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.SourceNames.Metric |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Comparison.Jets.ComparisonCovariantJets |
| 3 | import PoincareLib.Geometry.Riemannian.Coordinates.Exponential.Jacobi.Coefficients |
| 4 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Scalar.Round.RoundPullback |
| 5 | import PoincareLib.Geometry.Riemannian.Tensor.Linearity |
| 6 | |
| 7 | /-! |
| 8 | # The actual connection correction for a nearby metric |
| 9 | |
| 10 | The covariant bilinear derivative and Koszul identity express the |
| 11 | connection correction in the intrinsic metric error. This is the |
| 12 | curvature-perturbation step of the round estimate in Morgan--Tian, |
| 13 | Definition 9.76 and Lemma 11.2; see M44 derivation 31. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open scoped Manifold ContDiff Topology BigOperators |
| 20 | |
| 21 | namespace PoincareMT.M44 |
| 22 | |
| 23 | open M36 CoordinateExponential |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin 3) |
| 26 | |
| 27 | /-- The difference of the two actual coordinate connections, bilinear |
| 28 | in its vector inputs. Source: the Koszul perturbation formula on pp. 3-4, |
| 29 | used for Definition 9.76 in M44 derivation 31. -/ |
| 30 | noncomputable def connectionDifference (g h : RiemannianMetric 3 E) (x : E) : |
| 31 | E →L[ℝ] E →L[ℝ] E := |
| 32 | christoffelBilinear h.euclideanCoefficients x - |
| 33 | christoffelBilinear g.euclideanCoefficients x |
| 34 | |
| 35 | /-- The actual bilinear metric error. Source: the comparison tensor in |
| 36 | Definition 9.76; M44 derivation 31. -/ |
| 37 | noncomputable def metricError (g h : RiemannianMetric 3 E) : |
| 38 | CovariantTensorEvaluation 3 E 2 := |
| 39 | fun x v => h.inner x (v 0) (v 1) - g.inner x (v 0) (v 1) |
| 40 | |
| 41 | /-- The actual metric error is a smooth covariant tensor. Source: |
| 42 | Definition 9.76 in the round perturbation estimate. -/ |
| 43 | theorem metricError_isSmooth (g h : RiemannianMetric 3 E) : |
| 44 | IsSmoothCovariantTensor (metricError g h) := |
| 45 | (isSmoothCovariantTensor_metric h).sub (isSmoothCovariantTensor_metric g) |
| 46 | |
| 47 | /-- A bilinear coefficient derivative equals its intrinsic covariant |
| 48 | derivative plus the two connection corrections. Source: pp. 3-4 in |
| 49 | the perturbation calculation for Definition 9.76; M44 derivation 31. -/ |
| 50 | theorem fderiv_bilinear_eq_covariant {g : RiemannianMetric 3 E} |
| 51 | (D : LeviCivitaData g) {B : E → E →L[ℝ] E →L[ℝ] ℝ} |
| 52 | (hB : ContDiff ℝ ∞ B) (x u v w : E) : |
| 53 | fderiv ℝ (fun y => B y v w) x u = |
| 54 | D.covariantTensorDerivative (k := 2) (fun y a => B y (a 0) (a 1)) x ![u, v, w] + |
| 55 | B x (christoffelBilinear g.euclideanCoefficients x u v) w + |
| 56 | B x v (christoffelBilinear g.euclideanCoefficients x u w) := by |
| 57 | have hh := D.fderiv_covariantTensor_pullback_model (comparison_bilinear_isSmooth hB) |
| 58 | (q := id) (V := fun i (_ : E) => (![v, w] : Fin 2 → E) i) (p := x) |
| 59 | differentiableAt_id (fun i => differentiableAt_const ((![v, w] : Fin 2 → E) i)) u |
| 60 | simpa [id_eq, LeviCivitaData.manifoldCovDerivAlong_model, |
| 61 | ConnectionVariation.covDerivAlong_def, Fin.sum_univ_two, Function.update, |
| 62 | add_assoc] using hh |
| 63 | |
| 64 | /-- The background covariant derivative of the actual metric is that |
| 65 | of its error, since the background metric is parallel. Source: metric |
| 66 | compatibility on pp. 3-4 in M44 derivation 31. -/ |
| 67 | theorem covariant_metric_eq_error {g : RiemannianMetric 3 E} |
| 68 | (D : LeviCivitaData g) (h : RiemannianMetric 3 E) : |
| 69 | D.covariantTensorDerivative (fun x v => h.inner x (v 0) (v 1)) = |
| 70 | D.covariantTensorDerivative (metricError g h) := by |
| 71 | unfold metricError |
| 72 | rw [D.covariantTensorDerivative_sub |
| 73 | (isSmoothCovariantTensor_metric h) (isSmoothCovariantTensor_metric g)] |
| 74 | funext x v |
| 75 | have hz := D.covariantTensorDerivative_metric_eq_zero x (v 0) (v 1) (v 2) |
| 76 | have hv : v = ![v 0, v 1, v 2] := by ext i; fin_cases i <;> rfl |
| 77 | rw [hv, hz, sub_zero] |
| 78 | |
| 79 | /-- The lowered difference of the two Levi-Civita connections is |
| 80 | the Koszul permutation of the first intrinsic metric error. Source: |
| 81 | pp. 3-4, used for Definition 9.76 in M44 derivation 31. -/ |
| 82 | theorem inner_connectionDifference {g h : RiemannianMetric 3 E} |
| 83 | (D : LeviCivitaData g) (D' : LeviCivitaData h) (x u v w : E) : |
| 84 | 2 * h.inner x (connectionDifference g h x u v) w = |
| 85 | D.covariantTensorDerivative (metricError g h) x ![u, v, w] + |
| 86 | D.covariantTensorDerivative (metricError g h) x ![v, w, u] - |
| 87 | D.covariantTensorDerivative (metricError g h) x ![w, u, v] := by |
| 88 | have hB : ContDiff ℝ ∞ h.euclideanCoefficients := |
| 89 | contDiff_iff_contDiffAt.mpr h.contDiffAt_euclideanCoefficients |
| 90 | have h1 := fderiv_bilinear_eq_covariant D hB x u v w |
| 91 | have h2 := fderiv_bilinear_eq_covariant D hB x v w u |
| 92 | have h3 := fderiv_bilinear_eq_covariant D hB x w u v |
| 93 | simp only [RiemannianMetric.euclideanCoefficients] at h1 h2 h3 |
| 94 | erw [covariant_metric_eq_error D h] at h1 h2 h3 |
| 95 | have hk := D'.inner_connection_const x u v w |
| 96 | rw [D'.connection_const_eq_inverse] at hk |
| 97 | change 2 * h.inner x (christoffelBilinear h.euclideanCoefficients x u v) w = _ at hk |
| 98 | erw [h1, h2, h3] at hk |
| 99 | have hs (a b : E) := christoffelBilinear_symm |
| 100 | ((g.contDiffAt_euclideanCoefficients x).differentiableAt (by simp)) |
| 101 | (Filter.Eventually.of_forall fun y a b => g.symm y a b) a b |
| 102 | erw [hs v w, hs w u, h.symm x v, h.symm x |
| 103 | (christoffelBilinear g.euclideanCoefficients x w v) u, |
| 104 | h.symm x w (christoffelBilinear g.euclideanCoefficients x v u), hs v u] at hk |
| 105 | have hcancel : 2 * h.inner x (christoffelBilinear h.euclideanCoefficients x u v) w = |
| 106 | D.covariantTensorDerivative (metricError g h) x ![u, v, w] + |
| 107 | D.covariantTensorDerivative (metricError g h) x ![v, w, u] - |
| 108 | D.covariantTensorDerivative (metricError g h) x ![w, u, v] + |
| 109 | 2 * h.inner x (christoffelBilinear g.euclideanCoefficients x u v) w := by |
| 110 | convert hk using 1 |
| 111 | ring! |
| 112 | simp only [connectionDifference, sub_apply, map_sub] |
| 113 | linarith! only [hcancel] |
| 114 | |
| 115 | /-- The connection correction is symmetric in its two vector inputs. |
| 116 | Source: torsion-freeness on pp. 3-4 in M44 derivation 31. -/ |
| 117 | theorem connectionDifference_symm (g h : RiemannianMetric 3 E) (x u v : E) : |
| 118 | connectionDifference g h x u v = connectionDifference g h x v u := by |
| 119 | have hs (k : RiemannianMetric 3 E) := christoffelBilinear_symm |
| 120 | ((k.contDiffAt_euclideanCoefficients x).differentiableAt (by simp)) |
| 121 | (Filter.Eventually.of_forall fun y a b => k.symm y a b) u v |
| 122 | simp only [connectionDifference, sub_apply, hs] |
| 123 | |
| 124 | end PoincareMT.M44 |