File: Mathlib/Data/Multiset/Fold.lean

full_name: Multiset.«_aux_Mathlib_Data_Multiset_Fold___macroRules_Multiset_term_*__1»
code: local notation a " * " b => op a b
goal: Lean.Macro

full_name: Multiset.fold
code: /-- `fold op b s` folds a commutative associative operation `op` over
  the multiset `s`. -/
def fold : α → Multiset α → α 
goal: α → Multiset α → α

full_name: Multiset.fold_eq_foldr
code: theorem fold_eq_foldr (b : α) (s : Multiset α) :
    fold op b s = foldr op (left_comm _ hc.comm ha.assoc) b s 
goal: Multiset.fold op b s = Multiset.foldr op ⋯ b s

full_name: Multiset.coe_fold_r
code: @[simp]
theorem coe_fold_r (b : α) (l : List α) : fold op b l = l.foldr op b 
goal: Multiset.fold op b ↑l = List.foldr op b l

full_name: Multiset.coe_fold_l
code: theorem coe_fold_l (b : α) (l : List α) : fold op b l = l.foldl op b 
goal: Multiset.fold op b ↑l = List.foldl op b l

full_name: Multiset.fold_eq_foldl
code: theorem fold_eq_foldl (b : α) (s : Multiset α) :
    fold op b s = foldl op (right_comm _ hc.comm ha.assoc) b s 
goal: Multiset.fold op b s = Multiset.foldl op ⋯ b s

full_name: Multiset.fold_zero
code: @[simp]
theorem fold_zero (b : α) : (0 : Multiset α).fold op b = b 
goal: Multiset.fold op b 0 = b

full_name: Multiset.fold_cons_left
code: @[simp]
theorem fold_cons_left : ∀ (b a : α) (s : Multiset α), (a ::ₘ s).fold op b = a * s.fold op b 
goal: Multiset.fold op b (a ::ₘ s) = op a (Multiset.fold op b s)

full_name: Multiset.fold_cons_right
code: theorem fold_cons_right (b a : α) (s : Multiset α) : (a ::ₘ s).fold op b = s.fold op b * a 
goal: Multiset.fold op b (a ::ₘ s) = op (Multiset.fold op b s) a

full_name: Multiset.fold_cons'_right
code: theorem fold_cons'_right (b a : α) (s : Multiset α) : (a ::ₘ s).fold op b = s.fold op (b * a) 
goal: Multiset.fold op b (a ::ₘ s) = Multiset.fold op (op b a) s

full_name: Multiset.fold_cons'_left
code: theorem fold_cons'_left (b a : α) (s : Multiset α) : (a ::ₘ s).fold op b = s.fold op (a * b) 
goal: Multiset.fold op b (a ::ₘ s) = Multiset.fold op (op a b) s

full_name: Multiset.fold_add
code: theorem fold_add (b₁ b₂ : α) (s₁ s₂ : Multiset α) :
    (s₁ + s₂).fold op (b₁ * b₂) = s₁.fold op b₁ * s₂.fold op b₂ 
goal: Multiset.fold op (op b₁ b₂) (s₁ + s₂) = op (Multiset.fold op b₁ s₁) (Multiset.fold op b₂ s₂)

full_name: Multiset.fold_bind
code: theorem fold_bind {ι : Type*} (s : Multiset ι) (t : ι → Multiset α) (b : ι → α) (b₀ : α) :
    (s.bind t).fold op ((s.map b).fold op b₀) =
    (s.map fun i => (t i).fold op (b i)).fold op b₀ 
goal: Multiset.fold op (Multiset.fold op b₀ (Multiset.map b s)) (s.bind t) =
  Multiset.fold op b₀ (Multiset.map (fun i => Multiset.fold op (b i) (t i)) s)

full_name: Multiset.fold_singleton
code: theorem fold_singleton (b a : α) : ({a} : Multiset α).fold op b = a * b 
goal: Multiset.fold op b {a} = op a b

full_name: Multiset.fold_distrib
code: theorem fold_distrib {f g : β → α} (u₁ u₂ : α) (s : Multiset β) :
    (s.map fun x => f x * g x).fold op (u₁ * u₂) = (s.map f).fold op u₁ * (s.map g).fold op u₂ 
goal: Multiset.fold op (op u₁ u₂) (Multiset.map (fun x => op (f x) (g x)) s) =
  op (Multiset.fold op u₁ (Multiset.map f s)) (Multiset.fold op u₂ (Multiset.map g s))

full_name: Multiset.fold_hom
code: theorem fold_hom {op' : β → β → β} [Std.Commutative op'] [Std.Associative op'] {m : α → β}
    (hm : ∀ x y, m (op x y) = op' (m x) (m y)) (b : α) (s : Multiset α) :
    (s.map m).fold op' (m b) = m (s.fold op b) 
goal: Multiset.fold op' (m b) (Multiset.map m s) = m (Multiset.fold op b s)

full_name: Multiset.fold_union_inter
code: theorem fold_union_inter [DecidableEq α] (s₁ s₂ : Multiset α) (b₁ b₂ : α) :
    ((s₁ ∪ s₂).fold op b₁ * (s₁ ∩ s₂).fold op b₂) = s₁.fold op b₁ * s₂.fold op b₂ 
goal: op (Multiset.fold op b₁ (s₁ ∪ s₂)) (Multiset.fold op b₂ (s₁ ∩ s₂)) =
  op (Multiset.fold op b₁ s₁) (Multiset.fold op b₂ s₂)

full_name: Multiset.fold_dedup_idem
code: @[simp]
theorem fold_dedup_idem [DecidableEq α] [hi : Std.IdempotentOp op] (s : Multiset α) (b : α) :
    (dedup s).fold op b = s.fold op b 
goal: Multiset.fold op b s.dedup = Multiset.fold op b s

full_name: Multiset.le_smul_dedup
code: theorem le_smul_dedup [DecidableEq α] (s : Multiset α) : ∃ n : ℕ, s ≤ n • dedup s 
goal: ∃ n, s ≤ n • s.dedup