Back to catalogue
Computer ScienceComputability theorySolved

The Halting Problem

No general algorithm can decide whether an arbitrary program will terminate.

Problem statement

Is there an algorithm that decides, for every program and input, whether the program eventually halts?

In plain language

No program can inspect another program and always tell whether it will finish. Turing proved this by building a program that contradicts any such inspector.

How it came about

The record begins in 1936. Turing proves that no general algorithm can decide whether an arbitrary program halts. It is associated with Alan Turing.

Details
Originator
Alan Turing
Proposed
1936
Prize
None recorded
Editorial status
Solved
Monetary award
None recorded
What this status means

A solution has been accepted by the relevant expert community.

Keywords and what they mean
computabilityWhether a problem can be solved by an algorithm at all.
undecidabilityNo algorithm can decide every instance.
foundationsThe basic assumptions underlying a subject.
Sources (3)
Proof sketch

Assume a program H decides whether any program P halts on input I. Build a program D that asks H about its own behaviour and then does the opposite. If H says D halts, D loops forever. If H says D loops, D halts. The contradiction rules out H.

Mechanised proof: Halting problem in mathlib4 (Lean) ↗

What a machine check proves ->

Tracking history
See all tracking updates ->
Editorial note

Proved undecidable by Alan Turing in 1936, a foundational result in computability theory.

Found an error or a missing source? Open a public correction thread ↗

Public discussion
All public threads ↗

Comments are public and need a GitHub account. A comment does not change the editorial status of this entry. For a claimed proof, link the manuscript, its date and the step you believe is new.

Start a public thread ↗How claims are handled ->

If the thread does not load, open it on GitHub ↗

Keep exploring

More in Computer Science

View discipline ->
Computer ScienceOpen

P versus NP

Whether every problem whose solution can be checked quickly can also be solved quickly.

Computer ScienceOpen

NP versus co-NP

Whether problems with efficiently verifiable "yes" answers also have efficiently verifiable "no" answers.

Computer ScienceOpen

P versus PSPACE

Whether polynomial time and polynomial space define the same class of problems.