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.MinimalLogCurvature |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Annulus.LogBoundaryLimit |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Plateau.Free.UniformizationEnergy |
| 4 | |
| 5 | /-! |
| 6 | # Weighted annular logarithmic boundary curvature |
| 7 | |
| 8 | The actual weighted curvature inequality integrates over the rectangle. |
| 9 | Literal map periodicity cancels the seam. Positive boundary energy permits |
| 10 | the regularization limit, while all interior branch points remain allowed. |
| 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 | {g : RiemannianMetric n M} {c0 c1 : ℝ → M} |
| 29 | |
| 30 | private theorem modulus_annulus_map_periodic_add (A : M64Annulus g c0 c1) |
| 31 | (p : LoopPlane) : A.map (annulusPoint curvePeriod 0 + p) = A.map p := by |
| 32 | have hp : annulusPoint (p 0) (p 1) = p := by |
| 33 | ext i |
| 34 | fin_cases i <;> simp [annulusPoint] |
| 35 | have hshift : annulusPoint curvePeriod 0 + p = |
| 36 | annulusPoint (p 0 + curvePeriod) (p 1) := by |
| 37 | ext i |
| 38 | fin_cases i <;> simp [annulusPoint, add_comm] |
| 39 | rw [hshift, A.periodic, hp] |
| 40 | |
| 41 | private theorem modulus_energy_periodic (A : M64Annulus g c0 c1) (r : ℝ) |
| 42 | (p : LoopPlane) |
| 43 | (hp : MDifferentiableAt (𝓡 2) (𝓡 n) A.map (annulusPoint curvePeriod 0 + p)) : |
| 44 | m64ModulusEnergyDensity g r A.map (annulusPoint curvePeriod 0 + p) = |
| 45 | m64ModulusEnergyDensity g r A.map p := by |
| 46 | let T : LoopPlane := annulusPoint curvePeriod 0 |
| 47 | have hshift : HasFDerivAt (fun q : LoopPlane => T + q) |
| 48 | (ContinuousLinearMap.id ℝ LoopPlane) p := (hasFDerivAt_id p).const_add T |
| 49 | have hfun : (A.map ∘ fun q : LoopPlane => T + q) = A.map := |
| 50 | funext (modulus_annulus_map_periodic_add A) |
| 51 | have hmd : MDifferentiableAt (𝓡 2) (𝓡 2) (fun q : LoopPlane => T + q) p := |
| 52 | hshift.differentiableAt.mdifferentiableAt |
| 53 | have hd := mfderiv_comp (I := 𝓡 2) (I' := 𝓡 2) (I'' := 𝓡 n) p hp hmd |
| 54 | have hT : mfderiv (𝓡 2) (𝓡 2) (fun q : LoopPlane => T + q) p = |
| 55 | ContinuousLinearMap.id ℝ LoopPlane := by |
| 56 | rw [mfderiv_eq_fderiv] |
| 57 | exact hshift.fderiv |
| 58 | rw [hfun, hT] at hd |
| 59 | have hd' : mfderiv (𝓡 2) (𝓡 n) A.map p = |
| 60 | mfderiv (𝓡 2) (𝓡 n) A.map (T + p) := by |
| 61 | simpa only [ContinuousLinearMap.comp_id] using! hd |
| 62 | have heq : m60AreaGram g A.map (T + p) = m60AreaGram g A.map p := by |
| 63 | ext i j |
| 64 | simp only [m60AreaGram, ← hd'] |
| 65 | exact congrArg (fun x : M => g.inner x |
| 66 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 67 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.basisFun (Fin 2) ℝ j))) |
| 68 | (modulus_annulus_map_periodic_add A p) |
| 69 | exact congrArg (fun B : Matrix (Fin 2) (Fin 2) ℝ => |
| 70 | (r * B 0 0 + r⁻¹ * B 1 1) / 2) heq |
| 71 | |
| 72 | private theorem modulus_energy_transform_fderiv_periodic |
| 73 | (A : M64Annulus g c0 c1) (r : ℝ) (Phi : ℝ → ℝ) (p : LoopPlane) |
| 74 | (hp : ContMDiffAt (𝓡 2) (𝓡 n) ∞ A.map (annulusPoint curvePeriod 0 + p)) : |
| 75 | fderiv ℝ (fun q => Phi (m64ModulusEnergyDensity g r A.map q)) |
| 76 | (annulusPoint curvePeriod 0 + p) = |
| 77 | fderiv ℝ (fun q => Phi (m64ModulusEnergyDensity g r A.map q)) p := by |
| 78 | let T : LoopPlane := annulusPoint curvePeriod 0 |
| 79 | have hnear : ∀ᶠ q in 𝓝 (T + p), ContMDiffAt (𝓡 2) (𝓡 n) 1 A.map q := |
| 80 | (contMDiffAt_iff_contMDiffAt_nhds (by simp)).mp (hp.of_le (by simp)) |
| 81 | have htrans : Tendsto (fun q : LoopPlane => T + q) (𝓝 p) (𝓝 (T + p)) := |
| 82 | (continuous_const.add continuous_id).continuousAt.tendsto |
| 83 | have heq : (fun q => Phi (m64ModulusEnergyDensity g r A.map (T + q))) =ᶠ[𝓝 p] |
| 84 | fun q => Phi (m64ModulusEnergyDensity g r A.map q) := by |
| 85 | filter_upwards [htrans.eventually hnear] with q hq |
| 86 | exact congrArg Phi (modulus_energy_periodic A r q (hq.mdifferentiableAt one_ne_zero)) |
| 87 | have hd := heq.fderiv_eq (𝕜 := ℝ) |
| 88 | rw [fderiv_comp_add_left (f := fun q => Phi (m64ModulusEnergyDensity g r A.map q)) T] at hd |
| 89 | exact hd |
| 90 | |
| 91 | /-- Literal annular periodicity transports the derivative of every scalar transform of the |
| 92 | genuine weighted density at smooth strip points. Source: Morgan--Tian (2007), Lemma 19.15 |
| 93 | and Corollary 19.16, pp. 447-449; project derivation |
| 94 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 95 | theorem m64Annulus_modulusEnergy_fderiv_periodic |
| 96 | (A : M64Annulus g c0 c1) (r : ℝ) (Phi : ℝ → ℝ) (p : LoopPlane) |
| 97 | (hp : ContMDiffAt (𝓡 2) (𝓡 n) ∞ A.map (annulusPoint curvePeriod 0 + p)) : |
| 98 | fderiv ℝ (fun q => Phi (m64ModulusEnergyDensity g r A.map q)) |
| 99 | (annulusPoint curvePeriod 0 + p) = |
| 100 | fderiv ℝ (fun q => Phi (m64ModulusEnergyDensity g r A.map q)) p := |
| 101 | modulus_energy_transform_fderiv_periodic A r Phi p hp |
| 102 | |
| 103 | variable [T2Space M] [CompactSpace M] |
| 104 | |
| 105 | /-- The actual weighted logarithmic curvature inequality integrates to the two radial traces |
| 106 | after literal periodic seam cancellation. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 107 | Corollary 19.16, pp. 447-449; project derivation |
| 108 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 109 | theorem m64Annulus_modulus_log_energy_boundary_lower_bound |
| 110 | (D : LeviCivitaData g) (A : M64Annulus g c0 c1) {r : ℝ} (hr : 0 < r) |
| 111 | (hminimum : A.area = m64LeastAnnulusArea g c0 c1) |
| 112 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 113 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 114 | m60AreaGram g A.map p 0 1 = 0) |
| 115 | {O : Set LoopPlane} (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 116 | (hA : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map O) |
| 117 | {K ε : ℝ} (hK : 0 ≤ K) (hε : 0 < ε) |
| 118 | (hsec : ∀ p ∈ m64AnnulusInterior, D.sectionalCurvature (A.map p) |
| 119 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.single (0 : Fin 2) 1)) |
| 120 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.single (1 : Fin 2) 1)) ≤ K) : |
| 121 | -2 * K * A.area ≤ r⁻¹ * ∫ x in Icc (0 : ℝ) curvePeriod, |
| 122 | fderiv ℝ (fun q => Real.log (m64ModulusEnergyDensity g r A.map q + ε)) |
| 123 | (annulusPoint x 1) (EuclideanSpace.single (1 : Fin 2) 1) - |
| 124 | fderiv ℝ (fun q => Real.log (m64ModulusEnergyDensity g r A.map q + ε)) |
| 125 | (annulusPoint x 0) (EuclideanSpace.single (1 : Fin 2) 1) := by |
| 126 | let E := m64ModulusEnergyDensity g r A.map |
| 127 | let L := fun q => Real.log (E q + ε) |
| 128 | let b0 : LoopPlane := EuclideanSpace.single (0 : Fin 2) 1 |
| 129 | let b1 : LoopPlane := EuclideanSpace.single (1 : Fin 2) 1 |
| 130 | have hE : ContDiffOn ℝ ∞ E O := m64ModulusEnergyDensity_contDiffOn r hO hA |
| 131 | have hL : ContDiffOn ℝ ∞ L O := by |
| 132 | intro p hp |
| 133 | exact (((hE.contDiffAt (hO.mem_nhds hp)).add contDiffAt_const).log |
| 134 | (add_pos_of_nonneg_of_pos |
| 135 | (m64ModulusEnergyDensity_nonneg r hr.le A.map p) hε).ne').contDiffWithinAt |
| 136 | have hD (b : LoopPlane) : ContDiffOn ℝ ∞ (fun q => fderiv ℝ L q b) O := |
| 137 | (hL.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply contDiffOn_const |
| 138 | have hDD (b : LoopPlane) : IntegrableOn |
| 139 | (fun p => fderiv ℝ (fun q => fderiv ℝ L q b) p b) m64AnnulusDomain volume := |
| 140 | (((hD b).fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply |
| 141 | contDiffOn_const).continuousOn.mono hdom |
| 142 | |>.integrableOn_compact m64AnnulusDomain_isCompact |
| 143 | have hEI : IntegrableOn E m64AnnulusDomain volume := |
| 144 | (hE.continuousOn.mono hdom).integrableOn_compact m64AnnulusDomain_isCompact |
| 145 | have hI : m64AnnulusInterior ⊆ O := m64AnnulusInterior_subset_domain.trans hdom |
| 146 | have hmem : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, p ∈ m64AnnulusInterior := by |
| 147 | rw [Measure.restrict_congr_set m64AnnulusDomain_ae_eq_interior] |
| 148 | exact ae_restrict_mem isOpen_m64AnnulusInterior.measurableSet |
| 149 | have hbound : (∫ p in m64AnnulusDomain, -2 * K * E p) ≤ |
| 150 | ∫ p in m64AnnulusDomain, |
| 151 | r * fderiv ℝ (fun q => fderiv ℝ L q b0) p b0 + |
| 152 | r⁻¹ * fderiv ℝ (fun q => fderiv ℝ L q b1) p b1 := by |
| 153 | apply integral_mono_ae (hEI.const_mul (-2 * K)) |
| 154 | (((hDD b0).const_mul r).add ((hDD b1).const_mul r⁻¹)) |
| 155 | filter_upwards [hmem] with p hp |
| 156 | exact m64Annulus_modulus_log_energy_laplacian_lower_bound |
| 157 | D A hr hminimum hconformal (hA.mono hI) hp hK hε (hsec p hp) |
| 158 | have hseam (s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : |
| 159 | fderiv ℝ L (annulusPoint curvePeriod s) b0 = fderiv ℝ L (annulusPoint 0 s) b0 := by |
| 160 | have hshift : annulusPoint curvePeriod 0 + annulusPoint 0 s = |
| 161 | annulusPoint curvePeriod s := by |
| 162 | ext i |
| 163 | fin_cases i <;> simp [annulusPoint] |
| 164 | have hp : annulusPoint curvePeriod s ∈ m64AnnulusDomain := by |
| 165 | change 0 ≤ curvePeriod ∧ curvePeriod ≤ curvePeriod ∧ 0 ≤ s ∧ s ≤ 1 |
| 166 | exact ⟨by unfold curvePeriod; positivity, le_rfl, hs⟩ |
| 167 | have hperiod := modulus_energy_transform_fderiv_periodic A r |
| 168 | (fun v => Real.log (v + ε)) (annulusPoint 0 s) |
| 169 | (by rw [hshift]; exact hA.contMDiffAt (hO.mem_nhds (hdom hp))) |
| 170 | rw [hshift] at hperiod |
| 171 | exact congrArg (fun T : LoopPlane →L[ℝ] ℝ => T b0) hperiod |
| 172 | have hboundary : (∫ p in m64AnnulusDomain, |
| 173 | r * fderiv ℝ (fun q => fderiv ℝ L q b0) p b0 + |
| 174 | r⁻¹ * fderiv ℝ (fun q => fderiv ℝ L q b1) p b1) = |
| 175 | r⁻¹ * ∫ x in Icc (0 : ℝ) curvePeriod, |
| 176 | fderiv ℝ L (annulusPoint x 1) b1 - fderiv ℝ L (annulusPoint x 0) b1 := by |
| 177 | rw [integral_add ((hDD b0).const_mul r) ((hDD b1).const_mul r⁻¹), |
| 178 | integral_const_mul, integral_const_mul, m64Annulus_restrict_closed_eq_interior, |
| 179 | m64Annulus_integral_horizontal_derivative_of_contDiffOn hO hdom (hD b0), |
| 180 | m64Annulus_integral_vertical_derivative_of_contDiffOn hO hdom (hD b1)] |
| 181 | have hzero : (∫ s in Icc (0 : ℝ) 1, |
| 182 | fderiv ℝ L (annulusPoint curvePeriod s) b0 - fderiv ℝ L (annulusPoint 0 s) b0) = 0 := by |
| 183 | apply integral_eq_zero_of_ae |
| 184 | filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs |
| 185 | exact sub_eq_zero.mpr (hseam s hs) |
| 186 | rw [hzero, mul_zero, zero_add] |
| 187 | rw [integral_const_mul, hboundary] at hbound |
| 188 | have heq : (∫ p in m64AnnulusDomain, E p) = A.area := |
| 189 | m64_weightedEnergy_eq_area_of_ae_modulus_conformal A hr hconformal |
| 190 | rw [heq] at hbound |
| 191 | exact hbound |
| 192 | |
| 193 | /-- Positive boundary energy permits removal of the logarithmic shift and gives the weighted |
| 194 | boundary curvature bound by sectional curvature times area. Source: Morgan--Tian (2007), |
| 195 | Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 196 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 197 | theorem m64Annulus_modulus_log_boundary_curvature_le |
| 198 | (D : LeviCivitaData g) (A : M64Annulus g c0 c1) {r : ℝ} (hr : 0 < r) |
| 199 | (hminimum : A.area = m64LeastAnnulusArea g c0 c1) |
| 200 | (hconformal : ∀ᵐ p ∂volume.restrict m64AnnulusDomain, |
| 201 | r * m60AreaGram g A.map p 0 0 = r⁻¹ * m60AreaGram g A.map p 1 1 ∧ |
| 202 | m60AreaGram g A.map p 0 1 = 0) |
| 203 | {O : Set LoopPlane} (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 204 | (hA : ContMDiffOn (𝓡 2) (𝓡 n) ∞ A.map O) |
| 205 | {K : ℝ} (hK : 0 ≤ K) |
| 206 | (hsec : ∀ p ∈ m64AnnulusInterior, D.sectionalCurvature (A.map p) |
| 207 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.single (0 : Fin 2) 1)) |
| 208 | (mfderiv (𝓡 2) (𝓡 n) A.map p (EuclideanSpace.single (1 : Fin 2) 1)) ≤ K) |
| 209 | (hlower : ∀ x ∈ Icc (0 : ℝ) curvePeriod, |
| 210 | 0 < m64ModulusEnergyDensity g r A.map (annulusPoint x 0)) |
| 211 | (hupper : ∀ x ∈ Icc (0 : ℝ) curvePeriod, |
| 212 | 0 < m64ModulusEnergyDensity g r A.map (annulusPoint x 1)) : |
| 213 | -(1 / 2 : ℝ) * r⁻¹ * |
| 214 | ((∫ x in Icc (0 : ℝ) curvePeriod, |
| 215 | fderiv ℝ (m64ModulusEnergyDensity g r A.map) (annulusPoint x 1) |
| 216 | (EuclideanSpace.single (1 : Fin 2) 1) / |
| 217 | m64ModulusEnergyDensity g r A.map (annulusPoint x 1)) - |
| 218 | ∫ x in Icc (0 : ℝ) curvePeriod, |
| 219 | fderiv ℝ (m64ModulusEnergyDensity g r A.map) (annulusPoint x 0) |
| 220 | (EuclideanSpace.single (1 : Fin 2) 1) / |
| 221 | m64ModulusEnergyDensity g r A.map (annulusPoint x 0)) ≤ K * A.area := by |
| 222 | let E := m64ModulusEnergyDensity g r A.map |
| 223 | let b1 : LoopPlane := EuclideanSpace.single (1 : Fin 2) 1 |
| 224 | have hE : ContDiffOn ℝ ∞ E O := m64ModulusEnergyDensity_contDiffOn r hO hA |
| 225 | have hlo := m64Annulus_log_normal_trace_tendsto hO hdom hE |
| 226 | (show (0 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) hlower |
| 227 | have hhi := m64Annulus_log_normal_trace_tendsto hO hdom hE |
| 228 | (show (1 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) hupper |
| 229 | have hbound : -2 * K * A.area ≤ r⁻¹ * |
| 230 | ((∫ x in Icc (0 : ℝ) curvePeriod, fderiv ℝ E (annulusPoint x 1) b1 / |
| 231 | E (annulusPoint x 1)) - |
| 232 | ∫ x in Icc (0 : ℝ) curvePeriod, fderiv ℝ E (annulusPoint x 0) b1 / |
| 233 | E (annulusPoint x 0)) := by |
| 234 | apply ge_of_tendsto ((hhi.sub hlo).const_mul r⁻¹) |
| 235 | apply Eventually.of_forall |
| 236 | intro m |
| 237 | let eps : ℝ := 1 / ((m : ℝ) + 1) |
| 238 | have heps : 0 < eps := by dsimp only [eps]; positivity |
| 239 | let L := fun p => Real.log (E p + eps) |
| 240 | have hL : ContDiffOn ℝ ∞ L O := by |
| 241 | intro p hp |
| 242 | exact (((hE.contDiffAt (hO.mem_nhds hp)).add contDiffAt_const).log |
| 243 | (add_pos_of_nonneg_of_pos |
| 244 | (m64ModulusEnergyDensity_nonneg r hr.le A.map p) heps).ne').contDiffWithinAt |
| 245 | have hD : ContinuousOn (fun p => fderiv ℝ L p b1) O := |
| 246 | ((hL.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply contDiffOn_const).continuousOn |
| 247 | have htrace (s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : |
| 248 | IntegrableOn (fun x => fderiv ℝ L (annulusPoint x s) b1) |
| 249 | (Icc (0 : ℝ) curvePeriod) volume := by |
| 250 | have hcurve : Continuous (fun x : ℝ => annulusPoint x s) := by |
| 251 | unfold annulusPoint |
| 252 | fun_prop |
| 253 | apply (hD.comp hcurve.continuousOn ?_).integrableOn_compact isCompact_Icc |
| 254 | intro x hx |
| 255 | apply hdom |
| 256 | change 0 ≤ x ∧ x ≤ curvePeriod ∧ 0 ≤ s ∧ s ≤ 1 |
| 257 | exact ⟨hx.1, hx.2, hs⟩ |
| 258 | have hraw := m64Annulus_modulus_log_energy_boundary_lower_bound |
| 259 | D A hr hminimum hconformal hO hdom hA hK heps hsec |
| 260 | change -2 * K * A.area ≤ r⁻¹ * ∫ x in Icc (0 : ℝ) curvePeriod, |
| 261 | fderiv ℝ L (annulusPoint x 1) b1 - fderiv ℝ L (annulusPoint x 0) b1 at hraw |
| 262 | rw [integral_sub (htrace 1 (by simp)) (htrace 0 (by simp))] at hraw |
| 263 | exact hraw |
| 264 | change -(1 / 2 : ℝ) * r⁻¹ * |
| 265 | ((∫ x in Icc (0 : ℝ) curvePeriod, fderiv ℝ E (annulusPoint x 1) b1 / |
| 266 | E (annulusPoint x 1)) - |
| 267 | ∫ x in Icc (0 : ℝ) curvePeriod, fderiv ℝ E (annulusPoint x 0) b1 / |
| 268 | E (annulusPoint x 0)) ≤ K * A.area |
| 269 | linarith |
| 270 | |
| 271 | end PoincareMT |