34.4 NP-completeness proofs |
Document last modified: |
A language L
⊆ {0, 1}*
is NPC if:
L ∈ NP and
L' ≤p L, ∀ L' ∈ NP
This seems to say that we have to show that all L' ∈ NP have to be reduced to L in order to show L is in NPC.
But this is not so:
because of transitivity, by reducing a known NP-complete Language L' to L, we implicitly reduce every language in NP to L.
NP-hard - A language L that satisfies L' ≤p L, ∀ L' ∈ NP (means every language in NP can be reduced in polynomial time to L).
Lemma 34.8
Given: L is a language such that L' ≤p L for some L' ∈ NPC
L is NP-hard.
If L ∈ NP then L ∈ NPC.
Proof
L'' ≤p L', ∀ L'' ∈ NP property 2 in NPC definition L' ∈ NPC
L is NP-hard By transitivity, L'' ≤p L' ≤p L, so L' ≤p L, ∀ L' ∈ NP.
Satisfies property 2 of NPC.L ∈ NPC If L ∈ NP then satisfies property 1 of NPC definition.
Means that by reducing a known NP-complete language L' to L, we implicitly can reduce every language in NP to L.
|
The General Method for proving L ∈ NPC
|
Example - Prove Formula satisfiability is NPC
SAT = { <φ>: φ is an instance of a Boolean formula}
φ is composed of:
n Boolean variables: x1, x2, ..., xn
m Boolean connectives: ^, v, ¬, → , ↔
( ) parenthesis
Example Formula: φ = ((x1 → x2) v ¬((¬x1 ↔ x3) v x4)) ^ ¬x2
n = 4, m = 8
φ ∈ SAT if φ has a satisfying assignment to xi
For the formula above try: x1 = 0, x2 = 0, x3 = 1, x4 = 1
There are 2n possible assignments to φ
Checking all requires at least Ω(2n) time
Overall Steps for Showing SAT ∈ NPC
Show SAT ∈ NP
ASAT(φ,y) = 1
ASAT runs in polynomial time by just replacing each xi with its corresponding value from y and evaluating expression. Simulate φ to verify certificate.
Show CIRCUIT-SAT ≤p SAT
Select a known NPC language L' (i.e. choose CIRCUIT-SAT)
Describe an algorithm F that computes a function f, mapping every instance of x ∈ {0, 1}* of CIRCUIT-SAT to an instance f(x) ∈ SAT
See below.
Prove that the function f satisfies: x ∈ CIRCUIT-SAT iff f(x) ∈ SAT, ∀ x ∈ {0, 1}*
Prove that F computes f in polynomial time
CIRCUIT-SAT ≤p SAT has been shown.
SAT ∈ NP and CIRCUIT-SAT ≤p SAT
Hence SAT ∈ NPC
By Lemma 34.8, if L is a language such that L' ≤p L for some L' ∈ NPC, then L is NP-hard. Also, if L ∈ NP then L ∈ NPC.
That is: if SAT is a language such that CIRCUIT-SAT ≤p SAT for CIRCUIT-SAT ∈ NPC, then SAT is NP-hard. Also, if SAT ∈ NP then SAT ∈ NPC.
What is the function f ?
|
Figure 34-10 from Cormen |
F reduces CIRCUIT-SAT instance to SAT instance by converting Boolean expressions to wire connections and gates.
φ
= x10 ^ (x4 ↔ ¬x3)
^ (x5
↔ (x1 v x2))
^ (x6
↔
¬x4)
^ (x7
↔ (x1 ^ x2 ^ x4))
^ (x8
↔ (x5 v x6))
^ (x9
↔ (x6 v x7))
^ (x10
↔ (x7 ^ x8 ^ x9)
For this circuit to be satisfiable, there has to be a satisfying assignment to x1 .. x10
Satisfied by: x1 = 1, x2 = 1, x3 = 0, x4 = 1, x5 = 1, x6 = 0, x7 = 1, x8 = 1, x9 = 1, x10 = 1
What This Reduction Shows
CIRCUIT-SAT ≤p SAT
So we can construct a machine as follows:
- A1 is CIRCUIT-SAT ∈ NPC
- A2 is SAT
- F is the polynomial-time reduction algorithm that computes the function f
- x is a problem instance of CIRCUIT-SAT
- f(x) is a problem instance of SAT
Figure 34.5 from Cormen
If a polynomial-time algorithm existed for SAT (i.e., A2 in the diagram), then we could construct a machine similar to Figure 34.5 that could decide A1 in polynomial time.
But we know that no known polynomial-time algorithm has ever been discovered for CIRCUIT-SAT (i.e., A1 in the diagram)
Therefore, by contradiction, it is not likely that a polynomial-time algorithm exists for SAT
A proof that a problem is NP-complete is excellent evidence it is intractable.