Our First NP-Complete Problem: The Cook-Levin Theorem
Our First NP-Complete Problem: The Cook-Levin Theorem
Complexity 1
Introduction
• Objectives:
– To present the first NP-Complete
problem
• Overview:
– SAT - definition and examples
– The Cook-Levin theorem
– What next?
Complexity 2
SAT
• Instance: A Boolean formula.
• Problem: To decide if the formula is satisfiable.
Complexity 3
To Which Time Complexity Class
Does SAT Clearly Belong?
SAT
NP Co-NP
P
Complexity 4
SAT is in NP:
Non-Deterministic Algorithm
• Guess an assignment to the variables.
• Check the assignment.
((x
F1 x
T2 x
T3 ) x
F1 ) (x
T3 x
T2 )
x1 F
x2 T
x3 T
Complexity 5
SIP 254-259
The Cook-Levin Theorem:
SAT is NP-Complete
Proof Idea: For any NP machine M and any input
string w, we construct a Boolean formula M,w
which is satisfiable iff M accepts w.
... # 1 1 # 1 ...
M ,w
Complexity 6
Representing a Computation
by a Configurations Table
nk
# q0 w1 ... wn _ #
upper bound on the content of the (relevant #
part of the) tape
the running time and the position of the head
.
nk . indicates tape bounds
.
# #
Complexity 7
Tableau: Example
•• TM:
TM: •• tableau
tableau (input
(input 11)
11)
–– Q={q
Q={q00,q,qaccept ,q reject}}
accept,qreject
={1}
={1}
={1,_}
={1,_}
(q00,1)={(q
(q ,1)={(q00,_,R)}
,_,R)}
(q00,_)={(q
(q ,_)={(qaccept ,L)}
accept,L)}
Complexity 8
The Variables of the Formula
stands for: “Is s the
content of cell (i,j)?”
xi, j, s
symbol (sQ{#})
# ... #
position in the #
tableau (1i,jnk) .
.
.
# #
Complexity 9
The Formula
M,w = cell
M,w = start
cell move
start move accept
accept
Complexity 10
Ensuring Unique Cell Content
φcell xi, j,s (xi, j,s xi, j,t )
1i, jn k sC s tC
Complexity 11
Ensuring Initial Configuration
Corresponds to Input
Observe: we can explicitly state the desired
configuration in the first step. Assuming
the input string is w1w2...wn,
φstart x1,1,# x1,2,q0 x1,3,w1 ... x1,n 3,_ ... x1,nk 1,_ x1,nk ,#
Complexity 12
Ensuring the Computation
Accepts
The accepting state is visited during
the computation.
φaccept
1i, jn k
xi, j,qaccept
Complexity 13
Ensuring Every Transition is
Legal
Local: only need
to examine
23 “windows”
# ... #
#
.
.
.
# #
Complexity 14
Which Windows are Legal in
the Following Example?
•• TM:
TM:
–– Q={q
Q={q00,q,qaccept ,q reject}}
accept,qreject
={1}
={1}
={1,_}
={1,_}
(q00,1)={(q
(q ,1)={(q00,_,R)}
,_,R)}
(q00,_)={(q
(q ,_)={(qaccept ,L)}
accept,L)}
Complexity 15
Ensuring Every Transition is
Legal
φmove
xi1, j,a1 ... xi1, j1, a6
a1 ,..., a6
1i , j n k
Complexity 16
The Bottom Line
M,w = cell
M,w = start
cell move
start move accept
accept
Complexity 17
Conclusion: SAT is NP-
Complete
For any language A in NP,
Complexity 18
Revisiting the Map
SAT
NPC
NP Co-NP
P
Complexity 19
Looking Forward
From now on, in order to show some NP problem
is NP-Complete, we merely need to reduce
SAT to it.
Complexity 22