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.
The configurations are used by both deterministic and nondeterministic multi-tape Turing machines
and give instantaneous descriptions of their state. An Action describes how one configuration
transitions to the next. It records which way the input head moves, what is written and where the
work heads move, which symbol is emitted and which state follows. Action.apply carries out the
action on a configuration.
Design #
Configurations and actions are defined independently of a machine.
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. An action can optionally output one symbol, which models the write-only output tape.
The input head can move freely on the input, but any move attempt beyond one cell outside the input results in no movement. Restricting the movement of the input head is not essential, but useful because it allows us to easily bound the number of possible configurations of a space-bounded machine. Most textbooks have this restriction.
This definition is adapted from the one in [Pap94a], chapter 2.3 including the sub-linear space modifications from chapter 2.5 with the following changes:
- We allow Turing machines to choose to not write on a tape. This is equivalent to writing the read symbol again but makes it easier to reason about the semantics.
- Our tapes are infinite in both directions instead of just to the right. This definition is equivalent (see [AB09], Claim 1.4). It saves us from having to add a "start marker" to the alphabet.
- We only have a single halting state. The different ways to halt (accepting, rejecting, etc) can be distinguished based on the output.
- The input-head restriction is enforced by
Action.apply, rather than by restricting the transition relation. The two definitions are equivalent, but allowing all actions makes it easier to define a universal machine.
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 in
References #
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
Two configurations with no work tapes are equal when their state, input head and output agree.
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.
Instances For
A left move away from the left input boundary decrements the native input position.
The input head moves by at most one position.
The same configuration with a word prepended to the output tape. A machine never reads its
output, so prepending to it preserves steps: cf. Turing.MultiTapeNTM.prependOutputHom.
Instances For
Forget the control state of a configuration, keeping the input head, the work tapes, the work-tape heads and the output. A property of this part of a configuration makes sense for every machine, whatever its state type.
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. Control-flow combinators such as seq embed a
sub-machine's configurations into the combined machine by exactly such a state remap.
Instances For
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.