Results about "big operations" over a Fintype, and consequent
results about cardinalities of certain types.
Implementation note #
This content had previously been in Data.Fintype.Basic, but was moved here to avoid
requiring Algebra.BigOperators (and hence many other imports) as a
dependency of Fintype.
However many of the results here really belong in Algebra.BigOperators.Basic
and should be moved at some point.
If a sum of a Finset of a subsingleton type has a given
value, so do the terms in that sum.
If a product of a Finset of a subsingleton type has a given
value, so do the terms in that product.
Taking a sum over univ.pi t is the same as taking the sum over
Fintype.piFinset t. univ.pi t and Fintype.piFinset t are essentially the same Finset,
but differ in the type of their element, univ.pi t is a Finset (Π a ∈ univ, t a) and
Fintype.piFinset t is a Finset (Π a, t a).
Taking a product over univ.pi t is the same as taking the product over Fintype.piFinset t.
univ.pi t and Fintype.piFinset t are essentially the same Finset, but differ
in the type of their element, univ.pi t is a Finset (Π a ∈ univ, t a) and
Fintype.piFinset t is a Finset (Π a, t a).
The product over univ of a sum can be written as a sum over the product of sets,
Fintype.piFinset. Finset.prod_sum is an alternative statement when the product is not
over univ
Summing a^s.card * b^(n-s.card) over all finite subsets s of a fintype of cardinality n
gives (a + b)^n. The "good" proof involves expanding along all coordinates using the fact that
x^n is multilinear, but multilinear maps are only available now over rings, so we give instead
a proof reducing to the usual binomial theorem to have a result over semirings.
It is equivalent to sum a function over fin n or finset.range n.
It is equivalent to compute the product of a function over Fin n or Finset.range n.