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 ww 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:

  • The simulation never ends because it never fulfils these termination conditions. (non-halting case, represented by ⊥\bot).

  • The simulation ends on an accepted state at a head position ≤i\le i (accepting case, represented by ⊤\top).

  • The simulation ends with head at i+1i + 1 in some state s′∈Ss'\in S. (progress case, represented by s′s').

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

  • Put the Turing machine into the initial configuration for word ww (i.e. put the head on position 11 and enter the start state).

  • Repeat forever:

    • Fast-forward.

    • If the result is either ⊥\bot or ⊤\top, reject or accept, and terminate.

    • Otherwise, the result is some s∈Ss\in S. Move the head to the right and enter state s∈Ss\in S.

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 s′∈Ss'\in S, let f(s′)f(s') be the outcome of forwarding beginning in (w,i−1,s′)(w, i - 1, s'). This defines the data for a tuple (s,f)∈Z≔S×(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 i−1i-1, where ii is the head position of cc. Writing σ(c)≔(s,f)\sigma(c) \coloneqq (s, f), we have defined a map σ ⁣:C→Z\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:

  • If ss is accepted, accept (⊤\top) and terminate.

  • If δ(s,wi)=(s′,R)\delta(s, w_i) = (s', R), return s′s'.

  • If δ(s,wi)=(s′,N)\delta(s, w_i) = (s', N), return the result of this algorithm when ss is replaced by s′s'.

  • If δ(s,wi)=(s′,L)\delta(s, w_i) = (s', L), determine f(s′)f(s'). If it is ⊤\top or ⊥\bot, return its result; otherwise, its result is some s′′∈Ss''\in S. Then return the result of this algorithm when ss is replaced by s′′s''.

We collect the fast-forwardings in the map f~ ⁣:S→S∪{⊥,⊤}\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.