G27
Self-checkedTier 1 10 min readtoc.tm-variants-church

TM variants and the Church-Turing thesis

Variants of the Turing machine that do not add power (several tapes, a tape infinite in one or two directions, stay moves, nondeterminism, enumerators) and what they cost in time (a quadratic slowdown for several tapes, an exponential one for nondeterminism), encodings of machines and the universal Turing machine, and the Church-Turing thesis as a statement about the informal notion of algorithm rather than a theorem.

Why it exists

The Turing machine of the previous page is one specific model. Many natural changes (more tapes, a head that may stay, guessing) look as if they should make it stronger. The theorems on this page say they do not change what can be computed, only how fast. That robustness is the reason the Turing machine is accepted as the definition of "computable", which is the content of the Church–Turing thesis. GATE asks which variants are equivalent in power, what the cost of a simulation is, and what the thesis states.

Prerequisites

You need the definition of a Turing machine, its configurations and the difference between recognising and deciding (Turing machines).

Precise definitions

Two models are equivalent if they accept (or decide, or compute) exactly the same languages (functions). The equivalences below are proved by simulation: a machine of the first kind is turned into one of the second kind that does the same job.

variantequivalent to the basic machine?cost of the simulation (quoted)
tape infinite in one direction onlyyesconstant factor
head may stay in place (SS) as well as move LL or RRyesconstant factor
larger tape alphabet, several "tracks" on one tapeyesconstant factor
several tapes (kk heads)yestime t(n)t(n) becomes O(t(n)2)O(t(n)^2)
a two-dimensional tapeyespolynomial
nondeterministic machineyestime t(n)t(n) becomes 2O(t(n))2^{O(t(n))}
enumerator (a machine that prints the strings of a language)yes (for recognisers)see dovetailing below
a pushdown automaton with two stacksyespolynomial
random-access machine, λ\lambda-calculus, μ\mu-recursive functionsyespolynomial for random-access machines

How it works

Several tapes

A kk-tape machine has kk tapes with a head on each; one move reads the kk symbols under the heads, writes kk symbols, moves each head (LL, RR or SS) and changes state. The input is on tape 1. Example: a two-tape machine for {anbn}\{a^n b^n\} copies the aa's onto tape 2, then, for every bb on tape 1, erases one copied symbol on tape 2; it accepts when both tapes reach their blanks together. It makes 2n+22n + 2 moves on anbna^n b^n, whereas the one-tape machine of the previous page, which walks back and forth, makes 2n2+2n+12n^2 + 2n + 1:

One tape against two tapes for a^n b^n: start

Computed by a script, not typed
none-tape machine (moves)two-tape machine (moves)
n = 0
n = 1
n = 2
n = 3
n = 4
n = 5
n = 6
n = 7
n = 8
n = 9
n = 10

Step 0

Moves made on the input a^n b^n. One tape: 2n² + 2n + 1 (quadratic). Two tapes: 2n + 2 for n ≥ 1 (linear). Both machines decide the same language, checked on all strings up to length 10.

0 / 11
computed by script: the machine is simulated or the sets are constructed by scripts/toc_lib.py, one step at a time. python3 scripts/gen-toc5-traces.py

Both machines decide the same language (checked on all strings up to length 1010). Simulation of kk tapes by one tape: write the contents of the tapes one after another separated by a marker #\#, and mark the cell under each head with a dotted symbol (the alphabet is extended). One move of the kk-tape machine becomes a sweep over the whole tape to read the marked symbols and a second sweep to update them; each sweep takes O(t)O(t) steps if tt moves have been made, so tt moves cost O(t2)O(t^2) (quoted).

Nondeterminism

A nondeterministic Turing machine (NTM) has δ(q,a)⊆Q×Γ×{L,R}\delta(q, a) \subseteq Q \times \Gamma \times \{L, R\}: several moves may apply, and the machine accepts ww if some sequence of choices reaches the accepting state. Its computations form a tree. Example: the NTM that accepts the strings over {a,b}\{a, b\} whose third symbol from the end is aa: on each aa it may guess "this is the symbol", then read two more symbols and look for the blank. The table follows all computations at once on an accepted and a rejected input:

Following all computations of a nondeterministic Turing machine: start

Computed by a script, not typed
timeabaab: configurations aliveabaab: statesabbbb: configurations aliveabbbb: states
after 0 moves
after 1 moves
after 2 moves
after 3 moves
after 4 moves
after 5 moves
after 6 moves

Step 0

The machine accepts strings whose third symbol from the end is a: on each a it may guess that this is the symbol. abaab is accepted (True), abbbb is not (False). A deterministic machine simulates it by breadth-first search over these lists.

0 / 7
computed by script: the machine is simulated or the sets are constructed by scripts/toc_lib.py, one step at a time. python3 scripts/gen-toc5-traces.py

Simulation by a deterministic machine: search the computation tree breadth first, keeping the list of all configurations after 0,1,2,…0, 1, 2, \ldots moves, exactly as in the table; accept as soon as one of them is accepting. (Depth-first search would be wrong: an infinite branch could make it miss an accepting one.) If every configuration has at most bb successors, after tt moves there are at most btb^t configurations, which is the exponential cost; whether this exponential cost can be avoided is the P versus NP question. The two machines accept the same language: the simulation was checked against an explicit enumeration of all computation paths. A nondeterministic machine decides a language if all its computations halt; the simulation then halts on every input too.

Enumerators and dovetailing

An enumerator is a machine with a printer that, started on a blank tape, prints strings (possibly for ever); its language is the set of strings it prints. Enumerators and recognisers are equivalent. Given a recogniser MM, build the enumerator by dovetailing: in stage ss run MM for s−is - i moves on the ii-th string (counting from 00) of the list ε,a,b,aa,ab,…\varepsilon, a, b, aa, ab, \ldots for every i<si < s, and print a string the first time MM accepts it. A string on which MM loops never blocks the others, and every string accepted after mm moves is printed in stage i+max⁡(1,m)i + \max(1, m):

Turning a recogniser into an enumerator (dovetailing): start

Computed by a script, not typed
outputstring printedstageits number in the listmove budget in that stagemoves the machine needs
output 1
output 2
output 3
output 4
output 5
output 6
output 7
output 8
output 9
output 10
output 11
output 12
output 13
output 14

Step 0

In stage s the recogniser for 'contains b' is run for s − i moves on the i-th string for every i < s, and a string is printed the first time it is accepted. A machine that loops on some string never blocks the others, and every string of the language is printed in some stage.

0 / 14
computed by script: the machine is simulated or the sets are constructed by scripts/toc_lib.py, one step at a time. python3 scripts/gen-toc5-traces.py

Conversely, from an enumerator EE build a recogniser: run EE and accept ww if EE prints ww.

Encoding machines and the universal machine

A machine can be written as a string ⟨M⟩\langle M \rangle over a fixed alphabet: list the start and accepting states and all transitions. For the machine of the previous page that decides anbna^n b^n the description begins start=q0;accept=qa;q0,Y>q3,Y,R;q0,_>qa,_,R;q0,a>q1,X,R;.... Decoding this string recovers the machine exactly (checked for six machines). A universal Turing machine UU takes ⟨M⟩\langle M \rangle and ww, and simulates MM on ww: it accepts iff MM accepts ww, loops iff MM loops. A program that decodes and simulates agrees with direct simulation on all strings up to length 88 for four machines. UU is the model of a general-purpose computer; it is also the machine that recognises ATMA_{TM}, the language of pairs (⟨M⟩,w)(\langle M \rangle, w) with MM accepting ww, a language that is recognisable but not decidable (next pages).

The Church–Turing thesis

Everything that can be computed by an algorithm, in the intuitive sense, can be computed by a Turing machine.

It is a thesis, not a theorem, because "algorithm in the intuitive sense" is not a mathematical notion: it cannot be proved, only supported. The evidence: every proposed formal model of computation (the λ\lambda-calculus of Church, Turing machines, μ\mu-recursive functions of Gödel and Kleene, random-access machines, programming languages, two-stack machines) has turned out to compute the same functions, and no one has found an algorithm that a Turing machine cannot carry out. The strong (or extended) version claims that a Turing machine simulates every reasonable model with only a polynomial slowdown; it is more debatable (it is where quantum computers raise questions). Practical consequences: to show that a language is decidable one may describe an algorithm in plain language; to show it is undecidable one must show that no Turing machine, and by the thesis no algorithm, decides it.

Worked examples

EX 1Which variants add power

Easy

A multitape Turing machine, a nondeterministic Turing machine, a machine whose head may stay in place, a machine with a one-way infinite tape: none recognises a language that a basic Turing machine cannot. A pushdown automaton with one stack does recognise fewer languages (not anbncna^n b^n c^n); with two stacks it recognises all recursively enumerable languages.

EX 2Cost of the simulations

Easy

A 3-tape machine that runs in 10n210 n^2 moves is simulated by a one-tape machine in O((n2)2)=O(n4)O((n^2)^2) = O(n^4) moves. A nondeterministic machine with branching degree 22 that runs tt moves is simulated by breadth-first search over at most 2t2^t configurations after tt moves, hence in time exponential in tt.

EX 3Why breadth-first, not depth-first

Medium

An NTM may have a computation branch that never halts next to a short accepting branch. Depth-first search could follow the infinite branch for ever and never see the accepting one. Breadth-first search examines all configurations of depth 1,2,3,…1, 2, 3, \ldots in turn, so it finds the accepting configuration at its depth.

EX 4Enumerating a language by dovetailing

Medium

The recogniser for "contains bb" accepts bb after 11 move, abab after 22 moves, aabaab after 33. The strings are the 3rd, 5th and 9th in the list ε,a,b,aa,ab,ba,bb,aaa,aab\varepsilon, a, b, aa, ab, ba, bb, aaa, aab. The enumerator prints bb in stage 2+1=32 + 1 = 3, abab in stage 4+2=64 + 2 = 6 and aabaab in stage 8+3=118 + 3 = 11 (the table lists these and the later outputs). The strings a,aa,aaaa, aa, aaa, on which the recogniser loops, are never printed and never block anything.

EX 5Typical questions

GATE level

(a) "A nondeterministic TM is more powerful than a deterministic TM." False (same languages); it may be faster. (b) "Every multitape TM has an equivalent single-tape TM." True. (c) "The Church–Turing thesis is a theorem." False; it is an unprovable thesis. (d) "A language is recursively enumerable iff some enumerator prints it." True. (e) "A PDA with two stacks is as powerful as a TM." True (quoted). (f) "A universal TM simulates any TM given its description." True.

Cheat box

Cheat box

  • Same power as the basic TM: more tapes, two-way or one-way tape, stay moves, bigger alphabet, nondeterminism, enumerators, two stacks, RAM, λ\lambda-calculus.
  • Costs: kk tapes →\to one tape squares the time; NTM →\to DTM exponential (search the tree breadth first).
  • Enumerator from recogniser: dovetailing (stage ss runs the ii-th string for s−is - i moves).
  • Universal TM: input ⟨M⟩\langle M \rangle and ww; recognises ATMA_{TM}.
  • Church–Turing thesis: intuitive algorithm = Turing machine; a thesis, not a theorem.

Traps and GATE patterns

Connections

Recognising versus deciding becomes the central distinction of the next page (decidable and recognisable languages); the universal machine is the engine of the halting problem (undecidability); the strict gap between the first and second stack leads back to the Chomsky hierarchy (hierarchy).

PYQs

2 previous year questions from your book. I re-solved each one myself (0 by running or simulating, 2 by reasoning only); the book's key is shown next to my answer. All PYQs

GATE 2011 · MCQ · 1 markQ55 · page 205 of the book
Which of the following pairs have DIFFERENT
expressive power?
  • (a)Deterministic finite automata (DFA) and Non- deterministic finite automata (NFA)
  • (b). Deterministic push down automata (DPDA) and Non-deterministic push down automata (NPDA)
  • (c). Deterministic single-tape Turning machine and Non-deterministic single tape Turning machine
  • (d). Single-tape Turning machine and multi-tape Turning machine
GATE 2017 · Set 1 · MCQ · 2 marksQ10 · page 242 of the book
Let A and B be finite alphabets and let # be a symbol
outside both A and B. Let f be a total function from A*
to B*. We say f is computable if there exists a Turing
machine M which given an input x  ∈  A*, always halts
with f(x) on its tape. Let Lf denote the language {x #
f(x)│x ∈ A* }. Which of the following statements is
true:
  • (a)f is computable if and only if Lf is recursive.
  • (b)f is computable if and only if Lf is recursively enumerable.
  • (c)If f is computable then Lf is recursive, but not conversely.
  • (d)If f is computable then Lf is recursively enumerable, but not conversely.

Self-check

Question 1

How much slower is the one-tape simulation of a kk-tape machine that runs in t(n)t(n) moves?

Show answer

It runs in O(t(n)2)O(t(n)^2) moves.

Question 2

Why does the simulation of an NTM use breadth-first search?

Show answer

A depth-first search could get stuck in an infinite branch and never reach an accepting branch.

Question 3

Is the Church–Turing thesis a theorem?

Show answer

No: it relates an informal notion (algorithm) to a formal one and cannot be proved.

Question 4

How does dovetailing turn a recogniser into an enumerator?

Show answer

In stage ss it runs the recogniser for s−is - i moves on the ii-th string for each i<si < s and prints every string the first time it is accepted.

Revision card

One-screen revision

  • Same languages: multitape, nondeterminism, stay moves, one-way tape, bigger alphabet, enumerators, two stacks.
  • Time: t→t2t \to t^2 (multitape), t→2O(t)t \to 2^{O(t)} (NTM, breadth first).
  • Dovetailing; universal machine UU; encoding ⟨M⟩\langle M \rangle.
  • Church–Turing thesis: a thesis about algorithms.

References

  • ·Sipser, Introduction to the Theory of Computation (3rd edition), Section 3.2 (variants of Turing machines) and Section 3.3 (the definition of algorithm, the Church-Turing thesis)
  • ·Hopcroft, Motwani, Ullman, Introduction to Automata Theory, Languages, and Computation (3rd edition), Section 8.4 (extensions to the basic Turing machine) and Section 8.6 (Turing machines and computers)

Verification

scripts/enum-checks/toc_compute.py: a two-tape machine and a one-tape machine for a^n b^n decide the same language on all strings up to length 10, with 2n + 2 and 2n^2 + 2n + 1 moves (n up to 40); a nondeterministic machine for 'the third symbol from the end is a' equals its predicate on all strings up to length 9, and the breadth-first simulation (the list of configurations after each move) equals an explicit enumeration of all computation paths, with at most 2^t paths after t moves; the encoding of machines as strings decodes back to the same machine and a universal program that decodes and simulates agrees with direct simulation on four machines and all strings up to length 8; the dovetailing enumerator built from a recogniser prints exactly the strings of the language, each once, in stage i + max(1, moves). The general simulation theorems (every multitape or nondeterministic machine has an equivalent single-tape deterministic machine, with the quoted slowdowns), the equivalence of enumerators with recognisers, the equivalence of the other models of computation and the Church-Turing thesis itself are textbook statements, QUOTED and not machine-proved (the thesis cannot be proved). Textbook chapter references are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand or by a small script (state counts, derivations, parse-tree and move counts, decomposition counts); tables and animations are machine output and were read, not re-run; No other defect found. Status raised to self-checked; verified needs a textbook or human check.

last verified: never