Sums and products over multisets #
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 (fun (x x_1 : α) => x + x_1) ⋯ 0
Instances For
Product of a multiset given a commutative monoid structure on α
.
prod {a, b, c} = a * b * c
Equations
- Multiset.prod = Multiset.foldr (fun (x x_1 : α) => x * x_1) ⋯ 1
Instances For
Multiset.sum
, the sum of the elements of a multiset, promoted to a morphism of
AddCommMonoid
s.
Equations
- Multiset.sumAddMonoidHom = { toZeroHom := { toFun := Multiset.sum, map_zero' := ⋯ }, map_add' := ⋯ }
Instances For
Order #
Slightly more general version of Multiset.sum_eq_zero_iff
for a non-ordered AddMonoid
Slightly more general version of Multiset.prod_eq_one_iff
for a non-ordered Monoid