File: Mathlib/Data/List/Nodup.lean

full_name: List.forall_mem_ne
code: @[simp]
theorem forall_mem_ne {a : α} {l : List α} : (∀ a' : α, a' ∈ l → ¬a = a') ↔ a ∉ l 
goal: (∀ a' ∈ l, ¬a = a') ↔ a ∉ l

full_name: List.nodup_nil
code: @[simp]
theorem nodup_nil : @Nodup α [] 
goal: [].Nodup

full_name: List.nodup_cons
code: @[simp]
theorem nodup_cons {a : α} {l : List α} : Nodup (a :: l) ↔ a ∉ l ∧ Nodup l 
goal: (a :: l).Nodup ↔ a ∉ l ∧ l.Nodup

full_name: List.Pairwise.nodup
code: protected theorem Pairwise.nodup {l : List α} {r : α → α → Prop} [IsIrrefl α r] (h : Pairwise r l) :
    Nodup l 
goal: l.Nodup

full_name: List.rel_nodup
code: theorem rel_nodup {r : α → β → Prop} (hr : Relator.BiUnique r) : (Forall₂ r ⇒ (· ↔ ·)) Nodup Nodup
  
goal: (List.Forall₂ r ⇒ fun x x_1 => x ↔ x_1) List.Nodup List.Nodup

full_name: List.Nodup.cons
code: protected theorem Nodup.cons (ha : a ∉ l) (hl : Nodup l) : Nodup (a :: l) 
goal: (a :: l).Nodup

full_name: List.nodup_singleton
code: theorem nodup_singleton (a : α) : Nodup [a] 
goal: [a].Nodup

full_name: List.Nodup.of_cons
code: theorem Nodup.of_cons (h : Nodup (a :: l)) : Nodup l 
goal: l.Nodup

full_name: List.Nodup.not_mem
code: theorem Nodup.not_mem (h : (a :: l).Nodup) : a ∉ l 
goal: a ∉ l

full_name: List.not_nodup_cons_of_mem
code: theorem not_nodup_cons_of_mem : a ∈ l → ¬Nodup (a :: l) 
goal: a ∈ l → ¬(a :: l).Nodup

full_name: List.Nodup.sublist
code: protected theorem Nodup.sublist : l₁ <+ l₂ → Nodup l₂ → Nodup l₁ 
goal: l₁.Sublist l₂ → l₂.Nodup → l₁.Nodup

full_name: List.not_nodup_pair
code: theorem not_nodup_pair (a : α) : ¬Nodup [a, a] 
goal: ¬[a, a].Nodup

full_name: List.nodup_iff_sublist
code: theorem nodup_iff_sublist {l : List α} : Nodup l ↔ ∀ a, ¬[a, a] <+ l 
goal: l.Nodup ↔ ∀ (a : α), ¬[a, a].Sublist l

full_name: List.nodup_iff_injective_getElem
code: theorem nodup_iff_injective_getElem {l : List α} :
    Nodup l ↔ Function.Injective (fun i : Fin l.length => l[i.1]) 
goal: l.Nodup ↔ Function.Injective fun i => l[↑i]

full_name: List.nodup_iff_injective_get
code: theorem nodup_iff_injective_get {l : List α} :
    Nodup l ↔ Function.Injective l.get 
goal: l.Nodup ↔ Function.Injective l.get

full_name: List.nodup_iff_nthLe_inj
code: @[deprecated nodup_iff_injective_get (since := "2023-01-10")]
theorem nodup_iff_nthLe_inj {l : List α} :
    Nodup l ↔ ∀ i j h₁ h₂, nthLe l i h₁ = nthLe l j h₂ → i = j 
goal: l.Nodup ↔ ∀ (i j : ℕ) (h₁ : i < l.length) (h₂ : j < l.length), l.nthLe i h₁ = l.nthLe j h₂ → i = j

full_name: List.Nodup.get_inj_iff
code: theorem Nodup.get_inj_iff {l : List α} (h : Nodup l) {i j : Fin l.length} :
    l.get i = l.get j ↔ i = j 
goal: l.get i = l.get j ↔ i = j

full_name: List.Nodup.getElem_inj_iff
code: theorem Nodup.getElem_inj_iff {l : List α} (h : Nodup l)
    {i : Nat} {hi : i < l.length} {j : Nat} {hj : j < l.length} :
    l[i] = l[j] ↔ i = j 
goal: l[i] = l[j] ↔ i = j

full_name: List.Nodup.nthLe_inj_iff
code: @[deprecated Nodup.get_inj_iff (since := "2023-01-10")]
theorem Nodup.nthLe_inj_iff {l : List α} (h : Nodup l) {i j : ℕ} (hi : i < l.length)
    (hj : j < l.length) : l.nthLe i hi = l.nthLe j hj ↔ i = j 
goal: l.nthLe i hi = l.nthLe j hj ↔ i = j

full_name: List.nodup_iff_getElem?_ne_getElem?
code: theorem nodup_iff_getElem?_ne_getElem? {l : List α} :
    l.Nodup ↔ ∀ i j : ℕ, i < j → j < l.length → l[i]? ≠ l[j]? 
goal: l.Nodup ↔ ∀ (i j : ℕ), i < j → j < l.length → l[i]? ≠ l[j]?

full_name: List.nodup_iff_get?_ne_get?
code: theorem nodup_iff_get?_ne_get? {l : List α} :
    l.Nodup ↔ ∀ i j : ℕ, i < j → j < l.length → l.get? i ≠ l.get? j 
goal: l.Nodup ↔ ∀ (i j : ℕ), i < j → j < l.length → l.get? i ≠ l.get? j

full_name: List.Nodup.ne_singleton_iff
code: theorem Nodup.ne_singleton_iff {l : List α} (h : Nodup l) (x : α) :
    l ≠ [x] ↔ l = [] ∨ ∃ y ∈ l, y ≠ x 
goal: l ≠ [x] ↔ l = [] ∨ ∃ y ∈ l, y ≠ x

full_name: List.not_nodup_of_get_eq_of_ne
code: theorem not_nodup_of_get_eq_of_ne (xs : List α) (n m : Fin xs.length)
    (h : xs.get n = xs.get m) (hne : n ≠ m) : ¬Nodup xs 
goal: ¬xs.Nodup

full_name: List.indexOf_getElem
code: theorem indexOf_getElem [DecidableEq α] {l : List α} (H : Nodup l) (i : Nat) (h : i < l.length) :
    indexOf l[i] l = i 
goal: List.indexOf l[i] l = i

full_name: List.get_indexOf
code: theorem get_indexOf [DecidableEq α] {l : List α} (H : Nodup l) (i : Fin l.length) :
    indexOf (get l i) l = i 
goal: List.indexOf (l.get i) l = ↑i

full_name: List.nodup_iff_count_le_one
code: theorem nodup_iff_count_le_one [DecidableEq α] {l : List α} : Nodup l ↔ ∀ a, count a l ≤ 1 
goal: l.Nodup ↔ ∀ (a : α), List.count a l ≤ 1

full_name: List.nodup_iff_count_eq_one
code: theorem nodup_iff_count_eq_one [DecidableEq α] : Nodup l ↔ ∀ a ∈ l, count a l = 1 
goal: l.Nodup ↔ ∀ a ∈ l, List.count a l = 1

full_name: List.nodup_replicate
code: theorem nodup_replicate (a : α) : ∀ {n : ℕ}, Nodup (replicate n a) ↔ n ≤ 1
  
goal: (List.replicate n a).Nodup ↔ n ≤ 1

full_name: List.count_eq_one_of_mem
code: @[simp]
theorem count_eq_one_of_mem [DecidableEq α] {a : α} {l : List α} (d : Nodup l) (h : a ∈ l) :
    count a l = 1 
goal: List.count a l = 1

full_name: List.count_eq_of_nodup
code: theorem count_eq_of_nodup [DecidableEq α] {a : α} {l : List α} (d : Nodup l) :
    count a l = if a ∈ l then 1 else 0 
goal: List.count a l = if a ∈ l then 1 else 0

full_name: List.Nodup.of_append_left
code: theorem Nodup.of_append_left : Nodup (l₁ ++ l₂) → Nodup l₁ 
goal: (l₁ ++ l₂).Nodup → l₁.Nodup

full_name: List.Nodup.of_append_right
code: theorem Nodup.of_append_right : Nodup (l₁ ++ l₂) → Nodup l₂ 
goal: (l₁ ++ l₂).Nodup → l₂.Nodup

full_name: List.nodup_append
code: theorem nodup_append {l₁ l₂ : List α} :
    Nodup (l₁ ++ l₂) ↔ Nodup l₁ ∧ Nodup l₂ ∧ Disjoint l₁ l₂ 
goal: (l₁ ++ l₂).Nodup ↔ l₁.Nodup ∧ l₂.Nodup ∧ l₁.Disjoint l₂

full_name: List.disjoint_of_nodup_append
code: theorem disjoint_of_nodup_append {l₁ l₂ : List α} (d : Nodup (l₁ ++ l₂)) : Disjoint l₁ l₂ 
goal: l₁.Disjoint l₂

full_name: List.Nodup.append
code: theorem Nodup.append (d₁ : Nodup l₁) (d₂ : Nodup l₂) (dj : Disjoint l₁ l₂) : Nodup (l₁ ++ l₂) 
goal: (l₁ ++ l₂).Nodup

full_name: List.nodup_append_comm
code: theorem nodup_append_comm {l₁ l₂ : List α} : Nodup (l₁ ++ l₂) ↔ Nodup (l₂ ++ l₁) 
goal: (l₁ ++ l₂).Nodup ↔ (l₂ ++ l₁).Nodup

full_name: List.nodup_middle
code: theorem nodup_middle {a : α} {l₁ l₂ : List α} :
    Nodup (l₁ ++ a :: l₂) ↔ Nodup (a :: (l₁ ++ l₂)) 
goal: (l₁ ++ a :: l₂).Nodup ↔ (a :: (l₁ ++ l₂)).Nodup

full_name: List.Nodup.of_map
code: theorem Nodup.of_map (f : α → β) {l : List α} : Nodup (map f l) → Nodup l 
goal: (List.map f l).Nodup → l.Nodup

full_name: List.Nodup.map_on
code: theorem Nodup.map_on {f : α → β} (H : ∀ x ∈ l, ∀ y ∈ l, f x = f y → x = y) (d : Nodup l) :
    (map f l).Nodup 
goal: (List.map f l).Nodup

full_name: List.inj_on_of_nodup_map
code: theorem inj_on_of_nodup_map {f : α → β} {l : List α} (d : Nodup (map f l)) :
    ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → f x = f y → x = y 
goal: x ∈ l → ∀ ⦃y : α⦄, y ∈ l → f x = f y → x = y

full_name: List.nodup_map_iff_inj_on
code: theorem nodup_map_iff_inj_on {f : α → β} {l : List α} (d : Nodup l) :
    Nodup (map f l) ↔ ∀ x ∈ l, ∀ y ∈ l, f x = f y → x = y 
goal: (List.map f l).Nodup ↔ ∀ x ∈ l, ∀ y ∈ l, f x = f y → x = y

full_name: List.Nodup.map
code: protected theorem Nodup.map {f : α → β} (hf : Injective f) : Nodup l → Nodup (map f l) 
goal: l.Nodup → (List.map f l).Nodup

full_name: List.nodup_map_iff
code: theorem nodup_map_iff {f : α → β} {l : List α} (hf : Injective f) : Nodup (map f l) ↔ Nodup l 
goal: (List.map f l).Nodup ↔ l.Nodup

full_name: List.nodup_attach
code: @[simp]
theorem nodup_attach {l : List α} : Nodup (attach l) ↔ Nodup l 
goal: l.attach.Nodup ↔ l.Nodup

full_name: List.Nodup.pmap
code: theorem Nodup.pmap {p : α → Prop} {f : ∀ a, p a → β} {l : List α} {H}
    (hf : ∀ a ha b hb, f a ha = f b hb → a = b) (h : Nodup l) : Nodup (pmap f l H) 
goal: (List.pmap f l H).Nodup

full_name: List.Nodup.filter
code: theorem Nodup.filter (p : α → Bool) {l} : Nodup l → Nodup (filter p l) 
goal: l.Nodup → (List.filter p l).Nodup

full_name: List.nodup_reverse
code: @[simp]
theorem nodup_reverse {l : List α} : Nodup (reverse l) ↔ Nodup l 
goal: l.reverse.Nodup ↔ l.Nodup

full_name: List.Nodup.erase_eq_filter
code: theorem Nodup.erase_eq_filter [DecidableEq α] {l} (d : Nodup l) (a : α) :
    l.erase a = l.filter (· ≠ a) 
goal: l.erase a = List.filter (fun x => decide (x ≠ a)) l

full_name: List.Nodup.erase
code: theorem Nodup.erase [DecidableEq α] (a : α) : Nodup l → Nodup (l.erase a) 
goal: l.Nodup → (l.erase a).Nodup

full_name: List.Nodup.erase_getElem
code: theorem Nodup.erase_getElem [DecidableEq α] {l : List α} (hl : l.Nodup)
    (i : Nat) (h : i < l.length) : l.erase l[i] = l.eraseIdx ↑i 
goal: l.erase l[i] = l.eraseIdx i

full_name: List.Nodup.erase_get
code: theorem Nodup.erase_get [DecidableEq α] {l : List α} (hl : l.Nodup) (i : Fin l.length) :
    l.erase (l.get i) = l.eraseIdx ↑i 
goal: l.erase (l.get i) = l.eraseIdx ↑i

full_name: List.Nodup.diff
code: theorem Nodup.diff [DecidableEq α] : l₁.Nodup → (l₁.diff l₂).Nodup 
goal: l₁.Nodup → (l₁.diff l₂).Nodup

full_name: List.Nodup.mem_erase_iff
code: theorem Nodup.mem_erase_iff [DecidableEq α] (d : Nodup l) : a ∈ l.erase b ↔ a ≠ b ∧ a ∈ l 
goal: a ∈ l.erase b ↔ a ≠ b ∧ a ∈ l

full_name: List.Nodup.not_mem_erase
code: theorem Nodup.not_mem_erase [DecidableEq α] (h : Nodup l) : a ∉ l.erase a 
goal: a ∉ l.erase a

full_name: List.nodup_join
code: theorem nodup_join {L : List (List α)} :
    Nodup (join L) ↔ (∀ l ∈ L, Nodup l) ∧ Pairwise Disjoint L 
goal: L.join.Nodup ↔ (∀ l ∈ L, l.Nodup) ∧ List.Pairwise List.Disjoint L

full_name: List.nodup_bind
code: theorem nodup_bind {l₁ : List α} {f : α → List β} :
    Nodup (l₁.bind f) ↔
      (∀ x ∈ l₁, Nodup (f x)) ∧ Pairwise (fun a b : α => Disjoint (f a) (f b)) l₁ 
goal: (l₁.bind f).Nodup ↔ (∀ x ∈ l₁, (f x).Nodup) ∧ List.Pairwise (fun a b => (f a).Disjoint (f b)) l₁

full_name: List.Nodup.product
code: protected theorem Nodup.product {l₂ : List β} (d₁ : l₁.Nodup) (d₂ : l₂.Nodup) :
    (l₁ ×ˢ l₂).Nodup 
goal: (l₁ ×ˢ l₂).Nodup

full_name: List.Nodup.sigma
code: theorem Nodup.sigma {σ : α → Type*} {l₂ : ∀ a , List (σ a)} (d₁ : Nodup l₁)
    (d₂ : ∀ a , Nodup (l₂ a)) : (l₁.sigma l₂).Nodup 
goal: (l₁.sigma l₂).Nodup

full_name: List.Nodup.filterMap
code: protected theorem Nodup.filterMap {f : α → Option β} (h : ∀ a a' b, b ∈ f a → b ∈ f a' → a = a') :
    Nodup l → Nodup (filterMap f l) 
goal: l.Nodup → (List.filterMap f l).Nodup

full_name: List.Nodup.concat
code: protected theorem Nodup.concat (h : a ∉ l) (h' : l.Nodup) : (l.concat a).Nodup 
goal: (l.concat a).Nodup

full_name: List.Nodup.insert
code: protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup 
goal: (List.insert a l).Nodup

full_name: List.Nodup.union
code: theorem Nodup.union [DecidableEq α] (l₁ : List α) (h : Nodup l₂) : (l₁ ∪ l₂).Nodup 
goal: (l₁ ∪ l₂).Nodup

full_name: List.Nodup.inter
code: theorem Nodup.inter [DecidableEq α] (l₂ : List α) : Nodup l₁ → Nodup (l₁ ∩ l₂) 
goal: l₁.Nodup → (l₁ ∩ l₂).Nodup

full_name: List.Nodup.diff_eq_filter
code: theorem Nodup.diff_eq_filter [DecidableEq α] :
    ∀ {l₁ l₂ : List α} (_ : l₁.Nodup), l₁.diff l₂ = l₁.filter (· ∉ l₂)
  
goal: l₁.Nodup → l₁.diff l₂ = List.filter (fun x => decide (x ∉ l₂)) l₁

full_name: List.Nodup.mem_diff_iff
code: theorem Nodup.mem_diff_iff [DecidableEq α] (hl₁ : l₁.Nodup) : a ∈ l₁.diff l₂ ↔ a ∈ l₁ ∧ a ∉ l₂ 
goal: a ∈ l₁.diff l₂ ↔ a ∈ l₁ ∧ a ∉ l₂

full_name: List.Nodup.set
code: protected theorem Nodup.set :
    ∀ {l : List α} {n : ℕ} {a : α} (_ : l.Nodup) (_ : a ∉ l), (l.set n a).Nodup
  
goal: l.Nodup → a ∉ l → (l.set n a).Nodup

full_name: List.Nodup.map_update
code: theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f 
goal: List.map (Function.update f x y) l = if x ∈ l then (List.map f l).set (List.indexOf x l) y else List.map f l

full_name: List.Nodup.pairwise_of_forall_ne
code: theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r 
goal: List.Pairwise r l

full_name: List.Nodup.pairwise_of_set_pairwise
code: theorem Nodup.pairwise_of_set_pairwise {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : { x | x ∈ l }.Pairwise r) : l.Pairwise r 
goal: List.Pairwise r l

full_name: List.Nodup.pairwise_coe
code: @[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r 
goal: {a | a ∈ l}.Pairwise r ↔ List.Pairwise r l

full_name: List.Nodup.take_eq_filter_mem
code: theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (l.take n).elem
  
goal: l.Nodup → List.take n l = List.filter (fun a => List.elem a (List.take n l)) l

full_name: Option.toList_nodup
code: theorem Option.toList_nodup : ∀ o : Option α, o.toList.Nodup
  
goal: o.toList.Nodup