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.Closed.ContactAvoidance |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Geodesic.SideAgreement |
| 3 | |
| 4 | /-! |
| 5 | # Complete avoidance of an actual geodesic side |
| 6 | |
| 7 | Local side agreement makes interior contact persist. The compact side |
| 8 | image gives closedness, while its base corner is forbidden and its terminal |
| 9 | vertex cannot recur by injectivity. Connectedness excludes every side |
| 10 | contact before the terminal parameter, even with infinitely many contacts. |
| 11 | Source: MT Claim 19.40, pp. 470-471; minimal-contact derivation, Section 5. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology ENNReal Manifold ContDiff |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- A constrained minimizer starting off an actual geodesic side and ending at its terminal |
| 24 | vertex avoids the closed side at every interior parameter. Base-corner avoidance is supplied |
| 25 | separately; injectivity excludes the terminal vertex, and all smooth side contacts are |
| 26 | excluded by proved local agreement and connectedness. Source: MT Claim 19.40, pp. 470-471; |
| 27 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 5. -/ |
| 28 | theorem m64Intrinsic_constrained_minimizer_avoids_geodesic_side |
| 29 | (G : RiemannianMetric 2 AnnulusCoordinates) |
| 30 | {alpha : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) {a b : ℝ} |
| 31 | (hinj : InjOn alpha (Icc a b)) |
| 32 | (hregular : ∀ p ∈ Ioo a b, deriv alpha p ≠ 0) |
| 33 | (hgeo : G.IsGeodesicOn alpha (Ioo a b)) |
| 34 | {W U V : Set AnnulusCoordinates} (hW : IsCompact W) |
| 35 | (hseparate : ∀ p ∈ Ioo a b, alpha p ∉ W) |
| 36 | (hU : IsOpen U) (hV : IsOpen V) (hdisj : Disjoint U V) |
| 37 | (hfU : frontier U = alpha '' Icc a b ∪ W) (hfV : frontier V = frontier U) |
| 38 | (hK : IsCompact (closure U)) {gamma : ℝ → AnnulusCoordinates} {L : ℝ} |
| 39 | (hc : ContinuousOn gamma (Icc 0 L)) (hginj : InjOn gamma (Icc 0 L)) |
| 40 | (hconf : MapsTo gamma (Icc 0 L) (closure U)) |
| 41 | (hlip : ∀ s ∈ Icc 0 L, ∀ t ∈ Icc 0 L, |
| 42 | G.edist (gamma s) (gamma t) ≤ ENNReal.ofReal |s - t|) |
| 43 | (hmin : ∀ c ∈ Icc 0 L, ∀ d ∈ Icc 0 L, c ≤ d → |
| 44 | ∀ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) → |
| 45 | tau 0 = gamma c → tau 1 = gamma d → MapsTo tau (Icc 0 1) (closure U) → |
| 46 | ENNReal.ofReal (d - c) ≤ m64IntrinsicCurveVariation G tau 0 1) |
| 47 | (hstart : gamma 0 ∉ alpha '' Icc a b) (hend : gamma L = alpha b) |
| 48 | (hcorner : ∀ u ∈ Ioo 0 L, gamma u ≠ alpha a) : |
| 49 | ∀ u ∈ Ioo 0 L, gamma u ∉ alpha '' Icc a b := by |
| 50 | apply m64ContinuousOn_avoids_closed_of_local_contact hc |
| 51 | (isCompact_Icc.image ha.continuous).isClosed hstart |
| 52 | intro u hu hmem |
| 53 | obtain ⟨p, hp, hpoint⟩ := hmem |
| 54 | have hpa : a < p := by |
| 55 | rcases hp.1.eq_or_lt with heq | hlt |
| 56 | · exact False.elim (hcorner u hu (by rw [heq]; exact hpoint.symm)) |
| 57 | · exact hlt |
| 58 | have hpb : p < b := by |
| 59 | rcases hp.2.eq_or_lt with heq | hlt |
| 60 | · have hmeet : gamma u = gamma L := by rw [hend, ← heq]; exact hpoint.symm |
| 61 | have htime := hginj ⟨hu.1.le, hu.2.le⟩ ⟨hu.1.le.trans hu.2.le, le_rfl⟩ hmeet |
| 62 | exact False.elim (hu.2.ne htime) |
| 63 | · exact hlt |
| 64 | obtain ⟨_, _, _, hnear⟩ := m64Intrinsic_constrained_minimizer_geodesic_side_agreement |
| 65 | G ha hinj ⟨hpa, hpb⟩ (hregular p ⟨hpa, hpb⟩) hgeo hW (hseparate p ⟨hpa, hpb⟩) |
| 66 | hU hV hdisj hfU hfV hK hc hconf hlip hmin hu hpoint.symm |
| 67 | filter_upwards [hnear] with t ht |
| 68 | exact image_mono Ioo_subset_Icc_self ht |
| 69 | |
| 70 | end PoincareMT |