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.ReducedLength.Minimum.Variational.ChartCover |
| 2 | import Mathlib.Order.RelSeries |
| 3 | import Mathlib.Order.Fin.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Compact chart partitions around a prescribed time |
| 7 | |
| 8 | A chosen interior parameter lies strictly inside one segment of the partition. |
| 9 | Adapted from Mapher `Proofs/M08/ChartCoverAt.lean`, commit |
| 10 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter Topology |
| 17 | |
| 18 | namespace PoincareMT.ReducedLengthMinimum |
| 19 | |
| 20 | /-- A nonconstant monotone partition has a positive-length interval starting |
| 21 | at its left endpoint, even when some initial subdivision values repeat. -/ |
| 22 | theorem exists_first_strict_segment {m : ℕ} (t : Fin (m + 1) → ℝ) |
| 23 | (ht : Monotone t) (hab : t 0 < t (Fin.last m)) : |
| 24 | ∃ j : Fin m, t j.castSucc = t 0 ∧ t 0 < t j.succ := by |
| 25 | by_contra! h |
| 26 | have heq : ∀ i : Fin (m + 1), t i = t 0 := |
| 27 | Fin.induction rfl (fun j hj => le_antisymm (h j hj) (ht (Fin.zero_le _))) |
| 28 | exact hab.ne (heq (Fin.last m)).symm |
| 29 | |
| 30 | /-- The analogous last positive-length interval of a monotone partition. -/ |
| 31 | theorem exists_last_strict_segment {m : ℕ} (t : Fin (m + 1) → ℝ) |
| 32 | (ht : Monotone t) (hab : t 0 < t (Fin.last m)) : |
| 33 | ∃ j : Fin m, t j.succ = t (Fin.last m) ∧ t j.castSucc < t (Fin.last m) := by |
| 34 | by_contra! h |
| 35 | have heq : ∀ i : Fin (m + 1), t i = t (Fin.last m) := |
| 36 | Fin.reverseInduction rfl (fun j hj => le_antisymm (ht (Fin.le_last _)) (h j hj)) |
| 37 | exact hab.ne (heq 0) |
| 38 | |
| 39 | theorem exists_compact_partition_at {X ι : Type*} |
| 40 | [MetricSpace X] [LocallyCompactSpace X] (U : ι → Set X) |
| 41 | (hU : ∀ i, IsOpen (U i)) (hcover : ∀ x, ∃ i, x ∈ U i) |
| 42 | {A B s : ℝ} (hs : s ∈ Ioo A B) (γ : ℝ → X) (hγ : Continuous γ) : |
| 43 | ∃ (m : ℕ) (t : Fin (m + 1) → ℝ) (c : Fin m → ι) (K : Fin m → Set X) |
| 44 | (j : Fin m), Monotone t ∧ t 0 = A ∧ t (Fin.last m) = B ∧ |
| 45 | (∀ i, IsCompact (K i) ∧ |
| 46 | γ '' Icc (t i.castSucc) (t i.succ) ⊆ interior (K i) ∧ K i ⊆ U (c i)) ∧ |
| 47 | A < t j.castSucc ∧ t j.castSucc < s ∧ s < t j.succ ∧ t j.succ < B := by |
| 48 | classical |
| 49 | let R : Set (ℝ × ℝ) := {z | z.1 ≤ z.2 ∧ ∃ i K, IsCompact K ∧ |
| 50 | γ '' Icc z.1 z.2 ⊆ interior K ∧ K ⊆ U i} |
| 51 | have partition (a b : ℝ) (hab : a ≤ b) : |
| 52 | ∃ p : RelSeries R, p.head = a ∧ p.last = b := by |
| 53 | have hlim : TendstoUniformlyOn (fun _ : ℕ ↦ γ) γ atTop (Icc a b) := by |
| 54 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 55 | intro ε hε |
| 56 | exact Eventually.of_forall (fun _ _ _ ↦ by simpa only [dist_self] using hε) |
| 57 | obtain ⟨m, t, c, K, _, ht, hta, htb, hK, _⟩ := |
| 58 | exists_compact_partition_of_uniform_limit U hU hcover hab γ hγ (fun _ ↦ γ) hlim |
| 59 | let p : RelSeries R := ⟨m, t, fun i ↦ ⟨ht (Fin.castSucc_le_succ i), |
| 60 | c i, K i, hK i⟩⟩ |
| 61 | exact ⟨p, hta, htb⟩ |
| 62 | obtain ⟨i, hi⟩ := hcover (γ s) |
| 63 | obtain ⟨K, hK, hγK, hKU⟩ := exists_compact_between isCompact_singleton (hU i) |
| 64 | (singleton_subset_iff.mpr hi) |
| 65 | have hS : Ioo A B ∩ γ ⁻¹' interior K ∈ 𝓝 s := |
| 66 | (isOpen_Ioo.inter (isOpen_interior.preimage hγ)).mem_nhds |
| 67 | ⟨hs, hγK (mem_singleton _)⟩ |
| 68 | obtain ⟨a, b, _, habmem, habS⟩ := exists_Icc_mem_subset_of_mem_nhds hS |
| 69 | have hsab : s ∈ Ioo a b := by |
| 70 | simpa only [interior_Icc] using (mem_interior_iff_mem_nhds.mpr habmem) |
| 71 | have hab : a < b := hsab.1.trans hsab.2 |
| 72 | have hAa : A < a := (habS ⟨le_rfl, hab.le⟩).1.1 |
| 73 | have hbB : b < B := (habS ⟨hab.le, le_rfl⟩).1.2 |
| 74 | have habK : γ '' Icc a b ⊆ interior K := by |
| 75 | rintro _ ⟨z, hz, rfl⟩ |
| 76 | exact (habS hz).2 |
| 77 | obtain ⟨p, hpA, hpa⟩ := partition A a hAa.le |
| 78 | obtain ⟨q, hqb, hqB⟩ := partition b B hbB.le |
| 79 | have hstep : (p.last, b) ∈ R := by |
| 80 | change p.last ≤ b ∧ ∃ c C, IsCompact C ∧ |
| 81 | γ '' Icc p.last b ⊆ interior C ∧ C ⊆ U c |
| 82 | rw [hpa] |
| 83 | exact ⟨hab.le, i, K, hK, habK, hKU⟩ |
| 84 | let p' := p.snoc b hstep |
| 85 | have hconnect : p'.last = q.head := by |
| 86 | rw [show p'.last = b from RelSeries.last_snoc p b hstep, hqb] |
| 87 | let r := p'.smash q hconnect |
| 88 | let j : Fin r.length := (Fin.last p.length).castAdd q.length |
| 89 | have hja : r j.castSucc = a := by |
| 90 | rw [show r j.castSucc = p' (Fin.last p.length).castSucc from |
| 91 | RelSeries.smash_castAdd hconnect (Fin.last p.length)] |
| 92 | exact (RelSeries.snoc_castSucc p b hstep (Fin.last p.length)).trans hpa |
| 93 | have hjb : r j.succ = b := by |
| 94 | rw [show r j.succ = p' (Fin.last p.length).succ from |
| 95 | RelSeries.smash_succ_castAdd hconnect (Fin.last p.length)] |
| 96 | simpa [p', RelSeries.last] using (RelSeries.last_snoc p b hstep) |
| 97 | choose c C hC using fun i : Fin r.length ↦ (r.step i).2 |
| 98 | refine ⟨r.length, r, c, C, j, ?_, ?_, ?_, hC, ?_⟩ |
| 99 | · exact Fin.monotone_iff_le_succ.mpr (fun i ↦ (r.step i).1) |
| 100 | · change r.head = A |
| 101 | simpa only [r, RelSeries.head_smash, p', RelSeries.head_snoc] using hpA |
| 102 | · change r.last = B |
| 103 | simpa only [r, RelSeries.last_smash] using hqB |
| 104 | · simpa only [hja, hjb] using And.intro hAa (And.intro hsab.1 (And.intro hsab.2 hbB)) |
| 105 | |
| 106 | end PoincareMT.ReducedLengthMinimum |