Lecture 2a: First-Order Logic Over Words
Lecture 2a: First-Order Logic Over Words
Here is a formula describing the language of words over {a, b, c} that contain ab as a
subword:
However, if the alphabet is {a, b} then this can expressed for the following simpler formula:
The first formula uses 3 variables (x, y and z) while the second one uses only 2 and one of
things that we hope to prove in this course is that if the alphabet has at least 3 letters then
the above language cannot be expressed with FO(<) formulas that use at most 2 variables.
1
a1 a2 . . . an , σ |= a(x) if aσ(x) = a
a1 a2 . . . an , σ |= x<y if σ(x) < σ(y)
a1 a2 . . . an σ |= φ ∧ φ0 if (a1 a2 . . . an , σ |= φ) and (a1 a2 . . . an , σ |= φ0 )
a1 a2 . . . an , σ |= ¬φ if (a1 a2 . . . an , σ 6|= φ)
a1 a2 . . . an , σ |= ∃x.φ if there is an i ∈ {1, 2, 3, . . . n} such a1 a2 . . . an , σ[x : i] |= φ
where σ[v : y](u) = σ(u) if u 6= v and σ[v : y](v) = y. Thus with this notation,
and
bacabc, [x 7→ 5, y 7→ 5] 6|= (x < y) ∧ a(x) ∧ b(y)
From the definition above, it is clear that if w is a word, ϕ is a formula and σ and σ 0 are
valuations such that for all variables x that occur as free variables in ϕ we have σ(x) = σ 0 (x)
then w, σ |= ϕ iff w, σ 0 |= ϕ. In particular, if the formula is a sentence, then the valuation
is irrelevant and we may instead write w |= ϕ. The language defined by a sentence ϕ is the
set {w | w |= ϕ}.
Lemma 1 Let ϕ be any formula in FO1 (<) and let u and v be words with u ≡α v. Then, if
i and j are any two positions in u and v respectively, such that ui = vj , then u, [x 7→ i] |= ϕ
if and only if v, [x 7→ j] |= ϕ.
2
Case 2: ϕ = ¬ψ
u, [x 7→ i] |= ¬ψ iff u, [x 7→ i] 6|= ψ iff v, [x 7→ j] 6|= ψ iff v, [x 7→ j] |= ¬ψ
Case 3: ϕ = ϕ1 ∨ ϕ2
u, [x 7→ i] |= ϕ1 ∨ ϕ2 iff u, [x 7→ i] |= ϕ1 or u, [x 7→ i] |= ϕ2 and by induction hypothesis,
u, [x 7→ i] |= ϕk iff v, [x 7→ j] |= ϕk for k ∈ 1, 2. The result follows.
Case 4: ϕ = ∃x. ψ
If u, [x 7→ i] |= ∃x. ψ then there is a position i0 in u such that u, [x 7→ i0 ] |= ψ. Further
since u ≡α v, there is a position j 0 in v such that ui0 = vj 0 . Then, by induction hypothesis,
v, [x 7→ j 0 ] |= ψ. Therefore, v, [x 7→ j] |= ∃x. ψ. The converse is proved symmetrically and
this completes the proof of this lemma.
As a consequence of the above lemma we have that if u ≡α v and ϕ is any formula in
FO1 (<) then u |= ϕ iff v |= ϕ.
But any equivalence class of ≡a lpha is a boolean combination of languages of the form
A∗ (see Lecture 02a). Thus we have the following theorem:
Theorem 2 Let Σ be any alphabet. For any language L over Σ the following are equivalent:
The equivalence of the first two is proved above and the equivalence of the last two can
be found in Lecture 02a. As a consequence of these equivalences, checking if a given regular
language is definable in FO1 (<), reduces to computing its syntactic monoid and checking
that it is commutative and idempotent.
References
[1] V. Diekart, P. Gastin and M. Kufleitner: A Survey on Small Fragments of First-Order
Logic over Finite Words, Int. J. Found. Comput. Sci., Vol 19, 2008.