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.Alexandrov.Packing.Basic |
| 2 | import PoincareLib.Geometry.Alexandrov.FiniteApproximation |
| 3 | |
| 4 | /-! |
| 5 | # Comparison-angle packing in pointed metric limits |
| 6 | |
| 7 | Strict comparison-angle separation of a finite configuration persists in |
| 8 | approximating configurations. Consequently a uniform packing bound passes to |
| 9 | bounded pointed Gromov--Hausdorff limits and, by localization to balls, to |
| 10 | unbounded pointed limits. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter Topology |
| 17 | open Poincare.GromovHausdorff |
| 18 | |
| 19 | namespace Poincare.Alexandrov |
| 20 | |
| 21 | /-- Bounded pointed Gromov--Hausdorff limits preserve a uniform packing bound |
| 22 | at the same strict comparison-angle threshold. -/ |
| 23 | theorem comparisonAnglePackingBound_of_pointedGHConverges |
| 24 | {X : ℕ → FiniteDiameterBasedMetricSpace} {Y : FiniteDiameterBasedMetricSpace} |
| 25 | {α : ℝ} {N : ℕ} |
| 26 | (hX : ∀ j, ComparisonAnglePackingBound (X j).carrier α N) |
| 27 | (h : PointedGHConverges X Y) : ComparisonAnglePackingBound Y.carrier α N := by |
| 28 | obtain ⟨f, hf⟩ := exists_approximating_maps_of_pointedGHConverges h |
| 29 | intro k p q hq hangle |
| 30 | have hnonzero (i : Fin k) : ∀ᶠ j in atTop, f j (q i) ≠ f j p := by |
| 31 | have hpos : 0 < dist (q i) p := dist_pos.mpr (hq i) |
| 32 | filter_upwards [(hf (q i) p).eventually_const_lt hpos] with j hj heq |
| 33 | simp only [heq, dist_self, lt_self_iff_false] at hj |
| 34 | have hseparated (i l : Fin k) : ∀ᶠ j in atTop, i ≠ l → |
| 35 | α < comparisonAngle (dist (f j p) (f j (q i))) |
| 36 | (dist (f j p) (f j (q l))) (dist (f j (q i)) (f j (q l))) := by |
| 37 | by_cases hil : i = l |
| 38 | · exact Eventually.of_forall (fun _ hne => (hne hil).elim) |
| 39 | · have hpos (a : Fin k) : 0 < dist p (q a) := dist_pos.mpr (hq a).symm |
| 40 | have ht := tendsto_comparisonAngle (hf p (q i)) (hf p (q l)) |
| 41 | (hf (q i) (q l)) (hpos i) (hpos l) |
| 42 | filter_upwards [ht.eventually_const_lt (hangle i l hil)] with j hj _ |
| 43 | exact hj |
| 44 | obtain ⟨j, hj, hsep⟩ := ((Filter.eventually_all.mpr hnonzero).and |
| 45 | (Filter.eventually_all.mpr fun i => Filter.eventually_all.mpr (hseparated i))).exists |
| 46 | exact hX j k (f j p) (fun i => f j (q i)) hj hsep |
| 47 | |
| 48 | /-- Uniform comparison-angle packing bounds pass to pointed |
| 49 | Gromov--Hausdorff limits on bounded regions. -/ |
| 50 | theorem comparisonAnglePackingBound_of_pointedGHConvergesUnbounded |
| 51 | {X : ℕ → BasedMetricSpaceBundle} {Y : BasedMetricSpaceBundle} |
| 52 | {α : ℝ} {N : ℕ} |
| 53 | (hX : ∀ j, ComparisonAnglePackingBound (X j).carrier α N) |
| 54 | (h : PointedGHConvergesUnbounded X Y) : ComparisonAnglePackingBound Y.carrier α N := by |
| 55 | intro k p q hq hangle |
| 56 | let r : ℝ := 1 + dist p Y.base + ∑ i : Fin k, dist (q i) Y.base |
| 57 | have hsum : 0 ≤ ∑ i : Fin k, dist (q i) Y.base := |
| 58 | Finset.sum_nonneg (fun _ _ => dist_nonneg) |
| 59 | have hr : 0 < r := by dsimp [r]; linarith [dist_nonneg (x := p) (y := Y.base)] |
| 60 | have hpr : p ∈ Metric.ball Y.base r := by |
| 61 | rw [Metric.mem_ball] |
| 62 | dsimp [r] |
| 63 | linarith |
| 64 | have hqr (i : Fin k) : q i ∈ Metric.ball Y.base r := by |
| 65 | rw [Metric.mem_ball] |
| 66 | have hi := Finset.single_le_sum (fun (l : Fin k) _ => |
| 67 | show 0 ≤ dist (q l) Y.base from dist_nonneg) (Finset.mem_univ i) |
| 68 | dsimp [r] |
| 69 | linarith [dist_nonneg (x := p) (y := Y.base)] |
| 70 | obtain ⟨δ, _, hpos, hconv⟩ := h r hr |
| 71 | have hballs (j : ℕ) : |
| 72 | ComparisonAnglePackingBound (ballModel (X j) (r + δ j) (hpos j)).carrier α N := |
| 73 | (hX j).of_isometry (f := Subtype.val) (Isometry.of_dist_eq (fun _ _ => rfl)) |
| 74 | have hlimit := comparisonAnglePackingBound_of_pointedGHConverges hballs hconv |
| 75 | let p' : (ballModel Y r hr).carrier := ⟨p, hpr⟩ |
| 76 | let q' : Fin k → (ballModel Y r hr).carrier := fun i => ⟨q i, hqr i⟩ |
| 77 | have hq' (i : Fin k) : q' i ≠ p' := fun heq => hq i (congrArg Subtype.val heq) |
| 78 | exact hlimit k p' q' hq' hangle |
| 79 | |
| 80 | end Poincare.Alexandrov |