Computation and Turing Machines · v1.0.1
2026-09-07 03:05:26
A definition of computation has to satisfy three demands at once:
Model the person, not the machine.
| Human computation | Machine computation |
|---|---|
| the paper | tape |
| the hand and eye | tape head |
| what to do next | transition function |

| Operation | Explanation |
|---|---|
| Write | optionally writes a new symbol at the current tape position |
| Move | optionally moves either left or right |
| Think | optionally changes to a new state |
Every machine built in this unit is assembled from these three.
\[M = (Q, \Sigma, \Gamma, \delta, q_0, H)\]
\[\delta : (Q - H) \times \Gamma \to Q \times (\Gamma \cup \{\leftarrow, \rightarrow\})\]
A configuration is the state, the head position, and the tape content — for example \((q_4, \triangleright bbb\square)\).
A snapshot: everything needed to pause the machine and resume it later, and nothing more.
| Time | Configuration | State | Tape |
|---|---|---|---|
| 0 | \(C_0\) | \(q_0\) | ▷ b b b □ □ … |
| 1 | \(C_1\) | \(q_1\) | ▷ b b b □ □ … |
| 4 | \(C_4\) | \(q_4\) | ▷ b b b □ □ … |
| 5 | \(C_5\) | \(q_{\text{rej}}\) | ▷ b b b □ □ … |
\[C_0 \vdash_M C_1 \vdash_M C_2 \vdash_M C_3 \vdash_M C_4 \vdash_M C_5\]
\[C_0 \vdash^{5}_{M} C_5 \qquad C_1 \vdash^{*}_{M} C_4\]
Problem. Construct a TM to erase the input string.
| \(\triangleright\) | \(a\) | \(\square\) | |
|---|---|---|---|
| \(q_0\) | \((q_0, \rightarrow)\) | \((q_1, \square)\) | \((q_h, \square)\) |
| \(q_1\) | — | \((q_0, a)\) | \((q_0, \rightarrow)\) |
\(q_0\) writes a blank over the current symbol; \(q_1\) steps right; the cycle repeats.

Problem. Construct a TM that copies a string from \(L = \Sigma^*\), \(\Sigma = \{a, b\}\).
\[\Gamma = \Sigma \cup \{\triangleright, \square, \#, 1, 2\}\]

Problem. Construct a TM that accepts \(L = \{\)strings containing \(ab\) or ending with \(ba\}\).

| \(\triangleright\) | \(a\) | \(b\) | \(\square\) | |
|---|---|---|---|---|
| \(q_0\) | \((q_1, \rightarrow)\) | — | — | — |
| \(q_1\) | — | \((q_2, \rightarrow)\) | \((q_4, \rightarrow)\) | — |
| \(q_3\) | — | \((q_{\text{acc}}, \rightarrow)\) | \((q_{\text{acc}}, \rightarrow)\) | \((q_{\text{acc}}, \rightarrow)\) |
Every entry is a move. The whole job is done by the finite state set.
On \(aabbbbb\): the machine reaches \(q_3\) after reading \(aab\), and accepts on the next step, with four symbols still unread.
A Turing machine can accept a string without scanning it completely.
Problem. Construct a TM to accept \(L = \{a^n b^n c^n \mid n \geq 1\}\).
\[\Gamma = \Sigma \cup \{\triangleright, \square, x, y, z\}\]

A Universal Turing Machine \(U\) simulates the execution of any Turing machine \(M\) on any input \(w\).
The input to \(U\) is written \(\langle M, w \rangle\): an encoding of the machine, together with its input.
Given any Turing machine \(M\) and an input string \(w\), there exists a Turing machine \(M'\) that simulates the execution of \(M\) on \(w\), halts if and only if \(M\) halts on \(w\), and if it halts, returns whatever result \(M\) returns.
Algorithms and the Limits of Computation, the next unit in this module.