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.Plateau.Annulus.DensityCongruence |
| 2 | import PoincareLib.Geometry.RicciFlow.Area.MinimalSphere.EnergyDensityCoordinates |
| 3 | |
| 4 | /-! |
| 5 | # Actual annular energy density at a fixed positive modulus |
| 6 | |
| 7 | The weighted Gram density is expressed in genuine target coordinates. |
| 8 | For smooth families it is jointly smooth at every derivative rank. |
| 9 | These are the local calculus facts for modulus-weighted stationarity and |
| 10 | moving-metric variation; no normalization to modulus one is made. |
| 11 | |
| 12 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 13 | 447-449. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter MeasureTheory |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | |
| 29 | /-- The actual half-energy density for a fixed cylinder modulus. Source: Morgan--Tian |
| 30 | (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 31 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 32 | noncomputable def m64ModulusEnergyDensity (g : RiemannianMetric n M) (r : ℝ) |
| 33 | (f : LoopPlane → M) (p : LoopPlane) : ℝ := |
| 34 | (r * m60AreaGram g f p 0 0 + r⁻¹ * m60AreaGram g f p 1 1) / 2 |
| 35 | |
| 36 | /-- Equality of map germs identifies their genuine weighted energy densities at the base |
| 37 | point. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 38 | derivation |
| 39 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 40 | theorem m64ModulusEnergyDensity_congr_of_eventuallyEq |
| 41 | (g : RiemannianMetric n M) (r : ℝ) {f h : LoopPlane → M} {p : LoopPlane} |
| 42 | (heq : f =ᶠ[𝓝 p] h) : m64ModulusEnergyDensity g r f p = m64ModulusEnergyDensity g r h p := by |
| 43 | have hi (v w : EuclideanSpace ℝ (Fin n)) : g.inner (f p) v w = g.inner (h p) v w := |
| 44 | congrArg (fun q : M => g.inner q v w) heq.eq_of_nhds |
| 45 | simp only [m64ModulusEnergyDensity, m60AreaGram, heq.mfderiv_eq, hi] |
| 46 | rfl |
| 47 | |
| 48 | /-- Equality on the closed annulus rectangle identifies weighted densities almost everywhere |
| 49 | through equality of interior germs. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 50 | 19.16, pp. 447-449; project derivation |
| 51 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 52 | theorem m64ModulusEnergyDensity_ae_eq_of_eqOn |
| 53 | (g : RiemannianMetric n M) (r : ℝ) {f h : LoopPlane → M} |
| 54 | (heq : EqOn f h m64AnnulusDomain) : |
| 55 | m64ModulusEnergyDensity g r f =ᵐ[volume.restrict m64AnnulusDomain] |
| 56 | m64ModulusEnergyDensity g r h := by |
| 57 | rw [m64Annulus_restrict_closed_eq_interior] |
| 58 | filter_upwards [ae_restrict_mem isOpen_interior.measurableSet] with p hp |
| 59 | apply m64ModulusEnergyDensity_congr_of_eventuallyEq g r |
| 60 | filter_upwards [isOpen_interior.mem_nhds hp] with q hq |
| 61 | exact heq (interior_subset hq) |
| 62 | |
| 63 | /-- Inside a genuine target chart, the actual manifold Gram coefficient equals the |
| 64 | coordinate metric pairing of the differentiated map. Source: Morgan--Tian (2007), Lemma |
| 65 | 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 66 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 67 | theorem m64AreaGram_eq_chart (g : RiemannianMetric n M) (b : M) |
| 68 | {f : LoopPlane → M} {p : LoopPlane} |
| 69 | (hf : MDifferentiableAt (𝓡 2) (𝓡 n) f p) |
| 70 | (hp : f p ∈ (extChartAt (𝓡 n) b).source) (i j : Fin 2) : |
| 71 | m60AreaGram g f p i j = |
| 72 | g.pullbackCoefficients (extChartAt (𝓡 n) b).symm (extChartAt (𝓡 n) b (f p)) |
| 73 | (fderiv ℝ ((extChartAt (𝓡 n) b) ∘ f) p (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 74 | (fderiv ℝ ((extChartAt (𝓡 n) b) ∘ f) p (EuclideanSpace.basisFun (Fin 2) ℝ j)) := by |
| 75 | have hc : MDifferentiableAt (𝓡 n) (𝓡 n) (extChartAt (𝓡 n) b) (f p) := |
| 76 | (contMDiffAt_extChartAt' (n := ∞) |
| 77 | (by simpa only [extChartAt_source] using hp)).mdifferentiableAt (by simp) |
| 78 | have hd := mfderiv_comp p hc hf |
| 79 | rw [mfderiv_eq_fderiv] at hd |
| 80 | rw [hd] |
| 81 | exact (ConjugateVariation.chartCoefficients_apply g b hp _ _).symm |
| 82 | |
| 83 | /-- The actual spatial Gram entries of a differentiable family equal the corresponding two |
| 84 | coordinate-derivative columns. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, |
| 85 | pp. 447-449; project derivation |
| 86 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 87 | theorem m64AreaGram_family_eq_chart (g : RiemannianMetric n M) (b : M) |
| 88 | {v : ℝ × LoopPlane → M} {p : ℝ × LoopPlane} |
| 89 | (hv : MDifferentiableAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) v p) |
| 90 | (hp : v p ∈ (extChartAt (𝓡 n) b).source) (i j : Fin 2) : |
| 91 | m60AreaGram g (fun z => v (p.1, z)) p.2 i j = |
| 92 | g.pullbackCoefficients (extChartAt (𝓡 n) b).symm (extChartAt (𝓡 n) b (v p)) |
| 93 | (fderiv ℝ ((extChartAt (𝓡 n) b) ∘ v) p (0, EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 94 | (fderiv ℝ ((extChartAt (𝓡 n) b) ∘ v) p (0, EuclideanSpace.basisFun (Fin 2) ℝ j)) := by |
| 95 | have hi : MDifferentiableAt (𝓡 2) 𝓘(ℝ, ℝ × LoopPlane) (fun z => (p.1, z)) p.2 := |
| 96 | (hasFDerivAt_prodMk_right (𝕜 := ℝ) p.1 p.2).differentiableAt.mdifferentiableAt |
| 97 | have hslice : MDifferentiableAt (𝓡 2) (𝓡 n) (fun z => v (p.1, z)) p.2 := |
| 98 | hv.comp p.2 hi |
| 99 | rw [m64AreaGram_eq_chart g b hslice hp] |
| 100 | have hc : MDifferentiableAt (𝓡 n) (𝓡 n) (extChartAt (𝓡 n) b) (v p) := |
| 101 | (contMDiffAt_extChartAt' (n := ∞) |
| 102 | (by simpa only [extChartAt_source] using hp)).mdifferentiableAt (by simp) |
| 103 | have hu : DifferentiableAt ℝ ((extChartAt (𝓡 n) b) ∘ v) p := |
| 104 | (hc.comp p hv).differentiableAt |
| 105 | have hd : HasFDerivAt (fun z => extChartAt (𝓡 n) b (v (p.1, z))) |
| 106 | ((fderiv ℝ ((extChartAt (𝓡 n) b) ∘ v) p).comp |
| 107 | (ContinuousLinearMap.inr ℝ ℝ LoopPlane)) p.2 := |
| 108 | HasFDerivAt.comp p.2 (f := fun z : LoopPlane => (p.1, z)) |
| 109 | (g := (extChartAt (𝓡 n) b) ∘ v) hu.hasFDerivAt |
| 110 | (hasFDerivAt_prodMk_right (𝕜 := ℝ) p.1 p.2) |
| 111 | dsimp only [Function.comp_def] at hd ⊢ |
| 112 | rw [hd.fderiv] |
| 113 | rfl |
| 114 | |
| 115 | /-- Every actual Gram entry of a smooth family is jointly smooth, including points of |
| 116 | deficient rank. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 117 | project derivation |
| 118 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 119 | theorem m64AreaGram_family_contDiffAt (g : RiemannianMetric n M) |
| 120 | {v : ℝ × LoopPlane → M} {p : ℝ × LoopPlane} |
| 121 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v p) (i j : Fin 2) : |
| 122 | ContDiffAt ℝ ∞ (fun q : ℝ × LoopPlane => m60AreaGram g (fun z => v (q.1, z)) q.2 i j) p := by |
| 123 | let b := v p |
| 124 | let c := extChartAt (𝓡 n) b |
| 125 | let u := c ∘ v |
| 126 | let B := g.pullbackCoefficients c.symm |
| 127 | have hc : ContMDiffAt (𝓡 n) (𝓡 n) ∞ c (v p) := contMDiffAt_extChartAt |
| 128 | have hu : ContDiffAt ℝ ∞ u p := contMDiffAt_iff_contDiffAt.mp (hc.comp p hv) |
| 129 | have hB : ContDiffAt ℝ ∞ B (u p) := |
| 130 | (g.contDiffOn_chartCoefficients b).contDiffAt |
| 131 | ((isOpen_extChartAt_target b).mem_nhds (c.map_source (mem_extChartAt_source b))) |
| 132 | have hdu (k : Fin 2) : ContDiffAt ℝ ∞ |
| 133 | (fun q => fderiv ℝ u q (0, EuclideanSpace.basisFun (Fin 2) ℝ k)) p := |
| 134 | (hu.fderiv_right (m := ∞) (by simp)).clm_apply contDiffAt_const |
| 135 | have hformula := ((hB.comp p hu).clm_apply (hdu i)).clm_apply (hdu j) |
| 136 | apply hformula.congr_of_eventuallyEq |
| 137 | have hchart : ∀ᶠ q in 𝓝 p, v q ∈ c.source := |
| 138 | hv.continuousAt.preimage_mem_nhds |
| 139 | ((isOpen_extChartAt_source b).mem_nhds (mem_extChartAt_source b)) |
| 140 | have hnear : ∀ᶠ q in 𝓝 p, ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) 1 v q := |
| 141 | (contMDiffAt_iff_contMDiffAt_nhds (by simp)).mp (hv.of_le (by simp)) |
| 142 | filter_upwards [hchart, hnear] with q hq hvq |
| 143 | exact m64AreaGram_family_eq_chart g b (hvq.mdifferentiableAt one_ne_zero) hq i j |
| 144 | |
| 145 | /-- The actual weighted Gram energy of a smooth family is jointly smooth for each fixed real |
| 146 | modulus. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 147 | derivation |
| 148 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 149 | theorem m64ModulusEnergyDensity_family_contDiffAt (g : RiemannianMetric n M) (r : ℝ) |
| 150 | {v : ℝ × LoopPlane → M} {p : ℝ × LoopPlane} |
| 151 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v p) : |
| 152 | ContDiffAt ℝ ∞ (fun q : ℝ × LoopPlane => |
| 153 | m64ModulusEnergyDensity g r (fun z => v (q.1, z)) q.2) p := by |
| 154 | exact ((contDiffAt_const.mul (m64AreaGram_family_contDiffAt g hv 0 0)).add |
| 155 | (contDiffAt_const.mul (m64AreaGram_family_contDiffAt g hv 1 1))).div_const 2 |
| 156 | |
| 157 | end PoincareMT |