op1957_four_block_sdiff_card_sum
Four block sdiff card sum.
Statement
theorem op1957_four_block_sdiff_card_sum {V : Type*} [Fintype V] [DecidableEq V] (B : Fin 4 → Finset V) (W : Finset V) (forbidden : Fin 4) (hdis : ∀ i j : Fin 4, i ≠ j → Disjoint (B i) (B j)) (hcover : (Finset.univ : Finset (Fin 4)).biUnion B = Finset.univ) : (W \ B forbidden).card = ∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, (W ∩ B t).card
- Source
- OP-1957; positive-separator graph-to-count transfer.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op1957_four_shore_aggregate_representative_boundsFour shore aggregate representative bounds.
The proof, explained
To compute the cardinality of W \ B forbidden, the set difference is partitioned into the family of intersections W ∩ B t indexed by the remaining three blocks t ≠ forbidden. Because the four blocks form a partition of the ambient space V, every element in W \ B forbidden belongs to a unique block B t with t ≠ forbidden. Pairwise disjointness of the blocks ensures pairwise disjointness of these intersections, so the cardinality of their union is the sum of their individual cardinalities.
The family of intersections (W ∩ B t)_{t ∈ J} is pairwise disjoint over the index set J = (Fin 4) \ {forbidden}.
We define J to be the set of indices in {0, 1, 2, 3} excluding forbidden. For any two distinct indices i, j ∈ J, the blocks B i and B j are disjoint by the assumption hdis. Because W ∩ B i ⊆ B i and W ∩ B j ⊆ B j, the subsets W ∩ B i and W ∩ B j inherit this disjointness.
uses
Finset.disjoint_of_subset_left,Finset.inter_subset_right,Finset.disjoint_of_subset_rightclassical let J : Finset (Fin 4) := Finset.univ.erase forbidden have hp : (J : Set (Fin 4)).PairwiseDisjoint (fun t => W ∩ B t) := by intro i _ j _ hij exact Finset.disjoint_of_subset_left Finset.inter_subset_right (Finset.disjoint_of_subset_right Finset.inter_subset_right (hdis i j hij))
The set difference W \ B forbidden equals the union ⋃_{t ∈ J} (W ∩ B t).
We establish set equality by showing mutual inclusion for an arbitrary element v ∈ V. If v ∈ W \ B forbidden, then v ∈ W and v ∉ B forbidden. Since the blocks cover V (hypothesis hcover), v must belong to some block B i. As v ∉ B forbidden, i cannot be forbidden, so i ∈ J, which places v in W ∩ B i and thus in the union. Conversely, if v belongs to the union, there is some index i ∈ J such that v ∈ W ∩ B i. This gives v ∈ W and v ∈ B i. Since i ∈ J, we have i ≠ forbidden, so B i and B forbidden are disjoint by hdis, which implies v ∉ B forbidden. Hence v ∈ W \ B forbidden.
uses
Finset.mem_sdiff.mp,Finset.mem_biUnion.mp,Finset.mem_biUnion.mpr,Finset.mem_erase.mpr,Finset.mem_univ,Finset.mem_inter.mpr,Finset.mem_erase.mp,Finset.mem_inter.mp,Finset.mem_sdiff.mpr,Finset.disjoint_left.mphave heq : W \ B forbidden = J.biUnion (fun t => W ∩ B t) := by ext v constructor · intro hv have hvW := (Finset.mem_sdiff.mp hv).1 have hvN := (Finset.mem_sdiff.mp hv).2 have hvAll : v ∈ (Finset.univ : Finset (Fin 4)).biUnion B := by rw [hcover]; simp obtain ⟨i,_,hvi⟩ := Finset.mem_biUnion.mp hvAll have hif : i ≠ forbidden := fun h => hvN (h ▸ hvi) exact Finset.mem_biUnion.mpr ⟨i,Finset.mem_erase.mpr ⟨hif,Finset.mem_univ _⟩, Finset.mem_inter.mpr ⟨hvW,hvi⟩⟩ · intro hv obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hv have hi' := Finset.mem_erase.mp hi have hvW := (Finset.mem_inter.mp hvi).1 have hviB := (Finset.mem_inter.mp hvi).2 refine Finset.mem_sdiff.mpr ⟨hvW,?_⟩ intro hvf exact Finset.disjoint_left.mp (hdis i forbidden hi'.1) hviB hvf
The cardinality of W \ B forbidden is the sum of the cardinalities of W ∩ B t over all t ∈ J.
Rewriting W \ B forbidden as the union ⋃_{t ∈ J} (W ∩ B t) and using the fact that the cardinality of a pairwise disjoint union of finite sets is the sum of the cardinalities of the individual components concludes the proof.
uses
Finset.card_biUnionrw [heq, Finset.card_biUnion hp]
Finset.disjoint_of_subset_left- If u and t are disjoint and s ⊆ u, then s and t are disjoint.
Finset.inter_subset_right- For any sets s₁ and s₂, the intersection s₁ ∩ s₂ is a subset of s₂.
Finset.disjoint_of_subset_right- If s and u are disjoint and t ⊆ u, then s and t are disjoint.
Finset.mem_sdiff.mp- If x ∈ s \ t, then x ∈ s and x ∉ t.
Finset.mem_biUnion.mp- If x belongs to an indexed union ⋃_{a ∈ s} t_a, then x ∈ t_a for some a ∈ s.
Finset.mem_biUnion.mpr- If x ∈ t_a for some a ∈ s, then x ∈ ⋃_{a ∈ s} t_a.
Finset.mem_erase.mpr- If a ≠ b and a ∈ s, then a ∈ s \ {b}.
Finset.mem_univ- Every element of a finite type belongs to the universal finset.
Finset.mem_inter.mpr- If x ∈ s and x ∈ t, then x ∈ s ∩ t.
Finset.mem_erase.mp- If a ∈ s \ {b}, then a ≠ b and a ∈ s.
Finset.mem_inter.mp- If x ∈ s ∩ t, then x ∈ s and x ∈ t.
Finset.mem_sdiff.mpr- If x ∈ s and x ∉ t, then x ∈ s \ t.
Finset.disjoint_left.mp- If two sets are disjoint, any element of the first set does not belong to the second set.
Finset.card_biUnion- The cardinality of a pairwise disjoint union of finite sets is the sum of their individual cardinalities.
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_sdiff_card_sum {V : Type*} [Fintype V] [DecidableEq V] (B : Fin 4 → Finset V) (W : Finset V) (forbidden : Fin 4) (hdis : ∀ i j : Fin 4, i ≠ j → Disjoint (B i) (B j)) (hcover : (Finset.univ : Finset (Fin 4)).biUnion B = Finset.univ) : (W \ B forbidden).card = ∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, (W ∩ B t).card := by classical let J : Finset (Fin 4) := Finset.univ.erase forbidden have hp : (J : Set (Fin 4)).PairwiseDisjoint (fun t => W ∩ B t) := by intro i _ j _ hij exact Finset.disjoint_of_subset_left Finset.inter_subset_right (Finset.disjoint_of_subset_right Finset.inter_subset_right (hdis i j hij)) have heq : W \ B forbidden = J.biUnion (fun t => W ∩ B t) := by ext v constructor · intro hv have hvW := (Finset.mem_sdiff.mp hv).1 have hvN := (Finset.mem_sdiff.mp hv).2 have hvAll : v ∈ (Finset.univ : Finset (Fin 4)).biUnion B := by rw [hcover]; simp obtain ⟨i,_,hvi⟩ := Finset.mem_biUnion.mp hvAll have hif : i ≠ forbidden := fun h => hvN (h ▸ hvi) exact Finset.mem_biUnion.mpr ⟨i,Finset.mem_erase.mpr ⟨hif,Finset.mem_univ _⟩, Finset.mem_inter.mpr ⟨hvW,hvi⟩⟩ · intro hv obtain ⟨i,hi,hvi⟩ := Finset.mem_biUnion.mp hv have hi' := Finset.mem_erase.mp hi have hvW := (Finset.mem_inter.mp hvi).1 have hviB := (Finset.mem_inter.mp hvi).2 refine Finset.mem_sdiff.mpr ⟨hvW,?_⟩ intro hvf exact Finset.disjoint_left.mp (hdis i forbidden hi'.1) hviB hvf rw [heq, Finset.card_biUnion hp]