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.RicciFlow.ReducedGeometry.LGeometry.Minimization.ChartCover |
| 2 | import Mathlib.Order.RelSeries |
| 3 | import Mathlib.Order.Fin.Basic |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ChartCoverAt.lean` at |
| 6 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 7 | |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter Topology |
| 13 | |
| 14 | namespace PoincareMT.LGeometry |
| 15 | |
| 16 | theorem exists_compact_partition_at {X ι : Type*} |
| 17 | [MetricSpace X] [LocallyCompactSpace X] (U : ι → Set X) |
| 18 | (hU : ∀ i, IsOpen (U i)) (hcover : ∀ x, ∃ i, x ∈ U i) |
| 19 | {A B s : ℝ} (hs : s ∈ Ioo A B) (γ : ℝ → X) (hγ : Continuous γ) : |
| 20 | ∃ (m : ℕ) (t : Fin (m + 1) → ℝ) (c : Fin m → ι) (K : Fin m → Set X) |
| 21 | (j : Fin m), Monotone t ∧ t 0 = A ∧ t (Fin.last m) = B ∧ |
| 22 | (∀ i, IsCompact (K i) ∧ |
| 23 | γ '' Icc (t i.castSucc) (t i.succ) ⊆ interior (K i) ∧ K i ⊆ U (c i)) ∧ |
| 24 | A < t j.castSucc ∧ t j.castSucc < s ∧ s < t j.succ ∧ t j.succ < B := by |
| 25 | classical |
| 26 | let R : Set (ℝ × ℝ) := {z | z.1 ≤ z.2 ∧ ∃ i K, IsCompact K ∧ |
| 27 | γ '' Icc z.1 z.2 ⊆ interior K ∧ K ⊆ U i} |
| 28 | have partition (a b : ℝ) (hab : a ≤ b) : |
| 29 | ∃ p : RelSeries R, p.head = a ∧ p.last = b := by |
| 30 | have hlim : TendstoUniformlyOn (fun _ : ℕ ↦ γ) γ atTop (Icc a b) := by |
| 31 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 32 | intro ε hε |
| 33 | exact Eventually.of_forall (fun _ _ _ ↦ by simpa only [dist_self] using hε) |
| 34 | obtain ⟨m, t, c, K, _, ht, hta, htb, hK, _⟩ := |
| 35 | exists_compact_partition_of_uniform_limit U hU hcover hab γ hγ (fun _ ↦ γ) hlim |
| 36 | let p : RelSeries R := ⟨m, t, fun i ↦ ⟨ht (Fin.castSucc_le_succ i), |
| 37 | c i, K i, hK i⟩⟩ |
| 38 | exact ⟨p, hta, htb⟩ |
| 39 | obtain ⟨i, hi⟩ := hcover (γ s) |
| 40 | obtain ⟨K, hK, hγK, hKU⟩ := exists_compact_between isCompact_singleton (hU i) |
| 41 | (singleton_subset_iff.mpr hi) |
| 42 | have hS : Ioo A B ∩ γ ⁻¹' interior K ∈ 𝓝 s := |
| 43 | (isOpen_Ioo.inter (isOpen_interior.preimage hγ)).mem_nhds |
| 44 | ⟨hs, hγK (mem_singleton _)⟩ |
| 45 | obtain ⟨a, b, _, habmem, habS⟩ := exists_Icc_mem_subset_of_mem_nhds hS |
| 46 | have hsab : s ∈ Ioo a b := by |
| 47 | simpa only [interior_Icc] using (mem_interior_iff_mem_nhds.mpr habmem) |
| 48 | have hab : a < b := hsab.1.trans hsab.2 |
| 49 | have hAa : A < a := (habS ⟨le_rfl, hab.le⟩).1.1 |
| 50 | have hbB : b < B := (habS ⟨hab.le, le_rfl⟩).1.2 |
| 51 | have habK : γ '' Icc a b ⊆ interior K := by |
| 52 | rintro _ ⟨z, hz, rfl⟩ |
| 53 | exact (habS hz).2 |
| 54 | obtain ⟨p, hpA, hpa⟩ := partition A a hAa.le |
| 55 | obtain ⟨q, hqb, hqB⟩ := partition b B hbB.le |
| 56 | have hstep : (p.last, b) ∈ R := by |
| 57 | change p.last ≤ b ∧ ∃ c C, IsCompact C ∧ |
| 58 | γ '' Icc p.last b ⊆ interior C ∧ C ⊆ U c |
| 59 | rw [hpa] |
| 60 | exact ⟨hab.le, i, K, hK, habK, hKU⟩ |
| 61 | let p' := p.snoc b hstep |
| 62 | have hconnect : p'.last = q.head := by |
| 63 | rw [show p'.last = b from RelSeries.last_snoc p b hstep, hqb] |
| 64 | let r := p'.smash q hconnect |
| 65 | let j : Fin r.length := (Fin.last p.length).castAdd q.length |
| 66 | have hja : r j.castSucc = a := by |
| 67 | rw [show r j.castSucc = p' (Fin.last p.length).castSucc from |
| 68 | RelSeries.smash_castAdd hconnect (Fin.last p.length)] |
| 69 | exact (RelSeries.snoc_castSucc p b hstep (Fin.last p.length)).trans hpa |
| 70 | have hjb : r j.succ = b := by |
| 71 | rw [show r j.succ = p' (Fin.last p.length).succ from |
| 72 | RelSeries.smash_succ_castAdd hconnect (Fin.last p.length)] |
| 73 | simpa [p', RelSeries.last] using (RelSeries.last_snoc p b hstep) |
| 74 | choose c C hC using fun i : Fin r.length ↦ (r.step i).2 |
| 75 | refine ⟨r.length, r, c, C, j, ?_, ?_, ?_, hC, ?_⟩ |
| 76 | · exact Fin.monotone_iff_le_succ.mpr (fun i ↦ (r.step i).1) |
| 77 | · change r.head = A |
| 78 | simpa only [r, RelSeries.head_smash, p', RelSeries.head_snoc] using hpA |
| 79 | · change r.last = B |
| 80 | simpa only [r, RelSeries.last_smash] using hqB |
| 81 | · simpa only [hja, hjb] using And.intro hAa (And.intro hsab.1 (And.intro hsab.2 hbB)) |
| 82 | |
| 83 | end PoincareMT.LGeometry |