List duplicates #
Main definitions #
List.Duplicate x l : Propis an inductive property that holds whenxis a duplicate inl
Implementation details #
In this file, x ∈+ l notation is shorthand for List.Duplicate x l.
theorem
List.Mem.duplicate_cons_self
{α : Type u_1}
{l : List α}
{x : α}
(h : x ∈ l)
:
Duplicate x (x :: l)
theorem
List.Duplicate.duplicate_cons
{α : Type u_1}
{l : List α}
{x : α}
(h : Duplicate x l)
(y : α)
:
Duplicate x (y :: l)
theorem
List.Duplicate.mem_cons_self
{α : Type u_1}
{l : List α}
{x : α}
(h : Duplicate x (x :: l))
:
x ∈ l
@[simp]
theorem
List.duplicate_cons_self_iff
{α : Type u_1}
{l : List α}
{x : α}
:
Duplicate x (x :: l) ↔ x ∈ l
theorem
List.Duplicate.ne_singleton
{α : Type u_1}
{l : List α}
{x : α}
(h : Duplicate x l)
(y : α)
:
l ≠ [y]
@[simp]
theorem
List.Duplicate.of_duplicate_cons
{α : Type u_1}
{l : List α}
{x y : α}
(h : Duplicate x (y :: l))
(hx : x ≠ y)
:
Duplicate x l
theorem
List.Duplicate.mono_sublist
{α : Type u_1}
{l : List α}
{x : α}
{l' : List α}
(hx : Duplicate x l)
(h : l.Sublist l')
:
Duplicate x l'
theorem
List.duplicate_iff_sublist
{α : Type u_1}
{l : List α}
{x : α}
:
Duplicate x l ↔ [x, x].Sublist l
The contrapositive of List.nodup_iff_sublist.
theorem
List.nodup_iff_forall_not_duplicate
{α : Type u_1}
{l : List α}
:
l.Nodup ↔ ∀ (x : α), ¬Duplicate x l
theorem
List.exists_duplicate_iff_not_nodup
{α : Type u_1}
{l : List α}
:
(∃ (x : α), Duplicate x l) ↔ ¬l.Nodup
@[implicit_reducible]
instance
List.decidableDuplicate
{α : Type u_1}
[DecidableEq α]
(x : α)
(l : List α)
:
Decidable (Duplicate x l)