AFTD Auto-Formalizing Theoretical Domains

op861_disjoint_boolean_partition_card

theoremverified

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

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|}$.

  1. 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.

    lines 8–9

    uses Finset.card_le_univ

      classical
      have hU : (J.biUnion B).card ≤ Fintype.card β := Finset.card_le_univ _
  2. 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|$.

    lines 10–11

    uses Fintype.card_subtype_compl, Fintype.card_coe

      have h1 : Fintype.card {t : β // t ∉ J.biUnion B} = Fintype.card β - (J.biUnion B).card := by
        rw [Fintype.card_subtype_compl, Fintype.card_coe]
  3. 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.

    lines 12–13

    uses Finset.prod_pow_eq_pow_sum, Finset.card_biUnion

      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]
  4. 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|}$.

    line 14

    uses Fintype.card_fun, Fintype.card_bool, pow_add, Nat.sub_add_cancel

      rw [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$.

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

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]
See it in the graphDiscuss this resultChallenge it