NP-complete problems & how to prove one
◈ 6 cardsTrace the reduction chain seeded by Cook’s CIRCUIT-SAT (SAT → 3-CNF-SAT → CLIQUE → VERTEX-COVER → HAM-CYCLE → TSP, plus 3-CNF-SAT → SUBSET-SUM) and drill the 2-step template for proving a problem NP-complete.
Bootstrapping: the first NP-complete problem
The transfer lemma needs a seed — one problem proved NP-complete from first principles, before any reduction is available. That seed is CIRCUIT-SAT: given a boolean combinational circuit, is there an input assignment making the output ?
- In NP (Lemma 34.5): the certificate is an assignment of values to all wires; verify each gate is consistent with its inputs and the output wire is — .
- NP-hard (Lemma 34.6, Cook 1971): for any with poly-time verifier running in steps, build a circuit that simulates — lay down copies of the small circuit computing one computation step, feeding each step's output into the next (a "time-unrolled" computer). The input and program are hardwired; only the certificate is left as free input. The resulting circuit is satisfiable some makes . The circuit has polynomial size, so this is a polynomial reduction. Hence CIRCUIT-SAT for every — CIRCUIT-SAT is NP-hard, and being in NP too, it is NP-complete.
The deep idea: a computer's hardware is a boolean circuit, so any polynomial computation can be "frozen" into a circuit. That single fact bootstraps the entire theory.
The reduction chain
From CIRCUIT-SAT, transitivity (Lesson 9.2) extends NP-completeness by a chain of reductions, each :
with a branch . A few links worth knowing:
- CIRCUIT-SAT SAT: give each wire a variable and each gate a clause ; the formula is the AND of all gate clauses with the output wire. Using a variable per wire (rather than substituting recursively) keeps the formula linear even when wires fan out — the naive substitution blows up exponentially.
- SAT 3-CNF-SAT: parse the formula, introduce a variable per internal node, convert each small clause to CNF via truth tables, then pad short clauses to exactly 3 literals — a 2-literal clause becomes , which is satisfiable under exactly the same assignments.
- 3-CNF-SAT CLIQUE: for a formula with clauses, build a graph with a triple of vertices per clause (one per literal) and an edge between two literals in different clauses unless they are a variable and its negation. Then is satisfiable has a -clique (pick one true literal per clause — they are mutually consistent and in different triples, so they are pairwise adjacent).
- CLIQUE VERTEX-COVER: map to ; has a -clique has a vertex cover of size (the clique's complement covers every edge of ).
- HAM-CYCLE TSP: weight existing edges and missing edges on the complete graph; a tour of total cost exists a Hamiltonian cycle exists.
The 2-step proof template (drill this)
The exam asks you to prove a problem is NP-complete. There is a fixed recipe — Lemma 34.8:
> Step 1 — show NP. Describe a polynomial-length certificate and a polynomial-time verifier that checks it. > > Step 2 — show is NP-hard. Pick a known NP-complete problem and exhibit a reduction : > (a) define mapping instances of to instances of ; > (b) prove runs in polynomial time; > (c) prove the biconditional — both directions. > > NP and NP-hard is NP-complete.
Worked example — proving VERTEX-COVER NP-complete
We run the template end to end on VERTEX-COVER has a vertex cover of size .
Step 1 — in NP. Certificate: a set of vertices. Verifier: check and that every edge has or . That is , polynomial. So VERTEX-COVER NP.
Step 2 — NP-hard via CLIQUE VERTEX-COVER. Known-hard problem: CLIQUE (left side, correct direction). Reduction .
- (a) the map: build the complement graph (edge present iff absent in ), keep .
- (b) polynomial: constructing is .
- (c) biconditional: has a clique of size is a vertex cover of of size . Forward: if is a clique in then no edge of has both endpoints in , so every -edge touches — a cover. Reverse: if covers then no -edge lies inside , so is fully connected in — a clique.
Both conditions hold, so VERTEX-COVER is NP-complete. That four-line skeleton — certificate; pick known-NPC; map; poly; both directions — is the answer to nearly every NP-completeness exam question.