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.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Frame.Curvature |
| 3 | import PoincareLib.Geometry.RicciFlow.Frame.Transport |
| 4 | import PoincareLib.Geometry.Riemannian.Connection.MetricDuality |
| 5 | |
| 6 | /-! |
| 7 | # Ricci transport with terminal data on a closed slab |
| 8 | |
| 9 | The fibrewise linear ODE in Cook--Kotschwar, Section 2.1, equation (2.2), |
| 10 | pp. 2--3, has a solution including both endpoints of the time interval. |
| 11 | Metric compatibility makes its solution maps isometries. The preservation |
| 12 | of spatial parallelity in Corollary 4.1, p. 7, is a further geometric step. |
| 13 | |
| 14 | The coefficient construction follows `Frame.RicciTransport`, with within |
| 15 | derivatives on the closed interval and normalization at the terminal time. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set |
| 22 | open scoped Manifold ContDiff Bundle Topology NNReal |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.RicciFlow.Splitting |
| 27 | |
| 28 | private lemma differentiableWithinAt_clm_of_apply |
| 29 | {E G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 30 | [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ E] |
| 31 | {f : ℝ → E →L[ℝ] G} {S : Set ℝ} {t : ℝ} |
| 32 | (hf : ∀ v, DifferentiableWithinAt ℝ (fun s => f s v) S t) : |
| 33 | DifferentiableWithinAt ℝ f S t := by |
| 34 | let d := Module.finrank ℝ E |
| 35 | let e₁ : E ≃L[ℝ] (Fin d → ℝ) := |
| 36 | ContinuousLinearEquiv.ofFinrankEq (Module.finrank_fin_fun ℝ).symm |
| 37 | let e₂ := (e₁.arrowCongr (1 : G ≃L[ℝ] G)).trans |
| 38 | (ContinuousLinearEquiv.piRing (Fin d)) |
| 39 | rw [← Function.id_comp f, ← e₂.symm_comp_self] |
| 40 | exact e₂.symm.differentiableAt.comp_differentiableWithinAt t |
| 41 | (differentiableWithinAt_pi.mpr fun i => hf _) |
| 42 | |
| 43 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 44 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 45 | {a b : ℝ} |
| 46 | |
| 47 | noncomputable def ricciForm (F : RicciFlow n M (Icc a b)) (x : M) (t : ℝ) : |
| 48 | TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x →L[ℝ] ℝ := |
| 49 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 50 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 51 | (-(1 / 2 : ℝ)) • derivWithin (fun s => (F.metric s).inner x) (Icc a b) t |
| 52 | |
| 53 | private theorem metric_hasDerivWithinAt (F : RicciFlow n M (Icc a b)) |
| 54 | (x : M) {t : ℝ} (ht : t ∈ Icc a b) : |
| 55 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 57 | HasDerivWithinAt (fun s => (F.metric s).inner x) |
| 58 | ((-2 : ℝ) • ricciForm F x t) (Icc a b) t := by |
| 59 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 60 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 61 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 62 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 63 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 64 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 65 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 66 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 67 | (TangentSpace (𝓡 n) : M → Type _) x |
| 68 | have hd : DifferentiableWithinAt ℝ (fun s => (F.metric s).inner x) (Icc a b) t := |
| 69 | differentiableWithinAt_clm_of_apply fun v => |
| 70 | differentiableWithinAt_clm_of_apply fun w => (F.equation t ht x v w).differentiableWithinAt |
| 71 | simpa only [ricciForm, smul_smul, show (-2 : ℝ) * -(1 / 2) = 1 by norm_num, |
| 72 | one_smul] using hd.hasDerivWithinAt |
| 73 | |
| 74 | theorem ricciForm_apply (hab : a < b) (F : RicciFlow n M (Icc a b)) |
| 75 | (x : M) {t : ℝ} (ht : t ∈ Icc a b) (v w : TangentSpace (𝓡 n) x) : |
| 76 | ricciForm F x t v w = (F.connection t).ricci x v w := by |
| 77 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 78 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 79 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 80 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 81 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 82 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 83 | have hd := ((metric_hasDerivWithinAt F x ht).clm_apply |
| 84 | (hasDerivWithinAt_const t (Icc a b) v)).clm_apply |
| 85 | (hasDerivWithinAt_const t (Icc a b) w) |
| 86 | have heq := (uniqueDiffOn_Icc hab t ht).eq_deriv (Icc a b) hd (F.equation t ht x v w) |
| 87 | simp only [smul_apply, map_zero, smul_eq_mul, add_zero] at heq |
| 88 | linarith |
| 89 | |
| 90 | noncomputable def ricciEndomorphism |
| 91 | (F : RicciFlow n M (Icc a b)) (x : M) (t : ℝ) : |
| 92 | TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x := |
| 93 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 94 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 95 | ((F.metric t).inner x).inverse.comp (ricciForm F x t) |
| 96 | |
| 97 | theorem inner_ricciEndomorphism (hab : a < b) |
| 98 | (F : RicciFlow n M (Icc a b)) (x : M) {t : ℝ} (ht : t ∈ Icc a b) |
| 99 | (v w : TangentSpace (𝓡 n) x) : |
| 100 | (F.metric t).inner x (ricciEndomorphism F x t v) w = |
| 101 | (F.connection t).ricci x v w := by |
| 102 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 103 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 104 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 105 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 106 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 107 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 108 | change (F.metric t).inner x (((F.metric t).inner x).inverse (ricciForm F x t v)) w = _ |
| 109 | rw [((F.metric t).inner_isInvertible x).self_apply_inverse] |
| 110 | exact ricciForm_apply hab F x ht v w |
| 111 | |
| 112 | theorem ricciEndomorphism_eq_ricciSharp (hab : a < b) |
| 113 | (F : RicciFlow n M (Icc a b)) (x : M) {t : ℝ} (ht : t ∈ Icc a b) |
| 114 | (v : TangentSpace (𝓡 n) x) : |
| 115 | ricciEndomorphism F x t v = ricciSharp (F.connection t) x v := by |
| 116 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 117 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 118 | let e := (F.metric t).orthonormalBasis x |
| 119 | change ricciEndomorphism F x t v = ∑ i, (F.connection t).ricci x v (e i) • e i |
| 120 | conv_lhs => rw [← e.sum_repr (ricciEndomorphism F x t v)] |
| 121 | apply Finset.sum_congr rfl |
| 122 | intro i _ |
| 123 | congr 1 |
| 124 | rw [OrthonormalBasis.repr_apply_apply, real_inner_comm] |
| 125 | exact inner_ricciEndomorphism hab F x ht v (e i) |
| 126 | |
| 127 | private theorem continuousOn_ricciEndomorphism (hC : RicciFlowCurvatureCalculus.{u}) |
| 128 | (hab : a < b) (F : RicciFlow n M (Icc a b)) (x : M) : |
| 129 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 130 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 131 | ContinuousOn (ricciEndomorphism F x) (Icc a b) := by |
| 132 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 133 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 134 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 135 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 136 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 137 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 138 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 139 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 140 | (TangentSpace (𝓡 n) : M → Type _) x |
| 141 | have hg : ContinuousOn (fun s => (F.metric s).inner x) (Icc a b) := by |
| 142 | apply continuousOn_clm_apply.mpr |
| 143 | intro v |
| 144 | apply continuousOn_clm_apply.mpr |
| 145 | exact fun w t ht => (F.equation t ht x v w).continuousWithinAt |
| 146 | have hr : ContinuousOn (ricciForm F x) (Icc a b) := by |
| 147 | apply continuousOn_clm_apply.mpr |
| 148 | intro v |
| 149 | apply continuousOn_clm_apply.mpr |
| 150 | intro w |
| 151 | apply ContinuousOn.congr (fun t ht => |
| 152 | (hC.ricci_evolution n M (Icc a b) F t ht x v w).continuousWithinAt) |
| 153 | exact fun t ht => ricciForm_apply hab F x ht v w |
| 154 | intro t ht |
| 155 | exact ((((F.metric t).inner_isInvertible x).contDiffAt_map_inverse |
| 156 | (n := ∞)).continuousAt.comp_continuousWithinAt |
| 157 | (f := fun s => (F.metric s).inner x) (hg t ht)).clm_comp (hr t ht) |
| 158 | |
| 159 | /-- Terminal-normalized Ricci transport, including both endpoint derivatives. |
| 160 | The coefficient and its continuity are derived from M04 and the flow equation. -/ |
| 161 | theorem exists_terminal_ricci_transport |
| 162 | (hC : RicciFlowCurvatureCalculus.{u}) (hab : a < b) |
| 163 | (F : RicciFlow n M (Icc a b)) (x : M) : |
| 164 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 165 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 166 | ∃ U : ℝ → TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x, |
| 167 | U b = ContinuousLinearMap.id ℝ _ ∧ |
| 168 | (∀ t ∈ Icc a b, ∀ v, |
| 169 | HasDerivWithinAt (fun s => U s v) |
| 170 | (ricciSharp (F.connection t) x (U t v)) (Icc a b) t) ∧ |
| 171 | (∀ t ∈ Icc a b, ∀ v w, |
| 172 | (F.metric t).inner x (U t v) (U t w) = (F.metric b).inner x v w) ∧ |
| 173 | (∀ t ∈ Icc a b, (U t).IsInvertible) := by |
| 174 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 175 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 176 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 177 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 178 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 179 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 180 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 181 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 182 | (TangentSpace (𝓡 n) : M → Type _) x |
| 183 | let A := ricciEndomorphism F x |
| 184 | have hAc : ContinuousOn A (Icc a b) := continuousOn_ricciEndomorphism hC hab F x |
| 185 | obtain ⟨K, hK⟩ := isCompact_Icc.exists_bound_of_continuousOn hAc |
| 186 | let K' : ℝ≥0 := ⟨max K 0, le_max_right _ _⟩ |
| 187 | have hK' : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K' := by |
| 188 | intro t ht |
| 189 | exact_mod_cast (hK t ht).trans (le_max_left K 0) |
| 190 | let V := Frame.transportCurveOn A hab.le hAc hK' |
| 191 | have hVa : V a = ContinuousLinearMap.id ℝ _ := Frame.transportCurveOn_left A _ _ _ |
| 192 | have hVd : ∀ t ∈ Icc a b, |
| 193 | HasDerivWithinAt V ((A t).comp (V t)) (Icc a b) t := |
| 194 | fun t ht => Frame.transportCurveOn_hasDerivWithinAt A hab.le hAc hK' ht |
| 195 | have hpair : ∀ t ∈ Icc a b, ∀ v w, |
| 196 | (F.metric t).inner x (V t v) (V t w) = (F.metric a).inner x v w := by |
| 197 | intro t ht v w |
| 198 | let q : ℝ → ℝ := fun s => (F.metric s).inner x (V s v) (V s w) |
| 199 | have hd : ∀ s ∈ Icc a b, HasDerivWithinAt q 0 (Icc a b) s := by |
| 200 | intro s hs |
| 201 | have hv := (hVd s hs).clm_apply (hasDerivWithinAt_const s (Icc a b) v) |
| 202 | have hw := (hVd s hs).clm_apply (hasDerivWithinAt_const s (Icc a b) w) |
| 203 | have hh := ((metric_hasDerivWithinAt F x hs).clm_apply hv).clm_apply hw |
| 204 | apply hh.congr_deriv |
| 205 | simp only [smul_apply, add_apply, map_zero, add_zero, ContinuousLinearMap.comp_apply, |
| 206 | smul_eq_mul] |
| 207 | rw [ricciForm_apply hab F x hs, inner_ricciEndomorphism hab F x hs] |
| 208 | rw [(F.metric s).symm x (V s v) (A s (V s w)), |
| 209 | inner_ricciEndomorphism hab F x hs] |
| 210 | have hsymm := ((hC.tensor_calculus n M (F.metric s) (F.connection s)).2.2.2.1 |
| 211 | x (V s v) (V s w) (V s v) (V s w)).2.2.2 |
| 212 | linarith |
| 213 | have hc := constant_of_derivWithin_zero |
| 214 | (fun s hs => (hd s hs).differentiableWithinAt) |
| 215 | (fun s hs => (hd s ⟨hs.1, hs.2.le⟩).derivWithin |
| 216 | (uniqueDiffOn_Icc hab s ⟨hs.1, hs.2.le⟩)) t ht |
| 217 | simpa only [q, hVa, ContinuousLinearMap.id_apply] using hc |
| 218 | have hinv : ∀ t ∈ Icc a b, (V t).IsInvertible := by |
| 219 | intro t ht |
| 220 | let e := (LinearEquiv.ofBijective (V t).toLinearMap |
| 221 | (Frame.transportCurveOn_bijective A hab.le hAc hK' ht)).toContinuousLinearEquiv |
| 222 | exact ContinuousLinearMap.isInvertible_equiv (f := e) |
| 223 | have hb : b ∈ Icc a b := ⟨hab.le, le_rfl⟩ |
| 224 | let U := fun t => (V t).comp (V b).inverse |
| 225 | have hUb : U b = ContinuousLinearMap.id ℝ _ := by |
| 226 | ext v |
| 227 | exact (hinv b hb).self_apply_inverse v |
| 228 | refine ⟨U, hUb, ?_, ?_, ?_⟩ |
| 229 | · intro t ht v |
| 230 | have hd := (hVd t ht).clm_apply |
| 231 | (hasDerivWithinAt_const t (Icc a b) ((V b).inverse v)) |
| 232 | simpa only [U, A, ContinuousLinearMap.comp_apply, map_zero, add_zero, |
| 233 | ricciEndomorphism_eq_ricciSharp hab F x ht] using hd |
| 234 | · intro t ht v w |
| 235 | have ht' := hpair t ht ((V b).inverse v) ((V b).inverse w) |
| 236 | have hb' := hpair b hb ((V b).inverse v) ((V b).inverse w) |
| 237 | rw [(hinv b hb).self_apply_inverse, (hinv b hb).self_apply_inverse] at hb' |
| 238 | exact ht'.trans hb'.symm |
| 239 | · intro t ht |
| 240 | exact (hinv t ht).comp (hinv b hb).inverse |
| 241 | |
| 242 | end PoincareMT.RicciFlow.Splitting |