AFTD Auto-Formalizing Theoretical Domains

balanced_cut_near_perfect_of_incidence_bounds

theoremverified

Under the displayed incidence bounds, minimum degree and unmatched independence cardinality, a balanced-side matching has at least k−1 edges.

Statement

theorem balanced_cut_near_perfect_of_incidence_bounds
    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (hdegree : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card)
    (C : Finset (Fin (4*k))) (hcard : C.card = 2*k)
    (M : G.Subgraph) [DecidablePred (· ∈ M.verts)] (hM : M.IsMatching)
    (hMC : M.verts ⊆ (C : Set (Fin (4*k))))
    (hindU : (C \ M.verts.toFinset).card ≤ k)
    (hbound : ∀ r : ℕ, 2 ≤ r → M.edgeSet.ncard + r = k →
      (∑ u ∈ C \ M.verts.toFinset, ((G.neighborFinset u) ∩ C).card) ≤ 2*r*(k-2*r+1) ∧
      (∑ u ∈ C \ M.verts.toFinset, ((G.neighborFinset u) ∩ Cᶜ).card) ≤ 2*r*k+2*r) :
    k ≤ M.edgeSet.ncard + 1
Source
Balanced-cut reduction for OP-1957; https://arxiv.org/abs/1011.3384.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
Used by 1

The proof, explained

The proof proceeds by contradiction. Assuming the matching $M$ has fewer than $k - 1$ edges, the deficit $r = k - |E(M)|$ satisfies $r \ge 2$. The unmatched vertices $U = C \setminus V(M)$ have size $2k - 2|E(M)| = 2r$, so the minimum degree bound $2k+1$ implies the sum of degrees across $U$ is at least $2r(2k+1)$. On the other hand, decomposing degrees into neighbors in $C$ and $C^c$ and applying the assumed incidence bounds gives a sum of at most $2r(k - 2r + 1) + 2rk + 2r = 2r(2k - 2r + 2)$. Comparing the lower and upper bounds forces $2r \le 1$, which contradicts $r \ge 2$.

  1. Define the matched vertices $D = V(M)$ and unmatched vertices $U = C \setminus D$, and establish $|D| = 2 |E(M)|$.

    We define $D$ to be the finite set of vertices in the matching $M$, and $U$ to be the unmatched vertices in $C$. Because $M$ is a matching, every edge has two endpoints and edges are pairwise disjoint, so the number of matched vertices $|D|$ is twice the edge count $|E(M)|$ by `in1076_matching_twice_card` and `Set.ncard_eq_toFinset_card'`.

    lines 12–19

    uses Set.ncard_eq_toFinset_card', in1076_matching_twice_card

      set_option maxHeartbeats 4000000 in
        classical
        let D : Finset (Fin (4*k)) := M.verts.toFinset
        let U : Finset (Fin (4*k)) := C \ D
        have hD : D.card = 2*M.edgeSet.ncard := by
          dsimp [D]
          rw [← Set.ncard_eq_toFinset_card']
          exact (in1076_matching_twice_card hM).symm
  2. The matched vertices $D$ are contained in $C$, which implies $|E(M)| \le k$.

    Hypothesis `hMC` states that $V(M) \subseteq C$, so $D \subseteq C$. By `Finset.card_le_card`, $|D| \le |C| = 2k$. Since $|D| = 2|E(M)|$, linear arithmetic (`omega`) yields $|E(M)| \le k$.

    lines 20–25

    uses Finset.card_le_card

        have hDC : D ⊆ C := by
          intro v hv
          exact hMC (by simpa [D] using hv)
        have hmle : M.edgeSet.ncard ≤ k := by
          have hh := Finset.card_le_card hDC
          omega
  3. Assuming for contradiction that $|E(M)| + 1 < k$, define $r = k - |E(M)| \ge 2$ and show that $|U| = 2r$.

    We argue by contradiction (`by_contra`): suppose $k > |E(M)| + 1$. Defining the deficit $r = k - |E(M)|$, we have $r \ge 2$ and $|E(M)| + r = k$. Since $D \subseteq C$ and $|C| = 2k$, the set difference $U = C \setminus D$ satisfies $|U| = |C| - |D| = 2k - 2|E(M)| = 2r$ via `Finset.card_sdiff_add_card_eq_card`.

    lines 26–33

    uses Finset.card_sdiff_add_card_eq_card

        by_contra hnot
        let r := k-M.edgeSet.ncard
        have hr : 2 ≤ r := by dsimp [r]; omega
        have hm : M.edgeSet.ncard+r=k := by dsimp [r]; omega
        have hUcard : U.card = 2*r := by
          have hh := Finset.card_sdiff_add_card_eq_card hDC
          dsimp [U]
          omega
  4. Instantiate the incidence bounds `hbound` with parameter $r$.

    Applying the hypothesis `hbound` to $r \ge 2$ and $|E(M)| + r = k$ yields upper bounds on the sum of edges from $U$ to $C$ (at most $2r(k - 2r + 1)$) and from $U$ to $C^c$ (at most $2rk + 2r$).

    lines 34–37

        have hstar := (hbound r hr hm).1
        have hcross := (hbound r hr hm).2
        change (∑ u ∈ U, ((G.neighborFinset u) ∩ C).card) ≤ 2*r*(k-2*r+1) at hstar
        change (∑ u ∈ U, ((G.neighborFinset u) ∩ Cᶜ).card) ≤ 2*r*k+2*r at hcross
  5. The total degree sum over $U$ equals the sum of edges to $C$ plus the sum of edges to $C^c$.

    For every vertex $u$, its neighborhood splits into $N(u) \cap C$ and $N(u) \cap C^c$ using `Finset.card_filter_add_card_filter_not`, `Finset.filter_mem_eq_inter`, `Finset.filter_notMem_eq_sdiff`, and `Finset.sdiff_eq_inter_compl`. Summing over all $u \in U$ with `Finset.sum_add_distrib` and `Finset.sum_congr` decomposes $\sum_{u \in U} \deg(u)$ into the sum of internal and crossing edges.

    lines 38–50

    uses Finset.card_filter_add_card_filter_not, Finset.filter_mem_eq_inter, Finset.filter_notMem_eq_sdiff, Finset.sdiff_eq_inter_compl, Finset.sum_add_distrib, Finset.sum_congr

        have hsplit : ∀ u,
            ((G.neighborFinset u) ∩ C).card + ((G.neighborFinset u) ∩ Cᶜ).card =
              (G.neighborFinset u).card := by
          intro u
          have hh := Finset.card_filter_add_card_filter_not (s:=G.neighborFinset u) (fun v => v ∈ C)
          simpa [Finset.filter_mem_eq_inter, Finset.filter_notMem_eq_sdiff, Finset.sdiff_eq_inter_compl] using hh
        have hsum : (∑ u ∈ U, (G.neighborFinset u).card) =
            (∑ u ∈ U, ((G.neighborFinset u) ∩ C).card) +
            (∑ u ∈ U, ((G.neighborFinset u) ∩ Cᶜ).card) := by
          rw [← Finset.sum_add_distrib]
          apply Finset.sum_congr rfl
          intro u hu
          exact (hsplit u).symm
  6. The total degree of $U$ satisfies $2r(2k+1) \le \sum_{u \in U} |N(u) \cap C| + \sum_{u \in U} |N(u) \cap C^c|$.

    Because each vertex has degree at least $2k+1$, `Finset.sum_le_sum` gives $|U|(2k+1) \le \sum_{u \in U} \deg(u)$. Replacing $|U|$ with $2r$ and rewriting the total degree sum with the previous decomposition gives the desired lower bound.

    lines 51–54

    uses Finset.sum_le_sum

        have hdegreeSum : U.card*(2*k+1) ≤ ∑ u ∈ U, (G.neighborFinset u).card := by
          have hh := Finset.sum_le_sum (s:=U) (fun u _ => hdegree u)
          simpa using hh
        rw [hsum,hUcard] at hdegreeSum
  7. A contradiction is reached between the degree lower bound and incidence upper bounds. automation

    Hypothesis `hindU` implies $|U| = 2r \le k$. Adding the two incidence upper bounds gives $\sum_{u \in U} \deg(u) \le 2r(k - 2r + 1) + 2rk + 2r = 2r(2k - 2r + 2)$. Comparing this with the lower bound $2r(2k+1)$ forces $2k+1 \le 2k - 2r + 2$, whence $2r \le 1$, contradicting $r \ge 2$. Non-linear arithmetic (`nlinarith`) closes the proof.

    lines 55–59

        have hrk : 2*r ≤ k := by
          change U.card ≤ k at hindU
          omega
        have hsub : k-2*r+1+2*r=k+1 := by omega
        nlinarith
in1076_matching_twice_card
In any matching in a graph, the number of vertices spanned by the matching is twice the number of edges.
Set.ncard_eq_toFinset_card'
The cardinality (`ncard`) of a finite set as a `Set` equals the cardinality of its `Finset` representation.
Finset.card_le_card
If a finite set $s$ is a subset of $t$, then the cardinality of $s$ is at most the cardinality of $t$.
Finset.card_sdiff_add_card_eq_card
If $s \subseteq t$ are finite sets, then the cardinality of the difference $t \setminus s$ plus the cardinality of $s$ equals the cardinality of $t$.
Finset.card_filter_add_card_filter_not
Filtering a finite set by a predicate and by its negation partitions the set, so the sum of their cardinalities equals the total cardinality.
Finset.filter_mem_eq_inter
Filtering a finite set $s$ by membership in $t$ is equal to the intersection $s \cap t$.
Finset.filter_notMem_eq_sdiff
Filtering a finite set $s$ by non-membership in $t$ is equal to the difference $s \setminus t$.
Finset.sdiff_eq_inter_compl
In a finite universe, the set difference $s \setminus t$ equals the intersection $s \cap t^c$.
Finset.sum_add_distrib
A sum of a pointwise sum of functions over a finite set distributes into the sum of each function.
Finset.sum_congr
Two sums over finite sets are equal if the index sets are equal and the summands agree on each element.
Finset.sum_le_sum
If $f(i) \le g(i)$ for all elements $i$ of a finite set, then the sum of $f$ over the set is at most the sum of $g$.

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_near_perfect_of_incidence_bounds    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (hdegree : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card)    (C : Finset (Fin (4*k))) (hcard : C.card = 2*k)    (M : G.Subgraph) [DecidablePred (· ∈ M.verts)] (hM : M.IsMatching)    (hMC : M.verts ⊆ (C : Set (Fin (4*k))))    (hindU : (C \ M.verts.toFinset).card ≤ k)    (hbound : ∀ r : ℕ, 2 ≤ r → M.edgeSet.ncard + r = k →      (∑ u ∈ C \ M.verts.toFinset, ((G.neighborFinset u) ∩ C).card) ≤ 2*r*(k-2*r+1) ∧      (∑ u ∈ C \ M.verts.toFinset, ((G.neighborFinset u) ∩ Cᶜ).card) ≤ 2*r*k+2*r) :    k ≤ M.edgeSet.ncard + 1 := by  set_option maxHeartbeats 4000000 in    classical    let D : Finset (Fin (4*k)) := M.verts.toFinset    let U : Finset (Fin (4*k)) := C \ D    have hD : D.card = 2*M.edgeSet.ncard := by      dsimp [D]      rw [← Set.ncard_eq_toFinset_card']      exact (in1076_matching_twice_card hM).symm    have hDC : D ⊆ C := by      intro v hv      exact hMC (by simpa [D] using hv)    have hmle : M.edgeSet.ncard ≤ k := by      have hh := Finset.card_le_card hDC      omega    by_contra hnot    let r := k-M.edgeSet.ncard    have hr : 2 ≤ r := by dsimp [r]; omega    have hm : M.edgeSet.ncard+r=k := by dsimp [r]; omega    have hUcard : U.card = 2*r := by      have hh := Finset.card_sdiff_add_card_eq_card hDC      dsimp [U]      omega    have hstar := (hbound r hr hm).1    have hcross := (hbound r hr hm).2    change (∑ u ∈ U, ((G.neighborFinset u) ∩ C).card) ≤ 2*r*(k-2*r+1) at hstar    change (∑ u ∈ U, ((G.neighborFinset u) ∩ Cᶜ).card) ≤ 2*r*k+2*r at hcross    have hsplit : ∀ u,        ((G.neighborFinset u) ∩ C).card + ((G.neighborFinset u) ∩ Cᶜ).card =          (G.neighborFinset u).card := by      intro u      have hh := Finset.card_filter_add_card_filter_not (s:=G.neighborFinset u) (fun v => v ∈ C)      simpa [Finset.filter_mem_eq_inter, Finset.filter_notMem_eq_sdiff, Finset.sdiff_eq_inter_compl] using hh    have hsum : (∑ u ∈ U, (G.neighborFinset u).card) =        (∑ u ∈ U, ((G.neighborFinset u) ∩ C).card) +        (∑ u ∈ U, ((G.neighborFinset u) ∩ Cᶜ).card) := by      rw [← Finset.sum_add_distrib]      apply Finset.sum_congr rfl      intro u hu      exact (hsplit u).symm    have hdegreeSum : U.card*(2*k+1) ≤ ∑ u ∈ U, (G.neighborFinset u).card := by      have hh := Finset.sum_le_sum (s:=U) (fun u _ => hdegree u)      simpa using hh    rw [hsum,hUcard] at hdegreeSum    have hrk : 2*r ≤ k := by      change U.card ≤ k at hindU      omega    have hsub : k-2*r+1+2*r=k+1 := by omega    nlinarith
See it in the graphDiscuss this resultChallenge it