Multisets form an ordered monoid #
This file contains the ordered monoid instance on multisets, and lemmas related to it.
See note [foundational algebra order theory].
Additive monoid #
Cardinality #
Multiset.card
bundled as a group hom.
Equations
- Multiset.cardHom = { toFun := Multiset.card, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Multiset.replicate
as an AddMonoidHom
.
Equations
- Multiset.replicateAddMonoidHom a = { toFun := fun (n : ℕ) => Multiset.replicate n a, map_zero' := ⋯, map_add' := ⋯ }
Instances For
@[simp]
Multiset.map
as an AddMonoidHom
.
Equations
- Multiset.mapAddMonoidHom f = { toFun := Multiset.map f, map_zero' := ⋯, map_add' := ⋯ }
Instances For
@[simp]
@[simp]
Subtraction #
countP #
countP p
, the number of elements of a multiset satisfying p
, promoted to an
AddMonoidHom
.
Equations
- Multiset.countPAddMonoidHom p = { toFun := Multiset.countP p, map_zero' := ⋯, map_add' := ⋯ }
Instances For
@[simp]
Multiplicity of an element #
count a
, the multiplicity of a
in a multiset, promoted to an AddMonoidHom
.
Equations
- Multiset.countAddMonoidHom a = Multiset.countPAddMonoidHom fun (x : α) => a = x
Instances For
@[simp]