Extended ScienceCognition

Halting Problem

Definition

No general algorithm can judge, for any program-plus-input, whether it will ever halt or run forever.

Core rule: Draws the hard boundary of "which problems are in principle unsolvable by computers" (kindred to Gödelian incompleteness); explains why perfect antivirus, infinite-loop detection, and automatic program-correctness determination are impossible, and why compilers can only make approximate, conservative judgments.

You've left a program running and the screen still shows nothing. You could give it another second and see whether it finishes.

Or you could shut it down just before it gets to the last step. What if you had a checker that could read the program and its input and tell you whether waiting would pay off?

That's the halting problem. No algorithm can always finish and correctly say whether any given program will eventually stop on a given input. We'll follow Turing's machine on paper and see the one input that a universal checker can't get right.

How it works

Turing first needed a picture of computation you could check one step at a time. In nineteen thirty-six, he described a machine that reads a square on a tape. Its rules tell it what symbol to write, which way to move, and what to do next.

You can write the machine's own instructions as symbols and have another machine read them. A print shop can print a short story or a manual for the printing press. In much the same way, a computing machine can work on instructions, including its own.

  1. 01 · Assume a decider Suppose a function exists that can decide whether any program halts.
  2. 02 · Construct a self-referential program Build a program that deliberately contradicts the verdict.
  3. +2 more mechanism steps & animation in the app

When it fails & limits

That result leaves a lot of room for reasoning about particular programs. Suppose a counter starts at ten and drops by one every time around a loop until it hits zero.

✦ Unlock full lesson in ConceptFlow

Unlock the full Halting Problem lesson in ConceptFlow

You’ve read the core idea and opening case. Get the ConceptFlow app to continue through the full breakdown, failure modes, 5-minute audio lesson, and decision practice.

  • ▸5-minute English & Mandarin audio lesson
  • ▸6 more deep-dive case & mechanism insights
  • ▸All 6 failure boundaries & counter-examples
  • ▸4-point decision checklist + 6-step practice

Tap a store button on mobile, or scan with your phone camera on desktop.