Sub topic 1
What a Turing Machine Is: The 7-Tuple Model
A Turing machine (TM) is a mathematical model of computation. It has a finite control, an unbounded tape, and a head that reads and writes one tape cell at a time. The machine follows a transition rule that depends on its current state and the symbol under its head.
This chapter assumes familiarity with finite automata, regular languages, context-free grammars, and basic proof by contradiction.
Prerequisites
You should know:
- How states and transitions work in a finite automaton.
- The difference between an input alphabet and a language.
- Basic set notation and functions.
- The meaning of a proof by contradiction.
The formal 7-tuple
A deterministic Turing machine is written as:
M = (Q, Σ, Γ, δ, q₀, qaccept, qreject)
Each component has a specific role.
| Component | Meaning |
|---|---|
| Q | A finite set of states |
| Σ | The input alphabet |
| Γ | The tape alphabet, where Σ ⊆ Γ |
| δ | The transition function |
| q₀ | The start state, where q₀ ∈ Q |
| q_accept | The accepting halt state |
| q_reject | The rejecting halt state |
The input alphabet contains symbols that may appear in an input string. The tape alphabet also contains symbols used internally by the machine. Usually, Γ contains a special blank symbol, written as _, and _ is not in Σ.
The transition function is usually defined as:
δ: (Q − {qaccept, qreject}) × Γ → Q × Γ × {L, R}
For a current state and a scanned tape symbol, δ returns:
- The next state.
- The symbol to write in the current tape cell.
- The direction in which to move the head: left or right.
For example:
δ(q₀, a) = (q₁, X, R)
This means: if the machine is in state q₀ and reads a, it writes X, moves right, and enters q₁.
Unlike a finite automaton, a Turing machine can change the input and revisit earlier cells. The tape is considered unbounded in the direction needed by the computation. The input is placed on the tape initially, with blank symbols elsewhere.
Well-formed machines
The start state must belong to Q. The accepting and rejecting states must also belong to Q, and they are normally distinct. The transition function does not define moves from either halting state.
A machine accepts an input when its computation enters qaccept. It rejects an input when it enters qreject. It may also continue forever if it never reaches either state. This possibility is a fundamental difference between Turing machines and deciders.
A quick check
Suppose δ(q₂, Y) = (q₃, b, L). When the machine is in q₂ scanning Y, it replaces Y with b, moves one cell left, and continues in q₃.
Exercise
In the transition δ(q₁, 0) = (q₂, X, R), what happens to the tape and head?
Show answer
The machine writes X over 0, moves the head one cell right, and enters q₂.