Sums and products over multisets #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file we define products and sums indexed by multisets. This is later used to define products and sums indexed by finite sets.
Main declarations #
multiset.prod
:s.prod f
is the product off i
over alli ∈ s
. Not to be mistaken with the cartesian productmultiset.product
.multiset.sum
:s.sum f
is the sum off i
over alli ∈ s
.
Implementation notes #
Nov 2022: To speed the Lean 4 port, lemmas requiring extra algebra imports
(data.list.big_operators.lemmas
rather than .basic
) have been moved to a separate file,
algebra.big_operators.multiset.lemmas
. This split does not need to be permanent.
Sum of a multiset given a commutative additive monoid structure on α
.
sum {a, b, c} = a + b + c
Equations
- multiset.sum = multiset.foldr has_add.add multiset.sum._proof_1 0
Product of a multiset given a commutative monoid structure on α
.
prod {a, b, c} = a * b * c
Equations
- multiset.prod = multiset.foldr has_mul.mul multiset.prod._proof_1 1
multiset.sum
, the sum of the elements of a multiset, promoted to a morphism of
add_comm_monoid
s.
Equations
- multiset.sum_add_monoid_hom = {to_fun := multiset.sum _inst_1, map_zero' := _, map_add' := _}
Order #
Slightly more general version of multiset.prod_eq_one_iff
for a non-ordered monoid
Slightly more general version of multiset.sum_eq_zero_iff
for a non-ordered add_monoid