Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
NP-Completeness
• A language B is NP-complete iff • B ∈ NP • ∀ A ∈ NP A ≤P B
This property means B is NP hard
1
3SAT is NP-complete
2
Result Idea:
• B is known to be NP complete • Use it to prove NP-Completeness of C
IF • C is NP-hard
• B is NP-complete and • B ≤P C and
• C ∈ NP THEN
• C is NP-complete3
Result• CLIQUE is NP-hard
• 3SAT is NP-complete and • 3SAT ≤P CLIQUE and
• CLIQUE ∈ NP
THEREFORE
• CLIQUE is NP-complete4
Result• VERTEX-COVER is NP-hard
• 3SAT is NP-complete and • 3SAT ≤P VERTEX-COVER and
• VERTEX-COVER ∈ NP
THEREFORE
• VERTEX-COVER is NP-complete5
Result
IF • B is NP-complete and • B ∈ P
THEN • P = NP
6
SAT ∈ P ⇔ P = NP3SAT ∈ P ⇔ P = NP
CLIQUE ∈ P ⇔ P = NPVERTEX-COVER ∈ P ⇔ P = NP
7
SAT = { Φ | Φ is a satisfiable Boolean formula}
SAT ∈ NP
SAT is NP-complete
Cook-Levin Theorem
In other words • SAT ∈ NP • ∀ A ∈ NP A ≤P SAT
9
To prove • ∀ A ∈ NP A ≤P SAT
define polynomial time computable function f: Σ* →Σ*
∀ w ∈ Σ* w ∈ A ⇔ f(w) ∈ SAT
∀ w ∈ Σ* w ∈ A ⇔ Φ ∈ SAT10
Consider any A ∈ NP ∃ NTM N that decides A in polytime nk For any input w ∈ Σ*
valid tableau of configurations
11
There is exactly one symbol in each cell The first row is the (‘legal’) start configuration Every subsequent row is generated ‘legally’
Properties of a Valid Tableau
12
For any input w ∈ A there is an accepting (valid) tableau of configurations
13
There is exactly one symbol in each cell The first row is the (‘legal’) start configuration Every subsequent row is generated ‘legally’ One of these rows is an accepting configuration
Properties of an Accepting Tableau
14
Given N and w construct a Boolean formula that is satisfiable exactly when N has an accepting tableau on input w
15
Proof Idea
Define Boolean formula with variables xijs for
• 1 ≤ i ≤ nk • 1 ≤ j ≤ nk • s ∈ State Set ∪ Tape Alphabet ∪ Delimiter
Want following semantics: xijs is T iff cell (i, j) contains symbol s
for some valid accepting tableau
16
Constructing the formula
xijs is T iff cell (i, j) contains symbol s x12q_0 is T whereas x12⊔ is F
17
There is exactly one symbol in each cellThe first row is the (‘legal’) start configuration Every subsequent row is generated ‘legally’ One of these rows is an accepting configuration
Properties of an Accepting Tableau
18
represent valid tableau with a Boolean formula with components
•Φcell • exactly one symbol per cell
for any pair (i,j)the cell contains at least one symbol
the cell contains at most one symbol19
There is exactly one symbol in each cell The first row is the (‘legal’) start configurationEvery subsequent row is generated ‘legally’ One of these rows is an accepting configuration
Properties of an Accepting Tableau
20
represent valid tableau with a Boolean formula with components
• Φcell • exactly one symbol per cell
• Φstart • legal starting configuration
21
There is exactly one symbol in each cell The first row is the (‘legal’) start configuration Every subsequent row is generated ‘legally’One of these rows is an accepting configuration
Properties of an Accepting Tableau
22
represent valid tableau with a Boolean formula with components
•Φcell • exactly one symbol per cell
•Φstart • legal starting configuration
•Φmove • legal moves
23
represent valid tableau with a Boolean formula with components
• Φmove • legal moves
# a b q1 b c ⊔ ⊔ ⊔ ⊔ ⊔ ⊔# a q2 b c c ⊔ ⊔ ⊔ ⊔ ⊔ ⊔
# a b q1 b c ⊔ ⊔ ⊔ ⊔ ⊔ ⊔# a b a q2 c ⊔ ⊔ ⊔ ⊔ ⊔ ⊔
q2
b → c, L
q1N
transition function
b → a, Ra → b, R
24
represent valid tableau with a Boolean formula with components
• Φmove • legal moves represented by legal windows
q2
b → c, L
q1N
transition function
b → a, Ra → b, R
25
represent valid tableau with a Boolean formula with components
• Φmove • legal moves represented by legal windows
26
There is exactly one symbol in each cell The first row is the (‘legal’) start configuration Every subsequent row is generated ‘legally’ One of these rows is an accepting configuration
Properties of an Accepting Tableau
27
represent valid accepting tableau with a Boolean formula with components
•Φcell • exactly one symbol per cell
•Φstart • legal starting configuration
•Φmove • legal moves
•Φaccept • legal accepting configuration
28
represent valid accepting tableau with Boolean formula Φcell ∧ Φstart ∧ Φmove ∧ Φaccept
29
∀ w ∈ Σ* w ∈ A ⇔
there is a valid accepting tableau ⇔
constructed formula is SATISFIABLE
30
SAT is NP-complete
Corollary 7.42: 3SAT is NP-complete
HALTTM = { M, w : M is a TM that halts on input w}
HALTTM is NP-hard
In other words ∀ A ∈ NP A ≤P HALTTM
31
define polynomial time computable function f: Σ* →Σ*
∀ w ∈ Σ* w ∈ 3SAT ⇔ f(w) ∈ HALTTM
3SAT ≤P HALTTM
32
Define TM M as follows
M: On input w:
If w is not a valid 3CNF encoding then loop
If w is a valid 3CNF encoding then
check if w evaluates to True for any possible assignment to variables in w If yes then accept else loop
3SAT ≤P HALTTM
∀ w ∈ Σ* w ∈ 3SAT ⇔ M, w ∈ HALTTM33
HALTTM = { M, w : M is a TM that halts on input w}
Is HALTTM NP-complete?
34
P
NP
All languages
NP-hard
NP-complete
35