Computability and decidability §
Computability and decidability is the study of what can and cannot be computed by a mechanical procedure. It answers “what can be mechanically decided?” and thereby bounds what proofs, algorithms, and machines can achieve. It is relevant whenever you must establish a hard limit — that no algorithm exists at all, not merely that none is known — for a decision problem.
This page takes the decidability angle: which problems are decidable, which are merely semi-decidable, and how the undecidable ones are ranked by the arithmetical hierarchy. The complexity-class angle — how fast a decidable problem can be solved (P, NP, and their relatives) — is treated on the Computer-Science side in Computability and Complexity Classes. The formal 7-tuple definition of a Turing machine and the P/NP machinery live there; this page builds on them rather than re-deriving them.
Authoritative sources
- A. Turing (1936), On Computable Numbers, with an Application to the Entscheidungsproblem
- A. Church (1936), An Unsolvable Problem of Elementary Number Theory
- H. Rogers, Jr., Theory of Recursive Functions and Effective Computability (1967)
- Stanford Encyclopedia of Philosophy: Computability and Complexity
Models of computation §
A model of computation is a precise formal definition of “mechanical procedure.” The three canonical models — Turing machines, the lambda calculus, and the general recursive functions — compute exactly the same class of functions, the computable (or recursive) functions. This robustness across independent definitions is the empirical content of the Church–Turing thesis: every effectively computable function is Turing-computable. The property that matters most for undecidability is universality: a single machine can take the description of any other machine as data and simulate it.
Details
Step 1 — What a model of computation is. A model of computation fixes, in mathematical terms, what counts as a mechanical procedure, so that “computable” stops being a vague word. A Turing machine is the standard choice: a finite control (a finite set of states) that reads and writes one cell of an unbounded tape at a time. The full 7-tuple definition, the notion of a decidable language, and the complexity classes built on top of it are developed on the Computer-Science side in Computability and Complexity Classes; here we only need the machine as a black box that either halts or runs forever.
Step 2 — Universality and self-reference. A Turing machine can be written down as a finite string of symbols, so a machine’s description is itself data. A universal machine reads a pair — the code of a machine and an input — and simulates step for step. Because a machine’s code is just a string, a machine can be handed its own code as input. This self-reference is the engine behind every undecidability proof on this page: it is what lets us build a machine that reasons about its own behavior.
The simulator below runs a concrete Turing machine that decides the language — a decidable (but not regular) language. Load an input and step through to watch the machine mark off matched /1 pairs.
Authoritative sources
Example problem. Why does universality matter for undecidability, and not merely for convenience?
Solution
Every undecidability proof on this page needs a machine to be given its own description as input, so that the machine’s behavior can depend on a prediction about itself. Without universality there is no way to form the self-referential object (the diagonal machine ), and the contradiction never arises. Universality is therefore not an engineering nicety but the logical precondition for the halting-problem argument.
Semi-decidability and recursively enumerable sets §
A set is semi-decidable (or recursively enumerable, r.e.) if some machine halts and accepts exactly the members of , and may run forever on non-members. is decidable iff both and its complement are semi-decidable. is co-semi-decidable when its complement is semi-decidable. The decidable sets sit exactly at the intersection of the semi-decidable and the co-semi-decidable sets.
Details
Step 1 — Decidable vs. semi-decidable. A decider must answer both yes and no in finite time. A semi-decider only has to answer yes in finite time; on a “no” instance it is allowed to loop forever. So every decidable set is semi-decidable, but not conversely: a semi-decider can “miss” the negative answers by never halting on them.
Step 2 — A concrete semi-decidable set. The halting set (the set of machine codes that halt when run on their own code) is semi-decidable: to test whether , run machine on input ; if it halts, accept. If it never halts, the test runs forever — exactly the behavior a semi-decider is allowed to have. We will see in the next section that is not decidable, so it is a genuine example of a set that is semi-decidable but not decidable.
The three-way split is shown below: a set can be decidable (both directions answer), semi-decidable only (positives answer, negatives may loop), co-semi-decidable only (negatives answer, positives may loop), or neither.
Authoritative sources
Example problem. Give a set that is co-semi-decidable but not decidable, and justify it.
Solution
The complement of the halting set, , is co-semi-decidable (its complement is semi-decidable). It is not decidable: if were decidable then would be decidable too (just flip the answer), contradicting the halting problem. So is co-semi-decidable but not decidable.
Decidability and the halting problem §
A decision problem is decidable when some algorithm answers yes or no for every input in finite time. The halting problem — deciding whether a given machine halts on a given input — is undecidable (Turing 1936; Church 1936). Undecidability is not exotic: the satisfiability of first-order logic (the Entscheidungsproblem), the word problem for groups, and many tiling problems are undecidable as well.
Details
Step 1 — Diagonalization. Suppose a decider existed, answering “halts” or “loops” for any machine and input . Build a machine that, on input , runs and does the opposite: if says “ halts on ,” then loops; otherwise halts. Now run on its own code : halts on exactly when it does not — a contradiction. So no such exists. (The same self-referential structure appears in Cantor’s proof that the reals are uncountable. Gödel’s incompleteness theorems reach a similar self-reference by a different route — arithmetization plus the fixed-point lemma, not direct diagonalization — see Mathematical logic.)
The diagram below lays out the diagonal: the rows are machines, the columns are inputs, and the highlighted diagonal is where each machine is run on its own code. The machine is built to disagree with the diagonal everywhere, so at the cell it must both halt and loop.
Authoritative sources
Step 2 — Reductions: spreading undecidability. Once one problem is known undecidable, others follow by reduction. A problem reduces to a problem (written ) if a machine can, given any instance of , produce an instance of that is a “yes” exactly when the original was. If were decidable, then so would be ; so if is undecidable and , then is undecidable too.
Concrete reduction. Show that ACCEPTS-SOMETHING is undecidable by reducing the halting problem to it. Given a halting-problem instance $(M, w)$, build a machine that, on any input , first ignores , simulates , and accepts if and only if halts. Then accepts some input (indeed every input) exactly when halts, so $(M, w) \in \text{HALT} \iff M’ \in \text{ACCEPTS-SOMETHING}$. If ACCEPTS-SOMETHING were decidable, HALT would be — contradiction.
The same reduction pattern proves the undecidability of the first-order Entscheidungsproblem (Church 1936), the word problem for groups (Novikov 1955; Adian 1958), and the tiling problem (Rogers 1952; Berger 1966).
Authoritative sources
Example problem. Reduce the halting problem to the problem ACCEPTS-EMPTY .
Solution
Given $(M, w)$, build that, on input , first erases (overwriting the tape with blanks and returning to the start), then simulates , accepting iff halts. accepts $\varepsilon$ (and in fact every input) exactly when halts, so $(M,w) \in \text{HALT} \iff M’ \in \text{ACCEPTS-EMPTY}$. If ACCEPTS-EMPTY were decidable, HALT would be — contradiction.
The arithmetical hierarchy §
Undecidable problems come in degrees. The arithmetical hierarchy classifies sets of natural numbers by the quantifier pattern needed to define them over a decidable base:
- Σ₁ sets have the form with decidable — exactly the semi-decidable sets.
- Π₁ sets have the form with decidable — exactly the co-semi-decidable sets.
- Σ₂ sets allow one alternation, ; Π₂ sets are ; and so on.
The halting set is Σ₁-complete (it is Σ₁, and every Σ₁ set reduces to it); its complement is Π₁ and not semi-decidable.
Details
Step 1 — The decidable base. A decidable (Δ₀) predicate is one a machine can answer yes/no on in finite time. The hierarchy is built by stacking quantifiers over such a base. The base itself is level 0: a set defined by a decidable predicate with no quantifiers is just decidable.
Step 2 — The Σ₁ / Π₁ base of the hierarchy. Adding a single existential quantifier over a decidable predicate gives Σ₁: . To semi-decide such an , search and accept the first with ; if none exists, the search runs forever. So Σ₁ = semi-decidable. Dually, a single universal quantifier gives Π₁ = co-semi-decidable. Concrete Σ₁ example: the halting set — the predicate “halts within steps” is decidable (simulate for steps), so is Σ₁.
Step 3 — Higher levels. Each further alternation raises the level. Concrete Σ₂ example: the set of machines that halt on every input, . The innermost predicate is decidable, then ∃s, then ∀x: a Σ₂ definition. TOT is not Σ₁ (it is not semi-decidable), which is why the hierarchy does not collapse at level 1.
The nested-boxes diagram below places these examples: Σ₁ (semi-decidable, containing ) and Π₁ (co-semi-decidable, containing ) overlap exactly in the decidable sets, and both sit strictly inside Σ₂, which contains TOT.
Authoritative sources
Example problem. Place the set in the hierarchy, and argue that it is not Σ₁.
Solution
is exactly the Σ₂ set from Step 3, so it is Σ₂. It is not Σ₁: if it were semi-decidable, then its complement (machines that fail to halt on some input, a Σ₁ set) would be co-semi-decidable, and together the two would make TOT decidable — but TOT is Σ₂-complete and not decidable. So TOT is a genuine Σ₂ set, one level above the halting set.
Quizz §
Quizz
Problem. Show that the halting set is Σ₁-complete: (i) is Σ₁, and (ii) every Σ₁ set many-one reduces to .
Solution
(i) is Σ₁. , and the predicate “halts within steps” is decidable (simulate on for steps). So is Σ₁.
(ii) Every Σ₁ set reduces to . Let be any Σ₁ set, with decidable. Build a machine (indexed by ) that, on input , checks and accepts if true. Then halts on input (i.e. ) exactly when there is some with , i.e. exactly when . The map is computable, so . Hence is Σ₁-complete.
Consequence. Because is Σ₁-complete and undecidable, no Σ₁ set can be decidable unless the hierarchy collapses — and the halting problem is the canonical representative of the first level of undecidability.