Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.InSpace.Midpoint

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 #

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 #

theorem Turing.MultiTapeTM.ComputableInSpace.reach {α : Type} {encA : α ↪ List Bool} {edge : α → List Bool → List Bool → Bool} {w d : α → ℕ} {u v : α → List Bool} {S E : α → ℕ} {T : (List Bool × List Bool) × α → ℕ} (hw : ComputableInSpace w encA encUnary S) (hd : ComputableInSpace d encA encNat S) (hu : ComputableInSpace u encA encBits S) (hv : ComputableInSpace v encA encBits S) (hedge : ComputableInSpace (fun (q : (List Bool × List Bool) × α) => edge q.2 q.1.1 q.1.2) (encPair (encPair encBits encBits) encA) encBool T) (hT : ∀ (a : α) (x y : List Bool), x.length = w a → y.length = w a → T ((x, y), a) ≤ E a) (hlen : ∀ (a : α), (u a).length = w a ∧ (v a).length = w a) :
ComputableInSpace (fun (a : α) => Cslib.Reachability.reach (edge a) (w a) (d a) (u a) (v a)) encA encBool fun (a : α) => S a + (d a + 1) * (w a + (d a).log2 + 1) + E a + (encA a).length.log2

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.