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.Continuation |
| 2 | import PoincareLib.Geometry.Riemannian.Coordinates.Exponential.Uniqueness |
| 3 | |
| 4 | /-! |
| 5 | # Existence up to the first annulus exit |
| 6 | |
| 7 | Uniqueness joins the initial geodesic's extensions while their positive |
| 8 | parts stay inside the annulus. At the supremum endpoint, compact |
| 9 | continuation gives a terminal point. Unless the chosen time has been |
| 10 | reached, this point must lie on the annulus boundary. |
| 11 | |
| 12 | Morgan--Tian context: Claim 19.37, printed pp. 468-469, in the proof of Proposition |
| 13 | 19.35. This module supplies actual normal-geodesic data or its coordinate and measure |
| 14 | transport. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Topology Manifold ContDiff Bundle |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 27 | normedSpaceTangentSpaceVectorSpace |
| 28 | |
| 29 | /-- A local geodesic entering the annulus continues to any prescribed time or to its first |
| 30 | boundary contact, with its initial germ preserved. Source/construction: Morgan--Tian Claim |
| 31 | 19.37, printed pp. 468-469. -/ |
| 32 | theorem m64Intrinsic_exists_geodesic_to_annulus_exit |
| 33 | (N : IntrinsicAnnulus) {R epsilon eta : ℝ} |
| 34 | (hR : 0 < R) (hepsilon : 0 < epsilon) (heta : 0 < eta) |
| 35 | {q : ℝ → AnnulusCoordinates} |
| 36 | (hgeo : N.metric.IsGeodesicOn q (Ioo (-epsilon) epsilon)) |
| 37 | (hinside : ∀ t ∈ Ioo (0 : ℝ) eta, 1 < ‖q t‖ ∧ ‖q t‖ < 2) : |
| 38 | ∃ b left right : ℝ, 0 < b ∧ b ≤ R ∧ 0 < left ∧ 0 < right ∧ |
| 39 | ∃ gamma : ℝ → AnnulusCoordinates, |
| 40 | N.metric.IsGeodesicOn gamma (Ioo (-left) (b + right)) ∧ |
| 41 | gamma =ᶠ[𝓝 0] q ∧ |
| 42 | (∀ t ∈ Ioo (0 : ℝ) b, 1 < ‖gamma t‖ ∧ ‖gamma t‖ < 2) ∧ |
| 43 | gamma b ∈ standardAnnulusDomain ∧ |
| 44 | (b = R ∨ ‖gamma b‖ = 1 ∨ ‖gamma b‖ = 2) := by |
| 45 | classical |
| 46 | let d := min (epsilon / 2) (min (eta / 2) (R / 2)) |
| 47 | have hd : 0 < d := lt_min (half_pos hepsilon) (lt_min (half_pos heta) (half_pos hR)) |
| 48 | have hdE : d < epsilon := (min_le_left _ _).trans_lt (half_lt_self hepsilon) |
| 49 | have hdEta : d < eta := |
| 50 | ((min_le_right _ _).trans (min_le_left _ _)).trans_lt (half_lt_self heta) |
| 51 | have hdR : d < R := |
| 52 | ((min_le_right _ _).trans (min_le_right _ _)).trans_lt (half_lt_self hR) |
| 53 | have hgeo0 : N.metric.IsGeodesicOn q (Ioo (-d) d) := by |
| 54 | intro t ht |
| 55 | exact hgeo t ⟨by linarith [ht.1], ht.2.trans hdE⟩ |
| 56 | let T : Set ℝ := {b | d ≤ b ∧ b ≤ R ∧ ∃ gamma : ℝ → AnnulusCoordinates, |
| 57 | N.metric.IsGeodesicOn gamma (Ioo (-d) b) ∧ gamma =ᶠ[𝓝 0] q ∧ |
| 58 | ∀ t ∈ Ioo (0 : ℝ) b, 1 < ‖gamma t‖ ∧ ‖gamma t‖ < 2} |
| 59 | have hdT : d ∈ T := ⟨le_rfl, hdR.le, q, hgeo0, EventuallyEq.rfl, |
| 60 | fun t ht => hinside t ⟨ht.1, ht.2.trans hdEta⟩⟩ |
| 61 | have hbounded : BddAbove T := ⟨R, fun _ ht => ht.2.1⟩ |
| 62 | let b := sSup T |
| 63 | have hdb : d ≤ b := le_csSup hbounded hdT |
| 64 | have hb : 0 < b := hd.trans_le hdb |
| 65 | have hbR : b ≤ R := csSup_le ⟨d, hdT⟩ (fun _ ht => ht.2.1) |
| 66 | choose f hf using fun r (hr : r ∈ T) => hr.2.2 |
| 67 | have hcompat (r : ℝ) (hr : r ∈ T) (s : ℝ) (hs : s ∈ T) : |
| 68 | EqOn (f r hr) (f s hs) (Ioo (-d) (min r s)) := by |
| 69 | have hzero : (0 : ℝ) ∈ Ioo (-d) (min r s) := |
| 70 | ⟨by linarith, lt_min (hd.trans_le hr.1) (hd.trans_le hs.1)⟩ |
| 71 | exact (show N.metric.IsGeodesicOn (f r hr) (Ioo (-d) (min r s)) from |
| 72 | fun t ht => (hf r hr).1 t ⟨ht.1, ht.2.trans_le (min_le_left _ _)⟩) |
| 73 | |>.eqOn_of_eventuallyEq |
| 74 | (fun t ht => (hf s hs).1 t ⟨ht.1, ht.2.trans_le (min_le_right _ _)⟩) |
| 75 | isOpen_Ioo (convex_Ioo _ _).isPreconnected hzero |
| 76 | ((hf r hr).2.1.trans (hf s hs).2.1.symm) |
| 77 | let G : ℝ → AnnulusCoordinates := fun t => |
| 78 | if ht : ∃ r ∈ T, t < r then f ht.choose ht.choose_spec.1 t else q t |
| 79 | have hGeq (r : ℝ) (hr : r ∈ T) : EqOn G (f r hr) (Ioo (-d) r) := by |
| 80 | intro t ht |
| 81 | have hex : ∃ s ∈ T, t < s := ⟨r, hr, ht.2⟩ |
| 82 | change (if h : ∃ s ∈ T, t < s then f h.choose h.choose_spec.1 t else q t) = _ |
| 83 | rw [dif_pos hex] |
| 84 | exact hcompat hex.choose hex.choose_spec.1 r hr |
| 85 | ⟨ht.1, lt_min hex.choose_spec.2 ht.2⟩ |
| 86 | have hGgerm (r : ℝ) (hr : r ∈ T) {t : ℝ} (ht : t ∈ Ioo (-d) r) : |
| 87 | G =ᶠ[𝓝 t] f r hr := by |
| 88 | filter_upwards [isOpen_Ioo.mem_nhds ht] with s hs |
| 89 | exact hGeq r hr hs |
| 90 | have hGgeo : N.metric.IsGeodesicOn G (Ioo (-d) b) := by |
| 91 | intro t ht |
| 92 | obtain ⟨r, hr, htr⟩ := exists_lt_of_lt_csSup ⟨d, hdT⟩ ht.2 |
| 93 | obtain ⟨p, q', w, hlocal⟩ := (hf r hr).1 t ⟨ht.1, htr⟩ |
| 94 | refine ⟨p, q', w, ?_⟩ |
| 95 | filter_upwards [hlocal, hGgerm r hr ⟨ht.1, htr⟩] with s hs heq |
| 96 | exact ⟨heq.trans hs.1, hs.2⟩ |
| 97 | have hzero : (0 : ℝ) ∈ Ioo (-d) d := ⟨by linarith, hd⟩ |
| 98 | have hgerm : G =ᶠ[𝓝 0] q := (hGgerm d hdT hzero).trans (hf d hdT).2.1 |
| 99 | have hGinside (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) b) : |
| 100 | 1 < ‖G t‖ ∧ ‖G t‖ < 2 := by |
| 101 | obtain ⟨r, hr, htr⟩ := exists_lt_of_lt_csSup ⟨d, hdT⟩ ht.2 |
| 102 | rw [hGeq r hr ⟨by linarith [ht.1], htr⟩] |
| 103 | exact (hf r hr).2.2 t ⟨ht.1, htr⟩ |
| 104 | have hGinitial : EqOn G q (Ioo (-d) d) := |
| 105 | (show N.metric.IsGeodesicOn G (Ioo (-d) d) from |
| 106 | fun t ht => hGgeo t ⟨ht.1, ht.2.trans_le hdb⟩).eqOn_of_eventuallyEq hgeo0 |
| 107 | isOpen_Ioo (convex_Ioo _ _).isPreconnected hzero hgerm |
| 108 | let C := q '' Icc (-d) 0 ∪ standardAnnulusDomain |
| 109 | have hC : IsCompact C := by |
| 110 | apply IsCompact.union _ m64Intrinsic_standardAnnulus_isCompact |
| 111 | apply isCompact_Icc.image_of_continuousOn |
| 112 | exact hgeo.contMDiffOn.continuousOn.mono (fun t ht => |
| 113 | ⟨by linarith [ht.1], ht.2.trans_lt hepsilon⟩) |
| 114 | have hGC : MapsTo G (Ioo (-d) b) C := by |
| 115 | intro t ht |
| 116 | by_cases hpos : 0 < t |
| 117 | · exact Or.inr ⟨(hGinside t ⟨hpos, ht.2⟩).1.le, |
| 118 | (hGinside t ⟨hpos, ht.2⟩).2.le⟩ |
| 119 | · have ht0 : t ≤ 0 := le_of_not_gt hpos |
| 120 | exact Or.inl ⟨t, ⟨ht.1.le, ht0⟩, (hGinitial ⟨ht.1, ht0.trans_lt hd⟩).symm⟩ |
| 121 | obtain ⟨right, hright, gamma, hgammaEq, hgamma⟩ := |
| 122 | N.metric.exists_geodesic_continuation_of_compact_confinement |
| 123 | (by linarith : -d < b) hGgeo hC hGC |
| 124 | have hgammaGerm : gamma =ᶠ[𝓝 0] q := by |
| 125 | apply EventuallyEq.trans _ hgerm |
| 126 | filter_upwards [isOpen_Ioo.mem_nhds |
| 127 | (show (0 : ℝ) ∈ Ioo (-d) b from ⟨by linarith, hb⟩)] with t ht |
| 128 | exact hgammaEq ht |
| 129 | have hgammaInside (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) b) : |
| 130 | 1 < ‖gamma t‖ ∧ ‖gamma t‖ < 2 := by |
| 131 | rw [hgammaEq ⟨by linarith [ht.1], ht.2⟩] |
| 132 | exact hGinside t ht |
| 133 | have hcont : ContinuousAt gamma b := |
| 134 | hgamma.contMDiffOn.continuousOn.continuousAt |
| 135 | (isOpen_Ioo.mem_nhds ⟨by linarith, by linarith⟩) |
| 136 | have hend : gamma b ∈ standardAnnulusDomain := by |
| 137 | have hIoo : Ioo (0 : ℝ) b ∈ 𝓝[<] b := by |
| 138 | rw [← nhdsWithin_Ioo_eq_nhdsLT hb] |
| 139 | exact self_mem_nhdsWithin |
| 140 | apply m64Intrinsic_standardAnnulus_isCompact.isClosed.mem_of_tendsto |
| 141 | (b := 𝓝[<] b) (hcont.tendsto.mono_left nhdsWithin_le_nhds) |
| 142 | filter_upwards [hIoo] with t ht |
| 143 | exact ⟨(hgammaInside t ht).1.le, (hgammaInside t ht).2.le⟩ |
| 144 | refine ⟨b, d, right, hb, hbR, hd, hright, gamma, |
| 145 | hgamma, hgammaGerm, hgammaInside, hend, ?_⟩ |
| 146 | by_contra hnot |
| 147 | push Not at hnot |
| 148 | have hbRlt : b < R := lt_of_le_of_ne hbR hnot.1 |
| 149 | have hinterior : 1 < ‖gamma b‖ ∧ ‖gamma b‖ < 2 := |
| 150 | ⟨lt_of_le_of_ne hend.1 hnot.2.1.symm, lt_of_le_of_ne hend.2 hnot.2.2⟩ |
| 151 | have hnear : {t : ℝ | 1 < ‖gamma t‖ ∧ ‖gamma t‖ < 2} ∈ 𝓝 b := |
| 152 | hcont.norm.preimage_mem_nhds (Ioo_mem_nhds hinterior.1 hinterior.2) |
| 153 | obtain ⟨lo, hi, hbLoHi, hsub⟩ := mem_nhds_iff_exists_Ioo_subset.mp hnear |
| 154 | let e := min (right / 2) (min ((hi - b) / 2) ((R - b) / 2)) |
| 155 | have he : 0 < e := lt_min (half_pos hright) |
| 156 | (lt_min (half_pos (sub_pos.mpr hbLoHi.2)) (half_pos (sub_pos.mpr hbRlt))) |
| 157 | have heright : e < right := (min_le_left _ _).trans_lt (half_lt_self hright) |
| 158 | have hehi : e < hi - b := |
| 159 | ((min_le_right _ _).trans (min_le_left _ _)).trans_lt |
| 160 | (half_lt_self (sub_pos.mpr hbLoHi.2)) |
| 161 | have heR : e < R - b := |
| 162 | ((min_le_right _ _).trans (min_le_right _ _)).trans_lt |
| 163 | (half_lt_self (sub_pos.mpr hbRlt)) |
| 164 | have hnew : b + e ∈ T := by |
| 165 | refine ⟨by linarith, by linarith, gamma, ?_, hgammaGerm, ?_⟩ |
| 166 | · intro t ht |
| 167 | exact hgamma t ⟨ht.1, ht.2.trans_le (by linarith)⟩ |
| 168 | · intro t ht |
| 169 | by_cases htb : t < b |
| 170 | · exact hgammaInside t ⟨ht.1, htb⟩ |
| 171 | · exact hsub ⟨hbLoHi.1.trans_le (le_of_not_gt htb), by linarith [ht.2]⟩ |
| 172 | have hle := le_csSup hbounded hnew |
| 173 | change b + e ≤ b at hle |
| 174 | linarith |
| 175 | |
| 176 | end PoincareMT |