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.Lefschetz.OrderComplexNeighborhoods |
| 2 | |
| 3 | /-! |
| 4 | # Contraction of an upper-cone coordinate neighborhood |
| 5 | |
| 6 | First renormalize onto the selected vertices, then join that point to the |
| 7 | selected least vertex. The resulting contraction fixes its endpoint vertex |
| 8 | and is defined on the actual open coordinate neighborhood. |
| 9 | Source: Hatcher, Theorem 2.27, printed pp. 128-130. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | open scoped BigOperators unitInterval |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.Proofs.M59 |
| 21 | |
| 22 | open M02.Topology |
| 23 | |
| 24 | variable {J : Type u} [PartialOrder J] [Fintype J] |
| 25 | |
| 26 | open scoped Classical in |
| 27 | /-- The actual coordinate vertex of the geometric order complex. |
| 28 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 29 | def orderComplexVertex (v : J) : (finiteOrderComplex J).space := by |
| 30 | refine ⟨fun i => if i = v then 1 else 0, ?_⟩ |
| 31 | have h := (orderComplexStar_barycenter_mem ({v} : Finset J) |
| 32 | (Finset.singleton_nonempty v) (by simp)).1 |
| 33 | simpa only [Finset.card_singleton, Nat.cast_one, inv_one, Finset.mem_singleton] using h |
| 34 | |
| 35 | /-- A selected coordinate vertex belongs to its selected neighborhood. |
| 36 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 37 | def orderComplexConePoint (s : Finset J) (v : J) (hv : v ∈ s) : |
| 38 | orderComplexNeighborhood s := by |
| 39 | classical |
| 40 | refine ⟨orderComplexVertex v, ?_⟩ |
| 41 | apply (mem_orderComplexNeighborhood_iff s _).mpr |
| 42 | exact ⟨v, hv, by simp [orderComplexVertex]⟩ |
| 43 | |
| 44 | variable (s : Finset J) (v : J) (hv : v ∈ s) (hmin : ∀ j ∈ s, v ≤ j) |
| 45 | |
| 46 | include hv hmin |
| 47 | |
| 48 | open scoped Classical in |
| 49 | /-- After coordinate restriction, joining to the least selected vertex |
| 50 | stays in the order complex and has selected weight one. |
| 51 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 52 | theorem orderComplexConeSegment_mem (z : orderComplexNeighborhood s) (t : I) : |
| 53 | let w := fun i => (1 - (t : ℝ)) * orderComplexRestrictionCoord s z.val.val i + |
| 54 | (t : ℝ) * (orderComplexVertex v).val i |
| 55 | w ∈ (finiteOrderComplex J).space ∧ orderComplexRestrictionWeight s w = 1 := by |
| 56 | classical |
| 57 | let r := orderComplexRestrictionCoord s z.val.val |
| 58 | let w := fun i => (1 - (t : ℝ)) * r i + (t : ℝ) * (orderComplexVertex v).val i |
| 59 | have hr := (finiteOrderComplex_space J r).mp (orderComplexRestrictionCoord_mem s z) |
| 60 | have hvertex := (finiteOrderComplex_space J _).mp (orderComplexVertex v).property |
| 61 | have hsupp (i : J) (hi : i ∉ s) : w i = 0 := by |
| 62 | have hiv : i ≠ v := fun h => hi (h ▸ hv) |
| 63 | simp only [w, r, orderComplexRestrictionCoord, if_neg hi, orderComplexVertex, |
| 64 | if_neg hiv, mul_zero, add_zero] |
| 65 | have hri (i : J) (hi : w i ≠ 0) (hiv : i ≠ v) : r i ≠ 0 := by |
| 66 | intro h |
| 67 | simp only [w, h, orderComplexVertex, if_neg hiv, mul_zero, add_zero] at hi |
| 68 | exact hi rfl |
| 69 | have hmem : w ∈ (finiteOrderComplex J).space := by |
| 70 | apply (finiteOrderComplex_space J _).mpr |
| 71 | refine ⟨?_, ?_, ?_⟩ |
| 72 | · intro i |
| 73 | exact add_nonneg (mul_nonneg (sub_nonneg.mpr t.property.2) (hr.1 i)) |
| 74 | (mul_nonneg t.property.1 (hvertex.1 i)) |
| 75 | · change (∑ i : J, ((1 - (t : ℝ)) * r i + (t : ℝ) * (orderComplexVertex v).val i)) = 1 |
| 76 | rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, |
| 77 | hr.2.1, hvertex.2.1] |
| 78 | ring |
| 79 | · intro i j hi hj |
| 80 | by_cases hiv : i = v |
| 81 | · subst i |
| 82 | exact Or.inl (hmin j (by by_contra h; exact hj (hsupp j h))) |
| 83 | by_cases hjv : j = v |
| 84 | · subst j |
| 85 | exact Or.inr (hmin i (by by_contra h; exact hi (hsupp i h))) |
| 86 | · exact hr.2.2 i j (hri i hi hiv) (hri j hj hjv) |
| 87 | exact ⟨hmem, orderComplexRestrictionWeight_eq_one s ⟨w, hmem⟩ hsupp⟩ |
| 88 | |
| 89 | /-- The second half of the cone contraction joins the restricted point |
| 90 | to the least vertex. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 91 | def orderComplexConeSecondHomotopy : (orderComplexRestriction s).Homotopy |
| 92 | (ContinuousMap.const _ (orderComplexConePoint s v hv)) := by |
| 93 | classical |
| 94 | refine { |
| 95 | toFun := fun q => ⟨⟨fun i => (1 - (q.1 : ℝ)) * |
| 96 | orderComplexRestrictionCoord s q.2.val.val i + (q.1 : ℝ) * (orderComplexVertex v).val i, |
| 97 | (orderComplexConeSegment_mem s v hv hmin q.2 q.1).1⟩, ?_⟩ |
| 98 | continuous_toFun := ?_ |
| 99 | map_zero_left := ?_ |
| 100 | map_one_left := ?_ } |
| 101 | · change 0 < orderComplexRestrictionWeight s _ |
| 102 | rw [(orderComplexConeSegment_mem s v hv hmin q.2 q.1).2] |
| 103 | exact zero_lt_one |
| 104 | · apply Continuous.subtype_mk |
| 105 | apply Continuous.subtype_mk |
| 106 | apply continuous_pi |
| 107 | intro i |
| 108 | exact ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul |
| 109 | ((continuous_apply i).comp |
| 110 | ((continuous_orderComplexRestrictionCoord s).comp continuous_snd))).add |
| 111 | ((continuous_subtype_val.comp continuous_fst).mul continuous_const) |
| 112 | · intro z |
| 113 | apply Subtype.ext |
| 114 | apply Subtype.ext |
| 115 | funext i |
| 116 | change (1 - (0 : ℝ)) * orderComplexRestrictionCoord s z.val.val i + |
| 117 | 0 * (orderComplexVertex v).val i = orderComplexRestrictionCoord s z.val.val i |
| 118 | ring |
| 119 | · intro z |
| 120 | apply Subtype.ext |
| 121 | apply Subtype.ext |
| 122 | funext i |
| 123 | change (1 - (1 : ℝ)) * orderComplexRestrictionCoord s z.val.val i + |
| 124 | 1 * (orderComplexVertex v).val i = (orderComplexVertex v).val i |
| 125 | ring |
| 126 | |
| 127 | /-- The actual open neighborhood contracts to its least selected vertex. |
| 128 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 129 | def orderComplexConeHomotopy : |
| 130 | (ContinuousMap.id (orderComplexNeighborhood s)).Homotopy |
| 131 | (ContinuousMap.const _ (orderComplexConePoint s v hv)) := |
| 132 | (orderComplexRestrictionHomotopy s).trans (orderComplexConeSecondHomotopy s v hv hmin) |
| 133 | |
| 134 | /-- The cone contraction leaves its endpoint vertex fixed throughout. |
| 135 | Source: Hatcher, Proposition 1.30 and Theorem 2.27. -/ |
| 136 | theorem orderComplexConeHomotopy_fixed (t : I) : |
| 137 | orderComplexConeHomotopy s v hv hmin (t, orderComplexConePoint s v hv) = |
| 138 | orderComplexConePoint s v hv := by |
| 139 | classical |
| 140 | have hsupp : ∀ i ∉ s, (orderComplexConePoint s v hv).val.val i = 0 := by |
| 141 | intro i hi |
| 142 | change (if i = v then (1 : ℝ) else 0) = 0 |
| 143 | exact if_neg (fun h : i = v => hi (h.symm ▸ hv)) |
| 144 | change ((orderComplexRestrictionHomotopy s).trans |
| 145 | (orderComplexConeSecondHomotopy s v hv hmin)) (t, _) = _ |
| 146 | rw [ContinuousMap.Homotopy.trans_apply] |
| 147 | split_ifs |
| 148 | · exact orderComplexRestrictionHomotopy_fixed s _ hsupp _ |
| 149 | · apply Subtype.ext |
| 150 | apply Subtype.ext |
| 151 | change (fun i => (1 - _) * orderComplexRestrictionCoord s |
| 152 | (orderComplexConePoint s v hv).val.val i + _ * (orderComplexVertex v).val i) = _ |
| 153 | rw [orderComplexRestrictionCoord_eq_self s _ hsupp] |
| 154 | funext i |
| 155 | change (1 - _) * (orderComplexVertex v).val i + _ * (orderComplexVertex v).val i = |
| 156 | (orderComplexVertex v).val i |
| 157 | ring |
| 158 | |
| 159 | end PoincareMT.Proofs.M59 |