Chapter 34-3NP-Completeness and Reducibility |
Document last modified: |
Overview
NP-complete class has property that if any NP-complete problem can be solved in polynomial time, every NP problem can be solved in polynomial time.
Language HAM-CYCLEL is NP-complete. If we could decide HAM-CYCLEL in polynomial time then we could decide every NP in polynomial time.
We know that P | NP, an answer from a polynomial time algorithm can be verified in polynomial time.
The question is whether P=NP or P≠NP.
Most computer scientists believe the relationship between NP, NPC and P at right.
satisfiable - an instance exists to which a decision problem produces a 1 output
Reducibility - tool for proving languages belong to class P
|
Example A1 decides Hamiltonian cycle visits each vertex exactly once.
L1 language of Hamiltonian cycle instances.
Example: A1( G )
A2 decides k-cycle is a cycle of length exactly k unique vertices.
L2 language of exactly k unique vertices cycle length instances.
Example: A2( G, 5 )
For a graph with v vertices:
we can answer the question: does a Hamiltonian cycle exist?
with the question: does a cycle of length v exist?
The answer to both questions is the same.
Question
- What is x?
- What is L2?
- What is A1(x)?
- What is f(x)?
- What is A2( f(x) )?
- What is the work of the reduction algorithm F in this case?
- L1 ≤p L2?
- L2 ≤p L1?
V= {1,2,3,4,5}
E = {(1,2),(2,1),(1,5),(5,1),...}
G = (V, E)
Lemma 34.3
If L1, L2 ⊆ {0, 1}* are languages such that L1 ≤p L2 then L2 ∈ P implies L1 ∈ P.
Question: What does the lemma imply about L1 if L1 ≤p L2?
We can think of ≤p as meaning L1 is no worse than L2
NP-completeness
Language L ⊆ {0, 1}* is NP-complete if:
- L ∈ NP
- L' ≤p L for every L' ∈ NP (meaning L' is polynomial time reducible to L)
NP-hard - Language L that satisfies property 2 only (satisfying property 1 means L is polynomial time verifiable, NP-hard means it is not polynomial time verifiable).
Now to prove that NP-complete class has property that if any NP-complete problem can be solved in polynomial time, every NP problem can be solved in polynomial time.
Theorem 34.4
Equivalent statements:
- If any NP-complete problem is polynomial time solvable, then P=NP (all NP problems can be solved in polynomial time).
- If any NP problem is not polynomial time solvable, then no NP-complete problem is polynomial time solvable .
Proof
Let L ∈ P and also that L ∈ NPC (the class of NP-complete languages).
For any L' ∈ NP, by property 2 of NP definition, L' ≤p L.
By Lemma 34.3, have L' ∈ P, proving the first statement.
The second statement is the contrapositive of the first (i.e. the contrapositive of p → q is ~q→ ~p).
Circuit satisfiability
Reduction relies on having a known NP-complete problem to prove a different problem NP-complete.
Need to prove a first problem NP-complete.
|
![]() Figure 34.7 from Cormen |
||||||||||||||||||||||||||||||||||||
|
Figure 34.8 (a) and (b) from Cormen
|
|
CIRCUIT-SAT = {<C>: C is a satisfiable Boolean combinational circuit}
CIRCUIT-SAT is a language
C is a circuit
<C> is a binary string
Encoding is directed graph-like:
# of combinational elements (AND, OR and NOT gates) as with vertices
# of wires as with edges
Show that CIRCUIT-SAT satisfies definition of NP-complete:
- CIRCUIT-SAT ∈ NP
- L' ≤p CIRCUIT-SAT, ∀ L' ∈ NP
Lemma 34.5 The circuit-satisfiability (CIRCUIT-SAT) problem belongs to the class NP.
CIRCUIT-SAT ∈ NP
Proof:
Will provide a 2-input polynomial time algorithm A that can verify CIRCUIT-SAT. Note that A simulates the circuit.
Inputs to A:
- standard encoding of Boolean combinational circuit C
- certificate corresponding to assignment of Boolean values to the wires in C, the inputs and outputs of each logic gate
Algorithm A constructed as:
- For each logic gate in circuit, A checks that certificate value and gate output are equal for inputs on the logic gate.
- If the circuit output is 1, A outputs a 1, otherwise A outputs a 0.
Input to A must always include the circuit C and a certificate of polynomial length in size of C, for which A outputs a 1.
Because A simulates the circuit and verifies against the certificate, A cannot be fooled by an unsatisfiable circuit no matter the certificate.
CIRCUIT-SAT can be verified in polynomial time and CIRCUIT-SAT ∈ NP
Lemma 34.6 The circuit-satisfiability problem is NP-hard.
L' ≤p CIRCUIT-SAT, ∀ L' ∈ NP (meaning L' is polynomial time reducible to CIRCUIT-SAT)
Proof: See text.
NP-completeness of circuit-satisfiability relies on direct proof that L ≤p CIRCUIT-SAT for every language L ∈ NP.
CIRCUIT-SAT provides the known NP-complete problem to prove a different problem NP-complete.