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.UnitInterval |
| 2 | import Mathlib.Tactic.Linarith |
| 3 | |
| 4 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/OverlappingIntervals.lean` at |
| 5 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 6 | |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | |
| 10 | open Set Filter Topology |
| 11 | |
| 12 | namespace PoincareMT.LGeometry |
| 13 | |
| 14 | theorem exists_enlarged_closed_interval {a b c d : ℝ} (hab : a < b) |
| 15 | (hac : a ≤ c) (hcd : c ≤ d) (hdb : d ≤ b) |
| 16 | {U : Set ℝ} (hU : IsOpen U) (hcore : Icc c d ⊆ U) : |
| 17 | ∃ l r : ℝ, a ≤ l ∧ l < r ∧ r ≤ b ∧ l ≤ c ∧ d ≤ r ∧ Icc l r ⊆ U ∧ |
| 18 | ∀ s ∈ Icc c d, Icc l r ∈ 𝓝[Icc a b] s := by |
| 19 | obtain ⟨l₀, u₀, ⟨hlc, hcu⟩, hleft⟩ := |
| 20 | mem_nhds_iff_exists_Ioo_subset.mp (hU.mem_nhds (hcore ⟨le_rfl, hcd⟩)) |
| 21 | obtain ⟨l₁, u₁, ⟨hld, hdu⟩, hright⟩ := |
| 22 | mem_nhds_iff_exists_Ioo_subset.mp (hU.mem_nhds (hcore ⟨hcd, le_rfl⟩)) |
| 23 | let l' := (l₀ + c) / 2 |
| 24 | let r' := (d + u₁) / 2 |
| 25 | have hll : l₀ < l' := by dsimp only [l']; linarith |
| 26 | have hlc' : l' < c := by dsimp only [l']; linarith |
| 27 | have hdr' : d < r' := by dsimp only [r']; linarith |
| 28 | have hrr : r' < u₁ := by dsimp only [r']; linarith |
| 29 | have henlarged : Icc l' r' ⊆ U := by |
| 30 | intro s hs |
| 31 | rcases le_total s c with hsc | hcs |
| 32 | · exact hleft ⟨hll.trans_le hs.1, hsc.trans_lt hcu⟩ |
| 33 | · rcases le_total d s with hds | hsd |
| 34 | · exact hright ⟨hld.trans_le hds, hs.2.trans_lt hrr⟩ |
| 35 | · exact hcore ⟨hcs, hsd⟩ |
| 36 | let l := max a l' |
| 37 | let r := min b r' |
| 38 | have hlr : l < r := max_lt |
| 39 | (lt_min hab ((hac.trans hcd).trans_lt hdr')) |
| 40 | (lt_min ((hlc'.trans_le hcd).trans_le hdb) ((hlc'.trans_le hcd).trans hdr')) |
| 41 | refine ⟨l, r, le_max_left _ _, hlr, min_le_left _ _, max_le hac hlc'.le, |
| 42 | le_min hdb hdr'.le, ?_, ?_⟩ |
| 43 | · exact (Icc_subset_Icc (le_max_right _ _) (min_le_right _ _)).trans henlarged |
| 44 | · intro s hs |
| 45 | apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 46 | refine ⟨Ioo l' r', Ioo_mem_nhds (hlc'.trans_le hs.1) (hs.2.trans_lt hdr'), ?_⟩ |
| 47 | intro t ht |
| 48 | exact ⟨max_le ht.2.1 ht.1.1.le, le_min ht.2.2 ht.1.2.le⟩ |
| 49 | |
| 50 | theorem exists_overlapping_Icc_partition {ι : Type*} (U : ι → Set ℝ) |
| 51 | (hU : ∀ i, IsOpen (U i)) {a b : ℝ} (hab : a < b) |
| 52 | (hcover : Icc a b ⊆ ⋃ i, U i) : |
| 53 | ∃ (m : ℕ) (t : Fin (m + 1) → ℝ) (c : Fin m → ι) (l r : Fin m → ℝ), |
| 54 | 0 < m ∧ Monotone t ∧ t 0 = a ∧ t (Fin.last m) = b ∧ |
| 55 | ∀ i, a ≤ l i ∧ l i < r i ∧ r i ≤ b ∧ l i ≤ t i.castSucc ∧ |
| 56 | t i.succ ≤ r i ∧ Icc (l i) (r i) ⊆ U (c i) ∧ |
| 57 | ∀ s ∈ Icc (t i.castSucc) (t i.succ), Icc (l i) (r i) ∈ 𝓝[Icc a b] s := by |
| 58 | classical |
| 59 | let V : ι → Set (Icc a b) := fun i ↦ (Subtype.val : Icc a b → ℝ) ⁻¹' U i |
| 60 | have hV : ∀ i, IsOpen (V i) := fun i ↦ (hU i).preimage continuous_subtype_val |
| 61 | have hVcover : (univ : Set (Icc a b)) ⊆ ⋃ i, V i := by |
| 62 | intro s _ |
| 63 | obtain ⟨i, hi⟩ := mem_iUnion.mp (hcover s.property) |
| 64 | exact mem_iUnion.mpr ⟨i, hi⟩ |
| 65 | obtain ⟨u, hua, humono, ⟨k, huk⟩, hpieces⟩ := |
| 66 | exists_monotone_Icc_subset_open_cover_Icc hab.le hV hVcover |
| 67 | let m := k + 1 |
| 68 | let t : Fin (m + 1) → ℝ := fun i ↦ u i |
| 69 | have htm : Monotone t := fun i j hij ↦ humono hij |
| 70 | have hta : t 0 = a := hua |
| 71 | have htb : t (Fin.last m) = b := huk m (Nat.le_succ k) |
| 72 | choose c hc using fun i : Fin m ↦ hpieces i.1 |
| 73 | have hcore (i : Fin m) : Icc (t i.castSucc) (t i.succ) ⊆ U (c i) := by |
| 74 | intro s hs |
| 75 | have hsab : s ∈ Icc a b := |
| 76 | ⟨(u i.1).property.1.trans hs.1, hs.2.trans (u (i.1 + 1)).property.2⟩ |
| 77 | exact hc i (show (⟨s, hsab⟩ : Icc a b) ∈ Icc (u i.1) (u (i.1 + 1)) from hs) |
| 78 | choose l r hl using fun i : Fin m ↦ exists_enlarged_closed_interval hab |
| 79 | (u i.1).property.1 (humono (Nat.le_succ i.1)) (u (i.1 + 1)).property.2 |
| 80 | (hU (c i)) (hcore i) |
| 81 | exact ⟨m, t, c, l, r, Nat.succ_pos k, htm, hta, htb, hl⟩ |
| 82 | |
| 83 | end PoincareMT.LGeometry |