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.GenLoopTopology |
| 2 | |
| 3 | /-! |
| 4 | # Transposing sphere and cube parameters |
| 5 | |
| 6 | A based cube of maps from S is the same data as a map from S to the based |
| 7 | cube space. Homotopies transpose as well. Source: Hatcher, Section 4.1, |
| 8 | pp. 340-342; MT Claim 18.16, p. 430. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped Topology unitInterval |
| 14 | |
| 15 | namespace GenLoop |
| 16 | |
| 17 | variable {N P S X : Type*} [TopologicalSpace S] [LocallyCompactSpace S] |
| 18 | [TopologicalSpace X] {x : X} |
| 19 | |
| 20 | /-- Transpose a based cube of maps to a map into the based cube space. |
| 21 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 22 | def transpose (F : GenLoop N C(S, X) (ContinuousMap.const S x)) : C(S, GenLoop N X x) where |
| 23 | toFun z := ⟨⟨fun v => F v z, (continuous_eval_const z).comp F.val.continuous⟩, |
| 24 | fun v hv => congrArg (fun f : C(S, X) => f z) (GenLoop.boundary F v hv)⟩ |
| 25 | continuous_toFun := (ContinuousMap.continuous_of_continuous_uncurry _ (by |
| 26 | change Continuous (fun v : S × (N → I) => F v.2 v.1) |
| 27 | fun_prop)).subtype_mk _ |
| 28 | |
| 29 | /-- Transpose a map into the based cube space back to a based cube of maps. |
| 30 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 31 | def untranspose (F : C(S, GenLoop N X x)) : GenLoop N C(S, X) (ContinuousMap.const S x) := |
| 32 | ⟨⟨fun v => ⟨fun z => F z v, by fun_prop⟩, |
| 33 | ContinuousMap.continuous_of_continuous_uncurry _ (by |
| 34 | change Continuous (fun v : (N → I) × S => F v.2 v.1) |
| 35 | fun_prop)⟩, |
| 36 | fun v hv => by ext z; exact GenLoop.boundary (F z) v hv⟩ |
| 37 | |
| 38 | /-- The two transpositions undo each other on every cube value. |
| 39 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 40 | theorem untranspose_transpose (F : GenLoop N C(S, X) (ContinuousMap.const S x)) : |
| 41 | untranspose (transpose F) = F := by ext v z; rfl |
| 42 | |
| 43 | /-- The two transpositions undo each other on every parameter value. |
| 44 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 45 | theorem transpose_untranspose (F : C(S, GenLoop N X x)) : |
| 46 | transpose (untranspose F) = F := by ext z v; rfl |
| 47 | |
| 48 | /-- Relative cubical homotopies transpose to free homotopies into cube space. |
| 49 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 50 | theorem transpose_homotopic |
| 51 | {F G : GenLoop N C(S, X) (ContinuousMap.const S x)} (h : Homotopic F G) : |
| 52 | (transpose F).Homotopic (transpose G) := by |
| 53 | obtain ⟨H⟩ := h |
| 54 | exact ⟨{ |
| 55 | toFun := fun q => ⟨⟨fun v => H (q.1, v) q.2, by fun_prop⟩, |
| 56 | fun v hv => (congrArg (fun f : C(S, X) => f q.2) (H.eq_fst q.1 hv)).trans |
| 57 | (congrArg (fun f : C(S, X) => f q.2) (GenLoop.boundary F v hv))⟩ |
| 58 | continuous_toFun := |
| 59 | (ContinuousMap.continuous_of_continuous_uncurry _ (by |
| 60 | change Continuous (fun v : (I × S) × (N → I) => H (v.1.1, v.2) v.1.2) |
| 61 | fun_prop)).subtype_mk _ |
| 62 | map_zero_left := by intro z; ext v; exact congrArg (fun f : C(S, X) => f z) (H.apply_zero v) |
| 63 | map_one_left := by intro z; ext v; exact congrArg (fun f : C(S, X) => f z) (H.apply_one v) }⟩ |
| 64 | |
| 65 | omit [LocallyCompactSpace S] in |
| 66 | /-- Free homotopies into cube space transpose to relative cubical homotopies. |
| 67 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 68 | theorem untranspose_homotopic {F G : C(S, GenLoop N X x)} (h : F.Homotopic G) : |
| 69 | Homotopic (untranspose F) (untranspose G) := by |
| 70 | obtain ⟨H⟩ := h |
| 71 | exact ⟨{ |
| 72 | toFun := fun q => ⟨fun z => H (q.1, z) q.2, by fun_prop⟩ |
| 73 | continuous_toFun := ContinuousMap.continuous_of_continuous_uncurry _ (by |
| 74 | change Continuous (fun v : (I × (N → I)) × S => H (v.1.1, v.2) v.1.2) |
| 75 | fun_prop) |
| 76 | map_zero_left := by |
| 77 | intro v; ext z |
| 78 | exact congrArg (fun g : GenLoop N X x => g v) (H.apply_zero z) |
| 79 | map_one_left := by |
| 80 | intro v; ext z |
| 81 | exact congrArg (fun g : GenLoop N X x => g v) (H.apply_one z) |
| 82 | prop' := by |
| 83 | intro t v hv |
| 84 | ext z |
| 85 | exact (GenLoop.boundary (H (t, z)) v hv).trans (GenLoop.boundary (F z) v hv).symm }⟩ |
| 86 | |
| 87 | /-- Cubical classes of maps from S are free classes of maps into the cube |
| 88 | space. Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 89 | theorem homotopic_iff_transpose_homotopic |
| 90 | {F G : GenLoop N C(S, X) (ContinuousMap.const S x)} : |
| 91 | Homotopic F G ↔ (transpose F).Homotopic (transpose G) := by |
| 92 | refine ⟨transpose_homotopic, fun h => ?_⟩ |
| 93 | simpa only [untranspose_transpose] using untranspose_homotopic h |
| 94 | |
| 95 | /-- Interchange two sets of based cube coordinates. |
| 96 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 97 | def swapNested (F : GenLoop N (GenLoop P X x) const) : GenLoop P (GenLoop N X x) const := |
| 98 | (genLoopGenLoopEquiv x).symm (congr x (Equiv.sumComm N P) (genLoopGenLoopEquiv x F)) |
| 99 | |
| 100 | /-- Interchanging the cube coordinates interchanges pointwise evaluation. |
| 101 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 102 | theorem swapNested_apply (F : GenLoop N (GenLoop P X x) const) (v : P → I) (w : N → I) : |
| 103 | swapNested F v w = F w v := rfl |
| 104 | |
| 105 | /-- Interchanging the same two coordinate sets twice is the identity. |
| 106 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 107 | theorem swapNested_swapNested (F : GenLoop N (GenLoop P X x) const) : |
| 108 | swapNested (swapNested F) = F := by ext v w; rfl |
| 109 | |
| 110 | /-- The interchange is continuous on spaces of based cubes. |
| 111 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 112 | theorem continuous_swapNested : Continuous (swapNested (N := N) (P := P) (x := x)) := |
| 113 | (genLoopGenLoopEquiv x).symm.continuous.comp |
| 114 | ((congr x (Equiv.sumComm N P)).continuous.comp (genLoopGenLoopEquiv x).continuous) |
| 115 | |
| 116 | /-- Interchange preserves based homotopy classes. |
| 117 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 118 | theorem swapNested_homotopic {F G : GenLoop N (GenLoop P X x) const} (h : Homotopic F G) : |
| 119 | Homotopic (swapNested F) (swapNested G) := by |
| 120 | obtain ⟨p⟩ := homotopic_iff_nonempty_path.mp h |
| 121 | exact homotopic_iff_nonempty_path.mpr ⟨p.map continuous_swapNested⟩ |
| 122 | |
| 123 | end GenLoop |