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.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Plateau.Rectangle.MeasurableIntegration |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Lipschitz.AnnulusAdapter |
| 4 | import Mathlib.MeasureTheory.Integral.DivergenceTheorem |
| 5 | |
| 6 | /-! The actual annulus divergence theorem at finite regularity. |
| 7 | Only the total divergence is assumed integrable. Source: MT Lemma |
| 8 | 19.15, pp. 447-449; Mathlib's rectangle divergence theorem. -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option warningAsError true |
| 13 | |
| 14 | open Set MeasureTheory |
| 15 | open scoped ContDiff |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | open Proofs.M58 |
| 20 | |
| 21 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 22 | |
| 23 | /-- A current continuous on the closed annulus and differentiable in its interior has the |
| 24 | genuine boundary flux when its total divergence is integrable. No derivative on a boundary |
| 25 | face is required. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 26 | project derivation |
| 27 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 28 | theorem m64Annulus_integral_divergence_of_continuous |
| 29 | {J0 J1 : LoopPlane → E} |
| 30 | (hc0 : ContinuousOn J0 m64AnnulusDomain) |
| 31 | (hc1 : ContinuousOn J1 m64AnnulusDomain) |
| 32 | (hd0 : ∀ p ∈ m64AnnulusInterior, DifferentiableAt ℝ J0 p) |
| 33 | (hd1 : ∀ p ∈ m64AnnulusInterior, DifferentiableAt ℝ J1 p) |
| 34 | (hi : IntegrableOn (fun p => |
| 35 | fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 36 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1)) |
| 37 | m64AnnulusDomain volume) : |
| 38 | (∫ p in m64AnnulusDomain, |
| 39 | fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 40 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1)) = |
| 41 | ((∫ x in Icc (0 : ℝ) curvePeriod, J1 (annulusPoint x 1)) - |
| 42 | ∫ x in Icc (0 : ℝ) curvePeriod, J1 (annulusPoint x 0)) + |
| 43 | ((∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint curvePeriod y)) - |
| 44 | ∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint 0 y)) := by |
| 45 | let L : (ℝ × ℝ) →L[ℝ] LoopPlane := |
| 46 | (ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (EuclideanSpace.single 0 1) + |
| 47 | (ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (EuclideanSpace.single 1 1) |
| 48 | have hL (q : ℝ × ℝ) : L q = annulusPoint q.1 q.2 := by |
| 49 | ext i |
| 50 | fin_cases i <;> simp [L, annulusPoint] |
| 51 | have hL0 : L (1, 0) = EuclideanSpace.single (0 : Fin 2) 1 := by simp [L] |
| 52 | have hL1 : L (0, 1) = EuclideanSpace.single (1 : Fin 2) 1 := by simp [L] |
| 53 | let D := fun p => |
| 54 | fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 55 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1) |
| 56 | have hclosed (q : ℝ × ℝ) (hq : q ∈ Icc ((0 : ℝ), (0 : ℝ)) (curvePeriod, 1)) : |
| 57 | L q ∈ m64AnnulusDomain := by |
| 58 | rw [hL] |
| 59 | exact ⟨hq.1.1, hq.2.1, hq.1.2, hq.2.2⟩ |
| 60 | have hopen (q : ℝ × ℝ) |
| 61 | (hq : q ∈ Ioo (0 : ℝ) curvePeriod ×ˢ Ioo (0 : ℝ) 1) : |
| 62 | L q ∈ m64AnnulusInterior := by |
| 63 | rw [hL] |
| 64 | intro i _ |
| 65 | fin_cases i |
| 66 | · exact hq.1 |
| 67 | · exact hq.2 |
| 68 | have hpi : IntegrableOn (fun q : ℝ × ℝ => D (L q)) |
| 69 | (Icc ((0 : ℝ), (0 : ℝ)) (curvePeriod, 1)) volume := by |
| 70 | have h := m64AnnulusPoint_measurePreserving.integrable_comp_of_integrable |
| 71 | (hi.mono_set interior_subset) |
| 72 | simpa +instances only [IntegrableOn, Measure.prod_restrict, Icc_prod_eq, hL, D, |
| 73 | Function.comp_def] using! h |
| 74 | have hdiv := integral_divergence_prod_Icc_of_hasFDerivAt_of_le |
| 75 | (fun q => J0 (L q)) (fun q => J1 (L q)) |
| 76 | (fun q => (fderiv ℝ J0 (L q)).comp L) (fun q => (fderiv ℝ J1 (L q)).comp L) |
| 77 | ((0 : ℝ), (0 : ℝ)) (curvePeriod, 1) |
| 78 | (show ((0 : ℝ), (0 : ℝ)) ≤ (curvePeriod, 1) from |
| 79 | ⟨by unfold curvePeriod; positivity, zero_le_one⟩) |
| 80 | (hc0.comp L.continuous.continuousOn hclosed) |
| 81 | (hc1.comp L.continuous.continuousOn hclosed) |
| 82 | (fun q hq => (hd0 _ (hopen q hq)).hasFDerivAt.comp q L.hasFDerivAt) |
| 83 | (fun q hq => (hd1 _ (hopen q hq)).hasFDerivAt.comp q L.hasFDerivAt) |
| 84 | (by simpa only [ContinuousLinearMap.comp_apply, hL0, hL1] using hpi) |
| 85 | have hpre : loopPlaneEquivProd.symm ⁻¹' m64AnnulusDomain = |
| 86 | Icc ((0 : ℝ), (0 : ℝ)) (curvePeriod, 1) := by |
| 87 | ext q |
| 88 | change (0 ≤ q.1 ∧ q.1 ≤ curvePeriod ∧ 0 ≤ q.2 ∧ q.2 ≤ 1) ↔ |
| 89 | (0 ≤ q.1 ∧ 0 ≤ q.2) ∧ q.1 ≤ curvePeriod ∧ q.2 ≤ 1 |
| 90 | tauto |
| 91 | have hint := measurePreserving_loopPlaneEquivProd.symm.setIntegral_preimage_emb |
| 92 | loopPlaneEquivProd.symm.measurableEmbedding D m64AnnulusDomain |
| 93 | rw [hpre] at hint |
| 94 | have hmeasure : (∫ p in m64AnnulusDomain, D p) = |
| 95 | ∫ q in Icc ((0 : ℝ), (0 : ℝ)) (curvePeriod, 1), D (L q) := by |
| 96 | convert hint.symm using 1 |
| 97 | apply integral_congr_ae |
| 98 | exact Filter.Eventually.of_forall fun q => congrArg D (hL q) |
| 99 | rw [hmeasure] |
| 100 | simp only [ContinuousLinearMap.comp_apply, hL0, hL1] at hdiv |
| 101 | have hp : 0 ≤ curvePeriod := by unfold curvePeriod; positivity |
| 102 | simp only [hL, intervalIntegral.integral_of_le hp, |
| 103 | intervalIntegral.integral_of_le zero_le_one, |
| 104 | setIntegral_congr_set (Ioc_ae_eq_Icc (α := ℝ) (μ := volume))] at hdiv |
| 105 | simpa only [D, hL, sub_eq_add_neg, add_assoc] using hdiv |
| 106 | |
| 107 | /-- Literal periodicity cancels the seam in the finite-regularity divergence theorem. The |
| 108 | remaining trace is integrable by continuity. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 109 | Corollary 19.16, pp. 447-449; project derivation |
| 110 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 111 | theorem m64Annulus_integral_divergence_of_continuous_periodic |
| 112 | {J0 J1 : LoopPlane → E} |
| 113 | (hc0 : ContinuousOn J0 m64AnnulusDomain) |
| 114 | (hc1 : ContinuousOn J1 m64AnnulusDomain) |
| 115 | (hd0 : ∀ p ∈ m64AnnulusInterior, DifferentiableAt ℝ J0 p) |
| 116 | (hd1 : ∀ p ∈ m64AnnulusInterior, DifferentiableAt ℝ J1 p) |
| 117 | (hi : IntegrableOn (fun p => |
| 118 | fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 119 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1)) |
| 120 | m64AnnulusDomain volume) |
| 121 | (hseam : ∀ y ∈ Icc (0 : ℝ) 1, |
| 122 | J0 (annulusPoint curvePeriod y) = J0 (annulusPoint 0 y)) : |
| 123 | (∫ p in m64AnnulusDomain, |
| 124 | fderiv ℝ J0 p (EuclideanSpace.single (0 : Fin 2) 1) + |
| 125 | fderiv ℝ J1 p (EuclideanSpace.single (1 : Fin 2) 1)) = |
| 126 | ∫ x in Icc (0 : ℝ) curvePeriod, J1 (annulusPoint x 1) - J1 (annulusPoint x 0) := by |
| 127 | rw [m64Annulus_integral_divergence_of_continuous hc0 hc1 hd0 hd1 hi] |
| 128 | have heq : (∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint curvePeriod y)) = |
| 129 | ∫ y in Icc (0 : ℝ) 1, J0 (annulusPoint 0 y) := by |
| 130 | apply integral_congr_ae |
| 131 | filter_upwards [ae_restrict_mem measurableSet_Icc] with y hy |
| 132 | exact hseam y hy |
| 133 | have htrace (y : ℝ) (hy : y ∈ Icc (0 : ℝ) 1) : |
| 134 | IntegrableOn (fun x => J1 (annulusPoint x y)) (Icc (0 : ℝ) curvePeriod) volume := by |
| 135 | have hline : Continuous (fun x : ℝ => annulusPoint x y) := by |
| 136 | unfold annulusPoint |
| 137 | fun_prop |
| 138 | exact (hc1.comp hline.continuousOn |
| 139 | (fun _ hx => ⟨hx.1, hx.2, hy.1, hy.2⟩)).integrableOn_compact isCompact_Icc |
| 140 | rw [heq, sub_self, add_zero, integral_sub (htrace 1 (by simp)) (htrace 0 (by simp))] |
| 141 | |
| 142 | end PoincareMT |