Transcript lecture05

Finite Model Theory
Lecture 5
Turing Machines and Finite Models
1
Outline
• Trakhtenbrot’s theorem (Chapter 9.1)
• Fagin’s theorem (Chapter 9.2)
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.
3
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|).
4
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 ?]
5
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
6
Proof of Trakhtenbrot’s Theorem
M halts:
9 C. (C is a halting computation of M)
fM has a finite model:
9 A. A ² fM
Hence a model A should stand for a computation of M
7
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 ?
8
Proof of Trakhtenbrot’s Theorem
s = {<, T0(¢,¢), T1(¢, ¢), (Hq(¢, ¢))q 2 Q}
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]
A ² fM iff A represents a valid computation of M
9
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:
Q1 R1 … Qm Rm. f
where each Qi is either 9 or 8, and f is in FO
[WHY ???]
10
Fagin’s Theorem
• Define 9 SO to be formulas of the form:
9 R1 … 9 Rm. f
• Define 8 SO to be formulas of the form:
8 R1 … 8 Rm. f
11
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
12
Examples
3-colorability:
9 A.9 B.9 C.(f Æ yA Æ yB Æ yC)
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)))
13
Examples
Hamiltonean path:
9 <. (f Æ y)
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 !
14
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
15
Fagin’s Theorem
Need encodings of finite structures:
Let A = (A, R1A, …, RpA)
where A = {a1, …, an}
Fix an order a1 < a2 < … < an
enc(A) = 0n¢ 1 ¢ enc(R1A) ¢ ¢ ¢ enc(RpA)
where each enc(RiA) is a string of length nk
in {0,1}* [what meaning ? See book pp. 88]
16
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
9 <. 9 T0. 9 T1 9 Hq1 … 9 Hqm. fM
[what are the arities of T0, T1, (Hq)q 2 Q ?
17
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
18
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]
19
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
20