Contents

Set Automata and Limits of Decidability of Two-Variable Logic on Data Words

The project

Showcase

All papers

Shibashis Guha, Amaldev Manuel and S P Rishal

ICALP 2026 (LIPIcs, vol. 374)DOI 10.4230/LIPIcs.ICALP.2026.181Theoretical computer science: Automata, logic, semantics and theory of programming

  • lipics-v2021 (or a renamed copy)
  • apxproof
  • centernot
  • changes
  • cite

CC BY 4.0, published at drops.dagstuhl.de. “Set Automata and Limits of Decidability of Two-Variable Logic on Data Words” by Shibashis Guha, Amaldev Manuel, S P Rishal, arXiv:2605.09077v1 (published in ICALP 2026, LIPIcs vol. 374, 10.4230/LIPIcs.ICALP.2026.181). Licensed under CC BY 4.0. Typeset here by reflowtex from the authors' source.

Changed to build here

Written for pdfLaTeX: UTF-8 text in an 8-bit font encoding; characters replaced by LaTeX's own definitions (t1enc.dfu, what pdfLaTeX's inputenc gives them), braced where the definition is a command. Under LuaLaTeX these characters reached the 8-bit font unchanged and were lost ("Missing character" in the log). Replaced outside comments, verbatim, listings and URLs: č (U+010D) -> \v c: 1 in the source (4 missing-character lines in the log before) ń (U+0144) -> \'n: 2 in the source (4 missing-character lines in the log before) ř (U+0159) -> \v r: 1 in the source (4 missing-character lines in the log before) – (U+2013) -> \textendash: 5 in the source (6 missing-character lines in the log before) After the change the plain LuaLaTeX build reports none of these characters missing, and its page count is unchanged. The source is CC BY 4.0, which allows modified copies with the change indicated: this file is that indication.

Set Automata and Limits of Decidability of Two-Variable Logic on Data Words

Shibashis Guha

Tata Institute of Fundamental Research

Amaldev Manuel

Indian Institute of Technology Goa

S P Rishal

Sarva Labs

Abstract

We extend the two-variable logic on data words [4] with guarded regular binary predicates of the form L(x, y) that is true if positions x and y are in the same class and the factor strictly between x and y is in the regular language L. We characterise the class of monoids for which the extension of the two-variable logic with guarded predicates recognised by the monoid is decidable, namely the class of idempotent monoids whose two-sided ideals are linearly ordered. For this, we introduce an automata formalism, set automata, that is equivalent to the class automata of Bojańczyk and Lasota and thus has an undecidable emptiness problem. We identify a subclass of set automata called ordered quasi-normal set automata that has a decidable emptiness problem by reduction to the emptiness problem of ordered multicounter automata. We show that the two-variable logic extended with guarded regular predicates recognised by a semigroup S is expressively equivalent to a quasi-normal set automaton with the semigroup of transformations S. In particular, if S is a linear band monoid then the resulting automaton is ordered, and the decidability result follows.

2012 ACM Subject Classification Theory of computation → Logic and verification

Keywords and phrases Data words, Two-variable FO, Class automata, Finite semigroups, Decidability

Funding Shibashis Guha: Partially supported by CEFIPRA project no. 7302-I and by the Department of Atomic Energy, Government of India, under project no. RTI4014

1 Introduction

A data word is a finite sequence of pairs (ai, di) ∈ Σ × D where Σ is a finite alphabet and D is an infinite domain of data values that can be tested only for equality. A set of data words L is called a data language. In most cases (including this work) L is assumed to be closed under permutations of the set D, that is, every occurrence of some data value di can be replaced with another data value dj = di as long as such a mapping is a permutation. Thus the specific data values considered are not important to the study and we only capture properties involving equality of data values. For our purposes, L can be represented as a collection of relational first-order structures of the form ([n], (a)a∈Σ, <, +1 ∼) , 1 where [n] and < denote the set {1, . . . , n} and the natural order on it, the unary predicates (a)a∈Σ denotes the labelling by Σ, and ∼ is the equivalence relation on positions given by data values, i.e., i ∼ j if di = dj. The relation 1 denotes the class successor relation, i.e., i 1 = j, if i ∼ j and the positions strictly between i and j are not equivalent to them. The class of i is the equivalence class of i under the relation ∼, i.e., the set of all positions labelled with the data value di.

The primary direction in the study of data words has been identifying suitable notions of automata and logics for them (See [2, 18] and the survey [21]). The models and logics in the literature can broadly be classified into two families: temporal logics (correspondingly, the register automata family) and first-order logics (data automata family). The prominent member of the first family is the freeze-LTL (i.e., LTL with registers) of [9], while the most important logic of the latter is the two-variable first-order logic [4]. In this work we present a decidable, strict extension of the two-variable logic that incorporates some aspects of temporal logics. First we recall the two-variable logic in some detail.

For a vocabulary τ of unary and binary predicates let FO2[τ] denote the first-order formulas using the predicates from τ and the variables x and y. The logic EMSO2[τ] consists of formulas of the form ∃X1 . . . ∃Xn ϕ with ϕ ∈ FO2[X, τ], where X stands for the monadic second-order predicates X1, . . . , Xn that quantify over sets of positions. Certainly, it is natural to consider the first-order logic (FO) with the vocabulary (Σ, <, ∼) on data words. However, as one would expect, the satisfiability problem of the logic FO[Σ, <, ∼] is undecidable [4]. The undecidability persists even if the number of variables is restricted to three. This prompted the study of the two-variable fragment of the logic. For convenience in working with automata, we consider the extension of the first-oder logics with existential monadic second-order predicates. It is shown in [4] that the satisfiability problem of EMSO2[Σ, <, +1, ∼, 1] is decidable over data words in non-elementary time. The proof is by translating the formulas into an automaton formalism called data automata and showing the decidability of the emptiness problem of data automata. As far as the study of logics over data words is concerned this result is a milestone and despite nearly two decades of active research, FO2 remains as one of the yardstick logics with which any new formalism is measured.

Next we look at some examples. The string projection of a data word w is the word str(w) = a1 · · · an. Let 1 ≤ i1 < i2 < · · · < ik ≤ n be a class of w. The string projection of this class is the word u = ai1 · · · aik. We say u is a class of w to mean a class whose string projection is u.

▶ Example 1. Let Σ = {ι, δ, z}. We can think of ι and δ as increments and decrements of a counter and z as a zero-test.

1. Let L1 be the set of all data words where each class is of the form ιδ or z. This language is defined by the formula ϕ1 where

ϕ1 := ∀x∀y (x < y ∧ x ∼ y → ι(x) ∧ δ(y)) ∧ ((x ∼ y → x = y) → z(x)) (1)

2. Let L2 consists of all data words satisfying the property: there is no position labelled by z between each ι and δ of the same class.

The language L2 is not definable in FO2 as noted in [21]. In fact it is not recognised by the data automata of [4], that is equivalent to the logic EMSO2[Σ, <, x + 1, ∼, 1] However, L2 is definable in freeze-LTL with only forward-looking modalities (Next and Until), a logic with a decidable satisfiability problem (as a trade-off this logic cannot define L1, see [21]).

To define L2 in FO2, we extend the two-variable logic with the below predicates.

▶ Definition 2 (Regular Predicate). A regular predicate over the alphabet Σ is a binary relation of the form L(x, y) where L ⊆ Σ∗ is a regular language. The word w = a1 · · · an ∈ Σ∗ at the pair of positions (i, j), for i, j ∈ [n], satisfies the predicate L(x, y) if i < j and the factor ai+1 · · · aj−1 given by the interval (i, j) is in L. A guarded regular predicate L(x, y) is equivalent to the formula x ∼ y ∧ L(x, y).

For a regular expression r, let r denote the language defined by it. Using regular predicates, the language L2 can be defined in FO2 by the below formula.

∀x∀y (ι(x) ∧ δ(y) ∨ δ(x) ∧ ι(y)) ∧ x ∼ y → ¬Σ∗zΣ∗(x, y) . (2)

The below example illustrates that adding regular predicates to the vocabulary leads to undecidability even when relatively simple regular predicates are used.

▶ Example 3. Let Σ′ = {ι1, δ1, z1, ι2, δ2, z2}. We can think of the alphabet as encoding the increments, decrements, and zero-tests of a two-counter machine.

1. Let L3 be the set of all data words satisfying the following property: each class is of the form ιiδi or zi, i ∈ {1, 2}. Clearly L3 is in FO2[Σ, <, +1, ∼].

2. Let L4 consist of all data words satisfying the following property: for each i ∈ {1, 2}, there is no position labelled by zi between each ιi and δi of the same class.

From Formula 2, it is not difficult to see that L4 is definable in FO2 using the guarded regular predicates defined by the languages Σ′∗z1Σ′∗ and Σ′∗z2Σ′∗. This is sufficient to encode the run of a two-counter machine as a data word.

The algebraic theory of regular languages where the semigroup recognising a language is considered, allows for properties of regular languages to be understood through the structure of the semigroup recognising it. Motivated by this, in the logic, we consider families of regular predicates defined by a semigroup recognising it.

A semigroup S is a set with an associative binary operation. It is a monoid if the operation has an identity, denoted by 1. All semigroups we consider in this paper are finite or free semigroups of the form Σ∗. Let M be a finite monoid. A morphism h : Σ∗ → M is a map satisfying h(ab) = h(a)h(b) and h(ε) = 1. A language L ⊆ Σ∗ is recognised by a morphism g : Σ∗ → M, where M is a finite monoid, if there is a finite subset P ⊆ M such that L = h−1(P). We also consider semigroups recognising languages. Let S be a finite semigroup and S1 be the monoid obtained by adjoining an identity 1 to S. The monoid morphism h : Σ∗ → S1 is unit-reflecting if h−1(1) = ε. We say a language L ⊆ Σ∗ is recognised by S if it is recognised by a unit-reflecting morphism into S1. A monoid M recognises a family F of languages over Σ if there is a morphism h : Σ∗ → M that recognises each language in the family. Definitions of other semigroup-theoretic notions required for our purposes can be found in Section A.

Let h : Σ∗ → M be a morphism. The logic FO2[Σ, <, +1, ∼, 1, Fh] is the extension of the logic with the family of regular predicates F = {L1, . . . , Lk} such that h recognises the family F. For a monoid M, by FO2[Σ, <, +1, ∼, 1, FM] we denote the set of formulas ϕ ∈ FO2[Σ, <, +1, ∼, 1, Fh] for some morphism h : Σ∗ → M. The logics FO2[Σ, <, +1, ∼, 1, Fh] and FO2[Σ, <, +1, ∼, 1, FM] are defined analogously where the predicates Fh = {L1, . . . , Lk} used are guarded. The above definitions extend naturally to semigroups and unit-reflecting morphisms.

▶ Example 4. The language family {Σ∗zΣ∗} from Equation (2) is recognised by the two element monoid with a zero U1 = {1, 0} under the usual product operation, with the morphism z → 0 and ι, δ → 1 and accepting set P = {0}. However, the family F = {Σ′∗z1Σ′∗, Σ′∗z2Σ′∗} is not recognisable by the monoid U1 as both languages cannot be recognised by the same morphism. However F is recognised by the product monoid U21 = U1 × U1 = {(1, 1), (1, 0), (0, 1), (0, 0)}. under the morphism z1 → (0, 1), z2 → (1, 0) with the accepting sets {(0, 1), (0, 0)} and {(1, 0), (0, 0)} respectively.

A key difference in the structure of the two monoids above is that in U1, the two-sided ideals (See Definition 49) are linearly ordered while it is not the case in U21 (See Figure 2). Motivated by this, we consider the class of idempotent monoids whose two-sided ideals are linearly ordered called linear bands, that is, for all two-sided ideals I, J, we have that I ⊆ J or J ⊆ I. The idempotency restriction follows from another such language that leads to undecidability (See Proposition 39).

The below example shows how guarded regular predicates parametrised by a family of monoids can be used to capture a previously known decidable logic introduced in [4].

▶ Example 5 (Nilpotent Predicates). Consider the monoid {0, 1, . . . , n − 1, ∞}, n ≥ 1 with the below operation where x + y is the usual addition over natural numbers.

x · y = x + y if x, y ∈ {0, 1, . . . , n − 1} and x + y < n, ∞ otherwise.

The unique morphism given by the map g : Σ → 1 (and g : Σ → ∞ if n = 1) recognises the family of languages {Σi | 1 ≤ i ≤ n − 1} ∪ {Σ≥n}. Thus the logic FO2[Σ, <, ∼, Fg] ≡ FO2[Σ, <, +1, +2, +3, . . . , +n, ∼]. The decidability of the latter logic is shown in [4].

Our Contributions

Our main result is as follows.

▶ Theorem 6. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, FM] formulas over data words is decidable if and only if M is a linear band.

Our decidable fragment is a strict extension of the FO2 of [4] as the language L2 of Example 1 is definable in the decidable fragment of Theorem 6 but not in the FO2 of [4]. The guardedness of the regular predicates does not impose a restriction on the expressibility in the following sense: for every formula in EMSO2[Σ, <, +1, ∼, 1, FM] with regular predicates recognised by a monoid M there is an equivalent formula in EMSO2[Σ, <, +1, ∼, 1, FM′] with guarded regular predicates recognised by another monoid M′. We state our results for the guarded regular predicates.

To show decidability of the logic, we employ a new automaton formalism called set automata. A set automaton A is a finite state automaton with a fixed number of sets X = {X1, . . . , Xk} that can store data values. During the run, the automaton can add or remove the current data value from the sets as well as assign a union of sets to each set (i.e. of the form Xi = j∈J Xj for J ⊆ [k]). The latter kind of updates can be represented as an element of a semigroup S of relations on the sets. The acceptance of a run is determined by the state as well as the sets in which the data values are present at the end of the run. The set automaton model is equivalent to the class automata of [5] and is thus undecidable. Also, it is noteworthy that data automata are equivalent to set automata whose semigroup of relations is trivial, that is, the only set update is used is the identity relation.

We identify a subclass of set automata with decidable emptiness, called ordered-quasi normal set automata. The decidability of emptiness of ordered quasi-normal set automata is shown by a reduction to the emptiness of ordered multicounter automata [20], which is known to be decidable. The complexity of the decision procedures for the logic EMSO2[Σ, <, +1, ∼, 1, FM] and set automata are non-elementary that is inherited from FO2[Σ, <, +1, ∼] and data automata.

We obtain decidability of the logic by converting EMSO2[Σ, <, +1, ∼, 1, FM] formulas where M is a linear band to ordered quasi-normal set automata. To show undecidability of the logic when M is not a linear band, we use a reduction from the halting problem of two-counter machines which is known to be undecidable [17].

Related Works

Automata on Data Words. There exists numerous extensions of finite state automata with registers [13], pebbles [18], hash tables [2], counters [16], sets [1, 12], etc. to handle data values (See the survey [21]). The bibliography is extensive and we mention only those relevant to our work. Register automata [13] and its variants [6, 9, 18] equip finite state automata with a fixed number of registers for storing data values and comparing them using equality. Set augmented finite automata [1], register set automata [12], and history register automata [10] are generalisations of register automata with unbounded registers (or sets in the present terminology). The latter two are equivalent to set automata except for the acceptance conditions. Class automata [5] are closely related to data automata and are expressively equivalent to set automata. A subclass of class automata captures the alternating one register automata of [9]. The decidable subclass presented in our work was previously unknown.

Logics on Data Words. As for FO2 on data words, the results in [4] are already mentioned. The related, but weaker logic EMSO2(Σ, ∼, +1) was studied in [14]. It was shown to be equivalent to a semantic restriction of data automata, called weak data automata. A weakening of MSO logic with data equality tests called rigidly guarded MSO was introduced in [7]. It was shown that it is as expressive as orbit finite data monoids [3] and its satisfiability is decidable. A µ-calculus that has modalities corresponding to successor, predecessor, class successor and class predecessor relations was introduced in [8].

Organisation of the Paper

The paper is organised as follows. Section 2 introduces set automata and its various restrictions namely normal, quasi-normal, and ordered automata. We also prove the necessary closure properties required to translate guarded EMSO2 formulas to quasi-normal set automata. Subsequently, in Section 3 we establish the automata-logic connection. Section 4 details the decidability and undecidability results concerning the guarded fragment. Section 5 discusses alternative accepting conditions for set automata, translations between class automata and set automata. In Section 6 we conclude. Standard facts from the theory of Green’s relations on finite semigroups, and definitions of basic relations like preorder, partial order, and other related notions are given in Appendix A. Finally, to improve readability, we have moved some proofs to the Appendix.

2 Set Automata

In this section, we introduce set automata, and the subclasses normal, quasi-normal, and ordered set automata. As our main result, we show that the emptiness problem of ordered normal set automata is decidable.

2.1 Relations and Transformations

First, we recall some preliminaries used in the rest of the paper.

For k > 0, let [k] denote the set {1, . . . , k}. The set of Boolean values is denoted by 𝟚 = {0, 1}. Let Y be a finite ordered set. A column vector u = (uy)y∈Y indexed by Y is an element of 𝟚Y. For a subset Y′ ⊆ Y, the restriction of u to Y′ is given by u ↾Y′= (uy)y∈Y′.

The set of column vectors over 𝟚 indexed by Y is denoted by 𝟚Y. The Boolean operations can be extended to elements of 𝟚Y pointwise. For u ∈ 𝟚Y, we denote by uc = (1 − uy)y∈Y the complement of u. For y ∈ Y, let ey ∈ 𝟚Y denote the vector whose y-component is 1 and all other components are 0. The vectors {ey | y ∈ Y} are called unit vectors.

Let S be a set. For a subset X ⊆ S, let 1X : S → 𝟚 denote the characteristic function given by 1X(x) = 1 if x ∈ X and 1X(x) = 0 otherwise. Extending this notation, for X = (Xy)y∈Y ∈ P(S)Y a vector of subsets of S indexed by Y, let 1X : S → 𝟚Y denote the function x → (1Xy(x))y∈Y. The vector 1X(x) is called the characteristic vector of x in X.

A binary relation ρ on a set Y is a subset of the cartesian product Y × Y. We simply write relation instead of binary relation. The converse of a relation ρ is the relation ρ−1 = {(y, x) | (x, y) ∈ ρ} where the order is switched. For a subset Y′ ⊆ Y, the restriction of ρ to Y′ is ρ ↾Y′= ρ ∩ (Y′ × Y′). The image of an element x ∈ Y under the relation ρ is the set ρ(x) ⊆ Y given by ρ(x) = {y ∈ Y | (x, y) ∈ ρ}. Similarly, the image of a subset S of Y under the relation is given by ρ(S) = x∈S ρ(x). A transformation on a set is a function from the set to itself. A bijective transformation is called a permutation. Given relations ρ and σ on the set Y, their relation composition or product ρσ is given by ρσ = {(x, z) ∈ Y × Y | ∃y ∈ Y, (x, y) ∈ ρ, (y, z) ∈ σ}.

▶ Example 7. Let ρ = {(0, 0), (0, 1), (1, 1)} and σ = {(0, 0), (1, 0)} be relations on the set Y = {0, 1}. Then ρσ = {(0, 0), (1, 0)} and σρ = {(0, 0), (0, 1), (1, 0), (1, 1)}.

The omission of ◦ to denote the product operation is intentional. When ρ and σ are functions then their function composition ρ ◦ σ is the function ρ ◦ σ = σρ that is different from their product ρσ. The product of relations is an associative operation and the relations on a set Y form a monoid with the identity function idY = {(y, y) | y ∈ Y} as the identity element. Let RY and TY denote the monoid of relations and transformations on the set Y, respectively.

A relation ρ over Y is naturally viewed as a Boolean matrix M(ρ) = (mij)(yi,yj)∈Y×Y where mij = 1 if (yi, yj) ∈ ρ and 0 otherwise. Conversely, for every Boolean matrix M there is a corresponding relation ρ(M) such that M(ρ(M)) = M. It is easy to verify that M(ρσ) = M(ρ) · M(σ). We denote by MT the transpose of a matrix M.

2.2 Set Automaton

▶ Definition 8 (Set automaton). A set automaton A is a tuple (Q, Y, Σ, ∆, I, F, C) where Q is the finite set of states, Y is a finite set of names for sets, and Σ is the input alphabet. The transition relation is given by ∆ ⊆ Q × Σ × 𝟚Y × RY × 𝟚Y × 𝟚Y × Q. The initial and final sets of states are respectively I ⊆ Q and F ⊆ Q. Finally, C ⊆ 𝟚Y is the family of accepting vectors of membership of data values.

A configuration of the automaton A is a pair γ = (q, X) where q ∈ Q is a state and X = (Xy)y∈Y ∈ P(D)Y is a vector of subsets of data values. A data value d is said to be present in X if it is in Xy for some y ∈ Y. A configuration is initial if q ∈ I and Xy = ∅ for each y ∈ Y.

When the automaton is in a configuration γ, on the input pair (a, d) ∈ Σ × D, the transition (p, ℓ, z, ρ, u, v, p′) ∈ ∆ is applicable if p = q, ℓ = a, and z = 1X(d), that is, the characteristic vector of membership of the data value d is z. The set or global update is given by the relation ρ ∈ RY. The global update ρ removes the contents of each set x and copies it to each set y ∈ ρ(x). This results in the vector of subsets of data values stored in the sets of A, X′ = (X′y)y∈Y where X′y = x∈ρ−1(y) Xx. Further, for each data value d′ ∈ D, we obtain the characteristic vector of membership 1X′(d′) = M(ρ)T · 1X(d′) after the global update. The local updates are given by the vectors u, v ∈ 𝟚Y. The local updates are applied on the contents of the sets given by X′, with the current data value d added to the sets given by u and removed from the sets given by v. Let U, V ∈ P({d})Y be such that u = 1U(d) and v = 1V(d). This results in the configuration (p′, X′′) where X′′ = (X′′y)y∈Y is given by X′′y = (X′y ∪ Uy) \ Vy for each y ∈ Y.

A configuration (q, X) is accepting if q ∈ F and the characteristic vector of each data value present in X is in C. A successful run of A on a data word w is a sequence of applicable transitions taking the automaton from an initial to an accepting configuration. The language of A, denoted as L(A), is the set of all data words w on which A has a successful run.

Let U(A) denote the set of global updates used in the transitions of the set automaton A. Let MA = ⟨U(A)⟩, called the update monoid of A, be the submonoid of relations on Y generated by U(A). Clearly MA is a submonoid of RY, i.e., MA ≤ RY.

▶ Example 9. Consider the language L12 = L1 ∩ L2 over the alphabet Σ = {ι, δ, z} where L1 and L2 are the languages described in Example 1. This language is accepted by a set automaton A with three sets Y1, Y2 and Y3. At any given position, the set Y1 contains all the data values d such that (ι, d) was read but a corresponding (δ, d) has not yet been observed. The set Y2 is used to track whether a z was observed between an ι and δ of the same class. In an accepting run, the set Y2 always remains empty. The set Y3 is used as a sink to track the data values of each class satisfying either of the above properties that have occurred in the run. The set automaton rejects whenever the current data value is present in Y3 as this signifies that a class is not of the form ι followed by δ or a single z. Whenever the position is labelled by an ι the automaton checks if the data value is not present in any of the sets and it is then placed in the set Y1 by local updates. Whenever a δ is read, the data value is ensured to be present only in Y1 and then is moved to Y3 by local updates. In both cases the global update is the identity. Whenever a z is encountered, we have to ensure that Y1 is empty to maintain property (2). This is accomplished by copying the data values in Y1 to Y2 by the global update ρ = {(Y1, Y2)} ∪ idY and adding the current data value to Y3 by local updates. Finally, the run is accepted if the sets Y1 and Y2 are empty.

2.3 Normal Set Automaton

A set automaton is normal if it maintains the following invariant throughout the run on each data word: each data value is present in at most one set. This is captured by the following syntactic definition.

▶ Definition 10 (Normal Set Automaton). A set automaton is normal if each of its transitions (p, ℓ, z, ρ, u, v, q) satisfy the following properties:

1. the set update ρ is a transformation, and,

2. u is a unit vector and if u = MT(ρ) · z then v = MT(ρ) · z, otherwise it is ¯0.

In a normal set automaton A with sets Y, since each global update is a transformation, the update monoid is a transformation monoid, i.e., MA ≤ TY. Further, for the same reason, data values in each set move to exactly one set. This, in combination with restricted local updates where the current data value can be added to at most one set ensures that each data value is present in at most one set throughout the run of a normal set automaton.

For every relation on a set Y, there exists a corresponding transformation on the set P(Y). A consequence of this is that every set automaton can be normalised.

▶ Example 11. Consider the relation ρ from Example 9 on the sets Y = {Y1, Y2, Y3}. This relation can be expressed as a transformation ρ′ on the sets P(Y) where each element represents a subset of elements in Y. For instance, the set Y(100) tracks the data values present in the set Y1 and not in Y2 or Y3, and the set Y(110) tracks the data values present in both Y1 and Y2 but not in Y3. The relation ρ on Y is captured by the transformation ρ′ on P(Y) as follows: ρ(Y1) = {Y1, Y2} is given as ρ′(Y(100)) = Y(110), ρ(Y2) = {Y2} as Y(010) → {Y(010)}, and ρ′(Y3) = Y3 as Y(001) → {Y(001)} respectively.

▶ Proposition 12. For each set automaton A with the family of sets Y there is an equivalent to a normal set automaton N(A) with the family of sets 𝟚Y \ {¯0}.

We now generalise normal set automata such that the invariant that each data value is present in at most one set is only maintained in the sets modified by global updates.

A set y of a set automaton is said to be stable if ρ(y) = {y} = ρ−1(y) for each global update ρ used in the transitions of the automaton.

▶ Definition 13 (Quasi-normal set automaton). Let A = (Q, Y, Σ, ∆, I, F, C) be a set automaton with the set of stable sets S ⊆ Y. The set automaton A is quasi-normal if the restriction A ↾(Y\S)= (Q, Y \ S, Σ, ∆′, I, F, C′) of A to the non-stable sets is a normal set automaton, given by the following: (p, ℓ, z′, ρ′, u′, v′, q) ∈ ∆′ if (p, ℓ, z, ρ, u, v, q) ∈ ∆ where z′ = z ↾(Y\S), ρ′ = ρ ↾(Y\S), u′ = u ↾(Y\S), and v′ = v ↾(Y\S), and C′ = {u ↾(Y\S)| u ∈ C}.

2.4 Ordered Normal Set Automaton

In this section, we introduce ordered normal set automata and show that they have a decidable emptiness problem by reduction to the emptiness problem of ordered multicounter automata. Further, we extend this result to ordered quasi-normal set automata.

Let A be a normal set automaton with the family of sets Y. In a set automaton, new data values are added to a set by local updates. On reading a data word of length n, a set of the automaton A can have n data values added by n local updates. Thus, in general the contents of a set is unbounded. However, this depends on the global updates used in the transitions of A allowing for such unbounded accumulation.

Let {ρi | i ∈ I} be the set of global updates used by transitions of A. Let ρ = ∪i∈Iρi be the union of the update relations and ρ+ denote the transitive closure of ρ. Consider the graph (Y, ρ+) and a set y ∈ Y. If there is no vertex z with (z, z) ∈ ρ+ that can reach y, then the induced subgraph consisting of the vertices Y′ ⊆ Y that can reach y is acyclic. For each vertex y′ ∈ Y′, we can show by induction that if the number of vertices from which y′ is reachable is k, then y′ contains at most k + 1 data values at each point during the run over a data word. Thus, we have the below definition.

▶ Definition 14 (Bounded set). Let A be a normal set automaton A with the family of sets Y. Let y ∈ Y be a set. In the graph (Y, ρ+), if no vertex z such that (z, z) ∈ ρ+ can reach y, then the set y is called a bounded set. A set y ∈ Y is called a bounded set if in the graph (Y, ρ+), there is no vertex z such that (z, z) ∈ ρ+ that can reach y.

We now introduce ordered normal set automata. The idea is to impose an order on the non-bounded sets of the automaton and restrict the global updates on the non-bounded sets such that they empty the contents of a prefix of sets and move them to sets higher in the order whose contents not emptied. Such global updates are simulated by an ordered multicounter automaton using its restricted hierarchical zero-tests on a prefix of counters corresponding to the sets emptied by the global update. The contents of the bounded sets are tracked by the ordered multicounter automaton without using zero-tests by maintaining the number of data values in each set in its finite state space.

Toward this, we recall the notion of an ordered partition. Let X be a set and ≤ be a linear order on it. For subsets Y, Y′ ⊆ X, we write Y ≤ Y′ to mean that y ≤ y′ for each y ∈ Y and y′ ∈ Y′. An ordered partition of X is a tuple (X0, X1) of disjoint subsets that cover X (i.e., X0 ⊎ X1 = X) such that X0 ≤ X1.

▶ Definition 15 (Ordered normal set automaton). Let A be a normal set automaton with family of sets YA and bounded sets ZA ⊆ YA. The automaton A is ordered if there is a linear order ≤ on YA such that YA \ ZA ≤ ZA, and for each global update transformation ρ used in the transitions there is an associated ordered partition (Y0, Y1) of YA \ ZA such that the tranformation ρ maps the elements of Y0 to Y1, and is the identity transformation on Y1. That is, the contents of each set in Y0 is emptied and moved to a set in Y1 and the contents of each set in Y1 are not emptied. A quasi-normal set automaton B with family of sets YB and stable sets SB is ordered if the restriction B ↾(YB\SB) is ordered.

Note that there is no restriction on the global update transformations on the bounded sets.

We now present the main result of this section. To this end, we recall the below definition.

▶ Definition 16 (Ordered multicounter automaton [20]). An ordered multicounter automaton M is a tuple (Q, Σ, O, ∆, J, F) where Q is the finite set of states, Σ is the finite alphabet, O is the ordered finite set of non-negative counters, J is the set of initial states, F ⊆ Q is the set of final states. Let O = {c1, . . . , ck}. The set of transitions is given by

∆ ⊆ Q × (Σ ∪ {ε}) × {Ii, Di, Z≤i | i ∈ [k]} × Q.

From a given state p on a label a, the transition (p, a, Ij, q) increments the counter cj by one and moves to the state q. Similarly, Dj decrements the counter cj by one and Z≤j tests the counters {ci | 1 ≤ i ≤ j} for zero value. Whenever the run tries to decrement the value of a counter below zero, the computation halts erroneously and rejects.

A configuration of an ordered multicounter automaton is a pair (q, v) where q ∈ Q and v = (v1, . . . , vk) where vi is the value of the counter ci. An accepting run of the automaton over a word is a sequence of transitions from an initial state with all the counters set to zero to a configuration where all counters are zero and the state is final. The language of an ordered multicounter automaton M is the set of all finite words w on which M has an accepting run.

The following is a well known result about ordered multicounter automata.

▶ Proposition 17 (Reinhardt, Theorem 6.1 of [20]). Emptiness of ordered multicounter automata is decidable.

We simulate the run of an ordered normal set automaton using an ordered multicounter automaton.

▶ Proposition 18. For each ordered normal set automaton A, an ordered multicounter automaton M recognising the string projection of L(A) can be constructed.

Proof. Let A = (Q, Σ, Y, ∆, I, F, C) be an ordered normal set automaton with the linear order ≤ on the family of sets Y. Let Z ⊆ Y be the family of bounded sets of A. By definition Y \ Z ≤ Z.

We construct an ordered multicounter automaton M that simulates the ordered normal set automaton A. The automaton M has a counter cy for each y ∈ Y and the counters are ordered with respect to the order ≤. The counter cy tracks the number of data values in the set y ∈ Y in a configuration of A during the simulation. The automaton also remembers which of the bounded sets are nonempty and how many data values are in them using its state space. This memory is modified whenever the bounded sets are updated through global or local updates. This is further elaborated in Item 4 below.

Consider a word w ∈ L(A) with an accepting run ρ = δ1δ2 · · · δn of the ordered normal set automaton S. Let δ = (p, a, ez, ρ, eu, v, q) be a transition in the run. Note that since the automaton A is normal, ez and eu are unit vectors and v is either a unit or zero vector. It is simulated by the ordered multicounter automaton M as follows:

1. The states p, q and the current label a are handled by the underlying finite state automaton.

2. The automaton M tests that the counter cz is nonzero (by successively decrementing and incrementing), signifying the presence of a data value with the characteristic vector ez.

3. Let (Y0, Y1) be the ordered partition of Y \ Z associated with ρ. Let y ∈ Y0. The automaton M successively decrements the counter cy and increments the counter cz′ such that ez′ = MT(ρ) · ey (Note that z′ ∈ Y1). This process is repeated for each set y ∈ Y0 (on ε-transitions) until the automaton M guesses the counters {cy | y ∈ Y0} to be zero. The guess is verified by zero-testing the set of counters {cy | y ∈ Y0}. Note that the sets in Y0 form a prefix that can be zero-tested using the hierarchical zero-tests of M.

4. The global update is simulated on the bounded sets by decrementing the counter cx for x ∈ Z and incrementing the counter cx′ such that ex′ = MT(ρ) · ex (Note that x′ ∈ Y and not necessarily in Z), until the former become zero. This step is accomplished without the use of zero-tests by remembering in the state space the size of each of the bounded sets that are nonempty. Further, the finite state automaton remembers this information after each transition.

5. Finally the local updates eu and v are simulated by incrementing the counter cu and decrementing the counter cv if v = 0.

The transitions δ1 and δn are ensured to be initial and final transitions, respectively, by the underlying finite state automaton. At the end of the run decrements all counters cx such that ex ∈ C to zero and performs a zero-test on all the counters verifying that all data values reached an accepting configuration. ◀

Thus, by Propositions 17 and 18 we obtain the below result.

▶ Theorem 19. Emptiness of ordered normal set automata is decidable.

We now extend the above decidability result to ordered quasi-normal set automata.

▶ Proposition 20. For each ordered quasi-normal set automaton there is an equivalent ordered normal set automaton.

Proof sketch. Given an ordered quasi-normal set automaton A, consider the set automaton N(A) obtained on normalising it as given by Proposition 12. We show that the restriction of N(A) to the family of sets given by the unit vectors corresponding to the non-stable sets of A, is an equivalent ordered set automaton. ◀

▶ Corollary 21. Emptiness of ordered quasi-normal set automata is decidable.

2.5 Closure Properties

Closure properties of set automata follow from that of class automata (See Proposition 43). We prove closure properties for quasi-normal set automata required for the translation of logical formulas to automata.

▶ Lemma 22. Quasi-normal set automata are closed under letter-to-letter renaming, and union and intersection with data automata.

Proof sketch. It is easy to verify that the standard construction for closure under letter-to-letter renaming preserves quasi-normality. For closure under union and intersection with data automata, we use our result that each data automata is equivalent to a set automaton where each set is stable (See Proposition 42). The result follows from the standard constructions using this equivalent set automaton. ◀

3 Equivalence of Set Automata and FO2 with Guarded Regular Predicates

In this section, we present a logical characterisation of set automata.

3.1 Set Automata to FO2 with Guarded Regular Predicates

▶ Proposition 23. For each set automaton A with update monoid M there is a formula φA ∈ EMSO2[Σ, <, +1, ∼, 1, FM] such that L(A) = L(φA).

Proof sketch. We write a formula that is satisfied by a data word w = (a1, d1) · · · (an, dn) if and only if there is a successful run of A on w using standard ideas. In this sketch, we focus on how the global and local updates in the transitions of A are captured by a formula with guarded regular predicates.

We ensure that (1) at each position the sets in which the input data value is present is consistent with the global and local updates of the transition, and (2) in two class-successive positions, the sets in which the data value is present is consistent with the global updates in the positions strictly between them. Note that we do not need to consider the local updates in the positions between two successive positions of a given class as local updates only affect the input data value at that position.

Let ∆ and S denote the set of transitions and family of sets of A respectively. We use the monadic predicates X = {Xδ | δ ∈ ∆} to indicate the transition used at a position in the run. We use the monadic predicates Y = {Ys | s ∈ S} to indicate the contents of the sets during the run: Ys is true, for s ∈ S, at a position j if during the run of A after reading (aj, dj) we have that dj is present in the set Ys. Let Z = X ∪ Y. Our formula is of the form ∃Z ϕ where ϕ ∈ FO2[Σ, Z, <, +1, ∼, 1, FM] is the conjunction of the formulas detailed in this sketch. To capture that the characteristic vector of membership at position x is ρ ∈ 𝟚S, we write,

ρ(x) := s∈S, ρ(s)=1 Ys(x) ∧ s∈S, ρ(s)=0 ¬Ys(x).

First, we ensure that the updates made at each position x with label (ai, di) is consistent with the transition δ = (p, ai, χ, t, α, β, q) at position x. That is, the current data value di with characteristic vector χ after the application of the transition δ with global update t and local updates α and β has the characteristic vector of membership ρδ = MT(t) · χ + α − β, i.e., ρ(x) is true. We write

∀x (Xδ(x) → ρδ(x)).

Now, it suffices to ensure that the contents of the sets in two class-successive positions are consistent with the global updates in positions strictly between them. Toward this, we introduce the below notation.

Let 𝟚Z denote the characteristic vectors of the monadic predicates Z. Let Σ′ = Σ × 𝟚Z.

Let Σ′ ⊆ Σ × 𝟚X be the set of all vectors that denotes the interpretation of the monadic variables Y. Let π∆ : Σ′ → ∆ be the projection function that maps a letter ℓ ∈ Σ′ to the (unique) δ ∈ ∆ such that Xδ is true in ℓ. We extend the map π∆ to the map π∗∆ : Σ′∗ → ∆∗ in the natural manner.

Let π : ∆ → M be the projection map defined as δ = (p, γ, χ, t, α, β, q) → t that maps each transition to its transformation given as an element of the update monoid M. We extend the map π to the map π∗ : ∆∗ → M∗ in the natural manner.

Let σ : M∗ → M be the product morphism that maps each word m1 · · · mn to the product of m1, . . . , mn. Clearly, the morphism σ ◦ π∗ ◦ π∗∆ : Σ′∗ → M maps a sequence of letters in Σ′ to the product of the corresponding transformations in M.

For χ ∈ 𝟚S, let ∆χ ⊆ ∆ denote all transitions with the membership vector χ. Assume that a position y is labelled with a transition δ = (p, aj, χ, t, α, β, p′) ∈ ∆. Let position y be the class-successor of position x. Assume that the position x satisfies ρ(x), i.e., the characteristic vector of membership of the data value in position x is ρ, and y is labelled by a transition in ∆χ. Then we ensure that the product of transformations between the positions strictly in between x and y is an element m ∈ M such that χ = ρ · m. We write

∀x∀y χ,ρ∈𝟚S δ∈∆χ (x 1 = y ∧ ρ(x) ∧ Xδ(y) → L(x, y))

where L := m∈M, χ=ρ·m (σ ◦ π∗ ◦ π∗∆)−1(m). ◀

3.2 FO2 with Guarded Regular Predicates to Quasi-Normal Set Automata

In this section we translate the guarded logic formulas to a subclass of quasi-normal set automata called suffix-storing set automata.

▶ Definition 24 (Suffix-storing set automaton). Let M be a monoid and h : Σ∗ → M be a morphism. A set automaton over the alphabet Σ is h-suffix-storing if it is a quasi-normal set automaton whose non-stable family of sets is of the form {Xm | m ∈ M} and that obeys the following property: after reading the input prefix w ∈ (Σ × D)∗, the set {m | Xm = ∅} is a subset of images of suffixes of str(w) under h.

The rest of the section is devoted to the proof of Proposition 25.

▶ Proposition 25. For each formula ψ ∈ EMSO2[Σ, <, +1, ∼, 1, Fh], there is a h-suffix-storing set automaton Aψ such that L(ψ) = L(Aψ).

We proceed by translating the formulas to suffix-storing set automata.

Assume that we are given a formula ψ of the form ∃Xϕ where ϕ ∈ FO2[Σ, X, <, +1, ∼, 1, Fh] and X = {X1, . . . , Xm}. Further, assume that ϕ uses guarded predicates defined by the morphism h : (Σ × 2X)∗ → M. Since set automata are closed under letter-to-letter renaming it suffices to show that there is a set automaton Aϕ recognising L(ϕ). In the following, to transform the formulas, we add additional monadic variables to the vocabulary. This requires h to be replaced by the morphism h ◦ π where π is the projection map to the alphabet Σ × 2X. To keep the discussion simple, we omit referring to the step explicitly.

We convert the formula ϕ to an equivalent formula of size linear in |ϕ| with additional unary predicates Y = {Y1, . . . , Yn} in Scott Normal Form (see, for instance [11]). Hence, we get an equivalent formula

∃Y1 · · · Yn ∀x∀y χ ∧ i ∀x∃y χi (3)

where Y1, . . . , Yn are new unary predicates and χ and χi are quantifier-free with free variables X ∪ Y. Again, by appealing to the closure under letter-to-letter renaming of set automata, it suffices to show that there is an equivalent set automaton for formulas of the form

∀x∀y χ ∧ i ∀x∃y χi. (4)

Unary and Binary types

Let x ≪ y stand for the formula x < y ∧ x + 1 = y, i.e., x occurs before y but is not its predecessor. Let O denote the set of binary order-types on two variables, i.e.,

O = {x ≪ y, x + 1 = y, x = y, y + 1 = x, y ≪ x}.

No two formulas in O are satisfiable at the same time, and any quantifier-free formula that uses only the predicates {<, +1, =} is equivalent to a disjunction of formulas from O (easily verified by converting the formula to DNF).

Let x ○ ∼ y, read as ‘x and y are class-distant’, stand for the formula x ∼ y ∧ x 1 = y ∧ x 1 = y, i.e., x and y are in the same class but neither is the class successor of the other. Let E denote the set of binary equivalence-types on two variables, i.e.,

E = {x ∼ y, x ○ ∼ y, x 1 = y, y 1 = x, x = y}.

It is easily verified that no two formulas in E are satisfiable at the same time and that any quantifier-free two-variable formula using the predicates {∼, 1} is equivalent to a disjunction of formulas in E.

A literal is either an atomic formula or a negation of an atomic formula. Let Γ be a set of literals. The set Γ is consistent if Γ does not contain a literal and its negation. It is maximally-consistent if Γ is consistent and no strict superset of Γ is consistent.

A unary-type over Σ ∪ X is a conjunction of a positive literal from Σ and a maximally-consistent set of literals over X on the same variable (either x or y). For example, let Σ = {a, b}. Then a(x) ∧ ¬X1(x) is a unary-type over the unary predicates {a, b, X1}, whereas a(x) and a(x) ∧ b(y) ∧ X1(y) are not. Let U denote the set of unary-types.

Construction of the Quasi-Normal Set Automaton

We first transform the formulas ∀x∀y χ and ∀x∃y χi into suitable forms given below using standard techniques (see Lemma 12 and 13 of [4]).

It is straightforward to first transform χ to CNF and distribute the universal quantifiers over the conjunction. Furthermore, by using standard logical equivalences, we write each of the exponentially many conjuncts in χ obtained from the CNF transformation in the below form:

φ = ∀x∀y(α(x) ∧ β(y) ∧ o(x, y) ∧ ϵ(x, y) → λ(x, y)) (5)

where α, β ∈ U, o(x, y) ∈ O, ϵ(x, y) ∈ E, and λ(x, y) is either false or a regular predicate of the form L(x, y) or L(y, x) for some language L defined by h. The set automaton constructed ensures that for each α and β with the class and order conditions met, the factor bordered by them satisfies the guarded predicate λ by storing information about the factors in its sets.

Similarly, for each χi, by introducing additional unary predicates, it suffices to consider formulas of the form

φ = ∀x∃y(α(x) → β(y) ∧ o(x, y) ∧ ϵ(x, y) ∧ λ(x, y)). (6)

Here, the set automaton ensures that each α is witnessed by a β satisfying the order, class, and guarded predicate constraints. Thus, it suffices to construct a set automaton for a formula with conjuncts in either of the above forms. Let k be the number of such conjuncts.

For the construction of the set automaton, we use the sets X = {Xm | m ∈ M}, A = {Aγ | γ ∈ U} and a collection of sets Yi for each of the k conjuncts. We refer to the sets together as S = X ∪ A ∪ i∈[k] Yi.

The sets in X are used to compute the image of factors (suffixes) under the morphism h. The sets in A are used to track which unary-types correspond to the factors whose images are computed in X. The sets in Yi are used to ensure that the i’th conjunct is satisfied during the run. The sets in A and Yi for each i ∈ [k] are stable and only the identity transformation is applied to them.

The automaton uses the set update transformations T = {tγ | γ ∈ U} where the transformation tγ is given by Xp → {Xp·h(γ)} for each p ∈ M and Z → {Z} for Z ∈ S \ X.

Now, it suffices to prove Lemma 26.

▶ Lemma 26. For each formula = i∈[k] φi where φi is a formula of the form

(∀∀) : ∀x∀y (α(x) ∧ β(y) ∧ o(x, y) ∧ ϵ(x, y) → λ(x, y)) or

there is an equivalent h-suffix-storing set automaton where, in addition to the identity transformation on the sets, the set updates in T are used.

We construct a set automaton A with the sets S. First we introduce some notation used in the proof.

Notation: For a subset I of positions, let γI denote the set of all positions in I that are labelled by γ. For example γ(0, ∞) = γ[1, ∞) is the set of all positions in the word labelled by γ. Similarly, for a data value d, let dI denote the set of all positions in I that are in the class of d. Further, let γdI denote the set of all positions in I that are in the class of d and is labelled by γ. Let ˆd(x) denote the largest position in d(0, x) if it exists, i.e., the latest occurrence of data value d that is smaller than x. We refer to this position as the latest occurrence of d (with respect to the current position). Let ˆγd(x) denote the largest position in γd(0, x) if it exists, i.e., the position of latest occurrence of γ in the class of d that is smaller than x. We refer to this position as the latest γ of d (with respect to the current position). All the other positions in γd(0, x) are referred to as non-latest γ of d. For a word w and an interval I of positions, let wI denote the factor of w given by the positions in I. For example w(i,i+1) is always the empty word whereas w(i−1,i] is the i-th letter. For a word w and a pair of positions i, j, the factor w(i,j) is called the factor bordered by the positions i and j.

In the required set automaton A, the sets in X are used to store the image of factors (suffixes) of the input word in the monoid M under the morphism h. This is accomplished by storing the data value of the first position of the factor in a set Xm if the image of the factor is m ∈ M. This can be thought of as tracking the run of the monoid on the factors. Thus, in the rest of the proof, we say that the runs of the monoid are stored in the sets to refer to the images of the factors that are stored. It is sufficient for X to store the images of factors under the morphism h as all the languages used in the guarded predicates are recognised by it.

The required set automaton A uses the sets in Yi to ensure that the formula φi is satisfied during the run. The state space of the automaton is given by the cartesian product of the set of states obtained by the construction for each of the formulas φi as described below, with the transitions and the state space ensuring that each of the formulas φi are satisfied. The acceptance conditions for each of the formulas φi as described in the construction below are taken in conjunction at the end of a run, with the automaton accepting only if the acceptance conditions according to the construction for each formula φi are satisfied.

We perform a case analysis on the types o(x, y), ϵ(x, y), and λ(x, y) for each of the forms φi occurs in. We denote the unary types occurring in φi as αi and βi, respectively. Further, let Li be the language used in the guarded predicate of the form L(x, y) recognised by morphism h with accepting set Pi ⊆ M.

We give the construction by first describing how the sets in X and A track the runs of the monoid. This is followed by describing how the cases for each φi are handled using the sets in Yi along with the run information from X and A.

The sets in X are used to compute the images of factors defined by the latest occurrence of a data value and the current position. The sets in A are used to remember the label present in the latest occurrence of a data value. The set automaton A reads the data word from left to right. Let w be the string projection of the data word. Assume that the automaton is on a position y. Let αi denote the unary type α in the conjunct φi. Let d be a data value and let x0 be the latest occurrence of d before the current position if it exists, i.e., x0 = ˆd(y). The following invariants are maintained during the run of the set automaton A:

(X) The data value d is in the set Xm, where m ∈ M, if and only if the factor bordered by latest occurrence of d and the current position has image m ∈ M. That is, the image of w(x0,y) is m. Note that a data value can be present in at most one of the sets in X.

(A) The data value d is in the set Aγ if and only if the latest occurrence of d before y was with the label γ. That is, x0 = ˆγd(y).

On encountering a pair (ℓ, d′), the automaton performs the following actions. The set update tℓ is performed, updating the runs stored in the sets. Since all the guarded predicates’ languages are recognised by the same morphism h, their runs can be tracked simultaneously. The data value d′ is removed from the unique set in X in which it is present, if any. Further, to maintain the invariant (X) for the upcoming positions in the run, the data value d′ is added to the set X1 (here, 1 is the identity of the monoid M) by means of local updates since the run of the monoid M starts at the identity element. To maintain the invariant (A), the data value d′ is removed from the sets in (A) in which it is present, if any, and is added to the set Aℓ. Note that the sets in X obey the suffix-storing property.

We now obtain Proposition 25 from Lemmas 27 and 28. We omit their proofs here due to space constraints.

▶ Lemma 27. For each formula φi of the form

(∀∀) : ∀x∀y (α(x) ∧ β(y) ∧ o(x, y) ∧ ϵ(x, y) → λ(x, y))

the h-suffix-storing set automaton A can be constructed such that, using the sets X ∪ A ∪ Yi it ensures that a data word is accepted by the automaton A if and only if it satisfies the formula φi.

▶ Lemma 28. For each formula φi of the form

(∀∃) : ∀x∃y (α(x) → β(y) ∧ o(x, y) ∧ ϵ(x, y) ∧ λ(x, y))

the h-suffix-storing set automaton A can be constructed such that, using the sets X ∪ A ∪ Yi it ensures that a data word is accepted by the automaton A if and only if it satisfies the formula φi.

Proof sketch. We illustrate the key ideas of the construction by considering the case where o(x, y) is x ≪ y, ϵ(x, y) is x ○ ∼ y, and λ(x, y) is Li(x, y).

The formula φi states that if an αi is followed by a class-distant β that is not its successor, then the word bordered by them is in Li. Observe that the condition x ○ ∼ y captures that x + 1 = y. Thus in the construction we do not need to specifically ensure that x ≪ y and can instead simply work with x < y. Here, in addition to the sets in X and A, we take the sets Hi = {Hm | m ∈ M}, and Fi = {Fm | m ∈ M}, i.e., Yi = Hi ∪ Fi. The sets in Hi (short for Hitherto) are used to compute the images of factors defined by a non-latest αi and the latest αi of a data value d. The sets in Fi (short for henceForth) are used to compute the images of factors defined by the latest αi of d and the latest occurrence of d. During the run of the automaton, the images of factors defined by an αi and the current position is required to check whether the conclusion of the formula φi is ensured whenever the premise is met. This is be obtained from the sets by multiplying the images of factors stored in Hi, Fi, and X.

Assume that the automaton is on a position y. Let d be a data value and let x0 be the latest occurrence of d with respect to the current position if it exists, i.e., x0 = ˆd(y). Similarly, let xi0 be the latest αi of d with respect to the current position if it exists, i.e., xi0 = ˆαid(y). During the run of the automaton, the following invariants are maintained in addition to (X) and (A).

(H) The data value d is in Hm if and only if there is a factor defined by a non-latest αi and the latest αi in d’s class whose image is m. That is to say, there is a factor w(x,xi0) for some x ∈ αdi(0, xi0) with the image m.

(F) The data value d is in Fm if and only if there is a factor defined by the latest αi in d’s class and the latest occurrence of d whose image is m. That is to say, the factor w(xi0,x0) has image m.

▶ Example 29. The invariants can be understood from the below figure. For ease of presentation, in Figure 1, for a pair of positions i < j we use the notation X(i,j) to denote the set Xm where m is the image of the factor w(i,j) in the monoid M.

Figure 1: A data word w and the contents of the sets of A on encountering position 9 of w.

On encountering a pair (ℓ, d′) the automaton performs the following actions in addition to those described for the sets in X and A earlier.

If ℓ = αi: The present data value d′ is removed from all the sets in H and is added to the set Hu·h(αi)·v·w if prior to the set update, the data value was present in Hu, Fv and Xw. Further, the data value is added to the set Hm if prior to the set update, the data value was present in Xm and Aαi. This is to maintain the invariant (H) in the upcoming positions. To maintain the invariant (F) in the upcoming positions, the data value is removed from the sets in F if present.

If ℓ = αi: If the present data value d′ is present in any of the sets in F, it is removed from it and added to the set Fm·h(γ)·n if prior to the set update, the data value was present in the sets Fm, Aγ, and Xn. Further, if the data value d′ was present in Xm and Aαi prior to the set update then it is added to the set Fm. This is to maintain the invariant (F). If ℓ = βi, the following operations are also performed. To satisfy φi, we need to ensure that (1) the unique set Fm containing d′ corresponds to an accepting element (i.e., m ∈ Pi) if d′ is not in Aαi (i.e., if the latest element in the class is not an αi) (2) and all the sets Hn containing d′ must satisfy n · h(αi) · m ∈ Pi. Note that this captures only the condition x ≪ y as it only considers x ○ ∼ y where x < y, thus ensuring x + 1 = y. This can be ascertained from the characteristic vector of d′. If it is not, then A halts erroneously.

Finally, at the end of the run, every configuration of the set automaton is accepting. ◀

4 Decidability & Undecidability Results on FO2 with Guarded Regular Predicates

4.1 Linear Bands

A band is a semigroup in which every element is an idempotent.

▶ Definition 30 (Linear Band). A monoid M is a linear band if it is a band and the preorder relation ≤J on M is total. In other words, M satisfies identities x2 = x and xyx = x ∨ yxy = y for all x, y ∈ M.

▶ Example 31. Below are some examples and non-examples of linear bands.

1. The two-element monoid U1 = {1, 0} with a zero is a linear band.

2. Consider the band U21 = {1, r, s, 0} with the multiplication rs = sr = 0 given in Figure 2. This example shows that linear bands are not closed under direct products, and hence they fail to form a pseudovariety.

3. Consider the null monoid Nk = {1, x1, . . . , xk, 0}, with the multiplication xi · xj = 0, for all i, j ∈ [k]. The null monoid N2 is in Figure 2. The monoid Nk is not a linear band.

Figure 2: (a) A linear band recognising the language (a + b)∗b + a∗ over the alphabet {a, b}, (b) A linear band U1, (c) A band U21, and (d) a linear monoid N2. Here, (c) and (d) are not linear bands. Idempotents are denoted by a star in the above semigroups.

A semigroup S is in the class DA if it satisfies the identity ese = e for each element s and idempotent e such that e ≤J s. The name DA comes from an equiavalent definition that all regular D-classes of S are aperiodic subsemigroups. They correspond to positive regular languages (subsets of Σ+) recognised by FO2(Σ, <) formulas as given in, for instance, the survey [22].

▶ Lemma 32. Every linear band is in DA.

Proof. Let M be a linear band. Let e, s ∈ M be such that e ≤J s. Since M is a linear band, we have ese = e or ses = s. Let, if possible, ese = e. Then ses = s, that is, s ≤J e. By assumption we also have e ≤J s, therefore eJs. Since each element of M is an idempotent, by location theorem (Fact 53) we have es ∈ R(e) ∩ L(s). Further we have ese ∈ R(es) ∩ L(e). But R(es) = R(e), therefore we have ese ∈ H(e). Now by Fact 52 we have ese = e. ◀

4.2 Decidability with Guarded Regular Predicates recognised by Linear Bands

In this section, we show that the logic EMSO2[Σ, <, +1, ∼, 1, FM] has a decidable satisfiability problem when M is a linear band. It suffices to show the below result.

▶ Proposition 33. Let M be a linear band and h : Σ∗ → M be a morphism. For each h-suffix-storing set automaton there is an equivalent ordered quasi-normal set automaton.

Proof. Let M be a linear band and A be a h-suffix-storing set automaton for some morphism h : Σ∗ → M. Assume that X = {Xm | m ∈ M} are the non-stable sets of A. Since stable sets can always be added to an ordered quasi-normal set automaton, to simplify the below construction we ignore the stable sets.

First, we introduce some machinery for the proof.

Let ⊑L be a partial order on M extending ≤L, obtained by fixing total orders within each J-class on L-classes such that they are stable on R-classes, and ordering distinct J-classes according to ≤L. More precisely, ⊑L satisfies the following conditions. Let x, y ∈ M.

1. If x ⊏L y then x ≤L y.

2. The relation ⊑L is antisymmetric, i.e., x ⊑L y and y ⊑L x then x = y.

3. If x <L y then x ⊏L y, and, if xLy and x = y then either x ⊏L y or y ⊏L x.

4. If x ⊑L y, xRx′ and yRy′, then x′ ⊑L y′.

An order ⊑L is easily found by fixing an ordering on the columns of each J-class in the eggbox diagram of M.

Let x ⊒L y and x ⊐L y denote y ⊑L x and y ⊏L x respectively. A strict ⊑L-chain in M is a sequence m1, . . . , mn of elements from M such that m1 ⊐L m2 ⊐L · · · ⊐L mn. Let k ≥ 1 be the length of the longest ⊑L-chain in M. The ⊑L-height of an element m ∈ M, denoted by km, is the length of the longest ⊑L-chain starting with m.

We observe that a subset M′ ⊆ M is an ≤L-total set, if, and only if, it is ⊑L-total, and equivalently, the elements of M′ forms a strict ⊑L-chain. Moreover, if m1 ⊐L m2 ⊐L · · · ⊐L mn is a strict ⊑L-chain then km1 > km2 > · · · > kmn.

▷ Claim 34. If M′ ⊆ M is an ≤L-total set. Then for all m ∈ M, M′m is also ≤L-total.

Proof. Assume that M′ ⊆ M is ≤L-total. It suffices to prove that for each m1, m2 ∈ M′, if m1 ≤L m2, then m1m ≤L m2m, which follows from the fact that ≤L is stable under right multiplication (Fact 51). ◁

▷ Claim 35. If mRm′ for m, m′ ∈ M, then km = km′.

Proof. Assume that mRm′. Let m = m1 ⊐L m2 ⊐L · · · ⊐L mn be a strict ⊑L-chain starting in m. Let zi ∈ M, for 1 ≤ i ≤ n − 1, be such that zimi = mi+1. The we claim that the ⊑L-chain m′ ⊒L z1m′ ⊒L z2z1m′ · · · ⊒L zn−1 · · · z1m′ is strict. Since mRm′ we have z1mRz1m′. By induction, we have zi · · · z1mRzi · · · z1m′, for 1 ≤ i ≤ n − 1. Since ⊑L is compatible with the R-relation, we conclude that the chain is strict. Thus we infer that km ≤ km′. The other direction follows symmetrically. ◁

▷ Claim 36. Let m1, m2 ∈ M be two elements such that m1 ⊏L m2. Then for each m ∈ M, if km1m < km1 then km2m < km1 < km2.

Proof. Assume that km1m < km1. We claim that m1m <J m1. Otherwise m1mJm1 and we also have m1m ≤R m1, therefore by Fact 50 we have m1mRm1. Now by Claim 35 we have km1m = km1, a contradiction. Hence we have m1m <J m1. Since M is linear, we have either m <J m1 or m1 ≤J m. If m1 ≤J m we have m1mm1 = m1 since M is in DA. Here we have m1 ≤J m1m, a contradiction. Thus m <J m1 and since m2m ≤J m we get m2m <J m1. We deduce that km2m < km1 < km2. ◁

We construct an ordered quasi-normal set automaton B that has the family of sets Y ∪ Z, where Y = {Yi | i ≤ k} and Z = {Zm | m ∈ M}. The sets in Y are used to simulate the non-stable sets X of the h-suffix-storing set automaton A. At any point during a run of the automaton B, the set Ykm has the content of a unique nonempty set Xm if it exists. During the run, except for the last step, the sets in Z remain empty and the identity transformation is applied to them. At the last step we copy the nonempty sets in Y to the corresponding set in Z (i.e., Ykm to Zm). The automaton B simulates A in the following way.

As already observed , at any point during the run, the subset M′ = {m ∈ M | Xm = ∅} is an ≤L-total set, and hence ⊑L-total also. The contents of each Xm is stored in the set Ykm and the automaton B also remembers in its state the information about the element m that corresponds to the nonempty set Ykm (this is a partial map f : [k] → I defined as f : km → m). To effect the global update ρ = {(Xm, Xmm′) | m ∈ M} of A, i.e., right multiplication by an element m′ ∈ M, the automaton B moves the data values in each nonempty set Ykm to the set Ykmm′, i.e. by the global update ρ′ = {(Ykm, Ykmm′) | m ∈ M′} ∪ {(Zm, Zm) | m ∈ M}, and replace the map f by the map f′ : kmm′ → mm′. Note that since M′m′ is a ⊑L-total set, elements of M′m′ form a strict ⊑L-chain, and therefore km1m′ = km2m′ whenever m1m′ = m2m′, m1, m2 ∈ M′. Therefore each nonempty set Yi corresponds to precisely one nonempty set from X. On the last input pair the global update ρ = {(Xm, Xmm′) | m ∈ M} is simulated by the update ρ′′ = {(Ykm, Zmm′) | m ∈ M}, i.e., we copy the sets in Y to sets in Z using the map stored in the sets. Finally the automaton B accepts if a final state is reached and the each data value is in an accepting configuration.

Let ≲ be the order on the family Y ∪ Z, given by Y Z, where Y is ordered by the relation {(Yi, Yj) | j ≤ i}, and we fix an arbitrary order on Z. Using Claim 36, it is straightforward to check that global updates of B are ordered with respect to ≲. ◀

Thus, by Propositions 25, 33, and Corollary 21, we have the below result.

▶ Theorem 37. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, FM] formulas over data words is decidable when M is a linear band.

4.3 Undecidability with Guarded Regular Predicates not recognised by Linear Bands

▶ Proposition 38. If M is not a linear band then either U21 or N2 divides M.

Proof. Let M be a monoid that is not a linear band. If M contains an element x that is not an idempotent then M is not a band. Here N2 divides the submonoid generated by x. Hence assume that all elements of M are idempotent. Now since M is not a linear band, there exist two idempotents e and f that are J-incomparable. Here U21 divides M. ◀

▶ Proposition 39. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, F] formulas over data words is undecidable for the following families of languages F:

1. {Σ∗aΣ∗, Σ∗bΣ∗}, where a, b ∈ Σ.

2. {(Σ \ {a})∗ a (Σ \ {a})∗}, where a ∈ Σ.

The below result follows from Proposition 38 and the fact that the language families in Proposition 39 can be recognised by the monoids U21 and N2 respectively.

▶ Theorem 40. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, FM] formulas over data words is undecidable when M is not a linear band.

Our main result restated below follows from Theorem 37, Proposition 38 and Theorem 40.

▶ Theorem 6. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, FM] formulas over data words is decidable if and only if M is a linear band.

5 Expressiveness

The set automaton formalism is robust upto various acceptance conditions.

▶ Lemma 41. In a set automaton, the following acceptance conditions are equivalent: Let (q, X) be the configuration reached at the end of the run.

1. (F ⊆ Q, C ⊆ 𝟚Y): q ∈ F and the characteristic vector of each data value present in X is in C.

2. (F ⊆ Q, Fℓ ⊆ Q): q ∈ F and at every class maximal position the state reached is in Fℓ.

3. (F ⊆ Q, C ⊆ 𝟚Y): q ∈ F and at every class maximal position with data value d, the characteristic vector of d is in C.

4. (F ⊆ Q, S ⊆ Y): q ∈ F and the subset S of the sets are empty.

5.1 Comparison with Other Models

A natural restriction of set automata captures the class of languages recognised by Data automata.

▶ Proposition 42. For each data automaton there is an equivalent set automaton where each set is stable and thus having the update monoid be trivial.

We have the following result.

▶ Proposition 43. Set automata are expressively equivalent to class automata.

5.2 Logical Characterisation of Set Automata

First, we recall a logical characterisation of class automata given in [5].

▶ Proposition 44 (Bojańczyk and Lasota, [5]). Class automata are expressively equivalent to a restricted fragment of MSO[Σ, <, ∼] consisting of formulas of the form

∃X1 · · · ∃Xn ∀ Y class(Y) → φ(X1, . . . , Xn, Y) (7)

where class(Y) := ∃y∀x (Y(x) ↔ y ∼ x) and φ is in MSO[Σ, <].

It is easy to see that the data value equality test, the class successor relation, and regular predicates are captured in the restricted fragment of MSO.

▶ Proposition 45. For each formula ϕ ∈ EMSO2[Σ, <, +1, ∼, 1, F], there is a formula ψ belonging to the restricted fragment of MSO[Σ, <, ∼] consisting of formulas of the form given in Equation (7) such that L(ϕ) = L(ψ).

By Propositions 23, 43, 44, and 45, we obtain the below result.

▶ Theorem 46. Set automata and EMSO2[Σ, <, +1, ∼, 1, F] are expressively equivalent.

Now by Proposition 23, we obtain the below corollary.

▶ Corollary 47. For each formula in EMSO2[Σ, <, +1, ∼, 1, FM], there is an equivalent formula in EMSO2[Σ, <, +1, ∼, 1, FM′].

In fact, it can be shown that M′ = P(M) but we skip it here for the sake of brevity.

6 Conclusion

We have characterised the decidability frontier for the EMSO2 logic over data words with guarded regular predicates recognised by a monoid. The characterisation in the case of guarded regular predicates recognised by semigroups is yet to be done. The class of regular languages recognised by linear bands has not been studied in the literature and needs to be explored further.

References

1 Ansuman Banerjee, Kingshuk Chatterjee, and Shibashis Guha. Set augmented finite automata over infinite alphabets. In DLT, volume 13911 of LNCS, pages 36–50. Springer, 2023.

2 Henrik Björklund and Thomas Schwentick. On notions of regularity for data languages. In Fundamentals of Computation Theory, pages 88–99. Springer Berlin Heidelberg, 2007.

3 Mikołaj Bojańczyk. Data monoids. In STACS, volume 9 of LIPIcs, pages 105–116. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2011.

4 Mikołaj Bojańczyk, Claire David, Anca Muscholl, Thomas Schwentick, and Luc Segoufin. Two-variable logic on data words. ACM Trans. Comput. Logic, 12(4), Jul 2011.

5 Mikolaj Bojańczyk and Sławomir Lasota. An extension of data automata that captures xpath. In LICS, pages 243–252, 2010.

6 Mikołaj Bojańczyk and Rafał Stefański. Single-Use Automata and Transducers for Infinite Alphabets. In ICALP, volume 168 of LIPIcs, pages 113:1–113:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020.

7 Thomas Colcombet, Clemens Ley, and Gabriele Puppis. On the use of guards for logics with data. In MFCS, volume 6907 of LNCS, pages 243–255. Springer, 2011.

8 Thomas Colcombet and Amaldev Manuel. Fragments of Fixpoint Logic on Data Words. In FSTTCS, volume 45 of LIPIcs, pages 98–111. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2015.

9 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.

10 Radu Grigore and Nikos Tzevelekos. History-register automata. Log. Methods Comput. Sci., 12(1), 2016.

11 Erich Grädel, Phokion G. Kolaitis, and Moshe Y. Vardi. On the decision problem for two-variable first-order logic. The Bulletin of Symbolic Logic, 3(1):53–69, 1997.

12 Sabína Gulčíková and Ondřej Lengál. Register set automata (technical report), 2022. arXiv:2205.12114.

13 Michael Kaminski and Nissim Francez. Finite-memory automata. Theor. Comput. Sci., 134(2):329–363, 1994.

14 Ahmet Kara, Thomas Schwentick, and Tony Tan. Feasible automata for two-variable logic with successor on data words. In LATA, volume 7183 of LNCS, pages 351–362. Springer, 2012.

15 Gerard Lallement. Semigroups and combinatorial applications. Wiley, New York, 1979.

16 Amaldev Manuel and Ramaswamy Ramanujam. Class counting automata on data words. International Journal of Foundations of Computer Science, 22, 11 2011.

17 Marvin L. Minsky. Computation: finite and infinite machines. Prentice-Hall, Inc., 1967.

18 Frank Neven, Thomas Schwentick, and Victor Vianu. Finite state machines for strings over infinite alphabets. ACM Trans. Comput. Logic, 5(3):403–435, Jul 2004.

19 Jean-Éric Pin. Mathematical Foundations of Automata Theory. 2022.

20 Klaus Reinhardt. Reachability in petri nets with inhibitor arcs. Electron. Notes Theor. Comput. Sci., 223:239–264, Dec 2008.

21 Luc Segoufin. Automata and logics for words and trees over an infinite alphabet. In CSL, pages 41–57. Springer Berlin Heidelberg, 2006.

22 Pascal Tesson and Denis Thérien. Diamonds are forever: The variety DA. In Semigroups, Algorithms, Automata and Languages, pages 475–499, 2002.

A Appendix

Orders Preliminaries

A preorder ≲ on a set X is a binary relation on X that is reflexive and transitive. A preorder ≲ is total if x ≲ y or y ≲ x for each x, y ∈ X. We say the subset Y ⊆ X is ≲-total if any two elements in Y is comparable with respect to ≲, in other words Y is totally preordered by ≲. A partial order is an antisymmetric preorder. A linear order is a total partial order.

Semigroup Preliminaries

We recall some fundamental definitions from the local theory of semigroups. A detailed account can be found in standard textbooks, such as [15, 19].

For a semigroup S, its monoidal extension S1 is defined to be S if it is already a monoid and otherwise to be the monoid obtained by adjoining an identity element 1 to it. We denote by ⟨X⟩ the semigroup generated by elements in X. For semigroups S and T, let S ≤ T denote that S is a subsemigroup of T. An element e of a semigroup is said to be an idempotent if e2 = e. In a finite semigroup, for every element x there exists a positive integer k such that the element xk is an idempotent. Moreover there is some n > 0 such that the sn is an idempotent for each element s of the semigroup. The least such n is called the exponent of the semigroup and is denoted by ω. A semigroup is aperiodic if sω+1 = sω for each element s of the semigroup. Let S and T be semigroups. The semigroup T is a quotient of S if there exists a surjective morphism from S onto T. The semigroup T is said to divide S if T is a quotient of a subsemigroup of S.

▶ Definition 48 (Green’s relations). Let s, t be elements of a semigroup S. The Green’s preorders ≤R, ≤L, and ≤J are given as follows: s ≤R t ≜ s = ty for some y ∈ S1, s ≤L t ≜ s = xt for some x ∈ S1, and s ≤J t ≜ s = xty for some x, y ∈ S1.

Let K ∈ {R, L, J}. The Green’s preorders have equivalence relations associated with them that are given as sKt ≜ s ≤K t and t ≤K s Further, the relation H is given by sHt ≜ sLt and sRt.

The equivalence class of an element s under the relation K ∈ {R, L, J, H} is called the K-class of s and is denoted by K(s). Let K′ ∈ {R, L, J}. Two K′-classes are comparable when every element in one class is comparable to every element in the other class in the ≤K′ preorder. In finite semigroups the relations D = R ◦ L = L ◦ R and J coincide, and we use them interchangeably.

▶ Definition 49 (Ideals). A (two-sided) ideal of a semigroup S is a subset I of S such that S1IS1 ⊆ I, that is, for each s ∈ I and x, y ∈ S1 we have that xsy ∈ I.

It is trivial to see that for an ideal I of a semigroup S, we have S1IS1 = I since 1I1 = I ⊆ S1.

▶ Fact 50 (Prefix/Suffix Lemma). Let x, y be elements of a finite semigroup. If x ≤L y and xJy then xLy. If x ≤R y and xJy then xRy.

▶ Fact 51 (Stability of ≤L and ≤R). The following is true in any semigroup.

1. ≤R is stable on the left, i.e., if x ≤R y then zx ≤R zy. Hence, if xRy then zxRzy.

2. ≤L is stable on the right, i.e., if x ≤L y then xz ≤L yz. Hence, if xLy then xzLyz.

▶ Fact 52. If x and y are idempotents and xHy, then x = y.

▶ Fact 53 (Location Theorem). Let s and t be elements of a finite semigroup S such that sDt. The following are equivalent:

1. st D s,

2. st ∈ R(s) ∩ L(t),

3. L(s) ∩ R(t) contains an idempotent.

Proofs for Section 2

▶ Proposition 12. For each set automaton A with the family of sets Y there is an equivalent to a normal set automaton N(A) with the family of sets 𝟚Y \ {¯0}.

Proof. Consider a set automaton A = (Q, Y, Σ, ∆, I, F, C) with the set names Y = {1, . . . , k}. Let N(A) be the required set automaton with the set names 𝟚Y \ {¯0} where ¯0 denotes the zero vector. Automaton N(A) has the same state space Q as A as well as the same sets of initial and final states. The sets of the automaton N(A) are denoted as Y′u for each nonempty vector u ∈ 𝟚Y. For each

δ = (p, ℓ, z, ρ, u, v, p′) ∈ ∆ (8)

the set of transitions ∆′ of N(A) contains the tuple

δ′ = (p, ℓ, ez, ρ′, eu′, ev′, p′) (9)

where

ρ′ = {(s, s′) | s, s′ ∈ 𝟚Y, s′ = MT(ρ) · s} (10)

(Recall that s ∧ s′ denote pointwise Boolean conjunction on the vectors s, s′ ∈ 𝟚Y). The set of accepting configurations of N(A) is C′ = {eu | u ∈ C}.

We prove the following claim (†): On a data word w, the automaton A reaches a configuration (q, P) if and only if N(A) reaches the configuration (q, Q) where P and Q are mutually determined by each other by the following condition: For each d ∈ D, we have that 1P(d) = z ⇐⇒ 1Q(d) = ez. Clearly, the claim implies that L(A) = L(N(A)) by definition of C′.

Next we prove the claim by induction on the length of the data word w. When |w| = 0, the configuration of A and N(A) are initial and the claim holds trivially. Assume the claim holds for all w of length k. Assume that (q, P) and (q, Q) are two corresponding configurations of A and N(A) respectively after reading w. By induction hypothesis, on the pair (a, d) ∈ Σ × D, the transition (8) is applicable in the configuration (q, P) if and only if the transition (9) is applicable in the configuration (q, Q). Let (p′, P′) and (p′, Q′) be the resulting configurations of A and N(A) respectively.

We proceed by cases. For all data values d′ ∈ D such that d′ = d,

z = 1P′(d′) ⇐⇒ z = MT(ρ) · 1P(d′)

Now for d′ = d,

z = 1P′(d) ⇐⇒ z = (MT(ρ) · 1P(d) ∨ u) ∧ vc

where u′ and v′ are in the definition of δ′. Hence the Claim (†) is proved. ◀

▶ Proposition 20. For each ordered quasi-normal set automaton there is an equivalent ordered normal set automaton.

Proof. Assume that A = (Q, Y, Σ, ∆, I, F, C) is an ordered quasi-normal set automaton with the family of stable sets S ⊆ Y. By assumption the set automaton A ↾Y\S is ordered by a linear order ≤ on Y \ S. Let U = {¯0} ∪ {ey | y ∈ Y \ S} be a set of characteristic vectors. Let N(A) be the normal set automaton obtained on normalising A as given in Proposition 12. Consider the restriction N(A) ↾Y′ with the family of sets Y′ = {u ∈ 𝟚Y | u ↾(Y\S)∈ U} where the restriction of the vectors to the non-stable sets of Y \ S of A are unit vectors, i.e., the non-stable sets occur at most once. Let ≤′ be a linear order on Y′ such that ≤′ ⊇ {(u, v) | u ↾Y\S= eu, u ↾Y\S= ev, u ≤ v}. It is easy to verify that N(A) ↾Y′ is an ordered set automaton with the linear order ≤′ that is equivalent to A. ◀

▶ Lemma 22. Quasi-normal set automata are closed under letter-to-letter renaming, and union and intersection with data automata.

Proof. Consider a quasi-normal set automaton A with sets YA and stable sets SA and a data automaton B with sets YB over the alphabet Σ. By Proposition 42, for the data automaton B, there exists an equivalent set automaton B′ with sets SB′ where each set is stable.

If h : Σ → Σ′ is a renaming from alphabet Σ to an alphabet Σ′, it is easily checked that h(L(A)) is accepted by the automaton A′ obtained by applying the renaming h to each of the transitions in A. Further, this construction preserves quasi-normality of the set automaton.

Closure under union can be shown by taking the disjoint union of A and B′. The resulting set automaton has the family of stable sets SA ∪ SB′. Since all the sets of B′ are stable, the restriction of the resulting set automaton to the non-stable sets YA \ SA results in a normal set automaton due to the quasi-normality of A.

For closure under intersection, consider the synchronous product of A and B′. By standard arguments, this automaton accepts the language L(A1) ∩ L(A2). Similarly, here the resulting automaton is quasi-normal. ◀

Proofs for Section 3

▶ Proposition 23. For each set automaton A with update monoid M there is a formula φA ∈ EMSO2[Σ, <, +1, ∼, 1, FM] such that L(A) = L(φA).

Proof. Let A be a set automaton with update monoid M.

We write a formula that is satisfied by a data word w = (a1, d1) · · · (an, dn) if and only if there is a successful run of A on w.

Let ∆ be the set of transitions of A. Let X be the set of monadic predicates {Xδ | δ ∈ ∆} which are used to indicate the transition used at a position in the run. Let S denote the family of sets of A. We use the monadic predicates Y = {Ys | s ∈ S} to indicate the contents of the sets during the run: Ys is true, for s ∈ S, at a position j if during the run of A after reading (aj, dj) we have that dj is present in the set Ys. Let Z = X ∪ Y.

Our formula is of the form ∃Z ϕ where ϕ ∈ FO2[Σ, Z, <, +1, ∼, 1, FM] is the conjunction of the following formulas.

1. Each position is labelled by exactly one transition of the automaton, i.e.,

∀x δ∈∆ Xδ(x) ∧ ∀x δ,δ′∈∆ δ=δ′ ¬(Xδ(x) ∧ Xδ′(x)).

2. Let I ⊆ ∆ denote the set of transitions from an initial state of the automaton. We ensure that the first position is labelled by transitions from I, i.e.,

∀x (∀y y + 1 = x → δ∈I Xδ(x)).

3. Let F ⊆ ∆ denote the set of transitions to a final state of the automaton. We ensure that the last position is labelled by a transition in F, i.e.,

∀x (∀y x + 1 = y → δ∈F Xδ(x)).

4. We say a pair of transitions (δ, δ′) are compatible, denoted as comp(δ, δ′), if the target state of δ is the source state of δ′. We state that consecutive positions are labelled by compatible transitions, i.e.,

∀x∀y (x + 1 = y → δ,δ′∈∆, comp(δ,δ′) Xδ(x) ∧ Xδ′(y)).

5. Let ∆¯0 be the set of transitions where the characteristic vector is the zero-vector. We ensure that class-minimal positions are labelled by transitions from ∆¯0, i.e.,

∀x (¬∃y y 1 = x → δ∈∆¯0 Xδ(x)).

6. Assume that the set automaton A has the acceptance condition (2) given in Lemma 41. Let F ⊆ ∆ denote the set of transitions to a local final state of A. We state that every class-maximal position is labelled by a transition to a local final state, i.e.,

∀x (∀y x 1 = y → δ∈F Xδ(x)).

7. It remains to ensure that the data values present in the sets S are according to the updates made by the transitions in ∆. That is, the labelling by the Y-predicates are consistent with the run indicated by the X-predicates. Toward this, we introduce the below formula. Let ρ ∈ 𝟚S be a characteristic vector. To capture that the characteristic vector of membership at position x is ρ, we write,

ρ(x) := s∈S, ρ(s)=1 Ys(x) ∧ s∈S, ρ(s)=0 ¬Ys(x).

Now, we ensure that the updates made at each position x with label (ai, di) is consistent with the unique transition δ = (p, ai, χ, t, α, β, q) at position x. That is, the current data value di with characteristic vector χ after the application of the transition δ with global update t and local updates α and β has the characteristic vector of membership ρδ = MT(t) · χ + α − β. We write

∀x (Xδ(x) → ρδ(x)).

8. Finally, we ensure that the data values present in the sets S in two class-successive positions are consistent with the global updates in the positions strictly between them.

Let 𝟚Z denote the characteristic vectors of the monadic predicates Z. Let Σ′ = Σ × 𝟚Z. Let Σ′ ⊆ Σ × 𝟚X be the set of all vectors that denotes the interpretation of the monadic variables Y.

Let π∆ : Σ′ → ∆ be the projection function that maps a letter ℓ ∈ Σ′ to the unique δ ∈ ∆ determined by Item 1 above such that Xδ is true in ℓ. We extend the map π∆ to the map π∗∆ : Σ′∗ → ∆∗ in the natural manner.

Let π : ∆ → M be the projection map defined as δ = (p, γ, χ, t, α, β, q) → t that maps each transition to its transformation given as an element of the update monoid M. We extend the map π to the map π∗ : ∆∗ → M∗ in the natural manner.

Let σ : M∗ → M be the product morphism that maps each word m1 · · · mn to the product of m1, . . . , mn. Clearly, the morphism σ ◦ π∗ ◦ π∗∆ : Σ′∗ → M maps a sequence of letters in Σ′ to the product of the corresponding transformations in M.

For χ ∈ 𝟚S, let ∆χ ⊆ ∆ denote all transitions with the membership vector χ. Assume that a position x is labelled with a transition δ = (p, aj, χ, t, α, β, p′) ∈ ∆. Let position y be the class-successor of position x. Assume that the position x satisfies ρ(x), i.e., the characteristic vector of membership of the data value in position x is ρ, and y is labelled by a transition in ∆χ. Then we ensure that the product of transformations between the positions strictly in between x and y is an element m ∈ M such that χ = ρ · m. We write

∀x∀y χ,ρ∈𝟚S δ∈∆χ (x 1 = y ∧ ρ(x) ∧ Xδ(y) → L(x, y))

where L := m∈M, χ=ρ·m (σ ◦ π∗ ◦ π∗∆)−1(m).

The proof is completed by examining that a data word w satisfies the formula ∃Zϕ if and only if A has a successful run on w. ◀

▶ Lemma 27. For each formula φi of the form

(∀∀) : ∀x∀y (α(x) ∧ β(y) ∧ o(x, y) ∧ ϵ(x, y) → λ(x, y))

the h-suffix-storing set automaton A can be constructed such that, using the sets X ∪ A ∪ Yi it ensures that a data word is accepted by the automaton A if and only if it satisfies the formula φi.

Proof. We first discuss the degenerate cases below.

When λ(x, y) is false: In this case there is an equivalent data automaton for the formula φi since it uses no regular predicates (see [4]). Since data automata are captured by set automata with identity transformations (see Proposition 42), we simulate it using local updates in the sets Yi. Henceforth we assume that λ(x, y) is a guarded predicate of the form Li(x, y) or Li(y, x).

When o(x, y) is x = y: If ϵ(x, y) ∈ {x 1 = y, y 1 = x, x ∼ y, x ○ ∼ y}, or if αi = βi, then the premise of φi is false. Thus φi is always true and the required set automaton accepts all inputs. Next assume that ϵ(x, y) is x = y and αi = βi. Then the conclusion Li(x, y) is false as per the semantics of the guarded predicates since x = y. Thus, for the formula to be true, the premise should not be met. This can be ensured by a data automaton as the premise does not contain any regular predicates (See [4]). Thus we take the corresponding set automaton with identity transformations on the sets Yi (See Proposition 42). Henceforth we assume that o(x, y) is not x = y.

When o(x, y) is x ≪ y or x + 1 = y and λ(x, y) is Li(y, x): Here, the conclusion is always false due to the semantics of the guarded predicates. Thus, for φi to be true, we ensure that the premise is not met using a set automaton with identity transformations. A symmetric case occurs when o(x, y) is y ≪ x or y + 1 = x and λ(x, y) is Li(x, y). Henceforth, whenever o(x, y) is x ≪ y or x + 1 = y, we assume that λ(x, y) is Li(x, y) and whenever o(x, y) is y ≪ x or y + 1 = x, we assume λ(x, y) to be Li(y, x).

When ϵ(x, y) is x ≁ y and o(x, y) is not x = y: Here, if the premise is met, the conclusion can never be met as Li(x, y) requires that x ∼ y. Thus, for φi to be true, we ensure that the premise is not met using a set automaton with identity transformations.

Consider the following cases, (1) o(x, y) is x ≪ y or x + 1 = y and ϵ(x, y) is y 1 = x, (2) o(x, y) is y ≪ x or y + 1 = x and ϵ(x, y) is x 1 = y,(3) ϵ(x, y) is x = y and o(x, y) is not x = y, (4) ϵ(x, y) is x ○ ∼ y and o(x, y) is x + 1 = y or y + 1 = x. Here, in each of the cases, the premise of φi is false. Thus φi is always true and we take a set automaton that accepts all inputs.

Now we proceed to describe the construction for the remaining cases.

Case 1: x ≪ y and x ○ ∼ y.

The formula φi states that if an αi is followed by a class-distant β that is not its successor, then the word bordered by them is in Li. Observe that the condition x ○ ∼ y captures that x + 1 = y. Thus in the construction we do not need to specifically ensure that x ≪ y and can instead simply work with x < y. Here, in addition to the sets in X and A, we take the sets Hi = {Hm | m ∈ M}, and Fi = {Fm | m ∈ M}, i.e., Yi = Hi ∪ Fi. The sets in Hi (short for Hitherto) are used to compute the images of factors defined by a non-latest αi and the latest αi of a data value d. The sets in Fi (short for henceForth) are used to compute the images of factors defined by the latest αi of d and the latest occurrence of d. During the run of the automaton, the images of factors defined by an αi and the current position is required to check whether the conclusion of the formula φi is ensured whenever the premise is met. This is be obtained from the sets by multiplying the images of factors stored in Hi, Fi, and X.

Assume that the automaton is on a position y. Let d be a data value and let x0 be the latest occurrence of d with respect to the current position if it exists, i.e., x0 = ˆd(y). Similarly, let xi0 be the latest αi of d with respect to the current position if it exists, i.e., xi0 = ˆαid(y). During the run of the automaton, the following invariants are maintained in addition to (X) and (A).

(H) The data value d is in Hm if and only if there is a factor defined by a non-latest αi and the latest αi in d’s class whose image is m. That is to say, there is a factor w(x,xi0) for some x ∈ αdi(0, xi0) with the image m.

(F) The data value d is in Fm if and only if there is a factor defined by the latest αi in d’s class and the latest occurrence of d whose image is m. That is to say, the factor w(xi0,x0) has image m.

On encountering a pair (ℓ, d′) the automaton performs the following actions in addition to those described for the sets in X and A earlier.

If ℓ = αi: The present data value d′ is removed from all the sets in H and is added to the set Hu·h(αi)·v·w if prior to the set update, the data value was present in Hu, Fv and Xw. Further, the data value is added to the set Hm if prior to the set update, the data value was present in Xm and Aαi. This is to maintain the invariant (H) in the upcoming positions. To maintain the invariant (F) in the upcoming positions, the data value is removed from the sets in F if present.

If ℓ = αi: If the present data value d′ is present in any of the sets in F, it is removed from it and added to the set Fm·h(γ)·n if prior to the set update, the data value was present in the sets Fm, Aγ, and Xn. Further, if the data value d′ was present in Xm and Aαi prior to the set update then it is added to the set Fm. This is to maintain the invariant (F). If ℓ = βi, the following operations are also performed. To satisfy φi, we need to ensure that (1) the unique set Fm containing d′ corresponds to an accepting element (i.e., m ∈ Pi) if d′ is not in Aαi (i.e., if the latest element in the class is not an αi) (2) and all the sets Hn containing d′ must satisfy n · h(αi) · m ∈ Pi. Note that this captures only the condition x ≪ y as it only considers x ○ ∼ y where x < y, thus ensuring x + 1 = y. This can be ascertained from the characteristic vector of d′. If it is not, then A halts erroneously.

Finally, at the end of the run, every configuration of the set automaton is accepting.

Case 2: x ≪ y and x 1y.

The formula φi states the property that if an αi is followed by a βi that is also the class successor of αi and not the successor of αi, then the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the sets in X already track the run of the latest data value and Aαi tracks whether this occurred with an αi. Further, the automaton tracks with its state space whether the preceeding position was labelled by αi.

Let the automaton be at a position with data value d′. Assume that d′ exists in the set Xm and Aαi before the update. If d′ is labelled by a β and d′ is not in the set V, then m has to be in the accepting set Pi to satisfy the formula. Otherwise, the automaton halts erroneously. However, if the preceeding position is labelled by αi as given by the state space then the current position is the successor of αi which does not satisfy the premise of the formula and thus the above condition is not required to be met. Finally, at the end of the run, every configuration of the set automaton is accepting.

Case 3: x + 1 = y and x 1y. The formula φi states that for each αi whose successor is a βi in the same class, the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the set Aαi tracks whether the latest occurrence of the data value was with an αi. Further, the automaton tracks with its state space whether the preceeding position was labelled by αi.

When reading a βi with data value d′ that is present in the set Aαi and the preceeding position is labelled by αi according to the state space, the set automaton halts erroneously if the empty word is not in Li. This ensures that the formula is satisfied. Finally, at the end of the run, every configuration of the set automaton is accepting.

Case 4 (5, 6): y ≪ x and y ○ ∼ x (y ≪ x and y 1 = x, y + 1 = x and y 1 = x). These cases are exactly the cases 1, 2, and 3 respectively but with the variables x and y swapped. Thus, the constructions in the cases 1, 2, and 3 follow with the change that everywhere in the construction, αi and βi are replaced by each other.

◀

▶ Lemma 28. For each formula φi of the form

(∀∃) : ∀x∃y (α(x) → β(y) ∧ o(x, y) ∧ ϵ(x, y) ∧ λ(x, y))

the h-suffix-storing set automaton A can be constructed such that, using the sets X ∪ A ∪ Yi it ensures that a data word is accepted by the automaton A if and only if it satisfies the formula φi.

Proof. We first discuss the degenerate cases below.

Consider the following cases (a) λ(x, y) is false, (b) ϵ(x, y) is x ≁ y, (c) o(x, y) or ϵ(x, y) is x = y, (d) o(x, y) is x ≪ y or x + 1 = y and λ(x, y) is Li(y, x), (e) o(x, y) is y ≪ x or y + 1 = x and λ(x, y) is Li(x, y), (f) o(x, y) is x ≪ y or x + 1 = y and ϵ(x, y) is y 1 = x, and (g) o(x, y) is y ≪ x or y + 1 = x and ϵ(x, y) is x 1 = y, (h) ϵ(x, y) is x ○ ∼ y and o(x, y) is x + 1 = y or y + 1 = x. Here, in each of these cases, the conclusion in the formula φi is false. Thus, no αi’s must occur in the data word for it to satisfy the formula. Therefore, we take a finite state automaton that ensures that no αi’s are present in the input. By the above cases (a), (d) and (e), henceforth whenever o(x, y) is x ≪ y or x + 1 = y, we assume that λ(x, y) is Li(x, y) and whenever o(x, y) is y ≪ x or y + 1 = x, we assume λ(x, y) to be Li(y, x).

Now we proceed to describe the construction for the remaining cases.

Case 1: x ≪ y and x ○ ∼ y.

The formula φi states for that each αi there is a subsequent class-distant βi that is not its immediate successor and the word bordered by them is in Li. We call such a βi, a witness of the αi and at a position in the run, if such a βi has been observed, we say that the αi has been witnessed. Observe that the condition x ○ ∼ y captures that x + 1 = y. Thus in the construction we do not need to specifically ensure that x ≪ y and can instead simply work with x < y.

Here, in addition to the sets in X and A, we take the sets Hi = {Hm | m ∈ M} and Fi = {Fm | m ∈ M}, i.e., Yi = Hi ∪ Fi.

Assume that the automaton is on a position y. Let d be a data value and let x0 be the latest occurrence of d with respect to the current position if it exists, i.e., x0 = ˆd(y). Similarly, let xi0 be the latest αi of d with respect to the current position if it exists, i.e., xi0 = ˆαid(y). During the run of the automaton, the following invariants are maintained in addition to (X), and (A).

(H) The data value d is in Hm if and only if there is a factor defined by a non-latest αi that has not been witnessed and the latest αi in d’s class whose image is m. That is to say, there is a factor w(x,xi0) for some x ∈ αdi(0, xi0) with the image m.

(F) The data value d is in Fm if and only if there is a factor defined by the latest αi of d that has not been witnessed and the latest occurrence of d whose image is m. That is to say, the factor w(xi0,x0) has image m.

On encountering a pair (ℓ, d′) the automaton performs the following actions in addition to those described for the sets in X and A earlier.

If ℓ = αi: The present data value d′ is removed from all the sets in Hi and is added to the set Hu·h(αi)·v·w if prior to the set update, the data value was present in Hu, Fv and Xw. Further, the data value is added to the set Hm if prior to the set update, the data value was present in Xm and Aαi. This is to maintain the invariant (H) in the upcoming positions. To maintain the invariant (F) in the upcoming positions, the data value is removed from the sets in F if present.

If ℓ = αi: If the present data value d′ is present in any of the sets in F, it is removed from it and added to the set Fm·h(γ)·n if prior to the set update, the data value was present in the sets Fm, Aγ, and Xn. Further, if the data value d′ was present in Xm and Aαi prior to the set update then it is added to the set Fm. This is to maintain the invariant (F) in the upcoming positions.

Additionally, If ℓ = βi, the following operations are performed. If the latest element in the class is not an αi, i.e., if d′ is not in Aαi, then the βi serves as a witness to the latest αi, if present, corresponding to the set Fm containing d′ such that m ∈ Pi. Thus, the data value d′ is removed from the set Fm using local updates. Further, the βi serves as a witness to the αi’s corresponding to the data value d′ present in a set Hm with the data value also present in Fn such that m · h(αi) · n ∈ Pi. Thus, the data value is removed from those sets in Hi using local updates. On reaching the end of the input, we check that all the αi’s are witnessed. This is done by the acceptance condition which requires that the sets {Hm, Fm | m ∈ M \ Pi} are empty. Further, the set Aαi is required to be empty, signifying that there are no data values whose latest occurrence is with an αi and is thus not witnessed.

Case 2: x ≪ y and x 1 = y.

The formula φi states that each αi is witnessed by a βi in a later position that is not its successor and is also its class successor and the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the sets in X already track the run of the latest data value and Aαi tracks whether this occurred with an αi. Further, the automaton tracks with its state space whether the preceeding position was labelled by αi.

When a data value appears that is present in Aαi and one of the sets in X, it must be labelled with a βi. Furthermore, prior to the update, it should be present in one of the sets in {Xm | m ∈ Pi} and the preceeding position must not be labelled by αi as given by the state space. This ensures that each αi is witnessed by its class successor that is a βi and is not its immediate successor. Violation of any of these will result in the automaton halting erroneously. Once the set automaton reaches the end of the input, we check that all the αi’s are witnessed. This is done by the acceptance condition which requires that there is no data value present in the set Aαi. This is because if a data value d is present in Aαi then the latest occurrence of d was with the label αi and is thus not witnessed by a βi.

Case 3: x + 1 = y and x 1 = y. The formula φi states that each αi is witnessed by its successor which is a βi in the same class and that the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the set Aαi tracks whether the latest occurrence of the data value was with an αi. Further, the automaton tracks with its state space whether the preceeding position was labelled by αi.

At each position immediately succeeding a position labelled by αi as given by the state space, it must be the case that the data value is present in Aαi, the label is βi, and the empty word belongs to the language Li. This ensures that the αi is witnessed. Violation of any of these will result in the automaton halting erroneously. Once the set automaton reaches the end of the input, we check that all the αi’s are witnessed. This is done by the acceptance condition which requires that there is no data value present in the set Aαi. This is because, if a data value d is present in Aαi with the run not yet halted, then the final occurrence was with the label αi and is thus not witnessed by a βi.

Case 4: y ≪ x and y ○ ∼ x. The formula φi states that each αi is witnessed by an earlier class-distant βi that is not its immediate predecessor and the word bordered by them is in Li. Observe that the condition y ○ ∼ x captures that y + 1 = x. Thus in the construction we do not need to specifically ensure that y ≪ x and can instead simply work with y < x.

Here, in addition to the sets in X and A, we take the sets Hi = {Hm | m ∈ M} and Fi = {Fm | m ∈ M}, i.e., Yi = Hi ∪ Fi.

Assume that the automaton is on a position y. Let d be a data value and let x0 be the latest occurrence of d with respect to the current position if it exists, i.e., x0 = ˆd(y). Similarly, let xi0 be the latest βi of d with respect to the current position if it exists, i.e., xi0 = ˆβid(y). During the run of the automaton, the following invariants are maintained in addition to (X), and (A).

(H) The data value d is in Hm if and only if there is a factor defined by a non-latest βi that has not been witnessed and the latest βi in d’s class whose image is m. That is to say, there is a factor w(x,xi0) for some x ∈ βdi(0, xi0) with the image m.

(F) The data value d is in Fm if and only if there is a factor defined by the latest βi of d that has not been witnessed and the latest occurrence of d whose image is m. That is to say, the factor w(xi0,x0) has image m.

On encountering a pair (ℓ, d′) the automaton performs the following actions in addition to those described for the sets in X and A earlier.

If ℓ = βi: The present data value d′ is removed from all the sets in Hi and is added to the set Hu·h(βi)·v·w if prior to the set update, the data value was present in Hu, Fv and Xw. Further, the data value is added to the set Hm if prior to the set update, the data value was present in Xm and Aβi. This is to maintain the invariant (H) in the upcoming positions. To maintain the invariant (F) in the upcoming positions, the data value is removed from the sets in F if present.

If ℓ = βi: If the present data value d′ is present in any of the sets in F, it is removed from it and added to the set Fm·h(γ)·n if prior to the set update, the data value was present in the sets Fm, Aγ, and Xn. Further, if the data value d′ was present in Xm and Aβi prior to the set update then it is added to the set Fm. This is to maintain the invariant (F) in the upcoming positions. Additionally, If ℓ = αi, the following operations are performed. The αi must be witnessed by an earlier βi that is class-distant. Thus, the automaton checks if either the data value d′ is present in a set Fm such that m ∈ Pi or if it is present in sets Hm and Fn such that m · h(βi) · n ∈ Pi. If either of the above are met, then the corresponding βi serves as a witness to the αi. Otherwise, the automaton halts erroneously. Finally, at the end of the input, every configuration of the automaton is accepting.

Case 5: y ≪ x and y 1 = x.

The formula φi states that each αi is witnessed by its class predecessor which is a βi that is not its immediate predecessor and the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the sets in X already track the run of the latest data value and Aβi tracks whether this occurred with an βi. Further, the automaton tracks with its state space whether the preceeding position was labelled by βi.

At each position labelled by αi, the corresponding data value must be present in Aβi. Furthermore, prior to the update, it should be present in one of the sets in {Xm | m ∈ Pi} and the preceeding position must not be labelled by βi as given by the state space. This ensures that each αi is witnessed by its class predecessor that is a βi and is not its immediate predecessor. Violation of any of these will result in the automaton halting erroneously. Finally, at the end of the input, every configuration of the automaton is accepting.

Case 6: y + 1 = x and y 1 = x. The formula φi states that each αi is witnessed by its predecessor which is a βi in the same class and that the word bordered by them is in Li. Here, the automaton does not require any sets Yi as the set Aβi tracks whether the latest occurrence of the data value was with a βi. Further, the automaton tracks with its state space whether the preceeding position was labelled by βi.

At each position labelled by αi, the corresponding data value must be present in Aβi. Further, the preceeding position must be labelled by βi according to the state space. Finally, the empty word must be in the language Li. Violation of any of these will result in the automaton halting erroneously. Finally, at the end of the input, every configuration of the automaton is accepting. ◀

Proofs for Section 4

▶ Proposition 39. Satisfiability of EMSO2[Σ, <, +1, ∼, 1, F] formulas over data words is undecidable for the following families of languages F:

1. {Σ∗aΣ∗, Σ∗bΣ∗}, where a, b ∈ Σ.

2. {(Σ \ {a})∗ a (Σ \ {a})∗}, where a ∈ Σ.

Proof. We use a reduction from the halting problem of two-counter machines that is known to be undecidable [17].

First, we recall two counter machines. Let i ∈ {1, 2}.

A two-counter machine M is a tuple (Q, q0, ∆, qf) where Q is the set of states with an initial state q0 and a final state qf, ∆ ⊆ Q × I × Q is the transition relation where I = {Ii, Di, Zi}. The instruction Ii increases the value of counter i by one, Di decreases the value of counter i by one, while Zi performs a zero test for counter i. The final state qf is reached after performing the zero-tests (q, Z1, qf), and (q, Z2, qf). While incrementing a counter can happen unconditionally, a counter can be decremented only when the counter value is non-zero.

A configuration of a two-counter machine is of the form (q, c1, c2) where q ∈ Q is a state, c1 and c2 are the values of counter 1 and counter 2 respectively. An accepting run of a two-counter machine is a sequence of configurations from the initial configuration (q0, 0, 0) to the final configuration (qf, 0, 0).

Proof of (1): We encode the run of a given two-counter machine M = (Q, q0, ∆, qf) as a data word over the alphabet ∆, the string projection of which corresponds to the sequence of transitions of the two-counter machine. We partition the alphabet ∆ into six disjoint subsets, {∆α ⊆ ∆ | α ∈ {ι1, δ1, z1, ι2, δ2, z2}}. Each transition incrementing counter i is belongs to the class ∆ιi. Similarly, the transitions decrementing and zero-testing counter i belong to ∆δi and ∆zi respectively. The same data value is used when a counter’s value is incremented from the value c to c + 1 and its subsequent decrement from c + 1 to c. Apart from this, each transition is given a unique data value from the infinite domain.

We write a formula ϕ ∈ EMSO2[∆, <, +1, ∼, 1, F] that is satisfied by the data word w = (γ1, d1), . . . , (γn, dn), where γi ∈ ∆ for i ∈ [n], encoding the run of the two-counter machine M if and only if the run is accepting. The formula ϕ is a conjunction of the following formulas describing sufficient properties for an accepting run of a two-counter machine M.

1. Each position is labelled by exactly one transition. We write

∀x γ∈∆ γ(x) ∧ ∀x γi,γj∈∆, γi=γj ¬(γi(x) ∧ γj(x)).

2. The first position is labelled by a transition from an initial state. Let ∆I ⊆ ∆ denote the set of transitions from an initial state. We write

∃x (∀y x < y ∨ x = y) → γj∈∆I γj(x).

3. The last position is labelled by a transition to a final state. Let ∆F ⊆ ∆ denote the set of transitions to a final state. We write

∃x (∀y y < x ∨ y = x) → γj∈∆F γj(x).

4. We say two transitions γi, γj ∈ ∆ are compatible, denoted as comp(γi, γj), if the target state of γi is the source state of γj. Then, we state that consecutive positions are labelled by compatible transitions. We write

∀x∀y y = x + 1 ∧ γi(x) → γi,γj∈∆, comp(γi,γj) γj(y).

5. Each class is a word in ∆ιi∆δi or ∆zi, for i ∈ {1, 2}. We write

∀x∀y i∈{1,2} (x < y ∧ x ∼ y → γιi∈∆ιi, γδi∈∆δi γιi(x) ∧ γδi(y))

6. There is no position with a label from ∆zi between two positions with labels from ∆ιi and ∆δi of the same class, for i ∈ {1, 2}. We write

∀x∀y i∈{1,2} γιi∈∆ιi γδi∈∆δi γιi(x) ∧ γδi(y) ∨ γδi(x) ∧ γιi(y) ∧ x ∼ y → ¬∆∗∆zi∆∗(x, y).

We observe that the languages ∆∗∆z1∆∗ and ∆∗∆z2∆∗ belong to the given family F with Σ = ∆, renaming ∆z1 as a and ∆z2 as b.

This concludes our proof.

Proof of (2): We encode the run of a given two-counter machine M = (Q, q0, ∆, qf) as a data word over the alphabet Σ = ∆ ∪ {c1, c2}. The string projection of the data word is of the form (∆c∗1c∗2)∗ which corresponds to the sequence of transitions of the two-counter machine along with the number of ci’s denoting the value of the counter ci after the transition.

We partition the alphabet ∆ into six disjoint subsets, {∆α ⊆ ∆ | α ∈ {ι1, δ1, z1, ι2, δ2, z2}}. The same data value is used for a transition incrementing a counter, its corresponding ci present in each factor ∆c∗1c∗2, and the transition eventually decrementing it. Thus, each class is of the form ∆ιic+i∆δi or ∆zi for the zero-test transitions, where i ∈ {1, 2}.

We write a formula ϕ ∈ EMSO2[Σ, <, +1, ∼, 1, F] that is satisfied by the data word w = (γ1, d1), . . . , (γn, dn), where γi ∈ Σ for i ∈ [n], encoding the run of the two-counter machine M if and only if the run is accepting. The formula ϕ is a conjunction of the following formulas describing sufficient properties for an accepting run of a two-counter machine M.

1. Each position is labelled by exactly one letter, i.e.,

∀x γ∈Σ γ(x) ∧ ∀x γi,γj∈Σ, γi=γj ¬(γi(x) ∧ γj(x)).

2. The string projection is a word in (∆c∗1c∗2)∗. We say two transitions γi, γj ∈ ∆ are compatible, denoted as comp(γi, γj), if the target state of γi is the source state of γj. Then, we state that two positions labelled by transitions in ∆ with no such position in between, are labelled by compatible transitions. This is written as an EMSO2[Σ, <, +1] formula.

3. Each class is a word in ∆ιic+i∆δi or ∆zi for i ∈ {1, 2}. This is written as an EMSO2[Σ, <, +1, ∼, 1] formula.

4. The first position is labelled by a transition from an initial state. Let ∆I ⊆ ∆ denote the set of transitions from an initial state. Then, we write

∃x (∀y x < y ∨ x = y) → γj∈∆I γj(x).

5. The last position is labelled by a transition to a final state. Let ∆F ⊆ ∆ denote the set of transitions to a final state. Then, we write

∃x (∀y y < x ∨ y = x) → γj∈∆F γj(x).

6. For each position with a label from ∆zi, we ensure that the previous factor of the form ∆c∗1c∗2 does not have any ci’s. This is a regular property that can be written as an EMSO2[Σ, <, +1] formula.

7. Between two positions labelled by ci of the same class, there is exactly one position with label from ∆, for i ∈ {1, 2}. We write

∀x∀y i∈{1,2}ci(x) ∧ ci(y) ∧ x 1 = y → (c1 + c2)∗∆(c1 + c2)∗(x, y).

We observe that the language (c1 + c2)∗∆(c1 + c2)∗ belongs to the given family F with alphabet Σ = ∆ ∪ {c1, c2}, renaming ∆ as a.

Hence, the result follows. ◀

Proofs for Section 5

▶ Lemma 41. In a set automaton, the following acceptance conditions are equivalent: Let (q, X) be the configuration reached at the end of the run.

1. (F ⊆ Q, C ⊆ 𝟚Y): q ∈ F and the characteristic vector of each data value present in X is in C.

2. (F ⊆ Q, Fℓ ⊆ Q): q ∈ F and at every class maximal position the state reached is in Fℓ.

3. (F ⊆ Q, C ⊆ 𝟚Y): q ∈ F and at every class maximal position with data value d, the characteristic vector of d is in C.

4. (F ⊆ Q, S ⊆ Y): q ∈ F and the subset S of the sets are empty.

Proof. (1 ⇒ 2): Let A1 = (Q, Y, A, ∆, I, F, C), with acceptance condition (1). The idea is to verify that at each class maximal position i, the characteristic vector ci of the corresponding data value is such that on applying the sequence of update relations ρi+1 · · · ρn in the transitions of the rest of the run (since there are no more local updates affecting d), results in a characteristic vector present in the accepting set of configurations C.

We construct a finite state automaton B to verify this and using this automaton we construct a set automaton with the acceptance condition (2).

Let Q′ = Q × RY × 𝟚Y × 𝟚. This serves as the alphabet for the automaton B, tracking the current state, update relation, and the characteristic vector along the run of the set automaton A1 respectively. The final element of the tuples in Q′ is used as a flag to track whether the characteristic vector, on performing the rest of the update relations in the run of A1, belongs to C. Consider the language

L = {(q1, ρ1,c1, b1) · · · (qn, ρn, cn, bn) ∈ Q′∗ | bn = 1 ⇔ cn ∈ C

The above language consists of all runs from a state q1 to qn of the set automaton such that the characteristic vector at the end of the run is in C as well as at every position i along the run the characteristic vector is maintained such that the remaining set updates take it to the accepting set of characteristic vectors C. The above language is regular and is accepted by a deterministic automaton that reads the input from right-to-left. Let B be the finite state automaton recognising this language over the alphabet Q′ with a finite set of states QB and final states FB.

We construct a set automaton A2 = (Q′ × QB, Y, A, ∆′, I, F′, Fℓ) with the acceptance condition (2). We define the transitions ∆′ in A2 in the following way: For each transition (q, a, χ, ρ, α, β, q′) ∈ ∆, in A1 we have the transitions (p, a, χ, ρ′, α, β, p′) where p = ((q, ρ, c, b), r) ∈ Q′ × QB (ρ, c, and b are not relevant) and p′ = ((q′, ρ′, c′, b′), s) is such that b′ ∈ {0, 1}, c′ ∈ 𝟚Y is obtained by applying the set update ρ′ to χ and then modifying the resulting vector by the local update operations (i.e., c′ = ρ′(χ) + α − β) and s is a state reached after reading the tuple (q′, ρ′, c′, b′) from the state r in B. We let F′ = F × RY × C × {1} × FB, and Fℓ = {(q, ρ, c, b) | b = 1} × FB.

(2 ⇒ 3): We construct a new set automaton that has |Q| (say n) additional sets DX = {Xq1, . . . , Xqn}, along with the sets of the given automaton. The automaton preserves the property that at any point during the run a data value is present in at most one of the sets in DX. After each transition with a target state q, the current data is removed from all the other sets in DX and is added to the set Xq. To finish the construction, we take C to be the set of all vectors that has a 1 in at least one of the components corresponding to the sets {Xqi | i ∈ [n], qi ∈ Fℓ}. This ensures that on each class maximal position the state reached is in Fℓ.

(3 ⇒ 4): For this translation, we construct a new set automaton that has two additional sets along with the sets of the given automaton. Let’s call the new sets a sink set and a set X. The sets X and sink are always updated with the identity transformation. When a data value appears for the first time, it is added to the set X.

For each class, the new automaton guesses the last occurrence of the data value, that is, the class maximal position of the data value. At the class maximal position in the new automaton, the characteristic vector of the data present should be in C (otherwise the automaton halts erroneously). Also at the class maximal position, in the corresponding transition of the new automaton, the data value is removed from every set in which the data value exists by local updates and is added to the sink set. Thus, following the class maximal position, the data value should only be in the sink set. If the new automaton guesses the class maximal position wrongly, this can be easily checked: When a data value is read that is in the sink set, it will lead to a non-accepting state. In case a data value appears only once, it is directly added to the sink set rather than adding to the set X. At the end of the run the new automaton verifies that the set X is empty, i.e., for each class a class maximal position has been guessed and verified.

(4 ⇒ 1): To convert a set automaton with acceptance condition (4) to a set automaton with acceptance condition (1), we take C ⊆ 𝟚Y to be the set of all vectors whose ith components are 0 for each i ∈ S. ◀

▶ Proposition 42. For each data automaton there is an equivalent set automaton where each set is stable and thus having the update monoid be trivial.

Proof. Data automata and class memory automata are known to be expressively equivalent [2] with an effective translation in both directions. Therefore it suffices to consider class memory automata in place of data automata.

First we recall class memory automata introduced in [2]. Formally, a class memory automaton (CMA) A = (Q, Σ, ∆, q0, Fℓ, Fg) where Q is the finite set of states, q0 is the initial state, Fℓ ⊆ Fg ⊆ Q are the local and global accepting states respectively.

The CMA has a hash function h : D → Q ∪ {⊥} such that h(d) = ⊥ for only finitely many d, which are precisely those that appear in the run of an input data word. The hash function h holds the state the automaton moved to when the data value d was read the last time. Each transition δ of the form (p, ℓ, s, q) on the input (ℓ, d), if the current hash value of d is s, takes the state from p to q and updates the hash value of d to q. Initially, the hash value of every data value d is set to ⊥. In an accepting run, the hash value for every data value d at the end of the run is in Fℓ ∪ {⊥} and the state is in Fg.

First, we show that for every CMA, there is an equivalent identity set automaton. Consider a CMA A = (Q, Σ, ∆, q0, Fℓ, Fg). Let |Q| = k be the number of states of the CMA A. Let B be the required identity set automaton consisting of log2(k) number of sets with the same state space Q as the CMA A. The set automaton B when simulating the CMA A remembers the local state of A using the log2(k) sets. Each local state of the CMA is denoted using a binary encoding of length log2(k). For instance, if k = 4, the local states q0, q1, q2, q3 shall be represented as 00, 01, 10, and 11, respectively. Let d be a data value present in the data word w. The binary encoding of the local state of d in A is given by its characteristic vector of membership in the set automaton B.

A transition of the form (p, a, s, q) on the input (a, d) is simulated by the set automaton B as follows. Checking whether the current data value d is in the local state s is done by enabling the transition only if the characteristic vector χ for membership check denotes the binary encoding of the state s. The local state of d is updated to q by updating the sets so that the new characteristic vector χ′ for membership of d denotes the binary encoding of the state q. Note that these do not require any global updates as they can be accomplished using the local updates α and β to add and delete the current data value at the necessary sets. Thus, each set in the automaton B is stable. This set automaton, using the acceptance condition (2) given in Lemma 41, simulates the local acceptance condition of the CMA A through the set of accepting characteristic vectors C. The accepting set of states is F = Fg ⊆ Q in the set automaton B.

Thus, we can simulate accepting runs of the class memory automaton A using an equivalent set automaton B where all the sets are stable. ◀

▶ Proposition 43. Set automata are expressively equivalent to class automata.

Proof. We recall the definition of a class automaton [5].

A class automaton over the alphabet Σ is a tuple A = (B, C) where B is a nondeterministic letter-to-letter transducer with input alphabet Σ and output alphabet Γ, and C is a nondeterministic finite automaton over Γ × {0, 1}. A run of a class automaton on a data word w = (a1, d1) · · · (an, dn) is accepting if there is an accepting run of B on the string projection str(w), yielding the output w′ = b1 · · · bn ∈ Γ∗, such that for each class X of w, the class string w′X ∈ (Γ × {0, 1})∗ obtained by labelling w′ by 1 at positions in X and 0 everywhere else, is accepted by the automaton C. Here, the word w′X is called the class string of X.

First, we show that for every set automaton, there is an equivalent class automaton. Consider a set automaton S = (Q, Y, A, ∆, I, F, Fl) with the acceptance condition (2) from Lemma 41 recognising the language L. We sketch the construction of a class automaton A = (B, C) recognising L. The set automaton S has the following regular properties for a run: (1) the first position is in an initial state, (2) at the final position, there is a transition to an accepting state, and (3) for each pair of consecutive positions x and y, there is a transition from the state at position x to the state at position y.

Such regular properties in the run of a set automaton are verified by the transducer B. Recall that B is a nondeterministic letter-to-letter transducer with input alphabet Σ and output alphabet Γ. The transducer B does not have access to the data values in the input word of the set automaton S and reads only the string projection. Thus B nondeterministically guesses the characteristic vector of membership of the current data value at each position and simulates the run of S. More precisely, on simulating a transition (p, ℓ, χ, ρ, α, β, q) of S, the transducer outputs (χ, ρ, α, β). Thus, the output alphabet of B is Γ = 𝟚Y × RY × 𝟚Y × 𝟚Y. The state space of B is the same as that of S and hence is Q.

The idea is that for the transducer B to ensure that the regular constraints are satisfied while the NFA C ensures that the class constraints are met.

The NFA C, on each class string, verifies that (1) the class-minimal position has a transition on the zero vector, (2) at the class-maximal position, there is a transition to a local final state, and (3) the transitions on successive positions in a class are on characteristic vectors which are consistent as per the update relations in the interval between the two positions. That is, for any two positions x and y such that y = x 1, the vector χy at position y must satisfy χy = M(ρx+1ρx+2 · · · ρy−1)T(χ′x) where χ′x = M(ρx)Tχ + αx − βx. Here, (χx, ρx, αx, βx) is the label on the position x. The above properties can be recognised by a NFA and hence we can see that the class automaton C accepts L.

Now, we show that for every class automaton, there is an equivalent set automaton. Consider a class automaton A = (B, C) recognising L, with Γ as the output alphabet of the transducer B. The states of the constructed set automaton S keep track of how the current state of the transducer B evolves over a run. Thus when the transducer reaches an accepting state after reading the string projection of the input word, the same is reflected in the run of the set automaton S. Since the number of classes in an input data word can be unbounded, the runs of C on the class strings cannot be simulated in the finite state space of S. The sets of S are used to track this information. Let k be the number of states of the NFA C. The set automaton S uses k sets X1, . . . , Xk each corresponding to a state of C.

Suppose on a position with (ℓ, d) in the input word, the transducer reads ℓ ∈ Σ and outputs a ∈ Γ. In the class strings that the NFA C reads, the corresponding position has can thus have either (a, 0) or (a, 1). Thus there are bounded number of runs of the NFA C that S simulates when reading a letter-data pair. The set automaton, at each position, makes a global update followed by a local update to simulate the run of the class automaton corresponding to all possible class strings. At any position in the run of the set automaton S, a data word d being present in a set X means that the run of the NFA C on the class string of d until that position is at the state corresponding to the set X. Consider the case where the NFA reads (a, 0) and makes a transition from state p to p′. This is simulated in S by moving the content of set Xp to set Xp′ by a global update. On the other hand, C reading (a, 1) and making a transition from p to p′′ is simulated by a local update where only the current data value is moved from the set Xp′ to set Xp′′. This is because the transition on (a, 1) occurs only in the class string corresponding to the current data value and hence it can be simulated using local updates for the data value.

Further, the set automaton S also needs to remember in its state space the state q that the NFA C reaches on reading the class-minimal position on the class string so that the first time a data value d is encountered, it is added to the set Xq using local updates. Note that starting from the initial state of C, the class string that takes C to state q has all 0’s when projected to the data values. Let QB, QC, and QS be the state space of the transducer B, NFA C, and set automata S respectively. We have that QS = QB × QC.

The set automaton S given by the ideas sketched above is the required set automaton recognising L. ◀