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.Analysis.Affine.EquivHessian |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Boundary.Chart.Connection |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.Annulus |
| 4 | |
| 5 | /-! The genuine weighted coordinate equation becomes M65's actual |
| 6 | complex-gradient equation after annular source dilation. Both radial |
| 7 | orientations are allowed, for the two boundary components. |
| 8 | Source: MT Lemma 19.15, pp. 447-449; M64 finite collar derivation. -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option warningAsError true |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Filter Complex |
| 16 | open scoped ContDiff Topology |
| 17 | |
| 18 | namespace PoincareMT.M64 |
| 19 | |
| 20 | open CoordinateExponential ConnectionVariation M65Branch |
| 21 | |
| 22 | variable {n : ℕ} |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | /-- An actual metric germ and weighted harmonic equation give the actual complex equation in |
| 27 | either oriented boundary coordinate. Source: Morgan--Tian (2007), Lemma 19.15, pp. 447-449; |
| 28 | project derivations `proof-work/tasks/M64/derivations/2026-09-26-finite-boundary-collar.md` |
| 29 | and `proof-work/tasks/M64/derivations/2026-09-26-periodic-finite-collar.md`. -/ |
| 30 | theorem modulus_harmonic_equation_comp_affine |
| 31 | {g : RiemannianMetric n E} (D : LeviCivitaData g) |
| 32 | {B : E → E →L[ℝ] E →L[ℝ] ℝ} {u : LoopPlane → E} |
| 33 | {r : ℝ} (hr : 0 < r) (e : ℂ ≃L[ℝ] LoopPlane) (a : LoopPlane) (z : ℂ) |
| 34 | (he1 : e 1 = r • EuclideanSpace.basisFun (Fin 2) ℝ 0) |
| 35 | (heI : e I = EuclideanSpace.basisFun (Fin 2) ℝ 1 ∨ |
| 36 | e I = -EuclideanSpace.basisFun (Fin 2) ℝ 1) |
| 37 | (hu : ContDiffAt ℝ ∞ u (a + e z)) |
| 38 | (hB : g.euclideanCoefficients =ᶠ[𝓝 (u (a + e z))] B) |
| 39 | (heq : |
| 40 | r • covDerivAlong (christoffelBilinear B) u |
| 41 | (fun q => fderiv ℝ u q (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 42 | (EuclideanSpace.basisFun (Fin 2) ℝ 0) (a + e z) + |
| 43 | r⁻¹ • covDerivAlong (christoffelBilinear B) u |
| 44 | (fun q => fderiv ℝ u q (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 45 | (EuclideanSpace.basisFun (Fin 2) ℝ 1) (a + e z) = 0) : |
| 46 | let H := fun w => u (a + e w) |
| 47 | dbar (complexGradient H) z = harmonicMatrix D H z (complexGradient H z) := by |
| 48 | let H := fun w => u (a + e w) |
| 49 | let p := a + e z |
| 50 | let b0 := EuclideanSpace.basisFun (Fin 2) ℝ 0 |
| 51 | let b1 := EuclideanSpace.basisFun (Fin 2) ℝ 1 |
| 52 | have hP : HasFDerivAt (fun w => a + e w) e.toContinuousLinearMap z := |
| 53 | e.hasFDerivAt.const_add a |
| 54 | have hH : ContDiffAt ℝ ∞ H z := |
| 55 | hu.comp z (contDiffAt_const.add e.contDiff.contDiffAt) |
| 56 | have hcol (v : ℂ) : fderiv ℝ H z v = fderiv ℝ u p (e v) := |
| 57 | congrArg (fun L : ℂ →L[ℝ] E => L v) |
| 58 | ((hu.differentiableAt (by simp)).hasFDerivAt.comp z hP).fderiv |
| 59 | have hdd (v : LoopPlane) : |
| 60 | fderiv ℝ (fun q => fderiv ℝ u q v) (a + e z) v = |
| 61 | fderiv ℝ (fderiv ℝ u) (a + e z) v v := by |
| 62 | rw [fderiv_clm_apply ((hu.fderiv_right (m := ∞) (by simp)).differentiableAt |
| 63 | (by simp)) (differentiableAt_const v)] |
| 64 | simp |
| 65 | have hGamma := connectionCoefficient_eq_of_metric_germ D hB |
| 66 | have hv : |
| 67 | fderiv ℝ (fderiv ℝ H) z I I = fderiv ℝ (fderiv ℝ u) p b1 b1 := by |
| 68 | rw [fderiv2_comp_affine_equiv] |
| 69 | rcases heI with hi | hi <;> simp only [hi, map_neg, neg_apply, neg_neg, p, b1] |
| 70 | have hvGamma : |
| 71 | M65Gauss.connectionCoefficient D (H z) (fderiv ℝ H z I) (fderiv ℝ H z I) = |
| 72 | christoffelBilinear B (u p) (fderiv ℝ u p b1) (fderiv ℝ u p b1) := by |
| 73 | rw [hcol, hGamma] |
| 74 | rcases heI with hi | hi <;> simp only [hi, map_neg, neg_apply, neg_neg, p, b1] |
| 75 | have hweighted : |
| 76 | r • (fderiv ℝ (fderiv ℝ u) p b0 b0 + |
| 77 | christoffelBilinear B (u p) (fderiv ℝ u p b0) (fderiv ℝ u p b0)) + |
| 78 | r⁻¹ • (fderiv ℝ (fderiv ℝ u) p b1 b1 + |
| 79 | christoffelBilinear B (u p) (fderiv ℝ u p b1) (fderiv ℝ u p b1)) = 0 := by |
| 80 | simpa only [covDerivAlong_def, hdd, p, b0, b1] using heq |
| 81 | apply dbar_complexGradient_of_harmonic D hH |
| 82 | rw [hv, hvGamma, fderiv2_comp_affine_equiv, hcol, hGamma, he1] |
| 83 | simp only [map_smul, smul_apply, smul_smul] |
| 84 | have hh := congrArg (fun v : E => r • v) hweighted |
| 85 | simp only [smul_zero, smul_add, smul_smul, mul_inv_cancel₀ hr.ne', one_smul] at hh |
| 86 | convert! hh using 1 |
| 87 | module |
| 88 | |
| 89 | end PoincareMT.M64 |