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.Riemannian.MetricComparison |
| 2 | import Mathlib.Topology.Order.Compact |
| 3 | |
| 4 | /-! |
| 5 | # Length comparison and the first exit of an embedded path |
| 6 | |
| 7 | These local lemmas are used to cover source balls by pointed-convergence |
| 8 | embeddings. Reference: Kleiner--Lott, Appendix E, pp. 2848--2849. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set MeasureTheory |
| 14 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 15 | |
| 16 | namespace PoincareMT.RiemannianMetric |
| 17 | |
| 18 | variable {n : ℕ} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 21 | |
| 22 | theorem pathELength_comp_le_of_tangentNorm_le_on_Icc |
| 23 | (g : RiemannianMetric n M) (h : RiemannianMetric n N) |
| 24 | {f : M → N} {γ : ℝ → M} {a b C : ℝ} (hC : 0 ≤ C) |
| 25 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) |
| 26 | (hf : ∀ u ∈ Icc a b, ContMDiffAt (𝓡 n) (𝓡 n) 1 f (γ u)) |
| 27 | (hbound : ∀ u ∈ Icc a b, ∀ v : TangentSpace (𝓡 n) (γ u), |
| 28 | h.tangentNorm (f (γ u)) (mfderiv (𝓡 n) (𝓡 n) f (γ u) v) ≤ |
| 29 | C * g.tangentNorm (γ u) v) : |
| 30 | h.pathELength (f ∘ γ) a b ≤ ENNReal.ofReal C * g.pathELength γ a b := by |
| 31 | rw [pathELength_eq_lintegral_tangentNorm, pathELength_eq_lintegral_tangentNorm, |
| 32 | ← lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] |
| 33 | apply setLIntegral_mono' measurableSet_Icc |
| 34 | intro u hu |
| 35 | rw [mfderiv_comp_apply u ((hf u hu).mdifferentiableAt one_ne_zero) |
| 36 | (hγ.mdifferentiable one_ne_zero u)] |
| 37 | exact (ENNReal.ofReal_le_ofReal (hbound u hu _)).trans_eq (ENNReal.ofReal_mul hC) |
| 38 | |
| 39 | end PoincareMT.RiemannianMetric |
| 40 | |
| 41 | namespace PoincareMT |
| 42 | |
| 43 | /-- A continuous path leaving an open set first reaches its boundary, with |
| 44 | the initial closed segment contained in the closure of the set. -/ |
| 45 | theorem exists_first_exit_of_continuous |
| 46 | {X : Type*} [TopologicalSpace X] {γ : ℝ → X} (hγ : Continuous γ) |
| 47 | {U : Set X} (hU : IsOpen U) (h0 : γ 0 ∈ U) (h1 : γ 1 ∉ U) : |
| 48 | ∃ c ∈ Ioc (0 : ℝ) 1, γ c ∈ frontier U ∧ MapsTo γ (Icc 0 c) (closure U) := by |
| 49 | let A := Icc (0 : ℝ) 1 ∩ γ ⁻¹' Uᶜ |
| 50 | have hA : IsCompact A := isCompact_Icc.inter_right (hU.isClosed_compl.preimage hγ) |
| 51 | obtain ⟨c, hc, hleast⟩ := hA.exists_isLeast ⟨1, ⟨by norm_num, h1⟩⟩ |
| 52 | have hcpos : 0 < c := lt_of_le_of_ne hc.1.1 (by |
| 53 | intro heq |
| 54 | exact hc.2 (heq ▸ h0)) |
| 55 | have hbefore : MapsTo γ (Ico 0 c) U := by |
| 56 | intro t ht |
| 57 | by_contra h |
| 58 | exact (not_le_of_gt ht.2) (hleast ⟨⟨ht.1, ht.2.le.trans hc.1.2⟩, h⟩) |
| 59 | have hclosed : MapsTo γ (Icc 0 c) (closure U) := by |
| 60 | have hh := hbefore.closure_of_continuousOn hγ.continuousOn |
| 61 | simpa only [closure_Ico hcpos.ne] using hh |
| 62 | refine ⟨c, ⟨hcpos, hc.1.2⟩, ?_, hclosed⟩ |
| 63 | rw [frontier, hU.interior_eq] |
| 64 | exact ⟨hclosed ⟨hcpos.le, le_rfl⟩, hc.2⟩ |
| 65 | |
| 66 | end PoincareMT |