Chapter 7

Turing machines and computability

A recogniser must eventually accept members. A decider must also finish rejecting every nonmember. This termination distinction drives the classification of decision problems.

7.1 Machine model and simulation

A deterministic Turing machine has finite states QQ, input alphabet Σ\Sigma, tape alphabet Γ⊇Σ\Gamma\supseteq\Sigma containing a blank □∉Σ\square\notin\Sigma, a start state and halting accept/reject states. A transition reads one tape symbol, writes one symbol, changes state and moves left or right. A stay-put move is an equivalent convention.

To decide anbncna^nb^nc^n, first check block order, then repeatedly mark one unmarked aa, one bb and one cc. Reject an unmatched block; accept when all are marked. Every round marks symbols, so this algorithm terminates.

Multitape and nondeterministic Turing machines have the same language-recognition power as the standard model. A deterministic simulation of nondeterminism explores the finitely branching computation tree level by level. Following one branch forever is invalid. Two stacks can simulate a tape: one stores cells to the left of the head, the other the current/right region. One ordinary stack gives only PDA power.

7.2 Decidable and recognisable languages

Past papers · CS 2014–2026 (23 papers): 3 questions, 4 marks

A language is decidable (recursive, DEC) if a TM halts on every input and answers membership correctly. It is recognisable (recursively enumerable, RE, semidecidable) if a TM accepts every member and never accepts a nonmember; on a nonmember it may reject or loop. A machine that halts on every input is a decider for its own accepted language, not necessarily for a separately specified LL.

LLL‾\overline LPossible?
DECDECYes
RE but not DECNot REYes
Not RERE but not DECYes
Not RENot REYes
RE but not DECRE but not DECNo

7.3 Enumeration and total-function graphs

Past papers · CS 2014–2026 (23 papers): 1 question, 2 marks

A language is RE exactly when some effective enumerator prints its members, with repetition and arbitrary order allowed. Simulate a recogniser on all strings by dovetailing: at stage tt, simulate the first tt inputs for tt steps and print detected members. To recognise a member from an enumerator, wait until it is printed. Empty languages have an enumerator that prints nothing.

Given a computable ff, compute it and compare with the proposed output. Given an RE graph, dovetail its recogniser on x#yx\#y for all possible yy; totality ensures one will accept. A finite output alphabet permits effective enumeration of all candidate outputs.

7.4 Hierarchy and countability

Past papers · CS 2014–2026 (23 papers): 4 questions, 6 marks

The inclusions below are strict for the usual alphabets with at least two symbols. Unary alphabets have special collapses such as CFL = REG.

The recognisable languages split into decidable and recognisable undecidable languages, with further languages outside recognisability.The recognisable languages split into decidable and recognisable undecidable languages, with further languages outside recognisability.

List strings by length and then lexicographically to establish countability. A diagonal choice differs from each language in any proposed list at its assigned string, proving that all languages cannot be listed. Only countably many machines exist, so most languages have no recogniser. Every infinite regular language has undecidable subsets: its power set is uncountable, whereas all decidable languages form a countable family.

For Chomsky terminology: type 3 means regular grammar/finite automaton, type 2 means CFG/NPDA, type 1 means context-sensitive grammar/linear-bounded automaton, and type 0 means unrestricted grammar/Turing machine. Context-sensitive languages lie between CFL and DEC, with the usual convention allowing ϵ\epsilon separately. No detailed type-1 construction is needed here.

Complexity classes P and NP consist of decidable languages. P, NP and NP-completeness are not in the GATE 2027 CS syllabus.

Last-minute recall

  • A decider halts correctly on both members and nonmembers.
  • A recogniser may loop only on nonmembers.
  • RE plus co-RE equals DEC.
  • Enumerators need not print in order or stop.
  • Dovetail independent searches; do not wait forever for one computation.
  • Totality matters when computing a function from its graph.
  • There are countably many programs but uncountably many languages.

Revise offline: the whole Theory of Computation handbook as one PDF

40 pages · 1.7 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections