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.Analysis.Last.ClosedContact |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Interior.Geodesic |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Last.ContactTangency |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Endpoint.UnitSpeed |
| 5 | |
| 6 | /-! |
| 7 | # The actual last base contact and its outgoing geodesic |
| 8 | |
| 9 | Compactness selects the last contact. Side avoidance then gives interior |
| 10 | geodesic regularity afterwards, and the checked tangency theorem supplies |
| 11 | the actual nonzero outgoing derivative at the selected base point. |
| 12 | Source: MT Claim 19.40, pp. 470-471; minimal-contact derivation, Section 6. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Topology ENNReal Manifold ContDiff Bundle |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 25 | normedSpaceTangentSpaceVectorSpace |
| 26 | |
| 27 | /-- Any further base contact produces a last interior base point, followed by an actual |
| 28 | interior geodesic with nonzero tangent parallel to the base. The last contact and outgoing |
| 29 | geodesic are constructed from the original path, rather than supplied as regularity |
| 30 | assumptions. Source: MT Claim 19.40, pp. 470-471; |
| 31 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Sections 6-7. -/ |
| 32 | theorem m64Intrinsic_constrained_minimizer_last_base_contact |
| 33 | (G : RiemannianMetric 2 AnnulusCoordinates) |
| 34 | {alpha : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) {a b : ℝ} |
| 35 | (hinj : InjOn alpha (Icc a b)) (hregular : ∀ p ∈ Ioo a b, deriv alpha p ≠ 0) |
| 36 | {W U V : Set AnnulusCoordinates} (hW : IsCompact W) |
| 37 | (hseparate : ∀ p ∈ Ioo a b, alpha p ∉ W) |
| 38 | (hU : IsOpen U) (hV : IsOpen V) (hdisj : Disjoint U V) |
| 39 | (hfU : frontier U = alpha '' Icc a b ∪ W) (hfV : frontier V = frontier U) |
| 40 | (hK : IsCompact (closure U)) {gamma : ℝ → AnnulusCoordinates} {L : ℝ} |
| 41 | (hc : ContinuousOn gamma (Icc 0 L)) |
| 42 | (hconf : MapsTo gamma (Icc 0 L) (closure U)) |
| 43 | (hlip : ∀ s ∈ Icc 0 L, ∀ t ∈ Icc 0 L, |
| 44 | G.edist (gamma s) (gamma t) ≤ ENNReal.ofReal |s - t|) |
| 45 | (hmin : ∀ c ∈ Icc 0 L, ∀ d ∈ Icc 0 L, c ≤ d → |
| 46 | ∀ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) → |
| 47 | tau 0 = gamma c → tau 1 = gamma d → MapsTo tau (Icc 0 1) (closure U) → |
| 48 | ENNReal.ofReal (d - c) ≤ m64IntrinsicCurveVariation G tau 0 1) |
| 49 | (hside : ∀ t ∈ Ioo 0 L, gamma t ∉ W) |
| 50 | (hcorners : ∀ t ∈ Ioo 0 L, gamma t ≠ alpha a ∧ gamma t ≠ alpha b) |
| 51 | (hend : gamma L ∉ alpha '' Icc a b) |
| 52 | (hcontact : ∃ t ∈ Ioo 0 L, gamma t ∈ alpha '' Icc a b) : |
| 53 | ∃ u p : ℝ, ∃ v : AnnulusCoordinates, ∃ c : ℝ, |
| 54 | u ∈ Ioo 0 L ∧ p ∈ Ioo a b ∧ gamma u = alpha p ∧ |
| 55 | MapsTo gamma (Ioo u L) (interior (closure U)) ∧ |
| 56 | G.IsGeodesicOn gamma (Ioo u L) ∧ |
| 57 | (∀ t ∈ Ioo u L, ContMDiffAt 𝓘(ℝ, ℝ) (𝓡 2) ∞ gamma t) ∧ |
| 58 | HasDerivWithinAt gamma v (Ioi u) u ∧ v ≠ 0 ∧ |
| 59 | G.tangentNorm (gamma u) v = 1 ∧ c ≠ 0 ∧ v = c • deriv alpha p := by |
| 60 | obtain ⟨u, hu, humem, hlast⟩ := m64ContinuousOn_exists_last_closed_contact hc |
| 61 | (isCompact_Icc.image ha.continuous).isClosed hend hcontact |
| 62 | obtain ⟨p, hp, hpoint⟩ := humem |
| 63 | have hpa : a < p := lt_of_le_of_ne hp.1 (fun heq => |
| 64 | (hcorners u hu).1 (hpoint.symm.trans (congrArg alpha heq.symm))) |
| 65 | have hpb : p < b := lt_of_le_of_ne hp.2 (fun heq => |
| 66 | (hcorners u hu).2 (hpoint.symm.trans (congrArg alpha heq))) |
| 67 | have hinside : MapsTo gamma (Ioo u L) (interior (closure U)) := by |
| 68 | intro t ht |
| 69 | have htfull : t ∈ Ioo 0 L := ⟨hu.1.trans ht.1, ht.2⟩ |
| 70 | by_contra hout |
| 71 | have hfront : gamma t ∈ frontier (closure U) := |
| 72 | ⟨subset_closure (hconf (Ioo_subset_Icc_self htfull)), hout⟩ |
| 73 | have hf : gamma t ∈ alpha '' Icc a b ∪ W := |
| 74 | hfU ▸ frontier_closure_subset hfront |
| 75 | exact hf.elim (hlast t ⟨ht.1, ht.2.le⟩) (hside t htfull) |
| 76 | obtain ⟨hgeo, hsmooth⟩ := |
| 77 | m64Intrinsic_constrained_minimizer_interior_geodesic G hK hlip hmin |
| 78 | have houtGeo : G.IsGeodesicOn gamma (Ioo u L) := |
| 79 | fun t ht => hgeo t ⟨⟨hu.1.trans ht.1, ht.2⟩, hinside ht⟩ |
| 80 | obtain ⟨v, hv, hvne, c, hcne, hvc⟩ := |
| 81 | m64Intrinsic_constrained_minimizer_last_contact_tangent G ha hinj ⟨hpa, hpb⟩ |
| 82 | (hregular p ⟨hpa, hpb⟩) hW (hseparate p ⟨hpa, hpb⟩) |
| 83 | hU hV hdisj hfU hfV hK hc hconf hlip hmin hu hpoint.symm houtGeo |
| 84 | have hvunit : G.tangentNorm (gamma u) v = 1 := |
| 85 | m64Intrinsic_compact_geodesic_right_derivative_unit G hK hu.2 houtGeo |
| 86 | (fun t ht => hconf ⟨hu.1.le.trans ht.1.le, ht.2.le⟩) |
| 87 | (hc.continuousAt (Icc_mem_nhds hu.1 hu.2)).continuousWithinAt |
| 88 | (fun t ht => m64Intrinsic_constrained_minimizer_interior_unit_speed G hK hlip hmin |
| 89 | ⟨hu.1.trans ht.1, ht.2⟩ (hinside ht)) hv |
| 90 | exact ⟨u, p, v, c, hu, ⟨hpa, hpb⟩, hpoint.symm, hinside, houtGeo, |
| 91 | fun t ht => hsmooth t ⟨hu.1.trans ht.1, ht.2⟩ (hinside ht), hv, hvne, hvunit, hcne, hvc⟩ |
| 92 | |
| 93 | end PoincareMT |