0% found this document useful (0 votes)
38 views

Our First NP-Complete Problem: The Cook-Levin Theorem

The document presents the Cook-Levin theorem, which shows that the SAT problem is NP-complete. It does this by describing how any problem in NP can be reduced to SAT. Specifically, it shows how any non-deterministic Turing machine and input can be encoded as a Boolean formula that is satisfiable if and only if the machine accepts the input. This establishes SAT as the first known NP-complete problem.

Uploaded by

Imran
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Our First NP-Complete Problem: The Cook-Levin Theorem

The document presents the Cook-Levin theorem, which shows that the SAT problem is NP-complete. It does this by describing how any problem in NP can be reduced to SAT. Specifically, it shows how any non-deterministic Turing machine and input can be encoded as a Boolean formula that is satisfiable if and only if the machine accepts the input. This establishes SAT as the first known NP-complete problem.

Uploaded by

Imran
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

C

B Our First NP-Complete


A 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.

A satisfiable Boolean formula:


((x
F1  x
T2   x
T3 )   x
F1 )  (x
T3  x
T2 )

An unsatisfiable Boolean formula:


x1  x1

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)}

Q: what does this


machine compute?

Complexity 8
The Variables of the Formula
stands for: “Is s the
content of cell (i,j)?”

xi, j, s
symbol (sQ{#})
# ... #
position in the #
tableau (1i,jnk) .
.
.

# #

Complexity 9
The Formula 
M,w = cell
M,w =  start
cell  move
start move accept
accept

cell content machine accepts


consistency

input consistency transition legal

Complexity 10
Ensuring Unique Cell Content

   
φcell     xi, j,s     (xi, j,s  xi, j,t ) 
1i, jn k  sC   s  tC 

The (i,j) cell It shouldn’t contain


must contain different symbols.
some symbol

Note: the length of this formula is polynomial in n.

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  
1i, jn k
xi, j,qaccept

Complexity 13
Ensuring Every Transition is
Legal
Local: only need
to examine
23 “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   
 xi1, j,a1  ...  xi1, j1, a6
a1 ,..., a6

1i , j  n k

for any a1,...,a6


s.t. this is a
legal window
a1 a2 a3
a4 a5 a6

Complexity 16
The Bottom Line
M,w = cell
M,w =  start
cell  move
start move accept
accept

, which is of size polynomial in n - Check! - is


satisfiable iff the TM accepts the input string.

Complexity 17
Conclusion: SAT is NP-
Complete
For any language A in NP,

can be reduced to...


testing satisfiability
membership in A problem

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.

any NP can be reduced to...


problem

SAT can be reduced to...


We’ve already
shown this
new NP
problem
will imply the new
20
Complexity
problem is in NPC
... and Beyond!
Moreover, every NP-Complete problem we
discover, provides us with a new way for
showing problems to be NP-Complete.

any NP can be reduced to...


problem
Known
NP-hard can be reduced to...
problem
new NP
problem
Complexity 21
Summary
• We’ve proved SAT is NP-Complete.
• We’ve also described a general
method for showing other problems
are NP-Complete too.


Complexity 22

You might also like