Read-only Turing machines

The goal of this article is to show that read-only Turing machines can only accept regular languages. The idea is to develop a "DP algorithm" to decide whether the Turing machine will accept that proceeds linearly from left to right and only remembers a finite amount of information.

Let:

Then this Turing machine recognizes some language LΣL \subseteq \Sigma_*, the set of all words for which the Turing machine reaches some accepted state. In order to prove that LL is regular, it suffices to construct another Turing machine that moves right in every step and also accepts LL.

Fast-forwarding procedure

Note that the configuration of the Turing machine at a given point in time can be encoded as a tuple (w,i,s)CΣ×N0×S(w, i, s) \in C \coloneqq \Sigma_* \times \mathbb{N}_0 \times S, where ii is the word on the band beginning at position 11, ii is the position of the head and ss is the current state.

Let c=(w,i,s)Cc = (w, i, s) \in C be a Turing machine configuration. If we try to simulate the Turing machine until we reach an accepted state or the head moves to i+1i + 1, we can encounter one of the following three situations:

An important note: To determine whether wLw\in L, we can apply the following algorithm, provided we can compute the outcome of any fast-forward operation.

This algorithm terminates because the head was assumed to stay at most one \bot symbol away from the word.

Defining a new state space

Let c=(w,i,s)Cc = (w, i, s) \in C be a configuration. For each sSs'\in S, let f(s)f(s') be the outcome of forwarding beginning in (w,i1,s)(w, i - 1, s'). This defines the data for a tuple (s,f)ZS×(S{,})S(s, f) \in Z \coloneqq S \times (S \cup \{\bot, \top\})^S. We will later consider ZZ as the state space of the linear Turing machine we construct. Remember that ss is the state of the configuration cc, while ff describes the fast-forward behavior at position i1i-1, where ii is the head position of cc. Writing σ(c)(s,f)\sigma(c) \coloneqq (s, f), we have defined a map σ ⁣:CZ\sigma\colon C \to Z.

Again, let c=(w,i,s)Cc = (w, i, s) \in C be a configuration. The following algorithm determines the result of fast-forwarding (w,i,s~)(w, i, \tilde s) for any s~S\tilde s\in S (non-termination corresponds to the \bot outcome), solely using σ(c)=(s,f)\sigma(c) = (s, f) and the symbol under the head, namely wiw_i:

We collect the fast-forwardings in the map f~ ⁣:SS{,}\tilde f\colon S \to S \cup \{\bot, \top\}. If the result of fast-forwarding is not \bot or \top, then cc has moved to another configuration c~=(w,i+1,f~(s))\tilde c = (w, i + 1, \tilde f(s)), and σ(c~)=(f~(s),f~)\sigma(\tilde c) = (\tilde f(s), \tilde f).

Hence, if we know σ(c)\sigma(c) and the symbol under the head, we can determine σ(c~)\sigma(\tilde c), where c~\tilde c is the fast-forwarded configuration.

A right-linear Turing machine that accepts L

To prove that LL is regular, we now construct a right-linear Turing machine that accepts LL. Its state space is ZZ, and its alphabet is Σ\Sigma. In every step, if the Turing machine is not in an accepted state, it moves the head to the right. If the head is on the \bot after the word and the Turing machine does not accept in the next step, it rejects.

The initial state is (s0,f0)(s_0, f_0), where s0s_0 was the initial state of the original Turing machine and f0(s)f_0(s) is the result of fast-forwarding the configuration (w,0,s)(w, 0, s). Importantly, f0f_0 is independent of the word ww, because during the fast-forwarding, the Turing machine does not get to see the band to the right of position 00 (where the symbol is \bot).

If the current state is (s,f)Z(s, f) \in Z and the head is on symbol xΣ{}x \in \Sigma \cup \{\bot\}, we use the algorithm from the last section to uniquely determine the successor state (f~(s),f~)(\tilde f(s), \tilde f).

If we ignore the second component of (s,f)Z(s, f) \in Z, then every configuration of this linear Turing machine corresponds to a configuration cc of our original read-only Turing machine, and we can reconstruct (s,f)(s, f) as σ(c)=(s,f)\sigma(c) = (s, f). Making a step with the linear Turing machine corresponds to fast-forwarding the read-only Turing machine. Hence both Turing machines accept the same language LL.