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.Topology.Homotopy.HomotopyGroup |
| 2 | import Mathlib.AlgebraicTopology.FundamentalGroupoid.SimplyConnected |
| 3 | import Mathlib.Analysis.Convex.Contractible |
| 4 | |
| 5 | /-! |
| 6 | # Connected cube boundaries and contractible cubes |
| 7 | |
| 8 | Cubes contract by coordinate multiplication. In at least two dimensions, |
| 9 | each boundary point can be joined to the zero vertex in two faces: first |
| 10 | hold one boundary coordinate fixed, then hold another zero coordinate fixed. |
| 11 | These facts make higher cubical loops lift through covering maps. |
| 12 | Source: Hatcher, Proposition 4.1, printed p. 342; MT Claim 18.16, p. 430. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped unitInterval Topology |
| 19 | |
| 20 | namespace Cube |
| 21 | |
| 22 | variable {N : Type*} |
| 23 | |
| 24 | private instance : ContractibleSpace I := |
| 25 | (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, le_rfl, zero_le_one⟩ |
| 26 | |
| 27 | /-- Coordinate multiplication contracts every cube to its zero vertex. |
| 28 | Source: Hatcher, Section 4.1, printed pp. 340-341. -/ |
| 29 | theorem contractibleSpace (N : Type*) : ContractibleSpace (I^N) := by |
| 30 | apply (contractible_iff_id_nullhomotopic _).mpr |
| 31 | refine ⟨fun _ => 0, ⟨{ |
| 32 | toFun := fun v i => unitInterval.symm v.1 * v.2 i |
| 33 | continuous_toFun := by |
| 34 | apply continuous_pi |
| 35 | intro i |
| 36 | apply Continuous.subtype_mk |
| 37 | change Continuous (fun v : I × (I^N) => (1 - (v.1 : ℝ)) * (v.2 i : ℝ)) |
| 38 | fun_prop |
| 39 | map_zero_left := by intro v; ext i; simp |
| 40 | map_one_left := by intro v; ext i; simp }⟩⟩ |
| 41 | |
| 42 | /-- A coordinate face of a cube is path connected, including an infinite cube. |
| 43 | Source: Hatcher, Section 4.1, printed pp. 340-341. -/ |
| 44 | theorem isPathConnected_face (i : N) (c : I) : |
| 45 | IsPathConnected {v : I^N | v i = c} := by |
| 46 | classical |
| 47 | have h (j : N) : IsPathConnected (if j = i then ({c} : Set I) else univ) := by |
| 48 | split_ifs |
| 49 | · exact isPathConnected_singleton c |
| 50 | · exact isPathConnected_univ |
| 51 | convert IsPathConnected.pi h using 1 |
| 52 | ext v |
| 53 | simp only [mem_ofPred_eq, mem_univ_pi] |
| 54 | constructor |
| 55 | · intro hv j |
| 56 | by_cases hj : j = i |
| 57 | · simpa [hj] using hv |
| 58 | · simp [hj] |
| 59 | · intro hv |
| 60 | simpa using hv i |
| 61 | |
| 62 | /-- The boundary of a cube with at least two coordinates is path connected. |
| 63 | Source: Hatcher, Proposition 4.1, printed p. 342. -/ |
| 64 | theorem isPathConnected_boundary [Nontrivial N] : IsPathConnected (boundary N) := by |
| 65 | classical |
| 66 | let z : I^N := fun _ => 0 |
| 67 | have hz : z ∈ boundary N := ⟨Classical.choice (inferInstance : Nonempty N), Or.inl rfl⟩ |
| 68 | refine ⟨z, hz, ?_⟩ |
| 69 | intro v hv |
| 70 | obtain ⟨i, hi⟩ := hv |
| 71 | obtain ⟨j, hji⟩ := exists_ne i |
| 72 | let w : I^N := Function.update z i (v i) |
| 73 | have hwi : w i = v i := by simp [w] |
| 74 | have hwj : w j = 0 := by simp [w, z, hji] |
| 75 | have hfirst : JoinedIn (boundary N) v w := |
| 76 | ((isPathConnected_face i (v i)).joinedIn v rfl w hwi).mono |
| 77 | (fun u hu => ⟨i, hu ▸ hi⟩) |
| 78 | have hsecond : JoinedIn (boundary N) w z := |
| 79 | ((isPathConnected_face j 0).joinedIn w hwj z rfl).mono |
| 80 | (fun u hu => ⟨j, Or.inl hu⟩) |
| 81 | exact (hfirst.trans hsecond).symm |
| 82 | |
| 83 | end Cube |