AFTD Auto-Formalizing Theoretical Domains

boundary_five_blocks_bridge_shore_defect_constraints

theoremverified

For the displayed four-block graph with min degree at least 2k+2 and disjoint even nonendpoint bridge shores, the stated block intersection counts satisfy the root budgets, representative-vertex nonneighbor budgets, sizes, parity, and the bound on opposite-block cross defects. This is a graph-to-integer transfer, with no connectivity or matching hypothesis.

Statement

theorem boundary_five_blocks_bridge_shore_defect_constraints
    (k : ℕ) (hk : 5 ≤ k) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (A B C D : Finset (Fin (4*k)))
    (hAB : Disjoint A B) (hAC : Disjoint A C) (hAD : Disjoint A D)
    (hBC : Disjoint B C) (hBD : Disjoint B D) (hCD : Disjoint C D)
    (hcover : A ∪ B ∪ C ∪ D = Finset.univ)
    (hA : A.card=5) (hC : C.card=5)
    (hsizeAB : A.card+B.card=2*k) (hsizeCD : C.card+D.card=2*k)
    (hnoAB : ∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b)
    (hnoCD : ∀ c ∈ C, ∀ d ∈ D, ¬ G.Adj c d)
    (hdegree : ∀ v, 2*k+2 ≤ (G.neighborFinset v).card)
    (x y : Fin (4*k)) (hx : x ∈ A) (hy : y ∈ C)
    (Q W : Finset (Fin (4*k))) (hQW : Disjoint Q W)
    (hxQ : x ∉ Q) (hyQ : y ∉ Q) (hxW : x ∉ W) (hyW : y ∉ W)
    (hQeven : Even Q.card) (hWeven : Even W.card)
    (hsize : (Q ∪ W ∪ {x,y}).card = 2*k)
    (hyQadj : ∀ q ∈ Q, ¬ G.Adj y q)
    (hxWadj : ∀ w ∈ W, ¬ G.Adj x w)
    (hcross : ∀ q ∈ Q, ∀ w ∈ W, ¬ G.Adj q w)
    : let m := 2*k-5
      let r := (C.filter (fun c => ¬ G.Adj x c)).card
      let qa := (Q∩A).card; let qb := (Q∩B).card
      let qc := (Q∩C).card; let qd := (Q∩D).card
      let wa := (W∩A).card; let wb := (W∩B).card
      let wc := (W∩C).card; let wd := (W∩D).card
      let qs := Q.card; let ws := W.card
      5 ≤ m ∧ r ≤ 2 ∧ wc ≤ r ∧ qa+wa ≤ 4 ∧ qb+wb ≤ m ∧
      qc+wc ≤ 4 ∧ qd+wd ≤ m ∧ qs=qa+qb+qc+qd ∧ ws=wa+wb+wc+wd ∧
      Even qs ∧ Even ws ∧ qs+ws=m+3 ∧ wa+wd+r ≤ 2 ∧ qa+qb+qc ≤ 2 ∧
      (0<qa → wa+wc+wd+1 ≤ 2) ∧ (0<qb → wb+wc+wd+1+3 ≤ m) ∧
      (0<qc → wa+wb+wc+1 ≤ 2) ∧ (0<qd → wa+wb+wd+3 ≤ m) ∧
      (0<wa → qa+qc+qd+1 ≤ 2) ∧ (0<wb → qb+qc+qd+3 ≤ m) ∧
      (0<wc → qa+qb+qc+1 ≤ 2) ∧ (0<wd → qa+qb+qd+1+3 ≤ m)
Source
OP-1957: graph-to-count transfer for the nonclique bridge-shore classification.
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
Used by 2

The proof, explained

The theorem transfers minimum degree conditions (at least 2k + 2) in a four-block graph into 22 integer constraints on the block intersection sizes of two disjoint, even sets Q and W that partition all but two vertices {x, y} of a 2k-element set. The strategy applies a four-block vertex defect lemma (`boundary_five_blocks_vertex_nonneighbor_defects`) to representative vertices of each block. The key move is that the absence of edges between blocks A and B, between C and D, and between Q, W, and {x, y} forces the non-neighbor counts outside opposite blocks to stay within tight budgets (at most 2 for A and C, and at most 2k - 8 for B and D).

  1. |B| = 2k - 5 and |D| = 2k - 5 automation

    Linear arithmetic over ℕ using |A| = 5, |C| = 5, |A| + |B| = 2k, and |C| + |D| = 2k establishes that the two large blocks B and D each have size 2k - 5.

    lines 33–36

          (0<wc → qa+qb+qc+1 ≤ 2) ∧ (0<wd → qa+qb+qd+1+3 ≤ m) := by  classical
      dsimp only
      have hB : B.card = 2*k-5 := by omega
      have hD : D.card = 2*k-5 := by omega
  2. x ≠ y, x ∉ B ∪ C ∪ D, and y ∉ A ∪ B ∪ D

    Since x ∈ A and y ∈ C, the disjointness of blocks A and C implies x ≠ y, x ∉ C, and y ∉ A. By the pairwise disjointness of the partition blocks A, B, C, D, x cannot belong to B or D, and y cannot belong to B or D.

    lines 37–46

    uses Finset.disjoint_left.mp, Finset.disjoint_right.mp

      have hxy : x ≠ y := by
        intro h
        subst y
        exact Finset.disjoint_left.mp hAC hx hy
      have hxB : x ∉ B := Finset.disjoint_left.mp hAB hx
      have hxC : x ∉ C := Finset.disjoint_left.mp hAC hx
      have hxD : x ∉ D := Finset.disjoint_left.mp hAD hx
      have hyA : y ∉ A := Finset.disjoint_right.mp hAC hy
      have hyB : y ∉ B := Finset.disjoint_right.mp hBC hy
      have hyD : y ∉ D := Finset.disjoint_left.mp hCD hy
  3. |Q| and |W| equal the sum of their four block intersections, and |Q| + |W| + 2 = 2k

    Because A, B, C, D partition the universe, the cardinality of Q (and similarly of W) is the sum of its intersection sizes with A, B, C, and D. Since Q, W, and {x, y} are pairwise disjoint and x ≠ y, the cardinality of their union |Q ∪ W ∪ {x, y}| = 2k expands to |Q| + |W| + 2 = 2k.

    lines 47–60

    uses finset_card_eq_sum_four_block_inter, Finset.card_sdiff_add_card_inter, Finset.card_union_of_disjoint, Finset.card_pair

      have hQcard := finset_card_eq_sum_four_block_inter A B C D Q hAB hAC hAD hBC hBD hCD hcover
      have hWcard := finset_card_eq_sum_four_block_inter A B C D W hAB hAC hAD hBC hBD hCD hcover
      have hsQ (T : Finset (Fin (4*k))) := Finset.card_sdiff_add_card_inter Q T
      have hsW (T : Finset (Fin (4*k))) := Finset.card_sdiff_add_card_inter W T
      have hsplit : Q.card + W.card + 2 = 2*k := by
        have hp : Disjoint (Q ∪ W) ({x,y} : Finset (Fin (4*k))) := by
          apply Finset.disjoint_left.mpr
          intro v hv hs
          simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] at hv hs
          rcases hs with rfl | rfl <;> rcases hv with hv | hv
          exacts [hxQ hv, hxW hv, hyQ hv, hyW hv]
        rw [Finset.card_union_of_disjoint hp, Finset.card_union_of_disjoint hQW,
          Finset.card_pair hxy] at hsize
        omega
  4. |Q ∩ T| + |W ∩ T| ≤ |T| for each block T, with bound 4 on blocks A and C

    For any block T, the intersections Q ∩ T and W ∩ T are disjoint subsets of T, so their sum is at most |T|. For block A, since x ∈ A but x ∉ Q ∪ W, both intersections lie in A \ {x}, which has size |A| - 1 = 4. Symmetrically, y ∉ Q ∪ W places the intersections with C inside C \ {y}, giving size at most |C| - 1 = 4. For B and D, the sum is bounded by their cardinality 2k - 5.

    lines 61–92

    uses Finset.card_union_of_disjoint, Finset.card_le_card, Finset.card_erase_of_mem

      have hcap (T : Finset (Fin (4*k))) : (Q∩T).card + (W∩T).card ≤ T.card := by
        have hd : Disjoint (Q∩T) (W∩T) :=
          Finset.disjoint_of_subset_left Finset.inter_subset_left
            (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)
        rw [← Finset.card_union_of_disjoint hd]
        exact Finset.card_le_card (Finset.union_subset Finset.inter_subset_right Finset.inter_subset_right)
      have hcapA : (Q∩A).card + (W∩A).card ≤ 4 := by
        have hd : Disjoint (Q∩A) (W∩A) :=
          Finset.disjoint_of_subset_left Finset.inter_subset_left
            (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)
        have hsub : (Q∩A) ∪ (W∩A) ⊆ A.erase x := by
          intro v hv
          rcases Finset.mem_union.mp hv with hv | hv
          · exact Finset.mem_erase.mpr ⟨fun h => hxQ (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩
          · exact Finset.mem_erase.mpr ⟨fun h => hxW (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩
        have := Finset.card_le_card hsub
        rw [Finset.card_union_of_disjoint hd, Finset.card_erase_of_mem hx, hA] at this
        omega
      have hcapC : (Q∩C).card + (W∩C).card ≤ 4 := by
        have hd : Disjoint (Q∩C) (W∩C) :=
          Finset.disjoint_of_subset_left Finset.inter_subset_left
            (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)
        have hsub : (Q∩C) ∪ (W∩C) ⊆ C.erase y := by
          intro v hv
          rcases Finset.mem_union.mp hv with hv | hv
          · exact Finset.mem_erase.mpr ⟨fun h => hyQ (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩
          · exact Finset.mem_erase.mpr ⟨fun h => hyW (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩
        have := Finset.card_le_card hsub
        rw [Finset.card_union_of_disjoint hd, Finset.card_erase_of_mem hy, hC] at this
        omega
      have hcapB := hcap B
      have hcapD := hcap D
  5. Every vertex in Q has W ∪ {y} among its non-neighbors, and every vertex in W has Q ∪ {x} among its non-neighbors

    Because there are no cross-edges between Q and W, no edges between y and Q, and no edges between x and W, applying the four-block defect theorem `boundary_five_blocks_vertex_nonneighbor_defects` to any u ∈ Q yields defect budgets on W and {y}, and to any u ∈ W yields defect budgets on Q and {x}. Helper lemmas `getQ` and `getW` produce witness vertices whenever an intersection is nonempty.

    lines 93–124

    uses boundary_five_blocks_vertex_nonneighbor_defects, Finset.disjoint_empty_right, Finset.card_pos.mp

      let VD := boundary_five_blocks_vertex_nonneighbor_defects k hk G A B C D hAB hCD hA hC hsizeAB hsizeCD hnoAB hnoCD hdegree
      have hE := fun (T : Finset (Fin (4*k))) => Finset.disjoint_empty_right T
      have hqvd (u : Fin (4*k)) (hu : u ∈ Q) :=
        VD u W {y} ∅ ∅ (by
          intro v hv
          rcases hv with hv | hv | hv | hv
          · exact ⟨fun h => Finset.disjoint_left.mp hQW hu (h ▸ hv), hcross u hu v hv⟩
          · have he : v=y := Finset.mem_singleton.mp hv
            subst v
            exact ⟨fun h => hyQ (h ▸ hu), fun h => hyQadj u hu h.symm⟩
          · simp at hv
          · simp at hv)
          (Finset.disjoint_left.mpr (by intro v hv hs; have he : v=y := Finset.mem_singleton.mp hs; exact hyW (he ▸ hv)))
          (hE _) (hE _) (hE _) (hE _) (hE _)
      have hwvd (u : Fin (4*k)) (hu : u ∈ W) :=
        VD u Q {x} ∅ ∅ (by
          intro v hv
          rcases hv with hv | hv | hv | hv
          · exact ⟨fun h => Finset.disjoint_left.mp hQW (h ▸ hv) hu, fun h => hcross v hv u hu h.symm⟩
          · have he : v=x := Finset.mem_singleton.mp hv
            subst v
            exact ⟨fun h => hxW (h ▸ hu), fun h => hxWadj u hu h.symm⟩
          · simp at hv
          · simp at hv)
          (Finset.disjoint_left.mpr (by intro v hv hs; have he : v=x := Finset.mem_singleton.mp hs; exact hxQ (he ▸ hv)))
          (hE _) (hE _) (hE _) (hE _) (hE _)
      have getQ (T : Finset (Fin (4*k))) (h : 0 < (Q∩T).card) : ∃ u ∈ Q, u ∈ T := by
        obtain ⟨u, hu⟩ := Finset.card_pos.mp h
        exact ⟨u,(Finset.mem_inter.mp hu).1,(Finset.mem_inter.mp hu).2⟩
      have getW (T : Finset (Fin (4*k))) (h : 0 < (W∩T).card) : ∃ u ∈ W, u ∈ T := by
        obtain ⟨u, hu⟩ := Finset.card_pos.mp h
        exact ⟨u,(Finset.mem_inter.mp hu).1,(Finset.mem_inter.mp hu).2⟩
  6. |Q ∩ A| + |Q ∩ B| + |Q ∩ C| ≤ 2

    Applying the vertex defect lemma to y ∈ C with non-neighbor set Q bounds the non-neighbors of y outside block D: |Q \ D| ≤ 2. Decomposing Q \ D into the disjoint intersections with A, B, and C gives the budget qa + qb + qc ≤ 2.

    lines 125–135

    uses Finset.empty_sdiff, Finset.card_empty, add_zero

      have hybudget : (Q∩A).card+(Q∩B).card+(Q∩C).card ≤ 2 := by
        have hh := (VD y Q ∅ ∅ ∅ (by
          intro v hv
          rcases hv with hv | hv | hv | hv
          · exact ⟨fun h => hyQ (h ▸ hv), hyQadj v hv⟩
          · simp at hv
          · simp at hv
          · simp at hv) (hE _) (hE _) (hE _) (hE _) (hE _) (hE _)).2.2.1 hy
        simp only [Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsQ D
        omega
  7. {y} \ C = ∅ and {y} \ T = {y} for T ∈ {A, B, D}, while {x} \ A = ∅ and {x} \ T = {x} for T ∈ {B, C, D}

    Since y ∈ C and y is disjoint from A, B, and D, removing C leaves the empty set while removing any other block leaves {y} unchanged. The identical reasoning applies to x ∈ A.

    lines 136–175

    uses Finset.mem_sdiff, Finset.sdiff_eq_empty_iff_subset.mpr, Finset.singleton_subset_iff.mpr

      have hySB : ({y} : Finset (Fin (4*k))) \ B = {y} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hyB⟩
      have hySA : ({y} : Finset (Fin (4*k))) \ A = {y} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hyA⟩
      have hySD : ({y} : Finset (Fin (4*k))) \ D = {y} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hyD⟩
      have hySC : ({y} : Finset (Fin (4*k))) \ C = ∅ := by
        exact Finset.sdiff_eq_empty_iff_subset.mpr (Finset.singleton_subset_iff.mpr hy)
      have hxSB : ({x} : Finset (Fin (4*k))) \ B = {x} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hxB⟩
      have hxSA : ({x} : Finset (Fin (4*k))) \ A = ∅ := by
        exact Finset.sdiff_eq_empty_iff_subset.mpr (Finset.singleton_subset_iff.mpr hx)
      have hxSD : ({x} : Finset (Fin (4*k))) \ D = {x} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hxD⟩
      have hxSC : ({x} : Finset (Fin (4*k))) \ C = {x} := by
        ext v
        simp only [Finset.mem_sdiff, Finset.mem_singleton]
        constructor
        · exact And.left
        · rintro rfl; exact ⟨rfl, hxC⟩
  8. If Q meets A, B, C, or D, the block intersection counts of W satisfy the representative-vertex non-neighbor defect constraints

    If Q ∩ T has an element u, the defect lemma applies to u with non-neighbor set W ∪ {y}. When u ∈ A, the non-neighbors outside B satisfy |W \ B| + |{y} \ B| ≤ 2, which simplifies to wa + wc + wd + 1 ≤ 2. When u ∈ B, the non-neighbors outside A satisfy |W \ A| + 1 + 8 ≤ 2k, which simplifies to wb + wc + wd + 4 ≤ m. The symmetric arguments for u ∈ C and u ∈ D yield wa + wb + wc + 1 ≤ 2 and wa + wb + wd + 3 ≤ m.

    lines 176–206

    uses Finset.card_singleton

      have hqA : 0 < (Q∩A).card → (W∩A).card+(W∩C).card+(W∩D).card+1 ≤ 2 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getQ A h
        have hh := (hqvd u hu).1 hblock
        simp only [hySB, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsW B
        omega
    
      have hqB : 0 < (Q∩B).card → (W∩B).card+(W∩C).card+(W∩D).card+1+3 ≤ 2*k-5 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getQ B h
        have hh := (hqvd u hu).2.1 hblock
        simp only [hySA, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsW A
        omega
    
      have hqC : 0 < (Q∩C).card → (W∩A).card+(W∩B).card+(W∩C).card+1 ≤ 2 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getQ C h
        have hh := (hqvd u hu).2.2.1 hblock
        simp only [hySD, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsW D
        omega
    
      have hqD : 0 < (Q∩D).card → (W∩A).card+(W∩B).card+(W∩D).card+3 ≤ 2*k-5 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getQ D h
        have hh := (hqvd u hu).2.2.2 hblock
        simp only [hySC, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsW C
        omega
  9. If W meets A, B, C, or D, the block intersection counts of Q satisfy the representative-vertex non-neighbor defect constraints

    Symmetrically, if W ∩ T contains a vertex u, applying the defect lemma to u with non-neighbor set Q ∪ {x} bounds the non-neighbors outside the opposite block. When u ∈ A, this gives qa + qc + qd + 1 ≤ 2; when u ∈ B, qb + qc + qd + 3 ≤ m; when u ∈ C, qa + qb + qc + 1 ≤ 2; and when u ∈ D, qa + qb + qd + 4 ≤ m.

    lines 207–238

    uses Finset.card_singleton

      have hwA : 0 < (W∩A).card → (Q∩A).card+(Q∩C).card+(Q∩D).card+1 ≤ 2 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getW A h
        have hh := (hwvd u hu).1 hblock
        simp only [hxSB, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsQ B
        omega
    
      have hwB : 0 < (W∩B).card → (Q∩B).card+(Q∩C).card+(Q∩D).card+3 ≤ 2*k-5 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getW B h
        have hh := (hwvd u hu).2.1 hblock
        simp only [hxSA, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsQ A
        omega
    
      have hwC : 0 < (W∩C).card → (Q∩A).card+(Q∩B).card+(Q∩C).card+1 ≤ 2 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getW C h
        have hh := (hwvd u hu).2.2.1 hblock
        simp only [hxSD, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsQ D
        omega
    
      have hwD : 0 < (W∩D).card → (Q∩A).card+(Q∩B).card+(Q∩D).card+1+3 ≤ 2*k-5 := by
        intro h
        obtain ⟨u,hu,hblock⟩ := getW D h
        have hh := (hwvd u hu).2.2.2 hblock
        simp only [hxSC, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh
        have hs := hsQ C
        omega
  10. |W ∩ A| + |W ∩ D| + r ≤ 2, where r is the number of non-neighbors of x in C

    The sets T = W ∩ A, U = W ∩ D, and S = {c ∈ C | ¬ G.Adj x c} are pairwise disjoint sets of non-neighbors of x. Applying the vertex defect lemma to x ∈ A bounds (T \ B).card + (U \ B).card + (S \ B).card ≤ 2. Because T, U, and S are subsets of A, D, and C respectively, all three are disjoint from B, so subtracting B leaves each set intact, giving wa + wd + r ≤ 2.

    lines 239–264

    uses Finset.filter_subset, Finset.sdiff_eq_self_of_disjoint

      let T := W ∩ A
      let U := W ∩ D
      let S := C.filter (fun c => ¬ G.Adj x c)
      have hTA : T ⊆ A := Finset.inter_subset_right
      have hUD : U ⊆ D := Finset.inter_subset_right
      have hSC : S ⊆ C := Finset.filter_subset _ _
      have hTU : Disjoint T U := Finset.disjoint_of_subset_left hTA (Finset.disjoint_of_subset_right hUD hAD)
      have hTS : Disjoint T S := Finset.disjoint_of_subset_left hTA (Finset.disjoint_of_subset_right hSC hAC)
      have hUS : Disjoint U S := Finset.disjoint_of_subset_left hUD (Finset.disjoint_of_subset_right hSC hCD.symm)
      have hTB : Disjoint T B := Finset.disjoint_of_subset_left hTA hAB
      have hUB : Disjoint U B := Finset.disjoint_of_subset_left hUD hBD.symm
      have hSB : Disjoint S B := Finset.disjoint_of_subset_left hSC hBC.symm
      have hxbudget : T.card+U.card+S.card ≤ 2 := by
        have hh := (VD x T U S ∅ (by
          intro v hv
          rcases hv with hv | hv | hv | hv
          · have hvW : v ∈ W := (Finset.mem_inter.mp hv).1
            exact ⟨fun h => hxW (h ▸ hvW), hxWadj v hvW⟩
          · have hvW : v ∈ W := (Finset.mem_inter.mp hv).1
            exact ⟨fun h => hxW (h ▸ hvW), hxWadj v hvW⟩
          · obtain ⟨hvC,hvno⟩ := Finset.mem_filter.mp hv
            exact ⟨fun h => hxC (h ▸ hvC), hvno⟩
          · simp at hv) hTU hTS (hE _) hUS (hE _) (hE _)).1 hx
        rw [Finset.sdiff_eq_self_of_disjoint hTB, Finset.sdiff_eq_self_of_disjoint hUB,
          Finset.sdiff_eq_self_of_disjoint hSB] at hh
        simpa using hh
  11. |W ∩ C| ≤ r

    Since x has no edges to W, every vertex in W ∩ C is a non-neighbor of x lying in C. Thus W ∩ C is a subset of the non-neighbors of x in C, so its cardinality is at most r.

    lines 265–270

    uses Finset.card_le_card, Finset.mem_filter.mpr

      have hWC : (W ∩ C).card ≤ S.card := by
        apply Finset.card_le_card
        intro v hv
        exact Finset.mem_filter.mpr ⟨(Finset.mem_inter.mp hv).2, hxWadj v (Finset.mem_inter.mp hv).1⟩
      have hxbudget' : (W∩A).card + (W∩D).card + (C.filter (fun c => ¬ G.Adj x c)).card ≤ 2 := by
        simpa [T,U,S] using hxbudget
  12. All 22 boundary defect constraints and capacity relations hold simultaneously automation

    The 22 conjuncts are combined: the block intersection counts, parities, and defect bounds are supplied directly by the established lemmas, while the linear arithmetic bounds 5 ≤ m, r ≤ 2, qb + wb ≤ m, qd + wd ≤ m, and qs + ws = m + 3 are closed by Presburger arithmetic from the previous steps.

      exact ⟨by omega, by omega, by simpa [S] using hWC, hcapA, by omega, hcapC, by omega,
        hQcard, hWcard, hQeven, hWeven, by omega, hxbudget',
        hybudget, hqA, hqB, hqC, hqD, hwA, hwB, hwC, hwD⟩
add_zero
Adding zero to an element leaves it unchanged.
boundary_five_blocks_vertex_nonneighbor_defects
In a four-block partition with minimum degree at least 2k + 2, the sum of sizes of disjoint non-neighbor sets of a vertex outside its opposite block is bounded by 2 (if the vertex is in A or C) or 2k - 8 (if in B or D).
Finset.card_empty
The empty set has cardinality 0.
Finset.card_erase_of_mem
Removing an element from a finite set decreases its cardinality by 1.
Finset.card_le_card
If s ⊆ t for finite sets s and t, then |s| ≤ |t|.
Finset.card_pair
A set containing two distinct elements has cardinality 2.
Finset.card_pos.mp
A finite set with strictly positive cardinality is nonempty.
Finset.card_sdiff_add_card_inter
For any finite sets s and t, |s \ t| + |s ∩ t| = |s|.
Finset.card_singleton
A singleton set {a} has cardinality 1.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.disjoint_empty_right
Any finite set is disjoint from the empty set.
Finset.disjoint_left.mp
If s and t are disjoint, any element of s does not belong to t.
Finset.disjoint_right.mp
If s and t are disjoint, any element of t does not belong to s.
Finset.empty_sdiff
The empty set minus any set is the empty set.
Finset.filter_subset
The subset of elements satisfying a predicate is contained in the original set.
Finset.mem_filter.mpr
An element of the base set satisfying the predicate belongs to the filtered subset.
Finset.mem_sdiff
An element belongs to s \ t if and only if it belongs to s and not to t.
Finset.sdiff_eq_empty_iff_subset.mpr
If s ⊆ t, then s \ t is empty.
Finset.sdiff_eq_self_of_disjoint
If s and t are disjoint, then s \ t = s.
Finset.singleton_subset_iff.mpr
A singleton {a} is a subset of s if and only if a ∈ s.
finset_card_eq_sum_four_block_inter
For a four-block partition A, B, C, D of the universe, the cardinality of any set P is the sum of the cardinalities of its intersections with the four blocks.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem boundary_five_blocks_bridge_shore_defect_constraints    (k : ℕ) (hk : 5 ≤ k) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (A B C D : Finset (Fin (4*k)))    (hAB : Disjoint A B) (hAC : Disjoint A C) (hAD : Disjoint A D)    (hBC : Disjoint B C) (hBD : Disjoint B D) (hCD : Disjoint C D)    (hcover : A ∪ B ∪ C ∪ D = Finset.univ)    (hA : A.card=5) (hC : C.card=5)    (hsizeAB : A.card+B.card=2*k) (hsizeCD : C.card+D.card=2*k)    (hnoAB : ∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b)    (hnoCD : ∀ c ∈ C, ∀ d ∈ D, ¬ G.Adj c d)    (hdegree : ∀ v, 2*k+2 ≤ (G.neighborFinset v).card)    (x y : Fin (4*k)) (hx : x ∈ A) (hy : y ∈ C)    (Q W : Finset (Fin (4*k))) (hQW : Disjoint Q W)    (hxQ : x ∉ Q) (hyQ : y ∉ Q) (hxW : x ∉ W) (hyW : y ∉ W)    (hQeven : Even Q.card) (hWeven : Even W.card)    (hsize : (Q ∪ W ∪ {x,y}).card = 2*k)    (hyQadj : ∀ q ∈ Q, ¬ G.Adj y q)    (hxWadj : ∀ w ∈ W, ¬ G.Adj x w)    (hcross : ∀ q ∈ Q, ∀ w ∈ W, ¬ G.Adj q w)    : let m := 2*k-5      let r := (C.filter (fun c => ¬ G.Adj x c)).card      let qa := (Q∩A).card; let qb := (Q∩B).card      let qc := (Q∩C).card; let qd := (Q∩D).card      let wa := (W∩A).card; let wb := (W∩B).card      let wc := (W∩C).card; let wd := (W∩D).card      let qs := Q.card; let ws := W.card      5 ≤ m ∧ r ≤ 2 ∧ wc ≤ r ∧ qa+wa ≤ 4 ∧ qb+wb ≤ m ∧      qc+wc ≤ 4 ∧ qd+wd ≤ m ∧ qs=qa+qb+qc+qd ∧ ws=wa+wb+wc+wd ∧      Even qs ∧ Even ws ∧ qs+ws=m+3 ∧ wa+wd+r ≤ 2 ∧ qa+qb+qc ≤ 2 ∧      (0<qa → wa+wc+wd+1 ≤ 2) ∧ (0<qb → wb+wc+wd+1+3 ≤ m) ∧      (0<qc → wa+wb+wc+1 ≤ 2) ∧ (0<qd → wa+wb+wd+3 ≤ m) ∧      (0<wa → qa+qc+qd+1 ≤ 2) ∧ (0<wb → qb+qc+qd+3 ≤ m) ∧      (0<wc → qa+qb+qc+1 ≤ 2) ∧ (0<wd → qa+qb+qd+1+3 ≤ m) := by  classical  dsimp only  have hB : B.card = 2*k-5 := by omega  have hD : D.card = 2*k-5 := by omega  have hxy : x ≠ y := by    intro h    subst y    exact Finset.disjoint_left.mp hAC hx hy  have hxB : x ∉ B := Finset.disjoint_left.mp hAB hx  have hxC : x ∉ C := Finset.disjoint_left.mp hAC hx  have hxD : x ∉ D := Finset.disjoint_left.mp hAD hx  have hyA : y ∉ A := Finset.disjoint_right.mp hAC hy  have hyB : y ∉ B := Finset.disjoint_right.mp hBC hy  have hyD : y ∉ D := Finset.disjoint_left.mp hCD hy  have hQcard := finset_card_eq_sum_four_block_inter A B C D Q hAB hAC hAD hBC hBD hCD hcover  have hWcard := finset_card_eq_sum_four_block_inter A B C D W hAB hAC hAD hBC hBD hCD hcover  have hsQ (T : Finset (Fin (4*k))) := Finset.card_sdiff_add_card_inter Q T  have hsW (T : Finset (Fin (4*k))) := Finset.card_sdiff_add_card_inter W T  have hsplit : Q.card + W.card + 2 = 2*k := by    have hp : Disjoint (Q ∪ W) ({x,y} : Finset (Fin (4*k))) := by      apply Finset.disjoint_left.mpr      intro v hv hs      simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] at hv hs      rcases hs with rfl | rfl <;> rcases hv with hv | hv      exacts [hxQ hv, hxW hv, hyQ hv, hyW hv]    rw [Finset.card_union_of_disjoint hp, Finset.card_union_of_disjoint hQW,      Finset.card_pair hxy] at hsize    omega  have hcap (T : Finset (Fin (4*k))) : (Q∩T).card + (W∩T).card ≤ T.card := by    have hd : Disjoint (Q∩T) (W∩T) :=      Finset.disjoint_of_subset_left Finset.inter_subset_left        (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)    rw [← Finset.card_union_of_disjoint hd]    exact Finset.card_le_card (Finset.union_subset Finset.inter_subset_right Finset.inter_subset_right)  have hcapA : (Q∩A).card + (W∩A).card ≤ 4 := by    have hd : Disjoint (Q∩A) (W∩A) :=      Finset.disjoint_of_subset_left Finset.inter_subset_left        (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)    have hsub : (Q∩A) ∪ (W∩A) ⊆ A.erase x := by      intro v hv      rcases Finset.mem_union.mp hv with hv | hv      · exact Finset.mem_erase.mpr ⟨fun h => hxQ (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩      · exact Finset.mem_erase.mpr ⟨fun h => hxW (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩    have := Finset.card_le_card hsub    rw [Finset.card_union_of_disjoint hd, Finset.card_erase_of_mem hx, hA] at this    omega  have hcapC : (Q∩C).card + (W∩C).card ≤ 4 := by    have hd : Disjoint (Q∩C) (W∩C) :=      Finset.disjoint_of_subset_left Finset.inter_subset_left        (Finset.disjoint_of_subset_right Finset.inter_subset_left hQW)    have hsub : (Q∩C) ∪ (W∩C) ⊆ C.erase y := by      intro v hv      rcases Finset.mem_union.mp hv with hv | hv      · exact Finset.mem_erase.mpr ⟨fun h => hyQ (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩      · exact Finset.mem_erase.mpr ⟨fun h => hyW (h ▸ (Finset.mem_inter.mp hv).1), (Finset.mem_inter.mp hv).2⟩    have := Finset.card_le_card hsub    rw [Finset.card_union_of_disjoint hd, Finset.card_erase_of_mem hy, hC] at this    omega  have hcapB := hcap B  have hcapD := hcap D  let VD := boundary_five_blocks_vertex_nonneighbor_defects k hk G A B C D hAB hCD hA hC hsizeAB hsizeCD hnoAB hnoCD hdegree  have hE := fun (T : Finset (Fin (4*k))) => Finset.disjoint_empty_right T  have hqvd (u : Fin (4*k)) (hu : u ∈ Q) :=    VD u W {y} ∅ ∅ (by      intro v hv      rcases hv with hv | hv | hv | hv      · exact ⟨fun h => Finset.disjoint_left.mp hQW hu (h ▸ hv), hcross u hu v hv⟩      · have he : v=y := Finset.mem_singleton.mp hv        subst v        exact ⟨fun h => hyQ (h ▸ hu), fun h => hyQadj u hu h.symm⟩      · simp at hv      · simp at hv)      (Finset.disjoint_left.mpr (by intro v hv hs; have he : v=y := Finset.mem_singleton.mp hs; exact hyW (he ▸ hv)))      (hE _) (hE _) (hE _) (hE _) (hE _)  have hwvd (u : Fin (4*k)) (hu : u ∈ W) :=    VD u Q {x} ∅ ∅ (by      intro v hv      rcases hv with hv | hv | hv | hv      · exact ⟨fun h => Finset.disjoint_left.mp hQW (h ▸ hv) hu, fun h => hcross v hv u hu h.symm⟩      · have he : v=x := Finset.mem_singleton.mp hv        subst v        exact ⟨fun h => hxW (h ▸ hu), fun h => hxWadj u hu h.symm⟩      · simp at hv      · simp at hv)      (Finset.disjoint_left.mpr (by intro v hv hs; have he : v=x := Finset.mem_singleton.mp hs; exact hxQ (he ▸ hv)))      (hE _) (hE _) (hE _) (hE _) (hE _)  have getQ (T : Finset (Fin (4*k))) (h : 0 < (Q∩T).card) : ∃ u ∈ Q, u ∈ T := by    obtain ⟨u, hu⟩ := Finset.card_pos.mp h    exact ⟨u,(Finset.mem_inter.mp hu).1,(Finset.mem_inter.mp hu).2⟩  have getW (T : Finset (Fin (4*k))) (h : 0 < (W∩T).card) : ∃ u ∈ W, u ∈ T := by    obtain ⟨u, hu⟩ := Finset.card_pos.mp h    exact ⟨u,(Finset.mem_inter.mp hu).1,(Finset.mem_inter.mp hu).2⟩  have hybudget : (Q∩A).card+(Q∩B).card+(Q∩C).card ≤ 2 := by    have hh := (VD y Q ∅ ∅ ∅ (by      intro v hv      rcases hv with hv | hv | hv | hv      · exact ⟨fun h => hyQ (h ▸ hv), hyQadj v hv⟩      · simp at hv      · simp at hv      · simp at hv) (hE _) (hE _) (hE _) (hE _) (hE _) (hE _)).2.2.1 hy    simp only [Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsQ D    omega  have hySB : ({y} : Finset (Fin (4*k))) \ B = {y} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hyB⟩  have hySA : ({y} : Finset (Fin (4*k))) \ A = {y} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hyA⟩  have hySD : ({y} : Finset (Fin (4*k))) \ D = {y} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hyD⟩  have hySC : ({y} : Finset (Fin (4*k))) \ C = ∅ := by    exact Finset.sdiff_eq_empty_iff_subset.mpr (Finset.singleton_subset_iff.mpr hy)  have hxSB : ({x} : Finset (Fin (4*k))) \ B = {x} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hxB⟩  have hxSA : ({x} : Finset (Fin (4*k))) \ A = ∅ := by    exact Finset.sdiff_eq_empty_iff_subset.mpr (Finset.singleton_subset_iff.mpr hx)  have hxSD : ({x} : Finset (Fin (4*k))) \ D = {x} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hxD⟩  have hxSC : ({x} : Finset (Fin (4*k))) \ C = {x} := by    ext v    simp only [Finset.mem_sdiff, Finset.mem_singleton]    constructor    · exact And.left    · rintro rfl; exact ⟨rfl, hxC⟩  have hqA : 0 < (Q∩A).card → (W∩A).card+(W∩C).card+(W∩D).card+1 ≤ 2 := by    intro h    obtain ⟨u,hu,hblock⟩ := getQ A h    have hh := (hqvd u hu).1 hblock    simp only [hySB, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsW B    omega  have hqB : 0 < (Q∩B).card → (W∩B).card+(W∩C).card+(W∩D).card+1+3 ≤ 2*k-5 := by    intro h    obtain ⟨u,hu,hblock⟩ := getQ B h    have hh := (hqvd u hu).2.1 hblock    simp only [hySA, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsW A    omega  have hqC : 0 < (Q∩C).card → (W∩A).card+(W∩B).card+(W∩C).card+1 ≤ 2 := by    intro h    obtain ⟨u,hu,hblock⟩ := getQ C h    have hh := (hqvd u hu).2.2.1 hblock    simp only [hySD, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsW D    omega  have hqD : 0 < (Q∩D).card → (W∩A).card+(W∩B).card+(W∩D).card+3 ≤ 2*k-5 := by    intro h    obtain ⟨u,hu,hblock⟩ := getQ D h    have hh := (hqvd u hu).2.2.2 hblock    simp only [hySC, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsW C    omega  have hwA : 0 < (W∩A).card → (Q∩A).card+(Q∩C).card+(Q∩D).card+1 ≤ 2 := by    intro h    obtain ⟨u,hu,hblock⟩ := getW A h    have hh := (hwvd u hu).1 hblock    simp only [hxSB, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsQ B    omega  have hwB : 0 < (W∩B).card → (Q∩B).card+(Q∩C).card+(Q∩D).card+3 ≤ 2*k-5 := by    intro h    obtain ⟨u,hu,hblock⟩ := getW B h    have hh := (hwvd u hu).2.1 hblock    simp only [hxSA, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsQ A    omega  have hwC : 0 < (W∩C).card → (Q∩A).card+(Q∩B).card+(Q∩C).card+1 ≤ 2 := by    intro h    obtain ⟨u,hu,hblock⟩ := getW C h    have hh := (hwvd u hu).2.2.1 hblock    simp only [hxSD, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsQ D    omega  have hwD : 0 < (W∩D).card → (Q∩A).card+(Q∩B).card+(Q∩D).card+1+3 ≤ 2*k-5 := by    intro h    obtain ⟨u,hu,hblock⟩ := getW D h    have hh := (hwvd u hu).2.2.2 hblock    simp only [hxSC, Finset.card_singleton, Finset.empty_sdiff, Finset.card_empty, add_zero] at hh    have hs := hsQ C    omega  let T := W ∩ A  let U := W ∩ D  let S := C.filter (fun c => ¬ G.Adj x c)  have hTA : T ⊆ A := Finset.inter_subset_right  have hUD : U ⊆ D := Finset.inter_subset_right  have hSC : S ⊆ C := Finset.filter_subset _ _  have hTU : Disjoint T U := Finset.disjoint_of_subset_left hTA (Finset.disjoint_of_subset_right hUD hAD)  have hTS : Disjoint T S := Finset.disjoint_of_subset_left hTA (Finset.disjoint_of_subset_right hSC hAC)  have hUS : Disjoint U S := Finset.disjoint_of_subset_left hUD (Finset.disjoint_of_subset_right hSC hCD.symm)  have hTB : Disjoint T B := Finset.disjoint_of_subset_left hTA hAB  have hUB : Disjoint U B := Finset.disjoint_of_subset_left hUD hBD.symm  have hSB : Disjoint S B := Finset.disjoint_of_subset_left hSC hBC.symm  have hxbudget : T.card+U.card+S.card ≤ 2 := by    have hh := (VD x T U S ∅ (by      intro v hv      rcases hv with hv | hv | hv | hv      · have hvW : v ∈ W := (Finset.mem_inter.mp hv).1        exact ⟨fun h => hxW (h ▸ hvW), hxWadj v hvW⟩      · have hvW : v ∈ W := (Finset.mem_inter.mp hv).1        exact ⟨fun h => hxW (h ▸ hvW), hxWadj v hvW⟩      · obtain ⟨hvC,hvno⟩ := Finset.mem_filter.mp hv        exact ⟨fun h => hxC (h ▸ hvC), hvno⟩      · simp at hv) hTU hTS (hE _) hUS (hE _) (hE _)).1 hx    rw [Finset.sdiff_eq_self_of_disjoint hTB, Finset.sdiff_eq_self_of_disjoint hUB,      Finset.sdiff_eq_self_of_disjoint hSB] at hh    simpa using hh  have hWC : (W ∩ C).card ≤ S.card := by    apply Finset.card_le_card    intro v hv    exact Finset.mem_filter.mpr ⟨(Finset.mem_inter.mp hv).2, hxWadj v (Finset.mem_inter.mp hv).1⟩  have hxbudget' : (W∩A).card + (W∩D).card + (C.filter (fun c => ¬ G.Adj x c)).card ≤ 2 := by    simpa [T,U,S] using hxbudget  exact ⟨by omega, by omega, by simpa [S] using hWC, hcapA, by omega, hcapC, by omega,    hQcard, hWcard, hQeven, hWeven, by omega, hxbudget',    hybudget, hqA, hqB, hqC, hqD, hwA, hwB, hwC, hwD⟩
See it in the graphDiscuss this resultChallenge it