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.OrderComplexStars |
| 2 | import Mathlib.Algebra.BigOperators.Field |
| 3 | import Mathlib.Topology.Homotopy.Equiv |
| 4 | |
| 5 | /-! |
| 6 | # Coordinate neighborhoods of induced order subcomplexes |
| 7 | |
| 8 | The open set where a selected group of coordinates has positive total |
| 9 | weight retracts by deleting the other coordinates and renormalizing. |
| 10 | Its straight-line homotopy preserves the original chain support. These |
| 11 | neighborhoods provide the geometric Mayer-Vietoris step for the actual |
| 12 | characteristic-simplex comparison. |
| 13 | Source: Hatcher, Theorem 2.27, printed pp. 128-130. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | open scoped BigOperators unitInterval |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.Proofs.M59 |
| 25 | |
| 26 | open M02.Topology |
| 27 | |
| 28 | variable {J : Type u} [PartialOrder J] [Fintype J] |
| 29 | |
| 30 | /-- The total coordinate weight on the chosen vertices. |
| 31 | Source: the simplicial neighborhood construction in Hatcher, 2.27. -/ |
| 32 | def orderComplexRestrictionWeight (s : Finset J) (z : J → ℝ) : ℝ := |
| 33 | ∑ i ∈ s, z i |
| 34 | |
| 35 | /-- The open coordinate neighborhood of the induced subcomplex. |
| 36 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 37 | def orderComplexNeighborhood (s : Finset J) : Set (finiteOrderComplex J).space := |
| 38 | {z | 0 < orderComplexRestrictionWeight s z.val} |
| 39 | |
| 40 | /-- The coordinate neighborhood is open in the actual realization. |
| 41 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 42 | theorem isOpen_orderComplexNeighborhood (s : Finset J) : |
| 43 | IsOpen (orderComplexNeighborhood s) := by |
| 44 | apply isOpen_lt continuous_const |
| 45 | exact continuous_finsetSum s (fun i _ => |
| 46 | (continuous_apply i).comp continuous_subtype_val) |
| 47 | |
| 48 | open scoped Classical in |
| 49 | /-- Delete the unselected coordinates and normalize the selected ones. |
| 50 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 51 | def orderComplexRestrictionCoord (s : Finset J) (z : J → ℝ) (i : J) : ℝ := |
| 52 | if i ∈ s then z i / orderComplexRestrictionWeight s z else 0 |
| 53 | |
| 54 | omit [PartialOrder J] [Fintype J] in |
| 55 | /-- Normalization makes the total selected weight equal to one. |
| 56 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 57 | theorem orderComplexRestrictionCoord_weight (s : Finset J) (z : J → ℝ) |
| 58 | (hz : orderComplexRestrictionWeight s z ≠ 0) : |
| 59 | orderComplexRestrictionWeight s (orderComplexRestrictionCoord s z) = 1 := by |
| 60 | classical |
| 61 | simp only [orderComplexRestrictionWeight, orderComplexRestrictionCoord, |
| 62 | Finset.sum_ite_mem, Finset.inter_self] |
| 63 | rw [← Finset.sum_div] |
| 64 | exact div_self hz |
| 65 | |
| 66 | /-- Renormalization stays in the geometric order complex because its |
| 67 | support is contained in the original support. Source: Hatcher, 2.27. -/ |
| 68 | theorem orderComplexRestrictionCoord_mem (s : Finset J) |
| 69 | (z : orderComplexNeighborhood s) : |
| 70 | orderComplexRestrictionCoord s z.val.val ∈ (finiteOrderComplex J).space := by |
| 71 | classical |
| 72 | have hz := (finiteOrderComplex_space J z.val.val).mp z.val.property |
| 73 | have hpos : 0 < orderComplexRestrictionWeight s z.val.val := z.property |
| 74 | apply (finiteOrderComplex_space J _).mpr |
| 75 | refine ⟨?_, ?_, ?_⟩ |
| 76 | · intro i |
| 77 | simp only [orderComplexRestrictionCoord] |
| 78 | split_ifs |
| 79 | · exact div_nonneg (hz.1 i) hpos.le |
| 80 | · exact le_rfl |
| 81 | · simp only [orderComplexRestrictionCoord, Finset.sum_ite_mem, Finset.univ_inter] |
| 82 | rw [← Finset.sum_div] |
| 83 | exact div_self (ne_of_gt hpos) |
| 84 | · intro i j hi hj |
| 85 | apply hz.2.2 i j |
| 86 | · intro h |
| 87 | simp only [orderComplexRestrictionCoord, h, zero_div, ite_self] at hi |
| 88 | exact hi rfl |
| 89 | · intro h |
| 90 | simp only [orderComplexRestrictionCoord, h, zero_div, ite_self] at hj |
| 91 | exact hj rfl |
| 92 | |
| 93 | /-- The renormalization is continuous on its positive-weight domain. |
| 94 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 95 | theorem continuous_orderComplexRestrictionCoord (s : Finset J) : |
| 96 | Continuous (fun z : orderComplexNeighborhood s => |
| 97 | orderComplexRestrictionCoord s z.val.val) := by |
| 98 | classical |
| 99 | apply continuous_pi |
| 100 | intro i |
| 101 | dsimp only [orderComplexRestrictionCoord] |
| 102 | split_ifs |
| 103 | · exact ((continuous_apply i).comp |
| 104 | (continuous_subtype_val.comp continuous_subtype_val)).div |
| 105 | (continuous_finsetSum s (fun j _ => (continuous_apply j).comp |
| 106 | (continuous_subtype_val.comp continuous_subtype_val))) |
| 107 | (fun z => ne_of_gt z.property) |
| 108 | · exact continuous_const |
| 109 | |
| 110 | /-- The actual continuous neighborhood retraction, still valued in the |
| 111 | neighborhood. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 112 | def orderComplexRestriction (s : Finset J) : |
| 113 | C(orderComplexNeighborhood s, orderComplexNeighborhood s) := by |
| 114 | classical |
| 115 | refine ⟨fun z => ⟨⟨orderComplexRestrictionCoord s z.val.val, |
| 116 | orderComplexRestrictionCoord_mem s z⟩, ?_⟩, ?_⟩ |
| 117 | · change 0 < orderComplexRestrictionWeight s (orderComplexRestrictionCoord s z.val.val) |
| 118 | rw [orderComplexRestrictionCoord_weight s _ (ne_of_gt z.property)] |
| 119 | exact zero_lt_one |
| 120 | · exact ((continuous_orderComplexRestrictionCoord s).subtype_mk _).subtype_mk _ |
| 121 | |
| 122 | /-- A point already supported on the selected vertices has weight one. |
| 123 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 124 | theorem orderComplexRestrictionWeight_eq_one (s : Finset J) |
| 125 | (z : (finiteOrderComplex J).space) (hz : ∀ i ∉ s, z.val i = 0) : |
| 126 | orderComplexRestrictionWeight s z.val = 1 := by |
| 127 | classical |
| 128 | rw [orderComplexRestrictionWeight, |
| 129 | Finset.sum_subset (Finset.subset_univ s) (fun i _ hi => hz i hi)] |
| 130 | exact ((finiteOrderComplex_space J z.val).mp z.property).2.1 |
| 131 | |
| 132 | /-- Renormalization fixes every point of the induced subcomplex. |
| 133 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 134 | theorem orderComplexRestrictionCoord_eq_self (s : Finset J) |
| 135 | (z : (finiteOrderComplex J).space) (hz : ∀ i ∉ s, z.val i = 0) : |
| 136 | orderComplexRestrictionCoord s z.val = z.val := by |
| 137 | classical |
| 138 | funext i |
| 139 | simp only [orderComplexRestrictionCoord, orderComplexRestrictionWeight_eq_one s z hz, |
| 140 | div_one] |
| 141 | split_ifs with hi |
| 142 | · rfl |
| 143 | · exact (hz i hi).symm |
| 144 | |
| 145 | /-- The segment to the coordinate retraction stays in the open |
| 146 | neighborhood and preserves the original chain support. |
| 147 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 148 | theorem orderComplexRestrictionSegment_mem (s : Finset J) |
| 149 | (z : orderComplexNeighborhood s) (t : I) : |
| 150 | (fun i => (1 - (t : ℝ)) * z.val.val i + |
| 151 | (t : ℝ) * orderComplexRestrictionCoord s z.val.val i) ∈ |
| 152 | (finiteOrderComplex J).space ∧ |
| 153 | 0 < orderComplexRestrictionWeight s (fun i => (1 - (t : ℝ)) * z.val.val i + |
| 154 | (t : ℝ) * orderComplexRestrictionCoord s z.val.val i) := by |
| 155 | classical |
| 156 | let r := orderComplexRestrictionCoord s z.val.val |
| 157 | have hz := (finiteOrderComplex_space J z.val.val).mp z.val.property |
| 158 | have hr := (finiteOrderComplex_space J r).mp (orderComplexRestrictionCoord_mem s z) |
| 159 | have hsupp (i : J) (hi : (1 - (t : ℝ)) * z.val.val i + (t : ℝ) * r i ≠ 0) : |
| 160 | z.val.val i ≠ 0 := by |
| 161 | intro h |
| 162 | have hri : r i = 0 := by |
| 163 | simp only [r, orderComplexRestrictionCoord, h, zero_div, ite_self] |
| 164 | simp only [h, hri, mul_zero, add_zero] at hi |
| 165 | exact hi rfl |
| 166 | constructor |
| 167 | · apply (finiteOrderComplex_space J _).mpr |
| 168 | refine ⟨?_, ?_, ?_⟩ |
| 169 | · intro i |
| 170 | exact add_nonneg (mul_nonneg (sub_nonneg.mpr t.property.2) (hz.1 i)) |
| 171 | (mul_nonneg t.property.1 (hr.1 i)) |
| 172 | · change (∑ i : J, ((1 - (t : ℝ)) * z.val.val i + (t : ℝ) * r i)) = 1 |
| 173 | rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, |
| 174 | hz.2.1, hr.2.1] |
| 175 | ring |
| 176 | · intro i j hi hj |
| 177 | exact hz.2.2 i j (hsupp i hi) (hsupp j hj) |
| 178 | · change 0 < ∑ i ∈ s, ((1 - (t : ℝ)) * z.val.val i + (t : ℝ) * r i) |
| 179 | rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, |
| 180 | show (∑ i ∈ s, r i) = 1 from |
| 181 | orderComplexRestrictionCoord_weight s _ (ne_of_gt z.property), mul_one] |
| 182 | rcases lt_or_eq_of_le t.property.2 with ht | ht |
| 183 | · exact add_pos_of_pos_of_nonneg (mul_pos (sub_pos.mpr ht) z.property) t.property.1 |
| 184 | · rw [ht] |
| 185 | norm_num |
| 186 | |
| 187 | /-- The explicit deformation from the identity to coordinate |
| 188 | renormalization. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 189 | def orderComplexRestrictionHomotopy (s : Finset J) : |
| 190 | (ContinuousMap.id (orderComplexNeighborhood s)).Homotopy (orderComplexRestriction s) where |
| 191 | toFun q := ⟨⟨fun i => (1 - (q.1 : ℝ)) * q.2.val.val i + |
| 192 | (q.1 : ℝ) * orderComplexRestrictionCoord s q.2.val.val i, |
| 193 | (orderComplexRestrictionSegment_mem s q.2 q.1).1⟩, |
| 194 | (orderComplexRestrictionSegment_mem s q.2 q.1).2⟩ |
| 195 | continuous_toFun := by |
| 196 | apply Continuous.subtype_mk |
| 197 | apply Continuous.subtype_mk |
| 198 | apply continuous_pi |
| 199 | intro i |
| 200 | exact ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul |
| 201 | ((continuous_apply i).comp |
| 202 | (continuous_subtype_val.comp (continuous_subtype_val.comp continuous_snd)))).add |
| 203 | ((continuous_subtype_val.comp continuous_fst).mul ((continuous_apply i).comp |
| 204 | ((continuous_orderComplexRestrictionCoord s).comp continuous_snd))) |
| 205 | map_zero_left z := by |
| 206 | apply Subtype.ext |
| 207 | apply Subtype.ext |
| 208 | funext i |
| 209 | change (1 - (0 : ℝ)) * z.val.val i + |
| 210 | 0 * orderComplexRestrictionCoord s z.val.val i = z.val.val i |
| 211 | ring |
| 212 | map_one_left z := by |
| 213 | apply Subtype.ext |
| 214 | apply Subtype.ext |
| 215 | funext i |
| 216 | change (1 - (1 : ℝ)) * z.val.val i + |
| 217 | 1 * orderComplexRestrictionCoord s z.val.val i = |
| 218 | orderComplexRestrictionCoord s z.val.val i |
| 219 | ring |
| 220 | |
| 221 | /-- The deformation fixes the induced subcomplex pointwise, which is |
| 222 | the condition needed when lifting it through a covering. |
| 223 | Source: Hatcher, Proposition 1.30 and Theorem 2.27. -/ |
| 224 | theorem orderComplexRestrictionHomotopy_fixed (s : Finset J) |
| 225 | (z : orderComplexNeighborhood s) (hz : ∀ i ∉ s, z.val.val i = 0) (t : I) : |
| 226 | orderComplexRestrictionHomotopy s (t, z) = z := by |
| 227 | apply Subtype.ext |
| 228 | apply Subtype.ext |
| 229 | change (fun i => (1 - (t : ℝ)) * z.val.val i + |
| 230 | (t : ℝ) * orderComplexRestrictionCoord s z.val.val i) = z.val.val |
| 231 | rw [orderComplexRestrictionCoord_eq_self s z.val hz] |
| 232 | funext i |
| 233 | ring |
| 234 | |
| 235 | end PoincareMT.Proofs.M59 |