Moving words between the ends of tapes #
Small native machines that move a word along its tape or between two tapes, specified by runs
between Turing.tapesCfg configurations (Turing.MultiTapeTM.RunsBetween), so that the words may
sit anywhere on their tapes. They implement a stack kept on a tape that grows to the left.
Main definitions #
Turing.MultiTapeTM.seekEnd: move the head from the first cell of a word to the cell after it.Turing.MultiTapeTM.copyBack: move a word, read from its end, to the front of the word on a second tape.Turing.MultiTapeTM.eraseFrame: erase a framed word (Turing.MultiTapeTM.frame) at the front of a tape.Turing.MultiTapeTM.popFrame: move a framed word at the front of a tape to a blank second tape, prefixed by[true, true], or write[false]there if the first tape is blank.
Main results #
Turing.MultiTapeTM.runsBetween_seekEnd,Turing.MultiTapeTM.runsBetween_copyBack,Turing.MultiTapeTM.runsBetween_eraseFrame,Turing.MultiTapeTM.runsBetween_popFrame_nil,Turing.MultiTapeTM.runsBetween_popFrame_frame: their runs, in time linear in the words moved.
Shifted words #
Writing after the end of a shifted word appends to it.
Erasing the first cell of a shifted word drops its first letter.
Erasing the last cell of a shifted word drops its last letter.
Writing before the first cell of a shifted word prepends to it.
The first letter of a shifted word, read at its first cell.
The cell before a shifted word is blank.
Moving the head to the end of a word #
Moves the head of its only tape right until it reads a blank.
Instances For
Moving a word to the front of another #
The states of Turing.MultiTapeTM.copyBack.
- first : CopyBackState
Step both heads left.
- loop : CopyBackState
Move one letter.
Instances For
Started with the head of tape 0 on the cell after a word and the head of tape 1 on the
first cell of another, moves the first word letter by letter, from its end, to the front of the
second, erasing it, and halts with both heads on the first cells of their words.
Instances For
Erasing a framed word #
The states of Turing.MultiTapeTM.eraseFrame.
- loop : EraseFrameState
At the start of a pair, or at the final
false. - bit : EraseFrameState
At the second cell of a pair.
Instances For
Erases the framed word at the head of its only tape, moving right, and halts on the cell after it.
Instances For
Popping a framed word #
The states of Turing.MultiTapeTM.popFrame.
- start : PopFrameState
Reading the first cell of tape
0. - pre : PopFrameState
Writing the second
trueof the prefix. - loop : PopFrameState
At the start of a pair, or at the final
false. - bit : PopFrameState
At the second cell of a pair.
Instances For
If tape 0 is blank under its head, writes false at the head of tape 1. Otherwise writes
[true, true] and then moves the framed word at the head of tape 0 there, erasing it. Both
heads move right as they go. The specifications below start with a blank tape 1; the loop
Turing.MultiTapeTM.runFrom_popFrame_loop appends to any word ending before the head.