Repeating a machine while a condition holds #
whileCond c tm reads the symbols under its heads and halts unless the condition c holds of them;
otherwise it runs tm and repeats. Unlike Turing.MultiTapeTM.repeatUntilBlank, the rounds may
leave the input head anywhere (Turing.MultiTapeTM.TransformsTapesAt), so the loop can drive a
two-way input head.
Main definitions #
Turing.MultiTapeTM.WhileCond.condTest: the test of the condition.Turing.MultiTapeTM.whileCond: the loop,tmcombined with the test.
Main results #
Turing.MultiTapeTM.transformsTapesAt_whileCond: a loop invariant preserved by every round gives a specification ofwhileCond c tm, with the times of the rounds adding up.
The test of the condition c: it halts unless c holds of the symbols under the input head
and the work-tape heads, and otherwise stays in its only state, moving no head.
Instances For
tm combined with the test of c, which it starts with: the test halts the loop unless c
holds and otherwise starts tm, and halting of tm returns to the test.
Instances For
The condition c on the configuration with the input head at p and the words ws on the
work tapes, read at the start of each word.
Instances For
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 with the condition holding and takes
P n to P (n + 1) within t n steps and s cells, and P rounds implies that the condition
fails and that R holds, then whileCond c tm takes P 0 to R.