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.ReducedLength.Minimum.Variational.Regularity.Minimizer |
| 2 | import Mathlib.Analysis.ODE.PicardLindelof |
| 3 | |
| 4 | /-! |
| 5 | # Smooth Euler momentum of local action minimizers |
| 6 | |
| 7 | Continuous momentum and velocity solve a smooth first-order phase equation; |
| 8 | ODE regularity upgrades the weak chart minimizer to a smooth curve. |
| 9 | Adapted from Mapher `Proofs/M08/ChartEulerRegularity.lean`, commit |
| 10 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open MeasureTheory Set Filter Topology |
| 17 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 18 | |
| 19 | namespace PoincareMT.ReducedLengthMinimum.Variational |
| 20 | |
| 21 | section SmoothCoefficients |
| 22 | |
| 23 | variable {E H : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 24 | [NormedAddCommGroup H] [NormedSpace ℝ H] |
| 25 | |
| 26 | theorem spatialFDeriv_contDiffOn {Ω : Set (ℝ × E)} (hΩ : IsOpen Ω) |
| 27 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f Ω) : |
| 28 | ContDiffOn ℝ ∞ (spatialFDeriv f) Ω := by |
| 29 | exact (hf.fderiv_of_isOpen hΩ (by simp)).clm_comp contDiffOn_const |
| 30 | |
| 31 | end SmoothCoefficients |
| 32 | |
| 33 | section Force |
| 34 | |
| 35 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] |
| 36 | |
| 37 | noncomputable local instance : NormedAddCommGroup (E →L[ℝ] ℝ) := |
| 38 | ContinuousLinearMap.toNormedAddCommGroup |
| 39 | |
| 40 | noncomputable local instance : NormedSpace ℝ (E →L[ℝ] ℝ) := |
| 41 | ContinuousLinearMap.toNormedSpace |
| 42 | |
| 43 | noncomputable local instance : NormedAddCommGroup (E →L[ℝ] E →L[ℝ] ℝ) := |
| 44 | ContinuousLinearMap.toNormedAddCommGroup |
| 45 | |
| 46 | noncomputable local instance : NormedSpace ℝ (E →L[ℝ] E →L[ℝ] ℝ) := |
| 47 | ContinuousLinearMap.toNormedSpace |
| 48 | |
| 49 | theorem chartForceVector_contDiff : |
| 50 | ContDiff ℝ ∞ (fun z : ((E →L[ℝ] E →L[ℝ] E →L[ℝ] ℝ) × (E →L[ℝ] ℝ)) × E ↦ |
| 51 | chartForceVector z.1.1 z.1.2 z.2) := by |
| 52 | have hD : ContDiff ℝ ∞ |
| 53 | (fun z : ((E →L[ℝ] E →L[ℝ] E →L[ℝ] ℝ) × (E →L[ℝ] ℝ)) × E ↦ z.1.1) := |
| 54 | contDiff_fst.fst |
| 55 | have hDf := (ContinuousLinearMap.flipₗᵢ ℝ E E (E →L[ℝ] ℝ)).toContinuousLinearEquiv.contDiff.comp hD |
| 56 | have hDq := hDf.clm_apply contDiff_snd |
| 57 | have hDqf := (ContinuousLinearMap.flipₗᵢ ℝ E E ℝ).toContinuousLinearEquiv.contDiff.comp hDq |
| 58 | have hDqq := hDqf.clm_apply contDiff_snd |
| 59 | exact (InnerProductSpace.toDual ℝ E).symm.toContinuousLinearEquiv.contDiff.comp |
| 60 | (((contDiff_const (c := (1 / 2 : ℝ))).smul hDqq).add contDiff_fst.snd) |
| 61 | |
| 62 | theorem chartForceVector_continuousOn {X : Type*} [TopologicalSpace X] {S : Set X} |
| 63 | {DG : X → E →L[ℝ] E →L[ℝ] E →L[ℝ] ℝ} {DV : X → E →L[ℝ] ℝ} {q : X → E} |
| 64 | (hDG : ContinuousOn DG S) (hDV : ContinuousOn DV S) (hq : ContinuousOn q S) : |
| 65 | ContinuousOn (fun s ↦ chartForceVector (DG s) (DV s) (q s)) S := by |
| 66 | have hDf := (ContinuousLinearMap.flipₗᵢ ℝ E E (E →L[ℝ] ℝ)).continuous.comp_continuousOn hDG |
| 67 | have hDq := hDf.clm_apply hq |
| 68 | have hDqf := (ContinuousLinearMap.flipₗᵢ ℝ E E ℝ).continuous.comp_continuousOn hDq |
| 69 | have hDqq := hDqf.clm_apply hq |
| 70 | exact (InnerProductSpace.toDual ℝ E).symm.continuous.comp_continuousOn |
| 71 | (((continuousOn_const (c := (1 / 2 : ℝ))).smul hDqq).add hDV) |
| 72 | |
| 73 | end Force |
| 74 | |
| 75 | universe uM |
| 76 | |
| 77 | variable {n : ℕ} {M : Type uM} [MetricSpace M] |
| 78 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 79 | |
| 80 | noncomputable local instance : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 81 | ContinuousLinearMap.toNormedAddCommGroup |
| 82 | |
| 83 | noncomputable local instance : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 84 | ContinuousLinearMap.toNormedSpace |
| 85 | |
| 86 | noncomputable local instance : |
| 87 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 88 | ContinuousLinearMap.toNormedAddCommGroup |
| 89 | |
| 90 | noncomputable local instance : |
| 91 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 92 | ContinuousLinearMap.toNormedSpace |
| 93 | |
| 94 | noncomputable def chartEulerPhase {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) (x : M) |
| 95 | (s : ℝ) (z : EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n)) : |
| 96 | EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n) := |
| 97 | let v := Ring.inverse (chartMetricOperator F T x (s, z.1)) z.2 |
| 98 | (v, chartForceVector (spatialFDeriv (chartActionMetric F T x) (s, z.1)) |
| 99 | (spatialFDeriv (chartActionPotential F T x) (s, z.1)) v) |
| 100 | |
| 101 | set_option maxHeartbeats 800000 in |
| 102 | -- The phase field composes the inverse metric with the quadratic spatial force. |
| 103 | theorem chartEulerPhase_contDiffOn {J : Set ℝ} (F : RicciFlow n M J) |
| 104 | (T : ℝ) |
| 105 | (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 106 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 107 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) (x : M) {a b : ℝ} |
| 108 | (htime : ∀ s ∈ Icc a b, s ∈ interior ((fun r : ℝ => T - r ^ 2) ⁻¹' J)) : |
| 109 | ContDiffOn ℝ ∞ (Function.uncurry (chartEulerPhase F T x)) |
| 110 | (Icc a b ×ˢ ((extChartAt (𝓡 n) x).target ×ˢ univ)) := by |
| 111 | let Ω := Icc a b ×ˢ ((extChartAt (𝓡 n) x).target ×ˢ |
| 112 | (univ : Set (EuclideanSpace ℝ (Fin n)))) |
| 113 | let k := fun z : ℝ × (EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n)) ↦ (z.1, z.2.1) |
| 114 | have hk : ContDiffOn ℝ ∞ k Ω := contDiffOn_fst.prodMk contDiffOn_snd.fst |
| 115 | have hmap : MapsTo k Ω (chartActionDomain F T x) := |
| 116 | fun z hz ↦ ⟨htime z.1 hz.1, hz.2.1⟩ |
| 117 | have hB := (chartMetricInverse_contDiffOn F T x).comp hk hmap |
| 118 | have hv := hB.clm_apply contDiffOn_snd.snd |
| 119 | have hDG := (spatialFDeriv_contDiffOn (chartActionDomain_open F T x) _ |
| 120 | (chartActionMetric_contDiffOn F T x)).comp hk hmap |
| 121 | have hDV := (spatialFDeriv_contDiffOn (chartActionDomain_open F T x) _ |
| 122 | (chartActionPotential_contDiffOn F T hpotential x)).comp hk hmap |
| 123 | have hQ := (chartForceVector_contDiff (E := EuclideanSpace ℝ (Fin n))).comp_contDiffOn |
| 124 | ((hDG.prodMk hDV).prodMk hv) |
| 125 | exact hv.prodMk hQ |
| 126 | |
| 127 | set_option maxHeartbeats 1200000 in |
| 128 | -- The weak equation is upgraded pointwise before the smooth phase ODE is applied. |
| 129 | theorem chart_minimum_smooth_momentum {J : Set ℝ} (F : RicciFlow n M J) |
| 130 | (T : ℝ) |
| 131 | (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 132 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 133 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) {a b : ℝ} (hab : a < b) |
| 134 | (x : M) (γ : ℝ → M) (hγ : ContinuousOn γ (Icc a b)) |
| 135 | (hsrc : MapsTo γ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 136 | (htime : ∀ s ∈ Icc a b, s ∈ interior ((fun r : ℝ => T - r ^ 2) ⁻¹' J)) |
| 137 | (w : IntervalL2 (EuclideanSpace ℝ (Fin n)) a b) |
| 138 | (hw : ∀ s ∈ Icc a b, extChartAt (𝓡 n) x (γ s) = |
| 139 | extChartAt (𝓡 n) x (γ a) + ∫ r in a..s, w r) |
| 140 | (hmin : IsChartH1Minimizer F T x a b γ w) : |
| 141 | let u : ℝ → EuclideanSpace ℝ (Fin n) := extChartAt (𝓡 n) x ∘ γ |
| 142 | ContDiffOn ℝ ∞ u (Icc a b) ∧ ∀ s ∈ Ioo a b, |
| 143 | HasDerivAt (fun r ↦ chartMomentumVector (chartActionMetric F T x (r, u r)) (deriv u r)) |
| 144 | (chartForceVector (spatialFDeriv (chartActionMetric F T x) (s, u s)) |
| 145 | (spatialFDeriv (chartActionPotential F T x) (s, u s)) (deriv u s)) s := by |
| 146 | let e := extChartAt (𝓡 n) x |
| 147 | let u : ℝ → EuclideanSpace ℝ (Fin n) := e ∘ γ |
| 148 | let q := derivWithin u (Icc a b) |
| 149 | have hreg : ContDiffOn ℝ 1 u (Icc a b) := |
| 150 | chart_minimum_contDiffOn F T hpotential hab x γ hγ hsrc htime w hw hmin |
| 151 | have hq : ContinuousOn q (Icc a b) := |
| 152 | hreg.continuousOn_derivWithin (uniqueDiffOn_Icc hab) (by rfl) |
| 153 | have hud (s : ℝ) (hs : s ∈ Icc a b) : HasDerivWithinAt u (q s) (Icc a b) s := |
| 154 | ((hreg.differentiableOn (by simp)) s hs).hasDerivWithinAt |
| 155 | have hwq : (w : ℝ → EuclideanSpace ℝ (Fin n)) =ᵐ[volume.restrict (Icc a b)] q := by |
| 156 | filter_upwards [primitive_ae_hasDerivAt hab.le u w hw, |
| 157 | ae_restrict_mem measurableSet_Icc] with s hs hmem |
| 158 | exact (hs.hasDerivWithinAt.derivWithin (uniqueDiffOn_Icc hab s hmem)).symm |
| 159 | have hsrc' : MapsTo γ (Icc a b) e.source := by |
| 160 | simpa only [e, extChartAt_source] using hsrc |
| 161 | have hpair : ContinuousOn (fun s ↦ (s, u s)) (Icc a b) := |
| 162 | continuousOn_id.prodMk hreg.continuousOn |
| 163 | have hdom : MapsTo (fun s ↦ (s, u s)) (Icc a b) (chartActionDomain F T x) := |
| 164 | fun s hs ↦ ⟨htime s hs, e.map_source (hsrc' hs)⟩ |
| 165 | let G := fun s ↦ chartActionMetric F T x (s, u s) |
| 166 | let DG := fun s ↦ spatialFDeriv (chartActionMetric F T x) (s, u s) |
| 167 | let DV := fun s ↦ spatialFDeriv (chartActionPotential F T x) (s, u s) |
| 168 | let P := fun s ↦ chartMomentumVector (G s) (q s) |
| 169 | let Q := fun s ↦ chartForceVector (DG s) (DV s) (q s) |
| 170 | have hG : ContinuousOn G (Icc a b) := |
| 171 | (chartActionMetric_contDiffOn F T x).continuousOn.comp hpair hdom |
| 172 | have hDG : ContinuousOn DG (Icc a b) := |
| 173 | (spatialFDeriv_continuousOn (chartActionDomain_open F T x) _ |
| 174 | (chartActionMetric_contDiffOn F T x)).comp hpair hdom |
| 175 | have hDV : ContinuousOn DV (Icc a b) := |
| 176 | (spatialFDeriv_continuousOn (chartActionDomain_open F T x) _ |
| 177 | (chartActionPotential_contDiffOn F T hpotential x)).comp hpair hdom |
| 178 | have hP : ContinuousOn P (Icc a b) := |
| 179 | (InnerProductSpace.toDual ℝ (EuclideanSpace ℝ (Fin n))).symm.continuous.comp_continuousOn |
| 180 | (hG.clm_apply hq) |
| 181 | have hQ : ContinuousOn Q (Icc a b) := |
| 182 | chartForceVector_continuousOn hDG hDV hq |
| 183 | have hPint : IntervalIntegrable P volume a b := hP.intervalIntegrable_of_Icc hab.le |
| 184 | have hQint : IntervalIntegrable Q volume a b := hQ.intervalIntegrable_of_Icc hab.le |
| 185 | have hweak : ∀ φ : ℝ → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → |
| 186 | tsupport φ ⊆ Ioo a b → (∫ s in a..b, deriv φ s • P s) = |
| 187 | -(∫ s in a..b, φ s • Q s) := by |
| 188 | intro φ hφ _ hsupp |
| 189 | have hφa : φ a = 0 := image_eq_zero_of_notMem_tsupport |
| 190 | (fun ha ↦ (lt_irrefl a) (hsupp ha).1) |
| 191 | have hφb : φ b = 0 := image_eq_zero_of_notMem_tsupport |
| 192 | (fun hb ↦ (lt_irrefl b) (hsupp hb).2) |
| 193 | apply weak_momentum_of_scalar_stationarity P Q hPint hQint φ hφ |
| 194 | intro z |
| 195 | have hstat := chart_minimum_affine_stationary F T hpotential hab x γ hγ hsrc htime w hw hmin |
| 196 | (fun s ↦ φ s • z) (fun s ↦ deriv φ s • z) |
| 197 | (hφ.continuous.continuousOn.smul continuousOn_const) |
| 198 | ((hφ.continuous_deriv (by simp)).continuousOn.smul continuousOn_const) |
| 199 | (fun s _ ↦ ((hφ.differentiable (by simp)) s).hasDerivAt.smul_const z) |
| 200 | (by simp only [hφa, zero_smul]) (by simp only [hφb, zero_smul]) |
| 201 | calc |
| 202 | _ = ∫ s in a..b, DG s (φ s • z) (q s) (q s) / 2 + |
| 203 | G s (q s) (deriv φ s • z) + DV s (φ s • z) := by |
| 204 | apply intervalIntegral.integral_congr |
| 205 | intro s hs |
| 206 | dsimp only [P, Q] |
| 207 | rw [chartMomentumVector_inner, chartForceVector_inner] |
| 208 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 209 | ring |
| 210 | _ = ∫ s in a..b, DG s (φ s • z) (w s) (w s) / 2 + |
| 211 | G s (w s) (deriv φ s • z) + DV s (φ s • z) := by |
| 212 | apply intervalIntegral.integral_congr_ae_restrict |
| 213 | rw [uIoc_of_le hab.le] |
| 214 | filter_upwards [ae_mono (Measure.restrict_mono Ioc_subset_Icc_self le_rfl) hwq] with s hs |
| 215 | rw [hs] |
| 216 | _ = 0 := hstat |
| 217 | obtain ⟨c, hc⟩ := weak_momentum_primitive hab P Q hPint hQint hweak |
| 218 | have hpc : ∀ s ∈ Icc a b, P s = c + ∫ r in a..s, Q r := by |
| 219 | apply Measure.eqOn_Icc_of_ae_eq volume hab.ne hc hP |
| 220 | have h := intervalIntegral.continuousOn_primitive_interval' hQint left_mem_uIcc |
| 221 | rw [uIcc_of_le hab.le] at h |
| 222 | exact continuousOn_const.add h |
| 223 | have hca : c = P a := by |
| 224 | simpa only [intervalIntegral.integral_same, add_zero] using (hpc a ⟨le_rfl, hab.le⟩).symm |
| 225 | have hPprimitive (s : ℝ) (hs : s ∈ Icc a b) : P s = P a + ∫ r in a..s, Q r := by |
| 226 | rw [hpc s hs, hca] |
| 227 | obtain ⟨hPd, _⟩ := continuous_primitive_regular hab P Q hQ hPprimitive |
| 228 | have hinv (s : ℝ) (hs : s ∈ Icc a b) : |
| 229 | Ring.inverse (chartMetricOperator F T x (s, u s)) (P s) = q s := |
| 230 | inverse_operator_apply _ (chartMetricOperator_isUnit F T x (hdom hs)) (q s) |
| 231 | have hphase (s : ℝ) (hs : s ∈ Icc a b) : |
| 232 | HasDerivWithinAt (fun r ↦ (u r, P r)) |
| 233 | (chartEulerPhase F T x s (u s, P s)) (Icc a b) s := by |
| 234 | simpa only [chartEulerPhase, hinv s hs] using (hud s hs).prodMk (hPd s hs) |
| 235 | have hphasemem : MapsTo (fun s ↦ (u s, P s)) (Icc a b) |
| 236 | ((extChartAt (𝓡 n) x).target ×ˢ univ) := |
| 237 | fun s hs ↦ ⟨(hdom hs).2, mem_univ _⟩ |
| 238 | have hphaseSmooth := ODE.contDiffOn_enat_Icc_of_hasDerivWithinAt (n := ⊤) |
| 239 | (chartEulerPhase_contDiffOn F T hpotential x htime) hphase hphasemem |
| 240 | refine ⟨hphaseSmooth.fst, ?_⟩ |
| 241 | intro s hs |
| 242 | have hqs : q s = deriv u s := derivWithin_of_mem_nhds (Icc_mem_nhds hs.1 hs.2) |
| 243 | have heq : (fun r ↦ chartMomentumVector (G r) (deriv u r)) =ᶠ[𝓝 s] P := by |
| 244 | filter_upwards [Ioo_mem_nhds hs.1 hs.2] with r hr |
| 245 | dsimp only [P, q] |
| 246 | rw [derivWithin_of_mem_nhds (Icc_mem_nhds hr.1 hr.2)] |
| 247 | have hd := ((hPd s (Ioo_subset_Icc_self hs)).hasDerivAt (Icc_mem_nhds hs.1 hs.2)).congr_of_eventuallyEq heq |
| 248 | simpa only [Q, hqs] using hd |
| 249 | |
| 250 | end PoincareMT.ReducedLengthMinimum.Variational |