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.Small.CapPatchChain |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Arc.BandOppositeNeighborhood |
| 3 | |
| 4 | /-! Sequential construction of both cap-to-patch chains with disjoint |
| 5 | closed carriers. Source: MT Claim 19.40, pp. 470-471; three-arc |
| 6 | cap/patch seed derivation, Section 5. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter |
| 13 | open scoped Topology ContDiff |
| 14 | open Poincare.Topology.Plane.Curves PoincareMT.Topology.Surface |
| 15 | open ChartCircleArrangementVertexPatch |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | /-- The two original joined pieces acquire disjoint occupied chains. Their physical patch |
| 20 | cuts satisfy the same previously fixed nesting bound, and the remaining frontier has an open |
| 21 | neighborhood missing both chains. Source: MT Claim 19.40; three-arc cap/patch seed, Section |
| 22 | 5. Construction: proof-work/tasks/M64/derivations/2026-09-27-three-arc-cap-patch-seed.md, |
| 23 | Section 5. -/ |
| 24 | theorem m64Intrinsic_exists_paired_cap_patch_chains |
| 25 | (gamma : Bool → ℝ → AnnulusCoordinates) (T r b : Bool → ℝ) |
| 26 | (hg : ∀ e, ContDiff ℝ ∞ (gamma e)) (hr : ∀ e, 0 < r e) (hrT : ∀ e, r e < T e) |
| 27 | (hb : ∀ e, b e ∈ Ioo (0 : ℝ) (T e)) |
| 28 | (hgap : ∀ e : Bool, (if e then b e else r e) < if e then T e - r e else b e) |
| 29 | (hinj : ∀ e, InjOn (gamma e) (Icc 0 (T e))) |
| 30 | (hregular : ∀ e, ∀ t ∈ Ioo (0 : ℝ) (T e), deriv (gamma e) t ≠ 0) |
| 31 | {K U V : Set AnnulusCoordinates} (hK : IsCompact K) |
| 32 | (havoid : ∀ e, ∀ t ∈ Ioo (0 : ℝ) (T e), |
| 33 | gamma e t ∉ gamma (!e) '' Icc 0 (T (!e)) ∪ K) |
| 34 | (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 35 | (hfront : ∀ e, frontier U = gamma e '' Icc 0 (T e) ∪ |
| 36 | (gamma (!e) '' Icc 0 (T (!e)) ∪ K)) |
| 37 | (hfV : frontier V = frontier U) |
| 38 | (hray : ∀ e, ∀ t ∈ Ioo (0 : ℝ) (T e), ∀ᶠ z in 𝓝[>] (0 : ℝ), |
| 39 | gamma e t + z • quarterTurn (deriv (gamma e) t) ∈ U) |
| 40 | (H : Bool → OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 41 | (F : Bool → Bool × Bool → OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 42 | (positive : Bool → Bool) |
| 43 | (hcap : ∀ e i, |
| 44 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r e} ⊆ (F e i).source ∧ |
| 45 | ContDiffOn ℝ ∞ (F e i) (F e i).source ∧ |
| 46 | ContDiffOn ℝ ∞ (F e i).symm (F e i).target ∧ |
| 47 | (∀ s ∈ Icc (0 : ℝ) (r e), F e i (s, 0) = H e (sectorParameterEquiv 0 i (s, 0))) ∧ |
| 48 | (∀ s ∈ Icc (0 : ℝ) (r e), F e i (0, s) = H e (sectorParameterEquiv 0 i (0, s))) ∧ |
| 49 | (∀ t : ℝ, F e i ((1 - t) * r e, t * r e) = |
| 50 | (1 - t) • F e i (r e, 0) + t • F e i (0, r e)) ∧ |
| 51 | F e i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r e} ⊆ |
| 52 | H e '' ((H e).source ∩ (sectorParameterEquiv 0 i) '' |
| 53 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 54 | (haxis : ∀ (e : Bool) (s : ℝ), H e (s, 0) = gamma e (if e then T e - s else s)) |
| 55 | (htip : ∀ e, (r e, (0 : ℝ)) ∈ (H e).source) |
| 56 | (L : Bool → (ℝ × ℝ) ≃L[ℝ] AnnulusCoordinates) (f : Bool → ℝ → ℝ) |
| 57 | (a0 a1 ua wa ub wb ra rb : Bool → ℝ) (ha01 : ∀ e, a0 e < a1 e) |
| 58 | (P : ∀ e, ObliqueBandFaces |
| 59 | (collarParameterEquiv.trans (L e)).toHomeomorph.toOpenPartialHomeomorph |
| 60 | (f e) (a0 e) (a1 e) (ua e) (wa e) (ub e) (wb e) (ra e) (rb e)) |
| 61 | (hbase : ∀ e : Bool, |
| 62 | L e (if e then a1 e else a0 e, f e (if e then a1 e else a0 e)) = gamma e (b e)) |
| 63 | (htangent : ∀ e : Bool, ∃ speed : ℝ, 0 < speed ∧ |
| 64 | deriv (gamma e) (b e) = speed • L e (1, deriv (f e) (if e then a1 e else a0 e))) |
| 65 | (htrans : ∀ e : Bool, 0 < inner ℝ (quarterTurn (deriv (gamma e) (b e))) |
| 66 | (if e then L e (ub e, wb e) else L e (ua e, wa e))) |
| 67 | (hlower : ∀ e : Bool, |
| 68 | (P e).lowerArc = if e then gamma e '' Icc 0 (b e) else gamma e '' Icc (b e) (T e)) |
| 69 | (hopen : ∀ e, (P e).carrier \ (P e).lowerArc ⊆ U) |
| 70 | {delta : ℝ} (hdelta : 0 < delta) : |
| 71 | let C (e : Bool) := ⋃ i, |
| 72 | ⋃ (_ : if positive e then i = (true, true) else i ≠ (true, true)), |
| 73 | F e i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r e} |
| 74 | (∀ e, C e ⊆ closure U) → |
| 75 | (∀ e, Disjoint (C e) ((P false).carrier ∪ (P true).carrier)) → |
| 76 | (∀ e, Disjoint (C e) (gamma (!e) '' Icc 0 (T (!e)))) → |
| 77 | (∀ e : Bool, C e ∩ frontier U ⊆ |
| 78 | (fun s => gamma e (if e then T e - s else s)) '' Icc 0 (r e) ∪ |
| 79 | (gamma (!e) '' Icc 0 (T (!e)) ∪ K)) → |
| 80 | (∀ e : Bool, ∃ W : Set AnnulusCoordinates, IsOpen W ∧ |
| 81 | gamma e (if e then T e else 0) ∈ W ∧ W ∩ closure U ⊆ C e) → |
| 82 | ∃ E : ∀ e : Bool, M64IntrinsicArcBandChain (gamma e) |
| 83 | (if e then b e else r e) (if e then T e - r e else b e) U, |
| 84 | (∀ e : Bool, |
| 85 | (E e).length ≤ 1 ∧ (E e).length * (if e then rb e else ra e) < delta ∧ |
| 86 | (E e).direction (if e then T e - r e else r e) = |
| 87 | F e (true, positive e) (0, r e) - F e (true, positive e) (r e, 0) ∧ |
| 88 | (E e).direction (b e) = (if e then rb e else ra e) • |
| 89 | (if e then L e (ub e, wb e) else L e (ua e, wa e)) ∧ |
| 90 | (∀ z ∈ Icc (0 : ℝ) 1, gamma e (if e then T e - r e else r e) + |
| 91 | z • (E e).direction (if e then T e - r e else r e) ∈ C e) ∧ |
| 92 | (∀ z ∈ Icc (0 : ℝ) 1, gamma e (b e) + z • (E e).direction (b e) ∈ |
| 93 | (P e).carrier ∪ (P (!e)).carrier) ∧ |
| 94 | (∀ i, ((E e).band i).carrier ⊆ (C (!e))ᶜ) ∧ |
| 95 | (∀ i, (C e ∪ ((P e).carrier ∪ (P (!e)).carrier)) ∩ ((E e).band i).carrier = |
| 96 | (if (E e).cut i.castSucc = (if e then b e else r e) |
| 97 | then ((E e).band i).leftCut else ∅) ∪ |
| 98 | (if (E e).cut i.succ = (if e then T e - r e else b e) |
| 99 | then ((E e).band i).rightCut else ∅)) ∧ |
| 100 | ∀ p ∈ (if e then Ioc (b e) (T e) else Ico 0 (b e)), |
| 101 | ∃ W : Set AnnulusCoordinates, IsOpen W ∧ gamma e p ∈ W ∧ |
| 102 | W ∩ closure U ⊆ C e ∪ ⋃ i, ((E e).band i).carrier) ∧ |
| 103 | (∀ i j, Disjoint ((E false).band i).carrier ((E true).band j).carrier) ∧ |
| 104 | IsOpen ((⋃ i, ((E false).band i).carrier) ∪ (⋃ i, ((E true).band i).carrier))ᶜ ∧ |
| 105 | K ⊆ ((⋃ i, ((E false).band i).carrier) ∪ (⋃ i, ((E true).band i).carrier))ᶜ := by |
| 106 | classical |
| 107 | intro C hCsub hCP hCother hCfront hcorner |
| 108 | have hCclosed (e : Bool) : IsClosed (C e) := by |
| 109 | apply IsCompact.isClosed |
| 110 | apply isCompact_iUnion |
| 111 | intro i |
| 112 | apply isCompact_iUnion |
| 113 | intro _ |
| 114 | exact m64Intrinsic_cap_isCompact (F e i) (hcap e i).1 |
| 115 | have hPfull (e : Bool) : (P e).lowerArc ⊆ gamma e '' Icc 0 (T e) := by |
| 116 | rw [hlower] |
| 117 | cases e |
| 118 | · exact image_mono (Icc_subset_Icc (hb false).1.le le_rfl) |
| 119 | · exact image_mono (Icc_subset_Icc le_rfl (hb true).2.le) |
| 120 | have hZfront (e : Bool) : (P (!e)).carrier ∩ frontier U ⊆ |
| 121 | gamma (!e) '' Icc 0 (T (!e)) ∪ K := by |
| 122 | rintro p ⟨hp, hpf⟩ |
| 123 | by_cases hl : p ∈ (P (!e)).lowerArc |
| 124 | · exact Or.inl (hPfull (!e) hl) |
| 125 | · exact ((disjoint_frontier_iff_isOpen.mpr hU).le_bot |
| 126 | ⟨hpf, hopen (!e) ⟨hp, hl⟩⟩).elim |
| 127 | have hwhole (e : Bool) : (P e).carrier ∪ (P (!e)).carrier = |
| 128 | (P false).carrier ∪ (P true).carrier := by |
| 129 | cases e |
| 130 | · rfl |
| 131 | · exact union_comm _ _ |
| 132 | have hclosedRemainder (e : Bool) : |
| 133 | IsCompact (gamma (!e) '' Icc 0 (T (!e)) ∪ K) := |
| 134 | (isCompact_Icc.image (hg (!e)).continuous).union hK |
| 135 | have hdisjRemainder (e : Bool) : Disjoint (gamma e '' Ioo 0 (T e)) |
| 136 | (gamma (!e) '' Icc 0 (T (!e)) ∪ K) := by |
| 137 | apply disjoint_left.mpr |
| 138 | rintro _ ⟨t, ht, rfl⟩ hp |
| 139 | exact havoid e t ht hp |
| 140 | have htrim (e : Bool) : Icc (if e then b e else r e) (if e then T e - r e else b e) ⊆ |
| 141 | Ioo (0 : ℝ) (T e) := by |
| 142 | intro t ht |
| 143 | cases e |
| 144 | · exact ⟨(hr false).trans_le ht.1, ht.2.trans_lt (hb false).2⟩ |
| 145 | · exact ⟨(hb true).1.trans_le ht.1, ht.2.trans_lt (sub_lt_self _ (hr true))⟩ |
| 146 | have hbuild (e : Bool) (O : Set AnnulusCoordinates) (hO : IsOpen O) |
| 147 | (haxisO : gamma e '' Icc (if e then b e else r e) |
| 148 | (if e then T e - r e else b e) ⊆ O) := |
| 149 | m64Intrinsic_exists_small_cap_patch_chain (hg e) (hr e) (hrT e) (hb e) hdelta e |
| 150 | (hgap e) (hinj e) (hregular e) (hclosedRemainder e) (havoid e) |
| 151 | hU hV hUV (hfront e) hfV (hray e) (H e) (F e) (positive e) false |
| 152 | (fun i => (hcap e i).1) (fun i => (hcap e i).2.1) (fun i => (hcap e i).2.2.1) |
| 153 | (fun i => (hcap e i).2.2.2.1) (fun i => (hcap e i).2.2.2.2.1) |
| 154 | (fun i => (hcap e i).2.2.2.2.2.1) (fun i => (hcap e i).2.2.2.2.2.2) |
| 155 | (haxis e) (htip e) (L e) (ha01 e) (P e) (hbase e) (htangent e) (htrans e) |
| 156 | (hlower e) (hopen e) (P (!e)).isClosed_carrier (hZfront e) hO haxisO |
| 157 | (hCsub e) (by rw [hwhole]; exact hCP e) (hCfront e) (hcorner e) |
| 158 | obtain ⟨E0, hE0⟩ := hbuild false (C true)ᶜ (hCclosed true).isOpen_compl (by |
| 159 | intro p hp |
| 160 | exact fun hpC => disjoint_left.mp (hCother true) hpC |
| 161 | (image_mono (fun _ ht => Ioo_subset_Icc_self (htrim false ht)) hp)) |
| 162 | have havoidChains (e : Bool) |
| 163 | (E : M64IntrinsicArcBandChain (gamma e) |
| 164 | (if e then b e else r e) (if e then T e - r e else b e) U) : |
| 165 | IsOpen (⋃ i, (E.band i).carrier)ᶜ ∧ |
| 166 | gamma (!e) '' Icc 0 (T (!e)) ∪ K ⊆ (⋃ i, (E.band i).carrier)ᶜ := |
| 167 | m64Intrinsic_arc_band_carriers_avoid_remainder |
| 168 | (fun i => (E.band i).carrier) (fun i => (E.band i).lowerArc) |
| 169 | (fun i => (E.band i).isClosed_carrier) hU (hfront e) (hdisjRemainder e) |
| 170 | (fun i => (E.lower_subset i).trans (image_mono (htrim e))) E.off_lower |
| 171 | have havoid0 := havoidChains false E0 |
| 172 | let O1 := (C false ∪ ⋃ i, (E0.band i).carrier)ᶜ |
| 173 | have hO1 : IsOpen O1 := |
| 174 | ((hCclosed false).union |
| 175 | (isClosed_iUnion_of_finite (fun i => (E0.band i).isClosed_carrier))).isOpen_compl |
| 176 | obtain ⟨E1, hE1⟩ := hbuild true O1 hO1 (by |
| 177 | intro p hp |
| 178 | have hpfull := image_mono (fun _ ht => Ioo_subset_Icc_self (htrim true ht)) hp |
| 179 | rintro (hpC | hpE) |
| 180 | · exact disjoint_left.mp (hCother false) hpC hpfull |
| 181 | · exact havoid0.2 (Or.inl hpfull) hpE) |
| 182 | let E (e : Bool) : M64IntrinsicArcBandChain (gamma e) |
| 183 | (if e then b e else r e) (if e then T e - r e else b e) U := |
| 184 | Bool.rec E0 E1 e |
| 185 | have havoid1 := havoidChains true E1 |
| 186 | have hE1O := hE1.2.2.2.2.2.2.1 |
| 187 | refine ⟨E, ?_, ?_, ?_, ?_⟩ |
| 188 | · intro e |
| 189 | cases e |
| 190 | · exact hE0 |
| 191 | · refine ⟨hE1.1, hE1.2.1, hE1.2.2.1, hE1.2.2.2.1, |
| 192 | hE1.2.2.2.2.1, hE1.2.2.2.2.2.1, ?_, hE1.2.2.2.2.2.2.2⟩ |
| 193 | intro i p hp hpC |
| 194 | exact hE1O i hp (Or.inl hpC) |
| 195 | · intro i j |
| 196 | exact disjoint_left.mpr (fun p h0 h1 => hE1O j h1 (Or.inr (mem_iUnion.mpr ⟨i, h0⟩))) |
| 197 | · exact ((isClosed_iUnion_of_finite (fun i => (E0.band i).isClosed_carrier)).union |
| 198 | (isClosed_iUnion_of_finite (fun i => (E1.band i).isClosed_carrier))).isOpen_compl |
| 199 | · intro p hp |
| 200 | rintro (h0 | h1) |
| 201 | · exact havoid0.2 (Or.inr hp) h0 |
| 202 | · exact havoid1.2 (Or.inr hp) h1 |
| 203 | |
| 204 | end PoincareMT |