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.CurveShortening.Comparison.AnnularEvolution.Sweep.Metric.Transport |
| 2 | import PoincareLib.Geometry.Riemannian.Distance.CompactConfinement |
| 3 | import PoincareLib.Geometry.Riemannian.MetricComparison |
| 4 | |
| 5 | /-! |
| 6 | # Closed-interval distance bounds from interior curve speed |
| 7 | |
| 8 | An interior C1 curve with bounded metric speed is Lipschitz there. Its |
| 9 | continuous endpoint values extend the same bound to the closed interval. |
| 10 | |
| 11 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 12 | 447-449. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set MeasureTheory |
| 19 | open scoped Manifold ContDiff Bundle ENNReal NNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | /-- A C1 curve with bounded speed has endpoint distance at most the speed bound times the |
| 29 | interval length. Source: MT Lemma 19.15, pp. 447-449, its weak minimum and sweep |
| 30 | construction. -/ |
| 31 | theorem m64_curve_edist_le_speed_Icc (g : RiemannianMetric n M) |
| 32 | {c : ℝ → M} {s t K : ℝ} (hst : s ≤ t) |
| 33 | (hc : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 c (Icc s t)) |
| 34 | (hbound : ∀ x ∈ Icc s t, |
| 35 | g.tangentNorm (c x) (curveVelocity c x) ≤ K) : |
| 36 | g.edist (c s) (c t) ≤ ENNReal.ofReal K * ENNReal.ofReal (t - s) := by |
| 37 | have h := g.edist_le_pathELength_of_mem_Icc hc (show t ∈ Icc s t from ⟨hst, le_rfl⟩) |
| 38 | apply h.trans |
| 39 | rw [RiemannianMetric.pathELength_eq_lintegral_tangentNorm] |
| 40 | calc |
| 41 | _ ≤ ∫⁻ _ in Icc s t, ENNReal.ofReal K := by |
| 42 | apply setLIntegral_mono' measurableSet_Icc |
| 43 | intro x hx |
| 44 | exact ENNReal.ofReal_le_ofReal (hbound x hx) |
| 45 | _ = _ := by simp [Real.volume_Icc] |
| 46 | |
| 47 | /-- Interior C1 regularity and closed-interval continuity suffice for the speed-to-distance |
| 48 | estimate at included endpoints. Source: MT Lemma 19.15, pp. 447-449, its weak minimum and |
| 49 | sweep construction. -/ |
| 50 | theorem m64_curve_edist_le_speed_closed [T2Space M] |
| 51 | (g : RiemannianMetric n M) {c : ℝ → M} {a b K : ℝ} (hK : 0 ≤ K) |
| 52 | (hc : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 c (Ioo a b)) |
| 53 | (hcont : ContinuousOn c (Icc a b)) |
| 54 | (hbound : ∀ x ∈ Ioo a b, g.tangentNorm (c x) (curveVelocity c x) ≤ K) : |
| 55 | ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, |
| 56 | g.edist (c s) (c t) ≤ ENNReal.ofReal K * ENNReal.ofReal |s - t| := by |
| 57 | let : LocallyCompactSpace M := |
| 58 | ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin n)) M |
| 59 | let : R1Space M := T2Space.r1Space |
| 60 | let : RegularSpace M := RegularSpace.of_hasBasis |
| 61 | isCompact_isClosed_basis_nhds (fun _ _ ⟨_, _, h⟩ => h) |
| 62 | let : T3Space M := ⟨⟩ |
| 63 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 64 | ⟨g.toRiemannianMetric⟩ |
| 65 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 66 | (TangentSpace (𝓡 n) : M → Type _) := |
| 67 | ⟨⟨g.inner, g.contMDiff.continuous, fun _ _ _ => rfl⟩⟩ |
| 68 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 69 | let C : ℝ≥0 := ⟨K, hK⟩ |
| 70 | by_cases hab : a < b |
| 71 | · have hleft {s t : ℝ} (hs : s ∈ Ioo a b) (ht : t ∈ Ioo a b) (hst : s ≤ t) : |
| 72 | g.edist (c s) (c t) ≤ ENNReal.ofReal K * ENNReal.ofReal (t - s) := by |
| 73 | have hsub : Icc s t ⊆ Ioo a b := fun x hx => |
| 74 | ⟨hs.1.trans_le hx.1, hx.2.trans_lt ht.2⟩ |
| 75 | exact m64_curve_edist_le_speed_Icc g hst (hc.mono hsub) |
| 76 | (fun x hx => hbound x (hsub hx)) |
| 77 | have hLip : LipschitzOnWith C c (Ioo a b) := by |
| 78 | intro s hs t ht |
| 79 | change g.edist (c s) (c t) ≤ (C : ℝ≥0∞) * edist s t |
| 80 | rw [ENNReal.coe_nnreal_eq, edist_dist, Real.dist_eq] |
| 81 | change g.edist (c s) (c t) ≤ ENNReal.ofReal K * ENNReal.ofReal |s - t| |
| 82 | rcases le_total s t with hst | hts |
| 83 | · simpa only [abs_of_nonpos (sub_nonpos.mpr hst), neg_sub] using hleft hs ht hst |
| 84 | · have h := hleft ht hs hts |
| 85 | have hsym : g.edist (c s) (c t) = g.edist (c t) (c s) := by |
| 86 | change edist (c s) (c t) = edist (c t) (c s) |
| 87 | exact edist_comm _ _ |
| 88 | simpa only [abs_of_nonneg (sub_nonneg.mpr hts), hsym] using h |
| 89 | have hclosed : LipschitzOnWith C c (Icc a b) := by |
| 90 | have hc' : ContinuousOn c (closure (Ioo a b)) := by |
| 91 | simpa only [closure_Ioo hab.ne] using hcont |
| 92 | simpa only [closure_Ioo hab.ne] using LipschitzOnWith.closure hc' hLip |
| 93 | intro s hs t ht |
| 94 | have h := hclosed hs ht |
| 95 | change g.edist (c s) (c t) ≤ (C : ℝ≥0∞) * edist s t at h |
| 96 | rw [ENNReal.coe_nnreal_eq, edist_dist, Real.dist_eq] at h |
| 97 | exact h |
| 98 | · intro s hs t ht |
| 99 | have hst : s = t := by linarith [hs.1, hs.2, ht.1, ht.2] |
| 100 | subst t |
| 101 | simp only [sub_self, abs_zero, ENNReal.ofReal_zero, mul_zero] |
| 102 | change edist (c s) (c s) ≤ 0 |
| 103 | exact le_of_eq (edist_self _) |
| 104 | |
| 105 | end PoincareMT |