Deterministic multi-input multi-tape Turing machines #
Defines deterministic Turing machines with i two-way read-only input tapes, w work
tapes and one write-only output tape — the machine model of MIP* = RE's normal form
verifiers (a decider is a 5-input Turing machine; blueprint def:decider).
This file generalizes the vendored CSLib development
(MIPRE.Cslib.Computability.Machines.Turing.MultiTape.Deterministic, upstream
Turing.MultiTapeTM) from one input tape to i of them, declaration for declaration and
under the same names; Turing.MultiTapeTM is exactly the case i = 1 (the exact
correspondence is proved in MIPRE.TM.MultiInput.OneInputEquiv). All conventions are
inherited:
- tape symbols are
Option Symbol, withnonethe blank symbol; - each input head moves freely on its own input, clamped one cell beyond either end
(
Turing.moveInputPosis reused unchanged, one input tape at a time); - the transition can optionally write and move on every work tape, and optionally emit one output symbol;
- halting is the absent successor state (
none), and halted configurations are fixed points ofstep; - space usage counts the work-tape cells visited by the heads; the input and output tapes are ignored for space.
Native multiple input tapes (rather than packing several inputs onto one tape by
concatenation) keep the paper's per-input time bounds honest: accessing one input never
costs time proportional to the lengths of the others. See
planning/tm-infrastructure.md (Milestone A) for the design record.
Important declarations #
MultiInputTM: the machineMultiInputTM.Cfg: configurations, relative to the tuple of inputsMultiInputTM.step,MultiInputTM.configs: one step, and the step-indexed runMultiInputTM.outputString: the output emitted during the firsttstepsMultiInputTM.spaceUsed: the number of work-tape cells visited up to a stepMultiInputTM.TransitionRelation: the relational view ofstep, tied to the iterated view byrelatesInSteps_iff_configs_eqMultiInputTM.haltsAtStep,MultiInputTM.halting_step_unique: the exact halting step
The resource-bound packaging (ComputesInTimeAndSpace, ComputesFunWithBounds) is in
MIPRE.TM.MultiInput.Complexity.
The output of the transition function of a multi-input Turing machine.
The movement (attempt) of each input head.
Actions on the work tapes: optionally a symbol to write and the head movement.
- outS : Option Symbol
An optional symbol to output.
- q' : Option State
The successor state or
noneto halt.
Instances For
A deterministic Turing machine with i two-way read-only input tapes and w work tapes
over the alphabet Option Symbol (where none is the blank symbol). Note that it is not
required that Symbol or State are finite; finiteness enters only with the canonically
coded machines of MIPRE.TM.Code.
- q₀ : State
initial state
- tr (q : State) (inputs : Fin i → Option Symbol) (work : Fin w → Option Symbol) : TransitionOut i w Symbol State
transition function, mapping a state, the tuple of symbols under the input heads and the tuple of symbols under the work heads to a movement for each input head, actions on the work tapes, optionally a symbol to output and the successor state
Instances For
Configurations #
This section defines the configurations of a multi-input Turing machine, the step function
that lets the machine transition from one configuration to the next, the resulting
sequence of configurations and the initial configuration. Input-head movement reuses
Turing.moveInputPos from the vendored CSLib file, one input tape at a time.
The configurations of a multi-input Turing machine are relative to the tuple of inputs of the machine and consist of:
- an
Optional state (ornonefor the halting state), - the position of each input head (shifted by one),
- the contents of the work tapes,
- the positions of the work tape heads.
- state : Option State
the state of the machine (or
nonefor the halting state) the position of each input head, shifted by one
the work tapes
the positions of the heads on the work tapes
Instances For
The tuple of symbols under the input heads.
Equations
- cfg.inputSymbols j = cfg.inputSymbol j
Instances For
The symbol read by work tape d.
Equations
- cfg.workTapeSymbols d = cfg.workTapes d (cfg.workTapePos d)
Instances For
The step function corresponding to a MultiInputTM.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The symbol (optionally) output when executing one step starting from configuration
cfg.
Equations
- Turing.MultiInputTM.outputSymbol cfg = match cfg.state with | none => none | some q => (tm.tr q cfg.inputSymbols cfg.workTapeSymbols).outS
Instances For
The initial configuration corresponding to a tuple of input strings.
Equations
Instances For
The sequence of configurations of the Turing machine starting from cfg.
If the Turing machine halts, it will stay at the halting configuration.
Equations
Instances For
Running a + b steps equals running b steps from the configuration reached after
a.
The sequence of configurations from a halting state is constant.
Each work-tape head moves by at most one cell in a single step.
Space usage #
The set of positions visited by the head of work tape d in the computation starting
from configuration cfg up to step t.
Equations
- Turing.MultiInputTM.visitedByTapeHead cfg t d = Finset.image (fun (t' : ℕ) => (Turing.MultiInputTM.configs cfg t').workTapePos d) (Finset.range (t + 1))
Instances For
The number of work tape cells touched by the head of tape d in the computation starting
from configuration cfg up to step t.
Equations
- Turing.MultiInputTM.spaceUsedByTape cfg t d = (Turing.MultiInputTM.visitedByTapeHead cfg t d).card
Instances For
The number of work tape cells touched by a computation starting from configuration cfg
up to step t.
Equations
- Turing.MultiInputTM.spaceUsed cfg t = ∑ d : Fin w, Turing.MultiInputTM.spaceUsedByTape cfg t d
Instances For
A machine without work tapes uses zero space.
Each tape's space usage is bounded by the total space used.
The TransitionRelation corresponding to a MultiInputTM i w Symbol State is defined by
the step function, which maps a configuration to its next configuration.
Equations
- Turing.MultiInputTM.TransitionRelation c₁ c₂ = (Turing.MultiInputTM.step c₁ = c₂)
Instances For
The string output by the Turing machine tm starting in configuration cfg₀,
executing for t steps. It is the concatenation of the symbols (optionally) emitted at
each of the first t steps.
Equations
- tm.outputString cfg₀ t = List.flatMap (fun (t' : ℕ) => (Turing.MultiInputTM.outputSymbol (Turing.MultiInputTM.configs cfg₀ t')).toList) (List.range t)
Instances For
The output produced in t + 1 steps is the output produced in t steps followed by
the symbol (optionally) emitted at step t.
The output does not change after the machine has halted.
This lemma translates between the relational notion and the iterated step notion. The latter can be more convenient especially for deterministic machines as we have here.
The Turing machine tm halts after exactly t steps on input tuple input if its
state is none at step t and non-none at step t - 1.
Note that every Turing machine has to perform at least one step to halt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If a Turing machine halts, the time step is uniquely determined.
If a deterministic machine repeats a non-halting configuration, it never halts,
because the sequence between the two configurations will loop forever.
Note that this can be applied to two arbitrary and different time steps t and t + Δ
using tm.configs_add.