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 fis the product off iover alli ∈ s. Not to be mistaken with the Cartesian productMultiset.product.Multiset.sum:s.sum fis the sum off iover alli ∈ s.
Product of a multiset given a commutative monoid structure on M.
prod {a, b, c} = a * b * c
Equations
- Multiset.prod = Multiset.foldr (fun (x1 x2 : M) => x1 * x2) 1
Instances For
Sum of a multiset given a commutative additive monoid structure on M.
sum {a, b, c} = a + b + c
Equations
- Multiset.sum = Multiset.foldr (fun (x1 x2 : M) => x1 + x2) 0
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem Multiset.nsmul_count {M : Type u_2} [AddCommMonoid M] {s : Multiset M} [DecidableEq M] (a : M) :
theorem Multiset.prod_hom_rel {ι : Type u_1} {M : Type u_2} {N : Type u_3} [CommMonoid M] [CommMonoid N] (s : Multiset ι) {r : M → N → Prop} {f : ι → M} {g : ι → N} (h₁ : r 1 1) (h₂ : ∀ ⦃a : ι⦄ ⦃b : M⦄ ⦃c : N⦄, r b c → r (f a * b) (g a * c)) :
theorem Multiset.sum_hom_rel {ι : Type u_1} {M : Type u_2} {N : Type u_3} [AddCommMonoid M] [AddCommMonoid N] (s : Multiset ι) {r : M → N → Prop} {f : ι → M} {g : ι → N} (h₁ : r 0 0) (h₂ : ∀ ⦃a : ι⦄ ⦃b : M⦄ ⦃c : N⦄, r b c → r (f a + b) (g a + c)) :
theorem Multiset.prod_induction {M : Type u_2} [CommMonoid M] (p : M → Prop) (s : Multiset M) (p_mul : ∀ (a b : M), p a → p b → p (a * b)) (p_one : p 1) (p_s : ∀ (a : M), a ∈ s → p a) :
p s.prod
theorem Multiset.sum_induction {M : Type u_2} [AddCommMonoid M] (p : M → Prop) (s : Multiset M) (p_add : ∀ (a b : M), p a → p b → p (a + b)) (p_zero : p 0) (p_s : ∀ (a : M), a ∈ s → p a) :
p s.sum