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.Variation.Geometry.ChartMetric |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Geometry.Extension |
| 3 | |
| 4 | /-! |
| 5 | # Differentiating metric pairings along a curve |
| 6 | |
| 7 | Adapted from Mapher `Proofs/M08/EulerMomentum.lean`, commit |
| 8 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | open Set Filter Topology |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLengthMinimum.Variation.Geometry |
| 22 | |
| 23 | open ReducedLengthMinimum.Variational |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | omit [IsManifold (𝓡 n) ∞ M] in |
| 29 | theorem scalar_graph_hasDerivAt (H : ℝ × M → ℝ) {α : ℝ → M} {s : ℝ} |
| 30 | (hH : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) H (s, α s)) |
| 31 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s) : |
| 32 | HasDerivAt (fun r ↦ H (r, α r)) |
| 33 | (deriv (fun r ↦ H (r, α s)) s + |
| 34 | mvfderiv (𝓡 n) (fun y ↦ H (s, y)) (α s) (curveVelocity (n := n) α s)) s := by |
| 35 | have hgraph := mdifferentiableAt_id.prodMk hα |
| 36 | have hcomp := (hH.comp s hgraph).differentiableAt.hasDerivAt |
| 37 | have h := mfderiv_comp_apply s hH hgraph (1 : ℝ) |
| 38 | rw [mfderiv_prodMk mdifferentiableAt_id hα, mfderiv_id] at h |
| 39 | change mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r ↦ H (r, α r)) s 1 = |
| 40 | mfderiv ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) H (s, α s) |
| 41 | (1, curveVelocity (n := n) α s) at h |
| 42 | rw [mfderiv_prod_eq_add_apply hH] at h |
| 43 | have hscalar (f : ℝ → ℝ) : mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) f s 1 = deriv f s := by |
| 44 | have hf := congrArg (fun A : ℝ →L[ℝ] ℝ ↦ A 1) |
| 45 | (mfderiv_eq_fderiv (𝕜 := ℝ) (f := f) (x := s)) |
| 46 | exact hf.trans fderiv_apply_one_eq_deriv |
| 47 | dsimp only [Prod.fst, Prod.snd] at h |
| 48 | rw [hscalar, hscalar] at h |
| 49 | convert hcomp using 1 <;> first | rfl | exact h.symm |
| 50 | |
| 51 | section Bilinear |
| 52 | |
| 53 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 54 | |
| 55 | noncomputable local instance eulerMomentumInstance1 : NormedAddCommGroup (E →L[ℝ] ℝ) := |
| 56 | ContinuousLinearMap.toNormedAddCommGroup |
| 57 | noncomputable local instance eulerMomentumInstance2 : NormedSpace ℝ (E →L[ℝ] ℝ) := |
| 58 | ContinuousLinearMap.toNormedSpace |
| 59 | noncomputable local instance eulerMomentumInstance3 : NormedAddCommGroup (E →L[ℝ] E →L[ℝ] ℝ) := |
| 60 | ContinuousLinearMap.toNormedAddCommGroup |
| 61 | noncomputable local instance eulerMomentumInstance4 : NormedSpace ℝ (E →L[ℝ] E →L[ℝ] ℝ) := |
| 62 | ContinuousLinearMap.toNormedSpace |
| 63 | |
| 64 | theorem bilinear_moving_vector_hasDerivAt {G : ℝ → E →L[ℝ] E →L[ℝ] ℝ} |
| 65 | {v : ℝ → E} {s d : ℝ} {a : E} (w : E) |
| 66 | (hG : DifferentiableAt ℝ G s) (hv : HasDerivAt v a s) |
| 67 | (hfixed : HasDerivAt (fun r ↦ G r (v s) w) d s) : |
| 68 | HasDerivAt (fun r ↦ G r (v r) w) (d + G s a w) s := by |
| 69 | have h₁ := (hG.hasDerivAt.clm_apply (hasDerivAt_const s (v s))).clm_apply |
| 70 | (hasDerivAt_const s w) |
| 71 | have hd : deriv G s (v s) w = d := by |
| 72 | simpa only [map_zero, add_zero] using h₁.unique hfixed |
| 73 | have h₂ := (hG.hasDerivAt.clm_apply hv).clm_apply (hasDerivAt_const s w) |
| 74 | simpa only [add_apply, map_zero, add_zero, hd] using h₂ |
| 75 | |
| 76 | end Bilinear |
| 77 | |
| 78 | noncomputable local instance eulerMomentumInstance5 : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 79 | ContinuousLinearMap.toNormedAddCommGroup |
| 80 | noncomputable local instance eulerMomentumInstance6 : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 81 | ContinuousLinearMap.toNormedSpace |
| 82 | noncomputable local instance eulerMomentumInstance7 : |
| 83 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 84 | ContinuousLinearMap.toNormedAddCommGroup |
| 85 | noncomputable local instance eulerMomentumInstance8 : |
| 86 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 87 | ContinuousLinearMap.toNormedSpace |
| 88 | |
| 89 | theorem parametricExtension_chart_contMDiffAt {I : Set ℝ} {α : ℝ → M} |
| 90 | {Y : ∀ s, TangentSpace (𝓡 n) (α s)} |
| 91 | (E : ParametricAlongCurveExtensionOn I α Y) {x y : M} {s : ℝ} |
| 92 | (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 93 | (hE : (s, y) ∈ E.domain) : |
| 94 | ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 n) ∞ |
| 95 | (fun z : ℝ × M ↦ |
| 96 | (trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x).continuousLinearMapAt |
| 97 | ℝ z.2 (E.extension z.1 z.2)) (s, y) := by |
| 98 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x |
| 99 | have h := (e.contMDiffAt_iff (x₀ := (s, y)) (f := fun z : ℝ × M ↦ |
| 100 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) z.2 (E.extension z.1 z.2)) |
| 101 | (e.mem_source.mpr hy)).mp |
| 102 | ((E.smooth _ hE).contMDiffAt (E.open_domain.mem_nhds hE)) |
| 103 | apply h.2.congr_of_eventuallyEq |
| 104 | filter_upwards [continuous_snd.continuousAt (e.open_baseSet.mem_nhds hy)] with z hz |
| 105 | exact e.continuousLinearMapAt_apply_of_mem ℝ hz _ |
| 106 | |
| 107 | set_option synthInstance.maxHeartbeats 200000 in |
| 108 | theorem parametricExtension_metric_pair_contMDiffAt {J I : Set ℝ} (F : RicciFlow n M J) |
| 109 | (T : ℝ) {α : ℝ → M} {Y : ∀ s, TangentSpace (𝓡 n) (α s)} |
| 110 | (E : ParametricAlongCurveExtensionOn I α Y) {x y : M} {s : ℝ} |
| 111 | (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 112 | (hE : (s, y) ∈ E.domain) (ht : T - s ^ 2 ∈ interior J) |
| 113 | (w : EuclideanSpace ℝ (Fin n)) : |
| 114 | ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓘(ℝ, ℝ)) ∞ |
| 115 | (fun z : ℝ × M ↦ (F.metric (T - z.1 ^ 2)).inner z.2 |
| 116 | (E.extension z.1 z.2) (chartFrame x w z.2)) (s, y) := by |
| 117 | have hmap : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) |
| 118 | ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ |
| 119 | (fun z : ℝ × M ↦ (T - z.1 ^ 2, z.2)) (s, y) := |
| 120 | (contMDiffAt_const.sub (contMDiffAt_fst.pow 2)).prodMk contMDiffAt_snd |
| 121 | have hmetric := ((F.smooth (T - s ^ 2, y) ⟨interior_subset ht, mem_univ y⟩).contMDiffAt |
| 122 | (prod_mem_nhds (mem_interior_iff_mem_nhds.mp ht) univ_mem)).comp (s, y) hmap |
| 123 | have hfield := (E.smooth (s, y) hE).contMDiffAt (E.open_domain.mem_nhds hE) |
| 124 | have hframe : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 125 | (fun z : ℝ × M ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) z.2 |
| 126 | (chartFrame x w z.2)) (s, y) := |
| 127 | ((chartFrame_contMDiffOn x w y hy).contMDiffAt |
| 128 | ((chartAt (EuclideanSpace ℝ (Fin n)) x).open_source.mem_nhds hy)).comp (s, y) |
| 129 | contMDiffAt_snd |
| 130 | have h : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓘(ℝ, ℝ))) ∞ |
| 131 | (fun z : ℝ × M ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) z.2 |
| 132 | ((F.metric (T - z.1 ^ 2)).inner z.2 |
| 133 | (E.extension z.1 z.2) (chartFrame x w z.2))) (s, y) := by |
| 134 | apply ContMDiffAt.clm_bundle_apply₂ |
| 135 | (F₁ := EuclideanSpace ℝ (Fin n)) (F₂ := EuclideanSpace ℝ (Fin n)) |
| 136 | · exact hmetric |
| 137 | · exact hfield |
| 138 | · exact hframe |
| 139 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 140 | using (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 141 | |
| 142 | theorem parametricExtension_metric_pair_time {J I : Set ℝ} (F : RicciFlow n M J) |
| 143 | (T : ℝ) {α : ℝ → M} {Y : ∀ s, TangentSpace (𝓡 n) (α s)} |
| 144 | (E : ParametricAlongCurveExtensionOn I α Y) {x y : M} {s : ℝ} |
| 145 | (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 146 | (hE : (s, y) ∈ E.domain) (ht : T - s ^ 2 ∈ interior J) |
| 147 | (w : EuclideanSpace ℝ (Fin n)) : |
| 148 | HasDerivAt (fun r ↦ (F.metric (T - r ^ 2)).inner y |
| 149 | (E.extension r y) (chartFrame x w y)) |
| 150 | (4 * s * (F.connection (T - s ^ 2)).ricci y (E.extension s y) (chartFrame x w y) + |
| 151 | (F.metric (T - s ^ 2)).inner y |
| 152 | (deriv (fun r ↦ E.extension r y) s) (chartFrame x w y)) s := by |
| 153 | let : NormedAddCommGroup (TangentSpace (𝓡 n) y) := |
| 154 | inferInstanceAs (NormedAddCommGroup (EuclideanSpace ℝ (Fin n))) |
| 155 | let : NormedSpace ℝ (TangentSpace (𝓡 n) y) := |
| 156 | inferInstanceAs (NormedSpace ℝ (EuclideanSpace ℝ (Fin n))) |
| 157 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x |
| 158 | let v := fun r ↦ e.continuousLinearMapAt ℝ y (E.extension r y) |
| 159 | let a := e.continuousLinearMapAt ℝ y (deriv (fun r ↦ E.extension r y) s) |
| 160 | have hv : HasDerivAt v a s := (e.continuousLinearMapAt ℝ y).hasFDerivAt.comp_hasDerivAt s |
| 161 | (parametricExtension_differentiableAt_time E hE).hasDerivAt |
| 162 | have hy' : y ∈ (extChartAt (𝓡 n) x).source := by simpa only [extChartAt_source] using hy |
| 163 | have hdom : (s, extChartAt (𝓡 n) x y) ∈ chartActionDomain F T x := |
| 164 | ⟨squareTime_mem_interior_preimage ht, (extChartAt (𝓡 n) x).map_source hy'⟩ |
| 165 | have hG : DifferentiableAt ℝ (chartActionMetric F T x) (s, extChartAt (𝓡 n) x y) := |
| 166 | (((chartActionMetric_contDiffOn F T x) _ hdom).contDiffAt |
| 167 | ((chartActionDomain_open F T x).mem_nhds hdom)).differentiableAt (by simp) |
| 168 | have hGt := hG.comp (f := fun r : ℝ ↦ (r, extChartAt (𝓡 n) x y)) s |
| 169 | (differentiableAt_id.prodMk (differentiableAt_const _)) |
| 170 | have hfixed := chartActionMetric_time_derivative F T hy ht (v s) w |
| 171 | have h := bilinear_moving_vector_hasDerivAt w hGt hv hfixed |
| 172 | have heq (r : ℝ) : chartFrame x (v r) y = E.extension r y := |
| 173 | e.symmL_continuousLinearMapAt hy _ |
| 174 | have hea : chartFrame x a y = deriv (fun r ↦ E.extension r y) s := |
| 175 | e.symmL_continuousLinearMapAt hy _ |
| 176 | simpa only [Function.comp_apply, chartActionMetric_apply F T hy, heq, hea] using h |
| 177 | |
| 178 | theorem chartFrame_connection_cross (g : RiemannianMetric n M) (D : LeviCivitaData g) |
| 179 | {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 180 | (v w : EuclideanSpace ℝ (Fin n)) : |
| 181 | g.inner y (chartFrame x v y) (D.connection (chartFrame x w) y (chartFrame x v y)) = |
| 182 | mvfderiv (𝓡 n) (fun p ↦ g.inner p (chartFrame x v p) (chartFrame x v p)) y |
| 183 | (chartFrame x w y) / 2 := by |
| 184 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 185 | ⟨g.toRiemannianMetric⟩ |
| 186 | have hdiff (z : EuclideanSpace ℝ (Fin n)) := |
| 187 | ((chartFrame_contMDiffOn x z y hy).contMDiffAt |
| 188 | ((chartAt (EuclideanSpace ℝ (Fin n)) x).open_source.mem_nhds hy)).mdifferentiableAt |
| 189 | (by simp) |
| 190 | have hcross : D.connection (chartFrame x w) y (chartFrame x v y) = |
| 191 | D.connection (chartFrame x v) y (chartFrame x w y) := by |
| 192 | have h := D.connection.torsion_eq_zero_iff.mp D.torsion_eq_zero (hdiff v) (hdiff w) |
| 193 | rw [chartFrame_mlieBracket hy v w] at h |
| 194 | exact sub_eq_zero.mp h |
| 195 | have h := D.metricCompatible.mvfderiv_inner_eq (chartFrame x w) (hdiff v) (hdiff v) |
| 196 | change mvfderiv (𝓡 n) (fun p ↦ g.inner p (chartFrame x v p) (chartFrame x v p)) y |
| 197 | (chartFrame x w y) = |
| 198 | g.inner y (D.connection (chartFrame x v) y (chartFrame x w y)) (chartFrame x v y) + |
| 199 | g.inner y (chartFrame x v y) (D.connection (chartFrame x v) y (chartFrame x w y)) at h |
| 200 | rw [g.symm y (D.connection (chartFrame x v) y (chartFrame x w y)) (chartFrame x v y)] at h |
| 201 | rw [hcross] |
| 202 | linarith |
| 203 | |
| 204 | set_option maxHeartbeats 800000 in |
| 205 | theorem parametricExtension_metric_pair_graph {J I : Set ℝ} (F : RicciFlow n M J) |
| 206 | (T : ℝ) (hI : IsOpen I) {α : ℝ → M} |
| 207 | (E : ParametricAlongCurveExtensionOn I α (curveVelocityWithin (n := n) α I)) |
| 208 | {x : M} {s : ℝ} (hs : s ∈ I) |
| 209 | (hy : α s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 210 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s) |
| 211 | (ht : T - s ^ 2 ∈ interior J) (w : EuclideanSpace ℝ (Fin n)) : |
| 212 | HasDerivAt (fun r ↦ (F.metric (T - r ^ 2)).inner (α r) |
| 213 | (E.extension r (α r)) (chartFrame x w (α r))) |
| 214 | ((F.metric (T - s ^ 2)).inner (α s) |
| 215 | (pullbackCovariantDerivative F (fun r ↦ T - r ^ 2) α |
| 216 | (curveVelocityWithin (n := n) α I) I E s) (chartFrame x w (α s)) + |
| 217 | 4 * s * (F.connection (T - s ^ 2)).ricci (α s) |
| 218 | (curveVelocityWithin (n := n) α I s) (chartFrame x w (α s)) + |
| 219 | spatialFDeriv (chartActionMetric F T x) (s, extChartAt (𝓡 n) x (α s)) |
| 220 | w (deriv ((extChartAt (𝓡 n) x) ∘ α) s) |
| 221 | (deriv ((extChartAt (𝓡 n) x) ∘ α) s) / 2) s := by |
| 222 | let g := F.metric (T - s ^ 2) |
| 223 | let D := F.connection (T - s ^ 2) |
| 224 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 225 | ⟨g.toRiemannianMetric⟩ |
| 226 | let v := deriv ((extChartAt (𝓡 n) x) ∘ α) s |
| 227 | have hvel : chartFrame x v (α s) = curveVelocityWithin (n := n) α I s := by |
| 228 | rw [show curveVelocityWithin (n := n) α I s = curveVelocity (n := n) α s by |
| 229 | simp only [curveVelocityWithin, curveVelocity, mfderivWithin_of_mem_nhds (hI.mem_nhds hs)]] |
| 230 | unfold v chartFrame |
| 231 | rw [chart_deriv_eq_velocity hy hα] |
| 232 | exact Bundle.Trivialization.symmL_continuousLinearMapAt |
| 233 | (trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x) hy _ |
| 234 | have hvel' : curveVelocity (n := n) α s = chartFrame x v (α s) := by |
| 235 | rw [hvel] |
| 236 | simp only [curveVelocityWithin, curveVelocity, mfderivWithin_of_mem_nhds (hI.mem_nhds hs)] |
| 237 | have hE := (parametricExtension_contMDiffAt_space E (E.graph_mem s hs)).mdifferentiableAt |
| 238 | (by simp) |
| 239 | have hw := ((chartFrame_contMDiffOn x w (α s) hy).contMDiffAt |
| 240 | ((chartAt (EuclideanSpace ℝ (Fin n)) x).open_source.mem_nhds hy)).mdifferentiableAt |
| 241 | (by simp) |
| 242 | have hspace := D.metricCompatible.mvfderiv_inner_eq (chartFrame x v) hE hw |
| 243 | change mvfderiv (𝓡 n) (fun y ↦ g.inner y (E.extension s y) (chartFrame x w y)) (α s) |
| 244 | (chartFrame x v (α s)) = |
| 245 | g.inner (α s) (D.connection (E.extension s) (α s) (chartFrame x v (α s))) |
| 246 | (chartFrame x w (α s)) + |
| 247 | g.inner (α s) (E.extension s (α s)) |
| 248 | (D.connection (chartFrame x w) (α s) (chartFrame x v (α s))) at hspace |
| 249 | rw [E.agrees s hs, ← hvel, chartFrame_connection_cross g D hy v w, |
| 250 | ← chartActionMetric_spatial_apply F T hy ht w v v] at hspace |
| 251 | have htime := parametricExtension_metric_pair_time F T E hy (E.graph_mem s hs) ht w |
| 252 | have h := scalar_graph_hasDerivAt _ |
| 253 | ((parametricExtension_metric_pair_contMDiffAt F T E hy (E.graph_mem s hs) ht w).mdifferentiableAt |
| 254 | (by simp)) hα |
| 255 | rw [htime.deriv, hvel', hspace, E.agrees s hs, hvel] at h |
| 256 | convert h using 1 |
| 257 | unfold pullbackCovariantDerivative |
| 258 | simp only [map_add, add_apply] |
| 259 | ring |
| 260 | |
| 261 | end PoincareMT.ReducedLengthMinimum.Variation.Geometry |