Turing Machines
Context: FIT2014_MOC · the outermost machine model — a PDA’s stack replaced by an unbounded read/write tape · formalises “effective process” and underwrites Computable Functions and the Church-Turing Thesis
Quick Revision
- 🎯 Objective: finite program + infinite tape + one head ➔ transitions ; the machine is deterministic and may accept, reject, or loop forever.
- 📦 Core Components: Tape ➔ infinite cells over a finite alphabet | Head ➔ read/write, one step or | Program ➔ numbered states, Start , Accept .
- ⚡ Key Constraint: a TM has three outcomes, not two — , , partition . Only a machine with is a decider.
📝 How It Works
1. Effective process (what is being formalised)
- Turing’s checklist ➔ a process is effective/algorithmic if it can be done with pencil and paper, follows a finite set of instructions, demands neither insight nor ingenuity, works without error, and in finitely many steps yields a final result (or, if the result is a sequence, each symbol of it).
- The abstraction of a human computer ➔ a person doing arithmetic is at any moment (i) at one position on the paper, (ii) reading the symbol there, (iii) in one mental state; they then write a symbol, possibly change state, and move their attention nearby. Every component of the TM is one of these three.
2. The machine
- Tape ➔ an infinite sequence of cells, each holding one symbol of a finite alphabet; initially the input string followed by blanks .
- Tape head ➔ sits on exactly one cell; can read it, write to it (overwriting), and move one cell or per step.
- Program ➔ a finite set of states numbered by integers: Start State , Accept State , optionally a Reject State. One state one very low-level instruction.
- Transition ➔ , drawn on an edge as (read , write , move right). Writing the same symbol back is abbreviated .
- Computation ➔ start in state on the first input cell; at each step apply the one applicable instruction. Deterministic — unlike an NFA/PDA, there is no choice of path.
- Crash reject ➔ if no transition matches the current (state, symbol) pair the machine halts and rejects; an explicit Reject State is optional sugar.
3. The three languages of a TM
For a Turing machine :
| Set | Membership condition | Halts? |
|---|---|---|
| strings that lead to the Accept state — the language accepted by | yes | |
| strings that crash or reach an explicit Reject state | yes | |
| strings that make run forever | no |
- ⚡ Key Constraint: the three sets are disjoint and exhaust ➔ so holds only when . This is the entire difference between “accepted” and “decided”.
4. Deciders and decidability
- Decider ➔ a TM that halts on every input, i.e. .
- Decider for ➔ a decider with (hence ). It always settles, in finite time, whether any input is in — it never “dithers” forever.
- Decidable language ➔ one for which some decider exists.
- Every regular language is decidable ➔ witnessed constructively by the FA TM conversion below.
5. Finite Automaton Turing Machine
A 5-step rewrite turning any FA into an equivalent TM (which is automatically a decider — it moves right on every step, so it halts within steps).
- Label the start state .
- Label every other state with an integer .
- Rewrite edge labels , — read, rewrite unchanged, advance.
- Un-double every Final state’s circle and add an edge from it to State 2 labelled — “input exhausted and we were accepting”.
- State 2 becomes the sole Final state.
- Why is the trigger ➔ an FA accepts when the input runs out in a Final state; on a tape “input ran out” is literally “the head reads a blank”.
6. Equivalent machines and variations
- Other machines ➔ queue automaton (deterministic PDA with a queue instead of a stack), 2PDA (deterministic PDA with two stacks), NTM (nondeterministic TM), TM (TM with tapes).
- Equivalence theorem ➔ any language a Turing machine can accept can also be defined by any of these machines, and vice versa; there are algorithms converting all of them into each other.
- Variations that change nothing ➔ allowing the head to stay still; a two-way infinite tape; multiple tapes; separate input/output/work tapes; multi-dimensional tapes. All give the same class of computable functions.
- ⚡ Contrast with the lower tiers ➔ nondeterminism did matter for PDAs (deterministic PDAs are strictly weaker) but does not matter here — an NTM buys no extra languages, only speed.
📊 Exam Execution Trace
stateDiagram-v2 direction LR [*] --> s1 s1: 1 s3: 3 s2: 2 Accept s1 --> s1: b→R s1 --> s1: ∆→R s1 --> s3: a→R s3 --> s1: b→R s3 --> s2: a→R
The three sets read straight off the missing and the self-looping rules:
- strings containing — two s in a row take .
- strings without that end in — the head halts in state on a , and state has no rule ⟹ crash.
- or strings without ending in — these reach state on a , and marches right over blanks forever.
Trace of :
| Step | State | Head cell | Read | Write | Move | Next state |
|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 3 | |||
| 1 | 3 | 1 | 1 | |||
| 2 | 1 | 2 | 3 | |||
| 3 | 3 | 3 | 2 — Accept |
⚠️ Common Mistakes
- 💡 “Not accepted” “rejected” ➔ a string may loop. requires the extra hypothesis ; asserting it unconditionally is the single biggest mark-loss here.
- 💡 Accepting deciding ➔ decidable demands a machine that halts on all inputs, not merely one that accepts the right strings.
- 💡 A TM halts the moment it enters state 2 ➔ it does not need to consume the whole tape, unlike an FA which must run out of input.
- 💡 A missing transition is a crash, not a no-op ➔ every (state, symbol) pair you leave undefined silently becomes a rejection; check the rules deliberately.
- 💡 Blanks are symbols ➔ is in the tape alphabet and can be read and written; forgetting this breaks every “have I reached the end?” test.
🧠 Active Recall
Why does the definition of decidable need rather than just ?
Answer
- Short answer: because alone leaves the complement unresolved — a string outside might crash (a genuine “no”) or run forever, and an observer watching a non-halting run can never conclude “no”.
- Why: Three outcomes, not two ➔ . Only killing the third block gives , which is what “decides membership in finite time” means.
What does the FA TM construction prove, and why is the added edge essential?
Answer
- Short answer: it proves every regular language is decidable — the resulting TM only ever moves right, so it halts after at most steps on every input, making it a decider with .
- Why: Blank end of input ➔ an FA’s acceptance test is “the input is exhausted while in a Final state”, a condition with no direct tape analogue. The edge out of each old Final state into State is that test, rewritten as a tape observation.
Nondeterminism strictly increased the power of a PDA. Why doesn't it increase the power of a Turing machine?
Answer
- Short answer: a deterministic TM can simulate an NTM by systematically exploring its computation tree on the tape (breadth-first over branch sequences), because the tape is unbounded scratch space. A deterministic PDA has only a stack and cannot record the alternatives it did not take.
- Why: Unbounded rewritable memory absorbs the search ➔ this is the same reason TMs, two-way tapes and queue/2-stack machines all collapse to the same class: whatever extra structure you add can be encoded onto one tape and simulated, so the class of accepted languages is invariant.