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 | import Mathlib.Topology.Homotopy.HomotopyGroup |
| 3 | |
| 4 | /-! |
| 5 | # Homotopy groups and evaluation on the path space |
| 6 | |
| 7 | A homotopy of target maps gives moving-basepoint homotopies on cubical |
| 8 | representatives. A homotopy left inverse therefore makes actual |
| 9 | postcomposition injective, even if that inverse homotopy moves the |
| 10 | basepoint. Applied to contraction of the interval, this makes evaluation |
| 11 | at zero injective on the homotopy groups of `C(I,X)`. |
| 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 | universe u v w |
| 20 | |
| 21 | namespace GenLoop.HomotopyAlong |
| 22 | |
| 23 | open PoincareMT.Proofs.M02 |
| 24 | |
| 25 | variable {N : Type w} [Finite N] {X : Type u} {Y : Type v} |
| 26 | [TopologicalSpace X] [TopologicalSpace Y] |
| 27 | |
| 28 | /-- A homotopy of target maps carries a cube along its basepoint trace. |
| 29 | Source: Hatcher, Section 4.1, printed p. 342. -/ |
| 30 | def ofMapHomotopy {f g : C(X, Y)} (H : f.Homotopy g) {x : X} (a : GenLoop N X x) : |
| 31 | HomotopyAlong (H.evalAt x) (mapGenLoop f rfl a) (mapGenLoop g rfl a) where |
| 32 | toHomotopy := H.comp (ContinuousMap.Homotopy.refl a.val) |
| 33 | boundary_path t z := congrArg (fun x => H (t, x)) (GenLoop.boundary a z z.2) |
| 34 | |
| 35 | /-- Equal initial classes and one common boundary trace give equal terminal |
| 36 | classes. Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 37 | theorem endpoint_homotopic_of_initial {x y : X} {p : Path x y} |
| 38 | {a c : GenLoop N X x} {b d : GenLoop N X y} |
| 39 | (H : HomotopyAlong p a b) (G : HomotopyAlong p c d) (h : GenLoop.Homotopic a c) : |
| 40 | GenLoop.Homotopic b d := by |
| 41 | obtain ⟨K⟩ := h |
| 42 | obtain ⟨L⟩ := ((ofRel K).trans G).change_path (Path.Homotopic.refl_trans p) |
| 43 | exact H.endpoint_homotopic L |
| 44 | |
| 45 | end GenLoop.HomotopyAlong |
| 46 | |
| 47 | namespace PoincareMT.Proofs.M59 |
| 48 | |
| 49 | open PoincareMT.Proofs.M02 |
| 50 | |
| 51 | /-- A homotopy left inverse gives injectivity of actual postcomposition on |
| 52 | all finite cubical homotopy groups. Source: Hatcher 4.1, pp. 341-342. -/ |
| 53 | theorem homotopyGroupMap_injective_of_leftHomotopyInverse |
| 54 | {N : Type w} [Finite N] {X : Type u} {Y : Type v} |
| 55 | [TopologicalSpace X] [TopologicalSpace Y] (f : C(X, Y)) (g : C(Y, X)) |
| 56 | (H : (g.comp f).Homotopy (ContinuousMap.id X)) (x : X) : |
| 57 | Function.Injective (homotopyGroupMap N f (rfl : f x = f x)) := by |
| 58 | intro a b |
| 59 | refine Quotient.inductionOn₂ a b ?_ |
| 60 | intro a b h |
| 61 | apply Quotient.sound |
| 62 | exact (GenLoop.HomotopyAlong.ofMapHomotopy H a).endpoint_homotopic_of_initial |
| 63 | (GenLoop.HomotopyAlong.ofMapHomotopy H b) |
| 64 | (mapGenLoop_homotopic g rfl (Quotient.exact h)) |
| 65 | |
| 66 | /-- Evaluation at a chosen interval parameter, as a continuous map. |
| 67 | Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 68 | def pathEvaluation {X : Type u} [TopologicalSpace X] (t : I) : C(C(I, X), X) := |
| 69 | ⟨fun f => f t, by fun_prop⟩ |
| 70 | |
| 71 | /-- The constant-map section of path evaluation. |
| 72 | Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 73 | def pathConstant {X : Type u} [TopologicalSpace X] : C(X, C(I, X)) := |
| 74 | ⟨ContinuousMap.const I, ContinuousMap.continuous_const'⟩ |
| 75 | |
| 76 | private def shrinkTime : C(I × I, I) := |
| 77 | ⟨fun v => unitInterval.symm v.1 * v.2, by |
| 78 | apply Continuous.subtype_mk |
| 79 | change Continuous (fun v : I × I => (1 - (v.1 : ℝ)) * (v.2 : ℝ)) |
| 80 | fun_prop⟩ |
| 81 | |
| 82 | /-- Shrinking the interval contracts the identity of the path space to |
| 83 | constant paths at their initial values. Source: Hatcher 4.1, pp. 341-342. -/ |
| 84 | def pathSpaceShrink {X : Type u} [TopologicalSpace X] : |
| 85 | (ContinuousMap.id C(I, X)).Homotopy |
| 86 | (pathConstant.comp (pathEvaluation 0)) where |
| 87 | toFun v := ⟨fun s => v.2 (shrinkTime (v.1, s)), |
| 88 | v.2.continuous.comp (shrinkTime.continuous.comp (continuous_const.prodMk continuous_id))⟩ |
| 89 | continuous_toFun := by |
| 90 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 91 | change Continuous (fun v : (I × C(I, X)) × I => v.1.2 (shrinkTime (v.1.1, v.2))) |
| 92 | exact (continuous_snd.comp continuous_fst).eval |
| 93 | (shrinkTime.continuous.comp ((continuous_fst.comp continuous_fst).prodMk continuous_snd)) |
| 94 | map_zero_left f := by ext s; simp [shrinkTime] |
| 95 | map_one_left f := by ext s; simp [shrinkTime, pathConstant, pathEvaluation] |
| 96 | |
| 97 | /-- Evaluation at zero is injective on actual finite cubical homotopy groups |
| 98 | of the path space, at every path basepoint. Source: Hatcher 4.1, pp. 341-342. -/ |
| 99 | theorem homotopyGroupMap_pathEvaluation_injective |
| 100 | {N : Type w} [Finite N] {X : Type u} [TopologicalSpace X] (r : C(I, X)) : |
| 101 | Function.Injective (homotopyGroupMap N (pathEvaluation 0) (rfl : r 0 = r 0)) := |
| 102 | homotopyGroupMap_injective_of_leftHomotopyInverse |
| 103 | (pathEvaluation 0) pathConstant pathSpaceShrink.symm r |
| 104 | |
| 105 | /-- Trivial homotopy at the initial value gives trivial homotopy at the |
| 106 | path itself. Source: Hatcher, Section 4.1, printed pp. 341-342. -/ |
| 107 | theorem pathSpace_homotopyGroup_subsingleton |
| 108 | {N : Type w} [Finite N] {X : Type u} [TopologicalSpace X] (r : C(I, X)) |
| 109 | (h : Subsingleton (HomotopyGroup N X (r 0))) : |
| 110 | Subsingleton (HomotopyGroup N C(I, X) r) := |
| 111 | ⟨fun _a _b => homotopyGroupMap_pathEvaluation_injective r (h.elim _ _)⟩ |
| 112 | |
| 113 | end PoincareMT.Proofs.M59 |