Nondeterministic Multi-Tape Turing Machines #
Defines nondeterministic Turing machines with a read-only input tape, k work tapes and one
write-only output tape, their computation paths, and time bounds.
Design #
The design choices for configurations and actions are documented in
Cslib.Computability.Machines.Turing.MultiTape.Configuration.
Following [Pap94], chapter 2.7, a nondeterministic machine is a Turing machine whose
transition function is replaced by a transition relation: Tr q input work action holds when Tr
relates the state q and the read symbols input and work to action.
A halted configuration steps to itself, so once a machine has halted it has a run of every length. A time bound is therefore an upper bound, with no separate account of the step at which it halted.
The transition relation may be empty at a running configuration. Such a configuration has no successor configuration and is called stuck.
Time bounds apply to every computation path, regardless of its outcome. RunsInTime input t
requires every path of at least t steps to end in a halted configuration.
Important Declarations #
MultiTapeNTM: the machine, an initial state and a transition relationStep: the one-step relation on configurationsRunPath: finite relation series of stepsComputationPath: a run path starting at the initial configurationAdapter,Follows: a machine follows another when it performs each of its transitions, reading and acting through an adapterFollows.step,Follows.runningStepHom,Follows.stepHom: a configuration map that agrees with the adapter maps steps to steps, so it is a homomorphism of step relations and maps run pathsRunsInTime: every computation path of at least the given length ends in a halted configuration
References #
A nondeterministic multi-tape Turing machine with k work tapes over the alphabet of
Option Symbol (where none is the blank symbol). Neither Symbol nor State is required to be
finite.
- q₀ : State
initial state
- Tr (q : State) (input : Option Symbol) (work : Fin k → Option Symbol) (action : Action k Symbol State) : Prop
transition relation: which combinations of state, current input symbol, tuple of work head symbols and resulting actions are valid transitions
Instances For
The one-step relation on configurations. A halted configuration steps only to itself. A running
configuration steps by applying any action related to its state and read symbols by Tr.
Equations
- ntm.Step c₁ c₂ = match c₁.state with | none => c₂ = c₁ | some q => ∃ (action : Turing.Action k Symbol State), ntm.Tr q c₁.inputSymbol c₁.workTapeSymbols action ∧ c₂ = action.apply c₁
Instances For
The initial configuration corresponding to an input string.
Equations
- ntm.initCfg input = Turing.Cfg.init ntm.q₀ input
Instances For
The one-step relation on configurations for input, as a set of pairs.
Equations
Instances For
The steps of ntm from running configurations: the steps within a run until it halts.
Equations
Instances For
A nonempty list of configurations joined by steps of ntm.
Instances For
A run path mapped along a step-preserving map of configurations: RelSeries.map, typed as a
run path of the target machine.
Equations
- p.map f = RelSeries.map p f
Instances For
Once a run path is halted, its configuration stays unchanged.
A path that ends halted runs from its head to its last configuration in running steps, up to its first halted configuration.
A run path starting at the initial configuration for input.
- toFun : Fin (self.length + 1) → Turing.Cfg k Symbol State input
the path starts at the initial configuration
Instances For
The number of steps taken by a computation path.
Equations
Instances For
Every computation path on input of at least t steps ends in a halted configuration.
A path ending in a stuck configuration must have fewer than t steps.
Equations
- ntm.RunsInTime input t = ∀ (p : ntm.ComputationPath input), t ≤ p.time → p.last.Halted
Instances For
A time bound can be increased.
Following a machine #
How a machine with k' work tapes and states State' performs the transitions of a machine
with k work tapes and states State. A transition turns the symbols under the heads into an
action, so the outer machine translates both ends: read computes the symbols the inner machine
reads from those under the outer heads, and action turns the inner action into an outer one,
which may also depend on the outer symbols.
- read : HeadSymbols k' Symbol → HeadSymbols k Symbol
the symbols the inner machine reads
- action : HeadSymbols k' Symbol → Action k Symbol State → Action k' Symbol State'
the outer action performing an inner action
Instances For
The adapter that relabels the states through φ and reads and acts on the same tapes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ntm' follows ntm through adapter, in state state q while ntm is in state q: whatever
ntm may do in q on what adapter reads, ntm' may do the adapted action in state q.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A follower mirrors a step. If ntm' follows ntm, and the map f relabels the state of
c through state, reads through adapter what c reads, and carries the action of a step from
c to its adaptation, then f maps the step to a step of ntm'.
A follower mirrors the running steps. If ntm' follows ntm, and f sends a configuration
in state q to one in state state q, from which adapter reads what the configuration reads and
on which each adapted action acts as the action acts on the configuration, then f maps each
running step of ntm to a step of ntm'.
Equations
- h.runningStepHom f hstate hread haction = { toFun := f, map_rel' := ⋯ }
Instances For
A follower mirrors the steps. As runningStepHom, for an f that relabels every state
through state, so that it also keeps halted configurations halted.
Instances For
A machine never reads its output tape, so prepending a word to the output preserves steps.
Equations
- ntm.prependOutputHom pre = Turing.MultiTapeNTM.Follows.stepHom ⋯ (fun (x : Turing.Cfg k Symbol State input) => x.prependOutput pre) ⋯ ⋯ ⋯