Mathwords logoMathwords

Cook–Levin Theorem — Definition & Example

The Cook–Levin Theorem (also called Cook's Theorem) says that the Boolean satisfiability problem, SAT, is NP-complete. If you could solve SAT efficiently, you could solve every problem in NP efficiently.

SAT is the language of Boolean formulas that have at least one satisfying truth assignment. The theorem states that (1) SAT∈NP\text{SAT} \in \text{NP}, and (2) for every language L∈NPL \in \text{NP} there is a polynomial-time computable function ff such that w∈L  ⟺  f(w)∈SATw \in L \iff f(w) \in \text{SAT}, written L≤pSATL \le_p \text{SAT}. Stephen Cook (1971) and Leonid Levin (1973) proved it independently. Cook's original proof used polynomial-time Turing reductions. The version above, with many-one (Karp) reductions, is the one most textbooks state. The result also holds for 3-SAT, the restriction to formulas in conjunctive normal form with exactly three literals per clause.

How It Works

Part (1) is easy: a proposed truth assignment can be checked against the formula in polynomial time. Part (2) is the core of the proof. Take any nondeterministic Turing machine NN that decides LL in time nkn^k. Build a table, called a tableau, whose rows are the machine's configurations, one per time step. Boolean variables record which symbol sits in each cell. Clauses then force four conditions: each cell holds exactly one symbol, the first row is the start configuration on input ww, every pair of consecutive rows follows a legal move, and some row is accepting. The resulting formula is satisfiable exactly when NN has an accepting computation on ww.

Worked Example

Problem: A nondeterministic Turing machine decides a language in time n2n^2. Its tableau alphabet (states, tape symbols, and a boundary marker #) has 20 symbols. For an input of length n=10n = 10, how many Boolean variables does the Cook–Levin construction create, and why does the formula stay polynomial in size?
Step 1: The tableau is n2×n2n^2 \times n^2: one row per time step and enough columns for every tape cell the machine can reach. Count its cells.
(102)2=100×100=10,000 cells(10^2)^2 = 100 \times 100 = 10{,}000 \text{ cells}
Step 2: The construction creates one variable xi,j,sx_{i,j,s} for each cell (i,j)(i,j) and each symbol ss. The variable is true when cell (i,j)(i,j) holds ss.
10,000×20=200,000 variables10{,}000 \times 20 = 200{,}000 \text{ variables}
Step 3: Each cell, together with the small window of cells around it, adds only a constant number of clauses. So the formula's length grows like n4n^4, which is a polynomial in nn.
size(φw)=O((n2)2)=O(n4)\text{size}(\varphi_w) = O\big((n^2)^2\big) = O(n^4)
Answer: The construction uses 200,000 variables. The formula's size is O(n4)O(n^4), so the reduction runs in polynomial time, which is exactly what the theorem requires.

Why It Matters

Before this theorem, no problem was known to be NP-complete. Once SAT was established, Richard Karp (1972) published a list of 21 NP-complete problems, starting from SAT and reducing it or its relatives to the others, among them clique, vertex cover, and Hamiltonian cycle. Every NP-completeness proof in a theory of computation or algorithms course traces back to this result.

Common Mistakes

Mistake: Thinking the theorem proves that SAT cannot be solved quickly.
Correction: It proves only that SAT is at least as hard as every problem in NP. Whether SAT has a polynomial-time algorithm is the P versus NP question, which is still open. Modern SAT solvers handle many large real-world instances well, even though no algorithm is known to run in polynomial time on every instance.

Related Terms