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.Annulus |
| 2 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.AreaEnergy |
| 3 | |
| 4 | /-! |
| 5 | # Guarded annular area infima |
| 6 | |
| 7 | The admissible maps have nonnegative Jacobians. An actual annulus therefore |
| 8 | supplies a nonempty, bounded-below area class, a nonnegative least area and |
| 9 | competitors with any positive error. These are the order-theoretic steps of |
| 10 | Morgan--Tian Lemma 19.15, pp. 447-449; no attainment is asserted here. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set MeasureTheory |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {g : RiemannianMetric n M} {c0 c1 : ℝ → M} |
| 25 | |
| 26 | /-- A map factoring differentiably through one real coordinate has zero two-dimensional area |
| 27 | density. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 28 | derivation |
| 29 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 30 | theorem m60AreaDensity_eq_zero_of_factor (g : RiemannianMetric n M) |
| 31 | (c : ℝ → M) (psi : LoopPlane → ℝ) (z : LoopPlane) |
| 32 | (hc : MDifferentiableAt 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) |
| 33 | (hpsi : MDifferentiableAt (𝓡 2) 𝓘(ℝ, ℝ) psi z) : |
| 34 | m60AreaDensity g (c ∘ psi) z = 0 := by |
| 35 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 36 | ⟨g.toRiemannianMetric⟩ |
| 37 | let w := mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z) (1 : ℝ) |
| 38 | have hcol (i : Fin 2) : |
| 39 | mfderiv (𝓡 2) (𝓡 n) (c ∘ psi) z |
| 40 | (EuclideanSpace.basisFun (Fin 2) ℝ i) = |
| 41 | (fderiv ℝ psi z |
| 42 | (EuclideanSpace.basisFun (Fin 2) ℝ i) : ℝ) • w := by |
| 43 | have hvalue : |
| 44 | mfderiv (𝓡 2) 𝓘(ℝ, ℝ) psi z |
| 45 | (EuclideanSpace.basisFun (Fin 2) ℝ i) = |
| 46 | (fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i) : ℝ) := by |
| 47 | rw [mfderiv_eq_fderiv] |
| 48 | rfl |
| 49 | have hcomp := mfderiv_comp_apply (f := psi) (g := c) z hc hpsi |
| 50 | (EuclideanSpace.basisFun (Fin 2) ℝ i) |
| 51 | have hs : (fderiv ℝ psi z |
| 52 | (EuclideanSpace.basisFun (Fin 2) ℝ i) : ℝ) • (1 : ℝ) = |
| 53 | fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i) := by simp |
| 54 | calc |
| 55 | mfderiv (𝓡 2) (𝓡 n) (c ∘ psi) z |
| 56 | (EuclideanSpace.basisFun (Fin 2) ℝ i) = |
| 57 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) |
| 58 | (fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) := |
| 59 | hcomp.trans (congrArg (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) hvalue) |
| 60 | _ = (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) |
| 61 | ((fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) • (1 : ℝ)) := by |
| 62 | rw [hs] |
| 63 | _ = (fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) • w := by |
| 64 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) |
| 65 | ((fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) • (1 : ℝ)) = |
| 66 | (fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) • |
| 67 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)) (1 : ℝ) |
| 68 | exact (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) c (psi z)).map_smul |
| 69 | (fderiv ℝ psi z (EuclideanSpace.basisFun (Fin 2) ℝ i)) (1 : ℝ) |
| 70 | have hdet : Matrix.det (m60AreaGram g (c ∘ psi) z) = 0 := by |
| 71 | rw [Matrix.det_fin_two, m60AreaGram_symm g (c ∘ psi) z 1 0] |
| 72 | simp only [m60AreaGram] |
| 73 | rw [hcol 0, hcol 1] |
| 74 | simp only [Function.comp_apply] |
| 75 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 76 | ring |
| 77 | simp only [m60AreaDensity, hdet, max_self, Real.sqrt_zero] |
| 78 | |
| 79 | /-- The actual annular area integral is nonnegative because its density is a nonnegative |
| 80 | square root. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 81 | project derivation |
| 82 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 83 | theorem m64AnnulusArea_nonneg (f : LoopPlane → M) : |
| 84 | 0 ≤ m64AnnulusArea g f := |
| 85 | integral_nonneg (fun _ => Real.sqrt_nonneg _) |
| 86 | |
| 87 | /-- The closed angular rectangle is measurable in the actual Euclidean source plane. Source: |
| 88 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 89 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 90 | theorem m64AnnulusDomain_measurableSet : |
| 91 | MeasurableSet m64AnnulusDomain := by |
| 92 | change MeasurableSet {p : LoopPlane | |
| 93 | 0 ≤ p 0 ∧ p 0 ≤ curvePeriod ∧ 0 ≤ p 1 ∧ p 1 ≤ 1} |
| 94 | measurability |
| 95 | |
| 96 | /-- The closed angular rectangle is compact by its actual coordinate-product |
| 97 | parametrization. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 98 | project derivation |
| 99 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 100 | theorem m64AnnulusDomain_isCompact : IsCompact m64AnnulusDomain := by |
| 101 | have hmap : Continuous (fun p : ℝ × ℝ => annulusPoint p.1 p.2) := by |
| 102 | unfold annulusPoint |
| 103 | fun_prop |
| 104 | have heq : m64AnnulusDomain = |
| 105 | (fun p : ℝ × ℝ => annulusPoint p.1 p.2) '' |
| 106 | (Icc 0 curvePeriod ×ˢ Icc (0 : ℝ) 1) := by |
| 107 | ext z |
| 108 | constructor |
| 109 | · intro hz |
| 110 | refine ⟨(z 0, z 1), ⟨⟨hz.1, hz.2.1⟩, hz.2.2⟩, ?_⟩ |
| 111 | ext i |
| 112 | fin_cases i <;> rfl |
| 113 | · rintro ⟨p, hp, rfl⟩ |
| 114 | exact ⟨hp.1.1, hp.1.2, hp.2.1, hp.2.2⟩ |
| 115 | rw [heq] |
| 116 | exact (isCompact_Icc.prod isCompact_Icc).image hmap |
| 117 | |
| 118 | /-- The compact angular rectangle has finite planar volume. Source: Morgan--Tian (2007), |
| 119 | Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 120 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 121 | theorem m64AnnulusDomain_volume_ne_top : |
| 122 | volume m64AnnulusDomain ≠ (⊤ : ENNReal) := |
| 123 | m64AnnulusDomain_isCompact.measure_ne_top |
| 124 | |
| 125 | /-- The actual integrable annular area is bounded by its integrable Dirichlet energy. |
| 126 | Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 127 | derivation |
| 128 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 129 | theorem M64Annulus.area_le_energy (A : M64Annulus g c0 c1) |
| 130 | (hmeas : MeasurableSet m64AnnulusDomain) |
| 131 | (hE : IntegrableOn (m60EnergyDensity g A.map) m64AnnulusDomain volume) : |
| 132 | A.area ≤ ∫ p in m64AnnulusDomain, |
| 133 | m60EnergyDensity g A.map p := by |
| 134 | unfold M64Annulus.area m64AnnulusArea |
| 135 | exact MeasureTheory.setIntegral_mono_on A.area_integrable hE hmeas |
| 136 | (fun p _ => m60AreaDensity_le_energyDensity g A.map p) |
| 137 | |
| 138 | /-- Every actual admissible annulus has nonnegative area. Source: Morgan--Tian (2007), Lemma |
| 139 | 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 140 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 141 | theorem M64Annulus.area_nonneg (A : M64Annulus g c0 c1) : 0 ≤ A.area := |
| 142 | m64AnnulusArea_nonneg A.map |
| 143 | |
| 144 | /-- An actual admissible annulus makes its area range nonempty. Source: Morgan--Tian (2007), |
| 145 | Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 146 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 147 | theorem m64AnnulusAreaRange_nonempty (A : M64Annulus g c0 c1) : |
| 148 | (m64AnnulusAreaRange g c0 c1).Nonempty := |
| 149 | ⟨A.area, A, rfl⟩ |
| 150 | |
| 151 | /-- Every annular area range is bounded below by zero, including an empty range. 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 m64AnnulusAreaRange_bddBelow (g : RiemannianMetric n M) (c0 c1 : ℝ → M) : |
| 155 | BddBelow (m64AnnulusAreaRange g c0 c1) := by |
| 156 | refine ⟨0, ?_⟩ |
| 157 | rintro _ ⟨A, rfl⟩ |
| 158 | exact A.area_nonneg |
| 159 | |
| 160 | /-- An actual annulus guards the nonempty infimum and gives nonnegative least area. Source: |
| 161 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 162 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 163 | theorem m64LeastAnnulusArea_nonneg (A : M64Annulus g c0 c1) : |
| 164 | 0 ≤ m64LeastAnnulusArea g c0 c1 := by |
| 165 | have hnonempty := m64AnnulusAreaRange_nonempty A |
| 166 | have hbounded := m64AnnulusAreaRange_bddBelow g c0 c1 |
| 167 | apply le_csInf hnonempty |
| 168 | rintro _ ⟨B, rfl⟩ |
| 169 | exact B.area_nonneg |
| 170 | |
| 171 | /-- The guarded least annular area is below the area of each actual competitor. Source: |
| 172 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 173 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 174 | theorem m64LeastAnnulusArea_le_annulus (A : M64Annulus g c0 c1) : |
| 175 | m64LeastAnnulusArea g c0 c1 ≤ A.area := |
| 176 | csInf_le (m64AnnulusAreaRange_bddBelow g c0 c1) ⟨A, rfl⟩ |
| 177 | |
| 178 | /-- An actual least-area competitor realizes the guarded annular infimum. Source: |
| 179 | Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 180 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 181 | theorem m64LeastAnnulusArea_eq_of_isLeast |
| 182 | (B : M64Annulus g c0 c1) |
| 183 | (hB : ∀ C : M64Annulus g c0 c1, B.area ≤ C.area) : |
| 184 | B.area = m64LeastAnnulusArea g c0 c1 := by |
| 185 | refine le_antisymm ?_ (m64LeastAnnulusArea_le_annulus B) |
| 186 | apply le_csInf (m64AnnulusAreaRange_nonempty B) |
| 187 | rintro _ ⟨C, rfl⟩ |
| 188 | exact hB C |
| 189 | |
| 190 | /-- A nonempty admissible area class has an actual competitor within every positive error of |
| 191 | its infimum. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 192 | project derivation |
| 193 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 194 | theorem m64LeastAnnulusArea_near_minimizer (A : M64Annulus g c0 c1) |
| 195 | {epsilon : ℝ} (hepsilon : 0 < epsilon) : |
| 196 | ∃ B : M64Annulus g c0 c1, |
| 197 | B.area < m64LeastAnnulusArea g c0 c1 + epsilon := by |
| 198 | have hnonempty := m64AnnulusAreaRange_nonempty A |
| 199 | have hbounded := m64AnnulusAreaRange_bddBelow g c0 c1 |
| 200 | obtain ⟨_, ⟨B, rfl⟩, hB⟩ := exists_lt_of_csInf_lt hnonempty |
| 201 | (show m64LeastAnnulusArea g c0 c1 < |
| 202 | m64LeastAnnulusArea g c0 c1 + epsilon from lt_add_of_pos_right _ hepsilon) |
| 203 | exact ⟨B, hB⟩ |
| 204 | |
| 205 | end PoincareMT |