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.MeasureTheory.Measure.MeasureSpace |
| 2 | import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic |
| 3 | import Mathlib.Topology.MetricSpace.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Packing bounds from ball measures |
| 7 | |
| 8 | Disjoint small balls with a common positive measure lower bound give a |
| 9 | cardinality bound inside a set of finite measure. This is the measure step in |
| 10 | the finite coordinate covers of Morgan--Tian, Theorem 5.6, pp. 86--87. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set MeasureTheory |
| 16 | open scoped ENNReal |
| 17 | |
| 18 | namespace Poincare.MeasureTheory |
| 19 | |
| 20 | variable {X : Type*} [PseudoEMetricSpace X] [MeasurableSpace X] [BorelSpace X] |
| 21 | |
| 22 | /-- A separated finite family of equal-radius balls obeys the usual volume |
| 23 | packing inequality, including for an extended metric. -/ |
| 24 | theorem card_mul_le_measure_of_separated_balls |
| 25 | (μ : Measure X) (s : Finset X) {r v : ℝ≥0∞} {U : Set X} |
| 26 | (hsep : ∀ x ∈ s, ∀ y ∈ s, x ≠ y → r + r ≤ edist x y) |
| 27 | (hsub : ∀ x ∈ s, Metric.eball x r ⊆ U) |
| 28 | (hvol : ∀ x ∈ s, v ≤ μ (Metric.eball x r)) : |
| 29 | (s.card : ℝ≥0∞) * v ≤ μ U := by |
| 30 | have hdisj : (s : Set X).PairwiseDisjoint (fun x => Metric.eball x r) := by |
| 31 | intro x hx y hy hxy |
| 32 | apply Set.disjoint_left.mpr |
| 33 | intro z hxz hyz |
| 34 | have htri := edist_triangle x z y |
| 35 | have hsmall : edist x z + edist z y < r + r := by |
| 36 | exact ENNReal.add_lt_add (by simpa only [Metric.mem_eball, edist_comm] using hxz) hyz |
| 37 | exact (not_lt_of_ge (hsep x hx y hy hxy)) (htri.trans_lt hsmall) |
| 38 | calc |
| 39 | (s.card : ℝ≥0∞) * v = ∑ x ∈ s, v := by simp |
| 40 | _ ≤ ∑ x ∈ s, μ (Metric.eball x r) := Finset.sum_le_sum hvol |
| 41 | _ = μ (⋃ x ∈ s, Metric.eball x r) := |
| 42 | (measure_biUnion_finset hdisj (fun _ _ => Metric.isOpen_eball.measurableSet)).symm |
| 43 | _ ≤ μ U := measure_mono (iUnion₂_subset hsub) |
| 44 | |
| 45 | /-- A finite ambient measure and a positive ball-measure lower bound turn the |
| 46 | packing inequality into a real cardinality bound. -/ |
| 47 | theorem card_le_measure_div_of_separated_balls |
| 48 | (μ : Measure X) (s : Finset X) {r : ℝ≥0∞} {v : ℝ} {U : Set X} |
| 49 | (hv : 0 < v) (hU : μ U ≠ ⊤) |
| 50 | (hsep : ∀ x ∈ s, ∀ y ∈ s, x ≠ y → r + r ≤ edist x y) |
| 51 | (hsub : ∀ x ∈ s, Metric.eball x r ⊆ U) |
| 52 | (hvol : ∀ x ∈ s, ENNReal.ofReal v ≤ μ (Metric.eball x r)) : |
| 53 | (s.card : ℝ) ≤ (μ U).toReal / v := by |
| 54 | have h := card_mul_le_measure_of_separated_balls μ s hsep hsub hvol |
| 55 | have hreal := ENNReal.toReal_mono hU h |
| 56 | rw [ENNReal.toReal_mul, ENNReal.toReal_natCast, |
| 57 | ENNReal.toReal_ofReal hv.le] at hreal |
| 58 | exact (le_div_iff₀ hv).mpr hreal |
| 59 | |
| 60 | /-- Relative volume lower bounds give a packing bound independent of the |
| 61 | absolute ambient volume. -/ |
| 62 | theorem card_le_inv_of_relative_ball_measure |
| 63 | (μ : Measure X) (s : Finset X) {r : ℝ≥0∞} {c : ℝ} {U : Set X} |
| 64 | (hc : 0 < c) (hU0 : μ U ≠ 0) (hU : μ U ≠ ⊤) |
| 65 | (hsep : ∀ x ∈ s, ∀ y ∈ s, x ≠ y → r + r ≤ edist x y) |
| 66 | (hsub : ∀ x ∈ s, Metric.eball x r ⊆ U) |
| 67 | (hvol : ∀ x ∈ s, ENNReal.ofReal c * μ U ≤ μ (Metric.eball x r)) : |
| 68 | (s.card : ℝ) ≤ c⁻¹ := by |
| 69 | have h := card_mul_le_measure_of_separated_balls μ s hsep hsub hvol |
| 70 | have hreal := ENNReal.toReal_mono hU h |
| 71 | simp only [ENNReal.toReal_mul, ENNReal.toReal_natCast, |
| 72 | ENNReal.toReal_ofReal hc.le] at hreal |
| 73 | have hpositive : 0 < (μ U).toReal := ENNReal.toReal_pos hU0 hU |
| 74 | have hcard : (s.card : ℝ) * c ≤ 1 := by |
| 75 | apply (mul_le_mul_iff_left₀ hpositive).mp |
| 76 | simpa only [mul_assoc, one_mul] using hreal |
| 77 | simpa only [one_div] using (le_div_iff₀ hc).mpr hcard |
| 78 | |
| 79 | end Poincare.MeasureTheory |