AFTD Auto-Formalizing Theoretical Domains

op874_open_square_block_family_unbounded_cut_repair

theoremverified

For every even k at least two there is a simple connected bridgeless cubic graph on 16k vertices, a perfect matching and a mixed globally maximum matching-constant cut such that every exact-owner strong two-versus-four state with one global high pair on unselected factor edges requires changing at least 2k vertex bits from that cut, equivalently at least k matching-pair bits. This concerns the prescribed initial cut and restricted coloring, not the existence of another valid cut.

Statement

theorem op874_open_square_block_family_unbounded_cut_repair :
  ∀ k : ℕ, 2 ≤ k → Even k →
  ∃ (G : SimpleGraph (Fin (16*k))) (dG : DecidableRel G.Adj),
    letI : DecidableRel G.Adj := dG
    ∃ (M : Finset (Sym2 (Fin (16*k)))) (b : Fin (16*k) → Bool),
      G.Connected ∧ G.IsRegularOfDegree 3 ∧
      (∀ e : G.edgeSet, ¬ G.IsBridge e.1) ∧ M ⊆ G.edgeFinset ∧
      (∀ v : Fin (16*k), ∃! e : Sym2 (Fin (16*k)), e ∈ M ∧ v ∈ e) ∧
      (∀ u v, s(u,v) ∈ M → b u = b v) ∧
      (∀ b' : Fin (16*k) → Bool,
        (∀ u v, s(u,v) ∈ M → b' u = b' v) →
        (Finset.univ.sum fun u : Fin (16*k) =>
          ((G.neighborFinset u).filter fun v => b' u ≠ b' v).card) ≤
        (Finset.univ.sum fun u : Fin (16*k) =>
          ((G.neighborFinset u).filter fun v => b u ≠ b v).card)) ∧
      (∀ (n : ℕ), ∀ [NeZero n], 3 ≤ n →
        ∀ p : Fin n → Fin (16*k), Function.Injective p →
        (∀ i, G.Adj (p i) (p (i+1))) →
        (∀ i, s(p i,p (i+1)) ∉ M) → ¬ (∀ i, b (p i) = b (p 0))) ∧
      (∀ b' : Fin (16*k) → Bool,
        (∀ u v, s(u,v) ∈ M → b' u = b' v) →
        (Finset.univ.filter fun v : Fin (16*k) => b' v ≠ b v).card < 2*k →
        ¬ ∃ (c : G.edgeSet → Fin 6) (h : Fin (16*k) → G.edgeSet → Fin 6),
          truncation_local_states_define_strong_coloring
            (fun e : G.edgeSet => (e : Sym2 (Fin (16*k)))) (fun _ e => c e) h ∧
          (∀ u (e : G.edgeSet), u ∈ (e : Sym2 (Fin (16*k))) → (e : Sym2 (Fin (16*k))) ∈ M →
            c e = if b' u then 1 else 0) ∧
          (∀ e : G.edgeSet, (e : Sym2 (Fin (16*k))) ∉ M → 2 ≤ (c e).val) ∧
          (∀ u v (e : G.edgeSet), (e : Sym2 (Fin (16*k))) = s(u,v) →
            ¬ (h u e = (if b' u then 0 else 1) ∧ h v e = (if b' v then 0 else 1))) ∧
          (∀ u v (e : G.edgeSet), (e : Sym2 (Fin (16*k))) = s(u,v) →
            (e : Sym2 (Fin (16*k))) ∉ M →
            h u e ≠ (if b' u then 0 else 1) → h v e ≠ (if b' v then 0 else 1) →
            c e = 2 ∨ c e = 3))
Source
OP-874; opened four-square block cycles, experiments 41901, 41903, 41905–41908, 41910, 41912–41914 and 41917.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 8

Lean source view module on GitHub

Lean’s trace was cut to the first 400 of 890 tactics.

section genericvariable {V : Type*} {G : SimpleGraph V}theorem in1252_other {e : G.edgeSet} {u : V} (hu : u ∈ (e : Sym2 V)) :    ∃ w, G.Adj u w ∧ (e : Sym2 V) = s(u, w) := by  obtain ⟨w, hw⟩ := Sym2.mem_iff_exists.mp hu  refine ⟨w, ?_, hw⟩  have := e.2  rw [hw] at this  exact thistheorem in1252_third [Fintype V] [DecidableRel G.Adj] (hreg : G.IsRegularOfDegree 3)    (u w1 w2 : V) : ∃ w3, G.Adj u w3 ∧ w3 ≠ w1 ∧ w3 ≠ w2 := by  classical  have h3 : (G.neighborFinset u).card = 3 := by    rw [SimpleGraph.card_neighborFinset_eq_degree]; exact hreg u  have h1 := Finset.pred_card_le_card_erase (s := G.neighborFinset u) (a := w1)  have h2 := Finset.pred_card_le_card_erase (s := (G.neighborFinset u).erase w1) (a := w2)  obtain ⟨w3, hw3⟩ : (((G.neighborFinset u).erase w1).erase w2).Nonempty := by    rw [← Finset.card_pos]; omega  simp only [Finset.mem_erase, SimpleGraph.mem_neighborFinset] at hw3  exact ⟨w3, hw3.2.2, hw3.2.1, hw3.1⟩theorem in1252_edge_ne {u w w' : V} (hu : G.Adj u w) (hu' : G.Adj u w') (hne : w ≠ w') :    (⟨s(u, w), hu⟩ : G.edgeSet) ≠ ⟨s(u, w'), hu'⟩ := by  intro h  apply hne  have := congrArg Subtype.val h  simp only [Sym2.eq, Sym2.rel_iff', Prod.mk.injEq, Prod.swap_prod_mk] at this  rcases this with ⟨-, h1⟩ | ⟨h1, h2⟩  · exact h1  · exact h2.trans h1variable {Ω : Type*} {c h : V → G.edgeSet → Ω}theorem in1252_L1    (H : truncation_local_states_define_strong_coloring (fun e : G.edgeSet => (e : Sym2 V)) c h)    {u : V} {e f : G.edgeSet} (he : u ∈ (e : Sym2 V)) (hf : u ∈ (f : Sym2 V)) (hef : e ≠ f) :    c u e ≠ c u f := by  obtain ⟨χ, hs, hext, -⟩ := H  obtain ⟨w, hw, hew⟩ := in1252_other he  obtain ⟨w', hw', hfw⟩ := in1252_other hf  have hwe : w ∈ (e : Sym2 V) := by rw [hew]; exact Sym2.mem_mk_right _ _  have hwf : w' ∈ (f : Sym2 V) := by rw [hfw]; exact Sym2.mem_mk_right _ _  let p1 : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, e), he⟩  let q1 : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(w, e), hwe⟩  let p2 : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, f), hf⟩  let q2 : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(w', f), hwf⟩  have n1 : p1 ≠ q1 := fun h' => hw.ne (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h')  have n2 : p2 ≠ q2 := fun h' => hw'.ne (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h')  have npp : p1 ≠ p2 := fun h' => hef (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  rw [← hext p1 q1 n1 rfl, ← hext p2 q2 n2 rfl]  apply hs  · exact (SimpleGraph.mem_edgeSet _).2 ⟨n1, Or.inr rfl⟩  · exact (SimpleGraph.mem_edgeSet _).2 ⟨n2, Or.inr rfl⟩  · intro h'    have : p1 ∈ s(p2, q2) := h' ▸ Sym2.mem_mk_left _ _    rcases Sym2.mem_iff.mp this with h'' | h''    · exact npp h''    · exact hef (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h'')  · right; exact ⟨p1, p2, Sym2.mem_mk_left _ _, Sym2.mem_mk_left _ _, npp, Or.inl rfl⟩/-- hidden colours at a vertex are distinct -/theorem in1252_L2    (H : truncation_local_states_define_strong_coloring (fun e : G.edgeSet => (e : Sym2 V)) c h)    {u : V} {e f g : G.edgeSet} (he : u ∈ (e : Sym2 V)) (hf : u ∈ (f : Sym2 V))    (hg : u ∈ (g : Sym2 V)) (hef : e ≠ f) (hge : g ≠ e) (hgf : g ≠ f) :    h u e ≠ h u f := by  obtain ⟨χ, hs, -, hint⟩ := H  let pe : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, e), he⟩  let pf : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, f), hf⟩  let pg : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, g), hg⟩  have nef : pe ≠ pf := fun h' => hef (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  have nge : pg ≠ pe := fun h' => hge (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  have ngf : pg ≠ pf := fun h' => hgf (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  rw [← hint pf pg pe ngf.symm nef.symm nge rfl rfl, ← hint pe pg pf nge.symm nef ngf rfl rfl]  apply hs  · exact (SimpleGraph.mem_edgeSet _).2 ⟨ngf.symm, Or.inl rfl⟩  · exact (SimpleGraph.mem_edgeSet _).2 ⟨nge.symm, Or.inl rfl⟩  · intro h'    have : pf ∈ s(pe, pg) := h' ▸ Sym2.mem_mk_left _ _    rcases Sym2.mem_iff.mp this with h'' | h''    · exact nef h''.symm    · exact ngf h''.symm  · left; exact ⟨pg, Sym2.mem_mk_right _ _, Sym2.mem_mk_right _ _⟩/-- a hidden colour differs from the external colours at the vertex -/theorem in1252_L3    (H : truncation_local_states_define_strong_coloring (fun e : G.edgeSet => (e : Sym2 V)) c h)    {u : V} {e f x y : G.edgeSet} (he : u ∈ (e : Sym2 V)) (hf : u ∈ (f : Sym2 V))    (hx : u ∈ (x : Sym2 V)) (hy : u ∈ (y : Sym2 V)) (hxe : x ≠ e) (hye : y ≠ e) (hxy : x ≠ y) :    h u e ≠ c u f := by  obtain ⟨χ, hs, hext, hint⟩ := H  obtain ⟨w, hw, hfw⟩ := in1252_other hf  have hwf : w ∈ (f : Sym2 V) := by rw [hfw]; exact Sym2.mem_mk_right _ _  let pe : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, e), he⟩  let pf : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, f), hf⟩  let qf : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(w, f), hwf⟩  let px : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, x), hx⟩  let py : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(u, y), hy⟩  have nxe : px ≠ pe := fun h' => hxe (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  have nye : py ≠ pe := fun h' => hye (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  have nxy : px ≠ py := fun h' => hxy (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h')  have nf : pf ≠ qf := fun h' => hw.ne (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h')  rw [← hint px py pe nxy nxe nye rfl rfl, ← hext pf qf nf rfl]  apply hs  · exact (SimpleGraph.mem_edgeSet _).2 ⟨nxy, Or.inl rfl⟩  · exact (SimpleGraph.mem_edgeSet _).2 ⟨nf, Or.inr rfl⟩  · intro h'    have : qf ∈ s(px, py) := h' ▸ Sym2.mem_mk_right _ _    rcases Sym2.mem_iff.mp this with h'' | h''    · exact hw.ne (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h'').symm    · exact hw.ne (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h'').symm  · by_cases hfx : f = x    · left; refine ⟨px, Sym2.mem_mk_left _ _, ?_⟩      have : px = pf := Subtype.ext (by simp [px, pf, hfx])      rw [this]; exact Sym2.mem_mk_left _ _    · right      refine ⟨px, pf, Sym2.mem_mk_left _ _, Sym2.mem_mk_left _ _, ?_, Or.inl rfl⟩      exact fun h' => hfx (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm/-- hidden colours on the two sides of an edge differ -/theorem in1252_L4    (H : truncation_local_states_define_strong_coloring (fun e : G.edgeSet => (e : Sym2 V)) c h)    {a b : V} {e f f' g g' : G.edgeSet} (hab : a ≠ b) (ha : a ∈ (e : Sym2 V)) (hb : b ∈ (e : Sym2 V))    (hf : a ∈ (f : Sym2 V)) (hf' : a ∈ (f' : Sym2 V)) (hg : b ∈ (g : Sym2 V)) (hg' : b ∈ (g' : Sym2 V))    (hfe : f ≠ e) (hf'e : f' ≠ e) (hff' : f ≠ f') (hge : g ≠ e) (hg'e : g' ≠ e) (hgg' : g ≠ g') :    h a f ≠ h b g := by  obtain ⟨χ, hs, -, hint⟩ := H  let pa : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(a, e), ha⟩  let pf : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(a, f), hf⟩  let pf' : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(a, f'), hf'⟩  let pb : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(b, e), hb⟩  let pg : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(b, g), hg⟩  let pg' : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} := ⟨(b, g'), hg'⟩  have n1 : pa ≠ pf' := fun h' => hf'e (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  have n2 : pa ≠ pf := fun h' => hfe (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  have n3 : pf' ≠ pf := fun h' => hff' (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  have m1 : pb ≠ pg' := fun h' => hg'e (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  have m2 : pb ≠ pg := fun h' => hge (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  have m3 : pg' ≠ pg := fun h' => hgg' (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.2) h').symm  rw [← hint pa pf' pf n1 n2 n3 rfl rfl, ← hint pb pg' pg m1 m2 m3 rfl rfl]  have nab : pa ≠ pb := fun h' => hab (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h')  apply hs  · exact (SimpleGraph.mem_edgeSet _).2 ⟨n1, Or.inl rfl⟩  · exact (SimpleGraph.mem_edgeSet _).2 ⟨m1, Or.inl rfl⟩  · intro h'    have : pb ∈ s(pa, pf') := h' ▸ Sym2.mem_mk_left _ _    rcases Sym2.mem_iff.mp this with h'' | h''    · exact hab (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h'').symm    · exact hab (congrArg (fun x : {p : V × G.edgeSet // p.1 ∈ (p.2 : Sym2 V)} => x.1.1) h'').symm  · right; exact ⟨pa, pb, Sym2.mem_mk_left _ _, Sym2.mem_mk_left _ _, nab, Or.inr rfl⟩end genericabbrev in1252_W (n : ℕ) := Fin (n+1) × (Fin 4 × Fin 4)def in1252_mq : Fin 4 → Fin 4 → Fin 4 := ![![0,3,0,3],![1,2,1,2],![1,1,3,3],![2,2,0,0]]def in1252_mr : Fin 4 → Fin 4 → Fin 4 := ![![2,2,0,3],![2,1,0,0],![3,1,0,1],![2,3,1,3]]def in1252_m2 (a : Fin 4 × Fin 4) : Fin 4 × Fin 4 := (in1252_mq a.1 a.2, in1252_mr a.1 a.2)def in1252_cs (a : Fin 4 × Fin 4) : Fin 4 × Fin 4 := (a.1, a.2 + 1)def in1252_bits (a : Fin 4 × Fin 4) : Bool :=  ![![true,false,true,false],![true,false,true,false],![false,false,true,false],    ![true,false,false,false]] a.1 a.2def in1252_blk (n : ℕ) (a : Fin 4 × Fin 4) (i : Fin (n+1)) : Fin (n+1) :=  if a = (2,2) then i + 1 else if a = (3,0) then i - 1 else idef in1252_mate (n : ℕ) (u : in1252_W n) : in1252_W n := (in1252_blk n u.2 u.1, in1252_m2 u.2)theorem in1252_m2_m2 : ∀ a, in1252_m2 (in1252_m2 a) = a := by decidetheorem in1252_mate_mate (n : ℕ) (u : in1252_W n) : in1252_mate n (in1252_mate n u) = u := by  obtain ⟨i, q, r⟩ := u  fin_cases q <;> fin_cases r <;> simp [in1252_mate, in1252_blk, in1252_m2, in1252_mq, in1252_mr]theorem in1252_m2_ne : ∀ a, in1252_m2 a ≠ a ∧ in1252_m2 a ≠ in1252_cs a ∧ in1252_cs (in1252_m2 a) ≠ a ∧    in1252_cs a ≠ a ∧ in1252_cs (in1252_cs a) ≠ a := by decidedef in1252_G (n : ℕ) : SimpleGraph (in1252_W n) where  Adj u w := (u.1 = w.1 ∧ (w.2 = in1252_cs u.2 ∨ u.2 = in1252_cs w.2)) ∨ in1252_mate n u = w  symm := ⟨fun u w h => by    rcases h with ⟨h1, h2 | h2⟩ | h    · exact Or.inl ⟨h1.symm, Or.inr h2⟩    · exact Or.inl ⟨h1.symm, Or.inl h2⟩    · right; rw [← h, in1252_mate_mate]⟩  loopless := ⟨fun u h => by    rcases h with ⟨-, h | h⟩ | h    · exact (in1252_m2_ne u.2).2.2.2.1 h.symm    · exact (in1252_m2_ne u.2).2.2.2.1 h.symm    · exact (in1252_m2_ne u.2).1 (congrArg Prod.snd h)⟩instance in1252_G_dec (n : ℕ) : DecidableRel (in1252_G n).Adj := fun u w => by  unfold in1252_G; infer_instancetheorem in1252_adj (n : ℕ) (u w : in1252_W n) : (in1252_G n).Adj u w ↔    (u.1 = w.1 ∧ (w.2 = in1252_cs u.2 ∨ u.2 = in1252_cs w.2)) ∨ in1252_mate n u = w := Iff.rfltheorem in1252_step (n : ℕ) (i : Fin (n+1)) (a : Fin 4 × Fin 4) :    (in1252_G n).Adj (i, a) (i, in1252_cs a) := Or.inl ⟨rfl, Or.inl rfl⟩/-- internal adjacency inside a block -/def in1252_iadj (x z : Fin 4 × Fin 4) : Bool :=  decide (z = in1252_cs x ∨ x = in1252_cs z ∨ (x ≠ (2,2) ∧ x ≠ (3,0) ∧ in1252_m2 x = z))theorem in1252_iadj_G (n : ℕ) (i : Fin (n+1)) (x z : Fin 4 × Fin 4) (h : in1252_iadj x z = true) :    (in1252_G n).Adj (i, x) (i, z) := by  simp only [in1252_iadj, decide_eq_true_eq] at h  rcases h with h | h | ⟨h1, h2, h3⟩  · exact Or.inl ⟨rfl, Or.inl h⟩  · exact Or.inl ⟨rfl, Or.inr h⟩  · right; simp [in1252_mate, in1252_blk, h1, h2, h3]def in1252_chain (d : Sym2 (Fin 4 × Fin 4)) :    Fin 4 × Fin 4 → List (Fin 4 × Fin 4) → Fin 4 × Fin 4 → Bool  | x, [], y => decide (x = y)  | x, z :: l, y => in1252_iadj x z && decide (s(x, z) ≠ d) && in1252_chain d z l ytheorem in1252_chain_reach {n : ℕ} (H : SimpleGraph (in1252_W n)) (i : Fin (n+1))    (d : Sym2 (Fin 4 × Fin 4))    (hH : ∀ x z, in1252_iadj x z = true → s(x, z) ≠ d → H.Adj (i, x) (i, z)) :    ∀ x l y, in1252_chain d x l y = true → H.Reachable (i, x) (i, y) := by  intro x l  induction l generalizing x with  | nil => intro y h; simp only [in1252_chain, decide_eq_true_eq] at h; subst h; rfl  | cons z l ih =>    intro y h    simp only [in1252_chain, Bool.and_eq_true, decide_eq_true_eq] at h    exact (hH x z h.1.1 h.1.2).reachable.trans (ih z y h.2)/-- the port pair, never an internal edge -/abbrev in1252_p0 : Sym2 (Fin 4 × Fin 4) := s((2,2), (3,0))theorem in1252_hH_G (n : ℕ) (i : Fin (n+1)) :    ∀ x z, in1252_iadj x z = true → s(x, z) ≠ in1252_p0 → (in1252_G n).Adj (i, x) (i, z) :=  fun x z h _ => in1252_iadj_G n i x z htheorem in1252_hH_del_snd (n : ℕ) (i : Fin (n+1)) (E : Sym2 (in1252_W n)) :    ∀ x z, in1252_iadj x z = true → s(x, z) ≠ Sym2.map Prod.snd E →      ((in1252_G n).deleteEdges {E}).Adj (i, x) (i, z) := by  intro x z h hd  rw [SimpleGraph.deleteEdges_adj]  refine ⟨in1252_iadj_G n i x z h, ?_⟩  rintro rfl  exact hd (by simp)theorem in1252_hH_del_fst (n : ℕ) (i j : Fin (n+1)) (hij : i ≠ j) (a b : Fin 4 × Fin 4) :    ∀ x z, in1252_iadj x z = true → s(x, z) ≠ in1252_p0 →      ((in1252_G n).deleteEdges {s((j, a), (j, b))}).Adj (i, x) (i, z) := by  intro x z h _  rw [SimpleGraph.deleteEdges_adj]  refine ⟨in1252_iadj_G n i x z h, ?_⟩  intro he  rw [Set.mem_singleton_iff] at he  have := congrArg (Sym2.map Prod.fst) he  simp at this  exact hij thisdef in1252_bpath : Fin 4 → Fin 4 → List (Fin 4 × Fin 4) :=  ![![[(3,3),(0,3),(0,0)],[(3,1),(3,2),(0,1)],[(3,3),(0,3),(0,2)],[(3,3),(0,3)]],![[(3,1),(2,3),(2,0),(1,3),(1,0)],[(3,1),(2,3),(2,0),(2,1),(1,1)],[(3,1),(2,3),(2,0),(1,3),(1,2)],[(3,1),(2,3),(2,0),(1,3)]],![[(3,1),(2,3),(2,0)],[(3,1),(2,3),(2,0),(2,1)],[(3,1),(2,3),(2,2)],[(3,1),(2,3)]],![[],[(3,1)],[(3,1),(3,2)],[(3,3)]]]def in1252_mpath : Fin 4 → Fin 4 → List (Fin 4 × Fin 4) :=  ![![[(0,1),(0,2)],[(0,0),(0,3),(3,3),(3,2)],[(0,1),(0,0)],[(0,0),(0,1),(3,2),(3,3)]],![[(1,1),(1,2)],[(1,0),(1,3),(2,0),(2,1)],[(1,1),(1,0)],[(1,0),(1,1),(2,1),(2,0)]],![[(2,1),(1,1),(1,0),(1,3)],[(2,0),(1,3),(1,0),(1,1)],[],[]],![[],[],[(3,3),(0,3),(0,0),(0,1)],[(3,2),(0,1),(0,0),(0,3)]]]theorem in1252_bpath_ok : ∀ a : Fin 4 × Fin 4, in1252_chain in1252_p0 (3,0) (in1252_bpath a.1 a.2) a = true := by  decidetheorem in1252_mpath_ok : ∀ a : Fin 4 × Fin 4, a ≠ (2,2) → a ≠ (3,0) → a ≠ (2,3) → a ≠ (3,1) →    in1252_chain s(a, in1252_m2 a) a (in1252_mpath a.1 a.2) (in1252_m2 a) = true := by  decidetheorem in1252_cyc_ok : ∀ a : Fin 4 × Fin 4, in1252_chain s(a, in1252_cs a) a    [(a.1, a.2 - 1), (a.1, a.2 - 2), (a.1, a.2 - 3)] (in1252_cs a) = true := by  decidetheorem in1252_trav_ok : in1252_chain in1252_p0 (2,2) [(2,3),(3,1),(3,0)] (3,0) = true := by decideopen scoped Fin.NatCast intheorem in1252_ring {n : ℕ} (H : SimpleGraph (in1252_W n)) (i : Fin (n+1))    (hb : ∀ s : ℕ, 1 ≤ s → s ≤ n → H.Reachable (i - s, (2,2)) (i - s, (3,0)))    (hx : ∀ s : ℕ, 1 ≤ s → s ≤ n → H.Adj (i - s, (2,2)) (i - s + 1, (3,0))) :    ∀ t ≤ n, H.Reachable (i, (3,0)) (i - t, (3,0)) := by  intro t  induction t with  | zero => intro _; simpa using SimpleGraph.Reachable.refl _  | succ t ih =>    intro ht    refine (ih (by omega)).trans ?_    have e1 : i - ((t+1 : ℕ) : Fin (n+1)) + 1 = i - (t : Fin (n+1)) := by      rw [Nat.cast_succ, sub_add_eq_sub_sub, sub_add_cancel]    have a := hx (t+1) (by omega) ht    rw [e1] at a    exact a.symm.reachable.trans (hb (t+1) (by omega) ht)open scoped Fin.NatCast intheorem in1252_sub_n (n : ℕ) (i : Fin (n+1)) : i - ((n : ℕ) : Fin (n+1)) = i + 1 := by  have : ((n : ℕ) : Fin (n+1)) = -1 := by    rw [eq_neg_iff_add_eq_zero]    have := Fin.natCast_self (n := n + 1)    push_cast at this    exact this  rw [this, sub_neg_eq_add]open scoped Fin.NatCast inopen scoped Fin.NatCast intheorem in1252_sub_ne (n : ℕ) (i : Fin (n+1)) (s : ℕ) (h1 : 1 ≤ s) (h2 : s ≤ n) :    i - (s : Fin (n+1)) ≠ i := by  intro h  have : ((s : ℕ) : Fin (n+1)) = 0 := by    have := congrArg (fun x => i - x) h    simpa using this  rw [Fin.natCast_eq_zero] at this  obtain ⟨c, hc⟩ := this  rcases c with _ | c  · omega  · nlinariththeorem in1252_cross (n : ℕ) (j : Fin (n+1)) : (in1252_G n).Adj (j, (2,2)) (j + 1, (3,0)) := by  right; simp [in1252_mate, in1252_blk, in1252_m2, in1252_mq, in1252_mr]open scoped Fin.NatCast intheorem in1252_connected (n : ℕ) : (in1252_G n).Connected := by  have hr := in1252_ring (in1252_G n) 0    (fun s _ _ => in1252_chain_reach _ _ _ (in1252_hH_G n _) _ _ _ in1252_trav_ok)    (fun s _ _ => in1252_cross n _)  have hall : ∀ u : in1252_W n, (in1252_G n).Reachable (0, (3,0)) u := by    rintro ⟨j, a⟩    have h1 := hr ((0 : Fin (n+1)) - j).val (by omega)    rw [Fin.cast_val_eq_self, sub_sub_cancel] at h1    exact h1.trans (in1252_chain_reach _ _ _ (in1252_hH_G n j) _ _ _ (in1252_bpath_ok a))  have : Nonempty (in1252_W n) := ⟨(0, (0,0))⟩  exact ⟨fun u w => (hall u).symm.trans (hall w)⟩theorem in1252_delE_adj {n : ℕ} (E : Sym2 (in1252_W n)) {x y : in1252_W n}    (h : (in1252_G n).Adj x y) (hne : s(x, y) ≠ E) : ((in1252_G n).deleteEdges {E}).Adj x y := by  rw [SimpleGraph.deleteEdges_adj]; exact ⟨h, fun he => hne (Set.mem_singleton_iff.mp he)⟩theorem in1252_hH_snd (n : ℕ) (i : Fin (n+1)) (E : Sym2 (in1252_W n)) (d : Sym2 (Fin 4 × Fin 4))    (hd : Sym2.map Prod.snd E = d) :    ∀ x z, in1252_iadj x z = true → s(x, z) ≠ d →      ((in1252_G n).deleteEdges {E}).Adj (i, x) (i, z) := by  subst hd; exact in1252_hH_del_snd n i Etheorem in1252_ne_of_snd {n : ℕ} {E E' : Sym2 (in1252_W n)}    (h : Sym2.map Prod.snd E ≠ Sym2.map Prod.snd E') : E ≠ E' := fun h' => h (h' ▸ rfl)open scoped Fin.NatCast intheorem in1252_ringY (n : ℕ) (hn : 1 ≤ n) (j : Fin (n+1)) :    ((in1252_G n).deleteEdges {s((j, (2,2)), (j + 1, (3,0)))}).Reachable (j, (2,2)) (j + 1, (3,0)) := by  have hH : ∀ i : Fin (n+1), ∀ x z, in1252_iadj x z = true → s(x, z) ≠ in1252_p0 →      ((in1252_G n).deleteEdges {s((j, (2,2)), (j + 1, (3,0)))}).Adj (i, x) (i, z) :=    fun i => in1252_hH_snd n i _ _ (by simp)  have hr := in1252_ring ((in1252_G n).deleteEdges {s((j, (2,2)), (j + 1, (3,0)))}) j    (fun s _ _ => in1252_chain_reach _ _ _ (hH _) _ _ _ in1252_trav_ok)    (fun s hs1 hs2 => in1252_delE_adj _ (in1252_cross n _) (by      intro he      rcases Sym2.eq_iff.mp he with ⟨h1, -⟩ | ⟨h1, -⟩      · exact in1252_sub_ne n j s hs1 hs2 (congrArg Prod.fst h1)      · exact absurd (congrArg Prod.snd h1) (by dsimp only; decide)))  have := hr n le_rfl  rw [in1252_sub_n] at this  exact (in1252_chain_reach _ _ _ (hH j) _ _ _ in1252_trav_ok).trans thisopen scoped Fin.NatCast intheorem in1252_ringX (n : ℕ) (hn : 1 ≤ n) (i : Fin (n+1)) :    ((in1252_G n).deleteEdges {s((i, (2,3)), (i, (3,1)))}).Reachable (i, (2,3)) (i, (3,1)) := by  have hr := in1252_ring ((in1252_G n).deleteEdges {s((i, (2,3)), (i, (3,1)))}) i    (fun s hs1 hs2 => in1252_chain_reach _ _ _      (in1252_hH_del_fst n (i - s) i (in1252_sub_ne n i s hs1 hs2) _ _) _ _ _ in1252_trav_ok)    (fun s _ _ => in1252_delE_adj _ (in1252_cross n _)      (in1252_ne_of_snd (by simp only [Sym2.map_mk]; decide)))  have := hr n le_rfl  rw [in1252_sub_n] at this  have a1 := in1252_chain_reach ((in1252_G n).deleteEdges {s((i, (2,3)), (i, (3,1)))}) i    s((2,3),(3,1)) (in1252_hH_snd n i _ _ (by simp)) (3,1) [(3,0)] (3,0) (by decide)  have a2 := (in1252_delE_adj s((i, (2,3)), (i, (3,1))) (in1252_cross n i)      (in1252_ne_of_snd (by simp only [Sym2.map_mk]; decide))).symm  have a3 := in1252_chain_reach ((in1252_G n).deleteEdges {s((i, (2,3)), (i, (3,1)))}) i    s((2,3),(3,1)) (in1252_hH_snd n i _ _ (by simp)) (2,2) [(2,3)] (2,3) (by decide)  exact (a1.trans (this.trans (a2.reachable.trans a3))).symmtheorem in1252_not_bridge (n : ℕ) (hn : 1 ≤ n) (e : Sym2 (in1252_W n)) : ¬ (in1252_G n).IsBridge e := by  induction e using Sym2.ind with  | _ u w =>  rw [SimpleGraph.isBridge_iff, not_not]  by_cases hadj : (in1252_G n).Adj u w  · obtain ⟨i, a⟩ := u    obtain ⟨j, b⟩ := w    rcases hadj with ⟨h1, h2 | h2⟩ | h    · simp only at h1 h2      subst h1 h2      exact in1252_chain_reach _ i _ (in1252_hH_snd n i _ _ (by simp)) _ _ _ (in1252_cyc_ok a)    · simp only at h1 h2      subst h1 h2      rw [Sym2.eq_swap]      exact (in1252_chain_reach _ i _ (in1252_hH_snd n i _ _ (by simp)) _ _ _ (in1252_cyc_ok b)).symm    · simp only [in1252_mate, Prod.mk.injEq] at h      obtain ⟨rfl, rfl⟩ := h      by_cases h22 : a = (2,2)      · subst h22        simpa [in1252_blk, in1252_m2, in1252_mq, in1252_mr] using in1252_ringY n hn i      by_cases h30 : a = (3,0)      · subst h30        have := in1252_ringY n hn (i - 1)        rw [sub_add_cancel] at this        simp only [in1252_blk, in1252_m2, in1252_mq, in1252_mr]        norm_num        rw [Sym2.eq_swap]; exact this.symm      have hb : in1252_blk n a i = i := by simp [in1252_blk, h22, h30]      rw [hb]      by_cases h23 : a = (2,3)      · subst h23        simpa [in1252_m2, in1252_mq, in1252_mr] using in1252_ringX n hn i      by_cases h31 : a = (3,1)      · subst h31        simp only [in1252_m2, in1252_mq, in1252_mr]        norm_num        rw [Sym2.eq_swap]; exact (in1252_ringX n hn i).symm      exact in1252_chain_reach _ i _ (in1252_hH_snd n i _ _ (by simp)) _ _ _        (in1252_mpath_ok a h22 h30 h23 h31)  · have hdel : (in1252_G n).deleteEdges {s(u, w)} = in1252_G n := by      ext x y      rw [SimpleGraph.deleteEdges_adj]      constructor      · exact fun h => h.1      · intro h        refine ⟨h, ?_⟩        intro he        rw [Set.mem_singleton_iff] at he        apply hadj        rw [← SimpleGraph.mem_edgeSet, ← he]        exact h    rw [hdel]    exact (in1252_connected n).preconnected u wtheorem in1252_cs_iff : ∀ a b : Fin 4 × Fin 4, a = in1252_cs b ↔ b = (a.1, a.2 - 1) := by decidetheorem in1252_distinct : ∀ a : Fin 4 × Fin 4, in1252_cs a ≠ (a.1, a.2 - 1) ∧    in1252_m2 a ≠ in1252_cs a ∧ in1252_m2 a ≠ (a.1, a.2 - 1) := by decidetheorem in1252_nbr (n : ℕ) (u : in1252_W n) : (in1252_G n).neighborFinset u =    {(u.1, in1252_cs u.2), (u.1, (u.2.1, u.2.2 - 1)), in1252_mate n u} := by  ext w  rw [SimpleGraph.mem_neighborFinset, in1252_adj]  simp only [Finset.mem_insert, Finset.mem_singleton]  rw [in1252_cs_iff u.2 w.2]  constructor  · rintro (⟨h1, h2 | h2⟩ | h)    · left; exact Prod.ext h1.symm h2    · right; left; exact Prod.ext h1.symm h2    · right; right; exact h.symm  · rintro (h | h | h)    · left; rw [h]; exact ⟨rfl, Or.inl rfl⟩    · left; rw [h]; exact ⟨rfl, Or.inr rfl⟩    · right; exact h.symmtheorem in1252_regular (n : ℕ) : (in1252_G n).IsRegularOfDegree 3 := by  intro u  rw [← SimpleGraph.card_neighborFinset_eq_degree, in1252_nbr]  obtain ⟨d1, d2, d3⟩ := in1252_distinct u.2  rw [Finset.card_insert_of_notMem, Finset.card_pair]  · intro h; exact d3 (congrArg Prod.snd h).symm  · simp only [Finset.mem_insert, Finset.mem_singleton, not_or]    exact ⟨fun h => d1 (congrArg Prod.snd h), fun h => d2 (congrArg Prod.snd h).symm⟩def in1252_blockcut (f : Fin 4 × Fin 4 → Bool) : ℕ :=  ∑ a : Fin 4 × Fin 4, ((if f a ≠ f (in1252_cs a) then 1 else 0) +    (if f a ≠ f (a.1, a.2 - 1) then 1 else 0))def in1252_F (x0 x1 x2 x3 x4 x5 x6 x7 x8 : Bool) (a : Fin 4 × Fin 4) : Bool :=  ![![x0,x1,x0,x2],![x3,x4,x3,x5],![x5,x4,x7,x6],![x8,x6,x1,x2]] a.1 a.2set_option maxRecDepth 10000 intheorem in1252_F_bound : ∀ x0 x1 x2 x3 x4 x5 x6 x7 x8 : Bool,    in1252_blockcut (in1252_F x0 x1 x2 x3 x4 x5 x6 x7 x8) ≤ 24 := by  decidetheorem in1252_bits_cut : in1252_blockcut in1252_bits = 24 := by decidetheorem in1252_blockcut_bound (f : Fin 4 × Fin 4 → Bool)    (key : ∀ a, a ≠ (2,2) → a ≠ (3,0) → f (in1252_m2 a) = f a) : in1252_blockcut f ≤ 24 := by  have h : f = in1252_F (f (0,0)) (f (0,1)) (f (0,3)) (f (1,0)) (f (1,1)) (f (1,3)) (f (2,3))      (f (2,2)) (f (3,0)) := by    have k := fun a h1 h2 => (key a h1 h2).symm    funext a    obtain ⟨q, r⟩ := a    fin_cases q <;> fin_cases r <;>      simp [in1252_F, in1252_m2, in1252_mq, in1252_mr] at k ⊢    all_goals first      | rfl      | (have := k 0 0 (by decide) (by decide); simpa using this.symm)      | (have := k 0 1 (by decide) (by decide); simpa using this.symm)      | (have := k 0 3 (by decide) (by decide); simpa using this.symm)      | (have := k 1 0 (by decide) (by decide); simpa using this.symm)      | (have := k 1 1 (by decide) (by decide); simpa using this.symm)      | (have := k 1 3 (by decide) (by decide); simpa using this.symm)      | (have := k 2 3 (by decide) (by decide); simpa using this.symm)  rw [h]; exact in1252_F_bound _ _ _ _ _ _ _ _ _theorem in1252_cnt (n : ℕ) (β : in1252_W n → Bool) (hβ : ∀ u, β (in1252_mate n u) = β u)    (u : in1252_W n) :    (((in1252_G n).neighborFinset u).filter (fun v => β u ≠ β v)).card =      (if β u ≠ β (u.1, in1252_cs u.2) then 1 else 0) +      (if β u ≠ β (u.1, (u.2.1, u.2.2 - 1)) then 1 else 0) := by  obtain ⟨d1, d2, d3⟩ := in1252_distinct u.2  rw [in1252_nbr, Finset.card_filter, Finset.sum_insert, Finset.sum_insert, Finset.sum_singleton, hβ]  · simp  · simp only [Finset.mem_singleton]    intro h; exact d3 (congrArg Prod.snd h).symm  · simp only [Finset.mem_insert, Finset.mem_singleton, not_or]    exact ⟨fun h => d1 (congrArg Prod.snd h), fun h => d2 (congrArg Prod.snd h).symm⟩theorem in1252_cut_eq (n : ℕ) (β : in1252_W n → Bool) (hβ : ∀ u, β (in1252_mate n u) = β u) :    (∑ u : in1252_W n, (((in1252_G n).neighborFinset u).filter (fun v => β u ≠ β v)).card) =      ∑ i : Fin (n+1), in1252_blockcut (fun a => β (i, a)) := by  rw [Finset.sum_congr rfl (fun u _ => in1252_cnt n β hβ u), Fintype.sum_prod_type]  rfltheorem in1252_bits_m2 : ∀ a, in1252_bits (in1252_m2 a) = in1252_bits a := by decidetheorem in1252_mate_nonport (n : ℕ) (i : Fin (n+1)) (a : Fin 4 × Fin 4) (h1 : a ≠ (2,2))    (h2 : a ≠ (3,0)) : in1252_mate n (i, a) = (i, in1252_m2 a) := by  simp [in1252_mate, in1252_blk, h1, h2]theorem in1252_maxcut (n : ℕ) (β : in1252_W n → Bool) (hβ : ∀ u, β (in1252_mate n u) = β u) :    (∑ u : in1252_W n, (((in1252_G n).neighborFinset u).filter (fun v => β u ≠ β v)).card) ≤    (∑ u : in1252_W n, (((in1252_G n).neighborFinset u).filter      (fun v => in1252_bits u.2 ≠ in1252_bits v.2)).card) := by  rw [in1252_cut_eq n β hβ, in1252_cut_eq n (fun u => in1252_bits u.2)    (fun u => in1252_bits_m2 u.2)]  apply Finset.sum_le_sum  intro i _  rw [show (fun a => in1252_bits (i, a).2) = in1252_bits from rfl, in1252_bits_cut]  apply in1252_blockcut_bound  intro a h1 h2  have := hβ (i, a)  rwa [in1252_mate_nonport n i a h1 h2] at thistheorem in1252_tri : ∀ r0 r1 r2 : Fin 4, (r1 = r0 + 1 ∨ r0 = r1 + 1) → (r2 = r1 + 1 ∨ r1 = r2 + 1) →    (r0 = r2 + 1 ∨ r2 = r0 + 1) → False := by decidetheorem in1252_quad : ∀ q r0 r1 r2 r3 : Fin 4, r0 ≠ r1 → r0 ≠ r2 → r0 ≠ r3 → r1 ≠ r2 → r1 ≠ r3 →    r2 ≠ r3 → in1252_bits (q, r1) = in1252_bits (q, r0) → in1252_bits (q, r2) = in1252_bits (q, r0) →    in1252_bits (q, r3) = in1252_bits (q, r0) → False := by decideopen scoped Fin.NatCast intheorem in1252_cycles (n m : ℕ) [NeZero m] (hm : 3 ≤ m) (p : Fin m → in1252_W n)    (hp : Function.Injective p) (hadj : ∀ i, (in1252_G n).Adj (p i) (p (i+1)))    (hM : ∀ i, in1252_mate n (p i) ≠ p (i+1))    (hb : ∀ i, in1252_bits (p i).2 = in1252_bits (p 0).2) : False := by  have hs : ∀ i, (p (i+1)).1 = (p i).1 ∧ (p (i+1)).2.1 = (p i).2.1 ∧      ((p (i+1)).2.2 = (p i).2.2 + 1 ∨ (p i).2.2 = (p (i+1)).2.2 + 1) := by    intro i    rcases hadj i with ⟨h1, h2 | h2⟩ | h    · simp only [in1252_cs, Prod.ext_iff] at h2      exact ⟨h1.symm, h2.1, Or.inl h2.2⟩    · simp only [in1252_cs, Prod.ext_iff] at h2      exact ⟨h1.symm, h2.1.symm, Or.inr h2.2⟩    · exact absurd h (hM i)  have hblk : ∀ j : ℕ, (p (j : Fin m)).1 = (p 0).1 ∧ (p (j : Fin m)).2.1 = (p 0).2.1 := by    intro j    induction j with    | zero => simp    | succ j ih =>      rw [Nat.cast_succ]      exact ⟨(hs _).1.trans ih.1, (hs _).2.1.trans ih.2⟩  have hblk' : ∀ i : Fin m, (p i).1 = (p 0).1 ∧ (p i).2.1 = (p 0).2.1 := by    intro i    have := hblk i.val    rwa [Fin.cast_val_eq_self] at this  have hr : Function.Injective (fun i => (p i).2.2) := by    intro i j hij    apply hp    exact Prod.ext ((hblk' i).1.trans (hblk' j).1.symm)      (Prod.ext ((hblk' i).2.trans (hblk' j).2.symm) hij)  have hm4 : m ≤ 4 := by    have := Fintype.card_le_of_injective _ hr    simpa using this  have hbits : ∀ i, in1252_bits ((p 0).2.1, (p i).2.2) = in1252_bits ((p 0).2.1, (p 0).2.2) := by    intro i    have e1 : (p i).2 = ((p 0).2.1, (p i).2.2) := Prod.ext (hblk' i).2 rfl    rw [← e1]; exact hb i  interval_cases m  · have a0 := (hs 0).2.2    have a1 := (hs 1).2.2    have a2 := (hs 2).2.2    simp only [show (0 : Fin 3) + 1 = 1 from rfl, show (1 : Fin 3) + 1 = 2 from rfl,      show (2 : Fin 3) + 1 = 0 from rfl] at a0 a1 a2    exact in1252_tri _ _ _ a0 a1 a2  · have d : ∀ i j : Fin 4, i ≠ j → (p i).2.2 ≠ (p j).2.2 := fun i j h h' => h (hr h')    exact in1252_quad _ _ _ _ _ (d 0 1 (by simp)) (d 0 2 (by simp)) (d 0 3 (by simp))      (d 1 2 (by simp)) (d 1 3 (by simp)) (d 2 3 (by simp)) (hbits 1) (hbits 2) (hbits 3)theorem in1252_pigeon (n : ℕ) (β : in1252_W n → Bool) (hβ : ∀ u, β (in1252_mate n u) = β u)    (hc : (Finset.univ.filter fun u : in1252_W n => β u ≠ in1252_bits u.2).card < 2 * (n+1)) :    ∃ i, ∀ a, a ≠ (2,2) → a ≠ (3,0) → β (i, a) = in1252_bits a := by  by_contra H  push Not at H  rw [Finset.card_filter, Fintype.sum_prod_type] at hc  have h2 : ∀ i : Fin (n+1), 2 ≤ ∑ a : Fin 4 × Fin 4, if β (i, a) ≠ in1252_bits (i, a).2 then 1 else 0 := by    intro i    obtain ⟨a, h1, h2, h3⟩ := H i    have hm : β (i, in1252_m2 a) ≠ in1252_bits (in1252_m2 a) := by      rw [← in1252_mate_nonport n i a h1 h2, hβ, in1252_bits_m2]; exact h3    have hne : a ≠ in1252_m2 a := fun h => (in1252_m2_ne a).1 h.symm    calc 2 = ∑ x ∈ ({a, in1252_m2 a} : Finset _),          (if β (i, x) ≠ in1252_bits (i, x).2 then 1 else 0) := by            rw [Finset.sum_pair hne]; simp [h3, hm]      _ ≤ _ := Finset.sum_le_sum_of_subset (Finset.subset_univ _)  have := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => h2 i)  simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul] at this hc  omegasection generic2variable {V : Type*} {G : SimpleGraph V} [Fintype V] [DecidableRel G.Adj]theorem in1252_third_edge (hreg : G.IsRegularOfDegree 3) {u : V} {e f : G.edgeSet}    (he : u ∈ (e : Sym2 V)) (hf : u ∈ (f : Sym2 V)) :    ∃ g : G.edgeSet, u ∈ (g : Sym2 V) ∧ g ≠ e ∧ g ≠ f := by  obtain ⟨w1, hw1, h1⟩ := in1252_other he  obtain ⟨w2, hw2, h2⟩ := in1252_other hf  obtain ⟨w3, hw3, n1, n2⟩ := in1252_third hreg u w1 w2  refine ⟨⟨s(u, w3), hw3⟩, Sym2.mem_mk_left _ _, ?_, ?_⟩  · intro h; apply in1252_edge_ne hw3 hw1 n1; rw [h]; exact Subtype.ext h1  · intro h; apply in1252_edge_ne hw3 hw2 n2; rw [h]; exact Subtype.ext h2end generic2section transportvariable (n : ℕ) {V : Type*} [Fintype V] [DecidableEq V] (e : V ≃ in1252_W n)abbrev in1252_GV : SimpleGraph V := (in1252_G n).comap einstance in1252_GV_dec : DecidableRel (in1252_GV n e).Adj := fun u w =>  inferInstanceAs (Decidable ((in1252_G n).Adj (e u) (e w)))def in1252_MV : Finset (Sym2 V) := Finset.univ.image (fun u => s(u, e.symm (in1252_mate n (e u))))theorem in1252_mem_MV (x y : V) : s(x, y) ∈ in1252_MV n e ↔ in1252_mate n (e x) = e y := by  simp only [in1252_MV, Finset.mem_image, Finset.mem_univ, true_and]  constructor  · rintro ⟨u, hu⟩    rcases Sym2.eq_iff.mp hu with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩    · simp    · simp [in1252_mate_mate]  · intro h    exact ⟨x, by rw [h]; simp⟩theorem in1252_MV_const (b' : V → Bool) (hb : ∀ u v, s(u, v) ∈ in1252_MV n e → b' u = b' v) :    ∀ w, b' (e.symm (in1252_mate n w)) = b' (e.symm w) := by  intro w  refine (hb _ _ ((in1252_mem_MV n e _ _).2 ?_)).symm  simptheorem in1252_nbr_card (u : V) (Q : V → Prop) [DecidablePred Q] :    (((in1252_GV n e).neighborFinset u).filter Q).card =      (((in1252_G n).neighborFinset (e u)).filter (fun w => Q (e.symm w))).card := by  apply Finset.card_nbij' (fun v => e v) (fun w => e.symm w)  · intro v hv    simp only [Finset.coe_filter, Set.mem_setOf_eq, SimpleGraph.mem_neighborFinset] at hv ⊢    exact ⟨hv.1, by simpa using hv.2⟩  · intro w hw    simp only [Finset.coe_filter, Set.mem_setOf_eq, SimpleGraph.mem_neighborFinset] at hw ⊢    exact ⟨by simpa using hw.1, hw.2⟩  · intro v _; simp  · intro w _; simptheorem in1252_cutV (b' : V → Bool) :    (∑ u : V, (((in1252_GV n e).neighborFinset u).filter fun v => b' u ≠ b' v).card) =    ∑ w : in1252_W n, (((in1252_G n).neighborFinset w).filter      fun x => b' (e.symm w) ≠ b' (e.symm x)).card := by  rw [← Equiv.sum_comp e.symm]  apply Finset.sum_congr rfl  intro w _  rw [in1252_nbr_card, Equiv.apply_symm_apply]end transportdef in1252_L : Fin 25 → Fin 18 := ![0,0,0,1,1,2,3,4,4,4,5,5,6,7,8,8,9,10,10,11,12,12,12,13,14]def in1252_R : Fin 25 → Fin 18 := ![1,2,3,2,14,3,15,5,6,7,6,9,7,8,9,11,10,11,16,13,13,15,17,14,15]def in1252_M0 : Finset (Fin 25) := {1,4,6,8,11,13,18,19,22}def in1252_bit (x y : Bool) : Fin 18 → Bool :=  ![true,false,true,false,true,false,true,false,false,false,x,false,y,false,false,false,x,y]def in1252_tau : Fin 18 → Fin 4 × Fin 4 :=  ![(0,0),(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(1,3),(2,0),(2,1),(2,2),(2,3),(3,0),(3,1),(3,2),(3,3),    (0,0),(0,0)]def in1252_lab (a : Fin 4 × Fin 4) : Fin 18 :=  ![![0,1,2,3],![4,5,6,7],![8,9,10,11],![12,13,14,15]] a.1 a.2def in1252_psi0 (n : ℕ) (i0 : Fin (n+1)) (v : Fin 18) : in1252_W n :=  if v.val < 16 then (i0, in1252_tau v) else if v = 16 then (i0 + 1, (3,0)) else (i0 - 1, (2,2))def in1252_kappa (n : ℕ) (i0 : Fin (n+1)) (w : in1252_W n) : Fin 18 :=  if w.1 = i0 then in1252_lab w.2 else if w.2 = (3,0) then 16 else 17theorem in1252_lab_tau : ∀ v : Fin 18, v.val < 16 → in1252_lab (in1252_tau v) = v := by decidetheorem in1252_succ_ne (n : ℕ) (hn : 1 ≤ n) (i : Fin (n+1)) : i + 1 ≠ i := by  intro h  have : (1 : Fin (n+1)) = 0 := by simpa using congrArg (· - i) h  rw [Fin.one_eq_zero_iff] at this; omegatheorem in1252_pred_ne (n : ℕ) (hn : 1 ≤ n) (i : Fin (n+1)) : i - 1 ≠ i := by  intro h  apply in1252_succ_ne n hn (i - 1)  rw [sub_add_cancel, h]theorem in1252_kappa_psi (n : ℕ) (hn : 1 ≤ n) (i0 : Fin (n+1)) (v : Fin 18) :    in1252_kappa n i0 (in1252_psi0 n i0 v) = v := by  by_cases hv : v.val < 16  · simp [in1252_psi0, in1252_kappa, hv, in1252_lab_tau v hv]  by_cases h16 : v = 16  · subst h16    simp [in1252_psi0, in1252_kappa, in1252_succ_ne n hn i0]  · have h17 : v = 17 := by      apply Fin.ext; have := v.isLt; have : v.val ≠ 16 := fun h => h16 (Fin.ext h); simp; omega    subst h17    simp [in1252_psi0, in1252_kappa, in1252_pred_ne n hn i0]theorem in1252_obs_int : ∀ t : Fin 25, t ≠ 18 → t ≠ 22 → (in1252_L t).val < 16 ∧    (in1252_R t).val < 16 ∧ in1252_iadj (in1252_tau (in1252_L t)) (in1252_tau (in1252_R t)) = true ∧    ((t ∈ in1252_M0) ↔ in1252_m2 (in1252_tau (in1252_L t)) = in1252_tau (in1252_R t)) ∧    (in1252_tau (in1252_L t) = (2,2) → in1252_tau (in1252_R t) ≠ (3,0)) ∧    (in1252_tau (in1252_L t) = (3,0) → in1252_tau (in1252_R t) ≠ (2,2)) := by decidetheorem in1252_obs_inj : ∀ t t' : Fin 25, (in1252_L t = in1252_L t' ∧ in1252_R t = in1252_R t') ∨    (in1252_L t = in1252_R t' ∧ in1252_R t = in1252_L t') → t = t' := by decidetheorem in1252_obs_bits : ∀ x y : Bool, ∀ v : Fin 18, v.val < 16 → v ≠ 10 → v ≠ 12 →    in1252_bit x y v = in1252_bits (in1252_tau v) ∧ in1252_tau v ≠ (2,2) ∧ in1252_tau v ≠ (3,0) := by  decidetheorem in1252_mate_iff (n : ℕ) (hn : 1 ≤ n) (i0 : Fin (n+1)) (a b : Fin 4 × Fin 4)    (h1 : a = (2,2) → b ≠ (3,0)) (h2 : a = (3,0) → b ≠ (2,2)) :    in1252_mate n (i0, a) = (i0, b) ↔ in1252_m2 a = b := by  by_cases h22 : a = (2,2)  · subst h22    have := h1 rfl    simp only [in1252_mate, in1252_blk, if_true, Prod.mk.injEq, in1252_succ_ne n hn i0, false_and,      false_iff]    simp [in1252_m2, in1252_mq, in1252_mr]; exact fun h => absurd h.symm this  by_cases h30 : a = (3,0)  · subst h30    have := h2 rfl    simp only [in1252_mate, in1252_blk, Prod.mk.injEq, in1252_pred_ne n hn i0, false_and,      false_iff]    simp [in1252_m2, in1252_mq, in1252_mr]; exact fun h => absurd h.symm this  · simp [in1252_mate, in1252_blk, h22, h30]theorem in1252_psi_10 (n : ℕ) (i0 : Fin (n+1)) : in1252_psi0 n i0 10 = (i0, (2,2)) := by  simp [in1252_psi0, in1252_tau]theorem in1252_psi_12 (n : ℕ) (i0 : Fin (n+1)) : in1252_psi0 n i0 12 = (i0, (3,0)) := by  simp [in1252_psi0, in1252_tau]theorem in1252_psi_16 (n : ℕ) (i0 : Fin (n+1)) : in1252_psi0 n i0 16 = (i0 + 1, (3,0)) := by  simp [in1252_psi0]theorem in1252_psi_17 (n : ℕ) (i0 : Fin (n+1)) : in1252_psi0 n i0 17 = (i0 - 1, (2,2)) := by  simp [in1252_psi0]theorem in1252_psi_lt (n : ℕ) (i0 : Fin (n+1)) (v : Fin 18) (hv : v.val < 16) :    in1252_psi0 n i0 v = (i0, in1252_tau v) := by  simp [in1252_psi0, hv]theorem in1252_mate16 (n : ℕ) (i0 : Fin (n+1)) :    in1252_mate n (in1252_psi0 n i0 10) = in1252_psi0 n i0 16 := by  rw [in1252_psi_10, in1252_psi_16]; simp [in1252_mate, in1252_blk, in1252_m2, in1252_mq, in1252_mr]theorem in1252_mate17 (n : ℕ) (i0 : Fin (n+1)) :    in1252_mate n (in1252_psi0 n i0 12) = in1252_psi0 n i0 17 := by  rw [in1252_psi_12, in1252_psi_17]; simp [in1252_mate, in1252_blk, in1252_m2, in1252_mq, in1252_mr]theorem in1252_psi_adj (n : ℕ) (i0 : Fin (n+1)) (t : Fin 25) :    (in1252_G n).Adj (in1252_psi0 n i0 (in1252_L t)) (in1252_psi0 n i0 (in1252_R t)) := by  by_cases h18 : t = 18  · subst h18    show (in1252_G n).Adj (in1252_psi0 n i0 10) (in1252_psi0 n i0 16)    rw [← in1252_mate16]; exact Or.inr rfl  by_cases h22 : t = 22  · subst h22    show (in1252_G n).Adj (in1252_psi0 n i0 12) (in1252_psi0 n i0 17)    rw [← in1252_mate17]; exact Or.inr rfl  obtain ⟨hl, hr, ha, -⟩ := in1252_obs_int t h18 h22  rw [in1252_psi_lt n i0 _ hl, in1252_psi_lt n i0 _ hr]  exact in1252_iadj_G n i0 _ _ hatheorem in1252_psi_M (n : ℕ) (hn : 1 ≤ n) (i0 : Fin (n+1)) (t : Fin 25) :    in1252_mate n (in1252_psi0 n i0 (in1252_L t)) = in1252_psi0 n i0 (in1252_R t) ↔ t ∈ in1252_M0 := by  by_cases h18 : t = 18  · subst h18    exact iff_of_true (in1252_mate16 n i0) (by decide)  by_cases h22 : t = 22  · subst h22    exact iff_of_true (in1252_mate17 n i0) (by decide)  obtain ⟨hl, hr, -, hM, h1, h2⟩ := in1252_obs_int t h18 h22  rw [in1252_psi_lt n i0 _ hl, in1252_psi_lt n i0 _ hr, in1252_mate_iff n hn i0 _ _ h1 h2, hM]section corevariable (n : ℕ) {V : Type*} [Fintype V] [DecidableEq V] (e : V ≃ in1252_W n)theorem in1252_regV : (in1252_GV n e).IsRegularOfDegree 3 := by  intro v  rw [← (SimpleGraph.Iso.comap e (in1252_G n)).degree_eq v]  exact in1252_regular n _theorem in1252_repair (hn : 1 ≤ n) (b' : V → Bool)    (hb' : ∀ u v, s(u, v) ∈ in1252_MV n e → b' u = b' v)    (i0 : Fin (n+1)) (hi0 : ∀ a, a ≠ (2,2) → a ≠ (3,0) → b' (e.symm (i0, a)) = in1252_bits a) :    ¬ ∃ (c : (in1252_GV n e).edgeSet → Fin 6) (h : V → (in1252_GV n e).edgeSet → Fin 6),      truncation_local_states_define_strong_coloring        (fun E : (in1252_GV n e).edgeSet => (E : Sym2 V)) (fun _ E => c E) h ∧      (∀ u (E : (in1252_GV n e).edgeSet), u ∈ (E : Sym2 V) → (E : Sym2 V) ∈ in1252_MV n e →        c E = if b' u then 1 else 0) ∧      (∀ E : (in1252_GV n e).edgeSet, (E : Sym2 V) ∉ in1252_MV n e → 2 ≤ (c E).val) ∧      (∀ u v (E : (in1252_GV n e).edgeSet), (E : Sym2 V) = s(u,v) →        ¬ (h u E = (if b' u then 0 else 1) ∧ h v E = (if b' v then 0 else 1))) ∧      (∀ u v (E : (in1252_GV n e).edgeSet), (E : Sym2 V) = s(u,v) →        (E : Sym2 V) ∉ in1252_MV n e →        h u E ≠ (if b' u then 0 else 1) → h v E ≠ (if b' v then 0 else 1) →        c E = 2 ∨ c E = 3) := by  rintro ⟨c, h, hT, hm, hf, hx, hg⟩  let ψ : Fin 18 → V := fun v => e.symm (in1252_psi0 n i0 v)  have hadj : ∀ t, (in1252_GV n e).Adj (ψ (in1252_L t)) (ψ (in1252_R t)) := by    intro t    show (in1252_G n).Adj (e (e.symm _)) (e (e.symm _))    simp only [Equiv.apply_symm_apply]    exact in1252_psi_adj n i0 t  let φ : Fin 25 → (in1252_GV n e).edgeSet := fun t => ⟨s(ψ (in1252_L t), ψ (in1252_R t)), hadj t⟩  have hmem : ∀ v t, v ∈ s(in1252_L t, in1252_R t) → ψ v ∈ (φ t : Sym2 V) := by    intro v t hv    rcases Sym2.mem_iff.mp hv with rfl | rfl    · exact Sym2.mem_mk_left _ _    · exact Sym2.mem_mk_right _ _  have hkap : ∀ v, in1252_kappa n i0 (e (ψ v)) = v := by    intro v; simp only [ψ, Equiv.apply_symm_apply]; exact in1252_kappa_psi n hn i0 v  have hinj : ∀ t t', t ≠ t' → φ t ≠ φ t' := by    intro t t' hne heq    apply hne    have := congrArg (fun E : (in1252_GV n e).edgeSet =>      Sym2.map (fun v => in1252_kappa n i0 (e v)) E.val) heq    simp only [φ, Sym2.map_mk, hkap] at this    exact in1252_obs_inj t t' (Sym2.eq_iff.mp this)  have hM : ∀ t, (φ t : Sym2 V) ∈ in1252_MV n e ↔ t ∈ in1252_M0 := by    intro t    show s(ψ (in1252_L t), ψ (in1252_R t)) ∈ in1252_MV n e ↔ _    rw [in1252_mem_MV]    simp only [ψ, Equiv.apply_symm_apply]    exact in1252_psi_M n hn i0 t  have hreg := in1252_regV n e  have hbit : ∀ v, in1252_bit (b' (ψ 10)) (b' (ψ 12)) v = b' (ψ v) := by    intro v    by_cases hv : v.val < 16    · by_cases h10 : v = 10      · subst h10; rfl      by_cases h12 : v = 12      · subst h12; rfl      obtain ⟨hb1, hb2, hb3⟩ := in1252_obs_bits (b' (ψ 10)) (b' (ψ 12)) v hv h10 h12      rw [hb1]      show _ = b' (e.symm (in1252_psi0 n i0 v))      rw [in1252_psi_lt n i0 v hv, hi0 _ hb2 hb3]    by_cases h16 : v = 16    · subst h16      show b' (ψ 10) = b' (ψ 16)      apply hb'      rw [in1252_mem_MV]      simp only [ψ, Equiv.apply_symm_apply]      exact in1252_mate16 n i0    · have h17 : v = 17 := by        apply Fin.ext; have := v.isLt; have : v.val ≠ 16 := fun h => h16 (Fin.ext h); simp; omega      subst h17      show b' (ψ 12) = b' (ψ 17)      apply hb'      rw [in1252_mem_MV]      simp only [ψ, Equiv.apply_symm_apply]      exact in1252_mate17 n i0  have hobs := op874_open_four_square_global_pair_local_obstruction (b' (ψ 10)) (b' (ψ 12))  apply hobs  refine ⟨fun t => c (φ t), fun v t => h (ψ v) (φ t), ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩  · intro v _ t t' hv ht' hne    exact in1252_L1 hT (hmem v t hv) (hmem v t' ht') (hinj t t' hne)  · intro v _ t t' hv ht' hne    obtain ⟨g, hg1, hg2, hg3⟩ := in1252_third_edge hreg (hmem v t hv) (hmem v t' ht')    exact in1252_L2 hT (hmem v t hv) (hmem v t' ht') hg1 (hinj t t' hne) hg2 hg3  · intro v _ t t' hv ht'    obtain ⟨g1, m1, n1, -⟩ := in1252_third_edge hreg (hmem v t hv) (hmem v t hv)    obtain ⟨g2, m2, n2, n3⟩ := in1252_third_edge hreg (hmem v t hv) m1    exact in1252_L3 hT (hmem v t hv) (hmem v t' ht') m1 m2 n1 n2 (Ne.symm n3)  · intro t _ _ f g hf hg hfe hge    have ha : ψ (in1252_L t) ∈ (φ t : Sym2 V) := Sym2.mem_mk_left _ _    have hb : ψ (in1252_R t) ∈ (φ t : Sym2 V) := Sym2.mem_mk_right _ _    have hfa := hmem _ f hf    have hgb := hmem _ g hg    obtain ⟨f', mf, nf1, nf2⟩ := in1252_third_edge hreg ha hfa    obtain ⟨g', mg, ng1, ng2⟩ := in1252_third_edge hreg hb hgb    exact in1252_L4 hT (hadj t).ne ha hb hfa mf hgb mg (hinj _ _ hfe) nf1 (Ne.symm nf2)      (hinj _ _ hge) ng1 (Ne.symm ng2)  · intro t ht    show c (φ t) = if in1252_bit (b' (ψ 10)) (b' (ψ 12)) (in1252_L t) then 1 else 0    rw [hbit]    exact hm _ _ (Sym2.mem_mk_left _ _) ((hM t).2 ht)  · intro t ht    exact hf _ (fun h' => ht ((hM t).1 h'))  · intro t _ _ _    show ¬ (h (ψ (in1252_L t)) (φ t) =        (if in1252_bit (b' (ψ 10)) (b' (ψ 12)) (in1252_L t) then 0 else 1) ∧      h (ψ (in1252_R t)) (φ t) =        (if in1252_bit (b' (ψ 10)) (b' (ψ 12)) (in1252_R t) then 0 else 1))    rw [hbit, hbit]    exact hx _ _ (φ t) rfl  · intro t ht h1 h2    have h1' : h (ψ (in1252_L t)) (φ t) ≠ (if b' (ψ (in1252_L t)) then 0 else 1) := by      rw [← hbit]; exact h1    have h2' : h (ψ (in1252_R t)) (φ t) ≠ (if b' (ψ (in1252_R t)) then 0 else 1) := by      rw [← hbit]; exact h2    exact hg _ _ (φ t) rfl (fun h' => ht ((hM t).1 h')) h1' h2'end coretheorem in1252_not_bridgeV (n : ℕ) (hn : 1 ≤ n) {V : Type*} (e : V ≃ in1252_W n) (E : Sym2 V) :    ¬ (in1252_GV n e).IsBridge E := by  induction E using Sym2.ind with  | _ u w =>  rw [SimpleGraph.isBridge_iff, not_not]  have hdel : (in1252_GV n e).deleteEdges {s(u, w)} =      ((in1252_G n).deleteEdges {s(e u, e w)}).comap e := by    ext x y    simp only [SimpleGraph.deleteEdges_adj, SimpleGraph.comap_adj, Set.mem_singleton_iff]    constructor <;> rintro ⟨h1, h2⟩ <;> refine ⟨h1, fun h3 => h2 ?_⟩    · have := congrArg (Sym2.map e.symm) h3; simpa using this    · have := congrArg (Sym2.map e) h3; simpa using this  rw [hdel]  have h := in1252_not_bridge n hn s(e u, e w)  rw [SimpleGraph.isBridge_iff, not_not] at h  exact (SimpleGraph.Iso.comap e _).reachable_iff.mp htheorem op874_open_square_block_family_unbounded_cut_repair :  ∀ k : ℕ, 2 ≤ k → Even k →  ∃ (G : SimpleGraph (Fin (16*k))) (dG : DecidableRel G.Adj),    letI : DecidableRel G.Adj := dG    ∃ (M : Finset (Sym2 (Fin (16*k)))) (b : Fin (16*k) → Bool),      G.Connected ∧ G.IsRegularOfDegree 3 ∧      (∀ e : G.edgeSet, ¬ G.IsBridge e.1) ∧ M ⊆ G.edgeFinset ∧      (∀ v : Fin (16*k), ∃! e : Sym2 (Fin (16*k)), e ∈ M ∧ v ∈ e) ∧      (∀ u v, s(u,v) ∈ M → b u = b v) ∧      (∀ b' : Fin (16*k) → Bool,        (∀ u v, s(u,v) ∈ M → b' u = b' v) →        (Finset.univ.sum fun u : Fin (16*k) =>          ((G.neighborFinset u).filter fun v => b' u ≠ b' v).card) ≤        (Finset.univ.sum fun u : Fin (16*k) =>          ((G.neighborFinset u).filter fun v => b u ≠ b v).card)) ∧      (∀ (n : ℕ), ∀ [NeZero n], 3 ≤ n →        ∀ p : Fin n → Fin (16*k), Function.Injective p →        (∀ i, G.Adj (p i) (p (i+1))) →        (∀ i, s(p i,p (i+1)) ∉ M) → ¬ (∀ i, b (p i) = b (p 0))) ∧      (∀ b' : Fin (16*k) → Bool,        (∀ u v, s(u,v) ∈ M → b' u = b' v) →        (Finset.univ.filter fun v : Fin (16*k) => b' v ≠ b v).card < 2*k →        ¬ ∃ (c : G.edgeSet → Fin 6) (h : Fin (16*k) → G.edgeSet → Fin 6),          truncation_local_states_define_strong_coloring            (fun e : G.edgeSet => (e : Sym2 (Fin (16*k)))) (fun _ e => c e) h ∧          (∀ u (e : G.edgeSet), u ∈ (e : Sym2 (Fin (16*k))) → (e : Sym2 (Fin (16*k))) ∈ M →            c e = if b' u then 1 else 0) ∧          (∀ e : G.edgeSet, (e : Sym2 (Fin (16*k))) ∉ M → 2 ≤ (c e).val) ∧          (∀ u v (e : G.edgeSet), (e : Sym2 (Fin (16*k))) = s(u,v) →            ¬ (h u e = (if b' u then 0 else 1) ∧ h v e = (if b' v then 0 else 1))) ∧          (∀ u v (e : G.edgeSet), (e : Sym2 (Fin (16*k))) = s(u,v) →            (e : Sym2 (Fin (16*k))) ∉ M →            h u e ≠ (if b' u then 0 else 1) → h v e ≠ (if b' v then 0 else 1) →            c e = 2 ∨ c e = 3)) := by  intro k hk _  obtain ⟨n, rfl⟩ : ∃ n, k = n + 1 := ⟨k - 1, by omega⟩  have hn : 1 ≤ n := by omega  obtain ⟨e⟩ : Nonempty (Fin (16 * (n+1)) ≃ in1252_W n) :=    ⟨Fintype.equivOfCardEq (by simp only [Fintype.card_fin, Fintype.card_prod]; ring)⟩  refine ⟨in1252_GV n e, in1252_GV_dec n e, in1252_MV n e, fun v => in1252_bits (e v).2,    (SimpleGraph.Iso.comap e (in1252_G n)).connected_iff.mpr (in1252_connected n),    in1252_regV n e, fun E => in1252_not_bridgeV n hn e E.1, ?_, ?_, ?_, ?_, ?_, ?_⟩  · intro E hE    rw [in1252_MV, Finset.mem_image] at hE    obtain ⟨u, -, rfl⟩ := hE    rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]    show (in1252_G n).Adj (e u) (e (e.symm (in1252_mate n (e u))))    rw [Equiv.apply_symm_apply]; exact Or.inr rfl  · intro v    refine ⟨s(v, e.symm (in1252_mate n (e v))), ⟨Finset.mem_image_of_mem _ (Finset.mem_univ v),      Sym2.mem_mk_left _ _⟩, ?_⟩    rintro E ⟨hE, hv⟩    obtain ⟨u, -, rfl⟩ := Finset.mem_image.mp hE    rcases Sym2.mem_iff.mp hv with rfl | rfl    · rfl    · rw [Equiv.apply_symm_apply, in1252_mate_mate, Equiv.symm_apply_apply, Sym2.eq_swap]  · intro u v h    rw [in1252_mem_MV] at h    show in1252_bits (e u).2 = in1252_bits (e v).2    rw [← h]; exact (in1252_bits_m2 _).symm  · intro b' hb'    refine (in1252_cutV n e b').le.trans (le_trans ?_ (in1252_cutV n e (fun v => in1252_bits (e v).2)).ge)    simpa using in1252_maxcut n _ (in1252_MV_const n e b' hb')  · intro m _ hm p hp hadj hM hb    exact in1252_cycles n m hm (fun i => e (p i)) (e.injective.comp hp) (fun i => hadj i)      (fun i h => hM i ((in1252_mem_MV n e _ _).2 h)) (fun i => hb i)  · intro b' hb' hcard    have hc : (Finset.univ.filter fun w : in1252_W n => b' (e.symm w) ≠ in1252_bits w.2).card <        2 * (n+1) := by      refine lt_of_eq_of_lt ?_ hcard      apply Finset.card_nbij' (fun w => e.symm w) (fun v => e v)      · intro w hw; simpa using hw      · intro v hv; simpa using hv      · intro w _; simp      · intro v _; simp    obtain ⟨i0, hi0⟩ := in1252_pigeon n _ (in1252_MV_const n e b' hb') hc    exact in1252_repair n e hn b' hb' i0 hi0
See it in the graphDiscuss this resultChallenge it