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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderScalarReadout |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderModelJet |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderCoefficientBounds |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderJetNorm |
| 6 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Spheres.RoundGaussJetReadout |
| 7 | |
| 8 | /-! |
| 9 | # Actual cylinder error jets in one Euclidean parametrization |
| 10 | |
| 11 | The source-minus-model coefficients agree as germs with the frozen error |
| 12 | after the fixed affine coordinate map. Differentiation transports its first |
| 13 | two ordinary component bounds into the actual metric two-jet difference. |
| 14 | Source: Morgan--Tian Lemma A.2 and M28 derivation 22. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | set_option maxSynthPendingDepth 12 |
| 21 | |
| 22 | open Set Filter |
| 23 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 24 | |
| 25 | universe u |
| 26 | |
| 27 | namespace PoincareMT.M28.tube |
| 28 | |
| 29 | open PoincareMT.SpacetimeBounds PoincareMT.Proofs.M28.NeckAnalysis |
| 30 | |
| 31 | private abbrev CE := EuclideanSpace ℝ (Fin 3) |
| 32 | private abbrev cb := EuclideanSpace.basisFun (Fin 3) ℝ |
| 33 | |
| 34 | private abbrev CMetric := MetricCoefficient 3 |
| 35 | local instance : NormedAddCommGroup CMetric := ContinuousLinearMap.toNormedAddCommGroup |
| 36 | local instance : NormedSpace ℝ CMetric := ContinuousLinearMap.toNormedSpace |
| 37 | private abbrev CFirst := CE →L[ℝ] CMetric |
| 38 | local instance : NormedAddCommGroup CFirst := ContinuousLinearMap.toNormedAddCommGroup |
| 39 | local instance : NormedSpace ℝ CFirst := ContinuousLinearMap.toNormedSpace |
| 40 | private abbrev CSecond := CE →L[ℝ] CFirst |
| 41 | local instance : NormedAddCommGroup CSecond := ContinuousLinearMap.toNormedAddCommGroup |
| 42 | local instance : NormedSpace ℝ CSecond := ContinuousLinearMap.toNormedSpace |
| 43 | |
| 44 | private theorem coefficient_second_fderiv_of_contDiffAt |
| 45 | {F : CE → MetricCoefficient 3} (hF : ContDiffAt ℝ ∞ F 0) |
| 46 | (u v w z : CE) : |
| 47 | fderiv ℝ (fun y => fderiv ℝ (fun x => F x w z) y v) 0 u = |
| 48 | fderiv ℝ (fderiv ℝ F) 0 u v w z := by |
| 49 | have hF1 : ContDiffAt ℝ 1 F 0 := hF.of_le (by simp) |
| 50 | have heq : (fun y => fderiv ℝ (fun x => F x w z) y v) =ᶠ[𝓝 0] |
| 51 | (fun y => fderiv ℝ F y v w z) := by |
| 52 | filter_upwards [hF1.eventually (by norm_num)] with y hy |
| 53 | exact coefficient_fderiv_evaluation (hy.differentiableAt (by norm_num)) v w z |
| 54 | have hDF : DifferentiableAt ℝ (fderiv ℝ F) 0 := |
| 55 | (hF.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) |
| 56 | rw [heq.fderiv_eq, coefficient_fderiv_evaluation |
| 57 | (hDF.clm_apply (differentiableAt_const (c := v)))] |
| 58 | rw [fderiv_clm_apply hDF (differentiableAt_const (c := v))] |
| 59 | simp |
| 60 | |
| 61 | private theorem cylinder_affine_first_derivative |
| 62 | (s : ℝ) {f : RoundCylinderCoordinates → ℝ} |
| 63 | (hf : DifferentiableAt ℝ f (0, s)) (i : Fin 3) : |
| 64 | fderiv ℝ (fun x => f (cylinderScalarCoordinates s x)) 0 (cb i) = |
| 65 | fderiv ℝ f (0, s) (roundCylinderCoordinateBasis i) := by |
| 66 | have hf' : DifferentiableAt ℝ f (cylinderScalarCoordinates s 0) := by |
| 67 | simpa only [cylinderScalarCoordinates_zero] using hf |
| 68 | change fderiv ℝ (f ∘ cylinderScalarCoordinates s) 0 (cb i) = _ |
| 69 | rw [fderiv_comp 0 hf' (cylinderScalarCoordinates_hasFDerivAt s 0).differentiableAt, |
| 70 | (cylinderScalarCoordinates_hasFDerivAt s 0).fderiv] |
| 71 | simp only [ContinuousLinearMap.comp_apply, cylinderScalarCoordinates_zero, |
| 72 | ContinuousLinearEquiv.coe_coe, cylinderScalarCoordinateEquiv_basis] |
| 73 | |
| 74 | private theorem cylinder_affine_second_derivative |
| 75 | (s : ℝ) {f : RoundCylinderCoordinates → ℝ} |
| 76 | (hf : ContDiffAt ℝ ∞ f (0, s)) (i j : Fin 3) : |
| 77 | fderiv ℝ (fun y => fderiv ℝ (fun x => f (cylinderScalarCoordinates s x)) y |
| 78 | (cb i)) 0 (cb j) = |
| 79 | fderiv ℝ (fun p => fderiv ℝ f p (roundCylinderCoordinateBasis i)) |
| 80 | (0, s) (roundCylinderCoordinateBasis j) := by |
| 81 | have hf1 : ContDiffAt ℝ 1 f (0, s) := hf.of_le (by simp) |
| 82 | have ht : Tendsto (cylinderScalarCoordinates s) (𝓝 (0 : CE)) (𝓝 (0, s)) := by |
| 83 | have hc : ContinuousAt (cylinderScalarCoordinates s) (0 : CE) := |
| 84 | (contDiff_cylinderScalarCoordinates s).continuous.continuousAt |
| 85 | simpa only [cylinderScalarCoordinates_zero] using |
| 86 | hc.tendsto |
| 87 | have heq : (fun y => fderiv ℝ (fun x => f (cylinderScalarCoordinates s x)) y |
| 88 | (cb i)) =ᶠ[𝓝 (0 : CE)] |
| 89 | (fun y => fderiv ℝ f (cylinderScalarCoordinates s y) |
| 90 | (roundCylinderCoordinateBasis i)) := by |
| 91 | filter_upwards [ht.eventually (hf1.eventually (by norm_num))] with y hy |
| 92 | have h := (hy.differentiableAt (by norm_num)).hasFDerivAt.comp y |
| 93 | (cylinderScalarCoordinates_hasFDerivAt s y) |
| 94 | change fderiv ℝ (f ∘ cylinderScalarCoordinates s) y (cb i) = _ |
| 95 | rw [h.fderiv] |
| 96 | simp only [ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, |
| 97 | cylinderScalarCoordinateEquiv_basis] |
| 98 | rw [heq.fderiv_eq] |
| 99 | have hdf : ContDiffAt ℝ ∞ |
| 100 | (fun p => fderiv ℝ f p (roundCylinderCoordinateBasis i)) (0, s) := |
| 101 | (hf.fderiv_right (m := ∞) (by simp)).clm_apply contDiffAt_const |
| 102 | exact cylinder_affine_first_derivative s (hdf.differentiableAt (by simp)) j |
| 103 | |
| 104 | variable {M : Type u} [TopologicalSpace M] |
| 105 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 106 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} |
| 107 | |
| 108 | private def normalizedNeckTensor (N : EpsilonNeck g) : RoundCylinderTwoTensor := |
| 109 | fun z v w => N.scale⁻¹ ^ 2 * roundCylinderPullback g N.coordinate_map z v w |
| 110 | |
| 111 | /-- Literal source-minus-model error in the actual common chart. -/ |
| 112 | def cylinderErrorCoefficients (N : EpsilonNeck g) (z : RoundCylinderSpace) : |
| 113 | CE → MetricCoefficient 3 := |
| 114 | fun x => cylinderNeckCoefficients N z.1 z.2 x - cylinderModelMetricCoefficient x |
| 115 | |
| 116 | /-- Both actual coefficient functions are smooth at the selected neck point. -/ |
| 117 | theorem cylinderErrorCoefficients_contDiffAt (N : EpsilonNeck g) |
| 118 | {z : RoundCylinderSpace} (hz : z.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) : |
| 119 | ContDiffAt ℝ ∞ (cylinderErrorCoefficients N z) 0 := |
| 120 | ((contDiffOn_cylinderNeckCoefficients N z.1 z.2).contDiffAt |
| 121 | ((isOpen_cylinderNeckChartDomain N z.1 z.2).mem_nhds |
| 122 | (zero_mem_cylinderNeckChartDomain N z.1 hz))).sub |
| 123 | contDiff_cylinderModelMetricCoefficient.contDiffAt |
| 124 | |
| 125 | private theorem cylinder_error_frozen_germ (N : EpsilonNeck g) |
| 126 | {z : RoundCylinderSpace} (hz : z.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) |
| 127 | (a b : Fin 3) : |
| 128 | (fun x => cylinderErrorCoefficients N z x (cb a) (cb b)) =ᶠ[𝓝 (0 : CE)] |
| 129 | (fun x => roundCylinderIteratedDerivative 0 |
| 130 | (chartAt (EuclideanSpace ℝ (Fin 2)) z.1) (normalizedNeckTensor N) 0 |
| 131 | (cylinderScalarCoordinates z.2 x) ![a, b]) := by |
| 132 | filter_upwards [cylinderNeckCoefficients_frozen_germ N z.1 hz a b] with x hx |
| 133 | change cylinderNeckCoefficients N z.1 z.2 x (cb a) (cb b) - |
| 134 | cylinderModelMetricCoefficient x (cb a) (cb b) = _ |
| 135 | rw [hx, cylinderModelMetricCoefficient_basis z.1 z.2 x a b] |
| 136 | rfl |
| 137 | |
| 138 | /-- Uniform ordinary two-jet control produced from the frozen cylinder |
| 139 | comparison. Its constant is chosen before the manifold, neck and point. -/ |
| 140 | theorem exists_cylinder_metricTwoJet_bound : |
| 141 | ∃ L : ℝ, 0 < L ∧ |
| 142 | ∀ (M : Type u) [TopologicalSpace M] |
| 143 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 144 | (g : RiemannianMetric 3 M) (N : EpsilonNeck g), |
| 145 | 2 ≤ ⌊N.epsilon⁻¹⌋₊ → ∀ z : RoundCylinderSpace, |
| 146 | z.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ → |
| 147 | dist (metricTwoJet (cylinderNeckCoefficients N z.1 z.2) 0) |
| 148 | cylinderModelTwoJet ≤ L * N.epsilon := by |
| 149 | obtain ⟨K, hK, hnorm⟩ := exists_metricTwoJet_coefficient_bound |
| 150 | obtain ⟨C, hC, hsecond⟩ := exists_cylinder_second_component_bound |
| 151 | refine ⟨K * (4 + C), mul_pos hK (by positivity), ?_⟩ |
| 152 | intro M _ _ _ g N horder z hz |
| 153 | let B := normalizedNeckTensor N |
| 154 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) z.1 |
| 155 | let T := roundCylinderIteratedDerivative 0 c B 0 |
| 156 | let F := cylinderErrorCoefficients N z |
| 157 | have hB : RoundCylinderClose N.epsilon 0 B := N.metric_comparison.close |
| 158 | have hF : ContDiffAt ℝ ∞ F 0 := cylinderErrorCoefficients_contDiffAt N hz |
| 159 | have hFdiff : DifferentiableAt ℝ F 0 := hF.differentiableAt (by simp) |
| 160 | have hp : (0, z.2) ∈ c.target ×ˢ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := by |
| 161 | refine ⟨?_, hz⟩ |
| 162 | rw [← sphere_chart_center z.1] |
| 163 | exact c.map_source (mem_chart_source _ z.1) |
| 164 | have hT (a : Fin 2 → Fin 3) : ContDiffAt ℝ ∞ (fun p => T p a) (0, z.2) := |
| 165 | (contDiffOn_roundCylinderIteratedDerivative (by norm_num) hB.1 z.1 0 a).contDiffAt |
| 166 | ((c.open_target.prod isOpen_Ioo).mem_nhds hp) |
| 167 | have hfour : 4 * N.epsilon ≤ (4 + C) * N.epsilon := by |
| 168 | nlinarith [N.epsilon_pos] |
| 169 | have hCbound : C * N.epsilon ≤ (4 + C) * N.epsilon := by |
| 170 | nlinarith [N.epsilon_pos] |
| 171 | have hzero (a b : Fin 3) : |F 0 (cb a) (cb b)| ≤ (4 + C) * N.epsilon := by |
| 172 | have heq : F 0 (cb a) (cb b) = |
| 173 | T (cylinderScalarCoordinates z.2 0) ![a, b] := |
| 174 | (cylinder_error_frozen_germ N hz a b).self_of_nhds |
| 175 | rw [heq, cylinderScalarCoordinates_zero] |
| 176 | exact (cylinder_covariant_component_le (k := 0) N.epsilon_pos hB hz |
| 177 | (by omega) (by omega) ![a, b]).trans hfour |
| 178 | have hfirst (i a b : Fin 3) : |
| 179 | |fderiv ℝ F 0 (cb i) (cb a) (cb b)| ≤ (4 + C) * N.epsilon := by |
| 180 | rw [← coefficient_fderiv_evaluation hFdiff, |
| 181 | (cylinder_error_frozen_germ N hz a b).fderiv_eq, |
| 182 | cylinder_affine_first_derivative z.2 ((hT ![a, b]).differentiableAt (by simp))] |
| 183 | exact (cylinder_first_component_le N.epsilon_pos hB hz (by omega) ![a, b] i).trans |
| 184 | hfour |
| 185 | have hsecond' (j i a b : Fin 3) : |
| 186 | |fderiv ℝ (fderiv ℝ F) 0 (cb j) (cb i) (cb a) (cb b)| ≤ |
| 187 | (4 + C) * N.epsilon := by |
| 188 | have hder : (fun y => fderiv ℝ (fun x => F x (cb a) (cb b)) y (cb i)) |
| 189 | =ᶠ[𝓝 (0 : CE)] (fun y => fderiv ℝ |
| 190 | (fun x => T (cylinderScalarCoordinates z.2 x) ![a, b]) y (cb i)) := by |
| 191 | filter_upwards [(cylinder_error_frozen_germ N hz a b).fderiv (𝕜 := ℝ)] with y hy |
| 192 | exact congrArg (fun L : CE →L[ℝ] ℝ => L (cb i)) hy |
| 193 | rw [← coefficient_second_fderiv_of_contDiffAt hF, |
| 194 | hder.fderiv_eq, cylinder_affine_second_derivative z.2 (hT ![a, b]) i j] |
| 195 | exact (hsecond N.epsilon N.epsilon_pos B hB z hz horder ![a, b] i j).trans hCbound |
| 196 | have hn := hnorm (metricTwoJet F 0) ((4 + C) * N.epsilon) |
| 197 | (mul_nonneg (by positivity) N.epsilon_pos.le) hzero hfirst hsecond' |
| 198 | have hdiff : metricTwoJet F 0 = |
| 199 | metricTwoJet (cylinderNeckCoefficients N z.1 z.2) 0 - cylinderModelTwoJet := |
| 200 | metricTwoJet_sub_of_smooth |
| 201 | ((contDiffOn_cylinderNeckCoefficients N z.1 z.2).contDiffAt |
| 202 | ((isOpen_cylinderNeckChartDomain N z.1 z.2).mem_nhds |
| 203 | (zero_mem_cylinderNeckChartDomain N z.1 hz))) |
| 204 | contDiff_cylinderModelMetricCoefficient.contDiffAt |
| 205 | rw [dist_eq_norm, ← hdiff] |
| 206 | simpa only [mul_assoc] using hn |
| 207 | |
| 208 | end PoincareMT.M28.tube |