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.Curvature.Evolution.Tensor.Within |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Evolution.Tensor.FlowRiemannRegularity |
| 3 | import Mathlib.Analysis.InnerProductSpace.GramMatrix |
| 4 | import Mathlib.Analysis.Matrix.PosDef |
| 5 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 6 | |
| 7 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/SectionalRayleigh.lean`, |
| 8 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 9 | `references/ricci-flow/mapher/curvature/`. -/ |
| 10 | |
| 11 | /-! |
| 12 | # Actual sectional Rayleigh quotients |
| 13 | |
| 14 | The metric Gram determinant is positive on independent pairs. Model |
| 15 | orthonormal pairs give compact parameters for the quotient. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle |
| 21 | open Set Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.RicciFlowAnalysis |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {J : Set ℝ} |
| 30 | |
| 31 | noncomputable def metricGram (g : RiemannianMetric n M) (x : M) |
| 32 | (u v : TangentSpace (𝓡 n) x) : ℝ := |
| 33 | g.inner x u u * g.inner x v v - (g.inner x u v) ^ 2 |
| 34 | |
| 35 | noncomputable def metricGramEvaluation (g : RiemannianMetric n M) : |
| 36 | CovariantTensorEvaluation n M 4 := fun x v ↦ |
| 37 | g.inner x (v 0) (v 2) * g.inner x (v 1) (v 3) - |
| 38 | g.inner x (v 0) (v 3) * g.inner x (v 1) (v 2) |
| 39 | |
| 40 | theorem isSmoothCovariantTensor_metricGramEvaluation (g : RiemannianMetric n M) : |
| 41 | IsSmoothCovariantTensor (metricGramEvaluation g) := by |
| 42 | classical |
| 43 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 44 | ⟨g.toRiemannianMetric⟩ |
| 45 | constructor |
| 46 | · intro x |
| 47 | refine ⟨MultilinearMap.mk' (R := ℝ) (metricGramEvaluation g x) ?_ ?_, fun _ ↦ rfl⟩ |
| 48 | · intro v i a b |
| 49 | fin_cases i <;> |
| 50 | simp [metricGramEvaluation, Function.update, map_add, add_apply] <;> ring |
| 51 | · intro v i r a |
| 52 | fin_cases i <;> |
| 53 | simp [metricGramEvaluation, Function.update, map_smul, smul_apply, smul_eq_mul] <;> ring |
| 54 | · intro U hU X hX |
| 55 | exact ((hX 0).inner_bundle (hX 2) |>.mul ((hX 1).inner_bundle (hX 3))).sub |
| 56 | ((hX 0).inner_bundle (hX 3) |>.mul ((hX 1).inner_bundle (hX 2))) |
| 57 | |
| 58 | theorem metricGram_pos_of_linearIndependent (g : RiemannianMetric n M) (x : M) |
| 59 | (u v : TangentSpace (𝓡 n) x) (hlin : LinearIndependent ℝ ![u, v]) : |
| 60 | 0 < metricGram g x u v := by |
| 61 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 62 | ⟨g.toRiemannianMetric⟩ |
| 63 | have h := (Matrix.posDef_gram_of_linearIndependent hlin).det_pos |
| 64 | have hinner (a b : TangentSpace (𝓡 n) x) : inner ℝ a b = g.inner x a b := rfl |
| 65 | simpa only [Matrix.det_fin_two, Matrix.gram, Matrix.of_apply, Matrix.cons_val_zero, |
| 66 | Matrix.cons_val_one, hinner, g.symm x v u, ← pow_two, metricGram] using h |
| 67 | |
| 68 | set_option backward.isDefEq.respectTransparency false in |
| 69 | theorem hasDerivWithinAt_sectionalRayleigh |
| 70 | (F : RicciFlow n M J) (t : ℝ) (ht : t ∈ J) |
| 71 | (x : M) (u v : TangentSpace (𝓡 n) x) |
| 72 | (hgram : 0 < metricGram (F.metric t) x u v) : |
| 73 | HasDerivWithinAt |
| 74 | (fun s ↦ (F.connection s).curvatureTensor x u v u v / |
| 75 | metricGram (F.metric s) x u v) |
| 76 | (((F.connection t).tensorLaplacian (F.connection t).riemannEvaluation |
| 77 | x ![u, v, u, v] + (F.connection t).curvatureReaction x u v u v) / |
| 78 | metricGram (F.metric t) x u v - |
| 79 | (F.connection t).curvatureTensor x u v u v * |
| 80 | (-2 * (F.connection t).ricci x u u * (F.metric t).inner x v v - |
| 81 | 2 * (F.metric t).inner x u u * (F.connection t).ricci x v v + |
| 82 | 4 * (F.connection t).ricci x u v * (F.metric t).inner x u v) / |
| 83 | (metricGram (F.metric t) x u v) ^ 2) J t := by |
| 84 | have hg : HasDerivWithinAt (fun s ↦ metricGram (F.metric s) x u v) |
| 85 | (-2 * (F.connection t).ricci x u u * (F.metric t).inner x v v - |
| 86 | 2 * (F.metric t).inner x u u * (F.connection t).ricci x v v + |
| 87 | 4 * (F.connection t).ricci x u v * (F.metric t).inner x u v) J t := by |
| 88 | have h := ((F.equation t ht x u u).mul (F.equation t ht x v v)).sub |
| 89 | ((F.equation t ht x u v).pow 2) |
| 90 | convert! h using 1 |
| 91 | ring |
| 92 | have h := (F.hasDerivWithinAt_curvatureTensor t ht x u v u v).div hg hgram.ne' |
| 93 | convert! h using 1 |
| 94 | field_simp |
| 95 | |
| 96 | def modelOrthonormalPairs (n : ℕ) : |
| 97 | Set (EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n)) := |
| 98 | {p | ‖p.1‖ = 1 ∧ ‖p.2‖ = 1 ∧ inner ℝ p.1 p.2 = 0} |
| 99 | |
| 100 | theorem isCompact_modelOrthonormalPairs (n : ℕ) : |
| 101 | IsCompact (modelOrthonormalPairs n) := by |
| 102 | let E := EuclideanSpace ℝ (Fin n) |
| 103 | have hclosed : IsClosed (modelOrthonormalPairs n) := |
| 104 | (isClosed_eq continuous_fst.norm continuous_const).inter |
| 105 | ((isClosed_eq continuous_snd.norm continuous_const).inter |
| 106 | (isClosed_eq (continuous_fst.inner continuous_snd) continuous_const)) |
| 107 | apply ((isCompact_sphere (0 : E) 1).prod (isCompact_sphere (0 : E) 1)).of_isClosed_subset |
| 108 | hclosed |
| 109 | intro p hp |
| 110 | exact ⟨by simpa only [Metric.mem_sphere, dist_zero_right] using hp.1, |
| 111 | by simpa only [Metric.mem_sphere, dist_zero_right] using hp.2.1⟩ |
| 112 | |
| 113 | |
| 114 | set_option maxHeartbeats 2000000 in |
| 115 | -- The sectional quotient in tangent-bundle coordinates needs extra elaboration. |
| 116 | set_option backward.isDefEq.respectTransparency false in |
| 117 | theorem continuousOn_flow_sectionalRayleigh_trivialization |
| 118 | (F : RicciFlow n M J) (c : M) : |
| 119 | let E := EuclideanSpace ℝ (Fin n) |
| 120 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) c |
| 121 | ContinuousOn (fun p : (ℝ × M) × (E × E) ↦ |
| 122 | (F.connection p.1.1).curvatureTensor p.1.2 |
| 123 | (e.symmL ℝ p.1.2 p.2.1) (e.symmL ℝ p.1.2 p.2.2) |
| 124 | (e.symmL ℝ p.1.2 p.2.1) (e.symmL ℝ p.1.2 p.2.2) / |
| 125 | metricGram (F.metric p.1.1) p.1.2 |
| 126 | (e.symmL ℝ p.1.2 p.2.1) (e.symmL ℝ p.1.2 p.2.2)) |
| 127 | ((J ×ˢ e.baseSet) ×ˢ modelOrthonormalPairs n) := by |
| 128 | classical |
| 129 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 130 | ⟨(F.metric 0).toRiemannianMetric⟩ |
| 131 | let E := EuclideanSpace ℝ (Fin n) |
| 132 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) c |
| 133 | let S := fun y ↦ e.symmL ℝ y |
| 134 | let b := EuclideanSpace.basisFun (Fin n) ℝ |
| 135 | let W := J ×ˢ e.baseSet |
| 136 | let V := W ×ˢ modelOrthonormalPairs n |
| 137 | have hc : c ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' c |
| 138 | have hSext (a : E) {y : M} (hy : y ∈ e.baseSet) : |
| 139 | FiberBundle.extend E (S c a) y = S y a := by |
| 140 | change e.symm y (e ⟨c, e.symmL ℝ c a⟩).2 = e.symmL ℝ y a |
| 141 | rw [← Bundle.Trivialization.continuousLinearMapAt_apply_of_mem (R := ℝ) e hc, |
| 142 | e.continuousLinearMapAt_symmL hc, e.symmL_apply hy] |
| 143 | have hS (a : E) : |
| 144 | ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ |
| 145 | (T% (fun y ↦ S y a)) e.baseSet := by |
| 146 | apply (contMDiffOn_extend_baseSet (S c a)).congr |
| 147 | intro y hy |
| 148 | exact congrArg (Bundle.TotalSpace.mk y) (hSext a hy).symm |
| 149 | let R (a : Fin 4 → Fin n) : ℝ × M → ℝ := fun p ↦ |
| 150 | (F.connection p.1).riemannEvaluation p.2 (fun j ↦ S p.2 (b (a j))) |
| 151 | have hR (a : Fin 4 → Fin n) : ContinuousOn (R a) W := |
| 152 | (contMDiffOn_flow_riemannEvaluation F e.open_baseSet |
| 153 | (fun j y ↦ S y (b (a j))) (fun j ↦ hS (b (a j)))).continuousOn |
| 154 | let v : (ℝ × M) × (E × E) → Fin 4 → E := |
| 155 | fun p ↦ ![p.2.1, p.2.2, p.2.1, p.2.2] |
| 156 | have hv (j : Fin 4) : Continuous (fun p : (ℝ × M) × (E × E) ↦ v p j) := by |
| 157 | fin_cases j |
| 158 | · exact continuous_fst.comp continuous_snd |
| 159 | · exact continuous_snd.comp continuous_snd |
| 160 | · exact continuous_fst.comp continuous_snd |
| 161 | · exact continuous_snd.comp continuous_snd |
| 162 | have hExpand (p : (ℝ × M) × (E × E)) : |
| 163 | (F.connection p.1.1).riemannEvaluation p.1.2 (fun j ↦ S p.1.2 (v p j)) = |
| 164 | ∑ a : Fin 4 → Fin n, (∏ j, inner ℝ (b (a j)) (v p j)) * R a p.1 := by |
| 165 | obtain ⟨A, hA⟩ := (isSmoothCovariantTensor_riemannEvaluation (F.connection p.1.1)).1 p.1.2 |
| 166 | have hrec (w : E) : (∑ i, inner ℝ (b i) w • S p.1.2 (b i)) = S p.1.2 w := by |
| 167 | calc |
| 168 | _ = S p.1.2 (∑ i, inner ℝ (b i) w • b i) := by simp only [map_sum, map_smul] |
| 169 | _ = S p.1.2 w := congrArg (S p.1.2) (b.sum_repr' w) |
| 170 | rw [hA] |
| 171 | calc |
| 172 | A (fun j ↦ S p.1.2 (v p j)) = |
| 173 | A (fun j ↦ ∑ i, inner ℝ (b i) (v p j) • S p.1.2 (b i)) := by |
| 174 | simp only [hrec] |
| 175 | _ = ∑ a : Fin 4 → Fin n, |
| 176 | A (fun j ↦ inner ℝ (b (a j)) (v p j) • S p.1.2 (b (a j))) := A.map_sum _ |
| 177 | _ = _ := by simp only [A.map_smul_univ, smul_eq_mul, R, hA] |
| 178 | have hRP : ContinuousOn (fun p : (ℝ × M) × (E × E) ↦ |
| 179 | (F.connection p.1.1).curvatureTensor p.1.2 |
| 180 | (S p.1.2 p.2.1) (S p.1.2 p.2.2) (S p.1.2 p.2.1) (S p.1.2 p.2.2)) V := by |
| 181 | have hs : ContinuousOn (fun p : (ℝ × M) × (E × E) ↦ |
| 182 | ∑ a : Fin 4 → Fin n, (∏ j, inner ℝ (b (a j)) (v p j)) * R a p.1) V := by |
| 183 | apply continuousOn_finsetSum |
| 184 | intro a ha |
| 185 | apply ContinuousOn.mul |
| 186 | · apply continuousOn_finsetProd |
| 187 | intro j hj |
| 188 | exact (continuous_const.inner (hv j)).continuousOn |
| 189 | · exact (hR a).comp continuousOn_fst (fun _ hp ↦ hp.1) |
| 190 | apply hs.congr |
| 191 | intro p hp |
| 192 | exact hExpand p |
| 193 | let G : ℝ × M → E →L[ℝ] E →L[ℝ] ℝ := fun p ↦ |
| 194 | ((F.metric p.1).inner p.2).bilinearComp (S p.2) (S p.2) |
| 195 | have hG : ContinuousOn G W := by |
| 196 | apply continuousOn_clm_apply.mpr |
| 197 | intro a |
| 198 | apply continuousOn_clm_apply.mpr |
| 199 | intro d |
| 200 | have hSa : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ |
| 201 | (fun p : ℝ × M ↦ Bundle.TotalSpace.mk' E p.2 (S p.2 a)) W := |
| 202 | (hS a).comp contMDiffOn_snd |
| 203 | (show MapsTo (Prod.snd : ℝ × M → M) W e.baseSet from fun _ hp ↦ hp.2) |
| 204 | have hSd : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ |
| 205 | (fun p : ℝ × M ↦ Bundle.TotalSpace.mk' E p.2 (S p.2 d)) W := |
| 206 | (hS d).comp contMDiffOn_snd |
| 207 | (show MapsTo (Prod.snd : ℝ × M → M) W e.baseSet from fun _ hp ↦ hp.2) |
| 208 | have hg : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 209 | (fun p : ℝ × M ↦ G p a d) W := by |
| 210 | intro p hp |
| 211 | have hm := (F.smooth p ⟨hp.1, mem_univ p.2⟩).mono |
| 212 | (show W ⊆ J ×ˢ univ from fun q hq ↦ ⟨hq.1, mem_univ q.2⟩) |
| 213 | have he : ContMDiffWithinAt (𝓘(ℝ, ℝ).prod (𝓡 n)) ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ |
| 214 | (fun q ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) q.2 |
| 215 | (G q a d)) W p := |
| 216 | hm.clm_bundle_apply₂ (hSa p hp) (hSd p hp) |
| 217 | simp only [Bundle.contMDiffWithinAt_totalSpace] at he |
| 218 | exact he.2 |
| 219 | exact hg.continuousOn |
| 220 | have hGP (a d : (ℝ × M) × (E × E) → E) (ha : Continuous a) (hd : Continuous d) : |
| 221 | ContinuousOn (fun p : (ℝ × M) × (E × E) ↦ G p.1 (a p) (d p)) V := |
| 222 | ((hG.comp continuousOn_fst (fun _ hp ↦ hp.1)).clm_apply ha.continuousOn).clm_apply |
| 223 | hd.continuousOn |
| 224 | have hfst : Continuous (fun p : (ℝ × M) × (E × E) ↦ p.2.1) := |
| 225 | continuous_fst.comp continuous_snd |
| 226 | have hsnd : Continuous (fun p : (ℝ × M) × (E × E) ↦ p.2.2) := |
| 227 | continuous_snd.comp continuous_snd |
| 228 | have hH : ContinuousOn (fun p : (ℝ × M) × (E × E) ↦ |
| 229 | metricGram (F.metric p.1.1) p.1.2 (S p.1.2 p.2.1) (S p.1.2 p.2.2)) V := |
| 230 | ((hGP _ _ hfst hfst).mul (hGP _ _ hsnd hsnd)).sub ((hGP _ _ hfst hsnd).pow 2) |
| 231 | apply hRP.div hH |
| 232 | intro p hp |
| 233 | apply ne_of_gt (metricGram_pos_of_linearIndependent (F.metric p.1.1) p.1.2 |
| 234 | (S p.1.2 p.2.1) (S p.1.2 p.2.2) ?_) |
| 235 | have horth : Orthonormal ℝ (![p.2.1, p.2.2] : Fin 2 → E) := by |
| 236 | constructor |
| 237 | · intro i |
| 238 | fin_cases i |
| 239 | · exact hp.2.1 |
| 240 | · exact hp.2.2.1 |
| 241 | · intro i j hij |
| 242 | fin_cases i <;> fin_cases j |
| 243 | · exact (hij rfl).elim |
| 244 | · exact hp.2.2.2 |
| 245 | · change inner ℝ p.2.2 p.2.1 = 0 |
| 246 | rw [real_inner_comm] |
| 247 | exact hp.2.2.2 |
| 248 | · exact (hij rfl).elim |
| 249 | have hinj : Function.Injective (S p.1.2) := by |
| 250 | intro a d had |
| 251 | have h := congrArg (e.continuousLinearMapAt ℝ p.1.2) had |
| 252 | simpa only [S, e.continuousLinearMapAt_symmL hp.1.2] using h |
| 253 | have hl := horth.linearIndependent.map' (S p.1.2).toLinearMap (LinearMap.ker_eq_bot.mpr hinj) |
| 254 | convert! hl using 1 |
| 255 | funext i |
| 256 | fin_cases i <;> rfl |
| 257 | |
| 258 | end PoincareMT.RicciFlowAnalysis |
| 259 | |
| 260 |