op861_disjoint_boolean_partition_card
For pairwise disjoint finite blocks, the number of Boolean outside assignments times the product of Boolean assignment counts on the blocks equals the total number of Boolean assignments.
Statement
theorem op861_disjoint_boolean_partition_card (β ι : Type) [Fintype β] [DecidableEq β] [DecidableEq ι] (J : Finset ι) (B : ι → Finset β) (hdisj : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (B i) (B j)) : Fintype.card ({t : β // t ∉ J.biUnion B} → Bool) * (∏ i ∈ J, 2 ^ (B i).card) = 2 ^ Fintype.card β
- Source
- Cardinal arithmetic for op861_disjoint_boolean_windows_count.
- Verified
- 18 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op861_disjoint_boolean_windows_countFor a finite Boolean coordinate set, pairwise disjoint coordinate blocks, and integer offsets depending only on coordinates outside all…
The proof, explained
The theorem expresses the total number of Boolean assignments on a finite type $\beta$, namely $2^{|\beta|}$, as the product of the assignment count on the complement of a family of disjoint blocks and the assignment counts on each block. The proof evaluates the outside assignments as $2^{|\beta| - |\bigcup B_i|}$ using the cardinality of the complement. By pairwise disjointness, the product of assignment counts across blocks simplifies to $2^{\sum |B_i|} = 2^{|\bigcup B_i|}$. Multiplying the two terms adds their exponents, which cancels the union's cardinality and yields $2^{|\beta|}$.
The cardinality of the union $\bigcup_{i \in J} B_i$ is at most the total cardinality $|\beta|$.
Working classically, the cardinality of any finite subset of $\beta$ is at most the total cardinality of $\beta$ by Finset.card_le_univ.
uses
Finset.card_le_univclassical have hU : (J.biUnion B).card ≤ Fintype.card β := Finset.card_le_univ _The number of elements outside the union $\bigcup_{i \in J} B_i$ is $|\beta| - |\bigcup_{i \in J} B_i|$.
By Fintype.card_subtype_compl, the number of elements not in the union is the cardinality of $\beta$ minus the cardinality of the subtype corresponding to the union. By Fintype.card_coe, the cardinality of that subtype equals the finset cardinality $|\bigcup_{i \in J} B_i|$.
uses
Fintype.card_subtype_compl,Fintype.card_coehave h1 : Fintype.card {t : β // t ∉ J.biUnion B} = Fintype.card β - (J.biUnion B).card := by rw [Fintype.card_subtype_compl, Fintype.card_coe]
The product of the assignment counts on the individual blocks equals $2^{|\bigcup_{i \in J} B_i|}$.
A product of powers of 2 equals 2 raised to the sum of the exponents by Finset.prod_pow_eq_pow_sum. Because the blocks $B_i$ are pairwise disjoint on $J$ (hypothesis hdisj), the sum of their cardinalities equals the cardinality of their union by Finset.card_biUnion.
uses
Finset.prod_pow_eq_pow_sum,Finset.card_biUnionhave h2 : ∏ i ∈ J, 2 ^ (B i).card = 2 ^ (J.biUnion B).card := by rw [Finset.prod_pow_eq_pow_sum, Finset.card_biUnion hdisj]
The product of the outside assignment count and the block assignment counts equals $2^{|\beta|}$.
The number of Boolean functions on the complement subtype is $2^{|\beta| - |\bigcup B_i|}$ by Fintype.card_fun, Fintype.card_bool, and the formula for the complement's size. Multiplying this by the simplified product of block assignments $2^{|\bigcup B_i|}$ yields $2^{(|\beta| - |\bigcup B_i|) + |\bigcup B_i|}$ by pow_add. Because the union size is bounded by $|\beta|$, the natural subtraction and addition cancel by Nat.sub_add_cancel, leaving $2^{|\beta|}$.
uses
Fintype.card_fun,Fintype.card_bool,pow_add,Nat.sub_add_cancelrw [Fintype.card_fun, Fintype.card_bool, h1, h2, ← pow_add, Nat.sub_add_cancel hU]
Finset.card_le_univ- The cardinality of any finite subset of a finite type is at most the cardinality of the type.
Fintype.card_subtype_compl- The cardinality of the subtype of elements not satisfying a predicate equals the cardinality of the ambient finite type minus the cardinality of the subtype satisfying the predicate.
Fintype.card_coe- The cardinality of a finite set coerced to a subtype equals the cardinality of the finite set.
Finset.prod_pow_eq_pow_sum- The product of powers $a^{f(i)}$ over an index finset equals $a$ raised to the sum $\sum_{i} f(i)$.
Finset.card_biUnion- If a family of finite sets indexed by a finset is pairwise disjoint, the cardinality of their union is the sum of their cardinalities.
Fintype.card_fun- The number of functions between two finite types is the cardinality of the codomain raised to the power of the cardinality of the domain.
Fintype.card_bool- The cardinality of the type Bool is 2.
pow_add- In a monoid, $a^{m + n} = a^m \cdot a^n$.
Nat.sub_add_cancel- For natural numbers with $m \le n$, $(n - m) + m = n$.
- The tactic `classical` on line 8 is a formal Lean detail enabling classical decidability for subtypes and complements throughout the proof, with no mathematical content.
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.
open scoped BigOperatorstheorem op861_disjoint_boolean_partition_card (β ι : Type) [Fintype β] [DecidableEq β] [DecidableEq ι] (J : Finset ι) (B : ι → Finset β) (hdisj : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (B i) (B j)) : Fintype.card ({t : β // t ∉ J.biUnion B} → Bool) * (∏ i ∈ J, 2 ^ (B i).card) = 2 ^ Fintype.card β := by classical have hU : (J.biUnion B).card ≤ Fintype.card β := Finset.card_le_univ _ have h1 : Fintype.card {t : β // t ∉ J.biUnion B} = Fintype.card β - (J.biUnion B).card := by rw [Fintype.card_subtype_compl, Fintype.card_coe] have h2 : ∏ i ∈ J, 2 ^ (B i).card = 2 ^ (J.biUnion B).card := by rw [Finset.prod_pow_eq_pow_sum, Finset.card_biUnion hdisj] rw [Fintype.card_fun, Fintype.card_bool, h1, h2, ← pow_add, Nat.sub_add_cancel hU]