Erasing duplicates in a multiset. #
dedup #
dedup s
removes duplicates from s
, yielding a nodup
multiset.
Equations
- s.dedup = Quot.liftOn s (fun (l : List α) => ↑l.dedup) ⋯
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
Alias of the reverse direction of Multiset.dedup_eq_self
.
theorem
Multiset.count_dedup
{α : Type u_1}
[DecidableEq α]
(m : Multiset α)
(a : α)
:
Multiset.count a m.dedup = if a ∈ m then 1 else 0
@[simp]
theorem
Multiset.dedup_idem
{α : Type u_1}
[DecidableEq α]
{m : Multiset α}
:
m.dedup.dedup = m.dedup
@[simp]
theorem
Multiset.dedup_map_of_injective
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
{f : α → β}
(hf : Function.Injective f)
(s : Multiset α)
:
(Multiset.map f s).dedup = Multiset.map f s.dedup
theorem
Multiset.dedup_map_dedup_eq
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
(f : α → β)
(s : Multiset α)
:
(Multiset.map f s.dedup).dedup = (Multiset.map f s).dedup
@[simp]
theorem
Multiset.Nodup.le_dedup_iff_le
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
(hno : s.Nodup)
:
theorem
Multiset.Subset.dedup_add_right
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
(h : s ⊆ t)
:
theorem
Multiset.Subset.dedup_add_left
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
(h : t ⊆ s)
:
theorem
Multiset.Disjoint.dedup_add
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
(h : Disjoint s t)
:
theorem
List.Subset.dedup_append_left
{α : Type u_1}
[DecidableEq α]
{s : List α}
{t : List α}
(h : t ⊆ s)
:
(s ++ t).dedup.Perm s.dedup
Note that the stronger List.Subset.dedup_append_right
is proved earlier.