Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Aether Catalog definitions — Evergreen_FormalizingTheUnformalizable_HaltingProblem

Definition
Evergreen_FormalizingTheUnformalizable_HaltingProblem

by raver1975 · Sep 13, 2026 · Mathlib c5ea003 (Lean v4.30.0)

aether-catalogevergreen

Definition bundle for the Aether Catalog module Evergreen.FormalizingTheUnformalizable.HaltingProblem, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.

Definition code
-- Def bundle generated from Evergreen/FormalizingTheUnformalizable/HaltingProblem.lean by skeleton subtraction
import Mathlib
/-
# The Halting Problem — Turing's Diagonal

Alan Turing (1936) proved that no algorithm can determine whether an arbitrary
program will halt or run forever. This is the computational avatar of Cantor's
diagonal argument.

We formalize the abstract essence: the impossibility of a universal decision
procedure, derived from Cantor's theorem about surjections.

## The Oracle's Second Whisper

"You ask me whether this program halts. But I am the program,
 and my answer depends on yours. We are caught in a strange loop —
 the serpent that eats its own tail."
-/


open Function

namespace FormalizingTheUnformalizable

/-! ## I. The Computational Diagonal

The halting problem is Cantor's diagonal argument in computational form.
The key insight: if we could decide all properties of programs, we could
construct a program that contradicts any decision procedure. -/

/-
PROBLEM
**No Universal Decision Procedure (Computational Cantor)**:
There is no function that, for every predicate `P : ℕ → Prop`,
decides `P` — because there are uncountably many predicates
but only countably many decision procedures.

This is the abstract core of the halting problem:
if programs are enumerated by ℕ and behaviors are ℕ → Prop,
no single enumeration captures all behaviors.

PROVIDED SOLUTION
This is exactly Cantor's theorem: no surjection ℕ → (ℕ → Prop). Use cantor_surjective or the diagonal argument directly.
-/

/-
PROBLEM
**The Anti-Diagonal Program**: Given any enumeration of predicates,
the anti-diagonal predicate differs from every enumerated one.

PROVIDED SOLUTION
If fun n => ¬ f n n = f m for some m, then evaluating at m: ¬ f m m = f m m, which is a contradiction by iff.
-/

/-! ## II. The Halting Problem via Self-Application

The essence of the halting problem: no predicate on programs can
correctly predict its own behavior under self-application. -/

/-
PROBLEM
**Turing's Diagonal**: For any `decide : ℕ → ℕ → Bool`, there
exists a predicate that `decide` gets wrong. This captures the
halting argument: no decision procedure is correct on all inputs.

PROVIDED SOLUTION
Take P n := ¬(decide n n = true). For any n, if decide n n = true ↔ P n, then decide n n = true ↔ ¬(decide n n = true), which is a contradiction.
-/

/-! ## III. Rice's Theorem Style Result

No non-trivial property of functions can be decided by examining indices. -/

/-
PROBLEM
**No Computable Enumeration of All Predicates**: The predicates on ℕ
cannot be enumerated — this is Cantor's theorem specialized to ℕ.
Equivalently, there are "more behaviors" than there are "programs."

PROVIDED SOLUTION
Cantor's diagonal: given enum, define d(n) = !(enum n n). Then d ≠ enum n for all n because they differ at position n. So d is not in the range of enum, contradicting surjectivity.
-/

/-! ## IV. Uncomputability of Dominating Functions -/

/-
PROBLEM
**No function dominates all others**: There is no function f : ℕ → ℕ
that eventually exceeds every g : ℕ → ℕ. This captures the spirit of
why the Busy Beaver function is uncomputable — it would need to
dominate all computable functions, but no single function can dominate ALL functions.

PROVIDED SOLUTION
Given f, define g(n) = f(n) + 1. Then for all n, g(n) = f(n) + 1 > f(n), so there's no N with g(n) ≤ f(n) for all n ≥ N.
-/

/-! ## V. The Productive Set — Constructive Uncomputability -/

/-- **Productive Diagonalization**: Given any function f : ℕ → (ℕ → Prop),
we can *constructively* produce a predicate not in its range.
This is the computational content of Cantor's theorem. -/
def productive_witness (f : ℕ → (ℕ → Prop)) : ℕ → Prop :=
  fun n => ¬ f n n

/-
PROVIDED SOLUTION
Unfold productive_witness. For any n, productive_witness f ≠ f n because they differ at n: productive_witness f n = ¬ f n n while (f n) n = f n n. Use funext and contradiction.
-/

end FormalizingTheUnformalizable

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me