Reading the input from a word on a work tape #
The additions of cslib PR #1111 to
Cslib.Computability.Machines.Turing.MultiTape.Plumbing.InputFromTape.
inputFromWord M mark reads the input from a word on the virtual input tape, with blank work tapes
around it. It runs three machines in sequence:
markFlag k (some mark)writesmarkto cell-1of the flag tape;inputFromTape MrunsMon the virtual input tape;markFlag k noneerases the mark again.
Main definitions #
Turing.MultiTapeTM.inputFromWord: the machine reading its input from a word on a work tape.
Main results #
Turing.MultiTapeTM.ComputesTidilyInTimeAndSpace.inputFromWord_extendTapes: run on a selected input tape, preserving it and emitting the output.Turing.MultiTapeTM.transformsTapes_inputFromWord: a run path ofMon the virtual input word, from and toTuring.wordsCfgconfigurations, gives a specification ofinputFromWord M mark;Turing.MultiTapeTM.transformsTapes_inputFromWord_of_runFromis the same for a run ofM.
Setting and erasing the flag #
markWork write placed on the flag tape, the last of k + 2 work tapes: it writes write to
the cell left of the head of that tape.
Instances For
M, reading its input from a word on the virtual input tape Fin.natAdd k 0, with mark
written to cell -1 of the flag tape, the last work tape, before and erased after.
Instances For
Turing.MultiTapeTM.inCfg of a wordsCfg configuration: the input w on the virtual input
tape, mark at cell -1 of the flag tape, every head at cell 0.
If M, run on the input w with work tapes ws₀, has a run path of at most t steps and s
cells to the halting configuration with work tapes ws₁, every head back at its start, having
emitted e, then inputFromWord M mark takes the work tapes Fin.append ws₀ ![w, []] to
Fin.append ws₁ ![w, []] and emits e.
If M, run on the input w with work tapes ws₀, halts after t steps with work tapes ws₁
and every head back at its start, having emitted e, then inputFromWord M mark takes the work
tapes Fin.append ws₀ ![w, []] to Fin.append ws₁ ![w, []] and emits e.
The work tapes in which inputFromWord starts and halts, for a tidy machine.
A tidy machine run on the word on a work tape, emitting what it computes.
Run a tidy computation on a selected input tape, preserving it and emitting the output.