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.Compact.SupportIntegralDerivative |
| 3 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Integrability |
| 4 | |
| 5 | /-! |
| 6 | # Differentiating the actual energy of supported sphere variations |
| 7 | |
| 8 | Morgan-Tian Claim 18.12, printed pp. 426-427, first-variation derivation. |
| 9 | The density difference has a common compact plane support. Its actual |
| 10 | time derivative can therefore be integrated. The original sphere energy |
| 11 | is integrable independently by the established C1 sphere estimate. |
| 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 |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | /-- The actual frozen plane energy density is jointly smooth on every |
| 28 | smooth variation interval. Source: MT Claim 18.12, pp. 426-427. -/ |
| 29 | theorem m60SphereEnergyDensity_family_contDiffOn (g : RiemannianMetric n M) |
| 30 | {v : ℝ × UnitTwoSphere → M} {ε : ℝ} |
| 31 | (hv : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v |
| 32 | (Ioo (-ε) ε ×ˢ (univ : Set UnitTwoSphere))) : |
| 33 | ContDiffOn ℝ ∞ (fun q : ℝ × LoopPlane => |
| 34 | m60SphereEnergyDensity g (fun p => v (q.1, p)) q.2) |
| 35 | (Ioo (-ε) ε ×ˢ (univ : Set LoopPlane)) := by |
| 36 | have hfst : ContMDiff 𝓘(ℝ, ℝ × LoopPlane) 𝓘(ℝ, ℝ) ∞ |
| 37 | (Prod.fst : ℝ × LoopPlane → ℝ) := contDiff_fst.contMDiff |
| 38 | have hsnd : ContMDiff 𝓘(ℝ, ℝ × LoopPlane) (𝓡 2) ∞ |
| 39 | (Prod.snd : ℝ × LoopPlane → LoopPlane) := contDiff_snd.contMDiff |
| 40 | have hparam := hfst.prodMk (m60SphereParameter_contMDiff.comp hsnd) |
| 41 | intro q hq |
| 42 | have hvq : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v |
| 43 | (q.1, m60SphereParameter q.2) := hv.contMDiffAt |
| 44 | ((isOpen_Ioo.prod isOpen_univ).mem_nhds ⟨hq.1, mem_univ (m60SphereParameter q.2)⟩) |
| 45 | exact (m60EnergyDensity_family_contDiffAt g (hvq.comp q (hparam q))).contDiffWithinAt |
| 46 | |
| 47 | /-- The energy of a smooth sphere variation which is fixed outside one |
| 48 | compact parameter-plane set has the integral of its actual density time |
| 49 | derivative as derivative. Source: MT Claim 18.12, pp. 426-427. -/ |
| 50 | theorem m60SphereEnergy_hasDerivAt_of_supported_variation (g : RiemannianMetric n M) |
| 51 | {v : ℝ × UnitTwoSphere → M} {ε : ℝ} (hε : 0 < ε) |
| 52 | (hv : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v |
| 53 | (Ioo (-ε) ε ×ˢ (univ : Set UnitTwoSphere))) |
| 54 | {K : Set LoopPlane} (hK : IsCompact K) |
| 55 | (hfix : ∀ s ∈ Ioo (-ε) ε, ∀ z ∉ K, |
| 56 | v (s, m60SphereParameter z) = v (0, m60SphereParameter z)) : |
| 57 | let E := fun q : ℝ × LoopPlane => m60SphereEnergyDensity g (fun p => v (q.1, p)) q.2 |
| 58 | Integrable (fun z => fderiv ℝ E (0, z) (1, 0)) volume ∧ |
| 59 | HasDerivAt (fun s => m60SphereEnergy g (fun p => v (s, p))) |
| 60 | (∫ z : LoopPlane, fderiv ℝ E (0, z) (1, 0)) 0 := by |
| 61 | let E := fun q : ℝ × LoopPlane => m60SphereEnergyDensity g (fun p => v (q.1, p)) q.2 |
| 62 | let G := fun s z => fderiv ℝ E (s, z) (1, 0) |
| 63 | have hzero : (0 : ℝ) ∈ Ioo (-ε) ε := ⟨by linarith, hε⟩ |
| 64 | have hO : IsOpen (Ioo (-ε) ε ×ˢ (univ : Set LoopPlane)) := isOpen_Ioo.prod isOpen_univ |
| 65 | have hE : ContDiffOn ℝ ∞ E (Ioo (-ε) ε ×ˢ (univ : Set LoopPlane)) := |
| 66 | m60SphereEnergyDensity_family_contDiffOn g hv |
| 67 | have hEs (s : ℝ) (hs : s ∈ Ioo (-ε) ε) : Continuous (fun z => E (s, z)) := |
| 68 | hE.continuousOn.comp_continuous (continuous_const.prodMk continuous_id) |
| 69 | (fun z => ⟨hs, mem_univ z⟩) |
| 70 | have hG : ContinuousOn (Function.uncurry G) (Ioo (-ε) ε ×ˢ (univ : Set LoopPlane)) := |
| 71 | ((hE.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply contDiffOn_const).continuousOn |
| 72 | have hdiff (s : ℝ) (hs : s ∈ Ioo (-ε) ε) (z : LoopPlane) : |
| 73 | HasDerivAt (fun t => E (t, z) - E (0, z)) (G s z) s := by |
| 74 | have hEp : ContDiffAt ℝ ∞ E (s, z) := hE.contDiffAt (hO.mem_nhds ⟨hs, mem_univ z⟩) |
| 75 | have hd := hEp.differentiableAt (by simp) |
| 76 | have ht : HasDerivAt (fun t : ℝ => (t, z)) (1, 0) s := |
| 77 | (hasDerivAt_id s).prodMk (hasDerivAt_const s z) |
| 78 | exact (hd.hasFDerivAt.comp_hasDerivAt (l := E) (f := fun t : ℝ => (t, z)) s ht).sub_const _ |
| 79 | have hsupp (s : ℝ) (hs : s ∈ Ioo (-ε) ε) (z : LoopPlane) (hz : z ∉ K) : |
| 80 | E (s, z) - E (0, z) = 0 := by |
| 81 | apply sub_eq_zero.mpr |
| 82 | apply m60EnergyDensity_congr_of_eventuallyEq g |
| 83 | filter_upwards [hK.isClosed.isOpen_compl.mem_nhds hz] with y hy |
| 84 | exact hfix s hs y hy |
| 85 | obtain ⟨hGint, hd⟩ := M60.hasDerivAt_integral_of_common_compact_support |
| 86 | (μ := volume) (F := fun s z => E (s, z) - E (0, z)) (F' := G) hK hε |
| 87 | (fun s hs => (hEs s hs).sub (hEs 0 hzero)) hG hdiff hsupp |
| 88 | refine ⟨hGint, ?_⟩ |
| 89 | have hvSlice (s : ℝ) (hs : s ∈ Ioo (-ε) ε) : |
| 90 | ContMDiff (𝓡 2) (𝓡 n) ∞ (fun p => v (s, p)) := by |
| 91 | have hi : ContMDiff (𝓡 2) ((𝓘(ℝ, ℝ)).prod (𝓡 2)) ∞ |
| 92 | (fun p : UnitTwoSphere => (s, p)) := contMDiff_const.prodMk contMDiff_id |
| 93 | intro p |
| 94 | have hvp : ContMDiffAt ((𝓘(ℝ, ℝ)).prod (𝓡 2)) (𝓡 n) ∞ v (s, p) := hv.contMDiffAt |
| 95 | ((isOpen_Ioo.prod isOpen_univ).mem_nhds ⟨hs, mem_univ p⟩) |
| 96 | exact hvp.comp p (hi p) |
| 97 | have hEi (s : ℝ) (hs : s ∈ Ioo (-ε) ε) : Integrable (fun z => E (s, z)) volume := by |
| 98 | change Integrable (m60SphereEnergyDensity g (fun p : UnitTwoSphere => v (s, p))) volume |
| 99 | exact m60SphereEnergyDensity_integrable g (fun p : UnitTwoSphere => v (s, p)) |
| 100 | ((hvSlice s hs).of_le (by simp)) |
| 101 | apply (hd.add_const (m60SphereEnergy g (fun p => v (0, p)))).congr_of_eventuallyEq |
| 102 | filter_upwards [isOpen_Ioo.mem_nhds hzero] with s hs |
| 103 | dsimp only [m60SphereEnergy] |
| 104 | rw [integral_sub (hEi s hs) (hEi 0 hzero)] |
| 105 | change (∫ z : LoopPlane, E (s, z)) = (∫ z : LoopPlane, E (s, z)) - |
| 106 | (∫ z : LoopPlane, E (0, z)) + ∫ z : LoopPlane, E (0, z) |
| 107 | ring |
| 108 | |
| 109 | end PoincareMT |