AFTD Auto-Formalizing Theoretical Domains

pairwise_disjoint_nonempty_groups_card_bound

theoremverified

In a pairwise-disjoint finite family of nonempty finite sets, each chosen set has at most the size of the union minus the number of other sets.

Statement

theorem pairwise_disjoint_nonempty_groups_card_bound
    {ι V : Type*} [DecidableEq ι] [DecidableEq V]
    (I : Finset ι) (T : ι → Finset V) (j : ι)
    (hj : j ∈ I)
    (hdis : ∀ i ∈ I, ∀ l ∈ I, i ≠ l → Disjoint (T i) (T l))
    (hne : ∀ i ∈ I, (T i).Nonempty) :
    (T j).card + I.card ≤ (I.biUnion T).card + 1
Source
OP-1957: aggregate barrier component bound.
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 6

The proof, explained

Since the sets T(i) are pairwise disjoint, the size of their union equals the sum of their individual sizes. Because each set is nonempty, each of the sets in I \ {j} has size at least 1, so their combined size is at least |I \ {j}|. Isolating T(j) from the sum and writing |I| = |I \ {j}| + 1, the desired inequality follows by linear arithmetic.

  1. It suffices to show |T(j)| + |I| ≤ ∑ i ∈ I, |T(i)| + 1.

    From the hypothesis `hdis` that distinct indices correspond to disjoint sets, the family T is pairwise disjoint over I. Using `Finset.card_biUnion`, the cardinality of the union |⋃ i ∈ I, T(i)| in the goal is rewritten as the sum of the individual cardinalities ∑ i ∈ I, |T(i)|.

    lines 8–12

    uses Finset.card_biUnion

      classical
      have hpair : (I : Set ι).PairwiseDisjoint T := by
        intro a ha b hb hab
        exact hdis a ha b hb hab
      rw [Finset.card_biUnion hpair]
  2. The number of remaining indices is at most the sum of their set sizes: |I \ {j}| ≤ ∑ i ∈ I \ {j}, |T(i)|.

    The cardinality |I \ {j}| equals the sum of 1 over all indices in I \ {j}. Since each set T(i) is nonempty by hypothesis `hne`, its cardinality is at least 1 by `Finset.card_pos.mpr` and `Finset.mem_of_mem_erase`. Applying `Finset.sum_le_sum` to compare 1 with |T(i)| termwise establishes the inequality.

    lines 13–19

    uses Finset.sum_le_sum, Finset.card_pos.mpr, Finset.mem_of_mem_erase

      have hsum : (I.erase j).card ≤ ∑ i ∈ I.erase j, (T i).card := by
        calc
          (I.erase j).card = ∑ _i ∈ I.erase j, (1 : ℕ) := by simp
          _ ≤ ∑ i ∈ I.erase j, (T i).card := by
            apply Finset.sum_le_sum
            intro i hi
            exact Finset.card_pos.mpr (hne i (Finset.mem_of_mem_erase hi))
  3. Combining the decompositions of ∑ i ∈ I, |T(i)| and |I| with the bound on I \ {j} establishes |T(j)| + |I| ≤ ∑ i ∈ I, |T(i)| + 1.

    By `Finset.sum_erase_add`, the sum decomposes into ∑ i ∈ I, |T(i)| = |T(j)| + ∑ i ∈ I \ {j}, |T(i)|. By `Finset.card_erase_add_one`, the size of the index set satisfies |I| = |I \ {j}| + 1. The decision procedure `omega` closes the goal by linear integer arithmetic from these two equalities and the bound `hsum`.

    lines 20–22

    uses Finset.sum_erase_add, Finset.card_erase_add_one

      have hs := Finset.sum_erase_add I (fun i => (T i).card) hj
      have hc := Finset.card_erase_add_one hj
      omega
Finset.card_biUnion
The cardinality of a finite union of pairwise disjoint finite sets equals the sum of their individual cardinalities.
Finset.sum_le_sum
If f(i) ≤ g(i) for all elements i in a finite set, then the sum of f over the set is at most the sum of g.
Finset.card_pos.mpr
A nonempty finite set has strictly positive cardinality (at least 1).
Finset.mem_of_mem_erase
An element belonging to a set with one element removed belongs to the original set.
Finset.sum_erase_add
The sum of a function over a finite set equals the value at a chosen element plus the sum over the remaining elements.
Finset.card_erase_add_one
Removing an element from a finite set decreases its cardinality by 1.

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 pairwise_disjoint_nonempty_groups_card_bound    {ι V : Type*} [DecidableEq ι] [DecidableEq V]    (I : Finset ι) (T : ι → Finset V) (j : ι)    (hj : j ∈ I)    (hdis : ∀ i ∈ I, ∀ l ∈ I, i ≠ l → Disjoint (T i) (T l))    (hne : ∀ i ∈ I, (T i).Nonempty) :    (T j).card + I.card ≤ (I.biUnion T).card + 1 := by  classical  have hpair : (I : Set ι).PairwiseDisjoint T := by    intro a ha b hb hab    exact hdis a ha b hb hab  rw [Finset.card_biUnion hpair]  have hsum : (I.erase j).card ≤ ∑ i ∈ I.erase j, (T i).card := by    calc      (I.erase j).card = ∑ _i ∈ I.erase j, (1 : ℕ) := by simp      _ ≤ ∑ i ∈ I.erase j, (T i).card := by        apply Finset.sum_le_sum        intro i hi        exact Finset.card_pos.mpr (hne i (Finset.mem_of_mem_erase hi))  have hs := Finset.sum_erase_add I (fun i => (T i).card) hj  have hc := Finset.card_erase_add_one hj  omega
See it in the graphDiscuss this resultChallenge it