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.Connected.Clopen |
| 2 | import Mathlib.Topology.Order.Compact |
| 3 | import Mathlib.Analysis.Normed.Group.Basic |
| 4 | import Mathlib.Algebra.Order.BigOperators.Group.Finset |
| 5 | |
| 6 | /-! |
| 7 | # Propagating eventual bounds by local oscillation |
| 8 | |
| 9 | On a connected space, a sequence with locally uniformly bounded oscillation |
| 10 | and a bound at one point is eventually uniformly bounded on every compact set. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology |
| 17 | |
| 18 | namespace Poincare.Analysis |
| 19 | |
| 20 | theorem eventually_uniform_abs_bound_on_compact_of_local_oscillation |
| 21 | {X : Type*} [TopologicalSpace X] [PreconnectedSpace X] |
| 22 | (f : ℕ → X → ℝ) |
| 23 | (hosc : ∀ x : X, ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ |
| 24 | ∃ C : ℝ, ∀ᶠ k in atTop, ∀ y ∈ U, ∀ z ∈ U, |f k y - f k z| ≤ C) |
| 25 | {p : X} (hp : ∃ C : ℝ, ∀ᶠ k in atTop, |f k p| ≤ C) |
| 26 | {K : Set X} (hK : IsCompact K) : |
| 27 | ∃ C : ℝ, 0 ≤ C ∧ ∀ᶠ k in atTop, ∀ x ∈ K, |f k x| ≤ C := by |
| 28 | classical |
| 29 | let B : Set X := {x | ∃ C : ℝ, ∀ᶠ k in atTop, |f k x| ≤ C} |
| 30 | have transfer {U : Set X} {D : ℝ} |
| 31 | (hD : ∀ᶠ k in atTop, ∀ y ∈ U, ∀ z ∈ U, |f k y - f k z| ≤ D) |
| 32 | {x y : X} (hx : x ∈ U) (hy : y ∈ U) (hbx : x ∈ B) : y ∈ B := by |
| 33 | obtain ⟨C, hC⟩ := hbx |
| 34 | refine ⟨D + C, ?_⟩ |
| 35 | filter_upwards [hD, hC] with k hk hck |
| 36 | calc |
| 37 | |f k y| = |(f k y - f k x) + f k x| := by congr 1; ring |
| 38 | _ ≤ |f k y - f k x| + |f k x| := abs_add_le _ _ |
| 39 | _ ≤ D + C := add_le_add (hk y hy x hx) hck |
| 40 | have hBo : IsOpen B := by |
| 41 | rw [isOpen_iff_forall_mem_open] |
| 42 | intro x hbx |
| 43 | obtain ⟨U, hU, hx, D, hD⟩ := hosc x |
| 44 | exact ⟨U, fun y hy => transfer hD hx hy hbx, hU, hx⟩ |
| 45 | have hBc : IsClosed B := by |
| 46 | rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open] |
| 47 | intro x hbx |
| 48 | obtain ⟨U, hU, hx, D, hD⟩ := hosc x |
| 49 | exact ⟨U, fun y hy hby => hbx (transfer hD hy hx hby), hU, hx⟩ |
| 50 | have hB : B = univ := (show IsClopen B from ⟨hBc, hBo⟩).eq_univ ⟨p, hp⟩ |
| 51 | have hlocal (x : X) : ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ |
| 52 | ∃ C : ℝ, ∀ᶠ k in atTop, ∀ y ∈ U, |f k y| ≤ C := by |
| 53 | obtain ⟨U, hU, hx, D, hD⟩ := hosc x |
| 54 | obtain ⟨C, hC⟩ : x ∈ B := by rw [hB]; trivial |
| 55 | refine ⟨U, hU, hx, D + C, ?_⟩ |
| 56 | filter_upwards [hD, hC] with k hk hck y hy |
| 57 | calc |
| 58 | |f k y| = |(f k y - f k x) + f k x| := by congr 1; ring |
| 59 | _ ≤ |f k y - f k x| + |f k x| := abs_add_le _ _ |
| 60 | _ ≤ D + C := add_le_add (hk y hy x hx) hck |
| 61 | choose U hU hx C hC using hlocal |
| 62 | obtain ⟨t, ht⟩ := hK.elim_finite_subcover U hU |
| 63 | (fun x _ => mem_iUnion.mpr ⟨x, hx x⟩) |
| 64 | refine ⟨∑ x ∈ t, max (C x) 0, Finset.sum_nonneg (fun _ _ => le_max_right _ _), ?_⟩ |
| 65 | have he := (Filter.eventually_all_finite t.finite_toSet).mpr (fun x _ => hC x) |
| 66 | filter_upwards [he] with k hk x hxK |
| 67 | obtain ⟨y, hy, hxy⟩ := mem_iUnion₂.mp (ht hxK) |
| 68 | exact (hk y hy x hxy).trans ((le_max_left _ _).trans |
| 69 | (Finset.single_le_sum (fun z _ => le_max_right (C z) 0) hy)) |
| 70 | |
| 71 | end Poincare.Analysis |