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.AlgebraicTopology.SimplicialSet.Homology.Basic |
| 2 | import Mathlib.AlgebraicTopology.SimplicialSet.SubcomplexColimits |
| 3 | import Mathlib.Algebra.Homology.HomologicalComplexLimits |
| 4 | import Mathlib.Algebra.Homology.HomologicalComplexAbelian |
| 5 | import Mathlib.CategoryTheory.Abelian.CommSq |
| 6 | import Mathlib.CategoryTheory.Limits.Preserves.SigmaConst |
| 7 | |
| 8 | /-! |
| 9 | # The exact chain sequence of a simplicial subcomplex union |
| 10 | |
| 11 | Unnormalized chains preserve pushouts of simplicial sets, degree by degree. |
| 12 | Inclusions of subcomplexes induce monomorphisms on chains by the literal |
| 13 | projection retaining only generators in the smaller subcomplex. Thus a |
| 14 | subcomplex union gives the signed-intersection/sum short exact sequence. |
| 15 | Source: Hatcher, Theorem 2.27, printed pp. 128-130. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | noncomputable section |
| 21 | |
| 22 | open CategoryTheory Limits HomologicalComplex |
| 23 | open scoped Simplicial |
| 24 | |
| 25 | universe u v w |
| 26 | |
| 27 | namespace SSet |
| 28 | |
| 29 | variable {C : Type v} [Category.{w} C] [Abelian C] [HasCoproducts.{u} C] |
| 30 | (R : C) |
| 31 | |
| 32 | /-- Simplicial chains preserve pushouts because each degree is a free |
| 33 | coproduct on simplices. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 34 | theorem chainComplexFunctor_preservesPushouts : |
| 35 | PreservesColimitsOfShape WalkingSpan ((chainComplexFunctor C).obj R : |
| 36 | SSet.{u} ⥤ ChainComplex C ℕ) := by |
| 37 | apply HomologicalComplex.preservesColimitsOfShape_of_eval |
| 38 | intro n |
| 39 | change PreservesColimitsOfShape WalkingSpan |
| 40 | ((evaluation _ (Type u)).obj (Opposite.op ⦋n⦌) ⋙ sigmaConst.obj R) |
| 41 | infer_instance |
| 42 | |
| 43 | variable {X : SSet.{u}} {A B : X.Subcomplex} (h : A ≤ B) |
| 44 | |
| 45 | set_option backward.isDefEq.respectTransparency false in |
| 46 | /-- A chain inclusion is a monomorphism in each degree: project onto |
| 47 | the literal generators of the smaller subcomplex. |
| 48 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 49 | theorem chainComplexMap_subcomplex_mono_f (n : ℕ) : |
| 50 | Mono ((chainComplexMap (Subcomplex.homOfLE h) R).f n) := by |
| 51 | classical |
| 52 | let c : Cofan (fun _ : B.obj (Opposite.op ⦋n⦌) => R) := |
| 53 | Cofan.mk ((A.toSSet.chainComplex R).X n) |
| 54 | (fun b => if hb : b.val ∈ A.obj _ then A.toSSet.ιChainComplex ⟨b.val, hb⟩ else 0) |
| 55 | let r := (B.toSSet.isColimitChainComplexXCofan R n).desc c |
| 56 | have hr : (chainComplexMap (Subcomplex.homOfLE h) R).f n ≫ r = 𝟙 _ := by |
| 57 | apply SSet.chainComplex_hom_ext |
| 58 | intro a |
| 59 | rw [← Category.assoc, SSet.ι_chainComplexMap_f] |
| 60 | have hf := (B.toSSet.isColimitChainComplexXCofan R n).fac c |
| 61 | (Discrete.mk ((Subcomplex.homOfLE h).app _ a)) |
| 62 | change B.toSSet.ιChainComplex ((Subcomplex.homOfLE h).app _ a) ≫ r = _ at hf |
| 63 | simp only [c, Cofan.mk_ι_app, Subcomplex.homOfLE_app_val, |
| 64 | dif_pos a.property] at hf |
| 65 | rw [Category.comp_id] |
| 66 | refine hf.trans ?_ |
| 67 | apply congrArg (fun b : A.toSSet _⦋n⦌ => A.toSSet.ιChainComplex (R := R) b) |
| 68 | exact Subtype.ext rfl |
| 69 | exact mono_of_mono_fac hr |
| 70 | |
| 71 | /-- Literal subcomplex inclusions induce monomorphisms of chain |
| 72 | complexes. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 73 | theorem chainComplexMap_subcomplex_mono : |
| 74 | Mono (chainComplexMap (Subcomplex.homOfLE h) R) := by |
| 75 | apply HomologicalComplex.mono_of_mono_f |
| 76 | intro n |
| 77 | exact chainComplexMap_subcomplex_mono_f R h n |
| 78 | |
| 79 | variable {A₁ A₂ A₃ A₄ : X.Subcomplex} |
| 80 | |
| 81 | /-- The actual chain square associated with a subcomplex union is a |
| 82 | pushout. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 83 | theorem chainComplex_subcomplex_isPushout |
| 84 | (sq : Subcomplex.BicartSq A₁ A₂ A₃ A₄) : |
| 85 | IsPushout (chainComplexMap (Subcomplex.homOfLE sq.le₁₂) R) |
| 86 | (chainComplexMap (Subcomplex.homOfLE sq.le₁₃) R) |
| 87 | (chainComplexMap (Subcomplex.homOfLE sq.le₂₄) R) |
| 88 | (chainComplexMap (Subcomplex.homOfLE sq.le₃₄) R) := by |
| 89 | let := chainComplexFunctor_preservesPushouts R |
| 90 | exact sq.isPushout.map ((chainComplexFunctor C).obj R) |
| 91 | |
| 92 | /-- The signed-intersection/sum sequence for a literal subcomplex |
| 93 | union is short exact. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 94 | theorem chainComplex_subcomplex_shortExact |
| 95 | (sq : Subcomplex.BicartSq A₁ A₂ A₃ A₄) : |
| 96 | (chainComplex_subcomplex_isPushout R sq).shortComplex.ShortExact := by |
| 97 | let hp := chainComplex_subcomplex_isPushout R sq |
| 98 | let := chainComplexMap_subcomplex_mono R sq.le₁₂ |
| 99 | exact { exact := hp.exact_shortComplex, mono_f := by |
| 100 | dsimp only [CommSq.shortComplex] |
| 101 | infer_instance |
| 102 | epi_g := hp.epi_shortComplex_g } |
| 103 | |
| 104 | end SSet |