{'fraction_non_alphanumeric': 0.045542624279221615, 'fraction_numerical': 0.011074444222616293, 'mean_word_length': 4.063146628612201, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 46, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Logic Meets Algebra: the Case of Regular Languages

The study of finite automata and regular languages is a privileged meeting point of algebra and logic. Since the work of Buchi, regular languages have been classified according to their descriptive complexity, i.e. the type of logical formalism required to define them. The algebraic point of view on automata is an essential complement of this classification: by providing alternative, algebraic characterizations for the classes, it often yields the only opportunity for the design of algorithms that decide expressibility in some logical fragment. We survey the existing results relating the expressibility of regular languages in logical fragments of MSO[S] with algebraic properties of their minimal automata. In particular, we show that many of the best known results in this area share the same underlying mechanics and rely on a very strong relation between logical substitutions and block-products of pseudovarieties of monoid. We also explain the impact of these connections on circuit complexity theory.


Introduction
Kleene's theorem insures that finite automata and regular expressions have the same expressive power and so we tend to forget that these two points of view on regular languages are of a different nature: regular expressions are well suited to reflect the combinatorial structure of a language while finite automata are first and foremost algebraic objects. It is intuitively clear that the combinatorial properties of a regular language should somehow be reflected in the structure of the corresponding automaton but this is difficult to formalize without resorting to algebra.
On one hand, the algebraic point of view on finite automata pioneered by Eilenberg [Eil76] has been a driving force in our understanding of regular languages: each letter of an automaton's alphabet defines a transformation of the set of states and one can identify an automaton with its transition monoid, i.e. the finite monoid generated by these functions. Any regular language L can then be canonically associated with the transition monoid of its minimal automaton (the syntactic monoid of L) and many important classes of regular languages defined combinatorially can be characterized by the algebraic properties of their syntactic monoid.
On the other hand, Büchi showed in 1960 that the expressive power of monadic second order logic with successor MSO[S] (or equivalently with order MSO[<]) was exactly that of finite automata [Büc60]. Since then numerous results have related the expressive power of various sublogics to well-known classes of regular languages. The most notable example of this sort concerns languages definable by a first-order sentence using order. Mc-Naughton and Papert showed that a regular language is definable in FO [<] if and only if it is star-free [MP71], i.e. if and only if the language can be described by a regular expression constructed from the letters of the alphabet, the empty set symbol, concatenation, union and complementation.
The result of McNaughton and Papert is non-trivial but it is stating an equivalence of two, not so different combinatorial descriptions of the class SF of star-free languages and neither of these is of any help to decide if a given language belongs to SF . This is precisely why the algebraic point of view on automata is so fruitful. Intuitively, the fact that a language is star-free should translate into structural properties of the corresponding automaton and indeed, an earlier result of Schützenberger shows that L ∈ SF if and only if its syntactic monoid contains no non-trivial group [Sch65]. This immediately provides an algorithm to decide definability in FO [<]. While it is fairly easy to show that a star-free language has a group-free syntactic monoid, the converse requires a very good understanding of the algebraic structure of these monoids.
Over the last thirty years, many of the most natural fragments of MSO[<], including a number of temporal sublogics of LTL, have been characterized algebraically in the same way. It seems surprising, at first glance, that so many questions about the expressivity of logical fragments of MSO [<] have an algebraic answer but Straubing provided elements of a meta-explanation of the phenomenon [Str02]. For the majority of results simultaneously providing alternate logical, algebraic and combinatorial descriptions of a same class of regular languages, the greatest challenge is to establish the bridge between the combinatorial or logical characterization and the algebraic one.
One objective of the present survey is to give an overview of the existing results in this line of work and to provide examples illustrating the expressive power of various classes of logical sentences. We also want to demonstrate that our understanding of the underlying mechanics of the interaction between logic and algebra in this context has recently grown much deeper. We have a much more systematic view today of the techniques involved in bridging the algebraic and logical perspectives on regular languages and this seems primordial if we hope to extend them to more sophisticated contexts such as the theory of regular tree-languages.
We focus particularly on one such technique known as the block-product/substitution principle. Substitutions are a natural logical construct: informally, a substitution replaces the label predicates Q a x of an MSO[<] sentence φ by a formula with free variable x. We want to understand the extra expressive power afforded to a class of sentences Λ when we substitute the label predicates of the φ in Λ by formulas from a class Γ. Under the right technical conditions, this logical operation can be put in correspondence with the blockproduct operation on pseudovarieties, an algebraic construct tied to bilateral semidirect products which reflects the combinatorial structure of substitutions. While this connection is not always as robust as we would hope it to be, it is still sufficient to derive the results of McNaughton-Papert and Schützenberger mentioned earlier, as well as results on temporal logic [CPP93,TW98,TW02,TW04], first-order sentences augmented with modular quantifiers [STT95] and sentences with a bounded number of variables [TW98,ST02,ST03,TT06].
Both logic and algebra have also contributed significantly in boolean circuit complexity. In particular, the circuit complexity classes AC 0 , CC 0 and ACC 0 have interesting logical and algebraic characterizations: a language L lies in AC 0 if and only if it definable by an FO sentence using arbitrary numerical predicates [GL84,Imm87] if and only if it can be recognized by a polynomial-length program over a finite aperiodic monoid [BT88]. This makes it possible to attack questions of circuit complexity using either the logical (e.g. [Str94,Lib04,LMSV01,Lyn82a,Str92,RS06,KLPT06]) or the algebraic perspective (e.g. [BST90,BS95,BS99,Bou05,GRS05,MPT91,Thé94]). Furthermore, the recent results on the expressivity of two-variable logical sentences using order [EVW97,TW98,ST03] have found surprising connections with regular languages which can be recognized by bounded depth circuits that use only O(n) gates or O(n) wires [KLPT06,KPT05] and the communication complexity of regular languages [TT05a,TT05b].
We begin by reviewing in Sections 2 and 3 the bases of the logical and algebraic approach to the study of regular languages and introduce the block-product/substitution principle. We then consider two types of applications of this principle in Sections 4 and 5 and finally explore some of the connections to computational complexity in Section 6.

Logic on Words
We are interested in considering logical sentences describing properties of finite words in Σ * . Variables in these sentences refer to positions in a finite word.
Example 2.1. Consider for instance the sentence We think of φ as being true on words of {a, b, c} * that have positions x and y each holding the letter a so that any position in between them holds a c. We can therefore think of this sentence as defining the regular language {a, b, c} * ac * a{a, b, c} * .
There is a considerable amount of literature dealing with the expressive power of these types of logics. Straubing's book on the links between logic, algebra and circuit theory [Str94] is certainly the reference which is closest in spirit to our discussion. Other valuable surveys and books include [Lib04,Pin96,Pin01,Tho97].
More formally we construct formulas using variables corresponding to positions in a finite word w ∈ Σ * , usual existential and universal quantifiers, the boolean constants T and F, and boolean connectives. Moreover, for every letter a ∈ Σ, we have a unary predicate Q a x (the 'content' or 'label' predicate) which over a finite word w is interpreted as 'position x in the word w holds the letter a'. We further allow numerical predicates from some specified set N = {R 1 , . . . , R k }: the truth value of a numerical predicate R i (x 1 , . . . , x t i ) only depends on the values of the variables x i and on the length 1 of the string w but not on the actual letters in those positions and we thus formally consider R i of arity t i as a subset of N t i +1 .
A word structure over alphabet Σ and variable set V = {x 1 , . . . , x k } is a pair (w, − → p ) consisting of a word w ∈ Σ * and a list of pointers − → p = (p 1 , . . . , p k ) with 1 ≤ p i ≤ |w| which associate each variable x i ∈ V with a position p i in the string. We identify the word w with the word structure (w, − → 0 ). Following [TW04], we further define a pointed word to be a word structure (w, p) with a single pointer p and a pointed language to be a set of pointed words. Alternatively, we can view a pointed word (w, p) as a triples (u, a, v) ∈ Σ * × Σ × Σ * with u = w 1 . . . w p−1 , a = w p and v = w p+1 . . . w |w| . Accordingly, we view pointed languages as subsets of Σ * × Σ × Σ * .
A simple extension of a word structure (w, − → p ) over Σ, V is a word structure (w, We can now formally define the semantics of our formulas in a natural way. If w = w 1 . . . w t is a word and − → p = (p 1 , . . . , p k ) is a list of pointers to w, we have If φ is a sentence, i.e. a formula with no free variable, we denote as L φ ⊆ Σ * the language L φ = {w : (w, − → 0 ) |= φ}. Similarly, formulas naturally define a set of word structures and it is often useful to consider the special case of formulas with a single free variable. Such a formula defines a set of pointed words (w, p) with 1 ≤ p ≤ |w|, i.e. a pointed language. For any formula φ having a single free variable and Φ a class of such formulas, we denote as P φ the pointed language P φ = {(w, p) : (w, p) |= φ} and P(Φ) the class of all P φ with φ ∈ Φ.
For a set of numerical predicates N , we denote as FO[N ] both the class of first-order sentences constructed with predicates in N and, with a slight abuse of notation, the class L(FO[N ]) of languages definable by such sentences. The expressive power of this logic is of course highly dependent on the choice of numerical predicates used. In particular, various results mentioned in our introduction can be combined to obtain: 1 Allowing the truth value of numerical predicates to also depend on the length of w might seem nonstandard. It is equivalent to assuming that formulas have access to the constant max and since this constant is easily definable in first-order, it would appear that this relaxed definition of numerical predicates is unnecessary. However max cannot be defined in very weak fragments of FO or in logics using modular quantifiers. In these cases the connection of logic to circuit complexity (see Section 6) is best preserved with this slightly more general formulation.
There is a considerable body of work concerning the case where the available numerical predicates are order (¡), successor (S) or both. Of course FO[S] is contained in FO[<] = FO[<, S] and that containment is known to be proper [Tho82]. In turn, FO[<] is clearly contained in MSO[S] and Büchi's theorem thus guarantees that all languages definable in these first-order fragments are regular.
One can further augment the expressive power of first-order sentences by introducing modular quantifiers ∃ i mod m x φ(x) (for some m ≥ 2 and i ≤ m − 1). Intuitively . The next three examples will serve to illustrate results of the later sections.
holds true for words over the alphabet Σ = {a, b, c, d} in which there are an even number of positions x holding an a and whose prefix lies in Σ * bc * . The sentence thus defines the regular language Example 2.4. The regular language K = (b * ab * a) * bΣ * over the alphabet Σ = {a, b} is defined by the sentence Example 2.5. The sentence is true of words over the alphabet {a, b, c} such that the position x holding the first a has a suffix containing an even number of c's. Thus the language defined is {b, c} * a({a, b} * c{a, b} * c{a, b} * ) * .
We denote as FO + MOD[N ] the class of first-order sentences constructed with the content predicates and numerical predicates in N and with existential, universal and modular quantifiers. We also denote as MOD[N ], the class of sentences in which only modular quantifiers are used. Once again Büchi's theorem guarantees that L(FO + MOD[<]) contains only regular languages because the modular quantifiers can be simulated in monadic second order.
Definition 2.6. Let Σ be an alphabet and Φ = {φ 1 (x), . . . φ k (x)} be a set formulas over Σ with at most 2 one free variable, say x. A Φ-substitution σ over Σ is a function mapping any sentence ψ over the alphabet 2 Φ (the power set of Φ) to a sentence σ(ψ) over the alphabet Σ as follows. We assume without loss of generality that the set of variables used in ψ is disjoint from the set of variables in any φ i and replace each occurrence of the predicate Q S y in ψ with S ⊆ Φ by the conjunction φ i (x)∈S φ i (y) ∧ φ i (x) ∈S ¬φ i (y). The following lemma formalizes the semantics of substitutions.
Lemma 2.7. Let σ be a Φ-substitution and for any w = w 1 . . . w n in Σ * let σ −1 (w) be the word u 1 . . . u n over the alphabet The proof is straightforward and is omitted [TW04,TT05b]. If Γ is a class of sentences and Λ is a class of formulas with one free variable we denote by Γ • Λ the class of sentences which are Boolean combinations of sentences in Λ and of sentences obtained by applying to a sentence ψ of Γ a Φ-substitution for some Φ ⊆ Λ. Substitutions provide a natural way to decompose complex sentences into simpler parts. For instance, the class of FO[<] sentences of quantifier depth k can be decomposed as the class of sentences of depth 1 in which label predicates are replaced with formulas of quantifier depth k − 1.
We are most interested in the case above where Γ is a class of sentences although the definition of Γ • Λ can be naturally extended to the case where Γ is a class of formulas with one free variable. Under this more general setting the substitution operator is associative: if Γ, Λ, Ψ are classes of formulas with at most one free variable, then Γ •(Λ•Ψ) = (Γ •Λ)•Ψ.

Regular Languages, Finite Monoids and the Block Product/Substitution Principle
We give in the first half of this section a brief introduction to the algebraic theory of regular languages which is required for the sequel. A very thorough overview of the subject can be found in the survey of Pin [Pin97] or his earlier book [Pin86]. We also refer the interested reader to the survey of Weil which provides a shorter, more superficial introduction but considers more broadly the notion of algebraic recognizability for trees, infinite words, traces, pomsets and so on [Wei04]. In the section's second half, we state and prove the block-product/substitution principle which underlies many of the results presented in Sections 4 and 5.

Regular Languages, Automata and Finite Monoids.
A semigroup S is a set with a binary associative operation which we denote multiplicatively. A monoid M is a semigroup with a distinguished identity element 1 M . In the sequel, S and M always denote respectively a finite semigroup and a finite monoid. The set Σ + of finite non-empty words over Σ forms a semigroup under concatenation (the free semigroup over Σ) while the set Σ * of finite words over Σ is a monoid with identity ǫ, the empty word.
We say that M divides the monoid N and write M ≺ N if M is the homomorphic image of a submonoid of N . A class V of finite monoids forms a pseudovariety if it is closed under finite direct product, homomorphic images and formation of submonoids. In particular, the following classes all form pseudovarieties: • finite monoids M; • finite groups G; • finite solvable groups G sol ; • finite Abelian groups Ab; • finite solvable monoids M sol , i.e. monoids whose subgroups are solvable.
A monoid M is said to be aperiodic or 'group free' if all its subgroups are trivial and we denote as A the pseudovariety of finite aperiodic monoids. The pseudovariety SL of semilattices consists of finite monoids which are idempotent (x 2 = x) and commutative (xy = yx) and it is easy to see that SL ⊆ A.
An element e of M is idempotent if e 2 = e. For any finite monoid, there is always an integer ω, the exponent of M such that x ω is idempotent for all x ∈ M . Pseudovarieties can often be conveniently described 3 as the class of monoids satisfying a certain set of identities. For instance, the pseudovariety of groups G is the class of monoids satisfying x ω y = yx ω = y (i.e. the only idempotent is the identity element of the group) and the pseudovariety A of aperiodics is defined by the identity x ω+1 = x ω .
We say that the language L ⊆ Σ * is recognized by M if there exists a homomorphism ρ : Σ * → M and a subset F ⊆ M such that L = ρ −1 (F ). A simple variant of Kleene's theorem states that a language is regular if and only if it can be recognized by a finite monoid. When one chooses to consider languages as subsets of Σ + it is more natural to define recognition by finite semigroups and, for technical reasons, the algebraic theory of regular languages is slightly altered. The two parallel approaches coexist but cannot be completely reconciled despite their close relationship [Pin97]. For simplicity, we focus on the first case.
The syntactic congruence of a language L ⊆ Σ * is defined by setting x ≡ L y if and only if uxv ∈ L ⇔ uyv for all u, v ∈ Σ * . The Myhill-Nerode theorem states that ≡ L has finite index if and only if L is regular. The syntactic monoid M (L) of L is the quotient Σ * / ≡ L and is thus finite if and only if L is regular. It can be shown that M (L) recognizes L and divides any monoid also recognizing L.
Example 3.1. Consider the language L = (ab) * . It is easy to see that for any word u containing two consecutive a or two consecutive b we have u ∈ L and, moreover, xuy ∈ L for any x, y ∈ {a, b} * . Thus, any two such u are equivalent under the syntactic congruence and we denote the corresponding element of the syntactic monoid as 0 since it will satisfy 0m = m0 = 0 for all monoid elements m. Simple computation shows that the syntactic monoid of L is the six-element monoid B 2 = {1, a, b, ab, ba, 0} where multiplication is specified by aba = a, bab = b, aa = bb = 0. It is often convenient to name elements of a syntactic monoid using words in Σ * that are minimal-length representatives for the different equivalence classes of the syntactic congruence.
For u ∈ Σ * , the right-quotient of L by u is Lu −1 = {x : xu ∈ L} and the left-quotient is defined symmetrically. A class V of languages is a variety of languages 4 if it is closed under boolean operations, left and right quotients and under inverse homomorphisms between free monoids (i.e. if L ∈ V and ρ : Γ * → Σ * is a homomorphism then ρ −1 (L) ∈ V). The very tight relationship existing between varieties of languages and pseudovarieties of finite monoids is the cornerstone of algebraic automata theory.
Theorem 3.2 (Variety Theorem [Eil76]). There is a natural bijection between pseudovarieties of finite monoids and varieties of languages: If V is a pseudovariety of finite monoids, then the class L(V) of regular languages recognized by some monoid in V forms a language variety.
Conversely, if V is a variety of languages then the pseudovariety of monoids V generated by the syntactic monoids of languages in V is such that L(V) = V.
One of the main objectives of algebraic automata theory is to explicitly relate natural varieties of regular languages with their algebraic counterpart or, conversely, describe combinatorially the variety of regular languages corresponding to a given pseudovariety of monoids. An algebraic characterization of a variety of languages V provides a natural approach for deciding if a given regular language L belongs to V: checking if K belongs to V is equivalent to deciding if its syntactic monoid M (K) belongs to the pseudovariety V such that L(V) = V. The latter formulation of the problem is often easier to handle. In particular, all the pseudovarieties introduced thus far in this survey are such that determining membership of M (K) in V amounts to checking that the monoid satisfies some finite set of defining identities (e.g. x ω+1 = x ω for the pseudovariety A of aperiodics). This requires an amount of time polynomial in |M (K)|. Although, |M (K)| is in general exponentially larger than the size of the representation of K, the problem of testing whether K ∈ L(V) for a K specified by an automaton or a regular expression can be shown to lie in PSPACE for all pseudovarieties considered thus far. There are however pseudovarieties for which membership is undecidable and many problems in this line of work remain open [Alm94,Pin97].
The best-known instance of an algebraic characterization of a variety of languages is Schützenberger's theorem: The theorem of McNaughton and Papert [MP71], whose proof we sketch in Section 4, further shows a language is star-free if and only if it is definable in FO[<].
Example 3.4. A simple calculation shows that the syntactic monoid of the language (ab) * , which we considered in Example 3.1, has exponent 2 and satisfies x 3 = x 2 . It is therefore aperiodic and so there must exist a star-free expression and an FO[<] sentence defining (ab) * . To construct a star-free expression, it suffices to note that (ab) * is the set of words starting with a, ending with b and having no consecutive a's or consecutive b's. Since the complement of the empty set ∅ c is simply {a, b} * , the following is a star-free expression defining (ab) * : The notion of recognition of a language by a monoid can naturally be extended to pointed languages: we say that the pointed languageK ⊆ Σ * × Σ × Σ * is recognized by M if there are homomorphisms h l , h r : Σ * → M and a set of triples For a pseudovariety V we denote as P(V) the set of pointed languages recognized by a monoid in V. Abusing our terminology, it is convenient to think of ordinary words in Σ * as pointed words with p = 0 and thus view L(V) as a subset of P(V). Note that P(V) is closed under boolean operations and inverse homomorphisms.
While relating star-freeness, aperiodicity and FO-definability is far from trivial, there are cases in which such three-way equivalences are easy to obtain and the following lemma is particularly useful in inductive arguments. Let FO 1 [<] denote the class of first-order sentences with a single quantified variable and let FOF 1 [<] denote the class of first-order formulas with a single quantified variable and at most one free variable. We similarly denote MOD 1 [<] and MODF 1 [<] the analog classes when ordinary quantifier quantifiers are replaced with modular ones.
Recall that SL and Ab respectively denote the pseudovarieties of semilattices and Abelian groups. Proof sketch. The syntactic monoid of the language Σ * aΣ * of words containing an a is the two-element semilattice {1, 0} with multiplication given by x0 = 0x = 0. Thus, any boolean combination of such languages can be recognized by a direct product of copies of this semilattice. Conversely, if M is a semilattice and ρ : Σ * → M is a homomorphism, then by commutativity and idempotency, the value of ρ(w) only depends on the set of letters occurring in w. Thus, if F ⊆ M then ρ −1 (F ) is in the boolean algebra generated by the Σ * aΣ * .
The language Σ * aΣ * can be defined by the sentence ∃xQ a x and any FO 1 sentence is a boolean combination of sentences of that form and therefore L(SL) = L(FO 1 [<]). Similarly, FOF 1 [<] formulas with free variable y and bound variable x are boolean combinations of sentences of the form ∃x [(x * y) ∧ Q a x] where * ∈ {<, >, =} and one can conclude The case of Abelian groups is handled similarly: one can show that the variety of languages L(Ab) consists of languages L such that membership of a word w in L only depends on the number of occurrences of each letter in w modulo some integer m.
The above lemma might give the impression that whenever V is a pseudovariety such that the class of languages L(V) has a meaningful logical description, then the class of pointed languages P(V) also has a meaningful (and closely related) logical description. This is unfortunately not the case and, in fact, there are very few classes Λ of formulas with one free variable whose expressive power can be characterized algebraically as P(V) for some pseudovariety V.

Block-Products and Substitutions.
Let M and N be finite monoids. To distinguish the operation of M and N , we denote the operation of M as + and its identity element as 0, although this operation is not necessarily commutative. A left-action of N on M is a function mapping pairs (n, m) ∈ N × M to nm ∈ M and satisfying n(m 1 + m 2 ) = nm 1 + nm 2 , n 1 (n 2 m) = (n 1 n 2 )m, n0 = 0 and 1m = m. Given a left-action of N on M , the semidirect product M ⋊ N (with respect to this action) is the monoid with elements in M × N and multiplication defined as (m 1 , n 1 )(m 2 , n 2 ) = (m 1 + n 1 m 2 , n 1 n 2 ). It can be verified that this operation is indeed associative and that (0, 1) acts as the identity element.
Right actions are defined symmetrically and naturally lead to the notion of reverse semidirect products. If we have both a right and a left-action of N on M that further satisfy n 1 (mn 2 ) = (n 1 m)n 2 , we define the bilateral semidirect product M * * N as the monoid with elements in M × N and multiplication defined as (m 1 , n 1 )(m 2 , n 2 ) = (m 1 n 2 + n 1 m 2 , n 1 n 2 ). This operation is associative and (0, 1) acts as an identity for it. Semidirect products (resp. reverse semidirect) can then be viewed as the special case of bilateral semidirect products for which the right (resp. left) action on M is trivial. The block product of the pseudovarieties V, W, denoted V W is the pseudovariety generated by all bilateral semidirect products (Bilateral) semidirect products are useful to decompose finite monoids of potentially complex structure into simpler components. For instance, it is well known that every finite group is isomorphic to an iterated semidirect product where each G i is a simple group and that a group is solvable if and only if there is such a decomposition in which all G i are cyclic groups of prime order. For monoids which are not groups, the Krohn-Rhodes theorem [KR65] states that every finite monoid divides an iterated semidirect product (bracketed as above) where every term is either a simple group or the 'set/reset monoid' (or 'flip-flop') i.e. the three element monoid {1, s, r} with multiplication satisfying 1x = x1 = x, xs = s and xr = r for each x. The bilateral semidirect product allows decompositions with even simpler factors: every finite monoid divides an iterated bilateral semidirect product of the form where each M i is either a simple group or the two element semilattice [RT89].
Let V 0 be the trivial pseudovariety (containing only the trivial monoid) and for i ≥ 0 define inductively the pseudovarieties V 2i+1 = G V 2i and V 2i+2 = SL V 2i+1 . The last result stated in the previous paragraph implies in particular that the pseudovariety M of all finite monoids is the union of the V i or, equivalently, that M is the smallest pseudovariety W satisfying G W = W and SL W = W. The following theorem lists fundamental results that similarly decompose important pseudovarieties in terms of block-products. All results are either due to Rhodes and Tilson or can be inferred from their work [RT89].
(1) The pseudovariety A of aperiodic monoids is the smallest pseudovariety satisfying SL A = A.
(2) The pseudovariety G sol of solvable groups is the smallest pseudovariety satisfying Ab G sol = G sol . The block product operation on pseudovarieties is not associative: it can be shown that (U V) W ⊆ U (V W) but this inclusion is strict in general. The block product is mostly used as a means of decomposing large and complex pseudovarieties into smaller, simpler ones and the most classical applications of iterated block-products have relied on the stronger right-to-left bracketing. Theorem 3.6 for instance states that the pseudovariety of aperiodics is the union of all pseudovarieties of the form In Section 5 we show the relevance of the weaker left-to-right bracketing of iterated blockproducts when analyzing the expressive power of two-variable sentences.
The languages recognized by V W can be conveniently described in terms of languages recognized by V and W. For a monoid N ∈ W, an N -transduction τ is a function determined by two homomorphisms h l , h r : Σ * → N and mapping words in Σ * to words in Proof sketch. The proof is too technical to present in full detail but we give a brief overview of the main idea for completeness. The argument relies on the very definition of multiplication in the bilateral semidirect product M * * N . Recall that (m 1 , n 1 )(m 2 , n 2 ) = (m 1 n 2 + n 1 m 2 , n 1 n 2 ) and so, by extension, if (m 1 , n 1 ), (m 2 , n 2 ), . . . , (m t , n t ) are elements of M * * N then their product (m 1 , n 1 ) · · · · · (m t , n t ) in M * * N is given by (m 1 n 2 n 3 . . . n t + n 1 m 2 n 3 . . . n t + . . . + n 1 . . . n t−2 m t−1 n t + n 1 . . . n t−1 m t , n 1 . . . n t ).
Fix an element in (m, n) ∈ M * * N and consider the language E (m,n) ⊆ (M * * N ) * consisting of finite sequences (m 1 , n 1 ), . . . , (m t , n t ) of elements of M * * N that multiply out to (m, n). Similarly, let E (m, * ) be the union over all n of all E (m,n) and let E ( * ,n) be the union over all m of the E (m,n) : we thus have If we identify these triples with the element n 1 . . . n i−1 m i n i+1 . . . n t of M then by the above expression we obtain immediately that On the other hand it is easy to see that if N ∈ W then E ( * ,n) ∈ L(W). This argument in fact suffices to establish that every language in L(V W) is a Boolean combination of languages in L(W) and languages τ −1 (K) for some K ∈ V and N -transduction τ with N ∈ W.
The converse statement, while more involved technically, proceeds along the same lines.
There is a striking similarity between the notion of transduction and that of substitution discussed in the previous section. We formalize this crucial correspondence in the next lemma which we refer too as the block-product/substitution principle. Thérien and Wilke [TW04] were the first to use this specific terminology although it is fair to say that the idea was implicitly present in the work of Straubing [Str94]. In [TW04], the lemma is stated for temporal logics. The formulation given here is taken from [TT05b]. Proof. Since L(V W) is closed under Boolean combinations, the left-to-right containment follows if we show that for any ψ ∈ Γ and any Λ-substitution σ we have L σ(ψ) ∈ L(V W). Let w be some word in Σ * and Φ = {φ 1 , . . . φ k } be the formulas used by σ. Since P(W) = P(Λ), the pointed languages P φ j : {(w, i) : (w, i) |= φ j } can be recognized by monoids N 1 , . . . , N k in W and N = N 1 × . . . × N k recognizes any Boolean combination of them. This implies the existence of two morphisms h l , h r : Σ * → N such that the membership of a pointed word (w, i) in each N j can be determined by the value of the triple ). Using these two homomorphisms, we therefore obtain an N -transduction τ such that for each i, the value of τ (w i ) is sufficient to determine the set For the right-to-left containment, we need to show that any language of L(V W) can be described by a sentence of Γ • Λ and we proceed similarly. If τ is an N -transduction for some N ∈ W then for any triple (n 1 , a, n 2 ) ∈ N × Σ × N , the pointed language T (n 1 ,a,n 2 ) = {(w, i) : τ (w i ) = (n 1 , a, n 2 )} is in P(W) and is thus definable by some formula φ (n 1 ,a,n 2 ) in P(Λ). Consider the substitution σ defined by these φ n 1 ,a,n 2 and note that for any w ∈ Σ * and any position 1 ≤ i ≤ |w|, exactly one of the φ (n 1 ,a,n 2 ) is true at i. Hence σ −1 (w i ) = {φ (n 1 ,a,n 2 ) |(w, i) |= φ (n 1 ,a,n 2 ) } is always a singleton and the range of possible values can be identified with the set N × Σ × N .
is definable by some sentence ψ K ∈ Γ. Now the set of words such that τ (w) ∈ K is defined by the sentence obtained from ψ K by a σ substitution.
Many results giving algebraic characterizations of regular languages defined in a fragment Λ of FO + MOD[<] more or less explicitly rely on some form of this lemma. It is often rather easy to characterize algebraically the expressivity of very weak fragments of FO + MOD[<] (e.g. Lemma 3.5). Furthermore, sufficiently robust classes Λ can typically be decomposed through iterated substitutions of these weak fragments. Applying the blockproduct/substitution principle we are thus able to characterize the expressive power of Λ by analyzing an iterated block-product.
For a number of reasons, however, this general paradigm cannot be applied too generally.
• Straubing showed that the class of regular languages definable in the most natural fragments of MSO[<] (in particular, fragments of first-order defined by quantifier type, quantifier alternation, quantifier depth, number of variables and so on) are all C lm -varieties of languages (see [Str02] for a formal definition) and are varieties of languages in the sense we defined earlier when we consider subclasses of FO + MOD[<].
Thus the expressive power of these fragments have some algebraic characterization. Preliminary investigations unfortunately indicate that classes of pointed languages definable in similar fragments only rarely correspond to P(V) for some pseudovariety V, as we noted after Lemma 3.5. This state of affairs limits the possible range of applications of the block-product/substitution principle. • We mentioned in Section 2 that the substitution operator is associative and the block-product/subsitution principle might lead one to find this fact in apparent contradiction with the non-associativity of the block-product. If Γ is a class of sentences and Λ, Φ are classes of formulas with at most one free variable, then indeed . For a sentence ψ, and a variable x not occurring in ψ, let ψ [<x] and ψ [>x] respectively denote the formulas obtained from ψ by restricting the scope of any quantified variable of ψ to values respectively strictly less than x and strictly greater than x. We rely on the following lemma. The proof is not conceptually difficult. By renaming variables we can assume that φ(x) does not contain any bound occurrence of x and this is the starting point of the construction. This rather trivial observation does not necessarily hold, however, when the sentences considered are only allowed a bounded number of variables as in Section 5.
Let us first focus on the problem of definability in FO[<]. Let SD k and FD k respectively denote the class of FO[<] sentences of quantifier depth k and FO[<] formulas of quantifier depth k with at most one free variable. By definition of quantifier depth, we have Proof sketch. We argue by induction on k. The base case is provided by Lemma 3.5. For the induction step we use the fact that SD k+1 = SD 1 • FD k . Since we know that L(SD 1 ) = L(SL) our inductive claim follows from the block-product/substitution principle if we can show that P(FD k ) = P(V k ). This is precisely what Lemma 4.1 allows: any formula φ(x) ∈ FD k can be rewritten as a boolean combination of formulas of the form where ρ and χ are sentences of SD k .
Membership of M in any individual V k is trivially decidable because these pseudovarieties are effectively locally finite [Pin97]: for each t, k we can effectively construct a monoid M t,k such that any monoid M ∈ V k with at most t generators is a divisor of M t,k . On the logical side, this is essentially equivalent to noting that over a given alphabet there are only finitely many equivalent first-order sentences of any fixed quantifier depth. The decidability of individual V k is in itself of moderate interest since one is typically not so interested in determining whether L is definable in some specific quantifier depth but rather whether L is FO[<]-definable at all. In algebraic terms, we are more interested in deciding membership of M in the union of the V k than in some specific V k . By part (1) of Theorem 3.6 we know that V k = A and this provides the missing link to obtain the theorem of McNaughton and Papert which we combine with Schützenberger's Theorem to obtain: Thus, deciding if a language K is FO[<] definable is equivalent to testing if K's syntactic monoid is aperiodic. The latter problem is clearly decidable and is in fact PSPACE-complete when K is specified by a finite automaton [CH91].
The same proof methods also yield an algebraic characterization of languages definable in

Quantifier Alternation.
Quantifier depth is only one of many possible parameterizations of languages definable in FO[<]. In particular it is natural to consider the hierarchy of first-order sentences defined by quantifier alternation. The block-product/substitution principle seems to be of no use in that case but the question can nevertheless be studied with algebraic and combinatorial perspectives. There is a natural parametrization of star-free languages in terms of concatenation depth. The Straubing-Thérien hierarchy is defined inductively as follows: a language over Σ * has depth 0 if and only if it is ∅ or Σ * . Level k + 1/2 of the hierarchy consists of unions of languages of the form L 0 a 1 L 1 a 2 . . . a t L t where the a i are letters of Σ and the L i 's are languages of depth k. Finally the (k + 1)st level of the hierarchy is the boolean closure of the level k + 1/2. This hierarchy is closely related to the Brzozowski-Cohen or dot-depth hierarchy [CB71] (the precise correspondence was established by Straubing [Str85,Pin97]). The Straubing-Thérien hierarchy is known to be infinite and the union of all its levels clearly corresponds to the class SF of star-free languages.
As usual, let Σ k [<] and Π k [<] denote the subclasses of FO[<] sentences defined by quantifier alternation. In fact, the original result of Thomas [Tho82] relates the levels of the Brzozowski-Cohen dot-depth hierarchy with definability in Σ k [<, S] but the argument can be easily be adapted to obtain the theorem just stated [PP86]. The 'if' part of the theorem is immediate from the definition of the Straubing-Thérien hierarchy. Thomas' argument for the second half of the theorem does not involve any algebra and relies instead on Ehrenfeucht-Fraïssé games. In particular it provides a way to relate FO[<]-definability and star-freeness without resorting to algebra (this is also true of [MP71]).
It is not hard to show that the kth levels of the Straubing-Thérien hierarchy are closed under inverse homomorphic images, left and right quotients, union and complementation and thus form varieties of languages. The variety theorem therefore guarantees that these classes correspond to some pseudovariety of finite monoids. Note in contrast that the k+1/2 levels do not form varieties of languages since they are not closed under complementation. They still are closed under inverse homomorphic images, quotients, union and intersection and therefore form what are known as positive varieties of languages. These can also be analyzed from an algebraic perspective using ordered syntactic monoids and pseudovarieties of ordered monoids [Pin86,Pin97]. The decidability of levels 1/2 and 1 of the Straubing-Thérien hierarchy follow from Simon's theorem on piecewise-testable languages [Sim75] and later refinements [Pin95,Pin97]. Level 3/2 is also decidable but considerable work is needed to establish this deep fact [PW97] (see [GS00] for an independent proof of the decidability of level 3/2 of the dot-depth hierarchy) and the decidability of level 2 is one of the most important open problems in algebraic automata theory [GS01, Pin97, PS81, PW97, PW01, Str88, SW92, Wei89].
There is in fact a general lesson to be learned from Theorem 4.5. We argued in the first half of this section that when Φ is a class of sentences and V is a pseudovariety such that L(Φ) = L(V) then the class Γ of sentences which are boolean combinations of sen- Clearly, the languages in L(Γ) are boolean combinations of languages of the form L 1 aL 2 with L 1 , L 2 ∈ L(Φ). These facts provide us with a bridge linking, under the correct technical assumptions, the logical operation of adding an extra existential quantifier, the algebraic operation of forming a block-product SL V and the combinatorial operation of concatenation of two languages. The same idea can be extended to obtain combinatorial and algebraic counterparts to the addition of a whole block of existential quantifiers ∃x 1 . . . ∃x k φ(x 1 , . . . , x k ) on the logical side.
For a variety of languages V, we define Pol(V) to be the class 5 of languages which are unions of languages of the form L 0 a 1 L 1 . . . a k L k for L i ∈ V. One can put in correspondence the logical operation of adding a block of existential quantification with the combinatorial operator of polynomial closure Pol(V) on varieties of languages. In other words, under some technical conditions, one can show that if Φ is a class of sentences and V is a language variety such that L(Φ) = V then a language K belongs to Pol(V) if and only if it can be defined as a positive boolean combination of sentences of the form where each ψ j is a formula in Φ and where the subscript ψ j [>x j ,<x j+1 ] is the formula obtained from ψ j by restricting the quantified variables to lie between x j and x j+1 .
In turn the operator Pol(V) on varieties of languages is linked to an algebraic operation on pseudovarieties of monoids defined in terms of so-called Mal'cev products [PW97]. Similarly, the addition of a block of modular quantifiers is related to the closure of a variety of languages under products with counters which can also be described algebraically through Mal'cev products [Wei92].  [Str94].
The extra expressive power afforded by the unary predicate ≡ i,m x (which is true at x if x ≡ i (mod m)) has also been considered [CPS06,Str02]. More generally, a numerical predicate R ⊆ N t is said to be regular if it is definable in [Pél92]) and the terminology comes from yet another equivalent definition of regular predicates using finite automata [Str94]. Let Reg denote the class of regular numerical predicates: it follows from our definition that

Two-Variable Sentences and Temporal Logic
In the previous section, the application of the block-product/substitution principle was particularly fruitful because of the decomposition of the pseudovarieties A, G sol , M sol in terms of iterated block products of semilattices and Abelian groups (Theorem 3.6). As we noted these iterated block products use the strong, right-to-left bracketing whereas the present section relies on decompositions using the weaker left-to-right bracketing.

Sentences with a Bounded Number of Variables.
It is common practice to construct logical sentences in such a way that any subformula φ(x) with a free variable x never contains an occurrence of x which is bound by a quantifier. This certainly avoids possible confusions although it is quite possible to construct sentences that do not obey this rule and still get unambiguous semantics by interpreting a variable as bound by the previous quantifier 6 . We illustrate this in the following two examples: Example 5.1. The three variable sentence of Example 2.5: can clearly be rewritten as the two-variable sentence In many cases, the rewriting is not as trivial.
Example 5.2. We claim that the following FO[<] sentence can also be rewritten using only two variables.
This sentence is true for words over Σ = {a, b, c, d} in which there exists a position x that holds the last occurrence of a and whose suffix begins with some c's (possibly none) followed by a d. Thus the sentence defines the language Σ * ac * d{b, c, d} * . We claim that the following two-variable sentence defines the very same language.
The first part of this second sentence also identifies x as the location of the last a. To understand how the rest of the sentence imposes the condition on the suffix of this position, it is more convenient to look first at the meaning of the most deeply nested subformulas and work back towards the outermost quantifiers: the most deeply nested subformula with free variable x is true at position x if there is an a occurring at x or a later position. Now, ψ(y) : ∀x [((x < y) ∧ ¬Q c x) ⇒ (∃y [(x ≤ y) ∧ Q a y])] which has y as a free variable is true at position y if all positions x before y that do not hold a c satisfy the property φ(x). Finally, checks that there is a y > x holding d and satisfying ψ(y). Putting it all together, we see that if x holds the last a then it satisfies η(x) iff its suffix lies in c * d{b, c, d} * . Indeed, any y occurring after the last a satisfies ψ(y) if and only if all positions between that last a and y hold a c.
We denote as Kamp showed that a language is starfree if and only if it can be defined in LTL (linear temporal logic) [Kam68]. We formally describe this logic in the next subsection and show how an LTL formula can easily be translated into an equivalent FO 3 [<] sentence. Thus . The case of two-variable sentences was first studied by Etessami, Vardi and Wilke who showed that a language is definable in FO 2 [<] if and only if it can be defined in unary temporal logic, i.e. by an LTL sentence using only unary temporal operators [EVW02]. The problem of deciding whether a language was definable in this logic was later settled through the algebraic characterization of this class, given by Thérien and Wilke [TW98].
Let us quickly review the mechanics of our proofs in Section 4. We decompose sentences of quantifier depth k + 1 as images of sentences of depth 1 under a substitution of formulas of quantifier depth k. Since by Lemma 4.1 any formula φ(x) of quantifier depth k can be written as boolean combinations of formulas of the form Q a x ∧ ρ [<x] ∧ χ [>x] we can conclude that the pointed languages definable by such formulas are exactly the pointed languages in P(V k ) and this makes our inductive proof possible.
In the case of two-variable sentences, we cannot hope to find an analog of Lemma 4.1: if ρ is a sentence using only two variables x, y it is not possible to construct the relativization ρ [<x] without introducing new variables. To circumvent this problem we choose to decompose two-variable sentences of depth k + 1 as the images of sentences of depth k under a substitution of formulas of quantifier depth 1.
When considering substitutions in the two-variable context, we need to worry about preserving the two-variable property. In other words, if Λ is a class of two-variable sentences and Γ is a class of two variable formulas with at most one free variable, we denote as Λ•Γ the class of sentences which are boolean combinations of sentences in Γ and sentences obtained from a Λ sentence by replacing each occurrence of a predicate Q a x (resp. Q a y) by a formula φ a (x) of Λ (resp. φ a (y)). The block-product/substitution principle still holds true under this restricted notion of substitutions [TT05b].
While we analyzed FO[<] sentences by starting from the outermost quantifiers it is much more convenient to begin our study of a two-variable FO 2 [<] sentence φ by looking at an innermost quantifier. Indeed, since φ uses only two variables, its most deeply nested subformula containing a quantifier is always of the form ∃y ψ(x, y) or ∃x ψ(x, y), where ψ(x, y) is quantifier-free. We therefore isolate the For the induction step, assume L(W k ) = L(Q 2,k ). We know by Lemma 3.5 that P(SL) = P(FOF 1 [<]) and by the block-product/substitution principle Thus, a language L is definable by an Note that this iterated block product uses the weaker left-to-right bracketing. The union of the W k is the smallest pseudovariety W satisfying W SL = W. Let DA denote the pseudovariety of monoids satisfying (xy) ω y(xy) ω = (xy) ω . This immediately provides an algorithm for deciding if a regular language is definable by an FO 2 [<] sentence because the pseudovariety DA is decidable. This pseudovariety admits a number of interesting characterizations [TT02] and, in particular, the regular languages whose syntactic monoids lie in DA have a nice combinatorial description. In fact, the original proof of Corollary 5.6 relied upon this characterization rather than on the decomposition of DA in terms of weakly iterated block products. For regular languages L 0 , . . . , L k ⊆ Σ * and letters a 1 , . . . , a k ∈ Σ, we say that the concatenation L = L 0 a 1 L 1 . . . a k L k is unambiguous if for each w ∈ L there exists a unique factorization of w as w = w 0 a 1 w 1 . . . a k w k with w i ∈ L i .  Example 5.9. In Example 5.2, we gave two first-order sentences defining the language L = Σ * ac * d{b, c, d} * , the second of which was FO 2 [<]. Note first that this concatenation is unambiguous: if a word w belongs to L then there is a unique factorization w = w 0 aw 1 dw 2 such that w 1 ∈ c * and w 2 ∈ {b, c, d} * because w 1 must start right after the last occurrence of the letter a in w and must end at the first occurrence of d after this a. Hence, the syntactic monoid of L lies in DA. We can also define L using the following Σ 2 [<] sentence which simply reflects the structure of the regular expression for L: But the following Π 2 [<] sentence also defines L: Indeed, this sentence relies on the fact that a word belongs to L if it contains at least one a, contains at least one d and is such that for any position x holding a and any later y holding d either all positions between x and y hold c or there exists an a occurring later than x or a d occurring between x and y.
Elementary computations can show that the syntactic monoid U of K consists of the six elements {1, a, b, ab, ba, 0} with multiplication specified 7 by aa = 0, bb = b, aba = a, bab = b and 0u = u0 = 0 for all u ∈ U . In particular, ba is idempotent and if x = b and y = a, we have (ba) ω a(ba) ω = baaba = 0 = (ba) ω . Thus U does not belong to DA and K cannot be defined by a Π 2 [<] sentence or by an FO 2 [<] sentence.

Two-Variable Sentences with Modular Quantifiers.
To characterize the expressive power of MOD 2 [<] and FO + MOD 2 [<] sentences, we can precisely follow the proof paradigm used in the FO 2 [<] case above. Since we have L(MOD 1 [<]) = L(Ab) and P(MOD 1 [<]) = P(Ab) we are naturally led to consider the smallest pseudovariety V such that V Ab = V (for the MOD 2 [<] case) and the smallest pseudovariety W such that W Ab = W and W SL = W (for the FO + MOD 2 [<] case).  Let us denote as Σ 2 • MODF[<] the class of FO + MOD[<] sentences which, as the terminology suggests, are positive 8 boolean combinations of sentences obtained by applying to a Σ 2 [<] sentence a substitution using formulas containing only modular quantifiers. We define Π 2 • MODF[<] similarly. Straubing and Thérien obtained the following analog of Theorem 5.8: Although Corollary 5.12 gives an exact algebraic characterization of FO + MOD 2 [<], it does not provide an effective way of testing if a given regular language is definable in this logic because the pseudovariety DA G sol is not known to be decidable. We have DA G sol ⊆ (DA G) ∩ M sol and the latter two pseudovarieties are decidable but the containment is strict. Straubing and Thérien show that DA G sol is decidable if and only if the smaller pseudovariety SL G sol is decidable [ST03]. The latter question is an outstanding open problem in combinatorial group theory with deep implications [MSW01].
Example 5.14. Let us once again consider the language L = (ab) * . Recall that L's syntactic monoid is the six element monoid B 2 = {1, a, b, ab, ba, 0} whose multiplication is specified by aba = a, bab = b, aa = 0, bb = 0 and x0 = 0x = 0 for all x ∈ B 2 . We mentioned that B 2 is aperiodic and gave an FO[<] sentence defining L. However, in B 2 we have (ab) ω b(ab) ω = 0 = (ab) ω and so B 2 ∈ DA. Hence, L is not definable in FO 2 [<]. On the other hand one can show that B 2 belongs to the pseudovariety DA G sol . While we could argue for this fact in algebraic terms, it is sufficient to show that the language L can be defined by an FO + MOD 2 [<] sentence. The language (ab) * consists of words of even length with a on every odd position and b on every even position so it is defined by the two-variable sentence

This sentence is in fact Π
In particular this example proves that (DA G sol ) ∩ A = DA and so, somewhat counter-intuitively, there are star-free languages, i.e. FO[<] definable languages, which are not definable in FO 2 [<] but are definable in FO + MOD 2 [<]. On the other hand the syntactic monoid U presented in Example 5.10 is the smallest aperiodic monoid that does not lie in DA G sol and so Σ * ac * aΣ * is definable in One can extend Corollary 5.12 to show that the pointed languages definable by a MODF 2 [<] formula are exactly the pointed languages recognized by solvable groups. This yields an interesting corollary: any two-variable FO + MOD 2 [<] sentence is equivalent to a two-variable sentence in which no existential or universal quantifier appears in the scope of a modular quantifier 9 . Indeed this class of sentences is just FO 2 [<] • MODF 2 [<] and, once again, the block-product/substitution principle yields In fact, it is possible to provide explicit rules for rewriting a two-variable FO + MOD sentence so that all modular quantifiers are pushed within the scope of existential and universal 8 Note that since the negation of a Σ2[<] sentence is not in general a Σ2[<] sentence, we must avoid negation in the definition of the class. 9 Note that this is not true in the case of sentences with an unbounded number of variables. It is possible to show that for any k the pseudovarieties S k , T k are decidable using the notion of kernels of monoid morphisms [Til87] (see also [TW04] for an application to logic). In any case, we are once again more interested in deciding membership in the union of the S k or the T k . Let DO be the pseudovariety of finite monoids satisfying the identity (xy) ω (yx) ω (xy) ω = (xy) ω . Example 5.17. Let us return to Example 2.4. It can be explicitly shown that the syntactic monoid M (K) of K = (b * ab * a) * bΣ * lies in DA G sol and, correspondingly, there exists an FO + MOD 2 [<] sentence defining K: ]. The modular quantifier lies in the scope of the existential quantifier and we want to show that it cannot be pulled out. Indeed, by simple calculation one can see that M (K) contains elements {1, a, b, ab, ba, aba, 0} with multiplication given by aa = 1, bb = b, bab = b, abab = 0 and 0s = s0 = 0 for all s. In particular aba and b = baa are idempotents. Choosing u = a and v = ba, we have (uv) ω (vu) ω (uv) ω = (aba) ω (baa) ω (aba) ω = abababa = 0 = (aba) ω = (uv) ω so M (K) violates the identity defining DO and K cannot be defined by an FO + MOD 2 [<] sentence in which the modular quantifiers lie outside the scope of the ordinary quantifiers.
The same type of argument also shows that (ab) * cannot be defined by an FO + MOD 2 [<] sentence in which the modular quantifiers lie outside the scope of the ordinary quantifiers.
Example 5.18. Consider for contrast the language of Example 2.5: we noted at the start of this section that the language L of words over {a, b, c} * such that the position holding the first a has a suffix containing an even number of c's is definable by the FO One can verify that the syntactic monoid of L lies in DO ∩ Ab. In the above sentence, the modular quantifier appears within the scope of the leading existential quantifier but can in fact be pulled out: the sentence asserts that there are an even number of c's which appear after the first occurrence of a and thus also defines L.
To conclude our discussion on two-variable sentences, note that although the successor relation is definable in FO[<] it is not possible in general to transform an FO + MOD 2 [<, S] sentence into an equivalent FO + MOD 2 [<] sentence. A precise characterization of the class FO 2 [<, S] in terms of syntactic semigroups is nonetheless given in [TW98].

Temporal Logic.
The idea of using weakly-iterated block-products to characterize the expressive power of two-variable FO + MOD[<] sentences came originally from the study of temporal logics. Such logics are widely used in hardware and software verification because they are able to express properties of dynamic processes in a natural and intuitive way.
A linear temporal logic formula (LTL) over the alphabet Σ is built from atomic formulas which are either one of the boolean constants t and f or one of the letters in Σ. We want to think of a word w satisfying the formula a at 'time' i if the ith letter of w is an a. More complex formulas are constructed from these atomic ones using boolean connectives and a certain set of temporal operators. We focus here on the cases where these operators are the unary operators (eventually in the future) and (eventually in the past) or the binary operators U (until) and S (since). The terminology of course stresses the intended meaning of these operators and we can formally define the semantics of an LTL formula φ over Σ for pointed words (w, p) with w ∈ Σ * as follows.
• For any (w, i) we have (w, i) |= t and (w, i) |= f; • For a ∈ Σ we have (w, i) |= a if and only if w i = a; • (w, i) |= φ if there exists i < j ≤ |w| such that (w, j) |= φ; • (w, i) |= φ if there exists 1 ≤ j < i such that (w, j) |= φ; • (w, i) |= φU ψ if there exists i < j ≤ |w| such that (w, j) |= ψ and (w, i ′ ) |= φ for all i < i ′ < j; • (w, i) |= φSψ if there exists 1 ≤ j < i such that (w, j) |= ψ and (w, i ′ ) |= φ for all j < i ′ < i; Note that the LTL sentences φ and t U φ are equivalent and so the Until and Since operators are sufficient to obtain the full expressive power of LTL. Any LTL formula φ naturally defines a pointed language P φ = {(w, i) : (w, i) |= φ}. We also associate to φ the language L φ = {w : (w, 0) |= φ}. If Φ is a class of LTL formulas, we similarly denote by L(Φ) and P(Φ) respectively the classes languages and pointed languages defined by a formula of Φ.
As we mentioned earlier, Kamp [Kam68] showed that L(LTL) = L(FO[<]) and in fact P(LTL) = P (FOF[<]). The containment from left to right is rather easy to obtain by induction on the structure of the LTL formulas. The atomic LTL formula a defines the set of pointed words (w, i) having the letter a in position i and thus corresponds to the formula Q a x. Suppose by induction that for the LTL formulas φ and ψ we can construct FOF[<] formulas τ (x), ρ(x) such that P(φ) = P(τ (x)) and P(ψ) = P(ρ(x)) then the LTL formula φU ψ defines the same pointed language as The translation of the other three temporal operators can be obtained similarly. Note also that the structure of η(x) allows us to construct this formula using only three variables and so L(LTL) ⊆ L( For two classes Λ, Γ of LTL formulas we denote as Λ • Γ the class of LTL formulas which are boolean combinations of formulas in Γ and formulas obtained from a Λ formula by replacing each occurrence of the atomic formula a by a formula φ a ∈ Γ. The blockproduct/substitution principle carries over to temporal logic: if there are pseudovarieties V, W such that L(Λ) = L(V), P(Γ) = P(W) and L(Γ) ⊆ L(V W) then L(Λ • Γ) = L(V W).
The class of unary temporal logic formulas UTL is the subclass of LTL consisting of formulas constructed without the binary operators U, S. There is a natural hierarchy UTL 1 ⊆ UTL 2 ⊆ . . . within UTL defined by the nesting depth of the , operators. We clearly have Lemma 5.19. L(UTL 1 ) = L(SL) and P(UTL 1 ) = P(SL).
Proof sketch. Any UTL 1 formula is a boolean combination of formulas of the form a, a or a. The rest of the argument is similar to the proof of part 1 of Lemma 3.5.
Thus, the block-product/substitution principle insures: Example 5.21. We argued in Example 5.9 that the syntactic monoid of the language L = Σ * ac * d{b, c, d} * lies in DA and exhibited Σ 2 [<] and Π 2 [<] sentences defining L (an equivalent FO 2 [<] sentence was also given in Example 5.2). In temporal terms, L can be described as the set of words which contain an a that has no other a in its future but has in its future an occurrence of d with the property that each b or d in the past of this occurrence of d contains an a in its future.
By contrast K = {a, b, c} * ac * a{a, b, c} * has a syntactic monoid which is aperiodic but outside of DA (Example 5.10) and so K is definable in LTL but not in UTL.
The Until/Since hierarchy {USH k } k≥0 within LTL corresponds to the nesting depth of the Until and Since operators (the unary operators do not contribute to the depth of a formula). We set LTL 0 = UTL. We have The Until/Since hierarchy was introduced by Etessami and Wilke [EW00] who proved that the hierarchy was infinite. The algebraic characterization of the levels of the Until/Since hierarchy was given by Thérien and Wilke [TW04]: Roughly speaking, the proof links pointed languages of USH 1 and pointed languages of P(RB). However a number of technical hurdles have to be overcome. This theorem also guarantees that the levels of the Until/Since hierarchy are decidable although the complexity of the algorithms provided in [TW04] is prohibitive.
The two temporal operators next and previous are also often used in the construction of LTL sentences. The additional expressive power offered by these operators is closely linked to the extra power afforded by the successor numerical predicate in first-order sentences and, at least intuitively, this is not a major surprise. Standard methods allow algebraic characterizations of the expressive power of the various levels of the Until/Since hierarchy and of UTL when next and previous operators are available [TW98,TW04].
In the context of software and hardware verification, 'future' operators U, , next are more suited to express properties and the 'past' operators and S are not so standard in LTL. Kamp in fact shows that the until operator U is sufficient to obtain the full expressive power of LTL = FO[<]. When future operators are the only ones available substitutions only allow additional information on the suffix of a given position and so the two-sided nature of the block-product makes it unsuited for the analysis. However, one can instead consider reverse semidirect products and obtain the correct analog of the principle. Cohen, Pin and Perrin used this idea to characterize the expressive power of unary future temporal logic [CPP93] and Thérien and Wilke later extended the idea to characterize the levels of the Until hierarchy [TW02]. Baziramwabo, McKenzie and Thérien also considered the extension of LTL in which new modular counting temporal operators are introduced [BMT99]. An early survey of Wilke provides an overview of the semigroup theoretic approach in the analysis of temporal logics [Wil01].
We have so far considered only the case of first-order formulas with order (<) as the sole numerical predicate. When FO + MOD sentences have access to non-regular predicates, their expressive power is dramatically increased and they can provide logical characterizations for a number of well-known classes of boolean circuit complexity.
A boolean circuit C on n boolean variables w 1 , . . . , w n is a directed acyclic graph with a distinguished output node of outdegree 0. A node of in-degree 0 is called an input node (or input gate) and is either labeled by one of the boolean constants 0, 1 or by some boolean literal w i or w i . Any other node g of C (including the output node) is labeled by some symmetric boolean function f g chosen from some predetermined base. The most standard case has each inner node labeled either by the Or or the And function but we also consider the case where gates are labeled by the boolean function Mod m which is 1 if the sum of its inputs is divisible by m and is 0 otherwise. Any gate g of a boolean circuit on n variables naturally computes a boolean function v g : {0, 1} n → {0, 1}. If the gate g is an input node labeled by w i (resp. w i ) then v g (w) = 1 if and only if w i = 1 (resp. w i = 0). If g is an inner node then a gate g ′ is an input to g if there is a directed edge (g ′ , g) in the graph C. Naturally, if g 1 , . . . , g k are the inputs of g we set v g (w) = f g (v g 1 (w), . . . , v g k (w)).
If out is the output node of C then the function computed by the circuit is C(w) = v out (w). The language accepted by the circuit is the set {w ∈ {0, 1} n : C(w) = 1} of n-bit strings on which the circuit outputs 1.
The depth d of a circuit C is the length of the longest path from an input node to the output node. The size s of C is the number of gates in C. We are also interested in considering circuits in which inputs w i are not booleans but rather take values in some finite alphabet Σ. This can be handled either by using a binary encoding of Σ or by labeling input nodes by functions w i = a for some a ∈ Σ. The rest of our discussion is unaffected by these implementation details.
By definition a boolean circuit can only process inputs of some fixed length n but we are interested in using circuits as computing devices recognizing languages in Σ * . This can be done by providing an infinite family C of circuits C = {C n } n≥0 where the circuit C i processes inputs of length i. In this case, we define the size s(C) and the depth d(C) of a circuit family as functions of the input size.
Note that for any subset K ⊆ N, the language {w : |w| = k ∧ k ∈ K} can be recognized by a family of circuits of depth 0 and size 1 since inputs of a given length are either all accepted or all rejected. If we do not impose any constraints on the constructibility of circuit families, boolean circuits are thus able to recognize undecidable languages. Uniformity restrictions on circuit families impose the existence of an (efficient) algorithm that computes some representation of the nth circuit C n of a family. We say that a family of circuits C is uniform if such an algorithm exists and furthermore say that C is P-uniform (resp. Luniform) if there is a polynomial time (resp. logarithmic space) algorithm which on input 1 n constructs C n . An even more stringent requirement is that of dlogtime-uniformity which requires the existence of an algorithm which on input (n, i, j) computes in time O(log |n|) the type of the ith and jth gates of C n and determines whether these gates are connected by a wire [BIS90].
We define some classical circuit complexity classes: Definition 6.1. The boolean circuit complexity class non-uniform AC 0 is the class of languages which are computable by a family C = {C n } n≥0 of circuits constructed with And and Or gates with depth d(C) = O(1) and size s(C) = O(n k ) for some k.
Similarly, non-uniform CC 0 is the class of languages computable by families of circuits of bounded depth and polynomial size and constructed with gates Mod m for some m ≥ 2. Non-uniform ACC 0 is the class of languages computable by families of circuits of bounded depth and polynomial size and constructed with gates And, Or and Mod m for some m ≥ 2.
Finally, non-uniform NC 1 is the class of languages computable by families of circuits of depth O(log n), polynomial-size and constructed with And and Or gates of fan-in 2.
There are natural uniform versions of the above classes. By definition both AC 0 and CC 0 are subclasses of ACC 0 ⊆ NC 1 . Moreover, L-uniform-NC 1 is a subclass of L (logspace). The containment AC 0 ⊆ ACC 0 is known to be strict because the parity function (i.e. the Mod 2 function) cannot be computed by bounded depth And,Or circuits of subexponential size [Ajt83,FSS84,Smo86]. It is conjectured that CC 0 is also strictly contained in ACC 0 and, in particular, that the And function requires bounded depth Mod m circuits of superpolynomial size. Despite an impressive body of work in circuit complexity [All97,Vol99], no such lower bound is known and even much weaker statements such as dlogtime-uniform CC 0 = NP still elude proof.
These circuit classes have nice logical descriptions which were made explicit by Gurevich, Lewis, Barrington, Immerman and Straubing [GL84,Imm87,BIS90,Str94]. Proof sketch. The statements about dlogtime uniformity are too technical to present succinctly [BIS90] but it is rather straightforward to prove, for instance, that AC 0 = FO. For the right to left containment, we need to build for any FO sentence φ a non-uniform AC 0 circuit family C that accepts exactly L φ . We assume without loss of generality that φ is in prenex normal form: where ψ is quantifier free and each Q i is ∃ or ∀. Circuit C n is obtained by using Or and And gates to respectively represent the existential and universal quantifiers. Each of those gates has fan-in n so that a wire into the gate representing Q i x i represents one of the n possible values of x i . Finally, for any choice of values (x 1 , . . . , x k ) we need to build subcircuits computing the value of ψ(x 1 , . . . , x k ): the atomic formulas of the form Q a x i are evaluated using a query to the input variable x i and the value of a numerical predicate R(x i 1 , . . . , x it ) can be hardwired into the nth circuit since the value of R only depends on the value of the x i j and the input length n. Note that the size of the nth circuit built in this way is at most c · n k+1 for some c ≥ 1.
To show AC 0 ⊆ FO, we first normalize our circuit family C so that each C n of C is a tree of depth k which is leveled so that gates at level i in any circuit of the family are either all Or or all And gates. Moreover, we insure that every non-input gate has fan-in exactly n so that we can think of these n wires as being indexed by positions in the input. By extension, any sequence of k input positions can be viewed as a path from the output gate back to some input gate.
It is a simple exercise to show that the normalization process of our circuit family can be done so that the resulting family still has bounded depth and polynomial-size. The construction of an FO sentence defining the language accepted by C then follows naturally: if the family of circuits has depth k, the sentence has k quantifiers where existential and universal quantifiers are used to respectively represent levels of And gates and Or gates. We complete the construction by using a k + 1-ary numerical predicate R(i, x 1 , . . . , x k ) which is true if the path (x 1 , . . . , x k ) from the output gate back to the input queries the ith bit of the input. Note also that the non-uniformity of the family of circuits can be handled easily since we allow the value of the numerical predicates to depend on the length of the input word.
Note that the polynomial-size restriction in the definition of AC 0 , CC 0 and ACC 0 is in some sense built into this correspondence with first-order logic. Lautemann [KLPT06] further noted that when arbitrary numerical predicates are used, the restriction of FO, FO + MOD and MOD to two variables correspond to a linear-size restriction on the corresponding circuits.
Theorem 6.3. A language L is computable by a family of AC 0 (resp. CC 0 , ACC 0 ) circuits of size O(n) if and only if L is definable by a two-variable FO 2 (resp. MOD 2 , FO + MOD 2 ) sentence with arbitrary numerical predicates.
AC 0 , CC 0 and ACC 0 (as well as a number of other important circuit complexity classes) also admit very interesting algebraic characterizations using the programs over finite monoids formalism. The idea first appeared in Chandra, Stockmeyer and Vishkin [CSV84] but was formalized and further developed by Barrington and Thérien [Bar89,BT88]. A number of lower bounds for restricted classes of circuits can be obtained through this approach [BST90,BS94,ST06]. A detailed account of this line of work is beyond our scope but we refer the interested reader to Straubing's book [Str94] or one of the surveys [MPT91, Str00, TT04, TT06].
6.2. Bounding the Expressive Power of FO + MOD: Partial Results.
The logical description of circuit classes suggests a natural incremental approach to obtaining strong complexity separation results such as the strict containment of non-uniform CC 0 in ACC 0 or of non-uniform-ACC 0 in Logspace. Such results amount to bounding the expressive power of FO + MOD or MOD and while this seems a deep mathematical challenge we can hope that for sufficiently simple classes of numerical predicates N it is at least possible to bound the expressive power of . Building on work exposed in Libkin's book [Lib04], Roy and Straubing further showed that if p is a prime that does not divide q then the language Mod p is not expressible in FO + MOD q [+] where the q subscript indicates that only quantifiers counting modulo q are used [RS06]. In later work, Behle and Lange [BL06] translated the restriction of N to {+} into a uniformity restriction on circuits. Lautemann et al. [LMSV01], Schweikardt [Sch05] and Lange [Lan04] all provided further evidence of the fairly weak expressive power of addition even in the case where FO is augmented by so-called counting quantifiers or majority quantifiers.
In a somewhat different direction, Nurmonen [Nur00] and Niwiński and Stolboushkin [SN97] considered logics equipped with numerical predicates of the form y = kx for some integer k and in particular establish that there is no FO + MOD q [<, {y = qx}] sentence that defines the set of words whose length is divisible by p where p does not divide q.
If we are trying to exhibit a language L who cannot be defined in FO + MOD[N ] for some class N of numerical predicates, it makes sense to choose L so that the predicates in N seem particularly impotent in a sentence defining L. This intuition is of course difficult to formalize but it led to the study of languages with a neutral letter. A letter e ∈ Σ is said to be neutral for L ⊆ Σ * if for all u, v ∈ Σ * it holds that uev ∈ L ⇔ uv ∈ L. In other words e is neutral for L if e is equivalent to the empty word ǫ under the syntactic congruence of L. At least intuitively, it is difficult to construct circuits to recognize languages having a neutral letter because they cannot rely on the precise location of the relevant (i.e. non-neutral) letters of their input. By the same token, access to arbitrary numerical predicates seems of little help to define these languages. Lautemann and Thérien conjectured that every language with a neutral letter recognized in AC 0 is in fact a star-free regular language. Some of these questions can be recast in purely model-theoretic terms [BCST92,Str92,Str94,STT93,Pél92]. Intuitively, the only numerical predicates that can be of any significant use in defining regular languages are the regular predicates described at the end of Section 4. For example, [BCST92] used the fact that the Mod p -functions do not lie in AC 0 to show that a regular language is definable in FO iff it is definable in FO[Reg]. If R denotes the class of regular languages then the conjectured separation of ACC 0 from NC 1 is equivalent to the statement and, similarly, CC 0 = ACC 0 is equivalent to These equivalences are discussed in full detail in [Str94] and we simply sketch here the argument for the first of them. Assume that ACC 0 = NC 1 : since every regular language is in NC 1 , we have R ∩ FO + MOD = R ∩ ACC 0 = R ∩ NC 1 = R whereas FO + MOD[Reg] = FO + MOD[<] contains only those regular languages whose syntactic monoid is solvable (Theorem 4.4).
On the other hand, Barrington and Thérien [BT88] showed that any regular language whose syntactic monoid is not solvable (and therefore not definable in FO + MOD[Reg], is complete for NC 1 under very simple reductions known as non-uniform projections or programs. Therefore, if ACC 0 = NC 1 then none of these languages lies in ACC 0 and R ∩ FO We can refine our questions about the circuit complexity of regular languages and ask how small the AC 0 , CC 0 and ACC 0 circuits recognizing them can be. For AC 0 , a surprising partial answer was provided by Chandra, Fortune and Lipton [CFL85] who show that any regular language computed by an AC 0 circuit can in fact be computed by an AC 0 -circuit with only O(ng −1 (n)) wires (and thus gates) for any primitive recursive function g. The result in fact extends to ACC 0 . The only regular languages known to be (and believed to be) in CC 0 are those definable in MOD 2 [Reg] and, by Theorem 6.3, these can all be recognized with circuits with O(n) gates. It is tempting to further conjecture that any regular language which is not definable in FO 2 [Reg] (resp. FO + MOD 2 [Reg]) is in fact not definable in FO 2 (resp. FO + MOD 2 ) and therefore requires superlinear-size AC 0 (resp. ACC 0 ) circuits. In other words, superlinear-size lower bounds for AC 0 and ACC 0 circuits can conceivably be obtained through logical methods such as Ehrenfeucht-Fraïssé games showing that a given language is not FO 2 or FO + MOD 2 definable.
Kouck, Pudlk and Thérien considered the class of regular languages (with a neutral letter) which are recognizable by ACC 0 circuits with only O(n) wires. The superlinear lower bound needed to obtain this theorem requires significant work and relies on an extension of deep combinatorial results of Pudlk on superconcentrators [Pud94] and on a linear lower bound [TT05a] on the communication complexity of regular languages which do not belong to L(DO ∩ Ab).
The upper bound is based on a result of Bilardi and Preparata [BP90] which exhibits an AC 0 circuit with n inputs x 1 , . . . , x n , 2n input gates and only O(n) wires which on input {0, 1} n computes the Or function of each prefix x 1 . . . x i and each suffix x i+1 . . . x n of the input. To build circuits with O(n) wires recognizing languages in L(DO ∩ Ab) it is convenient [TT05b] to make use of their logical characterization given by Corollary 5.16: any such language is definable by an FO + MOD 2 [<] sentence in which no modular quantifier appears in the scope of another quantifier. We illustrate the upper bound on an example.
Example 6.5. Consider the language L = {b, c} * a({a, b} * c{a, b} * c{a, b} * ) * which we already studied in Examples 2.5, 5.1 and 5.18. We saw that L can be defined by the FO + MOD 2 [<] sentence φ : ∃ 0 mod 2 x [Q c x ∧ (∃y (y < x) ∧ (Q a y ∧ ∀x [(y < x) ⇒ ¬Q a x]))] We want to build a circuit C with O(n) wires verifying w |= φ. As a first step, we build a subcircuit C ψ with O(n) outputs which simultaneously computes for all 1 ≤ y ≤ n the boolean value of the subformula ψ(y) : Q a y ∧ ∀x [(y < x) ⇒ ¬Q a x].
This subformula is true at y if and only if y contains the first occurrence of a in w. Using Bilardi and Preparata's construction we can build a subcircuit with O(n) wires and n outputs which simultaneously tells us for each y if the suffix following y contains an a and this allows the construction of C ψ .
We can now use the same idea to build a subcircuit C η with O(n) wires and n output gates which uses the outputs of C ψ as inputs in order to compute simultaneously for all x the value of η(x) : Q c x ∧ (∃y [(y < x) ∧ ψ(y)]) . Finally, we complete the construction of our circuit C by feeding the n outputs of C η into a Mod 2 output gate for C.
This example has a straightforward generalization providing the upper bound for all regular languages in L(DO ∩ Ab). We know from Theorem 6.3 that a language K is computable by a family of ACC 0 circuits with O(n) gates if and only if it K is FO + MOD 2 definable given arbitrary numerical predicates but there is no similar logical characterization for the class of ACC 0 circuits with O(n) wires. Theorem 6.4 indicates that the fine line separating O(n) gates and O(n) wires may be related to the ability or incapacity of pulling out modular quantifiers in FO + MOD 2 sentences.

Conclusion
We believe that the block-product/substitution principle largely explains the success of semigroup theory in the analysis of the expressive power of fragments of FO + MOD[<] and LTL. In particular, we have tried to show that it underlies some of the most important results about the expressivity of fragments of FO + MOD[<] because it translates these logical questions into algebraic questions about decomposition of pseudovarieties through iterated block-products.
Considerable efforts have been invested in the development of an analogous algebraic approach to regular tree-languages. There currently exists no known algorithm for deciding whether a tree language is definable in FO[<] where < is the descendant relation in trees. While most agree that this question will inevitably be solved using some algebraic framework, it is rather unclear what the correct framework is. For instance, one can define the syntactic monoid of a regular-tree language L as the transition monoid of the minimal tree-automaton for L. It is known that if a regular tree language is FO[<]definable then its syntactic monoid is aperiodic but that condition is known to be insufficient [Heu91,PT93]. This strongly suggests that the combinatorial properties of regular tree-languages are not properly reflected in the algebraic properties of its syntactic monoid. Esik and Weil proposed to consider instead syntactic pre-clones. They obtain an analog of the block-product/substitution principle and show that a tree language is FO[<]-definable iff its syntactic preclone belongs to the smallest pseudovariety of pre-clones containing a very simple pseudovariety of preclones and closed under block product [ÉW05]. Unfortunately, too little is known about this pseudovariety to make this characterization effective. That the block-product/substitution principle generalizes to more complex settings is not much of a surprise since it simply provides a scheme to reformulate a logical question into algebraic terms but there are no known preclone analogs of the block-product decomposition results that exist for monoids and this impedes progress.
There are decidability results for subclasses of FO[<] definable tree languages (e.g. [BW04]), some of which rely on the study of tree algebras proposed by Wilke [Wil96]. This first led to an effective algebraic characterization of frontier testable tree languages [Wil96] and, more recently, Benedikt and Segoufin used a similar framework to provide an effective algebraic characterization 10 of tree languages definable in FO[S] (where S is the child relation) [BS05]. The recent results of Bojańczyk et al. on pebble automata [BSSS06] also seem to be tightly connected to some variant of block-products although the authors do not explicitly give an algebraic interpretation of their work.
We focused in this survey on the case where logical sentences are interpreted over finite words. However, Büchi's Theorem also holds for infinite words: an ω-language is ω-regular if and only if it can be defined by an MSO[<]-sentence. The algebraic theory of ω-regular languages is well-developed although not as robust as the one presented here for the case of finite words [PP04]. Still, the class of ω-languages definable in FO[<] and LTL are exactly the starfree ω-languages [Tho79, SPW91,Coh91] which, in turn, are exactly those recognizable by aperiodic ω-semigroups [Per83]. Because the results for finite words often extend to the infinite case [Lib04,PP04,Pin96,Pin01,Tho97], it is tempting to overlook the related caveats. It would be interesting to specifically consider how the blockproduct/substitution principle extends to the case of infinite words to unify the existing results. The work of Carton [Car00] probably provides all the necessary tools for this investigation.
More generally, as Weil clearly demonstrates in [Wei04], there are numerous extensions of the algebraic point of view on finite automata and regular languages which have proved to be successful in the analysis of more sophisticated machines and more sophisticated logical formalisms. These include regular sets of traces [DR95], series-parallel pomsets [Kus03,LW00] and graphs, as well as timed automata [BDM + 06, FK03, MP04, BPT03].