Undecidable is proved, not unknown
It is not that nobody has found an algorithm. It is that none can exist, and the proof is a page long.
The halting problem is undecidable: no program can determine, for every program and input, whether it terminates. The proof is a diagonal argument and it fits on a page.
Core ideas
Undecidability is a theorem, not a state of ignorance, and its proof uses the same self-reference Logic and Proof excluded from propositions.
It is not that nobody has found an algorithm. It is that none can exist, and the proof is a page long.
Assume the decider exists, build a program that does the opposite of what it predicts, and ask about that program.
Every nontrivial question about what a program computes is undecidable, which is why static analysis is necessarily approximate.
The material
Decidability, the halting problem, the proof, and what follows.
A decision problem is decidable if some algorithm terminates on every input with the correct yes/no answer. Otherwise it is undecidable.
Note what undecidable does not mean. Not "hard", not "exponential", not "nobody has managed it". It means no algorithm exists and none ever will, and the statement is a theorem.
There is no algorithm H(P, x) that, for every program P and input x, terminates and correctly reports whether P halts on x.
Suppose such an H exists. Build a program D that takes one input P — the source of a program — and does the following: run H(P, P); if H says P halts on input P, then loop forever; if H says P does not halt, then halt immediately.
D is a perfectly ordinary program: it calls H, which by assumption always terminates, and then branches.
Now ask what D does on input D.
If D halts on D, then H(D, D) reported "halts", so by construction D loops forever. Contradiction.
If D does not halt on D, then H(D, D) reported "does not halt", so by construction D halts immediately. Contradiction.
Both cases are impossible, so H cannot exist.
□
The structure is exactly the diagonal argument of “Cardinality and Countability”, in Sets, Relations, and Functions: assume a complete listing or a complete decider, construct the object that differs from every entry, and derive a contradiction. Cantor used it against enumerations of the reals; Turing used it against deciders.
It is also the self-reference “Propositions and Truth Values” in Logic and Proof excluded from propositions, reappearing where it cannot be excluded: programs can take programs as input, and D is applied to itself. That is not a trick, it is what makes computation universal.
Every nontrivial property of the function a program computes is undecidable. "Nontrivial" means some programs have it and some do not.
So all of the following are undecidable: does this program ever output 0? do these two programs compute the same function? does this program ever access an unallocated address? is this code reachable? does this loop terminate?
This is why static analysis tools are necessarily conservative. A compiler warning about unreachable code, a type system, a linter and a verifier all approximate: they may report a problem that does not exist or miss one that does, and Rice's theorem says no tool can do otherwise for every program.
The path ends here, and the position is worth stating plainly. Logic and Proof made statements precise; Induction and Recursion gave the technique for proving them; counting, probability, number theory and graph theory built the structures; and this course measured the cost of computing with them. The last two lessons say what cost cannot be paid at all — some problems are intractable, and some are outside the reach of any algorithm whatever.
Interactive
Counts from running, not from quoting
Method
Ask what is being asked about.
"Does it halt", "does it output", "are these equivalent". Rice's theorem makes all such nontrivial questions undecidable.
If a decider for your problem would give one for halting, yours is undecidable too. That is the standard proof technique.
NP-complete means slow; undecidable means impossible. Different responses are appropriate.
Bounded loops, finite state spaces, restricted languages. Practical verification works by narrowing the question, not by defeating the theorem.
Short enough to reconstruct from memory, and worth being able to.
The whole proof rests on D being a legitimate program, which it is: it calls H, which was assumed to be an algorithm, and then branches. Nothing exotic is required, and that is what makes the conclusion so strong.
Seven lines: assume the decider, build the contrary program, apply it to itself, and read off both contradictions. It is the sharpest argument on this path and the shortest of the major ones.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.