How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Space Complexity, Savitch's Theorem, and TQBF
1 · Prerequisites
- Construction of the Natural Numbers
- Countability and Uncountability
- Finite Counting, Factorials and Binomial Coefficients
- Formal Languages, Encodings, and Decision Problems
- Graphs, Walks and Connectivity
- Linear Recurrences and Rational Generating Functions
- P, NP, coNP, and Polynomial Reductions
- Relations, Functions, and Quotients
- Resource Bounds and Machine Invariance
- The ZFC Axioms and the Basic Set Constructions
- Turing Machines, Configurations, and Computation
2 · Summary
This page isolates the space-bounded side of complexity theory. The first block turns a local reachability recursion on finite digraphs into Savitch's theorem, making explicit that the recursion reuses workspace instead of materializing the whole configuration graph. The immediate corollary is the collapse together with deterministic closure under complement.
The second block moves from reachability to quantified formulas. It proves that TQBF can be evaluated in polynomial space, then builds the reachability formula used for PSPACE-hardness and keeps its size polynomial by reusing one recursive subformula. The page closes by interpreting quantified formulas as games and using that semantics to connect unlimited alternation with PSPACE via .
3 · Logical flowchart
4 · Definitions, theorems and proofs
The classes PSPACE and NPSPACE
Definition
The class PSPACE is the union of all deterministic polynomial-space classes:
The class NPSPACE is the union of all nondeterministic polynomial-space classes:
Equivalently, a language lies in PSPACE when there is a deterministic multitape Turing machine deciding using at most space for some constant , and similarly lies in NPSPACE when there is such a nondeterministic decider. The meanings of and are those of The classes DTIME, NTIME, DSPACE, and NSPACE.
Remarks
- The page uses polynomial space rather than a single fixed bound because closure and completeness statements are stated for the whole class.
- No closure under complement is built into the definition of NPSPACE; that is a later theorem.
A machine using space s(n) has at most exponentially many configurations
Statement
Let be a fixed -tape deterministic or nondeterministic Turing machine, and fix an input of length . Then there is a constant such that if every branch of on visits at most tape cells, then the number of configurations that can arise on input is at most .
Facts & Assumptions
Given: a fixed -tape machine , an input of length , and a bound on the number of visited cells.
A multitape machine has a finite state set, finitely many tape alphabets, and one head position on each tape (Multitape and nondeterministic Turing machine variants).
Worst-case space is the total number of tape cells ever visited during a halting computation (Worst-case time and space complexity of a machine).
Proof
By [L1], once the input is fixed a configuration of is determined by the current state, the head positions, and the symbols on the cells that have been visited so far: every unvisited work-tape cell is still blank, and every unvisited input-tape cell still carries its fixed symbol from . By [L2], at most tape cells are ever visited in total.
Let be the finite state set and let be a common finite upper bound for the tape alphabets. Step 1.1 gives at most choices for the state, at most choices for the head positions, and at most choices for the symbols on the visited cells. Hence the total number of configurations that can arise on input is at most .
Because is fixed, the constants , , and are fixed. For there is therefore a constant with . This proves the claimed exponential bound.
The bounded reachability recursion for directed paths of length at most 2^i
Definition
Let be a finite digraph in the sense of Multigraphs, loops and directed graphs as variants distinct from the default finite simple graph, let , and let . Define the predicate recursively by
and, for ,
This is the bounded reachability recursion. Its intended meaning is that asks whether there is a directed path from to of length at most .
Remarks
- The level allows equality as well as one legal arc, so it captures paths of lengths and exactly.
- The recursive step halves the permitted path-length scale.
The bounded reachability recursion is correct
Statement
Let be a finite digraph, let , and let . Then holds if and only if contains a directed path from to of length at most .
Facts & Assumptions
Given: a finite digraph , vertices , and a natural number .
The definition of says exactly that or , and the definition of for says that some midpoint makes both and hold (The bounded reachability recursion for directed paths of length at most 2^i).
Proof
For , [L1] says holds exactly when or there is an arc . These are precisely the directed paths from to of lengths and , hence of length at most .
Assume the claim for with . If holds, [L1] gives a midpoint with and . By the induction hypothesis there are directed paths from to and from to , each of length at most , and concatenating them gives a path from to of length at most .
Conversely, suppose there is a directed path with . Put and choose . Then the initial segment from to has length at most , and the remaining segment from to has length . The induction hypothesis gives and , so [L1] yields .
Steps 1.1, 1.2, and 1.3 prove the equivalence for every .
The bounded reachability recursion uses logarithmic recursion depth
Statement
Let be a finite digraph with vertices, numbered by . To decide whether a directed path exists from to , it is enough to evaluate with when and when . This recursion has depth at most , each stack frame stores bits, and the whole deterministic search therefore uses space. In particular, if for some constant , then the search uses space.
Facts & Assumptions
Given: a finite digraph with numbered vertices.
is intended to decide existence of a path of length at most , and its recursive definition decreases by one at each call (The bounded reachability recursion for directed paths of length at most 2^i).
A space- machine has at most configurations (A machine using space s(n) has at most exponentially many configurations).
Proof
If , the only possible path question is settled by . Suppose now that . Any directed path with repeated vertices can be shortened by deleting a directed cycle, so if reaches at all then reaches by a simple directed path. A simple directed path in an -vertex digraph has length at most , and .
By [L1], every recursive call decreases the index by one, so starting from that initial yields recursion depth at most .
One stack frame stores the current vertices , , a midpoint candidate , and the current index . Each of these numbers is below , so one frame uses bits. Multiplying by the depth from step 2.1 gives total space .
If , then , and step 3.1 becomes . The last sentence follows; [L2] records exactly the configuration bound that supplies such an in Savitch's theorem.
Savitch's theorem: NSPACE(s(n)) is contained in DSPACE(s(n)^2)
Statement
For every function , every language in also lies in .
Facts & Assumptions
Given: a language .
By definition, means that some fixed nondeterministic multitape machine decides while every branch uses space (The classes DTIME, NTIME, DSPACE, and NSPACE).
Such a machine has at most exponentially many configurations in its space bound (A machine using space s(n) has at most exponentially many configurations).
The bounded reachability recursion is correct for paths of length at most (The bounded reachability recursion is correct).
When a digraph has vertices, the recursion needs only space, hence space when (The bounded reachability recursion uses logarithmic recursion depth).
Proof
Let be the machine from [L1], and fix an input of length . Form the directed configuration graph : its vertices are the configurations of on , and there is an arc exactly when one legal transition of moves from to . Let be the start configuration. Then if and only if some accepting configuration is reachable from in .
By [L2], has at most vertices for some constant depending only on . Any directed path with repeated vertices can be shortened by deleting directed cycles, so if and only if reaches some accepting configuration by a path of length at most .
A deterministic simulator can enumerate candidate accepting configurations one at a time and run the bounded reachability procedure on the triple with an index large enough to cover . By [L3], that test answers the reachability question correctly for each candidate .
By [L4], each such reachability test uses space. The simulator never stores the whole graph: it keeps only the current input, one or two configurations, the midpoint candidate, and the recursion stack; adjacency in is recomputed from the transition function of when needed. The outer loop over candidate accepting configurations adds only more space. Hence the overall deterministic decider uses space.
Since the input was arbitrary, . This proves .
PSPACE equals NPSPACE and is closed under complement
Statement
and if then its complement also lies in PSPACE.
Facts & Assumptions
Given: the classes PSPACE and NPSPACE.
PSPACE and NPSPACE are the unions of and over polynomial bounds (The classes PSPACE and NPSPACE).
Savitch's theorem gives for every (Savitch's theorem: NSPACE(s(n)) is contained in DSPACE(s(n)^2)).
A deterministic space class is defined by deterministic deciders (The classes DTIME, NTIME, DSPACE, and NSPACE).
Proof
If , then [L1] gives a polynomial with . By [L2], , because the square of a polynomial is again a polynomial. Thus .
The reverse inclusion is immediate from [L1] because every deterministic machine is a special case of a nondeterministic one. Hence .
If , choose a deterministic polynomial-space decider for using [L1] and [L3]. Swapping the accepting and rejecting halting states of gives a deterministic polynomial-space decider for the complement of . Therefore PSPACE is closed under complement.
Quantified Boolean formulas and the language TQBF
Definition
A quantified Boolean formula is a formula of the form
where each is either or , and is a quantifier-free Boolean formula built from the variables , the constants , and the connectives .
Such a formula is true when its usual recursive Boolean semantics evaluates to true. The language TQBF consists of all true quantified Boolean formulas under any fixed effective encoding of these strings.
Remarks
- The page uses prenex form so that the quantifier prefix can be read from left to right.
- TQBF is a decision problem about truth, not satisfiability of only the quantifier-free matrix.
TQBF is in PSPACE
Statement
The language TQBF belongs to PSPACE.
Facts & Assumptions
Given: an input quantified Boolean formula .
TQBF is the language of true quantified Boolean formulas (Quantified Boolean formulas and the language TQBF).
A language lies in PSPACE exactly when some deterministic machine decides it using polynomial space (The classes PSPACE and NPSPACE).
Proof
If has no quantifiers, then by [L1] one only needs to evaluate a quantifier-free Boolean formula under a fully specified truth assignment. That can be done by a deterministic left-to-right parse using space polynomial in .
Suppose begins with . Recursively evaluate and, if necessary, ; accept exactly when at least one branch returns true. If instead begins with , recursively evaluate both and and accept exactly when both are true. By [L1], this is exactly the truth definition of the quantified formula.
The recursion depth is at most the number of quantified variables, hence at most . At each level the machine stores the current parse position and the current partial assignment, both of polynomial size. So the whole depth-first evaluation uses polynomial space, even though it may take exponential time.
By [L2], the deterministic recursive evaluator places TQBF in PSPACE.
The quantified formula expressing reachability between two configurations
Definition
Fix a family of vertices encoded by bit strings of length , together with a chosen quantifier-free formula of size asserting that the encoded vertex is reachable from by one legal graph edge. In the application to PSPACE-hardness, is the one-step configuration predicate for a fixed machine on a fixed input length. Let be the quantifier-free formula asserting bitwise equality of the strings and , and abbreviate
For each , define an open prenex formula , whose only free variables are the endpoint blocks , recursively as follows:
and for , first write the already prenex previous formula, after renaming all its bound variables freshly, as where is quantifier-free, and set
The variable is the midpoint candidate, the one-bit variable chooses left or right half, and the variables feed the single recursive copy of .
Remarks
- The symbols , , and abbreviate quantifier-free Boolean formulas built from . Thus the displayed construction is genuinely prenex. After the endpoint blocks are replaced by fixed bit strings, is a closed quantified Boolean formula in the sense of Quantified Boolean formulas and the language TQBF.
- The naive formula duplicates the previous level. The present definition is the size-controlled version used for the PSPACE-hardness proof.
- The intended meaning is that says that is reachable from by a path of length at most .
Quantifier reuse keeps the reachability formulas polynomial in size
Statement
Fix the configuration length and assume that the one-step predicate from The quantified formula expressing reachability between two configurations has size . Then there is a constant such that the formula has size at most for every . In particular, if itself is polynomial in the input length and , then has polynomial size.
Facts & Assumptions
Given: the recursive formulas for a fixed bit-length , with of size .
By definition, , where both summands have size , while for adds one midpoint block, one selector bit, two comparison blocks, and a single recursive copy of (The quantified formula expressing reachability between two configurations).
Proof
By [L1], the base formula has size .
For , [L1] shows that contains exactly one copy of plus only new symbols coming from the variables , the two equality tests, and the Boolean guards for and . So if denotes the size of , then for some constant .
Starting from the base bound in step 1.1 and iterating the recurrence from step 1.2 gives for a suitable constant . If is polynomial in the input length and , this bound is polynomial.
TQBF is PSPACE-complete
Statement
TQBF lies in PSPACE, and every language in PSPACE polynomial-time many-one reduces to TQBF. Therefore TQBF is PSPACE-complete.
Facts & Assumptions
Given: the language TQBF and an arbitrary language .
TQBF belongs to PSPACE (TQBF is in PSPACE).
For a fixed multitape machine running in space , a configuration is determined by its state, finitely many head positions, and the contents of at most visited cells, so configurations admit encodings of length (Multitape and nondeterministic Turing machine variants, Worst-case time and space complexity of a machine).
A polynomial-space machine has at most exponentially many configurations (A machine using space s(n) has at most exponentially many configurations).
The formulas are the reachability formulas of The quantified formula expressing reachability between two configurations.
Those formulas have only polynomial size when the configuration length and the index are polynomially bounded (Quantifier reuse keeps the reachability formulas polynomial in size).
A polynomial-time many-one reduction is a polynomial-time computable map preserving yes and no instances exactly (Polynomial-time many-one reductions).
Proof
The membership part is exactly [L1]. So it remains to prove PSPACE-hardness.
Because , there is a deterministic machine deciding in space for some polynomial . Fix an input of length . By [L2], configurations of on can be encoded by bit strings of length . If has more than one accepting configuration, adjoin one fresh sink vertex and one edge from every accepting configuration to ; this changes the encoding length by at most one bit and preserves acceptance.
By [L3], the resulting graph has at most vertices for some constant . Choose large enough that exceeds this number, and form the quantified Boolean formula using [L4].
We claim that is true if and only if accepts . The proof is by induction on the index used in [L4]. For , says exactly that or that one legal edge joins to . For , the formula chooses a midpoint and then, by the universal choice of the selector bit , forces one recursive call to certify the left half and one to certify the right half. Hence is true exactly when there is a path from to of length at most . With and , this means exactly that accepts .
By [L5], has polynomial size. Because the transition table of is fixed and the configuration length is polynomial, the formula can be written down from in polynomial time. Step 3.1 shows , so by [L6] the map is a polynomial-time many-one reduction from to TQBF.
Steps 1.1 and 4.1 prove that TQBF is in PSPACE and PSPACE-hard. Therefore TQBF is PSPACE-complete.
The quantified formula game for a quantified Boolean formula
Definition
Let
be a quantified Boolean formula. Its quantified formula game is the two-player perfect-information game in which:
- whenever , Player E chooses the value of ;
- whenever , Player A chooses the value of .
After all variables are assigned, the quantifier-free matrix is evaluated. Player E wins if is true under the chosen assignment, and Player A wins otherwise.
Remarks
- The existential player tries to force truth of the formula.
- The universal player tries to force falsity.
A quantified Boolean formula is true if and only if the existential player has a winning strategy in its game
Statement
Let be a quantified Boolean formula. Then is true if and only if the existential player has a winning strategy in the quantified formula game of .
Facts & Assumptions
Given: a quantified Boolean formula .
Truth of a quantified Boolean formula is defined recursively from its quantifier prefix and quantifier-free matrix (Quantified Boolean formulas and the language TQBF).
In the quantified formula game, the existential player chooses the existentially quantified variables and the universal player chooses the universally quantified ones; the existential player wins exactly when the final matrix evaluates to true (The quantified formula game for a quantified Boolean formula).
Proof
If has no quantifiers, then [L1] says that is true exactly when its quantifier-free matrix is true, and [L2] says that this is exactly the condition for the existential player to win the zero-move game.
Suppose . By [L1], is true if and only if at least one of or is true. By the induction hypothesis, that happens exactly when the existential player has a winning strategy for at least one of the two suffix games, and then the existential player wins the whole game by choosing that first move. Conversely, any winning strategy for the whole game determines such a first move.
Suppose instead . By [L1], is true if and only if both and are true. By the induction hypothesis, that is equivalent to the existential player having a winning strategy after either first move of the universal player, which is exactly what [L2] means for the whole game.
Steps 1.1, 1.2, and 1.3 prove both directions of the equivalence.
Alternating polynomial time and the class AP
Definition
An alternating Turing machine is a nondeterministic Turing machine whose nonhalting states are partitioned into existential and universal states.
Acceptance is defined recursively on the computation tree:
- an accepting halting configuration accepts;
- a rejecting halting configuration rejects;
- an existential configuration accepts when at least one legal successor accepts;
- a universal configuration accepts when every legal successor accepts.
The class AP is the set of languages decided by alternating Turing machines whose every computation branch halts within polynomial time.
Remarks
- Deterministic polynomial time is the special case with only one successor at every step.
- Alternation differs from ordinary nondeterminism only at universal states, where all continuations must accept.
AP equals PSPACE
Statement
Facts & Assumptions
Given: the classes AP and PSPACE.
AP is defined by polynomial-time alternating machines (Alternating polynomial time and the class AP).
TQBF is PSPACE-complete (TQBF is PSPACE-complete).
A quantified Boolean formula is true exactly when the existential player has a winning strategy in its game (A quantified Boolean formula is true if and only if the existential player has a winning strategy in its game).
Proof
To prove , it is enough by [L2] to show that TQBF lies in AP. On input a quantified Boolean formula, an alternating machine reads the quantifier prefix from left to right: at an existential quantifier it enters an existential state and chooses the bit, and at a universal quantifier it enters a universal state and branches over both bits. After the prefix is exhausted, it deterministically evaluates the matrix. By [L3], this machine accepts exactly the true formulas, so TQBF is in AP.
For the reverse inclusion, let and choose an alternating machine for running in time . On input , a deterministic procedure evaluates the acceptance of the computation tree depth-first: at an accepting or rejecting leaf it returns the corresponding truth value; at an existential configuration it ORs the recursive values of the children; at a universal configuration it ANDs them. This exactly matches the acceptance rule in [L1].
Now let . By [L2], there is a polynomial-time reduction from to TQBF. An alternating machine for first computes deterministically and then runs the TQBF machine from step 1.1 on . This still uses only polynomial time, so [L1] gives . Thus .
The recursion depth is at most because every branch halts within that many steps. One stack frame stores the current configuration and the remaining depth counter, both of polynomial size, so the whole depth-first evaluation uses polynomial space. Therefore .
Steps 2.1 and 2.2 prove both containments, so .
FALSE: Savitch's algorithm stores the whole configuration graph
Statement
Savitch's algorithm stores the whole configuration graph.
Facts & Assumptions
Given: Savitch's recursive reachability procedure.
The recursive definition reduces one reachability query to two shorter subqueries through one midpoint candidate at a time (The bounded reachability recursion for directed paths of length at most 2^i).
A direct implementation keeps only the current endpoints, the current midpoint candidate, and the recursion stack, so the full search uses only space on an -vertex graph (The bounded reachability recursion uses logarithmic recursion depth).
Refutation
By [L1], Savitch's recursion examines one midpoint candidate and one shorter subproblem at a time, rather than materializing all candidates or all adjacency data at once.
By [L2], the whole recursion uses only polylogarithmic space in the number of configurations. An explicit storage of the whole configuration graph would require at least enough space to name all of its vertices, which is much larger than that bound in general. So the statement is false.
5 · Examples, counterexamples and false statements
A four-vertex digraph where the bounded reachability recursion finds a path via a midpoint
Example
Let have vertices and arcs , , and . Then is false but is true, witnessed by the midpoint .
Facts & Assumptions
Given: the digraph above.
The recursion is defined by splitting at a midpoint (The bounded reachability recursion for directed paths of length at most 2^i).
holds exactly when there is a path of length at most from to (The bounded reachability recursion is correct).
Verification
The only directed path from to is , which has length . Therefore [L2] gives false, because .
Using midpoint , [L1] reduces to and . By [L2], the first holds because has length , and the second holds because has length . Hence is true.
This makes the divide-and-conquer structure concrete: one midpoint splits the length- path into two shorter subproblems, exactly as the recursion predicts.
An alternating machine for a quantified Boolean formula
Example
For the formula
the existential player has a winning strategy, and the corresponding alternating machine accepts by choosing at its first existential state.
Facts & Assumptions
Given: the formula .
The quantified formula game lets the existential player choose existential variables and the universal player choose universal variables (The quantified formula game for a quantified Boolean formula).
Truth of the formula is equivalent to existence of a winning strategy for the existential player (A quantified Boolean formula is true if and only if the existential player has a winning strategy in its game).
AP equals PSPACE, and the AP side is realized by alternating choices along the quantifier prefix (AP equals PSPACE).
Verification
In the game of [L1], if Player E chooses on the first move, then the matrix is true regardless of whether Player A later chooses or . So Player E has a winning strategy.
By [L2], step 1.1 implies that is true. The corresponding alternating machine from [L3] uses an existential state to choose and a universal state to branch over the two values of ; after the choice , both universal branches accept.
This is the smallest nontrivial picture behind the inclusion in AP equals PSPACE.
A Savitch recursion that never materializes the full configuration graph
Statement refuted
Savitch's algorithm stores the whole configuration graph.
Facts & Assumptions
Given: a Savitch reachability search on a graph with many midpoint candidates.
The false statement being refuted is exactly the claim above (FALSE: Savitch's algorithm stores the whole configuration graph).
Counterexample
Take a graph with start vertex , target vertex , and many possible midpoints , but suppose only actually lies on a short path from to . This is a legitimate instance of the claim in [L1].
Savitch's recursion tests the midpoint candidates one by one. At any moment it stores only the current pair of endpoints, the current candidate , and the recursion stack for the shorter subproblems. When the test for fails, that local data is discarded before is tried. Hence no stage materializes the whole graph at once, even though the algorithm still eventually finds the successful midpoint .