Sub topic 1
Turing Machines: The 7-Tuple Model
Prerequisites
This chapter assumes you know finite automata and regular languages, context-free grammars and pushdown automata, basic set theory including countable and uncountable sets, and proof by contradiction.
The 7-tuple model
A Turing machine (TM) is a formal model of computation. It reads and writes on a tape that is unbounded in length. A TM is written as a 7-tuple M = (Q, Σ, Γ, δ, q0, qaccept, qreject), where:
- Q is a finite set of states.
- Σ is the input alphabet. It does not contain the blank symbol □.
- Γ is the tape alphabet. It satisfies Σ ⊆ Γ and □ ∈ Γ.
- δ: Q × Γ → Q × Γ × {L, R} is the transition function.
- q0 ∈ Q is the start state.
- qaccept ∈ Q is the accept state.
- qreject ∈ Q is the reject state, with qreject ≠ qaccept.
The transition function δ tells the machine, for each state and scanned symbol, which state to enter, which symbol to write, and whether to move the head left or right.
Running a machine: configurations, halting and looping
A configuration is a snapshot of the machine. It records the current state, the tape contents, and the head position. The string uqv describes one configuration, where u is the tape left of the head, q is the current state, and v is the tape from the head onward.
Each run ends in one of three outcomes:
| Outcome | Condition |
|---|---|
| Accept | The machine reaches qaccept. |
| Reject | The machine reaches qreject. |
| Loop | The machine never reaches either state. |
Designing machines: marking symbols for a^n b^n and a^n b^n c^n
A common design strategy is to mark symbols as you match them. To recognize a^n b^n, the machine repeats one pass. On each pass it replaces the leftmost a with X and the matching b with Y. It accepts when every symbol is marked.
For a^n b^n c^n, the machine uses the same idea with three symbols. Each pass crosses off one a, one b, and one c. A string is accepted only if all three counts match. This language is not context-free, so a TM is needed for it.
Multi-tape and nondeterministic machines are equivalent in power
A multi-tape TM has several tapes and several heads. Any multi-tape machine can be simulated by a single-tape machine. The simulation is slower, with a quadratic time cost, but it recognizes the same languages.
A nondeterministic TM can have several possible moves from one configuration. It accepts if some branch accepts. Nondeterminism does not add power over deterministic TMs. For GATE questions, these variants are equivalent in decidability.
Decidable versus semi-decidable languages
A language L is decidable, or recursive, if some TM halts on every input and accepts exactly the strings in L. A language L is recursively enumerable (RE), or semi-decidable, if some TM accepts exactly L. That machine may loop on strings outside L. Every decidable language is RE.
Exercise
A TM accepts L and loops on input w. Can you conclude that w is not in L?
Show answer
No. Looping gives no verdict. L is only semi-decidable unless some machine halts on every input.