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.Arc.BandChain |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Jordan.LineGerm |
| 3 | |
| 4 | /-! |
| 5 | # A normal neighborhood of the complete loop frontier |
| 6 | |
| 7 | The compact parameter tails are excluded before restricting the actual |
| 8 | normal collar. Thus the zero-height axis describes the whole loop in the |
| 9 | retained neighborhood, including when other portions of the loop approach |
| 10 | the chosen compact interior arc. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 13 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 14 | faces used in its regional Gauss--Bonnet arguments. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter Metric |
| 21 | open scoped Topology ContDiff |
| 22 | open Poincare.Topology.Plane.Curves |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | private theorem regular_arc_buffer |
| 27 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 28 | {T a b : ℝ} (hab : a ≤ b) (ha : 0 < a) (hb : b < T) |
| 29 | (hregular : ∀ t ∈ Icc a b, deriv gamma t ≠ 0) : |
| 30 | ∃ l u : ℝ, 0 < l ∧ l < a ∧ b < u ∧ u < T ∧ |
| 31 | ∀ t ∈ Icc l u, deriv gamma t ≠ 0 := by |
| 32 | let X := Ioo (0 : ℝ) T ∩ {t | deriv gamma t ≠ 0} |
| 33 | have hX : IsOpen X := isOpen_Ioo.inter |
| 34 | (isOpen_ne.preimage (contDiff_infty_iff_deriv.mp hg).2.continuous) |
| 35 | have hI : Icc a b ⊆ X := |
| 36 | fun t ht => ⟨⟨ha.trans_le ht.1, ht.2.trans_lt hb⟩, hregular t ht⟩ |
| 37 | obtain ⟨l, r, hlr, hleft⟩ := mem_nhds_iff_exists_Ioo_subset.mp |
| 38 | (hX.mem_nhds (hI (left_mem_Icc.mpr hab))) |
| 39 | obtain ⟨s, u, hsu, hright⟩ := mem_nhds_iff_exists_Ioo_subset.mp |
| 40 | (hX.mem_nhds (hI (right_mem_Icc.mpr hab))) |
| 41 | let l' := (l + a) / 2 |
| 42 | let u' := (b + u) / 2 |
| 43 | have hl'a : l' < a := by dsimp [l']; linarith [hlr.1] |
| 44 | have hbu' : b < u' := by dsimp [u']; linarith [hsu.2] |
| 45 | have hl' : l' ∈ X := hleft ⟨by dsimp [l']; linarith [hlr.1], hl'a.trans hlr.2⟩ |
| 46 | have hu' : u' ∈ X := hright ⟨hsu.1.trans hbu', by dsimp [u']; linarith [hsu.2]⟩ |
| 47 | refine ⟨l', u', hl'.1.1, hl'a, hbu', hu'.1.2, ?_⟩ |
| 48 | intro t ht |
| 49 | by_cases hta : t < a |
| 50 | · exact (hleft ⟨by dsimp [l'] at ht; linarith [ht.1, hlr.1], hta.trans hlr.2⟩).2 |
| 51 | by_cases hbt : b < t |
| 52 | · exact (hright ⟨hsu.1.trans hbt, by dsimp [u'] at ht; linarith [ht.2, hsu.2]⟩).2 |
| 53 | exact hregular t ⟨le_of_not_gt hta, le_of_not_gt hbt⟩ |
| 54 | |
| 55 | /-- Every compact regular interior arc of the actual simple return loop has a smooth normal |
| 56 | chart in which the complete loop is exactly height zero. Source: |
| 57 | `proof-work/tasks/M64/reports/2026-09-24-loop-inward-collar.md`. -/ |
| 58 | theorem m64Intrinsic_exists_loop_normal_neighborhood |
| 59 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T a b : ℝ} |
| 60 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 61 | (hab : a ≤ b) (ha : 0 < a) (hb : b < T) |
| 62 | (hregular : ∀ t ∈ Icc a b, deriv gamma t ≠ 0) : |
| 63 | ∃ delta > 0, ∃ H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates, |
| 64 | Icc a b ×ˢ Ioo (-delta) delta ⊆ H.source ∧ |
| 65 | (∀ q, H q = normalStrip gamma q) ∧ |
| 66 | ContDiffOn ℝ ∞ H H.source ∧ ContDiffOn ℝ ∞ H.symm H.target ∧ |
| 67 | ∀ q ∈ H.source, H q ∈ gamma '' Icc 0 T ↔ q.2 = 0 := by |
| 68 | obtain ⟨l, u, hl0, hla, hbu, huT, hreg⟩ := regular_arc_buffer hg hab ha hb hregular |
| 69 | have hlu : l < u := hla.trans_le hab |>.trans hbu |
| 70 | have hsub : Icc l u ⊆ Ico (0 : ℝ) T := |
| 71 | fun t ht => ⟨hl0.le.trans ht.1, ht.2.trans_lt huT⟩ |
| 72 | obtain ⟨epsilon, hepsilon, F, _, hstrip, hformula, hF, hFi, _⟩ := |
| 73 | exists_normal_collar_coordinates hg (hinj.mono hsub) hreg |
| 74 | let tail := gamma '' (Icc (0 : ℝ) l ∪ Icc u T) |
| 75 | have htail : IsClosed tail := |
| 76 | ((isCompact_Icc.union isCompact_Icc).image hg.continuous).isClosed |
| 77 | have havoid (t : ℝ) (ht : t ∈ Icc a b) : gamma t ∉ tail := by |
| 78 | rintro ⟨s, hs, heq⟩ |
| 79 | have htI : t ∈ Ico (0 : ℝ) T := ⟨ha.le.trans ht.1, ht.2.trans_lt hb⟩ |
| 80 | have hsI : s ∈ Icc (0 : ℝ) T := by |
| 81 | rcases hs with hs | hs |
| 82 | · exact ⟨hs.1, hs.2.trans (hlu.le.trans huT.le)⟩ |
| 83 | · exact ⟨(hl0.le.trans hlu.le).trans hs.1, hs.2⟩ |
| 84 | have hsT : s < T := by |
| 85 | by_contra hn |
| 86 | have heT : s = T := le_antisymm hsI.2 (le_of_not_gt hn) |
| 87 | have h0t := hinj ⟨le_rfl, ha.trans_le hab |>.trans hb⟩ htI |
| 88 | (hend.trans (heT ▸ heq)) |
| 89 | linarith [ha.trans_le ht.1] |
| 90 | have hst := hinj ⟨hsI.1, hsT⟩ htI heq |
| 91 | subst s |
| 92 | rcases hs with hs | hs |
| 93 | · linarith [ht.1, hs.2] |
| 94 | · linarith [ht.2, hs.1] |
| 95 | let W := (Ioo l u ×ˢ (univ : Set ℝ)) ∩ (F.source ∩ F ⁻¹' tailᶜ) |
| 96 | have hW : IsOpen W := (isOpen_Ioo.prod isOpen_univ).inter |
| 97 | (F.isOpen_inter_preimage htail.isOpen_compl) |
| 98 | let H := F.restrOpen W hW |
| 99 | have hHformula (q : ℝ × ℝ) : H q = normalStrip gamma q := hformula q |
| 100 | have haxis : Icc a b ×ˢ ({0} : Set ℝ) ⊆ H.source := by |
| 101 | rintro ⟨t, z⟩ ⟨ht, hz⟩ |
| 102 | have hz0 : z = 0 := hz |
| 103 | subst z |
| 104 | have htlu : t ∈ Icc l u := ⟨hla.le.trans ht.1, ht.2.trans hbu.le⟩ |
| 105 | have hts : (t, (0 : ℝ)) ∈ F.source := hstrip ⟨htlu, ⟨by linarith, hepsilon⟩⟩ |
| 106 | refine ⟨hts, ⟨⟨hla.trans_le ht.1, ht.2.trans_lt hbu⟩, mem_univ _⟩, hts, ?_⟩ |
| 107 | change F (t, 0) ∉ tail |
| 108 | simpa only [hformula, normalStrip_axis] using havoid t ht |
| 109 | obtain ⟨A, B, _, hB, hIA, h0B, hAB⟩ := generalized_tube_lemma |
| 110 | isCompact_Icc isCompact_singleton H.open_source haxis |
| 111 | obtain ⟨delta, hdelta, hball⟩ := Metric.mem_nhds_iff.mp |
| 112 | (hB.mem_nhds (h0B (mem_singleton (0 : ℝ)))) |
| 113 | refine ⟨delta, hdelta, H, ?_, hHformula, hF.mono inter_subset_left, |
| 114 | hFi.mono inter_subset_left, ?_⟩ |
| 115 | · rintro ⟨t, z⟩ ⟨ht, hz⟩ |
| 116 | exact hAB ⟨hIA ht, hball (by |
| 117 | simpa only [mem_ball, dist_zero_right, Real.norm_eq_abs] using abs_lt.mpr hz)⟩ |
| 118 | · intro q hq |
| 119 | constructor |
| 120 | · rintro ⟨t, ht, heq⟩ |
| 121 | have htlu : t ∈ Ioo l u := by |
| 122 | have hnotF : H q ∉ tail := hq.2.2.2 |
| 123 | have hnot : gamma t ∉ tail := heq ▸ hnotF |
| 124 | constructor |
| 125 | · by_contra hn |
| 126 | exact hnot ⟨t, Or.inl ⟨ht.1, le_of_not_gt hn⟩, rfl⟩ |
| 127 | · by_contra hn |
| 128 | exact hnot ⟨t, Or.inr ⟨le_of_not_gt hn, ht.2⟩, rfl⟩ |
| 129 | have hts : (t, (0 : ℝ)) ∈ F.source := |
| 130 | hstrip ⟨⟨htlu.1.le, htlu.2.le⟩, ⟨by linarith, hepsilon⟩⟩ |
| 131 | have he : q = (t, 0) := F.injOn hq.1 hts (by |
| 132 | calc |
| 133 | F q = H q := rfl |
| 134 | _ = gamma t := heq.symm |
| 135 | _ = F (t, 0) := by rw [hformula (t, 0), normalStrip_axis]) |
| 136 | exact congrArg Prod.snd he |
| 137 | · intro hz |
| 138 | refine ⟨q.1, ⟨hl0.le.trans hq.2.1.1.1.le, hq.2.1.1.2.le.trans huT.le⟩, ?_⟩ |
| 139 | rw [hHformula] |
| 140 | simp only [normalStrip, hz, zero_smul, add_zero] |
| 141 | |
| 142 | end PoincareMT |