The guess-then-verify alternating machine #
This file builds the alternating machine that writes a sequence of alternate single-bit moves of
two players on a work tape and then runs a deterministic verifier, the guess-then-verify machine
(Turing.MultiTapeATM.guessVerify) Chandra, Kozen and Stockmeyer
Arora and Barak, Section 5.3.
The machine is assembled from one deterministic machine for each move
(Turing.MultiTapeATM.ofTMs). The machine of the move b
(Turing.MultiTapeATM.GuessVerify.machine) runs, in sequence (Turing.MultiTapeTM.seq):
- a deterministic machine
prep, which writes on work tapeBthe frame ofLbitstrue(Turing.MultiTapeTM.frame) followed by the input; - the guessing machine (
Turing.MultiTapeATM.GuessVerify.guess), which walks along the pairstrue, trueof the frame and writes the movebover the second cell of each pair; its states record which player is to move, and the states of the universal player's moves are the universal states; - a rewind of tape
B(Turing.MultiTapeTM.rewindWork), and a deterministic machineverify, started on the frame of the moves followed by the input.
Outside the cells of the moves the two moves agree, so acceptance and halting pass along these
steps (Turing.MultiTapeATM.acceptsWithin_add_iff_of_next_eq,
Turing.MultiTapeATM.haltsWithin_add_iff_of_next_eq).
Main definitions #
Turing.MultiTapeATM.ofTMs: the alternating machine of a deterministic machine for each move.Turing.MultiTapeATM.HaltsWithin: every list of moves reaches a halted configuration.Turing.MultiTapeATM.GuessVerify.guess: the guessing machine.Turing.MultiTapeATM.guessVerify: the guess-then-verify machine.
Main results #
Turing.MultiTapeATM.acceptsWithin_add_iff_of_next_eq,Turing.MultiTapeATM.haltsWithin_add_iff_of_next_eq: moves that do not matter.Turing.MultiTapeATM.GuessVerify.haltsWithin_lift_tag: halting through the guessing phase.Turing.MultiTapeATM.GuessVerify.acceptsWithin_lift_none,Turing.MultiTapeATM.GuessVerify.haltsWithin_lift_none: the verifying phase.Turing.MultiTapeATM.GuessVerify.prepare_spec: the preparing phase.
References #
Alternating machines from deterministic machines #
The alternating machine whose move b is a step of the deterministic machine tm b, with
universal states universal.
Instances For
The move b of ofTMs tm universal is a step of tm b.
The initial configuration of ofTMs tm universal is that of tm false.
Halting within a number of moves #
Every list of n moves from c reaches a halted configuration.
Instances For
Within no moves, only a halted configuration halts.
Halting within n + 1 moves is halting within n after either move.
A time bound is halting within as many moves from the initial configuration.
Along steps of f whose two moves agree, halting moves forward.
Moves that do not matter #
A configuration whose two moves agree accepts within n + 1 moves exactly when the common
successor accepts within n.
Along steps of f whose two moves agree, acceptance moves forward.
The guessing machine #
The states of the guessing machine: at a tag cell, or at a cell receiving a move, with the
label of the player of the next move (true for universal).
- tag (universal : Bool) : GuessState
- move (universal : Bool) : GuessState
Instances For
Instances For
The guessing machine with move b on work tape B: at a cell true it moves right to the
next cell, which receives the move b, and the player alternates; at any other cell it halts.
Instances For
A configuration with the word w on tape B and its head at pos, every other work tape
blank with its head at 0, the input head at the start and no output.
Instances For
At a tag true, the guessing machine moves right to the cell of the move.
At the cell of a move, the guessing machine writes its move, moves right, and the other player is to move.
Guess, then verify #
Rewind tape B, then run verify.
Instances For
The deterministic machine of the move b: run prep, guess with the move b, rewind tape
B and run verify.
Instances For
The universal states of the guess-then-verify machine: the cells of the moves of the universal player.
Instances For
The guess-then-verify machine: it prepares tape B by prep, writes the moves of the two
players, alternately, over the second cells of the pairs true, true that follow the tape's
initial pairs, rewinds tape B and runs verify.
Instances For
Outside the cells of the moves, the two moves agree.
A configuration of the guessing machine, as a configuration of the guess-then-verify machine.
Instances For
In the guessing phase, the move b is a step of the guessing machine with the move b.
At the terminator of the frame, the guessing phase ends.
At the tag of a pair, the head moves to its second cell.
The second cell of a pair receives the move.
The guessing phase halts within 2 * r + 1 + n moves from the tag of the first of r pairs
true, true exactly when every way of writing the r moves ends the guessing phase in a
configuration halting within n moves.
The configurations after the guessing phase are never at the cell of a move.
After the guessing phase, the machine rewinds tape B and runs verify.
The configurations reached by the deterministic machine of the move false agree with those of
every move, outside the moves.
The verifying phase. After the guessing phase, with the word w on tape B, if verify
halts within t steps on w, the machine accepts within pos + 2 + t moves exactly when the
output of verify is [true].
The verifying phase halts. After the guessing phase, with the word w on tape B, if
verify halts within t steps on w, every list of pos + 2 + t moves reaches a halted
configuration.
The preparing phase. If prep halts at step u with the word w on tape B and every
other work tape blank, then from the initial configuration the machine reaches the start of the
guessing phase in u moves that do not matter.