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.Coordinates.ChartEulerCoefficients |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Coordinates.ClosedChartCoefficients |
| 3 | |
| 4 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/EndpointEulerCoefficients.lean` at |
| 5 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 6 | |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Set Filter Topology |
| 12 | open scoped Manifold ContDiff Bundle |
| 13 | |
| 14 | universe u |
| 15 | |
| 16 | namespace PoincareMT.LGeometry |
| 17 | |
| 18 | section Derivative |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | |
| 22 | noncomputable local instance endpointEulerCoefficientsInstance1 : NormedAddCommGroup (E →L[ℝ] ℝ) := |
| 23 | ContinuousLinearMap.toNormedAddCommGroup |
| 24 | noncomputable local instance endpointEulerCoefficientsInstance2 : NormedSpace ℝ (E →L[ℝ] ℝ) := |
| 25 | ContinuousLinearMap.toNormedSpace |
| 26 | noncomputable local instance endpointEulerCoefficientsInstance3 : NormedAddCommGroup (E →L[ℝ] E →L[ℝ] ℝ) := |
| 27 | ContinuousLinearMap.toNormedAddCommGroup |
| 28 | noncomputable local instance endpointEulerCoefficientsInstance4 : NormedSpace ℝ (E →L[ℝ] E →L[ℝ] ℝ) := |
| 29 | ContinuousLinearMap.toNormedSpace |
| 30 | |
| 31 | theorem bilinear_curve_hasDerivWithinAt (G : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ) |
| 32 | {C : Set ℝ} {Ω : Set (ℝ × E)} {u v : ℝ → E} {s : ℝ} {q a : E} |
| 33 | {dG : (ℝ × E) →L[ℝ] E →L[ℝ] E →L[ℝ] ℝ} |
| 34 | (hG : HasFDerivWithinAt G dG Ω (s, u s)) |
| 35 | (hu : HasDerivWithinAt u q C s) (hv : HasDerivWithinAt v a C s) |
| 36 | (hmap : MapsTo (fun r ↦ (r, u r)) C Ω) (z : E) : |
| 37 | HasDerivWithinAt (fun r ↦ G (r, u r) (v r) z) |
| 38 | (dG (1, 0) (v s) z + dG (0, q) (v s) z + G (s, u s) a z) C s := by |
| 39 | have h := (((hG.comp_hasDerivWithinAt s |
| 40 | (HasDerivWithinAt.prodMk (hasDerivWithinAt_id s C) hu) hmap).clm_apply hv).clm_apply |
| 41 | (hasDerivWithinAt_const s C z)) |
| 42 | have hsplit : ((1 : ℝ), q) = (1, 0) + (0, q) := by ext <;> simp |
| 43 | simpa only [Function.comp_def, id_eq, hsplit, map_add, add_apply, |
| 44 | map_zero, add_zero, add_assoc] using h |
| 45 | |
| 46 | end Derivative |
| 47 | |
| 48 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 49 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 50 | |
| 51 | noncomputable local instance endpointEulerCoefficientsInstance5 : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 52 | ContinuousLinearMap.toNormedAddCommGroup |
| 53 | noncomputable local instance endpointEulerCoefficientsInstance6 : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 54 | ContinuousLinearMap.toNormedSpace |
| 55 | noncomputable local instance endpointEulerCoefficientsInstance7 : |
| 56 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 57 | ContinuousLinearMap.toNormedAddCommGroup |
| 58 | noncomputable local instance endpointEulerCoefficientsInstance8 : |
| 59 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 60 | ContinuousLinearMap.toNormedSpace |
| 61 | |
| 62 | set_option maxHeartbeats 800000 in |
| 63 | theorem scalarCurvature_slice_contMDiffAt_of_mem {J : Set ℝ} (F : RicciFlow n M J) |
| 64 | (hM04 : RicciFlowCurvatureTheory.{u}) {t : ℝ} (ht : t ∈ J) (y : M) : |
| 65 | ContMDiffAt (𝓡 n) (𝓘(ℝ, ℝ)) ∞ (F.connection t).scalarCurvature y := by |
| 66 | rw [← contMDiffWithinAt_univ] |
| 67 | have hi : ContMDiffWithinAt (𝓡 n) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ |
| 68 | (fun z : M ↦ (t, z)) univ y := contMDiffWithinAt_const.prodMk contMDiffWithinAt_id |
| 69 | exact ((hM04.scalar_regular n M J F) (t, y) ⟨ht, mem_univ y⟩).comp y hi |
| 70 | (fun z _ ↦ ⟨ht, mem_univ z⟩) |
| 71 | |
| 72 | set_option maxHeartbeats 800000 in |
| 73 | theorem chartActionMetric_closed_spatial_apply {J C : Set ℝ} (F : RicciFlow n M J) |
| 74 | (T : ℝ) (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 75 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 76 | {s : ℝ} (hs : s ∈ C) (z v w : EuclideanSpace ℝ (Fin n)) : |
| 77 | spatialWithinFDeriv C (extChartAt (𝓡 n) x).target (chartActionMetric F T x) |
| 78 | (s, extChartAt (𝓡 n) x y) z v w = |
| 79 | mvfderiv (𝓡 n) (fun p ↦ (F.metric (T - s ^ 2)).inner p |
| 80 | (chartFrame x v p) (chartFrame x w p)) y (chartFrame x z y) := by |
| 81 | let e := extChartAt (𝓡 n) x |
| 82 | have hy' : y ∈ e.source := by simpa only [e, extChartAt_source] using hy |
| 83 | have htarget : e y ∈ e.target := e.map_source hy' |
| 84 | have hd := hasFDerivAt_spatialWithin (isOpen_extChartAt_target (I := 𝓡 n) x) _ |
| 85 | (chartActionMetric_closed_contDiffOn F T x htime) hs htarget |
| 86 | have heval := (hd.clm_apply (hasFDerivAt_const v (e y))).clm_apply |
| 87 | (hasFDerivAt_const w (e y)) |
| 88 | have hevald := congrArg (fun A : EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ ↦ A z) heval.fderiv |
| 89 | simp only [ContinuousLinearMap.comp_zero, zero_add, ContinuousLinearMap.flip_apply] at hevald |
| 90 | let f : M → ℝ := fun p ↦ (F.metric (T - s ^ 2)).inner p |
| 91 | (chartFrame x v p) (chartFrame x w p) |
| 92 | have heq : (fun q ↦ chartActionMetric F T x (s, q) v w) =ᶠ[𝓝 (e y)] f ∘ e.symm := by |
| 93 | filter_upwards [(isOpen_extChartAt_target (I := 𝓡 n) x).mem_nhds htarget] with q hq |
| 94 | have hq' : e.symm q ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source := by |
| 95 | simpa only [e, extChartAt_source] using e.map_target hq |
| 96 | exact metricInChart_apply (F.metric (T - s ^ 2)) hq' v w |
| 97 | calc |
| 98 | _ = fderiv ℝ (fun q ↦ chartActionMetric F T x (s, q) v w) (e y) z := hevald.symm |
| 99 | _ = fderiv ℝ (f ∘ e.symm) (e y) z := |
| 100 | congrArg (fun A : EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ ↦ A z) (heq.fderiv_eq (𝕜 := ℝ)) |
| 101 | _ = _ := chart_scalar_fderiv_apply hy f |
| 102 | ((chartFrame_inner_contMDiffAt _ hy v w).mdifferentiableAt (by simp)) z |
| 103 | |
| 104 | set_option maxHeartbeats 800000 in |
| 105 | theorem chartActionPotential_closed_spatial_apply {J C : Set ℝ} (F : RicciFlow n M J) |
| 106 | (hM04 : RicciFlowCurvatureTheory.{u}) (T : ℝ) (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 107 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 108 | {s : ℝ} (hs : s ∈ C) (w : EuclideanSpace ℝ (Fin n)) : |
| 109 | spatialWithinFDeriv C (extChartAt (𝓡 n) x).target (chartActionPotential F T x) |
| 110 | (s, extChartAt (𝓡 n) x y) w = |
| 111 | 2 * s ^ 2 * mvfderiv (𝓡 n) (F.connection (T - s ^ 2)).scalarCurvature y |
| 112 | (chartFrame x w y) := by |
| 113 | let e := extChartAt (𝓡 n) x |
| 114 | let f := (F.connection (T - s ^ 2)).scalarCurvature |
| 115 | have hy' : y ∈ e.source := by simpa only [e, extChartAt_source] using hy |
| 116 | have htarget : e y ∈ e.target := e.map_source hy' |
| 117 | have hf : ContMDiffAt (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f y := |
| 118 | scalarCurvature_slice_contMDiffAt_of_mem F hM04 (htime s hs) y |
| 119 | have hinv : ContMDiffAt (𝓡 n) (𝓡 n) ∞ e.symm (e y) := |
| 120 | (contMDiffOn_extChartAt_symm (I := 𝓡 n) x _ htarget).contMDiffAt |
| 121 | ((isOpen_extChartAt_target (I := 𝓡 n) x).mem_nhds htarget) |
| 122 | have hf' : ContMDiffAt (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f (e.symm (e y)) := by |
| 123 | rwa [e.left_inv hy'] |
| 124 | have hc : DifferentiableAt ℝ (f ∘ e.symm) (e y) := |
| 125 | (hf'.comp (e y) hinv).contDiffAt.differentiableAt (by simp) |
| 126 | have hd := hasFDerivAt_spatialWithin (isOpen_extChartAt_target (I := 𝓡 n) x) _ |
| 127 | (chartActionPotential_closed_contDiffOn F hM04 T x htime) hs htarget |
| 128 | have heq := hd.unique (hc.hasFDerivAt.const_mul (2 * s ^ 2)) |
| 129 | have h := congrArg (fun A : EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ ↦ A w) heq |
| 130 | calc |
| 131 | _ = 2 * s ^ 2 * fderiv ℝ (f ∘ e.symm) (e y) w := by |
| 132 | simpa only [smul_apply, smul_eq_mul] using h |
| 133 | _ = _ := congrArg (fun a : ℝ ↦ 2 * s ^ 2 * a) |
| 134 | (chart_scalar_fderiv_apply hy f (hf.mdifferentiableAt (by simp)) w) |
| 135 | |
| 136 | theorem chartActionMetric_closed_connection_diagonal {J C : Set ℝ} (F : RicciFlow n M J) |
| 137 | (T : ℝ) (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 138 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 139 | {s : ℝ} (hs : s ∈ C) (v w : EuclideanSpace ℝ (Fin n)) : |
| 140 | (F.metric (T - s ^ 2)).inner y |
| 141 | ((F.connection (T - s ^ 2)).connection (chartFrame x v) y (chartFrame x v y)) |
| 142 | (chartFrame x w y) = |
| 143 | spatialWithinFDeriv C (extChartAt (𝓡 n) x).target (chartActionMetric F T x) |
| 144 | (s, extChartAt (𝓡 n) x y) v v w - |
| 145 | spatialWithinFDeriv C (extChartAt (𝓡 n) x).target (chartActionMetric F T x) |
| 146 | (s, extChartAt (𝓡 n) x y) w v v / 2 := by |
| 147 | rw [chartActionMetric_closed_spatial_apply F T htime hy hs, |
| 148 | chartActionMetric_closed_spatial_apply F T htime hy hs, |
| 149 | chartFrame_connection_diagonal _ _ hy] |
| 150 | ring |
| 151 | |
| 152 | theorem chartActionMetric_closed_time_derivative {J C : Set ℝ} (F : RicciFlow n M J) |
| 153 | (T : ℝ) (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 154 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 155 | {s : ℝ} (hs : s ∈ C) (v w : EuclideanSpace ℝ (Fin n)) : |
| 156 | HasDerivWithinAt (fun r ↦ chartActionMetric F T x (r, extChartAt (𝓡 n) x y) v w) |
| 157 | (4 * s * (F.connection (T - s ^ 2)).ricci y (chartFrame x v y) (chartFrame x w y)) C s := by |
| 158 | have heq : (fun r ↦ chartActionMetric F T x (r, extChartAt (𝓡 n) x y) v w) = |
| 159 | (fun r ↦ (F.metric (T - r ^ 2)).inner y (chartFrame x v y) (chartFrame x w y)) := |
| 160 | funext (fun r ↦ chartActionMetric_apply F T hy r v w) |
| 161 | rw [heq] |
| 162 | have hevol := F.equation (T - s ^ 2) (htime s hs) y (chartFrame x v y) (chartFrame x w y) |
| 163 | have htimeDeriv : HasDerivAt (fun r : ℝ ↦ T - r ^ 2) (-(2 * s)) s := by |
| 164 | simpa using (hasDerivAt_pow 2 s).const_sub T |
| 165 | convert hevol.comp s htimeDeriv.hasDerivWithinAt htime using 1 <;> first | rfl | ring |
| 166 | |
| 167 | set_option maxHeartbeats 800000 in |
| 168 | theorem chartActionMetric_closed_curve_derivative {J C : Set ℝ} (F : RicciFlow n M J) |
| 169 | (T : ℝ) (htime : ∀ s ∈ C, T - s ^ 2 ∈ J) |
| 170 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 171 | {s : ℝ} (hs : s ∈ C) (hCs : UniqueDiffWithinAt ℝ C s) |
| 172 | {u : ℝ → EuclideanSpace ℝ (Fin n)} {q a : EuclideanSpace ℝ (Fin n)} |
| 173 | (hu : HasDerivAt u q s) (hq : HasDerivAt (deriv u) a s) |
| 174 | (hus : u s = extChartAt (𝓡 n) x y) |
| 175 | (hmap : MapsTo u C (extChartAt (𝓡 n) x).target) (w : EuclideanSpace ℝ (Fin n)) : |
| 176 | HasDerivWithinAt (fun r ↦ chartActionMetric F T x (r, u r) (deriv u r) w) |
| 177 | (4 * s * (F.connection (T - s ^ 2)).ricci y (chartFrame x q y) (chartFrame x w y) + |
| 178 | spatialWithinFDeriv C (extChartAt (𝓡 n) x).target (chartActionMetric F T x) |
| 179 | (s, extChartAt (𝓡 n) x y) q q w + |
| 180 | chartActionMetric F T x (s, extChartAt (𝓡 n) x y) a w) C s := by |
| 181 | have hdG := (((chartActionMetric_closed_contDiffOn F T x htime) |
| 182 | (s, u s) ⟨hs, hmap hs⟩).differentiableWithinAt (by simp)).hasFDerivWithinAt |
| 183 | let dG := fderivWithin ℝ (chartActionMetric F T x) |
| 184 | (C ×ˢ (extChartAt (𝓡 n) x).target) (s, u s) |
| 185 | have hcurve := bilinear_curve_hasDerivWithinAt (chartActionMetric F T x) hdG |
| 186 | hu.hasDerivWithinAt hq.hasDerivWithinAt (fun r hr ↦ ⟨hr, hmap hr⟩) w |
| 187 | have htime' : HasDerivWithinAt (fun r ↦ chartActionMetric F T x (r, u s) q w) |
| 188 | (dG (1, 0) q w) C s := by |
| 189 | have hi : HasDerivWithinAt (fun r : ℝ ↦ (r, u s)) (1, 0) C s := |
| 190 | (hasDerivWithinAt_id s C).prodMk (hasDerivWithinAt_const s C (u s)) |
| 191 | have hmapFixed : MapsTo (fun r : ℝ ↦ (r, u s)) C |
| 192 | (C ×ˢ (extChartAt (𝓡 n) x).target) := fun r hr ↦ ⟨hr, hmap hs⟩ |
| 193 | have hGtime : HasDerivWithinAt (fun r ↦ chartActionMetric F T x (r, u s)) |
| 194 | (dG (1, 0)) C s := hdG.comp_hasDerivWithinAt (f := fun r : ℝ ↦ (r, u s)) s hi hmapFixed |
| 195 | have h := ((hGtime.clm_apply (hasDerivWithinAt_const s C q)).clm_apply |
| 196 | (hasDerivWithinAt_const s C w)) |
| 197 | simpa only [Function.comp_def, id_eq, map_zero, add_zero, add_apply] using h |
| 198 | have hfixed := chartActionMetric_closed_time_derivative F T htime hy hs q w |
| 199 | rw [← hus] at hfixed |
| 200 | have heq := (htime'.derivWithin hCs).symm.trans (hfixed.derivWithin hCs) |
| 201 | have hspace : dG (0, q) q w = spatialWithinFDeriv C (extChartAt (𝓡 n) x).target |
| 202 | (chartActionMetric F T x) (s, u s) q q w := rfl |
| 203 | change HasDerivWithinAt (fun r ↦ chartActionMetric F T x (r, u r) (deriv u r) w) |
| 204 | (dG (1, 0) (deriv u s) w + dG (0, q) (deriv u s) w + |
| 205 | chartActionMetric F T x (s, u s) a w) C s at hcurve |
| 206 | rw [hu.deriv, heq, hspace] at hcurve |
| 207 | simpa only [hus] using hcurve |
| 208 | |
| 209 | end PoincareMT.LGeometry |
| 210 |