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.Variation.Second.SecondVariationCoefficients |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Coordinates.VariationChartFields |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Regularity.ChartEulerEquation |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ContinuationSpeed.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 scoped Manifold ContDiff Bundle |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.LGeometry |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local instance continuationSpeedDualGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 25 | ContinuousLinearMap.toNormedAddCommGroup |
| 26 | local instance continuationSpeedDualSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 27 | ContinuousLinearMap.toNormedSpace |
| 28 | local instance continuationSpeedBilinGroup : |
| 29 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 30 | ContinuousLinearMap.toNormedAddCommGroup |
| 31 | local instance continuationSpeedBilinSpace : |
| 32 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 33 | ContinuousLinearMap.toNormedSpace |
| 34 | |
| 35 | def continuationSpeedSq {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) |
| 36 | (α : ℝ → M) (C : Set ℝ) (s : ℝ) : ℝ := |
| 37 | (F.metric (T - s ^ 2)).inner (α s) |
| 38 | (curveVelocityWithin (n := n) α C s) (curveVelocityWithin (n := n) α C s) |
| 39 | |
| 40 | theorem continuationSpeedSq_nonneg {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) |
| 41 | (α : ℝ → M) (C : Set ℝ) (s : ℝ) : 0 ≤ continuationSpeedSq F T α C s := by |
| 42 | by_cases h : curveVelocityWithin (n := n) α C s = 0 |
| 43 | · simp only [continuationSpeedSq, h, map_zero, le_refl] |
| 44 | · exact ((F.metric (T - s ^ 2)).pos (α s) _ h).le |
| 45 | |
| 46 | theorem continuationSpeedSq_contDiffOn {J C U : Set ℝ} (F : RicciFlow n M J) (T : ℝ) |
| 47 | (α : ℝ → M) (hC : UniqueDiffOn ℝ C) (hU : IsOpen U) (hCU : C ⊆ U) |
| 48 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U) |
| 49 | (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) : |
| 50 | ContDiffOn ℝ ∞ (continuationSpeedSq F T α C) C := by |
| 51 | have hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 52 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) |
| 53 | (curveVelocityWithin (n := n) α C s)) C := by |
| 54 | apply ((contMDiffOn_mfderiv_const_apply hU α hα (1 : ℝ)).mono hCU).congr |
| 55 | intro s hs |
| 56 | apply congrArg (fun w : TangentSpace (𝓡 n) (α s) ↦ |
| 57 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) w) |
| 58 | unfold curveVelocityWithin |
| 59 | rw [mfderivWithin_eq_mfderiv (hC.uniqueMDiffOn s hs) |
| 60 | (((hα s (hCU hs)).contMDiffAt (hU.mem_nhds (hCU hs))).mdifferentiableAt (by simp))] |
| 61 | exact (movingMetric_pair_contMDiffOn F (fun s : ℝ ↦ T - s ^ 2) α |
| 62 | (curveVelocityWithin (n := n) α C) (curveVelocityWithin (n := n) α C) |
| 63 | (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn |
| 64 | (hα.mono hCU) hA hA (fun s hs ↦ htime s hs)).contDiffOn |
| 65 | |
| 66 | set_option maxHeartbeats 2200000 in |
| 67 | theorem continuationSpeedSq_hasDerivAt {J C U : Set ℝ} |
| 68 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) (T : ℝ) |
| 69 | (α : ℝ → M) (hC : UniqueDiffOn ℝ C) (hU : IsOpen U) (hCU : C ⊆ U) |
| 70 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U) |
| 71 | (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 72 | (E : ParametricAlongCurveExtensionOn C α (curveVelocityWithin (n := n) α C)) |
| 73 | {s : ℝ} (hs : s ∈ C) (hsN : C ∈ 𝓝 s) : |
| 74 | HasDerivAt (continuationSpeedSq F T α C) |
| 75 | (2 * (F.metric (T - s ^ 2)).inner (α s) |
| 76 | (pullbackCovariantDerivative F (fun r ↦ T - r ^ 2) α |
| 77 | (curveVelocityWithin (n := n) α C) C E s) |
| 78 | (curveVelocityWithin (n := n) α C s) + |
| 79 | 4 * s * (F.connection (T - s ^ 2)).ricci (α s) |
| 80 | (curveVelocityWithin (n := n) α C s) (curveVelocityWithin (n := n) α C s)) s := by |
| 81 | let x := α s |
| 82 | let e := extChartAt (𝓡 n) x |
| 83 | let N := U ∩ α ⁻¹' (chartAt (EuclideanSpace ℝ (Fin n)) x).source |
| 84 | let q := e ∘ α |
| 85 | let A := deriv q |
| 86 | let G := chartActionMetric F T x |
| 87 | have hN : IsOpen N := hα.continuousOn.isOpen_inter_preimage hU |
| 88 | (chartAt (EuclideanSpace ℝ (Fin n)) x).open_source |
| 89 | have hx : α s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source := mem_chart_source _ _ |
| 90 | have hsN' : s ∈ N := ⟨hCU hs, hx⟩ |
| 91 | have hq : ContDiffOn ℝ ∞ q N := chart_curve_contDiffOn x α |
| 92 | (hα.mono inter_subset_left) (fun r hr ↦ hr.2) |
| 93 | have hA : ContDiffOn ℝ ∞ A N := hq.deriv_of_isOpen hN (by simp) |
| 94 | have hαd (r : ℝ) (hr : r ∈ N) : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α r := |
| 95 | ((hα r hr.1).contMDiffAt (hU.mem_nhds hr.1)).mdifferentiableAt (by simp) |
| 96 | have hfield (r : ℝ) (hr : r ∈ C ∩ N) : |
| 97 | chartFrame x (A r) (α r) = curveVelocityWithin (n := n) α C r := by |
| 98 | rw [chartFrame_curveVelocity hr.2.2 (hαd r hr.2)] |
| 99 | unfold curveVelocityWithin curveVelocity |
| 100 | rw [mfderivWithin_eq_mfderiv (hC r hr.1).uniqueMDiffWithinAt (hαd r hr.2)] |
| 101 | have htarget : q s ∈ e.target := e.map_source |
| 102 | (by simpa only [e, extChartAt_source] using hx) |
| 103 | have hprod : C ×ˢ e.target ∈ 𝓝 (s, q s) := |
| 104 | prod_mem_nhds hsN ((isOpen_extChartAt_target (I := 𝓡 n) x).mem_nhds htarget) |
| 105 | have hGd : DifferentiableAt ℝ G (s, q s) := |
| 106 | (((chartActionMetric_closed_contDiffOn F T x htime) (s, q s) ⟨hs, htarget⟩).contDiffAt |
| 107 | hprod).differentiableAt (by simp) |
| 108 | have hqd : DifferentiableAt ℝ q s := |
| 109 | ((hq s hsN').contDiffAt (hN.mem_nhds hsN')).differentiableAt (by simp) |
| 110 | have hAd : HasDerivAt A (deriv A s) s := |
| 111 | (((hA s hsN').contDiffAt (hN.mem_nhds hsN')).differentiableAt (by simp)).hasDerivAt |
| 112 | have hGc : HasDerivAt (fun r ↦ G (r, q r)) (fderiv ℝ G (s, q s) (1, A s)) s := by |
| 113 | simpa only [Function.comp_def, id_eq] using |
| 114 | hGd.hasFDerivAt.comp_hasDerivAt s ((hasDerivAt_id s).prodMk hqd.hasDerivAt) |
| 115 | have hp := (hGc.clm_apply hAd).clm_apply hAd |
| 116 | have hpb := pullbackCovariantDerivative_chart_formula_local F (fun r ↦ T - r ^ 2) |
| 117 | hN x α A hA (fun r hr ↦ hr.2.2) _ hfield E hs hsN' (hC s hs) (hαd s hsN') |
| 118 | have hDA : pullbackCovariantDerivative F (fun r ↦ T - r ^ 2) α |
| 119 | (curveVelocityWithin (n := n) α C) C E s = |
| 120 | chartFrame x (deriv A s + closedChartChristoffel F T x C (s, q s) (A s) (A s)) (α s) := by |
| 121 | rw [hpb, closedChartChristoffel_connection F T htime hx hs] |
| 122 | exact ((trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x).symmL ℝ |
| 123 | (α s)).map_add _ _ |>.symm |
| 124 | have hspace := chartActionMetric_spatial_compatibility F T htime hx hs (A s) (A s) (A s) |
| 125 | change spatialWithinFDeriv C e.target G (s, q s) (A s) (A s) (A s) = _ at hspace |
| 126 | rw [spatialWithinFDeriv_apply_of_mem_nhds G hprod (A s)] at hspace |
| 127 | have hsplit : fderiv ℝ G (s, q s) (1, A s) (A s) (A s) = |
| 128 | fderiv ℝ G (s, q s) (1, 0) (A s) (A s) + |
| 129 | G (s, q s) (closedChartChristoffel F T x C (s, q s) (A s) (A s)) (A s) + |
| 130 | G (s, q s) (A s) (closedChartChristoffel F T x C (s, q s) (A s) (A s)) := by |
| 131 | rw [show ((1 : ℝ), A s) = (1, (0 : EuclideanSpace ℝ (Fin n))) + (0, A s) by simp, |
| 132 | map_add, add_apply, add_apply, hspace] |
| 133 | dsimp only [G, q, e, Function.comp_def] |
| 134 | ring |
| 135 | have htimeG := chartActionMetric_time_pair_interior F hM04 T hC htime hx hs hsN (A s) (A s) |
| 136 | have hpair : (fderiv ℝ G (s, q s) (1, A s) (A s) + |
| 137 | G (s, q s) (deriv A s)) (A s) + G (s, q s) (A s) (deriv A s) = |
| 138 | 2 * (F.metric (T - s ^ 2)).inner (α s) |
| 139 | (pullbackCovariantDerivative F (fun r ↦ T - r ^ 2) α |
| 140 | (curveVelocityWithin (n := n) α C) C E s) (curveVelocityWithin (n := n) α C s) + |
| 141 | 4 * s * (F.connection (T - s ^ 2)).ricci (α s) |
| 142 | (curveVelocityWithin (n := n) α C s) (curveVelocityWithin (n := n) α C s) := by |
| 143 | rw [hDA, ← hfield s ⟨hs, hsN'⟩, ← chartActionMetric_apply F T hx, |
| 144 | ← htimeG, add_apply, hsplit] |
| 145 | simp only [map_add, add_apply] |
| 146 | dsimp only [G, q, e, Function.comp_def] |
| 147 | rw [chartActionMetric_symm_at F T hx s (deriv A s) (A s), |
| 148 | chartActionMetric_symm_at F T hx s |
| 149 | (closedChartChristoffel F T x C (s, extChartAt (𝓡 n) x (α s)) (A s) (A s)) (A s)] |
| 150 | ring |
| 151 | rw [hpair] at hp |
| 152 | apply hp.congr_of_eventuallyEq |
| 153 | filter_upwards [hsN, hN.mem_nhds hsN'] with r hrC hrN |
| 154 | dsimp only [G, q, e, Function.comp_def] |
| 155 | rw [chartActionMetric_apply F T hrN.2, hfield r ⟨hrC, hrN⟩] |
| 156 | rfl |
| 157 | |
| 158 | theorem regularized_continuationSpeedSq_hasDerivAt {J : Set ℝ} {F : RicciFlow n M J} |
| 159 | {T τ₁ τ₂ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) |
| 160 | {p : BackwardTimePath F T τ₁ τ₂} (R : RegularizedLGeodesicData p) {s : ℝ} |
| 161 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) : |
| 162 | HasDerivAt (continuationSpeedSq F T R.path.curve (sqrtParameterInterval τ₁ τ₂)) |
| 163 | (4 * s ^ 2 * scalarCurvatureDifferential F (fun r ↦ T - r ^ 2) R.path.curve s |
| 164 | (curveVelocityWithin (n := n) R.path.curve (sqrtParameterInterval τ₁ τ₂) s) - |
| 165 | 4 * s * (F.connection (T - s ^ 2)).ricci (R.path.curve s) |
| 166 | (curveVelocityWithin (n := n) R.path.curve (sqrtParameterInterval τ₁ τ₂) s) |
| 167 | (curveVelocityWithin (n := n) R.path.curve (sqrtParameterInterval τ₁ τ₂) s)) s := by |
| 168 | have hsC : s ∈ sqrtParameterInterval τ₁ τ₂ := Ioo_subset_Icc_self hs |
| 169 | have htime (r : ℝ) (hr : r ∈ sqrtParameterInterval τ₁ τ₂) : T - r ^ 2 ∈ J := |
| 170 | p.time_mem _ (square_mem_backward_interval p hr) |
| 171 | have h := continuationSpeedSq_hasDerivAt F hM04 T R.path.curve |
| 172 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered)) R.path.open_domain |
| 173 | R.path.interval_subset R.path.smooth htime R.velocity_extension hsC (Icc_mem_nhds hs.1 hs.2) |
| 174 | have heq := R.equation s hsC |
| 175 | (curveVelocityWithin (n := n) R.path.curve (sqrtParameterInterval τ₁ τ₂) s) |
| 176 | unfold regularizedEulerResidual at heq |
| 177 | convert h using 1 <;> dsimp only [sqrtParameterInterval] at heq ⊢ <;> linarith |
| 178 | |
| 179 | theorem backward_gronwall_bound {q q' : ℝ → ℝ} {a c C : ℝ} |
| 180 | (hq : ContinuousOn q (Icc a c)) |
| 181 | (hqd : ∀ s ∈ Ioo a c, HasDerivAt q (q' s) s) |
| 182 | (hbound : ∀ s ∈ Ioo a c, -(C * (q s + 1)) ≤ q' s) |
| 183 | {s : ℝ} (hs : s ∈ Icc a c) : |
| 184 | q s + 1 ≤ Real.exp (C * (c - s)) * (q c + 1) := by |
| 185 | let f := fun r ↦ Real.exp (C * r) * (q r + 1) |
| 186 | have hf : ContinuousOn f (Icc a c) := |
| 187 | ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn).mul |
| 188 | (hq.add continuousOn_const) |
| 189 | have hfd (r : ℝ) (hr : r ∈ Ioo a c) : |
| 190 | HasDerivAt f (Real.exp (C * r) * (q' r + C * (q r + 1))) r := by |
| 191 | convert (((hasDerivAt_id r).const_mul C).exp).mul ((hqd r hr).add_const 1) using 1 <;> |
| 192 | first | rfl | (simp only [id_eq, mul_one]; ring) |
| 193 | have hmono : MonotoneOn f (Icc a c) := by |
| 194 | apply monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc a c) hf |
| 195 | (f' := fun r ↦ Real.exp (C * r) * (q' r + C * (q r + 1))) |
| 196 | · intro r hr |
| 197 | rw [interior_Icc] at hr |
| 198 | exact (hfd r hr).hasDerivWithinAt |
| 199 | · intro r hr |
| 200 | rw [interior_Icc] at hr |
| 201 | exact mul_nonneg (Real.exp_pos _).le (by linarith [hbound r hr]) |
| 202 | have hsc := hmono hs ⟨hs.1.trans hs.2, le_rfl⟩ hs.2 |
| 203 | change Real.exp (C * s) * (q s + 1) ≤ Real.exp (C * c) * (q c + 1) at hsc |
| 204 | calc |
| 205 | q s + 1 = (Real.exp (C * s) * (q s + 1)) / Real.exp (C * s) := by |
| 206 | field_simp |
| 207 | _ ≤ (Real.exp (C * c) * (q c + 1)) / Real.exp (C * s) := |
| 208 | div_le_div_of_nonneg_right hsc (Real.exp_pos _).le |
| 209 | _ = Real.exp (C * (c - s)) * (q c + 1) := by |
| 210 | rw [mul_div_right_comm, ← Real.exp_sub, mul_sub] |
| 211 | |
| 212 | theorem backward_gronwall_uniform_bound {q q' : ℝ → ℝ} {a c C : ℝ} |
| 213 | (ha : 0 ≤ a) (hC : 0 ≤ C) (hqc : 0 ≤ q c) |
| 214 | (hq : ContinuousOn q (Icc a c)) |
| 215 | (hqd : ∀ s ∈ Ioo a c, HasDerivAt q (q' s) s) |
| 216 | (hbound : ∀ s ∈ Ioo a c, -(C * (q s + 1)) ≤ q' s) |
| 217 | {s : ℝ} (hs : s ∈ Icc a c) : |
| 218 | q s ≤ Real.exp (C * c) * (q c + 1) := by |
| 219 | have h := backward_gronwall_bound hq hqd hbound hs |
| 220 | have hexp : Real.exp (C * (c - s)) ≤ Real.exp (C * c) := by |
| 221 | apply Real.exp_le_exp.mpr |
| 222 | exact mul_le_mul_of_nonneg_left (sub_le_self c (ha.trans hs.1)) hC |
| 223 | nlinarith [mul_le_mul_of_nonneg_right hexp (by linarith : 0 ≤ q c + 1)] |
| 224 | |
| 225 | end PoincareMT.LGeometry |