File: Mathlib/Data/Multiset/Basic.lean

full_name: Multiset
code: /-- `Multiset α` is the quotient of `List α` by list permutation. The result
  is a type of finite sets with duplicates allowed.  -/
def Multiset.{u} (α : Type u) : Type u 
goal: Type u

full_name: Multiset.ofList
code: /-- The quotient map from `List α` to `Multiset α`. -/
@[coe]
def ofList : List α → Multiset α 
goal: List α → Multiset α

full_name: Multiset.instCoeList
code: instance : Coe (List α) (Multiset α) 
goal: Coe (List α) (Multiset α)

full_name: Multiset.quot_mk_to_coe
code: @[simp]
theorem quot_mk_to_coe (l : List α) : @Eq (Multiset α) ⟦l⟧ l 
goal: ⟦l⟧ = ↑l

full_name: Multiset.quot_mk_to_coe'
code: @[simp]
theorem quot_mk_to_coe' (l : List α) : @Eq (Multiset α) (Quot.mk (· ≈ ·) l) l 
goal: Quot.mk (fun x x_1 => x ≈ x_1) l = ↑l

full_name: Multiset.quot_mk_to_coe''
code: @[simp]
theorem quot_mk_to_coe'' (l : List α) : @Eq (Multiset α) (Quot.mk Setoid.r l) l 
goal: Quot.mk Setoid.r l = ↑l

full_name: Multiset.lift_coe
code: @[simp]
theorem lift_coe {α β : Type*} (x : List α) (f : List α → β)
    (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x 
goal: Quotient.lift f h ↑x = f x

full_name: Multiset.coe_eq_coe
code: @[simp]
theorem coe_eq_coe {l₁ l₂ : List α} : (l₁ : Multiset α) = l₂ ↔ l₁ ~ l₂ 
goal: ↑l₁ = ↑l₂ ↔ l₁ ~ l₂

full_name: Multiset.instDecidableEquivListOfDecidableEq
code: instance [DecidableEq α] (l₁ l₂ : List α) : Decidable (l₁ ≈ l₂) 
goal: Decidable (l₁ ≈ l₂)

full_name: Multiset.decidableEq
code: instance decidableEq [DecidableEq α] : DecidableEq (Multiset α)
  
goal: DecidableEq (Multiset α)

full_name: Multiset.sizeOf
code: /-- defines a size for a multiset by referring to the size of the underlying list -/
protected
def sizeOf [SizeOf α] (s : Multiset α) : ℕ 
goal: ℕ

full_name: Multiset.instSizeOf
code: instance [SizeOf α] : SizeOf (Multiset α) 
goal: SizeOf (Multiset α)

full_name: Multiset.zero
code: /-- `0 : Multiset α` is the empty set -/
protected def zero : Multiset α 
goal: Multiset α

full_name: Multiset.instZero
code: instance : Zero (Multiset α) 
goal: Zero (Multiset α)

full_name: Multiset.instEmptyCollection
code: instance : EmptyCollection (Multiset α) 
goal: EmptyCollection (Multiset α)

full_name: Multiset.inhabitedMultiset
code: instance inhabitedMultiset : Inhabited (Multiset α) 
goal: Inhabited (Multiset α)

full_name: Multiset.instUniqueOfIsEmpty
code: instance [IsEmpty α] : Unique (Multiset α) 
goal: Unique (Multiset α)

full_name: Multiset.coe_nil
code: @[simp]
theorem coe_nil : (@nil α : Multiset α) = 0 
goal: ↑[] = 0

full_name: Multiset.empty_eq_zero
code: @[simp]
theorem empty_eq_zero : (∅ : Multiset α) = 0 
goal: ∅ = 0

full_name: Multiset.coe_eq_zero
code: @[simp]
theorem coe_eq_zero (l : List α) : (l : Multiset α) = 0 ↔ l = [] 
goal: ↑l = 0 ↔ l = []

full_name: Multiset.coe_eq_zero_iff_isEmpty
code: theorem coe_eq_zero_iff_isEmpty (l : List α) : (l : Multiset α) = 0 ↔ l.isEmpty 
goal: ↑l = 0 ↔ l.isEmpty = true

full_name: Multiset.cons
code: /-- `cons a s` is the multiset which contains `s` plus one more instance of `a`. -/
def cons (a : α) (s : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset._aux_Mathlib_Data_Multiset_Basic___unexpand_Multiset_cons_1
code: @[inherit_doc Multiset.cons]
infixr:67 " ::ₘ " => Multiset.cons
goal: Lean.PrettyPrinter.Unexpander

full_name: Multiset.«_aux_Mathlib_Data_Multiset_Basic___macroRules_Multiset_term_::ₘ__1»
code: @[inherit_doc Multiset.cons]
infixr:67 " ::ₘ " => Multiset.cons
goal: Lean.Macro

full_name: Multiset.instInsert
code: instance : Insert α (Multiset α) 
goal: Insert α (Multiset α)

full_name: Multiset.insert_eq_cons
code: @[simp]
theorem insert_eq_cons (a : α) (s : Multiset α) : insert a s = a ::ₘ s 
goal: insert a s = a ::ₘ s

full_name: Multiset.cons_coe
code: @[simp]
theorem cons_coe (a : α) (l : List α) : (a ::ₘ l : Multiset α) = (a :: l : List α) 
goal: a ::ₘ ↑l = ↑(a :: l)

full_name: Multiset.cons_inj_left
code: @[simp]
theorem cons_inj_left {a b : α} (s : Multiset α) : a ::ₘ s = b ::ₘ s ↔ a = b 
goal: a ::ₘ s = b ::ₘ s ↔ a = b

full_name: Multiset.cons_inj_right
code: @[simp]
theorem cons_inj_right (a : α) : ∀ {s t : Multiset α}, a ::ₘ s = a ::ₘ t ↔ s = t 
goal: a ::ₘ s = a ::ₘ t ↔ s = t

full_name: Multiset.induction
code: @[elab_as_elim]
protected theorem induction {p : Multiset α → Prop} (empty : p 0)
    (cons : ∀ (a : α) (s : Multiset α), p s → p (a ::ₘ s)) : ∀ s, p s 
goal: p s

full_name: Multiset.induction_on
code: @[elab_as_elim]
protected theorem induction_on {p : Multiset α → Prop} (s : Multiset α) (empty : p 0)
    (cons : ∀ (a : α) (s : Multiset α), p s → p (a ::ₘ s)) : p s 
goal: p s

full_name: Multiset.cons_swap
code: theorem cons_swap (a b : α) (s : Multiset α) : a ::ₘ b ::ₘ s = b ::ₘ a ::ₘ s 
goal: a ::ₘ b ::ₘ s = b ::ₘ a ::ₘ s

full_name: Multiset.rec
code: /-- Dependent recursor on multisets.
TODO: should be @[recursor 6], but then the definition of `Multiset.pi` fails with a stack
overflow in `whnf`.
-/
protected
def rec (C_0 : C 0) (C_cons : ∀ a m, C m → C (a ::ₘ m))
    (C_cons_heq :
      ∀ a a' m b, HEq (C_cons a (a' ::ₘ m) (C_cons a' m b)) (C_cons a' (a ::ₘ m) (C_cons a m b)))
    (m : Multiset α) : C m 
goal: C m

full_name: Multiset.recOn
code: /-- Companion to `Multiset.rec` with more convenient argument order. -/
@[elab_as_elim]
protected
def recOn (m : Multiset α) (C_0 : C 0) (C_cons : ∀ a m, C m → C (a ::ₘ m))
    (C_cons_heq :
      ∀ a a' m b, HEq (C_cons a (a' ::ₘ m) (C_cons a' m b)) (C_cons a' (a ::ₘ m) (C_cons a m b))) :
    C m 
goal: C m

full_name: Multiset.recOn_0
code: @[simp]
theorem recOn_0 : @Multiset.recOn α C (0 : Multiset α) C_0 C_cons C_cons_heq = C_0 
goal: Multiset.recOn 0 C_0 C_cons C_cons_heq = C_0

full_name: Multiset.recOn_cons
code: @[simp]
theorem recOn_cons (a : α) (m : Multiset α) :
    (a ::ₘ m).recOn C_0 C_cons C_cons_heq = C_cons a m (m.recOn C_0 C_cons C_cons_heq) 
goal: (a ::ₘ m).recOn C_0 C_cons C_cons_heq = C_cons a m (m.recOn C_0 C_cons C_cons_heq)

full_name: Multiset.Mem
code: /-- `a ∈ s` means that `a` has nonzero multiplicity in `s`. -/
def Mem (a : α) (s : Multiset α) : Prop 
goal: Prop

full_name: Multiset.instMembership
code: instance : Membership α (Multiset α) 
goal: Membership α (Multiset α)

full_name: Multiset.mem_coe
code: @[simp]
theorem mem_coe {a : α} {l : List α} : a ∈ (l : Multiset α) ↔ a ∈ l 
goal: a ∈ ↑l ↔ a ∈ l

full_name: Multiset.decidableMem
code: instance decidableMem [DecidableEq α] (a : α) (s : Multiset α) : Decidable (a ∈ s) 
goal: Decidable (a ∈ s)

full_name: Multiset.mem_cons
code: @[simp]
theorem mem_cons {a b : α} {s : Multiset α} : a ∈ b ::ₘ s ↔ a = b ∨ a ∈ s 
goal: a ∈ b ::ₘ s ↔ a = b ∨ a ∈ s

full_name: Multiset.mem_cons_of_mem
code: theorem mem_cons_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ b ::ₘ s 
goal: a ∈ b ::ₘ s

full_name: Multiset.mem_cons_self
code: theorem mem_cons_self (a : α) (s : Multiset α) : a ∈ a ::ₘ s 
goal: a ∈ a ::ₘ s

full_name: Multiset.forall_mem_cons
code: theorem forall_mem_cons {p : α → Prop} {a : α} {s : Multiset α} :
    (∀ x ∈ a ::ₘ s, p x) ↔ p a ∧ ∀ x ∈ s, p x 
goal: (∀ x ∈ a ::ₘ s, p x) ↔ p a ∧ ∀ x ∈ s, p x

full_name: Multiset.exists_cons_of_mem
code: theorem exists_cons_of_mem {s : Multiset α} {a : α} : a ∈ s → ∃ t, s = a ::ₘ t 
goal: a ∈ s → ∃ t, s = a ::ₘ t

full_name: Multiset.not_mem_zero
code: @[simp]
theorem not_mem_zero (a : α) : a ∉ (0 : Multiset α) 
goal: a ∉ 0

full_name: Multiset.eq_zero_of_forall_not_mem
code: theorem eq_zero_of_forall_not_mem {s : Multiset α} : (∀ x, x ∉ s) → s = 0 
goal: (∀ (x : α), x ∉ s) → s = 0

full_name: Multiset.eq_zero_iff_forall_not_mem
code: theorem eq_zero_iff_forall_not_mem {s : Multiset α} : s = 0 ↔ ∀ a, a ∉ s 
goal: s = 0 ↔ ∀ (a : α), a ∉ s

full_name: Multiset.exists_mem_of_ne_zero
code: theorem exists_mem_of_ne_zero {s : Multiset α} : s ≠ 0 → ∃ a : α, a ∈ s 
goal: s ≠ 0 → ∃ a, a ∈ s

full_name: Multiset.empty_or_exists_mem
code: theorem empty_or_exists_mem (s : Multiset α) : s = 0 ∨ ∃ a, a ∈ s 
goal: s = 0 ∨ ∃ a, a ∈ s

full_name: Multiset.zero_ne_cons
code: @[simp]
theorem zero_ne_cons {a : α} {m : Multiset α} : 0 ≠ a ::ₘ m 
goal: 0 ≠ a ::ₘ m

full_name: Multiset.cons_ne_zero
code: @[simp]
theorem cons_ne_zero {a : α} {m : Multiset α} : a ::ₘ m ≠ 0 
goal: a ::ₘ m ≠ 0

full_name: Multiset.cons_eq_cons
code: theorem cons_eq_cons {a b : α} {as bs : Multiset α} :
    a ::ₘ as = b ::ₘ bs ↔ a = b ∧ as = bs ∨ a ≠ b ∧ ∃ cs, as = b ::ₘ cs ∧ bs = a ::ₘ cs 
goal: a ::ₘ as = b ::ₘ bs ↔ a = b ∧ as = bs ∨ a ≠ b ∧ ∃ cs, as = b ::ₘ cs ∧ bs = a ::ₘ cs

full_name: Multiset.instSingleton
code: instance : Singleton α (Multiset α) 
goal: Singleton α (Multiset α)

full_name: Multiset.instLawfulSingleton
code: instance : LawfulSingleton α (Multiset α) 
goal: LawfulSingleton α (Multiset α)

full_name: Multiset.cons_zero
code: @[simp]
theorem cons_zero (a : α) : a ::ₘ 0 = {a} 
goal: a ::ₘ 0 = {a}

full_name: Multiset.coe_singleton
code: @[simp, norm_cast]
theorem coe_singleton (a : α) : ([a] : Multiset α) = {a} 
goal: ↑[a] = {a}

full_name: Multiset.mem_singleton
code: @[simp]
theorem mem_singleton {a b : α} : b ∈ ({a} : Multiset α) ↔ b = a 
goal: b ∈ {a} ↔ b = a

full_name: Multiset.mem_singleton_self
code: theorem mem_singleton_self (a : α) : a ∈ ({a} : Multiset α) 
goal: a ∈ {a}

full_name: Multiset.singleton_inj
code: @[simp]
theorem singleton_inj {a b : α} : ({a} : Multiset α) = {b} ↔ a = b 
goal: {a} = {b} ↔ a = b

full_name: Multiset.coe_eq_singleton
code: @[simp, norm_cast]
theorem coe_eq_singleton {l : List α} {a : α} : (l : Multiset α) = {a} ↔ l = [a] 
goal: ↑l = {a} ↔ l = [a]

full_name: Multiset.singleton_eq_cons_iff
code: @[simp]
theorem singleton_eq_cons_iff {a b : α} (m : Multiset α) : {a} = b ::ₘ m ↔ a = b ∧ m = 0 
goal: {a} = b ::ₘ m ↔ a = b ∧ m = 0

full_name: Multiset.pair_comm
code: theorem pair_comm (x y : α) : ({x, y} : Multiset α) = {y, x} 
goal: {x, y} = {y, x}

full_name: Multiset.Subset
code: /-- `s ⊆ t` is the lift of the list subset relation. It means that any
  element with nonzero multiplicity in `s` has nonzero multiplicity in `t`,
  but it does not imply that the multiplicity of `a` in `s` is less or equal than in `t`;
  see `s ≤ t` for this relation. -/
protected def Subset (s t : Multiset α) : Prop 
goal: Prop

full_name: Multiset.instHasSubset
code: instance : HasSubset (Multiset α) 
goal: HasSubset (Multiset α)

full_name: Multiset.instHasSSubset
code: instance : HasSSubset (Multiset α) 
goal: HasSSubset (Multiset α)

full_name: Multiset.instIsNonstrictStrictOrder
code: instance instIsNonstrictStrictOrder : IsNonstrictStrictOrder (Multiset α) (· ⊆ ·) (· ⊂ ·) 
goal: IsNonstrictStrictOrder (Multiset α) (fun x x_1 => x ⊆ x_1) fun x x_1 => x ⊂ x_1

full_name: Multiset.coe_subset
code: @[simp]
theorem coe_subset {l₁ l₂ : List α} : (l₁ : Multiset α) ⊆ l₂ ↔ l₁ ⊆ l₂ 
goal: ↑l₁ ⊆ ↑l₂ ↔ l₁ ⊆ l₂

full_name: Multiset.Subset.refl
code: @[simp]
theorem Subset.refl (s : Multiset α) : s ⊆ s 
goal: s ⊆ s

full_name: Multiset.Subset.trans
code: theorem Subset.trans {s t u : Multiset α} : s ⊆ t → t ⊆ u → s ⊆ u 
goal: s ⊆ t → t ⊆ u → s ⊆ u

full_name: Multiset.subset_iff
code: theorem subset_iff {s t : Multiset α} : s ⊆ t ↔ ∀ ⦃x⦄, x ∈ s → x ∈ t 
goal: s ⊆ t ↔ ∀ ⦃x : α⦄, x ∈ s → x ∈ t

full_name: Multiset.mem_of_subset
code: theorem mem_of_subset {s t : Multiset α} {a : α} (h : s ⊆ t) : a ∈ s → a ∈ t 
goal: a ∈ s → a ∈ t

full_name: Multiset.zero_subset
code: @[simp]
theorem zero_subset (s : Multiset α) : 0 ⊆ s 
goal: 0 ⊆ s

full_name: Multiset.subset_cons
code: theorem subset_cons (s : Multiset α) (a : α) : s ⊆ a ::ₘ s 
goal: s ⊆ a ::ₘ s

full_name: Multiset.ssubset_cons
code: theorem ssubset_cons {s : Multiset α} {a : α} (ha : a ∉ s) : s ⊂ a ::ₘ s 
goal: s ⊂ a ::ₘ s

full_name: Multiset.cons_subset
code: @[simp]
theorem cons_subset {a : α} {s t : Multiset α} : a ::ₘ s ⊆ t ↔ a ∈ t ∧ s ⊆ t 
goal: a ::ₘ s ⊆ t ↔ a ∈ t ∧ s ⊆ t

full_name: Multiset.cons_subset_cons
code: theorem cons_subset_cons {a : α} {s t : Multiset α} : s ⊆ t → a ::ₘ s ⊆ a ::ₘ t 
goal: s ⊆ t → a ::ₘ s ⊆ a ::ₘ t

full_name: Multiset.eq_zero_of_subset_zero
code: theorem eq_zero_of_subset_zero {s : Multiset α} (h : s ⊆ 0) : s = 0 
goal: s = 0

full_name: Multiset.subset_zero
code: @[simp] lemma subset_zero : s ⊆ 0 ↔ s = 0 
goal: s ⊆ 0 ↔ s = 0

full_name: Multiset.zero_ssubset
code: @[simp] lemma zero_ssubset : 0 ⊂ s ↔ s ≠ 0 
goal: 0 ⊂ s ↔ s ≠ 0

full_name: Multiset.singleton_subset
code: @[simp] lemma singleton_subset : {a} ⊆ s ↔ a ∈ s 
goal: {a} ⊆ s ↔ a ∈ s

full_name: Multiset.induction_on'
code: theorem induction_on' {p : Multiset α → Prop} (S : Multiset α) (h₁ : p 0)
    (h₂ : ∀ {a s}, a ∈ S → s ⊆ S → p s → p (insert a s)) : p S 
goal: p S

full_name: Multiset.toList
code: /-- Produces a list of the elements in the multiset using choice. -/
noncomputable def toList (s : Multiset α) 
goal: List α

full_name: Multiset.coe_toList
code: @[simp, norm_cast]
theorem coe_toList (s : Multiset α) : (s.toList : Multiset α) = s 
goal: ↑s.toList = s

full_name: Multiset.toList_eq_nil
code: @[simp]
theorem toList_eq_nil {s : Multiset α} : s.toList = [] ↔ s = 0 
goal: s.toList = [] ↔ s = 0

full_name: Multiset.empty_toList
code: @[simp]
theorem empty_toList {s : Multiset α} : s.toList.isEmpty ↔ s = 0 
goal: s.toList.isEmpty = true ↔ s = 0

full_name: Multiset.toList_zero
code: @[simp]
theorem toList_zero : (Multiset.toList 0 : List α) = [] 
goal: Multiset.toList 0 = []

full_name: Multiset.mem_toList
code: @[simp]
theorem mem_toList {a : α} {s : Multiset α} : a ∈ s.toList ↔ a ∈ s 
goal: a ∈ s.toList ↔ a ∈ s

full_name: Multiset.toList_eq_singleton_iff
code: @[simp]
theorem toList_eq_singleton_iff {a : α} {m : Multiset α} : m.toList = [a] ↔ m = {a} 
goal: m.toList = [a] ↔ m = {a}

full_name: Multiset.toList_singleton
code: @[simp]
theorem toList_singleton (a : α) : ({a} : Multiset α).toList = [a] 
goal: {a}.toList = [a]

full_name: Multiset.Le
code: /-- `s ≤ t` means that `s` is a sublist of `t` (up to permutation).
  Equivalently, `s ≤ t` means that `count a s ≤ count a t` for all `a`. -/
protected def Le (s t : Multiset α) : Prop 
goal: Prop

full_name: Multiset.instPartialOrder
code: instance : PartialOrder (Multiset α) 
goal: PartialOrder (Multiset α)

full_name: Multiset.decidableLE
code: instance decidableLE [DecidableEq α] : DecidableRel ((· ≤ ·) : Multiset α → Multiset α → Prop) 
goal: DecidableRel fun x x_1 => x ≤ x_1

full_name: Multiset.subset_of_le
code: theorem subset_of_le : s ≤ t → s ⊆ t 
goal: s ≤ t → s ⊆ t

full_name: Multiset.mem_of_le
code: theorem mem_of_le (h : s ≤ t) : a ∈ s → a ∈ t 
goal: a ∈ s → a ∈ t

full_name: Multiset.not_mem_mono
code: theorem not_mem_mono (h : s ⊆ t) : a ∉ t → a ∉ s 
goal: a ∉ t → a ∉ s

full_name: Multiset.coe_le
code: @[simp]
theorem coe_le {l₁ l₂ : List α} : (l₁ : Multiset α) ≤ l₂ ↔ l₁ <+~ l₂ 
goal: ↑l₁ ≤ ↑l₂ ↔ l₁ <+~ l₂

full_name: Multiset.leInductionOn
code: @[elab_as_elim]
theorem leInductionOn {C : Multiset α → Multiset α → Prop} {s t : Multiset α} (h : s ≤ t)
    (H : ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → C l₁ l₂) : C s t 
goal: C s t

full_name: Multiset.zero_le
code: theorem zero_le (s : Multiset α) : 0 ≤ s 
goal: 0 ≤ s

full_name: Multiset.instOrderBot
code: instance : OrderBot (Multiset α) 
goal: OrderBot (Multiset α)

full_name: Multiset.bot_eq_zero
code: /-- This is a `rfl` and `simp` version of `bot_eq_zero`. -/
@[simp]
theorem bot_eq_zero : (⊥ : Multiset α) = 0 
goal: ⊥ = 0

full_name: Multiset.le_zero
code: theorem le_zero : s ≤ 0 ↔ s = 0 
goal: s ≤ 0 ↔ s = 0

full_name: Multiset.lt_cons_self
code: theorem lt_cons_self (s : Multiset α) (a : α) : s < a ::ₘ s 
goal: s < a ::ₘ s

full_name: Multiset.le_cons_self
code: theorem le_cons_self (s : Multiset α) (a : α) : s ≤ a ::ₘ s 
goal: s ≤ a ::ₘ s

full_name: Multiset.cons_le_cons_iff
code: theorem cons_le_cons_iff (a : α) : a ::ₘ s ≤ a ::ₘ t ↔ s ≤ t 
goal: a ::ₘ s ≤ a ::ₘ t ↔ s ≤ t

full_name: Multiset.cons_le_cons
code: theorem cons_le_cons (a : α) : s ≤ t → a ::ₘ s ≤ a ::ₘ t 
goal: s ≤ t → a ::ₘ s ≤ a ::ₘ t

full_name: Multiset.cons_lt_cons_iff
code: @[simp] lemma cons_lt_cons_iff : a ::ₘ s < a ::ₘ t ↔ s < t 
goal: a ::ₘ s < a ::ₘ t ↔ s < t

full_name: Multiset.cons_lt_cons
code: lemma cons_lt_cons (a : α) (h : s < t) : a ::ₘ s < a ::ₘ t 
goal: a ::ₘ s < a ::ₘ t

full_name: Multiset.le_cons_of_not_mem
code: theorem le_cons_of_not_mem (m : a ∉ s) : s ≤ a ::ₘ t ↔ s ≤ t 
goal: s ≤ a ::ₘ t ↔ s ≤ t

full_name: Multiset.singleton_ne_zero
code: @[simp]
theorem singleton_ne_zero (a : α) : ({a} : Multiset α) ≠ 0 
goal: {a} ≠ 0

full_name: Multiset.singleton_le
code: @[simp]
theorem singleton_le {a : α} {s : Multiset α} : {a} ≤ s ↔ a ∈ s 
goal: {a} ≤ s ↔ a ∈ s

full_name: Multiset.le_singleton
code: @[simp] lemma le_singleton : s ≤ {a} ↔ s = 0 ∨ s = {a} 
goal: s ≤ {a} ↔ s = 0 ∨ s = {a}

full_name: Multiset.lt_singleton
code: @[simp] lemma lt_singleton : s < {a} ↔ s = 0 
goal: s < {a} ↔ s = 0

full_name: Multiset.ssubset_singleton_iff
code: @[simp] lemma ssubset_singleton_iff : s ⊂ {a} ↔ s = 0 
goal: s ⊂ {a} ↔ s = 0

full_name: Multiset.add
code: /-- The sum of two multisets is the lift of the list append operation.
  This adds the multiplicities of each element,
  i.e. `count a (s + t) = count a s + count a t`. -/
protected def add (s₁ s₂ : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset.instAdd
code: instance : Add (Multiset α) 
goal: Add (Multiset α)

full_name: Multiset.coe_add
code: @[simp]
theorem coe_add (s t : List α) : (s + t : Multiset α) = (s ++ t : List α) 
goal: ↑s + ↑t = ↑(s ++ t)

full_name: Multiset.singleton_add
code: @[simp]
theorem singleton_add (a : α) (s : Multiset α) : {a} + s = a ::ₘ s 
goal: {a} + s = a ::ₘ s

full_name: _private.Mathlib.Data.Multiset.Basic.0.Multiset.add_le_add_iff_left'
code: private theorem add_le_add_iff_left' {s t u : Multiset α} : s + t ≤ s + u ↔ t ≤ u 
goal: s + t ≤ s + u ↔ t ≤ u

full_name: Multiset.instCovariantClassHAddLe
code: instance : CovariantClass (Multiset α) (Multiset α) (· + ·) (· ≤ ·) 
goal: CovariantClass (Multiset α) (Multiset α) (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1

full_name: Multiset.instContravariantClassHAddLe
code: instance : ContravariantClass (Multiset α) (Multiset α) (· + ·) (· ≤ ·) 
goal: ContravariantClass (Multiset α) (Multiset α) (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1

full_name: Multiset.instOrderedCancelAddCommMonoid
code: instance : OrderedCancelAddCommMonoid (Multiset α) 
goal: OrderedCancelAddCommMonoid (Multiset α)

full_name: Multiset.le_add_right
code: theorem le_add_right (s t : Multiset α) : s ≤ s + t 
goal: s ≤ s + t

full_name: Multiset.le_add_left
code: theorem le_add_left (s t : Multiset α) : s ≤ t + s 
goal: s ≤ t + s

full_name: Multiset.le_iff_exists_add
code: theorem le_iff_exists_add {s t : Multiset α} : s ≤ t ↔ ∃ u, t = s + u 
goal: s ≤ t ↔ ∃ u, t = s + u

full_name: Multiset.instCanonicallyOrderedAddCommMonoid
code: instance : CanonicallyOrderedAddCommMonoid (Multiset α) 
goal: CanonicallyOrderedAddCommMonoid (Multiset α)

full_name: Multiset.cons_add
code: @[simp]
theorem cons_add (a : α) (s t : Multiset α) : a ::ₘ s + t = a ::ₘ (s + t) 
goal: a ::ₘ s + t = a ::ₘ (s + t)

full_name: Multiset.add_cons
code: @[simp]
theorem add_cons (a : α) (s t : Multiset α) : s + a ::ₘ t = a ::ₘ (s + t) 
goal: s + a ::ₘ t = a ::ₘ (s + t)

full_name: Multiset.mem_add
code: @[simp]
theorem mem_add {a : α} {s t : Multiset α} : a ∈ s + t ↔ a ∈ s ∨ a ∈ t 
goal: a ∈ s + t ↔ a ∈ s ∨ a ∈ t

full_name: Multiset.mem_of_mem_nsmul
code: theorem mem_of_mem_nsmul {a : α} {s : Multiset α} {n : ℕ} (h : a ∈ n • s) : a ∈ s 
goal: a ∈ s

full_name: Multiset.mem_nsmul
code: @[simp]
theorem mem_nsmul {a : α} {s : Multiset α} {n : ℕ} : a ∈ n • s ↔ n ≠ 0 ∧ a ∈ s 
goal: a ∈ n • s ↔ n ≠ 0 ∧ a ∈ s

full_name: Multiset.mem_nsmul_of_ne_zero
code: lemma mem_nsmul_of_ne_zero {a : α} {s : Multiset α} {n : ℕ} (h0 : n ≠ 0) : a ∈ n • s ↔ a ∈ s 
goal: a ∈ n • s ↔ a ∈ s

full_name: Multiset.nsmul_cons
code: theorem nsmul_cons {s : Multiset α} (n : ℕ) (a : α) :
    n • (a ::ₘ s) = n • ({a} : Multiset α) + n • s 
goal: n • (a ::ₘ s) = n • {a} + n • s

full_name: Multiset.card
code: /-- The cardinality of a multiset is the sum of the multiplicities
  of all its elements, or simply the length of the underlying list. -/
def card : Multiset α →+ ℕ 
goal: Multiset α →+ ℕ

full_name: Multiset.coe_card
code: @[simp]
theorem coe_card (l : List α) : card (l : Multiset α) = length l 
goal: Multiset.card ↑l = l.length

full_name: Multiset.length_toList
code: @[simp]
theorem length_toList (s : Multiset α) : s.toList.length = card s 
goal: s.toList.length = Multiset.card s

full_name: Multiset.card_zero
code: @[simp]
theorem card_zero : @card α 0 = 0 
goal: Multiset.card 0 = 0

full_name: Multiset.card_add
code: theorem card_add (s t : Multiset α) : card (s + t) = card s + card t 
goal: Multiset.card (s + t) = Multiset.card s + Multiset.card t

full_name: Multiset.card_nsmul
code: theorem card_nsmul (s : Multiset α) (n : ℕ) : card (n • s) = n * card s 
goal: Multiset.card (n • s) = n * Multiset.card s

full_name: Multiset.card_cons
code: @[simp]
theorem card_cons (a : α) (s : Multiset α) : card (a ::ₘ s) = card s + 1 
goal: Multiset.card (a ::ₘ s) = Multiset.card s + 1

full_name: Multiset.card_singleton
code: @[simp]
theorem card_singleton (a : α) : card ({a} : Multiset α) = 1 
goal: Multiset.card {a} = 1

full_name: Multiset.card_pair
code: theorem card_pair (a b : α) : card {a, b} = 2 
goal: Multiset.card {a, b} = 2

full_name: Multiset.card_eq_one
code: theorem card_eq_one {s : Multiset α} : card s = 1 ↔ ∃ a, s = {a} 
goal: Multiset.card s = 1 ↔ ∃ a, s = {a}

full_name: Multiset.card_le_card
code: theorem card_le_card {s t : Multiset α} (h : s ≤ t) : card s ≤ card t 
goal: Multiset.card s ≤ Multiset.card t

full_name: Multiset.card_mono
code: @[mono]
theorem card_mono : Monotone (@card α) 
goal: Monotone ⇑Multiset.card

full_name: Multiset.eq_of_le_of_card_le
code: theorem eq_of_le_of_card_le {s t : Multiset α} (h : s ≤ t) : card t ≤ card s → s = t 
goal: Multiset.card t ≤ Multiset.card s → s = t

full_name: Multiset.card_lt_card
code: theorem card_lt_card {s t : Multiset α} (h : s < t) : card s < card t 
goal: Multiset.card s < Multiset.card t

full_name: Multiset.card_strictMono
code: lemma card_strictMono : StrictMono (card : Multiset α → ℕ) 
goal: StrictMono ⇑Multiset.card

full_name: Multiset.lt_iff_cons_le
code: theorem lt_iff_cons_le {s t : Multiset α} : s < t ↔ ∃ a, a ::ₘ s ≤ t 
goal: s < t ↔ ∃ a, a ::ₘ s ≤ t

full_name: Multiset.card_eq_zero
code: @[simp]
theorem card_eq_zero {s : Multiset α} : card s = 0 ↔ s = 0 
goal: Multiset.card s = 0 ↔ s = 0

full_name: Multiset.card_pos
code: theorem card_pos {s : Multiset α} : 0 < card s ↔ s ≠ 0 
goal: 0 < Multiset.card s ↔ s ≠ 0

full_name: Multiset.card_pos_iff_exists_mem
code: theorem card_pos_iff_exists_mem {s : Multiset α} : 0 < card s ↔ ∃ a, a ∈ s 
goal: 0 < Multiset.card s ↔ ∃ a, a ∈ s

full_name: Multiset.card_eq_two
code: theorem card_eq_two {s : Multiset α} : card s = 2 ↔ ∃ x y, s = {x, y} 
goal: Multiset.card s = 2 ↔ ∃ x y, s = {x, y}

full_name: Multiset.card_eq_three
code: theorem card_eq_three {s : Multiset α} : card s = 3 ↔ ∃ x y z, s = {x, y, z} 
goal: Multiset.card s = 3 ↔ ∃ x y z, s = {x, y, z}

full_name: Multiset.strongInductionOn
code: /-- The strong induction principle for multisets. -/
@[elab_as_elim]
def strongInductionOn {p : Multiset α → Sort*} (s : Multiset α) (ih : ∀ s, (∀ t < s, p t) → p s) :
    p s 
goal: p s

full_name: Multiset.strongInductionOn_eq
code: theorem strongInductionOn_eq {p : Multiset α → Sort*} (s : Multiset α) (H) :
    @strongInductionOn _ p s H = H s fun t _h => @strongInductionOn _ p t H 
goal: s.strongInductionOn H = H s fun t _h => t.strongInductionOn H

full_name: Multiset.case_strongInductionOn
code: @[elab_as_elim]
theorem case_strongInductionOn {p : Multiset α → Prop} (s : Multiset α) (h₀ : p 0)
    (h₁ : ∀ a s, (∀ t ≤ s, p t) → p (a ::ₘ s)) : p s 
goal: p s

full_name: Multiset.strongDownwardInduction
code: /-- Suppose that, given that `p t` can be defined on all supersets of `s` of cardinality less than
`n`, one knows how to define `p s`. Then one can inductively define `p s` for all multisets `s` of
cardinality less than `n`, starting from multisets of card `n` and iterating. This
can be used either to define data, or to prove properties. -/
def strongDownwardInduction {p : Multiset α → Sort*} {n : ℕ}
    (H : ∀ t₁, (∀ {t₂ : Multiset α}, card t₂ ≤ n → t₁ < t₂ → p t₂) → card t₁ ≤ n → p t₁)
    (s : Multiset α) :
    card s ≤ n → p s 
goal: Multiset.card s ≤ n → p s

full_name: Multiset.strongDownwardInduction_eq
code: theorem strongDownwardInduction_eq {p : Multiset α → Sort*} {n : ℕ}
    (H : ∀ t₁, (∀ {t₂ : Multiset α}, card t₂ ≤ n → t₁ < t₂ → p t₂) → card t₁ ≤ n → p t₁)
    (s : Multiset α) :
    strongDownwardInduction H s = H s fun ht _hst => strongDownwardInduction H _ ht 
goal: Multiset.strongDownwardInduction H s = H s fun {t₂} ht _hst => Multiset.strongDownwardInduction H t₂ ht

full_name: Multiset.strongDownwardInductionOn
code: /-- Analogue of `strongDownwardInduction` with order of arguments swapped. -/
@[elab_as_elim]
def strongDownwardInductionOn {p : Multiset α → Sort*} {n : ℕ} :
    ∀ s : Multiset α,
      (∀ t₁, (∀ {t₂ : Multiset α}, card t₂ ≤ n → t₁ < t₂ → p t₂) → card t₁ ≤ n → p t₁) →
        card s ≤ n → p s 
goal: ((t₁ : Multiset α) → ({t₂ : Multiset α} → Multiset.card t₂ ≤ n → t₁ < t₂ → p t₂) → Multiset.card t₁ ≤ n → p t₁) →
  Multiset.card s ≤ n → p s

full_name: Multiset.strongDownwardInductionOn_eq
code: theorem strongDownwardInductionOn_eq {p : Multiset α → Sort*} (s : Multiset α) {n : ℕ}
    (H : ∀ t₁, (∀ {t₂ : Multiset α}, card t₂ ≤ n → t₁ < t₂ → p t₂) → card t₁ ≤ n → p t₁) :
    s.strongDownwardInductionOn H = H s fun {t} ht _h => t.strongDownwardInductionOn H ht 
goal: (fun a => s.strongDownwardInductionOn H a) = H s fun {t} ht _h => t.strongDownwardInductionOn H ht

full_name: Multiset.instWellFoundedLT
code: /-- Another way of expressing `strongInductionOn`: the `(<)` relation is well-founded. -/
instance instWellFoundedLT : WellFoundedLT (Multiset α) 
goal: WellFoundedLT (Multiset α)

full_name: Multiset.replicate
code: /-- `replicate n a` is the multiset containing only `a` with multiplicity `n`. -/
def replicate (n : ℕ) (a : α) : Multiset α 
goal: Multiset α

full_name: Multiset.coe_replicate
code: theorem coe_replicate (n : ℕ) (a : α) : (List.replicate n a : Multiset α) = replicate n a 
goal: ↑(List.replicate n a) = Multiset.replicate n a

full_name: Multiset.replicate_zero
code: @[simp] theorem replicate_zero (a : α) : replicate 0 a = 0 
goal: Multiset.replicate 0 a = 0

full_name: Multiset.replicate_succ
code: @[simp] theorem replicate_succ (a : α) (n) : replicate (n + 1) a = a ::ₘ replicate n a 
goal: Multiset.replicate (n + 1) a = a ::ₘ Multiset.replicate n a

full_name: Multiset.replicate_add
code: theorem replicate_add (m n : ℕ) (a : α) : replicate (m + n) a = replicate m a + replicate n a 
goal: Multiset.replicate (m + n) a = Multiset.replicate m a + Multiset.replicate n a

full_name: Multiset.replicateAddMonoidHom_apply
code: /-- `Multiset.replicate` as an `AddMonoidHom`. -/
@[simps]
def replicateAddMonoidHom (a : α) : ℕ →+ Multiset α 
goal: (Multiset.replicateAddMonoidHom a) n = Multiset.replicate n a

full_name: Multiset.replicateAddMonoidHom
code: /-- `Multiset.replicate` as an `AddMonoidHom`. -/
@[simps]
def replicateAddMonoidHom (a : α) : ℕ →+ Multiset α 
goal: ℕ →+ Multiset α

full_name: Multiset.replicate_one
code: theorem replicate_one (a : α) : replicate 1 a = {a} 
goal: Multiset.replicate 1 a = {a}

full_name: Multiset.card_replicate
code: @[simp] theorem card_replicate (n) (a : α) : card (replicate n a) = n 
goal: Multiset.card (Multiset.replicate n a) = n

full_name: Multiset.mem_replicate
code: theorem mem_replicate {a b : α} {n : ℕ} : b ∈ replicate n a ↔ n ≠ 0 ∧ b = a 
goal: b ∈ Multiset.replicate n a ↔ n ≠ 0 ∧ b = a

full_name: Multiset.eq_of_mem_replicate
code: theorem eq_of_mem_replicate {a b : α} {n} : b ∈ replicate n a → b = a 
goal: b ∈ Multiset.replicate n a → b = a

full_name: Multiset.eq_replicate_card
code: theorem eq_replicate_card {a : α} {s : Multiset α} : s = replicate (card s) a ↔ ∀ b ∈ s, b = a 
goal: s = Multiset.replicate (Multiset.card s) a ↔ ∀ b ∈ s, b = a

full_name: Multiset.eq_replicate
code: theorem eq_replicate {a : α} {n} {s : Multiset α} :
    s = replicate n a ↔ card s = n ∧ ∀ b ∈ s, b = a 
goal: s = Multiset.replicate n a ↔ Multiset.card s = n ∧ ∀ b ∈ s, b = a

full_name: Multiset.replicate_right_injective
code: theorem replicate_right_injective {n : ℕ} (hn : n ≠ 0) : Injective (@replicate α n) 
goal: Function.Injective (Multiset.replicate n)

full_name: Multiset.replicate_right_inj
code: @[simp] theorem replicate_right_inj {a b : α} {n : ℕ} (h : n ≠ 0) :
    replicate n a = replicate n b ↔ a = b 
goal: Multiset.replicate n a = Multiset.replicate n b ↔ a = b

full_name: Multiset.replicate_left_injective
code: theorem replicate_left_injective (a : α) : Injective (replicate · a) 
goal: Function.Injective fun x => Multiset.replicate x a

full_name: Multiset.replicate_subset_singleton
code: theorem replicate_subset_singleton (n : ℕ) (a : α) : replicate n a ⊆ {a} 
goal: Multiset.replicate n a ⊆ {a}

full_name: Multiset.replicate_le_coe
code: theorem replicate_le_coe {a : α} {n} {l : List α} : replicate n a ≤ l ↔ List.replicate n a <+ l 
goal: Multiset.replicate n a ≤ ↑l ↔ List.replicate n a <+ l

full_name: Multiset.nsmul_replicate
code: theorem nsmul_replicate {a : α} (n m : ℕ) : n • replicate m a = replicate (n * m) a 
goal: n • Multiset.replicate m a = Multiset.replicate (n * m) a

full_name: Multiset.nsmul_singleton
code: theorem nsmul_singleton (a : α) (n) : n • ({a} : Multiset α) = replicate n a 
goal: n • {a} = Multiset.replicate n a

full_name: Multiset.replicate_le_replicate
code: theorem replicate_le_replicate (a : α) {k n : ℕ} : replicate k a ≤ replicate n a ↔ k ≤ n 
goal: Multiset.replicate k a ≤ Multiset.replicate n a ↔ k ≤ n

full_name: Multiset.le_replicate_iff
code: theorem le_replicate_iff {m : Multiset α} {a : α} {n : ℕ} :
    m ≤ replicate n a ↔ ∃ k ≤ n, m = replicate k a 
goal: m ≤ Multiset.replicate n a ↔ ∃ k ≤ n, m = Multiset.replicate k a

full_name: Multiset.lt_replicate_succ
code: theorem lt_replicate_succ {m : Multiset α} {x : α} {n : ℕ} :
    m < replicate (n + 1) x ↔ m ≤ replicate n x 
goal: m < Multiset.replicate (n + 1) x ↔ m ≤ Multiset.replicate n x

full_name: Multiset.erase
code: /-- `erase s a` is the multiset that subtracts 1 from the multiplicity of `a`. -/
def erase (s : Multiset α) (a : α) : Multiset α 
goal: Multiset α

full_name: Multiset.coe_erase
code: @[simp]
theorem coe_erase (l : List α) (a : α) : erase (l : Multiset α) a = l.erase a 
goal: (↑l).erase a = ↑(l.erase a)

full_name: Multiset.erase_zero
code: @[simp]
theorem erase_zero (a : α) : (0 : Multiset α).erase a = 0 
goal: Multiset.erase 0 a = 0

full_name: Multiset.erase_cons_head
code: @[simp]
theorem erase_cons_head (a : α) (s : Multiset α) : (a ::ₘ s).erase a = s 
goal: (a ::ₘ s).erase a = s

full_name: Multiset.erase_cons_tail
code: @[simp]
theorem erase_cons_tail {a b : α} (s : Multiset α) (h : b ≠ a) :
    (b ::ₘ s).erase a = b ::ₘ s.erase a 
goal: (b ::ₘ s).erase a = b ::ₘ s.erase a

full_name: Multiset.erase_singleton
code: @[simp]
theorem erase_singleton (a : α) : ({a} : Multiset α).erase a = 0 
goal: {a}.erase a = 0

full_name: Multiset.erase_of_not_mem
code: @[simp]
theorem erase_of_not_mem {a : α} {s : Multiset α} : a ∉ s → s.erase a = s 
goal: a ∉ s → s.erase a = s

full_name: Multiset.cons_erase
code: @[simp]
theorem cons_erase {s : Multiset α} {a : α} : a ∈ s → a ::ₘ s.erase a = s 
goal: a ∈ s → a ::ₘ s.erase a = s

full_name: Multiset.erase_cons_tail_of_mem
code: theorem erase_cons_tail_of_mem (h : a ∈ s) :
    (b ::ₘ s).erase a = b ::ₘ s.erase a 
goal: (b ::ₘ s).erase a = b ::ₘ s.erase a

full_name: Multiset.le_cons_erase
code: theorem le_cons_erase (s : Multiset α) (a : α) : s ≤ a ::ₘ s.erase a 
goal: s ≤ a ::ₘ s.erase a

full_name: Multiset.add_singleton_eq_iff
code: theorem add_singleton_eq_iff {s t : Multiset α} {a : α} : s + {a} = t ↔ a ∈ t ∧ s = t.erase a 
goal: s + {a} = t ↔ a ∈ t ∧ s = t.erase a

full_name: Multiset.erase_add_left_pos
code: theorem erase_add_left_pos {a : α} {s : Multiset α} (t) : a ∈ s → (s + t).erase a = s.erase a + t 
goal: a ∈ s → (s + t).erase a = s.erase a + t

full_name: Multiset.erase_add_right_pos
code: theorem erase_add_right_pos {a : α} (s) {t : Multiset α} (h : a ∈ t) :
    (s + t).erase a = s + t.erase a 
goal: (s + t).erase a = s + t.erase a

full_name: Multiset.erase_add_right_neg
code: theorem erase_add_right_neg {a : α} {s : Multiset α} (t) :
    a ∉ s → (s + t).erase a = s + t.erase a 
goal: a ∉ s → (s + t).erase a = s + t.erase a

full_name: Multiset.erase_add_left_neg
code: theorem erase_add_left_neg {a : α} (s) {t : Multiset α} (h : a ∉ t) :
    (s + t).erase a = s.erase a + t 
goal: (s + t).erase a = s.erase a + t

full_name: Multiset.erase_le
code: theorem erase_le (a : α) (s : Multiset α) : s.erase a ≤ s 
goal: s.erase a ≤ s

full_name: Multiset.erase_lt
code: @[simp]
theorem erase_lt {a : α} {s : Multiset α} : s.erase a < s ↔ a ∈ s 
goal: s.erase a < s ↔ a ∈ s

full_name: Multiset.erase_subset
code: theorem erase_subset (a : α) (s : Multiset α) : s.erase a ⊆ s 
goal: s.erase a ⊆ s

full_name: Multiset.mem_erase_of_ne
code: theorem mem_erase_of_ne {a b : α} {s : Multiset α} (ab : a ≠ b) : a ∈ s.erase b ↔ a ∈ s 
goal: a ∈ s.erase b ↔ a ∈ s

full_name: Multiset.mem_of_mem_erase
code: theorem mem_of_mem_erase {a b : α} {s : Multiset α} : a ∈ s.erase b → a ∈ s 
goal: a ∈ s.erase b → a ∈ s

full_name: Multiset.erase_comm
code: theorem erase_comm (s : Multiset α) (a b : α) : (s.erase a).erase b = (s.erase b).erase a 
goal: (s.erase a).erase b = (s.erase b).erase a

full_name: Multiset.erase_le_erase
code: theorem erase_le_erase {s t : Multiset α} (a : α) (h : s ≤ t) : s.erase a ≤ t.erase a 
goal: s.erase a ≤ t.erase a

full_name: Multiset.erase_le_iff_le_cons
code: theorem erase_le_iff_le_cons {s t : Multiset α} {a : α} : s.erase a ≤ t ↔ s ≤ a ::ₘ t 
goal: s.erase a ≤ t ↔ s ≤ a ::ₘ t

full_name: Multiset.card_erase_of_mem
code: @[simp]
theorem card_erase_of_mem {a : α} {s : Multiset α} : a ∈ s → card (s.erase a) = pred (card s) 
goal: a ∈ s → Multiset.card (s.erase a) = (Multiset.card s).pred

full_name: Multiset.card_erase_add_one
code: @[simp]
theorem card_erase_add_one {a : α} {s : Multiset α} : a ∈ s → card (s.erase a) + 1 = card s 
goal: a ∈ s → Multiset.card (s.erase a) + 1 = Multiset.card s

full_name: Multiset.card_erase_lt_of_mem
code: theorem card_erase_lt_of_mem {a : α} {s : Multiset α} : a ∈ s → card (s.erase a) < card s 
goal: a ∈ s → Multiset.card (s.erase a) < Multiset.card s

full_name: Multiset.card_erase_le
code: theorem card_erase_le {a : α} {s : Multiset α} : card (s.erase a) ≤ card s 
goal: Multiset.card (s.erase a) ≤ Multiset.card s

full_name: Multiset.card_erase_eq_ite
code: theorem card_erase_eq_ite {a : α} {s : Multiset α} :
    card (s.erase a) = if a ∈ s then pred (card s) else card s 
goal: Multiset.card (s.erase a) = if a ∈ s then (Multiset.card s).pred else Multiset.card s

full_name: Multiset.coe_reverse
code: @[simp]
theorem coe_reverse (l : List α) : (reverse l : Multiset α) = l 
goal: ↑l.reverse = ↑l

full_name: Multiset.map
code: /-- `map f s` is the lift of the list `map` operation. The multiplicity
  of `b` in `map f s` is the number of `a ∈ s` (counting multiplicity)
  such that `f a = b`. -/
def map (f : α → β) (s : Multiset α) : Multiset β 
goal: Multiset β

full_name: Multiset.map_congr
code: @[congr]
theorem map_congr {f g : α → β} {s t : Multiset α} :
    s = t → (∀ x ∈ t, f x = g x) → map f s = map g t 
goal: s = t → (∀ x ∈ t, f x = g x) → Multiset.map f s = Multiset.map g t

full_name: Multiset.map_hcongr
code: theorem map_hcongr {β' : Type v} {m : Multiset α} {f : α → β} {f' : α → β'} (h : β = β')
    (hf : ∀ a ∈ m, HEq (f a) (f' a)) : HEq (map f m) (map f' m) 
goal: HEq (Multiset.map f m) (Multiset.map f' m)

full_name: Multiset.forall_mem_map_iff
code: theorem forall_mem_map_iff {f : α → β} {p : β → Prop} {s : Multiset α} :
    (∀ y ∈ s.map f, p y) ↔ ∀ x ∈ s, p (f x) 
goal: (∀ y ∈ Multiset.map f s, p y) ↔ ∀ x ∈ s, p (f x)

full_name: Multiset.map_coe
code: @[simp, norm_cast] lemma map_coe (f : α → β) (l : List α) : map f l = l.map f 
goal: Multiset.map f ↑l = ↑(List.map f l)

full_name: Multiset.map_zero
code: @[simp]
theorem map_zero (f : α → β) : map f 0 = 0 
goal: Multiset.map f 0 = 0

full_name: Multiset.map_cons
code: @[simp]
theorem map_cons (f : α → β) (a s) : map f (a ::ₘ s) = f a ::ₘ map f s 
goal: Multiset.map f (a ::ₘ s) = f a ::ₘ Multiset.map f s

full_name: Multiset.map_comp_cons
code: theorem map_comp_cons (f : α → β) (t) : map f ∘ cons t = cons (f t) ∘ map f 
goal: Multiset.map f ∘ Multiset.cons t = Multiset.cons (f t) ∘ Multiset.map f

full_name: Multiset.map_singleton
code: @[simp]
theorem map_singleton (f : α → β) (a : α) : ({a} : Multiset α).map f = {f a} 
goal: Multiset.map f {a} = {f a}

full_name: Multiset.map_replicate
code: @[simp]
theorem map_replicate (f : α → β) (k : ℕ) (a : α) : (replicate k a).map f = replicate k (f a) 
goal: Multiset.map f (Multiset.replicate k a) = Multiset.replicate k (f a)

full_name: Multiset.map_add
code: @[simp]
theorem map_add (f : α → β) (s t) : map f (s + t) = map f s + map f t 
goal: Multiset.map f (s + t) = Multiset.map f s + Multiset.map f t

full_name: Multiset.canLift
code: /-- If each element of `s : Multiset α` can be lifted to `β`, then `s` can be lifted to
`Multiset β`. -/
instance canLift (c) (p) [CanLift α β c p] :
    CanLift (Multiset α) (Multiset β) (map c) fun s => ∀ x ∈ s, p x 
goal: CanLift (Multiset α) (Multiset β) (Multiset.map c) fun s => ∀ x ∈ s, p x

full_name: Multiset.mapAddMonoidHom
code: /-- `Multiset.map` as an `AddMonoidHom`. -/
def mapAddMonoidHom (f : α → β) : Multiset α →+ Multiset β 
goal: Multiset α →+ Multiset β

full_name: Multiset.coe_mapAddMonoidHom
code: @[simp]
theorem coe_mapAddMonoidHom (f : α → β) :
    (mapAddMonoidHom f : Multiset α → Multiset β) = map f 
goal: ⇑(Multiset.mapAddMonoidHom f) = Multiset.map f

full_name: Multiset.map_nsmul
code: theorem map_nsmul (f : α → β) (n : ℕ) (s) : map f (n • s) = n • map f s 
goal: Multiset.map f (n • s) = n • Multiset.map f s

full_name: Multiset.mem_map
code: @[simp]
theorem mem_map {f : α → β} {b : β} {s : Multiset α} : b ∈ map f s ↔ ∃ a, a ∈ s ∧ f a = b 
goal: b ∈ Multiset.map f s ↔ ∃ a ∈ s, f a = b

full_name: Multiset.card_map
code: @[simp]
theorem card_map (f : α → β) (s) : card (map f s) = card s 
goal: Multiset.card (Multiset.map f s) = Multiset.card s

full_name: Multiset.map_eq_zero
code: @[simp]
theorem map_eq_zero {s : Multiset α} {f : α → β} : s.map f = 0 ↔ s = 0 
goal: Multiset.map f s = 0 ↔ s = 0

full_name: Multiset.mem_map_of_mem
code: theorem mem_map_of_mem (f : α → β) {a : α} {s : Multiset α} (h : a ∈ s) : f a ∈ map f s 
goal: f a ∈ Multiset.map f s

full_name: Multiset.map_eq_singleton
code: theorem map_eq_singleton {f : α → β} {s : Multiset α} {b : β} :
    map f s = {b} ↔ ∃ a : α, s = {a} ∧ f a = b 
goal: Multiset.map f s = {b} ↔ ∃ a, s = {a} ∧ f a = b

full_name: Multiset.map_eq_cons
code: theorem map_eq_cons [DecidableEq α] (f : α → β) (s : Multiset α) (t : Multiset β) (b : β) :
    (∃ a ∈ s, f a = b ∧ (s.erase a).map f = t) ↔ s.map f = b ::ₘ t 
goal: (∃ a ∈ s, f a = b ∧ Multiset.map f (s.erase a) = t) ↔ Multiset.map f s = b ::ₘ t

full_name: Multiset.mem_map_of_injective
code: @[simp 1100, nolint simpNF]
theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {s : Multiset α} :
    f a ∈ map f s ↔ a ∈ s 
goal: f a ∈ Multiset.map f s ↔ a ∈ s

full_name: Multiset.map_map
code: @[simp]
theorem map_map (g : β → γ) (f : α → β) (s : Multiset α) : map g (map f s) = map (g ∘ f) s 
goal: Multiset.map g (Multiset.map f s) = Multiset.map (g ∘ f) s

full_name: Multiset.map_id
code: theorem map_id (s : Multiset α) : map id s = s 
goal: Multiset.map id s = s

full_name: Multiset.map_id'
code: @[simp]
theorem map_id' (s : Multiset α) : map (fun x => x) s = s 
goal: Multiset.map (fun x => x) s = s

full_name: Multiset.map_const
code: theorem map_const (s : Multiset α) (b : β) : map (const α b) s = replicate (card s) b 
goal: Multiset.map (Function.const α b) s = Multiset.replicate (Multiset.card s) b

full_name: Multiset.map_const'
code: @[simp] theorem map_const' (s : Multiset α) (b : β) : map (fun _ ↦ b) s = replicate (card s) b 
goal: Multiset.map (fun x => b) s = Multiset.replicate (Multiset.card s) b

full_name: Multiset.eq_of_mem_map_const
code: theorem eq_of_mem_map_const {b₁ b₂ : β} {l : List α} (h : b₁ ∈ map (Function.const α b₂) l) :
    b₁ = b₂ 
goal: b₁ = b₂

full_name: Multiset.map_le_map
code: @[simp]
theorem map_le_map {f : α → β} {s t : Multiset α} (h : s ≤ t) : map f s ≤ map f t 
goal: Multiset.map f s ≤ Multiset.map f t

full_name: Multiset.map_lt_map
code: @[simp]
theorem map_lt_map {f : α → β} {s t : Multiset α} (h : s < t) : s.map f < t.map f 
goal: Multiset.map f s < Multiset.map f t

full_name: Multiset.map_mono
code: theorem map_mono (f : α → β) : Monotone (map f) 
goal: Monotone (Multiset.map f)

full_name: Multiset.map_strictMono
code: theorem map_strictMono (f : α → β) : StrictMono (map f) 
goal: StrictMono (Multiset.map f)

full_name: Multiset.map_subset_map
code: @[simp]
theorem map_subset_map {f : α → β} {s t : Multiset α} (H : s ⊆ t) : map f s ⊆ map f t 
goal: Multiset.map f s ⊆ Multiset.map f t

full_name: Multiset.map_erase
code: theorem map_erase [DecidableEq α] [DecidableEq β] (f : α → β) (hf : Function.Injective f) (x : α)
    (s : Multiset α) : (s.erase x).map f = (s.map f).erase (f x) 
goal: Multiset.map f (s.erase x) = (Multiset.map f s).erase (f x)

full_name: Multiset.map_erase_of_mem
code: theorem map_erase_of_mem [DecidableEq α] [DecidableEq β] (f : α → β)
    (s : Multiset α) {x : α} (h : x ∈ s) : (s.erase x).map f = (s.map f).erase (f x) 
goal: Multiset.map f (s.erase x) = (Multiset.map f s).erase (f x)

full_name: Multiset.map_surjective_of_surjective
code: theorem map_surjective_of_surjective {f : α → β} (hf : Function.Surjective f) :
    Function.Surjective (map f) 
goal: Function.Surjective (Multiset.map f)

full_name: Multiset.foldl
code: /-- `foldl f H b s` is the lift of the list operation `foldl f b l`,
  which folds `f` over the multiset. It is well defined when `f` is right-commutative,
  that is, `f (f b a₁) a₂ = f (f b a₂) a₁`. -/
def foldl (f : β → α → β) (H : RightCommutative f) (b : β) (s : Multiset α) : β 
goal: β

full_name: Multiset.foldl_zero
code: @[simp]
theorem foldl_zero (f : β → α → β) (H b) : foldl f H b 0 = b 
goal: Multiset.foldl f H b 0 = b

full_name: Multiset.foldl_cons
code: @[simp]
theorem foldl_cons (f : β → α → β) (H b a s) : foldl f H b (a ::ₘ s) = foldl f H (f b a) s 
goal: Multiset.foldl f H b (a ::ₘ s) = Multiset.foldl f H (f b a) s

full_name: Multiset.foldl_add
code: @[simp]
theorem foldl_add (f : β → α → β) (H b s t) : foldl f H b (s + t) = foldl f H (foldl f H b s) t 
goal: Multiset.foldl f H b (s + t) = Multiset.foldl f H (Multiset.foldl f H b s) t

full_name: Multiset.foldr
code: /-- `foldr f H b s` is the lift of the list operation `foldr f b l`,
  which folds `f` over the multiset. It is well defined when `f` is left-commutative,
  that is, `f a₁ (f a₂ b) = f a₂ (f a₁ b)`. -/
def foldr (f : α → β → β) (H : LeftCommutative f) (b : β) (s : Multiset α) : β 
goal: β

full_name: Multiset.foldr_zero
code: @[simp]
theorem foldr_zero (f : α → β → β) (H b) : foldr f H b 0 = b 
goal: Multiset.foldr f H b 0 = b

full_name: Multiset.foldr_cons
code: @[simp]
theorem foldr_cons (f : α → β → β) (H b a s) : foldr f H b (a ::ₘ s) = f a (foldr f H b s) 
goal: Multiset.foldr f H b (a ::ₘ s) = f a (Multiset.foldr f H b s)

full_name: Multiset.foldr_singleton
code: @[simp]
theorem foldr_singleton (f : α → β → β) (H b a) : foldr f H b ({a} : Multiset α) = f a b 
goal: Multiset.foldr f H b {a} = f a b

full_name: Multiset.foldr_add
code: @[simp]
theorem foldr_add (f : α → β → β) (H b s t) : foldr f H b (s + t) = foldr f H (foldr f H b t) s 
goal: Multiset.foldr f H b (s + t) = Multiset.foldr f H (Multiset.foldr f H b t) s

full_name: Multiset.coe_foldr
code: @[simp]
theorem coe_foldr (f : α → β → β) (H : LeftCommutative f) (b : β) (l : List α) :
    foldr f H b l = l.foldr f b 
goal: Multiset.foldr f H b ↑l = List.foldr f b l

full_name: Multiset.coe_foldl
code: @[simp]
theorem coe_foldl (f : β → α → β) (H : RightCommutative f) (b : β) (l : List α) :
    foldl f H b l = l.foldl f b 
goal: Multiset.foldl f H b ↑l = List.foldl f b l

full_name: Multiset.coe_foldr_swap
code: theorem coe_foldr_swap (f : α → β → β) (H : LeftCommutative f) (b : β) (l : List α) :
    foldr f H b l = l.foldl (fun x y => f y x) b 
goal: Multiset.foldr f H b ↑l = List.foldl (fun x y => f y x) b l

full_name: Multiset.foldr_swap
code: theorem foldr_swap (f : α → β → β) (H : LeftCommutative f) (b : β) (s : Multiset α) :
    foldr f H b s = foldl (fun x y => f y x) (fun _x _y _z => (H _ _ _).symm) b s 
goal: Multiset.foldr f H b s = Multiset.foldl (fun x y => f y x) ⋯ b s

full_name: Multiset.foldl_swap
code: theorem foldl_swap (f : β → α → β) (H : RightCommutative f) (b : β) (s : Multiset α) :
    foldl f H b s = foldr (fun x y => f y x) (fun _x _y _z => (H _ _ _).symm) b s 
goal: Multiset.foldl f H b s = Multiset.foldr (fun x y => f y x) ⋯ b s

full_name: Multiset.foldr_induction'
code: theorem foldr_induction' (f : α → β → β) (H : LeftCommutative f) (x : β) (q : α → Prop)
    (p : β → Prop) (s : Multiset α) (hpqf : ∀ a b, q a → p b → p (f a b)) (px : p x)
    (q_s : ∀ a ∈ s, q a) : p (foldr f H x s) 
goal: p (Multiset.foldr f H x s)

full_name: Multiset.foldr_induction
code: theorem foldr_induction (f : α → α → α) (H : LeftCommutative f) (x : α) (p : α → Prop)
    (s : Multiset α) (p_f : ∀ a b, p a → p b → p (f a b)) (px : p x) (p_s : ∀ a ∈ s, p a) :
    p (foldr f H x s) 
goal: p (Multiset.foldr f H x s)

full_name: Multiset.foldl_induction'
code: theorem foldl_induction' (f : β → α → β) (H : RightCommutative f) (x : β) (q : α → Prop)
    (p : β → Prop) (s : Multiset α) (hpqf : ∀ a b, q a → p b → p (f b a)) (px : p x)
    (q_s : ∀ a ∈ s, q a) : p (foldl f H x s) 
goal: p (Multiset.foldl f H x s)

full_name: Multiset.foldl_induction
code: theorem foldl_induction (f : α → α → α) (H : RightCommutative f) (x : α) (p : α → Prop)
    (s : Multiset α) (p_f : ∀ a b, p a → p b → p (f b a)) (px : p x) (p_s : ∀ a ∈ s, p a) :
    p (foldl f H x s) 
goal: p (Multiset.foldl f H x s)

full_name: Multiset.pmap
code: /-- Lift of the list `pmap` operation. Map a partial function `f` over a multiset
  `s` whose elements are all in the domain of `f`. -/
nonrec def pmap {p : α → Prop} (f : ∀ a, p a → β) (s : Multiset α) : (∀ a ∈ s, p a) → Multiset β 
goal: (∀ a ∈ s, p a) → Multiset β

full_name: Multiset.coe_pmap
code: @[simp]
theorem coe_pmap {p : α → Prop} (f : ∀ a, p a → β) (l : List α) (H : ∀ a ∈ l, p a) :
    pmap f l H = l.pmap f H 
goal: Multiset.pmap f (↑l) H = ↑(List.pmap f l H)

full_name: Multiset.pmap_zero
code: @[simp]
theorem pmap_zero {p : α → Prop} (f : ∀ a, p a → β) (h : ∀ a ∈ (0 : Multiset α), p a) :
    pmap f 0 h = 0 
goal: Multiset.pmap f 0 h = 0

full_name: Multiset.pmap_cons
code: @[simp]
theorem pmap_cons {p : α → Prop} (f : ∀ a, p a → β) (a : α) (m : Multiset α) :
    ∀ h : ∀ b ∈ a ::ₘ m, p b,
      pmap f (a ::ₘ m) h =
        f a (h a (mem_cons_self a m)) ::ₘ pmap f m fun a ha => h a <| mem_cons_of_mem ha 
goal: Multiset.pmap f (a ::ₘ m) h = f a ⋯ ::ₘ Multiset.pmap f m ⋯

full_name: Multiset.attach
code: /-- "Attach" a proof that `a ∈ s` to each element `a` in `s` to produce
  a multiset on `{x // x ∈ s}`. -/
def attach (s : Multiset α) : Multiset { x // x ∈ s } 
goal: Multiset { x // x ∈ s }

full_name: Multiset.coe_attach
code: @[simp]
theorem coe_attach (l : List α) : @Eq (Multiset { x // x ∈ l }) (@attach α l) l.attach 
goal: (↑l).attach = ↑l.attach

full_name: Multiset.sizeOf_lt_sizeOf_of_mem
code: theorem sizeOf_lt_sizeOf_of_mem [SizeOf α] {x : α} {s : Multiset α} (hx : x ∈ s) :
    SizeOf.sizeOf x < SizeOf.sizeOf s 
goal: sizeOf x < sizeOf s

full_name: Multiset.pmap_eq_map
code: theorem pmap_eq_map (p : α → Prop) (f : α → β) (s : Multiset α) :
    ∀ H, @pmap _ _ p (fun a _ => f a) s H = map f s 
goal: Multiset.pmap (fun a x => f a) s H = Multiset.map f s

full_name: Multiset.pmap_congr
code: theorem pmap_congr {p q : α → Prop} {f : ∀ a, p a → β} {g : ∀ a, q a → β} (s : Multiset α) :
    ∀ {H₁ H₂}, (∀ a ∈ s, ∀ (h₁ h₂), f a h₁ = g a h₂) → pmap f s H₁ = pmap g s H₂ 
goal: (∀ a ∈ s, ∀ (h₁ : p a) (h₂ : q a), f a h₁ = g a h₂) → Multiset.pmap f s H₁ = Multiset.pmap g s H₂

full_name: Multiset.map_pmap
code: theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (s) :
    ∀ H, map g (pmap f s H) = pmap (fun a h => g (f a h)) s H 
goal: Multiset.map g (Multiset.pmap f s H) = Multiset.pmap (fun a h => g (f a h)) s H

full_name: Multiset.pmap_eq_map_attach
code: theorem pmap_eq_map_attach {p : α → Prop} (f : ∀ a, p a → β) (s) :
    ∀ H, pmap f s H = s.attach.map fun x => f x.1 (H _ x.2) 
goal: Multiset.pmap f s H = Multiset.map (fun x => f ↑x ⋯) s.attach

full_name: Multiset.attach_map_val'
code: theorem attach_map_val' (s : Multiset α) (f : α → β) : (s.attach.map fun i => f i.val) = s.map f 
goal: Multiset.map (fun i => f ↑i) s.attach = Multiset.map f s

full_name: Multiset.attach_map_val
code: @[simp]
theorem attach_map_val (s : Multiset α) : s.attach.map Subtype.val = s 
goal: Multiset.map Subtype.val s.attach = s

full_name: Multiset.mem_attach
code: @[simp]
theorem mem_attach (s : Multiset α) : ∀ x, x ∈ s.attach 
goal: x ∈ s.attach

full_name: Multiset.mem_pmap
code: @[simp]
theorem mem_pmap {p : α → Prop} {f : ∀ a, p a → β} {s H b} :
    b ∈ pmap f s H ↔ ∃ (a : _) (h : a ∈ s), f a (H a h) = b 
goal: b ∈ Multiset.pmap f s H ↔ ∃ a, ∃ (h : a ∈ s), f a ⋯ = b

full_name: Multiset.card_pmap
code: @[simp]
theorem card_pmap {p : α → Prop} (f : ∀ a, p a → β) (s H) : card (pmap f s H) = card s 
goal: Multiset.card (Multiset.pmap f s H) = Multiset.card s

full_name: Multiset.card_attach
code: @[simp]
theorem card_attach {m : Multiset α} : card (attach m) = card m 
goal: Multiset.card m.attach = Multiset.card m

full_name: Multiset.attach_zero
code: @[simp]
theorem attach_zero : (0 : Multiset α).attach = 0 
goal: Multiset.attach 0 = 0

full_name: Multiset.attach_cons
code: theorem attach_cons (a : α) (m : Multiset α) :
    (a ::ₘ m).attach =
      ⟨a, mem_cons_self a m⟩ ::ₘ m.attach.map fun p => ⟨p.1, mem_cons_of_mem p.2⟩ 
goal: (a ::ₘ m).attach = ⟨a, ⋯⟩ ::ₘ Multiset.map (fun p => ⟨↑p, ⋯⟩) m.attach

full_name: Multiset.decidableForallMultiset
code: /-- If `p` is a decidable predicate,
so is the predicate that all elements of a multiset satisfy `p`. -/
protected def decidableForallMultiset {p : α → Prop} [hp : ∀ a, Decidable (p a)] :
    Decidable (∀ a ∈ m, p a) 
goal: Decidable (∀ a ∈ m, p a)

full_name: Multiset.decidableDforallMultiset
code: instance decidableDforallMultiset {p : ∀ a ∈ m, Prop} [_hp : ∀ (a) (h : a ∈ m), Decidable (p a h)] :
    Decidable (∀ (a) (h : a ∈ m), p a h) 
goal: Decidable (∀ (a : α) (h : a ∈ m), p a h)

full_name: Multiset.decidableEqPiMultiset
code: /-- decidable equality for functions whose domain is bounded by multisets -/
instance decidableEqPiMultiset {β : α → Type*} [h : ∀ a, DecidableEq (β a)] :
    DecidableEq (∀ a ∈ m, β a) 
goal: DecidableEq ((a : α) → a ∈ m → β a)

full_name: Multiset.decidableExistsMultiset
code: /-- If `p` is a decidable predicate,
so is the existence of an element in a multiset satisfying `p`. -/
protected def decidableExistsMultiset {p : α → Prop} [DecidablePred p] : Decidable (∃ x ∈ m, p x) 
goal: Decidable (∃ x ∈ m, p x)

full_name: Multiset.decidableDexistsMultiset
code: instance decidableDexistsMultiset {p : ∀ a ∈ m, Prop} [_hp : ∀ (a) (h : a ∈ m), Decidable (p a h)] :
    Decidable (∃ (a : _) (h : a ∈ m), p a h) 
goal: Decidable (∃ a, ∃ (h : a ∈ m), p a h)

full_name: Multiset.sub
code: /-- `s - t` is the multiset such that `count a (s - t) = count a s - count a t` for all `a`
  (note that it is truncated subtraction, so it is `0` if `count a t ≥ count a s`). -/
protected def sub (s t : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset.instSub
code: instance : Sub (Multiset α) 
goal: Sub (Multiset α)

full_name: Multiset.coe_sub
code: @[simp]
theorem coe_sub (s t : List α) : (s - t : Multiset α) = (s.diff t : List α) 
goal: ↑s - ↑t = ↑(s.diff t)

full_name: Multiset.sub_zero
code: /-- This is a special case of `tsub_zero`, which should be used instead of this.
  This is needed to prove `OrderedSub (Multiset α)`. -/
protected theorem sub_zero (s : Multiset α) : s - 0 = s 
goal: s - 0 = s

full_name: Multiset.sub_cons
code: @[simp]
theorem sub_cons (a : α) (s t : Multiset α) : s - a ::ₘ t = s.erase a - t 
goal: s - a ::ₘ t = s.erase a - t

full_name: Multiset.sub_le_iff_le_add
code: /-- This is a special case of `tsub_le_iff_right`, which should be used instead of this.
  This is needed to prove `OrderedSub (Multiset α)`. -/
protected theorem sub_le_iff_le_add : s - t ≤ u ↔ s ≤ u + t 
goal: s - t ≤ u ↔ s ≤ u + t

full_name: Multiset.instOrderedSub
code: instance : OrderedSub (Multiset α) 
goal: OrderedSub (Multiset α)

full_name: Multiset.cons_sub_of_le
code: theorem cons_sub_of_le (a : α) {s t : Multiset α} (h : t ≤ s) : a ::ₘ s - t = a ::ₘ (s - t) 
goal: a ::ₘ s - t = a ::ₘ (s - t)

full_name: Multiset.sub_eq_fold_erase
code: theorem sub_eq_fold_erase (s t : Multiset α) : s - t = foldl erase erase_comm s t 
goal: s - t = Multiset.foldl Multiset.erase ⋯ s t

full_name: Multiset.card_sub
code: @[simp]
theorem card_sub {s t : Multiset α} (h : t ≤ s) : card (s - t) = card s - card t 
goal: Multiset.card (s - t) = Multiset.card s - Multiset.card t

full_name: Multiset.union
code: /-- `s ∪ t` is the lattice join operation with respect to the
  multiset `≤`. The multiplicity of `a` in `s ∪ t` is the maximum
  of the multiplicities in `s` and `t`. -/
def union (s t : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset.instUnion
code: instance : Union (Multiset α) 
goal: Union (Multiset α)

full_name: Multiset.union_def
code: theorem union_def (s t : Multiset α) : s ∪ t = s - t + t 
goal: s ∪ t = s - t + t

full_name: Multiset.le_union_left
code: theorem le_union_left (s t : Multiset α) : s ≤ s ∪ t 
goal: s ≤ s ∪ t

full_name: Multiset.le_union_right
code: theorem le_union_right (s t : Multiset α) : t ≤ s ∪ t 
goal: t ≤ s ∪ t

full_name: Multiset.eq_union_left
code: theorem eq_union_left : t ≤ s → s ∪ t = s 
goal: t ≤ s → s ∪ t = s

full_name: Multiset.union_le_union_right
code: theorem union_le_union_right (h : s ≤ t) (u) : s ∪ u ≤ t ∪ u 
goal: s ∪ u ≤ t ∪ u

full_name: Multiset.union_le
code: theorem union_le (h₁ : s ≤ u) (h₂ : t ≤ u) : s ∪ t ≤ u 
goal: s ∪ t ≤ u

full_name: Multiset.mem_union
code: @[simp]
theorem mem_union : a ∈ s ∪ t ↔ a ∈ s ∨ a ∈ t 
goal: a ∈ s ∪ t ↔ a ∈ s ∨ a ∈ t

full_name: Multiset.map_union
code: @[simp]
theorem map_union [DecidableEq β] {f : α → β} (finj : Function.Injective f) {s t : Multiset α} :
    map f (s ∪ t) = map f s ∪ map f t 
goal: Multiset.map f (s ∪ t) = Multiset.map f s ∪ Multiset.map f t

full_name: Multiset.zero_union
code: @[simp] theorem zero_union : 0 ∪ s = s 
goal: 0 ∪ s = s

full_name: Multiset.union_zero
code: @[simp] theorem union_zero : s ∪ 0 = s 
goal: s ∪ 0 = s

full_name: Multiset.inter
code: /-- `s ∩ t` is the lattice meet operation with respect to the
  multiset `≤`. The multiplicity of `a` in `s ∩ t` is the minimum
  of the multiplicities in `s` and `t`. -/
def inter (s t : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset.instInter
code: instance : Inter (Multiset α) 
goal: Inter (Multiset α)

full_name: Multiset.inter_zero
code: @[simp]
theorem inter_zero (s : Multiset α) : s ∩ 0 = 0 
goal: s ∩ 0 = 0

full_name: Multiset.zero_inter
code: @[simp]
theorem zero_inter (s : Multiset α) : 0 ∩ s = 0 
goal: 0 ∩ s = 0

full_name: Multiset.cons_inter_of_pos
code: @[simp]
theorem cons_inter_of_pos {a} (s : Multiset α) {t} : a ∈ t → (a ::ₘ s) ∩ t = a ::ₘ s ∩ t.erase a 
goal: a ∈ t → (a ::ₘ s) ∩ t = a ::ₘ s ∩ t.erase a

full_name: Multiset.cons_inter_of_neg
code: @[simp]
theorem cons_inter_of_neg {a} (s : Multiset α) {t} : a ∉ t → (a ::ₘ s) ∩ t = s ∩ t 
goal: a ∉ t → (a ::ₘ s) ∩ t = s ∩ t

full_name: Multiset.inter_le_left
code: theorem inter_le_left (s t : Multiset α) : s ∩ t ≤ s 
goal: s ∩ t ≤ s

full_name: Multiset.inter_le_right
code: theorem inter_le_right (s : Multiset α) : ∀ t, s ∩ t ≤ t 
goal: s ∩ t ≤ t

full_name: Multiset.le_inter
code: theorem le_inter (h₁ : s ≤ t) (h₂ : s ≤ u) : s ≤ t ∩ u 
goal: s ≤ t ∩ u

full_name: Multiset.mem_inter
code: @[simp]
theorem mem_inter : a ∈ s ∩ t ↔ a ∈ s ∧ a ∈ t 
goal: a ∈ s ∩ t ↔ a ∈ s ∧ a ∈ t

full_name: Multiset.instLattice
code: instance : Lattice (Multiset α) 
goal: Lattice (Multiset α)

full_name: Multiset.sup_eq_union
code: @[simp]
theorem sup_eq_union (s t : Multiset α) : s ⊔ t = s ∪ t 
goal: s ⊔ t = s ∪ t

full_name: Multiset.inf_eq_inter
code: @[simp]
theorem inf_eq_inter (s t : Multiset α) : s ⊓ t = s ∩ t 
goal: s ⊓ t = s ∩ t

full_name: Multiset.le_inter_iff
code: @[simp]
theorem le_inter_iff : s ≤ t ∩ u ↔ s ≤ t ∧ s ≤ u 
goal: s ≤ t ∩ u ↔ s ≤ t ∧ s ≤ u

full_name: Multiset.union_le_iff
code: @[simp]
theorem union_le_iff : s ∪ t ≤ u ↔ s ≤ u ∧ t ≤ u 
goal: s ∪ t ≤ u ↔ s ≤ u ∧ t ≤ u

full_name: Multiset.union_comm
code: theorem union_comm (s t : Multiset α) : s ∪ t = t ∪ s 
goal: s ∪ t = t ∪ s

full_name: Multiset.inter_comm
code: theorem inter_comm (s t : Multiset α) : s ∩ t = t ∩ s 
goal: s ∩ t = t ∩ s

full_name: Multiset.eq_union_right
code: theorem eq_union_right (h : s ≤ t) : s ∪ t = t 
goal: s ∪ t = t

full_name: Multiset.union_le_union_left
code: theorem union_le_union_left (h : s ≤ t) (u) : u ∪ s ≤ u ∪ t 
goal: u ∪ s ≤ u ∪ t

full_name: Multiset.union_le_add
code: theorem union_le_add (s t : Multiset α) : s ∪ t ≤ s + t 
goal: s ∪ t ≤ s + t

full_name: Multiset.union_add_distrib
code: theorem union_add_distrib (s t u : Multiset α) : s ∪ t + u = s + u ∪ (t + u) 
goal: s ∪ t + u = s + u ∪ (t + u)

full_name: Multiset.add_union_distrib
code: theorem add_union_distrib (s t u : Multiset α) : s + (t ∪ u) = s + t ∪ (s + u) 
goal: s + (t ∪ u) = s + t ∪ (s + u)

full_name: Multiset.cons_union_distrib
code: theorem cons_union_distrib (a : α) (s t : Multiset α) : a ::ₘ (s ∪ t) = a ::ₘ s ∪ a ::ₘ t 
goal: a ::ₘ (s ∪ t) = a ::ₘ s ∪ a ::ₘ t

full_name: Multiset.inter_add_distrib
code: theorem inter_add_distrib (s t u : Multiset α) : s ∩ t + u = (s + u) ∩ (t + u) 
goal: s ∩ t + u = (s + u) ∩ (t + u)

full_name: Multiset.add_inter_distrib
code: theorem add_inter_distrib (s t u : Multiset α) : s + t ∩ u = (s + t) ∩ (s + u) 
goal: s + t ∩ u = (s + t) ∩ (s + u)

full_name: Multiset.cons_inter_distrib
code: theorem cons_inter_distrib (a : α) (s t : Multiset α) : a ::ₘ s ∩ t = (a ::ₘ s) ∩ (a ::ₘ t) 
goal: a ::ₘ s ∩ t = (a ::ₘ s) ∩ (a ::ₘ t)

full_name: Multiset.union_add_inter
code: theorem union_add_inter (s t : Multiset α) : s ∪ t + s ∩ t = s + t 
goal: s ∪ t + s ∩ t = s + t

full_name: Multiset.sub_add_inter
code: theorem sub_add_inter (s t : Multiset α) : s - t + s ∩ t = s 
goal: s - t + s ∩ t = s

full_name: Multiset.sub_inter
code: theorem sub_inter (s t : Multiset α) : s - s ∩ t = s - t 
goal: s - s ∩ t = s - t

full_name: Multiset.filter
code: /-- `Filter p s` returns the elements in `s` (with the same multiplicities)
  which satisfy `p`, and removes the rest. -/
def filter (s : Multiset α) : Multiset α 
goal: Multiset α

full_name: Multiset.filter_coe
code: @[simp, norm_cast] lemma filter_coe (l : List α) : filter p l = l.filter p 
goal: Multiset.filter p ↑l = ↑(List.filter (fun b => decide (p b)) l)

full_name: Multiset.filter_zero
code: @[simp]
theorem filter_zero : filter p 0 = 0 
goal: Multiset.filter p 0 = 0

full_name: Multiset.filter_congr
code: theorem filter_congr {p q : α → Prop} [DecidablePred p] [DecidablePred q] {s : Multiset α} :
    (∀ x ∈ s, p x ↔ q x) → filter p s = filter q s 
goal: (∀ x ∈ s, p x ↔ q x) → Multiset.filter p s = Multiset.filter q s

full_name: Multiset.filter_add
code: @[simp]
theorem filter_add (s t : Multiset α) : filter p (s + t) = filter p s + filter p t 
goal: Multiset.filter p (s + t) = Multiset.filter p s + Multiset.filter p t

full_name: Multiset.filter_le
code: @[simp]
theorem filter_le (s : Multiset α) : filter p s ≤ s 
goal: Multiset.filter p s ≤ s

full_name: Multiset.filter_subset
code: @[simp]
theorem filter_subset (s : Multiset α) : filter p s ⊆ s 
goal: Multiset.filter p s ⊆ s

full_name: Multiset.filter_le_filter
code: theorem filter_le_filter {s t} (h : s ≤ t) : filter p s ≤ filter p t 
goal: Multiset.filter p s ≤ Multiset.filter p t

full_name: Multiset.monotone_filter_left
code: theorem monotone_filter_left : Monotone (filter p) 
goal: Monotone (Multiset.filter p)

full_name: Multiset.monotone_filter_right
code: theorem monotone_filter_right (s : Multiset α) ⦃p q : α → Prop⦄ [DecidablePred p] [DecidablePred q]
    (h : ∀ b, p b → q b) :
    s.filter p ≤ s.filter q 
goal: Multiset.filter p s ≤ Multiset.filter q s

full_name: Multiset.filter_cons_of_pos
code: @[simp]
theorem filter_cons_of_pos {a : α} (s) : p a → filter p (a ::ₘ s) = a ::ₘ filter p s 
goal: p a → Multiset.filter p (a ::ₘ s) = a ::ₘ Multiset.filter p s

full_name: Multiset.filter_cons_of_neg
code: @[simp]
theorem filter_cons_of_neg {a : α} (s) : ¬p a → filter p (a ::ₘ s) = filter p s 
goal: ¬p a → Multiset.filter p (a ::ₘ s) = Multiset.filter p s

full_name: Multiset.mem_filter
code: @[simp]
theorem mem_filter {a : α} {s} : a ∈ filter p s ↔ a ∈ s ∧ p a 
goal: a ∈ Multiset.filter p s ↔ a ∈ s ∧ p a

full_name: Multiset.of_mem_filter
code: theorem of_mem_filter {a : α} {s} (h : a ∈ filter p s) : p a 
goal: p a

full_name: Multiset.mem_of_mem_filter
code: theorem mem_of_mem_filter {a : α} {s} (h : a ∈ filter p s) : a ∈ s 
goal: a ∈ s

full_name: Multiset.mem_filter_of_mem
code: theorem mem_filter_of_mem {a : α} {l} (m : a ∈ l) (h : p a) : a ∈ filter p l 
goal: a ∈ Multiset.filter p l

full_name: Multiset.filter_eq_self
code: theorem filter_eq_self {s} : filter p s = s ↔ ∀ a ∈ s, p a 
goal: Multiset.filter p s = s ↔ ∀ a ∈ s, p a

full_name: Multiset.filter_eq_nil
code: theorem filter_eq_nil {s} : filter p s = 0 ↔ ∀ a ∈ s, ¬p a 
goal: Multiset.filter p s = 0 ↔ ∀ a ∈ s, ¬p a

full_name: Multiset.le_filter
code: theorem le_filter {s t} : s ≤ filter p t ↔ s ≤ t ∧ ∀ a ∈ s, p a 
goal: s ≤ Multiset.filter p t ↔ s ≤ t ∧ ∀ a ∈ s, p a

full_name: Multiset.filter_cons
code: theorem filter_cons {a : α} (s : Multiset α) :
    filter p (a ::ₘ s) = (if p a then {a} else 0) + filter p s 
goal: Multiset.filter p (a ::ₘ s) = (if p a then {a} else 0) + Multiset.filter p s

full_name: Multiset.filter_singleton
code: theorem filter_singleton {a : α} (p : α → Prop) [DecidablePred p] :
    filter p {a} = if p a then {a} else ∅ 
goal: Multiset.filter p {a} = if p a then {a} else ∅

full_name: Multiset.filter_nsmul
code: theorem filter_nsmul (s : Multiset α) (n : ℕ) : filter p (n • s) = n • filter p s 
goal: Multiset.filter p (n • s) = n • Multiset.filter p s

full_name: Multiset.filter_sub
code: @[simp]
theorem filter_sub [DecidableEq α] (s t : Multiset α) :
    filter p (s - t) = filter p s - filter p t 
goal: Multiset.filter p (s - t) = Multiset.filter p s - Multiset.filter p t

full_name: Multiset.filter_union
code: @[simp]
theorem filter_union [DecidableEq α] (s t : Multiset α) :
    filter p (s ∪ t) = filter p s ∪ filter p t 
goal: Multiset.filter p (s ∪ t) = Multiset.filter p s ∪ Multiset.filter p t

full_name: Multiset.filter_inter
code: @[simp]
theorem filter_inter [DecidableEq α] (s t : Multiset α) :
    filter p (s ∩ t) = filter p s ∩ filter p t 
goal: Multiset.filter p (s ∩ t) = Multiset.filter p s ∩ Multiset.filter p t

full_name: Multiset.filter_filter
code: @[simp]
theorem filter_filter (q) [DecidablePred q] (s : Multiset α) :
    filter p (filter q s) = filter (fun a => p a ∧ q a) s 
goal: Multiset.filter p (Multiset.filter q s) = Multiset.filter (fun a => p a ∧ q a) s

full_name: Multiset.filter_comm
code: lemma filter_comm (q) [DecidablePred q] (s : Multiset α) :
    filter p (filter q s) = filter q (filter p s) 
goal: Multiset.filter p (Multiset.filter q s) = Multiset.filter q (Multiset.filter p s)

full_name: Multiset.filter_add_filter
code: theorem filter_add_filter (q) [DecidablePred q] (s : Multiset α) :
    filter p s + filter q s = filter (fun a => p a ∨ q a) s + filter (fun a => p a ∧ q a) s 
goal: Multiset.filter p s + Multiset.filter q s =
  Multiset.filter (fun a => p a ∨ q a) s + Multiset.filter (fun a => p a ∧ q a) s

full_name: Multiset.filter_add_not
code: theorem filter_add_not (s : Multiset α) : filter p s + filter (fun a => ¬p a) s = s 
goal: Multiset.filter p s + Multiset.filter (fun a => ¬p a) s = s

full_name: Multiset.filter_map
code: theorem filter_map (f : β → α) (s : Multiset β) : filter p (map f s) = map f (filter (p ∘ f) s) 
goal: Multiset.filter p (Multiset.map f s) = Multiset.map f (Multiset.filter (p ∘ f) s)

full_name: Multiset.map_filter'
code: lemma map_filter' {f : α → β} (hf : Injective f) (s : Multiset α)
    [DecidablePred fun b => ∃ a, p a ∧ f a = b] :
    (s.filter p).map f = (s.map f).filter fun b => ∃ a, p a ∧ f a = b 
goal: Multiset.map f (Multiset.filter p s) = Multiset.filter (fun b => ∃ a, p a ∧ f a = b) (Multiset.map f s)

full_name: Multiset.card_filter_le_iff
code: lemma card_filter_le_iff (s : Multiset α) (P : α → Prop) [DecidablePred P] (n : ℕ) :
    card (s.filter P) ≤ n ↔ ∀ s' ≤ s, n < card s' → ∃ a ∈ s', ¬ P a 
goal: Multiset.card (Multiset.filter P s) ≤ n ↔ ∀ s' ≤ s, n < Multiset.card s' → ∃ a ∈ s', ¬P a

full_name: Multiset.filterMap
code: /-- `filterMap f s` is a combination filter/map operation on `s`.
  The function `f : α → Option β` is applied to each element of `s`;
  if `f a` is `some b` then `b` is added to the result, otherwise
  `a` is removed from the resulting multiset. -/
def filterMap (f : α → Option β) (s : Multiset α) : Multiset β 
goal: Multiset β

full_name: Multiset.filterMap_coe
code: @[simp, norm_cast]
lemma filterMap_coe (f : α → Option β) (l : List α) : filterMap f l = l.filterMap f 
goal: Multiset.filterMap f ↑l = ↑(List.filterMap f l)

full_name: Multiset.filterMap_zero
code: @[simp]
theorem filterMap_zero (f : α → Option β) : filterMap f 0 = 0 
goal: Multiset.filterMap f 0 = 0

full_name: Multiset.filterMap_cons_none
code: @[simp]
theorem filterMap_cons_none {f : α → Option β} (a : α) (s : Multiset α) (h : f a = none) :
    filterMap f (a ::ₘ s) = filterMap f s 
goal: Multiset.filterMap f (a ::ₘ s) = Multiset.filterMap f s

full_name: Multiset.filterMap_cons_some
code: @[simp]
theorem filterMap_cons_some (f : α → Option β) (a : α) (s : Multiset α) {b : β}
    (h : f a = some b) : filterMap f (a ::ₘ s) = b ::ₘ filterMap f s 
goal: Multiset.filterMap f (a ::ₘ s) = b ::ₘ Multiset.filterMap f s

full_name: Multiset.filterMap_eq_map
code: theorem filterMap_eq_map (f : α → β) : filterMap (some ∘ f) = map f 
goal: Multiset.filterMap (some ∘ f) = Multiset.map f

full_name: Multiset.filterMap_eq_filter
code: theorem filterMap_eq_filter : filterMap (Option.guard p) = filter p 
goal: Multiset.filterMap (Option.guard p) = Multiset.filter p

full_name: Multiset.filterMap_filterMap
code: theorem filterMap_filterMap (f : α → Option β) (g : β → Option γ) (s : Multiset α) :
    filterMap g (filterMap f s) = filterMap (fun x => (f x).bind g) s 
goal: Multiset.filterMap g (Multiset.filterMap f s) = Multiset.filterMap (fun x => (f x).bind g) s

full_name: Multiset.map_filterMap
code: theorem map_filterMap (f : α → Option β) (g : β → γ) (s : Multiset α) :
    map g (filterMap f s) = filterMap (fun x => (f x).map g) s 
goal: Multiset.map g (Multiset.filterMap f s) = Multiset.filterMap (fun x => Option.map g (f x)) s

full_name: Multiset.filterMap_map
code: theorem filterMap_map (f : α → β) (g : β → Option γ) (s : Multiset α) :
    filterMap g (map f s) = filterMap (g ∘ f) s 
goal: Multiset.filterMap g (Multiset.map f s) = Multiset.filterMap (g ∘ f) s

full_name: Multiset.filter_filterMap
code: theorem filter_filterMap (f : α → Option β) (p : β → Prop) [DecidablePred p] (s : Multiset α) :
    filter p (filterMap f s) = filterMap (fun x => (f x).filter p) s 
goal: Multiset.filter p (Multiset.filterMap f s) = Multiset.filterMap (fun x => Option.filter (fun b => decide (p b)) (f x)) s

full_name: Multiset.filterMap_filter
code: theorem filterMap_filter (f : α → Option β) (s : Multiset α) :
    filterMap f (filter p s) = filterMap (fun x => if p x then f x else none) s 
goal: Multiset.filterMap f (Multiset.filter p s) = Multiset.filterMap (fun x => if p x then f x else none) s

full_name: Multiset.filterMap_some
code: @[simp]
theorem filterMap_some (s : Multiset α) : filterMap some s = s 
goal: Multiset.filterMap some s = s

full_name: Multiset.mem_filterMap
code: @[simp]
theorem mem_filterMap (f : α → Option β) (s : Multiset α) {b : β} :
    b ∈ filterMap f s ↔ ∃ a, a ∈ s ∧ f a = some b 
goal: b ∈ Multiset.filterMap f s ↔ ∃ a ∈ s, f a = some b

full_name: Multiset.map_filterMap_of_inv
code: theorem map_filterMap_of_inv (f : α → Option β) (g : β → α) (H : ∀ x : α, (f x).map g = some x)
    (s : Multiset α) : map g (filterMap f s) = s 
goal: Multiset.map g (Multiset.filterMap f s) = s

full_name: Multiset.filterMap_le_filterMap
code: theorem filterMap_le_filterMap (f : α → Option β) {s t : Multiset α} (h : s ≤ t) :
    filterMap f s ≤ filterMap f t 
goal: Multiset.filterMap f s ≤ Multiset.filterMap f t

full_name: Multiset.countP
code: /-- `countP p s` counts the number of elements of `s` (with multiplicity) that
  satisfy `p`. -/
def countP (s : Multiset α) : ℕ 
goal: ℕ

full_name: Multiset.coe_countP
code: @[simp]
theorem coe_countP (l : List α) : countP p l = l.countP p 
goal: Multiset.countP p ↑l = List.countP (fun b => decide (p b)) l

full_name: Multiset.countP_zero
code: @[simp]
theorem countP_zero : countP p 0 = 0 
goal: Multiset.countP p 0 = 0

full_name: Multiset.countP_cons_of_pos
code: @[simp]
theorem countP_cons_of_pos {a : α} (s) : p a → countP p (a ::ₘ s) = countP p s + 1 
goal: p a → Multiset.countP p (a ::ₘ s) = Multiset.countP p s + 1

full_name: Multiset.countP_cons_of_neg
code: @[simp]
theorem countP_cons_of_neg {a : α} (s) : ¬p a → countP p (a ::ₘ s) = countP p s 
goal: ¬p a → Multiset.countP p (a ::ₘ s) = Multiset.countP p s

full_name: Multiset.countP_cons
code: theorem countP_cons (b : α) (s) : countP p (b ::ₘ s) = countP p s + if p b then 1 else 0 
goal: Multiset.countP p (b ::ₘ s) = Multiset.countP p s + if p b then 1 else 0

full_name: Multiset.countP_eq_card_filter
code: theorem countP_eq_card_filter (s) : countP p s = card (filter p s) 
goal: Multiset.countP p s = Multiset.card (Multiset.filter p s)

full_name: Multiset.countP_le_card
code: theorem countP_le_card (s) : countP p s ≤ card s 
goal: Multiset.countP p s ≤ Multiset.card s

full_name: Multiset.countP_add
code: @[simp]
theorem countP_add (s t) : countP p (s + t) = countP p s + countP p t 
goal: Multiset.countP p (s + t) = Multiset.countP p s + Multiset.countP p t

full_name: Multiset.countP_nsmul
code: @[simp]
theorem countP_nsmul (s) (n : ℕ) : countP p (n • s) = n * countP p s 
goal: Multiset.countP p (n • s) = n * Multiset.countP p s

full_name: Multiset.card_eq_countP_add_countP
code: theorem card_eq_countP_add_countP (s) : card s = countP p s + countP (fun x => ¬p x) s 
goal: Multiset.card s = Multiset.countP p s + Multiset.countP (fun x => ¬p x) s

full_name: Multiset.countPAddMonoidHom
code: /-- `countP p`, the number of elements of a multiset satisfying `p`, promoted to an
`AddMonoidHom`. -/
def countPAddMonoidHom : Multiset α →+ ℕ 
goal: Multiset α →+ ℕ

full_name: Multiset.coe_countPAddMonoidHom
code: @[simp]
theorem coe_countPAddMonoidHom : (countPAddMonoidHom p : Multiset α → ℕ) = countP p 
goal: ⇑(Multiset.countPAddMonoidHom p) = Multiset.countP p

full_name: Multiset.countP_sub
code: @[simp]
theorem countP_sub [DecidableEq α] {s t : Multiset α} (h : t ≤ s) :
    countP p (s - t) = countP p s - countP p t 
goal: Multiset.countP p (s - t) = Multiset.countP p s - Multiset.countP p t

full_name: Multiset.countP_le_of_le
code: theorem countP_le_of_le {s t} (h : s ≤ t) : countP p s ≤ countP p t 
goal: Multiset.countP p s ≤ Multiset.countP p t

full_name: Multiset.countP_filter
code: @[simp]
theorem countP_filter (q) [DecidablePred q] (s : Multiset α) :
    countP p (filter q s) = countP (fun a => p a ∧ q a) s 
goal: Multiset.countP p (Multiset.filter q s) = Multiset.countP (fun a => p a ∧ q a) s

full_name: Multiset.countP_eq_countP_filter_add
code: theorem countP_eq_countP_filter_add (s) (p q : α → Prop) [DecidablePred p] [DecidablePred q] :
    countP p s = (filter q s).countP p + (filter (fun a => ¬q a) s).countP p 
goal: Multiset.countP p s = Multiset.countP p (Multiset.filter q s) + Multiset.countP p (Multiset.filter (fun a => ¬q a) s)

full_name: Multiset.countP_True
code: @[simp]
theorem countP_True {s : Multiset α} : countP (fun _ => True) s = card s 
goal: Multiset.countP (fun x => True) s = Multiset.card s

full_name: Multiset.countP_False
code: @[simp]
theorem countP_False {s : Multiset α} : countP (fun _ => False) s = 0 
goal: Multiset.countP (fun x => False) s = 0

full_name: Multiset.countP_map
code: theorem countP_map (f : α → β) (s : Multiset α) (p : β → Prop) [DecidablePred p] :
    countP p (map f s) = card (s.filter fun a => p (f a)) 
goal: Multiset.countP p (Multiset.map f s) = Multiset.card (Multiset.filter (fun a => p (f a)) s)

full_name: Multiset.countP_attach
code: lemma countP_attach (s : Multiset α) : s.attach.countP (fun a : {a // a ∈ s} ↦ p a) = s.countP p 
goal: Multiset.countP (fun a => p ↑a) s.attach = Multiset.countP p s

full_name: Multiset.filter_attach
code: lemma filter_attach (s : Multiset α) (p : α → Prop) [DecidablePred p] :
    (s.attach.filter fun a : {a // a ∈ s} ↦ p ↑a) =
      (s.filter p).attach.map (Subtype.map id fun _ ↦ Multiset.mem_of_mem_filter) 
goal: Multiset.filter (fun a => p ↑a) s.attach = Multiset.map (Subtype.map id ⋯) (Multiset.filter p s).attach

full_name: Multiset.countP_pos
code: theorem countP_pos {s} : 0 < countP p s ↔ ∃ a ∈ s, p a 
goal: 0 < Multiset.countP p s ↔ ∃ a ∈ s, p a

full_name: Multiset.countP_eq_zero
code: theorem countP_eq_zero {s} : countP p s = 0 ↔ ∀ a ∈ s, ¬p a 
goal: Multiset.countP p s = 0 ↔ ∀ a ∈ s, ¬p a

full_name: Multiset.countP_eq_card
code: theorem countP_eq_card {s} : countP p s = card s ↔ ∀ a ∈ s, p a 
goal: Multiset.countP p s = Multiset.card s ↔ ∀ a ∈ s, p a

full_name: Multiset.countP_pos_of_mem
code: theorem countP_pos_of_mem {s a} (h : a ∈ s) (pa : p a) : 0 < countP p s 
goal: 0 < Multiset.countP p s

full_name: Multiset.countP_congr
code: theorem countP_congr {s s' : Multiset α} (hs : s = s')
    {p p' : α → Prop} [DecidablePred p] [DecidablePred p']
    (hp : ∀ x ∈ s, p x = p' x) : s.countP p = s'.countP p' 
goal: Multiset.countP p s = Multiset.countP p' s'

full_name: Multiset.count
code: /-- `count a s` is the multiplicity of `a` in `s`. -/
def count (a : α) : Multiset α → ℕ 
goal: Multiset α → ℕ

full_name: Multiset.coe_count
code: @[simp]
theorem coe_count (a : α) (l : List α) : count a (ofList l) = l.count a 
goal: Multiset.count a ↑l = List.count a l

full_name: Multiset.count_zero
code: @[simp]
theorem count_zero (a : α) : count a 0 = 0 
goal: Multiset.count a 0 = 0

full_name: Multiset.count_cons_self
code: @[simp]
theorem count_cons_self (a : α) (s : Multiset α) : count a (a ::ₘ s) = count a s + 1 
goal: Multiset.count a (a ::ₘ s) = Multiset.count a s + 1

full_name: Multiset.count_cons_of_ne
code: @[simp]
theorem count_cons_of_ne {a b : α} (h : a ≠ b) (s : Multiset α) : count a (b ::ₘ s) = count a s 
goal: Multiset.count a (b ::ₘ s) = Multiset.count a s

full_name: Multiset.count_le_card
code: theorem count_le_card (a : α) (s) : count a s ≤ card s 
goal: Multiset.count a s ≤ Multiset.card s

full_name: Multiset.count_le_of_le
code: theorem count_le_of_le (a : α) {s t} : s ≤ t → count a s ≤ count a t 
goal: s ≤ t → Multiset.count a s ≤ Multiset.count a t

full_name: Multiset.count_le_count_cons
code: theorem count_le_count_cons (a b : α) (s : Multiset α) : count a s ≤ count a (b ::ₘ s) 
goal: Multiset.count a s ≤ Multiset.count a (b ::ₘ s)

full_name: Multiset.count_cons
code: theorem count_cons (a b : α) (s : Multiset α) :
    count a (b ::ₘ s) = count a s + if a = b then 1 else 0 
goal: Multiset.count a (b ::ₘ s) = Multiset.count a s + if a = b then 1 else 0

full_name: Multiset.count_singleton_self
code: theorem count_singleton_self (a : α) : count a ({a} : Multiset α) = 1 
goal: Multiset.count a {a} = 1

full_name: Multiset.count_singleton
code: theorem count_singleton (a b : α) : count a ({b} : Multiset α) = if a = b then 1 else 0 
goal: Multiset.count a {b} = if a = b then 1 else 0

full_name: Multiset.count_add
code: @[simp]
theorem count_add (a : α) : ∀ s t, count a (s + t) = count a s + count a t 
goal: Multiset.count a (s + t) = Multiset.count a s + Multiset.count a t

full_name: Multiset.countAddMonoidHom
code: /-- `count a`, the multiplicity of `a` in a multiset, promoted to an `AddMonoidHom`. -/
def countAddMonoidHom (a : α) : Multiset α →+ ℕ 
goal: Multiset α →+ ℕ

full_name: Multiset.coe_countAddMonoidHom
code: @[simp]
theorem coe_countAddMonoidHom {a : α} : (countAddMonoidHom a : Multiset α → ℕ) = count a 
goal: ⇑(Multiset.countAddMonoidHom a) = Multiset.count a

full_name: Multiset.count_nsmul
code: @[simp]
theorem count_nsmul (a : α) (n s) : count a (n • s) = n * count a s 
goal: Multiset.count a (n • s) = n * Multiset.count a s

full_name: Multiset.count_attach
code: @[simp]
lemma count_attach (a : {x // x ∈ s}) : s.attach.count a = s.count ↑a 
goal: Multiset.count a s.attach = Multiset.count (↑a) s

full_name: Multiset.count_pos
code: theorem count_pos {a : α} {s : Multiset α} : 0 < count a s ↔ a ∈ s 
goal: 0 < Multiset.count a s ↔ a ∈ s

full_name: Multiset.one_le_count_iff_mem
code: theorem one_le_count_iff_mem {a : α} {s : Multiset α} : 1 ≤ count a s ↔ a ∈ s 
goal: 1 ≤ Multiset.count a s ↔ a ∈ s

full_name: Multiset.count_eq_zero_of_not_mem
code: @[simp]
theorem count_eq_zero_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) : count a s = 0 
goal: Multiset.count a s = 0

full_name: Multiset.count_ne_zero
code: lemma count_ne_zero {a : α} : count a s ≠ 0 ↔ a ∈ s 
goal: Multiset.count a s ≠ 0 ↔ a ∈ s

full_name: Multiset.count_eq_zero
code: @[simp] lemma count_eq_zero {a : α} : count a s = 0 ↔ a ∉ s 
goal: Multiset.count a s = 0 ↔ a ∉ s

full_name: Multiset.count_eq_card
code: theorem count_eq_card {a : α} {s} : count a s = card s ↔ ∀ x ∈ s, a = x 
goal: Multiset.count a s = Multiset.card s ↔ ∀ x ∈ s, a = x

full_name: Multiset.count_replicate_self
code: @[simp]
theorem count_replicate_self (a : α) (n : ℕ) : count a (replicate n a) = n 
goal: Multiset.count a (Multiset.replicate n a) = n

full_name: Multiset.count_replicate
code: theorem count_replicate (a b : α) (n : ℕ) : count a (replicate n b) = if a = b then n else 0 
goal: Multiset.count a (Multiset.replicate n b) = if a = b then n else 0

full_name: Multiset.count_erase_self
code: @[simp]
theorem count_erase_self (a : α) (s : Multiset α) : count a (erase s a) = count a s - 1 
goal: Multiset.count a (s.erase a) = Multiset.count a s - 1

full_name: Multiset.count_erase_of_ne
code: @[simp]
theorem count_erase_of_ne {a b : α} (ab : a ≠ b) (s : Multiset α) :
    count a (erase s b) = count a s 
goal: Multiset.count a (s.erase b) = Multiset.count a s

full_name: Multiset.count_sub
code: @[simp]
theorem count_sub (a : α) (s t : Multiset α) : count a (s - t) = count a s - count a t 
goal: Multiset.count a (s - t) = Multiset.count a s - Multiset.count a t

full_name: Multiset.count_union
code: @[simp]
theorem count_union (a : α) (s t : Multiset α) : count a (s ∪ t) = max (count a s) (count a t) 
goal: Multiset.count a (s ∪ t) = max (Multiset.count a s) (Multiset.count a t)

full_name: Multiset.count_inter
code: @[simp]
theorem count_inter (a : α) (s t : Multiset α) : count a (s ∩ t) = min (count a s) (count a t) 
goal: Multiset.count a (s ∩ t) = min (Multiset.count a s) (Multiset.count a t)

full_name: Multiset.le_count_iff_replicate_le
code: theorem le_count_iff_replicate_le {a : α} {s : Multiset α} {n : ℕ} :
    n ≤ count a s ↔ replicate n a ≤ s 
goal: n ≤ Multiset.count a s ↔ Multiset.replicate n a ≤ s

full_name: Multiset.count_filter_of_pos
code: @[simp]
theorem count_filter_of_pos {p} [DecidablePred p] {a} {s : Multiset α} (h : p a) :
    count a (filter p s) = count a s 
goal: Multiset.count a (Multiset.filter p s) = Multiset.count a s

full_name: Multiset.count_filter_of_neg
code: @[simp]
theorem count_filter_of_neg {p} [DecidablePred p] {a} {s : Multiset α} (h : ¬p a) :
    count a (filter p s) = 0 
goal: Multiset.count a (Multiset.filter p s) = 0

full_name: Multiset.count_filter
code: theorem count_filter {p} [DecidablePred p] {a} {s : Multiset α} :
    count a (filter p s) = if p a then count a s else 0 
goal: Multiset.count a (Multiset.filter p s) = if p a then Multiset.count a s else 0

full_name: Multiset.ext
code: theorem ext {s t : Multiset α} : s = t ↔ ∀ a, count a s = count a t 
goal: s = t ↔ ∀ (a : α), Multiset.count a s = Multiset.count a t

full_name: Multiset.ext'
code: @[ext]
theorem ext' {s t : Multiset α} : (∀ a, count a s = count a t) → s = t 
goal: (∀ (a : α), Multiset.count a s = Multiset.count a t) → s = t

full_name: Multiset.count_injective
code: lemma count_injective : Injective fun (s : Multiset α) a ↦ s.count a 
goal: Function.Injective fun s a => Multiset.count a s

full_name: Multiset.coe_inter
code: @[simp]
theorem coe_inter (s t : List α) : (s ∩ t : Multiset α) = (s.bagInter t : List α) 
goal: ↑s ∩ ↑t = ↑(s.bagInter t)

full_name: Multiset.le_iff_count
code: theorem le_iff_count {s t : Multiset α} : s ≤ t ↔ ∀ a, count a s ≤ count a t 
goal: s ≤ t ↔ ∀ (a : α), Multiset.count a s ≤ Multiset.count a t

full_name: Multiset.instDistribLattice
code: instance : DistribLattice (Multiset α) 
goal: DistribLattice (Multiset α)

full_name: Multiset.count_map
code: theorem count_map {α β : Type*} (f : α → β) (s : Multiset α) [DecidableEq β] (b : β) :
    count b (map f s) = card (s.filter fun a => b = f a) 
goal: Multiset.count b (Multiset.map f s) = Multiset.card (Multiset.filter (fun a => b = f a) s)

full_name: Multiset.count_map_eq_count
code: /-- `Multiset.map f` preserves `count` if `f` is injective on the set of elements contained in
the multiset -/
theorem count_map_eq_count [DecidableEq β] (f : α → β) (s : Multiset α)
    (hf : Set.InjOn f { x : α | x ∈ s }) (x) (H : x ∈ s) : (s.map f).count (f x) = s.count x 
goal: Multiset.count (f x) (Multiset.map f s) = Multiset.count x s

full_name: Multiset.count_map_eq_count'
code: /-- `Multiset.map f` preserves `count` if `f` is injective -/
theorem count_map_eq_count' [DecidableEq β] (f : α → β) (s : Multiset α) (hf : Function.Injective f)
    (x : α) : (s.map f).count (f x) = s.count x 
goal: Multiset.count (f x) (Multiset.map f s) = Multiset.count x s

full_name: Multiset.sub_filter_eq_filter_not
code: @[simp]
theorem sub_filter_eq_filter_not [DecidableEq α] (p) [DecidablePred p] (s : Multiset α) :
    s - s.filter p = s.filter (fun a ↦ ¬ p a) 
goal: s - Multiset.filter p s = Multiset.filter (fun a => ¬p a) s

full_name: Multiset.filter_eq'
code: theorem filter_eq' (s : Multiset α) (b : α) : s.filter (· = b) = replicate (count b s) b 
goal: Multiset.filter (fun x => x = b) s = Multiset.replicate (Multiset.count b s) b

full_name: Multiset.filter_eq
code: theorem filter_eq (s : Multiset α) (b : α) : s.filter (Eq b) = replicate (count b s) b 
goal: Multiset.filter (Eq b) s = Multiset.replicate (Multiset.count b s) b

full_name: Multiset.replicate_inter
code: @[simp]
theorem replicate_inter (n : ℕ) (x : α) (s : Multiset α) :
    replicate n x ∩ s = replicate (min n (s.count x)) x 
goal: Multiset.replicate n x ∩ s = Multiset.replicate (min n (Multiset.count x s)) x

full_name: Multiset.inter_replicate
code: @[simp]
theorem inter_replicate (s : Multiset α) (n : ℕ) (x : α) :
    s ∩ replicate n x = replicate (min (s.count x) n) x 
goal: s ∩ Multiset.replicate n x = Multiset.replicate (min (Multiset.count x s) n) x

full_name: Multiset.erase_attach_map_val
code: theorem erase_attach_map_val (s : Multiset α) (x : {x // x ∈ s}) :
    (s.attach.erase x).map (↑) = s.erase x 
goal: Multiset.map Subtype.val (s.attach.erase x) = s.erase ↑x

full_name: Multiset.erase_attach_map
code: theorem erase_attach_map (s : Multiset α) (f : α → β) (x : {x // x ∈ s}) :
    (s.attach.erase x).map (fun j : {x // x ∈ s} ↦ f j) = (s.erase x).map f 
goal: Multiset.map (fun j => f ↑j) (s.attach.erase x) = Multiset.map f (s.erase ↑x)

full_name: Multiset.addHom_ext
code: @[ext]
theorem addHom_ext [AddZeroClass β] ⦃f g : Multiset α →+ β⦄ (h : ∀ x, f {x} = g {x}) : f = g 
goal: f = g

full_name: Multiset.map_le_map_iff
code: @[simp]
theorem map_le_map_iff {f : α → β} (hf : Function.Injective f) {s t : Multiset α} :
    s.map f ≤ t.map f ↔ s ≤ t 
goal: Multiset.map f s ≤ Multiset.map f t ↔ s ≤ t

full_name: Multiset.mapEmbedding_apply
code: /-- Associate to an embedding `f` from `α` to `β` the order embedding that maps a multiset to its
image under `f`. -/
@[simps!]
def mapEmbedding (f : α ↪ β) : Multiset α ↪o Multiset β 
goal: (Multiset.mapEmbedding f) s = Multiset.map (⇑f) s

full_name: Multiset.mapEmbedding
code: /-- Associate to an embedding `f` from `α` to `β` the order embedding that maps a multiset to its
image under `f`. -/
@[simps!]
def mapEmbedding (f : α ↪ β) : Multiset α ↪o Multiset β 
goal: Multiset α ↪o Multiset β

full_name: Multiset.count_eq_card_filter_eq
code: theorem count_eq_card_filter_eq [DecidableEq α] (s : Multiset α) (a : α) :
    s.count a = card (s.filter (a = ·)) 
goal: Multiset.count a s = Multiset.card (Multiset.filter (fun x => a = x) s)

full_name: Multiset.map_count_True_eq_filter_card
code: /--
Mapping a multiset through a predicate and counting the `True`s yields the cardinality of the set
filtered by the predicate. Note that this uses the notion of a multiset of `Prop`s - due to the
decidability requirements of `count`, the decidability instance on the LHS is different from the
RHS. In particular, the decidability instance on the left leaks `Classical.decEq`.
See [here](https://github.com/leanprover-community/mathlib/pull/11306#discussion_r782286812)
for more discussion.
-/
@[simp]
theorem map_count_True_eq_filter_card (s : Multiset α) (p : α → Prop) [DecidablePred p] :
    (s.map p).count True = card (s.filter p) 
goal: Multiset.count True (Multiset.map p s) = Multiset.card (Multiset.filter p s)

full_name: Multiset.Rel.cons
code: /-- `Rel r s t` -- lift the relation `r` between two elements to a relation between `s` and `t`,
s.t. there is a one-to-one mapping between elements in `s` and `t` following `r`. -/
@[mk_iff]
inductive Rel (r : α → β → Prop) : Multiset α → Multiset β → Prop
  | zero : Rel r 0 0
  | cons {a b as bs} : r a b → Rel r as bs → Rel r (a ::ₘ as) (b ::ₘ bs)
goal: r a b → Multiset.Rel r as bs → Multiset.Rel r (a ::ₘ as) (b ::ₘ bs)

full_name: Multiset.Rel
code: /-- `Rel r s t` -- lift the relation `r` between two elements to a relation between `s` and `t`,
s.t. there is a one-to-one mapping between elements in `s` and `t` following `r`. -/
@[mk_iff]
inductive Rel (r : α → β → Prop) : Multiset α → Multiset β → Prop
  | zero : Rel r 0 0
  | cons {a b as bs} : r a b → Rel r as bs → Rel r (a ::ₘ as) (b ::ₘ bs)
goal: Multiset α → Multiset β → Prop

full_name: Multiset.rel_iff
code: /-- `Rel r s t` -- lift the relation `r` between two elements to a relation between `s` and `t`,
s.t. there is a one-to-one mapping between elements in `s` and `t` following `r`. -/
@[mk_iff]
inductive Rel (r : α → β → Prop) : Multiset α → Multiset β → Prop
  | zero : Rel r 0 0
  | cons {a b as bs} : r a b → Rel r as bs → Rel r (a ::ₘ as) (b ::ₘ bs)
goal: ∀ (a : Multiset α) (a_1 : Multiset β),
  Multiset.Rel r a a_1 ↔
    a = 0 ∧ a_1 = 0 ∨ ∃ a_2 b as bs, r a_2 b ∧ Multiset.Rel r as bs ∧ a = a_2 ::ₘ as ∧ a_1 = b ::ₘ bs

full_name: Multiset.Rel.zero
code: /-- `Rel r s t` -- lift the relation `r` between two elements to a relation between `s` and `t`,
s.t. there is a one-to-one mapping between elements in `s` and `t` following `r`. -/
@[mk_iff]
inductive Rel (r : α → β → Prop) : Multiset α → Multiset β → Prop
  | zero : Rel r 0 0
  | cons {a b as bs} : r a b → Rel r as bs → Rel r (a ::ₘ as) (b ::ₘ bs)
goal: Multiset.Rel r 0 0

full_name: _private.Mathlib.Data.Multiset.Basic.0.Multiset.rel_flip_aux
code: private theorem rel_flip_aux {s t} (h : Rel r s t) : Rel (flip r) t s 
goal: Multiset.Rel (flip r) t s

full_name: Multiset.rel_flip
code: theorem rel_flip {s t} : Rel (flip r) s t ↔ Rel r t s 
goal: Multiset.Rel (flip r) s t ↔ Multiset.Rel r t s

full_name: Multiset.rel_refl_of_refl_on
code: theorem rel_refl_of_refl_on {m : Multiset α} {r : α → α → Prop} : (∀ x ∈ m, r x x) → Rel r m m 
goal: (∀ x ∈ m, r x x) → Multiset.Rel r m m

full_name: Multiset.rel_eq_refl
code: theorem rel_eq_refl {s : Multiset α} : Rel (· = ·) s s 
goal: Multiset.Rel (fun x x_1 => x = x_1) s s

full_name: Multiset.rel_eq
code: theorem rel_eq {s t : Multiset α} : Rel (· = ·) s t ↔ s = t 
goal: Multiset.Rel (fun x x_1 => x = x_1) s t ↔ s = t

full_name: Multiset.Rel.mono
code: theorem Rel.mono {r p : α → β → Prop} {s t} (hst : Rel r s t)
    (h : ∀ a ∈ s, ∀ b ∈ t, r a b → p a b) : Rel p s t 
goal: Multiset.Rel p s t

full_name: Multiset.Rel.add
code: theorem Rel.add {s t u v} (hst : Rel r s t) (huv : Rel r u v) : Rel r (s + u) (t + v) 
goal: Multiset.Rel r (s + u) (t + v)

full_name: Multiset.rel_flip_eq
code: theorem rel_flip_eq {s t : Multiset α} : Rel (fun a b => b = a) s t ↔ s = t 
goal: Multiset.Rel (fun a b => b = a) s t ↔ s = t

full_name: Multiset.rel_zero_left
code: @[simp]
theorem rel_zero_left {b : Multiset β} : Rel r 0 b ↔ b = 0 
goal: Multiset.Rel r 0 b ↔ b = 0

full_name: Multiset.rel_zero_right
code: @[simp]
theorem rel_zero_right {a : Multiset α} : Rel r a 0 ↔ a = 0 
goal: Multiset.Rel r a 0 ↔ a = 0

full_name: Multiset.rel_cons_left
code: theorem rel_cons_left {a as bs} :
    Rel r (a ::ₘ as) bs ↔ ∃ b bs', r a b ∧ Rel r as bs' ∧ bs = b ::ₘ bs' 
goal: Multiset.Rel r (a ::ₘ as) bs ↔ ∃ b bs', r a b ∧ Multiset.Rel r as bs' ∧ bs = b ::ₘ bs'

full_name: Multiset.rel_cons_right
code: theorem rel_cons_right {as b bs} :
    Rel r as (b ::ₘ bs) ↔ ∃ a as', r a b ∧ Rel r as' bs ∧ as = a ::ₘ as' 
goal: Multiset.Rel r as (b ::ₘ bs) ↔ ∃ a as', r a b ∧ Multiset.Rel r as' bs ∧ as = a ::ₘ as'

full_name: Multiset.rel_add_left
code: theorem rel_add_left {as₀ as₁} :
    ∀ {bs}, Rel r (as₀ + as₁) bs ↔ ∃ bs₀ bs₁, Rel r as₀ bs₀ ∧ Rel r as₁ bs₁ ∧ bs = bs₀ + bs₁ 
goal: Multiset.Rel r (as₀ + as₁) bs ↔ ∃ bs₀ bs₁, Multiset.Rel r as₀ bs₀ ∧ Multiset.Rel r as₁ bs₁ ∧ bs = bs₀ + bs₁

full_name: Multiset.rel_add_right
code: theorem rel_add_right {as bs₀ bs₁} :
    Rel r as (bs₀ + bs₁) ↔ ∃ as₀ as₁, Rel r as₀ bs₀ ∧ Rel r as₁ bs₁ ∧ as = as₀ + as₁ 
goal: Multiset.Rel r as (bs₀ + bs₁) ↔ ∃ as₀ as₁, Multiset.Rel r as₀ bs₀ ∧ Multiset.Rel r as₁ bs₁ ∧ as = as₀ + as₁

full_name: Multiset.rel_map_left
code: theorem rel_map_left {s : Multiset γ} {f : γ → α} :
    ∀ {t}, Rel r (s.map f) t ↔ Rel (fun a b => r (f a) b) s t 
goal: Multiset.Rel r (Multiset.map f s) t ↔ Multiset.Rel (fun a b => r (f a) b) s t

full_name: Multiset.rel_map_right
code: theorem rel_map_right {s : Multiset α} {t : Multiset γ} {f : γ → β} :
    Rel r s (t.map f) ↔ Rel (fun a b => r a (f b)) s t 
goal: Multiset.Rel r s (Multiset.map f t) ↔ Multiset.Rel (fun a b => r a (f b)) s t

full_name: Multiset.rel_map
code: theorem rel_map {s : Multiset α} {t : Multiset β} {f : α → γ} {g : β → δ} :
    Rel p (s.map f) (t.map g) ↔ Rel (fun a b => p (f a) (g b)) s t 
goal: Multiset.Rel p (Multiset.map f s) (Multiset.map g t) ↔ Multiset.Rel (fun a b => p (f a) (g b)) s t

full_name: Multiset.card_eq_card_of_rel
code: theorem card_eq_card_of_rel {r : α → β → Prop} {s : Multiset α} {t : Multiset β} (h : Rel r s t) :
    card s = card t 
goal: Multiset.card s = Multiset.card t

full_name: Multiset.exists_mem_of_rel_of_mem
code: theorem exists_mem_of_rel_of_mem {r : α → β → Prop} {s : Multiset α} {t : Multiset β}
    (h : Rel r s t) : ∀ {a : α}, a ∈ s → ∃ b ∈ t, r a b 
goal: a ∈ s → ∃ b ∈ t, r a b

full_name: Multiset.rel_of_forall
code: theorem rel_of_forall {m1 m2 : Multiset α} {r : α → α → Prop} (h : ∀ a b, a ∈ m1 → b ∈ m2 → r a b)
    (hc : card m1 = card m2) : m1.Rel r m2 
goal: Multiset.Rel r m1 m2

full_name: Multiset.rel_replicate_left
code: theorem rel_replicate_left {m : Multiset α} {a : α} {r : α → α → Prop} {n : ℕ} :
    (replicate n a).Rel r m ↔ card m = n ∧ ∀ x, x ∈ m → r a x 
goal: Multiset.Rel r (Multiset.replicate n a) m ↔ Multiset.card m = n ∧ ∀ x ∈ m, r a x

full_name: Multiset.rel_replicate_right
code: theorem rel_replicate_right {m : Multiset α} {a : α} {r : α → α → Prop} {n : ℕ} :
    m.Rel r (replicate n a) ↔ card m = n ∧ ∀ x, x ∈ m → r x a 
goal: Multiset.Rel r m (Multiset.replicate n a) ↔ Multiset.card m = n ∧ ∀ x ∈ m, r x a

full_name: Multiset.Rel.trans
code: protected nonrec -- Porting note: added
theorem Rel.trans (r : α → α → Prop) [IsTrans α r] {s t u : Multiset α} (r1 : Rel r s t)
    (r2 : Rel r t u) : Rel r s u 
goal: Multiset.Rel r s u

full_name: Multiset.Rel.countP_eq
code: theorem Rel.countP_eq (r : α → α → Prop) [IsTrans α r] [IsSymm α r] {s t : Multiset α} (x : α)
    [DecidablePred (r x)] (h : Rel r s t) : countP (r x) s = countP (r x) t 
goal: Multiset.countP (r x) s = Multiset.countP (r x) t

full_name: Multiset.map_eq_map
code: theorem map_eq_map {f : α → β} (hf : Function.Injective f) {s t : Multiset α} :
    s.map f = t.map f ↔ s = t 
goal: Multiset.map f s = Multiset.map f t ↔ s = t

full_name: Multiset.map_injective
code: theorem map_injective {f : α → β} (hf : Function.Injective f) :
    Function.Injective (Multiset.map f) 
goal: Function.Injective (Multiset.map f)

full_name: Multiset.filter_attach'
code: lemma filter_attach' (s : Multiset α) (p : {a // a ∈ s} → Prop) [DecidableEq α]
    [DecidablePred p] :
    s.attach.filter p =
      (s.filter fun x ↦ ∃ h, p ⟨x, h⟩).attach.map (Subtype.map id fun x ↦ mem_of_mem_filter) 
goal: Multiset.filter p s.attach =
  Multiset.map (Subtype.map id ⋯) (Multiset.filter (fun x => ∃ (h : x ∈ s), p ⟨x, h⟩) s).attach

full_name: Multiset.map_mk_eq_map_mk_of_rel
code: theorem map_mk_eq_map_mk_of_rel {r : α → α → Prop} {s t : Multiset α} (hst : s.Rel r t) :
    s.map (Quot.mk r) = t.map (Quot.mk r) 
goal: Multiset.map (Quot.mk r) s = Multiset.map (Quot.mk r) t

full_name: Multiset.exists_multiset_eq_map_quot_mk
code: theorem exists_multiset_eq_map_quot_mk {r : α → α → Prop} (s : Multiset (Quot r)) :
    ∃ t : Multiset α, s = t.map (Quot.mk r) 
goal: ∃ t, s = Multiset.map (Quot.mk r) t

full_name: Multiset.induction_on_multiset_quot
code: theorem induction_on_multiset_quot {r : α → α → Prop} {p : Multiset (Quot r) → Prop}
    (s : Multiset (Quot r)) : (∀ s : Multiset α, p (s.map (Quot.mk r))) → p s 
goal: (∀ (s : Multiset α), p (Multiset.map (Quot.mk r) s)) → p s

full_name: Multiset.Disjoint
code: /-- `Disjoint s t` means that `s` and `t` have no elements in common. -/
def Disjoint (s t : Multiset α) : Prop 
goal: Prop

full_name: Multiset.coe_disjoint
code: @[simp]
theorem coe_disjoint (l₁ l₂ : List α) : @Disjoint α l₁ l₂ ↔ l₁.Disjoint l₂ 
goal: (↑l₁).Disjoint ↑l₂ ↔ l₁.Disjoint l₂

full_name: Multiset.Disjoint.symm
code: @[symm]
theorem Disjoint.symm {s t : Multiset α} (d : Disjoint s t) : Disjoint t s
  
goal: t.Disjoint s

full_name: Multiset.disjoint_comm
code: theorem disjoint_comm {s t : Multiset α} : Disjoint s t ↔ Disjoint t s 
goal: s.Disjoint t ↔ t.Disjoint s

full_name: Multiset.disjoint_left
code: theorem disjoint_left {s t : Multiset α} : Disjoint s t ↔ ∀ {a}, a ∈ s → a ∉ t 
goal: s.Disjoint t ↔ ∀ {a : α}, a ∈ s → a ∉ t

full_name: Multiset.disjoint_right
code: theorem disjoint_right {s t : Multiset α} : Disjoint s t ↔ ∀ {a}, a ∈ t → a ∉ s 
goal: s.Disjoint t ↔ ∀ {a : α}, a ∈ t → a ∉ s

full_name: Multiset.disjoint_iff_ne
code: theorem disjoint_iff_ne {s t : Multiset α} : Disjoint s t ↔ ∀ a ∈ s, ∀ b ∈ t, a ≠ b 
goal: s.Disjoint t ↔ ∀ a ∈ s, ∀ b ∈ t, a ≠ b

full_name: Multiset.disjoint_of_subset_left
code: theorem disjoint_of_subset_left {s t u : Multiset α} (h : s ⊆ u) (d : Disjoint u t) : Disjoint s t
  
goal: s.Disjoint t

full_name: Multiset.disjoint_of_subset_right
code: theorem disjoint_of_subset_right {s t u : Multiset α} (h : t ⊆ u) (d : Disjoint s u) : Disjoint s t
  
goal: s.Disjoint t

full_name: Multiset.disjoint_of_le_left
code: theorem disjoint_of_le_left {s t u : Multiset α} (h : s ≤ u) : Disjoint u t → Disjoint s t 
goal: u.Disjoint t → s.Disjoint t

full_name: Multiset.disjoint_of_le_right
code: theorem disjoint_of_le_right {s t u : Multiset α} (h : t ≤ u) : Disjoint s u → Disjoint s t 
goal: s.Disjoint u → s.Disjoint t

full_name: Multiset.zero_disjoint
code: @[simp]
theorem zero_disjoint (l : Multiset α) : Disjoint 0 l
  
goal: Multiset.Disjoint 0 l

full_name: Multiset.singleton_disjoint
code: @[simp]
theorem singleton_disjoint {l : Multiset α} {a : α} : Disjoint {a} l ↔ a ∉ l 
goal: {a}.Disjoint l ↔ a ∉ l

full_name: Multiset.disjoint_singleton
code: @[simp]
theorem disjoint_singleton {l : Multiset α} {a : α} : Disjoint l {a} ↔ a ∉ l 
goal: l.Disjoint {a} ↔ a ∉ l

full_name: Multiset.disjoint_add_left
code: @[simp]
theorem disjoint_add_left {s t u : Multiset α} :
    Disjoint (s + t) u ↔ Disjoint s u ∧ Disjoint t u 
goal: (s + t).Disjoint u ↔ s.Disjoint u ∧ t.Disjoint u

full_name: Multiset.disjoint_add_right
code: @[simp]
theorem disjoint_add_right {s t u : Multiset α} :
    Disjoint s (t + u) ↔ Disjoint s t ∧ Disjoint s u 
goal: s.Disjoint (t + u) ↔ s.Disjoint t ∧ s.Disjoint u

full_name: Multiset.disjoint_cons_left
code: @[simp]
theorem disjoint_cons_left {a : α} {s t : Multiset α} :
    Disjoint (a ::ₘ s) t ↔ a ∉ t ∧ Disjoint s t 
goal: (a ::ₘ s).Disjoint t ↔ a ∉ t ∧ s.Disjoint t

full_name: Multiset.disjoint_cons_right
code: @[simp]
theorem disjoint_cons_right {a : α} {s t : Multiset α} :
    Disjoint s (a ::ₘ t) ↔ a ∉ s ∧ Disjoint s t 
goal: s.Disjoint (a ::ₘ t) ↔ a ∉ s ∧ s.Disjoint t

full_name: Multiset.inter_eq_zero_iff_disjoint
code: theorem inter_eq_zero_iff_disjoint [DecidableEq α] {s t : Multiset α} :
    s ∩ t = 0 ↔ Disjoint s t 
goal: s ∩ t = 0 ↔ s.Disjoint t

full_name: Multiset.disjoint_union_left
code: @[simp]
theorem disjoint_union_left [DecidableEq α] {s t u : Multiset α} :
    Disjoint (s ∪ t) u ↔ Disjoint s u ∧ Disjoint t u 
goal: (s ∪ t).Disjoint u ↔ s.Disjoint u ∧ t.Disjoint u

full_name: Multiset.disjoint_union_right
code: @[simp]
theorem disjoint_union_right [DecidableEq α] {s t u : Multiset α} :
    Disjoint s (t ∪ u) ↔ Disjoint s t ∧ Disjoint s u 
goal: s.Disjoint (t ∪ u) ↔ s.Disjoint t ∧ s.Disjoint u

full_name: Multiset.add_eq_union_iff_disjoint
code: theorem add_eq_union_iff_disjoint [DecidableEq α] {s t : Multiset α} :
    s + t = s ∪ t ↔ Disjoint s t 
goal: s + t = s ∪ t ↔ s.Disjoint t

full_name: Multiset.add_eq_union_left_of_le
code: lemma add_eq_union_left_of_le [DecidableEq α] {s t u : Multiset α} (h : t ≤ s) :
    u + s = u ∪ t ↔ u.Disjoint s ∧ s = t 
goal: u + s = u ∪ t ↔ u.Disjoint s ∧ s = t

full_name: Multiset.add_eq_union_right_of_le
code: lemma add_eq_union_right_of_le [DecidableEq α] {x y z : Multiset α} (h : z ≤ y) :
    x + y = x ∪ z ↔ y = z ∧ x.Disjoint y 
goal: x + y = x ∪ z ↔ y = z ∧ x.Disjoint y

full_name: Multiset.disjoint_map_map
code: theorem disjoint_map_map {f : α → γ} {g : β → γ} {s : Multiset α} {t : Multiset β} :
    Disjoint (s.map f) (t.map g) ↔ ∀ a ∈ s, ∀ b ∈ t, f a ≠ g b 
goal: (Multiset.map f s).Disjoint (Multiset.map g t) ↔ ∀ a ∈ s, ∀ b ∈ t, f a ≠ g b

full_name: Multiset.Pairwise
code: /-- `Pairwise r m` states that there exists a list of the elements s.t. `r` holds pairwise on this
list. -/
def Pairwise (r : α → α → Prop) (m : Multiset α) : Prop 
goal: Prop

full_name: Multiset.pairwise_zero
code: @[simp]
theorem pairwise_zero (r : α → α → Prop) : Multiset.Pairwise r 0 
goal: Multiset.Pairwise r 0

full_name: Multiset.pairwise_coe_iff
code: theorem pairwise_coe_iff {r : α → α → Prop} {l : List α} :
    Multiset.Pairwise r l ↔ ∃ l' : List α, l ~ l' ∧ l'.Pairwise r 
goal: Multiset.Pairwise r ↑l ↔ ∃ l', l ~ l' ∧ List.Pairwise r l'

full_name: Multiset.pairwise_coe_iff_pairwise
code: theorem pairwise_coe_iff_pairwise {r : α → α → Prop} (hr : Symmetric r) {l : List α} :
    Multiset.Pairwise r l ↔ l.Pairwise r 
goal: Multiset.Pairwise r ↑l ↔ List.Pairwise r l

full_name: Multiset.map_set_pairwise
code: theorem map_set_pairwise {f : α → β} {r : β → β → Prop} {m : Multiset α}
    (h : { a | a ∈ m }.Pairwise fun a₁ a₂ => r (f a₁) (f a₂)) : { b | b ∈ m.map f }.Pairwise r 
goal: {b | b ∈ Multiset.map f m}.Pairwise r

full_name: Multiset.chooseX
code: /-- Given a proof `hp` that there exists a unique `a ∈ l` such that `p a`, `chooseX p l hp` returns
that `a` together with proofs of `a ∈ l` and `p a`. -/
def chooseX : ∀ _hp : ∃! a, a ∈ l ∧ p a, { a // a ∈ l ∧ p a } 
goal: { a // a ∈ l ∧ p a }

full_name: Multiset.choose
code: /-- Given a proof `hp` that there exists a unique `a ∈ l` such that `p a`, `choose p l hp` returns
that `a`. -/
def choose (hp : ∃! a, a ∈ l ∧ p a) : α 
goal: α

full_name: Multiset.choose_spec
code: theorem choose_spec (hp : ∃! a, a ∈ l ∧ p a) : choose p l hp ∈ l ∧ p (choose p l hp) 
goal: Multiset.choose p l hp ∈ l ∧ p (Multiset.choose p l hp)

full_name: Multiset.choose_mem
code: theorem choose_mem (hp : ∃! a, a ∈ l ∧ p a) : choose p l hp ∈ l 
goal: Multiset.choose p l hp ∈ l

full_name: Multiset.choose_property
code: theorem choose_property (hp : ∃! a, a ∈ l ∧ p a) : p (choose p l hp) 
goal: p (Multiset.choose p l hp)

full_name: Multiset.subsingletonEquiv
code: /-- The equivalence between lists and multisets of a subsingleton type. -/
def subsingletonEquiv [Subsingleton α] : List α ≃ Multiset α 
goal: List α ≃ Multiset α

full_name: Multiset.coe_subsingletonEquiv
code: @[simp]
theorem coe_subsingletonEquiv [Subsingleton α] :
    (subsingletonEquiv α : List α → Multiset α) = ofList 
goal: ⇑(Multiset.subsingletonEquiv α) = Multiset.ofList