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.Regular.Loop |
| 2 | import PoincareLib.Topology.Plane.Curves.Graphs.Coordinates |
| 3 | |
| 4 | /-! |
| 5 | # Isolated smooth graph neighborhoods of the actual return loop |
| 6 | |
| 7 | A compact interior arc of a simple return loop is separated from its |
| 8 | parameter tails. The actual scalar inverse coordinates therefore describe |
| 9 | the whole loop in a neighborhood of that arc, not only the retained arc. |
| 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 Filter Metric |
| 20 | open scoped Topology ContDiff |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | /-- An interior graph arc of a simple loop has an open neighborhood in which the complete |
| 25 | loop is exactly the same graph. Source: |
| 26 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Constructed smooth |
| 27 | collar pieces of the actual loop region. -/ |
| 28 | theorem m64Intrinsic_loop_graph_neighborhood |
| 29 | {gamma : ℝ → AnnulusCoordinates} (hg : Continuous gamma) {T : ℝ} |
| 30 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 31 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) |
| 32 | (G : OpenPartialHomeomorph ℝ ℝ) (h : ℝ → ℝ) |
| 33 | {a b l r : ℝ} (hab : a ≤ b) (ha : 0 < a) (hb : b < T) |
| 34 | (hla : l < a) (hbr : b < r) (hsource : G.source = Ioo l r) |
| 35 | (hmono : StrictMonoOn G G.source) |
| 36 | (hgraph : ∀ t ∈ G.source, L (gamma t) = (G t, h (G t))) : |
| 37 | ∃ W : Set AnnulusCoordinates, IsOpen W ∧ gamma '' Icc a b ⊆ W ∧ |
| 38 | ∀ z ∈ W, (L z).1 ∈ G.target ∧ |
| 39 | (z ∈ gamma '' Icc 0 T ↔ (L z).2 = h (L z).1) := by |
| 40 | let c := (max l 0 + a) / 2 |
| 41 | let d := (b + min r T) / 2 |
| 42 | have hc : max l 0 < c ∧ c < a := by |
| 43 | have hlt := max_lt hla ha |
| 44 | dsimp only [c] |
| 45 | constructor <;> linarith |
| 46 | have hd : b < d ∧ d < min r T := by |
| 47 | have hlt := lt_min hbr hb |
| 48 | dsimp only [d] |
| 49 | constructor <;> linarith |
| 50 | have hcd : c < d := hc.2.trans_le hab |>.trans hd.1 |
| 51 | have hc0 : 0 < c := (le_max_right l 0).trans_lt hc.1 |
| 52 | have hdT : d < T := hd.2.trans_le (min_le_right r T) |
| 53 | have hJ : Icc c d ⊆ G.source := by |
| 54 | rw [hsource] |
| 55 | exact fun _ ht => ⟨(le_max_left l 0).trans_lt (hc.1.trans_le ht.1), |
| 56 | ht.2.trans_lt (hd.2.trans_le (min_le_left r T))⟩ |
| 57 | have hI : Icc a b ⊆ Ioo c d := |
| 58 | fun _ ht => ⟨hc.2.trans_le ht.1, ht.2.trans_lt hd.1⟩ |
| 59 | let tail : Set AnnulusCoordinates := gamma '' (Icc 0 c ∪ Icc d T) |
| 60 | have htail : IsClosed tail := |
| 61 | ((isCompact_Icc.union isCompact_Icc).image hg).isClosed |
| 62 | let W : Set AnnulusCoordinates := {z | (L z).1 ∈ Ioo (G c) (G d)} \ tail |
| 63 | have hW : IsOpen W := (isOpen_Ioo.preimage L.continuous.fst).sdiff htail |
| 64 | have havoid (x : ℝ) (hx : x ∈ Icc a b) : gamma x ∉ tail := by |
| 65 | rintro ⟨y, hy, hyx⟩ |
| 66 | have hxI : x ∈ Ico 0 T := ⟨ha.le.trans hx.1, hx.2.trans_lt hb⟩ |
| 67 | have hyI : y ∈ Icc 0 T := by |
| 68 | rcases hy with hy | hy |
| 69 | · exact ⟨hy.1, hy.2.trans (hcd.le.trans hdT.le)⟩ |
| 70 | · exact ⟨(hc0.le.trans hcd.le).trans hy.1, hy.2⟩ |
| 71 | have hylt : y < T := by |
| 72 | by_contra hn |
| 73 | have hyT : y = T := le_antisymm hyI.2 (le_of_not_gt hn) |
| 74 | have h0x : gamma 0 = gamma x := hend.trans (hyT ▸ hyx) |
| 75 | have hx0 := hinj ⟨le_rfl, ha.trans_le hab |>.trans hb⟩ hxI h0x |
| 76 | linarith [ha.trans_le hx.1] |
| 77 | have hyx' := hinj ⟨hyI.1, hylt⟩ hxI hyx |
| 78 | subst y |
| 79 | rcases hy with hy | hy |
| 80 | · exact not_le_of_gt (hI hx).1 hy.2 |
| 81 | · exact not_le_of_gt (hI hx).2 hy.1 |
| 82 | have himage : G '' Icc c d = Icc (G c) (G d) := |
| 83 | (G.continuousOn.mono hJ).image_Icc_of_monotoneOn hcd.le (hmono.monotoneOn.mono hJ) |
| 84 | refine ⟨W, hW, ?_, ?_⟩ |
| 85 | · rintro z ⟨t, ht, rfl⟩ |
| 86 | have htG := hJ (Ioo_subset_Icc_self (hI ht)) |
| 87 | refine ⟨?_, havoid t ht⟩ |
| 88 | change (L (gamma t)).1 ∈ Ioo (G c) (G d) |
| 89 | rw [hgraph t htG] |
| 90 | exact ⟨hmono (hJ (left_mem_Icc.mpr hcd.le)) htG (hI ht).1, |
| 91 | hmono htG (hJ (right_mem_Icc.mpr hcd.le)) (hI ht).2⟩ |
| 92 | · intro z hz |
| 93 | have hximage : (L z).1 ∈ G '' Icc c d := by |
| 94 | rw [himage] |
| 95 | exact Ioo_subset_Icc_self hz.1 |
| 96 | have hxtarget : (L z).1 ∈ G.target := by |
| 97 | obtain ⟨t, ht, heq⟩ := hximage |
| 98 | rw [← heq] |
| 99 | exact G.map_source (hJ ht) |
| 100 | refine ⟨hxtarget, ?_⟩ |
| 101 | constructor |
| 102 | · rintro ⟨t, ht, rfl⟩ |
| 103 | have htcd : t ∈ Ioo c d := by |
| 104 | constructor |
| 105 | · by_contra hn |
| 106 | exact hz.2 ⟨t, Or.inl ⟨ht.1, le_of_not_gt hn⟩, rfl⟩ |
| 107 | · by_contra hn |
| 108 | exact hz.2 ⟨t, Or.inr ⟨le_of_not_gt hn, ht.2⟩, rfl⟩ |
| 109 | rw [hgraph t (hJ (Ioo_subset_Icc_self htcd))] |
| 110 | · intro hzgraph |
| 111 | obtain ⟨t, ht, heq⟩ := hximage |
| 112 | refine ⟨t, ⟨hc0.le.trans ht.1, ht.2.trans hdT.le⟩, ?_⟩ |
| 113 | apply L.injective |
| 114 | rw [hgraph t (hJ ht), heq] |
| 115 | exact Prod.ext rfl hzgraph.symm |
| 116 | |
| 117 | /-- Every regular interior point of a simple smooth return loop has constructed linear graph |
| 118 | coordinates describing the entire nearby loop. Source: |
| 119 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Constructed smooth |
| 120 | collar pieces of the actual loop region. -/ |
| 121 | theorem m64Intrinsic_exists_regular_loop_graph_neighborhood |
| 122 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 123 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 124 | (hp : p ∈ Ioo (0 : ℝ) T) (hregular : deriv gamma p ≠ 0) : |
| 125 | ∃ (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) (h : ℝ → ℝ) |
| 126 | (X : Set ℝ) (W : Set AnnulusCoordinates), |
| 127 | IsOpen X ∧ ContDiffOn ℝ ∞ h X ∧ IsOpen W ∧ gamma p ∈ W ∧ |
| 128 | ∀ z ∈ W, (L z).1 ∈ X ∧ (z ∈ gamma '' Icc 0 T ↔ (L z).2 = h (L z).1) := by |
| 129 | let v := deriv gamma p |
| 130 | have hderiv : Continuous (deriv gamma) := (contDiff_infty_iff_deriv.mp hg).2.continuous |
| 131 | have hpos : {t | 0 < inner ℝ v (deriv gamma t)} ∈ 𝓝 p := |
| 132 | (isOpen_lt continuous_const (continuous_const.inner hderiv)).mem_nhds |
| 133 | (real_inner_self_pos.mpr hregular) |
| 134 | obtain ⟨l, r, ⟨hlp, hpr⟩, hsub⟩ := mem_nhds_iff_exists_Ioo_subset.mp |
| 135 | (inter_mem (isOpen_Ioo.mem_nhds hp) hpos) |
| 136 | let a := (l + p) / 2 |
| 137 | let b := (p + r) / 2 |
| 138 | have hap : a < p := by dsimp only [a]; linarith |
| 139 | have hpb : p < b := by dsimp only [b]; linarith |
| 140 | have hla : l < a := by dsimp only [a]; linarith |
| 141 | have hbr : b < r := by dsimp only [b]; linarith |
| 142 | have hab : a < b := hap.trans hpb |
| 143 | have hI : Icc a b ⊆ Ioo l r := |
| 144 | fun _ ht => ⟨hla.trans_le ht.1, ht.2.trans_lt hbr⟩ |
| 145 | obtain ⟨l', r', G, L, h, hl'a, hbr', hsource, hG, _, hmono, |
| 146 | _, _, _, hh, hgraph, _, _, _⟩ := |
| 147 | Poincare.Topology.Plane.Curves.exists_graph_coordinates_of_positive_projection hg hab.le |
| 148 | (fun t ht => (hsub (hI ht)).2) |
| 149 | have hmonoG : StrictMonoOn G G.source := by |
| 150 | intro x hx y hy hxy |
| 151 | simpa only [hG] using hmono hx hy hxy |
| 152 | obtain ⟨W, hW, harc, hWgraph⟩ := m64Intrinsic_loop_graph_neighborhood hg.continuous |
| 153 | hend hinj L G h hab.le (hsub (hI (left_mem_Icc.mpr hab.le))).1.1 |
| 154 | (hsub (hI (right_mem_Icc.mpr hab.le))).1.2 hl'a hbr' hsource hmonoG hgraph |
| 155 | exact ⟨L, h, G.target, W, G.open_target, hh, hW, |
| 156 | harc ⟨p, ⟨hap.le, hpb.le⟩, rfl⟩, hWgraph⟩ |
| 157 | |
| 158 | end PoincareMT |