SLIDE 1 First-order theories
Gabriele Puppis
LaBRI / CNRS
SLIDE 2
Definition
Fix a class C of structures (e.g. graphs) and a logic L (e.g. FO). The L L L-theory of C C C is the set of all formulas in L that can be satisfied by some structure in C . The theory is decidable if there is an algorithm that receives formulas as input and tells whether they are in the theory or not.
SLIDE 3
Definition
Fix a class C of structures (e.g. graphs) and a logic L (e.g. FO). The L L L-theory of C C C is the set of all formulas in L that can be satisfied by some structure in C . The theory is decidable if there is an algorithm that receives formulas as input and tells whether they are in the theory or not.
Examples
first-order theory of the class of all graphs monadic theory of the class of all linear orders monadic theory of N monadic theory of the grid
SLIDE 4
Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid.
SLIDE 5 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ qhalt qhalt qhalt
SLIDE 6 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
1
encode initial configuration by top row
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ q0 q0 q0 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ qhalt qhalt qhalt
SLIDE 7 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
1
encode initial configuration by top row
2
encode next configurations by next rows
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ q0 q0 q0 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a q1 q1 q1 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a b b b q2 q2 q2 ⊔ ⊔ ⊔ a a a q3 q3 q3 b b b ⊔ ⊔ ⊔ qhalt qhalt qhalt
SLIDE 8 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
1
encode initial configuration by top row
2
encode next configurations by next rows
3
find a row with halting configuration
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ q0 q0 q0 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a q1 q1 q1 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a b b b q2 q2 q2 ⊔ ⊔ ⊔ a a a q3 q3 q3 b b b ⊔ ⊔ ⊔ qhalt qhalt qhalt
SLIDE 9 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. (and equally for MSO[E1, E2] MSO[E1, E2] MSO[E1, E2] over the grid N × N N × N N × N) Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
1
encode initial configuration by top row
2
encode next configurations by next rows
3
find a row with halting configuration MSO can even guess the labelling!
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ q0 q0 q0 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a q1 q1 q1 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a b b b q2 q2 q2 ⊔ ⊔ ⊔ a a a q3 q3 q3 b b b ⊔ ⊔ ⊔ qhalt qhalt qhalt
SLIDE 10 Undecidability of first-order theory
One cannot decide whether a given formula of FO[Σ, E1, E2] FO[Σ, E1, E2] FO[Σ, E1, E2] is satisfied over some labelled grid labelled grid labelled grid. (and equally for MSO[E1, E2] MSO[E1, E2] MSO[E1, E2] over the grid N × N N × N N × N) Given a Turing machine M, construct ψM ψM ψM defining its halting runs:
1
encode initial configuration by top row
2
encode next configurations by next rows
3
find a row with halting configuration MSO can even guess the labelling!
⋮ ⋮ ⋮ ⋯ ⋯ ⋯ ⋯ ⋱ q0 q0 q0 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a q1 q1 q1 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ a a a b b b q2 q2 q2 ⊔ ⊔ ⊔ a a a q3 q3 q3 b b b ⊔ ⊔ ⊔ qhalt qhalt qhalt
SLIDE 11
Consequences (Church ’36, Turing ’37, Trakhtenbrot ’50, ...)
The FO theory of the class of all finite structures is undecidable (provided that signature contains a binary predicate besides =).
SLIDE 12 Consequences (Church ’36, Turing ’37, Trakhtenbrot ’50, ...)
The FO theory of the class of all finite structures is undecidable (provided that signature contains a binary predicate besides =). The MSO theory of any class of graphs with unbounded grids as minors unbounded grids as minors unbounded grids as minors is undecidable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
n 4n+20
SLIDE 13 Consequences (Church ’36, Turing ’37, Trakhtenbrot ’50, ...)
The FO theory of the class of all finite structures is undecidable (provided that signature contains a binary predicate besides =). The MSO theory of any class of graphs with unbounded grids as minors unbounded grids as minors unbounded grids as minors is undecidable. The MSO theory of (N, +) (N, +) (N, +) is undecidable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
n n+1 n+2 n+3 n+4 2n 2n+2 2n+4 2n+6 2n+8 3n 3n+3 3n+6 3n+9 3n+12 4n 4n+4 4n+8 4n+16 4n+20
SLIDE 14
Definition
Presburger arithmetic is the first-order theory of (N, +) (N, +) (N, +)
Examples of Presburger formulas
ψ0 = ∃x. ∀y. (x + y = y) ϕ≤(x, y) = ∃z. (y = x + z) ϕ2×(x, y) = (x + x = y) ψω = ∀x. ∃y. (x ≤ y ∧ ¬x = y)
SLIDE 15
Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). Originally proved by quantifier elimination. Here we use automata!
SLIDE 16 Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). Originally proved by quantifier elimination. Here we use automata!
1
Encode numbers x ∈ N by reverse binary expansions [x] ∈ B⋆ [x] ∈ B⋆ [x] ∈ B⋆ e.g. [4] = 001, [0] = ε, . . .
SLIDE 17 Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). Originally proved by quantifier elimination. Here we use automata!
1
Encode numbers x ∈ N by reverse binary expansions [x] ∈ B⋆ [x] ∈ B⋆ [x] ∈ B⋆ e.g. [4] = 001, [0] = ε, . . .
2
Encode sum relation + ⊆ N × N × N by language L+ ⊆ (B × B × B)⋆ L+ ⊆ (B × B × B)⋆ L+ ⊆ (B × B × B)⋆ e.g. [ + (3, 1, 4)] = [3] ⊗ [1] ⊗ [4] = (
1 1 0 ) ( 1 0 ) ( 1 )
SLIDE 18 Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). Originally proved by quantifier elimination. Here we use automata!
1
Encode numbers x ∈ N by reverse binary expansions [x] ∈ B⋆ [x] ∈ B⋆ [x] ∈ B⋆ e.g. [4] = 001, [0] = ε, . . .
2
Encode sum relation + ⊆ N × N × N by language L+ ⊆ (B × B × B)⋆ L+ ⊆ (B × B × B)⋆ L+ ⊆ (B × B × B)⋆ e.g. [ + (3, 1, 4)] = [3] ⊗ [1] ⊗ [4] = (
1 1 0 ) ( 1 0 ) ( 1 )
A+ ∶
p q
(
0 ) , ( 1 1 ) , ( 1 1 )
(
1 0 ) , ( 1 0 ) , ( 1 1 1 )
(
1 1 0 )
(
1 )
SLIDE 19
Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). We inductively translate every Presburger formula ϕ(x1, ..., xm) into a finite automaton Aϕ over Σm = Bm such that L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
so as to reduce satisfiability of ϕ to emptiness of L(Aϕ).
SLIDE 20
Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). We inductively translate every Presburger formula ϕ(x1, ..., xm) into a finite automaton Aϕ over Σm = Bm such that L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
so as to reduce satisfiability of ϕ to emptiness of L(Aϕ). For atomic formulas x = y and +(x, y, z), use automata A= and A+
SLIDE 21
Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). We inductively translate every Presburger formula ϕ(x1, ..., xm) into a finite automaton Aϕ over Σm = Bm such that L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
so as to reduce satisfiability of ϕ to emptiness of L(Aϕ). For atomic formulas x = y and +(x, y, z), use automata A= and A+ For disjunction ϕ1(¯ x) ∨ ϕ2(¯ x), compute union of Aϕ1 and Aϕ2
SLIDE 22
Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). We inductively translate every Presburger formula ϕ(x1, ..., xm) into a finite automaton Aϕ over Σm = Bm such that L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
so as to reduce satisfiability of ϕ to emptiness of L(Aϕ). For atomic formulas x = y and +(x, y, z), use automata A= and A+ For disjunction ϕ1(¯ x) ∨ ϕ2(¯ x), compute union of Aϕ1 and Aϕ2 For negation ¬ϕ(¯ x), compute the complement of Aϕ
SLIDE 23 Decidability of Presburger arithmetic (Presburger ’29)
One can decide if a Presburger sentence ψ holds over (N, +). We inductively translate every Presburger formula ϕ(x1, ..., xm) into a finite automaton Aϕ over Σm = Bm such that L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
L (Aϕ) = { [x1] ⊗ ⋅ ⋅ ⋅ ⊗ [xm] ∈ Σ⋆
m ∣ (N, +) ⊧ ϕ(x1, ..., xm) }
so as to reduce satisfiability of ϕ to emptiness of L(Aϕ). For atomic formulas x = y and +(x, y, z), use automata A= and A+ For disjunction ϕ1(¯ x) ∨ ϕ2(¯ x), compute union of Aϕ1 and Aϕ2 For negation ¬ϕ(¯ x), compute the complement of Aϕ For existential quantification ∃y. ϕ(¯ x, y), project Aϕ from Σm+1 to Σm
(
1 1 1
×
) (
1 1 1 1 1 1
×
)
SLIDE 24
Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
SLIDE 25 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
p q ( 1
1 1 0 )
( 0
1 1 1 )
( 0
0 ), ( 1 1 1 1 1 1 )
SLIDE 26 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
2
Project away the encoding of y y y, thus capturing ∃y. (y = x + 1) ∃y. (y = x + 1) ∃y. (y = x + 1) p q ( 1
1 1
×
) ( 0
1 1 1
×
) ( 0
×
), ( 1
1 1 1 1 1
×
)
SLIDE 27 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
2
Project away the encoding of y y y, thus capturing ∃y. (y = x + 1) ∃y. (y = x + 1) ∃y. (y = x + 1)
3
Complement the det. automaton, thus capturing ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1) p q ( 1
1 1
×
) ( 0
1 1 1
×
) ( 0
×
), ( 1
1 1 1 1 1
×
)
SLIDE 28 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
2
Project away the encoding of y y y, thus capturing ∃y. (y = x + 1) ∃y. (y = x + 1) ∃y. (y = x + 1)
3
Complement the det. automaton, thus capturing ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1)
4
Project away the encoding of x x x, thus getting ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) p q ( 1
1 1
× ×
) ( 0
×
1 1 1
×
) ( 0
× ×
), ( 1
1 1
×
1 1 1
×
)
SLIDE 29 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
2
Project away the encoding of y y y, thus capturing ∃y. (y = x + 1) ∃y. (y = x + 1) ∃y. (y = x + 1)
3
Complement the det. automaton, thus capturing ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1)
4
Project away the encoding of x x x, thus getting ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) p q ( 1
1 1
× ×
) ( 0
×
1 1 1
×
) ( 0
× ×
), ( 1
1 1
×
1 1 1
×
) What’s wrong??
SLIDE 30 Example of translation
Consider the (unsatisfiable) formula ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1) ψ = ∃x. ¬ ∃y. (y = x + 1)
1
Start from automaton Ay=x+1
y=x+1 y=x+1
2
Project away the encoding of y y y, thus capturing ∃y. (y = x + 1) ∃y. (y = x + 1) ∃y. (y = x + 1)
3
Complement the det. automaton, thus capturing ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1) ¬ ∃y. (y = x + 1)
4
Project away the encoding of x x x, thus getting ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) ∃x. ¬ ∃y. (y = x + 1) p q ( 1
1 1
× ×
) ( 0
×
1 1 1
×
) ( 0
× ×
), ( 1
1 1
×
1 1 1
×
) What’s wrong?? Languages of encodings should be closed under padding with 0’s After complement, keep only final states that are stable under 0.
SLIDE 31
The previous result can be generalized to many other structures:
Definition
An automatic structure is a structure that is isomorphic to ( L, R1, . . . , Rn ) where L is a regular language of words over Σ (each word identifies a precise element of the structure) each relation Ri has arity ki and is represented by a regular language Li over (Σ ⊎ {#})
ki
(e.g. (ab, abb) ∈ Ri iff ( a
a )( b b )( # b ) ∈ Li )
SLIDE 32
The previous result can be generalized to many other structures:
Definition
An automatic structure is a structure that is isomorphic to ( L, R1, . . . , Rn ) where L is a regular language of words over Σ (each word identifies a precise element of the structure) each relation Ri has arity ki and is represented by a regular language Li over (Σ ⊎ {#})
ki
(e.g. (ab, abb) ∈ Ri iff ( a
a )( b b )( # b ) ∈ Li )
Examples of automatic structures
(N, +, ∣p) (N, +, ∣p) (N, +, ∣p), with x ∣p y iff x = pn divides y Binary tree with successor, ancestor, and equi-level predicates Unlabelled grid (N × N, →, ↓) (N × N, →, ↓) (N × N, →, ↓)
SLIDE 33
Theorem (B¨ uchi ’60, Hodgson ’76, Khoussainov & Nerode ’94)
Every automatic structure has a decidable first-order theory.
SLIDE 34
Theorem (B¨ uchi ’60, Hodgson ’76, Khoussainov & Nerode ’94)
Every automatic structure has a decidable first-order theory. On the other hand...
Theorem
Some automatic structures have an undecidable reachability problem. The transition graph transition graph transition graph of a Turing machine is automatic! configurations are encoded by words a1...ai−1 a1...ai−1 a1...ai−1 q q q ai ai+1...an ai ai+1...an ai ai+1...an transitions are of the following forms a1...ai−1 q q q ai ai aiai+1...an a1...ai−1q q q ai ai aiai+1...an a1...ai−1ai ai ai q q q ai+1...an ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ a1...ai−1q′ q′ q′a′
i
a′
i
a′
iai+1...an
a1...ai−1a′
i
a′
i
a′
iq′
q′ q′ai+1...an a1...ai−1q′ q′ q′a′
i
a′
i
a′
iai+1...an