Explaining Savitch's theorem and recursive reachability
Savitch’s theorem shows NPSPACE equals PSPACE by deterministically simulating nondeterministic space-bounded machines via a recursive reachability algorithm on the configuration graph. This graph has at most 2^{p(n)} nodes for polynomial space p(n), and the algorithm recursively checks if there’s a path of length ≤ t between configurations by splitting t in half, yielding recursion depth O(log t). Since each configuration needs O(p(n)) space and t ≤ 2^{p(n)}, the recursion uses O(p(n)·log t) = O(p(n)^2) space. For a graph with N nodes, the algorithm works in O(log^2 N) space by storing O(log N)-bit configurations across O(log N) recursion levels, establishing that NPSPACE ⊆ PSPACE and thus PSPACE = NPSPACE.
If (M) is a nondeterministic Turing machine which on inputs of length (n) never scans more than (f(n)) tape squares, then its instantaneous configurations can be coded by (O(f(n))) bits: you have to record the finite control state, the position of the head, and the contents of the (f(n)) cells. There are therefore at most
[
N;=;2^{O(f(n))}
]
different configurations, and you can view the possible moves of (M) as the edges of a directed graph (G) on (N) vertices. Acceptance of an input by (M) amounts to the existence of a directed path from the unique start configuration to one of the accepting configurations in this graph.
Savitch's idea is to solve this reachability problem deterministically by divide–and–conquer. Given two vertices (u,v) and a length parameter (\ell), define a predicate
[
\operatorname{REACH}(u,v,\ell)=\text{“there is a path of length }\leq \ell\text{ from }u\text{ to }v\text{”}.
]
For (\ell=1) this can be decided by inspecting the adjacency list of (u). For larger (\ell) there is a path of length (\leq \ell) from (u) to (v) if and only if there is some intermediate vertex (w) such that there is a path of length (\leq\lfloor\ell/2\rfloor) from (u) to (w) and a path of length (\leq\lfloor\ell/2\rfloor) from (w) to (v). This gives the recursive algorithm
REACH(u,v,ℓ):
if ℓ=1 return “(u,v) is an edge?”
for all w in V:
if REACH(u,w,⌊ℓ/2⌋) and REACH(w,v,⌊ℓ/2⌋) then return true
return false
On a graph with (N) vertices the maximum simple path length is (N-1), so it suffices to call (\operatorname{REACH}(s,t,N)) on the start and target configurations. The depth of the recursion is (O(\log \ell)), and at each level you need to store two vertex names, which take (O(\log N)) bits each, and the current value of (\ell), which takes (O(\log \ell)\leq O(\log N)) bits. Thus the total working space is (O((\log N)\cdot \log N)=O(\log^2 N)).
Applying this to the configuration graph of (M), we have (\log N = O(f(n))), so the deterministic simulation uses (O(f(n)^2)) space. This is Savitch's theorem: ( \mathrm{NSPACE}(f(n))\subseteq \mathrm{DSPACE}(f(n)^2)). In particular, if (f(n)) is a polynomial, then (f(n)^2) is still a polynomial. Thus any language in (\mathrm{NPSPACE}=\bigcup_k \mathrm{NSPACE}(n^k)) is in (\mathrm{PSPACE}), and the reverse inclusion is trivial. Therefore (\mathrm{PSPACE}=\mathrm{NPSPACE}).