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.Generalized.ReducedGeometry.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.Riemannian.Comparison.Volume.Conjugate.Energy.Length |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.ReferenceEnergy |
| 4 | |
| 5 | /-! |
| 6 | # Endpoint energy bounds without connectedness |
| 7 | |
| 8 | Proposition 16.13, pp. 377-378. An actual cap-exit curve is continuous |
| 9 | at its first exit and C1 before that exit. Interior restriction and |
| 10 | continuity extend the intrinsic length-energy inequality to its |
| 11 | endpoints, with no connectedness assumption on the whole surgery slice. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | -- The intrinsic distance uses the same actual metric and tangent norms. |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter MeasureTheory |
| 19 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M08 |
| 24 | export PoincareMT.LGeometry (referenceSpeedSq) |
| 25 | end PoincareMT.M08 |
| 26 | namespace PoincareMT.M08 |
| 27 | export PoincareMT.LGeometry (referenceSpeedSq_continuousOn) |
| 28 | end PoincareMT.M08 |
| 29 | namespace PoincareMT.M08 |
| 30 | export PoincareMT.LGeometry (referenceSpeedSq_nonneg) |
| 31 | end PoincareMT.M08 |
| 32 | |
| 33 | namespace PoincareMT.Proofs.M46 |
| 34 | |
| 35 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 36 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] [T3Space M] |
| 37 | |
| 38 | /-- The length-energy estimate survives first-exit endpoints of a |
| 39 | finite-energy curve. Source: Proposition 16.13, pp. 377-378. -/ |
| 40 | theorem edist_le_energy_of_interior_regular (g : RiemannianMetric n M) |
| 41 | {gamma : ℝ → M} {a b C : ℝ} (hab : a < b) (hC : 0 < C) |
| 42 | (hgamma : ContinuousOn gamma (Icc a b)) |
| 43 | (hregular : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma (Ioo a b)) |
| 44 | (henergy : IntervalIntegrable (M08.referenceSpeedSq g gamma) volume a b) : |
| 45 | g.edist (gamma a) (gamma b) ≤ ENNReal.ofReal |
| 46 | (((∫ t in a..b, M08.referenceSpeedSq g gamma t) + (b - a) * C ^ 2) / (2 * C)) := by |
| 47 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 48 | ⟨g.toRiemannianMetric⟩ |
| 49 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 50 | (TangentSpace (𝓡 n) : M → Type _) := |
| 51 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 52 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 53 | let bound := |
| 54 | ((∫ t in a..b, M08.referenceSpeedSq g gamma t) + (b - a) * C ^ 2) / (2 * C) |
| 55 | have hordered (s t : ℝ) (hs : s ∈ Ioo a b) (ht : t ∈ Ioo a b) (hst : s ≤ t) : |
| 56 | g.edist (gamma s) (gamma t) ≤ ENNReal.ofReal bound := by |
| 57 | have hsub : Icc s t ⊆ Ioo a b := Icc_subset_Ioo hs.1 ht.2 |
| 58 | have hspeed : ContinuousOn (fun r => |
| 59 | g.tangentNorm (gamma r) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma r 1)) (Icc s t) := |
| 60 | Real.continuous_sqrt.comp_continuousOn |
| 61 | ((M08.referenceSpeedSq_continuousOn g isOpen_Ioo hregular).mono hsub) |
| 62 | have hlength := g.edist_le_ofReal_energy_bound hst hC (hregular.mono hsub) hspeed |
| 63 | have hsq (r : ℝ) : |
| 64 | (g.tangentNorm (gamma r) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma r 1)) ^ 2 = |
| 65 | M08.referenceSpeedSq g gamma r := |
| 66 | Real.sq_sqrt (M08.referenceSpeedSq_nonneg g gamma r) |
| 67 | simp only [hsq] at hlength |
| 68 | apply hlength.trans (ENNReal.ofReal_le_ofReal ?_) |
| 69 | apply div_le_div_of_nonneg_right _ (by positivity) |
| 70 | apply add_le_add |
| 71 | · exact intervalIntegral.integral_mono_interval hs.1.le hst ht.2.le |
| 72 | (ae_of_all _ (M08.referenceSpeedSq_nonneg g gamma)) henergy |
| 73 | · exact mul_le_mul_of_nonneg_right (by linarith [hs.1, ht.2]) (sq_nonneg C) |
| 74 | have hopen (s : ℝ) (hs : s ∈ Ioo a b) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 75 | edist (gamma s) (gamma t) ≤ ENNReal.ofReal bound := by |
| 76 | rcases le_total s t with hst | hts |
| 77 | · exact hordered s t hs ht hst |
| 78 | · rw [edist_comm] |
| 79 | exact hordered t s ht hs hts |
| 80 | have hleft (s : ℝ) (hs : s ∈ Icc a b) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 81 | edist (gamma s) (gamma t) ≤ ENNReal.ofReal bound := by |
| 82 | apply le_on_closure (fun r hr => hopen r hr t ht) |
| 83 | · simpa only [closure_Ioo hab.ne, Function.comp_def] using |
| 84 | continuous_edist.comp_continuousOn (hgamma.prodMk continuousOn_const) |
| 85 | · exact continuousOn_const |
| 86 | · simpa only [closure_Ioo hab.ne] using hs |
| 87 | change edist (gamma a) (gamma b) ≤ ENNReal.ofReal bound |
| 88 | apply le_on_closure (fun r hr => hleft a ⟨le_rfl, hab.le⟩ r hr) |
| 89 | · simpa only [closure_Ioo hab.ne, Function.comp_def] using |
| 90 | continuous_edist.comp_continuousOn (continuousOn_const.prodMk hgamma) |
| 91 | · exact continuousOn_const |
| 92 | · simp only [closure_Ioo hab.ne, mem_Icc, le_refl, and_true] |
| 93 | exact hab.le |
| 94 | |
| 95 | /-- A positive intrinsic endpoint separation forces the usual squared |
| 96 | distance lower bound for energy, including the first-exit endpoint. |
| 97 | Source: Proposition 16.13, pp. 377-378. -/ |
| 98 | theorem sq_distance_le_duration_mul_energy (g : RiemannianMetric n M) |
| 99 | {gamma : ℝ → M} {a b d : ℝ} (hab : a < b) (hd : 0 < d) |
| 100 | (hgamma : ContinuousOn gamma (Icc a b)) |
| 101 | (hregular : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma (Ioo a b)) |
| 102 | (henergy : IntervalIntegrable (M08.referenceSpeedSq g gamma) volume a b) |
| 103 | (hdistance : ENNReal.ofReal d ≤ g.edist (gamma a) (gamma b)) : |
| 104 | d ^ 2 ≤ (b - a) * ∫ t in a..b, M08.referenceSpeedSq g gamma t := by |
| 105 | have hduration : 0 < b - a := sub_pos.mpr hab |
| 106 | have hE : 0 ≤ ∫ t in a..b, M08.referenceSpeedSq g gamma t := |
| 107 | intervalIntegral.integral_nonneg hab.le (fun t _ => M08.referenceSpeedSq_nonneg g gamma t) |
| 108 | have hC : 0 < d / (b - a) := div_pos hd hduration |
| 109 | have hbound := hdistance.trans |
| 110 | (edist_le_energy_of_interior_regular g hab hC hgamma hregular henergy) |
| 111 | have hreal := (ENNReal.ofReal_le_ofReal_iff (by positivity : |
| 112 | 0 ≤ ((∫ t in a..b, M08.referenceSpeedSq g gamma t) + |
| 113 | (b - a) * (d / (b - a)) ^ 2) / (2 * (d / (b - a))))).mp hbound |
| 114 | have h := (le_div_iff₀ (by positivity : 0 < 2 * (d / (b - a)))).mp hreal |
| 115 | have hm := mul_le_mul_of_nonneg_left h hduration.le |
| 116 | field_simp [hduration.ne'] at hm |
| 117 | nlinarith |
| 118 | |
| 119 | end PoincareMT.Proofs.M46 |