Savitch's theorem for general space bounds #
A nondeterministic machine whose computation paths on an input of length n visit at most S
work cells is simulated by a deterministic machine within space O((S + log₂ n + 1) ^ 2): this is
Savitch's theorem [Sav70]. No constructibility of S is assumed; as in Sipser's proof of
Theorem 8.5 [Sip13], the machine tries growing bounds. The simulation runs Savitch's midpoint
recursion with an explicit stack (Cslib.Reachability.Savitch.step) on the compact configuration
graph of the machine (Turing.MultiTapeNTM.ConfigurationGraph), whose vertices omit the input. A
vertex of the graph of radix B is stored as a word of W = O(log B) bits, so the stack of at
most W frames has O(W ^ 2) bits. The input is never copied: the simulation is a query machine
(Turing.QueryMachine), which reads one input bit per step, and the edge test at the bottom of the
recursion needs exactly one input bit, at the input head of its source vertex.
The space bound S is not computed. The machine counts the input in binary and then tries the
radices roundRadix State n j = 4 ^ j * startRadix State n of
Turing.MultiTapeNTM.ConfigurationGraph.roundRadix in turn, the radices of Immerman's inductive
counting for nondeterministic space; Sipser's proof of Theorem 8.5 likewise tries the space bounds
1, 2, 3, … and checks whether the machine uses more. In round j, a first recursion asks
whether an overflowing vertex, one with a step leaving the radix, is reachable from the start
vertex; if it is, the machine moves on to round j + 1. Otherwise every reachable view fits the
radix, and a second recursion on the same graph asks whether an accepting halted vertex is
reachable, which decides acceptance. A machine
within space S has no reachable overflow from round 4 * S + 1 on
(Turing.MultiTapeNTM.ConfigurationGraph.fits_roundRadix_of_runsInSpace), so every round has
vertices of O(S + log₂ n + 1) bits. To have a single target, the graph on words gains a sink, the
word of W ones: every target vertex steps to it
(Turing.MultiTapeNTM.SquareSavitch.sinkReach_eq_true_iff).
The sublinear form of Savitch's theorem is the extension stated in the final paragraph of
Section 8.4 of Sipser's third edition, just before Section 8.5 (p. 351): "We can extend Savitch's
theorem to hold for sublinear space bounds down to f(n) ≥ log n." Sipser's Theorem 8.5 itself
assumes f(n) ≥ n, and Arora and Barak's Theorem 4.14 assumes a space-constructible bound
S(n) ≥ log n. In the extension, the machine has a read-only input tape, and the configurations of
the machine on the input w record the state, the work tapes and the head positions but not w.
Here these are the vertices of the compact configuration graph, and the query machine reads the one
input bit an edge test needs. The sources state the theorem for languages decided by
nondeterministic machines whose branches all halt; the statement here also covers machines that
only recognize the problem (branches may run forever), arbitrary per-instance bounds without
constructibility, and arbitrary instances under an encoding into List Bool.
Main definitions #
Turing.MultiTapeNTM.SquareSavitch.wordEdge: the edges of the graph on words, given the round mode and the input bit at the source.Turing.MultiTapeNTM.SquareSavitch.sinkReach: the recursion from the start vertex to the sink.Turing.MultiTapeNTM.SquareSavitch.machine: the deterministic query machine.Turing.MultiTapeNTM.SquareSavitch.Runtime: named runtime fields with generated encodings and certificates.
Main results #
Turing.MultiTapeNTM.SquareSavitch.sinkReach_true_iff,Turing.MultiTapeNTM.SquareSavitch.sinkReach_false_iff: the recursion decides reachable overflow, and without it acceptance.Turing.MultiTapeNTM.exists_decidableInTimeAndSpace_sq: Savitch's theorem: a problem recognized by a nondeterministic machine within spaceSis decided by a deterministic machine within spaceO((S + log₂ n + 1) ^ 2).Turing.MultiTapeNTM.SquareSavitch.exists_halted,Turing.MultiTapeNTM.SquareSavitch.length_encRuntime_le: the machine halts, and its states haveO((S + log₂ n + 1) ^ 2)bits.
References #
- W. J. Savitch, Relationships between nondeterministic and deterministic tape complexities; journal text not inspected (paywalled), so no theorem number or page is cited.
- M. Sipser, Introduction to the Theory of Computation, 3rd edition, Theorem 8.5 and its proof, and Section 8.4, final paragraph (p. 351)
- S. Arora, B. Barak, Computational Complexity: A Modern Approach, Theorem 4.14
- N. Immerman, Nondeterministic Space Is Closed under Complementation
The graph on words #
The targets of a round, given the input bit symbol at the vertex: the overflowing vertices
in overflow mode, and the accepting halted vertices otherwise.
Instances For
The edges of the graph on words, given the round mode and the input bit symbol at the
source: the edges of the compact configuration graph between the values of the words, and an edge
from every target vertex to the sink, the word of ones.
Instances For
The edges of the graph on words on the input w: the input bit is read at the input head of
the source.
Instances For
The recursion of a round: Savitch's midpoint recursion at depth W = vertexWidth k B on
the graph on words of width W, from the start vertex to the sink.
Instances For
Reachability of the sink #
No vertex is the sink.
The sink is reachable exactly when a target is. Along the graph on words of width
W = vertexWidth k B, from the start vertex to the word of W ones.
The recursion of a round decides whether a target is reachable, for every radix above the finite tags.
The overflow round decides reachable overflow.
Without reachable overflow, the acceptance round decides acceptance.
The late rounds have no reachable overflow: for a machine within space S, from round
4 * S + 1 on.
The query machine #
Edge-test parameters, with the input bit read last.
- overflowMode : Bool
Whether the round searches for overflow, rather than for acceptance.
- radix : ℕ
Radix used to encode the simulated machine registers.
- inputLength : ℕ
Length of the original read-only input.
Input bit just read, or
nonebeyond the input.
Instances For
The parameters and unary vertex width share one frame.
- params : EdgeParams
Parameters shared by all edge tests in this round.
- width : ℕ
Bit width of vertices, stored in unary.
Instances For
A round of midpoint recursion.
- setup : RoundSetup
Edge-test parameters and vertex width.
- recursion : Cslib.Reachability.Savitch.State
Current continuation stack and recursion register.
Instances For
The input counter, startup flag, and current simulation round.
- counter : ℕ
Number of input bits counted; the input length after startup.
- started : Bool
Whether input counting has finished and recursion has started.
- round : SimulationRound
Current midpoint-recursion round.
Instances For
Round mode, binary radix and input length followed by the optional input bit, in field order.
Instances For
Framed edge parameters followed by the unary vertex width.
Instances For
The tuple of the fields of encSimulationRound.
Instances For
Framed round setup followed by the encoded recursion state.
Instances For
The first state of a round of the given mode and radix, on inputs of length n: the call at
depth W from the start vertex to the sink. The start vertex is written as the binary digits of
its value plus 2 ^ W, without the last one (Turing.MultiTapeTM.bits_add_two_pow).
Instances For
The source of the pending call, if any.
Instances For
The recursion has returned its value.
Instances For
The round has returned, and it is an overflow round: the next round starts.
Instances For
The input bit to read: the next input position while counting, then the input head of the source of the pending call.
Instances For
A step of the machine, given the input bit read: count the input until its end, then start the
overflow round of the first radix. An overflow round that returns true starts the overflow round
of the next radix; one that returns false starts the acceptance round of the same radix. Other
steps run the recursion, with the bit read as the input bit of the edge test.
Instances For
The machine halts once an acceptance round has returned.
Instances For
The answer: the value returned by the recursion.
Instances For
The deterministic simulation, as a query machine: count the input, then run Savitch's recursion on the graphs on words of growing radix, reading the input bit of each edge test.
Instances For
The runs of the machine #
The step of the recursion only uses the edge test at a call at level 0.
At the end of the input, the machine starts the overflow round of the first radix.
The value of a returned recursion is the value of its register.
A step of a round that has not returned runs the recursion, with the input bit at the source of the pending call.
A returned overflow round starts the next round: the overflow round of the next radix if
it returned true, and the acceptance round of the same radix otherwise.
The first state of a round, once the start vertex is known to have a word.
A returned round holds the value of its recursion.
A round runs to its return: from the first state of a round, the machine runs the
recursion until it returns the value sinkReach.
The states of a run: counting the input, or a round of radix roundRadix State n j,
after overflow rounds that found overflow at every earlier radix. An acceptance round has no
reachable overflow at its radix.
Instances For
A returned overflow round leads to a halted machine or to the overflow round of the next radix, after reachable overflow.
The machine halts on the inputs of a machine within some space bound.
The size of the states #
A run within space S stays below round 4 * S + 1.
The states of the recursion satisfy the invariant of a run at depth W.
The runtime's framing cost, separated from the encoded recursion state.
The states of a run have O((S + log₂ n + 1) ^ 2) bits, for a machine within space
S.
The parts of the machine in linear space #
The fields of a state of the recursion, as pairs.
The stack, within a budget.
The register as a pair, within a budget.
The value of the source of the pending call, within a budget.
Whether the recursion has returned, within a budget.
The input position to read, in space linear in the state.
The halting test, in space linear in the state.
The restart test, in space linear in the state.
The answer, in space linear in the state.
The edge test of the graph on words, in linear space.
A round of the recursion on the graph on words, in space linear in the round.
The first state of a round, from the mode, the radix and the input length, within a budget.
The first radix, within a budget.
A step of the machine, in space linear in the state and the bit read.
Savitch's theorem [Sav70], for general space bounds. No constructibility is assumed:
the machine tries growing bounds, as in Sipser's proof of Theorem 8.5 [Sip13]. A
problem recognized by a nondeterministic machine whose computation paths on enc a visit at most
S a work cells, and whose branches need not halt, is decided by a deterministic machine within
space O((S a + log₂ |enc a| + 1) ^ 2): Savitch's midpoint recursion on the compact configuration
graphs of the machine of growing radix (Turing.MultiTapeNTM.SquareSavitch.machine).