Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import Mathlib.Topology.Instances.Real.Lemmas |
| 2 | import Mathlib.Topology.Order.Basic |
| 3 | import Mathlib.Order.Interval.Set.Infinite |
| 4 | import Mathlib.Data.Set.Finite.Basic |
| 5 | |
| 6 | /-! # Finite regular cuts between critical heights -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | |
| 11 | open Set |
| 12 | |
| 13 | namespace Poincare.Analysis.Calculus.Morse |
| 14 | |
| 15 | /-- A finite set of real heights can be separated by finitely many cuts, |
| 16 | none of which is one of the given heights. -/ |
| 17 | theorem exists_finite_cuts_between {C : Set Real} (hC : C.Finite) : |
| 18 | ∃ A : Set Real, A.Finite ∧ Disjoint A C ∧ |
| 19 | ∀ a ∈ C, ∀ b ∈ C, a < b -> ∃ t ∈ A, a < t ∧ t < b := by |
| 20 | classical |
| 21 | let : Finite C := hC.to_subtype |
| 22 | let J := {p : C × C // (p.1 : Real) < p.2} |
| 23 | have hchoice (p : J) : ∃ t : Real, |
| 24 | t ∈ Ioo (p.val.1 : Real) p.val.2 ∧ t ∉ C := |
| 25 | (Ioo_infinite p.property).exists_notMem_finite hC |
| 26 | choose t ht using hchoice |
| 27 | refine ⟨range t, finite_range t, ?_, ?_⟩ |
| 28 | · rw [disjoint_left] |
| 29 | rintro x ⟨p, rfl⟩ hx |
| 30 | exact (ht p).2 hx |
| 31 | · intro a ha b hb hab |
| 32 | let p : J := ⟨(⟨a, ha⟩, ⟨b, hb⟩), hab⟩ |
| 33 | exact ⟨t p, ⟨p, rfl⟩, (ht p).1⟩ |
| 34 | |
| 35 | /-- Two prescribed heights in the same component of the complement of the |
| 36 | separating cuts must coincide. -/ |
| 37 | theorem eq_of_same_connected_component_of_cuts |
| 38 | {C A : Set Real} |
| 39 | (hcuts : ∀ a ∈ C, ∀ b ∈ C, a < b -> ∃ t ∈ A, a < t ∧ t < b) |
| 40 | {a b : Real} (ha : a ∈ C) (hb : b ∈ C) |
| 41 | (hsame : b ∈ connectedComponentIn Aᶜ a) : a = b := by |
| 42 | have hconn := isConnected_connectedComponentIn_iff.mpr |
| 43 | (connectedComponentIn_nonempty_iff.mp ⟨b, hsame⟩) |
| 44 | have ha' : a ∈ connectedComponentIn Aᶜ a := |
| 45 | mem_connectedComponentIn (connectedComponentIn_nonempty_iff.mp ⟨b, hsame⟩) |
| 46 | rcases lt_trichotomy a b with hab | rfl | hba |
| 47 | · obtain ⟨t, ht, hat, htb⟩ := hcuts a ha b hb hab |
| 48 | have htin := hconn.isPreconnected.ordConnected.out ha' hsame ⟨hat.le, htb.le⟩ |
| 49 | exact False.elim ((connectedComponentIn_subset _ _ htin) ht) |
| 50 | · rfl |
| 51 | · obtain ⟨t, ht, hbt, hta⟩ := hcuts b hb a ha hba |
| 52 | have htin := hconn.isPreconnected.ordConnected.out hsame ha' ⟨hbt.le, hta.le⟩ |
| 53 | exact False.elim ((connectedComponentIn_subset _ _ htin) ht) |
| 54 | |
| 55 | end Poincare.Analysis.Calculus.Morse |