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.Variation.SphereVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.Area.MinimalSphere.Variation.EnergyDerivative |
| 3 | import PoincareLib.Geometry.RicciFlow.Area.MinimalSphere.ChartEnergyFirstVariation |
| 4 | |
| 5 | /-! |
| 6 | # Energy stationarity gives vanishing coordinate test integrals |
| 7 | |
| 8 | Morgan-Tian Claim 18.12, printed pp. 426-427. The contract's stationarity |
| 9 | is applied to actual jointly smooth supported sphere variations. Their |
| 10 | actual energy derivative is the integral of the covariant first-variation |
| 11 | density, including every point outside the chosen target chart. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped Manifold ContDiff Topology BigOperators |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | open CoordinateExponential ConnectionVariation |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | |
| 29 | /-- Actual energy stationarity makes every smooth supported coordinate |
| 30 | first-variation integral vanish. Source: MT Claim 18.12, pp. 426-427. -/ |
| 31 | theorem m60EnergyStationary_test_integral_eq_zero (g : RiemannianMetric n M) |
| 32 | (f : UnitTwoSphere → M) (hf : ContMDiff (𝓡 2) (𝓡 n) ∞ f) |
| 33 | (hstat : M60EnergyStationary g f) (b : M) |
| 34 | (V : LoopPlane → EuclideanSpace ℝ (Fin n)) (hV : ContDiff ℝ ∞ V) |
| 35 | (hcompact : HasCompactSupport V) |
| 36 | (hsupport : tsupport V ⊆ (f ∘ m60SphereParameter) ⁻¹' (extChartAt (𝓡 n) b).source) : |
| 37 | let u := (extChartAt (𝓡 n) b) ∘ (f ∘ m60SphereParameter) |
| 38 | let B := g.pullbackCoefficients (extChartAt (𝓡 n) b).symm |
| 39 | (∫ z : LoopPlane, ∑ i : Fin 2, B (u z) |
| 40 | (covDerivAlong (christoffelBilinear B) u V (EuclideanSpace.basisFun (Fin 2) ℝ i) z) |
| 41 | (fderiv ℝ u z (EuclideanSpace.basisFun (Fin 2) ℝ i))) = 0 := by |
| 42 | let u := (extChartAt (𝓡 n) b) ∘ (f ∘ m60SphereParameter) |
| 43 | let B := g.pullbackCoefficients (extChartAt (𝓡 n) b).symm |
| 44 | let e := EuclideanSpace.basisFun (Fin 2) ℝ |
| 45 | let J := fun z => ∑ i : Fin 2, |
| 46 | B (u z) (covDerivAlong (christoffelBilinear B) u V (e i) z) (fderiv ℝ u z (e i)) |
| 47 | let v := m60SupportedSphereVariation b f V |
| 48 | obtain ⟨ε, hε, hv, hchart⟩ := m60SupportedSphereVariation_exists_interval b f hf V hV |
| 49 | hcompact (fun z hz => by |
| 50 | simpa only [extChartAt_source, mem_preimage, Function.comp_apply] using hsupport hz) |
| 51 | have hv0 : ∀ p, v (0, p) = f p := m60SupportedSphereVariation_zero b f V |
| 52 | have hfix (s : ℝ) (_hs : s ∈ Ioo (-ε) ε) (z : LoopPlane) (hz : z ∉ tsupport V) : |
| 53 | v (s, m60SphereParameter z) = v (0, m60SphereParameter z) := by |
| 54 | rw [hv0] |
| 55 | exact m60SupportedSphereVariation_eq_of_notMem_tsupport b f V s hz |
| 56 | let E := fun q : ℝ × LoopPlane => m60SphereEnergyDensity g (fun p => v (q.1, p)) q.2 |
| 57 | have hE : ContDiffOn ℝ ∞ E (Ioo (-ε) ε ×ˢ (univ : Set LoopPlane)) := |
| 58 | m60SphereEnergyDensity_family_contDiffOn g hv |
| 59 | have hzero : (0 : ℝ) ∈ Ioo (-ε) ε := ⟨by linarith, hε⟩ |
| 60 | have hcoord : ∀ s ∈ Ioo (-ε) ε, ∀ z : LoopPlane, |
| 61 | f (m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source → |
| 62 | v (s, m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source ∧ |
| 63 | extChartAt (𝓡 n) b (v (s, m60SphereParameter z)) = |
| 64 | extChartAt (𝓡 n) b (f (m60SphereParameter z)) + s • V z := by |
| 65 | simpa only [v, extChartAt_source, extChartAt_coe, modelWithCornersSelf_coe, |
| 66 | Function.id_comp] using hchart |
| 67 | have hpoint (z : LoopPlane) : |
| 68 | HasDerivAt (fun s => m60SphereEnergyDensity g (fun p => v (s, p)) z) (J z) 0 := by |
| 69 | by_cases hz : f (m60SphereParameter z) ∈ (extChartAt (𝓡 n) b).source |
| 70 | · exact m60SphereEnergyDensity_hasDerivAt_of_affine_chart g b f hf V hV hε hv hcoord z hz |
| 71 | · have hout : z ∉ tsupport V := fun hzV => hz (hsupport hzV) |
| 72 | have hJ : J z = 0 := by |
| 73 | simp only [J, covDerivAlong, image_eq_zero_of_notMem_tsupport hout, |
| 74 | fderiv_of_notMem_tsupport (𝕜 := ℝ) hout, zero_apply, |
| 75 | map_zero, add_zero, Finset.sum_const_zero] |
| 76 | rw [hJ] |
| 77 | apply (hasDerivAt_const (0 : ℝ) (m60SphereEnergyDensity g f z)).congr_of_eventuallyEq |
| 78 | apply Filter.Eventually.of_forall |
| 79 | intro s |
| 80 | apply m60EnergyDensity_congr_of_eventuallyEq g |
| 81 | filter_upwards [(isClosed_tsupport V).isOpen_compl.mem_nhds hout] with y hy |
| 82 | exact m60SupportedSphereVariation_eq_of_notMem_tsupport b f V s hy |
| 83 | have hderiv (z : LoopPlane) : fderiv ℝ E (0, z) (1, 0) = J z := by |
| 84 | have hEp : ContDiffAt ℝ ∞ E (0, z) := hE.contDiffAt |
| 85 | ((isOpen_Ioo.prod isOpen_univ).mem_nhds ⟨hzero, mem_univ z⟩) |
| 86 | have ht : HasDerivAt (fun s : ℝ => (s, z)) (1, 0) 0 := |
| 87 | (hasDerivAt_id (0 : ℝ)).prodMk (hasDerivAt_const (0 : ℝ) z) |
| 88 | exact ((hEp.differentiableAt (by simp)).hasFDerivAt.comp_hasDerivAt |
| 89 | (l := E) (f := fun s : ℝ => (s, z)) 0 ht).unique (hpoint z) |
| 90 | have htotal := m60SphereEnergy_hasDerivAt_of_supported_variation g (v := v) hε hv |
| 91 | hcompact hfix |
| 92 | have hzeroIntegral := htotal.2.unique (hstat ε hε v hv hv0) |
| 93 | change (∫ z : LoopPlane, J z) = 0 |
| 94 | calc |
| 95 | (∫ z : LoopPlane, J z) = ∫ z : LoopPlane, fderiv ℝ E (0, z) (1, 0) := by |
| 96 | apply integral_congr_ae |
| 97 | exact Filter.Eventually.of_forall (fun z => (hderiv z).symm) |
| 98 | _ = 0 := hzeroIntegral |
| 99 | |
| 100 | end PoincareMT |