NP-completeness
Intro
A decision problem is NP-complete (NPC) if and .
Certificate and Certifier
Algorithm is a certifier for problem if string s,
iff a string t (certificate) such that .
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 :
certificate t:
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 , then . If , then . B is at least as hard as A. (A B)
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 is NP-complete?
- (give a certificate and a ploy-time certifier)
- 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 .
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 3-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 be any circuit
there are inputs of that have output 1. can convert input values to create values at all nodes of . This input satisfies .
is satisfiable. 3-SAT clauses were designed to ensure the values assigned to all nodes in match exactly what the circuit would compute.
Reference
Algorithm Design Chapter 8 Intractability