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.Compact.GeodesicContinuation |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Smooth.ClosedExtension |
| 3 | import PoincareLib.Geometry.Riemannian.Comparison.Volume.Conjugate.Realization.Junction |
| 4 | |
| 5 | /-! |
| 6 | # A smooth representative of an actual closed geodesic segment |
| 7 | |
| 8 | Compact continuation at both endpoints and the original closed-interval |
| 9 | continuity give one open geodesic extension. A germ-preserving cutoff |
| 10 | supplies a globally smooth representative of the same closed segment, |
| 11 | including its actual one-sided endpoint derivatives. |
| 12 | Source: MT Claim 19.40, pp. 470-471; minimal-contact derivation, Section 10. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Topology ContDiff Manifold |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | /-- A compactly confined interior geodesic, continuous on its closed parameter interval, has |
| 25 | a globally smooth representative with identical closed-interval values and the actual |
| 26 | endpoint derivatives. Source: MT Claim 19.40, pp. 470-471; |
| 27 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 10. -/ |
| 28 | theorem m64Intrinsic_compact_geodesic_smooth_representative |
| 29 | (G : RiemannianMetric 2 AnnulusCoordinates) {K : Set AnnulusCoordinates} |
| 30 | (hK : IsCompact K) {a b : ℝ} (hab : a < b) {q : ℝ → AnnulusCoordinates} |
| 31 | (hc : ContinuousOn q (Icc a b)) (hgeo : G.IsGeodesicOn q (Ioo a b)) |
| 32 | (hmap : MapsTo q (Ioo a b) K) : |
| 33 | ∃ eta : ℝ → AnnulusCoordinates, |
| 34 | ContDiff ℝ ∞ eta ∧ EqOn eta q (Icc a b) ∧ G.IsGeodesicOn eta (Icc a b) ∧ |
| 35 | HasDerivWithinAt q (deriv eta a) (Ioi a) a ∧ |
| 36 | HasDerivWithinAt q (deriv eta b) (Iio b) b := by |
| 37 | have hca : ContinuousWithinAt q (Ici a) a := by |
| 38 | have h := hc a (left_mem_Icc.mpr hab.le) |
| 39 | rwa [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsGE hab] at h |
| 40 | obtain ⟨epsilon, hepsilon, l, hlq, hlgeo⟩ := |
| 41 | m64Intrinsic_compact_geodesic_left_extension G hK hab hgeo hmap hca |
| 42 | obtain ⟨delta, hdelta, r, hrq, _, hrgeo⟩ := |
| 43 | m64Intrinsic_compact_geodesic_right_extension G hK hab hgeo hmap |
| 44 | have hrb : ContinuousAt r b := |
| 45 | (hrgeo.contMDiffAt (show b ∈ Ioo a (b + delta) from ⟨hab, by linarith⟩)).continuousAt |
| 46 | have hqb : ContinuousWithinAt q (Iic b) b := by |
| 47 | have h := hc b (right_mem_Icc.mpr hab.le) |
| 48 | rwa [ContinuousWithinAt, nhdsWithin_Icc_eq_nhdsLE hab] at h |
| 49 | have hnear : r =ᶠ[𝓝[<] b] q := by |
| 50 | filter_upwards [Ioo_mem_nhdsLT hab] with t ht using hrq ht |
| 51 | have hrpoint : r b = q b := |
| 52 | tendsto_nhds_unique ((hrb.tendsto.mono_left nhdsWithin_le_nhds).congr' hnear) |
| 53 | (hqb.mono Iio_subset_Iic_self) |
| 54 | let m := (a + b) / 2 |
| 55 | have ham : a < m := by dsimp only [m]; linarith |
| 56 | have hmb : m < b := by dsimp only [m]; linarith |
| 57 | let zeta : ℝ → AnnulusCoordinates := fun t => if t ≤ m then l t else r t |
| 58 | have hleft : EqOn zeta l (Ioo (a - epsilon) b) := by |
| 59 | intro t ht |
| 60 | by_cases htm : t ≤ m |
| 61 | · exact if_pos htm |
| 62 | · have hat : a < t := ham.trans (lt_of_not_ge htm) |
| 63 | exact (if_neg htm).trans ((hrq ⟨hat, ht.2⟩).trans (hlq ⟨hat.le, ht.2⟩).symm) |
| 64 | have hright : EqOn zeta r (Ioo a (b + delta)) := by |
| 65 | intro t ht |
| 66 | by_cases htm : t ≤ m |
| 67 | · have htb : t < b := htm.trans_lt hmb |
| 68 | exact (if_pos htm).trans ((hlq ⟨ht.1.le, htb⟩).trans (hrq ⟨ht.1, htb⟩).symm) |
| 69 | · exact if_neg htm |
| 70 | have hzgeo : G.IsGeodesicOn zeta (Ioo (a - epsilon) (b + delta)) := by |
| 71 | intro t ht |
| 72 | by_cases htb : t < b |
| 73 | · obtain ⟨p, u, v, hlocal⟩ := hlgeo t ⟨ht.1, htb⟩ |
| 74 | refine ⟨p, u, v, ?_⟩ |
| 75 | filter_upwards [hlocal, isOpen_Ioo.mem_nhds (show t ∈ Ioo (a - epsilon) b from |
| 76 | ⟨ht.1, htb⟩)] with s hs hsl |
| 77 | exact ⟨(hleft hsl).trans hs.1, hs.2⟩ |
| 78 | · have hat : a < t := hab.trans_le (le_of_not_gt htb) |
| 79 | obtain ⟨p, u, v, hlocal⟩ := hrgeo t ⟨hat, ht.2⟩ |
| 80 | refine ⟨p, u, v, ?_⟩ |
| 81 | filter_upwards [hlocal, isOpen_Ioo.mem_nhds (show t ∈ Ioo a (b + delta) from |
| 82 | ⟨hat, ht.2⟩)] with s hs hsr |
| 83 | exact ⟨(hright hsr).trans hs.1, hs.2⟩ |
| 84 | have hzq : EqOn zeta q (Icc a b) := by |
| 85 | intro t ht |
| 86 | by_cases htm : t ≤ m |
| 87 | · exact (if_pos htm).trans (hlq ⟨ht.1, htm.trans_lt hmb⟩) |
| 88 | · rcases ht.2.eq_or_lt with rfl | htb |
| 89 | · exact (if_neg htm).trans hrpoint |
| 90 | · exact (if_neg htm).trans (hrq ⟨ham.trans (lt_of_not_ge htm), htb⟩) |
| 91 | have hzsm : ContDiffOn ℝ ∞ zeta (Ioo (a - epsilon) (b + delta)) := by |
| 92 | intro t ht |
| 93 | exact (contMDiffAt_iff_contDiffAt.mp |
| 94 | (Conjugate.Realization.contMDiffAt_of_isGeodesicOn hzgeo ht)).contDiffWithinAt |
| 95 | have hsub : Icc a b ⊆ Ioo (a - epsilon) (b + delta) := by |
| 96 | intro t ht |
| 97 | constructor <;> linarith [ht.1, ht.2] |
| 98 | obtain ⟨eta, heta, heq⟩ := |
| 99 | m64_exists_contDiff_eq_nhds_of_isClosed isClosed_Icc isOpen_Ioo hsub hzsm |
| 100 | have hclosed : EqOn eta q (Icc a b) := |
| 101 | fun t ht => (heq t ht).self_of_nhds.trans (hzq ht) |
| 102 | refine ⟨eta, heta, hclosed, ?_, ?_, ?_⟩ |
| 103 | · intro t ht |
| 104 | obtain ⟨p, u, v, hlocal⟩ := hzgeo t (hsub ht) |
| 105 | refine ⟨p, u, v, ?_⟩ |
| 106 | filter_upwards [hlocal, heq t ht] with s hs hse |
| 107 | exact ⟨hse.trans hs.1, hs.2⟩ |
| 108 | · apply ((heta.differentiable (by simp)) a).hasDerivAt.hasDerivWithinAt.congr_of_eventuallyEq |
| 109 | · filter_upwards [Ioo_mem_nhdsGT hab] with t ht using |
| 110 | (hclosed (Ioo_subset_Icc_self ht)).symm |
| 111 | · exact (hclosed (left_mem_Icc.mpr hab.le)).symm |
| 112 | · apply ((heta.differentiable (by simp)) b).hasDerivAt.hasDerivWithinAt.congr_of_eventuallyEq |
| 113 | · filter_upwards [Ioo_mem_nhdsLT hab] with t ht using |
| 114 | (hclosed (Ioo_subset_Icc_self ht)).symm |
| 115 | · exact (hclosed (right_mem_Icc.mpr hab.le)).symm |
| 116 | |
| 117 | end PoincareMT |