Chapter 9: Finite-State Machines, Turing Machines

Section 9.4 Turing Machines


We noted that S = {\(0^n\)\(1^n\) | n ≥ 0} cannot be recognized by FSMs because FSMs have no memory to match arbitrary numbers of symbols. In this section, we will use Turing machines, which have memory, to recognize this set.

Turing Machines as Set Recognizers

Although the Turing machine computations we have seen so far are not particularly meaningful, we can give the Turing machine an important role by using it as a recognizer, similar to how finite-state machines recognize sets of strings. We can even give a very similar definition, provided we first define a final state for a Turing machine. A final state in a Turing machine is one that is not the first symbol in any quintuple. Thus, on entering a final state, whatever the symbol read, the Turing machine halts.

Definition



Turing Machine Recognizer is a machine that accepts strings that belong to a set, and halts in a final state. If the input belongs to the set (the language), the machine halts in a final (accepting) state.

Situation What Happens Result
Input belongs to the set Machine halts in a final (accepting) state ✅ Accept
Input not in the set, machine halts in a non-final state Machine halts but in a non-final (non-accepting) state ❌ Reject
Input not in the set, machine never halts Machine loops forever without reaching a final state ❌ Reject

Turing Machine as Recognizers

We can now build a Turing machine to recognize our old friend:
\(S =\{0^n1^n | n ≥ 0\} = \{λ,01,0011,000111,00001111,...\}\)

The goal is to match the same number of 0's followed by the same number of 1's. One possible strategy (the first approach) is to count the number of 0’s as they are read, then compare this count to the number of 1’s. However, even though a Turing machine has memory, managing explicit counting would make the machine design much more complicated. Instead, we use a simpler strategy. The machine is based on our second approach to this recognition problem, sweeping back and forth across the input and crossing out 0–1 pairs.

How the Machine Works:

Note:


Practice

1.

2. Find a Turing machine that recognizes \(0^*\)1\(0^*\)1


Turing Machine Simulator

a web-based Turing machine simulator, written in Javascript, with some examples Turing machine programs.

Reference

saylor academy
Brilliant