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.Prefix.Confinement |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Regular.Loop |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Normal.Crossing |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Injective.DomainClosure |
| 5 | |
| 6 | /-! A first self-return is incompatible with local prefix separation. |
| 7 | Source: MT Lemma 19.53, p. 478; local-inverse-self-return derivation, |
| 8 | Sections 2-4. This argument includes essential loops and an initial-point return. -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology ContDiff Manifold Matrix |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | /-- Local separation of embedded annular prefixes forces the entire regular stopped ray to |
| 20 | be embedded. The separation premise is the local consequence of cyclic collision focusing, |
| 21 | not a ray-embedding premise. Source: MT Lemma 19.53; local-inverse-self-return derivation, |
| 22 | Sections 2-4. Source/construction: |
| 23 | proof-work/tasks/M64/derivations/2026-09-27-local-inverse-self-return.md, Sections 2-4. -/ |
| 24 | theorem m64Intrinsic_normal_ray_injOn_of_local_prefix_separation |
| 25 | {e : AnnulusCoordinates → AnnulusCoordinates} (he : ContDiff ℝ ∞ e) |
| 26 | (hbase : ∀ p, e !₂[p, 0] = intrinsicAnnulusBoundary 1 p) |
| 27 | {a T h : ℝ} (hT : 0 < T) (hTh : T ≤ h) |
| 28 | (hinward : 0 < inner ℝ (intrinsicAnnulusBoundary 1 a) |
| 29 | (deriv (fun t => e !₂[a, t]) 0)) |
| 30 | (hinside : ∀ t ∈ Ioo 0 T, 1 < ‖e !₂[a, t]‖ ∧ ‖e !₂[a, t]‖ < 2) |
| 31 | (hreg : ∀ t ∈ Icc 0 T, Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, t])) |
| 32 | {I : Set ℝ} (hI : IsOpen I) (haI : a ∈ I) |
| 33 | (hseparate : ∀ p ∈ I, ∀ q ∈ I, p ≠ q → ∀ A ∈ Ioo 0 h, ∀ B ∈ Ioo 0 h, |
| 34 | InjOn (fun t => e !₂[p, t]) (Icc 0 A) → |
| 35 | InjOn (fun t => e !₂[q, t]) (Icc 0 B) → |
| 36 | (∀ t ∈ Ioc 0 A, 1 < ‖e !₂[p, t]‖ ∧ ‖e !₂[p, t]‖ < 2) → |
| 37 | (∀ t ∈ Ioc 0 B, 1 < ‖e !₂[q, t]‖ ∧ ‖e !₂[q, t]‖ < 2) → |
| 38 | e !₂[p, A] ≠ e !₂[q, B]) : InjOn (fun t => e !₂[a, t]) (Icc 0 T) := by |
| 39 | classical |
| 40 | have hh : 0 < h := hT.trans_le hTh |
| 41 | have heta (z : AnnulusCoordinates) : !₂[z 0, z 1] = z := by ext i; fin_cases i <;> rfl |
| 42 | have hcoord0 : Continuous (fun z : AnnulusCoordinates => z 0) := by fun_prop |
| 43 | have hcoord1 : Continuous (fun z : AnnulusCoordinates => z 1) := by fun_prop |
| 44 | have hline : Continuous (fun t : ℝ => (!₂[a, t] : AnnulusCoordinates)) := by fun_prop |
| 45 | obtain ⟨F0, haF0, _, hF0, _, _⟩ := m64Intrinsic_exists_smooth_polar_inverse |
| 46 | isOpen_univ (contMDiff_iff_contDiff.mpr he).contMDiffOn (mem_univ _) |
| 47 | (hreg 0 ⟨le_rfl, hT.le⟩) |
| 48 | obtain ⟨epsilon, hepsilon, W, hW, haW, hcollar⟩ := |
| 49 | m64Intrinsic_exists_signed_normal_collar he hbase hinward F0.open_source haF0 |
| 50 | let d := min epsilon (h / 2) |
| 51 | have hd : 0 < d := lt_min hepsilon (by positivity) |
| 52 | have hde : d ≤ epsilon := min_le_left _ _ |
| 53 | have hdh : d < h := (min_le_right _ _).trans_lt (by linarith only [hh]) |
| 54 | let C : Set AnnulusCoordinates := {z | z 0 ∈ W ∩ I ∧ |z 1| < d} |
| 55 | have hC : IsOpen C := ((hW.inter hI).preimage hcoord0).inter |
| 56 | (isOpen_lt hcoord1.abs continuous_const) |
| 57 | have haC : !₂[a, 0] ∈ C := ⟨⟨haW, haI⟩, by |
| 58 | change |(0 : ℝ)| < d |
| 59 | simpa only [abs_zero] using hd⟩ |
| 60 | have hCsource : C ⊆ F0.source := by |
| 61 | intro z hz |
| 62 | have ht : z 1 ∈ Icc (-epsilon) epsilon := abs_le.mp (hz.2.le.trans hde) |
| 63 | simpa only [heta] using (hcollar (z 0) hz.1.1 (z 1) ht).1 |
| 64 | let Q : Set AnnulusCoordinates := {z | z 0 ∈ I ∧ 0 < z 1 ∧ z 1 < h ∧ |
| 65 | InjOn (fun t => e !₂[z 0, t]) (Icc 0 (z 1)) ∧ |
| 66 | ∀ t ∈ Ioc 0 (z 1), 1 < ‖e !₂[z 0, t]‖ ∧ ‖e !₂[z 0, t]‖ < 2} |
| 67 | have hCpositive : ∀ z ∈ C, 0 < z 1 → z ∈ Q := by |
| 68 | intro z hz hzpos |
| 69 | have hzd : z 1 < d := by simpa only [abs_of_pos hzpos] using hz.2 |
| 70 | have hsegment (t : ℝ) (ht : t ∈ Icc 0 (z 1)) : !₂[z 0, t] ∈ C := |
| 71 | ⟨hz.1, by |
| 72 | change |t| < d |
| 73 | simpa only [abs_of_nonneg ht.1] using ht.2.trans_lt hzd⟩ |
| 74 | refine ⟨hz.1.2, hzpos, hzd.trans hdh, ?_, ?_⟩ |
| 75 | · intro s hs t ht heq |
| 76 | have hst := F0.injOn (hCsource (hsegment s hs)) (hCsource (hsegment t ht)) |
| 77 | (by simpa only [hF0] using heq) |
| 78 | exact congrArg (fun x : AnnulusCoordinates => x 1) hst |
| 79 | · intro t ht |
| 80 | have htc : t ∈ Icc (-epsilon) epsilon := |
| 81 | ⟨by linarith only [hepsilon, ht.1], ht.2.trans (hzd.le.trans hde)⟩ |
| 82 | have hc := hcollar (z 0) hz.1.1 t htc |
| 83 | exact ⟨hc.2.2.2 ht.1, hc.2.1⟩ |
| 84 | have hCnonpositive : ∀ z ∈ C, z 1 ≤ 0 → ‖e z‖ ≤ 1 := by |
| 85 | intro z hz hzneg |
| 86 | rcases hzneg.eq_or_lt with hz0 | hzlt |
| 87 | · rw [← heta z, hz0, hbase, m64Intrinsic_inner_boundary_norm] |
| 88 | · have ht : z 1 ∈ Icc (-epsilon) epsilon := abs_le.mp (hz.2.le.trans hde) |
| 89 | have hc := (hcollar (z 0) hz.1.1 (z 1) ht).2.2.1 hzlt |
| 90 | simpa only [heta] using hc.le |
| 91 | have hQnorm (z : AnnulusCoordinates) (hz : z ∈ Q) : 1 < ‖e z‖ := by |
| 92 | simpa only [heta] using (hz.2.2.2.2 (z 1) ⟨hz.2.1, le_rfl⟩).1 |
| 93 | have hQinj : InjOn e Q := by |
| 94 | intro x hx y hy heq |
| 95 | have heq' : e !₂[x 0, x 1] = e !₂[y 0, y 1] := by simpa only [heta] using heq |
| 96 | by_cases hxy : x 0 = y 0 |
| 97 | · have ht : x 1 = y 1 := by |
| 98 | rcases le_total (x 1) (y 1) with hle | hle |
| 99 | · rw [hxy] at heq' |
| 100 | exact hy.2.2.2.1 ⟨hx.2.1.le, hle⟩ ⟨hy.2.1.le, le_rfl⟩ heq' |
| 101 | · rw [← hxy] at heq' |
| 102 | exact hx.2.2.2.1 ⟨hx.2.1.le, le_rfl⟩ ⟨hy.2.1.le, hle⟩ heq' |
| 103 | ext i |
| 104 | fin_cases i |
| 105 | · exact hxy |
| 106 | · exact ht |
| 107 | · exact (hseparate (x 0) hx.1 (y 0) hy.1 hxy (x 1) ⟨hx.2.1, hx.2.2.1⟩ |
| 108 | (y 1) ⟨hy.2.1, hy.2.2.1⟩ hx.2.2.2.1 hy.2.2.2.1 hx.2.2.2.2 hy.2.2.2.2 heq').elim |
| 109 | let P := Q ∪ C |
| 110 | have hPinj : InjOn e P := by |
| 111 | intro x hx y hy heq |
| 112 | rcases hx with hx | hx <;> rcases hy with hy | hy |
| 113 | · exact hQinj hx hy heq |
| 114 | · by_cases hypos : 0 < y 1 |
| 115 | · exact hQinj hx (hCpositive y hy hypos) heq |
| 116 | · have hn := hQnorm x hx |
| 117 | rw [heq] at hn |
| 118 | exact (not_lt_of_ge (hCnonpositive y hy (le_of_not_gt hypos)) hn).elim |
| 119 | · by_cases hxpos : 0 < x 1 |
| 120 | · exact hQinj (hCpositive x hx hxpos) hy heq |
| 121 | · have hn := hQnorm y hy |
| 122 | rw [← heq] at hn |
| 123 | exact (not_lt_of_ge (hCnonpositive x hx (le_of_not_gt hxpos)) hn).elim |
| 124 | · exact F0.injOn (hCsource hx) (hCsource hy) (by simpa only [hF0] using heq) |
| 125 | by_contra hnot |
| 126 | have hlocal (t : ℝ) (ht : t ∈ Icc 0 T) : |
| 127 | ∃ J : Set ℝ, IsOpen J ∧ t ∈ J ∧ InjOn (fun s => e !₂[a, s]) J := by |
| 128 | obtain ⟨F, htF, _, hF, _, _⟩ := m64Intrinsic_exists_smooth_polar_inverse |
| 129 | isOpen_univ (contMDiff_iff_contDiff.mpr he).contMDiffOn (mem_univ _) (hreg t ht) |
| 130 | refine ⟨(fun s => !₂[a, s]) ⁻¹' F.source, F.open_source.preimage hline, htF, ?_⟩ |
| 131 | intro s hs v hv heq |
| 132 | exact congrArg (fun z : AnnulusCoordinates => z 1) |
| 133 | (F.injOn hs hv (by simpa only [hF] using heq)) |
| 134 | obtain ⟨s, t, hs, hst, htT, hreturn, hprefix⟩ := |
| 135 | m64Intrinsic_exists_first_return_interval (he.continuous.comp hline) hlocal hnot |
| 136 | change e !₂[a, s] = e !₂[a, t] at hreturn |
| 137 | change InjOn (fun v => e !₂[a, v]) (Ico 0 t) at hprefix |
| 138 | have htpos : 0 < t := hs.trans_lt hst |
| 139 | have hprefixP : (fun v => !₂[a, v]) '' Ioo 0 t ⊆ P := by |
| 140 | rintro _ ⟨v, hv, rfl⟩ |
| 141 | refine Or.inl ⟨haI, hv.1, hv.2.trans_le (htT.trans hTh), ?_, ?_⟩ |
| 142 | · exact hprefix.mono (show Icc 0 v ⊆ Ico 0 t from |
| 143 | fun u hu => ⟨hu.1, hu.2.trans_lt hv.2⟩) |
| 144 | · intro u hu |
| 145 | exact hinside u ⟨hu.1, (hu.2.trans_lt hv.2).trans_le htT⟩ |
| 146 | have htClosure : !₂[a, t] ∈ closure P := by |
| 147 | apply (closure_mono hprefixP) |
| 148 | apply image_closure_subset_closure_image hline |
| 149 | refine ⟨t, ?_, rfl⟩ |
| 150 | rw [closure_Ioo htpos.ne] |
| 151 | exact ⟨htpos.le, le_rfl⟩ |
| 152 | have hsource : ∃ O : Set AnnulusCoordinates, IsOpen O ∧ !₂[a, s] ∈ O ∧ O ⊆ P := by |
| 153 | rcases hs.eq_or_lt with hs0 | hspos |
| 154 | · have hs' : s = 0 := hs0.symm |
| 155 | exact ⟨C, hC, hs' ▸ haC, subset_union_right⟩ |
| 156 | · obtain ⟨v, hsv, hvt⟩ := exists_between hst |
| 157 | have hvpos : 0 < v := hspos.trans hsv |
| 158 | obtain ⟨W', hW', haW', hstable⟩ := m64Intrinsic_exists_stable_annular_prefix |
| 159 | he hbase hvpos hinward |
| 160 | (fun u hu => hinside u ⟨hu.1, (hu.2.trans_lt hvt).trans_le htT⟩) |
| 161 | (hprefix.mono (show Icc 0 v ⊆ Ico 0 t from |
| 162 | fun u hu => ⟨hu.1, hu.2.trans_lt hvt⟩)) |
| 163 | (fun u hu => hreg u ⟨hu.1, (hu.2.trans hvt.le).trans htT⟩) |
| 164 | let O : Set AnnulusCoordinates := {z | z 0 ∈ W' ∩ I ∧ z 1 ∈ Ioo 0 v} |
| 165 | have hO : IsOpen O := ((hW'.inter hI).preimage hcoord0).inter |
| 166 | (isOpen_Ioo.preimage hcoord1) |
| 167 | refine ⟨O, hO, ⟨⟨haW', haI⟩, hspos, hsv⟩, ?_⟩ |
| 168 | intro z hz |
| 169 | refine Or.inl ⟨hz.1.2, hz.2.1, (hz.2.2.trans hvt).trans_le (htT.trans hTh), ?_, ?_⟩ |
| 170 | · exact (hstable (z 0) hz.1.1).1.mono (Icc_subset_Icc_right hz.2.2.le) |
| 171 | · intro u hu |
| 172 | exact (hstable (z 0) hz.1.1).2 u ⟨hu.1, hu.2.trans hz.2.2.le⟩ |
| 173 | obtain ⟨O, hO, hsO, hOP⟩ := hsource |
| 174 | obtain ⟨F, hsF, hFO, hF, _, _⟩ := m64Intrinsic_exists_smooth_polar_inverse hO |
| 175 | (contMDiff_iff_contDiff.mpr he).contMDiffOn hsO (hreg s ⟨hs, hst.le.trans htT⟩) |
| 176 | have htarget : e !₂[a, t] ∈ F.target := by |
| 177 | rw [← hreturn] |
| 178 | simpa only [hF] using F.map_source hsF |
| 179 | have heq := m64_eq_local_inverse_of_injOn_closure he.continuous.continuousAt hPinj |
| 180 | htClosure F (fun z _ => congrFun hF z) (hFO.trans hOP) htarget |
| 181 | have hback : F.symm (e !₂[a, t]) = !₂[a, s] := by |
| 182 | rw [← hreturn, ← hF] |
| 183 | exact F.left_inv hsF |
| 184 | rw [hback] at heq |
| 185 | have htime := congrArg (fun z : AnnulusCoordinates => z 1) heq |
| 186 | exact hst.ne htime.symm |
| 187 | |
| 188 | end PoincareMT |