Formal definition of Turing machines, including states, tape, alphabets, and transition functions.
A Turing machine is a formal model of an algorithm. It describes computation using a finite set of rules and an unbounded tape.
The machine has three main parts:
| Part | Role |
|---|---|
| Tape | stores symbols |
| Head | reads and writes one cell at a time |
| Finite control | stores the current state |
The tape is divided into cells:
Each cell contains one symbol. Most cells are blank. The blank symbol is usually written as:
The tape is idealized as unbounded. This means the machine always has more space available if computation needs it.
At every step, the machine does exactly four things:
- reads the current tape symbol
- writes a tape symbol
- moves left or right
- changes state
A move direction is written as:
or
Some versions also allow a stay-put move , but and are enough for the standard theory.
A deterministic Turing machine is usually defined as a tuple:
Here each component has a precise meaning.
| Symbol | Meaning |
|---|---|
| finite set of states | |
| input alphabet | |
| tape alphabet | |
| transition function | |
| start state | |
| accepting halt state | |
| rejecting halt state |
The set is finite. A state records the machine’s internal condition.
The input alphabet contains the symbols allowed in the input word. For binary strings, we often use:
The tape alphabet contains every symbol the machine may read or write. It includes the input alphabet and the blank symbol:
Usually the blank symbol is not part of the input alphabet:
The transition function gives the rule for one computation step:
If:
then the instruction means:
| Component | Meaning |
|---|---|
| current state | |
| symbol currently being read | |
| next state | |
| symbol to write | |
| direction to move |
For example:
means: if the machine is in state and reads , it writes , moves right, and enters state .
The states and are halting states. Once the machine enters one of them, the computation stops.
For a decision problem, accepting means the answer is yes. Rejecting means the answer is no.
For machines that compute functions, we often use one halting state instead:
Then the output is read from the tape after the machine stops.
Initial Configuration
An input word has the form:
where each symbol belongs to the input alphabet:
At the start, the tape contains the input symbols on consecutive cells:
All other cells contain blanks:
The head begins on the first input symbol, and the machine begins in the start state:
If the input word is empty, the head begins on a blank cell.
Deterministic Behavior
The machine described above is deterministic. This means that every state-symbol pair determines at most one next move.
So for a fixed pair:
there is only one possible instruction:
There is no guessing, randomness, or choice. If the same machine starts with the same input twice, it follows exactly the same sequence of steps.
Partial Transition Functions
Some definitions make the transition function partial:
The symbol means a partial function.
If is undefined, the machine halts. This convention avoids needing explicit accepting and rejecting states in some settings.
Both styles define the same class of computable functions and decidable languages.
Example: Scanning to the End of a Word
Let the input alphabet be:
Let the tape alphabet be:
Consider a machine that scans right until it finds the first blank cell.
Use states:
Define the transition rules:
On input:
the machine reads the symbols one by one:
Then it reaches the first blank:
and halts.
The machine does not change the input. Its purpose is only to show how a transition function controls movement.
A Turing machine is finite as a description, even though its tape is unbounded. This matters because machines can be encoded as strings. Once machines can be encoded, one machine can receive another machine as input. This idea leads to universal machines and the halting problem.