159 Complexity — Deterministic
159.1 Overview
This module defines deterministic multi-tape Turing machines with a read-only input tape, \(k\) work tapes, and a write-only output tape, together with their step semantics: the one-step transition on configurations, the configuration reached after \(t\) steps, and the halting behaviour. Space usage is measured as the total number of work-tape cells visited by the heads, and on top of the run semantics the module defines what it means for a machine to compute an output, a function, or the indicator of a set within given time and space bounds, including monotonicity of these notions in the bounds and uniqueness of the halting time.
159.2 Declarations
A deterministic Turing machine with a read-only input tape, \(k\) work tapes, and a write-only output tape, over an alphabet of symbols extended by a blank. It consists of an initial state \(q_0\) and a transition function that, given the current state, the (possibly blank) symbol under the input head, and the \(k\) symbols under the work-tape heads, returns a one-step action: a movement of the input head, a write-and-move instruction for each work tape, an optional symbol to append to the output, and a successor state or the decision to halt. Neither the alphabet nor the state set is required to be finite.
The successor of a configuration \(c\) of a multi-tape Turing machine \(M\): if \(c\) is halted (its state component is empty), the step returns \(c\) unchanged; otherwise it applies to \(c\) the action that the transition function of \(M\) prescribes for the current state, the symbol under the input head, and the symbols under the \(k\) work-tape heads.
The symbol, if any, that a multi-tape Turing machine \(M\) appends to its output tape when executing one step from a configuration \(c\): the optional output component of the action prescribed by the transition function for the current state and scanned symbols, and no symbol at all when \(c\) is halted.
The starting configuration of a multi-tape Turing machine \(M\) on an input word: the machine is in its initial state \(q_0\), the input head is at the first input symbol, all work tapes are blank with heads at the origin, and the output is empty.
Let \(M\) be a multi-tape Turing machine and \(c\) a configuration whose state component is empty (the machine has halted). Then one computation step of \(M\) leaves \(c\) unchanged.
The configuration reached by iterating the one-step function of a multi-tape Turing machine \(t\) times starting from a configuration \(c\). Since halted configurations are fixed points of the step function, a machine that halts stays in its halting configuration.
For every multi-tape Turing machine \(M\) and configuration \(c\), running \(M\) for \(0\) steps from \(c\) yields \(c\) itself.
For every multi-tape Turing machine \(M\), configuration \(c\), and \(t \in \mathbb {N}\), running \(M\) for \(t + 1\) steps from \(c\) equals running \(M\) for \(t\) steps from the configuration obtained by one step of \(M\) from \(c\).
For every multi-tape Turing machine \(M\), configuration \(c\), and \(t \in \mathbb {N}\), running \(M\) for \(t + 1\) steps from \(c\) equals applying one step of \(M\) to the configuration reached after running \(M\) for \(t\) steps from \(c\).
For every multi-tape Turing machine \(M\), configuration \(c\), and \(a, b \in \mathbb {N}\), running \(M\) for \(a + b\) steps from \(c\) equals running \(M\) for \(b\) steps from the configuration reached after \(a\) steps from \(c\).
Let \(M\) and \(M'\) be multi-tape Turing machines over the same alphabet, with \(k\) and \(k'\) work tapes and running on inputs \(x\) and \(x'\) respectively, and let \(f\) map configurations of \(M\) to configurations of \(M'\) so that one step of \(M'\) after \(f\) agrees with \(f\) after one step of \(M\) on every configuration. Then for every configuration \(c\) of \(M\) and every \(n \in \mathbb {N}\), running \(M'\) for \(n\) steps from \(f(c)\) yields the image under \(f\) of the configuration \(M\) reaches in \(n\) steps from \(c\).
Let \(M\) be a multi-tape Turing machine and \(c\) a configuration whose state component is empty (the machine has halted). Then running \(M\) for any number of steps from \(c\) yields \(c\) itself.
Let \(M\) be a multi-tape Turing machine and \(c\) a configuration whose state component is empty. Then the step of \(M\) from \(c\) emits no output symbol.
Let \(M\) be a multi-tape Turing machine with \(k\) work tapes, \(c\) a configuration, and \(i\) one of the \(k\) work-tape indices. Then the position of the \(i\)-th work-tape head after one step of \(M\) from \(c\) differs from its position in \(c\) by at most \(1\) in absolute value.
The finite set of integer positions occupied by the head of work tape \(i\) during the computation of a multi-tape Turing machine from a configuration \(c\), over steps \(0\) through \(t\) inclusive.
The number of distinct work-tape cells touched by the head of work tape \(i\) in the computation of a multi-tape Turing machine from a configuration \(c\) up to step \(t\), i.e. the cardinality of the set of positions visited by that head.
The total number of work-tape cells touched by the computation of a multi-tape Turing machine with \(k\) work tapes from a configuration \(c\) up to step \(t\): the sum over the \(k\) work tapes of the number of distinct cells visited by each head. This is the space measure used throughout; the read-only input tape and the write-only output tape do not count.
Let \(M\) be a multi-tape Turing machine with \(k\) work tapes where \(k = 0\). Then for every configuration \(c\) and every step count \(t\), the total space used by \(M\) from \(c\) up to step \(t\) is \(0\).
For every multi-tape Turing machine \(M\), configuration \(c\), step count \(t\), and work-tape index \(i\), the number of cells touched by the head of tape \(i\) up to step \(t\) is at most the total space used by \(M\) from \(c\) up to step \(t\).
Let \(M\) be a multi-tape Turing machine, \(c\) a configuration, and \(t \in \mathbb {N}\). The total space used by \(M\) from \(c\) up to step \(t\) equals the space touched by the list of configurations that \(M\) traverses in steps \(0, 1, \dots , t\) from \(c\), where the space touched by a list of configurations is the sum over the work tapes of the number of distinct head positions occurring in the list.
For every multi-tape Turing machine \(M\) and configuration \(c\), the output component after one step of \(M\) from \(c\) equals the output of \(c\) followed by the symbol emitted by that step, if any (and equals the output of \(c\) unchanged when no symbol is emitted).
Let \(M\) be a multi-tape Turing machine, \(c\) a configuration, and \(\tau \le t\) natural numbers such that the configuration reached by \(M\) after \(\tau \) steps from \(c\) is halted. Then the output after \(t\) steps from \(c\) equals the output after \(\tau \) steps from \(c\).
The proposition that a multi-tape Turing machine \(M\), started in its initial configuration on an input word, is halted after \(t\) steps (hence halts within \(t\) steps, since halting is absorbing), that its output tape then holds exactly the given output word, and that the computation up to step \(t\) touches exactly \(s\) work-tape cells. Neither the alphabet nor the state set is required to be finite.
Given injective encodings of the domain and codomain into words over the machine’s alphabet, a multi-tape Turing machine \(M\) computes a function \(f\) within time bound \(t\) and space bound \(s\) (both functions of the input) if for every input \(a\) there are \(t' \le t(a)\) and \(s' \le s(a)\) such that \(M\), on the encoding of \(a\), halts within \(t'\) steps with output the encoding of \(f(a)\), touching exactly \(s'\) work-tape cells. The alphabet and state set need not be finite.
A function \(f\) is computable within input-indexed time bound \(t\) and space bound \(s\), with respect to injective encodings of its domain and codomain into binary words, if there exist a number \(k\) of work tapes, a finite state set, and a multi-tape Turing machine over the binary alphabet with those tapes and states that computes \(f\) between the given encodings within the bounds \(t\) and \(s\).
A function \(f\) is computable within time bound \(t\) and space bound \(s\), where \(t, s : \mathbb {N} \to \mathbb {N}\) are functions of the encoded input length, if there is a binary Turing machine with finitely many states that, for every input \(a\), computes the encoding of \(f(a)\) from the encoding of \(a\) in at most \(t(n)\) steps and touching at most \(s(n)\) work-tape cells, where \(n\) is the length of the encoding of \(a\).
Let \(M\) be a multi-tape Turing machine that computes a function \(f\) between given injective encodings within input-indexed time bound \(t\) and space bound \(s\), and let \(t'\) and \(s'\) be bounds with \(t(a) \le t'(a)\) and \(s(a) \le s'(a)\) for every input \(a\). Then \(M\) also computes \(f\) between the same encodings within the bounds \(t'\) and \(s'\).
Let \(f\) be a function computable within input-indexed time bound \(t\) and space bound \(s\) with respect to given binary encodings, and let \(t'\) and \(s'\) be bounds with \(t(a) \le t'(a)\) and \(s(a) \le s'(a)\) for every input \(a\). Then \(f\) is computable within the bounds \(t'\) and \(s'\) with respect to the same encodings.
The Boolean indicator function of a set \(L \subseteq \alpha \): the function mapping \(x\) to true when \(x \in L\) and to false otherwise.
A set \(L \subseteq \alpha \) is decidable within input-indexed time bound \(t\) and space bound \(s\), with respect to an injective binary encoding of \(\alpha \), if the Boolean indicator function of \(L\) is computable within these bounds, the one-bit answer being encoded as the single-symbol output word.
The Boolean predicate stating that a multi-tape Turing machine \(M\) on a given input halts after exactly \(t\) steps: started from its initial configuration, \(M\) is halted after \(t\) steps but not after \(t - 1\) steps (truncated subtraction). In particular the predicate is never true at \(t = 0\): a machine must perform at least one step to halt.
Let \(M\) be a multi-tape Turing machine and fix an input word. If \(M\) halts on that input after exactly \(t_1\) steps and also after exactly \(t_2\) steps, then \(t_1 = t_2\).
Let \(M\) be a multi-tape Turing machine and let \(c\) be a configuration that is not halted. If running \(M\) for \(t + 1\) steps from \(c\) returns to \(c\) itself, then the computation of \(M\) from \(c\) never halts: for every number of steps \(t'\), the configuration reached after \(t'\) steps from \(c\) is not halted.
159.3 Additional declarations
Let \(M\) be a multi-tape Turing machine on an input word \(x\), whose input-head position ranges over \(\{ 0, 1, \dots , |x| + 1\} \), and let \(c\) be a configuration of \(M\) with input-head position \(p\). Then for every \(t \in \mathbb {N}\), the input-head position in the configuration reached by running \(M\) for \(t\) steps from \(c\) is at most \(p + t\).