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.Metric.Cylinder.CylinderCoefficientField |
| 2 | |
| 3 | /-! |
| 4 | # A fixed Euclidean two-jet for the round cylinder |
| 5 | |
| 6 | The centered Gram fields all agree with one explicit bilinear field. |
| 7 | Its value is coercive, its first derivative vanishes, and its second |
| 8 | derivative is the product of two horizontal inner products with factor -2. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | -- Second derivatives of bilinear fields have four curried operator slots. |
| 14 | set_option maxSynthPendingDepth 8 |
| 15 | |
| 16 | open scoped ContDiff Topology BigOperators |
| 17 | |
| 18 | namespace PoincareMT.MetricSurgery |
| 19 | |
| 20 | local notation "E₂" => EuclideanSpace ℝ (Fin 2) |
| 21 | local notation "E₃" => EuclideanSpace ℝ (Fin 3) |
| 22 | |
| 23 | theorem euclideanThree_bilinear_ext |
| 24 | {A B : E₃ →L[ℝ] E₃ →L[ℝ] ℝ} |
| 25 | (h : ∀ i j : Fin 3, |
| 26 | A (EuclideanSpace.basisFun (Fin 3) ℝ i) (EuclideanSpace.basisFun (Fin 3) ℝ j) = |
| 27 | B (EuclideanSpace.basisFun (Fin 3) ℝ i) (EuclideanSpace.basisFun (Fin 3) ℝ j)) : |
| 28 | A = B := by |
| 29 | apply ContinuousLinearMap.coe_injective |
| 30 | apply (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis.ext |
| 31 | intro i |
| 32 | apply ContinuousLinearMap.coe_injective |
| 33 | apply (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis.ext |
| 34 | exact h i |
| 35 | |
| 36 | noncomputable def cylinderHorizontalProjection : E₃ →L[ℝ] E₂ := |
| 37 | (ContinuousLinearMap.fst ℝ E₂ ℝ).comp cylinderEuclideanEquiv.toContinuousLinearMap |
| 38 | |
| 39 | noncomputable def cylinderHeightCovector : E₃ →L[ℝ] ℝ := |
| 40 | (ContinuousLinearMap.snd ℝ E₂ ℝ).comp cylinderEuclideanEquiv.toContinuousLinearMap |
| 41 | |
| 42 | noncomputable def cylinderHorizontalForm : E₃ →L[ℝ] E₃ →L[ℝ] ℝ := |
| 43 | (cylinderHorizontalProjection.precomp ℝ).comp |
| 44 | ((innerSL ℝ).comp cylinderHorizontalProjection) |
| 45 | |
| 46 | theorem cylinderHorizontalForm_apply (u v : E₃) : |
| 47 | cylinderHorizontalForm u v = |
| 48 | inner ℝ (cylinderEuclideanEquiv u).1 (cylinderEuclideanEquiv v).1 := rfl |
| 49 | |
| 50 | theorem cylinderHorizontalForm_basis (i j : Fin 3) : |
| 51 | cylinderHorizontalForm (EuclideanSpace.basisFun (Fin 3) ℝ i) |
| 52 | (EuclideanSpace.basisFun (Fin 3) ℝ j) = cylinderHorizontalGram i j := by |
| 53 | simp only [cylinderHorizontalForm_apply, cylinderEuclideanEquiv_basis, |
| 54 | cylinderHorizontalGram] |
| 55 | |
| 56 | theorem cylinderHeightCovector_basis (i : Fin 3) : |
| 57 | cylinderHeightCovector (EuclideanSpace.basisFun (Fin 3) ℝ i) = |
| 58 | (roundCylinderCoordinateBasis i).2 := by |
| 59 | change (cylinderEuclideanEquiv (EuclideanSpace.basisFun (Fin 3) ℝ i)).2 = _ |
| 60 | rw [cylinderEuclideanEquiv_basis] |
| 61 | |
| 62 | theorem cylinderHorizontalForm_add_vertical : |
| 63 | cylinderHorizontalForm + cylinderHeightCovector.smulRight cylinderHeightCovector = |
| 64 | innerSL ℝ := by |
| 65 | apply euclideanThree_bilinear_ext |
| 66 | intro i j |
| 67 | simp only [add_apply, ContinuousLinearMap.smulRight_apply, smul_apply, smul_eq_mul, |
| 68 | cylinderHorizontalForm_basis, cylinderHeightCovector_basis] |
| 69 | change cylinderHorizontalGram i j + |
| 70 | (roundCylinderCoordinateBasis i).2 * (roundCylinderCoordinateBasis j).2 = |
| 71 | inner ℝ (EuclideanSpace.basisFun (Fin 3) ℝ i) (EuclideanSpace.basisFun (Fin 3) ℝ j) |
| 72 | rw [(EuclideanSpace.basisFun (Fin 3) ℝ).inner_eq_ite] |
| 73 | fin_cases i <;> fin_cases j <;> |
| 74 | simp [cylinderHorizontalGram, roundCylinderCoordinateBasis, |
| 75 | EuclideanSpace.basisFun, EuclideanSpace.inner_single_left] |
| 76 | |
| 77 | noncomputable def cylinderModelField (p : E₃) : E₃ →L[ℝ] E₃ →L[ℝ] ℝ := |
| 78 | cylinderSphereFactor (cylinderEuclideanEquiv p) • cylinderHorizontalForm + |
| 79 | cylinderHeightCovector.smulRight cylinderHeightCovector |
| 80 | |
| 81 | theorem cylinderModelField_contDiff : ContDiff ℝ ∞ cylinderModelField := |
| 82 | ((cylinderSphereFactor_contDiff.comp cylinderEuclideanEquiv.contDiff).smul |
| 83 | contDiff_const).add contDiff_const |
| 84 | |
| 85 | theorem centeredCylinderBilinear_gram (theta : UnitTwoSphere) (s : ℝ) : |
| 86 | centeredCylinderBilinear (roundCylinderGram 0 (chartAt E₂ theta)) s = |
| 87 | cylinderModelField := by |
| 88 | funext p |
| 89 | apply euclideanThree_bilinear_ext |
| 90 | intro i j |
| 91 | rw [centeredCylinderBilinear_basis, roundCylinderGram_chart_entry] |
| 92 | simp only [cylinderModelField, add_apply, smul_apply, smul_eq_mul, |
| 93 | cylinderHorizontalForm_basis, ContinuousLinearMap.smulRight_apply, |
| 94 | cylinderHeightCovector_basis] |
| 95 | simp [cylinderSphereFactor] |
| 96 | |
| 97 | theorem cylinderModelField_zero : |
| 98 | cylinderModelField 0 = (2 : ℝ) • cylinderHorizontalForm + |
| 99 | cylinderHeightCovector.smulRight cylinderHeightCovector := by |
| 100 | norm_num [cylinderModelField, cylinderSphereFactor] |
| 101 | |
| 102 | theorem cylinderModelField_zero_lower (v : E₃) : |
| 103 | ‖v‖ ^ 2 ≤ cylinderModelField 0 v v := by |
| 104 | have hsplit := congrArg (fun A : E₃ →L[ℝ] E₃ →L[ℝ] ℝ => A v v) |
| 105 | cylinderHorizontalForm_add_vertical |
| 106 | simp only [add_apply, ContinuousLinearMap.smulRight_apply, smul_apply, |
| 107 | smul_eq_mul] at hsplit |
| 108 | change cylinderHorizontalForm v v + cylinderHeightCovector v * cylinderHeightCovector v = |
| 109 | inner ℝ v v at hsplit |
| 110 | rw [real_inner_self_eq_norm_sq] at hsplit |
| 111 | have hH : 0 ≤ cylinderHorizontalForm v v := by |
| 112 | rw [cylinderHorizontalForm_apply] |
| 113 | exact real_inner_self_nonneg |
| 114 | rw [cylinderModelField_zero] |
| 115 | simp only [add_apply, smul_apply, ContinuousLinearMap.smulRight_apply, smul_eq_mul] |
| 116 | linarith |
| 117 | |
| 118 | theorem cylinderModelField_fderiv (p v a b : E₃) : |
| 119 | fderiv ℝ cylinderModelField p v a b = |
| 120 | (-128 / (‖(cylinderEuclideanEquiv p).1‖ ^ 2 + 4) ^ 3) * |
| 121 | cylinderHorizontalForm p v * cylinderHorizontalForm a b := by |
| 122 | have hd := (((cylinderSphereFactor_hasFDerivAt (cylinderEuclideanEquiv p)).comp p |
| 123 | cylinderEuclideanEquiv.hasFDerivAt).smul_const cylinderHorizontalForm).add_const |
| 124 | (cylinderHeightCovector.smulRight cylinderHeightCovector) |
| 125 | have he := congrArg (fun A : E₃ →L[ℝ] E₃ →L[ℝ] E₃ →L[ℝ] ℝ => A v a b) hd.fderiv |
| 126 | change fderiv ℝ (fun y => cylinderSphereFactor (cylinderEuclideanEquiv y) • |
| 127 | cylinderHorizontalForm + cylinderHeightCovector.smulRight cylinderHeightCovector) p v a b = _ |
| 128 | simpa [cylinderModelField, cylinderHorizontalForm_apply, smul_eq_mul, |
| 129 | mul_assoc] using he |
| 130 | |
| 131 | theorem cylinderModelField_fderiv_zero : fderiv ℝ cylinderModelField 0 = 0 := by |
| 132 | apply ContinuousLinearMap.ext |
| 133 | intro v |
| 134 | apply ContinuousLinearMap.ext |
| 135 | intro a |
| 136 | apply ContinuousLinearMap.ext |
| 137 | intro b |
| 138 | simp [cylinderModelField_fderiv] |
| 139 | |
| 140 | set_option maxHeartbeats 800000 in |
| 141 | -- Elaborating the differentiated four-slot evaluation exceeds the default budget. |
| 142 | theorem cylinderModelField_second_fderiv_zero (u v a b : E₃) : |
| 143 | fderiv ℝ (fderiv ℝ cylinderModelField) 0 u v a b = |
| 144 | -2 * cylinderHorizontalForm u v * cylinderHorizontalForm a b := by |
| 145 | rw [← second_fderiv_bilinear_component cylinderModelField_contDiff.contDiffAt] |
| 146 | simp only [fderiv_bilinear_component (cylinderModelField_contDiff.differentiable |
| 147 | (by simp) _), cylinderModelField_fderiv] |
| 148 | let t : E₃ → ℝ := fun p => -128 / (‖(cylinderEuclideanEquiv p).1‖ ^ 2 + 4) ^ 3 |
| 149 | have ht : ContDiff ℝ ∞ t := by |
| 150 | apply contDiff_const.div |
| 151 | ((((contDiff_norm_sq ℝ).comp |
| 152 | (contDiff_fst.comp cylinderEuclideanEquiv.contDiff)).add contDiff_const).pow 3) |
| 153 | intro p |
| 154 | exact pow_ne_zero 3 (ne_of_gt |
| 155 | (show 0 < ‖(cylinderEuclideanEquiv p).1‖ ^ 2 + 4 by positivity)) |
| 156 | have hd := (((ht.differentiable (by simp) 0).hasFDerivAt.mul |
| 157 | (cylinderHorizontalForm.flip v).hasFDerivAt).mul_const |
| 158 | (cylinderHorizontalForm a b)).fderiv |
| 159 | have he := congrArg (fun A : E₃ →L[ℝ] ℝ => A u) hd |
| 160 | simpa [t, show (-128 / 4 ^ 3 : ℝ) = -2 by norm_num, |
| 161 | mul_assoc, mul_left_comm, mul_comm] using he |
| 162 | |
| 163 | noncomputable def centeredCylinderMetric |
| 164 | (B : RoundCylinderTwoTensor) (theta : UnitTwoSphere) (s : ℝ) : |
| 165 | E₃ → E₃ →L[ℝ] E₃ →L[ℝ] ℝ := |
| 166 | centeredCylinderBilinear (roundCylinderTensorCoefficient B (chartAt E₂ theta)) s |
| 167 | |
| 168 | theorem centeredCylinderMetric_sub_model |
| 169 | (B : RoundCylinderTwoTensor) (theta : UnitTwoSphere) (s : ℝ) : |
| 170 | (fun p => centeredCylinderMetric B theta s p - cylinderModelField p) = |
| 171 | centeredCylinderError B theta s := by |
| 172 | funext p |
| 173 | apply euclideanThree_bilinear_ext |
| 174 | intro i j |
| 175 | rw [← centeredCylinderBilinear_gram theta s] |
| 176 | simp only [centeredCylinderMetric, centeredCylinderError, sub_apply, |
| 177 | centeredCylinderBilinear_basis] |
| 178 | |
| 179 | theorem centeredCylinderMetric_contDiffAt {epsilon : ℝ} |
| 180 | {B : RoundCylinderTwoTensor} (hB : RoundCylinderClose epsilon 0 B) |
| 181 | (z : RoundCylinderSpace) (hz : z.2 ∈ Set.Ioo (-epsilon⁻¹) epsilon⁻¹) : |
| 182 | ContDiffAt ℝ ∞ (centeredCylinderMetric B z.1 z.2) 0 := by |
| 183 | have he : centeredCylinderMetric B z.1 z.2 = |
| 184 | fun p => centeredCylinderError B z.1 z.2 p + cylinderModelField p := by |
| 185 | funext p |
| 186 | have h := congrFun (centeredCylinderMetric_sub_model B z.1 z.2) p |
| 187 | exact sub_eq_iff_eq_add.mp h |
| 188 | rw [he] |
| 189 | exact (centeredCylinderError_contDiffAt hB z hz).add cylinderModelField_contDiff.contDiffAt |
| 190 | |
| 191 | end PoincareMT.MetricSurgery |