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 :

SetMembership conditionHalts?
strings that lead to the Accept statethe language accepted by yes
strings that crash or reach an explicit Reject stateyes
strings that make run foreverno
  • ⚡ 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).

  1. Label the start state .
  2. Label every other state with an integer .
  3. Rewrite edge labels , — read, rewrite unchanged, advance.
  4. Un-double every Final state’s circle and add an edge from it to State 2 labelled — “input exhausted and we were accepting”.
  5. 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 machinesqueue automaton (deterministic PDA with a queue instead of a stack), 2PDA (deterministic PDA with two stacks), NTM (nondeterministic TM), TM (TM with tapes).
  • Equivalence theoremany 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 :

StepStateHead cellReadWriteMoveNext state
0103
1311
2123
3332 — 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 decidingdecidable 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