Savitch's algorithm in the space of its stack #
Savitch's algorithm (Cslib.Reachability.savitch) runs the midpoint recursion on an explicit
stack, for Cslib.Reachability.Savitch.steps w d steps. This file bounds its time and space in the
quantitative calculus (Turing.MultiTapeTM.ComputableInO), charging every stored frame, counter,
returned value and copy.
The states are encoded by framed pairs, options and lists, with the levels in unary
(Cslib.Reachability.Savitch.encState). The edge test may depend on a parameter, which a round of
the iteration keeps in its state together with the width of the midpoints
(Cslib.Reachability.Savitch.roundStep). A round takes time quadratic and space linear in its
encoded state, plus the cost of the edge test on the endpoints of a call at level 0
(Cslib.Reachability.Savitch.computableInO_roundStep). Every state of a run from a call at
level d holds at most d frames of size O(d + w), so iterating the rounds with a binary
counter takes space O((d + 1) * (d + w + 1)), plus the parameter and the space of the edge test
on the worst endpoints (Cslib.Reachability.edgeMax), and exponential time
(Cslib.Reachability.computableInO_savitch). With an edge test and inputs computable in
polynomial time, the space is polynomial (Cslib.Reachability.exists_polyBounded_space_savitch).
Main definitions #
Cslib.Reachability.encArgs,Cslib.Reachability.encEdgeArgs: the encodings of the inputs of Savitch's algorithm and of the edge test.Cslib.Reachability.edgeMax: the cost of the edge test on the worst endpoints.Cslib.Reachability.Savitch.encFrame,Cslib.Reachability.Savitch.encReg,Cslib.Reachability.Savitch.encState: the encoded states of the machine.Cslib.Reachability.Savitch.roundStep,Cslib.Reachability.Savitch.encRound: a step carrying the parameter of the edge test and the width, and its encoding.Cslib.Reachability.Savitch.Invariant: the states of a run from a call at a given level.
Main results #
Cslib.Reachability.Savitch.computableInO_roundStep: the time and space of a round.Cslib.Reachability.Savitch.invariant_iterate,Cslib.Reachability.Savitch.length_encState_le: the states of a run hold at mostdframes, so their encodings have lengthO((d + 1) * (d + w + 1)).Cslib.Reachability.computableInO_savitch: the time and space of Savitch's algorithm.Cslib.Reachability.exists_polyBounded_space_savitch: Savitch's algorithm in polynomial space.
References #
The inputs and the cost of the edge test #
Encodings #
Registers encoded by Reg.toPair.
Instances For
The step in linear time, apart from the edge test #
The transducer testing whether all bits are ones.
Instances For
Sizes of encoded states #
A step carrying the parameter of the edge test #
A round within the time and space of the edge test, plus quadratic time and linear
space. A call at level 0 compares its endpoints, in quadratic time, and runs the edge test on
them; the other cases copy and rearrange the encoded state, in linear time.
The states of a run #
The states of a run from a call at level d with words of width w.
Instances For
The states of a run from a call at level d, with words of width w, are of size
O((d + 1) * (d + w + 1)): at most d frames of size O(d + w), and a call of size
O(d + w).
The number of rounds, in binary #
The first round and the answer #
Savitch's algorithm in the space of its stack #
Savitch's algorithm in the space of its stack. If the edge test is computable with time
Te and space Se, and the parameter, the width and depth in unary, and endpoints of width w
are computable from x with time Tin and space Sin, then Savitch's algorithm is computable
within space O(Sin + (d + 1) * (d + w + 1) + |par| + edgeMax Se) and exponential time.
Savitch's algorithm in polynomial space. If the edge test is computable in polynomial time,
and the parameter, the width and depth in unary, and endpoints of width w are computable from x
in polynomial time, then Savitch's algorithm is computable within space polynomial in the length of
the encoded input; the time is exponential, see Cslib.Reachability.computableInO_savitch. The
width and the depth are polynomial since they are computed in unary
Sipser, Theorem 8.5.