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 Mathlib.Topology.Order.Monotone |
| 2 | import Mathlib.Topology.Instances.Real.Lemmas |
| 3 | |
| 4 | /-! First exit after a positive prefix in a closed set. |
| 5 | Source: MT Claim 19.41, p. 471; short-geodesic-digons derivation, Section 10. |
| 6 | The prefix may touch the boundary; strict interior entry is unnecessary. -/ |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | |
| 10 | open Set Filter |
| 11 | open scoped Topology |
| 12 | |
| 13 | namespace PoincareMT |
| 14 | |
| 15 | /-- A positive closed confined prefix and a later outside point give a positive first exit, |
| 16 | with the entire closed prefix retained. Source: MT Claim 19.41; digon derivation, Section |
| 17 | 10. Source/construction: |
| 18 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 10. -/ |
| 19 | theorem m64_exists_first_exit_closed |
| 20 | {X : Type*} [TopologicalSpace X] {q : ℝ → X} {A : ℝ} (hA : 0 < A) |
| 21 | (hq : ContinuousOn q (Icc 0 A)) {K : Set X} (hK : IsClosed K) |
| 22 | (hzero : q 0 ∈ K) (henter : ∀ᶠ t in 𝓝[>] (0 : ℝ), q t ∈ K) |
| 23 | (hout : q A ∉ K) : |
| 24 | ∃ b ∈ Ioo 0 A, q b ∈ frontier K ∧ MapsTo q (Icc 0 b) K := by |
| 25 | obtain ⟨eta, heta, hprefix⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp henter |
| 26 | let S := {t ∈ Icc (0 : ℝ) A | q t ∉ K} |
| 27 | have hS : S.Nonempty := ⟨A, ⟨hA.le, le_rfl⟩, hout⟩ |
| 28 | have hbound : BddBelow S := ⟨0, fun _ ht => ht.1.1⟩ |
| 29 | let b := sInf S |
| 30 | have hbl : min eta A ≤ b := le_csInf hS (by |
| 31 | intro t ht |
| 32 | by_contra hn |
| 33 | have htlt : t < min eta A := lt_of_not_ge hn |
| 34 | have htpos : 0 < t := lt_of_le_of_ne ht.1.1 (by |
| 35 | intro heq |
| 36 | exact ht.2 (heq ▸ hzero)) |
| 37 | exact ht.2 (hprefix ⟨htpos, htlt.trans_le (min_le_left _ _)⟩)) |
| 38 | have hbpos : 0 < b := (lt_min heta hA).trans_le hbl |
| 39 | have hbA : b ≤ A := csInf_le hbound ⟨⟨hA.le, le_rfl⟩, hout⟩ |
| 40 | have hpre : MapsTo q (Ico 0 b) K := by |
| 41 | intro t ht |
| 42 | by_contra hnot |
| 43 | exact ht.2.not_ge (csInf_le hbound ⟨⟨ht.1, ht.2.le.trans hbA⟩, hnot⟩) |
| 44 | have hclpre : MapsTo q (Icc 0 b) K := by |
| 45 | have hc : ContinuousOn q (closure (Ico 0 b)) := by |
| 46 | rw [closure_Ico hbpos.ne] |
| 47 | exact hq.mono (Icc_subset_Icc le_rfl hbA) |
| 48 | have h := hpre.closure_of_continuousOn hc |
| 49 | simpa only [closure_Ico hbpos.ne, hK.closure_eq] using h |
| 50 | have hbK : q b ∈ K := hclpre ⟨hbpos.le, le_rfl⟩ |
| 51 | have hboutside : q b ∈ closure Kᶜ := by |
| 52 | have hsub : closure S ⊆ Icc 0 A := |
| 53 | closure_minimal (fun _ ht => ht.1) isClosed_Icc |
| 54 | have hmap : MapsTo q S Kᶜ := fun _ ht => ht.2 |
| 55 | exact hmap.closure_of_continuousOn (hq.mono hsub) (csInf_mem_closure hS hbound) |
| 56 | refine ⟨b, ⟨hbpos, lt_of_le_of_ne hbA ?_⟩, ?_, hclpre⟩ |
| 57 | · intro heq |
| 58 | exact hout (heq ▸ hbK) |
| 59 | · rw [frontier_eq_closure_inter_closure, hK.closure_eq] |
| 60 | exact ⟨hbK, hboutside⟩ |
| 61 | |
| 62 | end PoincareMT |