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.Area.MinimalSphere.EnergyDensityCoordinates |
| 2 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Analysis.Coordinates.EnergyVariation |
| 3 | |
| 4 | /-! |
| 5 | # The pointwise energy variation in a target chart |
| 6 | |
| 7 | Morgan-Tian Claim 18.12, printed pp. 426-427. An actual sphere variation |
| 8 | with affine target coordinates has the covariant first-variation density. |
| 9 | Every derivative is taken on the actual chart domain, and the target |
| 10 | metric is fixed throughout the variation. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Topology BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | open CoordinateExponential ConnectionVariation ConjugateVariation |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | /-- Affine coordinates of an actual smooth sphere variation give the |
| 29 | covariant derivative of the frozen half-energy density. |
| 30 | Source: MT Claim 18.12, pp. 426-427, supported variation derivation. -/ |
| 31 | theorem m60SphereEnergyDensity_hasDerivAt_of_affine_chart |
| 32 | (g : RiemannianMetric n M) (b : M) (f : UnitTwoSphere → M) |
| 33 | (hf : ContMDiff (𝓡 2) (𝓡 n) ∞ f) |
| 34 | (V : LoopPlane → EuclideanSpace ℝ (Fin n)) (hV : ContDiff ℝ ∞ V) |
| 35 | {v : ℝ × UnitTwoSphere → M} {ε : ℝ} (hε : 0 < ε) |
| 36 | (hv : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v |
| 37 | (Ioo (-ε) ε ×ˢ (univ : Set UnitTwoSphere))) |
| 38 | (hcoord : ∀ s ∈ Ioo (-ε) ε, ∀ z : LoopPlane, |
| 39 | f (m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source → |
| 40 | v (s, m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source ∧ |
| 41 | extChartAt (𝓡 n) b (v (s, m60SphereParameter z)) = |
| 42 | extChartAt (𝓡 n) b (f (m60SphereParameter z)) + s • V z) |
| 43 | (z : LoopPlane) (hz : f (m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source) : |
| 44 | let u := (extChartAt (𝓡 n) b) ∘ (f ∘ m60SphereParameter) |
| 45 | let B := g.pullbackCoefficients (extChartAt (𝓡 n) b).symm |
| 46 | HasDerivAt (fun s => m60SphereEnergyDensity g (fun p => v (s, p)) z) |
| 47 | (∑ i : Fin 2, B (u z) |
| 48 | (covDerivAlong (christoffelBilinear B) u V (EuclideanSpace.basisFun (Fin 2) ℝ i) z) |
| 49 | (fderiv ℝ u z (EuclideanSpace.basisFun (Fin 2) ℝ i))) 0 := by |
| 50 | let φ := f ∘ m60SphereParameter |
| 51 | let c := extChartAt (𝓡 n) b |
| 52 | let u := c ∘ φ |
| 53 | let B := g.pullbackCoefficients c.symm |
| 54 | let e := EuclideanSpace.basisFun (Fin 2) ℝ |
| 55 | let O := φ ⁻¹' c.source |
| 56 | have hφ : ContMDiff (𝓡 2) (𝓡 n) ∞ φ := hf.comp m60SphereParameter_contMDiff |
| 57 | have hO : IsOpen O := (isOpen_extChartAt_source b).preimage hφ.continuous |
| 58 | have hu : ContDiffAt ℝ ∞ u z := contMDiffAt_iff_contDiffAt.mp |
| 59 | ((contMDiffAt_extChartAt' (n := ∞) |
| 60 | (by simpa only [extChartAt_source, φ, Function.comp_apply] using hz)).comp z (hφ z)) |
| 61 | have hB : DifferentiableAt ℝ B (u z) := |
| 62 | ((g.contDiffOn_chartCoefficients b).contDiffAt |
| 63 | ((isOpen_extChartAt_target b).mem_nhds (c.map_source hz))).differentiableAt (by simp) |
| 64 | have hterm (i : Fin 2) := M60.hasDerivAt_affine_coordinate_energy (u := u) (V := V) |
| 65 | z (e i) hB (isMetricCompatibleAt_chartCoefficients g b (c.map_source hz)) |
| 66 | (fun _ _ => g.symm _ _ _) (christoffelBilinear_chart_symm g b (u z)) |
| 67 | have hsum := HasDerivAt.fun_sum (u := Finset.univ) (fun i _ => hterm i) |
| 68 | apply hsum.congr_of_eventuallyEq |
| 69 | filter_upwards [isOpen_Ioo.mem_nhds (show (0 : ℝ) ∈ Ioo (-ε) ε from ⟨by linarith, hε⟩)] |
| 70 | with s hs |
| 71 | have hvPlane : ContMDiff (𝓡 2) (𝓡 n) ∞ (fun y => v (s, m60SphereParameter y)) := by |
| 72 | intro y |
| 73 | have hva : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v |
| 74 | (s, m60SphereParameter y) := hv.contMDiffAt |
| 75 | ((isOpen_Ioo.prod isOpen_univ).mem_nhds ⟨hs, mem_univ (m60SphereParameter y)⟩) |
| 76 | exact hva.comp y (contMDiffAt_const.prodMk (m60SphereParameter_contMDiff y)) |
| 77 | have heq : (fun y => c (v (s, m60SphereParameter y))) =ᶠ[𝓝 z] |
| 78 | (fun y => u y + s • V y) := by |
| 79 | filter_upwards [hO.mem_nhds hz] with y hy |
| 80 | exact (hcoord s hs y hy).2 |
| 81 | have hd : HasFDerivAt (fun y => u y + s • V y) |
| 82 | (fderiv ℝ u z + s • fderiv ℝ V z) z := |
| 83 | (hu.differentiableAt (by simp)).hasFDerivAt.add |
| 84 | ((hV.differentiable (by simp) z).hasFDerivAt.const_smul s) |
| 85 | change m60EnergyDensity g (fun y => v (s, m60SphereParameter y)) z = _ |
| 86 | rw [m60EnergyDensity_eq_chart g b |
| 87 | (hvPlane.mdifferentiable (by simp) z) (hcoord s hs z hz).1] |
| 88 | dsimp only [Function.comp_def] |
| 89 | rw [heq.fderiv_eq, hd.fderiv, (hcoord s hs z hz).2, Finset.mul_sum] |
| 90 | rfl |
| 91 | |
| 92 | end PoincareMT |