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.Topology.Surface.Combinatorial.Incidence |
| 2 | import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected |
| 3 | |
| 4 | /-! |
| 5 | # Binary incidence cycles after deleting one edge |
| 6 | |
| 7 | This file records the finite graph step used in the disk Euler argument. If |
| 8 | an edge vector over `ZMod 2` has even incidence at every vertex, then the two |
| 9 | distinct endpoints of any selected edge remain connected by selected edges |
| 10 | after that edge is deleted. |
| 11 | |
| 12 | The proof sums the vertex equations over the component of the first endpoint. |
| 13 | It is independent of the planar realization; Jordan separation enters only in |
| 14 | the later step that fills the resulting cycle by region faces. |
| 15 | |
| 16 | Context: Morgan--Tian Lemma 19.45, printed p. 474, in Proposition 19.35; |
| 17 | the actual regional construction is recorded in the following derivation. |
| 18 | Source/construction: |
| 19 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. |
| 20 | -/ |
| 21 | |
| 22 | set_option autoImplicit false |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | open Matrix |
| 27 | open PoincareMT.Surface.Combinatorial.Incidence |
| 28 | |
| 29 | /-- The binary coordinate vector supported at one index. Keeping the classical equality |
| 30 | decision inside the definition avoids adding `DecidableEq` parameters to the graph-algebra |
| 31 | interfaces. Source/construction: |
| 32 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 33 | noncomputable def m64BinarySingle {I : Type*} (i : I) : I → ZMod 2 := by |
| 34 | classical |
| 35 | exact fun j => if j = i then 1 else 0 |
| 36 | |
| 37 | /-- The binary coordinate vector takes value one at its chosen index. Source/construction: |
| 38 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 39 | @[simp] |
| 40 | theorem m64BinarySingle_apply_self {I : Type*} (i : I) : |
| 41 | m64BinarySingle i i = 1 := by |
| 42 | simp [m64BinarySingle] |
| 43 | |
| 44 | /-- The binary coordinate vector vanishes away from its chosen index. Source/construction: |
| 45 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 46 | @[simp] |
| 47 | theorem m64BinarySingle_apply_of_ne {I : Type*} {i j : I} (h : j ≠ i) : |
| 48 | m64BinarySingle i j = 0 := by |
| 49 | simp [m64BinarySingle, h] |
| 50 | |
| 51 | /-- The simple graph of nonzero edges after deleting one distinguished edge. Parallel edges |
| 52 | are harmless because adjacency only records their endpoints. Loops are omitted, as required |
| 53 | by `SimpleGraph`; over `ZMod 2` they already contribute zero to the endpoint incidence |
| 54 | matrix. Source/construction: |
| 55 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 56 | def m64SelectedEdgeDeletionGraph {V E : Type*} |
| 57 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) : SimpleGraph V where |
| 58 | Adj a b := a ≠ b ∧ ∃ e, e ≠ e0 ∧ x e ≠ 0 ∧ |
| 59 | (((ends e).1 = a ∧ (ends e).2 = b) ∨ |
| 60 | ((ends e).1 = b ∧ (ends e).2 = a)) |
| 61 | symm := ⟨by |
| 62 | rintro a b ⟨hab, e, he0, hxe, hends⟩ |
| 63 | exact ⟨hab.symm, e, he0, hxe, hends.elim Or.inr Or.inl⟩⟩ |
| 64 | loopless := ⟨by |
| 65 | intro a |
| 66 | rintro ⟨haa, -⟩ |
| 67 | exact haa rfl⟩ |
| 68 | |
| 69 | /-- A nonloop edge in a binary incidence cycle is not a bridge of the cycle's support: after |
| 70 | deleting it, its endpoints are still reachable through other nonzero edges. |
| 71 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 72 | theorem m64Intrinsic_selected_edge_endpoints_reachable_without |
| 73 | {V E : Type*} [Finite V] [Fintype E] |
| 74 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 75 | (hcycle : (incidenceMatrix ends).transpose.mulVecLin x = 0) |
| 76 | (hx0 : x e0 ≠ 0) |
| 77 | (hendpoints : (ends e0).1 ≠ (ends e0).2) : |
| 78 | (m64SelectedEdgeDeletionGraph ends x e0).Reachable |
| 79 | (ends e0).1 (ends e0).2 := by |
| 80 | classical |
| 81 | let _ := Fintype.ofFinite V |
| 82 | let G := m64SelectedEdgeDeletionGraph ends x e0 |
| 83 | let u := (ends e0).1 |
| 84 | let v := (ends e0).2 |
| 85 | have huv : u ≠ v := by |
| 86 | simpa [u, v] using hendpoints |
| 87 | by_contra hreachable |
| 88 | have hv : ¬ G.Reachable u v := by |
| 89 | simpa [G, u, v] using hreachable |
| 90 | let component : V → ZMod 2 := fun w => if G.Reachable u w then 1 else 0 |
| 91 | have hedges_same_component (e : E) (he0 : e ≠ e0) (hxe : x e ≠ 0) : |
| 92 | G.Reachable u (ends e).1 ↔ G.Reachable u (ends e).2 := by |
| 93 | by_cases hloop : (ends e).1 = (ends e).2 |
| 94 | · simp [hloop] |
| 95 | · have hadj : G.Adj (ends e).1 (ends e).2 := by |
| 96 | exact ⟨hloop, e, he0, hxe, Or.inl ⟨rfl, rfl⟩⟩ |
| 97 | exact ⟨fun h => h.trans hadj.reachable, |
| 98 | fun h => h.trans hadj.symm.reachable⟩ |
| 99 | have hterm (e : E) (he0 : e ≠ e0) : |
| 100 | x e * (component (ends e).1 + component (ends e).2) = 0 := by |
| 101 | by_cases hxe : x e = 0 |
| 102 | · simp [hxe] |
| 103 | · have hsame := hedges_same_component e he0 hxe |
| 104 | by_cases hfirst : G.Reachable u (ends e).1 |
| 105 | · have hsecond : G.Reachable u (ends e).2 := hsame.mp hfirst |
| 106 | simp [component, hfirst, hsecond, CharTwo.add_self_eq_zero] |
| 107 | · have hsecond : ¬ G.Reachable u (ends e).2 := by |
| 108 | exact fun h => hfirst (hsame.mpr h) |
| 109 | simp [component, hfirst, hsecond] |
| 110 | have hmulVec : (incidenceMatrix ends).transpose.mulVec x = 0 := by |
| 111 | change (incidenceMatrix ends).transpose.mulVec x = 0 at hcycle |
| 112 | exact hcycle |
| 113 | have hdot : x ⬝ᵥ (incidenceMatrix ends).mulVec component = 0 := by |
| 114 | rw [← Matrix.dotProduct_transpose_mulVec |
| 115 | (incidenceMatrix ends) component x] |
| 116 | rw [hmulVec] |
| 117 | simp |
| 118 | have hsum : |
| 119 | (∑ e, x e * (component (ends e).1 + component (ends e).2)) = 0 := by |
| 120 | simpa [dotProduct, incidenceMatrix_mulVec_apply] using hdot |
| 121 | have hsum_single : |
| 122 | (∑ e, x e * (component (ends e).1 + component (ends e).2)) = x e0 := by |
| 123 | rw [Finset.sum_eq_single e0] |
| 124 | · simp [component, u, v, hv] |
| 125 | · intro e _ he0 |
| 126 | exact hterm e he0 |
| 127 | · simp |
| 128 | exact hx0 (hsum_single.symm.trans hsum) |
| 129 | |
| 130 | /-! ## The original-edge chain carried by a graph path -/ |
| 131 | |
| 132 | /-- The original selected edge represented by a dart of the deletion graph. This is the |
| 133 | common choice used by the algebraic chain and by a later geometric realization of the dart. |
| 134 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 135 | noncomputable def m64SelectedEdgeOfDart {V E : Type*} |
| 136 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 137 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : E := |
| 138 | Classical.choose d.adj.2 |
| 139 | |
| 140 | /-- The selected original edge of a dart is supported, is not the deleted edge, and has the |
| 141 | dart's endpoints in one of the two orders. Source/construction: |
| 142 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 143 | theorem m64SelectedEdgeOfDart_spec {V E : Type*} |
| 144 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 145 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : |
| 146 | m64SelectedEdgeOfDart ends x e0 d ≠ e0 ∧ |
| 147 | x (m64SelectedEdgeOfDart ends x e0 d) ≠ 0 ∧ |
| 148 | ((((ends (m64SelectedEdgeOfDart ends x e0 d)).1 = d.fst ∧ |
| 149 | (ends (m64SelectedEdgeOfDart ends x e0 d)).2 = d.snd)) ∨ |
| 150 | ((ends (m64SelectedEdgeOfDart ends x e0 d)).1 = d.snd ∧ |
| 151 | (ends (m64SelectedEdgeOfDart ends x e0 d)).2 = d.fst)) := by |
| 152 | exact Classical.choose_spec d.adj.2 |
| 153 | |
| 154 | /-- A dart never selects the deleted edge. Source/construction: |
| 155 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 156 | theorem m64SelectedEdgeOfDart_ne {V E : Type*} |
| 157 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 158 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : |
| 159 | m64SelectedEdgeOfDart ends x e0 d ≠ e0 := |
| 160 | (m64SelectedEdgeOfDart_spec ends x e0 d).1 |
| 161 | |
| 162 | /-- The original edge selected by a dart belongs to the binary support. Source/construction: |
| 163 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 164 | theorem m64SelectedEdgeOfDart_nonzero {V E : Type*} |
| 165 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 166 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : |
| 167 | x (m64SelectedEdgeOfDart ends x e0 d) ≠ 0 := |
| 168 | (m64SelectedEdgeOfDart_spec ends x e0 d).2.1 |
| 169 | |
| 170 | /-- A dart and its selected original edge have the same unordered endpoints. |
| 171 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 172 | theorem m64SelectedEdgeOfDart_ends {V E : Type*} |
| 173 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 174 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : |
| 175 | (((ends (m64SelectedEdgeOfDart ends x e0 d)).1 = d.fst ∧ |
| 176 | (ends (m64SelectedEdgeOfDart ends x e0 d)).2 = d.snd) ∨ |
| 177 | ((ends (m64SelectedEdgeOfDart ends x e0 d)).1 = d.snd ∧ |
| 178 | (ends (m64SelectedEdgeOfDart ends x e0 d)).2 = d.fst)) := |
| 179 | (m64SelectedEdgeOfDart_spec ends x e0 d).2.2 |
| 180 | |
| 181 | /-- The binary original-edge chain obtained by choosing one represented edge for each dart |
| 182 | of a walk in the deletion graph. Source/construction: |
| 183 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 184 | noncomputable def m64WalkEdgeChain {V E : Type*} |
| 185 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 186 | {a b : V} |
| 187 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk a b) : E → ZMod 2 := by |
| 188 | classical |
| 189 | exact (p.darts.map fun d => |
| 190 | m64BinarySingle (m64SelectedEdgeOfDart ends x e0 d)).sum |
| 191 | |
| 192 | /-- The edge chain of the nil walk is zero. Source/construction: |
| 193 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 194 | @[simp] |
| 195 | theorem m64WalkEdgeChain_nil {V E : Type*} |
| 196 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) (a : V) : |
| 197 | m64WalkEdgeChain ends x e0 |
| 198 | (SimpleGraph.Walk.nil : |
| 199 | (m64SelectedEdgeDeletionGraph ends x e0).Walk a a) = 0 := by |
| 200 | simp [m64WalkEdgeChain] |
| 201 | |
| 202 | /-- Consing a dart adds its selected original-edge coordinate vector. Source/construction: |
| 203 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 204 | @[simp] |
| 205 | theorem m64WalkEdgeChain_cons {V E : Type*} |
| 206 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 207 | {a b c : V} |
| 208 | (h : (m64SelectedEdgeDeletionGraph ends x e0).Adj a b) |
| 209 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk b c) : |
| 210 | m64WalkEdgeChain ends x e0 (SimpleGraph.Walk.cons h p) = |
| 211 | m64BinarySingle (m64SelectedEdgeOfDart ends x e0 ⟨(a, b), h⟩) + |
| 212 | m64WalkEdgeChain ends x e0 p := by |
| 213 | simp [m64WalkEdgeChain] |
| 214 | |
| 215 | private theorem m64_incidence_transpose_mulVec_single |
| 216 | {V E : Type*} [Fintype E] |
| 217 | (ends : E → V × V) (e : E) : |
| 218 | (incidenceMatrix ends).transpose.mulVec (m64BinarySingle e) = |
| 219 | m64BinarySingle (ends e).1 + m64BinarySingle (ends e).2 := by |
| 220 | classical |
| 221 | have hsingle : m64BinarySingle e = Pi.single e 1 := by |
| 222 | ext j |
| 223 | simp [m64BinarySingle, Pi.single_apply, eq_comm] |
| 224 | rw [hsingle] |
| 225 | rw [Matrix.mulVec_single_one] |
| 226 | ext w |
| 227 | simp [incidenceMatrix, m64BinarySingle, eq_comm] |
| 228 | |
| 229 | /-- The incidence boundary of a dart's selected edge is the sum of its two endpoint |
| 230 | coordinate vectors. Source/construction: |
| 231 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 232 | theorem m64SelectedEdgeOfDart_boundary |
| 233 | {V E : Type*} [Fintype E] |
| 234 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 235 | (d : (m64SelectedEdgeDeletionGraph ends x e0).Dart) : |
| 236 | (incidenceMatrix ends).transpose.mulVec |
| 237 | (m64BinarySingle (m64SelectedEdgeOfDart ends x e0 d)) = |
| 238 | m64BinarySingle d.fst + m64BinarySingle d.snd := by |
| 239 | rw [m64_incidence_transpose_mulVec_single] |
| 240 | rcases m64SelectedEdgeOfDart_ends ends x e0 d with h | h |
| 241 | · rw [h.1, h.2] |
| 242 | · rw [h.1, h.2, add_comm] |
| 243 | |
| 244 | /-- The boundary of the original-edge chain of a walk consists of its two endpoints. |
| 245 | Intermediate vertices cancel over `ZMod 2`. Source/construction: |
| 246 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 247 | theorem m64WalkEdgeChain_boundary |
| 248 | {V E : Type*} [Fintype E] |
| 249 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 250 | {a b : V} |
| 251 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk a b) : |
| 252 | (incidenceMatrix ends).transpose.mulVec |
| 253 | (m64WalkEdgeChain ends x e0 p) = |
| 254 | m64BinarySingle a + m64BinarySingle b := by |
| 255 | classical |
| 256 | induction p with |
| 257 | | nil => |
| 258 | rw [m64WalkEdgeChain_nil, Matrix.mulVec_zero] |
| 259 | ext w |
| 260 | simp [CharTwo.add_self_eq_zero] |
| 261 | | @cons a b c h p ih => |
| 262 | rw [m64WalkEdgeChain_cons, Matrix.mulVec_add, |
| 263 | m64SelectedEdgeOfDart_boundary, ih] |
| 264 | ext w |
| 265 | simp only [Pi.add_apply] |
| 266 | calc |
| 267 | (m64BinarySingle a w + m64BinarySingle b w) + |
| 268 | (m64BinarySingle b w + m64BinarySingle c w) = |
| 269 | m64BinarySingle a w + |
| 270 | (m64BinarySingle b w + m64BinarySingle b w) + |
| 271 | m64BinarySingle c w := by ring |
| 272 | _ = m64BinarySingle a w + m64BinarySingle c w := by |
| 273 | rw [CharTwo.add_self_eq_zero] |
| 274 | simp |
| 275 | |
| 276 | /-- The walk chain vanishes at every edge outside the original support. Source/construction: |
| 277 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 278 | theorem m64WalkEdgeChain_apply_eq_zero_of_x_eq_zero |
| 279 | {V E : Type*} |
| 280 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 281 | {a b : V} |
| 282 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk a b) |
| 283 | {e : E} (he : x e = 0) : |
| 284 | m64WalkEdgeChain ends x e0 p e = 0 := by |
| 285 | classical |
| 286 | induction p with |
| 287 | | nil => simp |
| 288 | | @cons a b c h p ih => |
| 289 | rw [m64WalkEdgeChain_cons] |
| 290 | simp only [Pi.add_apply] |
| 291 | have hchosen : m64SelectedEdgeOfDart ends x e0 ⟨(a, b), h⟩ ≠ e := by |
| 292 | intro hce |
| 293 | have hn := m64SelectedEdgeOfDart_nonzero ends x e0 ⟨(a, b), h⟩ |
| 294 | rw [hce, he] at hn |
| 295 | exact hn rfl |
| 296 | rw [m64BinarySingle_apply_of_ne hchosen.symm, ih] |
| 297 | simp |
| 298 | |
| 299 | /-- The walk chain vanishes at the deleted edge. Source/construction: |
| 300 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 301 | theorem m64WalkEdgeChain_apply_e0 |
| 302 | {V E : Type*} |
| 303 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 304 | {a b : V} |
| 305 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk a b) : |
| 306 | m64WalkEdgeChain ends x e0 p e0 = 0 := by |
| 307 | classical |
| 308 | induction p with |
| 309 | | nil => simp |
| 310 | | @cons a b c h p ih => |
| 311 | rw [m64WalkEdgeChain_cons] |
| 312 | have hchosen := m64SelectedEdgeOfDart_ne ends x e0 ⟨(a, b), h⟩ |
| 313 | rw [Pi.add_apply, m64BinarySingle_apply_of_ne (Ne.symm hchosen), ih] |
| 314 | simp |
| 315 | |
| 316 | /-- Every edge in the walk-chain support is selected by one of its darts. |
| 317 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 318 | theorem m64WalkEdgeChain_support_subset_chosen |
| 319 | {V E : Type*} |
| 320 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 321 | {a b : V} |
| 322 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk a b) : |
| 323 | Function.support (m64WalkEdgeChain ends x e0 p) ⊆ |
| 324 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e} := by |
| 325 | classical |
| 326 | induction p with |
| 327 | | nil => simp |
| 328 | | @cons a b c h p ih => |
| 329 | intro e he |
| 330 | by_cases hhead : m64SelectedEdgeOfDart ends x e0 ⟨(a, b), h⟩ = e |
| 331 | · exact ⟨⟨(a, b), h⟩, by simp, hhead⟩ |
| 332 | · have htail : m64WalkEdgeChain ends x e0 p e ≠ 0 := by |
| 333 | intro htail |
| 334 | apply he |
| 335 | rw [m64WalkEdgeChain_cons, Pi.add_apply, |
| 336 | m64BinarySingle_apply_of_ne (Ne.symm hhead), htail] |
| 337 | simp |
| 338 | obtain ⟨d, hd, hde⟩ := ih htail |
| 339 | exact ⟨d, by simp [hd], hde⟩ |
| 340 | |
| 341 | /-- Closing a deletion-graph walk by the deleted edge gives an original-edge binary cycle. |
| 342 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 343 | noncomputable def m64SelectedWalkCycleVector {V E : Type*} |
| 344 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 345 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 346 | (ends e0).1 (ends e0).2) : E → ZMod 2 := by |
| 347 | classical |
| 348 | exact m64WalkEdgeChain ends x e0 p + m64BinarySingle e0 |
| 349 | |
| 350 | /-- Closing the walk chain by the deleted edge has zero incidence boundary. |
| 351 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 352 | theorem m64SelectedWalkCycleVector_kernel |
| 353 | {V E : Type*} [Fintype E] |
| 354 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 355 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 356 | (ends e0).1 (ends e0).2) : |
| 357 | (incidenceMatrix ends).transpose.mulVecLin |
| 358 | (m64SelectedWalkCycleVector ends x e0 p) = 0 := by |
| 359 | classical |
| 360 | change (incidenceMatrix ends).transpose.mulVec |
| 361 | (m64SelectedWalkCycleVector ends x e0 p) = 0 |
| 362 | rw [m64SelectedWalkCycleVector, Matrix.mulVec_add, |
| 363 | m64WalkEdgeChain_boundary, m64_incidence_transpose_mulVec_single] |
| 364 | ext w |
| 365 | simp only [Pi.add_apply, Pi.zero_apply] |
| 366 | calc |
| 367 | (m64BinarySingle (ends e0).1 w + m64BinarySingle (ends e0).2 w) + |
| 368 | (m64BinarySingle (ends e0).1 w + m64BinarySingle (ends e0).2 w) = |
| 369 | (m64BinarySingle (ends e0).1 w + m64BinarySingle (ends e0).1 w) + |
| 370 | (m64BinarySingle (ends e0).2 w + m64BinarySingle (ends e0).2 w) := by |
| 371 | ring |
| 372 | _ = 0 := by simp [CharTwo.add_self_eq_zero] |
| 373 | |
| 374 | /-- The closed walk vector is nonzero at the deleted edge. Source/construction: |
| 375 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 376 | theorem m64SelectedWalkCycleVector_ne_zero |
| 377 | {V E : Type*} |
| 378 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 379 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 380 | (ends e0).1 (ends e0).2) : |
| 381 | m64SelectedWalkCycleVector ends x e0 p ≠ 0 := by |
| 382 | classical |
| 383 | intro hzero |
| 384 | have he0 := congrFun hzero e0 |
| 385 | simp only [m64SelectedWalkCycleVector, Pi.add_apply, Pi.zero_apply] at he0 |
| 386 | rw [m64WalkEdgeChain_apply_e0] at he0 |
| 387 | simp at he0 |
| 388 | |
| 389 | /-- The closed walk vector is supported inside the original binary cycle. |
| 390 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 391 | theorem m64SelectedWalkCycleVector_support_subset |
| 392 | {V E : Type*} |
| 393 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 394 | (hx0 : x e0 ≠ 0) |
| 395 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 396 | (ends e0).1 (ends e0).2) : |
| 397 | Function.support (m64SelectedWalkCycleVector ends x e0 p) ⊆ |
| 398 | Function.support x := by |
| 399 | classical |
| 400 | intro e hecycle |
| 401 | by_contra hxe |
| 402 | have hxe_zero : x e = 0 := not_ne_iff.mp hxe |
| 403 | have he0 : e ≠ e0 := by |
| 404 | intro heq |
| 405 | subst e |
| 406 | exact hx0 hxe_zero |
| 407 | apply hecycle |
| 408 | simp [m64SelectedWalkCycleVector, |
| 409 | m64WalkEdgeChain_apply_eq_zero_of_x_eq_zero ends x e0 p hxe_zero, |
| 410 | he0] |
| 411 | |
| 412 | /-- The closed walk vector uses only the deleted edge and dart-selected original edges. |
| 413 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 414 | theorem m64SelectedWalkCycleVector_support_subset_chosen |
| 415 | {V E : Type*} |
| 416 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 417 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 418 | (ends e0).1 (ends e0).2) : |
| 419 | Function.support (m64SelectedWalkCycleVector ends x e0 p) ⊆ |
| 420 | ({e0} ∪ |
| 421 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) := by |
| 422 | classical |
| 423 | intro e hecycle |
| 424 | by_cases he0 : e = e0 |
| 425 | · exact Set.mem_union_left _ (Set.mem_singleton_iff.mpr he0) |
| 426 | · apply Set.mem_union_right |
| 427 | apply m64WalkEdgeChain_support_subset_chosen ends x e0 p |
| 428 | intro hchain |
| 429 | apply hecycle |
| 430 | simp [m64SelectedWalkCycleVector, hchain, he0] |
| 431 | |
| 432 | /-- The deleted edge and every dart-selected edge belong to the original binary support. |
| 433 | Source/construction: proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 434 | theorem m64SelectedWalkChosenEdges_subset_support |
| 435 | {V E : Type*} |
| 436 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 437 | (hx0 : x e0 ≠ 0) |
| 438 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 439 | (ends e0).1 (ends e0).2) : |
| 440 | ({e0} ∪ |
| 441 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) ⊆ |
| 442 | Function.support x := by |
| 443 | intro e he |
| 444 | rcases he with he | ⟨d, -, hde⟩ |
| 445 | · have heq : e = e0 := Set.mem_singleton_iff.mp he |
| 446 | change x e ≠ 0 |
| 447 | simpa only [heq] using hx0 |
| 448 | · rw [← hde] |
| 449 | exact m64SelectedEdgeOfDart_nonzero ends x e0 d |
| 450 | |
| 451 | /-- Minimal support forces the path cycle through any selected edge to use exactly the |
| 452 | support of the original binary cycle. Source/construction: |
| 453 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 454 | theorem m64SelectedWalkCycleVector_support_eq_of_minimal |
| 455 | {V E : Type*} [Fintype E] |
| 456 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 457 | (hx0 : x e0 ≠ 0) |
| 458 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 459 | (ends e0).1 (ends e0).2) |
| 460 | (hminimal : ∀ y : E → ZMod 2, |
| 461 | (incidenceMatrix ends).transpose.mulVecLin y = 0 → y ≠ 0 → |
| 462 | Function.support y ⊆ Function.support x → |
| 463 | Function.support x ⊆ Function.support y) : |
| 464 | Function.support (m64SelectedWalkCycleVector ends x e0 p) = |
| 465 | Function.support x := by |
| 466 | apply Set.Subset.antisymm |
| 467 | · exact m64SelectedWalkCycleVector_support_subset ends x e0 hx0 p |
| 468 | · exact hminimal _ (m64SelectedWalkCycleVector_kernel ends x e0 p) |
| 469 | (m64SelectedWalkCycleVector_ne_zero ends x e0 p) |
| 470 | (m64SelectedWalkCycleVector_support_subset ends x e0 hx0 p) |
| 471 | |
| 472 | /-- The algebraic cycle, the deleted edge together with the dart choices, and the original |
| 473 | minimal cycle have exactly the same edge support. Source/construction: |
| 474 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 475 | theorem m64SelectedWalkCycleVector_exact_support_of_minimal |
| 476 | {V E : Type*} [Fintype E] |
| 477 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 478 | (hx0 : x e0 ≠ 0) |
| 479 | (p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 480 | (ends e0).1 (ends e0).2) |
| 481 | (hminimal : ∀ y : E → ZMod 2, |
| 482 | (incidenceMatrix ends).transpose.mulVecLin y = 0 → y ≠ 0 → |
| 483 | Function.support y ⊆ Function.support x → |
| 484 | Function.support x ⊆ Function.support y) : |
| 485 | Function.support (m64SelectedWalkCycleVector ends x e0 p) = |
| 486 | ({e0} ∪ |
| 487 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) ∧ |
| 488 | ({e0} ∪ |
| 489 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) = |
| 490 | Function.support x := by |
| 491 | let chosenEdges : Set E := {e0} ∪ |
| 492 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e} |
| 493 | have hcycle_eq := m64SelectedWalkCycleVector_support_eq_of_minimal |
| 494 | ends x e0 hx0 p hminimal |
| 495 | have hcycle_chosen : |
| 496 | Function.support (m64SelectedWalkCycleVector ends x e0 p) ⊆ chosenEdges := by |
| 497 | simpa only [chosenEdges] using |
| 498 | m64SelectedWalkCycleVector_support_subset_chosen ends x e0 p |
| 499 | have hchosen_x : chosenEdges ⊆ Function.support x := by |
| 500 | simpa only [chosenEdges] using |
| 501 | m64SelectedWalkChosenEdges_subset_support ends x e0 hx0 p |
| 502 | have hx_chosen : Function.support x ⊆ chosenEdges := by |
| 503 | rw [← hcycle_eq] |
| 504 | exact hcycle_chosen |
| 505 | have hchosen_eq : chosenEdges = Function.support x := |
| 506 | Set.Subset.antisymm hchosen_x hx_chosen |
| 507 | exact ⟨hcycle_eq.trans hchosen_eq.symm, hchosen_eq⟩ |
| 508 | |
| 509 | /-- A nonzero minimal binary incidence cycle and one of its nonloop edges produce a |
| 510 | nontrivial simple deletion path whose closed original-edge chain has the same support as the |
| 511 | cycle. Source/construction: |
| 512 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 513 | theorem m64Intrinsic_exists_path_with_cycle_support |
| 514 | {V E : Type*} [Finite V] [Fintype E] |
| 515 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 516 | (hcycle : (incidenceMatrix ends).transpose.mulVecLin x = 0) |
| 517 | (hx0 : x e0 ≠ 0) |
| 518 | (hendpoints : (ends e0).1 ≠ (ends e0).2) |
| 519 | (hminimal : ∀ y : E → ZMod 2, |
| 520 | (incidenceMatrix ends).transpose.mulVecLin y = 0 → y ≠ 0 → |
| 521 | Function.support y ⊆ Function.support x → |
| 522 | Function.support x ⊆ Function.support y) : |
| 523 | ∃ p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 524 | (ends e0).1 (ends e0).2, |
| 525 | p.IsPath ∧ ¬ p.Nil ∧ |
| 526 | Function.support (m64SelectedWalkCycleVector ends x e0 p) = |
| 527 | Function.support x := by |
| 528 | have hreachable := m64Intrinsic_selected_edge_endpoints_reachable_without |
| 529 | ends x e0 hcycle hx0 hendpoints |
| 530 | obtain ⟨p, hp⟩ := hreachable.exists_isPath |
| 531 | exact ⟨p, hp, SimpleGraph.Walk.not_nil_of_ne hendpoints, |
| 532 | m64SelectedWalkCycleVector_support_eq_of_minimal ends x e0 hx0 p hminimal⟩ |
| 533 | |
| 534 | /-- The path form with the exact original-edge set needed by the geometric Jordan |
| 535 | realization. Source/construction: |
| 536 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 537 | theorem m64Intrinsic_exists_path_with_exact_cycle_support |
| 538 | {V E : Type*} [Finite V] [Fintype E] |
| 539 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 540 | (hcycle : (incidenceMatrix ends).transpose.mulVecLin x = 0) |
| 541 | (hx0 : x e0 ≠ 0) |
| 542 | (hendpoints : (ends e0).1 ≠ (ends e0).2) |
| 543 | (hminimal : ∀ y : E → ZMod 2, |
| 544 | (incidenceMatrix ends).transpose.mulVecLin y = 0 → y ≠ 0 → |
| 545 | Function.support y ⊆ Function.support x → |
| 546 | Function.support x ⊆ Function.support y) : |
| 547 | ∃ p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 548 | (ends e0).1 (ends e0).2, |
| 549 | p.IsPath ∧ ¬ p.Nil ∧ |
| 550 | Function.support (m64SelectedWalkCycleVector ends x e0 p) = |
| 551 | ({e0} ∪ |
| 552 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) ∧ |
| 553 | ({e0} ∪ |
| 554 | {e | ∃ d ∈ p.darts, m64SelectedEdgeOfDart ends x e0 d = e}) = |
| 555 | Function.support x := by |
| 556 | have hreachable := m64Intrinsic_selected_edge_endpoints_reachable_without |
| 557 | ends x e0 hcycle hx0 hendpoints |
| 558 | obtain ⟨p, hp⟩ := hreachable.exists_isPath |
| 559 | obtain ⟨hcycle_chosen, hchosen_x⟩ := |
| 560 | m64SelectedWalkCycleVector_exact_support_of_minimal |
| 561 | ends x e0 hx0 p hminimal |
| 562 | exact ⟨p, hp, SimpleGraph.Walk.not_nil_of_ne hendpoints, |
| 563 | hcycle_chosen, hchosen_x⟩ |
| 564 | |
| 565 | /-- Packaged algebra-to-geometry interface: a support-minimal binary cycle is one |
| 566 | distinguished edge together with the original edges chosen along a simple path in the |
| 567 | deletion graph. Source/construction: |
| 568 | proof-work/tasks/M64/derivations/2026-09-25-plane-graph-cycle-fill.md. -/ |
| 569 | theorem m64Intrinsic_minimal_cycle_eq_edge_union_path |
| 570 | {V E : Type*} [Finite V] [Fintype E] |
| 571 | (ends : E → V × V) (x : E → ZMod 2) (e0 : E) |
| 572 | (hcycle : (incidenceMatrix ends).transpose.mulVecLin x = 0) |
| 573 | (hx0 : x e0 ≠ 0) |
| 574 | (hendpoints : (ends e0).1 ≠ (ends e0).2) |
| 575 | (hminimal : ∀ y : E → ZMod 2, |
| 576 | (incidenceMatrix ends).transpose.mulVecLin y = 0 → y ≠ 0 → |
| 577 | Function.support y ⊆ Function.support x → |
| 578 | Function.support x ⊆ Function.support y) : |
| 579 | ∃ p : (m64SelectedEdgeDeletionGraph ends x e0).Walk |
| 580 | (ends e0).1 (ends e0).2, |
| 581 | p.IsPath ∧ |
| 582 | ∃ chosen : (m64SelectedEdgeDeletionGraph ends x e0).Dart → E, |
| 583 | (∀ d, chosen d ≠ e0 ∧ x (chosen d) ≠ 0 ∧ |
| 584 | (((ends (chosen d)).1 = d.fst ∧ (ends (chosen d)).2 = d.snd) ∨ |
| 585 | ((ends (chosen d)).1 = d.snd ∧ (ends (chosen d)).2 = d.fst))) ∧ |
| 586 | ∀ e, x e ≠ 0 ↔ |
| 587 | e = e0 ∨ ∃ d ∈ p.darts, chosen d = e := by |
| 588 | obtain ⟨p, hp, -, -, hchosen_x⟩ := |
| 589 | m64Intrinsic_exists_path_with_exact_cycle_support |
| 590 | ends x e0 hcycle hx0 hendpoints hminimal |
| 591 | refine ⟨p, hp, m64SelectedEdgeOfDart ends x e0, ?_, ?_⟩ |
| 592 | · intro d |
| 593 | exact m64SelectedEdgeOfDart_spec ends x e0 d |
| 594 | · intro e |
| 595 | change e ∈ Function.support x ↔ _ |
| 596 | rw [← hchosen_x] |
| 597 | simp only [Set.mem_union, Set.mem_singleton_iff, Set.mem_ofPred_eq] |
| 598 | |
| 599 | end PoincareMT |