Notes
Outline
Finite Model Theory
Lecture 5
Turing Machines and Finite Models
Outline
Trakhtenbrot’s theorem (Chapter 9.1)
Fagin’s theorem (Chapter 9.2)
Trachtenbrot’s Theorem
Definition. f is finitely satisfiable if there exists a finite model A s.t. A ² f
Theorem [Trakhtenbrot] Suppose s has at least one relation symbol of arity ¸ 2.  Then it is undecidable whether a sentence f is finitely satisfiable.
Consequence 1
Corollary.  There is no recursive function f such that if f has a finite model then it has a finite model of size at most f(|f|).
Consequence 2
Definition. A sentence f is finitely valid, ²fin f, if for all finite models A, A ² f
Question: is there a complete proof system `, i.e.  such that ` f iff ²fin f ?
Answer: NO !  [why ?]
Proof of Trakhtenbrot’s Theorem
By reduction from the halting problem: given a Turing machine M, does it halt on the empty tape ?
Given M, construct fM s.t. M halts iff fM has a finite model
Proof of Trakhtenbrot’s Theorem
Proof of Trakhtenbrot’s Theorem
Details:
M = (Q, D, d, q0, Qa)
 states Q,
 initial state q0 2 Q,
 accepting states Qa µ Q
 D = {0, 1} = tape alphabet
 d = transitions
What is a computation C of M ?
Proof of Trakhtenbrot’s Theorem
The formula fM will say the following:
< is a linear order
T0(p, t) = the tape holds 0 at position p and time t
T1(p, t) = similar
Hq(p, t) = the machine is in state q at time t, and the head is over position p of the tape
[write fM in class]
Fagin’s Theorem
Recall Second Order Logic, SO:
May have formulas of the form 9 R.f or 8 R. f, where R is a relation symbol
Every SO formula can be written in prenex form like this:


where each Qi is either 9 or 8, and f is in FO
[WHY ???]
Fagin’s Theorem
Define 9 SO to be formulas of the form:
Define 8 SO to be formulas of the form:
Examples
Let s = {R}, i.e. a single binary relation.  Finite models are graphs.
Express the following in SO
The graph is connected
[what 2nd order quantifiers did we need ?]
The graph is 3-colorable
The graph has a Hamiltonean path
Examples
3-colorability:


f    = 8 x.(A(x) Ç B(x) Ç C(x))

yA = 8 x.8 y.(R(x,y) ) : (A(x) Æ A(y)))
yB = 8 x.8 y.(R(x,y) ) : (B(x) Æ B(y)))
yC = 8 x.8 y.(R(x,y) ) : (C(x) Æ C(y)))
Examples
Hamiltonean path:

f = says that  < is a total linear order
y = says that if x<y are consecutive, then R(x,y)
Little dirty secret of SO (actually 9 SO): we don’t need order, because we can express it !
Fagin’s Theorem
Theorem [Fagin] 9SO captures precisely NP
More precisely:
For every f 2 9SO, the problem of checking whether A ² f is in NP
For any property of models, P, s.t. checking A 2 P is in NP, there exists a formula f 2 9SO s.t. A ² f iff A 2 P
Fagin’s Theorem
Need encodings of finite structures:
Let A = (A, R1A, …, RpA)
where A = {a1, …, an}
Fix an order a1 < a2 < … < an


where each enc(RiA) is a string of length nk in {0,1}* [what meaning ? See book pp. 88]
Proof
 9SO µ NP is obvious [why ?]
NP µ 9SO requires us to model a Turing Machine M running in NP with a formula fM: like in Trakhtenbrot’s theorem, with some additional complications
Discussion
This is a characterization that does not mention computational resources !
Later, other complexity classes were captured by logics, but for all lower classes Logic need help from order.
Descriptive complexity
Fagin’s Theorem and P¹ NP
We have NP = 9 SO,  coNP = 8 SO
If we prove 9 SO ¹ 8 SO then P ¹ NP
Definition.  MSO = Monadic SO
(restrict quantifiers to unary relations)
Definition.  Monadic NP = 9MSO;
Monadic coNP = 8MSO
[give examples of NP-complete problems in monadic NP]
Fagin’s Theorem and P¹ NP
Theorem Monadic NP ¹ Monadic coNP
Proof.
Step 1: Graph connectivity is in 8 MSO
Step 2: Graph connectivity is not in 9 MSO