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.CubicalAdjunction |
| 2 | import Mathlib.AlgebraicTopology.FundamentalGroupoid.InducedMaps |
| 3 | |
| 4 | /-! |
| 5 | # Free loops when the fundamental group is abelian |
| 6 | |
| 7 | The boundary of a free homotopy conjugates the two based loop classes. |
| 8 | Commutativity cancels that conjugation. Source: Hatcher, Proposition 4A.2, |
| 9 | printed p. 422; Morgan--Tian Claim 18.16, p. 430. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Topology unitInterval |
| 15 | |
| 16 | namespace Path |
| 17 | |
| 18 | variable {X : Type*} [TopologicalSpace X] {x : X} |
| 19 | |
| 20 | /-- The two edge paths of a free loop homotopy differ by its common endpoint |
| 21 | trace. Source: Hatcher, Proposition 4A.2, p. 422. -/ |
| 22 | theorem homotopic_trans_trace (p q : Path x x) |
| 23 | (H : p.toContinuousMap.Homotopy q.toContinuousMap) |
| 24 | (htrace : ∀ t, H (t, 0) = H (t, 1)) : |
| 25 | ∃ r : Path x x, (p.trans r).Homotopic (r.trans q) := by |
| 26 | let r : Path x x := (H.evalAt 0).cast p.source.symm q.source.symm |
| 27 | obtain ⟨K⟩ := Path.Homotopic.map_trans_evalAt H Path.id |
| 28 | refine ⟨r, ⟨(K.pathCast p.source.symm q.target.symm).cast ?_ ?_⟩⟩ |
| 29 | · ext t |
| 30 | simp only [Path.cast_coe, Path.trans_apply] |
| 31 | split_ifs |
| 32 | · rfl |
| 33 | · exact (htrace _).symm |
| 34 | · ext t |
| 35 | simp only [Path.cast_coe, Path.trans_apply] |
| 36 | split_ifs <;> rfl |
| 37 | |
| 38 | /-- A free homotopy of based loops is based when their fundamental group |
| 39 | is abelian. Source: Hatcher, Proposition 4A.2, p. 422. -/ |
| 40 | theorem homotopic_of_free_homotopy |
| 41 | (hcomm : ∀ a b : FundamentalGroup X x, a * b = b * a) |
| 42 | (p q : Path x x) (H : p.toContinuousMap.Homotopy q.toContinuousMap) |
| 43 | (htrace : ∀ t, H (t, 0) = H (t, 1)) : p.Homotopic q := by |
| 44 | obtain ⟨r, h⟩ := homotopic_trans_trace p q H htrace |
| 45 | let P : FundamentalGroup X x := Homotopic.Quotient.mk p |
| 46 | let Q : FundamentalGroup X x := Homotopic.Quotient.mk q |
| 47 | let R : FundamentalGroup X x := Homotopic.Quotient.mk r |
| 48 | have he : R * P = Q * R := by |
| 49 | change Homotopic.Quotient.mk (p.trans r) = Homotopic.Quotient.mk (r.trans q) |
| 50 | exact Quotient.sound h |
| 51 | rw [hcomm Q R] at he |
| 52 | have hPQ : P = Q := mul_left_cancel he |
| 53 | exact Quotient.exact hPQ |
| 54 | |
| 55 | end Path |