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.CubeSphereHomotopy |
| 2 | import Mathlib.Topology.Maps.Proper.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Exact cube-boundary quotients |
| 6 | |
| 7 | The quotient of a finite cube by its boundary parametrizes based sphere |
| 8 | maps and their free homotopies. Source: Hatcher, Section 4.1, pp. 340-342. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Topology |
| 14 | open scoped Topology unitInterval |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | namespace PoincareMT.Proofs.M59 |
| 19 | |
| 20 | /-- A parameter collapsing precisely the boundary of a cube. |
| 21 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 22 | structure CubeBoundaryQuotient (N S : Type*) [TopologicalSpace S] where |
| 23 | map : C((N → I), S) |
| 24 | pole : S |
| 25 | surjective : Function.Surjective map |
| 26 | boundary_collapsed : ∀ v ∈ Cube.boundary N, map v = pole |
| 27 | exact_fibers : ∀ v w, map v = map w ↔ |
| 28 | v = w ∨ (v ∈ Cube.boundary N ∧ w ∈ Cube.boundary N) |
| 29 | |
| 30 | namespace CubeBoundaryQuotient |
| 31 | |
| 32 | variable {N S X : Type*} [Finite N] [Nonempty N] |
| 33 | [TopologicalSpace S] [T2Space S] [TopologicalSpace X] |
| 34 | (q : CubeBoundaryQuotient N S) {x : X} |
| 35 | |
| 36 | omit [Finite N] [Nonempty N] in |
| 37 | /-- Compactness makes an exact sphere parameter a quotient map. |
| 38 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 39 | theorem isQuotientMap : IsQuotientMap q.map := |
| 40 | IsQuotientMap.of_surjective_continuous q.surjective q.map.continuous |
| 41 | |
| 42 | omit [Finite N] [Nonempty N] [T2Space S] in |
| 43 | /-- A based cube is constant on each fiber of the boundary quotient. |
| 44 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 45 | theorem factorsThrough (g : GenLoop N X x) : Function.FactorsThrough g.val q.map := by |
| 46 | intro v w h |
| 47 | rcases (q.exact_fibers v w).mp h with rfl | ⟨hv, hw⟩ |
| 48 | · rfl |
| 49 | · exact (GenLoop.boundary g v hv).trans (GenLoop.boundary g w hw).symm |
| 50 | |
| 51 | /-- The sphere map descended from a based cube. |
| 52 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 53 | def descend (g : GenLoop N X x) : C(S, X) := |
| 54 | q.isQuotientMap.lift g.val (q.factorsThrough g) |
| 55 | |
| 56 | omit [Finite N] [Nonempty N] in |
| 57 | /-- Descent agrees with the original cube at every parameter. |
| 58 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 59 | theorem descend_map (g : GenLoop N X x) (v : N → I) : |
| 60 | q.descend g (q.map v) = g v := |
| 61 | ContinuousMap.congr_fun (q.isQuotientMap.lift_comp g.val (q.factorsThrough g)) v |
| 62 | |
| 63 | omit [Finite N] in |
| 64 | /-- The collapsed boundary has the specified based value. |
| 65 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 66 | theorem descend_pole (g : GenLoop N X x) : q.descend g q.pole = x := by |
| 67 | let i : N := Classical.choice inferInstance |
| 68 | have hz : (fun _ : N => (0 : I)) ∈ Cube.boundary N := ⟨i, Or.inl rfl⟩ |
| 69 | exact (congrArg (q.descend g) (q.boundary_collapsed _ hz).symm).trans |
| 70 | ((q.descend_map g _).trans (GenLoop.boundary g _ hz)) |
| 71 | |
| 72 | /-- Pull back a sphere map to a cube based at its pole value. |
| 73 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 74 | def pullback (f : C(S, X)) : GenLoop N X (f q.pole) := |
| 75 | ⟨f.comp q.map, fun v hv => congrArg f (q.boundary_collapsed v hv)⟩ |
| 76 | |
| 77 | omit [Nonempty N] in |
| 78 | /-- A path from the pole value to x makes a sphere map freely homotopic to |
| 79 | the descent of a cube based at x. Source: Hatcher, Section 4.1, pp. 341-342. -/ |
| 80 | theorem exists_based_descend (f : C(S, X)) (p : Path (f q.pole) x) : |
| 81 | ∃ g : GenLoop N X x, f.Homotopic (q.descend g) := by |
| 82 | let g := GenLoop.boundaryTransport p (q.pullback f) |
| 83 | refine ⟨g, (GenLoop.boundaryTransportHomotopy p (q.pullback f)).descend_sphere |
| 84 | q.map q.surjective q.exact_fibers f (q.descend g) (fun _ => rfl) ?_⟩ |
| 85 | intro v |
| 86 | exact (q.descend_map g v).symm |
| 87 | |
| 88 | omit [Nonempty N] in |
| 89 | /-- Relative cube homotopies descend to free sphere homotopies. |
| 90 | Source: Hatcher, Section 4.1, pp. 340-342. -/ |
| 91 | theorem descend_homotopic {f g : GenLoop N X x} (h : GenLoop.Homotopic f g) : |
| 92 | (q.descend f).Homotopic (q.descend g) := by |
| 93 | obtain ⟨H⟩ := h |
| 94 | exact (GenLoop.HomotopyAlong.ofRel H).descend_sphere |
| 95 | q.map q.surjective q.exact_fibers _ _ |
| 96 | (fun v => (q.descend_map f v).symm) (fun v => (q.descend_map g v).symm) |
| 97 | |
| 98 | omit [Finite N] [Nonempty N] in |
| 99 | /-- Descent varies continuously with the based cube in compact-open |
| 100 | topologies. Source: Hatcher, Section 4.1, p. 340, exponential adjunction. -/ |
| 101 | theorem continuous_descend : Continuous (q.descend : GenLoop N X x → C(S, X)) := by |
| 102 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 103 | let Q := Prod.map (id : GenLoop N X x → GenLoop N X x) q.map |
| 104 | have hproper : IsProperMap Q := isProperMap_id.prodMap q.map.continuous.isProperMap |
| 105 | have hQ : IsQuotientMap Q := hproper.isClosedMap.isQuotientMap hproper.continuous |
| 106 | (Function.Surjective.prodMap Function.surjective_id q.surjective) |
| 107 | apply hQ.continuous_iff.mpr |
| 108 | have heq : (fun v : GenLoop N X x × (N → I) => |
| 109 | q.descend v.1 (q.map v.2)) = fun v => v.1 v.2 := by |
| 110 | funext v |
| 111 | exact q.descend_map v.1 v.2 |
| 112 | change Continuous (fun v : GenLoop N X x × (N → I) => q.descend v.1 (q.map v.2)) |
| 113 | rw [heq] |
| 114 | exact continuous_eval |
| 115 | |
| 116 | /-- Descent as an actual continuous map of based loop spaces. |
| 117 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 118 | def descendMap : C(GenLoop N X x, C(S, X)) := ⟨q.descend, q.continuous_descend⟩ |
| 119 | |
| 120 | omit [Finite N] [Nonempty N] in |
| 121 | /-- Descending the constant cube gives the constant sphere map. |
| 122 | Source: Hatcher, Section 4.1, p. 340. -/ |
| 123 | theorem descend_const : q.descend (GenLoop.const : GenLoop N X x) = |
| 124 | ContinuousMap.const S x := by |
| 125 | ext z |
| 126 | obtain ⟨v, rfl⟩ := q.surjective z |
| 127 | exact q.descend_map GenLoop.const v |
| 128 | |
| 129 | end CubeBoundaryQuotient |
| 130 | |
| 131 | end PoincareMT.Proofs.M59 |