Foundations
Computability Theory
What can be computed? Turing machines, decidability, the Church-Turing thesis, recursive and recursively enumerable sets, reductions, Rice's theorem, and connections to learning theory.
Why This Matters
Before asking whether a problem is efficient, you must ask whether it is solvable at all. Computability theory draws the boundary between problems that any algorithm can solve and problems that no algorithm can solve, regardless of time or space.
This is not abstract philosophy. In ML, certain concept classes are provably not PAC-learnable for computability reasons, not sample complexity reasons. If the hypothesis class involves solving an undecidable problem during evaluation, no learner can succeed. The halting problem is the canonical example of an undecidable problem, and its proof technique (diagonalization) recurs throughout set theory, complexity theory, and learning theory.
Core Definitions
Turing Machine
A Turing machine is a 7-tuple where:
- is a finite set of states
- is a finite input alphabet (not containing the blank symbol )
- is the tape alphabet
- is the transition function
- is the start state
- are the accepting and rejecting states
The machine reads from an infinite tape, one cell at a time, writes a symbol, moves left or right, and transitions to a new state. It halts when it enters or .
Decidable Language (Recursive Set)
A language is decidable (recursive) if there exists a Turing machine that halts on every input and accepts exactly the strings in . That is, for every , halts and outputs "accept" if or "reject" if .
Semi-Decidable Language (Recursively Enumerable Set)
A language is semi-decidable (recursively enumerable, or r.e.) if there exists a Turing machine that accepts exactly the strings in . If , then halts and accepts. If , then may reject or may run forever.
Many-One Reduction
Language is many-one reducible to language , written , if there exists a computable function such that for all :
If and is decidable, then is decidable. Equivalently, if is undecidable and , then is undecidable.
The Church-Turing Thesis
The Church-Turing thesis is not a theorem. It is a claim about the physical world: every function that is "effectively computable" by any mechanical procedure is computable by a Turing machine. Evidence for this thesis includes the fact that every alternative model of computation (lambda calculus, recursive functions, register machines, cellular automata) computes exactly the same class of functions.
The thesis has practical force: if you cannot solve a problem with a Turing machine, you cannot solve it with any physical device. Quantum computers do not change this. They may be faster, but they compute the same set of functions.
The Halting Problem
Undecidability of the Halting Problem
Statement
The halting problem is undecidable. There is no Turing machine that, given an arbitrary Turing machine and input , always correctly determines whether halts on .
Intuition
If a halting decider existed, you could use it to construct a machine that does the opposite of what it is predicted to do. This self-referential contradiction is the same diagonal argument that Cantor used to prove the reals are uncountable.
Proof Sketch
Assume for contradiction that decides HALT: accepts if halts on and rejects otherwise. Construct a new machine : on input , run . If accepts (meaning halts on its own description), then loops forever. If rejects (meaning does not halt on its own description), then halts.
Now run on . If halts on , then accepts, so loops. If does not halt on , then rejects, so halts. Both cases yield a contradiction. Therefore cannot exist.
Why It Matters
The halting problem is the canonical undecidable problem. Most undecidability results in computer science are proved by reducing from HALT. It also shows that general program verification is impossible: no tool can check all programs for all properties. This is why static analysis, type checking, and formal verification must all restrict the class of programs or properties they consider.
Failure Mode
The proof requires the ability of Turing machines to simulate other Turing machines (universality). In restricted computational models (finite automata, pushdown automata), the halting problem is decidable because these models always halt or can be checked for loops in bounded time.
Decidability Hierarchy
The three-level classification:
| Class | Definition | Closure Properties | Example |
|---|---|---|---|
| Decidable | TM halts on all inputs, accepts | Union, intersection, complement | |
| Semi-decidable (r.e.) | TM accepts , may loop on | Union, intersection | HALT |
| Co-semi-decidable (co-r.e.) | Complement is semi-decidable | Union, intersection |
A language is decidable if and only if it is both semi-decidable and co-semi-decidable. This gives a useful proof technique: to show a language is decidable, show that both it and its complement are r.e.
Rice's Theorem
Rice's Theorem
Statement
Let be any nontrivial property of r.e. languages (i.e., some TMs have the property and some do not). Then the set
is undecidable.
Intuition
You cannot decide anything nontrivial about what a program computes by inspecting it. "Does this program ever output 1?" is undecidable. "Does this program compute a total function?" is undecidable. "Does this program compute the same function as that program?" is undecidable. The only decidable properties of programs are trivial ones (satisfied by all programs or no programs) or syntactic ones (about the code text, not its behavior).
Proof Sketch
Reduce from HALT. Given the property , let be a machine whose language has property (exists by nontriviality). Given input to the halting problem, construct a machine that on input first simulates on . If halts, then simulates on . If does not halt, loops. Then has property if and only if halts on . A decider for would therefore decide HALT, contradicting the halting theorem.
Why It Matters
Rice's theorem is a sweeping impossibility result. It explains why fully automatic program analysis is impossible in general: any question about program behavior (not syntax) that has both yes-instances and no-instances is undecidable. Practical tools (linters, type checkers, model checkers) work by restricting the class of programs or by being sound but incomplete (they may reject valid programs or accept invalid ones).
Failure Mode
Rice's theorem applies only to semantic properties (properties of the language ). Syntactic properties of the machine description, such as "does the machine have exactly 7 states?" or "does the source code contain the string 'hello'?", are decidable because they do not require running the machine.
Reductions and the Undecidability Zoo
Many-one reductions establish a hierarchy of undecidable problems. If , then is at least as hard as . The standard technique for proving a new problem undecidable is:
- Choose a known undecidable problem (often HALT).
- Construct a computable function such that .
- Conclude that is undecidable.
Undecidability of the emptiness problem
The language is undecidable. This follows immediately from Rice's theorem (emptiness is a nontrivial semantic property). Alternatively, reduce from HALT directly: given , construct that ignores its input, simulates on , and accepts if halts. Then iff does not halt on .
Connection to Learning Theory
Computability imposes hard limits on learnability. A concept class over is PAC-learnable only if there exists an algorithm that, given samples, outputs a hypothesis consistent with the target concept. If evaluating membership in concepts from requires solving an undecidable problem, no such algorithm exists.
More precisely: if the concept class consists of all r.e. sets, then even with infinite data, a learner cannot distinguish between a concept that accepts a given string after a very long computation and one that loops forever on that string. Sample complexity bounds become irrelevant when the hypothesis class itself is not computable.
Common Confusions
Computable does not mean efficient
A function is computable if some Turing machine computes it, with no bound on running time. A function is efficiently computable if it can be computed in polynomial time. The class of decidable problems is vastly larger than P. Integer factoring is decidable (try all factors). Whether it is in P is unknown. The P vs NP question lives entirely within the decidable world. Computability theory asks what is solvable at all; complexity theory asks what is solvable quickly.
Semi-decidable is not the same as half-decidable
A semi-decidable language has a TM that says "yes" when the answer is yes but may never respond when the answer is no. It does not mean the TM gets the right answer half the time. Semi-decidability is about completeness (all yes-instances are found) without soundness of rejection (no-instances may never be classified).
The Church-Turing thesis is not a theorem
The Church-Turing thesis cannot be proved because "effectively computable" is an informal notion. It is a claim about the physical world, supported by the equivalence of every proposed model of computation. If someone built a physical device that computed a non-Turing-computable function, the thesis would be falsified. No such device is known or believed to exist.
Exercises
Problem
Show that the language is decidable by describing a Turing machine that decides it.
Problem
Prove that if is decidable, then (the complement of ) is also decidable.
Problem
Prove that the language is undecidable using Rice's theorem or by reduction from HALT.
Problem
Give an example of a language that is semi-decidable but not decidable, and prove both claims.
Problem
The concept class over consists of all decidable languages. Is PAC-learnable? Explain why computability, not sample complexity, is the bottleneck.
References
Canonical:
- Sipser, Introduction to the Theory of Computation (2013), Chapters 3-5
- Rogers, Theory of Recursive Functions and Effective Computability (1987), Chapters 1-7
Additional:
- Hopcroft, Motwani, Ullman, Introduction to Automata Theory, Languages, and Computation (2006), Chapter 9
- Cutland, Computability: An Introduction to Recursive Function Theory (1980), Chapters 1-4
Connection to ML:
- Shalev-Shwartz and Ben-David, Understanding Machine Learning (2014), Chapter 8 (computational complexity of learning)
- Ben-David et al., "Learnability can be undecidable" (Nature Machine Intelligence, 2019)
Next Topics
- P vs NP: once you know a problem is decidable, the next question is whether it is efficiently decidable
- Kolmogorov complexity: an alternative lens on computability that measures the information content of individual strings
Last reviewed: April 2026
Prerequisites
Foundations this topic depends on.
- Basic Logic and Proof TechniquesLayer 0A
- Sets, Functions, and RelationsLayer 0A