File: Mathlib/Algebra/BigOperators/Group/Multiset.lean

full_name: Multiset.sum
code: /-- Product of a multiset given a commutative monoid structure on `α`.
  `prod {a, b, c} = a * b * c` -/
@[to_additive
      "Sum of a multiset given a commutative additive monoid structure on `α`.
      `sum {a, b, c} = a + b + c`"]
def prod : Multiset α → α 
goal: Multiset α → α

full_name: Multiset.prod
code: /-- Product of a multiset given a commutative monoid structure on `α`.
  `prod {a, b, c} = a * b * c` -/
@[to_additive
      "Sum of a multiset given a commutative additive monoid structure on `α`.
      `sum {a, b, c} = a + b + c`"]
def prod : Multiset α → α 
goal: Multiset α → α

full_name: Multiset.sum_eq_foldr
code: @[to_additive]
theorem prod_eq_foldr (s : Multiset α) :
    prod s = foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 s 
goal: s.sum = Multiset.foldr (fun x x_1 => x + x_1) ⋯ 0 s

full_name: Multiset.prod_eq_foldr
code: @[to_additive]
theorem prod_eq_foldr (s : Multiset α) :
    prod s = foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 s 
goal: s.prod = Multiset.foldr (fun x x_1 => x * x_1) ⋯ 1 s

full_name: Multiset.sum_eq_foldl
code: @[to_additive]
theorem prod_eq_foldl (s : Multiset α) :
    prod s = foldl (· * ·) (fun x y z => by simp [mul_right_comm]) 1 s 
goal: s.sum = Multiset.foldl (fun x x_1 => x + x_1) ⋯ 0 s

full_name: Multiset.prod_eq_foldl
code: @[to_additive]
theorem prod_eq_foldl (s : Multiset α) :
    prod s = foldl (· * ·) (fun x y z => by simp [mul_right_comm]) 1 s 
goal: s.prod = Multiset.foldl (fun x x_1 => x * x_1) ⋯ 1 s

full_name: Multiset.prod_coe
code: @[to_additive (attr := simp, norm_cast)]
theorem prod_coe (l : List α) : prod ↑l = l.prod 
goal: (↑l).prod = l.prod

full_name: Multiset.sum_coe
code: @[to_additive (attr := simp, norm_cast)]
theorem prod_coe (l : List α) : prod ↑l = l.prod 
goal: (↑l).sum = l.sum

full_name: Multiset.sum_toList
code: @[to_additive (attr := simp)]
theorem prod_toList (s : Multiset α) : s.toList.prod = s.prod 
goal: s.toList.sum = s.sum

full_name: Multiset.prod_toList
code: @[to_additive (attr := simp)]
theorem prod_toList (s : Multiset α) : s.toList.prod = s.prod 
goal: s.toList.prod = s.prod

full_name: Multiset.prod_zero
code: @[to_additive (attr := simp)]
theorem prod_zero : @prod α _ 0 = 1 
goal: Multiset.prod 0 = 1

full_name: Multiset.sum_zero
code: @[to_additive (attr := simp)]
theorem prod_zero : @prod α _ 0 = 1 
goal: Multiset.sum 0 = 0

full_name: Multiset.prod_cons
code: @[to_additive (attr := simp)]
theorem prod_cons (a : α) (s) : prod (a ::ₘ s) = a * prod s 
goal: (a ::ₘ s).prod = a * s.prod

full_name: Multiset.sum_cons
code: @[to_additive (attr := simp)]
theorem prod_cons (a : α) (s) : prod (a ::ₘ s) = a * prod s 
goal: (a ::ₘ s).sum = a + s.sum

full_name: Multiset.prod_erase
code: @[to_additive (attr := simp)]
theorem prod_erase [DecidableEq α] (h : a ∈ s) : a * (s.erase a).prod = s.prod 
goal: a * (s.erase a).prod = s.prod

full_name: Multiset.sum_erase
code: @[to_additive (attr := simp)]
theorem prod_erase [DecidableEq α] (h : a ∈ s) : a * (s.erase a).prod = s.prod 
goal: a + (s.erase a).sum = s.sum

full_name: Multiset.prod_map_erase
code: @[to_additive (attr := simp)]
theorem prod_map_erase [DecidableEq ι] {a : ι} (h : a ∈ m) :
    f a * ((m.erase a).map f).prod = (m.map f).prod 
goal: f a * (Multiset.map f (m.erase a)).prod = (Multiset.map f m).prod

full_name: Multiset.sum_map_erase
code: @[to_additive (attr := simp)]
theorem prod_map_erase [DecidableEq ι] {a : ι} (h : a ∈ m) :
    f a * ((m.erase a).map f).prod = (m.map f).prod 
goal: f a + (Multiset.map f (m.erase a)).sum = (Multiset.map f m).sum

full_name: Multiset.prod_singleton
code: @[to_additive (attr := simp)]
theorem prod_singleton (a : α) : prod {a} = a 
goal: {a}.prod = a

full_name: Multiset.sum_singleton
code: @[to_additive (attr := simp)]
theorem prod_singleton (a : α) : prod {a} = a 
goal: {a}.sum = a

full_name: Multiset.prod_pair
code: @[to_additive]
theorem prod_pair (a b : α) : ({a, b} : Multiset α).prod = a * b 
goal: {a, b}.prod = a * b

full_name: Multiset.sum_pair
code: @[to_additive]
theorem prod_pair (a b : α) : ({a, b} : Multiset α).prod = a * b 
goal: {a, b}.sum = a + b

full_name: Multiset.prod_add
code: @[to_additive (attr := simp)]
theorem prod_add (s t : Multiset α) : prod (s + t) = prod s * prod t 
goal: (s + t).prod = s.prod * t.prod

full_name: Multiset.sum_add
code: @[to_additive (attr := simp)]
theorem prod_add (s t : Multiset α) : prod (s + t) = prod s * prod t 
goal: (s + t).sum = s.sum + t.sum

full_name: Multiset.prod_nsmul
code: @[to_additive]
theorem prod_nsmul (m : Multiset α) : ∀ n : ℕ, (n • m).prod = m.prod ^ n
  
goal: (n • m).prod = m.prod ^ n

full_name: Multiset.sum_nsmul
code: @[to_additive]
theorem prod_nsmul (m : Multiset α) : ∀ n : ℕ, (n • m).prod = m.prod ^ n
  
goal: (n • m).sum = n • m.sum

full_name: Multiset.sum_filter_add_sum_filter_not
code: @[to_additive]
theorem prod_filter_mul_prod_filter_not (p) [DecidablePred p] :
    (s.filter p).prod * (s.filter (fun a ↦ ¬ p a)).prod = s.prod 
goal: (Multiset.filter p s).sum + (Multiset.filter (fun a => ¬p a) s).sum = s.sum

full_name: Multiset.prod_filter_mul_prod_filter_not
code: @[to_additive]
theorem prod_filter_mul_prod_filter_not (p) [DecidablePred p] :
    (s.filter p).prod * (s.filter (fun a ↦ ¬ p a)).prod = s.prod 
goal: (Multiset.filter p s).prod * (Multiset.filter (fun a => ¬p a) s).prod = s.prod

full_name: Multiset.sum_replicate
code: @[to_additive (attr := simp)]
theorem prod_replicate (n : ℕ) (a : α) : (replicate n a).prod = a ^ n 
goal: (Multiset.replicate n a).sum = n • a

full_name: Multiset.prod_replicate
code: @[to_additive (attr := simp)]
theorem prod_replicate (n : ℕ) (a : α) : (replicate n a).prod = a ^ n 
goal: (Multiset.replicate n a).prod = a ^ n

full_name: Multiset.prod_map_eq_pow_single
code: @[to_additive]
theorem prod_map_eq_pow_single [DecidableEq ι] (i : ι)
    (hf : ∀ i' ≠ i, i' ∈ m → f i' = 1) : (m.map f).prod = f i ^ m.count i 
goal: (Multiset.map f m).prod = f i ^ Multiset.count i m

full_name: Multiset.sum_map_eq_nsmul_single
code: @[to_additive]
theorem prod_map_eq_pow_single [DecidableEq ι] (i : ι)
    (hf : ∀ i' ≠ i, i' ∈ m → f i' = 1) : (m.map f).prod = f i ^ m.count i 
goal: (Multiset.map f m).sum = Multiset.count i m • f i

full_name: Multiset.sum_eq_nsmul_single
code: @[to_additive]
theorem prod_eq_pow_single [DecidableEq α] (a : α) (h : ∀ a' ≠ a, a' ∈ s → a' = 1) :
    s.prod = a ^ s.count a 
goal: s.sum = Multiset.count a s • a

full_name: Multiset.prod_eq_pow_single
code: @[to_additive]
theorem prod_eq_pow_single [DecidableEq α] (a : α) (h : ∀ a' ≠ a, a' ∈ s → a' = 1) :
    s.prod = a ^ s.count a 
goal: s.prod = a ^ Multiset.count a s

full_name: Multiset.prod_eq_one
code: @[to_additive]
lemma prod_eq_one (h : ∀ x ∈ s, x = (1 : α)) : s.prod = 1 
goal: s.prod = 1

full_name: Multiset.sum_eq_zero
code: @[to_additive]
lemma prod_eq_one (h : ∀ x ∈ s, x = (1 : α)) : s.prod = 1 
goal: s.sum = 0

full_name: Multiset.pow_count
code: @[to_additive]
theorem pow_count [DecidableEq α] (a : α) : a ^ s.count a = (s.filter (Eq a)).prod 
goal: a ^ Multiset.count a s = (Multiset.filter (Eq a) s).prod

full_name: Multiset.nsmul_count
code: @[to_additive]
theorem pow_count [DecidableEq α] (a : α) : a ^ s.count a = (s.filter (Eq a)).prod 
goal: Multiset.count a s • a = (Multiset.filter (Eq a) s).sum

full_name: Multiset.prod_hom
code: @[to_additive]
theorem prod_hom [CommMonoid β] (s : Multiset α) {F : Type*} [FunLike F α β]
    [MonoidHomClass F α β] (f : F) :
    (s.map f).prod = f s.prod 
goal: (Multiset.map (⇑f) s).prod = f s.prod

full_name: Multiset.sum_hom
code: @[to_additive]
theorem prod_hom [CommMonoid β] (s : Multiset α) {F : Type*} [FunLike F α β]
    [MonoidHomClass F α β] (f : F) :
    (s.map f).prod = f s.prod 
goal: (Multiset.map (⇑f) s).sum = f s.sum

full_name: Multiset.sum_hom'
code: @[to_additive]
theorem prod_hom' [CommMonoid β] (s : Multiset ι) {F : Type*} [FunLike F α β]
    [MonoidHomClass F α β] (f : F)
    (g : ι → α) : (s.map fun i => f <| g i).prod = f (s.map g).prod 
goal: (Multiset.map (fun i => f (g i)) s).sum = f (Multiset.map g s).sum

full_name: Multiset.prod_hom'
code: @[to_additive]
theorem prod_hom' [CommMonoid β] (s : Multiset ι) {F : Type*} [FunLike F α β]
    [MonoidHomClass F α β] (f : F)
    (g : ι → α) : (s.map fun i => f <| g i).prod = f (s.map g).prod 
goal: (Multiset.map (fun i => f (g i)) s).prod = f (Multiset.map g s).prod

full_name: Multiset.prod_hom₂
code: @[to_additive]
theorem prod_hom₂ [CommMonoid β] [CommMonoid γ] (s : Multiset ι) (f : α → β → γ)
    (hf : ∀ a b c d, f (a * b) (c * d) = f a c * f b d) (hf' : f 1 1 = 1) (f₁ : ι → α)
    (f₂ : ι → β) : (s.map fun i => f (f₁ i) (f₂ i)).prod = f (s.map f₁).prod (s.map f₂).prod 
goal: (Multiset.map (fun i => f (f₁ i) (f₂ i)) s).prod = f (Multiset.map f₁ s).prod (Multiset.map f₂ s).prod

full_name: Multiset.sum_hom₂
code: @[to_additive]
theorem prod_hom₂ [CommMonoid β] [CommMonoid γ] (s : Multiset ι) (f : α → β → γ)
    (hf : ∀ a b c d, f (a * b) (c * d) = f a c * f b d) (hf' : f 1 1 = 1) (f₁ : ι → α)
    (f₂ : ι → β) : (s.map fun i => f (f₁ i) (f₂ i)).prod = f (s.map f₁).prod (s.map f₂).prod 
goal: (Multiset.map (fun i => f (f₁ i) (f₂ i)) s).sum = f (Multiset.map f₁ s).sum (Multiset.map f₂ s).sum

full_name: Multiset.prod_hom_rel
code: @[to_additive]
theorem prod_hom_rel [CommMonoid β] (s : Multiset ι) {r : α → β → Prop} {f : ι → α} {g : ι → β}
    (h₁ : r 1 1) (h₂ : ∀ ⦃a b c⦄, r b c → r (f a * b) (g a * c)) :
    r (s.map f).prod (s.map g).prod 
goal: r (Multiset.map f s).prod (Multiset.map g s).prod

full_name: Multiset.sum_hom_rel
code: @[to_additive]
theorem prod_hom_rel [CommMonoid β] (s : Multiset ι) {r : α → β → Prop} {f : ι → α} {g : ι → β}
    (h₁ : r 1 1) (h₂ : ∀ ⦃a b c⦄, r b c → r (f a * b) (g a * c)) :
    r (s.map f).prod (s.map g).prod 
goal: r (Multiset.map f s).sum (Multiset.map g s).sum

full_name: Multiset.sum_map_zero
code: @[to_additive]
theorem prod_map_one : prod (m.map fun _ => (1 : α)) = 1 
goal: (Multiset.map (fun x => 0) m).sum = 0

full_name: Multiset.prod_map_one
code: @[to_additive]
theorem prod_map_one : prod (m.map fun _ => (1 : α)) = 1 
goal: (Multiset.map (fun x => 1) m).prod = 1

full_name: Multiset.sum_map_add
code: @[to_additive (attr := simp)]
theorem prod_map_mul : (m.map fun i => f i * g i).prod = (m.map f).prod * (m.map g).prod 
goal: (Multiset.map (fun i => f i + g i) m).sum = (Multiset.map f m).sum + (Multiset.map g m).sum

full_name: Multiset.prod_map_mul
code: @[to_additive (attr := simp)]
theorem prod_map_mul : (m.map fun i => f i * g i).prod = (m.map f).prod * (m.map g).prod 
goal: (Multiset.map (fun i => f i * g i) m).prod = (Multiset.map f m).prod * (Multiset.map g m).prod

full_name: Multiset.prod_map_pow
code: @[to_additive]
theorem prod_map_pow {n : ℕ} : (m.map fun i => f i ^ n).prod = (m.map f).prod ^ n 
goal: (Multiset.map (fun i => f i ^ n) m).prod = (Multiset.map f m).prod ^ n

full_name: Multiset.sum_map_nsmul
code: @[to_additive]
theorem prod_map_pow {n : ℕ} : (m.map fun i => f i ^ n).prod = (m.map f).prod ^ n 
goal: (Multiset.map (fun i => n • f i) m).sum = n • (Multiset.map f m).sum

full_name: Multiset.prod_map_prod_map
code: @[to_additive]
theorem prod_map_prod_map (m : Multiset β) (n : Multiset γ) {f : β → γ → α} :
    prod (m.map fun a => prod <| n.map fun b => f a b) =
      prod (n.map fun b => prod <| m.map fun a => f a b) 
goal: (Multiset.map (fun a => (Multiset.map (fun b => f a b) n).prod) m).prod =
  (Multiset.map (fun b => (Multiset.map (fun a => f a b) m).prod) n).prod

full_name: Multiset.sum_map_sum_map
code: @[to_additive]
theorem prod_map_prod_map (m : Multiset β) (n : Multiset γ) {f : β → γ → α} :
    prod (m.map fun a => prod <| n.map fun b => f a b) =
      prod (n.map fun b => prod <| m.map fun a => f a b) 
goal: (Multiset.map (fun a => (Multiset.map (fun b => f a b) n).sum) m).sum =
  (Multiset.map (fun b => (Multiset.map (fun a => f a b) m).sum) n).sum

full_name: Multiset.sum_induction
code: @[to_additive]
theorem prod_induction (p : α → Prop) (s : Multiset α) (p_mul : ∀ a b, p a → p b → p (a * b))
    (p_one : p 1) (p_s : ∀ a ∈ s, p a) : p s.prod 
goal: p s.sum

full_name: Multiset.prod_induction
code: @[to_additive]
theorem prod_induction (p : α → Prop) (s : Multiset α) (p_mul : ∀ a b, p a → p b → p (a * b))
    (p_one : p 1) (p_s : ∀ a ∈ s, p a) : p s.prod 
goal: p s.prod

full_name: Multiset.prod_induction_nonempty
code: @[to_additive]
theorem prod_induction_nonempty (p : α → Prop) (p_mul : ∀ a b, p a → p b → p (a * b)) (hs : s ≠ ∅)
    (p_s : ∀ a ∈ s, p a) : p s.prod 
goal: p s.prod

full_name: Multiset.sum_induction_nonempty
code: @[to_additive]
theorem prod_induction_nonempty (p : α → Prop) (p_mul : ∀ a b, p a → p b → p (a * b)) (hs : s ≠ ∅)
    (p_s : ∀ a ∈ s, p a) : p s.prod 
goal: p s.sum

full_name: Multiset.prod_dvd_prod_of_le
code: theorem prod_dvd_prod_of_le (h : s ≤ t) : s.prod ∣ t.prod 
goal: s.prod ∣ t.prod

full_name: map_multiset_prod
code: @[to_additive]
lemma _root_.map_multiset_prod [FunLike F α β] [MonoidHomClass F α β] (f : F) (s : Multiset α) :
    f s.prod = (s.map f).prod 
goal: f s.prod = (Multiset.map (⇑f) s).prod

full_name: map_multiset_sum
code: @[to_additive]
lemma _root_.map_multiset_prod [FunLike F α β] [MonoidHomClass F α β] (f : F) (s : Multiset α) :
    f s.prod = (s.map f).prod 
goal: f s.sum = (Multiset.map (⇑f) s).sum

full_name: MonoidHom.map_multiset_prod
code: @[to_additive]
protected lemma _root_.MonoidHom.map_multiset_prod (f : α →* β) (s : Multiset α) :
    f s.prod = (s.map f).prod 
goal: f s.prod = (Multiset.map (⇑f) s).prod

full_name: AddMonoidHom.map_multiset_sum
code: @[to_additive]
protected lemma _root_.MonoidHom.map_multiset_prod (f : α →* β) (s : Multiset α) :
    f s.prod = (s.map f).prod 
goal: f s.sum = (Multiset.map (⇑f) s).sum

full_name: Multiset.dvd_prod
code: lemma dvd_prod : a ∈ s → a ∣ s.prod 
goal: a ∈ s → a ∣ s.prod

full_name: Multiset.fst_prod
code: @[to_additive] lemma fst_prod (s : Multiset (α × β)) : s.prod.1 = (s.map Prod.fst).prod 
goal: s.prod.1 = (Multiset.map Prod.fst s).prod

full_name: Multiset.fst_sum
code: @[to_additive] lemma fst_prod (s : Multiset (α × β)) : s.prod.1 = (s.map Prod.fst).prod 
goal: s.sum.1 = (Multiset.map Prod.fst s).sum

full_name: Multiset.snd_prod
code: @[to_additive] lemma snd_prod (s : Multiset (α × β)) : s.prod.2 = (s.map Prod.snd).prod 
goal: s.prod.2 = (Multiset.map Prod.snd s).prod

full_name: Multiset.snd_sum
code: @[to_additive] lemma snd_prod (s : Multiset (α × β)) : s.prod.2 = (s.map Prod.snd).prod 
goal: s.sum.2 = (Multiset.map Prod.snd s).sum

full_name: Multiset.prod_dvd_prod_of_dvd
code: theorem prod_dvd_prod_of_dvd [CommMonoid β] {S : Multiset α} (g1 g2 : α → β)
    (h : ∀ a ∈ S, g1 a ∣ g2 a) : (Multiset.map g1 S).prod ∣ (Multiset.map g2 S).prod 
goal: (Multiset.map g1 S).prod ∣ (Multiset.map g2 S).prod

full_name: Multiset.sumAddMonoidHom
code: /-- `Multiset.sum`, the sum of the elements of a multiset, promoted to a morphism of
`AddCommMonoid`s. -/
def sumAddMonoidHom : Multiset α →+ α 
goal: Multiset α →+ α

full_name: Multiset.coe_sumAddMonoidHom
code: @[simp]
theorem coe_sumAddMonoidHom : (sumAddMonoidHom : Multiset α → α) = sum 
goal: ⇑Multiset.sumAddMonoidHom = Multiset.sum

full_name: Multiset.sum_map_neg'
code: @[to_additive]
theorem prod_map_inv' (m : Multiset α) : (m.map Inv.inv).prod = m.prod⁻¹ 
goal: (Multiset.map Neg.neg m).sum = -m.sum

full_name: Multiset.prod_map_inv'
code: @[to_additive]
theorem prod_map_inv' (m : Multiset α) : (m.map Inv.inv).prod = m.prod⁻¹ 
goal: (Multiset.map Inv.inv m).prod = m.prod⁻¹

full_name: Multiset.prod_map_inv
code: @[to_additive (attr := simp)]
theorem prod_map_inv : (m.map fun i => (f i)⁻¹).prod = (m.map f).prod⁻¹ 
goal: (Multiset.map (fun i => (f i)⁻¹) m).prod = (Multiset.map f m).prod⁻¹

full_name: Multiset.sum_map_neg
code: @[to_additive (attr := simp)]
theorem prod_map_inv : (m.map fun i => (f i)⁻¹).prod = (m.map f).prod⁻¹ 
goal: (Multiset.map (fun i => -f i) m).sum = -(Multiset.map f m).sum

full_name: Multiset.sum_map_sub
code: @[to_additive (attr := simp)]
theorem prod_map_div : (m.map fun i => f i / g i).prod = (m.map f).prod / (m.map g).prod 
goal: (Multiset.map (fun i => f i - g i) m).sum = (Multiset.map f m).sum - (Multiset.map g m).sum

full_name: Multiset.prod_map_div
code: @[to_additive (attr := simp)]
theorem prod_map_div : (m.map fun i => f i / g i).prod = (m.map f).prod / (m.map g).prod 
goal: (Multiset.map (fun i => f i / g i) m).prod = (Multiset.map f m).prod / (Multiset.map g m).prod

full_name: Multiset.prod_map_zpow
code: @[to_additive]
theorem prod_map_zpow {n : ℤ} : (m.map fun i => f i ^ n).prod = (m.map f).prod ^ n 
goal: (Multiset.map (fun i => f i ^ n) m).prod = (Multiset.map f m).prod ^ n

full_name: Multiset.sum_map_zsmul
code: @[to_additive]
theorem prod_map_zpow {n : ℤ} : (m.map fun i => f i ^ n).prod = (m.map f).prod ^ n 
goal: (Multiset.map (fun i => n • f i) m).sum = n • (Multiset.map f m).sum

full_name: Multiset.sum_map_singleton
code: @[simp]
theorem sum_map_singleton (s : Multiset α) : (s.map fun a => ({a} : Multiset α)).sum = s 
goal: (Multiset.map (fun a => {a}) s).sum = s

full_name: Multiset.sum_nat_mod
code: theorem sum_nat_mod (s : Multiset ℕ) (n : ℕ) : s.sum % n = (s.map (· % n)).sum % n 
goal: s.sum % n = (Multiset.map (fun x => x % n) s).sum % n

full_name: Multiset.prod_nat_mod
code: theorem prod_nat_mod (s : Multiset ℕ) (n : ℕ) : s.prod % n = (s.map (· % n)).prod % n 
goal: s.prod % n = (Multiset.map (fun x => x % n) s).prod % n

full_name: Multiset.sum_int_mod
code: theorem sum_int_mod (s : Multiset ℤ) (n : ℤ) : s.sum % n = (s.map (· % n)).sum % n 
goal: s.sum % n = (Multiset.map (fun x => x % n) s).sum % n

full_name: Multiset.prod_int_mod
code: theorem prod_int_mod (s : Multiset ℤ) (n : ℤ) : s.prod % n = (s.map (· % n)).prod % n 
goal: s.prod % n = (Multiset.map (fun x => x % n) s).prod % n