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.big_operators (and hence many other imports) as a
dependency of fintype.
However many of the results here really belong in algebra.big_operators.basic
and should be moved at some point.
If a product of a finset of a subsingleton type has a given
value, so do the terms in that product.
If a sum of a finset of a subsingleton type has a given
value, so do the terms in that sum.
A sum of a function f : fin 0 → β is 0 because fin 0 is empty
A product of a function f : fin (n + 1) → β over all fin (n + 1)
is the product of f x, for some x : fin (n + 1) times the remaining product
A product of a function f : fin (n + 1) → β over all fin (n + 1)
is the product of f (fin.last n) plus the remaining product
Taking a product over univ.pi t is the same as taking the product over fintype.pi_finset t.
univ.pi t and fintype.pi_finset 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.pi_finset t is a finset (Π a, t a).
Taking a sum over univ.pi t is the same as taking the sum over
fintype.pi_finset t. univ.pi t and fintype.pi_finset 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.pi_finset 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.pi_finset. 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.