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.Jacobi.IntervalSolutionGluing |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/IntervalSolutionUnique.lean` at |
| 4 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 5 | |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Filter Topology |
| 11 | |
| 12 | namespace PoincareMT.LGeometry |
| 13 | |
| 14 | theorem exists_mem_finite_interval_core {a b : ℝ} {m : ℕ} (hm : 0 < m) |
| 15 | (t : Fin (m + 1) → ℝ) (ht : Monotone t) |
| 16 | (hta : t 0 = a) (htb : t (Fin.last m) = b) {s : ℝ} (hs : s ∈ Icc a b) : |
| 17 | ∃ i : Fin m, s ∈ Icc (t i.castSucc) (t i.succ) := by |
| 18 | have hcover : ∀ k (hk : k ≤ m), ∀ s ∈ Icc a (t ⟨k, Nat.lt_succ_of_le hk⟩), |
| 19 | ∃ i : Fin m, s ∈ Icc (t i.castSucc) (t i.succ) := by |
| 20 | intro k |
| 21 | induction k with |
| 22 | | zero => |
| 23 | intro hk s hs |
| 24 | have hzero : t (⟨0, Nat.lt_succ_of_le hk⟩ : Fin (m + 1)) = a := hta |
| 25 | have hsa : s = a := le_antisymm (hzero ▸ hs.2) hs.1 |
| 26 | let i : Fin m := ⟨0, hm⟩ |
| 27 | refine ⟨i, ?_, ?_⟩ |
| 28 | · change t 0 ≤ s |
| 29 | rw [hta, hsa] |
| 30 | · rw [hsa] |
| 31 | exact hta ▸ ht (Fin.zero_le i.succ) |
| 32 | | succ k ih => |
| 33 | intro hk s hs |
| 34 | have hk' : k ≤ m := Nat.le_of_succ_le hk |
| 35 | by_cases hsc : s ≤ t ⟨k, Nat.lt_succ_of_le hk'⟩ |
| 36 | · exact ih hk' s ⟨hs.1, hsc⟩ |
| 37 | · let i : Fin m := ⟨k, Nat.lt_of_succ_le hk⟩ |
| 38 | exact ⟨i, (lt_of_not_ge hsc).le, hs.2⟩ |
| 39 | apply hcover m le_rfl s |
| 40 | change s ∈ Icc a (t (Fin.last m)) |
| 41 | simpa only [htb] using hs |
| 42 | |
| 43 | set_option maxHeartbeats 1000000 in |
| 44 | theorem interval_solution_unique_of_cover {X : Type*} |
| 45 | (Sol : ℝ → ℝ → (ℝ → X) → Prop) (hSol : IntervalSolutionLocality Sol) |
| 46 | {a b : ℝ} {m : ℕ} (hm : 0 < m) |
| 47 | (t : Fin (m + 1) → ℝ) (l r : Fin m → ℝ) |
| 48 | (ht : Monotone t) (hta : t 0 = a) (htb : t (Fin.last m) = b) |
| 49 | (hpieces : ∀ i, a ≤ l i ∧ l i < r i ∧ r i ≤ b ∧ |
| 50 | l i ≤ t i.castSucc ∧ t i.succ ≤ r i) |
| 51 | (hunique : ∀ i {f g : ℝ → X}, Sol (l i) (r i) f → Sol (l i) (r i) g → |
| 52 | ∀ s ∈ Icc (l i) (r i), f s = g s → EqOn f g (Icc (l i) (r i))) |
| 53 | {f g : ℝ → X} (hf : Sol a b f) (hg : Sol a b g) (hinit : f a = g a) : |
| 54 | EqOn f g (Icc a b) := by |
| 55 | have hstep : ∀ k (hk : k < m), EqOn f g (Icc (l ⟨k, hk⟩) (r ⟨k, hk⟩)) := by |
| 56 | intro k |
| 57 | induction k with |
| 58 | | zero => |
| 59 | intro hk |
| 60 | let i : Fin m := ⟨0, hk⟩ |
| 61 | obtain ⟨hal, hlr, hrb, hlt, htr⟩ := hpieces i |
| 62 | apply hunique i (hSol.restrict hal hlr hrb hf) (hSol.restrict hal hlr hrb hg) |
| 63 | (t i.castSucc) ⟨hlt, (ht (show i.castSucc ≤ i.succ from Nat.le_succ i.val)).trans htr⟩ |
| 64 | change f (t 0) = g (t 0) |
| 65 | rw [hta] |
| 66 | exact hinit |
| 67 | | succ k ih => |
| 68 | intro hk |
| 69 | have hk' : k < m := (Nat.lt_succ_self k).trans hk |
| 70 | let i : Fin m := ⟨k + 1, hk⟩ |
| 71 | let j : Fin m := ⟨k, hk'⟩ |
| 72 | obtain ⟨hal, hlr, hrb, hlt, htr⟩ := hpieces i |
| 73 | obtain ⟨hjal, hjlr, hjrb, hjlt, hjtr⟩ := hpieces j |
| 74 | apply hunique i (hSol.restrict hal hlr hrb hf) (hSol.restrict hal hlr hrb hg) |
| 75 | (t i.castSucc) ⟨hlt, (ht (show i.castSucc ≤ i.succ from Nat.le_succ i.val)).trans htr⟩ |
| 76 | change f (t j.succ) = g (t j.succ) |
| 77 | exact ih hk' ⟨hjlt.trans (ht (show j.castSucc ≤ j.succ from Nat.le_succ j.val)), hjtr⟩ |
| 78 | intro s hs |
| 79 | obtain ⟨i, hi⟩ := exists_mem_finite_interval_core hm t ht hta htb hs |
| 80 | obtain ⟨hal, hlr, hrb, hlt, htr⟩ := hpieces i |
| 81 | exact hstep i.val i.isLt ⟨hlt.trans hi.1, hi.2.trans htr⟩ |
| 82 | |
| 83 | end PoincareMT.LGeometry |