Recall warm-up
- Classify { aⁿbⁿcⁿ }.
Stuck? Peek at 3.4.4 Drill: regular, DCFL, CFL or not CFL?
- Ladder: bounded → regular; one comparison, no guess → DCFL; one comparison with a guess → CFL; two comparisons / crossing / copy / squares → not CFL.
- “or” of comparisons → CFL not DCFL; “and” → not CFL.
- Always check finiteness and collapses (unions that become a*b*).
- What is an instantaneous description of a PDA?
Stuck? Peek at 3.3.1 Stack primer and the push-down automaton
- PDA (Q, Σ, Γ, δ, q₀, Z₀, F); δ(q, a|ε, X) ⊆ Q × Γ*; label a, X/γ (γ = ε pop, X keep, YX push).
- ID (q, w, γ), top first; ⊢ one move, ⊢* many.
- Nondeterministic by default; ε-moves still see the stack.
- What are the three possible outcomes of a computation?
Stuck? Peek at 0.1.1 What “computation” means
- Machine: reads a finite input symbol by symbol, changes mode, ends with yes (accept) / no (reject) — or may never end.
- Decision problem: a question whose answer is yes or no for every input.
- Machines differ by memory: finite modes → pile of plates → endless notebook → beyond all machines.
- Finite memory works iff the fact you must carry stays bounded (even/odd, remainder, “seen x?”). Unbounded counts/comparisons break it.
The Hook
Imagine a clerk with a pencil, an eraser and an endless strip of squared paper. They look at one square at a time, may overwrite it, move one square left or right, and follow a finite rulebook. In 1936 Alan Turing argued that anything a person can compute by rote can be done this way. That clerk is the Turing machine (TM) — the model behind every computer, and the machine whose limits Phase 5 explores.
Predict First
A PDA could only touch the top of its stack. What two abilities does a tape add that a stack lacks?
Core Concept
Prediction check
The head can move back over what was written (read anywhere, not only the top), and it can overwrite any cell. The input itself sits on the tape and can be marked, erased, re-read many times.
The machine
A TM has a finite set of states, an infinite tape of cells (initially the input followed by blanks □), and a head on the first input cell. Each step: read the symbol under the head; based on (state, symbol) write a symbol, move L or R, and change state.
Formal definition
δ : Q × Γ → Q × Γ × {L, R} (a partial function).
The standard (deterministic) TM has at most one move per (state, symbol). Many books (and GATE) use a single accept state q_acc and a reject state q_rej instead of F. The machine halts when it enters an accepting/rejecting state, or when no move is defined (treated as reject).
| part | meaning |
|---|---|
| Q | finite set of states |
| Σ ⊆ Γ | input alphabet inside the tape alphabet |
| □ | blank, fills the rest of the tape |
| δ(q, X) = (p, Y, D) | in q reading X: write Y, move D ∈ {L, R}, go to p |
| q_acc / q_rej | halting states |
Instantaneous descriptions
Example: X q1 bc means tape “Xbc”, state q1, head on b. A move δ(q1, b) = (q2, Y, R) gives X Y q2 c.
Three outcomes
- Accept: reaches an accepting state.
- Reject: reaches the reject state or gets stuck (no move).
- Loop: runs forever, never halting.
L(M) = strings M accepts. Strings outside L(M) are either rejected or looped on — and an observer watching a long run cannot always tell which is happening. That gap is the heart of Phase 5.
States: q0, q1, qa
Transitions: q0>q0: a/a,R; q0>q1: b/b,L; q1>q0: a/a,R; q0>qa: □/□,R
Putting it together
- A TM reads, writes and moves on an unbounded tape under a finite rulebook.
- IDs α q β record configurations.
- On any input it accepts, rejects, or loops — and looping is not rejecting.
Visual
tape: … □ □ [a] b c □ □ … finite control
▲ ┌────────┐
head ───────────────────┤ state q│ δ(q, a) = (p, X, R)
└────────┘ write X, move right, go to pWorked Examples
From ID ab q0 ba with δ(q0, b) = (q1, a, L), what is the next ID?
Show the full solution
Overwrite b with a, move left onto the second b: a q1 baa.
Why can a TM accept { aⁿbⁿcⁿ } while a PDA cannot?
Show the full solution
It can return to the start and cross off one a, one b, one c per pass, re-reading the tape as many times as needed. A stack is destroyed as it is read.
A TM M halts on input w after exactly 10 moves and never moves left of cell 1. What is the largest number of tape cells it can have visited? Can it loop on some other input?
Show the full solution
At most 11 cells (start cell plus one new cell per move). Yes — halting on one input says nothing about others; TMs may loop on some inputs.
GATE Traps
- A TM that does not halt has not rejected — it has given no verdict.
- The input is on the tape; there is no separate read-only input.
- δ is partial: an undefined move means the machine halts (reject unless in an accepting state).
- GATE often uses single accept/reject states; F-based definitions are equivalent.
Memory Hook
A Turing machine is a clerk with an endless notebook, a pencil and an eraser — the most a rule-following clerk can ever do.
Connect the Dots
Now design TMs: crossing off symbols, copying strings, doing arithmetic in unary.
Self-Test
- MCQ
In a standard TM, δ has the form:
- Q × Σ → Q
- Q × Γ → Q × Γ × {L, R}
- Q × Σ × Γ → Q × Γ*
- Q → Γ
- MSQ
Which outcomes are possible for a TM on some input?
- accept
- reject
- run forever
- accept and reject
- MCQ
ID a q3 bc means:
- state q3, head on a
- state q3, head on b
- state q3, head on c
- tape is q3
- NAT
tmLoop above: how many of the inputs ε, a, b, ab, aa are accepted?
Write your answer before opening the key.
Rule Card
- TM (Q, Σ, Γ, δ, q₀, □, F), δ : Q × Γ → Q × Γ × {L,R} (partial).
- ID α q β (head on first of β). Outcomes: accept, reject (or stuck), loop.
- Tape: read/write anywhere, unbounded. L(M) = accepted strings.
Concept Ledger
- Turing machine (TM)
- tape, head, blank □
- tape alphabet Γ
- TM transition δ(q, X) = (p, Y, D)
- ID α q β
- halting: accept / reject / loop
Answer Vault
Reveal answers when you’re ready
Warm-up answers
- Not context-free.
- (state, unread input, stack top-first).
- Halt and accept, halt and reject, run forever.
Self-test answers
- B — Read, write, move.
- A: DFA.
- C: PDA.
- D: No.
- ABC — Three outcomes.
- D: A deterministic run ends one way.
- B — The state precedes the scanned symbol.
- A: a is left of the head.
- C: c is further right.
- D: No.
- 3 — ε, a, aa.
Flashcards
- TM transition function type?
Reveal answer
δ : Q × Γ → Q × Γ × {L, R} - Three possible TM outcomes?
Reveal answer
Accept, reject, loop forever. - What does ID α q β mean?
Reveal answer
Tape αβ, state q, head on the first symbol of β.