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.Surgery.StandardCap.Persistence.Scalar.Calculus.ConnectionBounds |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Scalar.Calculus.LoweredConnectionDerivative |
| 3 | import PoincareLib.Geometry.Riemannian.Curvature.Bounds.Operator |
| 4 | |
| 5 | /-! |
| 6 | # Quantitative curvature control from the actual metric error |
| 7 | |
| 8 | The lowered connection identity bounds its covariant derivative by |
| 9 | the first two intrinsic errors. The actual curvature identity then |
| 10 | gives the full four-tensor defect in the background norm. |
| 11 | Morgan--Tian, pp. 3-7, Definition 9.76 and Lemma 11.2; |
| 12 | see M44 derivation 31. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open scoped Manifold ContDiff BigOperators |
| 19 | |
| 20 | namespace PoincareMT.M44 |
| 21 | |
| 22 | local notation "E" => EuclideanSpace ℝ (Fin 3) |
| 23 | |
| 24 | set_option maxHeartbeats 800000 in |
| 25 | -- Four-slot contractions normalize products of the background tangent norms. |
| 26 | /-- The lowered covariant derivative of the actual connection |
| 27 | correction is bounded by the first two error jets. Source: |
| 28 | the differentiated Koszul identity in M44 derivation 31. -/ |
| 29 | theorem abs_inner_covariantConnectionDifference_le {g h : RiemannianMetric 3 E} |
| 30 | (D : LeviCivitaData g) (D' : LeviCivitaData h) (x : E) {epsilon : ℝ} |
| 31 | (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) |
| 32 | (herror : ∀ j ≤ 2, |
| 33 | g.tensorNorm (D.iteratedCovariantTensorDerivative (metricError g h) j) x ≤ epsilon) |
| 34 | (d u v w : E) : |
| 35 | |h.inner x (covariantConnectionDifference g h x d u v) w| ≤ |
| 36 | ((3 / 2 : ℝ) * epsilon + 2 * epsilon ^ 2) * |
| 37 | (g.tangentNorm x d * g.tangentNorm x u * g.tangentNorm x v * g.tangentNorm x w) := by |
| 38 | let P := g.tangentNorm x d * g.tangentNorm x u * g.tangentNorm x v * g.tangentNorm x w |
| 39 | have hsecond (a b c e : E) : |
| 40 | |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![a, b, c, e]| ≤ |
| 41 | epsilon * (g.tangentNorm x a * g.tangentNorm x b * |
| 42 | g.tangentNorm x c * g.tangentNorm x e) := by |
| 43 | simpa only [Fin.prod_univ_succ, Matrix.cons_val_zero, Matrix.cons_val_succ, |
| 44 | Fin.prod_univ_zero, mul_one, mul_assoc] using |
| 45 | metricError_jet_evaluation_le D 2 x (herror 2 le_rfl) ![a, b, c, e] |
| 46 | have hfirst := metricError_jet_evaluation_le D 1 x (herror 1 (by omega)) |
| 47 | ![d, connectionDifference g h x u v, w] |
| 48 | simp only [LeviCivitaData.iteratedCovariantTensorDerivative, Fin.prod_univ_succ, |
| 49 | Matrix.cons_val_zero, Matrix.cons_val_succ, Fin.prod_univ_zero, mul_one] at hfirst |
| 50 | have hc := tangentNorm_connectionDifference_le D D' x hepsilon hsmall |
| 51 | (herror 0 (by omega)) (herror 1 (by omega)) u v |
| 52 | have hfirst' : |D.covariantTensorDerivative (metricError g h) x |
| 53 | ![d, connectionDifference g h x u v, w]| ≤ 2 * epsilon ^ 2 * P := by |
| 54 | calc |
| 55 | _ ≤ epsilon * (g.tangentNorm x d * |
| 56 | (g.tangentNorm x (connectionDifference g h x u v) * g.tangentNorm x w)) := hfirst |
| 57 | _ = (epsilon * g.tangentNorm x d * g.tangentNorm x w) * |
| 58 | g.tangentNorm x (connectionDifference g h x u v) := by ring |
| 59 | _ ≤ (epsilon * g.tangentNorm x d * g.tangentNorm x w) * |
| 60 | (2 * epsilon * (g.tangentNorm x u * g.tangentNorm x v)) := |
| 61 | mul_le_mul_of_nonneg_left hc |
| 62 | (mul_nonneg (mul_nonneg hepsilon (Real.sqrt_nonneg _)) (Real.sqrt_nonneg _)) |
| 63 | _ = 2 * epsilon ^ 2 * P := by dsimp [P]; ring |
| 64 | have heq := inner_covariantConnectionDifference D D' x d u v w |
| 65 | have habs : |2 * h.inner x (covariantConnectionDifference g h x d u v) w| ≤ |
| 66 | |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, u, v, w]| + |
| 67 | |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, v, w, u]| + |
| 68 | |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, w, u, v]| + |
| 69 | 2 * |D.covariantTensorDerivative (metricError g h) x |
| 70 | ![d, connectionDifference g h x u v, w]| := by |
| 71 | rw [heq] |
| 72 | calc |
| 73 | _ ≤ |_ - _| + |2 * D.covariantTensorDerivative (metricError g h) x |
| 74 | ![d, connectionDifference g h x u v, w]| := abs_sub _ _ |
| 75 | _ ≤ (|_| + |_| + |_|) + |2 * D.covariantTensorDerivative (metricError g h) x |
| 76 | ![d, connectionDifference g h x u v, w]| := |
| 77 | add_le_add ((abs_sub _ _).trans (add_le_add (abs_add_le _ _) le_rfl)) le_rfl |
| 78 | _ = _ := by rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 79 | rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] at habs |
| 80 | have h1 : |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, u, v, w]| ≤ |
| 81 | epsilon * P := hsecond d u v w |
| 82 | have h2 : |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, v, w, u]| ≤ |
| 83 | epsilon * P := (hsecond d v w u).trans_eq (by dsimp [P]; ring) |
| 84 | have h3 : |D.iteratedCovariantTensorDerivative (metricError g h) 2 x ![d, w, u, v]| ≤ |
| 85 | epsilon * P := (hsecond d w u v).trans_eq (by dsimp [P]; ring) |
| 86 | have hsum := habs.trans (add_le_add |
| 87 | (add_le_add (add_le_add h1 h2) h3) |
| 88 | (mul_le_mul_of_nonneg_left hfirst' (by norm_num : (0 : ℝ) ≤ 2))) |
| 89 | change |h.inner x (covariantConnectionDifference g h x d u v) w| ≤ |
| 90 | ((3 / 2 : ℝ) * epsilon + 2 * epsilon ^ 2) * P |
| 91 | linarith only [hsum] |
| 92 | |
| 93 | set_option maxHeartbeats 800000 in |
| 94 | -- The finite curvature expansion identifies native and tangent-space vector sums. |
| 95 | /-- The actual four-covariant curvature error is uniformly controlled |
| 96 | by the first two intrinsic metric errors and the background curvature |
| 97 | norm. Source: pp. 5-7 in M44 derivation 31. -/ |
| 98 | theorem abs_curvatureTensor_difference_le {g h : RiemannianMetric 3 E} |
| 99 | (D : LeviCivitaData g) (D' : LeviCivitaData h) (x : E) {epsilon K : ℝ} |
| 100 | (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) |
| 101 | (hcurv : D.curvatureTensorNorm x ≤ K) |
| 102 | (herror : ∀ j ≤ 2, |
| 103 | g.tensorNorm (D.iteratedCovariantTensorDerivative (metricError g h) j) x ≤ epsilon) |
| 104 | (u v w z : E) : |
| 105 | |D'.curvatureTensor x u v w z - D.curvatureTensor x u v w z| ≤ |
| 106 | ((K + 3) * epsilon + 10 * epsilon ^ 2) * |
| 107 | (g.tangentNorm x u * g.tangentNorm x v * g.tangentNorm x w * g.tangentNorm x z) := by |
| 108 | let P := g.tangentNorm x u * g.tangentNorm x v * g.tangentNorm x w * g.tangentNorm x z |
| 109 | have hp (a : E) : 0 ≤ g.tangentNorm x a := Real.sqrt_nonneg _ |
| 110 | have hquad (a b c d : E) : |
| 111 | |h.inner x (connectionDifference g h x a (connectionDifference g h x b c)) d| ≤ |
| 112 | 3 * epsilon ^ 2 * |
| 113 | (g.tangentNorm x a * g.tangentNorm x b * g.tangentNorm x c * g.tangentNorm x d) := by |
| 114 | have hh := abs_inner_connectionDifference_le D D' x (herror 1 (by omega)) |
| 115 | a (connectionDifference g h x b c) d |
| 116 | have hc := tangentNorm_connectionDifference_le D D' x hepsilon hsmall |
| 117 | (herror 0 (by omega)) (herror 1 (by omega)) b c |
| 118 | calc |
| 119 | _ ≤ (3 / 2 : ℝ) * epsilon * (g.tangentNorm x a * |
| 120 | g.tangentNorm x (connectionDifference g h x b c) * g.tangentNorm x d) := hh |
| 121 | _ = ((3 / 2 : ℝ) * epsilon * g.tangentNorm x a * g.tangentNorm x d) * |
| 122 | g.tangentNorm x (connectionDifference g h x b c) := by ring |
| 123 | _ ≤ ((3 / 2 : ℝ) * epsilon * g.tangentNorm x a * g.tangentNorm x d) * |
| 124 | (2 * epsilon * (g.tangentNorm x b * g.tangentNorm x c)) := |
| 125 | mul_le_mul_of_nonneg_left hc |
| 126 | (mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) hepsilon) (hp a)) (hp d)) |
| 127 | _ = _ := by ring |
| 128 | have hzero := metricError_jet_evaluation_le D 0 x (herror 0 (by omega)) |
| 129 | ![D.curvature x u v z, w] |
| 130 | simp! only [Nat.add_zero, LeviCivitaData.iteratedCovariantTensorDerivative, metricError, |
| 131 | Fin.prod_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one] at hzero |
| 132 | have hR := (D.tangentNorm_curvature_le x u v z).trans |
| 133 | (mul_le_mul_of_nonneg_right |
| 134 | (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcurv (hp u)) (hp v)) (hp z)) |
| 135 | have hbase : |h.inner x (D.curvature x u v z) w - g.inner x (D.curvature x u v z) w| ≤ |
| 136 | K * epsilon * P := by |
| 137 | calc |
| 138 | _ ≤ epsilon * (g.tangentNorm x (D.curvature x u v z) * g.tangentNorm x w) := hzero |
| 139 | _ = (epsilon * g.tangentNorm x w) * g.tangentNorm x (D.curvature x u v z) := by ring |
| 140 | _ ≤ (epsilon * g.tangentNorm x w) * |
| 141 | (K * g.tangentNorm x u * g.tangentNorm x v * g.tangentNorm x z) := |
| 142 | mul_le_mul_of_nonneg_left hR (mul_nonneg hepsilon (hp w)) |
| 143 | _ = K * epsilon * P := by dsimp [P]; ring |
| 144 | have h1 := abs_inner_covariantConnectionDifference_le D D' x hepsilon hsmall herror u v z w |
| 145 | have h2 := abs_inner_covariantConnectionDifference_le D D' x hepsilon hsmall herror v u z w |
| 146 | have h3 := hquad u v z w |
| 147 | have h4 := hquad v u z w |
| 148 | have hid : D'.curvatureTensor x u v w z - D.curvatureTensor x u v w z = |
| 149 | (h.inner x (D.curvature x u v z) w - g.inner x (D.curvature x u v z) w) + |
| 150 | h.inner x (covariantConnectionDifference g h x u v z) w - |
| 151 | h.inner x (covariantConnectionDifference g h x v u z) w + |
| 152 | h.inner x (connectionDifference g h x u (connectionDifference g h x v z)) w - |
| 153 | h.inner x (connectionDifference g h x v (connectionDifference g h x u z)) w := by |
| 154 | unfold LeviCivitaData.curvatureTensor |
| 155 | rw [curvature_eq_add_connectionDifference D D'] |
| 156 | simp! only [map_add, map_sub, add_apply, sub_apply] |
| 157 | ring! |
| 158 | rw [hid] |
| 159 | calc |
| 160 | _ ≤ |h.inner x (D.curvature x u v z) w - g.inner x (D.curvature x u v z) w| + |
| 161 | |h.inner x (covariantConnectionDifference g h x u v z) w| + |
| 162 | |h.inner x (covariantConnectionDifference g h x v u z) w| + |
| 163 | |h.inner x (connectionDifference g h x u (connectionDifference g h x v z)) w| + |
| 164 | |h.inner x (connectionDifference g h x v (connectionDifference g h x u z)) w| := by |
| 165 | exact (abs_sub _ _).trans (add_le_add |
| 166 | ((abs_add_le _ _).trans (add_le_add |
| 167 | ((abs_sub _ _).trans (add_le_add (abs_add_le _ _) le_rfl)) le_rfl)) le_rfl) |
| 168 | _ ≤ _ := by |
| 169 | dsimp [P] at hbase |
| 170 | nlinarith! only [hbase, h1, h2, h3, h4] |
| 171 | |
| 172 | end PoincareMT.M44 |