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.AnnularEvolution.Modulus.EnergyDensity |
| 2 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Analysis.Coordinates.EnergyVariation |
| 3 | |
| 4 | /-! |
| 5 | # Actual coordinate variation at arbitrary fixed modulus |
| 6 | |
| 7 | The genuine weighted Gram density differentiates to the correspondingly |
| 8 | weighted covariant pairing. The calculation works at rank zero and does |
| 9 | not replace the modulus by one. |
| 10 | |
| 11 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 12 | 447-449. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | open CoordinateExponential ConnectionVariation ConjugateVariation |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | |
| 30 | /-- The true pointwise derivative of an affine supported target-chart variation, for the |
| 31 | actual modulus-weighted energy density. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 32 | Corollary 19.16, pp. 447-449; project derivation |
| 33 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 34 | theorem m64ModulusEnergyDensity_hasDerivAt_of_affine_chart |
| 35 | (g : RiemannianMetric n M) (r : ℝ) (b : M) (f : LoopPlane → M) |
| 36 | {U : Set LoopPlane} (hU : IsOpen U) |
| 37 | (hf : ContMDiffOn (𝓡 2) (𝓡 n) ∞ f U) |
| 38 | (hfU : MapsTo f U (extChartAt (𝓡 n) b).source) |
| 39 | (V : LoopPlane → EuclideanSpace ℝ (Fin n)) (hV : ContDiff ℝ ∞ V) |
| 40 | {v : ℝ × LoopPlane → M} {epsilon : ℝ} (hepsilon : 0 < epsilon) |
| 41 | (hv : ContMDiffOn 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v |
| 42 | (Ioo (-epsilon) epsilon ×ˢ U)) |
| 43 | (hcoord : ∀ s ∈ Ioo (-epsilon) epsilon, ∀ z ∈ U, |
| 44 | v (s, z) ∈ (extChartAt (𝓡 n) b).source ∧ |
| 45 | extChartAt (𝓡 n) b (v (s, z)) = |
| 46 | extChartAt (𝓡 n) b (f z) + s • V z) |
| 47 | (z : LoopPlane) (hz : z ∈ U) : |
| 48 | let u := (extChartAt (𝓡 n) b) ∘ f |
| 49 | let B := g.pullbackCoefficients (extChartAt (𝓡 n) b).symm |
| 50 | let e := EuclideanSpace.basisFun (Fin 2) ℝ |
| 51 | HasDerivAt (fun s => m64ModulusEnergyDensity g r (fun p => v (s, p)) z) |
| 52 | (r * B (u z) (covDerivAlong (christoffelBilinear B) u V (e 0) z) |
| 53 | (fderiv ℝ u z (e 0)) + |
| 54 | r⁻¹ * B (u z) (covDerivAlong (christoffelBilinear B) u V (e 1) z) |
| 55 | (fderiv ℝ u z (e 1))) 0 := by |
| 56 | let c := extChartAt (𝓡 n) b |
| 57 | let u := c ∘ f |
| 58 | let B := g.pullbackCoefficients c.symm |
| 59 | let e := EuclideanSpace.basisFun (Fin 2) ℝ |
| 60 | have hu : ContDiffAt ℝ ∞ u z := contMDiffAt_iff_contDiffAt.mp |
| 61 | ((contMDiffAt_extChartAt' (n := ∞) |
| 62 | (by simpa only [extChartAt_source] using hfU hz)).comp z |
| 63 | (hf.contMDiffAt (hU.mem_nhds hz))) |
| 64 | have hB : DifferentiableAt ℝ B (u z) := |
| 65 | ((g.contDiffOn_chartCoefficients b).contDiffAt |
| 66 | ((isOpen_extChartAt_target b).mem_nhds (c.map_source (hfU hz)))).differentiableAt |
| 67 | (by simp) |
| 68 | have hterm (i : Fin 2) := M60.hasDerivAt_affine_coordinate_energy (u := u) (V := V) |
| 69 | z (e i) hB (isMetricCompatibleAt_chartCoefficients g b (c.map_source (hfU hz))) |
| 70 | (fun _ _ => g.symm _ _ _) (christoffelBilinear_chart_symm g b (u z)) |
| 71 | apply (((hterm 0).const_mul r).add ((hterm 1).const_mul r⁻¹)).congr_of_eventuallyEq |
| 72 | filter_upwards [isOpen_Ioo.mem_nhds |
| 73 | (show (0 : ℝ) ∈ Ioo (-epsilon) epsilon from ⟨by linarith, hepsilon⟩)] with s hs |
| 74 | have hvPlane : ContMDiffAt (𝓡 2) (𝓡 n) ∞ (fun p => v (s, p)) z := |
| 75 | (hv.contMDiffAt ((isOpen_Ioo.prod hU).mem_nhds ⟨hs, hz⟩)).comp z |
| 76 | (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffAt |
| 77 | have heq : (fun p => c (v (s, p))) =ᶠ[𝓝 z] (fun p => u p + s • V p) := by |
| 78 | filter_upwards [hU.mem_nhds hz] with p hp |
| 79 | exact (hcoord s hs p hp).2 |
| 80 | have hd : HasFDerivAt (fun p => u p + s • V p) |
| 81 | (fderiv ℝ u z + s • fderiv ℝ V z) z := |
| 82 | (hu.differentiableAt (by simp)).hasFDerivAt.add |
| 83 | ((hV.differentiable (by simp) z).hasFDerivAt.const_smul s) |
| 84 | unfold m64ModulusEnergyDensity |
| 85 | rw [m64AreaGram_eq_chart g b (hvPlane.mdifferentiableAt (by simp)) |
| 86 | (hcoord s hs z hz).1 0 0, |
| 87 | m64AreaGram_eq_chart g b (hvPlane.mdifferentiableAt (by simp)) |
| 88 | (hcoord s hs z hz).1 1 1] |
| 89 | dsimp only [Function.comp_def] |
| 90 | rw [heq.fderiv_eq, hd.fderiv, (hcoord s hs z hz).2] |
| 91 | simp only [add_apply, smul_apply, u, B, e, c, Pi.add_apply, Function.comp_apply] |
| 92 | ring |
| 93 | |
| 94 | end PoincareMT |