A Turing Machine (TM) is a theoretical model of computation devised by Alan Turing in 1936. It defines what can and cannot be computed. Though abstract, it captures the essence of any algorithm.
A Turing Machine is formally defined as a 7-tuple:
(Q, Γ, b, Σ, δ, q₀, F)
Q = finite set of states
Γ = tape alphabet (all symbols that can appear on tape)
b = blank symbol (b ∈ Γ, b ∉ Σ)
Σ = input alphabet (Σ ⊆ Γ \ {b})
δ = transition function: Q×Γ → Q×Γ×{L,R,S}
q₀ = start state (q₀ ∈ Q)
F = set of accepting/halting states (F ⊆ Q)
At each step:
Simple TM to replace all 0s with 1s on the tape:
| Current State | Read Symbol | Write Symbol | Move | Next State |
|---|---|---|---|---|
| q₀ | 0 | 1 | R | q₀ |
| q₀ | 1 | 1 | R | q₀ |
| q₀ | b (blank) | b | S | qₐ (accept) |
Turing machines can also be represented as state diagrams. Each arrow is labelled: read / write, direction. Accepting states are shown with double circles (same convention as FSMs).
A Universal Turing Machine takes as input a description of any Turing machine M and an input I, and simulates M running on I.
The Church-Turing Thesis states: "Any function that can be computed by an algorithm can be computed by a Turing machine."
A system is Turing complete if it can simulate any Turing machine. All modern general-purpose programming languages (Python, Java, C++, etc.) are Turing complete — they can compute anything a TM can compute.
| Can compute (decidable) | Cannot compute (undecidable) |
|---|---|
| Any algorithm that always halts with an answer | The Halting Problem |
| Arithmetic, sorting, searching | "Does this program ever output 'hello'?" |
| Recognising regular and context-free languages | Equivalence of two arbitrary programs |
8 questions · instantly marked · AQA 7517 standard
| Term | Definition |
|---|
10 questions · 10 minutes