The midpoint recursion in the space of its frames #
Savitch's midpoint recursion Cslib.Reachability.reach edge w d u v asks whether v is reachable
from u within 2 ^ d steps along edges between words of width w. It has depth d and a frame
holds a level and three words, so it runs in space O((d + 1) * (w + log₂ d + 1)) plus the space
of one edge test. Turing.MultiTapeTM.ComputableInSpace.reach states this for an edge test that
is any certified function of two stored words and the read-only input: the edge test may read the
input, which is never copied.
The rule is an instance of Turing.MultiTapeTM.ComputableInSpace.recWith. A frame is a call
with the midpoint and the half being tried; the body answers a fresh call at level 0 with the
edge test, starts the first half at the word of zeros, moves from a successful first half to the
second, and from a failed half to the next midpoint by the binary counter
Cslib.BitString.increment. No stack, machine or run is described: the recursion is checked
against Cslib.Reachability.reach by the two equations of recWith.
Main results #
Turing.MultiTapeTM.ComputableInSpace.reach: the midpoint recursion with an edge test of two stored words and the input, within the space of its frames and of one edge test.
Implementation notes #
The frames, the body and the value of a frame are private to this module.
References #
What a frame returns #
The two equations of the recursion #
The body within its budget #
The midpoint recursion in the space of its frames. Let the edge test be any function of
two stored words and the input, computable within a budget T that is at most E a on words of
the width w a, and let the width, the depth and the endpoints be computable from the input
within S, the width in unary. Then Savitch's recursion Cslib.Reachability.reach at depth
d a between the endpoints is computable within space
O(S + (d + 1) * (w + log₂ d + 1) + E + log n) on inputs of length n: a chain of at most
d + 1 frames, each holding a level and three words, and one edge test at a time. The constant
does not depend on the depth, and the input is read in place.