Mathlib theorem · Existing formal mathematics

Existing in Mathlib · Computability and logic

Undecidability of the Halting Problem

Fix one input and vary the encoded program. No single computable test can correctly decide for every code whether its evaluation on that input eventually returns a value.

Exact theorem

Exact Mathlib statement

theorem ComputablePred.halting_problem (n : ℕ) : ¬ComputablePred (fun c ↦ (c.eval n).Dom)

The theorem at a glance

The Halting Problem at a glance

A visual guide to the theorem's hypotheses, structure, and conclusion; the exact statement gives the formal detail.

No computable predicate decides defined evaluation for every code at a fixed input. Explanatory diagram.
Detailed visual description

The poster separates the theorem's fixed input and encoded-program quantification from the two Rice witnesses, making noncomputability rather than long running time the central conclusion.

Statement structure

Statement and scope

Statement map for Undecidability of the Halting ProblemFor every fixed input, Mathlib's predicate that an encoded program is defined on that input is not computable. Claim boundary: This target indexes Mathlib's encoding-specific theorem that, for a fixed input n, the predicate saying a coded computation c halts on n is not computable. It does not quantify over arbitrary machine models or claim a new undecidability proof. The pinned upstream declaration is ComputablePred.halting_problem. The complete formal statement is available in the Exact Mathlib statement section.Mathematical readingFor every fixed input,Mathlib's predicate thatan encoded program isdefined on that input isnot computable.Claim boundaryThis target indexesMathlib'sencoding-specifictheorem that, for afixed input n, thepredicate saying a codedcomputation c halts on nis not computable. Itdoes not quantify overarbitrary machine modelsor claim a newundecidability proof.Pinned declarationmathlib ·ComputablePred.halting_problemStatement map for Undecidability of the Halting ProblemFor every fixed input, Mathlib's predicate that an encoded program is defined on that input is not computable. Claim boundary: This target indexes Mathlib's encoding-specific theorem that, for a fixed input n, the predicate saying a coded computation c halts on n is not computable. It does not quantify over arbitrary machine models or claim a new undecidability proof. The pinned upstream declaration is ComputablePred.halting_problem. The complete formal statement is available in the Exact Mathlib statement section.Mathematical readingFor every fixed input,Mathlib's predicate thatan encoded program isdefined on that input isnot computable.Claim boundaryThis target indexesMathlib'sencoding-specifictheorem that, for afixed input n, thepredicate saying a codedcomputation c halts on nis not computable. Itdoes not quantify overarbitrary machine modelsor claim a newundecidability proof.Pinned declarationmathlib ·ComputablePred.halting_problem

Read the exact Mathlib declaration

This map summarizes the statement's structure; the exact Mathlib declaration remains authoritative.

A computable fixed-input halting classifier would decide a nontrivial semantic property forbidden by Rice's theorem. Explanatory scientific diagram.
Detailed visual description

The same fixed input passes through a proposed classifier with varied program codes. One computation resolves to a defined endpoint and another remains nowhere defined, making the semantic distinction nontrivial before the contradiction folds back on the classifier.

Why it matters

A mathematical landmark

Halting undecidability marks a fundamental limit on algorithmic prediction. Mathlib's theorem proves an exact fixed-input version for its own code and partial-evaluation model through Rice's theorem.

Proof architecture

A Rice-theorem proof of fixed-input halting undecidability

2 curated stages

Mathlib fixes one input and treats defined evaluation as a semantic property of encoded partial-recursive programs. Rice's theorem rules out a computable classifier once the defined zero function and the nowhere-defined function witness that the property is nontrivial.

These source-anchored stages explain the retained Mathlib proof route. They are generated explanations, not proof evidence or an extracted Lean proof-term dependency graph.

  1. A proposed decider classifies codes by their behavior at one input

    Fixing n, the hypothetical computable predicate would separate exactly the codes whose partial evaluation at n is defined.

    ComputablePred (fun c ↦ (c.eval n).Dom)

    The selected theorem fixes a natural-number input and varies Mathlib codes c. Its contradiction assumption is a computable predicate for the semantic class of partial-recursive functions defined at that input, the precise input required by ComputablePred.rice.

  2. One witness halts and one never returns

    The zero function belongs to the fixed-input halting class while the nowhere-defined function does not, so Rice's theorem rejects the decider.

    ¬ComputablePred (fun c ↦ (c.eval n).Dom)

    The one-line proof supplies Nat.Partrec.zero and Nat.Partrec.none to Rice's theorem. The first computation is defined at the fixed input; the second has no value there. A computable classifier for this nontrivial semantic difference would contradict Rice's theorem.

ProofAtlas record

What has been checked

Upstream indexedPinned source bytes verified locally
Locally reproducedExact upstream declaration replayed
Reviewed pageCurrent public presentation reviewed
Accepted Atlas resultNot recorded for the preferred artifact

Mathlib is the source of the theorem; the local Lean replay and page review are separate.

Claim boundary

No new theorem is claimed

This target indexes Mathlib's encoding-specific theorem that, for a fixed input n, the predicate saying a coded computation c halts on n is not computable. It does not quantify over arbitrary machine models or claim a new undecidability proof.

Source and local evidence

Where the theorem comes from

Existing declaration
ComputablePred.halting_problem in mathlib
Relationship
The checked artifact is the upstream declaration itself
Local Lean evidence
artifact.library.mathlib.halting-problem.v001
Source
Open the pinned upstream reference