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.Tensor.FixedChartCurvature |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.CoordinateCompatibility |
| 3 | |
| 4 | /-! |
| 5 | # Differential Bianchi for the actual curvature tensor |
| 6 | |
| 7 | Metric compatibility differentiates a curvature section in one fixed |
| 8 | chart. The frozen fourth curvature slot is the vector acted upon. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 15 | open Filter |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | theorem coefficientCurvature_contDiffAt |
| 22 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | (C : E → E →L[ℝ] E →L[ℝ] E) (x : E) (hC : ContDiffAt ℝ ∞ C x) |
| 24 | (u v w : E) : ContDiffAt ℝ ∞ (fun y ↦ coefficientCurvature C y u v w) x := by |
| 25 | have hD := hC.fderiv_right (m := ∞) (by simp) |
| 26 | have hfirst := ((hD.clm_apply (contDiffAt_const (c := u))).clm_apply |
| 27 | (contDiffAt_const (c := v))).clm_apply (contDiffAt_const (c := w)) |
| 28 | have hsecond := ((hD.clm_apply (contDiffAt_const (c := v))).clm_apply |
| 29 | (contDiffAt_const (c := u))).clm_apply (contDiffAt_const (c := w)) |
| 30 | exact ((hfirst.sub hsecond).add ((hC.clm_apply contDiffAt_const).clm_apply |
| 31 | ((hC.clm_apply contDiffAt_const).clm_apply contDiffAt_const))).sub |
| 32 | ((hC.clm_apply contDiffAt_const).clm_apply |
| 33 | ((hC.clm_apply contDiffAt_const).clm_apply contDiffAt_const)) |
| 34 | |
| 35 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 36 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 37 | [IsManifold (𝓡 n) ∞ M] |
| 38 | |
| 39 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 40 | |
| 41 | theorem covariantRiemannDerivative_centeredChart {g : RiemannianMetric n M} |
| 42 | (D : LeviCivitaData g) (p : M) (a u v w z : TangentSpace (𝓡 n) p) : |
| 43 | D.covariantTensorDerivative D.riemannEvaluation p ![a, u, v, w, z] = |
| 44 | mvfderiv (𝓡 n) (fun q ↦ D.curvatureTensor q (chartVectorField p u q) |
| 45 | (chartVectorField p v q) (chartVectorField p w q) (chartVectorField p z q)) p a - |
| 46 | D.curvatureTensor p (D.connection (chartVectorField p u) p a) v w z - |
| 47 | D.curvatureTensor p u (D.connection (chartVectorField p v) p a) w z - |
| 48 | D.curvatureTensor p u v (D.connection (chartVectorField p w) p a) z - |
| 49 | D.curvatureTensor p u v w (D.connection (chartVectorField p z) p a) := by |
| 50 | have h := covariantTensorDerivative_centeredChart D D.riemannEvaluation p a ![u, v, w, z] |
| 51 | simpa [LeviCivitaData.riemannEvaluation, Fin.sum_univ_succ, sub_add_eq_sub_sub] using h |
| 52 | |
| 53 | theorem squareChartCoefficient_contDiffAt {J : Set ℝ} (F : RicciFlow n M J) |
| 54 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 55 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 56 | (y : E) (hy : y ∈ (chartAt E p).target) : |
| 57 | ContDiffAt ℝ ∞ (fun z ↦ coordinateConnectionBilinear (squareChartMetric F T p) (s, z)) y := by |
| 58 | have h := coordinateConnectionBilinear_contDiffOn (squareChartMetric F T p) |
| 59 | (Set.Ioo (-Real.sqrt b) (Real.sqrt b) ×ˢ (chartAt E p).target) |
| 60 | (isOpen_Ioo.prod (chartAt E p).open_target) |
| 61 | (squareChartMetric_smooth F T b hb hwindow p) |
| 62 | (fun z hz a ha ↦ squareChartMetric_pos F T p z hz.2 a ha) |
| 63 | exact (h.contDiffAt ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds |
| 64 | ⟨hs, hy⟩)).comp y (contDiffAt_const.prodMk contDiffAt_id) |
| 65 | |
| 66 | set_option backward.isDefEq.respectTransparency false in |
| 67 | theorem squareChartCurvature_coefficient_at_center {J : Set ℝ} (F : RicciFlow n M J) |
| 68 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 69 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 70 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) (u v w : E) : |
| 71 | ((F.connection (T - s ^ 2)).curvature p u v w : E) = |
| 72 | coefficientCurvature |
| 73 | (fun z ↦ coordinateConnectionBilinear (squareChartMetric F T p) (s, z)) |
| 74 | ((chartAt E p) p) u v w := by |
| 75 | have h := squareChartCurvature_on_target F hM04 T b hb hwindow p s hs |
| 76 | ((chartAt E p) p) ((chartAt E p).map_source (mem_chart_source E p)) u v w |
| 77 | dsimp only at h |
| 78 | rw [(chartAt E p).left_inv (mem_chart_source E p)] at h |
| 79 | simpa only [chartVectorField_self] using h |
| 80 | |
| 81 | set_option maxHeartbeats 1200000 in |
| 82 | -- The frozen tensor corrections and bundle metric instances are expanded together. |
| 83 | set_option backward.isDefEq.respectTransparency false in |
| 84 | theorem squareChartCovariantCurvature_at_center {J : Set ℝ} (F : RicciFlow n M J) |
| 85 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 86 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 87 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) (a u v w z : E) : |
| 88 | let D := F.connection (T - s ^ 2) |
| 89 | let C : E → E →L[ℝ] E →L[ℝ] E := fun y ↦ |
| 90 | coordinateConnectionBilinear (squareChartMetric F T p) (s, y) |
| 91 | D.covariantTensorDerivative D.riemannEvaluation p ![a, u, v, w, z] = |
| 92 | (F.metric (T - s ^ 2)).inner p |
| 93 | (coefficientCurvatureCovariantDerivative («E» := E) C ((chartAt E p) p) a u v z) w := by |
| 94 | dsimp only |
| 95 | let D := F.connection (T - s ^ 2) |
| 96 | let g := F.metric (T - s ^ 2) |
| 97 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 98 | let e := chartAt E p |
| 99 | let y0 := e p |
| 100 | let C : E → E →L[ℝ] E →L[ℝ] E := fun y ↦ |
| 101 | coordinateConnectionBilinear (squareChartMetric F T p) (s, y) |
| 102 | let φ : E → E := fun y ↦ coefficientCurvature C y u v z |
| 103 | let c : M → E := fun q ↦ φ (e q) |
| 104 | let K : (q : M) → TangentSpace (𝓡 n) q := fun q ↦ chartVectorField p (c q) q |
| 105 | have hsrc : p ∈ e.source := mem_chart_source E p |
| 106 | have htar : y0 ∈ e.target := e.map_source hsrc |
| 107 | have hC : ContDiffAt ℝ ∞ C y0 := |
| 108 | squareChartCoefficient_contDiffAt F T b hb hwindow p s hs y0 htar |
| 109 | have hφ : DifferentiableAt ℝ φ y0 := |
| 110 | (coefficientCurvature_contDiffAt C y0 hC u v z).differentiableAt (by simp) |
| 111 | have hc : MDifferentiableAt (𝓡 n) (𝓡 n) c p := hφ.mdifferentiableAt.comp p |
| 112 | ((mdifferentiable_chart (I := 𝓡 n) p).mdifferentiableAt hsrc) |
| 113 | have hK := mdifferentiableAt_chartVectorField_variable p c hc |
| 114 | have hw := ((chartVectorField_smooth p w).contMDiffAt (e.open_source.mem_nhds hsrc)).mdifferentiableAt |
| 115 | (by simp) |
| 116 | have hconn (A B : E) : (D.connection (chartVectorField p B) p A : E) = C y0 A B := |
| 117 | (squareChartConnection_at_center F T b hb hwindow p s hs A B).symm |
| 118 | have hKconn := connection_chartVectorField_variable D p c hc a |
| 119 | dsimp only at hKconn |
| 120 | rw [frozenConnectionEndomorphism_apply, connection_frozenExtend_eq_chartVectorField, |
| 121 | hconn, mvfderiv_vector_centeredChart_of_eventuallyEq p c φ hφ |
| 122 | (Filter.Eventually.of_forall (fun _ ↦ rfl)) a] at hKconn |
| 123 | have hKp : K p = φ y0 := chartVectorField_self p (φ y0) |
| 124 | have hmetric := D.metricCompatible.mvfderiv_inner_eq (FiberBundle.extend E (x := p) a) hK hw |
| 125 | have hmetric' : mvfderiv (𝓡 n) |
| 126 | (fun q ↦ g.inner q (K q) (chartVectorField p w q)) p a = |
| 127 | g.inner p (C y0 a (φ y0) + fderiv ℝ φ y0 a) w + |
| 128 | g.inner p (φ y0) (C y0 a w) := by |
| 129 | simpa only [FiberBundle.extend_apply_self, chartVectorField_self, hKp, hKconn, |
| 130 | hconn, K, c, y0, e] using! hmetric |
| 131 | have heq : (fun q ↦ D.curvatureTensor q (chartVectorField p u q) |
| 132 | (chartVectorField p v q) (chartVectorField p w q) (chartVectorField p z q)) =ᶠ[𝓝 p] |
| 133 | (fun q ↦ g.inner q (K q) (chartVectorField p w q)) := by |
| 134 | filter_upwards [e.open_source.mem_nhds hsrc] with q hq |
| 135 | have hR := squareChartCurvature_on_target F hM04 T b hb hwindow p s hs |
| 136 | (e q) (e.map_source hq) u v z |
| 137 | have hR' : D.curvature q (chartVectorField p u q) (chartVectorField p v q) |
| 138 | (chartVectorField p z q) = K q := by |
| 139 | dsimp only at hR |
| 140 | rw [e.left_inv hq] at hR |
| 141 | exact hR |
| 142 | change g.inner q (D.curvature q (chartVectorField p u q) |
| 143 | (chartVectorField p v q) (chartVectorField p z q)) (chartVectorField p w q) = _ |
| 144 | rw [hR'] |
| 145 | have hmetric'' : mvfderiv (𝓡 n) |
| 146 | (fun q ↦ D.curvatureTensor q (chartVectorField p u q) (chartVectorField p v q) |
| 147 | (chartVectorField p w q) (chartVectorField p z q)) p a = |
| 148 | g.inner p (C y0 a (φ y0) + fderiv ℝ φ y0 a) w + |
| 149 | g.inner p (φ y0) (C y0 a w) := by |
| 150 | rw [mvfderiv, heq.mfderiv_eq] |
| 151 | exact hmetric' |
| 152 | have hR (U V W Z : E) : D.curvatureTensor p U V W Z = |
| 153 | g.inner p (coefficientCurvature C y0 U V Z) W := |
| 154 | congrArg (fun ξ : E ↦ g.inner p ξ W) |
| 155 | (squareChartCurvature_coefficient_at_center F hM04 T b hb hwindow p s hs U V Z) |
| 156 | have h := covariantRiemannDerivative_centeredChart D p a u v w z |
| 157 | rw [hmetric''] at h |
| 158 | simp only [hconn, hR] at h |
| 159 | rw [h] |
| 160 | change _ = g.inner p (coefficientCurvatureCovariantDerivative («E» := E) C y0 a u v z) w |
| 161 | simp only [coefficientCurvatureCovariantDerivative, coefficientCurvatureExteriorDerivative, |
| 162 | map_sub, map_add, sub_apply, add_apply, φ] |
| 163 | let r0 := g.inner p (C y0 a (coefficientCurvature C y0 u v z)) w |
| 164 | let r1 := g.inner p (fderiv ℝ φ y0 a) w |
| 165 | let r2 := g.inner p (coefficientCurvature C y0 u v z) (C y0 a w) |
| 166 | let r3 := g.inner p (coefficientCurvature C y0 (C y0 a u) v z) w |
| 167 | let r4 := g.inner p (coefficientCurvature C y0 u (C y0 a v) z) w |
| 168 | let r5 := g.inner p (coefficientCurvature C y0 u v (C y0 a z)) w |
| 169 | change r0 + r1 + r2 - r3 - r4 - r2 - r5 = r1 + r0 - r5 - r3 - r4 |
| 170 | ring |
| 171 | |
| 172 | set_option maxHeartbeats 800000 in |
| 173 | -- The three paired coordinate identities share the frozen bundle telescope. |
| 174 | set_option backward.isDefEq.respectTransparency false in |
| 175 | theorem squareTime_curvature_second_bianchi {J : Set ℝ} (F : RicciFlow n M J) |
| 176 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 177 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 178 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) (a u v w z : E) : |
| 179 | let D := F.connection (T - s ^ 2) |
| 180 | D.covariantTensorDerivative D.riemannEvaluation p ![a, u, v, w, z] + |
| 181 | D.covariantTensorDerivative D.riemannEvaluation p ![u, v, a, w, z] + |
| 182 | D.covariantTensorDerivative D.riemannEvaluation p ![v, a, u, w, z] = 0 := by |
| 183 | dsimp only |
| 184 | let y0 := (chartAt E p) p |
| 185 | let C : E → E →L[ℝ] E →L[ℝ] E := fun y ↦ |
| 186 | coordinateConnectionBilinear (squareChartMetric F T p) (s, y) |
| 187 | have hy : y0 ∈ (chartAt E p).target := (chartAt E p).map_source (mem_chart_source E p) |
| 188 | have hC := squareChartCoefficient_contDiffAt F T b hb hwindow p s hs y0 hy |
| 189 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, y0) := |
| 190 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 191 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩)).differentiableAt (by simp) |
| 192 | have hsym (U V : E) : C y0 U V = C y0 V U := |
| 193 | coordinateConnection_symm (squareChartMetric F T p) (s, y0) hG |
| 194 | (Filter.Eventually.of_forall (fun q A B ↦ squareChartMetric_symm F T p q A B)) U V |
| 195 | have h := coefficientCurvature_bianchi C y0 hC hsym a u v z |
| 196 | have hp := congrArg (fun ξ : E ↦ (F.metric (T - s ^ 2)).inner p ξ w) h |
| 197 | simp only [map_add, add_apply, map_zero, zero_apply] at hp |
| 198 | rw [squareChartCovariantCurvature_at_center F hM04 T b hb hwindow p s hs, |
| 199 | squareChartCovariantCurvature_at_center F hM04 T b hb hwindow p s hs, |
| 200 | squareChartCovariantCurvature_at_center F hM04 T b hb hwindow p s hs] |
| 201 | exact hp |
| 202 | |
| 203 | end PoincareMT.ReducedLength |