1. Gyanastra
  2. Theory of Computation
  3. Decidability and Undecidability
  4. Definition of Algorithm as a Halting Turing Machine
Free lesson, no account needed 5 min read 11 practice questions after it
Asked in past papers11 times
  • GATE CSE202620212016201520142005200420031987
  • UGC NET20192018

Theory of Computation · Decidability and Undecidability

Definition of Algorithm as a Halting Turing Machine

Overview

An algorithm is formally a Turing machine that is guaranteed to halt. Comparing the countability of algorithms (countable) with the countability of problems (uncountable) proves that some problems have no algorithm at all.

Key concepts

  • Algorithm: A Turing machine that is guaranteed to halt. A general Turing machine is not an algorithm, because it may run forever; only a halting Turing machine qualifies.
  • Computability and decidability: These two terms mean the same thing here — both ask whether there exists an algorithm for a problem.
  • Problem vs. language: Every problem can be identified with a language, so counting languages is the same as counting problems.
  • Uncountable languages: The set of all possible languages is uncountable, so there exist languages for which no machine exists at all — languages that are not even recursively enumerable.
  • Countable Turing machines: The set of all Turing machines is countable.
  • Countable halting Turing machines: Halting Turing machines form a subset of all Turing machines, and every subset of a countable set is countable.
  • Countable algorithms: Since a halting Turing machine is an algorithm, the set of all algorithms is countable.
  • Uncountable problems: The number of languages is uncountable, and every problem corresponds to a language, so the number of problems is uncountable.

How it works

  1. The set of all possible languages is uncountable, so some languages have no machine at all (not even recursively enumerable).
  2. For a problem, "there is an algorithm" means exactly "there is a Turing machine for that problem which always halts." A machine not guaranteed to halt is not an algorithm, because an algorithm must halt after a finite number of steps.
  3. The set of all Turing machines is countable.
  4. Halting Turing machines are a subset of all Turing machines, and every subset of a countable set is countable, so halting Turing machines are countable.
  5. A halting Turing machine is an algorithm, so the set of all algorithms is countable.
  6. The number of languages is uncountable, and every problem corresponds to a language, so the number of problems is uncountable.
  7. Number of problems is uncountable while number of algorithms is countable, so there are some problems for which no algorithm exists (undecidable / uncomputable problems).
  8. The following three statements are used interchangeably:
    • "there is an algorithm for the problem"
    • "there is a Turing machine which halts for the problem"
    • "the problem is computable / decidable"
Figure. A halting Turing machine must halt on every input and is an algorithm. Halting TMs are a countable subset of all TMs, while problems are uncountable, so some problems have no algorithm.

Formulas

  • TM (countable)⊇Halting TM=Algorithm (countable)\text{TM (countable)} \supseteq \text{Halting TM} = \text{Algorithm (countable)} — every subset of a countable set is countable.
  • ∣Languages∣=∣Problems∣=uncountable|\text{Languages}| = |\text{Problems}| = \text{uncountable}; ∣Algorithms∣=countable|\text{Algorithms}| = \text{countable} ⇒\Rightarrow (uncountable−countable)>0(\text{uncountable} - \text{countable}) > 0 problems have no algorithm.
  • Algorithm⇔\text{Algorithm} \Leftrightarrow Turing machine that halts on every input (halts after a finite number of steps).

Comparison

ObjectCountabilityMeaning
Turing machinesCountableGeneral machines; may or may not halt
Halting Turing machinesCountable (subset of TM)Exactly the algorithms
AlgorithmsCountableProcedures that always halt in finite steps
Languages / problemsUncountableSome have no machine at all; some have no algorithm
Turing machineAlgorithm
Need not haltMust halt after a finite number of steps
Larger class (countable)Subclass of halting TMs (countable)

Revision summary

  • An algorithm is a Turing machine that is guaranteed to halt; a non-halting TM is not an algorithm.
  • Computability and decidability mean the same thing here: does an algorithm exist?
  • Turing machines are countable; halting Turing machines (algorithms) are a subset, hence countable.
  • Languages (problems) are uncountable, so some languages are not even recursively enumerable, and some problems have no algorithm.
  • "There is an algorithm" ⇔\Leftrightarrow "there is a halting Turing machine" — these phrases are used interchangeably.

Previous-year exam insights

  • A language is Turing-decidable (recursive) iff there exists a TM that halts on every input and accepts exactly the strings in the language; a language is recursively enumerable (Turing-recognizable) iff there exists a TM that accepts every string in the language (and may loop forever on strings not in it).
    Decidable ⊂ RE ⊂ all languages, and the inclusion is strict.
    Asked inGATE 2026GATE 2015UGC NET 2019
  • The complement of a decidable language is decidable; the complement of an RE language need not be RE. A language is decidable iff both it and its complement are RE (Post's theorem).
    Asked inGATE 2015GATE 2005
  • Every finite language is decidable/recursive; every regular and every context-free language is decidable.
    NP ⊆ decidable, so every language in NP is Turing decidable (statement 'some NP language is not decidable' is false).
    Asked inGATE 2015
  • A language is recursive iff it can be effectively enumerated in lexicographic order (or in any order by a TM); effective enumerability in lexicographic order implies decidability, since you can compare the generated strings with the input and stop.
    Asked inGATE 2003GATE 2004
  • Bounded-step questions are decidable: for a fixed k, the language {<M> | M takes more than k steps on some input} is decidable, because the first k steps of M depend only on the first k+1 input symbols, so simulating M for k steps on all of the finitely many inputs of length at most k+1 suffices.
    The unbounded halting problem is undecidable.
    Asked inGATE 2021
  • Closure: decidable (recursive) languages are closed under complement, union, intersection, concatenation, Kleene star; RE languages are closed under union, intersection, concatenation, Kleene star but NOT under complement.
    Asked inGATE 2005GATE 2015
Pages 1–2 of 2