The space hierarchy theorem #
Cslib.Complexity.DSPACE is defined in Classes.Space.Basic, and
Cslib.Complexity.SpaceConstructible in Classes.Constructible. Their generic APIs and
the concrete L and PSPACE characterizations do not depend on this hierarchy theorem.
The space hierarchy theorem #
Cslib.Complexity.spaceDiagonal G runs the machine described at the start of its input x, when
the description is tiny (Cslib.Complexity.Diagonal.tinyDesc), on x with the universal machine
within a space budget (Turing.MultiTapeTM.Universal.budgetedUniversal): for 2 ^ G n steps, with
the configurations of the simulation encoded within G n bits. It negates the verdict, and answers
false on other inputs. The budgeted universal machine is the in-place universal run with a budget
test at the end of each pass, within space linear in the description, the budget and the lengths
of the clock and of n in binary (Turing.MultiTapeTM.Universal.budgetSpace_le).
The diagonal does not hold its input. A tiny description has at most log₂ (log₂ n + 1) bits, so
it is decoded in logarithmic space
(Cslib.Complexity.Diagonal.computableInLogSpace_decodeDesc_tinyCut), and the input of the
universal machine (the description, the symbols of x, the clock and the budget) is recomputed on
demand in logarithmic space from x, never charged. So the diagonal takes space O(G n + log n)
(Cslib.Complexity.computableInTimeAndSpace_spaceDiagonal) and decides a problem in DSPACE G
when log₂ n ≤ G n (Cslib.Complexity.setOf_spaceDiagonal_mem_DSPACE).
Let a machine decide the same problem within space c₁ * f n + c₂, where every c * f n + c is
eventually below G n, and let 4 * log₂ n ≤ G n. It halts within its number of configurations,
(n + 2) * 2 ^ O(f n), which is below the clock 2 ^ G n. The configurations of its simulation
take O(f n + log n) bits, with a factor linear in its description: the overhead of the universal
machine is a constant factor for each simulated machine, eventually within the budget
(Cslib.Complexity.Diagonal.eventually_cfgSpaceBound_le). So on its
own description, padded to a doubly exponential length where it is tiny, the diagonal answers the
negation of its answer (Cslib.Complexity.setOf_spaceDiagonal_notMem_DSPACE). Hence the space
hierarchy theorem Stearns, Hartmanis and Lewis,
Sipser, Theorem 9.3, Arora and Barak, Theorem 4.8:
DSPACE f ⊂ DSPACE gfor a space-constructiblegwithlog₂ n ≤ g n, when everyc * f n + cis eventually belowg n(Cslib.Complexity.DSPACE_ssubset_DSPACE);L ⊂ DSPACE (log₂ n ^ 2)(Cslib.Complexity.L_ssubset_DSPACE_log2_sq), and more generallyDSPACE (log₂ n ^ (k + 1)) ⊂ DSPACE (log₂ n ^ (k + 2))(Cslib.Complexity.DSPACE_log2_pow_ssubset_DSPACE_log2_pow_succ);DSPACE (n ^ k) ⊂ DSPACE (n ^ (k + 1))(Cslib.Complexity.DSPACE_pow_ssubset_DSPACE_pow_succ);L ⊂ PSPACE(Cslib.Complexity.L_ssubset_PSPACE).
The gap f = o(g) and the lower bound log n ≤ g n are the textbook ones. The nondeterministic
space hierarchy, under the same hypotheses, is in
CslibFrontier.Computability.Complexity.Classes.Hierarchy.NondeterministicSpace.
Main definitions #
Cslib.Complexity.spaceDiagonal: the diagonal within a space budget.
Main results #
Cslib.Complexity.spaceDiagonal_desc: the diagonal negates the answer of a machine on its padded description, within the clock and the budget.Cslib.Complexity.computableInTimeAndSpace_spaceDiagonal: the diagonal within spaceGis computable within spaceO(G n + log n).Cslib.Complexity.setOf_spaceDiagonal_mem_DSPACE,Cslib.Complexity.setOf_spaceDiagonal_notMem_DSPACE: the diagonal within spaceGis decidable within spaceO(G), and not within spaceO(f)forf = o(G).Cslib.Complexity.DSPACE_ssubset_DSPACE: the space hierarchy theorem.Cslib.Complexity.L_ssubset_DSPACE_log2_sq,Cslib.Complexity.DSPACE_log2_pow_ssubset_DSPACE_log2_pow_succ,Cslib.Complexity.DSPACE_pow_ssubset_DSPACE_pow_succ,Cslib.Complexity.L_ssubset_PSPACE: its corollaries.Cslib.Complexity.eventually_mul_log2_pow_add_le,Cslib.Complexity.eventually_mul_pow_add_le_succ_pow: the gaps between consecutive powers oflog₂ nand ofn, shared with the nondeterministic corollaries.
References #
- R. E. Stearns, J. Hartmanis, P. M. Lewis II, Hierarchies of memory limited computations
- M. Sipser, Introduction to the Theory of Computation
- S. Arora, B. Barak, Computational Complexity: A Modern Approach
The padded diagonal argument follows the time hierarchy theorem
(CslibFrontier.Computability.Complexity.Classes.Hierarchy.Time), here on Christian Reitwiessner's
in-place universal interpreter within a space budget.
The diagonal within a space budget #
The diagonal within space G. On a word x of length n whose framed description is
tiny (Cslib.Complexity.Diagonal.tinyDesc), run the described machine on x, under the coding
Turing.MultiTapeTM.Universal.eBit of bits, for 2 ^ G n steps within the budget of G n bits
for the encoded configurations of the simulation (Turing.MultiTapeTM.Universal.budgetedUniversal),
and return false exactly when it has halted with output [true]; answer false on other
words.
The diagonal within space G is computable within space O(G n + log n), for a
space-constructible G. The tiny description, decoded, and the symbols of the input are computed
in logarithmic space, and the clock 2 ^ G n in binary and the budget G n in unary within space
O(G n); this input of the budgeted universal machine is recomputed on demand, not stored. The
budgeted universal run takes space linear in the description, the budget and the lengths of the
clock and of n in binary (Turing.MultiTapeTM.Universal.budgetSpace_le), and the tininess test
logarithmic space.
The diagonal within space G decides a problem in DSPACE G, for a space-constructible
G with log₂ n ≤ G n.
On a tiny padded description, the diagonal within space G negates the answer of a machine
that halts within the clock 2 ^ G n and whose simulated configurations fit within the budget
G n.
The diagonal argument for space. If every c * f n + c is eventually below G n and
4 * log₂ n ≤ G n, the problem of the diagonal within space G is not in DSPACE f. A decider
within space O(f) halts within its number of configurations, (n + 2) * 2 ^ O(f n), which is
below the clock 2 ^ G n, and the configurations of its simulation take O(f n + log n) bits,
eventually within the budget G n; so on its own description, padded to a tiny one beyond these
points, the diagonal answers the negation of its answer.
The space hierarchy theorem #
The space hierarchy theorem. If g is space-constructible, log₂ n ≤ g n, and every
c * f n + c is eventually below g n, then DSPACE f is strictly contained in DSPACE g
Sipser, Theorem 9.3 and Corollary 9.4, Arora and Barak, Theorem 4.8.
The universal machine simulates within a budget with a constant overhead for each simulated
machine, and the diagonal reads its input in place, so both the gap f = o(g) and the lower bound
log n ≤ g n are the textbook ones. The diagonal within space 4 * g separates the classes.
Polylogarithmic space has a strict hierarchy:
DSPACE (log₂ n ^ (k + 1)) ⊂ DSPACE (log₂ n ^ (k + 2)).
Logarithmic space is strictly within space log² n: L = DSPACE (log₂ n), and the
diagonal within space 4 * log₂ n ^ 2 separates them Sipser, Corollary 9.4.
Logarithmic space is strictly within polynomial space: L ⊂ DSPACE (log₂ n ^ 2), which is
within PSPACE. This is the deterministic part of Sipser, Corollary 9.6, which
separates NL from PSPACE.
Polynomial space has a strict hierarchy: DSPACE (n ^ k) ⊂ DSPACE (n ^ (k + 1))
Sipser, Corollary 9.5. The diagonal within space 4 * (n + 1) ^ (k + 1) separates
them.