TExcelTAD
Home › Approximation Algorithms › The PCP Theorem

The PCP Theorem

A satisfying assignment is a proof that a formula is satisfiable, and checking it means reading all of it. The PCP theorem says that every NP statement has a proof in a special, robust format that a verifier can check by reading only a constant number of bits, chosen at random, while being fooled with probability at most 12\frac{1}{2}. It sounds like a statement about proof checking, and it is; but its main consequence for this course is that MAX-3SAT has a constant-factor gap that is NP-hard, which is the starting point of almost every hardness of approximation result. This lesson states the theorem, proves its equivalence with the gap formulation, and explains the intuition behind it. The proof itself is beyond the scope of the course; its ideas are only sketched.

Probabilistically checkable proofs

A verifier VV for a language LL is a polynomial-time randomized algorithm that gets an input xx, a random string ρ\rho of length r(n)r(n), and oracle access to a proof string π\pi: it can ask for any position of π\pi and read that bit. It reads at most q(n)q(n) positions and accepts or rejects. L∈PCP(r(n),q(n))L \in \text{PCP}(r(n), q(n)) if some verifier satisfies

  • completeness: if x∈Lx \in L, some proof π\pi makes VV accept with probability 1;
  • soundness: if x∉Lx \notin L, every proof π\pi makes VV accept with probability at most 12\frac{1}{2}.

Two easy observations frame the theorem. NP=PCP(0,poly(n))\text{NP} = \text{PCP}(0, \text{poly}(n)): no randomness, read the whole certificate. And PCP(O(log⁡n),O(1))⊆NP\text{PCP}(O(\log n), O(1)) \subseteq \text{NP}: with O(log⁡n)O(\log n) random bits there are only polynomially many random strings, so a nondeterministic machine can guess the (relevant part of the) proof and run the verifier on all of them.

PCP Theorem (Arora and Safra, 1998; Arora, Lund, Motwani, Sudan and Szegedy, 1998). NP=PCP(O(log⁡n),O(1))\text{NP} = \text{PCP}(O(\log n), O(1)).

The proofs, from the early 1990s, combined algebraic error-correcting codes, low-degree testing and proof composition. Dinur (2007) gave a different, combinatorial proof by gap amplification, described below.

The gap formulation

Theorem. The PCP theorem is equivalent to: there is a constant ε>0\varepsilon > 0 such that Gap-MAX-3SAT1,1−ε\text{Gap-MAX-3SAT}_{1, 1 - \varepsilon} is NP-hard. That is, there is a polynomial reduction from any NP language to 3-CNF formulas such that yes-instances become satisfiable formulas, and no-instances become formulas in which every assignment violates at least an ε\varepsilon fraction of the clauses.

Proof. (⇐\Leftarrow) Given the reduction, a verifier for xx computes the formula ϕx\phi_x, picks one clause at random (O(log⁡n)O(\log n) random bits), and reads the 3 bits of the proof (an assignment) that it mentions. If x∈Lx \in L, a satisfying assignment always passes. If x∉Lx \notin L, every assignment fails a random clause with probability at least ε\varepsilon; repeating the test ⌈ln⁡2ε⌉\lceil \frac{\ln 2}{\varepsilon} \rceil times, a constant, brings the acceptance probability below 12\frac{1}{2}.

(⇒\Rightarrow) Let VV be a verifier using r=clog⁡nr = c \log n random bits and qq queries. Treat each proof bit as a Boolean variable. For each random string ρ\rho, the verifier's decision is a function of the qq bits it reads, which is a CNF of at most 2q2^q clauses of qq literals (one clause forbidding each rejecting pattern), and with auxiliary variables a 3-CNF of at most q2qq 2^q clauses. The conjunction over all 2r=nc2^r = n^c random strings is a polynomial-size 3-CNF ϕx\phi_x. If x∈Lx \in L, the good proof satisfies every clause. If x∉Lx \notin L, for every assignment (proof) at least half of the random strings reject, and each rejecting ρ\rho contributes at least one violated clause among its at most q2qq 2^q: so at least a ε=12q2q\varepsilon = \frac{1}{2 q 2^q} fraction of all clauses is violated. Since qq is constant, so is ε\varepsilon. □\square

Corollary. For some constant ε>0\varepsilon > 0, there is no (1−ε)(1 - \varepsilon)-approximation for MAX-3SAT unless P = NP. Hence MAX-3SAT has no PTAS, and neither does any problem it reduces to by a gap-preserving reduction.

Why reading a few bits cannot work for ordinary proofs

Without a special format, local checks are hopeless: an unsatisfiable formula can have an assignment that satisfies all clauses but one, and a verifier that reads a constant number of bits rarely looks at that clause. The program checks the most extreme case. All eight 3-clauses on the same three variables form an unsatisfiable formula, yet every assignment satisfies seven of them, so a verifier that checks one random clause accepts the best false "proof" with probability 78\frac{7}{8}. For a long formula with a single contradiction hidden in it, the acceptance probability is 1−1m1 - \frac{1}{m}.

python · try it yourself
from itertools import product

clauses = [[(v, s[i]) for i, v in enumerate((0, 1, 2))] for s in product([True, False], repeat=3)]
best = max(sum(any(a[v] == s for v, s in c) for c in clauses) for a in product([True, False], repeat=3))
print(f"{len(clauses)} clauses, unsatisfiable; best assignment satisfies {best} -> one-clause verifier accepts with {best}/{len(clauses)}")

# a long chain x0 -> x1 -> ... -> x9 with x0 forced true and x9 forced false: unsatisfiable, but only barely
n = 10
chain = [[(0, True)], [(n - 1, False)]] + [[(i, False), (i + 1, True)] for i in range(n - 1)]
best = max(sum(any(a[v] == s for v, s in c) for c in chain) for a in product([True, False], repeat=n))
print(f"chain formula: {len(chain)} clauses, unsatisfiable; best assignment satisfies {best} -> accepts with {best / len(chain):.3f}")
8 clauses, unsatisfiable; best assignment satisfies 7 -> one-clause verifier accepts with 7/8
chain formula: 11 clauses, unsatisfiable; best assignment satisfies 10 -> accepts with 0.909

A PCP turns such "barely unsatisfiable" instances into "far from satisfiable" ones. The price is a longer proof that encodes the assignment redundantly, so that any cheating is spread over a constant fraction of all the local checks.

Local tests and error-correcting codes

The basic gadget is a local test for a code: a few random queries reveal whether a string is close to a codeword. The simplest is the linearity test of Blum, Luby and Rubinfeld (1993). Write a function f:{0,1}n→{0,1}f : \{0, 1\}^n \to \{0, 1\} as its truth table, a string of 2n2^n bits. Linear functions f(x)=a⋅x mod 2f(x) = a \cdot x \bmod 2 form the Hadamard code of aa. The test picks x,yx, y at random and checks f(x)+f(y)=f(x+y)f(x) + f(y) = f(x + y), three queries.

Theorem (Blum, Luby and Rubinfeld, 1993; tight form by Bellare, Coppersmith, Håstad, Kiwi and Sudan, 1996). If ff disagrees with every linear function on at least a δ\delta fraction of inputs, the test rejects with probability at least δ\delta.

Proof sketch. In ±1\pm 1 notation F=(−1)fF = (-1)^f, the acceptance probability is 12+12∑SF^(S)3\frac{1}{2} + \frac{1}{2}\sum_S \hat F(S)^3, where F^(S)\hat F(S) are the Fourier coefficients. Since ∑SF^(S)2=1\sum_S \hat F(S)^2 = 1, the sum is at most max⁡SF^(S)=1−2δ\max_S \hat F(S) = 1 - 2\delta, so the acceptance probability is at most 1−δ1 - \delta. □\square

The program computes the exact rejection probability for functions on 4 bits (all 16×1616 \times 16 pairs) at various distances from linearity.

python · try it yourself
import random
from itertools import product

n = 4
points = list(product([0, 1], repeat=n))
add = lambda x, y: tuple((a + b) % 2 for a, b in zip(x, y))
linear = lambda a: {x: sum(ai * xi for ai, xi in zip(a, x)) % 2 for x in points}

def distance_to_linear(f):
    return min(sum(f[x] != linear(a)[x] for x in points) for a in points) / len(points)

def rejection(f):
    return sum(f[x] ^ f[y] != f[add(x, y)] for x in points for y in points) / len(points) ** 2

rng = random.Random(0)
base = linear((1, 0, 1, 1))
print("flipped bits  distance  rejection probability")
for flips in [0, 1, 2, 3, 5]:
    f = dict(base)
    for x in rng.sample(points, flips):
        f[x] ^= 1
    print(f"{flips:12} {distance_to_linear(f):9.4f} {rejection(f):12.4f}")
f = {x: rng.randint(0, 1) for x in points}
print(f"{'random':>12} {distance_to_linear(f):9.4f} {rejection(f):12.4f}")
flipped bits  distance  rejection probability
           0    0.0000       0.0000
           1    0.0625       0.1641
           2    0.1250       0.3438
           3    0.1875       0.4453
           5    0.1875       0.3516
      random    0.3750       0.6250

Every row satisfies rejection ≥\ge distance. (After five flips the function is closer to a different linear function than the one it started from, so its distance is smaller than 516\frac{5}{16}.) The Hadamard code is exponentially long (2n2^n bits to encode nn), so it gives only NP⊆PCP(poly(n),O(1))\text{NP} \subseteq \text{PCP}(\text{poly}(n), O(1)), the "exponential-size PCP" that is the first step of the original proof. The full theorem needs codes of polynomial length with similar local testability (polynomials over finite fields and low-degree tests) and proof composition, which recursively replaces a verifier's queries by smaller PCPs.

Dinur's gap amplification

Dinur's proof works with constraint graphs: variables on vertices over a constant alphabet, a constraint on each edge. Start from an NP-hard instance where unsatisfiable means only that a 1m\frac{1}{m} fraction of constraints must fail. Repeat O(log⁡m)O(\log m) times:

  1. Preprocess to a constant-degree expander (the gap shrinks by a constant factor).
  2. Power: replace each vertex's value by its opinion about its whole neighbourhood up to distance tt, and each edge by a test on walks of length tt. The gap grows by a factor about t\sqrt{t}, but the alphabet becomes huge.
  3. Reduce the alphabet back to a constant with a small PCP (composition), losing a constant factor of the gap.

With tt a large enough constant, each round at least doubles the gap while the instance grows by a constant factor, so after O(log⁡m)O(\log m) rounds the gap is a constant and the size is still polynomial.

Test yourself

What does NP=PCP(O(log⁡n),O(1))\text{NP} = \text{PCP}(O(\log n), O(1)) say?

  1. Every NP problem is in P
  2. Every NP statement has a proof that a verifier using O(log⁡n)O(\log n) random bits checks by reading a constant number of its bits, accepting true statements always and false ones with probability at most 12\frac{1}{2}
  3. NP proofs have constant length
  4. Every proof can be checked deterministically in constant time

Why does the PCP theorem imply that MAX-3SAT has no PTAS unless P = NP?

  1. Because 3SAT is NP-complete
  2. It is equivalent to the NP-hardness of distinguishing satisfiable 3-CNF formulas from those where every assignment violates an ε\varepsilon fraction of clauses
  3. Because MAX-3SAT has an FPTAS
  4. Because the verifier is randomized

In the proof that a PCP verifier gives a gap 3-CNF, where does the constant ε=12q2q\varepsilon = \frac{1}{2q2^q} come from?

  1. From the number of variables
  2. At least half of the random strings reject, and each contributes at least one violated clause among its at most q2qq2^q clauses
  3. From the Chernoff bound
  4. From the size of the alphabet

What does the Blum-Luby-Rubinfeld test check with three queries?

  1. That ff is constant
  2. That f(x)+f(y)=f(x+y)f(x) + f(y) = f(x + y) for random x,yx, y; functions far from linear fail with probability at least their distance
  3. That ff is a polynomial of degree 2
  4. That ff is balanced