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}
[DecidableEq α]
{a : α}
{l : List α}
(h : a ∈ l.dedup)
:
theorem
List.dedup_cons_of_not_mem'
{α : Type u}
[DecidableEq α]
{a : α}
{l : List α}
(h : a ∉ l.dedup)
:
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
List.replicate_dedup
{α : Type u}
[DecidableEq α]
{x : α}
{k : ℕ}
:
k ≠ 0 → (List.replicate k x).dedup = [x]
theorem
List.count_dedup
{α : Type u}
[DecidableEq α]
(l : List α)
(a : α)
:
List.count a l.dedup = if a ∈ l then 1 else 0