Local Normal Forms for First-Order Logic with Applications to Games and Automata

Building on work of Gaifman [Gai82] it is shown that every ﬁrst-order formula is logically equivalent to a formula of the form ∃ x 1 , . . . , x l ∀ yϕ where ϕ is r -local around y , i. e. quantiﬁcation in ϕ is restricted to elements of the universe of distance at most r from y . From this and related normal forms, variants of the Ehrenfeucht game for ﬁrst-order and existential monadic second-order logic are developed that restrict the possible strategies for the spoiler, one of the two players. This makes proofs of the existence of a winning strategy for the duplicator, the other player, easier and can thus simplify inexpressibility proofs. As another application, automata models are deﬁned that have, on arbitrary classes of relational structures, exactly the expressive power of ﬁrst-order logic and existential monadic second-order logic, respectively.


Introduction
First-order (FO) logic and its extensions play an important role in many branches of (theoretical) computer science.Examples that will be considered in this paper are automata theory and descriptive complexity.Since Büchi's and Elgot's famous characterization of the regular string languages as the sets of models of (existential) monadic second-order (MSO) sentences, (existential) MSO logic has been used as a guideline in the search for reasonable automata models for other kinds of structures like trees or graphs.In descriptive complexity, since Fagin [Fag74] showed that the complexity class NP coincides with the sets of models of existential secondorder (Σ 1 1 ) sentences, many complexity classes have been characterized by extensions of FO logic [Var82, Imm86, Imm87, AV89, Grä92] and there is still hope that separations of complexity classes might be possible by separating the expressive power of the respective logics.For a recent result in this direction see the paper of Libkin and Wong [LW98].
Despite its importance as an ingredient for more expressive logics, it is well-known that the expressive power of FO logic is rather limited.It can only express properties that depend on the local appearance of a structure.This intuition has been formalized in different ways by 1365-8050 c 1999 Maison de l'Informatique et des Mathématiques Discrètes (MIMD), Paris, France Hanf [Han65] and Gaifman [Gai82].Hanf showed that, for every first-order formula ψ, there is an r such that whether ψ holds in a structure A ("A |= ψ") only depends on the multiset of isomorphism types of all r-spheres in A.Here an r-sphere is a substructure of A which is induced by all elements of A that have distance at most r from a fixed element of A. On the other hand, Gaifman showed that, for every first-order formula ψ, there are r and d such that whether A |= ψ holds depends only on how many elements with pairwise disjoint r-neighbourhoods exist that fulfil θ, for every formula θ of quantifier depth at most d.
The starting question for the present investigation was to which extent Hanf's and Gaifman's conditions could be combined.The goal was to replace the isomorphism types in Hanf's condition by something weaker and to get rid of the "disjoint r-neighbourhoods" constraint in Gaifman's condition.(For very interesting recent results concerning Hanf's and Gaifman's theorems from a different point of view see the papers of Libkin and Dong et al. [Lib97,DLW97].)It is easy to see that the straightforward attempt to replace the isomorphism type of a sphere S in Hanf's condition by its Hintikka-type for some d (i.e. by the set of formulas of quantifier depth at most d that hold in S) does not work.A counterexample is given by the set of clique graphs.For every d, the spheres of a graph consisting of one 2d-clique fulfil exactly the same formulas of quantifier depth at most d as those of a graph which consists of two disjoint d-cliques.Nevertheless, it turns out that it is indeed possible to combine the two approaches in the following sense.For every FO formula ψ there are l and r such that A |= ψ if and only if it is possible to put l pebbles onto A such that in the resulting structure all r-spheres fulfil the same FO formula ϕ.Put in another way, every FO formula is logically equivalent to a formula of the form ∃x 1 , . . ., x l ∀yϕ where ϕ is r-local around y, i. e. quantification in ϕ is restricted to elements of the universe with distance at most r from y. From this normal form one can easily derive normal forms for other logics like monadic second-order logic.For existential monadic second-order logic we can show a bit more.Every such formula is, on classes of connected structures, equivalent to a formula of the form ∃X 1 , . . ., X l ∃x∀yϕ where ϕ is restricted as above.If every structure has an element which is uniquely definable by a local formula, we can even achieve a formula of the form ∃X 1 , . . ., X l ∀yϕ.
As one application of the normal forms we get variants of the Ehrenfeucht game [Ehr61] for first-order logic and existential monadic second-order logic in which the spoiler has only restricted global access to the structures that are played.After a phase in which he can select some vertices of the first graph (before having seen the other one) and one vertex of the other graph, in the second phase all moves are restricted to the neighbourhoods of one vertex in each graph.
Another application concerns a form of automata on relational structures.It is well-known that regular sets of strings can be obtained as projections of locally testable sets, namely the sets of transition sequences of a (nondeterministic) automaton.Thomas [Tho91] used this idea to extend the notion of recognizability to other objects like grids and graphs of uniformly bounded degree.The normal forms allow to generalize the method of local testing further to sets of arbitrary relational structures.Moreover, they maintain the correspondence to definability in a natural logic.
The paper is organized as follows.In Section 2 we give basic definitions and fix some notation.In Section 3 we show the normal form theorems.In Section 4 we define the simplified games for first-order logic and monadic Σ 1 1 -logic.The analogous results for automata are presented in Section 5.The ensuing automata models are also compared with the automata of [Tho91,Tho97b,Tho97a] and [Cou90].Section 6 contains a conclusion.

Definitions and Notations
A relational signature σ is a finite set of relation symbols R, each with a fixed arity a(R), and constant symbols c.We do not use function symbols.A σ-structure A consists of a universe U A (the vertices of A), an a(R)-ary relation R A on U A , for every relation symbol R of σ and a constant c A , for every constant symbol c of σ.All theorems in this paper are valid for infinite and finite structures.We assume that all structures contain at least two elements.
Let the Gaifman graph of a σ-structure A have universe Let H d (A) denote the depth-d-Hintikka-type of A, i. e., the set of all FO sentences of quantifierdepth at most d that hold in A [EF95].Recall that H d (A) contains only finitely many different formulas w. r. t. logical equivalence.The elementary type of a tuple a 1 , . . ., a k of vertices of A is the conjunction of all atomic σ-formulas with variables from x 1 , . . ., x k that hold in A, a 1 , . . ., a k .Now we are going to define our notions of locality, r-locality and basic locality.Informally, a formula is r-local around its free variables x, if its truth depends only on S r (x).More formally, a FO formula ϕ(x, u) with free variables from x = x 1 , . . ., x l and u = u 1 , . . ., u m is r-local around x if all variables that are quantified in ϕ are bounded to S r (x).I. e., if ∃yψ (resp.∀yψ) is a subformula of ϕ then ψ is of the form (δ(y, x) ≤ r) ∧ χ (resp.(δ(y, x) ≤ r) → χ), for some χ which is r-local around x.A formula is local around x if it is r-local around x for some r.
Here, (δ(y, x) ≤ r) is an abbreviation for the straightforward FO formula which expresses that the distance of y from x is at most r.A formula ϕ is basic local around x if it is a Boolean combination of formulas each of which is local around some variable x i .I. e., properties that are expressed by basic formulas depend only on combinations of the properties of spheres.A formula is ∃ * ∀-local if it is of the form ∃x 1 , . . ., x l ∀yϕ where ϕ is basic local around x 1 , . . ., x l , y.It should be noted that in Gaifman's terminology [Gai82] a formula is local around a variable x only if x is its single free variable.

Normal Forms
By definition, every basic local formula around x is logically equivalent to a local formula around x.The following lemma shows that the converse is also true.This will be an important tool in the proof of the normal form theorem.
Lemma 3.1 Every first-order formula ϕ which is local around variables x = x 1 , . . ., x l is logically equivalent to a formula which is basic local around x.
Proof.Let ϕ be a first-order formula with free variables x = x 1 , . . ., x l and u = u 1 , . . ., u m that is local around x.The proof is by induction on the structure of ϕ.If ϕ is an atomic formula, it is basic local around x by definition.If ϕ is of the form ¬ψ or ψ 1 ∨ ψ 2 then the statement holds by the induction hypothesis.
In the only remaining case, ϕ is of the form ∃y((δ(y, x) ≤ r) ∧ χ) for some r and some formula χ which is local around x.By induction, χ is logically equivalent to a formula which is basic local around x.By writing χ in disjunctive normal form, we get that χ is logically equivalent to a formula of the form j i χ ji , where, for some r ′ , every χ ji is r ′ -local around x i .Hence, ϕ is logically equivalent to a disjunction of formulas ∃y((δ(y, x) ≤ r) where every χ i is r ′ -local around x i .In the following, we assume w. l. o. g. that ϕ is of the form (*). In a sense, we have to distribute the quantification of y over the χ i .The problem which arises is that some of the x i might be close to each other, so that y might play a role for several χ i simultaneously.To get around this problem we choose, for every "cluster" C of vertices x i that are close to each other, a representative v(C) such that quantification around any x i of C can be replaced by quantification around v(C).More formally, we proceed as follows.We associate with every structure A and tuple a = a 1 , . . ., a l of vertices of A a graph G(A, a) with vertex set V = {1, . . ., l} and edge set E, which contains the edge (i, j) whenever δ(a i , a j ) ≤ R := r + r ′ + 1.We are going to construct, for every graph G on {1, . . ., l}, formulas θ G and ϕ G each of which is basic local around x, such that, for every A and a it holds that Once we have established the existence of such formulas the statement of the lemma follows immediately because ϕ ≡ G (θ G ∧ ϕ G ), where the disjunction is over all graphs G on {1, . . ., l}.
Let in the following a graph G = (V, E) be fixed.The definition of θ G is straightforward: It is easy to see that, for every i, the i-th conjunct can be made R-local around x i .In order to construct ϕ G we choose from each connected component C of G a vertex v(C).Then ϕ G can be defined as Here, the disjunction is over all connected components C of G and all (finitely many) elementary types α of x, u, y.
,α is obtained from χ i by • replacing every atomic subformula that contains the variable y and a variable that is bound in χ i with false, and • rewriting all other atomic formulas that refer to y according to α.
These replacements assure that y does not occur in χ ′ i,C,α and that every χ ′ i,C and every χ ′ i,C,α is local around x i .It should be pointed out that the internal subformula [• • • ] can only become true if δ(, x i ) ≤ r holds, for some i ∈ C, hence if δ(y, x j ) ≤ r ′ + 1 does not hold.This justifies the replacement of atomic subformulas that contain the variable y and a variable that is bound in χ i with false.We note that already a smaller radius of y around x v(C) suffices if v(C) is chosen closer to the "center" of C.
Theorem 3.2 Every FO formula is logically equivalent to a ∃ * ∀-local formula.
Proof.Let Ψ be a first-order formula with free variables u = u 1 , . . ., u m .First we are going to show that Ψ is logically equivalent to a positive Boolean combination of ∃ * ∀-local formulas.In the following, if ϕ is r-local around its single variable, we write ∃ r l xϕ(x) as an abbreviation for Gaifman's theorem implies that Ψ is logically equivalent to a positive Boolean combination of formulas of the following three types.
We are going to show that formulas of each of these types are logically equivalent to positive Boolean combinations of ∃ * ∀-local formulas.Formulas of type 1 are already ∃ * -local because δ(x i , x j ) > 2r can be easily expressed by a formula which is 2r-local around x i .A formula ϕ(u) of type 3 is logically equivalent to ∃x(x = u ∧ ϕ(x)).As, by Lemma 3.1, ϕ(x) is logically equivalent to a formula that is basic local around x we obtain again a ∃ * -local formula.We still have to consider formulas of type 2. Let ψ ≡ ¬∃ r l xϕ(x).ψ is logically equivalent to Of course, ¬∃xϕ(x) is equivalent to ∀x¬ϕ(x), which is of the required form.For every i, (**) expressing that there are x 1 , . . ., x i that fulfil ϕ, but • neither there is a y which fulfils ϕ and is far from all the x j , • nor there exist different z 1 , . . ., z i+1 all of which fulfil ϕ and are close to the x j .
As the [• • • ] part of this formula can be made local around x 1 , . . ., x i , y, it is logically equivalent to a basic local formula around x 1 , . . ., x i , y by Lemma 3.1.We conclude that ψ is logically equivalent to a ∃ * ∀-local formula.
It remains to show that every positive Boolean combination of In fact, by a closer inspection of Theorem 3.2, we can go one step further and show that local quantification around one single variable is enough.
Theorem 3.3 Every first-order formula is logically equivalent to a formula of the form ∃x 1 , . . ., x l ∀yϕ(x, y), where ϕ is local around y.
Proof.We refer in the following to the threefold case distinction in the proof of Theorem 3.2.Formulas of type 1 can be transformed into For formulas of type 3 we apply the same idea, obtaing a formula ∃x∀y(x = u∧ϕ ′ (x, y)), where ϕ ′ is obtained by applying Lemma 3.1 and replacing every local subformula θ(x i ) by y = x i → θ(y).
For formulas of type 2 we first note that in (**) the subformulas of line 1 and 3 can be transformed into the correct form easily.The subformula of the second line, which does not refer to y, can be made local around x and therefore, again by Lemma 3.1, basic local around x.By applying the same idea as in the cases 1 and 3 above, we obtain eventually a formula of the correct kind.
There are straightforward analogues of Theorem 3.2 for other logics.Of special interest is the case of monadic Σ 1 1 -logic, as quantification of unary relations does not change the locality properties of a structure.We get immediately that every monadic Σ 1 1 -formula is logically equivalent to a formula of the form ∃X 1 , . . ., X l ∃x 1 , . . ., x m ∀yϕ , where ϕ is local around y.For classes of structures that have a connected Gaifman graph we can show even stronger normal forms.The basic idea is that global information about the structure can be transported along the relations and collected in a designated place.This generalizes a similar procedure in [Tho97b,Tho97a], where the transport is much more deterministic.
Theorem 3.4 Let C be a class of structures with a connected Gaifman graph.Then the following hold.
(a) On C every monadic Σ 1 1 formula is equivalent to a formula of the form ∃X 1 , . . ., X l ∃x∀yϕ, where ϕ is local around y.
(b) If there exists a formula ρ that is local around its one free variable such that, for every structure A of C, A |= ∃!xρ(x) then on C every monadic Σ 1 1 formula is equivalent to a formula ∃X 1 , . . ., X l ∀yϕ, where ϕ is local around y.
Proof.We only give sketches of the proofs.
(a) Let ψ ≡ ∃X 1 , . . ., X l ∃x 1 , . . ., x m ∀yϕ, where ϕ is basic r-local around y.We explain how the x i can be eliminated in favour of one x.We have to find a way to distinguish m vertices in a structure A. The idea is to guess a vertex x and m minimal paths p 1 , . . ., p m in the Gaifman graph of A such that, for every i, p i starts in x and ends in x i .Note that we view these graph as directed although the Gaifman graph is an undirected graph.Every p i is encoded by two unary relations Y i , Z i .Y i contains all vertices of p i .As p i is a shortest path we can conclude that x and x i have degree 1 w.r. t. p i and all other vertices of p i have degree 2 w. r. t. p i .Z i is used to give p i an orientation.v ∈ Z i just in case v is the j-th vertex of p i , for some j, (where x is the 0-th vertex) and j is congruent to one of 0,1,3 modulo 6.
It is straightforward that there exists a formula ρ(x, y) that is local around y such that A, Y, Z, x |= ∀yρ if and only if Y and Z encode m paths that have their starting point in x. (Y and Z might also encode some directed cycles but this does not matter.)It remains to show how in ϕ all references to variables x j can be replaced.All atomic formulas θ in which a x j occurs together with y or with a variable that is bound in ϕ (around y!) can be easily replaced by a formula ∃z((δ(z, y) ≤ r + 1) ∧ χ i (z) ∧ θ ′ ), where χ i (z) tests that z is the sink of p i (this can be checked 5-locally around z, hence (r + 6)-locally around y) and in θ ′ every occurrence of x j is replaced by z.
To replace atomic formulas that only refer to variables of x (and u, the free variables) we proceed as follows.For every atomic formula α which only contains variables from x and u we introduce a unary relation T α .The intention is that T α = U A in the case that A, x, u |= α and T α = ∅ otherwise.Because A is connected, the formula checks that T α contains either all or no vertices.It is also easy to check by a 6-local formula around y (using some χ i as needed) that T α contains all vertices just in case the endpoints of (some of) the m paths behave according to α.
(b) In the construction of part (a), x only occurs in θ.Instead of guessing x and paths that start in x we can guess paths that start in the vertex that is distinguished by ρ.
Theorem 3.4 (b) can be generalized in a straightforward way to classes of structures with a bounded number of connected components.In the respective generalization of Theorem 3.4 (a) the number of connected components bounds the number of existentially quantified FO variables in the normal form.On the other hand, it can be seen by a simple game argument (cf.Section 4 below) that the set of two-vertex-graphs can not be characterized by a formula of the type considered in Theorem 3.4 (a).Of course, Theorem 3.2 is also true with ∀ * ∃-local formulas in place of ∃ * ∀-local formulas.Although it is easy to see that ∃ * -local formulas do not capture all first-order properties (e. g. they cannot express the property "every vertex is coloured black"), it follows from results of Compton [Com83] that Boolean combinations (including negations!) of ∃ * -formulas do.
From Theorem 3.2 we can conclude that every first-order (and monadic Σ 1 1 ) formula on graphs (suitably represented by adjacency lists) can be evaluated by a nondeterministic Random-Access-Machine with unit-cost measure in time O(nd O(1) ), where n denotes the number of vertices and d the maximal vertex-degree.

Games
Ehrenfeucht games -invented in [Ehr61] building on work of Fraïssé [Fra54] -are an important tool for proving inexpressibility results in Mathematical Logic.In fact, in Finite Model Theory, where only finite structures are considered, they are the major tool available (cf. [Fag97]).To show that a given property P of finite structures is not expressible in FO logic it is enough to prove that the duplicator, one of two players, has a winning strategy in the ordinary FO Ehrenfeucht game for P (for a definition see e. g. [EF95]).Variants of Ehrenfeucht games are available for proving inexpressibility results for many other logics, including second-order logics [Ten75], existential second-order logics [Ten75, AF90], transitive closure logics [CM91] and finite variable logics [Bar77,Imm82].
Proving the existence of a winning strategy for the duplicator is often very difficult.To simplify such proofs the following approaches have been taken.There have been developed several conditions that assure that the duplicator has a winning strategy on two given structures: the Hanf-condition [FSV95], the Arora-Fagin condition [AF97] and the condition of Schwentick [Sch96] (for a survey see [Fag97]).All of these conditions exploit the fact that FO logic can only express combinations of local properties, i. e. properties of regions of bounded size.On the other hand there have been attempts to make the game easier to play for the duplicator.An important example is the invention of the Ajtai-Fagin game for existential second-order logic which allows the duplicator to choose the second structure after the spoiler (the duplicator's opponent) has selected relations for the first structure.The idea behind that game can be used whenever all formulas of a logic have an existential quantifier-prefix.
In this section we introduce local Ehrenfeucht games for FO logic and monadic Σ 1 1 logic.Additionally, we characterize the mentioned logics in terms of Hintikka-types (cf.Section 2).First of all, we describe the local first-order Ehrenfeucht game for a class C of σ-structures.Like the ordinary Ehrenfeucht game it is played by two players, called the spoiler and the duplicator.It has three parameters, l, r and d and consists of three stages.

Stage 1
The duplicator chooses a σ-structure A ∈ C. The spoiler selects vertices x 1 , . . ., x l from A. Then the duplicator chooses a σ-structure A ′ / ∈ C and vertices x ′ 1 , . . ., x ′ l from A ′ .

Stage 2
The spoiler chooses a vertex y ′ from A ′ , then the duplicator chooses a vertex y from A.
Stage 3 The spoiler and the duplicator play an ordinary d-round Ehrenfeucht game on the structures N r (y), x 1 , . . ., x l and N r (y ′ ), x ′ 1 , . . ., x ′ l .Here N r (y), x 1 , . . ., x l denotes the structure that is induced by S r (y) and x and has x 1 , . . ., x l and y as distinguished elements.The spoiler wins the game if he wins the game of stage 3 in the usual sense.Otherwise, the duplicator wins. 1. C is first-order definable.
2. For some l, r and d, the spoiler has a winning strategy in the local FO Ehrenfeucht game on C with parameters l, r and d.
3. There exists a set H of Hintikka-types such that, for some l, r and d, for every σ-structure A it holds that A ∈ C if and only if there exist x 1 , . . ., Proof.
(1) =⇒ ( 2): If C is first-order definable, by Theorem 3.2, there is a formula ∃x 1 , . . ., x l ∀yϕ that characterizes the structures of C. Furthermore ϕ is basic r-local around x, y, for some r.
Let d denote the quantifier-depth of ϕ.It follows in a straightforward manner that the spoiler has a winning strategy in the local first-order Ehrenfeucht game on C with parameters l, r and d (compare with [AF90]).
(2) =⇒ (1): From a winning strategy of the spoiler in the local first-order Ehrenfeucht game on C with parameters l, r and d one can easily derive a winning strategy in the ordinary (l+1+r+d)round Ehrenfeucht game on C. The spoiler simply plays l + 1 + r rounds according to his winning strategy in the local game.The additional d rounds assure that the spoiler immediately has a win if, in stage 3, the duplicator does not play in the d-neighbourhoods of y and y ′ .
The local FO Ehrenfeucht game can be easily adapted for the case of monadic Σ 1 1 -logic.The resulting game has one additional parameter m.In stage 1 of the local monadic Σ 1 1 Ehrenfeucht game the spoiler chooses, before the duplicator chooses A ′ , unary relations X 1 , . . ., X m and vertices x 1 , . . ., x l in A and the duplicator has to choose corresponding relations X ′ 1 , . . ., X ′ m and vertices x ′ 1 , . . ., x ′ l in A ′ .Theorem 4.2 Let C be a class of σ-structures.The following are equivalent.
For some m, l, r and d, the spoiler has a winning strategy in the local monadic Σ 1 1 Ehrenfeucht game on C with parameters m, l, r and d.
3. There exists a set H of Hintikka-types such that, for some m, l, r and d, for every σstructure A it holds that A ∈ C ⇐⇒ there exist unary relations X 1 , . . ., X m and elements x 1 , . . ., x l The proof is an easy generalization of the proof of Theorem 4.1.
In a similar manner one can derive respective games from Theorem 3.4.Although we have not used Theorems 4.1 and 4.2 to derive any new inexpressibility results we are optimistic that the local Ehrenfeucht games will turn out to be a useful tool to get such results.One indication in this direction is the fact that many of the inexpressibility proofs that are given in the literature can be proved by using these games (e. g. [FSV95,Sch95]).
One particular example is the proof of Ajtai and Fagin [AF90], which has already been simplified by Arora and Fagin in [AF97].In both of these proofs the notion of the (r, d)-colour of a vertex or an edge is used.As the graphs that were used in those proofs do not contain small cycles all r-spheres are rooted trees.The definition assures that if two vertices have the same (r, d)-colour their r-neighbourhoods have the same d-Hintikka-type.As in the construction of [AF90] both structures have exactly the same multisets of (r, d)-colours Theorem 4.2 implies their result.It should be noted that the additional choice of vertices x 1 , . . ., x l does not make the construction of the graphs more difficult, as they can almost be treated like l additional unary relations with the proviso that each of these colours appears in every graph exactly once.

Automata
The conditions (3) of Theorems 4.1 and 4.2 give rise to a generalized form of automata.In this section we are going to introduce automata models for FO logic and monadic Σ 1 1 logic, respectively.Vaguely similar machine models are known for relational databases [Lei89,GPPdB94,AV95]. Informally the FO automaton works as follows.First it nondeterministically pebbles vertices b 1 , . . ., b g of its input structure A, for some g.Then, for every vertex a of A, it inspects in a constant number of steps (alternating between nondeterminism and parallelism) the neighbourhood of a. Navigation through the neighbourhood is only along edges.
We now define the model more formally.Let σ be a relational signature.A first-order σ-automaton M consists of a tuple (g, l, I, ϕ), where g ≥ 0 is the size of the global read-only store, l ≥ 0 is the size of the local store, I is a finite sequence of instructions and ϕ is a test.The store will hold a vector of (pointers to) elements of the structure.Instructions are of the form any i, j or all i, j , where 1 ≤ i, j ≤ l.The test is a quantifier-free formula with variables from x 1 , . . ., x l , y 1 , . . ., y g .A configuration (J, b, a) consists of a (possibly empty) sequence J of instructions yet to be executed and the contents b and a of the global and local store, respectively.Let b ∈ A l and v ∈ A. A configuration tree of M for b and v is defined as follows.It is a rooted tree, directed from the root to the leaves, and has configurations of M as vertices.It has the start configuration (I, b, v l ) as its root.The leaves are terminal configurations (ε, b, a).An inner vertex (ιJ, b, a) has • one child (J, b, a ′ ), where a ′ j is a i or a neighbour of a i and a ′ k = a k for every k = i, if ι is any i, j , and y), otherwise rejecting.A configuration tree is accepting, if all its leaves are accepting.We say that M accepts A if there is a b ∈ A g such that for every v ∈ A there is an accepting configuration tree of M with b and a.
A monadic Σ 1 1 σ-automaton similarly consists of a tuple (Q, g, l, I, ϕ), where g, l, I, ϕ are as before and Q is a finite set of states.It starts by nonterministically selecting a mapping f : U A → Q (represented by unary relations F q , one for each q ∈ Q).Afterwards it continues like the FO automaton (where the input structure is extended by the F q ).Theorem 5.1 A class of σ-structures is first-order definable if and only if it is accepted by a first-order σ-automaton.
Proof."only if": By Theorem 3.3, C can be defined by a ∃ * ∀-local formula ∃x 1 , . . ., x g ∀yψ (without free variables), where ψ is in prenex normal form with d quantifiers (r-local around y) numbered from left to right with 1, . . ., d.Let l = d + 1 and let I consist of the subsequences J 1 , . . ., J d , where • J i is any l, i followed by r − 1 times any i, i (nondeterministic choice of an element of distance ≤ r from a) if the i-th quantifier is existential, and • J i is all l, i followed by r − 1 times all i, i otherwise.
Corollary 5.2 A class of σ-structures is monadic Σ 1 1 definable if and only if it is accepted by a monadic Σ 1 1 automaton.For structures of bounded degree, the monadic Σ 1 1 automata generalize those of Thomas [Tho91,Tho97b,Tho97a].In this case a Hintikka-type of a small neighbourhood boils down to an isomorphism type, called tile.The automata of Thomas check that each vertex possesses a neighbourhood of one among a finite number of allowed isomorphism types.Moreover, some of them must occur at least a certain number of times and others at most a certain number of times.(This is the remainder of Hanf's condition, from which it is actually derived.)Inspecting Theorem 3.3 again with this in mind, one finds that ϕ describes all admissible tiles, while the center y runs over all vertices.The variables x are used to distinguish a finite number of vertices.It is therefore clear that it suffices to require that some tiles (namely those with a center in x) occur exactly once.Moreover, for structures with a connected Gaifman graph, Theorem 3.4 implies that one occurrence constraint of this form suffices.
We would also like to compare monadic Σ 1 1 automata to the algebraic automata introduced by Courcelle [Cou90].On general finite relational structures these automata are very powerful.They capture MSO logic with a built-in linear order [Cou92,Cou96].And on grids, for example, this inclusion is strict.More suitable for a comparison are sets of unordered, unranked trees, which we simply call trees in the sequel.On these structures, the recognizing power of algebraic automata is exactly the same as definability in monadic Σ 1 1 logic with a built-in linear order, as will be shown below.Hence the difference between algebraic automata and monadic Σ 1 1 automata corresponds to the difference between monadic Σ 1 1 with and without a built-in linear order, two logics which have different expressive power [Cou90].(For example, the linear order allows to count branches.)That such a linear order comes into play on an intentionally unordered structure is obviously due to the fact that trees must be encoded as terms before they are input to an automaton.The parallel inspection of local neighbourhoods in monadic Σ 1 1 automata avoids such side-effects.This is remarkable because Theorem 3.4 (b) applies and ensures that monadic Σ 1 1 automata do not need a global store in this case.Therefore, global information about a tree can be collected at the root without referring to some arbitrary order.
We now introduce trees and algebraic automata more formally.(Compare [Cou90].)A tree contains a distinguished vertex, its root.Edges are directed from the root to the leaves.They carry labels from a finite set L E .Vertices are labelled with sets of elements from a finite set L V .There is no a priori upper bound on the degree of a vertex.In particular, the degree of a vertex is not determined by its labelling.The class of trees (up to isomorphism) over L V , L E can be obtained inductively as follows.A few simple trees are assumed to be given.They consist solely of their root, which can be unlabelled or carry a label l ∈ L V .We denote these one-vertex trees by constants 1 and l, respectively.Then certain operations allow to construct new trees out of one or two others.For every label l ∈ L E there is a unary operation l adding to its argument a new (unlabelled) root and an l-labelled edge to the old root.Finally, a binary operation • glues its arguments at their roots, taking the union of their respective sets of root labels.It is easy to see that these operations can generate all trees and only those.In general, there is more than one way to obtain a particular tree.
An algebraic automaton recognizing a set of trees is an ordinary deterministic tree automaton working on the inductive representations of the trees (their derivation trees with respect to a grammar generating all trees).It is required that it accepts or rejects a tree independently of its representation, that is, all runs on different representations of the same tree produce the same answer.(Because logical formulas are also compatible to these inductive representations, algebraic automata are useful to obtain decision procedures.)Formally, an algebraic automaton consists of a finite set A = {1, . . ., m} of states, a transition function δ : and a subset F ⊆ A of accepting states.δ turns A into an algebra with respect to the tree-building operations: We write t for δ(t), t ∈ {1} ∪ L V , l(a) for δ( l, a), and a 1 • a 2 for δ(a 1 , •, a 2 ).The information contained in all the possible runs of the automaton can conveniently be expressed as a homomorphism from the set of all terms into A. We may assume that the homomorphism is surjective, that is, A does not contain superfluous states.Therefore, because results do not depend on representations, A is a commutative monoid with respect to • and has 1 as its neutral element.Moreover, l • l = l for every l ∈ L V .For all a 1 , . . ., a n ∈ A, n ≥ 0, the value of n i=1 a i only depends on the "Parikh image" Theorem 5.3 A set of trees is recognizable (by algebraic automata) if and only if it is definable in monadic Σ 1 1 logic with the help of a built-in linear order.That is, we consider monadic Σ 1 1 formulas which may use a linear order on the vertices of a tree but must remain invariant if the linear order is replaced with a different one.
We adapt the proof in [Cou90], which started from slightly different operations and aimed at a slightly different statement.There is no substantial new idea, only the defining formula has a more restricted form.Proof.The only-if part was shown in [Cou92,Cou96].Since our operations are derivable from the general (so-called quantifier-free definable) operations on graphs [Cou92], a tree which is recognizable as a graph is a fortiori recognizable with respect to tree operations.For the if-part consider a tree T with set of vertices V , set of edges E ⊆ V × V and root r.Let V l ⊆ V be the set of vertices labelled with l ∈ L V , and let E l ⊆ E be the set of vertex pairs which are connected by an edge labelled with l ∈ L E .We write T v for the subtree of T rooted at v ∈ V .Of course, T r = T .We determine a mapping ∂ : V → A inductively, moving from the leaves to the root.Since we can choose the representation of T such that we have Acceptance of T is equivalent to the existence of ∂ satisfying ( * ) and the condition ∂(r) ∈ F .This can be expressed in monadic Σ 1 1 logic with the help of a built-in linear order.As usual, the existence of pairwise disjoint sets X i = ∂ −1 (i), i ∈ A, is required.Besides that, each set v∈Xi Y i,v , i ∈ A, where is partitioned into q i sets such that they can be used (together with the built-in linear order) to determine the cardinality of Y i,v modulo q i for every v ∈ X i .For suitable q i ≥ 1, i ∈ A, this is enough to compute f , hence express ( * ).
For every a ∈ A, the sequence a 0 , a 1 , a 2 , . . .becomes ultimately periodic.Let p a ≥ 0, q a ≥ 1 be the smallest values such that a pa = a pa+qa .It is easy to see that f −1 (a) is a finite union of sets of the form {(n 1 , . . ., n m ) ∈ N m | n i = pi + k i qi , k i ≥ 0} with pi , qi ≥ 0.More precisely, for each i ∈ A independently, either pi < p i and qi = 0, or p i ≤ pi < p i + q i and qi = q i .Therefore, f −1 (a) can be described by a first-order formula for every a ∈ A.

Conclusion
We introduced a normal form for first-order logic that formalizes the intuition that this logic is only able to express properties of the form "there are some important parts of the structure that fulfil given conditions and everywhere else nothing forbidden happens".Although our normal forms are mainly useful when structures of unbounded diameter are considered (otherwise the whole structure is contained in the neighbourhood of all of its vertices and local formulas are just general first-order formulas) their translation into the language of automata gives uniform means of evaluating first-order properties "along the edges" of structures.On the other hand it is applicable to structures of unbounded degree, even in situations where the Hanf argument does not work.
Our main open question is whether the normal forms have other meaningful applications and to find new inexpressibility results with the help of the simplified games.Another question is whether automata models can be designed that inspect the neighbourhoods of vertices in a more deterministic fashion.
U A and edges between vertices a and b whenever a and b occur in a common tuple of a relation of A. The distance δ(a, b) of the vertices a and b of A is given by their (standard graph) distance in the Gaifman graph of A. For a tuple b = b 1 , . . ., b l of vertices of A we define δ(a, b) := min{δ(a, b i ) | i ≤ l}.For a tuple b = b 1 , . . ., b l of vertices of A and r ≥ 0 we define S r (b) := {a ∈ U A | δ(a, b) ≤ r}.We let N r (b) (resp.N r (a), for a = a 1 , . . ., a l ) denote the substructure of A which is induced by the vertices of S r (b) (resp.S r (a)) and has b (the a i ) as distinguished elements.

Theorem 4. 1
Let C be a class of σ-structures.The following are equivalent.