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.Algebra.Homology.ShortComplex.ModuleCat |
| 2 | |
| 3 | /-! # Element chases for exact diagrams of integer modules -/ |
| 4 | |
| 5 | set_option autoImplicit false |
| 6 | |
| 7 | open CategoryTheory |
| 8 | |
| 9 | universe u |
| 10 | |
| 11 | namespace Poincare.Topology |
| 12 | |
| 13 | theorem moduleExactDiagram_surjective |
| 14 | {A B C D A' B' C' D' : ModuleCat.{u} Int} |
| 15 | (f : A ⟶ B) (g : B ⟶ C) (h : C ⟶ D) |
| 16 | (f' : A' ⟶ B') (g' : B' ⟶ C') (h' : C' ⟶ D') |
| 17 | (a : A ⟶ A') (b : B ⟶ B') (c : C ⟶ C') (d : D ⟶ D') |
| 18 | (hf : f ≫ b = a ≫ f') (hg : g ≫ c = b ≫ g') (hh : h ≫ d = c ≫ h') |
| 19 | (hgh : g' ≫ h' = 0) |
| 20 | (hex : ∀ z : C, h z = 0 → ∃ y : B, g y = z) |
| 21 | (hex' : ∀ y : B', g' y = 0 → ∃ x : A', f' x = y) |
| 22 | (ha : Function.Surjective a) (hc : Function.Surjective c) |
| 23 | (hd : Function.Injective d) : Function.Surjective b := by |
| 24 | intro y |
| 25 | obtain ⟨z, hz⟩ := hc (g' y) |
| 26 | have hzero : h z = 0 := by |
| 27 | apply hd |
| 28 | rw [map_zero] |
| 29 | change (h ≫ d) z = 0 |
| 30 | rw [hh] |
| 31 | change h' (c z) = 0 |
| 32 | rw [hz] |
| 33 | exact congrArg (fun k => k y) hgh |
| 34 | obtain ⟨w, hw⟩ := hex z hzero |
| 35 | have hy : g' (y - b w) = 0 := by |
| 36 | have he := congrArg (fun k => k w) hg |
| 37 | change c (g w) = g' (b w) at he |
| 38 | rw [map_sub, ← he, hw, hz, sub_self] |
| 39 | obtain ⟨x, hx⟩ := hex' (y - b w) hy |
| 40 | obtain ⟨v, hv⟩ := ha x |
| 41 | refine ⟨w + f v, ?_⟩ |
| 42 | have he := congrArg (fun k => k v) hf |
| 43 | change b (f v) = f' (a v) at he |
| 44 | rw [map_add, he, hv, hx] |
| 45 | exact add_sub_cancel _ _ |
| 46 | |
| 47 | theorem moduleExactDiagram_injective |
| 48 | {A B C D A' B' C' D' : ModuleCat.{u} Int} |
| 49 | (f : A ⟶ B) (g : B ⟶ C) (h : C ⟶ D) |
| 50 | (f' : A' ⟶ B') (g' : B' ⟶ C') (h' : C' ⟶ D') |
| 51 | (a : A ⟶ A') (b : B ⟶ B') (c : C ⟶ C') (d : D ⟶ D') |
| 52 | (hf : f ≫ b = a ≫ f') (hg : g ≫ c = b ≫ g') (hh : h ≫ d = c ≫ h') |
| 53 | (hfg : f ≫ g = 0) |
| 54 | (hex : ∀ z : C, h z = 0 → ∃ y : B, g y = z) |
| 55 | (hex' : ∀ y : B', g' y = 0 → ∃ x : A', f' x = y) |
| 56 | (ha : Function.Surjective a) (hb : Function.Injective b) |
| 57 | (hd : Function.Injective d) : Function.Injective c := by |
| 58 | suffices hz : ∀ z : C, c z = 0 → z = 0 by |
| 59 | intro x y hxy |
| 60 | apply sub_eq_zero.mp |
| 61 | apply hz |
| 62 | rw [map_sub, hxy, sub_self] |
| 63 | intro z hz |
| 64 | have hzero : h z = 0 := by |
| 65 | apply hd |
| 66 | rw [map_zero] |
| 67 | change (h ≫ d) z = 0 |
| 68 | rw [hh] |
| 69 | change h' (c z) = 0 |
| 70 | rw [hz, map_zero] |
| 71 | obtain ⟨y, hy⟩ := hex z hzero |
| 72 | have hzero' : g' (b y) = 0 := by |
| 73 | change (b ≫ g') y = 0 |
| 74 | rw [← hg] |
| 75 | change c (g y) = 0 |
| 76 | rw [hy, hz] |
| 77 | obtain ⟨x, hx⟩ := hex' (b y) hzero' |
| 78 | obtain ⟨w, hw⟩ := ha x |
| 79 | have hy' : f w = y := by |
| 80 | apply hb |
| 81 | change (f ≫ b) w = b y |
| 82 | rw [hf] |
| 83 | change f' (a w) = b y |
| 84 | rw [hw, hx] |
| 85 | rw [← hy, ← hy'] |
| 86 | exact congrArg (fun k => k w) hfg |
| 87 | |
| 88 | end Poincare.Topology |