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.IntrinsicComparison.Retained.LoopCaps |
| 2 | |
| 3 | /-! |
| 4 | # Exact intersections between the fitted signed caps |
| 5 | |
| 6 | Distinct signed sectors can intersect only on their axes. The retained |
| 7 | full-axis contact equalities identify the actual common radial arcs. |
| 8 | |
| 9 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 10 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 11 | faces used in its regional Gauss--Bonnet arguments. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Topology ContDiff |
| 20 | open PoincareMT.Topology.Surface ChartCircleArrangementVertexPatch |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | private theorem common_sector_mem_axes {i j : Bool × Bool} (hij : i ≠ j) |
| 25 | {q : ℝ × ℝ} |
| 26 | (hi : q ∈ (sectorParameterEquiv 0 i) '' {p : ℝ × ℝ | 0 ≤ p.1 ∧ 0 ≤ p.2}) |
| 27 | (hj : q ∈ (sectorParameterEquiv 0 j) '' {p : ℝ × ℝ | 0 ≤ p.1 ∧ 0 ≤ p.2}) : |
| 28 | q.1 = 0 ∨ q.2 = 0 := by |
| 29 | obtain ⟨p, hp, rfl⟩ := hi |
| 30 | obtain ⟨w, hw, heq⟩ := hj |
| 31 | have heq1 := congrArg Prod.fst heq |
| 32 | have heq2 := congrArg Prod.snd heq |
| 33 | rcases i with ⟨i, k⟩ |
| 34 | rcases j with ⟨j, l⟩ |
| 35 | cases i <;> cases k <;> cases j <;> cases l <;> |
| 36 | simp only [sectorParameterEquiv_apply, Bool.false_eq_true, ↓reduceIte] |
| 37 | at heq1 heq2 ⊢ <;> dsimp at heq1 heq2 ⊢ |
| 38 | all_goals first | exact (hij rfl).elim | (left; linarith [hp.1, hw.1]) | |
| 39 | (right; linarith [hp.2, hw.2]) |
| 40 | |
| 41 | /-- Distinct actual caps meet exactly where their retained signed radial arcs meet. No |
| 42 | unproved separation or disjointness hypothesis is used. Source: |
| 43 | `proof-work/tasks/M64/reports/2026-09-24-attached-return-bands.md`, Actual attached return |
| 44 | bands and cap intersections. -/ |
| 45 | theorem m64Intrinsic_cap_inter_eq_common_axes |
| 46 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) {r : ℝ} |
| 47 | (C : Bool × Bool → Set AnnulusCoordinates) |
| 48 | (hsector : ∀ i, C i ⊆ H '' (H.source ∩ (sectorParameterEquiv 0 i) '' |
| 49 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 50 | (haxes : ∀ i, C i ∩ H '' (H.source ∩ {q : ℝ × ℝ | q.1 = 0 ∨ q.2 = 0}) = |
| 51 | H '' ((sectorParameterEquiv 0 i) '' |
| 52 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) |
| 53 | {i j : Bool × Bool} (hij : i ≠ j) : |
| 54 | C i ∩ C j = |
| 55 | (H '' ((sectorParameterEquiv 0 i) '' |
| 56 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) ∩ |
| 57 | (H '' ((sectorParameterEquiv 0 j) '' |
| 58 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) := by |
| 59 | ext z |
| 60 | constructor |
| 61 | · rintro ⟨hzi, hzj⟩ |
| 62 | obtain ⟨p, hp, hpz⟩ := hsector i hzi |
| 63 | obtain ⟨q, hq, hqz⟩ := hsector j hzj |
| 64 | have hpq := H.injOn hp.1 hq.1 (hpz.trans hqz.symm) |
| 65 | have hpaxes := common_sector_mem_axes hij hp.2 (hpq.symm ▸ hq.2) |
| 66 | have hzaxes : z ∈ H '' (H.source ∩ {q : ℝ × ℝ | q.1 = 0 ∨ q.2 = 0}) := |
| 67 | ⟨p, ⟨hp.1, hpaxes⟩, hpz⟩ |
| 68 | exact ⟨(haxes i).subset ⟨hzi, hzaxes⟩, (haxes j).subset ⟨hzj, hzaxes⟩⟩ |
| 69 | · rintro ⟨hzi, hzj⟩ |
| 70 | exact ⟨((haxes i).superset hzi).1, ((haxes j).superset hzj).1⟩ |
| 71 | |
| 72 | private theorem signed_axes_inter_horizontal {r : ℝ} (hr : 0 ≤ r) (i : Bool) : |
| 73 | ((sectorParameterEquiv 0 (i, false)) '' |
| 74 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r))) ∩ |
| 75 | ((sectorParameterEquiv 0 (i, true)) '' |
| 76 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r))) = |
| 77 | (sectorParameterEquiv 0 (i, false)) '' (Icc (0 : ℝ) r ×ˢ {0}) := by |
| 78 | ext q |
| 79 | constructor |
| 80 | · rintro ⟨⟨p, hp, hpq⟩, ⟨w, hw, hwq⟩⟩ |
| 81 | rcases hp with hp | hp |
| 82 | · exact ⟨p, hp, hpq⟩ |
| 83 | · have hp0 : p.1 = 0 := hp.1 |
| 84 | have hpfirst : p.1 ∈ Icc (0 : ℝ) r := by |
| 85 | rw [hp0] |
| 86 | exact ⟨le_rfl, hr⟩ |
| 87 | rcases hw with hw | hw |
| 88 | · have hp2 : p.2 = 0 := by |
| 89 | have heq := congrArg Prod.snd (hpq.trans hwq.symm) |
| 90 | simp [sectorParameterEquiv_apply] at heq |
| 91 | linarith [show w.2 = 0 from hw.2] |
| 92 | exact ⟨p, ⟨hpfirst, hp2⟩, hpq⟩ |
| 93 | · have hp2 : p.2 = 0 := by |
| 94 | have heq := congrArg Prod.snd (hpq.trans hwq.symm) |
| 95 | simp [sectorParameterEquiv_apply] at heq |
| 96 | linarith [hp.2.1, hw.2.1] |
| 97 | exact ⟨p, ⟨hpfirst, hp2⟩, hpq⟩ |
| 98 | · rintro ⟨p, hp, rfl⟩ |
| 99 | refine ⟨⟨p, Or.inl hp, rfl⟩, ⟨p, Or.inl hp, ?_⟩⟩ |
| 100 | have hp0 : p.2 = 0 := hp.2 |
| 101 | simp [sectorParameterEquiv_apply, hp0] |
| 102 | |
| 103 | /-- Horizontally neighboring caps share exactly their common horizontal radial arc, with its |
| 104 | original chart parametrization. Source: |
| 105 | `proof-work/tasks/M64/reports/2026-09-24-attached-return-bands.md`, Actual attached return |
| 106 | bands and cap intersections. -/ |
| 107 | theorem m64Intrinsic_neighbor_caps_inter_horizontal |
| 108 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) {r : ℝ} (hr : 0 ≤ r) |
| 109 | (C : Bool × Bool → Set AnnulusCoordinates) |
| 110 | (hsector : ∀ i, C i ⊆ H '' (H.source ∩ (sectorParameterEquiv 0 i) '' |
| 111 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 112 | (haxes : ∀ i, C i ∩ H '' (H.source ∩ {q : ℝ × ℝ | q.1 = 0 ∨ q.2 = 0}) = |
| 113 | H '' ((sectorParameterEquiv 0 i) '' |
| 114 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) |
| 115 | (hsmall : ∀ i : Bool × Bool, ∀ s ∈ Icc (0 : ℝ) r, |
| 116 | sectorParameterEquiv 0 i (s, 0) ∈ H.source ∧ |
| 117 | sectorParameterEquiv 0 i (0, s) ∈ H.source) (i : Bool) : |
| 118 | C (i, false) ∩ C (i, true) = |
| 119 | H '' ((sectorParameterEquiv 0 (i, false)) '' (Icc (0 : ℝ) r ×ˢ {0})) := by |
| 120 | have hsource (j : Bool × Bool) : |
| 121 | (sectorParameterEquiv 0 j) '' |
| 122 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)) ⊆ H.source := by |
| 123 | rintro _ ⟨p, hp, rfl⟩ |
| 124 | rcases hp with hp | hp |
| 125 | · have heq : p = (p.1, 0) := Prod.ext rfl hp.2 |
| 126 | rw [heq] |
| 127 | exact (hsmall j p.1 hp.1).1 |
| 128 | · have heq : p = (0, p.2) := Prod.ext hp.1 rfl |
| 129 | rw [heq] |
| 130 | exact (hsmall j p.2 hp.2).2 |
| 131 | rw [m64Intrinsic_cap_inter_eq_common_axes H C hsector haxes (by simp), |
| 132 | ← Set.InjOn.image_inter H.injOn (hsource _) (hsource _), |
| 133 | signed_axes_inter_horizontal hr i] |
| 134 | |
| 135 | private theorem signed_axes_inter_vertical {r : ℝ} (hr : 0 ≤ r) (j : Bool) : |
| 136 | ((sectorParameterEquiv 0 (false, j)) '' |
| 137 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r))) ∩ |
| 138 | ((sectorParameterEquiv 0 (true, j)) '' |
| 139 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r))) = |
| 140 | (sectorParameterEquiv 0 (false, j)) '' ({0} ×ˢ Icc (0 : ℝ) r) := by |
| 141 | ext q |
| 142 | constructor |
| 143 | · rintro ⟨⟨p, hp, hpq⟩, ⟨w, hw, hwq⟩⟩ |
| 144 | rcases hp with hp | hp |
| 145 | · have hp0 : p.2 = 0 := hp.2 |
| 146 | have hpsecond : p.2 ∈ Icc (0 : ℝ) r := by |
| 147 | rw [hp0] |
| 148 | exact ⟨le_rfl, hr⟩ |
| 149 | rcases hw with hw | hw |
| 150 | · have hp1 : p.1 = 0 := by |
| 151 | have heq := congrArg Prod.fst (hpq.trans hwq.symm) |
| 152 | simp [sectorParameterEquiv_apply] at heq |
| 153 | linarith [hp.1.1, hw.1.1] |
| 154 | exact ⟨p, ⟨hp1, hpsecond⟩, hpq⟩ |
| 155 | · have hp1 : p.1 = 0 := by |
| 156 | have heq := congrArg Prod.fst (hpq.trans hwq.symm) |
| 157 | simp [sectorParameterEquiv_apply] at heq |
| 158 | linarith [show w.1 = 0 from hw.1] |
| 159 | exact ⟨p, ⟨hp1, hpsecond⟩, hpq⟩ |
| 160 | · exact ⟨p, hp, hpq⟩ |
| 161 | · rintro ⟨p, hp, rfl⟩ |
| 162 | refine ⟨⟨p, Or.inr hp, rfl⟩, ⟨p, Or.inr hp, ?_⟩⟩ |
| 163 | have hp0 : p.1 = 0 := hp.1 |
| 164 | simp [sectorParameterEquiv_apply, hp0] |
| 165 | |
| 166 | /-- Vertically neighboring caps share exactly their common vertical radial arc, with its |
| 167 | original chart parametrization. Source: |
| 168 | `proof-work/tasks/M64/reports/2026-09-24-attached-return-bands.md`, Actual attached return |
| 169 | bands and cap intersections. -/ |
| 170 | theorem m64Intrinsic_neighbor_caps_inter_vertical |
| 171 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) {r : ℝ} (hr : 0 ≤ r) |
| 172 | (C : Bool × Bool → Set AnnulusCoordinates) |
| 173 | (hsector : ∀ i, C i ⊆ H '' (H.source ∩ (sectorParameterEquiv 0 i) '' |
| 174 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 175 | (haxes : ∀ i, C i ∩ H '' (H.source ∩ {q : ℝ × ℝ | q.1 = 0 ∨ q.2 = 0}) = |
| 176 | H '' ((sectorParameterEquiv 0 i) '' |
| 177 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) |
| 178 | (hsmall : ∀ i : Bool × Bool, ∀ s ∈ Icc (0 : ℝ) r, |
| 179 | sectorParameterEquiv 0 i (s, 0) ∈ H.source ∧ |
| 180 | sectorParameterEquiv 0 i (0, s) ∈ H.source) (j : Bool) : |
| 181 | C (false, j) ∩ C (true, j) = |
| 182 | H '' ((sectorParameterEquiv 0 (false, j)) '' ({0} ×ˢ Icc (0 : ℝ) r)) := by |
| 183 | have hsource (i : Bool × Bool) : |
| 184 | (sectorParameterEquiv 0 i) '' |
| 185 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)) ⊆ H.source := by |
| 186 | rintro _ ⟨p, hp, rfl⟩ |
| 187 | rcases hp with hp | hp |
| 188 | · have heq : p = (p.1, 0) := Prod.ext rfl hp.2 |
| 189 | rw [heq] |
| 190 | exact (hsmall i p.1 hp.1).1 |
| 191 | · have heq : p = (0, p.2) := Prod.ext hp.1 rfl |
| 192 | rw [heq] |
| 193 | exact (hsmall i p.2 hp.2).2 |
| 194 | rw [m64Intrinsic_cap_inter_eq_common_axes H C hsector haxes (by simp), |
| 195 | ← Set.InjOn.image_inter H.injOn (hsource _) (hsource _), |
| 196 | signed_axes_inter_vertical hr j] |
| 197 | |
| 198 | private theorem common_opposite_sector_eq_zero {i : Bool × Bool} {q : ℝ × ℝ} |
| 199 | (hi : q ∈ (sectorParameterEquiv 0 i) '' {p : ℝ × ℝ | 0 ≤ p.1 ∧ 0 ≤ p.2}) |
| 200 | (hj : q ∈ (sectorParameterEquiv 0 (!i.1, !i.2)) '' |
| 201 | {p : ℝ × ℝ | 0 ≤ p.1 ∧ 0 ≤ p.2}) : q = 0 := by |
| 202 | obtain ⟨p, hp, rfl⟩ := hi |
| 203 | obtain ⟨w, hw, heq⟩ := hj |
| 204 | have heq1 := congrArg Prod.fst heq |
| 205 | have heq2 := congrArg Prod.snd heq |
| 206 | rcases i with ⟨i, j⟩ |
| 207 | cases i <;> cases j <;> apply Prod.ext <;> |
| 208 | simp only [sectorParameterEquiv_apply, Bool.not_false, Bool.not_true, |
| 209 | Bool.false_eq_true, ↓reduceIte] at heq1 heq2 ⊢ <;> dsimp at heq1 heq2 ⊢ <;> |
| 210 | linarith [hp.1, hp.2, hw.1, hw.2] |
| 211 | |
| 212 | /-- Opposite fitted caps share only the original return corner. Source: |
| 213 | `proof-work/tasks/M64/reports/2026-09-24-attached-return-bands.md`, Actual attached return |
| 214 | bands and cap intersections. -/ |
| 215 | theorem m64Intrinsic_opposite_caps_inter |
| 216 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) {r : ℝ} (hr : 0 ≤ r) |
| 217 | (C : Bool × Bool → Set AnnulusCoordinates) |
| 218 | (hsector : ∀ i, C i ⊆ H '' (H.source ∩ (sectorParameterEquiv 0 i) '' |
| 219 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 220 | (haxes : ∀ i, C i ∩ H '' (H.source ∩ {q : ℝ × ℝ | q.1 = 0 ∨ q.2 = 0}) = |
| 221 | H '' ((sectorParameterEquiv 0 i) '' |
| 222 | ((Icc (0 : ℝ) r ×ˢ {0}) ∪ ({0} ×ˢ Icc (0 : ℝ) r)))) (i : Bool × Bool) : |
| 223 | C i ∩ C (!i.1, !i.2) = {H 0} := by |
| 224 | have hbase (j : Bool × Bool) : H 0 ∈ C j := by |
| 225 | apply ((haxes j).superset ?_).1 |
| 226 | refine ⟨0, ⟨0, Or.inl ⟨⟨le_rfl, hr⟩, rfl⟩, ?_⟩, rfl⟩ |
| 227 | exact sectorParameterEquiv_zero 0 j |
| 228 | ext z |
| 229 | constructor |
| 230 | · rintro ⟨hzi, hzj⟩ |
| 231 | obtain ⟨p, hp, hpz⟩ := hsector i hzi |
| 232 | obtain ⟨q, hq, hqz⟩ := hsector (!i.1, !i.2) hzj |
| 233 | have hpq := H.injOn hp.1 hq.1 (hpz.trans hqz.symm) |
| 234 | have hp0 := common_opposite_sector_eq_zero hp.2 (hpq.symm ▸ hq.2) |
| 235 | exact (hpz.symm.trans (congrArg H hp0) : z = H 0) |
| 236 | · rintro rfl |
| 237 | exact ⟨hbase i, hbase _⟩ |
| 238 | |
| 239 | end PoincareMT |