Register Automata with Permutations
Abstract
We propose Permutation Deterministic Register Automata (pDRAs), a deterministic register automaton model where we allow permutations of registers in transitions. The model enables minimal canonical representations and pDRAs can be tested for equivalence in polynomial time. The complexity of minimization is between GI (the complexity of graph isomorphism) and NP. We then introduce a subclass of pDRAs, called register automata with fixed permutation policy, where the register permutation discipline is stipulated globally. This class generalizes the model proposed by Benedikt, Ley and Puppis in 2010, and we show that it also admits minimal and canonical representations, based on a finite-index word equivalence relation. As an application, we show that for any regular data language , the minimal register automaton with fixed permutation policy recognizing can be actively learned in polynomial time using oracles for membership, equivalence and data-memorability queries. We show that all the oracles can be implemented in polynomial time, and so this yields a polynomial time minimization algorithm.
Keywords and phrases:
Register automata, data words, equivalence, minimization, active learningFunding:
Mrudula Balachander: Research Fellow at F.R.S.-FNRSCopyright and License:
2012 ACM Subject Classification:
Theory of computation Formal languages and automata theoryEditors:
Paweł Gawrychowski, Filip Mazowiecki, and Michał SkrzypczakSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Automata for words and trees over infinite alphabets have been extensively studied in the literature [9, 24, 23]. Automata operating over infinite alphabets are not as robust as finite automata (for example, non-determinism usually brings extra computational power), and that has led to introducing various models, with different expressiveness and algorithmic properties. However, register automata, introduced as finite memory automata by Kaminksi and Francez [13], are perhaps one of the most studied models of automata over infinite alphabets. They can naturally model systems processing sequences of data, which have to be stored and compared with respect to (dis)equality. Register automata (RAs) over an infinite dataset are finite-state automata extended with a finite set of registers. When they read a sequence of data from , data can be stored in the registers and compared against the data already in memory. Deterministic register automata (DRAs) enjoy better algorithmic properties than their non-deterministic counterparts, such as closure under complementation and a decidable equivalence problem. The class of languages recognized by DRAs are sometimes called regular data languages. In this paper we are interested in two fundamental questions about regular data languages: whether there is an effective, machine-independent representation thereof which is concise and enjoys good complexity bounds with respect to standard decision problems (such as the equivalence problem); and, in addition, the representation naturally yields a canonical and minimal representative.
Register automata models come in various guises, with some formalisms giving emphasis on succinctness (i.e. ability to write a concise automaton for a given language) and others on efficiency (ability to decide standard problems efficiently). For example, allowing registers to store duplicate data enhances succinctness [8], while ensuring that registers do not contain duplicate elements and cannot be empty yields a polynomial time equivalence checking routine (for deterministic automata) [17].111(Language) Equivalence is undecidable for non-deterministic RAs [19]. For deterministic ones, the problem is coNP-C if we allow empty registers [22, 16], and PSpace-hard if we cater for duplicate register content [10]. The problem is lowered to PTime by disallowing both features [17]. One could argue that there is an antagonism between the two notions: succinctness requires flexibility in how data are manipulated, whereas efficiency benefits from a restricted set of options. Part of the contribution is to show that this is not the case, and our automata strike a balance between the two notions.
Regular languages (over finite alphabets) are characterized by having finite-index Myhill-Nerode equivalence relations on words. This machine-independent characterization naturally yields a canonical and state-minimal DFA for any regular language. Minimization of register automata presents challenges related to choosing unique representatives for states that are equivalent up to data permutation, and ensuring the operations of the automata are compatible with said choice of representatives. To the best of our knowledge, the first extension of this result to regular data languages was given in [4], using the notion of memorable data (data that need to be stored to recognize a language). Moreover, [4] introduces a class of DRAs where, in each transition, registers are permuted so that their order follows the order of the last appearance of their data. We call this class Lar-DRA. For any regular data language, there exists a canonical Lar-DRA which is both state-minimal and register-minimal. The time complexity of minimizing Lar-DRAs is known to be exponential [4].
Register automata with permutations.
In this paper, we propose a new model of register automata whose equivalence problem is in PTime like the automata in [17] (called herein MRT-automata), which admits canonical and minimal representatives like Lar-automata, and which is exponentially more succinct than both models. The model, called deterministic register automata with permutations (pDRAs), is an extension of MRT-automata with the possibility of applying permutations on the registers. No duplicate values in registers nor empty registers are allowed, although some registers can be dropped (become unavailable) in some states. When reading a datum from the infinite alphabet , a pDRA can test whether it is already stored in some register , or it is fresh (not stored in any register). In the latter case, the pDRA assigns the fresh datum to some register. In both cases, a permutation (which depends on the transition) is applied on the registers to permute their content. The content of unavailable registers is deleted.
Example 1.
Let and
where is the identity permutation and is the order-reversing permutation. It is recognizable by a pDRA (illustrated in Figure 1) with states and at most available registers. By setting to be accepting and redirecting the last transition towards instead of , the modified pDRA recognizes . Since has no available registers, coming back to has the effect of deleting the whole memory.
Outline.
We study language-related properties of pDRAs. After showing that pDRAs are exponentially more succinct than MRT-automata and Lar-DRAs, we look at generalizations of known results in the pDRA setting. We show that pDRAs have membership, emptiness, equivalence and data memorability problems in PTime.
We then focus on mimimization and show that pDRAs have minimal and canonical representatives. We prove that pDRAs can be minimized in exponential time. The associated decision problem is in NP and we prove that it is as hard as the graph isomorphism problem.
The barrier in efficient minimization motivates a subclass of pDRAs, that we call pDRAs with fixed register policy. In this model, permutations applied to registers only depend on the number of available registers and the register test. Therefore, any fixed register policy determines a class of pDRAs, which we denote -DRAs. Additionally, in a -DRA, registers are ordered and data are required to be stored in consecutive registers. For instance, the model of [4] coincides with Lar-DRAs, where Lar is a policy ensuring that registers are ordered by last occurrence of their contents.
As an equi-expressive particular case of pDRAs, -DRAs inherit some of the properties of pDRAs, such as PTime equivalence (improving the exponential upper bound of [4] as a special case). Our next contribution is a Myhill-Nerode congruence for -DRAs, which yields canonical and minimal -DRAs for any regular data language. This generalizes the results of [4] with a different approach based on abstract residual languages. In some sense, compared to Lar-DRA, our result shows that the last appearance policy is not necessary to obtain a canonical and minimal model: fixing a register policy is actually sufficient.
We use the results gathered for -DRAs, either directly or by inheritance from pDRAs, to set up an active learning framework for regular data languages, in the spirit of and algorithms for DFAs [1, 25]. We show that any regular data language can be learned in polynomial time, using polynomially many queries (in the size of the minimal -DRA for ) to oracles of three types: equivalence, membership and memorability. The latter asks, given a word and a datum in that word, whether it is memorable or not. Our learning algorithm returns a minimal -DRA for , and, since the oracles can be implemented in PTime, this also yields a PTime minimization algorithm for -DRAs, for any fixed policy .
In summary, we start by introducing pDRAs. After establishing standard results (beginning of Section 3), we delve into distinctive features of pDRAs and their -DRA subclass, and develop novel results and algorithms. Our strongest contributions include:
-
Memorability problem in PTime (Section 3). This is important for efficient minimization and learning.
-
Canonical representatives for both pDRAs (Section 4) and -DRAs (Section 5) based on equivalence relations on data words, in the spirit of Myhill-Nerode relations. We are able to construct automata that are minimal both in the number of states and in the number of registers. The minimal pDRA for a language is unique once the order in which data that need to be memorized has been fixed (see Remark 20).
-
PTime active learning for -DRAs (Section 6).
Related work.
A succinct register automata model has been developed in [8], where succinctness is achieved by allowing registers to contain duplicate elements. As mentioned earlier, this comes at the cost of a PSpace-hard equivalence. A different approach to obtain a Myhill-Nerode characterisation of regular data languages was proposed in [6, 7], in terms of deterministic nominal automata, which are equi-expressive as deterministic register automata [5]. Nominal automata are finite-state automata recast within the universe of nominal sets [21], and where finiteness is generalized to orbit-finiteness. That approach offers neat generalizations of standard constructions and algorithms from finite-state automata to nominal automata (e.g. learning with [14]). On the other hand, the inner-workings of nominal automata and their algorithms are reliant on nominal-sets reasoning, such as equivalence under data-permutation, which introduces a level of indirection. Libraries dedicated to nominal-sets reasoning are available to that effect, though in terms of theoretical complexity and practical benchmarking, direct custom-made register-automata algorithms are typically faster [18, 3]. To represent nominal automata outside nominal sets, a representation scheme akin to a register discipline is essentially needed. However, as argued in [7, Sec. 6.2], extending finite automata with registers implicitly puts a linear order on the stored data, which is incompatible with minimality in the sense of Myhill-Nerode. Adding register permutations on transitions solves this problem and it turns out that minimal orbit-finite nominal automata (with straight state sets) and minimal pDRAs have same number of states (we thank the anonymous reviewer for pointing this connection out).
The problem of minimisation of systems dealing with data coming from an infinite alphabet has been studied extensively in the setting of -calculus processes and in particular using History-Dependent Automata (HDAs) [15, 20]. Those works can be seen as precursors of the research in register automata and nominal automata. While the focus had been on mobile processes and bisimulation, rather than language acceptance, HDAs brought up central issues inherent in minimising systems with data, namely picking a canonical order of storing data and dealing with symmetries between stored data. Moreover, HDAs first featured transitions with reassignment of registers (names, in HDA terminology), of which the permutations we use in pDRAs can be seen as a special case.
The problem of learning register automata has been previously considered in [12, 11, 2]. The learner in [2] addresses Lar-DRA and works in a passive framework, i.e. without relying on the active interaction with an oracle (but only on positive and negative samples). Within active learning, the state of the art learner in [11] (improving on [12]) addresses the model in [8] and is exponential in both the number of registers and the length of the longest counterexample provided by the teacher. We already mentioned nominal (called ) for learning nominal automata [14]. This has membership query complexity exponential in the number of states and registers (or longest counterexample, see loc. cit.). Note, however, that the learning algorithms above do not use a memorability oracle.
2 Data word languages and register automata with permutations
In this section we introduce our register automata model. We start with some preliminaries.
Numbers, sets, relations.
For , we let be the set . Note that when .
We let be the powerset of .
Given a set , a permutation over is a bijection from to itself (), whereas a partial permutation over is
a bijection for subsets (we write ).
For any relation , we define its domain as and its range as .
Given , we may write for the restriction .
For any two relations , we define their composition
as . For any and , we define the update
.
Data alphabet, data words and nominal sets.
We fix an infinite alphabet of data. Data are ranged over by and variants, or by and variants, while sometimes we may simply use numbers . A data word is a finite sequence . We denote by the empty word, the length of , and the th datum in (). We sometimes see as a function . A data permutation is a bijection fixing all but finitely many elements of ; we write for the set of data permutations. Given , we write for the data permutation that swaps and , and fixes other data.
A nominal set [21] (over ) is a set along with a group action , that is, for each data permutation and , we have . We say that a set is a support of if, for all permutations , if for all then . We stipulate that all elements of a nominal set have finite support. Finite support is closed under intersection and, hence, each element of a nominal set has least finite support which we denote by . We say that is equivariant if , i.e. for all . For a subset of a nominal set and any , we write for the set obtained from by applying elementwise on it: .
The set of data words is a nominal set, with action . For any , we can see that . Note that a set of words has finite support just if there is finite such that, for all , if for all then . We write for the least finite support of . is called a data language if it is equivariant, that is, if it has empty support, i.e., it is closed under data permutation. Given , we write if there exists such that .
Registers and register permutations.
In this paper registers are represented by natural numbers ranging over for some , and register assignments are partial injective mappings . We observe that if are two register assignments, then is a partial permutation over which identifies registers holding the same data: .
For any , we let be the group of permutations on . We write for the identity permutation on . We may write permutations using sequence notation, i.e. as , for . Given a partial permutation its canonical extension is the permutation obtained by setting: if ; and if and ( stands for the -fold composition ); and, finally, if . Put otherwise, extends by closing maximal paths in and by being the identity everywhere else. In particular, given sequences of pairwise distinct elements , for some , we write for the canonical extension to of the map .
Definition 2.
A deterministic permutation register automaton (pDRA) is a tuple , where:
-
is a set of registers (with );
-
is a finite set of states, is the initial state, and are final states;
-
is an availability function, such that ;
-
is a pair of partial transition functions of types:
-
–
-
–
-
–
We write for , and for . Transitions are subject to the following availability condition. Whenever :
-
if then and ;
-
if then .
We say that is complete if is total and, for all , it holds that .
Remark 3.
Let be a pDRA as in the definition above. The automaton operation relies on states and registers, with each state being equipped with a set of registers that are available at that state. During its operation, the automaton maintains a register assignment, which is an injective map from available registers to data (i.e. ). Given a state and assignment , for any input datum :
-
If is stored in some available register, say with , and , then the automaton reads and moves to state . Its register assignment will be updated by applying the permutation on its registers and discarding those registers that are not available in (i.e. the content of registers in gets deleted).
-
If is a locally fresh datum (i.e. ) and , then the automaton reads and moves to state . The register assignment is updated by storing in register (rewriting the existing contents if were available), then permuting registers by and finally discarding those registers that are not available in .
Configurations, runs and languages.
A configuration of a pDRA is a pair , where and is a register assignment, defined as a (total) mapping from to data. We denote by the set of configurations of . Transitions between configurations are modeled as a labelled transition system , whose elements are denoted by , for . We let , when one of the following holds:
-
, for some , and (Equality)
-
, , and (Disequality)
Note that, due to the availability condition, the assignment is in both cases well defined.
A run of a word on is a sequence of transitions where and is the initial configuration, defined as where is the register assignment with empty domain. The pDRA is deterministic in the sense that there is at most one transition per datum : given a configuration , there is at most one configuration such that .
Additionally, we also note that the transitions preserve the “injectivity” of the register assignments. Indeed, the transitions do not change the data stored in the registers but merely rearrange the storage or delete some values. New data are stored via transitions, which ensures that the new datum differs from all existing stored values in registers.
If is a data word and has a run on from a configuration to a configuration , then we write . The language recognised by is defined as . Accordingly, the language recognised by is defined as .
Definition 4.
We call regular data language any data language which is recognized by a pDRA. Given a data word and a language , the residual of by is the set .
Note that while every data language is equivariant, may not necessarily be so, although .
MRT-automata [17] are the permutation-free restriction of pDRAs, i.e. only the identity permutation is used. This restriction severely affects succinctness, as witnessed e.g. by the family of languages .
Lemma 5.
pDRAs are exponentially more succinct than MRT-automata.
Remark 6 (Deterministic).
MRT-automata are equi-expressive as (deterministic) register automata [13], and so pDRAs can recognize any language recognizable by an MRT-automaton or a register automaton. Conversely, having permutations on transitions only brings succinctness, but no additional computational power. In fact, they can be simulated by hardcoding the order of the registers in the state space, at the price of an exponential blow-up. Alternatively, the configuration graphs of pDRAs correspond to nominal automata with straight state sets, which are equivalent to orbit-finite nominal automata and register automata [5].
3 Decision problems for register automata with permutations
We now examine basic decision problems for pDRAs. We shall assume that equality and disequality tests are done in constant time. We start with a result that can be lifted directly from finite-state automata. The membership problem asks, given a pDRA and data word , if holds. The non-emptiness problem asks, given a pDRA , if .
Lemma 7.
For pDRAs, membership is in PTime, while non-emptiness is in NLogSpace.
We next look at three related notions of equivalence.
- Bisimilarity
-
Let be a pDRA, and its associated labelled transition system, as defined in Section 2. A relation is a bisimulation if for every it holds that, for each and , there exists such that . Two configurations and are bisimilar, denoted by , if there exists a bisimulation where . The bisimilarity problem is defined as follows: given two configurations of a given pDRA , decide if holds.
- Residual equivalence
-
This problem asks: given two pDRAs and and two configurations of and respectively, decide whether holds.
- (Language) equivalence
-
Finally, for this problem, given two pDRAs and , we need to decide whether holds. This is a special case of residual equivalence.
We note that, as pDRA are deterministic, the residual equivalence problem can be reduced to checking bisimilarity in a slight modification of the disjoint union of and .
Theorem 8.
Bisimilarity, residual equivalence and (language) equivalence are all in PTime for pDRAs.
The methodology we use to prove this bound for bisimilarity is closely related to [17]. It is based on building a candidate bisimulation relation on the fly, and relying on a group-based representation of its equivalence classes to keep the representation in polynomial space, and invoking PTime-subroutines from computational group theory (e.g. for group membership). Then, the bound for residual (and plain) equivalence follows from the observation above relating this problem to bisimilarity in the deterministic setting.
In the remainder of this section we study a notion describing the data that “must be remembered” when processing data words [4].
- Memorability
-
Given a data language , a word and a datum , we say that is -memorable in if . We let be the set of all -memorable data of , i.e. .
- Frugality
-
We say that a pDRA is frugal if, for all configurations , .
- Minimality
-
A pDRA is called state-minimal if there is no with less states than such that . It is called minimal if it is complete, frugal and state-minimal.
We can see that frugality essentially requires that all names stored in registers inside any configuration be -memorable (in all words reaching said configuration).
A more useful algorithmically version of memorability is given below. We use it to show that any pDRA recognizing a language has to store at least the -memorable data, thereby justifying the term “memorable”. In Section 4 we show that it suffices to store only -memorable data.
Lemma 9.
The following hold:
-
1.
Let be fresh in . Then is -memorable in iff .
-
2.
Let be a pDRA recognizing a language , and be the configuration reached by upon reading a word . Then .
Proof.
For 1, by nominal sets reasoning, iff for any fresh .
For 2,
suppose there exists such that
. By 1, . However, as is fresh in and is not
stored in , both and reach the same configuration , which
implies , contradiction.
Example 10.
We can see that for any . Next, consider the language:
then, for all and , . For all such that , , because can always be completed
by a suffix ending by (so ), or by a different ending (so ).
On the other hand, consider the language of all words
where the first and last element are repeated and distinct:
then, for all and , we have and . Note that is -memorable in , as, for instance , while . We also have . Indeed, is -memorable (as above), while for we have whereas for any .
The memorability problem asks, given as input a pDRA , a word and a datum in , whether is -memorable in .
Theorem 11.
The memorability problem is in PTime for pDRAs. Moreover, any pDRA can be transformed, in polynomial time, into an equivalent frugal pDRA with the same number of states and transitions.
Proof.
For the first claim,
following Lemma 9, take any datum
fresh in . It suffices to compute the configurations
and reached by the pDRA on reading and
respectively, and check if holds, which is in PTime (cf. Theorem 8).
For the second claim, we only provide a proof sketch.
We show that the set of registers which contain the memorable data in a configuration, only depends on the state of the configuration. This allows one to turn any pDRA into a frugal one.
4 Minimal register automata with permutations
In this section, given a data word language , we define a Myhill-Nerode equivalence relation on data words, which is shown to have finite index iff is recognizable by a pDRA. Based on this equivalence relation, we show how to construct a unique and minimal pDRA. This generalizes the results of [4] to pDRAs.
For any two data words , we write whenever holds. Moreover, we recall that .
Definition 12 (Data word equivalence relation).
Given a data language and two data words , we say that and are -equivalent, written (or just if is clear from the context), whenever there exists a data permutation such that , i.e, for all , .
Proposition 13.
is an equivalence relation.
We may write to emphasize in the definition above, however is not an equivalence relation in general. We can immediately see the following.
Lemma 14.
If , then . Hence .
Proof.
Since , we have . By nominal sets reasoning (see e.g. [21, Ch. 2]), we have . Hence .
We illustrate data word equivalence via a simple albeit non-trivial example. We then focus on the suitability of this relation as a Myhill-Nerode equivalence relation.
Example 15.
Consider the language . Let . There are six equivalence classes: . Any non-empty word which is not a prefix of some word in is equivalent to . Now, holds for any data permutation which swaps and . Indeed, , and . Finally, as they are both in .
Theorem 16.
A language is recognizable by a pDRA iff has finite index.
Proof.
Let be a pDRA recognizing . Take any state and
let be such that: and .
Since are injective (as by definition of pDRA, there are no duplicates in register assignments), there exists a data permutation such that .
Then, from we get . Therefore, , i.e. . This implies that has finite index.
The other direction is based on the construction of a canonical automaton explained below.
Construction of a canonical automaton.
Let us assume that has finite index. For each equivalence class of , let be some representative of and a register assignment. For any word , we hereby denote by its -equivalence class. We now construct a minimal pDRA recognizing , whose states are the chosen class representatives, with the following invariant (shown in Lemma 18 below): on reading any word , reaches configuration for some such that . We construct the minimal pDRA as follows:
-
the number of registers is (it exists by Lemma 14);
-
, for all , and ;
-
;
-
is defined as follows. Let be some representative and . After a successful equality test with register , the automaton goes to state where and . So, we add the transition for some that we now construct. The registers need to permuted to account for the fact some data of may need to be deleted (if they are not memorable in ), and the fact that and have equal residual languages up to some permutation . Let , and such that . Let . Note that , and . Then, is defined to be a canonical extension of to .
-
is defined similarly as , we let where for any fresh datum, and is a canonical extension of to , for . So, is stored in the first available register (), before the permutation is applied.
Note that is complete. We illustrate this construction with the following example.
Example 17.
Consider again the language of Example 15, where we have defined representatives for the six equivalence classes of . Note that, , , and . We depict in Figure 2 the canonical automaton obtained for those representatives and chosen assignments , , and . Looking at the transitions, consider for instance source state and test on register . The transition goes to state . As , the permutation is a canonical extension on domain of , i.e. transposition . Consider now a test on register . The next state is the representative equivalent to , i.e. , as for any swapping and . So, the permutation is , i.e. the identity on .
We finally prove that and that the automaton is minimal. For this, we use the fact that runs of compute the -equivalence class of the word they read.
Lemma 18.
-
1.
For all words , if reaches configuration on reading then there is some such that: , , and .
-
2.
and is minimal.
Proof.
For space reasons, we only prove 2 here.It is immediate as a consequence of 1 that . Indeed, iff the state reached by on is
accepting, iff , iff for some , iff , iff as is equivariant.
We prove that is minimal. First, is complete by definition. It is frugal by 1, as registers contain exactly the
memorable data (and it is necessary as proved by Lemma 9).
If it is not state minimal, then there
exists a pDRA with less states than the index of
recognizing . Therefore, there exist two inequivalent words
which respectively reach two configurations
and with the same state . As shown in
the proof of Theorem 16, this implies that
, contradiction.
Minimization of pDRAs.
Minimizing a pDRA recognizing a language can be done in EXPTime. Indeed, it suffices to apply the construction of the canonical automaton step-by-step, starting from initial state , based on a subroutine deciding . From a state with chosen assignment created so far and for all data , the algorithm checks whether for some existing state , otherwise state is created, with being arbitrary. Whether holds, given and , can be decided in EXPTime: compute the configurations reached by on , and check if there exists a permutation such that . The latter can be done in PTime by Theorem 8. Note that due to the enumeration of register permutations, the minimization procedure is exponential only in the number of registers, which in turn is in PTime for a constant number of registers.
Whether we can do better than exponential time is a hard question. We can show that checking whether a complete and frugal pDRA is not minimal (called pDRA-nonMin problem) is at least as hard as the Graph Isomorphism problem (GI). GI is known to be in NP but not known to be in coNP.
Proposition 19.
pDRA-nonMin is GI-hard.
Remark 20 (Canonicity).
As mentioned above, the construction of a canonical automaton can be used to minimize any pDRA. The construction of only depends on the choices of the representatives and register assignments for the -memorable data of those representatives. So, once these choices have been fixed, any pDRA recognizing can be minimized into a unique pDRA . This justifies that is called canonical.
A minimal DFA recognizing a regular language is unique up to (automata) isomorphism. An interesting question is how minimal pDRAs recognizing a regular data language relate to each other, i.e. what is the right notion of isomorphism. It turns out that minimal pDRAs are isomorphic, for a notion of isomorphism which also takes into account permutations of the registers. Due to lack of space, we do not include this notion here. This notion is not simply a bijection which puts a correspondence between states while preserving transitions, as the order in which data are stored in registers also matters. Consider the language of words with at most two distinct data. When reading a word , with , any minimal pDRA recognizing either stores or . Our notion of isomorphism identifies configurations up to permutation of their registers, so that minimal pDRAs for are considered isomorphic, no matter the order in which memorable data are stored.
5 -DRAs: pDRAs with a Fixed Permutation Policy
We next consider the model obtained by syntactically restricting pDRAs to a fixed register assignment policy. Informally, a policy fixes permutations depending on the size of the memory and the test on this memory, only. So, it is not state nor transition dependent. In particular, when a pDRA is in some state with a memory , and reads a datum for some , then it applies a permutation to its registers before possibly deleting some data (this deletion is still transition-dependent) and proceeds to the next state. The gaps created by deletion are always removed by shifting all the data to an initial segment for the new memory size. Similarly, if read is fresh, then it is stored in register , and a permutation is applied to the registers.
We let a permutation policy be a function that takes as input the size of the memory and an index and returns a permutation . Given and we let be the permutation that shifts the elements of to the right, and those not in to the left, preserving their respective order. For example, is the permutation , and is the identity. Formally, if is the th (smallest) element of , otherwise, when , where . We just write when is clear from the context.
Definition 21.
Let be a permutation policy. A pDRA with registers is said to have fixed permutation policy , and called a -DRA , if for each state there is s.t. and, for all there are and with or , and s.t.:
-
if then ; and otherwise and ;
-
is (canonically extended to ), where and for some with .
Note that when applying transition , all the data stored in registers are moved to the segment and as a result are deleted. Also note that only depends on , , and , so when the permutation policy is understood from the context, we denote each transition as instead of .
Example 22.
A natural example of -DRA is when the policy always returns the identity permutation . An -DRA preserves the order in which the data were stored in memory. This can model processes where the memory is a queue of bounded size. It suffices to require that a datum read as input is deleted from memory when it is equal to the first memorized datum, or when it is fresh but the queue is full (otherwise, by definition of -DRA, the fresh datum can be stored in the last register only).
Example 23 (Lar-automata).
The model by Benedikt, Ley, Puppis in [4] is exactly a pDRA with fixed permutation policy Lar (for Last Appearance Record):
In other words, a Lar-DRA saves (distinct) values in its registers ordering them according to their last appearance. In [4], the authors define a Myhill-Nerode relation for data languages allowing them to construct a minimal and canonical Lar-DRAs for any regular data language, though in exponential time. We extend and improve this by showing that pDRAs with any fixed permutation policy admit a canonical model and can be minimized in PTime.
For the remainder of this section, let be some fixed permutation policy. Given an arbitrary pDRA, we can always hardcode the permutations in the states (modulo an exponential blow-up) to turn it into a -DRA.
Proposition 24.
Given a pDRA , one can construct a (possibly exponentially larger) -DRA such that . Moreover, if is frugal then so is .
The exponential blow-up is in general unavoidable. We can show that pDRAs are exponentially more succinct than Lar-DRAs. We conjecture the blow-up is unavoidable for any fixed permutation policy .
Lemma 25.
pDRAs are exponentially more succinct than Lar-DRAs.
Word of memorable data.
We introduce some notions towards an equivalence relation on data words, whose index corresponds to the minimal number of states that suffices for a -DRA to recognize a data language . A key ingredient, unlike in pDRAs, is that the order in which -memorable data are stored by a -DRA is canonical, i.e., it only depends on . Thus we can define, for any word , a word which orders the -memorable data of . We illustrate it for . Initially, . Consider a word where and . Then, .
In general, for an arbitrary policy , can informally be defined as the register assignment reached by any frugal -DRA recognizing and reading (modulo considering infinite state -DRAs, as is equivariant but not necessarily regular). Formally, , and is built from and as follows. First, let if is not -memorable in , and otherwise. Let be such that . The positions of are reordered, giving a word of same length, obtained by applying permutation on . Then, is obtained by applying on the erasing morphism which replaces any datum not in by .
Proposition 26.
The word is an enumeration of .
Abstract residual.
In the remainder of this section we fix a permutation policy . Given a sequence of distinct data and any object with finite support, we define the -abstraction of the latter as . Given a language and data word , we set . Note that unravelling the last part of the definition above we have .
Example 27.
Recall language from Example 10. For all :
Canonical -DRA.
Unlike , it can be shown that has empty support, as it abstracts away the memorable data of . Based on this abstract residual notion, we define the following word equivalence “up-to memorable data”.
Definition 28 (-equivalence).
Given a language and data words , we let be the word relation defined by if .
The following lemma states that refines .
Lemma 29.
If then there is some such that and, therefore, .
Remark 30.
The converse of Lemma 29 does not necessarily hold. For example, for , consider the language: .
Take such that . Then because . However, and , hence .
The next lemma formalizes the intuition behind the definition of .
Lemma 31.
Let be a frugal -DRA and a word such that reaches configuration when reading . Then, .
Proof.
By Lemma 9 and frugality we have that and contain the same data. Using induction on the length of , we can show that their data are in the same order.
We finally show a Myhill-Nerode theorem for -DRAs involving . Note that we can reformulate so that coincide with word equivalence as defined in [4]. Thus, Theorem 32 generalizes the result of [4] following an alternative route using abstract residuals.
Theorem 32.
A language is recognizable by a pDRA with fixed permutation policy iff has finite index.
Proof.
The R2L direction follows from Theorem 16, Lemma 29 and Proposition 24. In the next section (Theorem 34), we show that allows one to construct a unique minimal -DRA for (up to state renaming). We prove it via an active learning algorithm.
For the L2R direction, suppose is recognizable by a -DRA . By Proposition 24, we can assume that is frugal. Given two words suppose they reach configurations , and say and . Let be the data permutation mapping to component-wise. Then, and thus .
By Lemma 31, and
.
We thus have that: .
6 Active Learning and Minimization of -DRAs
Let be a language recognizable by a -DRA. We show that it is possible to learn in PTime a canonical and minimal -DRA for in the active framework [1, 25], relying on the answers to (polynomially-many) queries from oracles of membership , language equivalence and data memorability (see Section 3 for definition). Since the involved oracles can be implemented in PTime, this yields also a PTime minimization procedure for -DRAs.
We give some intuition and notation concerning the learning procedure for -DRAs. We assume that has an arbitrary linear order, which we extend to by length-lexicographic order. The -DRA learner maintains in the set of known (representatives of) distinct -classes. Initially, and each data-word added to , where , has the following property: either or is a fresh (minimal) value. Therefore somehow codes a tree-shaped subgraph of the canonical -DRA for . Moreover, the learner grows a sample-set , where and are sets of positive and negative samples respectively. Such sample-set is used to guarantee the invariant and to forbid the completion of the tree-shaped -DRA coded by with the addition of wrong transitions. A transition from to on (or fresh) is forbidden by if is apart from according to , written , formalized below.
Definition 33 (Apartness).
Two words are said apart according to a sample-set for , written , if:
-
either ,
-
or s.t. , but iff .
Recall that denotes that for some , that can be checked in PTime by inspecting whether and iff , for all .
Description of the (active) learning algorithm.
We describe the learning procedure, given by Algorithm 1. The set is initialized to , and to . Then the learner proceeds with the main loop consisting of three main steps.
The first step (lines 3-4) is a while-loop growing as long as there is such that any transition out from on (where or is a fresh minimal value), towards any , is forbidden by , in which case is added to .
In the second step (line 5), is used to construct a hypothesis -DRA. In particular, the tree-shaped -DRA coded by is used to build a complete hypothesis -DRA as follows. The set of states of is exactly . The membership oracle is used to set final states: is final iff . Let , and such that . If , then is apart from any in , and we let . Otherwise, is not apart from some , and we let (for chosen arbitrarily). The transition is added to , where is chosen so that it ensures holds in the LTS of configurations. The transitions in for fresh values are similarly set up.
In the third step (lines 6-8), the hypothesis is submitted to the equivalence oracle that either accepts it, or provides a counterexample . If accepts the hypothesis, the algorithm terminates and returns . Otherwise, the algorithm calls a procedure to process the counter-example, ProcessCEX This procedure returns a pair of samples witnessing that the current hypothesis contains a wrong transition. Adding to will forever forbid the latter wrong transition in future hypothesis. See the paragraph in the sequel for a more detailed description of ProcessCEX and its pseudocode. Hence, if a canonical -DRA for contains states, transitions and is the maximum number of available registers in any state, then the -DRA learner will perform at most iterations of the main loop, since this is the number of detectable wrong transitions. Finally, Theorem 34 states that -DRA_Learn is a correct polynomial learner for the class of -DRAs.
Theorem 34.
Given membership oracle , an equivalence oracle and memory oracle for regular data language , -DRA_Learn learns the unique (up to state renaming) minimal -DRA for in time polynomial wrt , , and the size of the longest counterexample returned by .
In turn, this yields a polynomial upper bound for minimizing a given -DRA as the oracles can be implemented in PTime, by Lemma 7, Theorem 8 and Theorem 11.
Corollary 35.
-DRAs can be minimized in PTime.
Note that the above result is for a fixed policy . A natural problem is to find, given a -DRA, a minimal -DRA amongst all the policies . However, the GI-hardness proof (Proposition 19) can be slightly modified to show that this latter problem is also GI-hard.
Counter-example processing.
A key ingredient for proving Theorem 34 is the correctness of the procedure ProcessCEX. We informally describe this procedure and state its correctness.
ProcessCEX is a recursive procedure whose first step is decomposing the input counterexample as , where is the longest prefix in . Being final iff , . If and , then is also a counterexample. Hence, we can eventually find a counterexample , with , , or : The last transition followed by reading was added (to the tree-shaped -DRA coded by ) by BuildHP. Let mapping to , for . If , then witness that is wrong. Otherwise, is a counterexample. Let be the longest prefix in of . Being , . So, ProcessCEX terminates, returning a pair of words to prevent forever a wrong transition.
Lemma 36.
The procedure ProcessCEX called at Line 7 terminates performing a number of recursive calls linear in the length of the input counterexample , and returning (an ordered version of) a set of two words such that:
-
, where , but
-
is the last transition followed by upon reading the word
-
but iff
7 Discussion
Our learning algorithm can be extended from -DRAs to pDRAs, modulo modifying the notion of apartness by quantifying over all permutations of memorable data. This would entail an exponential blow-up in the maximal number of memorable data. On the other hand, learning a pDRA can be done as follows: learn a -DRA in PTime, for some , and minimize it into a pDRA (in exponential time, and PTime if the maximal number of memorable data is constant). An interesting question is whether enumerating the permutations is avoidable (for minimizing pDRAs or learning them).
We have shown that minimizing pDRAs is hard for the graph isomorphism problem. It is also in NP, as pDRA equivalence can be checked in PTime. We leave this gap open.
An interesting direction is to find a register automaton model which admits polynomial time active learning without relying on a memorability oracle. All known active learning frameworks for register automata which do not rely on memorability oracles have exponential time complexity [12, 11, 14]. On the other hand, -DRAs can be minimized in PTime, can be checked for equivalence in PTime, have PTime memorability problem and admit passive learning in polynomial time and data (for ) [2]. The latter can be easily generalized to any fixed policy. This makes -DRAs a good candidate to actively learn regular data languages in polynomial time, without memorability oracles.
References
- [1] Dana Angluin. Learning regular sets from queries and counterexamples. Information and Computation, 75(2):87–106, 1987. doi:10.1016/0890-5401(87)90052-6.
- [2] Mrudula Balachander, Emmanuel Filiot, and Raffaella Gentilini. Passive Learning of Regular Data Languages in Polynomial Time and Data. In Rupak Majumdar and Alexandra Silva, editors, 35th International Conference on Concurrency Theory (CONCUR 2024), volume 311 of Leibniz International Proceedings in Informatics (LIPIcs), pages 10:1–10:21, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.CONCUR.2024.10.
- [3] M. H. Bandukara and Nikos Tzevelekos. On-the-fly bisimulation equivalence checking for fresh-register automata. J. Syst. Archit., 145:103010, 2023. doi:10.1016/J.SYSARC.2023.103010.
- [4] Michael Benedikt, Clemens Ley, and Gabriele Puppis. What you must remember when processing data words. In Alberto H. F. Laender and Laks V. S. Lakshmanan, editors, Proceedings of the 4th Alberto Mendelzon International Workshop on Foundations of Data Management, Buenos Aires, Argentina, May 17-20, 2010, volume 619 of CEUR Workshop Proceedings. CEUR-WS.org, 2010. URL: https://ceur-ws.org/Vol-619/paper11.pdf.
- [5] Mikołaj Bojańczyk. Slightly infinite sets. Draft version, September 2019. URL: https://www.mimuw.edu.pl/˜bojan/paper/atom-book.
- [6] Mikołaj Bojańczyk, Bartek Klin, and Sławomir Lasota. Automata with group actions. In Proceedings of the 26th Annual IEEE Symposium on Logic in Computer Science, LICS 2011, June 21-24, 2011, Toronto, Ontario, Canada, pages 355–364. IEEE Computer Society, 2011. doi:10.1109/LICS.2011.48.
- [7] Mikołaj Bojańczyk, Bartek Klin, and Sławomir Lasota. Automata theory in nominal sets. Log. Methods Comput. Sci., 10(3), 2014. doi:10.2168/LMCS-10(3:4)2014.
- [8] Sofia Cassel, Falk Howar, Bengt Jonsson, Maik Merten, and Bernhard Steffen. A succinct canonical register automaton model. J. Log. Algebraic Methods Program., 84(1):54–66, 2015. doi:10.1016/J.JLAMP.2014.07.004.
- [9] Loris D’Antoni. In the maze of data languages. CoRR, abs/1208.5980, 2012. arXiv:1208.5980.
- [10] Stéphane Demri and Ranko Lazic. LTL with the freeze quantifier and register automata. ACM Trans. Comput. Log., 10(3):16:1–16:30, 2009. doi:10.1145/1507244.1507246.
- [11] Simon Dierl, Paul Fiterau-Brostean, Falk Howar, Bengt Jonsson, Konstantinos Sagonas, and Fredrik Tåquist. Scalable tree-based register automata learning. In Bernd Finkbeiner and Laura Kovács, editors, Tools and Algorithms for the Construction and Analysis of Systems, pages 87–108, Cham, 2024. Springer Nature Switzerland. doi:10.1007/978-3-031-57249-4_5.
- [12] Falk Howar, Bernhard Steffen, Bengt Jonsson, and Sofia Cassel. Inferring canonical register automata. In Viktor Kuncak and Andrey Rybalchenko, editors, Verification, Model Checking, and Abstract Interpretation, pages 251–266, Berlin, Heidelberg, 2012. Springer Berlin Heidelberg. doi:10.1007/978-3-642-27940-9_17.
- [13] Michael Kaminski and Nissim Francez. Finite-memory automata. Theoretical Computer Science, 134(2):329–363, 1994. doi:10.1016/0304-3975(94)90242-9.
- [14] Joshua Moerman, Matteo Sammartino, Alexandra Silva, Bartek Klin, and Michal Szynwelski. Learning nominal automata. In Giuseppe Castagna and Andrew D. Gordon, editors, Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, pages 613–625. ACM, 2017. doi:10.1145/3009837.3009879.
- [15] Ugo Montanari and Marco Pistore. An introduction to history dependent automata. In Andrew D. Gordon, Andrew M. Pitts, and Carolyn L. Talcott, editors, Second Workshop on Higher-Order Operational Techniques in Semantics, HOOTS 1997, Stanford, CA, USA, December 8-12, 1997, volume 10 of Electronic Notes in Theoretical Computer Science, pages 170–188. Elsevier, 1997. doi:10.1016/S1571-0661(05)80696-6.
- [16] Andrzej S. Murawski, Steven J. Ramsay, and Nikos Tzevelekos. Bisimilarity in fresh-register automata. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Japan, July 6-10, 2015, pages 156–167. IEEE Computer Society, 2015. doi:10.1109/LICS.2015.24.
- [17] Andrzej S. Murawski, Steven J. Ramsay, and Nikos Tzevelekos. Polynomial-Time Equivalence Testing for Deterministic Fresh-Register Automata. In Igor Potapov, Paul Spirakis, and James Worrell, editors, 43rd International Symposium on Mathematical Foundations of Computer Science (MFCS 2018), volume 117 of Leibniz International Proceedings in Informatics (LIPIcs), pages 72:1–72:14, Dagstuhl, Germany, 2018. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2018.72.
- [18] Andrzej S. Murawski, Steven J. Ramsay, and Nikos Tzevelekos. DEQ: equivalence checker for deterministic register automata. In Yu-Fang Chen, Chih-Hong Cheng, and Javier Esparza, editors, Automated Technology for Verification and Analysis - 17th International Symposium, ATVA 2019, Taipei, Taiwan, October 28-31, 2019, Proceedings, volume 11781 of Lecture Notes in Computer Science, pages 350–356. Springer, 2019. doi:10.1007/978-3-030-31784-3_20.
- [19] Frank Neven, Thomas Schwentick, and Victor Vianu. Finite state machines for strings over infinite alphabets. ACM Trans. Comput. Log., 5(3):403–435, 2004. doi:10.1145/1013560.1013562.
- [20] Marco Pistore. History dependent automata. PhD thesis, University of Pisa, March 1999.
- [21] Andrew M. Pitts. Nominal Sets: Names and Symmetry in Computer Science. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 2013.
- [22] Hiroshi Sakamoto and Daisuke Ikeda. Intractability of decision problems for finite-memory automata. Theor. Comput. Sci., 231(2):297–308, 2000. doi:10.1016/S0304-3975(99)00105-X.
- [23] Thomas Schwentick. Automata for XML - A survey. J. Comput. Syst. Sci., 73(3):289–315, 2007. doi:10.1016/J.JCSS.2006.10.003.
- [24] Luc Segoufin. Automata and logics for words and trees over an infinite alphabet. In Zoltán Ésik, editor, Computer Science Logic, 20th International Workshop, CSL 2006, 15th Annual Conference of the EACSL, Szeged, Hungary, September 25-29, 2006, Proceedings, volume 4207 of Lecture Notes in Computer Science, pages 41–57. Springer, 2006. doi:10.1007/11874683_3.
- [25] Frits Vaandrager, Bharat Garhewal, Jurriaan Rot, and Thorsten Wißmann. A new approach for active automata learning based on apartness. In Dana Fisman and Grigore Rosu, editors, Tools and Algorithms for the Construction and Analysis of Systems, pages 223–243, Cham, 2022. Springer International Publishing. doi:10.1007/978-3-030-99524-9_12.
