two_disjoint_group_family_fits_two_slots
A family of at most two pairwise disjoint nonempty finite sets can be placed in two slots, with unused slots empty, and the number of occupied slots equals the family size.
Statement
theorem two_disjoint_group_family_fits_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
- Source
- OP-1957; bookkeeping for the two exceptional groups in the saturated barrier reduction.
- Verified
- 27 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- two_exceptional_groups_and_block_poolFor a pairwise disjoint family of nonempty finite sets with at most two members meeting the complement of B, split its indices into B-only…
The proof, explained
The proof proceeds by case analysis on the cardinality of the index set J, which is at most 2. If |J| = 0, both slots P and Q are chosen to be empty. If |J| = 1, say J = {i}, the set F(i) is placed into slot P and slot Q is left empty. If |J| = 2, say J = {i, j} with i ≠ j, the sets F(i) and F(j) are placed into slots P and Q. In each case, the pairwise disjointness, membership, and slot occupancy conditions follow directly from the hypotheses.
The cardinality of the index set J is 0, 1, or 2.
Because |J| ≤ 2 by assumption (hcard), integer linear arithmetic (via omega) reduces the possible cardinalities of J to 0, 1, or 2. The proof then splits into these three cases.
classical have cases : J.card = 0 ∨ J.card = 1 ∨ J.card = 2 := by omega rcases cases with hzero | hone | htwo
When |J| = 0, the pair (P, Q) = (∅, ∅) satisfies all requirements of the theorem.
Since |J| = 0, the index set J is empty (Finset.card_eq_zero.mp). Setting P = ∅ and Q = ∅, both slots are empty, ∅ is disjoint from ∅, the condition ∀ i ∈ J holds vacuously, and the number of nonempty slots is 0 + 0 = 0 = |J|.
uses
Finset.card_eq_zero.mp· have hJ : J = ∅ := Finset.card_eq_zero.mp hzero subst J exact ⟨∅, ∅, by simp⟩
When |J| = 1, setting P = F(i) and Q = ∅ satisfies the theorem, where i is the unique index in J.
A finite set of cardinality 1 is a singleton {i} (Finset.card_eq_one.mp). By the nonemptiness hypothesis, F(i) is nonempty. Placing F(i) into slot P and leaving Q = ∅, we have P = F(i) with i ∈ J and Q = ∅. Moreover, F(i) is disjoint from ∅, and any j ∈ J = {i} must equal i, so F(j) = P. Since P is nonempty and Q is empty, the count of occupied slots is 1 + 0 = 1 = |J|.
uses
Finset.card_eq_one.mp,Or.inr,Or.inl· 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]
When |J| = 2, setting P = F(i) and Q = F(j) satisfies the theorem, where i and j are the two distinct indices in J.
A finite set of cardinality 2 consists of two distinct elements i ≠ j, so J = {i, j} (Finset.card_eq_two.mp). Both F(i) and F(j) are nonempty by assumption, and since i ≠ j, they are disjoint by the pairwise disjointness hypothesis (hdis). Setting P = F(i) and Q = F(j), any r ∈ J = {i, j} is either i or j (Finset.mem_insert, Finset.mem_singleton), so F(r) is either P or Q. Since both P and Q are nonempty, the occupied slot count is 1 + 1 = 2 = |J|.
uses
Finset.card_eq_two.mp,Or.inr,Finset.mem_insert,Finset.mem_singleton· 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]
Finset.card_eq_zero.mp- A finite set has cardinality 0 if and only if it is the empty set (forward direction).
Finset.card_eq_one.mp- A finite set has cardinality 1 if and only if it is a singleton {a} (forward direction).
Finset.card_eq_two.mp- A finite set has cardinality 2 if and only if it consists of two distinct elements {x, y} (forward direction).
Or.inr- If b holds, then a ∨ b holds (the right injection into a disjunction).
Or.inl- If a holds, then a ∨ b holds (the left injection into a disjunction).
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 b belongs to the singleton {a} if and only if b = a.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem two_disjoint_group_family_fits_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]