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.RicciFlow.ReducedGeometry.LGeometry.Path.PathEnergy |
| 2 | import Mathlib.Topology.ExtendFrom |
| 3 | import Mathlib.Topology.UniformSpace.Cauchy |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ContinuationLimit.lean` at |
| 6 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 7 | |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter Topology |
| 15 | open MeasureTheory |
| 16 | open scoped Manifold ContDiff Bundle intervalIntegral NNReal |
| 17 | |
| 18 | namespace PoincareMT.LGeometry |
| 19 | |
| 20 | theorem exists_continuous_endpoint_of_lipschitz {X : Type*} [MetricSpace X] |
| 21 | [CompleteSpace X] {a b : ℝ} (hab : a < b) (f : ℝ → X) {L : ℝ≥0} |
| 22 | (hf : LipschitzOnWith L f (Ioc a b)) : |
| 23 | ∃ g : ℝ → X, ContinuousOn g (Icc a b) ∧ EqOn g f (Ioc a b) ∧ |
| 24 | LipschitzOnWith L g (Icc a b) := by |
| 25 | have hclosure : closure (Ioc a b) = Icc a b := closure_Ioc hab.ne |
| 26 | have hlim (x : ℝ) (hx : x ∈ Icc a b) : ∃ y, Tendsto f (𝓝[Ioc a b] x) (𝓝 y) := by |
| 27 | have hx' : x ∈ closure (Ioc a b) := by rwa [hclosure] |
| 28 | haveI : NeBot (𝓝[Ioc a b] x) := mem_closure_iff_nhdsWithin_neBot.mp hx' |
| 29 | apply cauchy_map_iff_exists_tendsto.mp |
| 30 | exact (cauchy_nhds.mono nhdsWithin_le_nhds).map_of_le hf.uniformContinuousOn |
| 31 | inf_le_right |
| 32 | let g := extendFrom (Ioc a b) f |
| 33 | have hgc : ContinuousOn g (Icc a b) := |
| 34 | continuousOn_extendFrom (by rw [hclosure]) hlim |
| 35 | have hgeq : EqOn g f (Ioc a b) := extendFrom_extends hf.continuousOn |
| 36 | refine ⟨g, hgc, hgeq, ?_⟩ |
| 37 | have hLip : LipschitzOnWith L g (Ioc a b) := by |
| 38 | intro x hx y hy |
| 39 | rw [hgeq hx, hgeq hy] |
| 40 | exact hf hx hy |
| 41 | rw [← hclosure] at hgc ⊢ |
| 42 | exact hLip.closure hgc |
| 43 | |
| 44 | universe u |
| 45 | |
| 46 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 47 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 48 | |
| 49 | theorem lipschitzOnWith_of_referenceSpeed_bound [ConnectedSpace M] [T3Space M] |
| 50 | (g : RiemannianMetric n M) {a b L : ℝ} (hL : 0 ≤ L) {U : Set ℝ} |
| 51 | (hU : IsOpen U) (hIU : Ioc a b ⊆ U) (α : ℝ → M) |
| 52 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α U) |
| 53 | (hbound : ∀ s ∈ Ioc a b, referenceSpeedSq g α s ≤ L) : |
| 54 | letI : MetricSpace M := referenceMetricSpace g |
| 55 | LipschitzOnWith ⟨Real.sqrt L, Real.sqrt_nonneg _⟩ α (Ioc a b) := by |
| 56 | letI : MetricSpace M := referenceMetricSpace g |
| 57 | have hordered (s : ℝ) (hs : s ∈ Ioc a b) (t : ℝ) (ht : t ∈ Ioc a b) |
| 58 | (hst : s ≤ t) : dist (α s) (α t) ≤ Real.sqrt L * (t - s) := by |
| 59 | rcases hst.eq_or_lt with heq | hst |
| 60 | · subst t |
| 61 | simp only [dist_self, sub_self, mul_zero, le_refl] |
| 62 | have hsub : Icc s t ⊆ Ioc a b := fun r hr ↦ ⟨hs.1.trans_le hr.1, hr.2.trans ht.2⟩ |
| 63 | have hsubU := hsub.trans hIU |
| 64 | have hqc := (referenceSpeedSq_continuousOn g hU hα).mono hsubU |
| 65 | have hE : IntervalIntegrable (referenceSpeedSq g α) volume s t := |
| 66 | hqc.intervalIntegrable_of_Icc hst.le |
| 67 | have henergy : (∫ r in s..t, referenceSpeedSq g α r) ≤ L * (t - s) := by |
| 68 | calc |
| 69 | _ ≤ ∫ _r in s..t, L := intervalIntegral.integral_mono_on hst.le hE |
| 70 | intervalIntegrable_const (fun r hr ↦ hbound r (hsub hr)) |
| 71 | _ = _ := by simp only [intervalIntegral.integral_const, smul_eq_mul]; ring |
| 72 | have h := dist_le_sqrt_energy g hst (hα.continuousOn.mono hsubU) |
| 73 | (hα.mono (Ioo_subset_Icc_self.trans hsubU)) hE henergy |
| 74 | s ⟨le_rfl, hst.le⟩ t ⟨hst.le, le_rfl⟩ |
| 75 | rw [abs_of_nonneg (sub_nonneg.mpr hst.le), Real.sqrt_mul hL, mul_assoc, |
| 76 | ← pow_two, Real.sq_sqrt (sub_nonneg.mpr hst.le)] at h |
| 77 | exact h |
| 78 | apply LipschitzOnWith.of_dist_le_mul |
| 79 | intro s hs t ht |
| 80 | change dist (α s) (α t) ≤ Real.sqrt L * dist s t |
| 81 | rcases le_total s t with hst | hts |
| 82 | · simpa only [Real.dist_eq, abs_of_nonpos (sub_nonpos.mpr hst), neg_sub] using |
| 83 | hordered s hs t ht hst |
| 84 | · simpa only [dist_comm, Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hts)] using |
| 85 | hordered t ht s hs hts |
| 86 | |
| 87 | end PoincareMT.LGeometry |