computation tableau, 2×3 windows

A ∈ NP ≤p SAT

Every language A∈NPA\in\mathrm{NP} satisfies A≤pSATA\le_p\mathrm{SAT}. This is the Cook–Levin theorem: SAT\mathrm{SAT} is NP-hard, and since SAT∈NP\mathrm{SAT}\in\mathrm{NP} as well, it is NP-complete.

The construction

Let A∈NPA\in\mathrm{NP} and let MM be a nondeterministic machine deciding AA in polynomial time q(n)q(n). On input xx of length nn:

  1. The tableau. Consider the q(n)×q(n)q(n)\times q(n) table TM,xT_{M,x}: row ii encodes the configuration of MM after ii steps, as a single string in which the state is written immediately left of the scanned cell. The table is wide enough because in q(n)q(n) steps the head cannot travel more than q(n)q(n) cells.
  2. The variables. For every cell (i,j)(i,j) and every symbol ss of the alphabet L=Γ∪Q∪{#}L=\Gamma\cup Q\cup\{\#\}, introduce a Boolean variable xi,j,sx_{i,j,s} meaning "cell (i,j)(i,j) holds symbol ss".
  3. The formula. φ=φcell∧φstart∧φaccept∧φmove\varphi=\varphi_{cell}\wedge\varphi_{start}\wedge\varphi_{accept}\wedge\varphi_{move}:
    • φcell\varphi_{cell} — every cell holds exactly one symbol;
    • φstart\varphi_{start} — the first row is the initial configuration on xx;
    • φaccept\varphi_{accept} — the accepting state appears somewhere in the table;
    • φmove\varphi_{move} — every 2×32\times3 window is legal, i.e. consistent with the transition function of MM.
  4. Return ⟨φ⟩\langle\varphi\rangle.

The heart of the construction is φmove\varphi_{move}: global legality of a computation is enforced entirely by local checks. Two consecutive rows represent a legal step of MM iff every 2×32\times3 window across them is legal — because a single step changes only the scanned cell and its neighbours.

Visualization

Guided construction

Cook–Levin tableau

Step 1 of 7
Input x = 10 · time bound T = 3 · tableau width S = 5
t=0
⊢
[q0,1]
0
□
□

Correctness — both directions

A ∈ NP ∈ ⟹ SAT ∈

Suppose x∈Ax\in A. Then MM has an accepting run on xx of length ≤q(n)\le q(n). Fill the table according to exactly that run, and set xi,j,s=1x_{i,j,s}=1 iff cell (i,j)(i,j) of that table holds ss.

This assignment satisfies all four parts: φcell\varphi_{cell} because each cell holds one symbol; φstart\varphi_{start} because the first row was filled with the initial configuration; φaccept\varphi_{accept} because the run accepts, so the accepting state occurs; φmove\varphi_{move} because consecutive rows describe a legal step of MM, hence every 2×32\times3 window is legal. So φ\varphi is satisfiable.

SAT ∈ ⟹ A ∈ NP ∈

Suppose φ\varphi is satisfiable and let π\pi be a satisfying assignment. Read a table off it: since π\pi satisfies φcell\varphi_{cell}, every cell (i,j)(i,j) has exactly one symbol ss with π(xi,j,s)=1\pi(x_{i,j,s})=1, so the table is well defined.

Since π\pi satisfies φstart\varphi_{start}, the first row is the initial configuration on xx. Since it satisfies φmove\varphi_{move}, every 2×32\times3 window is legal, so — by induction on rows — each row follows from its predecessor by a legal step of MM. That is, the table describes a genuine run of MM on xx. Since π\pi satisfies φaccept\varphi_{accept}, that run reaches the accepting state. Hence MM has an accepting run on xx, so x∈Ax\in A.

Cost of the reduction

TimeO(q(n)^2) up to polylog factors
SpaceO(q(n)^2)
Output sizeO(q(n)^2 · |L| · log q(n)) bits

The tableau is q(n)×q(n)q(n)\times q(n) cells with ∣L∣|L| variables each — O(q(n)2)O(q(n)^2) variables — and ∣L∣|L| is a constant fixed by MM, not by the input. φmove\varphi_{move} contributes one clause per window, and the number of windows is (q(n)−1)⋅(q(n)−2)=O(q(n)2)(q(n)-1)\cdot(q(n)-2)=O(q(n)^2); the number of possible six-tuples per window is ∣L∣6|L|^6, again constant. So ∣φ∣=O(q(n)2)|\varphi|=O(q(n)^2) up to constants and the log⁡\log needed to encode indices — polynomial in the input size, which is all that is required.

What it buys

SAT\mathrm{SAT} is NP-complete. It is the first problem whose hardness was proved from scratch — every other reduction in the course leans on it through the transitivity of ≤p\le_p.

Pitfalls

  • The reduction builds the formula from ⟨M⟩\langle M\rangle and xx alone. It does not run MM and does not know whether an accepting run exists — the filled table appears only in the correctness proof, where assuming "an accepting run exists" is legitimate.

  • The bound q(n)q(n) limits the number of steps, and therefore the width too — the head cannot travel further than the number of steps it took. Without that bound the table would not be polynomial and the whole construction would collapse.

The chain

Where this was read from