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.LoopComparison |
| 2 | import PoincareLib.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.PathSpaceHomotopy |
| 3 | import PoincareLib.AlgebraicTopology.HomotopyGroup.LoopSpace.Basepoint.GenLoopWhisker |
| 4 | |
| 5 | /-! |
| 6 | # Continuous-loop comparison and moving basepoints |
| 7 | |
| 8 | Adjoint a homotopy of loop families to a cube of loops in the path space. |
| 9 | Naturality of the comparison at endpoint evaluations, and the evaluation |
| 10 | homotopy itself, identify constant-loop transport with transport in the |
| 11 | target. No manifold hypothesis is used. |
| 12 | Source: Hatcher, Section 4.1, printed pp. 341-342; MT Claim 18.16, p. 430. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Topology unitInterval |
| 18 | |
| 19 | noncomputable section |
| 20 | |
| 21 | namespace PoincareMT.Proofs.M59 |
| 22 | |
| 23 | open PoincareMT.Proofs.M02 |
| 24 | |
| 25 | variable {S X : Type*} [TopologicalSpace S] [TopologicalSpace X] |
| 26 | |
| 27 | /-- A path in the target, regarded as a path of constant maps. |
| 28 | Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 29 | def constantMapPath {x y : X} (r : Path x y) : |
| 30 | Path (ContinuousMap.const S x) (ContinuousMap.const S y) := |
| 31 | r.map ContinuousMap.continuous_const' |
| 32 | |
| 33 | /-- A loop-family homotopy with constant-loop boundary trace is a based |
| 34 | cube of circle maps into the path space. |
| 35 | Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 36 | def loopHomotopyPathCube [LocallyCompactSpace S] |
| 37 | {N : Type*} [Finite N] {x y : X} {r : Path x y} |
| 38 | {a : GenLoop N C(S, X) (ContinuousMap.const S x)} |
| 39 | {b : GenLoop N C(S, X) (ContinuousMap.const S y)} |
| 40 | (H : GenLoop.HomotopyAlong (constantMapPath r) a b) : |
| 41 | GenLoop N C(S, C(I, X)) (ContinuousMap.const S r.toContinuousMap) := |
| 42 | ⟨⟨fun v => ⟨fun z => ⟨fun t => H.toHomotopy (t, v) z, |
| 43 | (H.toHomotopy.continuous.comp (continuous_id.prodMk continuous_const)).eval |
| 44 | continuous_const⟩, by |
| 45 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 46 | change Continuous (fun w : S × I => H.toHomotopy (w.2, v) w.1) |
| 47 | exact (H.toHomotopy.continuous.comp (continuous_snd.prodMk continuous_const)).eval |
| 48 | continuous_fst⟩, by |
| 49 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 50 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 51 | change Continuous (fun w : ((I^N) × S) × I => H.toHomotopy (w.2, w.1.1) w.1.2) |
| 52 | exact (H.toHomotopy.continuous.comp |
| 53 | (continuous_snd.prodMk (continuous_fst.comp continuous_fst))).eval |
| 54 | (continuous_snd.comp continuous_fst)⟩, by |
| 55 | intro v hv |
| 56 | ext z t |
| 57 | exact congrArg (fun f : C(S, X) => f z) (H.boundary_path t ⟨v, hv⟩)⟩ |
| 58 | |
| 59 | /-- Evaluation at the initial endpoint recovers the initial family literally. |
| 60 | Source: Hatcher, Section 4.1, printed p. 342. -/ |
| 61 | theorem loopHomotopyPathCube_zero [LocallyCompactSpace S] |
| 62 | {N : Type*} [Finite N] {x y : X} {r : Path x y} |
| 63 | {a : GenLoop N C(S, X) (ContinuousMap.const S x)} |
| 64 | {b : GenLoop N C(S, X) (ContinuousMap.const S y)} |
| 65 | (H : GenLoop.HomotopyAlong (constantMapPath r) a b) : |
| 66 | mapGenLoop (postcomposeMap S (pathEvaluation 0)) |
| 67 | (postcomposeMap_const S (pathEvaluation 0) r.source) (loopHomotopyPathCube H) = a := by |
| 68 | ext v z |
| 69 | exact congrArg (fun f : C(S, X) => f z) (H.toHomotopy.apply_zero v) |
| 70 | |
| 71 | /-- Evaluation at the terminal endpoint recovers the terminal family literally. |
| 72 | Source: Hatcher, Section 4.1, printed p. 342. -/ |
| 73 | theorem loopHomotopyPathCube_one [LocallyCompactSpace S] |
| 74 | {N : Type*} [Finite N] {x y : X} {r : Path x y} |
| 75 | {a : GenLoop N C(S, X) (ContinuousMap.const S x)} |
| 76 | {b : GenLoop N C(S, X) (ContinuousMap.const S y)} |
| 77 | (H : GenLoop.HomotopyAlong (constantMapPath r) a b) : |
| 78 | mapGenLoop (postcomposeMap S (pathEvaluation 1)) |
| 79 | (postcomposeMap_const S (pathEvaluation 1) r.target) (loopHomotopyPathCube H) = b := by |
| 80 | ext v z |
| 81 | exact congrArg (fun f : C(S, X) => f z) (H.toHomotopy.apply_one v) |
| 82 | |
| 83 | /-- Evaluation of a path-valued cube gives the moving-boundary homotopy |
| 84 | between its endpoint evaluations. Source: Hatcher 4.1, pp. 341-342. -/ |
| 85 | def pathCubeEvaluationHomotopy |
| 86 | {N : Type*} [Finite N] {x y : X} (r : Path x y) |
| 87 | (a : GenLoop N C(I, X) r.toContinuousMap) : |
| 88 | GenLoop.HomotopyAlong r |
| 89 | (mapGenLoop (pathEvaluation 0) r.source a) |
| 90 | (mapGenLoop (pathEvaluation 1) r.target a) where |
| 91 | toFun v := a v.2 v.1 |
| 92 | continuous_toFun := (a.val.continuous.comp continuous_snd).eval continuous_fst |
| 93 | map_zero_left _ := rfl |
| 94 | map_one_left _ := rfl |
| 95 | boundary_path t v := congrArg (fun f : C(I, X) => f t) (GenLoop.boundary a v v.2) |
| 96 | |
| 97 | /-- The two endpoint evaluations on homotopy groups differ exactly by |
| 98 | basepoint transport along the base path. Source: Hatcher 4.1, pp. 341-342. -/ |
| 99 | theorem pathEvaluation_transport (n : Nat) {x y : X} (r : Path x y) |
| 100 | (a : HomotopyGroup.Pi n C(I, X) r.toContinuousMap) : |
| 101 | (m59HigherBasepointTransport X n).map r |
| 102 | (homotopyGroupMap (Fin n) (pathEvaluation 0) r.source a) = |
| 103 | homotopyGroupMap (Fin n) (pathEvaluation 1) r.target a := by |
| 104 | refine Quotient.inductionOn a fun a => ?_ |
| 105 | exact Quotient.sound (GenLoop.boundaryTransport_homotopic_of_homotopyAlong |
| 106 | (pathCubeEvaluationHomotopy r a)) |
| 107 | |
| 108 | namespace CubeBoundaryQuotient |
| 109 | |
| 110 | /-- Continuous-loop comparison carries a homotopy with constant-loop side |
| 111 | trace to basepoint transport of the corresponding higher class. |
| 112 | Source: Hatcher, Section 4.1, p. 342; MT Claim 18.16, p. 430. -/ |
| 113 | theorem loopHomotopyEquiv_homotopyAlong |
| 114 | [T2Space S] [LocallyCompactSpace S] |
| 115 | (q : CubeBoundaryQuotient (Fin 1) S) (n : Nat) [Nonempty (Fin n)] |
| 116 | {x y : X} (hpiX : Subsingleton (HomotopyGroup.Pi n X x)) |
| 117 | (hpiY : Subsingleton (HomotopyGroup.Pi n X y)) (r : Path x y) |
| 118 | {a : GenLoop (Fin n) C(S, X) (ContinuousMap.const S x)} |
| 119 | {b : GenLoop (Fin n) C(S, X) (ContinuousMap.const S y)} |
| 120 | (H : GenLoop.HomotopyAlong (constantMapPath r) a b) : |
| 121 | (m59HigherBasepointTransport X (n + 1)).map r (q.loopHomotopyEquiv n x hpiX ⟦a⟧) = |
| 122 | q.loopHomotopyEquiv n y hpiY ⟦b⟧ := by |
| 123 | have hp : Subsingleton (HomotopyGroup.Pi n X (r 0)) := by |
| 124 | simpa only [r.source] using hpiX |
| 125 | let hpPath := pathSpace_homotopyGroup_subsingleton r.toContinuousMap hp |
| 126 | let A := loopHomotopyPathCube H |
| 127 | have h0 := q.loopHomotopyEquiv_naturality n hpPath hpiX |
| 128 | (pathEvaluation 0) r.source (⟦A⟧ : HomotopyGroup.Pi n C(S, C(I, X)) _) |
| 129 | have h1 := q.loopHomotopyEquiv_naturality n hpPath hpiY |
| 130 | (pathEvaluation 1) r.target (⟦A⟧ : HomotopyGroup.Pi n C(S, C(I, X)) _) |
| 131 | have hA0 : homotopyGroupMap (Fin n) (postcomposeMap S (pathEvaluation 0)) |
| 132 | (postcomposeMap_const S (pathEvaluation 0) r.source) ⟦A⟧ = ⟦a⟧ := |
| 133 | congrArg Quotient.mk'' (loopHomotopyPathCube_zero H) |
| 134 | have hA1 : homotopyGroupMap (Fin n) (postcomposeMap S (pathEvaluation 1)) |
| 135 | (postcomposeMap_const S (pathEvaluation 1) r.target) ⟦A⟧ = ⟦b⟧ := |
| 136 | congrArg Quotient.mk'' (loopHomotopyPathCube_one H) |
| 137 | rw [hA0] at h0 |
| 138 | rw [hA1] at h1 |
| 139 | rw [h0, h1] |
| 140 | exact pathEvaluation_transport (n + 1) r _ |
| 141 | |
| 142 | end CubeBoundaryQuotient |
| 143 | |
| 144 | end PoincareMT.Proofs.M59 |