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:
- be an alphabet,
- a finite set of *states*,
- the set of accepted states and be the initial state,
- the set of possible movements of a Turing machine, namely left, nothing and right, and
- the transition function of a *read-only* Turing machine. (We assume for simplicity that the Turing machine starts on the first character of the word and that it never moves more that one away from the word.)
Then this Turing machine recognizes some language , the set of all words for which the Turing machine reaches some accepted state. In order to prove that is regular, it suffices to construct another Turing machine that moves right in every step and also accepts .
Fast-forwarding procedure
Note that the configuration of the Turing machine at a given point in time can be encoded as a tuple , where is the word on the band beginning at position , is the position of the head and is the current state.
Let be a Turing machine configuration. If we try to simulate the Turing machine until we reach an accepted state or the head moves to , we can encounter one of the following three situations:
- The simulation never ands because it never fulfils these termination conditions. (non-halting case, represeted by ).
- The simulation ends on an accepted state at a head position (accepting case, represented by ).
- The simulation ends with head at in some state . (progress case, represented by ).
An important note: To determine whether , 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 (i.e. put the head on position and enter the start state).
- Repeat forever:
- Fast-forward.
- If the result is either or , reject or accept, and terminate.
- Otherwise, the result is some . Move the head to the right and enter state .
- Fast-forward.
This algorithm terminates because the head was assumed to stay at most one symbol away from the word.
Defining a new state space
Let be a configuration. For each , let be the outcome of forwarding beginning in . This defines the data for a tuple . We will later consider as the state space of the linear Turing machine we construct. Remember that is the state of the configuration , while describes the fast-forward behavior at position , where is the head position of . Writing , we have defined a map .
Again, let be a configuration. The following algorithm determines the result of fast-forwarding for any (non-termination corresponds to the outcome), solely using and the symbol under the head, namely :
- If is accepted, accept () and terminate.
- If , return .
- If , return the result of this algorithm when is replaced by .
- If , and determine . If it is or , return its result; otherwise, its result is some . Then return the result of this algorithm when is replaced by .
We collect the fast-forwardings in the map . If the result of fast-forwarding is not or , then has moved to another configuration , and .
Hence, if we know and the symbol under the head, we can determine , where is the fast-forwarded configuration.
A right-linear Turing machine that accepts L
To prove that is regular, we now construct a right-linear Turing machine that accepts . Its state space is , and its alphabet is . 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 after the word and the Turing machine does not accept in the next step, it rejects.
The initial state is , where was the initial state of the original Turing machine and is the result of fast-forwarding the configuration . Importantly, is independent of the word , because during the fast-forwarding, the Turing machine does not get to see the band to the right of position (where the symbol is ).
If the current state is and the head is on symbol , we use the algorithm from the last section to uniquely determine the successor state .
If we ignore the second component of , then every configuration of this linear Turing machine corresponds to a configuration of our original read-only Turing machine, and we can reconstruct as . 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 .