Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

The halting problem: a question no computer can answer

Chapters

Narration

Imagine one perfect program. Feed it any code at all, and it tells you whether that code will finish, or spin forever. Call it H, the judge. It would be the most useful tool ever written. And it seems reasonable enough. Most programs are easy. This one obviously stops. That one obviously never will. H handles them all, thousands of them, without breaking a sweat. So here is how you break it. Build a program called D. D has exactly one rule: ask H what I am going to do, and then do the opposite. Now hand D its own source code. D is a program, so it is perfectly valid input. The judge has to predict a program that is standing there listening to the prediction. Suppose H says: this one halts. But D was built to do the opposite of whatever H says. So D loops forever. H was wrong. Fine. Suppose H says the opposite: this one loops. Then D stops immediately, and H is wrong again. Every answer it can possibly give destroys itself. So H cannot exist. Not on a faster machine, not with infinite memory, not ever. Turing found that ceiling in 1936, nine years before anyone built a computer.

Saved in this browser, and to your account when you sign in.