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 x
is notation forfinset.prod s f
(assumingβ
is acomm_monoid
)∑ x in s, f x
is notation forfinset.sum s f
(assumingβ
is anadd_comm_monoid
)∏ x, f x
is notation forfinset.prod finset.univ f
(assumingα
is afintype
andβ
is acomm_monoid
)∑ x, f x
is notation forfinset.sum finset.univ f
(assumingα
is afintype
andβ
is anadd_comm_monoid
)
∑ x in s, f
is the sum of f x
as x
ranges over the elements
of the finite set s
.
∏ 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 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 a
is in s
or f a = 0
.
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
.
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 sum
over s.subtype p
equals that sum over s
.
If all elements of a finset
satisfy the predicate p
, a product
over s.subtype p
equals that product over s
.
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
.
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
.
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 product.
The difference with prod_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 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.
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
If we can partition a product into subsets that cancel out, then the whole product cancels.
If a product of a finset
of size at most 1 has a given value, so
do the terms in that product.
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
.