1. Recap: P, NP, NP-Hard, NP-Complete
2. Cook-Levin Theorem — the first NP-complete problem
3. Problem Definitions — 3-SAT, CLIQUE, Vertex Cover
4. The NPC Proof Recipe — 3 steps
5. Reduction 1: 3-SAT \le_P CLIQUE
6. Reduction 2: CLIQUE \le_P Vertex Cover
7. Summary — reduction chain and takeaways
| Class | Intuition | Formal (one line) |
|---|---|---|
| P | Problems we can solve efficiently | Decidable in polynomial time by a DTM |
| NP | Problems whose solutions we can verify efficiently | Decidable in polynomial time by an NTM (equiv: poly-time verifiable certificate) |
| NP-hard | At least as hard as every problem in NP | Every L' \in \text{NP} reduces to L in polynomial time |
| NP-complete | The hardest problems in NP | L \in \text{NP} and L is NP-hard |
Key question: Does P = NP? Answer affects cryptography, optimization, AI, and virtually every field of computing.
SAT is NP-complete. — Stephen Cook (1971), Leonid Levin (1973)
Why this matters: Before Cook-Levin, we had no “anchor” problem. Now we have SAT — if SAT is easy, every NP problem is easy. If SAT is hard, thousands of problems are hard.
3-SAT: Given a boolean formula \phi in conjunctive normal form (CNF) where each clause has exactly 3 literals, does there exist a truth assignment that makes \phi true?
(x_1 \lor x_2 \lor \bar{x}_3) \land (\bar{x}_1 \lor x_2 \lor x_3) \land (x_1 \lor \bar{x}_2 \lor \bar{x}_3)
CLIQUE: Given a graph G = (V, E) and an integer k, does G contain a subset S \subseteq V of size k where every pair of vertices in S is connected by an edge?
Vertex Cover: Given a graph G = (V, E) and an integer k', does G contain a subset C \subseteq V of size k' such that every edge in E has at least one endpoint in C?
To prove a new problem B is NP-complete:
Our chain: SAT (Cook-Levin) \to 3-SAT \to CLIQUE \to Vertex Cover \to \dots
If we solve any NP-complete problem in polynomial time, we solve all of them.
The reduction chain lets us prove NP-completeness without re-proving Cook-Levin every time. Each new NP-complete problem becomes a stepping stone for the next.
Input: 3-SAT formula \phi = C_1 \land C_2 \land \dots \land C_k, each clause has 3 literals.
Construction:
Output: Graph G and integer k (number of clauses).
Formula: \phi = (x_1 \lor x_2 \lor x_3) \land (\bar{x}_1 \lor \bar{x}_2 \lor x_3) \land (x_1 \lor \bar{x}_2 \lor \bar{x}_3)
Three clauses → three groups of 3 vertices:
| Clause 1 | Clause 2 | Clause 3 |
|---|---|---|
| x_1 | \bar{x}_1 | x_1 |
| x_2 | \bar{x}_2 | \bar{x}_2 |
| x_3 | x_3 | \bar{x}_3 |
Edges connect across clauses except conflicting pairs.
\phi is satisfiable \iff G has a clique of size k.
(\Rightarrow) Satisfying assignment: pick the true literal from each clause. These k literals are pairwise consistent (no x and \bar{x} both true), so they form a k-clique.
(\Leftarrow) A k-clique picks one vertex from each clause (can’t pick two from same clause — no edges within a clause). No conflicting literals → set them to true → consistent satisfying assignment. ✓
Key insight: Graph complement duality.
The complement graph \bar{G} = (V, \bar{E}) where: \bar{E} = \{(u,v): u,v \in V, u \neq v, (u,v) \notin E\}
Idea: A clique in G corresponds to an independent set in \bar{G} (no edges). An independent set’s complement is a vertex cover.
S \subseteq V is a clique in G of size k \iff V \setminus S is a vertex cover in \bar{G} of size |V| - k.
Proof:
S is a clique in G \iff all pairs in S are adjacent in G \iff no pair in S is adjacent in \bar{G}
\iff every edge in \bar{G} has an endpoint outside S \iff V \setminus S touches all edges in \bar{G} \iff V \setminus S is a vertex cover of \bar{G} ✓
Input: CLIQUE instance (G, k).
Reduction: 1. Compute complement graph \bar{G} (polynomial time) 2. Set k' = |V| - k 3. Output Vertex Cover instance (\bar{G}, k')
Correctness: G \text{ has a } k\text{-clique} \iff \bar{G} \text{ has a } k'\text{-vertex cover}
Thus: CLIQUE \le_P Vertex Cover, so Vertex Cover is NP-complete. ✓
SAT (Cook-Levin, 1971)
↓
3-SAT (clause-bounded SAT)
↓
CLIQUE (graph problem)
↓
Vertex Cover (graph problem)
↓ … (thousands more)
Each arrow is a polynomial-time reduction.
Solve any of these in P, and P = NP.
| Reduction | Construction | Key Idea |
|---|---|---|
| 3-SAT → CLIQUE | Clause → group of 3 vertices. Edges across groups except conflicting literals. | Clique of size k = one literal per clause, all consistent |
| CLIQUE → Vertex Cover | Complement graph \bar{G}. k' = \|V\| - k. | S is a clique in G \iff V \setminus S is a VC in \bar{G} |
Takeaway: The reduction recipe is simple: pick a known NP-complete problem, map instances, prove correctness both ways. Once you know one reduction, you can chain it to prove NP-completeness for countless problems.
CS F364: Design & Analysis of AlgorithmsTulasimohan Molli