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: the loop.
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.
From check, the machine halts unless c holds of the symbols under the input head and the
work-tape heads, and otherwise starts tm, moving no head. Each round of tm returns to
check.
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.