List duplicates #
Main definitions #
List.Duplicate x l : Prop
is an inductive property that holds whenx
is a duplicate inl
Implementation details #
In this file, x ∈+ l
notation is shorthand for List.Duplicate x l
.
- cons_mem: ∀ {α : Type u_1} {x : α} {l : List α}, x ∈ l → List.Duplicate x (x :: l)
- cons_duplicate: ∀ {α : Type u_1} {x y : α} {l : List α}, List.Duplicate x l → List.Duplicate x (y :: l)
Property that an element x : α
of l : List α
can be found in the list more than once.
Instances For
theorem
List.Mem.duplicate_cons_self
{α : Type u_1}
{l : List α}
{x : α}
(h : x ∈ l)
:
List.Duplicate x (x :: l)
theorem
List.Duplicate.duplicate_cons
{α : Type u_1}
{l : List α}
{x : α}
(h : List.Duplicate x l)
(y : α)
:
List.Duplicate x (y :: l)
theorem
List.Duplicate.mem_cons_self
{α : Type u_1}
{l : List α}
{x : α}
(h : List.Duplicate x (x :: l))
:
x ∈ l
@[simp]
theorem
List.duplicate_cons_self_iff
{α : Type u_1}
{l : List α}
{x : α}
:
List.Duplicate x (x :: l) ↔ x ∈ l
theorem
List.Duplicate.ne_singleton
{α : Type u_1}
{l : List α}
{x : α}
(h : List.Duplicate x l)
(y : α)
:
l ≠ [y]
@[simp]
theorem
List.duplicate_cons_iff
{α : Type u_1}
{l : List α}
{x : α}
{y : α}
:
List.Duplicate x (y :: l) ↔ y = x ∧ x ∈ l ∨ List.Duplicate x l
theorem
List.Duplicate.of_duplicate_cons
{α : Type u_1}
{l : List α}
{x : α}
{y : α}
(h : List.Duplicate x (y :: l))
(hx : x ≠ y)
:
List.Duplicate x l
theorem
List.duplicate_cons_iff_of_ne
{α : Type u_1}
{l : List α}
{x : α}
{y : α}
(hne : x ≠ y)
:
List.Duplicate x (y :: l) ↔ List.Duplicate x l
theorem
List.Duplicate.mono_sublist
{α : Type u_1}
{l : List α}
{x : α}
{l' : List α}
(hx : List.Duplicate x l)
(h : List.Sublist l l')
:
List.Duplicate x l'
theorem
List.duplicate_iff_sublist
{α : Type u_1}
{l : List α}
{x : α}
:
List.Duplicate x l ↔ List.Sublist [x, x] l
The contrapositive of List.nodup_iff_sublist
.
theorem
List.nodup_iff_forall_not_duplicate
{α : Type u_1}
{l : List α}
:
List.Nodup l ↔ ∀ (x : α), ¬List.Duplicate x l
theorem
List.exists_duplicate_iff_not_nodup
{α : Type u_1}
{l : List α}
:
(∃ x, List.Duplicate x l) ↔ ¬List.Nodup l
theorem
List.duplicate_iff_two_le_count
{α : Type u_1}
{l : List α}
{x : α}
[DecidableEq α]
:
List.Duplicate x l ↔ 2 ≤ List.count x l
instance
List.decidableDuplicate
{α : Type u_1}
[DecidableEq α]
(x : α)
(l : List α)
:
Decidable (List.Duplicate x l)
Equations
- One or more equations did not get rendered due to their size.
- List.decidableDuplicate x [] = isFalse (_ : ¬List.Duplicate x [])