Big operators #
In this file we define products and sums indexed by finite sets (specifically, finset).
Notation #
We introduce the following notation, localized in big_operators.
To enable the notation, use open_locale big_operators.
Let s be a finset α, and f : α → β a function.
∏ x in s, f xis notation forfinset.prod s f(assumingβis acomm_monoid)∑ x in s, f xis notation forfinset.sum s f(assumingβis anadd_comm_monoid)∏ x, f xis notation forfinset.prod finset.univ f(assumingαis afintypeandβis acomm_monoid)∑ x, f xis notation forfinset.sum finset.univ f(assumingαis afintypeandβis anadd_comm_monoid)
Implementation Notes #
The first arguments in all definitions and lemmas is the codomain of the function of the big
operator. This is necessary for the heuristic in @[to_additive].
See the documentation of to_additive.attr for more information.
∑ x in s, f x is the sum of f x as x ranges over the elements
of the finite set s.
Equations
- s.sum f = (multiset.map f s.val).sum
∏ x in s, f x is the product of f x
as x ranges over the elements of the finite set s.
Equations
- s.prod f = (multiset.map f s.val).prod
The sum of f over insert a s is the same as
the sum over s, as long as a is in s or f a = 0.
The product of f over insert a s is the same as
the product over s, as long as a is in s or f a = 1.
The sum of f over insert a s is the same as
the sum over s, as long as f a = 0.
The product of f over insert a s is the same as the product over s, as long as f a = 1.
Adding the sums of a function over s and over sᶜ gives the whole sum.
For a version expressed with subtypes, see fintype.sum_subtype_add_sum_subtype.
Multiplying the products of a function over s and over sᶜ gives the whole product.
For a version expressed with subtypes, see fintype.prod_subtype_mul_prod_subtype.
An uncurried version of finset.sum_product
An uncurried version of finset.prod_product.
Product over a sigma type equals the product of fiberwise products. For rewriting
in the reverse direction, use finset.prod_sigma'.
Sum over a sigma type equals the sum of fiberwise sums. For rewriting
in the reverse direction, use finset.sum_sigma'
An uncurried version of finset.prod_product_right.
An uncurried version of finset.prod_product_right
A product over s.subtype p equals one over s.filter p.
A sum over s.subtype p equals one over s.filter p.
If all elements of a finset satisfy the predicate p, a product
over s.subtype p equals that product over s.
If all elements of a finset satisfy the predicate p, a sum
over s.subtype p equals that sum over s.
A sum of a function over a finset in a subtype equals a
sum in the main type of a function that agrees with the first
function on that finset.
A product of a function over a finset in a subtype equals a
product in the main type of a function that agrees with the first
function on that finset.
When a product is taken over a conditional whose condition is an equality test on the index
and whose alternative is 1, then the product's value is either the term at that index or 1.
The difference with prod_ite_eq is that the arguments to eq are swapped.
Reorder a sum.
The difference with sum_bij' is that the bijection is specified as a surjective injection,
rather than by an inverse function.
Reorder a product.
The difference with prod_bij' is that the bijection is specified as a surjective injection,
rather than by an inverse function.
Reorder a sum.
The difference with sum_bij is that the bijection is specified with an inverse, rather than
as a surjective injection.
Reorder a product.
The difference with prod_bij is that the bijection is specified with an inverse, rather than
as a surjective injection.
To prove a property of a product, it suffices to prove that the property is multiplicative and holds on factors.
To prove a property of a sum, it suffices to prove that the property is additive and holds on summands.
To prove a property of a sum, it suffices to prove that the property is additive and holds on summands.
To prove a property of a product, it suffices to prove that the property is multiplicative and holds on factors.
For any product along {0, ..., n-1} of a commutative-monoid-valued function, we can verify that
it's equal to a different function just by checking ratios of adjacent terms.
This is a multiplicative discrete analogue of the fundamental theorem of calculus.
For any sum along {0, ..., n-1} of a commutative-monoid-valued function,
we can verify that it's equal to a different function
just by checking differences of adjacent terms.
This is a discrete analogue
of the fundamental theorem of calculus.
A telescoping sum along {0, ..., n-1} of an additive commutative group valued function
reduces to the difference of the last and first terms.
A telescoping product along {0, ..., n-1} of a commutative group valued function
reduces to the ratio of the last and first factors.
A telescoping sum along {0, ..., n-1} of an ℕ-valued function
reduces to the difference of the last and first terms
when the function we are summing is monotone.
The product of the composition of functions f and g, is the product
over b ∈ s.image g of f b to the power of the cardinality of the fibre of b. See also
finset.prod_image.
A sum can be partitioned into a sum of sums, each equivalent under a setoid.
A product can be partitioned into a product of products, each equivalent under a setoid.
If we can partition a product into subsets that cancel out, then the whole product cancels.
If we can partition a sum into subsets that cancel out, then the whole sum cancels.
If a sum of a finset of size at most 1 has a given
value, so do the terms in that sum.
If a product of a finset of size at most 1 has a given value, so
do the terms in that product.
Taking a sum over s : finset α is the same as adding the value on a single element
f a to the sum over s.erase a.
Taking a product over s : finset α is the same as multiplying the value on a single element
f a by the product of s.erase a.
A variant of finset.add_sum_erase with the addition swapped.
A variant of finset.mul_prod_erase with the multiplication swapped.
If a function applied at a point is 1, a product is unchanged by
removing that point, if present, from a finset.
If a function applied at a point is 0, a sum is unchanged by
removing that point, if present, from a finset.
If a sum is 0 and the function is 0 except possibly at one
point, it is 0 everywhere on the finset.
If a product is 1 and the function is 1 except possibly at one
point, it is 1 everywhere on the finset.
If f = g = h everywhere but at i, where f i = g i + h i, then the product of f over s
is the sum of the products of g and h.
Moving to the opposite additive commutative monoid commutes with summing.
fintype.sum_equiv is a variant of finset.sum_bij that accepts
function.bijective.
See function.bijective.sum_comp for a version without h.
fintype.prod_bijective is a variant of finset.prod_bij that accepts function.bijective.
See function.bijective.prod_comp for a version without h.
fintype.prod_equiv is a specialization of finset.prod_bij that
automatically fills in most arguments.
See equiv.prod_comp for a version without h.
fintype.sum_equiv is a specialization of finset.sum_bij that
automatically fills in most arguments.
See equiv.sum_comp for a version without h.