The areas / V03. Sets, finite structures and big operators
Mathlib.Algebra.BigOperators.Group.Multiset.Defs
33 declarations. Mathlib docs · Source
theorem Multiset.foldl.congr_simp E1 #
∀ {α : Type u_1} {β : Type v} (f f_1 : β → α → β) (e_f : f = f_1) [inst : RightCommutative f] (b b_1 : β),
b = b_1 → ∀ (s s_1 : Multiset α), s = s_1 → Multiset.foldl f b s = Multiset.foldl f_1 b_1 s_1
def Multiset.prod E1 #
{M : Type u_2} → [CommMonoid M] → Multiset M → M
Product of a multiset given a commutative monoid structure on M.
prod {a, b, c} = a * b * c
def Multiset.sum E1 #
{M : Type u_2} → [AddCommMonoid M] → Multiset M → M
Sum of a multiset given a commutative additive monoid structure on M.
sum {a, b, c} = a + b + c
theorem Multiset.sum_eq_foldr E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (s : Multiset M), s.sum = Multiset.foldr (fun x1 x2 ↦ x1 + x2) 0 s
theorem Multiset.prod_eq_foldr E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (s : Multiset M), s.prod = Multiset.foldr (fun x1 x2 ↦ x1 * x2) 1 s
theorem Multiset.sum_eq_foldl E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (s : Multiset M), s.sum = Multiset.foldl (fun x1 x2 ↦ x1 + x2) 0 s
theorem Multiset.prod_eq_foldl E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (s : Multiset M), s.prod = Multiset.foldl (fun x1 x2 ↦ x1 * x2) 1 s
theorem Multiset.sum_coe E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (l : List M), (↑l).sum = l.sum
theorem Multiset.prod_coe E0 #
∀ {M : Type u_2} [inst : CommMonoid M] (l : List M), (↑l).prod = l.prod
theorem Multiset.prod_toList E0 #
∀ {M : Type u_2} [inst : CommMonoid M] (s : Multiset M), s.toList.prod = s.prod
theorem Multiset.sum_toList E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (s : Multiset M), s.toList.sum = s.sum
theorem Multiset.prod_map_toList E0 #
∀ {ι : Type u_1} {M : Type u_2} [inst : CommMonoid M] (s : Multiset ι) (f : ι → M),
(List.map f s.toList).prod = (Multiset.map f s).prod
theorem Multiset.sum_map_toList E0 #
∀ {ι : Type u_1} {M : Type u_2} [inst : AddCommMonoid M] (s : Multiset ι) (f : ι → M),
(List.map f s.toList).sum = (Multiset.map f s).sum
theorem Multiset.prod_zero E0 #
∀ {M : Type u_2} [inst : CommMonoid M], Multiset.prod 0 = 1
theorem Multiset.sum_zero E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M], Multiset.sum 0 = 0
theorem Multiset.prod_cons E0 #
∀ {M : Type u_2} [inst : CommMonoid M] (a : M) (s : Multiset M), (a ::ₘ s).prod = a * s.prod
theorem Multiset.sum_cons E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (a : M) (s : Multiset M), (a ::ₘ s).sum = a + s.sum
theorem Multiset.prod_singleton E0 #
∀ {M : Type u_2} [inst : CommMonoid M] (a : M), {a}.prod = a
theorem Multiset.sum_singleton E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (a : M), {a}.sum = a
theorem Multiset.sum_pair E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (a b : M), {a, b}.sum = a + b
theorem Multiset.prod_pair E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (a b : M), {a, b}.prod = a * b
theorem Multiset.prod_replicate E0 #
∀ {M : Type u_2} [inst : CommMonoid M] (n : ℕ) (a : M), (Multiset.replicate n a).prod = a ^ n
theorem Multiset.sum_replicate E0 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (n : ℕ) (a : M), (Multiset.replicate n a).sum = n • a
theorem Multiset.nsmul_count E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] {s : Multiset M} [inst_1 : DecidableEq M] (a : M),
Multiset.count a s • a = (Multiset.filter (Eq a) s).sum
theorem Multiset.pow_count E1 #
∀ {M : Type u_2} [inst : CommMonoid M] {s : Multiset M} [inst_1 : DecidableEq M] (a : M),
a ^ Multiset.count a s = (Multiset.filter (Eq a) s).prod
theorem Multiset.prod_hom_rel E1 #
∀ {ι : Type u_1} {M : Type u_2} {N : Type u_3} [inst : CommMonoid M] [inst_1 : CommMonoid N] (s : Multiset ι)
{r : M → N → Prop} {f : ι → M} {g : ι → N},
r 1 1 → (∀ ⦃a : ι⦄ ⦃b : M⦄ ⦃c : N⦄, r b c → r (f a * b) (g a * c)) → r (Multiset.map f s).prod (Multiset.map g s).prod
theorem Multiset.sum_hom_rel E1 #
∀ {ι : Type u_1} {M : Type u_2} {N : Type u_3} [inst : AddCommMonoid M] [inst_1 : AddCommMonoid N] (s : Multiset ι)
{r : M → N → Prop} {f : ι → M} {g : ι → N},
r 0 0 → (∀ ⦃a : ι⦄ ⦃b : M⦄ ⦃c : N⦄, r b c → r (f a + b) (g a + c)) → r (Multiset.map f s).sum (Multiset.map g s).sum
theorem Multiset.sum_map_zero E1 #
∀ {ι : Type u_1} {M : Type u_2} [inst : AddCommMonoid M] {m : Multiset ι}, (Multiset.map (fun x ↦ 0) m).sum = 0
theorem Multiset.prod_map_one E1 #
∀ {ι : Type u_1} {M : Type u_2} [inst : CommMonoid M] {m : Multiset ι}, (Multiset.map (fun x ↦ 1) m).prod = 1
theorem Multiset.sum_induction E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (p : M → Prop) (s : Multiset M),
(∀ (a b : M), p a → p b → p (a + b)) → p 0 → (∀ a ∈ s, p a) → p s.sum
theorem Multiset.prod_induction E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (p : M → Prop) (s : Multiset M),
(∀ (a b : M), p a → p b → p (a * b)) → p 1 → (∀ a ∈ s, p a) → p s.prod
theorem Multiset.sum_induction_nonempty E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] {s : Multiset M} (p : M → Prop),
(∀ (a b : M), p a → p b → p (a + b)) → s ≠ ∅ → (∀ a ∈ s, p a) → p s.sum
theorem Multiset.prod_induction_nonempty E1 #
∀ {M : Type u_2} [inst : CommMonoid M] {s : Multiset M} (p : M → Prop),
(∀ (a b : M), p a → p b → p (a * b)) → s ≠ ∅ → (∀ a ∈ s, p a) → p s.prod