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.Frame.Transport |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Theory |
| 3 | import PoincareLib.Geometry.Riemannian.Connection.MetricDuality |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 5 | |
| 6 | /-! |
| 7 | # Transport for the retained Ricci flow |
| 8 | |
| 9 | Construct the Ricci endomorphism from the metric derivative and prove its |
| 10 | duality with the actual Ricci tensor, including the initial endpoint. |
| 11 | |
| 12 | Reference: Morgan--Tian, Claim 3.16, p. 42, and Corollary 3.17, p. 43. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Bundle Topology NNReal BigOperators |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.RicciFlow.Frame |
| 24 | |
| 25 | private lemma differentiableWithinAt_clm_of_apply |
| 26 | {E G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 27 | [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ E] |
| 28 | {f : ℝ → E →L[ℝ] G} {S : Set ℝ} {t : ℝ} |
| 29 | (hf : ∀ v, DifferentiableWithinAt ℝ (fun s => f s v) S t) : |
| 30 | DifferentiableWithinAt ℝ f S t := by |
| 31 | let d := Module.finrank ℝ E |
| 32 | let e₁ : E ≃L[ℝ] (Fin d → ℝ) := |
| 33 | ContinuousLinearEquiv.ofFinrankEq (Module.finrank_fin_fun ℝ).symm |
| 34 | let e₂ := (e₁.arrowCongr (1 : G ≃L[ℝ] G)).trans |
| 35 | (ContinuousLinearEquiv.piRing (Fin d)) |
| 36 | rw [← Function.id_comp f, ← e₂.symm_comp_self] |
| 37 | exact e₂.symm.differentiableAt.comp_differentiableWithinAt t |
| 38 | (differentiableWithinAt_pi.mpr fun i => hf _) |
| 39 | |
| 40 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 41 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 42 | {a b : ℝ} |
| 43 | |
| 44 | /-- The Ricci tensor bundled using the unique within derivative of the metric. -/ |
| 45 | noncomputable def ricciForm (F : RicciFlow n M (Ico a b)) (x : M) (t : ℝ) : |
| 46 | TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x →L[ℝ] ℝ := |
| 47 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 48 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 49 | (- (1 / 2 : ℝ)) • derivWithin (fun s => (F.metric s).inner x) (Ico a b) t |
| 50 | |
| 51 | theorem ricciForm_apply (F : RicciFlow n M (Ico a b)) |
| 52 | (x : M) {t : ℝ} (ht : t ∈ Ico a b) (v w : TangentSpace (𝓡 n) x) : |
| 53 | ricciForm F x t v w = (F.connection t).ricci x v w := by |
| 54 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 55 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 56 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 57 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 58 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 59 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 60 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 61 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 62 | (TangentSpace (𝓡 n) : M → Type _) x |
| 63 | have hd : DifferentiableWithinAt ℝ (fun s => (F.metric s).inner x) (Ico a b) t := |
| 64 | differentiableWithinAt_clm_of_apply fun u => |
| 65 | differentiableWithinAt_clm_of_apply fun z => (F.equation t ht x u z).differentiableWithinAt |
| 66 | have he := ((hd.hasDerivWithinAt.clm_apply (hasDerivWithinAt_const t (Ico a b) v)).clm_apply |
| 67 | (hasDerivWithinAt_const t (Ico a b) w)).derivWithin (uniqueDiffOn_Ico a b t ht) |
| 68 | rw [(F.equation t ht x v w).derivWithin (uniqueDiffOn_Ico a b t ht)] at he |
| 69 | simp only [map_zero, add_zero] at he |
| 70 | simp only [ricciForm, smul_apply, smul_eq_mul] |
| 71 | rw [← he] |
| 72 | ring |
| 73 | |
| 74 | /-- Raising an index with the actual time-dependent metric. -/ |
| 75 | noncomputable def ricciEndomorphism (F : RicciFlow n M (Ico a b)) (x : M) (t : ℝ) : |
| 76 | TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x := |
| 77 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 78 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 79 | ((F.metric t).inner x).inverse.comp (ricciForm F x t) |
| 80 | |
| 81 | theorem inner_ricciEndomorphism (F : RicciFlow n M (Ico a b)) |
| 82 | (x : M) {t : ℝ} (ht : t ∈ Ico a b) (v w : TangentSpace (𝓡 n) x) : |
| 83 | (F.metric t).inner x (ricciEndomorphism F x t v) w = |
| 84 | (F.connection t).ricci x v w := by |
| 85 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 86 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 87 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 88 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 89 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 90 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 91 | change (F.metric t).inner x (((F.metric t).inner x).inverse (ricciForm F x t v)) w = _ |
| 92 | rw [((F.metric t).inner_isInvertible x).self_apply_inverse] |
| 93 | exact ricciForm_apply F x ht v w |
| 94 | |
| 95 | /-- Agreement with the orthonormal-basis expression used in curvature evolution. -/ |
| 96 | theorem ricciEndomorphism_eq_sum (F : RicciFlow n M (Ico a b)) (x : M) |
| 97 | {t : ℝ} (ht : t ∈ Ico a b) (v : TangentSpace (𝓡 n) x) : |
| 98 | ricciEndomorphism F x t v = |
| 99 | ∑ i, (F.connection t).ricci x v ((F.metric t).orthonormalBasis x i) • |
| 100 | (F.metric t).orthonormalBasis x i := by |
| 101 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 102 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 103 | let e := (F.metric t).orthonormalBasis x |
| 104 | have h := e.sum_repr (ricciEndomorphism F x t v) |
| 105 | rw [← h] |
| 106 | apply Finset.sum_congr rfl |
| 107 | intro i _ |
| 108 | congr 1 |
| 109 | rw [OrthonormalBasis.repr_apply_apply, real_inner_comm] |
| 110 | exact inner_ricciEndomorphism F x ht v (e i) |
| 111 | |
| 112 | /-- The coefficient of the transport equation is continuous up to the initial time. -/ |
| 113 | theorem continuousOn_ricciEndomorphism (hC : RicciFlowCurvatureTheory.{u}) |
| 114 | (F : RicciFlow n M (Ico a b)) (x : M) : |
| 115 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 116 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 117 | ContinuousOn (ricciEndomorphism F x) (Ico a b) := by |
| 118 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 119 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 120 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 121 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 122 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 123 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 124 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 125 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 126 | (TangentSpace (𝓡 n) : M → Type _) x |
| 127 | have hg : ContinuousOn (fun s => (F.metric s).inner x) (Ico a b) := by |
| 128 | apply continuousOn_clm_apply.mpr |
| 129 | intro v |
| 130 | apply continuousOn_clm_apply.mpr |
| 131 | exact fun w t ht => (F.equation t ht x v w).continuousWithinAt |
| 132 | have hr : ContinuousOn (ricciForm F x) (Ico a b) := by |
| 133 | apply continuousOn_clm_apply.mpr |
| 134 | intro v |
| 135 | apply continuousOn_clm_apply.mpr |
| 136 | intro w |
| 137 | apply ContinuousOn.congr (fun t ht => |
| 138 | (hC.ricci_evolution n M (Ico a b) F t ht x v w).continuousWithinAt) |
| 139 | exact fun t ht => ricciForm_apply F x ht v w |
| 140 | intro t ht |
| 141 | exact ((((F.metric t).inner_isInvertible x).contDiffAt_map_inverse (n := ∞)).continuousAt.comp_continuousWithinAt |
| 142 | (f := fun s => (F.metric s).inner x) (hg t ht)).clm_comp (hr t ht) |
| 143 | |
| 144 | /-- Compact-time transport for the actual Ricci tensor, with metric preservation. |
| 145 | No regularity or metric-duality hypotheses are imposed on an auxiliary coefficient. -/ |
| 146 | private theorem exists_ricciTransport_map (hC : RicciFlowCurvatureTheory.{u}) |
| 147 | (F : RicciFlow n M (Ico a b)) {T : ℝ} (haT : a < T) (hTb : T < b) (x : M) : |
| 148 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 149 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 150 | ∃ U : ℝ → TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x, |
| 151 | U a = ContinuousLinearMap.id ℝ _ ∧ |
| 152 | (∀ t ∈ Icc a T, HasDerivWithinAt U |
| 153 | ((ricciEndomorphism F x t).comp (U t)) (Icc a T) t) ∧ |
| 154 | (∀ t ∈ Icc a T, ∀ v w, |
| 155 | (F.metric t).inner x (U t v) (U t w) = (F.metric a).inner x v w) := by |
| 156 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 157 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 158 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 159 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 160 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 161 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 162 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 163 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 164 | (TangentSpace (𝓡 n) : M → Type _) x |
| 165 | let A := ricciEndomorphism F x |
| 166 | have hsub : Icc a T ⊆ Ico a b := fun t ht => ⟨ht.1, ht.2.trans_lt hTb⟩ |
| 167 | have hAc : ContinuousOn A (Icc a T) := |
| 168 | (continuousOn_ricciEndomorphism hC F x).mono hsub |
| 169 | obtain ⟨K, hK⟩ := isCompact_Icc.exists_bound_of_continuousOn hAc |
| 170 | let K' : ℝ≥0 := ⟨max K 0, le_max_right _ _⟩ |
| 171 | have hK' : ∀ t ∈ Icc a T, ‖A t‖₊ ≤ K' := by |
| 172 | intro t ht |
| 173 | exact_mod_cast (hK t ht).trans (le_max_left K 0) |
| 174 | let U := transportCurveOn A haT.le hAc hK' |
| 175 | have hUa : U a = ContinuousLinearMap.id ℝ _ := by |
| 176 | ext v |
| 177 | rw [transportCurveOn_apply_of_mem A haT.le hAc hK' ⟨le_rfl, haT.le⟩] |
| 178 | exact Poincare.ODE.Linear.solOf_left haT.le hAc hK' v |
| 179 | have hUd : ∀ t ∈ Icc a T, |
| 180 | HasDerivWithinAt U ((A t).comp (U t)) (Icc a T) t := |
| 181 | fun t ht => transportCurveOn_hasDerivWithinAt A haT.le hAc hK' ht |
| 182 | refine ⟨U, hUa, hUd, ?_⟩ |
| 183 | intro t ht v w |
| 184 | let f : ℝ → ℝ := fun s => (F.metric s).inner x (U s v) (U s w) |
| 185 | have hd : ∀ s ∈ Icc a T, HasDerivWithinAt f 0 (Icc a T) s := by |
| 186 | intro s hs |
| 187 | have hmetric : DifferentiableWithinAt ℝ (fun r => (F.metric r).inner x) |
| 188 | (Ico a b) s := differentiableWithinAt_clm_of_apply fun u => |
| 189 | differentiableWithinAt_clm_of_apply fun z => |
| 190 | (F.equation s (hsub hs) x u z).differentiableWithinAt |
| 191 | have hg : HasDerivWithinAt (fun r => (F.metric r).inner x) |
| 192 | ((-2 : ℝ) • ricciForm F x s) (Icc a T) s := by |
| 193 | apply (hmetric.hasDerivWithinAt.mono hsub).congr_deriv |
| 194 | norm_num [ricciForm, smul_smul] |
| 195 | have hv := (hUd s hs).clm_apply (hasDerivWithinAt_const s (Icc a T) v) |
| 196 | have hw := (hUd s hs).clm_apply (hasDerivWithinAt_const s (Icc a T) w) |
| 197 | have hh := (hg.clm_apply hv).clm_apply hw |
| 198 | apply hh.congr_deriv |
| 199 | simp only [smul_apply, add_apply, map_zero, add_zero, ContinuousLinearMap.comp_apply, |
| 200 | smul_eq_mul] |
| 201 | rw [ricciForm_apply F x (hsub hs), inner_ricciEndomorphism F x (hsub hs)] |
| 202 | rw [(F.metric s).symm x (U s v) (A s (U s w)), |
| 203 | inner_ricciEndomorphism F x (hsub hs)] |
| 204 | have hsymm := ((hC.tensor_calculus n M (F.metric s) (F.connection s)).2.2.2.1 |
| 205 | x (U s v) (U s w) (U s v) (U s w)).2.2.2 |
| 206 | linarith |
| 207 | have hc := constant_of_derivWithin_zero |
| 208 | (fun s hs => (hd s hs).differentiableWithinAt) |
| 209 | (fun s hs => (hd s ⟨hs.1, hs.2.le⟩).derivWithin |
| 210 | (uniqueDiffOn_Icc haT s ⟨hs.1, hs.2.le⟩)) t ht |
| 211 | simpa only [f, hUa, ContinuousLinearMap.id_apply] using hc |
| 212 | |
| 213 | /-- The Ricci flow has metric-preserving linear automorphisms on every compact |
| 214 | time interval, constructed from its retained Ricci tensor. -/ |
| 215 | theorem exists_ricciTransport (hC : RicciFlowCurvatureTheory.{u}) |
| 216 | (F : RicciFlow n M (Ico a b)) {T : ℝ} (haT : a < T) (hTb : T < b) (x : M) : |
| 217 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 218 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 219 | ∃ U : ℝ → TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x, |
| 220 | U a = ContinuousLinearMap.id ℝ _ ∧ |
| 221 | (∀ t ∈ Icc a T, HasDerivWithinAt U |
| 222 | ((ricciEndomorphism F x t).comp (U t)) (Icc a T) t) ∧ |
| 223 | (∀ t ∈ Icc a T, ∀ v w, |
| 224 | (F.metric t).inner x (U t v) (U t w) = (F.metric a).inner x v w) ∧ |
| 225 | (∀ t ∈ Icc a T, (U t).IsInvertible) := by |
| 226 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 227 | ⟨(F.metric a).toRiemannianMetric⟩ |
| 228 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 229 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 230 | (TangentSpace (𝓡 n) : M → Type _) x |
| 231 | obtain ⟨U, hUa, hUd, hpair⟩ := exists_ricciTransport_map hC F haT hTb x |
| 232 | refine ⟨U, hUa, hUd, hpair, ?_⟩ |
| 233 | intro t ht |
| 234 | have hi : Function.Injective (U t) := by |
| 235 | apply (U t).toLinearMap.ker_eq_bot.mp |
| 236 | rw [LinearMap.ker_eq_bot'] |
| 237 | intro v hv |
| 238 | change U t v = 0 at hv |
| 239 | have hh := hpair t ht v v |
| 240 | rw [hv] at hh |
| 241 | by_contra hn |
| 242 | have hp := (F.metric a).pos x v hn |
| 243 | simp only [map_zero] at hh |
| 244 | linarith |
| 245 | let e := (LinearEquiv.ofBijective (U t).toLinearMap |
| 246 | ⟨hi, LinearMap.injective_iff_surjective.mp hi⟩).toContinuousLinearEquiv |
| 247 | exact ContinuousLinearMap.isInvertible_equiv (f := e) |
| 248 | |
| 249 | end PoincareMT.RicciFlow.Frame |