Erasing duplicates in a multiset. #
dedup #
dedup s
removes duplicates from s
, yielding a nodup
multiset.
Equations
- Multiset.dedup s = Quot.liftOn s (fun (l : List α) => ↑(List.dedup l)) (_ : ∀ (x x_1 : List α), Setoid.r x x_1 → Quot.mk Setoid.r (List.dedup x) = Quot.mk Setoid.r (List.dedup x_1))
Instances For
@[simp]
theorem
Multiset.coe_dedup
{α : Type u_1}
[DecidableEq α]
(l : List α)
:
Multiset.dedup ↑l = ↑(List.dedup l)
@[simp]
theorem
Multiset.mem_dedup
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
:
a ∈ Multiset.dedup s ↔ a ∈ s
@[simp]
theorem
Multiset.dedup_cons_of_mem
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
:
a ∈ s → Multiset.dedup (a ::ₘ s) = Multiset.dedup s
@[simp]
theorem
Multiset.dedup_cons_of_not_mem
{α : Type u_1}
[DecidableEq α]
{a : α}
{s : Multiset α}
:
a ∉ s → Multiset.dedup (a ::ₘ s) = a ::ₘ Multiset.dedup s
@[simp]
theorem
Multiset.dedup_subset'
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
:
Multiset.dedup s ⊆ t ↔ s ⊆ t
@[simp]
theorem
Multiset.subset_dedup'
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
:
s ⊆ Multiset.dedup t ↔ s ⊆ t
@[simp]
theorem
Multiset.dedup_eq_self
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
:
Multiset.dedup s = s ↔ Multiset.Nodup s
theorem
Multiset.Nodup.dedup
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
:
Multiset.Nodup s → Multiset.dedup s = s
Alias of the reverse direction of Multiset.dedup_eq_self
.
theorem
Multiset.count_dedup
{α : Type u_1}
[DecidableEq α]
(m : Multiset α)
(a : α)
:
Multiset.count a (Multiset.dedup m) = if a ∈ m then 1 else 0
@[simp]
@[simp]
theorem
Multiset.dedup_bind_dedup
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
(m : Multiset α)
(f : α → Multiset β)
:
Multiset.dedup (Multiset.bind (Multiset.dedup m) f) = Multiset.dedup (Multiset.bind m f)
theorem
Multiset.dedup_eq_zero
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
:
Multiset.dedup s = 0 ↔ s = 0
@[simp]
theorem
Multiset.le_dedup
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
:
s ≤ Multiset.dedup t ↔ s ≤ t ∧ Multiset.Nodup s
theorem
Multiset.le_dedup_self
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
:
s ≤ Multiset.dedup s ↔ Multiset.Nodup s
theorem
Multiset.dedup_ext
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
:
Multiset.dedup s = Multiset.dedup t ↔ ∀ (a : α), a ∈ s ↔ a ∈ t
theorem
Multiset.dedup_map_dedup_eq
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
(f : α → β)
(s : Multiset α)
:
Multiset.dedup (Multiset.map f (Multiset.dedup s)) = Multiset.dedup (Multiset.map f s)
@[simp]
theorem
Multiset.dedup_nsmul
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{n : ℕ}
(h0 : n ≠ 0)
:
Multiset.dedup (n • s) = Multiset.dedup s
theorem
Multiset.Nodup.le_dedup_iff_le
{α : Type u_1}
[DecidableEq α]
{s : Multiset α}
{t : Multiset α}
(hno : Multiset.Nodup s)
:
s ≤ Multiset.dedup t ↔ s ≤ t