Configurations of Multi-Tape Turing Machines #
Configurations of a multi-tape Turing machine with a read-only input tape, k work tapes and one
write-only output tape, together with what a single transition does to a configuration.
Design #
Nothing here mentions a machine. A step is described in two parts: an Action, recording
which way the input head moves, what is written and where the work heads move, which symbol is
emitted and which state follows; and Action.apply, which carries it out on a
configuration.
The output tape is part of the configuration, so the string emitted along a run can be read off the configuration the run ends in.
Important Declarations #
Cfg: the configuration: the internal state, the tape contents and head positions, and the output tapeAction: what a machine does in one stepAction.apply: the effect of one action on a configurationCfg.Halted,Cfg.init: halting, and the configuration a machine starts intapeOfList,wordsCfg: tapes and configurations holding given words
The configurations of a Turing machine is relative to the input of the machine and consist of:
- an
Optional state (or none for the halting state), - the position of the input head (shifted by one),
- the contents of the work tape,
- the positions of the work tape heads,
- the contents of the write-only output tape
- state : Option State
the state of the TM (or none for the halting state)
the position of the input head, shifted by one
the work tapes
the positions of the heads on the work tapes
- output : List Symbol
the contents of the write-only output tape
Instances For
Equations
- Turing.instInhabitedCfg = { default := Turing.instInhabitedCfg.default }
Two configurations of a machine without work tapes are equal if their states, input head positions and outputs are equal.
Attempt to move the input tape head. The machine can only read one empty cell outside of the input, any attempted movement beyond that results in no movement.
The addition is performed in ℤ before clamping. Performing it in Fin (n + 2) would wrap an
outward boundary move to the opposite end of the input.
Equations
Instances For
A left move away from the left input boundary decrements the native input position.
The symbol read by work tape i.
Equations
- cfg.workTapeSymbols i = cfg.workTapes i (cfg.workTapePos i)
Instances For
The same configuration in a different control state, possibly of a different state type.
Equations
Instances For
Remap the (optional) state of a configuration through φ, leaving the input head, the work
tapes, the work-tape heads and the output alone. This is the shape of embedding used to place a
sub-machine's configurations into a larger machine built from it.
Equations
- Turing.Cfg.mapState φ c = { state := φ c.state, inputPos := c.inputPos, workTapes := c.workTapes, workTapePos := c.workTapePos, output := c.output }
Instances For
A tape containing exactly the symbols of xs at positions 0, ..., xs.length - 1.
Equations
- Turing.tapeOfList xs (Int.ofNat n) = xs[n]?
- Turing.tapeOfList xs (Int.negSucc a) = none
Instances For
Appending one symbol writes precisely the cell after the existing word.
The blank tape holds the empty word.
The cell at position 0 holds the first symbol of the word.
The configuration whose work tape i holds exactly the word ws i with its head at the
start, whose input head is at the start of the input, in state q with output out.
Equations
- Turing.wordsCfg input q ws out = { state := q, inputPos := 1, workTapes := fun (i : Fin k) => Turing.tapeOfList (ws i), workTapePos := fun (x : Fin k) => 0, output := out }
Instances For
Remapping the state of a wordsCfg remaps its state and leaves the words alone.
The effect of an action on a configuration: move the input head, write and move on the work tapes, append the emitted symbol to the output tape, and go to the successor state. This is the part of a step that does not depend on how the action was chosen.
Equations
- One or more equations did not get rendered due to their size.