A machine that rewinds a work-tape head #
A machine that moves the head of its work tape to the left end of its contents and halts. It optionally writes a certain symbol to or clears the cells it moves over while traveling to the left. The input tape is not modified. This machine can be run between two phases of a computation to re-normalise a work-tape head without disturbing anything else.
In its initial state start the machine takes one unconditional step left, into state scan. In
state scan it walks left over symbols, writing write to every cell it leaves; on the first
blank it moves the head right and halts. By default write is none and the machine writes
nothing; with write := some none it erases the part of the word it walks over.
This is a one-tape machine; to rewind tape i of a k-tape machine, place it there with
Turing.MultiTapeTM.tapeEmb and transport its run with
Turing.MultiTapeTM.runFrom_tapeEmb. The input head, the output and every other tape are then
untouched by construction.
Main results #
Turing.MultiTapeTM.rewindWork: the one-tape machine that rewinds its head to the start of its word.Turing.MultiTapeTM.runFrom_rewindWork: its run from the initial state, with the special casesTuring.MultiTapeTM.runFrom_rewindWork_none(nothing is written) andTuring.MultiTapeTM.runFrom_rewindWork_erase(the whole word is erased).Turing.MultiTapeTM.workTapePos_runFrom_rewindWork: the rewound head stays within[-1, p].
The control states of the work-tape-rewinding machine: start takes one unconditional step
left, scan walks left towards the start of the word.
- start : RewindWorkState
- scan : RewindWorkState
Instances For
The one-tape rewinding machine. In state start it moves its head left, unconditionally, and
enters state scan. In state scan it writes write over a symbol and moves left, staying in
scan; on the first blank it moves right and halts. The input head never moves and nothing is
ever output.
Instances For
The run of the one-tape machine that rewinds its head. Started with the tape holding a word
w and the head at a position p ≤ w.length — inside the word or at the frontier just past it —
after p + 2 steps the machine has halted with the head back at position 0, write applied to
the cells 0, …, p - 1 and nothing else changed.
Rewinding without writing changes nothing but the position of the head.
Rewinding while erasing from the frontier of the word leaves the tape blank.
At every step, the head is within [-1, p]: it walks from its start p ≤ w.length down to
-1 and back to 0, where it stays.