Repeating a probabilistic oracle machine until a tape goes blank #
repeatUntilBlank i body runs body repeatedly. After each round it reads the cell under the
head of work tape i, without moving a head, and halts if that cell is blank. Every round of a
Turing.MultiTapePTM.RunsWords specification ends with all heads on the first cells of their
words, so the loop stops exactly when the word on tape i is empty. The body always runs at least
once. Rounds may halt at random times; the remaining rounds start from the halted configuration,
with its tapes, oracle channels and external oracle state.
Main definitions #
Turing.MultiTapePTM.repeatUntilBlank: the looping machine.Turing.MultiTapePTM.RepeatUntilBlank.fromCheck: the same transition table started at its test.
Main results #
Turing.MultiTapePTM.RunsWords.repeatUntilBlank_round: one round followed by the remaining loop.Turing.MultiTapePTM.RunsWords.repeatUntilBlank:roundsrounds governed by an invariant runOracleComp.iterate rounds stepwithinrounds * (t + 1)steps, preserving the joint law of the tape words and the external oracle state.
References #
Adapts cslib's Plumbing/RepeatUntilBlank, by Christian Reitwiessner, to probabilistic oracle
machines and the joint stateful semantics of Turing.MultiTapePTM.RunsWords.
Clocked runs compose by sequencing their programs.
Embed an action of the repeated machine, sending its halt to the blank test.
Instances For
The blank test: halt if the cell under the head of work tape i is blank, and otherwise
restart at initial, moving no head and writing nothing.
Instances For
body, with its halting transitions sent to a test of the cell under the head of work tape
i: a blank cell halts the loop, and any other cell restarts body.
Instances For
The loop's transition table, started at its blank test.
Instances For
A configuration of the repeated machine as one of the loop: a live state q becomes run q
and the halted state becomes the blank test.
Instances For
Starting at the test changes only the initial state, not the clocked program.
While the repeated machine is live, one loop instruction mirrors its complete program.
The loop runs a clocked phase of body and then continues from its configuration, even when
body halts at a random time: an early halt reaches the blank test early, and the extra time is
absorbed because the remaining loop halts within its own clock.
Such an instruction also leaves every oracle channel unchanged.
At the blank test on an empty word, the loop halts after one instruction.
At the blank test on a non-empty word, the loop restarts its body after one instruction.
One round of body, followed by the loop started at its blank test. The round's final tape
words and emitted output must determine its program value.
A loop of rounds + 1 rounds. Round n < rounds runs step s from the words ws s of a
state s satisfying invariant n s, and leaves a non-empty word on tape i; the last round runs
last s and leaves tape i empty. The loop then runs OracleComp.iterate rounds step followed by
last within (rounds + 1) * (t + 1) steps, preserving the joint law of the tape words and the
external oracle state, and emits nothing.