Turing Machines
The Turing machine (TM) is the most powerful model of computation. It captures everything that can be computed algorithmically. Unlike finite automata and PDAs, a TM has unlimited memory in the form of an infinite tape.
Formal Definition
A Turing machine is a 7-tuple
: finite set of states : input alphabet (does not contain the blank symbol) : tape alphabet ( ) : transition function : start state : blank symbol : halting/final states
Transition Interpretation
In state
, reading symbol on the tape, write , move the head in direction (Left or Right), and go to state .
Computation Model
- Infinite tape divided into cells, each holding one symbol from
- Initially, the input string
is written at the left end of the tape, preceded and followed by blanks ( ) - The tape head starts at the leftmost symbol of the input
- The TM can read, write, and move the head at each step
- The TM halts when it enters a state
(accept) or when is undefined (reject)
Instantaneous Description (ID)
An ID is a string
is the current state - The tape head is scanning
- Everything to the left and right (up to first infinite blank) is shown
Moves
Acceptance and Language
A TM
Recursive vs. Recursively Enumerable (RE)
is recursively enumerable (RE): There exists a TM that accepts . If , the TM may run forever (not halt). is recursive (decidable): There exists a TM that accepts AND halts on all inputs (both and ).
Variations of Turing Machines (All Equivalent)
Multi-Tape TM
Has
Equivalence: Can be simulated by a single-tape TM using tracks or interleaving.
Nondeterministic TM (NTM)
Equivalence: Simulated by a deterministic TM using breadth-first search (dovetailing) of the nondeterministic computation tree — exponential time in worst case.
Semi-Infinite Tape
Tape infinite only to the right. Simulated by two-track tape: one track for the right half, another for the left half (with reversed addressing).
Multi-Track Tape
Each cell holds a tuple of symbols. Equivalent to expanding the tape alphabet (
Enumerator
A TM with a printer that outputs strings. A language is RE iff some enumerator enumerates it.
The Church-Turing Thesis
Every effectively computable function can be computed by a Turing machine.
This is a thesis, not a theorem — it connects the intuitive notion of "algorithm" to the formal TM model. All other formal models of computation (lambda calculus, recursive functions, register machines, Post systems, etc.) have been proven equivalent to TMs.
No one has found a computational model more powerful than the TM (that is physically realizable).
Universal Turing Machine
A universal TM
The existence of
Encoding
- States:
represented as followed by binary - Symbols:
(binary) - Transitions: Encoded as
(binary) - Separator: Use special delimiter
Decoding the Language
Decidable Problems About Turing Machines
Some problems about TMs are decidable:
- Does a TM have exactly
states? (just count) - Given a TM and
, does the TM use more than tape cells on a particular input of length ? (simulate for up to steps)
Most interesting questions, however, are undecidable.
The Halting Problem
Theorem:
If a decider for