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.FlowRiemannRegularity |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Evolution.Tensor.RicciEvolutionEndpoints |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Evolution.Tensor.RiemannEvolutionInterior |
| 4 | |
| 5 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/RiemannEvolutionEndpoints.lean`, |
| 6 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 7 | `references/ricci-flow/mapher/curvature/`. -/ |
| 8 | |
| 9 | /-! |
| 10 | # Curvature evolution at included times |
| 11 | |
| 12 | The actual first-variation velocity is continuous on the flow interval. |
| 13 | The continuous within derivative then extends the interior evolution identity. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | open Set Topology Filter |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.RicciFlowAnalysis |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {J : Set ℝ} |
| 28 | |
| 29 | set_option maxHeartbeats 800000 in |
| 30 | -- The fixed-fiber evaluation of the spacetime metric needs extra elaboration. |
| 31 | set_option backward.isDefEq.respectTransparency false in |
| 32 | private theorem continuousOn_metric_pairing (F : RicciFlow n M J) |
| 33 | (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 34 | ContinuousOn (fun t ↦ (F.metric t).inner x a b) J := by |
| 35 | let E := EuclideanSpace ℝ (Fin n) |
| 36 | have hslice : ContMDiff 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 37 | (fun t : ℝ ↦ (t, x)) := contMDiff_id.prodMk contMDiff_const |
| 38 | have hfamily := F.smooth.comp hslice.contMDiffOn |
| 39 | (show MapsTo (fun t : ℝ ↦ (t, x)) J (J ×ˢ univ) from |
| 40 | fun _ ht ↦ ⟨ht, mem_univ x⟩) |
| 41 | have hm : ContMDiffOn 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ |
| 42 | (fun t ↦ (F.metric t).inner x a b) J := by |
| 43 | intro t ht |
| 44 | have he : ContMDiffWithinAt 𝓘(ℝ, ℝ) ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ |
| 45 | (fun s ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) |
| 46 | x ((F.metric s).inner x a b)) J t := |
| 47 | (hfamily t ht).clm_bundle_apply₂ |
| 48 | (contMDiffWithinAt_const (c := Bundle.TotalSpace.mk' E x a)) |
| 49 | (contMDiffWithinAt_const (c := Bundle.TotalSpace.mk' E x b)) |
| 50 | simp only [Bundle.contMDiffWithinAt_totalSpace] at he |
| 51 | exact he.2 |
| 52 | exact hm.contDiffOn.continuousOn |
| 53 | |
| 54 | set_option maxHeartbeats 1200000 in |
| 55 | -- The local-field curvature formula and fixed-fiber conversion need extra elaboration. |
| 56 | set_option backward.isDefEq.respectTransparency false in |
| 57 | private theorem continuousOn_curvature_fiber (F : RicciFlow n M J) |
| 58 | (x : M) (u v z : TangentSpace (𝓡 n) x) : |
| 59 | ContinuousOn (fun t ↦ (F.connection t).curvature x u v z) J := by |
| 60 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 61 | ⟨(F.metric 0).toRiemannianMetric⟩ |
| 62 | let E := TangentSpace (𝓡 n) x |
| 63 | let : FiniteDimensional ℝ E := VectorBundle.finiteDimensional ℝ |
| 64 | (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) : M → Type _) x |
| 65 | let : CompleteSpace E := FiniteDimensional.complete ℝ E |
| 66 | let B : ℝ → E →L[ℝ] E →L[ℝ] ℝ := fun t ↦ (F.metric t).inner x |
| 67 | let K : ℝ → E := fun t ↦ (F.connection t).curvature x u v z |
| 68 | let P : ℝ → E →L[ℝ] ℝ := fun t ↦ B t (K t) |
| 69 | have hB : ContinuousOn B J := by |
| 70 | have h := (continuousOn_clm_apply (𝕜 := ℝ) (f := B) (s := J)).mpr (by |
| 71 | intro a |
| 72 | have ha := (continuousOn_clm_apply (𝕜 := ℝ) (f := fun t ↦ B t a) (s := J)).mpr |
| 73 | (fun b ↦ continuousOn_metric_pairing F x a b) |
| 74 | simpa only using! ha) |
| 75 | simpa only using! h |
| 76 | have hP : ContinuousOn P J := by |
| 77 | apply continuousOn_clm_apply.mpr |
| 78 | intro a |
| 79 | exact (contDiffOn_curvatureTensor_timeSlice F x u v a z).continuousOn |
| 80 | let Q := (InnerProductSpace.toDual ℝ E).symm.toContinuousLinearEquiv |
| 81 | let A : ℝ → E →L[ℝ] E := fun t ↦ Q.toContinuousLinearMap.comp (B t) |
| 82 | have hA : ContinuousOn A J := continuousOn_const.clm_comp hB |
| 83 | have hInv (t : ℝ) : (A t).IsInvertible := by |
| 84 | have hz (a : E) (ha : A t a = 0) : a = 0 := by |
| 85 | have hBa : B t a = 0 := Q.injective (by simpa [A] using ha) |
| 86 | have hi : (F.metric t).inner x a a = 0 := by |
| 87 | simpa [B] using congrArg (fun L : E →L[ℝ] ℝ ↦ L a) hBa |
| 88 | by_contra hne |
| 89 | exact (ne_of_gt ((F.metric t).pos x a hne)) hi |
| 90 | have hinj : Function.Injective (A t) := by |
| 91 | intro a b hab |
| 92 | apply sub_eq_zero.mp |
| 93 | apply hz |
| 94 | rw [map_sub, hab, sub_self] |
| 95 | have hsurj : Function.Surjective (A t) := LinearMap.injective_iff_surjective.mp hinj |
| 96 | exact ⟨(LinearEquiv.ofBijective (A t).toLinearMap ⟨hinj, hsurj⟩).toContinuousLinearEquiv, |
| 97 | by ext a; rfl⟩ |
| 98 | have hAi : ContinuousOn (fun t ↦ (A t).inverse) J := by |
| 99 | intro t ht |
| 100 | have hi : ContDiffAt ℝ ∞ ContinuousLinearMap.inverse (A t) := |
| 101 | (hInv t).contDiffAt_map_inverse |
| 102 | exact hi.continuousAt.comp_continuousWithinAt (hA t ht) |
| 103 | have hrec : ContinuousOn (fun t ↦ (A t).inverse (Q (P t))) J := |
| 104 | hAi.clm_apply (Q.continuous.comp_continuousOn hP) |
| 105 | apply hrec.congr |
| 106 | intro t ht |
| 107 | symm |
| 108 | apply (hInv t).inverse_apply_eq.mpr |
| 109 | rfl |
| 110 | |
| 111 | set_option maxHeartbeats 1200000 in |
| 112 | -- The second Ricci derivative and its fixed-fiber conversion need extra elaboration. |
| 113 | set_option backward.isDefEq.respectTransparency false in |
| 114 | private theorem continuousOn_secondRicci_pairing (F : RicciFlow n M J) |
| 115 | (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 116 | ContinuousOn (fun t ↦ (F.connection t).iteratedCovariantTensorDerivative |
| 117 | (F.connection t).ricciEvaluation 2 x ![a, b, c, d]) J := by |
| 118 | let E := EuclideanSpace ℝ (Fin n) |
| 119 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) x |
| 120 | let U := e.baseSet |
| 121 | have hx : x ∈ U := FiberBundle.mem_baseSet_trivializationAt' x |
| 122 | let X : Fin 4 → (y : M) → TangentSpace (𝓡 n) y := |
| 123 | ![FiberBundle.extend E a, FiberBundle.extend E b, |
| 124 | FiberBundle.extend E c, FiberBundle.extend E d] |
| 125 | have hX (i : Fin 4) : ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ (T% (X i)) U := by |
| 126 | fin_cases i |
| 127 | · exact contMDiffOn_extend_baseSet a |
| 128 | · exact contMDiffOn_extend_baseSet b |
| 129 | · exact contMDiffOn_extend_baseSet c |
| 130 | · exact contMDiffOn_extend_baseSet d |
| 131 | have hfamily := contMDiffOn_flow_iteratedCovariantTensorDerivative F |
| 132 | (fun s ↦ isSmoothCovariantTensor_ricciEvaluation (F.connection s)) |
| 133 | (fun V hV Y hY ↦ contMDiffOn_flow_ricciEvaluation F hV hY) 2 e.open_baseSet hX |
| 134 | have hslice : ContMDiff 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 135 | (fun t : ℝ ↦ (t, x)) := contMDiff_id.prodMk contMDiff_const |
| 136 | have hs := hfamily.comp hslice.contMDiffOn |
| 137 | (show MapsTo (fun t : ℝ ↦ (t, x)) J (J ×ˢ U) from fun _ ht ↦ ⟨ht, hx⟩) |
| 138 | have ht : ContMDiffOn 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ |
| 139 | (fun t ↦ (F.connection t).iteratedCovariantTensorDerivative |
| 140 | (F.connection t).ricciEvaluation 2 x ![a, b, c, d]) J := by |
| 141 | apply hs.congr |
| 142 | intro t ht |
| 143 | apply congrArg ((F.connection t).iteratedCovariantTensorDerivative |
| 144 | (F.connection t).ricciEvaluation 2 x) |
| 145 | funext i |
| 146 | fin_cases i <;> simp [X, FiberBundle.extend_apply_self] |
| 147 | exact ht.contDiffOn.continuousOn |
| 148 | |
| 149 | set_option maxHeartbeats 1000000 in |
| 150 | -- The contracted Ricci-curvature expression in fixed fibers needs extra elaboration. |
| 151 | set_option backward.isDefEq.respectTransparency false in |
| 152 | private theorem continuousOn_ricci_curvature_pairing (F : RicciFlow n M J) |
| 153 | (x : M) (u v w z : TangentSpace (𝓡 n) x) : |
| 154 | ContinuousOn (fun t ↦ (F.connection t).ricci x |
| 155 | ((F.connection t).curvature x u v z) w) J := by |
| 156 | classical |
| 157 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 158 | ⟨(F.metric 0).toRiemannianMetric⟩ |
| 159 | let E := TangentSpace (𝓡 n) x |
| 160 | let : FiniteDimensional ℝ E := VectorBundle.finiteDimensional ℝ |
| 161 | (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) : M → Type _) x |
| 162 | choose T hT using fun t : ℝ ↦ (isSmoothCovariantTensor_ricciEvaluation (F.connection t)).1 x |
| 163 | let L : ℝ → E →L[ℝ] ℝ := fun t ↦ ((T t).toLinearMap ![0, w] 0).toContinuousLinearMap |
| 164 | have hLval (t : ℝ) (a : E) : L t a = (F.connection t).ricci x a w := by |
| 165 | have hu : Function.update ![0, w] 0 a = ![a, w] := by |
| 166 | funext i |
| 167 | fin_cases i <;> simp [Function.update] |
| 168 | change T t (Function.update ![0, w] 0 a) = (F.connection t).ricci x a w |
| 169 | rw [hu] |
| 170 | exact (hT t ![a, w]).symm |
| 171 | have hL : ContinuousOn L J := by |
| 172 | apply continuousOn_clm_apply.mpr |
| 173 | intro a |
| 174 | apply (contDiffOn_ricci_timeSlice F x a w).continuousOn.congr |
| 175 | intro t ht |
| 176 | exact hLval t a |
| 177 | apply (hL.clm_apply (continuousOn_curvature_fiber F x u v z)).congr |
| 178 | intro t ht |
| 179 | exact (hLval t _).symm |
| 180 | |
| 181 | set_option maxHeartbeats 800000 in |
| 182 | -- The endpoint-continuity expansion of the tensor evolution terms needs extra elaboration. |
| 183 | set_option backward.isDefEq.respectTransparency false in |
| 184 | theorem continuousOn_curvatureTensor_evolution (F : RicciFlow n M J) |
| 185 | (x : M) (u v w z : TangentSpace (𝓡 n) x) : |
| 186 | ContinuousOn (fun t ↦ |
| 187 | (F.connection t).tensorLaplacian (F.connection t).riemannEvaluation x ![u, v, w, z] + |
| 188 | (F.connection t).curvatureReaction x u v w z) J := by |
| 189 | have hK := continuousOn_ricci_curvature_pairing F x u v w z |
| 190 | have hH := continuousOn_secondRicci_pairing F x |
| 191 | have hs := ((((((continuousOn_const (c := (-2 : ℝ))).mul hK).sub (hH u v z w)).sub |
| 192 | (hH u z v w)).add (hH u w v z)).add (hH v u z w)).add (hH v z u w) |
| 193 | apply (hs.sub (hH v w u z)).congr |
| 194 | intro t ht |
| 195 | exact (curvature_firstVariation_eq_laplacian_add_reaction (F.connection t) x u v w z).symm |
| 196 | |
| 197 | theorem curvatureTensor_timeDerivative_extend (F : RicciFlow n M J) |
| 198 | (x : M) (u v w z : TangentSpace (𝓡 n) x) (q : ℝ → ℝ) |
| 199 | (hq : ContinuousOn q J) |
| 200 | (hi : ∀ t ∈ interior J, |
| 201 | HasDerivAt (fun s ↦ (F.connection s).curvatureTensor x u v w z) (q t) t) : |
| 202 | ∀ t ∈ J, HasDerivWithinAt |
| 203 | (fun s ↦ (F.connection s).curvatureTensor x u v w z) (q t) J t := by |
| 204 | let f := fun t ↦ (F.connection t).curvatureTensor x u v w z |
| 205 | have hf : ContDiffOn ℝ ∞ f J := contDiffOn_curvatureTensor_timeSlice F x u v w z |
| 206 | have hconv : Convex ℝ J := F.interval.convex |
| 207 | have hne : (interior J).Nonempty := hconv.nontrivial_iff_nonempty_interior.mp F.nontrivial |
| 208 | have hJ : UniqueDiffOn ℝ J := uniqueDiffOn_convex hconv hne |
| 209 | have hdense : J ⊆ closure (interior J) := by |
| 210 | rw [hconv.closure_interior_eq_closure_of_nonempty_interior hne] |
| 211 | exact subset_closure |
| 212 | have hinside : EqOn (derivWithin f J) q (interior J) := by |
| 213 | intro t ht |
| 214 | exact (hi t ht).hasDerivWithinAt.derivWithin (hJ t (interior_subset ht)) |
| 215 | have heq : EqOn (derivWithin f J) q J := hinside.of_subset_closure |
| 216 | (hf.continuousOn_derivWithin hJ (by simp)) hq interior_subset hdense |
| 217 | intro t ht |
| 218 | exact ((hf t ht).differentiableWithinAt (by simp)).hasDerivWithinAt.congr_deriv (heq ht) |
| 219 | |
| 220 | end PoincareMT.RicciFlowAnalysis |
| 221 |