op1957_four_block_intersection_card_sum
Four block intersection card sum.
Statement
theorem op1957_four_block_intersection_card_sum {V : Type*} [Fintype V] [DecidableEq V] (B : Fin 4 → Finset V) (W : Finset V) (hBdis : ∀ i j : Fin 4, i ≠ j → Disjoint (B i) (B j)) (hBcover : (Finset.univ : Finset (Fin 4)).biUnion B = Finset.univ) : (∑ b : Fin 4, (W ∩ B b).card) = W.card
- Source
- OP-1957; positive-separator graph-to-count transfer.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
The proof, explained
The theorem states that when four blocks partition a universe V, the size of any subset W ⊆ V decomposes as the sum of the sizes of its intersections with the four blocks. The proof first shows that the intersections W ∩ B b are pairwise disjoint because the blocks B b are disjoint. It then verifies that the union of these four intersections recovers W, since the blocks cover the entire universe. Finally, applying the identity that the cardinality of a disjoint union is the sum of the cardinalities of its components completes the proof.
The intersections W ∩ B b for b ∈ Fin 4 are pairwise disjoint.
Given distinct indices i ≠ j in Fin 4, the blocks B i and B j are disjoint by hypothesis hBdis. Since W ∩ B i ⊆ B i and W ∩ B j ⊆ B j (by Finset.inter_subset_right), their intersections are also disjoint by Finset.disjoint_of_subset_left and Finset.disjoint_of_subset_right.
uses
Finset.disjoint_of_subset_left,Finset.inter_subset_right,Finset.disjoint_of_subset_rightclassical have hp : ((Finset.univ : Finset (Fin 4)) : Set (Fin 4)).PairwiseDisjoint (fun b => W ∩ B b) := by intro i _ j _ hij exact Finset.disjoint_of_subset_left Finset.inter_subset_right (Finset.disjoint_of_subset_right Finset.inter_subset_right (hBdis i j hij))
The union of the intersections ⋃ b, (W ∩ B b) is equal to W.
By set extensionality, an element v belongs to the union if and only if v ∈ W. Unfolding the definitions of union and intersection with Finset.mem_biUnion, Finset.mem_univ, true_and, and Finset.mem_inter reduces this to showing (∃ b, v ∈ W ∧ v ∈ B b) ↔ v ∈ W. The forward direction is immediate since v ∈ W ∧ v ∈ B b implies v ∈ W. For the reverse direction, if v ∈ W, then v is in the universe V, which equals ⋃ b, B b by the covering hypothesis hBcover. Hence, by Finset.mem_biUnion.mp, v belongs to B b for some block b, placing v in W ∩ B b.
uses
Finset.mem_biUnion,Finset.mem_univ,true_and,Finset.mem_inter,Finset.mem_biUnion.mphave heq : (Finset.univ : Finset (Fin 4)).biUnion (fun b => W ∩ B b) = W := by ext v simp only [Finset.mem_biUnion,Finset.mem_univ,true_and,Finset.mem_inter] constructor · rintro ⟨b,hv,_⟩ exact hv · intro hv have hh : v ∈ (Finset.univ : Finset (Fin 4)).biUnion B := by rw [hBcover]; simp obtain ⟨b,_,hvb⟩ := Finset.mem_biUnion.mp hh exact ⟨b,hv,hvb⟩
The sum of cardinalities ∑ b, |W ∩ B b| equals |W|.
By Finset.card_biUnion, the sum of cardinalities of pairwise disjoint sets equals the cardinality of their union. Rewriting with this equality using the pairwise disjointness established in the first step, and substituting W for the union using the equality established in the second step, produces ∑ b, |W ∩ B b| = |W|.
uses
Finset.card_biUnionrw [← Finset.card_biUnion hp,heq]
Finset.disjoint_of_subset_left- If s ⊆ u and u is disjoint from t, then s is disjoint from t.
Finset.inter_subset_right- The intersection s₁ ∩ s₂ is a subset of s₂.
Finset.disjoint_of_subset_right- If t ⊆ u and s is disjoint from u, then s is disjoint from t.
Finset.mem_biUnion- An element belongs to the union of a family of finsets indexed by s if and only if it belongs to the set indexed by some a ∈ s.
Finset.mem_univ- Every element of a finite type belongs to the universal finset Finset.univ.
true_and- The proposition True ∧ p is equivalent to p.
Finset.mem_inter- An element belongs to s₁ ∩ s₂ if and only if it belongs to both s₁ and s₂.
Finset.mem_biUnion.mp- If an element belongs to the union of a family of finsets, then there exists an index in the family whose set contains that element.
Finset.card_biUnion- For a pairwise disjoint family of finsets indexed by s, the cardinality of their union equals the sum of the cardinalities of the individual sets.
- The `classical` tactic on line 9 is a Lean formality enabling classical logic (such as decidability of set membership) throughout the proof.
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.
set_option maxHeartbeats 2000000theorem op1957_four_block_intersection_card_sum {V : Type*} [Fintype V] [DecidableEq V] (B : Fin 4 → Finset V) (W : Finset V) (hBdis : ∀ i j : Fin 4, i ≠ j → Disjoint (B i) (B j)) (hBcover : (Finset.univ : Finset (Fin 4)).biUnion B = Finset.univ) : (∑ b : Fin 4, (W ∩ B b).card) = W.card := by classical have hp : ((Finset.univ : Finset (Fin 4)) : Set (Fin 4)).PairwiseDisjoint (fun b => W ∩ B b) := by intro i _ j _ hij exact Finset.disjoint_of_subset_left Finset.inter_subset_right (Finset.disjoint_of_subset_right Finset.inter_subset_right (hBdis i j hij)) have heq : (Finset.univ : Finset (Fin 4)).biUnion (fun b => W ∩ B b) = W := by ext v simp only [Finset.mem_biUnion,Finset.mem_univ,true_and,Finset.mem_inter] constructor · rintro ⟨b,hv,_⟩ exact hv · intro hv have hh : v ∈ (Finset.univ : Finset (Fin 4)).biUnion B := by rw [hBcover]; simp obtain ⟨b,_,hvb⟩ := Finset.mem_biUnion.mp hh exact ⟨b,hv,hvb⟩ rw [← Finset.card_biUnion hp,heq]