AFTD Auto-Formalizing Theoretical Domains

op1957_two_exceptional_groups_exact_block_pool

theoremverified

A disjoint family with at most two groups meeting the complement of B splits into B-only groups and two slots, with every occupied slot meeting the complement of B and the pool having at least one vertex per group.

Statement

theorem op1957_two_exceptional_groups_exact_block_pool
    {I V : Type*} [DecidableEq I] [DecidableEq V]
    (K : Finset I) (F : I → Finset V) (B : Finset V)
    (hne : ∀ i ∈ K, (F i).Nonempty)
    (hdis : ∀ i ∈ K, ∀ j ∈ K, i ≠ j → Disjoint (F i) (F j))
    (houtside : (K.filter (fun i => (F i \ B).Nonempty)).card ≤ 2) :
    ∃ J ⊆ K, ∃ P Q : Finset V,
      (∀ i ∈ J, F i ⊆ B) ∧
      (∀ i ∈ K \ J, (F i \ B).Nonempty) ∧
      (P = ∅ ∨ ∃ i ∈ K \ J, P = F i) ∧
      (Q = ∅ ∨ ∃ i ∈ K \ J, Q = F i) ∧
      (∀ i ∈ K \ J, F i = P ∨ F i = Q) ∧
      Disjoint P Q ∧
      (∀ i ∈ J, Disjoint (F i) P ∧ Disjoint (F i) Q) ∧
      J.card + (if P.Nonempty then 1 else 0) +
        (if Q.Nonempty then 1 else 0) = K.card ∧
      J.card ≤ (J.biUnion F).card
Source
OP-1957: exact exceptional group pool
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 2

The proof, explained

First, any pairwise disjoint family of nonempty sets indexed by a set of cardinality at most 2 can be packed into at most two disjoint slots, verified by case analysis on whether the index set has size 0, 1, or 2 (in1245_two_slots). To prove the main theorem, the index set K is partitioned into H (at most two groups meeting the complement of B) and J = K \\ H (groups fully inside B). Applying the two-slot lemma to H yields two disjoint slots P and Q containing all exceptional groups, which remain disjoint from the groups in J by pairwise disjointness. Finally, the pool bound |J| ≤ |⋃_{i ∈ J} F i| follows from pairwise disjointness and nonemptiness of the groups in J, and the total group count is conserved.

  1. Split into cases on whether |J| is 0, 1, or 2.

    Because |J| ≤ 2, linear integer arithmetic (omega) determines that |J| must be 0, 1, or 2.

    lines 13–15

      classical
      have cases : J.card = 0 ∨ J.card = 1 ∨ J.card = 2 := by omega
      rcases cases with hzero | hone | htwo
  2. In the case |J| = 0, setting P = ∅ and Q = ∅ satisfies the two-slot conditions.

    Since |J| = 0, Finset.card_eq_zero.mp implies J = ∅. Setting P = ∅ and Q = ∅ satisfies all conditions vacuously: both sets are empty, disjoint, cover every group in J, and the slot count 0 + 0 = 0 equals |J|.

    lines 16–18

    uses Finset.card_eq_zero.mp

      · have hJ : J = ∅ := Finset.card_eq_zero.mp hzero
        subst J
        exact ⟨∅, ∅, by simp⟩
  3. In the case |J| = 1, setting P = F i and Q = ∅ satisfies the two-slot conditions.

    Since |J| = 1, Finset.card_eq_one.mp gives J = {i}. Since F i is nonempty, we choose P = F i and Q = ∅. By Or.inr, P equals F i; by Or.inl, Q is empty. They are disjoint, every group in J equals P (using Or.inl), and the count of nonempty slots 1 + 0 = 1 matches |J|.

    lines 19–30

    uses Finset.card_eq_one.mp, Or.inl, Or.inr

      · obtain ⟨i, hJ⟩ := Finset.card_eq_one.mp hone
        subst J
        have hi : (F i).Nonempty := hnonempty i (by simp)
        refine ⟨F i, ∅, ?_, ?_, ?_, ?_, ?_⟩
        · exact Or.inr ⟨i, by simp, rfl⟩
        · exact Or.inl rfl
        · simp
        · intro j hj
          have : j = i := by simpa using hj
          subst j
          exact Or.inl rfl
        · simp [hi]
  4. In the case |J| = 2, setting P = F i and Q = F j satisfies the two-slot conditions.

    Since |J| = 2, Finset.card_eq_two.mp gives J = {i, j} with i ≠ j. Both F i and F j are nonempty, so we choose P = F i and Q = F j. Both belong to the family using Or.inr, and they are disjoint by hypothesis hdis since i ≠ j. Any element r ∈ J equals i or j by Finset.mem_insert and Finset.mem_singleton, so every group in J equals P or Q. The slot count 1 + 1 = 2 matches |J|.

    lines 31–42

    uses Finset.card_eq_two.mp, Finset.mem_insert, Finset.mem_singleton, Or.inr

      · obtain ⟨i,j,hij,hJ⟩ := Finset.card_eq_two.mp htwo
        subst J
        have hi : (F i).Nonempty := hnonempty i (by simp)
        have hj : (F j).Nonempty := hnonempty j (by simp)
        refine ⟨F i, F j, ?_, ?_, ?_, ?_, ?_⟩
        · exact Or.inr ⟨i, by simp, rfl⟩
        · exact Or.inr ⟨j, by simp, rfl⟩
        · exact hdis i (by simp) j (by simp) hij
        · intro r hr
          simp only [Finset.mem_insert, Finset.mem_singleton] at hr
          rcases hr with rfl | rfl <;> simp
        · simp [hi,hj,hij]
  5. Define H as the indices of groups meeting the complement of B and J as its complement in K, both subsets of K.

    Using classical logic, we define H = {i ∈ K | (F i \\ B).Nonempty} and J = K \\ H. By Finset.filter_subset and Finset.sdiff_subset, both H and J are subsets of K.

    lines 61–65

    uses Finset.filter_subset, Finset.sdiff_subset

      classical
      let H := K.filter (fun i => (F i \ B).Nonempty)
      let J := K \ H
      have hHK : H ⊆ K := Finset.filter_subset _ _
      have hJK : J ⊆ K := Finset.sdiff_subset
  6. The set difference K \\ J equals H.

    By set extensionality and unfolding the definition of set difference using Finset.mem_sdiff, an index i belongs to K \\ (K \\ H) if and only if i ∈ K and not (i ∈ K and i ∉ H), which simplifies to i ∈ H.

    lines 66–74

    uses Finset.mem_sdiff

      have hKH : K \ J = H := by
        ext i
        simp only [J,Finset.mem_sdiff]
        constructor
        · rintro ⟨hi,hn⟩
          by_contra hh
          exact hn ⟨hi,hh⟩
        · intro hi
          exact ⟨hHK hi,fun hh => hh.2 hi⟩
  7. Every group indexed by J is completely contained in B.

    Take i ∈ J and v ∈ F i. By definition of J, i ∉ H (via Finset.mem_sdiff.mp). If v were not in B, then v would belong to F i \\ B by Finset.mem_sdiff.mpr, placing i into H by Finset.mem_filter.mpr, a contradiction. Hence F i ⊆ B.

    lines 75–81

    uses Finset.mem_filter.mpr, Finset.mem_sdiff.mp, Finset.mem_sdiff.mpr

      have hJB : ∀ i ∈ J, F i ⊆ B := by
        intro i hi v hv
        have hiK := hJK hi
        have hiH : i ∉ H := (Finset.mem_sdiff.mp hi).2
        by_contra hvB
        apply hiH
        exact Finset.mem_filter.mpr ⟨hiK,⟨v,Finset.mem_sdiff.mpr ⟨hv,hvB⟩⟩⟩
  8. The groups indexed by H inherit nonemptiness and pairwise disjointness from K.

    Because H ⊆ K, any index in H is in K, so its group is nonempty by the nonemptiness hypothesis on K. Similarly, any two distinct indices in H are distinct in K, so their groups are disjoint by the pairwise disjointness hypothesis on K.

    lines 82–84

      have hnH : ∀ i ∈ H, (F i).Nonempty := fun i hi => hne i (hHK hi)
      have hdH : ∀ i ∈ H, ∀ j ∈ H, i ≠ j → Disjoint (F i) (F j) :=
        fun i hi j hj hij => hdis i (hHK hi) j (hHK hj) hij
  9. There exist two disjoint slots P and Q containing all groups indexed by H, with the number of occupied slots equaling |H|.

    Since |H| ≤ 2 by the assumption houtside, applying lemma in1245_two_slots to H and F produces two disjoint sets P and Q such that each is either empty or a group from H, every group in H equals P or Q, and the count of nonempty slots equals |H|.

    line 85

    uses in1245_two_slots

      obtain ⟨P,Q,hP,hQ,hPQ,hslot,hcount⟩ := in1245_two_slots H F houtside hnH hdH
  10. Every group indexed by J is disjoint from every group indexed by H.

    For i ∈ J and j ∈ H, i and j are distinct because J and H are disjoint sets of indices (via Finset.mem_sdiff.mp). Since both belong to K and are distinct, F i and F j are disjoint by the global disjointness hypothesis.

    lines 86–90

    uses Finset.mem_sdiff.mp

      have hJdis : ∀ i ∈ J, ∀ j ∈ H, Disjoint (F i) (F j) := by
        intro i hi j hj
        have hneij : i ≠ j := by
          intro he; subst j; exact (Finset.mem_sdiff.mp hi).2 hj
        exact hdis i (hJK hi) j (hHK hj) hneij
  11. Every group indexed by J is disjoint from both slot P and slot Q.

    For any i ∈ J, slot P is either empty (hence trivially disjoint from F i) or equals F j for some j ∈ H, which is disjoint from F i by the cross-disjointness between J and H. The identical case split applies to Q.

    lines 91–100

      have hPJ : ∀ i ∈ J, Disjoint (F i) P := by
        intro i hi
        rcases hP with hp | ⟨j,hj,hp⟩
        · simp [hp]
        · rw [hp]; exact hJdis i hi j hj
      have hQJ : ∀ i ∈ J, Disjoint (F i) Q := by
        intro i hi
        rcases hQ with hq | ⟨j,hj,hq⟩
        · simp [hq]
        · rw [hq]; exact hJdis i hi j hj
  12. The total number of indices satisfies |J| + |H| = |K|.

    Because H ⊆ K and J = K \\ H, Finset.card_sdiff_add_card_eq_card directly gives |K \\ H| + |H| = |K|, which is |J| + |H| = |K|.

    line 101

    uses Finset.card_sdiff_add_card_eq_card

      have hcard : J.card + H.card = K.card := Finset.card_sdiff_add_card_eq_card hHK
  13. The pool contains at least one vertex per group: |J| ≤ |⋃_{i ∈ J} F i|.

    We split on whether J is nonempty. If J is nonempty, choose an element j ∈ J; by pairwise_disjoint_nonempty_groups_card_bound, |F j| + |J| ≤ |⋃_{i ∈ J} F i| + 1. Since F j is nonempty, |F j| ≥ 1 by Finset.card_pos.mpr, and linear arithmetic (omega) yields |J| ≤ |⋃_{i ∈ J} F i|. If J is empty by Finset.not_nonempty_iff_eq_empty.mp, both sides are 0.

    lines 102–111

    uses Finset.card_pos.mpr, Finset.not_nonempty_iff_eq_empty.mp, pairwise_disjoint_nonempty_groups_card_bound

      have hbound : J.card ≤ (J.biUnion F).card := by
        by_cases hJ : J.Nonempty
        · obtain ⟨j,hj⟩ := hJ
          have hh := pairwise_disjoint_nonempty_groups_card_bound J F j hj
            (fun i hi l hl hil => hdis i (hJK hi) l (hJK hl) hil)
            (fun i hi => hne i (hJK hi))
          have hpos : 1 ≤ (F j).card := Finset.card_pos.mpr (hne j (hJK hj))
          omega
        · have hJ0 : J = ∅ := Finset.not_nonempty_iff_eq_empty.mp hJ
          simp [hJ0]
  14. The witnesses J, P, and Q satisfy all conditions of the theorem.

    We provide J, P, and Q as witnesses. The properties J ⊆ K, F i ⊆ B for i ∈ J, Disjoint P Q, cross-disjointness with groups in J, and the pool bound were already shown. For i ∈ K \\ J, rewriting with K \\ J = H gives that F i \\ B is nonempty by Finset.mem_filter.mp, and the slot assignments follow from the properties of H. Finally, |J| plus the number of nonempty slots equals |K| by linear arithmetic (omega) combining |J| + |H| = |K| and the slot count equality for H.

    lines 112–120

    uses Finset.mem_filter.mp

      refine ⟨J,hJK,P,Q,hJB,?_,?_,?_,?_,hPQ,?_,?_,hbound⟩
      · intro i hi
        have hiH : i ∈ H := hKH ▸ hi
        exact (Finset.mem_filter.mp hiH).2
      · simpa [hKH] using hP
      · simpa [hKH] using hQ
      · simpa [hKH] using hslot
      · exact fun i hi => ⟨hPJ i hi,hQJ i hi⟩
      · omega
Finset.card_eq_zero.mp
A finite set with cardinality zero is empty.
Finset.card_eq_one.mp
A finite set with cardinality one is a singleton {a}.
Finset.card_eq_two.mp
A finite set with cardinality two consists of exactly two distinct elements {x, y}.
Or.inl
Introduces a disjunction from its left disjunct: a → a ∨ b.
Or.inr
Introduces a disjunction from its right disjunct: b → a ∨ b.
Finset.mem_insert
An element belongs to insert b s if and only if it equals b or belongs to s.
Finset.mem_singleton
An element belongs to the singleton {a} if and only if it equals a.
Finset.filter_subset
Filtering a finite set by a predicate yields a subset of the original set.
Finset.sdiff_subset
The set difference of two finite sets is a subset of the first set.
Finset.mem_sdiff
An element belongs to the set difference s \\ t if and only if it belongs to s and does not belong to t.
Finset.mem_sdiff.mp
If an element belongs to the set difference s \\ t, then it belongs to s and does not belong to t.
Finset.mem_sdiff.mpr
If an element belongs to s and does not belong to t, then it belongs to the set difference s \\ t.
Finset.mem_filter.mpr
If an element belongs to s and satisfies predicate p, then it belongs to the filtered set {x ∈ s | p x}.
Finset.mem_filter.mp
If an element belongs to a filtered finite set {x ∈ s | p x}, then it belongs to s and satisfies p.
in1245_two_slots
Any pairwise disjoint family of nonempty sets indexed by a set of cardinality at most 2 can be packed into at most two disjoint slots, each of which is empty or one of the sets, covering every set in the family.
Finset.card_sdiff_add_card_eq_card
For any subset s ⊆ t of a finite set, the cardinality of the difference (t \\ s) plus the cardinality of s equals the cardinality of t.
pairwise_disjoint_nonempty_groups_card_bound
For any designated element in a pairwise disjoint family of nonempty finite sets, the size of that element's set plus the number of sets is at most one more than the size of the union of all sets.
Finset.card_pos.mpr
A finite set is nonempty implies its cardinality is strictly greater than zero (at least 1).
Finset.not_nonempty_iff_eq_empty.mp
A finite set that is not nonempty is empty.

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

set_option maxHeartbeats 1000000theorem in1245_two_slots    {I V : Type*} [DecidableEq I] [DecidableEq V]    (J : Finset I) (F : I → Finset V) (hcard : J.card ≤ 2)    (hnonempty : ∀ i ∈ J, (F i).Nonempty)    (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j)) :    ∃ P Q : Finset V,      (P = ∅ ∨ ∃ i ∈ J, P = F i) ∧      (Q = ∅ ∨ ∃ i ∈ J, Q = F i) ∧      Disjoint P Q ∧ (∀ i ∈ J, F i = P ∨ F i = Q) ∧      (if P.Nonempty then 1 else 0) + (if Q.Nonempty then 1 else 0) = J.card := by  classical  have cases : J.card = 0 ∨ J.card = 1 ∨ J.card = 2 := by omega  rcases cases with hzero | hone | htwo  · have hJ : J = ∅ := Finset.card_eq_zero.mp hzero    subst J    exact ⟨∅, ∅, by simp⟩  · obtain ⟨i, hJ⟩ := Finset.card_eq_one.mp hone    subst J    have hi : (F i).Nonempty := hnonempty i (by simp)    refine ⟨F i, ∅, ?_, ?_, ?_, ?_, ?_⟩    · exact Or.inr ⟨i, by simp, rfl⟩    · exact Or.inl rfl    · simp    · intro j hj      have : j = i := by simpa using hj      subst j      exact Or.inl rfl    · simp [hi]  · obtain ⟨i,j,hij,hJ⟩ := Finset.card_eq_two.mp htwo    subst J    have hi : (F i).Nonempty := hnonempty i (by simp)    have hj : (F j).Nonempty := hnonempty j (by simp)    refine ⟨F i, F j, ?_, ?_, ?_, ?_, ?_⟩    · exact Or.inr ⟨i, by simp, rfl⟩    · exact Or.inr ⟨j, by simp, rfl⟩    · exact hdis i (by simp) j (by simp) hij    · intro r hr      simp only [Finset.mem_insert, Finset.mem_singleton] at hr      rcases hr with rfl | rfl <;> simp    · simp [hi,hj,hij]theorem op1957_two_exceptional_groups_exact_block_pool    {I V : Type*} [DecidableEq I] [DecidableEq V]    (K : Finset I) (F : I → Finset V) (B : Finset V)    (hne : ∀ i ∈ K, (F i).Nonempty)    (hdis : ∀ i ∈ K, ∀ j ∈ K, i ≠ j → Disjoint (F i) (F j))    (houtside : (K.filter (fun i => (F i \ B).Nonempty)).card ≤ 2) :    ∃ J ⊆ K, ∃ P Q : Finset V,      (∀ i ∈ J, F i ⊆ B) ∧      (∀ i ∈ K \ J, (F i \ B).Nonempty) ∧      (P = ∅ ∨ ∃ i ∈ K \ J, P = F i) ∧      (Q = ∅ ∨ ∃ i ∈ K \ J, Q = F i) ∧      (∀ i ∈ K \ J, F i = P ∨ F i = Q) ∧      Disjoint P Q ∧      (∀ i ∈ J, Disjoint (F i) P ∧ Disjoint (F i) Q) ∧      J.card + (if P.Nonempty then 1 else 0) +        (if Q.Nonempty then 1 else 0) = K.card ∧      J.card ≤ (J.biUnion F).card := by  classical  let H := K.filter (fun i => (F i \ B).Nonempty)  let J := K \ H  have hHK : H ⊆ K := Finset.filter_subset _ _  have hJK : J ⊆ K := Finset.sdiff_subset  have hKH : K \ J = H := by    ext i    simp only [J,Finset.mem_sdiff]    constructor    · rintro ⟨hi,hn⟩      by_contra hh      exact hn ⟨hi,hh⟩    · intro hi      exact ⟨hHK hi,fun hh => hh.2 hi⟩  have hJB : ∀ i ∈ J, F i ⊆ B := by    intro i hi v hv    have hiK := hJK hi    have hiH : i ∉ H := (Finset.mem_sdiff.mp hi).2    by_contra hvB    apply hiH    exact Finset.mem_filter.mpr ⟨hiK,⟨v,Finset.mem_sdiff.mpr ⟨hv,hvB⟩⟩⟩  have hnH : ∀ i ∈ H, (F i).Nonempty := fun i hi => hne i (hHK hi)  have hdH : ∀ i ∈ H, ∀ j ∈ H, i ≠ j → Disjoint (F i) (F j) :=    fun i hi j hj hij => hdis i (hHK hi) j (hHK hj) hij  obtain ⟨P,Q,hP,hQ,hPQ,hslot,hcount⟩ := in1245_two_slots H F houtside hnH hdH  have hJdis : ∀ i ∈ J, ∀ j ∈ H, Disjoint (F i) (F j) := by    intro i hi j hj    have hneij : i ≠ j := by      intro he; subst j; exact (Finset.mem_sdiff.mp hi).2 hj    exact hdis i (hJK hi) j (hHK hj) hneij  have hPJ : ∀ i ∈ J, Disjoint (F i) P := by    intro i hi    rcases hP with hp | ⟨j,hj,hp⟩    · simp [hp]    · rw [hp]; exact hJdis i hi j hj  have hQJ : ∀ i ∈ J, Disjoint (F i) Q := by    intro i hi    rcases hQ with hq | ⟨j,hj,hq⟩    · simp [hq]    · rw [hq]; exact hJdis i hi j hj  have hcard : J.card + H.card = K.card := Finset.card_sdiff_add_card_eq_card hHK  have hbound : J.card ≤ (J.biUnion F).card := by    by_cases hJ : J.Nonempty    · obtain ⟨j,hj⟩ := hJ      have hh := pairwise_disjoint_nonempty_groups_card_bound J F j hj        (fun i hi l hl hil => hdis i (hJK hi) l (hJK hl) hil)        (fun i hi => hne i (hJK hi))      have hpos : 1 ≤ (F j).card := Finset.card_pos.mpr (hne j (hJK hj))      omega    · have hJ0 : J = ∅ := Finset.not_nonempty_iff_eq_empty.mp hJ      simp [hJ0]  refine ⟨J,hJK,P,Q,hJB,?_,?_,?_,?_,hPQ,?_,?_,hbound⟩  · intro i hi    have hiH : i ∈ H := hKH ▸ hi    exact (Finset.mem_filter.mp hiH).2  · simpa [hKH] using hP  · simpa [hKH] using hQ  · simpa [hKH] using hslot  · exact fun i hi => ⟨hPJ i hi,hQJ i hi⟩  · omega
See it in the graphDiscuss this resultChallenge it