NP-completeness
Intro
A decision problem X is NP-complete (NPC) if X∈NP and X∈NP−hard.
Certificate and Certifier
Algorithm C(s,t) is a certifier for problem X if ∀ string s, s∈X iff ∃ a string t (certificate) such that C(s,t)=yes.
Ex. 3-SAT Given a CNF formula ϕ, is there a satisfying assignment?
Certifier:
Check each clause in ϕ has least one true literal
Certificate:
a solution (assignment to boolean variables) that
satisfies ϕ
instance s: ϕ=(x1∨x2∨x3)∧(x1∨x2∨x3)∧(x1∨x2∨x4)
certificate t: x1=true,x2=true,x3=false,x4=false
Reduction
A reduction from problem A → problem B is to construct a polynomial time algorithm that converts A inputs → equivalent B inputs (same yes/no answer). If we know how to solve B, then we know how to solve A. So if B∈P, then A∈P. If B∈NP, then A∈NP. B is at least as hard as A. (A ≤pB)
Prove NPC
It's good to know so we can give up on searching a polynomial algorithm for this problem ᵔᴥᵔ. So how do we prove a problem X is NP-complete? 1. X∈NP (give a certificate and a ploy-time certifier) 2. reduce from a known NPC problem (3-SAT is a good choice for almost anything)
Cook and Levin did all the ground work to prove Circuit-SAT and 3-SAT are NPC. Here we are just gonna show NPC with reduction.
Prove 3-SAT is NPC
We need a poly-time certifier to check a certificate of 3-SAT. Therefore, 3SAT ∈NP.
Now we need to pick a known NPC problem and show 3-SAT is harder. We decide to reduce from Circuit-SAT to 3-SAT (Circuit-SAT ≤p3-SAT). We want to construct a poly-time algorithm that converts C-S inputs to 3-SAT inputs such that a 3-SAT instance ϕ is satisfiable iff the C-S inputs have an output of 1.
The conversion algorithm has 3 steps.
Reduction Proof Let K be any circuit
⇐ there are inputs of K that have output 1. can convert input values to create values at all nodes of K. This input satisfies ϕ.
⇒ ϕ is satisfiable. 3-SAT clauses were designed to ensure the values assigned to all nodes in K match exactly what the circuit would compute.
Reference
Algorithm Design Chapter 8 Intractability
Last updated