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.Covariant.BoundaryFlux |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Plateau.Rectangle.MeasurableIntegration |
| 3 | |
| 4 | /-! |
| 5 | # Boundary flux for coefficients smooth near the annular rectangle |
| 6 | |
| 7 | Actual target-chart coefficients need only be smooth on their chart domain. |
| 8 | The local FTC below consequently assumes smoothness on an open neighborhood |
| 9 | of the source rectangle, without requesting a global coefficient extension. |
| 10 | |
| 11 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 12 | 447-449. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter MeasureTheory |
| 19 | open scoped ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | private theorem annulusPoint_mem_of_intervals {O : Set LoopPlane} |
| 24 | (hdom : m64AnnulusDomain ⊆ O) {x s : ℝ} |
| 25 | (hx : x ∈ Icc (0 : ℝ) curvePeriod) (hs : s ∈ Icc (0 : ℝ) 1) : |
| 26 | annulusPoint x s ∈ O := by |
| 27 | apply hdom |
| 28 | change 0 ≤ x ∧ x ≤ curvePeriod ∧ 0 ≤ s ∧ s ≤ 1 |
| 29 | exact ⟨hx.1, hx.2, hs.1, hs.2⟩ |
| 30 | |
| 31 | /-- Vertical FTC requires smoothness only near the actual closed rectangle. Source: |
| 32 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 33 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 34 | theorem m64Annulus_integral_vertical_derivative_of_contDiffOn |
| 35 | {O : Set LoopPlane} (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 36 | {f : LoopPlane → ℝ} (hf : ContDiffOn ℝ ∞ f O) : |
| 37 | (∫ p in interior m64AnnulusDomain, |
| 38 | fderiv ℝ f p (EuclideanSpace.single (1 : Fin 2) 1)) = |
| 39 | ∫ x in Icc (0 : ℝ) curvePeriod, f (annulusPoint x 1) - f (annulusPoint x 0) := by |
| 40 | let D := fun p => fderiv ℝ f p (EuclideanSpace.single (1 : Fin 2) 1) |
| 41 | have hD : ContinuousOn D O := |
| 42 | ((hf.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply contDiffOn_const).continuousOn |
| 43 | have hDi : IntegrableOn D (interior m64AnnulusDomain) volume := |
| 44 | (hD.mono hdom).integrableOn_compact m64AnnulusDomain_isCompact |
| 45 | |>.mono_set interior_subset |
| 46 | rw [m64AnnulusInteriorIntegral_eq_iterated_integrable D hDi] |
| 47 | apply integral_congr_ae |
| 48 | filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx |
| 49 | have hcurve : Continuous (fun s : ℝ => annulusPoint x s) := by |
| 50 | unfold annulusPoint |
| 51 | fun_prop |
| 52 | have hd : ContinuousOn (fun s => D (annulusPoint x s)) (Icc (0 : ℝ) 1) := |
| 53 | hD.comp hcurve.continuousOn (fun s hs => annulusPoint_mem_of_intervals hdom hx hs) |
| 54 | have hder (s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : |
| 55 | HasDerivAt (fun r => f (annulusPoint x r)) (D (annulusPoint x s)) s := |
| 56 | ((hf.contDiffAt (hO.mem_nhds (annulusPoint_mem_of_intervals hdom hx hs))).differentiableAt |
| 57 | (by simp)).hasFDerivAt.comp_hasDerivAt s |
| 58 | (m64AnnulusPoint_vertical_hasDerivAt x s) |
| 59 | rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le zero_le_one] |
| 60 | exact intervalIntegral.integral_eq_sub_of_hasDerivAt |
| 61 | (fun s hs => hder s (by simpa only [uIcc_of_le zero_le_one] using hs)) |
| 62 | (hd.intervalIntegrable_of_Icc zero_le_one) |
| 63 | |
| 64 | /-- Horizontal FTC retains the seam traces with only local smoothness. Source: Morgan--Tian |
| 65 | (2007), Lemma 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 m64Annulus_integral_horizontal_derivative_of_contDiffOn |
| 68 | {O : Set LoopPlane} (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 69 | {f : LoopPlane → ℝ} (hf : ContDiffOn ℝ ∞ f O) : |
| 70 | (∫ p in interior m64AnnulusDomain, |
| 71 | fderiv ℝ f p (EuclideanSpace.single (0 : Fin 2) 1)) = |
| 72 | ∫ s in Icc (0 : ℝ) 1, |
| 73 | f (annulusPoint curvePeriod s) - f (annulusPoint 0 s) := by |
| 74 | let D := fun p => fderiv ℝ f p (EuclideanSpace.single (0 : Fin 2) 1) |
| 75 | have hD : ContinuousOn D O := |
| 76 | ((hf.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply contDiffOn_const).continuousOn |
| 77 | have hDi : IntegrableOn D (interior m64AnnulusDomain) volume := |
| 78 | (hD.mono hdom).integrableOn_compact m64AnnulusDomain_isCompact |
| 79 | |>.mono_set interior_subset |
| 80 | rw [m64AnnulusInteriorIntegral_eq_iterated_swap_integrable D hDi] |
| 81 | apply integral_congr_ae |
| 82 | filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs |
| 83 | have hcurve : Continuous (fun x : ℝ => annulusPoint x s) := by |
| 84 | unfold annulusPoint |
| 85 | fun_prop |
| 86 | have hd : ContinuousOn (fun x => D (annulusPoint x s)) (Icc (0 : ℝ) curvePeriod) := |
| 87 | hD.comp hcurve.continuousOn (fun x hx => annulusPoint_mem_of_intervals hdom hx hs) |
| 88 | have hder (x : ℝ) (hx : x ∈ Icc (0 : ℝ) curvePeriod) : |
| 89 | HasDerivAt (fun y => f (annulusPoint y s)) (D (annulusPoint x s)) x := |
| 90 | ((hf.contDiffAt (hO.mem_nhds (annulusPoint_mem_of_intervals hdom hx hs))).differentiableAt |
| 91 | (by simp)).hasFDerivAt.comp_hasDerivAt x |
| 92 | (m64AnnulusPoint_horizontal_hasDerivAt s x) |
| 93 | have hp : 0 ≤ curvePeriod := by unfold curvePeriod; positivity |
| 94 | rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hp] |
| 95 | exact intervalIntegral.integral_eq_sub_of_hasDerivAt |
| 96 | (fun x hx => hder x (by simpa only [uIcc_of_le hp] using hx)) |
| 97 | (hd.intervalIntegrable_of_Icc hp) |
| 98 | |
| 99 | open Poincare.Riemannian.RadialTransport |
| 100 | |
| 101 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 102 | {Γ : LoopPlane → LoopPlane →L[ℝ] E →L[ℝ] E} |
| 103 | {G : LoopPlane → E →L[ℝ] E →L[ℝ] ℝ} |
| 104 | {V W W0 W1 : LoopPlane → E} {O : Set LoopPlane} |
| 105 | |
| 106 | private theorem continuousOn_covariantDerivative |
| 107 | (hO : IsOpen O) (hΓ : ContinuousOn Γ O) (hV : ContDiffOn ℝ ∞ V O) (d : LoopPlane) : |
| 108 | ContinuousOn (fun p => covariantDerivative Γ V p d) O := by |
| 109 | exact (((hV.fderiv_of_isOpen hO (m := ∞) (by simp)).clm_apply |
| 110 | contDiffOn_const).continuousOn).add |
| 111 | ((hΓ.clm_apply continuousOn_const).clm_apply hV.continuousOn) |
| 112 | |
| 113 | private theorem covariant_pairings_integrable_on |
| 114 | (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 115 | (hΓ : ContinuousOn Γ O) (hG : ContDiffOn ℝ ∞ G O) |
| 116 | (hV : ContDiffOn ℝ ∞ V O) (hW : ContDiffOn ℝ ∞ W O) (d : LoopPlane) : |
| 117 | IntegrableOn (fun p => G p (covariantDerivative Γ V p d) (W p)) |
| 118 | (interior m64AnnulusDomain) volume ∧ |
| 119 | IntegrableOn (fun p => G p (V p) (covariantDerivative Γ W p d)) |
| 120 | (interior m64AnnulusDomain) volume := by |
| 121 | constructor |
| 122 | · exact (((hG.continuousOn.clm_apply (continuousOn_covariantDerivative hO hΓ hV d)).clm_apply |
| 123 | hW.continuousOn).mono hdom).integrableOn_compact m64AnnulusDomain_isCompact |
| 124 | |>.mono_set interior_subset |
| 125 | · exact (((hG.continuousOn.clm_apply hV.continuousOn).clm_apply |
| 126 | (continuousOn_covariantDerivative hO hΓ hW d)).mono hdom).integrableOn_compact |
| 127 | m64AnnulusDomain_isCompact |>.mono_set interior_subset |
| 128 | |
| 129 | private theorem integral_covariant_pairing_on_eq_integral_derivative |
| 130 | (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 131 | (hΓ : ContinuousOn Γ O) (hG : ContDiffOn ℝ ∞ G O) |
| 132 | (hV : ContDiffOn ℝ ∞ V O) (hW : ContDiffOn ℝ ∞ W O) |
| 133 | (hcompat : ∀ p ∈ O, ∀ d : LoopPlane, ∀ v w : E, |
| 134 | fderiv ℝ (fun q => G q v w) p d = |
| 135 | G p (Γ p d v) w + G p v (Γ p d w)) (d : LoopPlane) : |
| 136 | (∫ p in interior m64AnnulusDomain, G p (covariantDerivative Γ V p d) (W p)) + |
| 137 | (∫ p in interior m64AnnulusDomain, G p (V p) (covariantDerivative Γ W p d)) = |
| 138 | ∫ p in interior m64AnnulusDomain, fderiv ℝ (fun q => G q (V q) (W q)) p d := by |
| 139 | obtain ⟨hleft, hright⟩ := covariant_pairings_integrable_on hO hdom hΓ hG hV hW d |
| 140 | rw [← integral_add hleft hright] |
| 141 | apply integral_congr_ae |
| 142 | filter_upwards [ae_restrict_mem isOpen_interior.measurableSet] with p hp |
| 143 | have hpo := hdom (interior_subset hp) |
| 144 | exact (fderiv_metric_pairing |
| 145 | ((hG.contDiffAt (hO.mem_nhds hpo)).differentiableAt (by simp)) |
| 146 | ((hV.contDiffAt (hO.mem_nhds hpo)).differentiableAt (by simp)) |
| 147 | ((hW.contDiffAt (hO.mem_nhds hpo)).differentiableAt (by simp)) |
| 148 | (hcompat p hpo) d).symm |
| 149 | |
| 150 | /-- The actual covariant boundary-flux identity for coefficients smooth only near the |
| 151 | rectangle. The seam cancellation and the interior divergence are both explicit. Source: |
| 152 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 153 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 154 | theorem m64Annulus_covariant_boundary_flux_on |
| 155 | (hO : IsOpen O) (hdom : m64AnnulusDomain ⊆ O) |
| 156 | (hΓ : ContinuousOn Γ O) (hG : ContDiffOn ℝ ∞ G O) |
| 157 | (hV : ContDiffOn ℝ ∞ V O) (hW0 : ContDiffOn ℝ ∞ W0 O) (hW1 : ContDiffOn ℝ ∞ W1 O) |
| 158 | (hcompat : ∀ p ∈ O, ∀ d : LoopPlane, ∀ v w : E, |
| 159 | fderiv ℝ (fun q => G q v w) p d = |
| 160 | G p (Γ p d v) w + G p v (Γ p d w)) |
| 161 | (hseam : ∀ s ∈ Icc (0 : ℝ) 1, |
| 162 | G (annulusPoint curvePeriod s) (V (annulusPoint curvePeriod s)) |
| 163 | (W0 (annulusPoint curvePeriod s)) = |
| 164 | G (annulusPoint 0 s) (V (annulusPoint 0 s)) (W0 (annulusPoint 0 s))) : |
| 165 | (∫ p in interior m64AnnulusDomain, |
| 166 | G p (covariantDerivative Γ V p (EuclideanSpace.single (0 : Fin 2) 1)) (W0 p) + |
| 167 | G p (covariantDerivative Γ V p (EuclideanSpace.single (1 : Fin 2) 1)) (W1 p)) + |
| 168 | (∫ p in interior m64AnnulusDomain, G p (V p) |
| 169 | (covariantDerivative Γ W0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 170 | covariantDerivative Γ W1 p (EuclideanSpace.single (1 : Fin 2) 1))) = |
| 171 | ∫ x in Icc (0 : ℝ) curvePeriod, |
| 172 | G (annulusPoint x 1) (V (annulusPoint x 1)) (W1 (annulusPoint x 1)) - |
| 173 | G (annulusPoint x 0) (V (annulusPoint x 0)) (W1 (annulusPoint x 0)) := by |
| 174 | have hi0 := covariant_pairings_integrable_on hO hdom hΓ hG hV hW0 |
| 175 | (EuclideanSpace.single (0 : Fin 2) 1) |
| 176 | have hi1 := covariant_pairings_integrable_on hO hdom hΓ hG hV hW1 |
| 177 | (EuclideanSpace.single (1 : Fin 2) 1) |
| 178 | have hh := integral_covariant_pairing_on_eq_integral_derivative hO hdom hΓ hG hV hW0 |
| 179 | hcompat (EuclideanSpace.single (0 : Fin 2) 1) |
| 180 | have hv := integral_covariant_pairing_on_eq_integral_derivative hO hdom hΓ hG hV hW1 |
| 181 | hcompat (EuclideanSpace.single (1 : Fin 2) 1) |
| 182 | rw [m64Annulus_integral_horizontal_derivative_of_contDiffOn hO hdom |
| 183 | ((hG.clm_apply hV).clm_apply hW0)] at hh |
| 184 | rw [m64Annulus_integral_vertical_derivative_of_contDiffOn hO hdom |
| 185 | ((hG.clm_apply hV).clm_apply hW1)] at hv |
| 186 | have hzero : (∫ s in Icc (0 : ℝ) 1, |
| 187 | G (annulusPoint curvePeriod s) (V (annulusPoint curvePeriod s)) |
| 188 | (W0 (annulusPoint curvePeriod s)) - |
| 189 | G (annulusPoint 0 s) (V (annulusPoint 0 s)) (W0 (annulusPoint 0 s))) = 0 := by |
| 190 | apply integral_eq_zero_of_ae |
| 191 | filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs |
| 192 | exact sub_eq_zero.mpr (hseam s hs) |
| 193 | rw [hzero] at hh |
| 194 | simp_rw [map_add] |
| 195 | rw [integral_add hi0.1 hi1.1, integral_add hi0.2 hi1.2] |
| 196 | linarith |
| 197 | |
| 198 | end PoincareMT |