← Student tools · Problem 45 · Lecture 16 · Round 3 (40 pts)

The space hierarchy theorem · via diagonalization

More space = strictly more languages. The cleanest separation theorem we can actually prove.

CLO-1 · Diagonalization CLO-5 · Hierarchy Round 3 · 40 pts Lecture 16
🔊 Listen

The hierarchy theorems are the only unconditional separation results in complexity theory. Every famous open problem — P vs NP, P vs PSPACE, NL vs L — asks whether two classes are equal. We don't know. But we do know, for sure, that strictly more space (or time) gives strictly more power, as long as the gap is big enough.

These are the theorems that anchor the complexity zoo. Without them, the picture L ⊆ NL ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME would have no proven inequalities at all. The hierarchy theorems guarantee at least one strict containment in every "long enough" stretch of the chain.

Space hierarchy theorem

If f(n) ≥ log n is space-constructible, then SPACE(f(n)) ⊊ SPACE(f(n) · log f(n)).

Corollaries: L ⊊ PSPACE · NL ⊊ PSPACE · P ⊊ EXPSPACE · NP ⊊ EXPSPACE.

🔊 Listen

The recipe is Cantor's, with three new ingredients:

  1. Enumerate the machines we want to defeat: M1, M2, … = all TMs using ≤ f(n) space. (We can list TM descriptions lexicographically.)
  2. Build D = "on input ⟨M⟩: simulate M(⟨M⟩) using a counter to enforce f(n) space; if M halts with answer b, output 1-b."
  3. Argue D's resources: D uses f(n) for the simulated tape, plus O(log f(n)) for a counter, total O(f(n) · log f(n)).
Vocabulary
  • Space-constructible · there's a TM that on 1n writes f(n) on its tape in O(f(n)) space. Almost any "reasonable" function (n, n², 2n, log n, …) is space-constructible.
  • Simulation overhead · the log factor. To simulate M's f(n)-space tape, D needs to track head positions, current state, and step count. That's an extra log f(n) factor.
🔊 Listen

Claim 1. D ∉ SPACE(f). Suppose, for contradiction, D ∈ SPACE(f). Then D = Mk for some k. Run D on input ⟨Mk⟩ = ⟨D⟩:

Claim 2. D ∈ SPACE(f · log f). The simulation uses f(n) tape cells for M's tape and O(log f(n)) for head/state/counter. Total: O(f · log f).

The animation walks the diagonal: row by row, watch the cell where Mi meets ⟨Mi⟩, then watch D's row appear in gold flipping every diagonal answer.

🔊 Listen
Build D by walking the diagonal · escape every SPACE(f) machine Auto-plays
🔊 Listen

Apply the theorem with f(n) = log n (i.e. L):

So L is strictly inside PSPACE = ∪k SPACE(n^k). Each strict step is small (log factor), but a chain of strict steps eventually crosses any polynomial gap.

Class Space Hierarchy gap to next
LO(log n)⊊ SPACE(log² n)
SPACE(n)O(n)⊊ SPACE(n²)
PSPACEpoly(n)⊊ EXPSPACE = SPACE(2poly)
🔊 Listen
🔊 Listen
  1. "Hierarchy proves P ≠ NP." No. P and NP are not separated by hierarchy: both are bounded by polynomial resources. The diagonal needs a resource gap.
  2. Ignoring constructibility. Without f being space-constructible, D doesn't know when to stop simulating. The theorem genuinely needs the hypothesis.
  3. Confusing the log f gap with log n. The simulation overhead depends on f, not n directly. For f = n, the gap is log n. For f = log n, the gap is log log n.
  4. "D's contradiction is Mk(⟨Mk⟩) = Mk(⟨Mk⟩) + 1." Almost — it's b = 1−b, which means 2b = 1, impossible for a bit.
  5. "This needs Cantor's bijection." No, just a TM enumeration. We never need to enumerate all reals.
🔊 Listen
🔊 Listen

Total time: 12 minutes.