Unit 3

Nondeterminism and Certificates

Branching computation, polynomial verification, and the equivalence of two views of NP.

Goals

  • Define acceptance for nondeterministic machines.
  • Translate between accepting branches and certificates.
  • Avoid confusing nondeterminism with randomness.

Intuition

A nondeterministic decider accepts when at least one legal branch accepts. Equivalently, a short certificate lets a deterministic verifier check a yes-instance efficiently.

Formal definitions

A nondeterministic machine runs in time t(n)t(n) if every branch halts within t(n)t(n). The class

NP=⋃k≥1NTIME(nk).\mathrm{NP}=\bigcup_{k\ge1}\mathrm{NTIME}(n^k).

A nondeterministic transition relation may offer several legal moves from one configuration. A computation tree has the initial configuration at its root and one child for each legal successor. The machine accepts if at least one branch accepts and rejects only if all branches reject. Nondeterminism assigns no probabilities to branches.

For general bounds,

NTIME(t(n))={L:some NTM decides L and every branch lasts at most O(t(n))},\mathrm{NTIME}(t(n))=\{L:\text{some NTM decides }L \text{ and every branch lasts at most }O(t(n))\},

and NSPACE(s(n))\mathrm{NSPACE}(s(n)) is defined analogously using at most O(s(n))O(s(n)) work cells on every branch. Every branch must halt for an NTM decider. A single infinite branch invalidates a claimed time bound, even if another branch accepts quickly.

Guided construction

Nondeterministic computation tree

Step 1 of 7
φ =(x₁ ∨ ¬x₂)∧(x₂ ∨ x₃)
Binary nondeterministic computation treeThe verifier guesses three assignment bits. Eight leaves check the formula, and the path 110 reaches an accepting leaf.ε
legal binary choice

Trace one accepting root-to-leaf path and record its edge labels. That string is a certificate of choices. Then inspect a no-instance: there must be no accepting leaf anywhere.

A polynomial verifier for LL is a deterministic polynomial-time VV and polynomial pp such that

x∈L  ⟺  ∃y, ∣y∣≤p(∣x∣) and V(x,y)=1.x\in L\iff \exists y,\ |y|\le p(|x|)\ \text{and}\ V(x,y)=1.

Theorem. The nondeterministic-machine and polynomial-verifier definitions of NP\mathrm{NP} are equivalent.

Proof walkthrough

We prove both directions. Assume a standard multitape model and that deciders/verifiers halt.

Direction I — NTM to verifier. Let NN decide LL in nondeterministic time p(n)p(n). Each configuration has at most bb children (bb fixed for NN). Encode each transition choice in O(1)O(1) bits. A certificate yy is the choice string along a branch of length ≤p(∣x∣)\le p(|x|), so ∣y∣≤O(p(∣x∣))|y|\le O(p(|x|)).

The verifier V(x,y)V(x,y) simulates NN on xx according to yy: at each step it reads the next choice, rejects if the choice is illegal or yy ends before halt, and accepts only if the simulation reaches an accepting state within p(∣x∣)p(|x|) steps. Deterministic time is polynomial in ∣x∣+∣y∣|x|+|y|.

Completeness: if x∈Lx\in L some accepting branch exists; its choice encoding is an accepting certificate. Soundness: every accepted certificate describes a genuine accepting branch of NN.

Direction II — verifier to NTM. Given verifier VV and polynomial qq with x∈Lx\in L iff some ∣y∣≤q(∣x∣)|y|\le q(|x|) has V(x,y)=1V(x,y)=1, the NTM NN guesses a string of length ≤q(∣x∣)\le q(|x|) bit by bit, then runs VV deterministically. If x∈Lx\in L some guess accepts; if x∉Lx\notin L every guess rejects. The length bound is essential: without it, even reading an exponential witness is not polynomial in ∣x∣|x|.

What this does not show. Equivalence does not give a deterministic polynomial simulation, nor settle NP=coNP\mathrm{NP}=\mathrm{coNP}.

Computation-tree size and deterministic simulation

Suppose each configuration has at most bb successors and every branch has length at most t(n)t(n). The tree can contain

1+b+⋯+bt(n)=bO(t(n))1+b+\cdots+b^{t(n)}=b^{O(t(n))}

nodes for constant b>1b>1. A deterministic simulator can traverse this tree depth-first, simulate every branch, and accept if one leaf accepts. Therefore

NTIME(t(n))⊆DTIME(2O(t(n)))\mathrm{NTIME}(t(n))\subseteq\mathrm{DTIME}(2^{O(t(n))})

for standard fixed-branching models and reasonable constructible tt. In particular,

P⊆NP⊆EXP.\mathrm P\subseteq\mathrm{NP}\subseteq\mathrm{EXP}.

The first inclusion lets a deterministic machine be an NTM with one choice. The second explores all polynomial-length choice strings.

This simulation is exponential in time, not polynomial merely because each branch is polynomial. The number of branches, not just branch depth, matters.

For space, naive depth-first exploration of a computation tree may encounter cycles and potentially infinite branches. Configuration graphs supply the correct finite object. An NTM using s(n)≥log⁡ns(n)\ge\log n space has 2O(s(n))2^{O(s(n))} configurations. Acceptance asks whether an accepting configuration is reachable from the start configuration. Deterministically exploring this graph yields

NSPACE(s(n))⊆DSPACE(2O(s(n)))\mathrm{NSPACE}(s(n))\subseteq\mathrm{DSPACE}(2^{O(s(n))})

by a straightforward simulation. A much stronger theorem, Savitch's theorem, gives

NSPACE(s(n))⊆DSPACE(s(n)2)\mathrm{NSPACE}(s(n))\subseteq\mathrm{DSPACE}(s(n)^2)

for s(n)≥log⁡ns(n)\ge\log n, but its recursive reachability proof is beyond the basic tree enumeration used here. Consequently NPSPACE=PSPACE\mathrm{NPSPACE}=\mathrm{PSPACE}.

Space semantics

Space is measured on the largest branch footprint, not by adding space across simultaneous branches. The computation tree is mathematical semantics; the NTM does not physically store all branches at once. A branch may reuse work cells, so exponential time can coexist with polynomial space.

Define

NPSPACE=⋃k≥1NSPACE(nk).\mathrm{NPSPACE}=\bigcup_{k\ge1}\mathrm{NSPACE}(n^k).

Clearly PSPACE⊆NPSPACE\mathrm{PSPACE}\subseteq\mathrm{NPSPACE}. Savitch's theorem supplies the reverse containment after squaring a polynomial.

Worked example

For Hamiltonian cycle, a certificate is an ordering of all vertices. Check that every vertex appears once and each consecutive pair, including the last-first pair, is an edge. The check is polynomial in the graph encoding.

If vertices are numbered 1,…,m1,\ldots,m, the witness contains mm numbers of O(log⁡m)O(\log m) bits, so its size is O(mlog⁡m)O(m\log m). The verifier checks range, uniqueness, and mm required edges. With an adjacency matrix, each edge lookup is constant-time under the conventional indexed model; with a TM-level encoding, the total remains polynomial. A malformed or repeated vertex causes rejection.

SAT example. For a Boolean formula φ\varphi with variables z1,…,zmz_1,\ldots,z_m, guess mm bits and evaluate the syntax tree bottom-up. Completeness: a satisfiable formula has an accepting assignment branch. Soundness: if any branch accepts, its bits define a satisfying assignment. This is existential semantics, not a randomized search claim.

Nondeterministic padding

For

Pad⁡p(L)={x#1p(∣x∣)−∣x∣:x∈L},\operatorname{Pad}_p(L)=\{x\#1^{p(|x|)-|x|}:x\in L\},

the same length conversion used for deterministic classes applies to NTIME\mathrm{NTIME} and NSPACE\mathrm{NSPACE}. If LL has a nondeterministic 2O(n)2^{O(n)}-time decider and p(n)=2Θ(n)p(n)=2^{\Theta(n)}, its correctly padded version has a polynomial-time nondeterministic decider in total length N=p(n)N=p(n).

The machine must first verify padding format, recover xx, and then simulate the original NTM. Every simulated branch must meet the translated bound. Padding changes the represented language; it does not imply that the original LL belongs to NP.

Padding often appears in conditional arguments. One assumes an equality at one resource scale, pads or unpads instances, and derives a consequence at another scale. The algebra must state both lengths and preserve the existential acceptance condition.

Common mistakes

  • Requiring every branch to accept.
  • Allowing exponential certificate length.
  • Treating an unverified guessed object as evidence.
  • Assigning probabilities to nondeterministic choices.
  • Bounding only an accepting branch instead of every branch.
  • Confusing branch depth with total tree size.
  • Summing work space over all conceptual branches.
  • Using graph search without handling repeated configurations.
  • Applying a padding conclusion to the original language.

Visualization prompt

Show a branching computation tree with one accepting leaf and map its edge labels to a certificate string.

Exercises

Exercise 1 — Accept and reject semantics

Define when an NTM accepts input xx and when it rejects (as a decider). Prove that swapping accept and reject states need not decide L‾\overline L.

Solution

Definition. NN accepts xx if some computation branch accepts. As a time-tt decider every branch halts within t(∣x∣)t(|x|) steps, and x∉Lx\notin L iff every branch rejects.

Swap. After swapping accept/reject, new acceptance is “some formerly rejecting branch exists” — existential — whereas L‾\overline L requires “no accepting branch”, a universal condition. Local state swapping does not exchange the quantifiers.

Exercise 2 — Certificate as choice string

Prove that if L∈NTIME(p(n))L\in\mathrm{NTIME}(p(n)) then there is a deterministic polynomial verifier with certificates of length O(p(n))O(p(n)). State completeness and soundness.

Solution

Encode transition choices along a branch of length ≤p(n)\le p(n) using O(1)O(1) bits per step. The verifier simulates according to yy and rejects illegal choices. Completeness: an accepting branch yields a certificate. Soundness: an accepted certificate is a real accepting branch. Time O(p(n))O(p(n)).

Exercise 3 — Polynomial depth is not P\mathrm P

Prove a binary machine with branches of length n3n^3 may create 2Θ(n3)2^{\Theta(n^3)} tree nodes, and deduce why naive deterministic simulation does not prove NP⊆P\mathrm{NP}\subseteq\mathrm P.

Solution

A full binary tree of depth t=n3t=n^3 has 2t+1−1=2Θ(n3)2^{t+1}-1=2^{\Theta(n^3)} nodes. Deterministic enumeration takes exponential time. The known inclusion is NTIME(t)⊆DTIME(2O(t))\mathrm{NTIME}(t)\subseteq\mathrm{DTIME}(2^{O(t)}), not polynomial.

Exercise 4 — Nondeterministic space measure

Define sN(n)s_N(n) for a nondeterministic machine. Prove that “some branch uses little space” is not the definition of NSPACE\mathrm{NSPACE}.

Solution

sN(n)s_N(n) is the maximum, over all branches, of work cells visited. NSPACE(s)\mathrm{NSPACE}(s) requires every branch to stay within s(n)s(n) cells. Existential thrifty branches alone allow overflowing branches hidden behind an accepting path — not the definition.

Exercise 5 — Savitch and NPSPACE\mathrm{NPSPACE}

State Savitch's conclusion for constructible s(n)≥log⁡ns(n)\ge\log n, and deduce NPSPACE=PSPACE\mathrm{NPSPACE}=\mathrm{PSPACE}.

Solution

Savitch: NSPACE(s(n))⊆DSPACE(O(s(n)2))\mathrm{NSPACE}(s(n))\subseteq\mathrm{DSPACE}(O(s(n)^2)). For s(n)=nks(n)=n^k, NSPACE(nk)⊆DSPACE(n2k)⊆PSPACE\mathrm{NSPACE}(n^k)\subseteq\mathrm{DSPACE}(n^{2k})\subseteq\mathrm{PSPACE}. Union yields NPSPACE⊆PSPACE\mathrm{NPSPACE}\subseteq\mathrm{PSPACE}. The reverse inclusion is immediate, hence equality.

Summary

Nondeterminism is an existential quantifier over branches. Short certificates and deterministic verifiers express the same idea; full deterministic simulation is exponentially costly.

Guided practice

Task 1 — Clique verifier

Build a polynomial verifier for CLIQUE. Prove completeness, soundness, and a certificate-length bound.

Solution

Certificate: kk vertex IDs. Checks: in range, distinct, and all (k2)\binom{k}{2} pairs are edges. Length O(klog⁡∣V∣)O(k\log|V|), polynomial time. Completeness: a true clique gives a list. Soundness: an accepted list is a clique. “Guess and accept” without checks is not a proof.

Task 2 — Complement trap

Explain why swapping accept/reject leaves in a machine for LL need not decide L‾\overline L. Relate to NP\mathrm{NP} versus coNP\mathrm{coNP}.

Solution

Original rejection means every branch rejects. After swapping, one originally rejecting branch suffices for acceptance — too weak. NP\mathrm{NP} is ∃\exists-evidence; coNP\mathrm{coNP} is ∀\forall/no-evidence. Whether they coincide is open.

Task 3 — Simple path of length kk

Describe “simple path of length ≥k\ge k” in three ways (NTM, verifier, tree) and prove membership in NP\mathrm{NP}. What does deterministic simulation give?

Solution

Guess/receive as certificate a sequence of k+1k+1 vertices; check legality, no repeats, and edges. Length O(klog⁡∣V∣)O(k\log|V|); reject if k>∣V∣k>|V|. All three views are the same ∃\exists. Deterministic enumeration: ∣V∣k+1=2O(klog⁡∣V∣)|V|^{k+1}=2^{O(k\log|V|)} — exponential, not a P\mathrm P proof.

Sources

  • Student-summary evidence: merged course summary, pp. 25-42; pp. 50-54 are cited only where the material overlaps with tableaux. The summary is used for course alignment, not authoritative verification.
  • Course evidence: Semester A 2026 transcripts 5-6, nondeterminism and padding.
  • Verification: Sipser, 3e, pp. 292-304 and 321-330.
  • Verification: Arora-Barak draft, pp. 43-64 and 83-88.
  • Verification: Papadimitriou, pp. 35-51 and 159-170.