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.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.GenLoopTopology |
| 2 | |
| 3 | /-! |
| 4 | # Cubical adjunction on homotopy groups |
| 5 | |
| 6 | Uncurrying based cubes and reindexing their coordinates preserve cubical |
| 7 | concatenation. Their topological equivalences therefore give group |
| 8 | equivalences on actual homotopy classes. Source: Hatcher, Section 4.1, |
| 9 | pp. 340-342; Morgan--Tian Claim 18.16, p. 430. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Topology unitInterval |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | namespace GenLoop |
| 19 | |
| 20 | variable {N P X : Type*} [TopologicalSpace X] (x : X) |
| 21 | [DecidableEq N] [DecidableEq P] |
| 22 | |
| 23 | /-- Uncurrying preserves concatenation in each outer cube coordinate. |
| 24 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 25 | theorem genLoopGenLoopEquiv_transAt (i : N) |
| 26 | (f g : GenLoop N (GenLoop P X x) const) : |
| 27 | genLoopGenLoopEquiv x (transAt i f g) = |
| 28 | transAt (Sum.inl i) (genLoopGenLoopEquiv x f) (genLoopGenLoopEquiv x g) := by |
| 29 | ext y |
| 30 | have hl (s : I) : Function.update y (Sum.inl i) s ∘ Sum.inl = |
| 31 | Function.update (y ∘ Sum.inl) i s := by |
| 32 | funext j |
| 33 | by_cases h : j = i <;> simp [h] |
| 34 | have hr (s : I) : Function.update y (Sum.inl i) s ∘ Sum.inr = y ∘ Sum.inr := by |
| 35 | funext j |
| 36 | simp |
| 37 | change (transAt i f g) (y ∘ Sum.inl) (y ∘ Sum.inr) = _ |
| 38 | simp only [transAt, coe_copy, Function.comp_apply] |
| 39 | split_ifs |
| 40 | · exact congrArg₂ (fun a b => f a b) (hl _).symm |
| 41 | (hr (Set.projIcc 0 1 zero_le_one (2 * y (Sum.inl i)))).symm |
| 42 | · exact congrArg₂ (fun a b => g a b) (hl _).symm |
| 43 | (hr (Set.projIcc 0 1 zero_le_one (2 * y (Sum.inl i) - 1))).symm |
| 44 | |
| 45 | /-- Reindexing cube coordinates preserves concatenation in the corresponding |
| 46 | coordinate. Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 47 | theorem congr_transAt (e : N ≃ P) (i : N) (f g : GenLoop N X x) : |
| 48 | congr x e (transAt i f g) = transAt (e i) (congr x e f) (congr x e g) := by |
| 49 | ext y |
| 50 | have hu (s : I) : Function.update y (e i) s ∘ e = |
| 51 | Function.update (y ∘ e) i s := by |
| 52 | funext j |
| 53 | simp [Function.update_apply, e.injective.eq_iff] |
| 54 | change (transAt i f g) (y ∘ e) = |
| 55 | (transAt (e i) (congr x e f) (congr x e g)) y |
| 56 | simp only [transAt, coe_copy, Function.comp_apply] |
| 57 | split_ifs |
| 58 | · change f _ = f _ |
| 59 | exact congrArg f (hu _).symm |
| 60 | · change g _ = g _ |
| 61 | exact congrArg g (hu _).symm |
| 62 | |
| 63 | end GenLoop |
| 64 | |
| 65 | namespace HomotopyGroup |
| 66 | |
| 67 | variable {N P X : Type*} [TopologicalSpace X] (x : X) |
| 68 | [DecidableEq N] [DecidableEq P] [Nonempty N] |
| 69 | |
| 70 | /-- The loop-space adjunction as a group equivalence on cubical classes. |
| 71 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 72 | def cubicalAdjunction : |
| 73 | HomotopyGroup N (GenLoop P X x) GenLoop.const ≃* |
| 74 | HomotopyGroup (N ⊕ P) X x where |
| 75 | toEquiv := equivOfGenLoopHomeomorph (GenLoop.genLoopGenLoopEquiv x) |
| 76 | map_mul' a b := Quotient.inductionOn₂ a b fun f g => by |
| 77 | let i : N := Classical.choice inferInstance |
| 78 | exact (congrArg (equivOfGenLoopHomeomorph (GenLoop.genLoopGenLoopEquiv x)) |
| 79 | (HomotopyGroup.mul_spec (i := i) (p := f) (q := g))).trans |
| 80 | ((congrArg (fun z => (⟦z⟧ : HomotopyGroup (N ⊕ P) X x)) |
| 81 | (GenLoop.genLoopGenLoopEquiv_transAt x i g f)).trans |
| 82 | (HomotopyGroup.mul_spec (i := Sum.inl i)).symm) |
| 83 | |
| 84 | /-- Coordinate reindexing as a group equivalence on cubical classes. |
| 85 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 86 | def reindex [Nonempty P] (e : N ≃ P) : |
| 87 | HomotopyGroup N X x ≃* HomotopyGroup P X x where |
| 88 | toEquiv := equivOfGenLoopHomeomorph (GenLoop.congr x e) |
| 89 | map_mul' a b := Quotient.inductionOn₂ a b fun f g => by |
| 90 | let i : N := Classical.choice inferInstance |
| 91 | exact (congrArg (equivOfGenLoopHomeomorph (GenLoop.congr x e)) |
| 92 | (HomotopyGroup.mul_spec (i := i) (p := f) (q := g))).trans |
| 93 | ((congrArg (fun z => (⟦z⟧ : HomotopyGroup P X x)) |
| 94 | (GenLoop.congr_transAt x e i g f)).trans |
| 95 | (HomotopyGroup.mul_spec (i := e i)).symm) |
| 96 | |
| 97 | omit [DecidableEq N] in |
| 98 | /-- The fundamental group of a nonzero iterated loop space is abelian. |
| 99 | Source: Hatcher, Section 4.1, pp. 340-342, and the Eckmann-Hilton argument. -/ |
| 100 | theorem fundamentalGroup_genLoop_mul_comm |
| 101 | (a b : FundamentalGroup (GenLoop N X x) GenLoop.const) : a * b = b * a := by |
| 102 | classical |
| 103 | let : Nontrivial (Fin 1 ⊕ N) := |
| 104 | ⟨⟨Sum.inl 0, Sum.inr (Classical.choice inferInstance), Sum.inl_ne_inr⟩⟩ |
| 105 | let e := (pi1MulEquivFundamentalGroup |
| 106 | (X := GenLoop N X x) (x := GenLoop.const)).symm.trans |
| 107 | (cubicalAdjunction (N := Fin 1) (P := N) x) |
| 108 | apply e.injective |
| 109 | simpa only [map_mul] using mul_comm (e a) (e b) |
| 110 | |
| 111 | /-- The fundamental group of based squares is the third homotopy group, |
| 112 | with the circle coordinate first. Source: MT Claim 18.16, p. 430. -/ |
| 113 | def squareFundamentalGroupEquivPiThree {X : Type*} [TopologicalSpace X] (x : X) : |
| 114 | FundamentalGroup (GenLoop (Fin 2) X x) GenLoop.const ≃* HomotopyGroup.Pi 3 X x := |
| 115 | ((pi1MulEquivFundamentalGroup (X := GenLoop (Fin 2) X x) |
| 116 | (x := GenLoop.const)).symm.trans (cubicalAdjunction x)).trans |
| 117 | (reindex x (finSumFinEquiv : Fin 1 ⊕ Fin 2 ≃ Fin 3)) |
| 118 | |
| 119 | end HomotopyGroup |