AFTD Auto-Formalizing Theoretical Domains

four_disjoint_subsets_card_sum_le

theoremverified

Four pairwise disjoint subsets of a finite set have total size at most the size of that set.

Statement

theorem four_disjoint_subsets_card_sum_le {V : Type*} [DecidableEq V] (s1 s2 s3 s4 T : Finset V)
    (h1 : s1 ⊆ T) (h2 : s2 ⊆ T) (h3 : s3 ⊆ T) (h4 : s4 ⊆ T)
    (d12 : Disjoint s1 s2) (d13 : Disjoint s1 s3) (d14 : Disjoint s1 s4)
    (d23 : Disjoint s2 s3) (d24 : Disjoint s2 s4) (d34 : Disjoint s3 s4) :
    s1.card + s2.card + s3.card + s4.card ≤ T.card
Source
OP-1957: graph-to-count transfer for the size-five block forced-edge route (IN-1126).
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 5

The proof, explained

Because the four subsets are pairwise disjoint, the cardinality of their fourfold union equals the sum of their individual cardinalities. Since every subset is contained in $T$, their union is also a subset of $T$, so its size is at most $|T|$. Combining this cardinality bound with the sum decomposition yields the desired inequality.

  1. The cardinality of each successive union is the sum of the cardinalities of its parts: $|s_1 ∪ s_2| = |s_1| + |s_2|$, $|s_1 ∪ s_2 ∪ s_3| = |s_1 ∪ s_2| + |s_3|$, and $|s_1 ∪ s_2 ∪ s_3 ∪ s_4| = |s_1 ∪ s_2 ∪ s_3| + |s_4|$.

    Because $s_1$ and $s_2$ are disjoint, $|s_1 ∪ s_2| = |s_1| + |s_2|$ by `Finset.card_union_of_disjoint`. Next, since $s_3$ is disjoint from both $s_1$ and $s_2$, `Finset.disjoint_union_left.mpr` shows it is disjoint from their union $s_1 ∪ s_2$, giving $|s_1 ∪ s_2 ∪ s_3| = |s_1 ∪ s_2| + |s_3|$. Similarly, as $s_4$ is disjoint from $s_1$, $s_2$, and $s_3$, two applications of `Finset.disjoint_union_left.mpr` show it is disjoint from $s_1 ∪ s_2 ∪ s_3$, so $|s_1 ∪ s_2 ∪ s_3 ∪ s_4| = |s_1 ∪ s_2 ∪ s_3| + |s_4|$.

    lines 6–11

    uses Finset.card_union_of_disjoint, Finset.disjoint_union_left.mpr

      have e1 : (s1 ∪ s2).card = s1.card + s2.card := Finset.card_union_of_disjoint d12
      have e2 : (s1 ∪ s2 ∪ s3).card = (s1 ∪ s2).card + s3.card :=
        Finset.card_union_of_disjoint (Finset.disjoint_union_left.mpr ⟨d13, d23⟩)
      have e3 : (s1 ∪ s2 ∪ s3 ∪ s4).card = (s1 ∪ s2 ∪ s3).card + s4.card :=
        Finset.card_union_of_disjoint (Finset.disjoint_union_left.mpr
          ⟨Finset.disjoint_union_left.mpr ⟨d14, d24⟩, d34⟩)
  2. The union $s_1 ∪ s_2 ∪ s_3 ∪ s_4$ is a subset of $T$, and therefore $|s_1 ∪ s_2 ∪ s_3 ∪ s_4| ≤ |T|$.

    Since each of $s_1, s_2, s_3, s_4$ is a subset of $T$, repeated application of `Finset.union_subset` shows that their union $s_1 ∪ s_2 ∪ s_3 ∪ s_4$ is also contained in $T$. By `Finset.card_le_card`, a subset has cardinality at most that of the ambient set, so $|s_1 ∪ s_2 ∪ s_3 ∪ s_4| ≤ |T|$.

    lines 12–14

    uses Finset.union_subset, Finset.card_le_card

      have hsub : s1 ∪ s2 ∪ s3 ∪ s4 ⊆ T :=
        Finset.union_subset (Finset.union_subset (Finset.union_subset h1 h2) h3) h4
      have := Finset.card_le_card hsub
  3. $|s_1| + |s_2| + |s_3| + |s_4| ≤ |T|$.

    The three cardinality equations express $|s_1 ∪ s_2 ∪ s_3 ∪ s_4|$ as the sum $|s_1| + |s_2| + |s_3| + |s_4|$. Combining these equations with the upper bound $|s_1 ∪ s_2 ∪ s_3 ∪ s_4| ≤ |T|$ directly yields the inequality by linear integer arithmetic.

    line 15

      omega
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.disjoint_union_left.mpr
If two sets are each disjoint from a third set, then their union is disjoint from that third set.
Finset.union_subset
If two sets are each subsets of a third set, then their union is also a subset of that third set.
Finset.card_le_card
If one finite set is a subset of another, its cardinality is at most the cardinality of the other.

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 four_disjoint_subsets_card_sum_le {V : Type*} [DecidableEq V] (s1 s2 s3 s4 T : Finset V)    (h1 : s1 ⊆ T) (h2 : s2 ⊆ T) (h3 : s3 ⊆ T) (h4 : s4 ⊆ T)    (d12 : Disjoint s1 s2) (d13 : Disjoint s1 s3) (d14 : Disjoint s1 s4)    (d23 : Disjoint s2 s3) (d24 : Disjoint s2 s4) (d34 : Disjoint s3 s4) :    s1.card + s2.card + s3.card + s4.card ≤ T.card := by  have e1 : (s1 ∪ s2).card = s1.card + s2.card := Finset.card_union_of_disjoint d12  have e2 : (s1 ∪ s2 ∪ s3).card = (s1 ∪ s2).card + s3.card :=    Finset.card_union_of_disjoint (Finset.disjoint_union_left.mpr ⟨d13, d23⟩)  have e3 : (s1 ∪ s2 ∪ s3 ∪ s4).card = (s1 ∪ s2 ∪ s3).card + s4.card :=    Finset.card_union_of_disjoint (Finset.disjoint_union_left.mpr      ⟨Finset.disjoint_union_left.mpr ⟨d14, d24⟩, d34⟩)  have hsub : s1 ∪ s2 ∪ s3 ∪ s4 ⊆ T :=    Finset.union_subset (Finset.union_subset (Finset.union_subset h1 h2) h3) h4  have := Finset.card_le_card hsub  omega
See it in the graphDiscuss this resultChallenge it