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.CubeTransport |
| 2 | |
| 3 | /-! |
| 4 | # Multiplication and cubical basepoint transport |
| 5 | |
| 6 | Spatial concatenation of two homotopies with the same boundary path preserves |
| 7 | that path. This proves Hatcher's basepoint-change homomorphism law, Section 4.1, |
| 8 | p. 341, for Mathlib's actual `GenLoop.transAt` operation. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped Topology unitInterval |
| 14 | |
| 15 | noncomputable section |
| 16 | |
| 17 | namespace GenLoop |
| 18 | |
| 19 | variable {N X : Type*} [Finite N] [DecidableEq N] [TopologicalSpace X] |
| 20 | {x y : X} {p : Path x y} |
| 21 | {a c : GenLoop N X x} {b d : GenLoop N X y} |
| 22 | |
| 23 | namespace HomotopyAlong |
| 24 | |
| 25 | /-- A time slice is a genuine cube based at the current point of the path. |
| 26 | Source: Hatcher, Section 4.1, p. 341. -/ |
| 27 | def slice (H : HomotopyAlong p a b) (t : I) : GenLoop N X (p t) := |
| 28 | ⟨⟨fun v => H.toHomotopy (t, v), |
| 29 | H.toHomotopy.continuous.comp (continuous_const.prodMk continuous_id)⟩, |
| 30 | fun v hv => H.boundary_path t ⟨v, hv⟩⟩ |
| 31 | |
| 32 | /-- Concatenate moving cubes along one spatial coordinate. |
| 33 | Source: Hatcher, Section 4.1, property (1), p. 341. -/ |
| 34 | def transAt (i : N) (H : HomotopyAlong p a b) (G : HomotopyAlong p c d) : |
| 35 | HomotopyAlong p (GenLoop.transAt i a c) (GenLoop.transAt i b d) where |
| 36 | toFun v := GenLoop.transAt i (H.slice v.1) (G.slice v.1) v.2 |
| 37 | continuous_toFun := by |
| 38 | change Continuous (fun v : I × (N → I) => |
| 39 | if (v.2 i : ℝ) ≤ 1 / 2 then |
| 40 | H.toHomotopy (v.1, Function.update v.2 i (Set.projIcc 0 1 zero_le_one (2 * v.2 i))) |
| 41 | else |
| 42 | G.toHomotopy (v.1, |
| 43 | Function.update v.2 i (Set.projIcc 0 1 zero_le_one (2 * v.2 i - 1)))) |
| 44 | refine Continuous.if_le ?_ ?_ (by fun_prop) continuous_const ?_ |
| 45 | · exact H.toHomotopy.continuous.comp (continuous_fst.prodMk (by fun_prop)) |
| 46 | · exact G.toHomotopy.continuous.comp (continuous_fst.prodMk (by fun_prop)) |
| 47 | · intro v hv |
| 48 | have hleft : Function.update v.2 i (Set.projIcc 0 1 zero_le_one (2 * v.2 i)) ∈ |
| 49 | Cube.boundary N := by |
| 50 | refine ⟨i, Or.inr ?_⟩ |
| 51 | norm_num [hv] |
| 52 | have hright : Function.update v.2 i (Set.projIcc 0 1 zero_le_one (2 * v.2 i - 1)) ∈ |
| 53 | Cube.boundary N := by |
| 54 | refine ⟨i, Or.inl ?_⟩ |
| 55 | norm_num [hv] |
| 56 | exact (H.boundary_path v.1 ⟨_, hleft⟩).trans (G.boundary_path v.1 ⟨_, hright⟩).symm |
| 57 | map_zero_left v := by |
| 58 | change GenLoop.transAt i (H.slice 0) (G.slice 0) v = GenLoop.transAt i a c v |
| 59 | simp only [GenLoop.transAt, GenLoop.coe_copy] |
| 60 | split_ifs |
| 61 | · exact H.toHomotopy.apply_zero _ |
| 62 | · exact G.toHomotopy.apply_zero _ |
| 63 | map_one_left v := by |
| 64 | change GenLoop.transAt i (H.slice 1) (G.slice 1) v = GenLoop.transAt i b d v |
| 65 | simp only [GenLoop.transAt, GenLoop.coe_copy] |
| 66 | split_ifs |
| 67 | · exact H.toHomotopy.apply_one _ |
| 68 | · exact G.toHomotopy.apply_one _ |
| 69 | boundary_path t v := |
| 70 | GenLoop.boundary (GenLoop.transAt i (H.slice t) (G.slice t)) v v.property |
| 71 | |
| 72 | end HomotopyAlong |
| 73 | |
| 74 | /-- Basepoint transport respects spatial concatenation on homotopy classes. |
| 75 | Source: Hatcher, Section 4.1, property (1), p. 341. -/ |
| 76 | theorem boundaryTransport_transAt (i : N) (p : Path x y) (a b : GenLoop N X x) : |
| 77 | Homotopic (boundaryTransport p (GenLoop.transAt i a b)) |
| 78 | (GenLoop.transAt i (boundaryTransport p a) (boundaryTransport p b)) := |
| 79 | boundaryTransport_homotopic_of_homotopyAlong |
| 80 | ((boundaryTransportHomotopy p a).transAt i (boundaryTransportHomotopy p b)) |
| 81 | |
| 82 | end GenLoop |