Erasure of duplicates in a list #
This file proves basic results about List.dedup
(definition in Data.List.Defs
).
dedup l
returns l
without its duplicates. It keeps the earliest (that is, rightmost)
occurrence of each.
Tags #
duplicate, multiplicity, nodup, nub
theorem
List.dedup_cons_of_mem'
{α : Type u_1}
[DecidableEq α]
{a : α}
{l : List α}
(h : a ∈ l.dedup)
:
theorem
List.dedup_cons_of_not_mem'
{α : Type u_1}
[DecidableEq α]
{a : α}
{l : List α}
(h : a ∉ l.dedup)
:
@[simp]
@[simp]
@[simp]
theorem
List.dedup_cons_of_not_mem
{α : Type u_1}
[DecidableEq α]
{a : α}
{l : List α}
(h : a ∉ l)
:
@[simp]
@[simp]
theorem
List.dedup_map_of_injective
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
{f : α → β}
(hf : Function.Injective f)
(xs : List α)
:
theorem
List.Subset.dedup_append_right
{α : Type u_1}
[DecidableEq α]
{xs : List α}
{ys : List α}
(h : xs ⊆ ys)
:
Note that the weaker List.Subset.dedup_append_left
is proved later.
theorem
List.Disjoint.union_eq
{α : Type u_1}
[DecidableEq α]
{xs : List α}
{ys : List α}
(h : xs.Disjoint ys)
:
theorem
List.Disjoint.dedup_append
{α : Type u_1}
[DecidableEq α]
{xs : List α}
{ys : List α}
(h : xs.Disjoint ys)
:
theorem
List.replicate_dedup
{α : Type u_1}
[DecidableEq α]
{x : α}
{k : ℕ}
:
k ≠ 0 → (List.replicate k x).dedup = [x]
theorem
List.count_dedup
{α : Type u_1}
[DecidableEq α]
(l : List α)
(a : α)
:
List.count a l.dedup = if a ∈ l then 1 else 0