The endpoints of Savitch's midpoint game #
A play of Savitch's midpoint game (Cslib.Reachability.midpointGame) on words of width w and
i levels ends with a pair of endpoints, whose edge test decides the play. The pair depends on
two levels only: the left endpoint is the midpoint chosen at the last level whose half is true,
or the initial left endpoint if there is none, and the right endpoint is the midpoint chosen at
the last level whose half is false, or the initial right endpoint if there is none
(Cslib.Reachability.midpointGame_eq_reach_lastMidpoint).
The midpoint of the last level with a given half is extracted from any moves z in time linear in
the number of moves, O((2 * w + 2) * i + w + |z|), by a native multi-tape machine
(Cslib.Reachability.computableInO_lastMidpoint). The moves are padded or cut to the length of the
game by a zip transducer (Cslib.Reachability.padZip); then the level marks are written in one
streaming pass (Cslib.Reachability.levelMarks), the moves are reversed, and a finite-state zip
transducer reads the marks and the reversed moves in lockstep (Cslib.Reachability.endpointZip),
copying the first level, from the end, with the wanted half. The moves are read a constant number of
times, not once per level: re-reading the remaining moves at every level would take order
w * i ^ 2 steps. The word this endpoint machine computes is Cslib.Reachability.endpointWord.
This is a step toward NSPACE(s) ⊆ ATIME(s ^ 2) Chandra, Kozen and
Stockmeyer, which
Cslib.Complexity.NSPACE_subset_ATIME_sq_of_timeConstructible assembles for a time-constructible
s (#4086) with the codes of the initial and accepting views and the edge test
Cslib.Reachability.reach ntm.codeEdge _ 0 of the final endpoints.
Main definitions #
Cslib.Reachability.lastMidpoint: the midpoint of the last level with a given half.Cslib.Reachability.levelMarks: the level marks, read backwards.Cslib.Reachability.endpointZip: the zip transducer copying the midpoint.Cslib.Reachability.endpointWord: the word the endpoint machine computes.Cslib.Reachability.padZip: the zip transducer padding or cutting the moves to the marks.
Main results #
Cslib.Reachability.lastMidpoint_eq_none_iff,Cslib.Reachability.lastMidpoint_eq_some_iff:lastMidpointis the midpoint of the last level with the given half.Cslib.Reachability.iterate_midpointStep: the endpoints afterilevels.Cslib.Reachability.midpointGame_eq_reach_lastMidpoint: the midpoint game is the edge test of the midpoints of the last levels with each half.Cslib.Reachability.lastMidpoint_congr:lastMidpointreads only the moves of its levels.Cslib.Reachability.computableInO_lastMidpoint: the midpoint of the last level with a given half, on any moves, within time and space linear in the number of moves.
References #
The endpoints of the midpoint game #
The midpoint chosen at the last of the first i levels of the midpoint game on words of width
w whose half is d, if there is one. A level takes 2 * w + 2 moves: its midpoint is
Cslib.Reachability.midpointMoves w of the moves from its start, and its half is its last move.
No level with half d. lastMidpoint w i z d is none exactly when no level j < i of
the moves z has half d; the half of level j is the move (2 * w + 2) * j + (2 * w + 1).
The midpoint of the last level with half d. lastMidpoint w i z d is some m exactly
when some level j < i of the moves z has half d, no later level j' < i has half d, and m
is the midpoint of level j, that is Cslib.Reachability.midpointMoves w of the moves from its
start (2 * w + 2) * j.
The endpoints after i levels. After i levels of the midpoint game from u and v,
the left endpoint is the midpoint of the last level whose half is true, or u, and the right
endpoint is the midpoint of the last level whose half is false, or v.
The midpoint game depends on two levels. The existential player wins a play of the
midpoint game at level i between u and v exactly when the edge test accepts the midpoint of
the last level whose half is true (or u) and the midpoint of the last level whose half is
false (or v).
The endpoint machine #
The level marks of i levels of 2 * w + 2 moves, read from the last move backwards: for each
level, true at its half, then false at its other 2 * w + 1 moves.
The states of the endpoint scan, which reads the levels from the last one backwards.
- seek : EndpointState
No level with the wanted half yet.
- skip : EndpointState
At the move of the existential player after the half of the level found.
- univ : EndpointState
Copying the level found, at a move of the universal player.
- mid : EndpointState
Copying the level found, at a bit of its midpoint.
- done : EndpointState
Past the level found.
Instances For
The endpoint scan for the half d: a zip transducer reading the level marks and the
reversed moves in lockstep. It emits the bits of the midpoint of the first level read, that is the
last level of the game, whose half is d, last bit first, and then true; it emits nothing if no
level has half d.
The word computed by the endpoint machine for the half d, on the width w, the number i
of levels and the moves z: the endpoint scan of the level marks and the reversed moves, reversed.
On moves of the length of the game it encodes Cslib.Reachability.lastMidpoint w i z d.
The pad scan: one move per mark, false past the end of the moves, nothing past the marks.
The midpoint of the last level with a given half, in linear time. On any moves z, the
midpoint of the last of the first i levels whose half is d, as an option, is computed on a
multi-tape machine within time and space O((2 * w + 2) * i + w + |z|): the moves are padded or
cut to the length of the game by the pad scan, and then the endpoint machine runs.