AFTD Auto-Formalizing Theoretical Domains

balanced_cut_even_component_parity_cross_matching

theoremverified

In the stated separator setting, an even number of crossing endpoints may be chosen in each specified odd-side group by sending one extra crossing edge into a disjoint component.

Statement

theorem balanced_cut_even_component_parity_cross_matching
    (k n : ℕ) (hn : Even n) (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 U H : Finset (Fin (4*k))) (hcard : C.card = 2*k) (hUC : U ⊆ C)
    (hU : 2*(n+1) ≤ U.card) (hCH : Disjoint C H) (hH : H.Nonempty)
    (hHanti : ∀ u ∈ H, ∀ v, v ∉ C → v ∉ H → ¬ G.Adj u v)
    {I : Type*} [DecidableEq I] (J : Finset I) (F : I → Finset (Fin (4*k)))
    (hJ : n+2 ≤ J.card)
    (hCF : ∀ i ∈ J, Disjoint C (F i))
    (hHF : ∀ i ∈ J, Disjoint H (F i))
    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))
    (hsize : ∀ i ∈ J, 2 ≤ (F i).card)
    (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v) :
    ∃ f g : Fin (n+1) → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧
      (∀ a, f a ∈ U ∧ g a ∉ C ∧ G.Adj (f a) (g a)) ∧
      (∀ i ∈ J, Even (((Finset.univ : Finset (Fin (n+1))).image g) ∩ F i).card)
Source
Balanced-cut parity reduction for OP-1957; https://arxiv.org/abs/2611.22690.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 1

The proof, explained

To construct an (n + 1)-edge matching from U ⊆ C into V(G) \ C that meets each specified group F i with even parity, the proof first routes a single crossing edge into an auxiliary component H disjoint from all F i. Removing the U-endpoint of this edge leaves a set U' of size at least 2n, on which the sharp evenly distributed cross-matching theorem is applied with even n, yielding an n-edge matching that meets every F i an even number of times since the defect set B has |B| ≤ n % 2 = 0. Concatenating the two disjoint matchings gives an (n + 1)-edge matching whose endpoints in each F i are untouched by the edge into H, preserving the even parity in every group.

  1. A single crossing edge (f₀(0), g₀(0)) can be chosen with f₀(0) ∈ U and g₀(0) ∈ H.

    Applying balanced_cut_anticomplete_side_has_cross_matching with matching size r = 1, using the separator lower bound and the fact that H is a nonempty component anticomplete to the rest of the graph outside C, yields an edge between U and H.

    lines 19–23

    uses balanced_cut_anticomplete_side_has_cross_matching, Finset.one_le_card.mpr

      set_option maxHeartbeats 4000000 in
        classical
        obtain ⟨f0,g0,hf0,hg0,hfg0⟩ :=
          balanced_cut_anticomplete_side_has_cross_matching k 1 (by omega) G hsep C H U
            hcard hCH hUC hHanti (by omega) (Finset.one_le_card.mpr hH)
  2. Removing the U-endpoint of the initial edge leaves a subset U' ⊆ C of size at least 2n.

    Let A = {f₀(0)} be the singleton image of f₀, which has |A| = 1 by injectivity. Setting U' = U \ A, we have U' ⊆ U ⊆ C and |U'| = |U| - |U ∩ A| ≥ |U| - |A| ≥ 2(n + 1) - 1 > 2n, so |U'| ≥ 2n.

    lines 24–35

    uses Finset.card_image_of_injective, Finset.sdiff_subset, Finset.card_sdiff_add_card_inter, Finset.card_le_card, Finset.inter_subset_right

        let A : Finset (Fin (4*k)) := (Finset.univ : Finset (Fin 1)).image f0
        let U' := U \ A
        have hA : A.card = 1 := by
          dsimp [A]
          rw [Finset.card_image_of_injective _ hf0]
          simp
        have hUC' : U' ⊆ C := (Finset.sdiff_subset : U' ⊆ U).trans hUC
        have hU' : 2*n ≤ U'.card := by
          have hh := Finset.card_sdiff_add_card_inter U A
          have hh' : (U ∩ A).card ≤ A.card := Finset.card_le_card Finset.inter_subset_right
          dsimp [U']
          omega
  3. There is an n-edge matching from U' into ⋃_{i ∈ J} F i that meets every group F i an even number of times.

    Applying balanced_cut_evenly_distributed_cross_matching_sharp provides an n-edge matching (f, g) from U' to ⋃_{i ∈ J} F i whose parity defect set B ⊆ J satisfies |B| ≤ n % 2. Since n is even, n % 2 = 0, which forces B = ∅. Thus every group F i for i ∈ J contains an even number of endpoints of g.

    lines 36–41

    uses balanced_cut_evenly_distributed_cross_matching_sharp, Nat.even_iff, Finset.card_eq_zero.mp

        obtain ⟨f,g,hf,hg,hfg,hgroups,B,hB,hpar⟩ :=
          balanced_cut_evenly_distributed_cross_matching_sharp k n G hsep C U' hcard hUC' hU' J F hJ hCF hdis hsize hanti
        have hBempty : B = ∅ := by
          rw [Nat.even_iff] at hn
          have hc : B.card = 0 := by omega
          exact Finset.card_eq_zero.mp hc
  4. The n-edge matching (f, g) and the single edge (f₀, g₀) have disjoint endpoints.

    On the U-side, f takes values in U' = U \ A while f₀ takes values in A, so f(a) ≠ f₀(b) for all a, b. On the other side, each g(a) belongs to some group F i, which is disjoint from H, whereas g₀(b) ∈ H; hence g(a) ≠ g₀(b) for all a, b.

    lines 42–54

    uses Finset.mem_sdiff.mp, Finset.mem_image.mpr, Finset.mem_univ, Finset.disjoint_left.mp

        have hfd : ∀ a b, f a ≠ f0 b := by
          intro a b he
          have ha := (Finset.mem_sdiff.mp (hfg a).1).2
          apply ha
          dsimp [A]
          exact Finset.mem_image.mpr ⟨b,Finset.mem_univ _,he.symm⟩
        have hgnot : ∀ a, g a ∉ H := by
          intro a ha
          obtain ⟨i,hi,hgi⟩ := hgroups a
          exact Finset.disjoint_left.mp (hHF i hi) ha hgi
        have hgd : ∀ a b, g a ≠ g0 b := by
          intro a b he
          exact hgnot a (he.symm ▸ (hfg0 b).2.1)
  5. Concatenating f with f₀ and g with g₀ produces an injective matching of size n + 1 between U and V(G) \ C.

    Define ff and gg by appending f₀ to f and g₀ to g via Fin.append. Since the components are injective and have disjoint ranges, ff and gg are injective. Case analysis via Fin.addCases shows that every pair (ff(a), gg(a)) is an edge with ff(a) ∈ U and gg(a) ∉ C, because each group F i and the component H are disjoint from C.

    lines 55–68

    uses Fin.append_injective_iff.mpr, Fin.addCases, Finset.disjoint_left.mp, Finset.mem_sdiff.mp

        let ff := Fin.append f f0
        let gg := Fin.append g g0
        have hff : Function.Injective ff := Fin.append_injective_iff.mpr ⟨hf,hf0,hfd⟩
        have hgg : Function.Injective gg := Fin.append_injective_iff.mpr ⟨hg,hg0,hgd⟩
        have hboth : ∀ a, ff a ∈ U ∧ gg a ∉ C ∧ G.Adj (ff a) (gg a) := by
          intro a
          refine Fin.addCases ?_ ?_ a
          · intro b
            obtain ⟨i,hi,hgi⟩ := hgroups b
            have hnC : g b ∉ C := fun h => Finset.disjoint_left.mp (hCF i hi) h hgi
            simpa [ff,gg] using ⟨(Finset.mem_sdiff.mp (hfg b).1).1,hnC,(hfg b).2⟩
          · intro b
            have hnC : g0 b ∉ C := fun h => Finset.disjoint_left.mp hCH h (hfg0 b).2.1
            simpa [ff,gg] using ⟨(hfg0 b).1,hnC,(hfg0 b).2.2⟩
  6. The image of gg is the union of the image of g and the singleton image of g₀.

    By case analysis on whether an index in Fin (n + 1) comes from the first n indices or the last index, the image of gg = Fin.append g g₀ decomposes as image(g) ∪ image(g₀).

    lines 69–84

    uses Finset.mem_image, Finset.mem_univ, true_and, Finset.mem_union, Fin.addCases, Fin.castAdd, Fin.natAdd

        have himage : ((Finset.univ : Finset (Fin (n+1))).image gg) =
            ((Finset.univ : Finset (Fin n)).image g) ∪ ((Finset.univ : Finset (Fin 1)).image g0) := by
          ext v
          simp only [Finset.mem_image,Finset.mem_univ,true_and,Finset.mem_union]
          constructor
          · rintro ⟨a,ha⟩
            cases a using Fin.addCases with
            | left b =>
              left
              exact ⟨b,by simpa [gg] using ha⟩
            | right b =>
              right
              exact ⟨b,by simpa [gg] using ha⟩
          · rintro (⟨b,hb⟩ | ⟨b,hb⟩)
            · exact ⟨Fin.castAdd 1 b,by simpa [gg] using hb⟩
            · exact ⟨Fin.natAdd n b,by simpa [gg] using hb⟩
  7. The combined (n + 1)-edge matching meets each group F i for i ∈ J an even number of times, concluding the proof.

    For each i ∈ J, the endpoint g₀(0) ∈ H is disjoint from F i, so image(g₀) ∩ F i = ∅. Consequently, image(gg) ∩ F i = image(g) ∩ F i. Since the latter has even cardinality from Step 3, the number of endpoints in F i is even.

    lines 85–105

    uses Finset.disjoint_left.mpr, Finset.mem_image.mp, Finset.disjoint_left.mp, Finset.mem_inter, Finset.mem_union, False.elim, Or.inl

        refine ⟨ff,gg,hff,hgg,hboth,?_⟩
        intro i hi
        rw [himage]
        have hzero : Disjoint ((Finset.univ : Finset (Fin 1)).image g0) (F i) := by
          apply Finset.disjoint_left.mpr
          intro v hvg hvi
          obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg
          exact Finset.disjoint_left.mp (hHF i hi) (hfg0 a).2.1 hvi
        have heq : (((Finset.univ : Finset (Fin n)).image g) ∪
            ((Finset.univ : Finset (Fin 1)).image g0)) ∩ F i =
              ((Finset.univ : Finset (Fin n)).image g) ∩ F i := by
          ext v
          simp only [Finset.mem_inter,Finset.mem_union]
          constructor
          · rintro ⟨hv | hv,hvi⟩
            · exact ⟨hv,hvi⟩
            · exact False.elim (Finset.disjoint_left.mp hzero hv hvi)
          · rintro ⟨hv,hvi⟩
            exact ⟨Or.inl hv,hvi⟩
        rw [heq]
        exact hpar i hi (by simp [hBempty])
balanced_cut_anticomplete_side_has_cross_matching
Under the separator condition, if H is disjoint from C and anticomplete outside C ∪ H, and |U|, |H| ≥ r ≥ 1 with U ⊆ C, then there is an injective matching of size r between U and H.
balanced_cut_evenly_distributed_cross_matching_sharp
Under separator assumptions, given pairwise disjoint groups F i outside C, there exists a matching of size r from U to ⋃ F i with at most r % 2 parity violations among the groups.
False.elim
Principal of explosion: from False, any proposition follows.
Fin.addCases
Case analysis principle for Fin (m + n), separating inputs into Fin m and Fin n.
Fin.append_injective_iff.mpr
The concatenation of two functions on finite initial segments is injective if each function is injective and their images are disjoint.
Fin.castAdd
Embeds Fin n into Fin (n + m) by preserving the numerical index.
Fin.natAdd
Embeds Fin m into Fin (n + m) by shifting the index by n.
Finset.card_eq_zero.mp
If a finite set has cardinality 0, then it is empty.
Finset.card_image_of_injective
The image of a finite set under an injective function has the same cardinality as the set.
Finset.card_le_card
If s ⊆ t for finite sets, then |s| ≤ |t|.
Finset.card_sdiff_add_card_inter
For finite sets s and t, |s \ t| + |s ∩ t| = |s|.
Finset.disjoint_left.mp
If two sets are disjoint and an element belongs to the first, then it does not belong to the second.
Finset.disjoint_left.mpr
Two sets are disjoint if no element of the first belongs to the second.
Finset.inter_subset_right
The intersection s₁ ∩ s₂ is a subset of s₂.
Finset.mem_image
An element belongs to the image f(s) if and only if it equals f(a) for some a ∈ s.
Finset.mem_image.mp
If b belongs to the image f(s), then b = f(a) for some a ∈ s.
Finset.mem_image.mpr
If a ∈ s and f(a) = b, then b belongs to the image f(s).
Finset.mem_inter
An element belongs to s₁ ∩ s₂ if and only if it belongs to both s₁ and s₂.
Finset.mem_sdiff.mp
If an element belongs to s \ t, then it belongs to s and not to t.
Finset.mem_union
An element belongs to s ∪ t if and only if it belongs to s or to t.
Finset.mem_univ
Every element of a finite type belongs to its universal set.
Finset.one_le_card.mpr
A finite set has cardinality at least 1 if and only if it is nonempty.
Finset.sdiff_subset
The set difference s \ t is a subset of s.
Nat.even_iff
A natural number n is even if and only if n % 2 = 0.
Or.inl
Constructs a proof of a ∨ b from a proof of a.
true_and
The propositional identity True ∧ p = p.

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_even_component_parity_cross_matching    (k n : ℕ) (hn : Even n) (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 U H : Finset (Fin (4*k))) (hcard : C.card = 2*k) (hUC : U ⊆ C)    (hU : 2*(n+1) ≤ U.card) (hCH : Disjoint C H) (hH : H.Nonempty)    (hHanti : ∀ u ∈ H, ∀ v, v ∉ C → v ∉ H → ¬ G.Adj u v)    {I : Type*} [DecidableEq I] (J : Finset I) (F : I → Finset (Fin (4*k)))    (hJ : n+2 ≤ J.card)    (hCF : ∀ i ∈ J, Disjoint C (F i))    (hHF : ∀ i ∈ J, Disjoint H (F i))    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j))    (hsize : ∀ i ∈ J, 2 ≤ (F i).card)    (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v) :    ∃ f g : Fin (n+1) → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧      (∀ a, f a ∈ U ∧ g a ∉ C ∧ G.Adj (f a) (g a)) ∧      (∀ i ∈ J, Even (((Finset.univ : Finset (Fin (n+1))).image g) ∩ F i).card) := by  set_option maxHeartbeats 4000000 in    classical    obtain ⟨f0,g0,hf0,hg0,hfg0⟩ :=      balanced_cut_anticomplete_side_has_cross_matching k 1 (by omega) G hsep C H U        hcard hCH hUC hHanti (by omega) (Finset.one_le_card.mpr hH)    let A : Finset (Fin (4*k)) := (Finset.univ : Finset (Fin 1)).image f0    let U' := U \ A    have hA : A.card = 1 := by      dsimp [A]      rw [Finset.card_image_of_injective _ hf0]      simp    have hUC' : U' ⊆ C := (Finset.sdiff_subset : U' ⊆ U).trans hUC    have hU' : 2*n ≤ U'.card := by      have hh := Finset.card_sdiff_add_card_inter U A      have hh' : (U ∩ A).card ≤ A.card := Finset.card_le_card Finset.inter_subset_right      dsimp [U']      omega    obtain ⟨f,g,hf,hg,hfg,hgroups,B,hB,hpar⟩ :=      balanced_cut_evenly_distributed_cross_matching_sharp k n G hsep C U' hcard hUC' hU' J F hJ hCF hdis hsize hanti    have hBempty : B = ∅ := by      rw [Nat.even_iff] at hn      have hc : B.card = 0 := by omega      exact Finset.card_eq_zero.mp hc    have hfd : ∀ a b, f a ≠ f0 b := by      intro a b he      have ha := (Finset.mem_sdiff.mp (hfg a).1).2      apply ha      dsimp [A]      exact Finset.mem_image.mpr ⟨b,Finset.mem_univ _,he.symm⟩    have hgnot : ∀ a, g a ∉ H := by      intro a ha      obtain ⟨i,hi,hgi⟩ := hgroups a      exact Finset.disjoint_left.mp (hHF i hi) ha hgi    have hgd : ∀ a b, g a ≠ g0 b := by      intro a b he      exact hgnot a (he.symm ▸ (hfg0 b).2.1)    let ff := Fin.append f f0    let gg := Fin.append g g0    have hff : Function.Injective ff := Fin.append_injective_iff.mpr ⟨hf,hf0,hfd⟩    have hgg : Function.Injective gg := Fin.append_injective_iff.mpr ⟨hg,hg0,hgd⟩    have hboth : ∀ a, ff a ∈ U ∧ gg a ∉ C ∧ G.Adj (ff a) (gg a) := by      intro a      refine Fin.addCases ?_ ?_ a      · intro b        obtain ⟨i,hi,hgi⟩ := hgroups b        have hnC : g b ∉ C := fun h => Finset.disjoint_left.mp (hCF i hi) h hgi        simpa [ff,gg] using ⟨(Finset.mem_sdiff.mp (hfg b).1).1,hnC,(hfg b).2⟩      · intro b        have hnC : g0 b ∉ C := fun h => Finset.disjoint_left.mp hCH h (hfg0 b).2.1        simpa [ff,gg] using ⟨(hfg0 b).1,hnC,(hfg0 b).2.2⟩    have himage : ((Finset.univ : Finset (Fin (n+1))).image gg) =        ((Finset.univ : Finset (Fin n)).image g) ∪ ((Finset.univ : Finset (Fin 1)).image g0) := by      ext v      simp only [Finset.mem_image,Finset.mem_univ,true_and,Finset.mem_union]      constructor      · rintro ⟨a,ha⟩        cases a using Fin.addCases with        | left b =>          left          exact ⟨b,by simpa [gg] using ha⟩        | right b =>          right          exact ⟨b,by simpa [gg] using ha⟩      · rintro (⟨b,hb⟩ | ⟨b,hb⟩)        · exact ⟨Fin.castAdd 1 b,by simpa [gg] using hb⟩        · exact ⟨Fin.natAdd n b,by simpa [gg] using hb⟩    refine ⟨ff,gg,hff,hgg,hboth,?_⟩    intro i hi    rw [himage]    have hzero : Disjoint ((Finset.univ : Finset (Fin 1)).image g0) (F i) := by      apply Finset.disjoint_left.mpr      intro v hvg hvi      obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg      exact Finset.disjoint_left.mp (hHF i hi) (hfg0 a).2.1 hvi    have heq : (((Finset.univ : Finset (Fin n)).image g) ∪        ((Finset.univ : Finset (Fin 1)).image g0)) ∩ F i =          ((Finset.univ : Finset (Fin n)).image g) ∩ F i := by      ext v      simp only [Finset.mem_inter,Finset.mem_union]      constructor      · rintro ⟨hv | hv,hvi⟩        · exact ⟨hv,hvi⟩        · exact False.elim (Finset.disjoint_left.mp hzero hv hvi)      · rintro ⟨hv,hvi⟩        exact ⟨Or.inl hv,hvi⟩    rw [heq]    exact hpar i hi (by simp [hBempty])
See it in the graphDiscuss this resultChallenge it