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.RicciFlow.Surgery.Induction.Noncollapse.LGeometry.CapEntry.EndpointEnergy |
| 3 | import Mathlib.Topology.UniformSpace.UniformEmbedding |
| 4 | import Mathlib.Topology.Order.ProjIcc |
| 5 | |
| 6 | /-! |
| 7 | # Finite-energy completion at the first cap exit |
| 8 | |
| 9 | Proposition 16.13, pp. 377-378. The physical birth slice is compact. |
| 10 | A C1 inverse-cylinder curve of finite birth energy is uniformly |
| 11 | continuous on its open parameter interval and therefore has unique |
| 12 | continuous endpoint values. This supplies endpoints without extending |
| 13 | the cap cylinder or assuming a smooth spatial frontier. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | -- The metric changes only the norm instances, not the birth-slice topology. |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter MeasureTheory |
| 21 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M08 |
| 26 | export PoincareMT.LGeometry (referenceSpeedSq) |
| 27 | end PoincareMT.M08 |
| 28 | namespace PoincareMT.M08 |
| 29 | export PoincareMT.LGeometry (referenceSpeedSq_nonneg) |
| 30 | end PoincareMT.M08 |
| 31 | namespace PoincareMT.M08 |
| 32 | export PoincareMT.LGeometry (referenceSpeedSq_continuousOn) |
| 33 | end PoincareMT.M08 |
| 34 | |
| 35 | namespace PoincareMT.Proofs.M46 |
| 36 | |
| 37 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 38 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] [T3Space M] |
| 39 | |
| 40 | omit [T3Space M] in |
| 41 | /-- Actual kinetic energy depends only on the germ of the physical |
| 42 | curve. Source: Definition 6.1, p. 105. -/ |
| 43 | theorem referenceSpeedSq_congr_of_eventuallyEq (g : RiemannianMetric n M) |
| 44 | {gamma eta : ℝ → M} {r : ℝ} (h : gamma =ᶠ[𝓝 r] eta) : |
| 45 | M08.referenceSpeedSq g gamma r = M08.referenceSpeedSq g eta r := by |
| 46 | unfold M08.referenceSpeedSq curveVelocity |
| 47 | rw [h.mfderiv_eq, h.eq_of_nhds] |
| 48 | |
| 49 | /-- A finite-energy inverse-cylinder curve in a compact birth slice |
| 50 | has continuous endpoint values with exactly the same interior energy. |
| 51 | Source: Proposition 16.13, pp. 377-378. -/ |
| 52 | theorem exists_continuous_birthCurve_extension [CompactSpace M] |
| 53 | (g : RiemannianMetric n M) {gamma : ℝ → M} {a b : ℝ} (hab : a < b) |
| 54 | (hgamma : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 gamma (Ioo a b)) |
| 55 | (henergy : IntervalIntegrable (M08.referenceSpeedSq g gamma) volume a b) : |
| 56 | ∃ eta : ℝ → M, Continuous eta ∧ EqOn eta gamma (Ioo a b) ∧ |
| 57 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 eta (Ioo a b) ∧ |
| 58 | IntervalIntegrable (M08.referenceSpeedSq g eta) volume a b ∧ |
| 59 | (∫ t in a..b, M08.referenceSpeedSq g eta t) = |
| 60 | ∫ t in a..b, M08.referenceSpeedSq g gamma t := by |
| 61 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 62 | ⟨g.toRiemannianMetric⟩ |
| 63 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 64 | (TangentSpace (𝓡 n) : M → Type _) := |
| 65 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 66 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 67 | let E := ∫ t in a..b, M08.referenceSpeedSq g gamma t |
| 68 | have hE : 0 ≤ E := intervalIntegral.integral_nonneg hab.le |
| 69 | (fun t _ => M08.referenceSpeedSq_nonneg g gamma t) |
| 70 | have hordered {s t C : ℝ} (hs : s ∈ Ioo a b) (ht : t ∈ Ioo a b) |
| 71 | (hst : s ≤ t) (hC : 0 < C) : |
| 72 | edist (gamma s) (gamma t) ≤ ENNReal.ofReal ((E + (t - s) * C ^ 2) / (2 * C)) := by |
| 73 | have hsub : Icc s t ⊆ Ioo a b := Icc_subset_Ioo hs.1 ht.2 |
| 74 | have hspeed : ContinuousOn (fun r => |
| 75 | g.tangentNorm (gamma r) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma r 1)) (Icc s t) := |
| 76 | Real.continuous_sqrt.comp_continuousOn |
| 77 | ((M08.referenceSpeedSq_continuousOn g isOpen_Ioo hgamma).mono hsub) |
| 78 | have h := g.edist_le_ofReal_energy_bound hst hC (hgamma.mono hsub) hspeed |
| 79 | have hsq (r : ℝ) : |
| 80 | (g.tangentNorm (gamma r) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) gamma r 1)) ^ 2 = |
| 81 | M08.referenceSpeedSq g gamma r := |
| 82 | Real.sq_sqrt (M08.referenceSpeedSq_nonneg g gamma r) |
| 83 | simp only [hsq] at h |
| 84 | apply h.trans (ENNReal.ofReal_le_ofReal ?_) |
| 85 | apply div_le_div_of_nonneg_right _ (by positivity) |
| 86 | exact add_le_add (intervalIntegral.integral_mono_interval hs.1.le hst ht.2.le |
| 87 | (ae_of_all _ (M08.referenceSpeedSq_nonneg g gamma)) henergy) le_rfl |
| 88 | have huniform : UniformContinuousOn gamma (Ioo a b) := by |
| 89 | apply EMetric.uniformContinuousOn_iff.mpr |
| 90 | intro epsilon hepsilon |
| 91 | obtain ⟨eps, _, heps0, heps⟩ := ENNReal.lt_iff_exists_real_btwn.mp hepsilon |
| 92 | have hepsPos : 0 < eps := ENNReal.ofReal_pos.mp heps0 |
| 93 | let C := (E + 1) / eps |
| 94 | have hC : 0 < C := div_pos (by linarith) hepsPos |
| 95 | let delta := eps / C |
| 96 | have hdelta : 0 < delta := div_pos hepsPos hC |
| 97 | have hEC : E < eps * C := by |
| 98 | dsimp only [C] |
| 99 | field_simp [hepsPos.ne'] |
| 100 | linarith |
| 101 | have hsmall {s t : ℝ} (hs : s ∈ Ioo a b) (ht : t ∈ Ioo a b) |
| 102 | (hst : s ≤ t) (hdt : t - s < delta) : edist (gamma s) (gamma t) < epsilon := by |
| 103 | have hdtC : (t - s) * C < eps := (lt_div_iff₀ hC).mp hdt |
| 104 | have hdtC2 : (t - s) * C ^ 2 < eps * C := by |
| 105 | nlinarith [mul_lt_mul_of_pos_right hdtC hC] |
| 106 | have hreal : (E + (t - s) * C ^ 2) / (2 * C) < eps := by |
| 107 | apply (div_lt_iff₀ (by positivity : 0 < 2 * C)).mpr |
| 108 | nlinarith |
| 109 | exact ((hordered hs ht hst hC).trans_lt |
| 110 | ((ENNReal.ofReal_lt_ofReal_iff hepsPos).mpr hreal)).trans heps |
| 111 | refine ⟨ENNReal.ofReal delta, ENNReal.ofReal_pos.mpr hdelta, ?_⟩ |
| 112 | intro s hs t ht hdist |
| 113 | have hd : |s - t| < delta := by simpa only [Real.dist_eq] using edist_lt_ofReal.mp hdist |
| 114 | rcases le_total s t with hst | hts |
| 115 | · exact hsmall hs ht hst (by linarith [neg_le_abs (s - t)]) |
| 116 | · rw [edist_comm] |
| 117 | exact hsmall ht hs hts (by linarith [le_abs_self (s - t)]) |
| 118 | let inclusion : Ioo a b → Icc a b := Set.inclusion Ioo_subset_Icc_self |
| 119 | have hui : IsUniformInducing inclusion := |
| 120 | (isUniformEmbedding_set_inclusion Ioo_subset_Icc_self).isUniformInducing |
| 121 | have hdi : DenseRange inclusion := by |
| 122 | apply (denseRange_inclusion_iff Ioo_subset_Icc_self).mpr |
| 123 | simpa only [closure_Ioo hab.ne] using (Subset.rfl : Icc a b ⊆ Icc a b) |
| 124 | let f : Ioo a b → M := fun t => gamma t.val |
| 125 | have huf : UniformContinuous f := uniformContinuousOn_iff_restrict.mp huniform |
| 126 | let extension := (hui.isDenseInducing hdi).extend f |
| 127 | have hext : UniformContinuous extension := uniformContinuous_uniformly_extend hui hdi huf |
| 128 | let eta : ℝ → M := fun t => extension (projIcc a b hab.le t) |
| 129 | have heta : Continuous eta := hext.continuous.comp continuous_projIcc |
| 130 | have heq : EqOn eta gamma (Ioo a b) := by |
| 131 | intro t ht |
| 132 | have h := (hui.isDenseInducing hdi).extend_eq huf.continuous (⟨t, ht⟩ : Ioo a b) |
| 133 | simpa only [eta, extension, f, inclusion, projIcc_of_mem hab.le |
| 134 | (Ioo_subset_Icc_self ht)] using h |
| 135 | have hdensity : ∀ t ∈ Ioo a b, |
| 136 | M08.referenceSpeedSq g eta t = M08.referenceSpeedSq g gamma t := by |
| 137 | intro t ht |
| 138 | apply referenceSpeedSq_congr_of_eventuallyEq g |
| 139 | filter_upwards [isOpen_Ioo.mem_nhds ht] with r hr |
| 140 | exact heq hr |
| 141 | refine ⟨eta, heta, heq, hgamma.congr heq, ?_, ?_⟩ |
| 142 | · apply henergy.congr_uIoo |
| 143 | intro t ht |
| 144 | rw [uIoo_of_le hab.le] at ht |
| 145 | exact (hdensity t ht).symm |
| 146 | · exact intervalIntegral.integral_congr_Ioo_of_le hab.le hdensity |
| 147 | |
| 148 | end PoincareMT.Proofs.M46 |