AFTD Auto-Formalizing Theoretical Domains

balanced_cut_anticomplete_side_has_cross_matching

theoremverified

A balanced 2k-vertex separator forces r disjoint crossing edges from any r vertices on the separator into an anticomplete outside shore containing at least r vertices.

Statement

theorem balanced_cut_anticomplete_side_has_cross_matching
    (k r : ℕ) (hr : 1 ≤ r)
    (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (hsep : ∀ S P Q : Finset (Fin (4*k)), P.Nonempty → Q.Nonempty →
      Disjoint S P → Disjoint S Q → Disjoint P Q → S ∪ P ∪ Q = Finset.univ →
      (∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v) → 2*k ≤ S.card)
    (C H U : Finset (Fin (4*k))) (hcard : C.card = 2*k)
    (hCH : Disjoint C H) (hUC : U ⊆ C)
    (hanti : ∀ u ∈ H, ∀ v, v ∉ C → v ∉ H → ¬ G.Adj u v)
    (hrU : r ≤ U.card) (hrH : r ≤ H.card) :
    ∃ f g : Fin r → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧
      (∀ i, f i ∈ U ∧ g i ∈ H ∧ G.Adj (f i) (g i))
Source
Balanced-cut separator matching for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 7

The proof, explained

The existence of an r-edge matching between a chosen r-element subset U₀ ⊆ U and H is deduced from Hall's Marriage Theorem. If Hall's marriage condition were violated, some non-empty subset T ⊆ U₀ would have strictly fewer neighbors N in H than |T|. Swapping T for N inside the balanced cut C produces a candidate separator S = (C \ T) ∪ N of size strictly less than 2k. Because N contains all neighbors of T in H and H is anticomplete to the outside of C ∪ H, there are no edges between P = H \ N and the remaining vertices Q = V \ (S ∪ P). This makes S a valid separator between non-empty disjoint sets, which contradicts the hypothesis that any such separator has size at least 2k.

  1. Select an r-element subset U₀ ⊆ U and define candidate neighbors in H for each vertex of U₀.

    Since |U| ≥ r, there exists a subset U₀ ⊆ U with |U₀| = r (Finset.exists_subset_card_eq). For each vertex x ∈ U₀, let choices(x) = H ∩ N_G(x) be the set of neighbors of x that lie in H.

    lines 13–15

    uses Finset.exists_subset_card_eq

      classical
      obtain ⟨U0, hU0U, hU0card⟩ := Finset.exists_subset_card_eq hrU
      let choices : U0 → Finset (Fin (4*k)) := fun x => H.filter (G.Adj x.val)
  2. To establish Hall's condition, assume for contradiction that some subset T ⊆ U₀ has strictly fewer than |T| neighbors in H.

    Hall's condition requires |T| ≤ |N_H(T)| for all T ⊆ U₀, where N_H(T) is the union of choices(x) over x ∈ T. Assume for contradiction that |N_H(T)| < |T| for some T. Let T' be the image of T in the vertex set of the graph and let N = N_H(T). Since the subtype inclusion is injective (Subtype.val_injective), |T'| = |T| (Finset.card_image_of_injective).

    lines 16–22

    uses Finset.card_image_of_injective, Subtype.val_injective

      have hall : ∀ T : Finset U0, T.card ≤ (T.biUnion choices).card := by
        intro T
        by_contra hn
        have hlt : (T.biUnion choices).card < T.card := by omega
        let T' : Finset (Fin (4*k)) := T.image Subtype.val
        let N : Finset (Fin (4*k)) := T.biUnion choices
        have hTcard : T'.card = T.card := Finset.card_image_of_injective _ Subtype.val_injective
  3. T' ⊆ C, N ⊆ H, T' is non-empty, and |N| < |H|.

    Every element of T' belongs to U₀ ⊆ U ⊆ C (using Finset.mem_image.mp), so T' ⊆ C. Elements of N come from choices, so N ⊆ H (using Finset.mem_biUnion.mp and Finset.mem_filter.mp). Since |T'| = |T| > |N| ≥ 0, T' is non-empty (Finset.card_pos.mp). Furthermore, |T| ≤ |U₀| = r (Finset.card_le_univ), so |N| < |T| ≤ r ≤ |H|, which gives |N| < |H|.

    lines 23–40

    uses Finset.mem_image.mp, Finset.mem_biUnion.mp, Finset.mem_filter.mp, Finset.card_pos.mp, Finset.card_le_univ

        have hTC : T' ⊆ C := by
          intro x hx
          obtain ⟨u,hu,rfl⟩ := Finset.mem_image.mp hx
          exact hUC (hU0U u.property)
        have hNH : N ⊆ H := by
          intro x hx
          obtain ⟨u,hu,hx⟩ := Finset.mem_biUnion.mp hx
          exact (Finset.mem_filter.mp hx).1
        have hTn : T'.Nonempty := by
          apply Finset.card_pos.mp
          rw [hTcard]
          omega
        have hNr : N.card < H.card := by
          have ht : T.card ≤ r := by
            have hh := Finset.card_le_univ T
            simpa [hU0card] using hh
          have hnlt : N.card < T.card := by simpa [N] using hlt
          omega
  4. Define S = (C \ T') ∪ N, P = H \ N, and Q = V \ (S ∪ P); the shore P is non-empty.

    Define S by swapping T' for N in C, let P be the remaining vertices of H, and let Q be the complement of S ∪ P. Since N ⊆ H and |N| < |H|, the cardinality |P| = |H| - |N| is strictly positive (Finset.card_sdiff_add_card_eq_card), so P is non-empty (Finset.card_pos.mp).

    lines 41–49

    uses Finset.card_pos.mp, Finset.card_sdiff_add_card_eq_card

        let S : Finset (Fin (4*k)) := (C \ T') ∪ N
        let P : Finset (Fin (4*k)) := H \ N
        let Q : Finset (Fin (4*k)) := Finset.univ \ (S ∪ P)
        have hP : P.Nonempty := by
          apply Finset.card_pos.mp
          have hnsub : N ⊆ H := hNH
          have hh := Finset.card_sdiff_add_card_eq_card hnsub
          dsimp [P]
          omega
  5. S, P, and Q are pairwise disjoint, and Q is non-empty because T' ⊆ Q.

    The set S is disjoint from P because C is disjoint from H (hCH) and N is disjoint from P = H \ N (Finset.disjoint_left.mpr, Finset.mem_sdiff.mp, Finset.mem_union.mp, Finset.disjoint_left.mp). Both S and P are disjoint from their complement Q (Finset.mem_union_left, Finset.mem_union_right). Furthermore, T' ⊆ C is disjoint from H (and thus from N and P) and disjoint from C \ T', so T' is disjoint from S ∪ P, which means T' ⊆ Q. Since T' is non-empty, Q is also non-empty.

    lines 50–74

    uses Finset.disjoint_left.mpr, Finset.mem_sdiff.mp, Finset.mem_union.mp, Finset.disjoint_left.mp, Finset.mem_union_left, Finset.mem_union_right

        have hSP : Disjoint S P := by
          apply Finset.disjoint_left.mpr
          intro x hxS hxP
          have hp := Finset.mem_sdiff.mp hxP
          rcases Finset.mem_union.mp hxS with hx | hx
          · exact Finset.disjoint_left.mp hCH (Finset.mem_sdiff.mp hx).1 hp.1
          · exact hp.2 hx
        have hSQ : Disjoint S Q := by
          apply Finset.disjoint_left.mpr
          intro x hxS hxQ
          exact (Finset.mem_sdiff.mp hxQ).2 (Finset.mem_union_left P hxS)
        have hPQ : Disjoint P Q := by
          apply Finset.disjoint_left.mpr
          intro x hxP hxQ
          exact (Finset.mem_sdiff.mp hxQ).2 (Finset.mem_union_right S hxP)
        have hTQ : T' ⊆ Q := by
          intro x hx
          have hxC := hTC hx
          have hxH : x ∉ H := fun hh => Finset.disjoint_left.mp hCH hxC hh
          have hxN : x ∉ N := fun hh => hxH (hNH hh)
          have hxS : x ∉ S := by
            simp [S,hx,hxN]
          have hxP : x ∉ P := fun hh => hxH (Finset.mem_sdiff.mp hh).1
          simp [Q,hxS,hxP]
        have hQ : Q.Nonempty := hTn.mono hTQ
  6. S ∪ P ∪ Q covers the entire vertex set of G.

    By definition, Q is the complement of S ∪ P in the universe of vertices, so S ∪ P ∪ Q is the whole vertex set.

    lines 75–77

        have hcover : S ∪ P ∪ Q = Finset.univ := by
          ext x
          simp [Q]
  7. There are no edges in G between P and Q.

    Suppose u ∈ P and v ∈ Q are adjacent in G. Since u ∈ P = H \ N, u ∈ H and u ∉ N (Finset.mem_sdiff.mp). Since v ∈ Q, v is disjoint from S and P (Finset.disjoint_left.mp). We split into two cases: if v ∈ C, then v ∉ S implies v ∈ T' (Finset.mem_union_left, Finset.mem_sdiff.mpr), which forces u to be in N (Finset.mem_image.mp, Finset.mem_biUnion.mpr, Finset.mem_filter.mpr), a contradiction. If v ∉ C, then v ∉ H as well (Finset.mem_union_right, Finset.mem_sdiff.mpr), so v ∉ C ∪ H; but the anticompleteness condition hanti forbids edges between H and the outside of C ∪ H. Thus no such edge exists.

    lines 78–102

    uses Finset.mem_sdiff.mp, Finset.disjoint_left.mp, Finset.mem_union_left, Finset.mem_sdiff.mpr, Finset.mem_image.mp, Finset.mem_biUnion.mpr, Finset.mem_filter.mpr, Finset.mem_union_right

        have hno : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by
          intro u hu v hv huv
          have huH := (Finset.mem_sdiff.mp hu).1
          have huN := (Finset.mem_sdiff.mp hu).2
          have hvS : v ∉ S := by
            intro hh
            exact Finset.disjoint_left.mp hSQ hh hv
          have hvP : v ∉ P := by
            intro hh
            exact Finset.disjoint_left.mp hPQ hh hv
          by_cases hvC : v ∈ C
          · have hvT : v ∈ T' := by
              by_contra hnT
              apply hvS
              exact Finset.mem_union_left N (Finset.mem_sdiff.mpr ⟨hvC,hnT⟩)
            obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hvT
            apply huN
            apply Finset.mem_biUnion.mpr
            exact ⟨w,hw,Finset.mem_filter.mpr ⟨huH,huv.symm⟩⟩
          · have hvH : v ∉ H := by
              intro hh
              by_cases hvN : v ∈ N
              · exact hvS (Finset.mem_union_right (C \ T') hvN)
              · exact hvP (Finset.mem_sdiff.mpr ⟨hh,hvN⟩)
            exact hanti u huH v hvC hvH huv
  8. The separator S has size |S| < 2k, contradicting the separator condition and proving Hall's condition.

    By subadditivity of cardinality (Finset.card_union_le) and the size of set differences (Finset.card_sdiff_add_card_eq_card), |S| ≤ |C \ T'| + |N| = |C| - |T'| + |N|. Since |N| < |T'| and |C| = 2k, we obtain |S| < 2k. But S separates the non-empty disjoint sets P and Q with no edges between them, so the separator hypothesis hsep implies 2k ≤ |S|, a contradiction. Hence Hall's condition holds for all T ⊆ U₀.

    lines 103–110

    uses Finset.card_union_le, Finset.card_sdiff_add_card_eq_card

        have hScard : S.card < 2*k := by
          have hh := Finset.card_union_le (C \ T') N
          have ht := Finset.card_sdiff_add_card_eq_card hTC
          have hn' : N.card < T'.card := by simpa [hTcard] using hlt
          dsimp [S]
          omega
        have hsep' := hsep S P Q hP hQ hSP hSQ hPQ hcover hno
        omega
  9. Hall's Marriage Theorem yields an r-edge matching between U and H.

    Hall's Marriage Theorem (Finset.all_card_le_biUnion_card_iff_existsInjective') provides an injective function f : U₀ → V picking a neighbor in H for each element of U₀ (Finset.mem_filter.mp). Using the bijection e : Fin r ≃ U₀ (Finset.equivFinOfCardEq), the compositions i ↦ e(i) and i ↦ f(e(i)) define two injective maps into U and H respectively (Subtype.val_injective), giving r disjoint edges between U and H.

    lines 111–118

    uses Finset.all_card_le_biUnion_card_iff_existsInjective', Finset.equivFinOfCardEq, Subtype.val_injective, Finset.mem_filter.mp

      obtain ⟨f,hfinj,hmem⟩ := (Finset.all_card_le_biUnion_card_iff_existsInjective' choices).mp hall
      let e : Fin r ≃ U0 := (Finset.equivFinOfCardEq hU0card).symm
      refine ⟨fun i => (e i).val, fun i => f (e i), ?_, ?_, ?_⟩
      · exact Subtype.val_injective.comp e.injective
      · exact hfinj.comp e.injective
      · intro i
        have hm := Finset.mem_filter.mp (hmem (e i))
        exact ⟨hU0U (e i).property, hm.1, hm.2⟩
Finset.exists_subset_card_eq
If n ≤ |s|, there exists a subset t ⊆ s with |t| = n.
Finset.card_image_of_injective
The image of a finite set under an injective map has the same cardinality as the domain set.
Subtype.val_injective
The canonical projection from a subtype to its ambient type is injective.
Finset.mem_image.mp
An element is in the image of a set under a function only if it is the image of some element in that set.
Finset.mem_biUnion.mp
An element is in an indexed union of finite sets only if it belongs to one of the component sets.
Finset.mem_filter.mp
An element is in a filtered set only if it belongs to the base set and satisfies the filter predicate.
Finset.card_pos.mp
A finite set is non-empty if and only if its cardinality is strictly positive.
Finset.card_le_univ
The cardinality of a finite set is at most the cardinality of its ambient finite universe.
Finset.card_sdiff_add_card_eq_card
For any subset s ⊆ t, the sum of |t \ s| and |s| equals |t|.
Finset.disjoint_left.mpr
Two sets are disjoint if no element of the first belongs to the second.
Finset.mem_sdiff.mp
An element in s \ t belongs to s and does not belong to t.
Finset.mem_union.mp
An element in s ∪ t belongs to s or belongs to t.
Finset.disjoint_left.mp
If two sets are disjoint, any element in the first does not belong to the second.
Finset.mem_union_left
An element belonging to s also belongs to s ∪ t.
Finset.mem_union_right
An element belonging to t also belongs to s ∪ t.
Finset.mem_sdiff.mpr
An element that belongs to s and not to t belongs to s \ t.
Finset.mem_biUnion.mpr
An element belonging to a component set belongs to the indexed union.
Finset.mem_filter.mpr
An element belonging to a set and satisfying a predicate belongs to the filtered set.
Finset.card_union_le
The cardinality of the union of two finite sets is at most the sum of their cardinalities.
Finset.all_card_le_biUnion_card_iff_existsInjective'
Hall's Marriage Theorem: for a family of finite sets indexed by a finite type, there exists an injective choice function if and only if every subset of indices has an indexed union at least as large as the subset.
Finset.equivFinOfCardEq
A finite set of size n is in bijection with Fin n.

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 balanced_cut_anticomplete_side_has_cross_matching    (k r : ℕ) (hr : 1 ≤ r)    (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (hsep : ∀ S P Q : Finset (Fin (4*k)), P.Nonempty → Q.Nonempty →      Disjoint S P → Disjoint S Q → Disjoint P Q → S ∪ P ∪ Q = Finset.univ →      (∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v) → 2*k ≤ S.card)    (C H U : Finset (Fin (4*k))) (hcard : C.card = 2*k)    (hCH : Disjoint C H) (hUC : U ⊆ C)    (hanti : ∀ u ∈ H, ∀ v, v ∉ C → v ∉ H → ¬ G.Adj u v)    (hrU : r ≤ U.card) (hrH : r ≤ H.card) :    ∃ f g : Fin r → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧      (∀ i, f i ∈ U ∧ g i ∈ H ∧ G.Adj (f i) (g i)) := by  classical  obtain ⟨U0, hU0U, hU0card⟩ := Finset.exists_subset_card_eq hrU  let choices : U0 → Finset (Fin (4*k)) := fun x => H.filter (G.Adj x.val)  have hall : ∀ T : Finset U0, T.card ≤ (T.biUnion choices).card := by    intro T    by_contra hn    have hlt : (T.biUnion choices).card < T.card := by omega    let T' : Finset (Fin (4*k)) := T.image Subtype.val    let N : Finset (Fin (4*k)) := T.biUnion choices    have hTcard : T'.card = T.card := Finset.card_image_of_injective _ Subtype.val_injective    have hTC : T' ⊆ C := by      intro x hx      obtain ⟨u,hu,rfl⟩ := Finset.mem_image.mp hx      exact hUC (hU0U u.property)    have hNH : N ⊆ H := by      intro x hx      obtain ⟨u,hu,hx⟩ := Finset.mem_biUnion.mp hx      exact (Finset.mem_filter.mp hx).1    have hTn : T'.Nonempty := by      apply Finset.card_pos.mp      rw [hTcard]      omega    have hNr : N.card < H.card := by      have ht : T.card ≤ r := by        have hh := Finset.card_le_univ T        simpa [hU0card] using hh      have hnlt : N.card < T.card := by simpa [N] using hlt      omega    let S : Finset (Fin (4*k)) := (C \ T') ∪ N    let P : Finset (Fin (4*k)) := H \ N    let Q : Finset (Fin (4*k)) := Finset.univ \ (S ∪ P)    have hP : P.Nonempty := by      apply Finset.card_pos.mp      have hnsub : N ⊆ H := hNH      have hh := Finset.card_sdiff_add_card_eq_card hnsub      dsimp [P]      omega    have hSP : Disjoint S P := by      apply Finset.disjoint_left.mpr      intro x hxS hxP      have hp := Finset.mem_sdiff.mp hxP      rcases Finset.mem_union.mp hxS with hx | hx      · exact Finset.disjoint_left.mp hCH (Finset.mem_sdiff.mp hx).1 hp.1      · exact hp.2 hx    have hSQ : Disjoint S Q := by      apply Finset.disjoint_left.mpr      intro x hxS hxQ      exact (Finset.mem_sdiff.mp hxQ).2 (Finset.mem_union_left P hxS)    have hPQ : Disjoint P Q := by      apply Finset.disjoint_left.mpr      intro x hxP hxQ      exact (Finset.mem_sdiff.mp hxQ).2 (Finset.mem_union_right S hxP)    have hTQ : T' ⊆ Q := by      intro x hx      have hxC := hTC hx      have hxH : x ∉ H := fun hh => Finset.disjoint_left.mp hCH hxC hh      have hxN : x ∉ N := fun hh => hxH (hNH hh)      have hxS : x ∉ S := by        simp [S,hx,hxN]      have hxP : x ∉ P := fun hh => hxH (Finset.mem_sdiff.mp hh).1      simp [Q,hxS,hxP]    have hQ : Q.Nonempty := hTn.mono hTQ    have hcover : S ∪ P ∪ Q = Finset.univ := by      ext x      simp [Q]    have hno : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by      intro u hu v hv huv      have huH := (Finset.mem_sdiff.mp hu).1      have huN := (Finset.mem_sdiff.mp hu).2      have hvS : v ∉ S := by        intro hh        exact Finset.disjoint_left.mp hSQ hh hv      have hvP : v ∉ P := by        intro hh        exact Finset.disjoint_left.mp hPQ hh hv      by_cases hvC : v ∈ C      · have hvT : v ∈ T' := by          by_contra hnT          apply hvS          exact Finset.mem_union_left N (Finset.mem_sdiff.mpr ⟨hvC,hnT⟩)        obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hvT        apply huN        apply Finset.mem_biUnion.mpr        exact ⟨w,hw,Finset.mem_filter.mpr ⟨huH,huv.symm⟩⟩      · have hvH : v ∉ H := by          intro hh          by_cases hvN : v ∈ N          · exact hvS (Finset.mem_union_right (C \ T') hvN)          · exact hvP (Finset.mem_sdiff.mpr ⟨hh,hvN⟩)        exact hanti u huH v hvC hvH huv    have hScard : S.card < 2*k := by      have hh := Finset.card_union_le (C \ T') N      have ht := Finset.card_sdiff_add_card_eq_card hTC      have hn' : N.card < T'.card := by simpa [hTcard] using hlt      dsimp [S]      omega    have hsep' := hsep S P Q hP hQ hSP hSQ hPQ hcover hno    omega  obtain ⟨f,hfinj,hmem⟩ := (Finset.all_card_le_biUnion_card_iff_existsInjective' choices).mp hall  let e : Fin r ≃ U0 := (Finset.equivFinOfCardEq hU0card).symm  refine ⟨fun i => (e i).val, fun i => f (e i), ?_, ?_, ?_⟩  · exact Subtype.val_injective.comp e.injective  · exact hfinj.comp e.injective  · intro i    have hm := Finset.mem_filter.mp (hmem (e i))    exact ⟨hU0U (e i).property, hm.1, hm.2⟩
See it in the graphDiscuss this resultChallenge it