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.Two.ArcRegion |
| 2 | |
| 3 | /-! |
| 4 | # First mutual contact of two normal rays |
| 5 | |
| 6 | Compactness selects an actual first mutual contact, minimizing the sum of |
| 7 | the two ray parameters. The truncated rays meet only at that contact. |
| 8 | Their embedded concatenation is constructed explicitly for the Jordan |
| 9 | region argument; no focusing estimate or polar lift is assumed here. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 12 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 13 | faces used in its regional Gauss--Bonnet arguments. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set Function |
| 20 | open scoped Topology |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | /-- Two compact continuous arcs with separate starting points have a first mutual contact. |
| 25 | Minimality of the sum of parameters excludes every other intersection of the two truncated |
| 26 | arcs, even before ray injectivity is used. Source: |
| 27 | `proof-work/tasks/M64/derivations/2026-09-25-crossing-annular-region.md`, Construction. -/ |
| 28 | theorem m64Intrinsic_exists_first_crossing |
| 29 | {alpha beta : ℝ → AnnulusCoordinates} {A B : ℝ} |
| 30 | (ha : Continuous alpha) (hb : Continuous beta) |
| 31 | (ha0 : alpha 0 ∉ beta '' Icc 0 B) (hb0 : beta 0 ∉ alpha '' Icc 0 A) |
| 32 | (hmeet : ∃ s ∈ Icc 0 A, ∃ t ∈ Icc 0 B, alpha s = beta t) : |
| 33 | ∃ s t : ℝ, 0 < s ∧ s ≤ A ∧ 0 < t ∧ t ≤ B ∧ alpha s = beta t ∧ |
| 34 | ∀ x ∈ Icc 0 s, ∀ y ∈ Icc 0 t, |
| 35 | alpha x = beta y → x = s ∧ y = t := by |
| 36 | let C : Set (ℝ × ℝ) := (Icc 0 A ×ˢ Icc 0 B) ∩ |
| 37 | {p | alpha p.1 = beta p.2} |
| 38 | have hC : IsCompact C := |
| 39 | (isCompact_Icc.prod isCompact_Icc).inter_right |
| 40 | (isClosed_eq (ha.comp continuous_fst) (hb.comp continuous_snd)) |
| 41 | obtain ⟨s, hs, t, ht, hst⟩ := hmeet |
| 42 | have hCne : C.Nonempty := ⟨(s, t), ⟨⟨hs, ht⟩, hst⟩⟩ |
| 43 | obtain ⟨p, hp, hmin⟩ := hC.exists_isMinOn hCne |
| 44 | (continuous_fst.add continuous_snd).continuousOn |
| 45 | have hpEq : alpha p.1 = beta p.2 := hp.2 |
| 46 | have hp0 : 0 < p.1 := by |
| 47 | apply lt_of_le_of_ne hp.1.1.1 |
| 48 | intro hzero |
| 49 | apply ha0 |
| 50 | exact ⟨p.2, hp.1.2, by simpa only [← hzero] using hpEq.symm⟩ |
| 51 | have hp1 : 0 < p.2 := by |
| 52 | apply lt_of_le_of_ne hp.1.2.1 |
| 53 | intro hzero |
| 54 | apply hb0 |
| 55 | exact ⟨p.1, hp.1.1, by simpa only [← hzero] using hpEq⟩ |
| 56 | refine ⟨p.1, p.2, hp0, hp.1.1.2, hp1, hp.1.2.2, hp.2, ?_⟩ |
| 57 | intro x hx y hy hxy |
| 58 | have hxyC : (x, y) ∈ C := |
| 59 | ⟨⟨⟨hx.1, hx.2.trans hp.1.1.2⟩, ⟨hy.1, hy.2.trans hp.1.2.2⟩⟩, hxy⟩ |
| 60 | have hsum := hmin hxyC |
| 61 | change p.1 + p.2 ≤ x + y at hsum |
| 62 | constructor <;> linarith [hx.2, hy.2] |
| 63 | |
| 64 | /-- Embedded arcs meeting only at the end of the first and the start of the second |
| 65 | concatenate to an actual embedded unit-interval arc. Source: |
| 66 | `proof-work/tasks/M64/derivations/2026-09-25-crossing-annular-region.md`, Construction. -/ |
| 67 | theorem m64Intrinsic_exists_embedded_join |
| 68 | {alpha beta : ℝ → AnnulusCoordinates} |
| 69 | (ha : ContinuousOn alpha (Icc 0 1)) (hb : ContinuousOn beta (Icc 0 1)) |
| 70 | (hai : InjOn alpha (Icc 0 1)) (hbi : InjOn beta (Icc 0 1)) |
| 71 | (hend : alpha 1 = beta 0) |
| 72 | (hmeet : ∀ s ∈ Icc 0 1, ∀ t ∈ Icc 0 1, |
| 73 | alpha s = beta t → s = 1 ∧ t = 0) : |
| 74 | ∃ gamma : ℝ → AnnulusCoordinates, |
| 75 | ContinuousOn gamma (Icc 0 1) ∧ InjOn gamma (Icc 0 1) ∧ |
| 76 | gamma 0 = alpha 0 ∧ gamma 1 = beta 1 ∧ |
| 77 | gamma '' Icc 0 1 = alpha '' Icc 0 1 ∪ beta '' Icc 0 1 := by |
| 78 | classical |
| 79 | let gamma : ℝ → AnnulusCoordinates := |
| 80 | fun t => if t ≤ 1 / 2 then alpha (2 * t) else beta (2 * t - 1) |
| 81 | have hgc : ContinuousOn gamma (Icc 0 1) := by |
| 82 | apply ContinuousOn.if |
| 83 | · intro t ht |
| 84 | have ht' : t = 1 / 2 := by |
| 85 | have h := ht.2 |
| 86 | change t ∈ frontier (Iic (1 / 2 : ℝ)) at h |
| 87 | simpa only [frontier_Iic, mem_singleton_iff] using h |
| 88 | subst t |
| 89 | simpa using hend |
| 90 | · apply ha.comp (continuous_const.mul continuous_id).continuousOn |
| 91 | intro t ht |
| 92 | have ht' : t ≤ 1 / 2 := by |
| 93 | have h := ht.2 |
| 94 | change t ∈ closure (Iic (1 / 2 : ℝ)) at h |
| 95 | simpa only [isClosed_Iic.closure_eq, mem_Iic] using h |
| 96 | change 2 * t ∈ Icc (0 : ℝ) 1 |
| 97 | exact ⟨by linarith [ht.1.1], by linarith⟩ |
| 98 | · apply hb.comp ((continuous_const.mul continuous_id).sub continuous_const).continuousOn |
| 99 | intro t ht |
| 100 | have ht' : 1 / 2 ≤ t := by |
| 101 | have h := ht.2 |
| 102 | simp only [not_le] at h |
| 103 | change t ∈ closure (Ioi (1 / 2 : ℝ)) at h |
| 104 | simpa only [closure_Ioi, mem_Ici] using h |
| 105 | change 2 * t - 1 ∈ Icc (0 : ℝ) 1 |
| 106 | exact ⟨by linarith, by linarith [ht.1.2]⟩ |
| 107 | have hgi : InjOn gamma (Icc 0 1) := by |
| 108 | intro s hs t ht heq |
| 109 | wlog hst : s ≤ t generalizing s t |
| 110 | · exact (this ht hs heq.symm (le_of_not_ge hst)).symm |
| 111 | by_cases ht2 : t ≤ 1 / 2 |
| 112 | · have hs2 := hst.trans ht2 |
| 113 | have h := hai (x₁ := 2 * s) (x₂ := 2 * t) |
| 114 | ⟨by linarith [hs.1], by linarith⟩ |
| 115 | ⟨by linarith [ht.1], by linarith⟩ |
| 116 | (by simpa only [gamma, if_pos hs2, if_pos ht2] using heq) |
| 117 | linarith |
| 118 | · by_cases hs2 : s ≤ 1 / 2 |
| 119 | · have h := hmeet (2 * s) ⟨by linarith [hs.1], by linarith⟩ |
| 120 | (2 * t - 1) ⟨by linarith, by linarith [ht.2]⟩ |
| 121 | (by simpa only [gamma, if_pos hs2, if_neg ht2] using heq) |
| 122 | linarith [h.2] |
| 123 | · have h := hbi (x₁ := 2 * s - 1) (x₂ := 2 * t - 1) |
| 124 | ⟨by linarith, by linarith [hs.2]⟩ |
| 125 | ⟨by linarith, by linarith [ht.2]⟩ |
| 126 | (by simpa only [gamma, if_neg hs2, if_neg ht2] using heq) |
| 127 | linarith |
| 128 | refine ⟨gamma, hgc, hgi, by norm_num [gamma], by norm_num [gamma], ?_⟩ |
| 129 | apply Subset.antisymm |
| 130 | · rintro p ⟨t, ht, rfl⟩ |
| 131 | by_cases ht2 : t ≤ 1 / 2 |
| 132 | · exact Or.inl ⟨2 * t, ⟨by linarith [ht.1], by linarith⟩, |
| 133 | (if_pos ht2).symm⟩ |
| 134 | · exact Or.inr ⟨2 * t - 1, ⟨by linarith, by linarith [ht.2]⟩, |
| 135 | (if_neg ht2).symm⟩ |
| 136 | · rintro p (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) |
| 137 | · refine ⟨t / 2, ⟨by linarith [ht.1], by linarith [ht.2]⟩, ?_⟩ |
| 138 | simp only [gamma, if_pos (by linarith [ht.2] : t / 2 ≤ 1 / 2)] |
| 139 | congr 1 |
| 140 | ring |
| 141 | · refine ⟨(t + 1) / 2, ⟨by linarith [ht.1], by linarith [ht.2]⟩, ?_⟩ |
| 142 | by_cases ht0 : t = 0 |
| 143 | · subst t |
| 144 | simpa [gamma] using hend |
| 145 | · have htpos : 0 < t := lt_of_le_of_ne ht.1 (Ne.symm ht0) |
| 146 | simp only [gamma, if_neg (by linarith : ¬ (t + 1) / 2 ≤ 1 / 2)] |
| 147 | congr 1 |
| 148 | ring |
| 149 | |
| 150 | /-- Two embedded crossing rays attached to the distinct endpoints of an embedded boundary |
| 151 | arc enclose an actual Jordan region. The first contact and the truncated frontier are |
| 152 | constructed, not supplied as extra data. Source: |
| 153 | `proof-work/tasks/M64/derivations/2026-09-25-crossing-annular-region.md`, Construction. -/ |
| 154 | theorem m64Intrinsic_exists_crossing_ray_region |
| 155 | {alpha beta base : ℝ → AnnulusCoordinates} {A B : ℝ} |
| 156 | (ha : Continuous alpha) (hb : Continuous beta) |
| 157 | (hai : InjOn alpha (Icc 0 A)) (hbi : InjOn beta (Icc 0 B)) |
| 158 | (hc : ContinuousOn base (Icc 0 1)) (hci : InjOn base (Icc 0 1)) |
| 159 | (hstart : base 0 = alpha 0) (hend : base 1 = beta 0) |
| 160 | (hca : ∀ x ∈ Icc 0 1, ∀ t ∈ Icc 0 A, |
| 161 | base x = alpha t → x = 0 ∧ t = 0) |
| 162 | (hcb : ∀ x ∈ Icc 0 1, ∀ t ∈ Icc 0 B, |
| 163 | base x = beta t → x = 1 ∧ t = 0) |
| 164 | (hmeet : ∃ s ∈ Icc 0 A, ∃ t ∈ Icc 0 B, alpha s = beta t) : |
| 165 | ∃ s t : ℝ, 0 < s ∧ s ≤ A ∧ 0 < t ∧ t ≤ B ∧ alpha s = beta t ∧ |
| 166 | ∃ U V : Set AnnulusCoordinates, |
| 167 | IsOpen U ∧ IsOpen V ∧ IsPathConnected U ∧ IsPathConnected V ∧ |
| 168 | Bornology.IsBounded U ∧ ¬ Bornology.IsBounded V ∧ Disjoint U V ∧ |
| 169 | U ∪ V = (base '' Icc 0 1 ∪ (alpha '' Icc 0 s ∪ beta '' Icc 0 t))ᶜ ∧ |
| 170 | frontier U = base '' Icc 0 1 ∪ (alpha '' Icc 0 s ∪ beta '' Icc 0 t) ∧ |
| 171 | frontier V = base '' Icc 0 1 ∪ (alpha '' Icc 0 s ∪ beta '' Icc 0 t) ∧ |
| 172 | IsCompact (closure U) := by |
| 173 | have ha0 : alpha 0 ∉ beta '' Icc 0 B := by |
| 174 | rintro ⟨t, ht, heq⟩ |
| 175 | have h := (hcb 0 (by norm_num) t ht (hstart.trans heq.symm)).1 |
| 176 | norm_num at h |
| 177 | have hb0 : beta 0 ∉ alpha '' Icc 0 A := by |
| 178 | rintro ⟨s, hs, heq⟩ |
| 179 | have h := (hca 1 (by norm_num) s hs (hend.trans heq.symm)).1 |
| 180 | norm_num at h |
| 181 | obtain ⟨s, t, hs, hsA, ht, htB, hst, hfirst⟩ := |
| 182 | m64Intrinsic_exists_first_crossing ha hb ha0 hb0 hmeet |
| 183 | let f : ℝ → AnnulusCoordinates := fun x => alpha (s * x) |
| 184 | let g : ℝ → AnnulusCoordinates := fun x => beta (t * (1 - x)) |
| 185 | have hsparam (x : ℝ) (hx : x ∈ Icc 0 1) : s * x ∈ Icc 0 s := |
| 186 | ⟨mul_nonneg hs.le hx.1, by nlinarith [hx.2]⟩ |
| 187 | have htparam (x : ℝ) (hx : x ∈ Icc 0 1) : t * (1 - x) ∈ Icc 0 t := |
| 188 | ⟨by nlinarith [hx.2], by nlinarith [hx.1]⟩ |
| 189 | have hf : ContinuousOn f (Icc 0 1) := |
| 190 | (ha.comp (continuous_const.mul continuous_id)).continuousOn |
| 191 | have hg : ContinuousOn g (Icc 0 1) := |
| 192 | (hb.comp (continuous_const.mul (continuous_const.sub continuous_id))).continuousOn |
| 193 | have hfi : InjOn f (Icc 0 1) := by |
| 194 | intro x hx y hy hxy |
| 195 | have h := hai ⟨(hsparam x hx).1, (hsparam x hx).2.trans hsA⟩ |
| 196 | ⟨(hsparam y hy).1, (hsparam y hy).2.trans hsA⟩ hxy |
| 197 | exact mul_left_cancel₀ hs.ne' h |
| 198 | have hgi : InjOn g (Icc 0 1) := by |
| 199 | intro x hx y hy hxy |
| 200 | have h := hbi ⟨(htparam x hx).1, (htparam x hx).2.trans htB⟩ |
| 201 | ⟨(htparam y hy).1, (htparam y hy).2.trans htB⟩ hxy |
| 202 | nlinarith |
| 203 | have hfg : f 1 = g 0 := by simpa only [f, g, mul_one, sub_zero] using hst |
| 204 | have hfgmeet : ∀ x ∈ Icc 0 1, ∀ y ∈ Icc 0 1, |
| 205 | f x = g y → x = 1 ∧ y = 0 := by |
| 206 | intro x hx y hy hxy |
| 207 | have h := hfirst (s * x) (hsparam x hx) (t * (1 - y)) (htparam y hy) hxy |
| 208 | constructor <;> nlinarith [h.1, h.2] |
| 209 | obtain ⟨q, hq, hqi, hq0, hq1, hqimage⟩ := |
| 210 | m64Intrinsic_exists_embedded_join hf hg hfi hgi hfg hfgmeet |
| 211 | have hfimage : f '' Icc 0 1 = alpha '' Icc 0 s := by |
| 212 | change (alpha ∘ fun x => s * x) '' Icc 0 1 = _ |
| 213 | rw [image_comp, image_mul_left_Icc' hs] |
| 214 | simp only [mul_zero, mul_one] |
| 215 | have hgimage : g '' Icc 0 1 = beta '' Icc 0 t := by |
| 216 | change (beta ∘ (fun x => t * x) ∘ (fun x => 1 - x)) '' Icc 0 1 = _ |
| 217 | rw [image_comp, image_comp, image_const_sub_Icc] |
| 218 | norm_num only [sub_self, sub_zero] |
| 219 | rw [image_mul_left_Icc' ht] |
| 220 | simp only [mul_zero, mul_one] |
| 221 | have hq0' : q 0 = alpha 0 := by simpa only [f, mul_zero] using hq0 |
| 222 | have hq1' : q 1 = beta 0 := by simpa only [g, sub_self, mul_zero] using hq1 |
| 223 | have hbaseq : ∀ x ∈ Icc 0 1, ∀ y ∈ Icc 0 1, |
| 224 | base x = q y → (x = 0 ∧ y = 0) ∨ (x = 1 ∧ y = 1) := by |
| 225 | intro x hx y hy hxy |
| 226 | have hyimage : q y ∈ f '' Icc 0 1 ∪ g '' Icc 0 1 := |
| 227 | hqimage ▸ mem_image_of_mem q hy |
| 228 | rcases hyimage with ⟨z, hz, hzq⟩ | ⟨z, hz, hzq⟩ |
| 229 | · have h := hca x hx (s * z) |
| 230 | ⟨(hsparam z hz).1, (hsparam z hz).2.trans hsA⟩ (hxy.trans hzq.symm) |
| 231 | refine Or.inl ⟨h.1, hqi hy (by norm_num) ?_⟩ |
| 232 | rw [← hxy, h.1, hq0', hstart] |
| 233 | · have h := hcb x hx (t * (1 - z)) |
| 234 | ⟨(htparam z hz).1, (htparam z hz).2.trans htB⟩ (hxy.trans hzq.symm) |
| 235 | refine Or.inr ⟨h.1, hqi hy (by norm_num) ?_⟩ |
| 236 | rw [← hxy, h.1, hq1', hend] |
| 237 | obtain ⟨U, V, hU, hV, hpU, hpV, hbU, hbV, hdisj, hcover, hfU, hfV, hcompact⟩ := |
| 238 | m64Intrinsic_exists_region_between_arcs hc hq hci hqi |
| 239 | (hstart.trans hq0'.symm) (hend.trans hq1'.symm) hbaseq |
| 240 | rw [hqimage, hfimage, hgimage] at hcover hfU hfV |
| 241 | exact ⟨s, t, hs, hsA, ht, htB, hst, U, V, hU, hV, hpU, hpV, hbU, hbV, |
| 242 | hdisj, hcover, hfU, hfV, hcompact⟩ |
| 243 | |
| 244 | end PoincareMT |