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 PoincareLib.Geometry.Curvature.Integral.Concentration.MaximalRadius |
| 2 | |
| 3 | /-! |
| 4 | # Spires relative to a compact subset |
| 5 | |
| 6 | Restrict a positive radius function to the compact metric subtype and transport |
| 7 | the finite punctured cover back to the ambient space. The maximal-radius |
| 8 | application retains its ambient ascent and maximality properties. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | |
| 15 | namespace Poincare.CurvatureIntegral |
| 16 | |
| 17 | /-- The spires relative to a compact subset are finite, and finitely many |
| 18 | punctured ambient balls centered in that subset cover their complement. -/ |
| 19 | theorem exists_finite_punctured_ball_cover_on_subset |
| 20 | {X : Type*} [MetricSpace X] {K : Set X} (hK : IsCompact K) |
| 21 | (b : X → ℝ) (hb : ∀ x ∈ K, 0 < b x) : |
| 22 | ∃ F S : Finset X, (F : Set X) ⊆ K ∧ (S : Set X) ⊆ K ∧ |
| 23 | (S : Set X) = {x | x ∈ K ∧ ∀ y ∈ K, y ≠ x → b y ≤ dist y x} ∧ |
| 24 | K \ (S : Set X) ⊆ ⋃ y ∈ F, Metric.ball y (b y) \ {y} := by |
| 25 | classical |
| 26 | let : CompactSpace K := isCompact_iff_compactSpace.mp hK |
| 27 | obtain ⟨F, S, hS, hcover⟩ := exists_finite_punctured_ball_cover |
| 28 | (isCompact_univ : IsCompact (univ : Set K)) |
| 29 | (fun x : K => b x) (fun x => hb x x.property) |
| 30 | refine ⟨F.image Subtype.val, S.image Subtype.val, ?_, ?_, ?_, ?_⟩ |
| 31 | · intro x hx |
| 32 | obtain ⟨y, _, rfl⟩ := Finset.mem_image.mp hx |
| 33 | exact y.property |
| 34 | · intro x hx |
| 35 | obtain ⟨y, _, rfl⟩ := Finset.mem_image.mp hx |
| 36 | exact y.property |
| 37 | · ext x |
| 38 | constructor |
| 39 | · intro hx |
| 40 | obtain ⟨y, hy, rfl⟩ := Finset.mem_image.mp hx |
| 41 | have hyS : y ∈ (S : Set K) := hy |
| 42 | rw [hS] at hyS |
| 43 | refine ⟨y.property, ?_⟩ |
| 44 | intro z hz hzy |
| 45 | exact hyS.2 ⟨z, hz⟩ (fun h => hzy (congrArg Subtype.val h)) |
| 46 | · rintro ⟨hxK, hx⟩ |
| 47 | refine Finset.mem_image.mpr ⟨⟨x, hxK⟩, ?_, rfl⟩ |
| 48 | change (⟨x, hxK⟩ : K) ∈ (S : Set K) |
| 49 | rw [hS] |
| 50 | refine ⟨mem_univ _, ?_⟩ |
| 51 | intro y hy |
| 52 | exact hx y y.property (fun h => hy (Subtype.ext h)) |
| 53 | · intro x hx |
| 54 | have hxS : (⟨x, hx.1⟩ : K) ∉ (S : Set K) := by |
| 55 | intro h |
| 56 | exact hx.2 (Finset.mem_image.mpr ⟨⟨x, hx.1⟩, h, rfl⟩) |
| 57 | obtain ⟨y, hy, hxy, hne⟩ := mem_iUnion₂.mp (hcover ⟨mem_univ _, hxS⟩) |
| 58 | refine mem_iUnion₂.mpr ⟨y.val, Finset.mem_image.mpr ⟨y, hy, rfl⟩, ?_, ?_⟩ |
| 59 | · exact hxy |
| 60 | · intro h |
| 61 | exact hne (Subtype.ext (mem_singleton_iff.mp h)) |
| 62 | |
| 63 | /-- Ambient maximal ascent radii give a finite cover whose centers and spire |
| 64 | test are confined to the given compact subset. -/ |
| 65 | theorem exists_maximal_regular_radius_finite_punctured_cover_on_subset |
| 66 | {X : Type*} [MetricSpace X] |
| 67 | (hX : Poincare.Alexandrov.CurvatureGEnegOne X) |
| 68 | (hgeo : ∀ x y : X, ∃ γ : ℝ → X, γ 0 = x ∧ γ 1 = y ∧ |
| 69 | ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 70 | dist (γ s) (γ t) = |s - t| * dist x y) |
| 71 | (hpacking : ∀ α : ℝ, 0 < α → ∃ N : ℕ, |
| 72 | Poincare.Alexandrov.ComparisonAnglePackingBound X α N) |
| 73 | {c R : ℝ} (hc0 : 0 ≤ c) (hc1 : c < 1) (hR : 0 < R) |
| 74 | {K : Set X} (hK : IsCompact K) : |
| 75 | ∃ b : X → ℝ, ∃ F S : Finset X, |
| 76 | (∀ p, 0 < b p ∧ 2 * b p ≤ R) ∧ |
| 77 | (∀ p y : X, 0 < dist p y → dist p y < 2 * b p → |
| 78 | ∀ s : ℝ, 0 < s → ∃ z : X, |
| 79 | dist y z < s ∧ c * dist y z < dist p z - dist p y) ∧ |
| 80 | (∀ p : X, ∀ a : ℝ, 0 ≤ a → 2 * a ≤ R → |
| 81 | (∀ y : X, 0 < dist p y → dist p y < 2 * a → |
| 82 | ∀ s : ℝ, 0 < s → ∃ z : X, |
| 83 | dist y z < s ∧ c * dist y z < dist p z - dist p y) → a ≤ b p) ∧ |
| 84 | (F : Set X) ⊆ K ∧ (S : Set X) ⊆ K ∧ |
| 85 | (S : Set X) = {x | x ∈ K ∧ ∀ y ∈ K, y ≠ x → b y ≤ dist y x} ∧ |
| 86 | K \ (S : Set X) ⊆ ⋃ y ∈ F, Metric.ball y (b y) \ {y} := by |
| 87 | obtain ⟨b, hb, hascent, hmax⟩ := |
| 88 | exists_maximal_regular_radius_function hX hgeo hpacking hc0 hc1 hR |
| 89 | obtain ⟨F, S, hFK, hSK, hS, hcover⟩ := |
| 90 | exists_finite_punctured_ball_cover_on_subset hK b (fun x _ => (hb x).1) |
| 91 | exact ⟨b, F, S, hb, hascent, hmax, hFK, hSK, hS, hcover⟩ |
| 92 | |
| 93 | end Poincare.CurvatureIntegral |