Repeating a machine while the input head reads a symbol #
whileInput tm reads the symbol under the input head and halts if it is blank; otherwise it runs
tm and repeats. A body that consumes the input from left to right, leaving the input head after
what it read (Turing.MultiTapeTM.TransformsTapesAt), is thus run until the input is used up.
Main definitions #
Turing.MultiTapeTM.inputSymbolAt: the symbol at a position of the input.Turing.MultiTapeTM.whileInput: the loop.
Main results #
Turing.MultiTapeTM.transformsTapesAt_whileInput: a loop invariant preserved by every round gives a specification ofwhileInput tm, with the times of the rounds adding up.
From check, the machine halts if the input head reads a blank and otherwise starts tm,
moving no head. Each round of tm returns to check.
Instances For
A move to the left stops at the blank before the input.
A move to the right stops at the blank after the input.
Let P n be a loop invariant after n rounds, on the input position, the words on the tapes
and the word emitted so far. If each round n < rounds starts on a symbol of the input and takes
P n to P (n + 1) within t n steps and s cells, and P rounds implies that the input head
is on a blank and that R holds, then whileInput tm takes P 0 to R.