Structure Theorem and Strict Alternation Hierarchy for FO 2 on Words ∗

. It is well-known that every ﬁrst-order property on words is expressible using at most three variables. The subclass of properties expressible with only two variables is also quite interesting and well-studied. We prove precise structure theorems that characterize the exact expressive power of ﬁrst-order logic with two variables on words. Our results apply to both the case with and without a successor relation. For both languages, our structure theorems show exactly what is expressible using a given quantiﬁer depth, n , and using m blocks of alternating quantiﬁers, for any m ≤ n . Using these characterizations, we prove, among other results, that there is a strict hierarchy of alternating quantiﬁers for both languages. The question whether there was such a hierarchy had been completely open. As another consequence of our structural results, we show that satisﬁability for ﬁrst-order logic with two variables without successor, which is NEXP -complete in general, becomes NP -complete once we only consider alphabets of a bounded size.


Introduction
It is well-known that every first-order property on words is expressible using at most three variables [7,8].The subclass of properties expressible with only two variables is also quite interesting and well-studied (Fact 1.1).
In this paper we prove precise structure theorems that characterize the exact expressive power of first-order logic with two variables on words.Our results apply to FO 2 [<] and FO 2 [<, Suc], the latter of which includes the binary successor relation in addition to the linear ordering on string positions.
For both languages, our structure theorems show exactly what is expressible using a given quantifier depth, n, and using m blocks of alternating quantifiers, for any m ≤ n.Using these characterizations, we prove that there is a strict hierarchy of alternating quantifiers for both languages.The question whether there was such a hierarchy had been completely open since it was asked in [3,4].As another consequence of our structural results, we show that satisfiability for FO 2 [<], which is NEXP-complete in general [4], becomes NPcomplete once we only consider alphabets of a bounded size.
Our motivation for studying FO 2 on words comes from the desire to understand the trade-off between formula size and number of variables.This is of great interest because, as is well-known, this is equivalent to the trade-off between parallel time and number of processors [6].Adler and Immerman [1] introduced a game that can be used to determine the minimum size of first-order formulas with a given number of variables needed to express a given property.These games, which are closely related to the communication complexity games of Karchmer and Wigderson [9], were used to prove two optimal size bounds for temporal logics [1].Later Grohe and Schweikardt used similar methods to study the size versus variable trade-off for first-order logic on unary words [5].They proved that all firstorder expressible properties of unary words are already expressible with two variables and that the variable-size trade-off between two versus three variables is polynomial whereas the trade-off between three versus four variables is exponential.They left open the trade-off between k and k + 1 variables for k ≥ 4. While we do not directly address that question here, our classification of FO 2 on words is a step towards the general understanding of the expressive power of FO needed for progress on such trade-offs.
Our characterization of FO 2 [<] and FO 2 [<, Suc] on words is based on the very natural notion of n-ranker (Definition 3.2).Informally, a ranker is the position of a certain combination of letters in a word.For example, ⊲ a and ⊳ b are 1-rankers where ⊲ a (w) is the position of the first a in w (from the left) and ⊳ b (w) is the position of the first b in w from the right.Similarly, the 2-ranker r 2 = ⊲ a ⊲ c denotes the position of the first c to the right of the first a, and the 3-ranker, r 3 = ⊲ a ⊲ c ⊳ b denotes the position of the first b to the left of r 2 .If there is no such letter then the ranker is undefined.For example, r 3 (cababcba) = 5 and r 3 (acbbca) is undefined.
Our first structure theorem (Theorem 3.8) says that the properties expressible in FO 2 n [<], i.e. first-order logic with two variables and quantifier depth n, are exactly boolean combinations of statements of the form, "r is defined", and "r is to the left (right) of r ′ " for k-rankers, r, and k ′ -rankers, r ′ , with k ≤ n and k ′ < n.A non-quantitative version of this theorem was previously known [13]. 1 Furthermore, a quantitative version in terms of iterated block products of the variety of semi-lattices is presented in [16], based on work by Straubing and Thérien [14].
Surprisingly, Theorem 3.8 can be generalized in almost exactly the same form to characterize FO 2 m,n [<] where there are at most m blocks of alternating quantifiers, m ≤ n.This second structure theorem (Theorem 4.5) uses the notion of (m, n)-ranker where there are m blocks of ⊲'s or ⊳'s, that is, changing direction in rankers corresponds exactly to alternation of quantifiers.Using Theorem 4.5 we prove that there is a strict alternation hierarchy for FO 2  n [<] (Theorem 4.11) but that exactly at most |Σ| + 1 alternations are useful, where |Σ| is the size of the alphabet (Theorem 4.7).
The language FO 2 [<, Suc] is more expressive than FO 2 [<] because it allows us to talk about consecutive strings of symbols 2 .For FO 2 [<, Suc], a straightforward generalization of n-ranker to n-successor-ranker allows us to prove exact analogs of Theorems 3.8 and 4.5.We use the latter to prove that there is also a strict alternation hierarchy for FO The expressive power of first-order logic with three or more variables on words has been well-studied.The languages expressible are of course the star-free regular languages [10].The dot-depth hierarchy is the natural hierarchy of these languages.This hierarchy is strict [2] and identical to the first-order quantifier alternation hierarchy [18,19].
Many beautiful results on FO 2 on words were also already known.The main significant outstanding question was whether there was an alternation hierarchy.The following is a summary of the main previously known characterizations of FO 2 [<] on words.For a detailed treatment of all these characterizations, we refer the reader to [15].Fact 1.1.[3,4,11,12,17,13] Let R ⊆ Σ ⋆ .The following conditions are equivalent: R is an unambiguous regular language (5) The syntactic semi-group of R is a member of DA (6) R is recognizable by a partially-ordered 2-way automaton (7) R is a boolean combination of "turtle languages" The proofs of our structure theorems are self-contained applications of Ehrenfeucht-Fraïssé games.All of the above characterizations follow from these results.Furthermore, we have now exactly connected quantifier and alternation depth to the picture, thus adding tight bounds and further insight to the above results.
For example, one can best understand item 4 above -that FO 2 [<] on words corresponds to the unambiguous regular languages -via Theorem 3.12 which states that any FO 2 n [<] formula with one free variable that is always true of at most one position in any string, necessarily denotes an n-ranker.
In the conclusion of [13], the authors define the subclasses of rankers with one and two blocks of alternation.They write that, ". . .turtle languages might turn out to be a helpful tool for further studies in algebraic language theory."We feel that the present paper fully justifies that prediction.Turtle languages -aka rankers -do provide an exceptionally clear and precise understanding of the expressive power of FO 2 on words, with and without successor.
In summary, our structure theorems provide a complete classification of the expressive power of FO 2 on words in terms of both quantifier depth and alternation.They also tighten several previous characterizations and lead to the alternation hierarchy results.
We begin the remainder of this paper with a brief review of logical background including Ehrenfeucht-Fraïssé games, our main tool.In Sect. 3 we formally define rankers and present our structure theorem for FO 2 n [<].The structure theorem for FO 2 m,n [<] is covered in Sect.4, including our alternation hierarchy result that follows from it.Sect. 5 extends our structure theorems and the alternation hierarchy result to FO 2 [<, Suc].Finally, we discuss applications of our structural results to satisfiability for FO 2 [<] in Sect.6.

Background and Definitions
We recall some notation concerning strings, first-order logic, and Ehrenfeucht-Fraïssé games.See [6] for more details, including the proof of Facts 2.1 and 2.2.
Σ will always denote a finite alphabet and ε the empty string.For a word w ∈ Σ ℓ and i ∈ [1, ℓ], let w i be the i-th letter of w; and for [i, j] a subinterval of [1, ℓ], let w [i,j] be the substring w i . . .w j .Slightly abusing notation, we identify a word w ∈ Σ ℓ with the logical structure w = ({1, . . ., ℓ}; Q w a , a ∈ Σ; x w ; y w ).Here Q a , a ∈ Σ are all unary relation symbols, and x and y are the only two variables.If not specified otherwise, we have x w = y w = 1 by default, and for all a ∈ Σ, Q w a = {1 ≤ i ≤ ℓ | w i = a}.Furthermore, we write (w, i, j) for the word structure w with the two variables set to i and j, respectively, and (w, i) for the word structure w with x w = i.Thus w = (w, 1, 1), and (w, i) We use FO[<] to denote first-order logic with a binary linear order predicate <, and FO = FO[<, Suc] for first-order logic with an additional binary successor predicate.FO 2 n refers to the restriction of first-order logic to use at most two distinct variables, and quantifier depth n.FO 2 m,n is the further restriction to formulas such that any path in their parse tree has at most m blocks of alternating quantifiers, and FO 2 -ALT[m] = n≥m FO 2 m,n .We write u ≡ 2 n v to mean that u and v agree on all formulas from FO 2 n , and u ≡ 2 m,n v if they agree on FO 2 m,n .We assume that the reader is familiar with our main tool: the Ehrenfeucht-Fraïssé game.In each of the n moves of the game FO 2 n (u, v), Samson places one of the two pebble pairs, x or y on a position in one of the two words and Delilah then answers by placing that pebble's mate on a position of the other word.Samson wins if after any move, the map from the chosen points in u to those in v, i.e., x u → x v , y u → y v is not an isomorphism of the induced substructures; and Delilah wins otherwise.The fundamental theorem of Ehrenfeucht-Fraïssé games is the following: m,n (u, v) iff u ≡ 2 m,n v.We end this section with a simple lemma that will be useful whenever we want to prove that there is a formula expressing a property of strings.With this lemma, it suffices to show that for any pair of strings, one with the property in question and one without, there is a formula that distinguishes between these two particular strings.Lemma 2.3.Let P ⊆ Σ ⋆ and let L be a logic closed under boolean operations with only finitely many inequivalent formulas.If for every u ∈ P and every v ∈ P there is a formula ϕ u,v ∈ L such that u |= ϕ u,v and v |= ϕ u,v , then there is a formula ϕ ∈ L such that for all w ∈ Σ ⋆ , w |= ϕ ⇐⇒ w ∈ P .
Proof.Let Γ = {ψ u,v | u ∈ P, v ∈ P }, and let Γ ′ be a maximal subset of Γ containing only inequivalent formulas.Since L contains only finitely many inequivalent formulas, Γ ′ is finite.For every u ∈ P , we define the finite sets of formulas Γ ′ u = {ψ ∈ Γ ′ | u |= ψ}.Since all these sets are subsets of the finite set Γ ′ , there can only be finitely many of them.Thus there is a finite set We have ϕ ∈ L and for every w ∈ Σ ⋆ , w ∈ P ⇐⇒ w |= ϕ as required.
It is well-known [6] that for any m, n ∈ N, the logics FO 2 n and FO 2 m,n , both with and without the successor predicate, have only finitely many inequivalent formulas.Thus the above lemma applies to these logics.

Structure Theorem for FO 2 [<]
We define boundary positions that point to the first or last occurrences of a letter in a word, and define an n-ranker as a sequence of n boundary positions.In terms of [13], boundary positions are turtle instructions and n-rankers are turtle programs of length n.The following three lemmas show that basic properties about the definedness and position of these rankers can be expressed in FO 2 [<], and we use these results to prove our structure theorem.
Here we set min{} and max{} to be undefined, thus d a (w) is undefined if a does not occur in w.A boundary position can also be specified with respect to a position q ∈ [1, |w|].
Let n be a positive integer.An n-ranker r is a sequence of n boundary positions.The interpretation of an n-ranker r = (p 1 , . . ., p n ) on a word w is defined as follows.
Instead of writing n-rankers as a formal sequence (p 1 , . . ., p n ), we often use the simpler notation p 1 . . .p n .We denote the set of all n-rankers by R n , and the set of all n-rankers that are defined over a word w by R n (w).Furthermore, we set Let r be an n-ranker.As defined above, we have r = (p 1 , . . ., p n ) for boundary positions p i .The k-prefix ranker of r for k ∈ [1, n] is r k := (p 1 , . . ., p k ).Definition 3.4.Let i, j ∈ N. The order type of i and j is defined as Proof.We only look at the case where x u ≥ r(u) and x v < r(v) since all other cases are symmetric to this one.For n = 1 Samson has a winning strategy: If r is the first occurrence of a letter, then Samson places y on r(u) and Delilah cannot reply.If r marks the last occurrence of a letter in the whole word, then Samson places y on r(v).Again, Delilah cannot reply with any position and thus loses.For n > 1, we look at the prefix ranker r n−1 of r.One of the following two cases applies.
(1) r n−1 (u) < r(u), as shown in Fig. 1.Samson places pebble y on r(u), and Delilah has to reply with a position that is to the left of x v .She cannot choose a position in the interval (r n−1 (v), r(v)), because this section does not contain the letter u r(u) .Thus she has to choose a position left of or equal to r n−1 (v).By induction Samson wins the remaining game.r(u) < r n−1 (u), as shown in Fig. 2. Samson places y on r(v), and Delilah has to reply with a position to the right of x u and thus to the right of r(u).She cannot choose any position in (r(u), r n−1 (u)), because this interval does not contain the letter v r(v) , thus Delilah has to choose a position to the right of or equal to r n−1 (u).By induction Samson wins the remaining game.
Lemma 3.6 (expressing the definedness of a ranker).Let n be a positive integer, and let , and using Fact 2.1, it suffices to show that Samson wins the game FO 2 n (u, v).If r 1 , the shortest prefix ranker of r, is not defined over v, the letter referred to by r 1 occurs in u but does not occur in v. Thus Samson easily wins in one move.
Otherwise we let r i = (p 1 , . . ., p i ) be the shortest prefix ranker of r that is undefined over v. Thus r i−1 is defined over both words.Without loss of generality we assume that p i = ⊳ a .This situation is illustrated in Fig. 3. Notice that v does not contain any a's to the left of r i−1 (v), otherwise r i would be defined over v. Samson places x in u on r i (u), and Delilah has to reply with a position right of or equal to r i−1 (v).Now Lemma 3.5 applies and Samson wins in i − 1 more moves.Lemma 3.7 (position of a ranker).Let n be a positive integer and let r ∈ R n .There is a formula Proof.As in the proof of Lemma 3.6, it suffices to show that for arbitrary u, v ∈ Σ ⋆ , Samson wins the game FO 2 n (u, v) where initially x u = r(u) and is defined over v, then we can apply Lemma 3.5 immediately to get the desired strategy for Samson.Otherwise we use the strategy from Lemma 3.6.
).Let u and v be finite words, and let n ∈ N. The following two conditions are equivalent.
. Instead of proving Theorem 3.8 directly, we prove the following more general version on words with two interpreted variables.
For n = 0, (i)(a), (i)(b) and (i)(d) are vacuous, and (i)(c) is equivalent to (ii).For n ≥ 1, we prove the two implications individually using induction on n.
We first show "¬(i) ⇒ ¬(ii)".Assuming that (i) holds for n ∈ N but fails for n + 1, we show that (u, (1) There is an (n + 1)-ranker that is defined over one word but not over the other.
(2) There are two n-rankers that do not agree on their ordering in u and v.
(3) There is an (n + 1)-ranker that does not appear in the same order on both structures with respect to a k-ranker where k ≤ n.
We first look at case (2) where there are two rankers r, r ′ ∈ R ⋆ n (u) that disagree on their ordering in u and v. Without loss of generality we assume that r(u) ≤ r ′ (u) and r(v) > r ′ (v), and present a winning strategy for Samson in the FO 2 n+1 game.In the first move he places x on r(u) in u.Delilah has to reply with r(v) in v, otherwise she would lose the remaining n-move game as shown in Lemma 3.5.Let r ′ n−1 be the (n − 1)-prefix-ranker of r ′ .We look at two different cases depending on the ordering of r ′ n−1 and r ′ .For r ′ n−1 (u) > r ′ (u), the situation is illustrated in Fig. 5.In his second move, Samson places pebble y on r ′ (u), and Delilah has to reply with a position to the right of x v , but she cannot choose anything from the interval (r ′ (v), r ′ n−1 (v)) because this section does not contain the letter u y u .Thus she has to reply with a position right of or equal to r Now we look at cases (1) and (3), assuming that case (2) does not apply.We know that condition (i) from the statement of the theorem fails, but still all n-rankers agree on their ordering.In both case (1) and case (3), there are two consecutive n-rankers r, r ′ ∈ R n (u) with r(u) < r ′ (u) and a letter a ∈ Σ such that without loss of generality a occurs in the segment u ((r(u),r ′ (u)) but not in the segment v (r(v),r ′ (v)) .We describe a winning strategy for Samson in the game FO 2 n+1 (u, v).He places x on an a in the segment (r(u), r ′ (u)) of u, as shown in Fig. 6.Delilah cannot reply with anything in the interval (r(v), r ′ (v)).If she replies with a position left of or equal to r(v), then x is on different sides of the n-ranker r in the two words.Thus Lemma 3.5 applies and Samson wins the remaining n-move game.If Delilah replies with a position right of or equal to r ′ (v), then we can apply Lemma 3.5 to r ′ and get a winning strategy for the remaining game as well.This concludes the proof of "¬(i) ⇒ ¬(ii)".
To show "(i) ⇒ (ii)", we assume (i) for n + 1, and present a winning strategy for Delilah in the FO 2 n+1 game on the two structures.In his first move Samson picks up one of the two pebbles, and places it on a new position.Without loss of generality we assume that Samson picks up x and places it on u in his first move.If x u = r(u) for any ranker r ∈ R ⋆ n+1 (u), then Delilah replies with x v = r(v).This establishes (i)(c) and (i)(d) for n, and thus Delilah has a winning strategy for the remaining FO 2 n game by induction.
If Samson does not place x u on any ranker from R ⋆ n+1 (u), then we look at the closest rankers from R ⋆ n (u) to the left and right of x u , denoted by λ and ρ, respectively.Let a := u x u and define the (n + 1)-ranker s = (λ, ⊲ a ).On u we have λ(u) < s(u) < ρ(u).Because of (i)(a) s is defined on v as well, and because of (i)(b), we have λ(v) < s(v) < ρ(v).If y u is not contained in the interval (λ(u), ρ(u)), then Delilah places x on s(v), which establishes (i)(c) and (i)(d) for n.Thus by induction Delilah has a winning strategy for the remaining FO If both pebbles x u and y u occur in the interval (λ(u), ρ(u)), then we need to be more careful.Without loss of generality we assume y u < x u as illustrated in Fig. 7. Thus Delilah has to place x in the interval (y v , ρ(v)) and at a position with letter a := u x u .We define the n + 1-ranker s = (ρ, ⊳ a ).From (i)(d) we know that s appears on the same side of y in both structures, thus we have y v < s(v) < ρ(v).Delilah places her pebble x on s(v), and thus establishes (i)(c) and (i)(d) for n.By induction, Delilah has a winning strategy for the remaining FO 2 n game.A fundamental property of an n-ranker is that it uniquely describes a position in a given word.Now we show that the converse holds as well: Any position in a word that can be uniquely described with an FO 2 [<] formula can also be described by a ranker (Lemma 3.11).Furthermore, any FO 2 [<] formula that describes a unique position in any given word is equivalent to a boolean combination of rankers (Theorem 3.12).Definition 3.10 (unique position formula).A formula ϕ ∈ FO 2 [<] with x as a free variable is a unique position formula if for all w ∈ Σ ⋆ there is at most one i ∈ [1, |w|] such that (w, i) |= ϕ.Lemma 3.11.Let n be a positive integer and let ϕ ∈ FO 2 n [<] be a unique position formula.Let u ∈ Σ ⋆ and let i ∈ [1, |u|] such that (u, i) |= ϕ.Then i = r(u) for some ranker r ∈ R ⋆ n .Proof.Suppose for the sake of a contradiction that there is no ranker r ∈ R ⋆ n such that (u, i) |= ϕ r .Because the first and last positions in u are described by 1-rankers, we know that i / ∈ {1, |u|}.We construct a new word v by doubling the symbol at position i in u, v = u 1 . . .u i−1 u i u i u i+1 . . .u |u| .By assumption, there is no n-ranker that describes position i in u.A brief argument by contradiction shows that there are also no n-rankers that describe positions i or i + 1 in v: Assuming that such a ranker exists, let r be the shortest such ranker.Thus none of the prefix rankers of r point to either positions i or i + 1 in v.This means that all prefix rankers of r are interpreted in exactly the same way on both u and v, and irrespective of whether r(v) points to i or i + 1, we have have r(u) = i, a contradiction.Hence all n-rankers are insensitive to the doubling of u i , and the two words u and v agree on the definedness of all n-rankers and on their ordering.By Theorem 3.9, we thus have (u, i) ≡ 2 n (v, i) ≡ 2 n (v, i + 1), which contradicts the fact that ϕ is a unique position formula.Theorem 3.12.Let n be a positive integer and let ϕ ∈ FO 2 n [<] be a unique position formula.There is a k ∈ N, and there are mutually exclusive formulas where ϕ r i ∈ FO 2 n [<] is the formula from Lemma 3.7 that uniquely describes the ranker r i .Proof.Let T be the set of all FO 2 n [<] types of words over Σ with one interpreted variable.Because there are only finitely many inequivalent formulas in FO 2 n [<], T is finite.Let T ′ ⊆ T be the set of all types that satisfy ϕ.We set Now suppose that (u, j) |= ϕ.Thus (u, j) |= α i for some i.By Lemma 3.11 (u, j) |= ϕ r i for some n and α i is a complete FO 2 n formula.Thus α i ≡ α i ∧ ϕ r i so ϕ is in the desired form.

Alternation hierarchy for FO 2 [<]
We define alternation rankers and prove our structure theorem (Theorem 4.5) for FO 2 m,n [<].Surprisingly the number of alternating blocks of ⊳ and ⊲ in the rankers corresponds exactly to the number of alternating quantifier blocks.The main ideas from our proof of Theorem 3.8 still apply here, but keeping track of the number of alternations does add complications.R i,j (w) Lemma 4.2.Let m and n be positive integers with m ≤ n, let u, v ∈ Σ ⋆ , and let r ∈ R m,n (u) ∩ R m,n (v).Samson wins the game FO 2 m,n (u, v) where initially ord(r(u), Furthermore, Samson can start the game with a move on u if r ends with ⊲, r(u) ≤ x u and r(v) ≥ x v , or if r ends with ⊳, r(u) ≥ x u and r(v) ≤ x v .He can start the game with a move on v if r ends with ⊲, r(u) ≥ x u and r(v) ≤ x v , or if r ends with ⊳, r(u) ≤ x u and r(v) ≥ x v .
Proof.If m = n = 1, then we can immediately apply the base case from the proof of Lemma 3.5.Samson wins in one move, placing his pebble on u or v as specified.
For the remaining cases, we assume without loss of generality that r ends with ⊲ and that x u ≥ r(u) and x v ≤ r(v).Let r n−1 be the (n − 1)-prefix ranker of r.This situation is illustrated in Fig. 1  ∈ R m,n (v), and using Fact 2.1, it suffices to show that Samson wins the game FO 2 m,n (u, v).Let r i = (p 1 , . . ., p i ) be the shortest prefix ranker of r that is undefined over v, and we assume without loss of generality that this ranker ends with the boundary position p i = ⊳ a for some a ∈ Σ.This situation is illustrated in Fig. 3 for Lemma 3.7.In his first move Samson places x on r i (u) and thus forces a situation where x u < r i−1 (u) and x v ≥ r i−1 (v).If r i−1 ends with ⊳, then according to Lemma 4.  (i) (a) R m,n (u) = R m,n (v), and, (b) for all r ∈ R ⋆ m,n (u) and for all r ′ ∈ R ⋆ m−1,n−1 (u), we have ord(r(u), r ′ (u)) = ord(r(v), r ′ (v)), and, (c) for all r ∈ R ⋆ m,n (u) and r ′ ∈ R ⋆ m,n−1 (u) such that r and r ′ end with different directions, ord(r(u), r ′ (u)) = ord(r(v), r ′ (v)) (ii) u ≡ 2 m,n v Just as before with Theorem 3.8, instead of proving Theorem 4.5 directly, we prove a more general version that applies to words with two interpreted variables.The statement of the general version is asymmetric with respect to the roles of the two structures u and v.This is necessary because of the correspondence between quantifier alternations (i.e.alternations between u and v in the game) and alternations of directions in the rankers.This asymmetry already affected the statement of Lemma 4.2, where Samson's winning strategy starts with a move on the specified structure.In fact, as the proof of the following theorem shows, he does not have a winning strategy that starts with a move on the other structure.We remark that conditions (i)(a) through (i)(e) of the general theorem are completely symmetric with respect to the roles of u and v, and only conditions (i)(f) and (ii) are asymmetric.Theorem 4.5 follows directly from the general theorem, since here i 1 = i 2 = j 1 = j 2 = 1, thus conditions (i)(e) and (i)(f) or trivially true, and the equivalence holds with the roles of u and v reversed as well.(i) (a) R m,n (u) = R m,n (v), and, (b) for all r ∈ R ⋆ m,n (u) and for all r ′ ∈ R ⋆ m−1,n−1 (u), we have ord(r(u), r ′ (u)) = ord(r(v), r ′ (v)), and, (c) for all r ∈ R ⋆ m,n (u) and r ′ ∈ R ⋆ m,n−1 (u) such that r and r ′ end with different directions, ord(r(u), r , and, (e) for all r ∈ R ⋆ m−1,n (u), ord(r(u), i 1 ) = ord(r(v), j 1 ) and ord(r(u), i 2 ) = ord(r(v), j 2 ), and, (f) for all r ∈ R ⋆ m,n (u), and (i, j) ∈ {(i 1 , j 1 ), (i 2 , j 2 )}, (f 1 ) if r ends on ⊲ and r(u) = i, then r(v) ≤ j (f 2 ) if r ends on ⊲ and r(u) < i, then r(v) < j (f 3 ) if r ends on ⊳ and r(u) = i, then r(v) ≥ j (f 4 ) if r ends on ⊳ and r(u) > i, then r(v) > j (ii) Delilah wins the game FO 2 m,n [<]((u, i 1 , i 2 ), (v, j 1 , j 2 )) if Samson starts with a move on (u, i 1 , i 2 ).
Proof.As in the proof of Theorem 3.8, we use induction on n.For n = 0, condition (i)(d) just by itself is equivalent to (ii), and all other conditions of (i) are vacuous.For n ≥ 1, we we first show "¬ (i) ⇒ ¬ (ii)".
Suppose that (i) holds for (m, n), but fails for (m, n + 1).If (i)(d) does not hold then Samson wins immediately.If (i)(e) does not hold for (m, n+1), then by Lemma 4.2, Samson wins the (m, n + 1)-game on (u, v), starting with a move on either u or v.If Samson can start with a move on u, we have established that (ii) is false.Otherwise, we reverse the roles of u and v, and observe that condition (i)(e) still remains the same.Thus, even if Samson needs to start with a move on v, he still has a winning strategy, and (ii) does not hold for (m, n + 1).If (i)(f) does not hold for (m, n + 1), then again by using Lemma 4.2, Samson wins the (m, n + 1)-game on (u, v) starting with a move on u.
If one of (i)(a), (i)(b) or (i)(c) fail, then we show that Samson has a winning strategy for the game FO 2 m,n+1 (u, v).We observe that it does not matter what structure Samson chooses for his first move, since all of (i)(a), (i)(b) and (i)(c) are completely symmetric with respect to the roles of u and v. Thus if Samson's winning strategy starts with a move on v, we can reverse the roles of u and v and get a winning strategy starting with move on u.

One of the following cases applies.
(1) There is a ranker r ∈ R m,n+1 that is defined over one structure but not over the other.This first case applies if (a) fails for (m, n + 1).If condition (2) fails for (m, n + 1), then there are two n-rankers for which it fails, or an (n + 1)-ranker and an n-ranker.This leads to the following two cases.
(2) There are two rankers r ∈ R m,n (u) and r ′ ∈ R m−1,n (u) that disagree on their order, i.e. ord(r(u), r ′ (u)) = ord(r(v), r ′ (v)).(3) There are two rankers r ∈ R m,n+1 (u) and r ′ ∈ R m−1,n (u) that disagree on their order.In a similar fashion, we obtain the remaining two cases if condition (3) fails for (m, n + 1).( 4) There are rankers r, r ′ ∈ R m,n (u) that end on different directions and disagree on their order.
(5) There are rankers r ∈ R m,n+1 (u) and r ′ ∈ R m,n (u) that end on different directions and disagree on their order.We look at the cases ( 2) and ( 4) first, then deal with case (1) assuming that cases (2) and ( 4) do not apply, and finally look at cases (3) and (5).
For case (2), we assume that r(u) ≤ r ′ (u), as illustrated in Fig. 8.The situation for r(u) ≥ r ′ (u) is completely symmetric.Depending on the last boundary position of r, one of the following two subcases applies.game.
• r ends with ⊳.This is similar to the previous case, but now Samson places x on r(v) in his first move.If Delilah replies with a position to the right of r ′ (u), or equal to r ′ (u), then as above we get a winning strategy for Samson in the remaining FO 2 m,n game that starts with a move on v. Otherwise we get a winning strategy for Samson with only m − 1 alternations for the remaining game.Thus again he has a winning strategy for the FO 2 m,n+1 game.For case (4), Samson's winning strategy is very similar to the previous case.If r(u) ≤ r ′ (u) and r ends with ⊲, then Samson places x on r(u) in his first move.If Delilah replies with a position to the right of r(u), then Samson's winning strategy is as above.Otherwise x is on different sides of r ′ and Samson has a winning strategy for the remaining FO 2 m,n game that starts with a move on u.All together, he has a winning strategy for the FO 2 m,n+1 game.The remaining three cases (ordering of r(u) and r ′ (u) and ending direction of r) work in the same way.
Similar to what we did in the proof of Theorem 3.8, we can reduce the remaining cases to an easier situation where a certain segment contains a certain letter in one structure, but not in the other structure, and then apply Lemma 4.2 to obtain a winning strategy for Samson.
To deal with case (1), we assume that the previous two cases, (2) and (4), do not apply.Without loss of generality, say that the (m, n + 1)-ranker r is defined over u but not over v. Let a := u r(u) be the letter in u at position r(u).We define the following sets of rankers.
Notice that all rankers from R ℓ appear to the left of all rankers from R r in u.From the inductive hypothesis, and from the fact that both cases (2) and (4) do not apply, it follows that over v, all rankers from R ℓ appear to the left of all rankers from R r as well.However, the rankers from R ℓ and R r by themselves do not necessarily appear in the same order in both structures.We look at the ordering of these rankers in v, and let λ be the rightmost ranker from R ℓ and ρ be the leftmost ranker from R r .By construction, we have λ(u) < r(u) < ρ(u), so the segment (λ, ρ) in u contains the letter a.Let r n be the n-prefixranker of r, and observe that r n is defined on both structures and that r n is contained in either R ℓ or R r .Because r is not defined on v, the letter a does not occur in v either to the right of r n if r n ∈ R ℓ , or to the left of r n if r n ∈ R r .Thus the segment (λ, ρ) does not contain the letter a in v. Now we know that a occurs in the segment (λ, ρ) in u but not in v, and thus we have established the situation illustrated in Fig. 9. Samson places his first pebble on an a within this section of u, and Delilah has to reply with a position outside of this section.No matter what side of the segment she chooses, with Lemma 4.2 Samson has a winning strategy for the remaining game and thus wins the FO 2 m,n+1 game.In cases (3) and ( 5), we again assume that cases (2) and ( 4) do not apply, and we look at the same sets of rankers, R ℓ and R r , and at r n , the n-prefix-ranker of r.We assume that r(u) ≤ r ′ (u) and that r ends with ⊲, all three other cases are completely symmetric.Notice that r n is an (m − 1, n)-ranker, or an (m, n)-ranker that ends with ⊲.Thus both structures agree on the ordering of r n and r ′ .The relative positions of all these rankers are illustrated in Fig. 10.As above, let λ be the rightmost ranker from R ℓ and let ρ be the leftmost ranker from R r , with respect to the ordering of these rankers on v. Again we know that λ(u) < r(u) < ρ(u) and therefore the segment (λ, ρ) of u contains an a.Notice that r n ∈ R ℓ and r ′ ∈ R r , thus r n (v) ≤ λ(v) < ρ(v) ≤ r ′ (v).Thus the segment (λ, ρ) does not contain the letter a in v, providing Samson with a winning strategy as argued above.To prove "(i) ⇒ (ii)", we assume that the theorem holds for n, and that (i) holds for (m, n + 1), and we present a winning strategy for Delilah in the game FO 2 m,n+1 (u, v) where Samson starts with a move on u.
If Samson places x on a ranker r ∈ R ⋆ m−1,n (u), then Delilah replies by placing x on the same ranker on v. Since (i)(b) holds for (m, n + 1), this establishes (i)(e) and (i)(f) for (m, n).It also establishes (i)(e) and (i)(f) for (m − 1, n) with reversed roles of u and v. Thus we can apply the inductive hypothesis to get a winning strategy for Delilah in the remaining game.
If x u = y u after Samson's first move, then Delilah replies with x v = y v .We use the inductive hypothesis to argue that Delilah wins the remaining n-move game, no matter what structure Samson chooses for his next move.If he chooses to play on u, then the remaining game is an (m, n)-game.Since in the first move Delilah set x v = y v , we have (i)(e) and (i)(f) for (m, n), and thus the inductive hypothesis applies and Delilah wins the remaining game.On the other hand, if Samson chooses to play on v for the next move, the remaining game is an (m − 1, n)-game, since he started with a move on u.Because Delilah set x v = y v in the first move, (i)(e) for (m, n + 1) implies both (i)(e) and (i)(f) for (m − 1, n) with reversed roles of u and v. Thus we can again use the inductive hypothesis to get a winning strategy for Delilah in the remaining game.previous parts again.Once we visited one part of a word |Σ| times, this part cannot contain any more letters and thus is empty.Theorem 4.7.Let Σ be a finite alphabet, let u, v ∈ Σ ⋆ and n ∈ N. If u ≡ 2 |Σ|+1,n v, then u ≡ 2 n v. Proof.Suppose for the sake of a contradiction that u ≡ 2 |Σ|+1,n v and u ≡ 2 n v. Thus, using Theorem 4.5, u and v agree on the definedness of all (|Σ| + 1, n)-rankers, and on their order with respect to all (|Σ|, n − 1)-rankers and some (|Σ| + 1, n − 1)-rankers.But since u ≡ 2 n v, u and v need to disagree on the properties of some other ranker.Let r = (p 1 , . . ., p t ) with t ∈ N be the shortest such ranker.We know that r has more than |Σ| blocks of alternating directions, say r is an m-alternation ranker for some m > |Σ|.Let 1 ≤ k 1 , . . ., k m ≤ t be the indices of the boundary positions at the end of each block, i.e.where p k i , 1 ≤ i < m points to a different direction than p k i +1 .For the last of those indices we have k m = t.
We look at the prefix rankers of r up to the end of each alternating block, r k i := (p 1 , . . ., p k i ), and the intervals defined by these prefix rankers.We set I 0 (u) := [1, |u|], r 0 (u) = 0 if p 1 points to the right, and r 0 (u) = |u| + 1 if p 1 points to the left.For all i ∈ [1, m] let, Notice that by definition the letter mentioned in p k i does not occur in the interval I i .Suppose that for all i ∈ [1, m] we have r k i (u) ∈ I i−1 (u).Then the letter mentioned in p k i has to occur in the interval I i−1 (u) of u, but the interval I |Σ| (u) of u cannot contain any of the |Σ| distinct letters.Therefore r k |Σ|+1 / ∈ I |Σ| and we have a contradiction.Otherwise there is an i ∈ [1, m] such that r k i (u) / ∈ I i−1 (u).We will construct a ranker r ′ that is shorter than r, does not have more alternations than r and occurs at exactly the same position as r in both u and v.The main idea for this construction is that if r k i (u) / ∈ I i−1 (u), then it is not useful to enter this interval at all.By our assumption, u and v disagree on some property of the ranker r, and thus on some property of the shorter ranker r ′ .This contradicts our assumption that r was the shortest such ranker.Now we show how to construct a shorter ranker r ′ that occurs at the same position as r.We assume without loss of generality that p k i points to the left.In this case we have . We look at the relative positions of the rankers r k i−1 +1 , . . ., r k i with respect to the ranker r k i−1 −1 .We know that r k i (u) ≤ r k i−1 −1 (u), and we are interested in the right-most of the rankers r k i−1 +1 , . . ., r k i that is still outside of the interval I i−1 (u).Let r j be this ranker.Thus we have We know that u ≡ 2 |Σ|+1,n v, thus by Theorem 4.5, these rankers occur in exactly the same order in v. Now we set s := (r k i−1 −1 , p j , . . ., p k i ).Because u and v agree on the ordering of the relevant rankers, we have s(u) = r k i (u) and s(v) = r k i (v).Therefore we have reduced the size of a prefix of r without increasing the number of alternations, and thus have a shorter ranker r ′ that occurs at the same position as r in both structures.
In order to prove that the alternation hierarchy for FO 2 is strict, we define example languages that can be separated by a formula of a given alternation depth m, but that cannot be separated by any formula of lower alternation depth.As Theorem 4.7 shows, we need to increase the size of the alphabet with increasing alternation depth.We inductively define the example words u m,n and v m,n and the example languages K m and L m over finite alphabets Σ m = {a 0 , . . ., a m−1 }.Here i, m and n are positive integers.Proof.For m = 1, we can easily separate K 1 = {a 0 } and L 1 = {ε} with the formula ∃x(x = x).For all larger m, we show that the two languages K m and L m differ on the ordering of two (m − 1)-alternation rankers.Then by Theorem 4.5 there is an FO 2 m,m [<] formula that separates K m and L m .We inductively define the rankers ).For m > 2, these rankers disagree on their order as well.To prove this, we prove the following two equalities.
r 2i+2 (u 2i+2,n ) = r 2i+1 (u 2i+1,n ) = (2i + 1)n + r 2i (u 2i,n ) To prove this, we first use the definitions above and write The letter a 2i+1 does not occur in the word u 2i+1,n , and thus ⊲ a 2i+1 (u 2i+2,n ) points to the first position in u 2i+2,n right after the copy of u 2i+1,n .We observe that r 2i+1 starts with ⊳, and that r 2i+1 is defined on u 2i+1,n .Thus the evaluation of the remainder of r 2i+2 on u 2i+2,n never leaves the copy of u 2i+1,n , and we have For the second part of the equality, we have As above, the letter a 2i does not occur in the word u 2i,n , and thus ⊳ a 2i (u 2i+1,n ) points to the position in u 2i+1,n right before the copy of u 2i,n .The ranker r 2i starts with ⊲, and r 2i is defined on u 2i,n .Thus, just as above, the evaluation of the remainder of r 2i+1 on u 2i+1,n never leaves the copy of u 2i,n , and we have Exactly the same holds for the other rankers (s 2 , . ..) and words (v 2,n , . ..).We have Now an easy inductive argument, based on the two equalities we just proved, shows that the rankers disagree on their order.Therefore condition (i)(b) of Theorem 4.5 fails for any pair of words, and there is a formula in FO For m ≥ 2 and any n ≥ m, we claim that exactly the same (m − 1, n)-rankers are defined over u m,n and v m,n , and that all (m − 1, n)-rankers appear in the same order with respect to all (m − 2, n − 1)-rankers and all (m − 1, n − 1)-rankers that end on a different direction.Once we established this claim, the lemma follows immediately from Theorem 4.5.We already observed that u m,n and v m,n are almost identical.The only difference between the two words is that u m,n contains the letter a 0 in the middle whereas v m,n does not.Thus we only have to consider rankers that are affected by this middle a 0 .
We claim that any ranker that points to the middle a 0 of u m,n requires at least m − 1 alternations.Furthermore, we claim that any such ranker needs to start with ⊲ for even m and with ⊳ for odd m.We prove this by induction on m.
For m = 2 we have u 2,n = a 0 (a 1 a 0 ) n .Any n-ranker that starts with ⊳ cannot reach the first a 0 , thus we need a ranker that starts with ⊲.
For odd m > 2 we have u m,n = (a 0 . . .a m−1 ) n u m−1,n .Any n-ranker that starts with ⊲ cannot leave the first block of n • m symbols of this word and thus not reach the middle a 0 .Therefore we need to start with ⊳, and in fact use ⊳ a m−1 at some point, because we would not be able to leave the last section of u m−1,n otherwise.But with ⊳ a m−1 we move past all of u m−1,n , and we need one alternation to turn around again.By induction, we need at least m − 2 alternations within u m−1,n , and thus m − 1 alternations total.
The argument for even m is completely symmetric.Thus we showed that we need at least m − 1 alternation blocks to point to the middle a 0 .Furthermore, we showed that if we have exactly m − 1 alternation blocks, then the last of these blocks uses ⊲.Therefore we only need to consider (m − 1)-alternation rankers that end on ⊲ and pass through the middle a 0 .It is easy to see that all of these rankers agree on their ordering with respect to all other (m − 2)-alternation rankers, and with respect to all (m − 1)-alternation rankers that end on ⊳.
To summarize, we showed that u m,n and v m,n satisfy condition (i) from Proof.The theorem immediately follows from Lemma 4.9 and Lemma 4.10.exactly 2n letters.Since no n-ranker can point to a position within any segment after the first n letters and before the last n letters of that segment, we have w ′ |= ϕ.Now we partition the word w ′ such that w ′ = u 1 s 1 u 2 . . .u r s r u r+1 , where r ∈ N and for every 1 ≤ i ≤ r, u i is a string of maximal length that uses exactly k different letters, s i is a segment, and u r+1 is a string over at most a k-letter alphabet.We observe that this partition is unique: If a is the last of the (k + 1) letters in our alphabet to appear in w ′ , starting from the left, then s 1 is the left-most segment of a's, and u 1 is everything up to that segment.Now s 2 is the left-most segment after s 1 of the letter that appears last after s 1 , and so on.We can point to a position in segment s n with an n-ranker, but no n-ranker that starts with ⊲ can point to a position to the right of s n .Similarly, we partition w ′ , now starting from the right, such that w ′ = v q+1 t q v q . . .v 2 t 1 v 1 , where q ∈ N and for every 1 ≤ i ≤ q, v i is a string of maximal length that uses exactly k different letters, t i is a segment, and v q+1 is a string over at most a k-letter alphabet.Again, this partition is unique and any n-ranker that starts with ⊳ cannot point to a position to the left of t n .We also notice that both partitions have the same number of segments, i.e. r = q, since any substring u i s i from the first partition contains all letters of the alphabet and thus has to contain at least one segment t j from the second partition, and vice versa.
If both partitions use more than 2n segments, then the segment s n of the first partition occurs to the left of the segment t n of the second partition.In this case we construct the word w ′′ = u 1 s 1 u 2 . . .u n s n t n v n . . .v 2 t 1 v 1 .w ′′ agrees with w ′ on all n-rankers, and thus w ′′ |= ϕ.Every one of the strings u 1 , . . ., u n and v 1 , . . .v n uses at most k different letters, therefore we can apply the inductive hypothesis and replace each of these strings with an equivalent string of length O(n k ), as explained in Lemma 6.1.Thus we have constructed a word of length O(n k+1 ) that satisfies ϕ.
If the partitions have at most 2n segments, then we combine the two partitions such that w ′ = w 1 x 1 . . .x p w p+1 , where p ≤ 4n, and for every 1 ≤ i ≤ p, x p is one of the original segments s 1 , . . ., s r and t 1 , . . ., t q .As above, we use the inductive hypothesis to replace all strings x i with equivalent strings of length O(n k ), and thus construct a new string of length O(n k+1 ) that satisfies ϕ.Theorem 6.3.Satisfiability for FO 2 [<] where the size of the alphabet is bounded by some fixed k ≥ 2 is NP-complete.
Proof.Membership in NP follows immediately from Theorem 6.2 -we nondeterministically guess a model of size O(n k ) where n is the quantifier depth of the given formula, and verify that it is a model of the formula.Now we give a reduction from SAT.Let α be a boolean formula in conjunctive normal form over the variables X 1 , . . ., X n .We construct a FO 2 [<] formula ϕ = ϕ n ∧ α[ξ i /X i ], where ϕ n says that every model has size exactly n, and where we replace every occurrence of X i in α with a formula ξ i of length O(n) which says that the i-th letter is a 1.The total length of ϕ is O(|α| • n), and ϕ is satisfiable iff α is satisfiable.

Conclusion
We proved precise structure theorems for FO 2 , with and without the successor predicate, that completely characterize the expressive power of the respective logics, including exact bounds on the quantifier depth and on the alternation depth.Using our structure theorems, we showed that the quantifier alternation hierarchy for FO 2 is strict, settling an open question from [3,4].Both our structure theorems and the alternation hierarchy results add further insight to and simplify previous characterizations of FO 2 .We hope that the insights gained in our study of FO 2 on words will be useful in future investigations of the trade-off between formula size and number of variables.

Definition 3 . 1 .
A boundary position denotes the first or last occurrence of a letter in a given word.Boundary positions are of the form d a where d ∈ {⊲, ⊳} and a ∈ Σ.The interpretation of a boundary position d a on a word w = w 1 . . .w |w| ∈ Σ ⋆ is defined as follows.

Figure 2 :
Figure 2: The case r(u) < r n−1 (u) by giving a winning strategy for Samson in the FO 2 n+1 game on the two structures.If (i)(c) does not hold, then Samson wins immediately.If (i)(d) does not hold for n + 1, then Samson wins by Lemma 3.5.If (i)(a) or (i)(b) do not hold for n + 1, then one of the following three cases applies.

Figure 4 :Figure 5 :
Figure 4: Two n-rankers appear in different order and r ′ ends with ⊲.For r ′ n−1 (u) < r ′ (u), the situation is illustrated in Fig.4.In his second move, Samson places y on r ′ (v).Delilah has to reply with a position to the left of x u , but she cannot choose any position from the interval (r ′ n−1 (u), r ′ (u)) because it does not contain the letter v y v .So she has to reply with a position left of or equal to r ′ n−1 (u), and Samson wins the remaining FO 2 n−1 game as shown in Lemma 3.5.

Figure 6 :
Figure 6: A letter a occurs between n-rankers r, r ′ in u but not in v

Figure 7 :
Figure 7: x and y are in the same section

Definition 4 . 1
(m-alternation n-ranker).Let m, n ∈ N with m ≤ n.An m-alternation n-ranker, or (m, n)-ranker, is an n-ranker with exactly m blocks of boundary positions that alternate between ⊲ and ⊳.We use the following notation for alternation rankers.R m,n (w) := {r | r is an m-alternation n-ranker and defined over the word w} R m⊲,n (w) := {r ∈ R m,n (w) | r ends with ⊲} R ⋆ m,n (w) := i∈[1,m],j∈[1,n] of Lemma 3.5.Samson places y on r(u), and creates a situation where y u > r n−1 (u) and y v ≤ r n−1 (v).If r n−1 ends with ⊳, then by induction Samson wins the remaining FO 2 m−1,n−1 game and thus he has a winning strategy for the FO 2 m,n game.If r n−1 ends with ⊲, then by induction Samson wins the remaining FO 2 m,n−1 game starting with a move on u, and thus he has a winning strategy for the FO 2 m,n game.Lemma 4.3.Let m and n be positive integers with m ≤ n and let r ∈ R m,n .There is a ϕ r ∈ FO 2 m,n [<] such that for all w ∈ Σ ⋆ , w |= ϕ r ⇐⇒ r ∈ R m,n (w).Proof.Using Lemma 2.3 it suffices to consider arbitrary u, v ∈ Σ ⋆ with r ∈ R m,n (u) and r /

2 ,
Samson wins the remaining FO 2 m,n−1 game starting with a move on u.Otherwise r i−1 ends with ⊲, and thus by Lemma 4.2 Samson wins the remaining FO 2 m−1,n−1 game starting with a move on v. Lemma 4.4.Let m and n be positive integers with m ≤ n and let r ∈ R m,n .There is a formula ψ r ∈ FO 2 m,n [<] such that for all w ∈ Σ ⋆ and for all i ∈ [1, |w|], (w, i) |= ψ r ⇐⇒ i = r(w).Proof.As in the proof of Lemma 4.3, it suffices to show that Samson wins the game FO 2 m,n (u, v) where initially x u = r(u) and x v = r(v).Depending on whether r is defined over v, we use the strategies from Lemma 4.2 or Lemma 4.3.

Theorem 4 . 5 (
structure of FO 2 m,n [<]).Let u and v be finite words, and let m, n ∈ N with m ≤ n.The following two conditions are equivalent.

Figure 8 :
Figure 8: r and r ′ appear in different order • r ends with ⊲.Samson places x on r(u) in his first move.If Delilah replies with a position to the left of r ′ (v) or equal to r ′ (v), then x v < r(v).Thus we can apply Lemma 4.2 to get a winning strategy for Samson in the remaining FO 2 m,n game that starts with a move on u.If Delilah replies with a position to the right of r ′ (v), Samson has a winning strategy for the remaining FO 2 m−1,n game.Thus we have a winning strategy for Samson in the FO 2 m,n+1

Figure 9 :
Figure 9: A letter occurs between rankers r, r ′ in u but not in v
Theorem 4.5 for m − 1 alternations.Thus the two words agree on all formulas from FO 2 m−1,n [<].Theorem 4.11 (alternation hierarchy for FO 2 [<]).For any positive integer m, there is a ϕ m ∈ FO 2 [<]-ALT[m] and there are two languages K m , L m such that ϕ m separates K m and L m , but no ψ ∈ FO 2 [<]-ALT[m − 1] separates K m and L m .
Since in the presence of successor we can encode an arbitrary alphabet in binary, no analog of Theorem 4.7 holds for FO 2 [<, Suc].
Let u, v ∈ Σ ⋆ and let m, n ∈ N with m ≤ n.Delilah has a winning strategy for the game FO 2 2 m,m [<] that separates K m and L m .Lemma 4.10.For m ∈ N, m ≥ 1, and all n ∈ N, we have u m,n ≡ 2 m−1,n v m,n .Proof.Because we do not have constants, there are no quantifier-free sentences.Thus FO 2 0,n [<] does not contain any formulas and the statement holds trivially for m = 1.