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.CurveShortening.Comparison.IntrinsicComparison.Metric.Germ |
| 2 | import PoincareLib.Geometry.Riemannian.Surface.GaussBonnet.SideIntegrals |
| 3 | import PoincareLib.Geometry.Riemannian.Curvature.Euclidean |
| 4 | import PoincareLib.Geometry.Riemannian.Coordinates.Exponential.SmoothExtension |
| 5 | |
| 6 | /-! |
| 7 | # Vanishing turning along actual reparametrized geodesics |
| 8 | |
| 9 | The intrinsic geodesic equation gives zero covariant derivative for any |
| 10 | ambient extension of its velocity, also after a smooth change of parameter. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 13 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 14 | derivations. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Topology Manifold ContDiff Bundle |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 27 | normedSpaceTangentSpaceVectorSpace |
| 28 | |
| 29 | /-- The genuine intrinsic geodesic equation gives the displayed derivative of the original |
| 30 | coordinate velocity. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, including |
| 31 | the Gauss--Bonnet argument in Lemma 19.45, p. 474; the explicit regional construction is |
| 32 | reviewed in `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, |
| 33 | Mathematical Checks. -/ |
| 34 | theorem m64Intrinsic_geodesic_velocity_hasDerivAt |
| 35 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 36 | {gamma : ℝ → AnnulusCoordinates} {I : Set ℝ} |
| 37 | (hgeo : g.IsGeodesicOn gamma I) {t : ℝ} (ht : t ∈ I) : |
| 38 | HasDerivAt (deriv gamma) |
| 39 | (-coordinateChristoffel g.euclideanCoefficients (gamma t) |
| 40 | (deriv gamma t) (deriv gamma t)) t := by |
| 41 | have h := (hgeo.hasDerivAt_chart_at ht (gamma t) (by simp)).2 |
| 42 | rw [m64Intrinsic_model_chart_coefficients] at h |
| 43 | simpa only [extChartAt_model_space_eq_id, |
| 44 | PartialEquiv.refl_coe, id_eq] using h |
| 45 | |
| 46 | /-- A constant multiple of geodesic velocity remains parallel after an arbitrary |
| 47 | differentiable parameter change. Only the actual field germ along that curve is used. |
| 48 | Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, including the Gauss--Bonnet |
| 49 | argument in Lemma 19.45, p. 474; the explicit regional construction is reviewed in |
| 50 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 51 | Checks. -/ |
| 52 | theorem m64Intrinsic_connection_reparam_geodesic_eq_zero |
| 53 | {g : RiemannianMetric 2 AnnulusCoordinates} (D : LeviCivitaData g) |
| 54 | {gamma eta : ℝ → AnnulusCoordinates} {phi : ℝ → ℝ} {I : Set ℝ} {t c : ℝ} |
| 55 | (hgeo : g.IsGeodesicOn gamma I) (ht : phi t ∈ I) |
| 56 | (hphi : DifferentiableAt ℝ phi t) |
| 57 | (heta : eta =ᶠ[𝓝 t] gamma ∘ phi) |
| 58 | {W : AnnulusCoordinates → AnnulusCoordinates} |
| 59 | (hW : DifferentiableAt ℝ W (eta t)) |
| 60 | (hfield : ∀ᶠ s in 𝓝 t, W (eta s) = c • deriv gamma (phi s)) : |
| 61 | D.connection W (eta t) (deriv eta t) = 0 := by |
| 62 | have hgamma : DifferentiableAt ℝ gamma (phi t) := |
| 63 | contMDiffAt_iff_contDiffAt.mp (hgeo.contMDiffAt ht) |>.differentiableAt (by simp) |
| 64 | have hdeta : HasDerivAt eta (deriv phi t • deriv gamma (phi t)) t := |
| 65 | (hgamma.hasDerivAt.scomp t hphi.hasDerivAt).congr_of_eventuallyEq heta |
| 66 | have hleft := hW.hasFDerivAt.comp_hasDerivAt t hdeta |
| 67 | have hright := ((m64Intrinsic_geodesic_velocity_hasDerivAt g hgeo ht).scomp t |
| 68 | hphi.hasDerivAt).const_smul c |
| 69 | have hfield' : W ∘ eta =ᶠ[𝓝 t] (fun s => c • deriv gamma (phi s)) := hfield |
| 70 | have hderiv : fderiv ℝ W (eta t) (deriv eta t) = |
| 71 | c • (deriv phi t • (-coordinateChristoffel g.euclideanCoefficients |
| 72 | (gamma (phi t)) (deriv gamma (phi t)) (deriv gamma (phi t)))) := by |
| 73 | rw [hdeta.deriv] |
| 74 | exact hleft.deriv.symm.trans (hfield'.deriv_eq.trans hright.deriv) |
| 75 | rw [D.connection_eq_fderiv_add hW, hderiv] |
| 76 | change _ + D.connection (fun _ => W (eta t)) (eta t) (deriv eta t) = 0 |
| 77 | rw [D.connection_const_eq_inverse, hfield.self_of_nhds, hdeta.deriv, |
| 78 | heta.self_of_nhds] |
| 79 | change _ + coordinateChristoffel g.euclideanCoefficients (gamma (phi t)) |
| 80 | (deriv phi t • deriv gamma (phi t)) (c • deriv gamma (phi t)) = 0 |
| 81 | change _ + CoordinateExponential.christoffelBilinear g.euclideanCoefficients |
| 82 | (gamma (phi t)) (deriv phi t • deriv gamma (phi t)) |
| 83 | (c • deriv gamma (phi t)) = 0 |
| 84 | simp only [map_smul, smul_apply, smul_neg] |
| 85 | exact neg_add_cancel _ |
| 86 | |
| 87 | /-- The normalized tangent of a regular reparametrized unit geodesic has zero retained |
| 88 | covariant derivative. Its tangent sign is locally constant. Source: Morgan--Tian Proposition |
| 89 | 19.35, printed pp. 467-481, including the Gauss--Bonnet argument in Lemma 19.45, p. 474; the |
| 90 | explicit regional construction is reviewed in |
| 91 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 92 | Checks. -/ |
| 93 | theorem m64Intrinsic_normalized_geodesic_connection_eq_zero |
| 94 | {g : RiemannianMetric 2 AnnulusCoordinates} (D : LeviCivitaData g) |
| 95 | {gamma eta : ℝ → AnnulusCoordinates} {phi : ℝ → ℝ} {I : Set ℝ} {t : ℝ} |
| 96 | (hg : ContDiff ℝ ∞ gamma) (hgeo : g.IsGeodesicOn gamma I) (ht : phi t ∈ I) |
| 97 | (hphi : ContDiffAt ℝ 2 phi t) (hpd : deriv phi t ≠ 0) |
| 98 | (heta : eta =ᶠ[𝓝 t] gamma ∘ phi) |
| 99 | (hunit : ∀ᶠ s in 𝓝 (phi t), g.inner (gamma s) (deriv gamma s) (deriv gamma s) = 1) |
| 100 | {V : AnnulusCoordinates → AnnulusCoordinates} |
| 101 | (hV : ∀ᶠ s in 𝓝 t, V (eta s) = deriv eta s) |
| 102 | (hT : DifferentiableAt ℝ (fun x => |
| 103 | (Real.sqrt (g.inner x (V x) (V x)))⁻¹ • V x) (eta t)) : |
| 104 | D.connection (fun x => (Real.sqrt (g.inner x (V x) (V x)))⁻¹ • V x) |
| 105 | (eta t) (deriv eta t) = 0 := by |
| 106 | have hpc : ContinuousAt (deriv phi) t := by |
| 107 | simpa only [fderiv_eq_smul_deriv, one_smul] using |
| 108 | ((hphi.fderiv_right (m := 1) (by norm_num)).clm_apply |
| 109 | (contDiffAt_const (c := (1 : ℝ)))).continuousAt |
| 110 | have hpdiff : ∀ᶠ s in 𝓝 t, DifferentiableAt ℝ phi s := |
| 111 | (hphi.eventually (by norm_num)).mono fun _ hs => hs.differentiableAt (by norm_num) |
| 112 | have hvel : ∀ᶠ s in 𝓝 t, V (eta s) = deriv phi s • deriv gamma (phi s) := by |
| 113 | filter_upwards [hV, heta.deriv, hpdiff] with s hs heq hds |
| 114 | rw [hs, heq] |
| 115 | exact ((hg.differentiable (by simp) _).hasDerivAt.scomp s hds.hasDerivAt).deriv |
| 116 | obtain ⟨c, hc⟩ : ∃ c : ℝ, ∀ᶠ s in 𝓝 t, |
| 117 | |deriv phi s|⁻¹ * deriv phi s = c := by |
| 118 | rcases lt_or_gt_of_ne hpd with hn | hp |
| 119 | · refine ⟨-1, ?_⟩ |
| 120 | filter_upwards [hpc.eventually (Iio_mem_nhds hn)] with s hs |
| 121 | rw [abs_of_neg hs, inv_neg, neg_mul, inv_mul_cancel₀ (ne_of_lt hs)] |
| 122 | · refine ⟨1, ?_⟩ |
| 123 | filter_upwards [hpc.eventually (Ioi_mem_nhds hp)] with s hs |
| 124 | rw [abs_of_pos hs, inv_mul_cancel₀ (ne_of_gt hs)] |
| 125 | apply m64Intrinsic_connection_reparam_geodesic_eq_zero D hgeo ht |
| 126 | (hphi.differentiableAt (by norm_num)) heta hT (c := c) |
| 127 | filter_upwards [hvel, heta, hc, hphi.continuousAt.eventually hunit] with s hs heq hcs hus |
| 128 | have hn : g.inner (eta s) (V (eta s)) (V (eta s)) = (deriv phi s) ^ 2 := by |
| 129 | rw [hs, heq] |
| 130 | simp only [Function.comp_apply, map_smul, smul_eq_mul] |
| 131 | rw [g.symm _ (deriv phi s • deriv gamma (phi s)) (deriv gamma (phi s)), |
| 132 | map_smul, smul_eq_mul, hus] |
| 133 | ring |
| 134 | rw [hn, Real.sqrt_sq_eq_abs, hs, smul_smul, hcs] |
| 135 | |
| 136 | /-- The normalized tangent of the actual regular reparametrized unit geodesic has zero |
| 137 | surface turning form. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, including |
| 138 | the Gauss--Bonnet argument in Lemma 19.45, p. 474; the explicit regional construction is |
| 139 | reviewed in `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, |
| 140 | Mathematical Checks. -/ |
| 141 | theorem m64Intrinsic_normalized_geodesic_turning_eq_zero |
| 142 | {g : RiemannianMetric 2 AnnulusCoordinates} (D : LeviCivitaData g) |
| 143 | (e1 e2 : AnnulusCoordinates → AnnulusCoordinates) |
| 144 | {gamma eta : ℝ → AnnulusCoordinates} {phi : ℝ → ℝ} {I : Set ℝ} {t : ℝ} |
| 145 | (hg : ContDiff ℝ ∞ gamma) (hgeo : g.IsGeodesicOn gamma I) (ht : phi t ∈ I) |
| 146 | (hphi : ContDiffAt ℝ 2 phi t) (hpd : deriv phi t ≠ 0) |
| 147 | (heta : eta =ᶠ[𝓝 t] gamma ∘ phi) |
| 148 | (hunit : ∀ᶠ s in 𝓝 (phi t), g.inner (gamma s) (deriv gamma s) (deriv gamma s) = 1) |
| 149 | {V : AnnulusCoordinates → AnnulusCoordinates} |
| 150 | (hV : ∀ᶠ s in 𝓝 t, V (eta s) = deriv eta s) |
| 151 | (hT : DifferentiableAt ℝ (fun x => |
| 152 | (Real.sqrt (g.inner x (V x) (V x)))⁻¹ • V x) (eta t)) : |
| 153 | D.surfaceTurningForm e1 e2 |
| 154 | (fun x => (Real.sqrt (g.inner x (V x) (V x)))⁻¹ • V x) V (eta t) = 0 := by |
| 155 | unfold LeviCivitaData.surfaceTurningForm |
| 156 | rw [hV.self_of_nhds, |
| 157 | m64Intrinsic_normalized_geodesic_connection_eq_zero D hg hgeo ht hphi hpd heta hunit hV hT] |
| 158 | simp |
| 159 | |
| 160 | end PoincareMT |