Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Proof of Cook-Levin Theorem: Reducing Every NP Problem to SAT, Slides of Theory of Automata

An in-depth explanation of the cook-levin theorem, which states that every problem in the np class can be reduced to the satisfiability problem (sat). The definition of np-complete problems, polynomial-time reductions, and the cook-levin theorem statement. It also provides a proof of the theorem using a reduction from every np problem to sat.

Typology: Slides

2012/2013

Uploaded on 04/29/2013

shamir_69
shamir_69 🇮🇳

5

(4)

66 documents

1 / 33

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
NP-complete problems
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21

Partial preview of the text

Download Proof of Cook-Levin Theorem: Reducing Every NP Problem to SAT and more Slides Theory of Automata in PDF only on Docsity!

NP-complete problems

Polynomial-time reductions

• Language L polynomial-time reduces to L’ if

there exists a polynomial-time computable map R

that takes an instance x of L into instance y of L’

s.t.

x ∈ L if and only if y ∈ L’

L ( IS ) L’ ( CLIQUE )

x ( G , k ) y ( G’ , k’ )

xL yL ’ ( G has IS of size k ) ( G’ has clique of size k’ )

R

NP-hardness

• Language L is NP-hard if every L’ in NP reduces

to L

• Intuitively, NP-hard means “harder than all of NP”

• The Cook-Levin Theorem says

SAT is NP-hard

P

SAT NP

NP-complete

• L is NP-complete if L is NP-hard and L ∈ NP

• Intuitively, NP-complete means “hardest in

NP”

• Recall that SAT ∈ NP, so SAT is NP-complete

If SAT ∈ P, then P = NP

P

SAT NP

Proof of Cook-Levin Theorem

• All we know about L : It has a poly-time NTM M

  • Let’s look at computation tableau of M on input w

M

w q0 w 1 w 2

qacc …

S- th configuration symbol at time T

S

T

Since M is nondeterministic, there may be many possible tableaus

Proof of Cook-Levin Theorem

q0 w 1 w 2

q (^) acc …

S

T

n = length of input w

height of tableau is p ( n ) for some polynomial p

width is at most p ( n )

k possible tableau symbols

x T , S , u =

true, if the ( T , S ) cell of tableau contains u false, if not

u

1 ≤ Sp ( n ) 1 ≤ Tp ( n ) 1 ≤ uk

Proof of Cook-Levin Theorem

• We want to construct (in time poly( n )) a formula f :

x T , S , u =

true, if the ( T , S ) cell of tableau contains u false, if not

1 ≤ Sp ( n ) 1 ≤ Tp ( n ) 1 ≤ uk

f ( x 1, 1, 1 , ..., xp ( n ), p ( n ), k ) =

true, if the x s represent a valid accepting tableau false, if not

Proof of Cook-Levin Theorem

q0 w 1 w 2

q (^) acc …

S

T

u

f = f cell ∧ f 0 ∧ f move ∧ f acc

f cell: (^) “Every cell contains

exactly one symbol”

“The first row is q 0 w 1 w 2 ... w (^) k ☐...☐”

f 0 :

f move : (^) “The moves between rows follow the transitions of M

f acc: (^) “qacc appears somewhere in the last row”

Proof of Cook-Levin Theorem

• Desired meaning

• Implementation:

f 0 : (^) “The first row is q 0 w 1 w 2 ... w (^) k ☐...☐” f acc: “qacc appears somewhere in the last row”

f 0 = x 1, 1, q0 ∧ x 1, 1, w 1 ∧ x 1, 1, w2 ∧ ... ∧ x 1, p ( n ),☐

f acc = x (^) p ( n ), 1, qacc ∨ x (^) p ( n ), 2, qacc ∨ ... ∨ x (^) p ( n ), p ( n ), qacc

Valid and invalid windows

… 6 c3a0t0 … … 0 c6a0p0 … 0

… 6 t 3 t 0 u 0 … … 0 t 6 t 0 u 0 … 0

valid window

invalid window

… 6 t 3 t 0 u 0 … … 0 t 6 t 0 q 3 … 0

valid window

… 6 t 3 q 3 u 0 … … 0 t 6 a 0 q 7 … 0

valid if δ(q 3 , u) = (q 7 , a, R)

… 6 q3t0u0 … … 0 k6t0q0 … 0

invalid window

… 6 c3a0t0 … … 0 b6a0t0 … 0

valid window

Other NP-complete problems

CLIQUE = {(G, k ): G is a graph with a clique of k vertices} IS = {(G, k ): G is a graph with an independent set of k vertices} VC = {(G, k ): G is a graph with a vertex cover of k vertices}

CLIQUE , IS and VC are NP-complete

SAT

NP

CLIQUE IS (^) VC

Proving NP-hardness

• To show L is NP-hard, it is enough to reduce

from some L’ we already know is NP-hard

  • For now we can take L’ = SAT

• To show L is NP-complete,

we also need to argue that

L is in NP

  • This is usually the easy part

roadmap:

SAT

3SAT

IS

CLIQUE VC

NP-hardness of 3SAT

• Theorem

• Proof: We describe a reduction R from SAT

Boolean formula f 3CNF formula f ’

f ’ is satisfiable

R

f is satisfiable

3SAT is NP-hard

Reducing SAT to 3SAT

• Example: f =( x 2 ∨( x 1 ∧ x 2 ))∧( x 1 ∧( x 1 ∨ x 2 ))

We give extra variables to every gate (“wire”)

x 3

x 6 x 7

x 8 x 9

x 4 x 5

x 10 AND

OR NOT

AND

NOT OR

AND

NOT

x 2 x 1 x 2 x 1 x 1 x 2

x 4 x 5 x 7 x 7 = x 4 ∧ x 5 T T T T T T F F T F T F T F F T F T T F F T F T F F T F F F F T

( x 4 ∨ x 5 ∨ x 7 ) ( x 4 ∨ x 5 ∨ x 7 ) ( x 4 ∨ x 5 ∨ x 7 )

( x 4 ∨ x 5 ∨ x 7 )

( x 4 ∨ x 5 ∨ x 7 ) ∧( x 4 ∨ x 5 ∨ x 7 ) ∧( x 4 ∨ x 5 ∨ x 7 ) ∧( x 4 ∨ x 5 ∨ x 7 )