File: .lake/packages/lean4/src/lean/Init/Data/List/Lemmas.lean

full_name: List.cons_ne_nil
code: theorem cons_ne_nil (a : α) (l : List α) : a :: l ≠ [] 
goal: a :: l ≠ []

full_name: List.cons_ne_self
code: @[simp]
theorem cons_ne_self (a : α) (l : List α) : a :: l ≠ l 
goal: a :: l ≠ l

full_name: List.head_eq_of_cons_eq
code: theorem head_eq_of_cons_eq (H : h₁ :: t₁ = h₂ :: t₂) : h₁ = h₂ 
goal: ∀ {α : Type u_1} {h₁ : α} {t₁ : List α} {h₂ : α} {t₂ : List α}, h₁ :: t₁ = h₂ :: t₂ → h₁ = h₂

full_name: List.tail_eq_of_cons_eq
code: theorem tail_eq_of_cons_eq (H : h₁ :: t₁ = h₂ :: t₂) : t₁ = t₂ 
goal: ∀ {α : Type u_1} {h₁ : α} {t₁ : List α} {h₂ : α} {t₂ : List α}, h₁ :: t₁ = h₂ :: t₂ → t₁ = t₂

full_name: List.cons_inj_right
code: theorem cons_inj_right (a : α) {l l' : List α} : a :: l = a :: l' ↔ l = l' 
goal: a :: l = a :: l' ↔ l = l'

full_name: List.cons_inj
code: @[deprecated (since := "2024-06-15")] abbrev cons_inj 
goal: a :: l = a :: l' ↔ l = l'

full_name: List.cons_eq_cons
code: theorem cons_eq_cons {a b : α} {l l' : List α} : a :: l = b :: l' ↔ a = b ∧ l = l' 
goal: a :: l = b :: l' ↔ a = b ∧ l = l'

full_name: List.exists_cons_of_ne_nil
code: theorem exists_cons_of_ne_nil : ∀ {l : List α}, l ≠ [] → ∃ b L, l = b :: L
  
goal: l ≠ [] → ∃ b L, l = b :: L

full_name: List.eq_nil_of_length_eq_zero
code: theorem eq_nil_of_length_eq_zero (_ : length l = 0) : l = [] 
goal: ∀ {α : Type u_1} {l : List α}, l.length = 0 → l = []

full_name: List.ne_nil_of_length_eq_add_one
code: theorem ne_nil_of_length_eq_add_one (_ : length l = n + 1) : l ≠ [] 
goal: ∀ {α : Type u_1} {l : List α} {n : Nat}, l.length = n + 1 → l ≠ []

full_name: List.ne_nil_of_length_eq_succ
code: @[deprecated ne_nil_of_length_eq_add_one (since := "2024-06-16")]
abbrev ne_nil_of_length_eq_succ 
goal: ∀ {α : Type u_1} {l : List α} {n : Nat}, l.length = n + 1 → l ≠ []

full_name: List.length_eq_zero
code: @[simp] theorem length_eq_zero : length l = 0 ↔ l = [] 
goal: ∀ {α : Type u_1} {l : List α}, l.length = 0 ↔ l = []

full_name: List.length_pos_of_mem
code: theorem length_pos_of_mem {a : α} : ∀ {l : List α}, a ∈ l → 0 < length l
  
goal: a ∈ l → 0 < l.length

full_name: List.exists_mem_of_length_pos
code: theorem exists_mem_of_length_pos : ∀ {l : List α}, 0 < length l → ∃ a, a ∈ l
  
goal: 0 < l.length → ∃ a, a ∈ l

full_name: List.length_pos_iff_exists_mem
code: theorem length_pos_iff_exists_mem {l : List α} : 0 < length l ↔ ∃ a, a ∈ l 
goal: 0 < l.length ↔ ∃ a, a ∈ l

full_name: List.exists_cons_of_length_pos
code: theorem exists_cons_of_length_pos : ∀ {l : List α}, 0 < l.length → ∃ h t, l = h :: t
  
goal: 0 < l.length → ∃ h t, l = h :: t

full_name: List.length_pos_iff_exists_cons
code: theorem length_pos_iff_exists_cons :
    ∀ {l : List α}, 0 < l.length ↔ ∃ h t, l = h :: t 
goal: 0 < l.length ↔ ∃ h t, l = h :: t

full_name: List.exists_cons_of_length_eq_add_one
code: theorem exists_cons_of_length_eq_add_one :
    ∀ {l : List α}, l.length = n + 1 → ∃ h t, l = h :: t
  
goal: l.length = n + 1 → ∃ h t, l = h :: t

full_name: List.length_pos
code: theorem length_pos {l : List α} : 0 < length l ↔ l ≠ [] 
goal: 0 < l.length ↔ l ≠ []

full_name: List.length_eq_one
code: theorem length_eq_one {l : List α} : length l = 1 ↔ ∃ a, l = [a] 
goal: l.length = 1 ↔ ∃ a, l = [a]

full_name: List.get_cons_zero
code: @[simp] theorem get_cons_zero : get (a::l) (0 : Fin (l.length + 1)) = a 
goal: ∀ {α : Type u_1} {a : α} {l : List α}, (a :: l).get 0 = a

full_name: List.get_cons_succ
code: @[simp] theorem get_cons_succ {as : List α} {h : i + 1 < (a :: as).length} :
  (a :: as).get ⟨i+1, h⟩ = as.get ⟨i, Nat.lt_of_succ_lt_succ h⟩ 
goal: (a :: as).get ⟨i + 1, h⟩ = as.get ⟨i, ⋯⟩

full_name: List.get_cons_succ'
code: @[simp] theorem get_cons_succ' {as : List α} {i : Fin as.length} :
  (a :: as).get i.succ = as.get i 
goal: (a :: as).get i.succ = as.get i

full_name: List.get?_len_le
code: theorem get?_len_le : ∀ {l : List α} {n}, length l ≤ n → l.get? n = none
  
goal: l.length ≤ n → l.get? n = none

full_name: List.get?_eq_get
code: theorem get?_eq_get : ∀ {l : List α} {n} (h : n < l.length), l.get? n = some (get l ⟨n, h⟩)
  
goal: l.get? n = some (l.get ⟨n, h⟩)

full_name: List.get?_eq_some
code: theorem get?_eq_some : l.get? n = some a ↔ ∃ h, get l ⟨n, h⟩ = a 
goal: ∀ {α : Type u_1} {a : α} {l : List α} {n : Nat}, l.get? n = some a ↔ ∃ h, l.get ⟨n, h⟩ = a

full_name: List.get?_eq_none
code: theorem get?_eq_none : l.get? n = none ↔ length l ≤ n 
goal: ∀ {α : Type u_1} {l : List α} {n : Nat}, l.get? n = none ↔ l.length ≤ n

full_name: List.get?_eq_getElem?
code: @[simp] theorem get?_eq_getElem? (l : List α) (i : Nat) : l.get? i = l[i]? 
goal: l.get? i = l[i]?

full_name: List.get_eq_getElem
code: @[simp] theorem get_eq_getElem (l : List α) (i : Fin l.length) : l.get i = l[i.1]'i.2 
goal: l.get i = l[↑i]

full_name: List.getElem?_nil
code: @[simp] theorem getElem?_nil {n : Nat} : ([] : List α)[n]? = none 
goal: [][n]? = none

full_name: List.getElem?_cons_zero
code: @[simp] theorem getElem?_cons_zero {l : List α} : (a::l)[0]? = some a 
goal: (a :: l)[0]? = some a

full_name: List.getElem?_cons_succ
code: @[simp] theorem getElem?_cons_succ {l : List α} : (a::l)[n+1]? = l[n]? 
goal: (a :: l)[n + 1]? = l[n]?

full_name: List.getElem?_len_le
code: theorem getElem?_len_le : ∀ {l : List α} {n}, length l ≤ n → l[n]? = none
  
goal: l.length ≤ n → l[n]? = none

full_name: List.getElem?_eq_getElem
code: @[simp] theorem getElem?_eq_getElem {l : List α} {n} (h : n < l.length) : l[n]? = some l[n] 
goal: l[n]? = some l[n]

full_name: List.getElem?_eq_some
code: theorem getElem?_eq_some {l : List α} : l[n]? = some a ↔ ∃ h : n < l.length, l[n] = a 
goal: l[n]? = some a ↔ ∃ h, l[n] = a

full_name: List.getElem?_eq_none_iff
code: @[simp] theorem getElem?_eq_none_iff : l[n]? = none ↔ length l ≤ n 
goal: ∀ {α : Type u_1} {l : List α} {n : Nat}, l[n]? = none ↔ l.length ≤ n

full_name: List.getElem?_eq_none
code: theorem getElem?_eq_none (h : length l ≤ n) : l[n]? = none 
goal: ∀ {α : Type u_1} {l : List α} {n : Nat}, l.length ≤ n → l[n]? = none

full_name: List.getElem!_nil
code: @[simp] theorem getElem!_nil [Inhabited α] {n : Nat} : ([] : List α)[n]! = default 
goal: [][n]! = default

full_name: List.getElem!_cons_zero
code: @[simp] theorem getElem!_cons_zero [Inhabited α] {l : List α} : (a::l)[0]! = a 
goal: (a :: l)[0]! = a

full_name: List.getElem!_cons_succ
code: @[simp] theorem getElem!_cons_succ [Inhabited α] {l : List α} : (a::l)[n+1]! = l[n]! 
goal: (a :: l)[n + 1]! = l[n]!

full_name: List.get_cons_cons_one
code: @[simp] theorem get_cons_cons_one : (a₁ :: a₂ :: as).get (1 : Fin (as.length + 2)) = a₂ 
goal: ∀ {α : Type u_1} {a₁ a₂ : α} {as : List α}, (a₁ :: a₂ :: as).get 1 = a₂

full_name: List.get!_len_le
code: theorem get!_len_le [Inhabited α] : ∀ {l : List α} {n}, length l ≤ n → l.get! n = (default : α)
  
goal: l.length ≤ n → l.get! n = default

full_name: List.get?_zero
code: theorem get?_zero (l : List α) : l.get? 0 = l.head? 
goal: l.get? 0 = l.head?

full_name: List.getElem_of_eq
code: /--
If one has `l[i]` in an expression and `h : l = l'`,
`rw [h]` will give a "motive it not type correct" error, as it cannot rewrite the
implicit `i < l.length` to `i < l'.length` directly. The theorem `getElem_of_eq` can be used to make
such a rewrite, with `rw [getElem_of_eq h]`.
-/
theorem getElem_of_eq {l l' : List α} (h : l = l') {i : Nat} (w : i < l.length) :
    l[i] = l'[i]'(h ▸ w) 
goal: l[i] = l'[i]

full_name: List.get_of_eq
code: /--
If one has `l.get i` in an expression (with `i : Fin l.length`) and `h : l = l'`,
`rw [h]` will give a "motive it not type correct" error, as it cannot rewrite the
`i : Fin l.length` to `Fin l'.length` directly. The theorem `get_of_eq` can be used to make
such a rewrite, with `rw [get_of_eq h]`.
-/
theorem get_of_eq {l l' : List α} (h : l = l') (i : Fin l.length) :
    get l i = get l' ⟨i, h ▸ i.2⟩ 
goal: l.get i = l'.get ⟨↑i, ⋯⟩

full_name: List.getElem_singleton
code: @[simp] theorem getElem_singleton (a : α) (h : i < 1) : [a][i] = a 
goal: [a][i] = a

full_name: List.get_singleton
code: @[deprecated getElem_singleton (since := "2024-06-12")]
theorem get_singleton (a : α) (n : Fin 1) : get [a] n = a 
goal: [a].get n = a

full_name: List.getElem_zero
code: theorem getElem_zero {l : List α} (h : 0 < l.length) : l[0] = l.head (length_pos.mp h) 
goal: l[0] = l.head ⋯

full_name: List.get_mk_zero
code: theorem get_mk_zero : ∀ {l : List α} (h : 0 < l.length), l.get ⟨0, h⟩ = l.head (length_pos.mp h)
  
goal: l.get ⟨0, h⟩ = l.head ⋯

full_name: List.getElem!_of_getElem?
code: theorem getElem!_of_getElem? [Inhabited α] : ∀ {l : List α} {n : Nat}, l[n]? = some a → l[n]! = a
  
goal: l[n]? = some a → l[n]! = a

full_name: List.get!_of_get?
code: theorem get!_of_get? [Inhabited α] : ∀ {l : List α} {n}, get? l n = some a → get! l n = a
  
goal: l.get? n = some a → l.get! n = a

full_name: List.get!_eq_getD
code: @[simp] theorem get!_eq_getD [Inhabited α] : ∀ (l : List α) n, l.get! n = l.getD n default
  
goal: l.get! n = l.getD n default

full_name: List.ext_getElem?
code: @[ext] theorem ext_getElem? {l₁ l₂ : List α} (h : ∀ n : Nat, l₁[n]? = l₂[n]?) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.ext_getElem
code: theorem ext_getElem {l₁ l₂ : List α} (hl : length l₁ = length l₂)
    (h : ∀ (n : Nat) (h₁ : n < l₁.length) (h₂ : n < l₂.length), l₁[n]'h₁ = l₂[n]'h₂) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.ext_get
code: theorem ext_get {l₁ l₂ : List α} (hl : length l₁ = length l₂)
    (h : ∀ n h₁ h₂, get l₁ ⟨n, h₁⟩ = get l₂ ⟨n, h₂⟩) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.getElem_concat_length
code: @[simp] theorem getElem_concat_length : ∀ (l : List α) (a : α) (i) (_ : i = l.length) (w), (l ++ [a])[i]'w = a
  
goal: i = l.length → ∀ (w : i < (l ++ [a]).length), (l ++ [a])[i] = a

full_name: List.getElem?_concat_length
code: theorem getElem?_concat_length (l : List α) (a : α) : (l ++ [a])[l.length]? = some a 
goal: (l ++ [a])[l.length]? = some a

full_name: List.get?_concat_length
code: @[deprecated getElem?_concat_length (since := "2024-06-12")]
theorem get?_concat_length (l : List α) (a : α) : (l ++ [a]).get? l.length = some a 
goal: (l ++ [a]).get? l.length = some a

full_name: List.not_mem_nil
code: @[simp] theorem not_mem_nil (a : α) : ¬ a ∈ [] 
goal: ¬a ∈ []

full_name: List.mem_cons
code: @[simp] theorem mem_cons : a ∈ (b :: l) ↔ a = b ∨ a ∈ l 
goal: ∀ {α : Type u_1} {a b : α} {l : List α}, a ∈ b :: l ↔ a = b ∨ a ∈ l

full_name: List.mem_cons_self
code: theorem mem_cons_self (a : α) (l : List α) : a ∈ a :: l 
goal: a ∈ a :: l

full_name: List.mem_cons_of_mem
code: theorem mem_cons_of_mem (y : α) {a : α} {l : List α} : a ∈ l → a ∈ y :: l 
goal: a ∈ l → a ∈ y :: l

full_name: List.exists_mem_of_ne_nil
code: theorem exists_mem_of_ne_nil (l : List α) (h : l ≠ []) : ∃ x, x ∈ l 
goal: ∃ x, x ∈ l

full_name: List.eq_nil_iff_forall_not_mem
code: theorem eq_nil_iff_forall_not_mem {l : List α} : l = [] ↔ ∀ a, a ∉ l 
goal: l = [] ↔ ∀ (a : α), ¬a ∈ l

full_name: List.eq_of_mem_singleton
code: theorem eq_of_mem_singleton : a ∈ [b] → a = b
  
goal: ∀ {α : Type u_1} {a b : α}, a ∈ [b] → a = b

full_name: List.mem_singleton
code: @[simp 1100] theorem mem_singleton {a b : α} : a ∈ [b] ↔ a = b 
goal: a ∈ [b] ↔ a = b

full_name: List.forall_mem_cons
code: theorem forall_mem_cons {p : α → Prop} {a : α} {l : List α} :
    (∀ x, x ∈ a :: l → p x) ↔ p a ∧ ∀ x, x ∈ l → p x 
goal: (∀ (x : α), x ∈ a :: l → p x) ↔ p a ∧ ∀ (x : α), x ∈ l → p x

full_name: List.exists_mem_nil
code: theorem exists_mem_nil (p : α → Prop) : ¬ (∃ x, ∃ _ : x ∈ @nil α, p x) 
goal: ¬∃ x x_1, p x

full_name: List.forall_mem_nil
code: theorem forall_mem_nil (p : α → Prop) : ∀ (x) (_ : x ∈ @nil α), p x 
goal: x ∈ [] → p x

full_name: List.exists_mem_cons
code: theorem exists_mem_cons {p : α → Prop} {a : α} {l : List α} :
    (∃ x, ∃ _ : x ∈ a :: l, p x) ↔ p a ∨ ∃ x, ∃ _ : x ∈ l, p x 
goal: (∃ x x_1, p x) ↔ p a ∨ ∃ x x_1, p x

full_name: List.forall_mem_singleton
code: theorem forall_mem_singleton {p : α → Prop} {a : α} : (∀ (x) (_ : x ∈ [a]), p x) ↔ p a 
goal: (∀ (x : α), x ∈ [a] → p x) ↔ p a

full_name: List.mem_nil_iff
code: theorem mem_nil_iff (a : α) : a ∈ ([] : List α) ↔ False 
goal: a ∈ [] ↔ False

full_name: List.mem_singleton_self
code: theorem mem_singleton_self (a : α) : a ∈ [a] 
goal: a ∈ [a]

full_name: List.mem_of_mem_cons_of_mem
code: theorem mem_of_mem_cons_of_mem : ∀ {a b : α} {l : List α}, a ∈ b :: l → b ∈ l → a ∈ l
  
goal: a ∈ b :: l → b ∈ l → a ∈ l

full_name: List.eq_or_ne_mem_of_mem
code: theorem eq_or_ne_mem_of_mem {a b : α} {l : List α} (h' : a ∈ b :: l) : a = b ∨ (a ≠ b ∧ a ∈ l) 
goal: a = b ∨ a ≠ b ∧ a ∈ l

full_name: List.ne_nil_of_mem
code: theorem ne_nil_of_mem {a : α} {l : List α} (h : a ∈ l) : l ≠ [] 
goal: l ≠ []

full_name: List.elem_iff
code: theorem elem_iff [BEq α] [LawfulBEq α] {a : α} {as : List α} :
    elem a as = true ↔ a ∈ as 
goal: List.elem a as = true ↔ a ∈ as

full_name: List.elem_eq_mem
code: @[simp] theorem elem_eq_mem [BEq α] [LawfulBEq α] (a : α) (as : List α) :
    elem a as = decide (a ∈ as) 
goal: List.elem a as = decide (a ∈ as)

full_name: List.mem_of_ne_of_mem
code: theorem mem_of_ne_of_mem {a y : α} {l : List α} (h₁ : a ≠ y) (h₂ : a ∈ y :: l) : a ∈ l 
goal: a ∈ l

full_name: List.ne_of_not_mem_cons
code: theorem ne_of_not_mem_cons {a b : α} {l : List α} : a ∉ b::l → a ≠ b 
goal: ¬a ∈ b :: l → a ≠ b

full_name: List.not_mem_of_not_mem_cons
code: theorem not_mem_of_not_mem_cons {a b : α} {l : List α} : a ∉ b::l → a ∉ l 
goal: ¬a ∈ b :: l → ¬a ∈ l

full_name: List.not_mem_cons_of_ne_of_not_mem
code: theorem not_mem_cons_of_ne_of_not_mem {a y : α} {l : List α} : a ≠ y → a ∉ l → a ∉ y::l 
goal: a ≠ y → ¬a ∈ l → ¬a ∈ y :: l

full_name: List.ne_and_not_mem_of_not_mem_cons
code: theorem ne_and_not_mem_of_not_mem_cons {a y : α} {l : List α} : a ∉ y::l → a ≠ y ∧ a ∉ l 
goal: ¬a ∈ y :: l → a ≠ y ∧ ¬a ∈ l

full_name: List.getElem_of_mem
code: theorem getElem_of_mem : ∀ {a} {l : List α}, a ∈ l → ∃ (n : Nat) (h : n < l.length), l[n]'h = a
  
goal: a ∈ l → ∃ n h, l[n] = a

full_name: List.get_of_mem
code: theorem get_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n, get l n = a 
goal: ∃ n, l.get n = a

full_name: List.getElem_mem
code: theorem getElem_mem : ∀ (l : List α) n (h : n < l.length), l[n]'h ∈ l
  
goal: l[n] ∈ l

full_name: List.get_mem
code: theorem get_mem : ∀ (l : List α) n h, get l ⟨n, h⟩ ∈ l
  
goal: l.get ⟨n, h⟩ ∈ l

full_name: List.mem_iff_getElem
code: theorem mem_iff_getElem {a} {l : List α} : a ∈ l ↔ ∃ (n : Nat) (h : n < l.length), l[n]'h = a 
goal: a ∈ l ↔ ∃ n h, l[n] = a

full_name: List.mem_iff_get
code: theorem mem_iff_get {a} {l : List α} : a ∈ l ↔ ∃ n, get l n = a 
goal: a ∈ l ↔ ∃ n, l.get n = a

full_name: List.getElem?_of_mem
code: theorem getElem?_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n : Nat, l[n]? = some a 
goal: ∃ n, l[n]? = some a

full_name: List.get?_of_mem
code: theorem get?_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n, l.get? n = some a 
goal: ∃ n, l.get? n = some a

full_name: List.getElem?_mem
code: theorem getElem?_mem {l : List α} {n : Nat} {a : α} (e : l[n]? = some a) : a ∈ l 
goal: a ∈ l

full_name: List.get?_mem
code: theorem get?_mem {l : List α} {n a} (e : l.get? n = some a) : a ∈ l 
goal: a ∈ l

full_name: List.mem_iff_getElem?
code: theorem mem_iff_getElem? {a} {l : List α} : a ∈ l ↔ ∃ n : Nat, l[n]? = some a 
goal: a ∈ l ↔ ∃ n, l[n]? = some a

full_name: List.mem_iff_get?
code: theorem mem_iff_get? {a} {l : List α} : a ∈ l ↔ ∃ n, l.get? n = some a 
goal: a ∈ l ↔ ∃ n, l.get? n = some a

full_name: List.decide_mem_cons
code: @[simp] theorem decide_mem_cons [BEq α] [LawfulBEq α] {l : List α} :
    decide (y ∈ a :: l) = (y == a || decide (y ∈ l)) 
goal: decide (y ∈ a :: l) = (y == a || decide (y ∈ l))

full_name: List.any_eq
code: theorem any_eq {l : List α} : l.any p = decide (∃ x, x ∈ l ∧ p x) 
goal: l.any p = decide (∃ x, x ∈ l ∧ p x = true)

full_name: List.all_eq
code: theorem all_eq {l : List α} : l.all p = decide (∀ x, x ∈ l →  p x) 
goal: l.all p = decide (∀ (x : α), x ∈ l → p x = true)

full_name: List.any_eq_true
code: @[simp] theorem any_eq_true {l : List α} : l.any p ↔ ∃ x, x ∈ l ∧ p x 
goal: l.any p = true ↔ ∃ x, x ∈ l ∧ p x = true

full_name: List.all_eq_true
code: @[simp] theorem all_eq_true {l : List α} : l.all p ↔ ∀ x, x ∈ l →  p x 
goal: l.all p = true ↔ ∀ (x : α), x ∈ l → p x = true

full_name: List.set_nil
code: @[simp] theorem set_nil (n : Nat) (a : α) : [].set n a = [] 
goal: [].set n a = []

full_name: List.set_cons_zero
code: @[simp] theorem set_cons_zero (x : α) (xs : List α) (a : α) :
  (x :: xs).set 0 a = a :: xs 
goal: (x :: xs).set 0 a = a :: xs

full_name: List.set_cons_succ
code: @[simp] theorem set_cons_succ (x : α) (xs : List α) (n : Nat) (a : α) :
  (x :: xs).set (n + 1) a = x :: xs.set n a 
goal: (x :: xs).set (n + 1) a = x :: xs.set n a

full_name: List.getElem_set_eq
code: @[simp] theorem getElem_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :
    (l.set i a)[i] = a 
goal: (l.set i a)[i] = a

full_name: List.get_set_eq
code: @[deprecated getElem_set_eq (since := "2024-06-12")]
theorem get_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :
    (l.set i a).get ⟨i, h⟩ = a 
goal: (l.set i a).get ⟨i, h⟩ = a

full_name: List.getElem?_set_eq
code: @[simp] theorem getElem?_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :
    (l.set i a)[i]? = some a 
goal: (l.set i a)[i]? = some a

full_name: List.getElem_set_ne
code: @[simp] theorem getElem_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α}
    (hj : j < (l.set i a).length) :
    (l.set i a)[j] = l[j]'(by simp at hj; exact hj) 
goal: (l.set i a)[j] = l[j]

full_name: List.get_set_ne
code: @[deprecated getElem_set_ne (since := "2024-06-12")]
theorem get_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α}
    (hj : j < (l.set i a).length) :
    (l.set i a).get ⟨j, hj⟩ = l.get ⟨j, by simp at hj; exact hj⟩ 
goal: (l.set i a).get ⟨j, hj⟩ = l.get ⟨j, ⋯⟩

full_name: List.getElem?_set_ne
code: @[simp] theorem getElem?_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α}  :
    (l.set i a)[j]? = l[j]? 
goal: (l.set i a)[j]? = l[j]?

full_name: List.getElem_set
code: theorem getElem_set {l : List α} {m n} {a} (h) :
    (set l m a)[n]'h = if m = n then a else l[n]'(length_set .. ▸ h) 
goal: (l.set m a)[n] = if m = n then a else l[n]

full_name: List.get_set
code: @[deprecated getElem_set (since := "2024-06-12")]
theorem get_set {l : List α} {m n} {a : α} (h) :
    (set l m a).get ⟨n, h⟩ = if m = n then a else l.get ⟨n, length_set .. ▸ h⟩ 
goal: (l.set m a).get ⟨n, h⟩ = if m = n then a else l.get ⟨n, ⋯⟩

full_name: List.getElem?_set
code: theorem getElem?_set {l : List α} {i j : Nat} {a : α} :
    (l.set i a)[j]? = if i = j then if i < l.length then some a else none else l[j]? 
goal: (l.set i a)[j]? = if i = j then if i < l.length then some a else none else l[j]?

full_name: List.set_eq_of_length_le
code: theorem set_eq_of_length_le {l : List α} {n : Nat} (h : l.length ≤ n) {a : α} :
    l.set n a = l 
goal: l.set n a = l

full_name: List.set_eq_nil
code: @[simp] theorem set_eq_nil (l : List α) (n : Nat) (a : α) : l.set n a = [] ↔ l = [] 
goal: l.set n a = [] ↔ l = []

full_name: List.set_comm
code: theorem set_comm (a b : α) : ∀ {n m : Nat} (l : List α), n ≠ m →
    (l.set n a).set m b = (l.set m b).set n a
  
goal: n ≠ m → (l.set n a).set m b = (l.set m b).set n a

full_name: List.set_set
code: @[simp]
theorem set_set (a b : α) : ∀ (l : List α) (n : Nat), (l.set n a).set n b = l.set n b
  
goal: (l.set n a).set n b = l.set n b

full_name: List.mem_set
code: theorem mem_set (l : List α) (n : Nat) (h : n < l.length) (a : α) :
    a ∈ l.set n a 
goal: a ∈ l.set n a

full_name: List.mem_or_eq_of_mem_set
code: theorem mem_or_eq_of_mem_set : ∀ {l : List α} {n : Nat} {a b : α}, a ∈ l.set n b → a ∈ l ∨ a = b
  
goal: a ∈ l.set n b → a ∈ l ∨ a = b

full_name: List.lt_irrefl'
code: theorem lt_irrefl' [LT α] (lt_irrefl : ∀ x : α, ¬x < x) (l : List α) : ¬l < l 
goal: ¬l < l

full_name: List.lt_trans'
code: theorem lt_trans' [LT α] [DecidableRel (@LT.lt α _)]
    (lt_trans : ∀ {x y z : α}, x < y → y < z → x < z)
    (le_trans : ∀ {x y z : α}, ¬x < y → ¬y < z → ¬x < z)
    {l₁ l₂ l₃ : List α} (h₁ : l₁ < l₂) (h₂ : l₂ < l₃) : l₁ < l₃ 
goal: l₁ < l₃

full_name: List.lt_antisymm'
code: theorem lt_antisymm' [LT α]
    (lt_antisymm : ∀ {x y : α}, ¬x < y → ¬y < x → x = y)
    {l₁ l₂ : List α} (h₁ : ¬l₁ < l₂) (h₂ : ¬l₂ < l₁) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.foldlM_reverse
code: @[simp] theorem foldlM_reverse [Monad m] (l : List α) (f : β → α → m β) (b) :
    l.reverse.foldlM f b = l.foldrM (fun x y => f y x) b 
goal: List.foldlM f b l.reverse = List.foldrM (fun x y => f y x) b l

full_name: List.foldlM_append
code: @[simp] theorem foldlM_append [Monad m] [LawfulMonad m] (f : β → α → m β) (b) (l l' : List α) :
    (l ++ l').foldlM f b = l.foldlM f b >>= l'.foldlM f 
goal: List.foldlM f b (l ++ l') = do
  let init ← List.foldlM f b l
  List.foldlM f init l'

full_name: List.foldrM_cons
code: @[simp] theorem foldrM_cons [Monad m] [LawfulMonad m] (a : α) (l) (f : α → β → m β) (b) :
    (a :: l).foldrM f b = l.foldrM f b >>= f a 
goal: List.foldrM f b (a :: l) = List.foldrM f b l >>= f a

full_name: List.foldl_eq_foldlM
code: theorem foldl_eq_foldlM (f : β → α → β) (b) (l : List α) :
    l.foldl f b = l.foldlM (m := Id) f b 
goal: List.foldl f b l = List.foldlM f b l

full_name: List.foldr_eq_foldrM
code: theorem foldr_eq_foldrM (f : α → β → β) (b) (l : List α) :
    l.foldr f b = l.foldrM (m := Id) f b 
goal: List.foldr f b l = List.foldrM f b l

full_name: List.foldrM_append
code: @[simp] theorem foldrM_append [Monad m] [LawfulMonad m] (f : α → β → m β) (b) (l l' : List α) :
    (l ++ l').foldrM f b = l'.foldrM f b >>= l.foldrM f 
goal: List.foldrM f b (l ++ l') = do
  let init ← List.foldrM f b l'
  List.foldrM f init l

full_name: List.foldl_append
code: @[simp] theorem foldl_append {β : Type _} (f : β → α → β) (b) (l l' : List α) :
    (l ++ l').foldl f b = l'.foldl f (l.foldl f b) 
goal: List.foldl f b (l ++ l') = List.foldl f (List.foldl f b l) l'

full_name: List.foldr_append
code: @[simp] theorem foldr_append (f : α → β → β) (b) (l l' : List α) :
    (l ++ l').foldr f b = l.foldr f (l'.foldr f b) 
goal: List.foldr f b (l ++ l') = List.foldr f (List.foldr f b l') l

full_name: List.foldr_self_append
code: @[simp] theorem foldr_self_append (l : List α) : l.foldr cons l' = l ++ l' 
goal: List.foldr List.cons l' l = l ++ l'

full_name: List.foldr_self
code: theorem foldr_self (l : List α) : l.foldr cons [] = l 
goal: List.foldr List.cons [] l = l

full_name: List.foldl_map
code: theorem foldl_map (f : β₁ → β₂) (g : α → β₂ → α) (l : List β₁) (init : α) :
    (l.map f).foldl g init = l.foldl (fun x y => g x (f y)) init 
goal: List.foldl g init (List.map f l) = List.foldl (fun x y => g x (f y)) init l

full_name: List.foldr_map
code: theorem foldr_map (f : α₁ → α₂) (g : α₂ → β → β) (l : List α₁) (init : β) :
    (l.map f).foldr g init = l.foldr (fun x y => g (f x) y) init 
goal: List.foldr g init (List.map f l) = List.foldr (fun x y => g (f x) y) init l

full_name: List.foldl_map'
code: theorem foldl_map' {α β : Type u} (g : α → β) (f : α → α → α) (f' : β → β → β) (a : α) (l : List α)
    (h : ∀ x y, f' (g x) (g y) = g (f x y)) :
    (l.map g).foldl f' (g a) = g (l.foldl f a) 
goal: List.foldl f' (g a) (List.map g l) = g (List.foldl f a l)

full_name: List.foldr_map'
code: theorem foldr_map' {α β : Type u} (g : α → β) (f : α → α → α) (f' : β → β → β) (a : α) (l : List α)
    (h : ∀ x y, f' (g x) (g y) = g (f x y)) :
    (l.map g).foldr f' (g a) = g (l.foldr f a) 
goal: List.foldr f' (g a) (List.map g l) = g (List.foldr f a l)

full_name: List.getD_eq_getElem?
code: @[simp] theorem getD_eq_getElem? (l) (n) (a : α) : getD l n a = (l[n]?).getD a 
goal: l.getD n a = l[n]?.getD a

full_name: List.getD_eq_get?
code: @[deprecated getD_eq_getElem? (since := "2024-06-12")]
theorem getD_eq_get? : ∀ l n (a : α), getD l n a = (get? l n).getD a 
goal: l.getD n a = (l.get? n).getD a

full_name: List.getLast_eq_get
code: theorem getLast_eq_get : ∀ (l : List α) (h : l ≠ []),
    getLast l h = l.get ⟨l.length - 1, by
      match l with
      | [] => contradiction
      | a :: l => exact Nat.le_refl _⟩
  
goal: l.getLast h = l.get ⟨l.length - 1, ⋯⟩

full_name: List.getLast_cons'
code: theorem getLast_cons' {a : α} {l : List α} : ∀ (h₁ : a :: l ≠ nil) (h₂ : l ≠ nil),
  getLast (a :: l) h₁ = getLast l h₂ 
goal: (a :: l).getLast h₁ = l.getLast h₂

full_name: List.getLast_eq_getLastD
code: theorem getLast_eq_getLastD (a l h) : @getLast α (a::l) h = getLastD l a 
goal: (a :: l).getLast h = l.getLastD a

full_name: List.getLastD_eq_getLast?
code: theorem getLastD_eq_getLast? (a l) : @getLastD α l a = (getLast? l).getD a 
goal: l.getLastD a = l.getLast?.getD a

full_name: List.getLast_singleton
code: @[simp] theorem getLast_singleton (a h) : @getLast α [a] h = a 
goal: [a].getLast h = a

full_name: List.getLast!_cons
code: theorem getLast!_cons [Inhabited α] : @getLast! α _ (a::l) = getLastD l a 
goal: (a :: l).getLast! = l.getLastD a

full_name: List.getLast_mem
code: theorem getLast_mem : ∀ {l : List α} (h : l ≠ []), getLast l h ∈ l
  
goal: l.getLast h ∈ l

full_name: List.getLastD_mem_cons
code: theorem getLastD_mem_cons : ∀ (l : List α) (a : α), getLastD l a ∈ a::l
  
goal: l.getLastD a ∈ a :: l

full_name: List.getElem_cons_length
code: theorem getElem_cons_length (x : α) (xs : List α) (n : Nat) (h : n = xs.length) :
    (x :: xs)[n]'(by simp [h]) = (x :: xs).getLast (cons_ne_nil x xs) 
goal: (x :: xs)[n] = (x :: xs).getLast ⋯

full_name: List.get_cons_length
code: @[deprecated getElem_cons_length (since := "2024-06-12")]
theorem get_cons_length (x : α) (xs : List α) (n : Nat) (h : n = xs.length) :
    (x :: xs).get ⟨n, by simp [h]⟩ = (x :: xs).getLast (cons_ne_nil x xs) 
goal: (x :: xs).get ⟨n, ⋯⟩ = (x :: xs).getLast ⋯

full_name: List.getLast?_cons
code: theorem getLast?_cons : @getLast? α (a::l) = getLastD l a 
goal: (a :: l).getLast? = some (l.getLastD a)

full_name: List.getLast?_singleton
code: @[simp] theorem getLast?_singleton (a : α) : getLast? [a] = a 
goal: [a].getLast? = some a

full_name: List.getLast?_eq_getLast
code: theorem getLast?_eq_getLast : ∀ l h, @getLast? α l = some (getLast l h)
  
goal: l.getLast? = some (l.getLast h)

full_name: List.getLast?_eq_get?
code: theorem getLast?_eq_get? : ∀ (l : List α), getLast? l = l.get? (l.length - 1)
  
goal: l.getLast? = l.get? (l.length - 1)

full_name: List.getLast?_concat
code: @[simp] theorem getLast?_concat (l : List α) : getLast? (l ++ [a]) = some a 
goal: (l ++ [a]).getLast? = some a

full_name: List.getLastD_concat
code: @[simp] theorem getLastD_concat (a b l) : @getLastD α (l ++ [b]) a = b 
goal: (l ++ [b]).getLastD a = b

full_name: List.head!_of_head?
code: theorem head!_of_head? [Inhabited α] : ∀ {l : List α}, head? l = some a → head! l = a
  
goal: l.head? = some a → l.head! = a

full_name: List.head?_eq_head
code: theorem head?_eq_head : ∀ l h, @head? α l = some (head l h)
  
goal: l.head? = some (l.head h)

full_name: List.tailD_eq_tail?
code: @[simp] theorem tailD_eq_tail? (l l' : List α) : tailD l l' = (tail? l).getD l' 
goal: l.tailD l' = l.tail?.getD l'

full_name: List.map_id
code: @[simp] theorem map_id (l : List α) : map id l = l 
goal: List.map id l = l

full_name: List.map_id'
code: @[simp] theorem map_id' (l : List α) : map (fun a => a) l = l 
goal: List.map (fun a => a) l = l

full_name: List.map_id''
code: theorem map_id'' {f : α → α} (h : ∀ x, f x = x) (l : List α) : map f l = l 
goal: List.map f l = l

full_name: List.map_singleton
code: theorem map_singleton (f : α → β) (a : α) : map f [a] = [f a] 
goal: List.map f [a] = [f a]

full_name: List.length_map
code: @[simp] theorem length_map (as : List α) (f : α → β) : (as.map f).length = as.length 
goal: (List.map f as).length = as.length

full_name: List.getElem?_map
code: @[simp] theorem getElem?_map (f : α → β) : ∀ (l : List α) (n : Nat), (map f l)[n]? = Option.map f l[n]?
  
goal: (List.map f l)[n]? = Option.map f l[n]?

full_name: List.get?_map
code: @[deprecated getElem?_map (since := "2024-06-12")]
theorem get?_map (f : α → β) : ∀ l n, (map f l).get? n = (l.get? n).map f
  
goal: (List.map f l).get? n = Option.map f (l.get? n)

full_name: List.getElem_map
code: @[simp] theorem getElem_map (f : α → β) {l} {n : Nat} {h : n < (map f l).length} :
    (map f l)[n] = f (l[n]'(length_map l f ▸ h)) 
goal: (List.map f l)[n] = f l[n]

full_name: List.get_map
code: @[deprecated getElem_map (since := "2024-06-12")]
theorem get_map (f : α → β) {l n} :
    get (map f l) n = f (get l ⟨n, length_map l f ▸ n.2⟩) 
goal: (List.map f l).get n = f (l.get ⟨↑n, ⋯⟩)

full_name: List.mem_map
code: @[simp] theorem mem_map {f : α → β} : ∀ {l : List α}, b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
  
goal: b ∈ List.map f l ↔ ∃ a, a ∈ l ∧ f a = b

full_name: List.exists_of_mem_map
code: theorem exists_of_mem_map (h : b ∈ map f l) : ∃ a, a ∈ l ∧ f a = b 
goal: ∀ {α : Type u_1} {b : α} {α_1 : Type u_2} {f : α_1 → α} {l : List α_1}, b ∈ List.map f l → ∃ a, a ∈ l ∧ f a = b

full_name: List.mem_map_of_mem
code: theorem mem_map_of_mem (f : α → β) (h : a ∈ l) : f a ∈ map f l 
goal: f a ∈ List.map f l

full_name: List.map_inj_left
code: @[simp] theorem map_inj_left {f g : α → β} : map f l = map g l ↔ ∀ a ∈ l, f a = g a 
goal: List.map f l = List.map g l ↔ ∀ (a : α), a ∈ l → f a = g a

full_name: List.map_congr_left
code: theorem map_congr_left (h : ∀ a ∈ l, f a = g a) : map f l = map g l 
goal: ∀ {α : Type u_1} {l : List α} {α_1 : Type u_2} {f g : α → α_1},
  (∀ (a : α), a ∈ l → f a = g a) → List.map f l = List.map g l

full_name: List.map_inj
code: theorem map_inj : map f = map g ↔ f = g 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f g : α → α_1}, List.map f = List.map g ↔ f = g

full_name: List.map_eq_nil
code: @[simp] theorem map_eq_nil {f : α → β} {l : List α} : map f l = [] ↔ l = [] 
goal: List.map f l = [] ↔ l = []

full_name: List.eq_nil_of_map_eq_nil
code: theorem eq_nil_of_map_eq_nil {f : α → β} {l : List α} (h : map f l = []) : l = [] 
goal: l = []

full_name: List.map_eq_cons
code: theorem map_eq_cons {f : α → β} {l : List α} :
    map f l = b :: l₂ ↔ l.head?.map f = some b ∧ l.tail?.map (map f) = some l₂ 
goal: List.map f l = b :: l₂ ↔ Option.map f l.head? = some b ∧ Option.map (List.map f) l.tail? = some l₂

full_name: List.map_eq_cons'
code: theorem map_eq_cons' {f : α → β} {l : List α} :
    map f l = b :: l₂ ↔ ∃ a l₁, l = a :: l₁ ∧ f a = b ∧ map f l₁ = l₂ 
goal: List.map f l = b :: l₂ ↔ ∃ a l₁, l = a :: l₁ ∧ f a = b ∧ List.map f l₁ = l₂

full_name: List.map_eq_foldr
code: theorem map_eq_foldr (f : α → β) (l : List α) : map f l = foldr (fun a bs => f a :: bs) [] l 
goal: List.map f l = List.foldr (fun a bs => f a :: bs) [] l

full_name: List.set_map
code: @[simp] theorem set_map {f : α → β} {l : List α} {n : Nat} {a : α} :
    (map f l).set n (f a) = map f (l.set n a) 
goal: (List.map f l).set n (f a) = List.map f (l.set n a)

full_name: List.head_map
code: @[simp] theorem head_map (f : α → β) (l : List α) (w) :
    head (map f l) w = f (head l (by simpa using w)) 
goal: (List.map f l).head w = f (l.head ⋯)

full_name: List.head?_map
code: @[simp] theorem head?_map (f : α → β) (l : List α) : head? (map f l) = (head? l).map f 
goal: (List.map f l).head? = Option.map f l.head?

full_name: List.headD_map
code: @[simp] theorem headD_map (f : α → β) (l : List α) (a : α) : headD (map f l) (f a) = f (headD l a) 
goal: (List.map f l).headD (f a) = f (l.headD a)

full_name: List.tail?_map
code: @[simp] theorem tail?_map (f : α → β) (l : List α) : tail? (map f l) = (tail? l).map (map f) 
goal: (List.map f l).tail? = Option.map (List.map f) l.tail?

full_name: List.tailD_map
code: @[simp] theorem tailD_map (f : α → β) (l : List α) (l' : List α) :
    tailD (map f l) (map f l') = map f (tailD l l') 
goal: (List.map f l).tailD (List.map f l') = List.map f (l.tailD l')

full_name: List.getLast_map
code: @[simp] theorem getLast_map (f : α → β) (l : List α) (h) :
    getLast (map f l) h = f (getLast l (by simpa using h)) 
goal: (List.map f l).getLast h = f (l.getLast ⋯)

full_name: List.getLast?_map
code: @[simp] theorem getLast?_map (f : α → β) (l : List α) : getLast? (map f l) = (getLast? l).map f 
goal: (List.map f l).getLast? = Option.map f l.getLast?

full_name: List.getLastD_map
code: @[simp] theorem getLastD_map (f : α → β) (l : List α) (a : α) : getLastD (map f l) (f a) = f (getLastD l a) 
goal: (List.map f l).getLastD (f a) = f (l.getLastD a)

full_name: List.map_append
code: @[simp] theorem map_append (f : α → β) : ∀ l₁ l₂, map f (l₁ ++ l₂) = map f l₁ ++ map f l₂ 
goal: List.map f (l₁ ++ l₂) = List.map f l₁ ++ List.map f l₂

full_name: List.map_map
code: @[simp] theorem map_map (g : β → γ) (f : α → β) (l : List α) :
  map g (map f l) = map (g ∘ f) l 
goal: List.map g (List.map f l) = List.map (g ∘ f) l

full_name: List.forall_mem_map_iff
code: theorem forall_mem_map_iff {f : α → β} {l : List α} {P : β → Prop} :
    (∀ (i) (_ : i ∈ l.map f), P i) ↔ ∀ (j) (_ : j ∈ l), P (f j) 
goal: (∀ (i : β), i ∈ List.map f l → P i) ↔ ∀ (j : α), j ∈ l → P (f j)

full_name: List.filter_cons_of_pos
code: @[simp] theorem filter_cons_of_pos {p : α → Bool} {a : α} (l) (pa : p a) :
    filter p (a :: l) = a :: filter p l 
goal: List.filter p (a :: l) = a :: List.filter p l

full_name: List.filter_cons_of_neg
code: @[simp] theorem filter_cons_of_neg {p : α → Bool} {a : α} (l) (pa : ¬ p a) :
    filter p (a :: l) = filter p l 
goal: List.filter p (a :: l) = List.filter p l

full_name: List.filter_cons
code: theorem filter_cons :
    (x :: xs : List α).filter p = if p x then x :: (xs.filter p) else xs.filter p 
goal: List.filter p (x :: xs) = if p x = true then x :: List.filter p xs else List.filter p xs

full_name: List.length_filter_le
code: theorem length_filter_le (p : α → Bool) (l : List α) :
    (l.filter p).length ≤ l.length 
goal: (List.filter p l).length ≤ l.length

full_name: List.filter_eq_self
code: @[simp]
theorem filter_eq_self {l} : filter p l = l ↔ ∀ a ∈ l, p a 
goal: ∀ {α : Type u_1} {p : α → Bool} {l : List α}, List.filter p l = l ↔ ∀ (a : α), a ∈ l → p a = true

full_name: List.filter_length_eq_length
code: @[simp]
theorem filter_length_eq_length {l} : (filter p l).length = l.length ↔ ∀ a ∈ l, p a 
goal: ∀ {α : Type u_1} {p : α → Bool} {l : List α}, (List.filter p l).length = l.length ↔ ∀ (a : α), a ∈ l → p a = true

full_name: List.mem_filter
code: theorem mem_filter : x ∈ filter p as ↔ x ∈ as ∧ p x 
goal: ∀ {α : Type u_1} {x : α} {p : α → Bool} {as : List α}, x ∈ List.filter p as ↔ x ∈ as ∧ p x = true

full_name: List.filter_eq_nil
code: theorem filter_eq_nil {l} : filter p l = [] ↔ ∀ a, a ∈ l → ¬p a 
goal: ∀ {α : Type u_1} {p : α → Bool} {l : List α}, List.filter p l = [] ↔ ∀ (a : α), a ∈ l → ¬p a = true

full_name: List.filter_filter
code: @[simp] theorem filter_filter (q) : ∀ l, filter p (filter q l) = filter (fun a => p a ∧ q a) l
  
goal: ∀ {α : Type u_1} {p : α → Bool} (q : α → Bool) (l : List α),
  List.filter p (List.filter q l) = List.filter (fun a => decide (p a = true ∧ q a = true)) l

full_name: List.filter_map
code: theorem filter_map (f : β → α) (l : List β) : filter p (map f l) = map f (filter (p ∘ f) l) 
goal: List.filter p (List.map f l) = List.map f (List.filter (p ∘ f) l)

full_name: List.map_filter
code: @[deprecated filter_map (since := "2024-06-15")] abbrev map_filter 
goal: List.filter p (List.map f l) = List.map f (List.filter (p ∘ f) l)

full_name: List.map_filter_eq_foldr
code: theorem map_filter_eq_foldr (f : α → β) (p : α → Bool) (as : List α) :
    map f (filter p as) = foldr (fun a bs => bif p a then f a :: bs else bs) [] as 
goal: List.map f (List.filter p as) = List.foldr (fun a bs => bif p a then f a :: bs else bs) [] as

full_name: List.filter_append
code: @[simp] theorem filter_append {p : α → Bool} :
    ∀ (l₁ l₂ : List α), filter p (l₁ ++ l₂) = filter p l₁ ++ filter p l₂
  
goal: List.filter p (l₁ ++ l₂) = List.filter p l₁ ++ List.filter p l₂

full_name: List.filter_congr
code: theorem filter_congr {p q : α → Bool} :
    ∀ {l : List α}, (∀ x ∈ l, p x = q x) → filter p l = filter q l
  
goal: (∀ (x : α), x ∈ l → p x = q x) → List.filter p l = List.filter q l

full_name: List.filter_congr'
code: @[deprecated filter_congr (since := "2024-06-20")] abbrev filter_congr' 
goal: (∀ (x : α), x ∈ l → p x = q x) → List.filter p l = List.filter q l

full_name: List.filterMap_cons_none
code: @[simp] theorem filterMap_cons_none {f : α → Option β} (a : α) (l : List α) (h : f a = none) :
    filterMap f (a :: l) = filterMap f l 
goal: List.filterMap f (a :: l) = List.filterMap f l

full_name: List.filterMap_cons_some
code: @[simp] theorem filterMap_cons_some (f : α → Option β) (a : α) (l : List α) {b : β} (h : f a = some b) :
    filterMap f (a :: l) = b :: filterMap f l 
goal: List.filterMap f (a :: l) = b :: List.filterMap f l

full_name: List.filterMap_eq_map
code: @[simp]
theorem filterMap_eq_map (f : α → β) : filterMap (some ∘ f) = map f 
goal: List.filterMap (some ∘ f) = List.map f

full_name: List.filterMap_some
code: @[simp] theorem filterMap_some (l : List α) : filterMap some l = l 
goal: List.filterMap some l = l

full_name: List.map_filterMap_some_eq_filter_map_is_some
code: theorem map_filterMap_some_eq_filter_map_is_some (f : α → Option β) (l : List α) :
    (l.filterMap f).map some = (l.map f).filter fun b => b.isSome 
goal: List.map some (List.filterMap f l) = List.filter (fun b => b.isSome) (List.map f l)

full_name: List.length_filterMap_le
code: theorem length_filterMap_le (f : α → Option β) (l : List α) :
    (filterMap f l).length ≤ l.length 
goal: (List.filterMap f l).length ≤ l.length

full_name: List.filterMap_length_eq_length
code: @[simp]
theorem filterMap_length_eq_length {l} :
    (filterMap f l).length = l.length ↔ ∀ a ∈ l, (f a).isSome 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {l : List α},
  (List.filterMap f l).length = l.length ↔ ∀ (a : α), a ∈ l → (f a).isSome = true

full_name: List.filterMap_eq_filter
code: @[simp]
theorem filterMap_eq_filter (p : α → Bool) :
    filterMap (Option.guard (p ·)) = filter p 
goal: List.filterMap (Option.guard fun x => p x = true) = List.filter p

full_name: List.filterMap_filterMap
code: theorem filterMap_filterMap (f : α → Option β) (g : β → Option γ) (l : List α) :
    filterMap g (filterMap f l) = filterMap (fun x => (f x).bind g) l 
goal: List.filterMap g (List.filterMap f l) = List.filterMap (fun x => (f x).bind g) l

full_name: List.map_filterMap
code: theorem map_filterMap (f : α → Option β) (g : β → γ) (l : List α) :
    map g (filterMap f l) = filterMap (fun x => (f x).map g) l 
goal: List.map g (List.filterMap f l) = List.filterMap (fun x => Option.map g (f x)) l

full_name: List.filterMap_map
code: @[simp]
theorem filterMap_map (f : α → β) (g : β → Option γ) (l : List α) :
    filterMap g (map f l) = filterMap (g ∘ f) l 
goal: List.filterMap g (List.map f l) = List.filterMap (g ∘ f) l

full_name: List.filter_filterMap
code: theorem filter_filterMap (f : α → Option β) (p : β → Bool) (l : List α) :
    filter p (filterMap f l) = filterMap (fun x => (f x).filter p) l 
goal: List.filter p (List.filterMap f l) = List.filterMap (fun x => Option.filter p (f x)) l

full_name: List.filterMap_filter
code: theorem filterMap_filter (p : α → Bool) (f : α → Option β) (l : List α) :
    filterMap f (filter p l) = filterMap (fun x => if p x then f x else none) l 
goal: List.filterMap f (List.filter p l) = List.filterMap (fun x => if p x = true then f x else none) l

full_name: List.mem_filterMap
code: @[simp] theorem mem_filterMap (f : α → Option β) (l : List α) {b : β} :
    b ∈ filterMap f l ↔ ∃ a, a ∈ l ∧ f a = some b 
goal: b ∈ List.filterMap f l ↔ ∃ a, a ∈ l ∧ f a = some b

full_name: List.filterMap_append
code: theorem filterMap_append {α β : Type _} (l l' : List α) (f : α → Option β) :
    filterMap f (l ++ l') = filterMap f l ++ filterMap f l' 
goal: List.filterMap f (l ++ l') = List.filterMap f l ++ List.filterMap f l'

full_name: List.filterMap_join
code: @[simp] theorem filterMap_join (f : α → Option β) (L : List (List α)) :
    filterMap f (join L) = join (map (filterMap f) L) 
goal: List.filterMap f L.join = (List.map (List.filterMap f) L).join

full_name: List.map_filterMap_of_inv
code: theorem map_filterMap_of_inv (f : α → Option β) (g : β → α) (H : ∀ x : α, (f x).map g = some x)
    (l : List α) : map g (filterMap f l) = l 
goal: List.map g (List.filterMap f l) = l

full_name: List.getElem?_append_right
code: theorem getElem?_append_right : ∀ {l₁ l₂ : List α} {n : Nat}, l₁.length ≤ n →
  (l₁ ++ l₂)[n]? = l₂[n - l₁.length]?

goal: l₁.length ≤ n → (l₁ ++ l₂)[n]? = l₂[n - l₁.length]?

full_name: List.get?_append_right
code: @[deprecated getElem?_append_right (since := "2024-06-12")]
theorem get?_append_right {l₁ l₂ : List α} {n : Nat} (h : l₁.length ≤ n) :
    (l₁ ++ l₂).get? n = l₂.get? (n - l₁.length) 
goal: (l₁ ++ l₂).get? n = l₂.get? (n - l₁.length)

full_name: List.getElem_append_right'
code: theorem getElem_append_right' {l₁ l₂ : List α} {n : Nat} (h₁ : l₁.length ≤ n) (h₂) :
    (l₁ ++ l₂)[n]'h₂ =
      l₂[n - l₁.length]'(by rw [length_append] at h₂; exact Nat.sub_lt_left_of_lt_add h₁ h₂) 
goal: (l₁ ++ l₂)[n] = l₂[n - l₁.length]

full_name: List.get_append_right_aux
code: @[deprecated (since := "2024-06-12")]
theorem get_append_right_aux {l₁ l₂ : List α} {n : Nat}
  (h₁ : l₁.length ≤ n) (h₂ : n < (l₁ ++ l₂).length) : n - l₁.length < l₂.length 
goal: n - l₁.length < l₂.length

full_name: List.get_append_right'
code: @[deprecated getElem_append_right' (since := "2024-06-12")]
theorem get_append_right' {l₁ l₂ : List α} {n : Nat} (h₁ : l₁.length ≤ n) (h₂) :
    (l₁ ++ l₂).get ⟨n, h₂⟩ = l₂.get ⟨n - l₁.length, get_append_right_aux h₁ h₂⟩ 
goal: (l₁ ++ l₂).get ⟨n, h₂⟩ = l₂.get ⟨n - l₁.length, ⋯⟩

full_name: List.getElem_of_append
code: theorem getElem_of_append {l : List α} (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) :
    l[n]'(eq ▸ h ▸ by simp_arith) = a 
goal: l[n] = a

full_name: List.get_of_append_proof
code: @[deprecated (since := "2024-06-12")]
theorem get_of_append_proof {l : List α}
    (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) : n < length l 
goal: n < l.length

full_name: List.get_of_append
code: @[deprecated getElem_of_append (since := "2024-06-12")]
theorem get_of_append {l : List α} (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) :
    l.get ⟨n, get_of_append_proof eq h⟩ = a 
goal: l.get ⟨n, ⋯⟩ = a

full_name: List.append_of_mem
code: theorem append_of_mem {a : α} {l : List α} : a ∈ l → ∃ s t : List α, l = s ++ a :: t
  
goal: a ∈ l → ∃ s t, l = s ++ a :: t

full_name: List.singleton_append
code: @[simp 1100] theorem singleton_append : [x] ++ l = x :: l 
goal: ∀ {α : Type u_1} {x : α} {l : List α}, [x] ++ l = x :: l

full_name: List.append_inj
code: theorem append_inj :
    ∀ {s₁ s₂ t₁ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → length s₁ = length s₂ → s₁ = s₂ ∧ t₁ = t₂
  
goal: s₁ ++ t₁ = s₂ ++ t₂ → s₁.length = s₂.length → s₁ = s₂ ∧ t₁ = t₂

full_name: List.append_inj_right
code: theorem append_inj_right (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length s₁ = length s₂) : t₁ = t₂ 
goal: ∀ {α : Type u_1} {s₁ t₁ s₂ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → s₁.length = s₂.length → t₁ = t₂

full_name: List.append_inj_left
code: theorem append_inj_left (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length s₁ = length s₂) : s₁ = s₂ 
goal: ∀ {α : Type u_1} {s₁ t₁ s₂ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → s₁.length = s₂.length → s₁ = s₂

full_name: List.append_inj'
code: theorem append_inj' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : s₁ = s₂ ∧ t₁ = t₂ 
goal: ∀ {α : Type u_1} {s₁ t₁ s₂ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → t₁.length = t₂.length → s₁ = s₂ ∧ t₁ = t₂

full_name: List.append_inj_right'
code: theorem append_inj_right' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : t₁ = t₂ 
goal: ∀ {α : Type u_1} {s₁ t₁ s₂ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → t₁.length = t₂.length → t₁ = t₂

full_name: List.append_inj_left'
code: theorem append_inj_left' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : s₁ = s₂ 
goal: ∀ {α : Type u_1} {s₁ t₁ s₂ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → t₁.length = t₂.length → s₁ = s₂

full_name: List.append_right_inj
code: theorem append_right_inj {t₁ t₂ : List α} (s) : s ++ t₁ = s ++ t₂ ↔ t₁ = t₂ 
goal: s ++ t₁ = s ++ t₂ ↔ t₁ = t₂

full_name: List.append_left_inj
code: theorem append_left_inj {s₁ s₂ : List α} (t) : s₁ ++ t = s₂ ++ t ↔ s₁ = s₂ 
goal: s₁ ++ t = s₂ ++ t ↔ s₁ = s₂

full_name: List.append_eq_nil
code: @[simp] theorem append_eq_nil : p ++ q = [] ↔ p = [] ∧ q = [] 
goal: ∀ {α : Type u_1} {p q : List α}, p ++ q = [] ↔ p = [] ∧ q = []

full_name: List.getLast_append
code: @[simp] theorem getLast_append {a : α} : ∀ (l : List α) h, getLast (l ++ [a]) h = a
  
goal: (l ++ [a]).getLast h = a

full_name: List.getLast_concat
code: theorem getLast_concat : getLast (concat l a) h = a 
goal: ∀ {α : Type u_1} {l : List α} {a : α} {h : l.concat a ≠ []}, (l.concat a).getLast h = a

full_name: List.getElem_append
code: theorem getElem_append : ∀ {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length),
    (l₁ ++ l₂)[n]'(length_append .. ▸ Nat.lt_add_right _ h) = l₁[n]

goal: (l₁ ++ l₂)[n] = l₁[n]

full_name: List.get_append
code: @[deprecated getElem_append (since := "2024-06-12")]
theorem get_append {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length) :
    (l₁ ++ l₂).get ⟨n, length_append .. ▸ Nat.lt_add_right _ h⟩ = l₁.get ⟨n, h⟩ 
goal: (l₁ ++ l₂).get ⟨n, ⋯⟩ = l₁.get ⟨n, h⟩

full_name: List.get_append_left
code: @[deprecated getElem_append_left (since := "2024-06-12")]
theorem get_append_left (as bs : List α) (h : i < as.length) {h'} : (as ++ bs).get ⟨i, h'⟩ = as.get ⟨i, h⟩ 
goal: (as ++ bs).get ⟨i, h'⟩ = as.get ⟨i, h⟩

full_name: List.get_append_right
code: @[deprecated getElem_append_right (since := "2024-06-12")]
theorem get_append_right (as bs : List α) (h : ¬ i < as.length) {h' h''} : (as ++ bs).get ⟨i, h'⟩ = bs.get ⟨i - as.length, h''⟩ 
goal: (as ++ bs).get ⟨i, h'⟩ = bs.get ⟨i - as.length, h''⟩

full_name: List.getElem?_append
code: theorem getElem?_append {l₁ l₂ : List α} {n : Nat} (hn : n < l₁.length) :
    (l₁ ++ l₂)[n]? = l₁[n]? 
goal: (l₁ ++ l₂)[n]? = l₁[n]?

full_name: List.get?_append
code: @[deprecated (since := "2024-06-12")]
theorem get?_append {l₁ l₂ : List α} {n : Nat} (hn : n < l₁.length) :
    (l₁ ++ l₂).get? n = l₁.get? n 
goal: (l₁ ++ l₂).get? n = l₁.get? n

full_name: List.append_eq_append
code: theorem append_eq_append : List.append l₁ l₂ = l₁ ++ l₂ 
goal: ∀ {α : Type u_1} {l₁ l₂ : List α}, l₁.append l₂ = l₁ ++ l₂

full_name: List.append_ne_nil_of_ne_nil_left
code: theorem append_ne_nil_of_ne_nil_left (s t : List α) : s ≠ [] → s ++ t ≠ [] 
goal: s ≠ [] → s ++ t ≠ []

full_name: List.append_ne_nil_of_ne_nil_right
code: theorem append_ne_nil_of_ne_nil_right (s t : List α) : t ≠ [] → s ++ t ≠ [] 
goal: t ≠ [] → s ++ t ≠ []

full_name: List.nil_eq_append
code: @[simp] theorem nil_eq_append : [] = a ++ b ↔ a = [] ∧ b = [] 
goal: ∀ {α : Type u_1} {a b : List α}, [] = a ++ b ↔ a = [] ∧ b = []

full_name: List.append_ne_nil_of_left_ne_nil
code: theorem append_ne_nil_of_left_ne_nil (a b : List α) (h0 : a ≠ []) : a ++ b ≠ [] 
goal: a ++ b ≠ []

full_name: List.append_eq_cons
code: theorem append_eq_cons :
    a ++ b = x :: c ↔ (a = [] ∧ b = x :: c) ∨ (∃ a', a = x :: a' ∧ c = a' ++ b) 
goal: ∀ {α : Type u_1} {a b : List α} {x : α} {c : List α},
  a ++ b = x :: c ↔ a = [] ∧ b = x :: c ∨ ∃ a', a = x :: a' ∧ c = a' ++ b

full_name: List.cons_eq_append
code: theorem cons_eq_append :
    x :: c = a ++ b ↔ (a = [] ∧ b = x :: c) ∨ (∃ a', a = x :: a' ∧ c = a' ++ b) 
goal: ∀ {α : Type u_1} {x : α} {c a b : List α}, x :: c = a ++ b ↔ a = [] ∧ b = x :: c ∨ ∃ a', a = x :: a' ∧ c = a' ++ b

full_name: List.append_eq_append_iff
code: theorem append_eq_append_iff {a b c d : List α} :
    a ++ b = c ++ d ↔ (∃ a', c = a ++ a' ∧ b = a' ++ d) ∨ ∃ c', a = c ++ c' ∧ d = c' ++ b 
goal: a ++ b = c ++ d ↔ (∃ a', c = a ++ a' ∧ b = a' ++ d) ∨ ∃ c', a = c ++ c' ∧ d = c' ++ b

full_name: List.mem_append
code: @[simp] theorem mem_append {a : α} {s t : List α} : a ∈ s ++ t ↔ a ∈ s ∨ a ∈ t 
goal: a ∈ s ++ t ↔ a ∈ s ∨ a ∈ t

full_name: List.not_mem_append
code: theorem not_mem_append {a : α} {s t : List α} (h₁ : a ∉ s) (h₂ : a ∉ t) : a ∉ s ++ t 
goal: ¬a ∈ s ++ t

full_name: List.mem_append_eq
code: theorem mem_append_eq (a : α) (s t : List α) : (a ∈ s ++ t) = (a ∈ s ∨ a ∈ t) 
goal: (a ∈ s ++ t) = (a ∈ s ∨ a ∈ t)

full_name: List.mem_append_left
code: theorem mem_append_left {a : α} {l₁ : List α} (l₂ : List α) (h : a ∈ l₁) : a ∈ l₁ ++ l₂ 
goal: a ∈ l₁ ++ l₂

full_name: List.mem_append_right
code: theorem mem_append_right {a : α} (l₁ : List α) {l₂ : List α} (h : a ∈ l₂) : a ∈ l₁ ++ l₂ 
goal: a ∈ l₁ ++ l₂

full_name: List.mem_iff_append
code: theorem mem_iff_append {a : α} {l : List α} : a ∈ l ↔ ∃ s t : List α, l = s ++ a :: t 
goal: a ∈ l ↔ ∃ s t, l = s ++ a :: t

full_name: List.forall_mem_append
code: theorem forall_mem_append {p : α → Prop} {l₁ l₂ : List α} :
    (∀ (x) (_ : x ∈ l₁ ++ l₂), p x) ↔ (∀ (x) (_ : x ∈ l₁), p x) ∧ (∀ (x) (_ : x ∈ l₂), p x) 
goal: (∀ (x : α), x ∈ l₁ ++ l₂ → p x) ↔ (∀ (x : α), x ∈ l₁ → p x) ∧ ∀ (x : α), x ∈ l₂ → p x

full_name: List.concat_nil
code: theorem concat_nil (a : α) : concat [] a = [a] 
goal: [].concat a = [a]

full_name: List.concat_cons
code: theorem concat_cons (a b : α) (l : List α) : concat (a :: l) b = a :: concat l b 
goal: (a :: l).concat b = a :: l.concat b

full_name: List.init_eq_of_concat_eq
code: theorem init_eq_of_concat_eq {a b : α} {l₁ l₂ : List α} : concat l₁ a = concat l₂ b → l₁ = l₂ 
goal: l₁.concat a = l₂.concat b → l₁ = l₂

full_name: List.last_eq_of_concat_eq
code: theorem last_eq_of_concat_eq {a b : α} {l₁ l₂ : List α} : concat l₁ a = concat l₂ b → a = b 
goal: l₁.concat a = l₂.concat b → a = b

full_name: List.concat_inj_left
code: theorem concat_inj_left {l l' : List α} (a : α) : concat l a = concat l' a ↔ l = l' 
goal: l.concat a = l'.concat a ↔ l = l'

full_name: List.concat_eq_concat
code: theorem concat_eq_concat {l l' : List α} {a b : α} : concat l a = concat l' b ↔ l = l' ∧ a = b 
goal: l.concat a = l'.concat b ↔ l = l' ∧ a = b

full_name: List.concat_ne_nil
code: theorem concat_ne_nil (a : α) (l : List α) : concat l a ≠ [] 
goal: l.concat a ≠ []

full_name: List.concat_append
code: theorem concat_append (a : α) (l₁ l₂ : List α) : concat l₁ a ++ l₂ = l₁ ++ a :: l₂ 
goal: l₁.concat a ++ l₂ = l₁ ++ a :: l₂

full_name: List.append_concat
code: theorem append_concat (a : α) (l₁ l₂ : List α) : l₁ ++ concat l₂ a = concat (l₁ ++ l₂) a 
goal: l₁ ++ l₂.concat a = (l₁ ++ l₂).concat a

full_name: List.map_concat
code: theorem map_concat (f : α → β) (a : α) (l : List α) : map f (concat l a) = concat (map f l) (f a) 
goal: List.map f (l.concat a) = (List.map f l).concat (f a)

full_name: List.eq_nil_or_concat
code: theorem eq_nil_or_concat : ∀ l : List α, l = [] ∨ ∃ L b, l = concat L b
  
goal: l = [] ∨ ∃ L b, l = L.concat b

full_name: List.mem_join
code: @[simp] theorem mem_join : ∀ {L : List (List α)}, a ∈ L.join ↔ ∃ l, l ∈ L ∧ a ∈ l
  
goal: a ∈ L.join ↔ ∃ l, l ∈ L ∧ a ∈ l

full_name: List.exists_of_mem_join
code: theorem exists_of_mem_join : a ∈ join L → ∃ l, l ∈ L ∧ a ∈ l 
goal: ∀ {α : Type u_1} {a : α} {L : List (List α)}, a ∈ L.join → ∃ l, l ∈ L ∧ a ∈ l

full_name: List.mem_join_of_mem
code: theorem mem_join_of_mem (lL : l ∈ L) (al : a ∈ l) : a ∈ join L 
goal: ∀ {α : Type u_1} {l : List α} {L : List (List α)} {a : α}, l ∈ L → a ∈ l → a ∈ L.join

full_name: List.map_join
code: @[simp] theorem map_join (f : α → β) (L : List (List α)) : map f (join L) = join (map (map f) L) 
goal: List.map f L.join = (List.map (List.map f) L).join

full_name: List.append_bind
code: @[simp] theorem append_bind xs ys (f : α → List β) :
  List.bind (xs ++ ys) f = List.bind xs f ++ List.bind ys f 
goal: (xs ++ ys).bind f = xs.bind f ++ ys.bind f

full_name: List.bind_id
code: @[simp] theorem bind_id (l : List (List α)) : List.bind l id = l.join 
goal: l.bind id = l.join

full_name: List.mem_bind
code: @[simp] theorem mem_bind {f : α → List β} {b} {l : List α} : b ∈ l.bind f ↔ ∃ a, a ∈ l ∧ b ∈ f a 
goal: b ∈ l.bind f ↔ ∃ a, a ∈ l ∧ b ∈ f a

full_name: List.exists_of_mem_bind
code: theorem exists_of_mem_bind {b : β} {l : List α} {f : α → List β} :
    b ∈ List.bind l f → ∃ a, a ∈ l ∧ b ∈ f a 
goal: b ∈ l.bind f → ∃ a, a ∈ l ∧ b ∈ f a

full_name: List.mem_bind_of_mem
code: theorem mem_bind_of_mem {b : β} {l : List α} {f : α → List β} {a} (al : a ∈ l) (h : b ∈ f a) :
    b ∈ List.bind l f 
goal: b ∈ l.bind f

full_name: List.bind_singleton
code: theorem bind_singleton (f : α → List β) (x : α) : [x].bind f = f x 
goal: [x].bind f = f x

full_name: List.bind_singleton'
code: @[simp] theorem bind_singleton' (l : List α) : (l.bind fun x => [x]) = l 
goal: (l.bind fun x => [x]) = l

full_name: List.bind_assoc
code: theorem bind_assoc {α β} (l : List α) (f : α → List β) (g : β → List γ) :
    (l.bind f).bind g = l.bind fun x => (f x).bind g 
goal: (l.bind f).bind g = l.bind fun x => (f x).bind g

full_name: List.map_bind
code: theorem map_bind (f : β → γ) (g : α → List β) :
    ∀ l : List α, (l.bind g).map f = l.bind fun a => (g a).map f
  
goal: List.map f (l.bind g) = l.bind fun a => List.map f (g a)

full_name: List.bind_map
code: theorem bind_map (f : α → β) (g : β → List γ) (l : List α) : (map f l).bind g = l.bind (fun a => g (f a)) 
goal: (List.map f l).bind g = l.bind fun a => g (f a)

full_name: List.map_eq_bind
code: theorem map_eq_bind {α β} (f : α → β) (l : List α) : map f l = l.bind fun x => [f x] 
goal: List.map f l = l.bind fun x => [f x]

full_name: List.replicate_one
code: @[simp] theorem replicate_one : replicate 1 a = [a] 
goal: ∀ {α : Type u_1} {a : α}, List.replicate 1 a = [a]

full_name: List.contains_replicate
code: @[simp] theorem contains_replicate [BEq α] {n : Nat} {a b : α} :
    (replicate n b).contains a = (a == b && !n == 0) 
goal: (List.replicate n b).contains a = (a == b && !n == 0)

full_name: List.decide_mem_replicate
code: @[simp] theorem decide_mem_replicate [BEq α] [LawfulBEq α] {a b : α} :
    ∀ {n}, decide (b ∈ replicate n a) = ((¬ n == 0) && b == a)
  
goal: decide (b ∈ List.replicate n a) = (decide ¬(n == 0) = true && b == a)

full_name: List.mem_replicate
code: @[simp] theorem mem_replicate {a b : α} : ∀ {n}, b ∈ replicate n a ↔ n ≠ 0 ∧ b = a
  
goal: b ∈ List.replicate n a ↔ n ≠ 0 ∧ b = a

full_name: List.eq_of_mem_replicate
code: theorem eq_of_mem_replicate {a b : α} {n} (h : b ∈ replicate n a) : b = a 
goal: b = a

full_name: List.replicate_succ_ne_nil
code: @[simp] theorem replicate_succ_ne_nil (n : Nat) (a : α) : replicate (n+1) a ≠ [] 
goal: List.replicate (n + 1) a ≠ []

full_name: List.getElem_replicate
code: @[simp] theorem getElem_replicate (a : α) {n : Nat} {m} (h : m < (replicate n a).length) :
    (replicate n a)[m] = a 
goal: (List.replicate n a)[m] = a

full_name: List.get_replicate
code: @[deprecated getElem_replicate (since := "2024-06-12")]
theorem get_replicate (a : α) {n : Nat} (m : Fin _) : (replicate n a).get m = a 
goal: (List.replicate n a).get m = a

full_name: List.getElem?_replicate
code: theorem getElem?_replicate : (replicate n a)[m]? = if m < n then some a else none 
goal: ∀ {α : Type u_1} {a : α} {m : Nat}, (List.replicate n a)[m]? = if m < n then some a else none

full_name: List.getElem?_replicate_of_lt
code: @[simp] theorem getElem?_replicate_of_lt {n : Nat} {m : Nat} (h : m < n) : (replicate n a)[m]? = some a 
goal: ∀ {α : Type u_1} {a : α} {n m : Nat}, m < n → (List.replicate n a)[m]? = some a

full_name: List.replicate_inj
code: @[simp] theorem replicate_inj : replicate n a = replicate m b ↔ n = m ∧ (n = 0 ∨ a = b) 
goal: ∀ {α : Type u_1} {a : α} {m : Nat} {b : α}, List.replicate n a = List.replicate m b ↔ n = m ∧ (n = 0 ∨ a = b)

full_name: List.eq_replicate_of_mem
code: theorem eq_replicate_of_mem {a : α} :
    ∀ {l : List α}, (∀ (b) (_ : b ∈ l), b = a) → l = replicate l.length a
  
goal: (∀ (b : α), b ∈ l → b = a) → l = List.replicate l.length a

full_name: List.eq_replicate
code: theorem eq_replicate {a : α} {n} {l : List α} :
    l = replicate n a ↔ length l = n ∧ ∀ (b) (_ : b ∈ l), b = a 
goal: l = List.replicate n a ↔ l.length = n ∧ ∀ (b : α), b ∈ l → b = a

full_name: List.map_eq_replicate_iff
code: theorem map_eq_replicate_iff {l : List α} {f : α → β} {b : β} :
    l.map f = replicate l.length b ↔ ∀ x ∈ l, f x = b 
goal: List.map f l = List.replicate l.length b ↔ ∀ (x : α), x ∈ l → f x = b

full_name: List.map_const
code: @[simp] theorem map_const (l : List α) (b : β) : map (Function.const α b) l = replicate l.length b 
goal: List.map (Function.const α b) l = List.replicate l.length b

full_name: List.map_const'
code: theorem map_const' (l : List α) (b : β) : map (fun _ => b) l = replicate l.length b 
goal: List.map (fun x => b) l = List.replicate l.length b

full_name: List.append_replicate_replicate
code: @[simp] theorem append_replicate_replicate : replicate n a ++ replicate m a = replicate (n + m) a 
goal: ∀ {α : Type u_1} {a : α} {m : Nat}, List.replicate n a ++ List.replicate m a = List.replicate (n + m) a

full_name: List.map_replicate
code: @[simp] theorem map_replicate : (replicate n a).map f = replicate n (f a) 
goal: ∀ {α : Type u_1} {a : α} {α_1 : Type u_2} {f : α → α_1}, List.map f (List.replicate n a) = List.replicate n (f a)

full_name: List.filter_replicate
code: theorem filter_replicate : (replicate n a).filter p = if p a then replicate n a else [] 
goal: ∀ {α : Type u_1} {a : α} {p : α → Bool},
  List.filter p (List.replicate n a) = if p a = true then List.replicate n a else []

full_name: List.filter_replicate_of_pos
code: @[simp] theorem filter_replicate_of_pos (h : p a) : (replicate n a).filter p = replicate n a 
goal: ∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α}, p a = true → List.filter p (List.replicate n a) = List.replicate n a

full_name: List.filter_replicate_of_neg
code: @[simp] theorem filter_replicate_of_neg (h : ¬ p a) : (replicate n a).filter p = [] 
goal: ∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α}, ¬p a = true → List.filter p (List.replicate n a) = []

full_name: List.filterMap_replicate
code: theorem filterMap_replicate {f : α → Option β} :
    (replicate n a).filterMap f = match f a with | none => [] | .some b => replicate n b 
goal: List.filterMap f (List.replicate n a) =
  match f a with
  | none => []
  | some b => List.replicate n b

full_name: List.filterMap_replicate_of_some
code: theorem filterMap_replicate_of_some {f : α → Option β} (h : f a = some b) :
    (replicate n a).filterMap f = replicate n b 
goal: List.filterMap f (List.replicate n a) = List.replicate n b

full_name: List.filterMap_replicate_of_isSome
code: @[simp] theorem filterMap_replicate_of_isSome {f : α → Option β} (h : (f a).isSome) :
    (replicate n a).filterMap f = replicate n (Option.get _ h) 
goal: List.filterMap f (List.replicate n a) = List.replicate n ((f a).get h)

full_name: List.filterMap_replicate_of_none
code: @[simp] theorem filterMap_replicate_of_none {f : α → Option β} (h : f a = none) :
    (replicate n a).filterMap f = [] 
goal: List.filterMap f (List.replicate n a) = []

full_name: List.join_replicate_nil
code: @[simp] theorem join_replicate_nil : (replicate n ([] : List α)).join = [] 
goal: (List.replicate n []).join = []

full_name: List.join_replicate_singleton
code: @[simp] theorem join_replicate_singleton : (replicate n [a]).join = replicate n a 
goal: ∀ {α : Type u_1} {a : α}, (List.replicate n [a]).join = List.replicate n a

full_name: List.join_replicate_replicate
code: @[simp] theorem join_replicate_replicate : (replicate n (replicate m a)).join = replicate (n * m) a 
goal: ∀ {α : Type u_1} {a : α}, (List.replicate n (List.replicate m a)).join = List.replicate (n * m) a

full_name: List.bind_replicate
code: theorem bind_replicate {β} (f : α → List β) : (replicate n a).bind f = (replicate n (f a)).join 
goal: (List.replicate n a).bind f = (List.replicate n (f a)).join

full_name: List.isEmpty_replicate
code: @[simp] theorem isEmpty_replicate : (replicate n a).isEmpty = decide (n = 0) 
goal: ∀ {α : Type u_1} {a : α}, (List.replicate n a).isEmpty = decide (n = 0)

full_name: List.length_reverse
code: @[simp] theorem length_reverse (as : List α) : (as.reverse).length = as.length 
goal: as.reverse.length = as.length

full_name: List.getElem?_reverse'
code: theorem getElem?_reverse' : ∀ {l : List α} (i j), i + j + 1 = length l →
    l.reverse[i]? = l[j]?
  
goal: i + j + 1 = l.length → l.reverse[i]? = l[j]?

full_name: List.get?_reverse'
code: @[deprecated getElem?_reverse' (since := "2024-06-12")]
theorem get?_reverse' {l : List α} (i j) (h : i + j + 1 = length l) : get? l.reverse i = get? l j 
goal: l.reverse.get? i = l.get? j

full_name: List.getElem?_reverse
code: theorem getElem?_reverse {l : List α} {i} (h : i < length l) :
    l.reverse[i]? = l[l.length - 1 - i]? 
goal: l.reverse[i]? = l[l.length - 1 - i]?

full_name: List.get?_reverse
code: @[deprecated getElem?_reverse (since := "2024-06-12")]
theorem get?_reverse {l : List α} {i} (h : i < length l) :
    get? l.reverse i = get? l (l.length - 1 - i) 
goal: l.reverse.get? i = l.get? (l.length - 1 - i)

full_name: List.reverseAux_reverseAux_nil
code: theorem reverseAux_reverseAux_nil (as bs : List α) : reverseAux (reverseAux as bs) [] = reverseAux bs as 
goal: (as.reverseAux bs).reverseAux [] = bs.reverseAux as

full_name: List.reverse_reverse
code: @[simp] theorem reverse_reverse (as : List α) : as.reverse.reverse = as 
goal: as.reverse.reverse = as

full_name: List.getLast?_reverse
code: @[simp] theorem getLast?_reverse (l : List α) : l.reverse.getLast? = l.head? 
goal: l.reverse.getLast? = l.head?

full_name: List.head?_reverse
code: @[simp] theorem head?_reverse (l : List α) : l.reverse.head? = l.getLast? 
goal: l.reverse.head? = l.getLast?

full_name: List.reverse_append
code: @[simp] theorem reverse_append (as bs : List α) : (as ++ bs).reverse = bs.reverse ++ as.reverse 
goal: (as ++ bs).reverse = bs.reverse ++ as.reverse

full_name: List.map_reverse
code: @[simp] theorem map_reverse (f : α → β) (l : List α) : l.reverse.map f = (l.map f).reverse 
goal: List.map f l.reverse = (List.map f l).reverse

full_name: List.reverse_map
code: @[deprecated map_reverse (since := "2024-06-20")]
theorem reverse_map (f : α → β) (l : List α) : (l.map f).reverse = l.reverse.map f 
goal: (List.map f l).reverse = List.map f l.reverse

full_name: List.reverse_eq_nil_iff
code: @[simp] theorem reverse_eq_nil_iff {xs : List α} : xs.reverse = [] ↔ xs = [] 
goal: xs.reverse = [] ↔ xs = []

full_name: List.mem_reverseAux
code: @[simp] theorem mem_reverseAux {x : α} : ∀ {as bs}, x ∈ reverseAux as bs ↔ x ∈ as ∨ x ∈ bs
  
goal: x ∈ as.reverseAux bs ↔ x ∈ as ∨ x ∈ bs

full_name: List.mem_reverse
code: @[simp] theorem mem_reverse {x : α} {as : List α} : x ∈ reverse as ↔ x ∈ as 
goal: x ∈ as.reverse ↔ x ∈ as

full_name: List.reverseAux_eq
code: theorem reverseAux_eq (as bs : List α) : reverseAux as bs = reverse as ++ bs 
goal: as.reverseAux bs = as.reverse ++ bs

full_name: List.foldrM_reverse
code: @[simp] theorem foldrM_reverse [Monad m] (l : List α) (f : α → β → m β) (b) :
    l.reverse.foldrM f b = l.foldlM (fun x y => f y x) b 
goal: List.foldrM f b l.reverse = List.foldlM (fun x y => f y x) b l

full_name: List.foldl_reverse
code: @[simp] theorem foldl_reverse (l : List α) (f : β → α → β) (b) :
    l.reverse.foldl f b = l.foldr (fun x y => f y x) b 
goal: List.foldl f b l.reverse = List.foldr (fun x y => f y x) b l

full_name: List.foldr_reverse
code: @[simp] theorem foldr_reverse (l : List α) (f : α → β → β) (b) :
    l.reverse.foldr f b = l.foldl (fun x y => f y x) b 
goal: List.foldr f b l.reverse = List.foldl (fun x y => f y x) b l

full_name: List.reverse_replicate
code: @[simp] theorem reverse_replicate (n) (a : α) : reverse (replicate n a) = replicate n a 
goal: (List.replicate n a).reverse = List.replicate n a

full_name: List.elem_cons_self
code: @[simp] theorem elem_cons_self [BEq α] [LawfulBEq α] {a : α} : (a::as).elem a = true 
goal: List.elem a (a :: as) = true

full_name: List.contains_cons
code: @[simp] theorem contains_cons [BEq α] :
    (a :: as : List α).contains x = (x == a || as.contains x) 
goal: (a :: as).contains x = (x == a || as.contains x)

full_name: List.contains_eq_any_beq
code: theorem contains_eq_any_beq [BEq α] (l : List α) (a : α) : l.contains a = l.any (a == ·) 
goal: l.contains a = l.any fun x => a == x

full_name: List.take_append_drop
code: @[simp] theorem take_append_drop : ∀ (n : Nat) (l : List α), take n l ++ drop n l = l
  
goal: List.take n l ++ List.drop n l = l

full_name: List.length_drop
code: @[simp] theorem length_drop : ∀ (i : Nat) (l : List α), length (drop i l) = length l - i
  
goal: (List.drop i l).length = l.length - i

full_name: List.drop_length_le
code: theorem drop_length_le {l : List α} (h : l.length ≤ i) : drop i l = [] 
goal: List.drop i l = []

full_name: List.take_length_le
code: theorem take_length_le {l : List α} (h : l.length ≤ i) : take i l = l 
goal: List.take i l = l

full_name: List.drop_length
code: @[simp] theorem drop_length (l : List α) : drop l.length l = [] 
goal: List.drop l.length l = []

full_name: List.take_length
code: @[simp] theorem take_length (l : List α) : take l.length l = l 
goal: List.take l.length l = l

full_name: List.take_concat_get
code: theorem take_concat_get (l : List α) (i : Nat) (h : i < l.length) :
    (l.take i).concat l[i] = l.take (i+1) 
goal: (List.take i l).concat l[i] = List.take (i + 1) l

full_name: List.reverse_concat
code: theorem reverse_concat (l : List α) (a : α) : (l.concat a).reverse = a :: l.reverse 
goal: (l.concat a).reverse = a :: l.reverse

full_name: List.take_succ_cons
code: abbrev take_succ_cons 
goal: ∀ {α : Type u_1} {a : α} {as : List α} {i : Nat}, List.take (i + 1) (a :: as) = a :: List.take i as

full_name: List.take_all_of_le
code: theorem take_all_of_le {n} {l : List α} (h : length l ≤ n) : take n l = l 
goal: List.take n l = l

full_name: List.take_left
code: @[simp]
theorem take_left : ∀ l₁ l₂ : List α, take (length l₁) (l₁ ++ l₂) = l₁
  
goal: List.take l₁.length (l₁ ++ l₂) = l₁

full_name: List.take_left'
code: theorem take_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : take n (l₁ ++ l₂) = l₁ 
goal: List.take n (l₁ ++ l₂) = l₁

full_name: List.map_take
code: @[simp] theorem map_take (f : α → β) :
    ∀ (L : List α) (i : Nat), (L.take i).map f = (L.map f).take i
  
goal: List.map f (List.take i L) = List.take i (List.map f L)

full_name: List.getElem?_take
code: theorem getElem?_take {l : List α} {n m : Nat} (h : m < n) : (l.take n)[m]? = l[m]? 
goal: (List.take n l)[m]? = l[m]?

full_name: List.get?_take
code: @[deprecated getElem?_take (since := "2024-06-12")]
theorem get?_take {l : List α} {n m : Nat} (h : m < n) : (l.take n).get? m = l.get? m 
goal: (List.take n l).get? m = l.get? m

full_name: List.get?_take_of_succ
code: @[simp]
theorem get?_take_of_succ {l : List α} {n : Nat} : (l.take (n + 1))[n]? = l[n]? 
goal: (List.take (n + 1) l)[n]? = l[n]?

full_name: List.take_succ
code: theorem take_succ {l : List α} {n : Nat} : l.take (n + 1) = l.take n ++ l[n]?.toList 
goal: List.take (n + 1) l = List.take n l ++ l[n]?.toList

full_name: List.take_eq_nil_iff
code: @[simp]
theorem take_eq_nil_iff {l : List α} {k : Nat} : l.take k = [] ↔ l = [] ∨ k = 0 
goal: List.take k l = [] ↔ l = [] ∨ k = 0

full_name: List.take_eq_nil_of_eq_nil
code: theorem take_eq_nil_of_eq_nil : ∀ {as : List α} {i}, as = [] → as.take i = []
  
goal: as = [] → List.take i as = []

full_name: List.ne_nil_of_take_ne_nil
code: theorem ne_nil_of_take_ne_nil {as : List α} {i : Nat} (h: as.take i ≠ []) : as ≠ [] 
goal: as ≠ []

full_name: List.dropLast_eq_take
code: theorem dropLast_eq_take (l : List α) : l.dropLast = l.take l.length.pred 
goal: l.dropLast = List.take l.length.pred l

full_name: List.drop_eq_nil_iff_le
code: @[simp]
theorem drop_eq_nil_iff_le {l : List α} {k : Nat} : l.drop k = [] ↔ l.length ≤ k 
goal: List.drop k l = [] ↔ l.length ≤ k

full_name: List.drop_sizeOf_le
code: theorem drop_sizeOf_le [SizeOf α] (l : List α) (n : Nat) : sizeOf (l.drop n) ≤ sizeOf l 
goal: sizeOf (List.drop n l) ≤ sizeOf l

full_name: List.drop_drop
code: @[simp] theorem drop_drop (n : Nat) : ∀ (m) (l : List α), drop n (drop m l) = drop (n + m) l
  
goal: List.drop n (List.drop m l) = List.drop (n + m) l

full_name: List.take_drop
code: theorem take_drop : ∀ (m n : Nat) (l : List α), take n (drop m l) = drop m (take (m + n) l)
  
goal: List.take n (List.drop m l) = List.drop m (List.take (m + n) l)

full_name: List.map_drop
code: @[simp] theorem map_drop (f : α → β) :
    ∀ (L : List α) (i : Nat), (L.drop i).map f = (L.map f).drop i
  
goal: List.map f (List.drop i L) = List.drop i (List.map f L)

full_name: List.getElem_cons_drop
code: @[simp]
theorem getElem_cons_drop : ∀ (l : List α) (i : Nat) (h : i < l.length),
    l[i] :: drop (i + 1) l = drop i l
  
goal: l[i] :: List.drop (i + 1) l = List.drop i l

full_name: List.get_cons_drop
code: @[deprecated getElem_cons_drop (since := "2024-06-12")]
theorem get_cons_drop (l : List α) (i) : get l i :: drop (i + 1) l = drop i l 
goal: l.get i :: List.drop (↑i + 1) l = List.drop (↑i) l

full_name: List.drop_eq_getElem_cons
code: theorem drop_eq_getElem_cons {n} {l : List α} (h) : drop n l = l[n] :: drop (n + 1) l 
goal: List.drop n l = l[n] :: List.drop (n + 1) l

full_name: List.drop_eq_get_cons
code: @[deprecated drop_eq_getElem_cons (since := "2024-06-12")]
theorem drop_eq_get_cons {n} {l : List α} (h) : drop n l = get l ⟨n, h⟩ :: drop (n + 1) l 
goal: List.drop n l = l.get ⟨n, h⟩ :: List.drop (n + 1) l

full_name: List.drop_eq_nil_of_eq_nil
code: theorem drop_eq_nil_of_eq_nil : ∀ {as : List α} {i}, as = [] → as.drop i = []
  
goal: as = [] → List.drop i as = []

full_name: List.ne_nil_of_drop_ne_nil
code: theorem ne_nil_of_drop_ne_nil {as : List α} {i : Nat} (h: as.drop i ≠ []) : as ≠ [] 
goal: as ≠ []

full_name: List.drop_add
code: @[deprecated drop_drop (since := "2024-06-15")]
theorem drop_add (m n) (l : List α) : drop (m + n) l = drop m (drop n l) 
goal: List.drop (m + n) l = List.drop m (List.drop n l)

full_name: List.drop_left
code: @[simp]
theorem drop_left : ∀ l₁ l₂ : List α, drop (length l₁) (l₁ ++ l₂) = l₂
  
goal: List.drop l₁.length (l₁ ++ l₂) = l₂

full_name: List.drop_left'
code: theorem drop_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : drop n (l₁ ++ l₂) = l₂ 
goal: List.drop n (l₁ ++ l₂) = l₂

full_name: List.takeWhile_cons
code: theorem takeWhile_cons (p : α → Bool) (a : α) (l : List α) :
    (a :: l).takeWhile p = if p a then a :: l.takeWhile p else [] 
goal: List.takeWhile p (a :: l) = if p a = true then a :: List.takeWhile p l else []

full_name: List.dropWhile_cons
code: theorem dropWhile_cons :
    (x :: xs : List α).dropWhile p = if p x then xs.dropWhile p else x :: xs 
goal: List.dropWhile p (x :: xs) = if p x = true then List.dropWhile p xs else x :: xs

full_name: List.takeWhile_map
code: theorem takeWhile_map (f : α → β) (p : β → Bool) (l : List α) :
    (l.map f).takeWhile p = (l.takeWhile (p ∘ f)).map f 
goal: List.takeWhile p (List.map f l) = List.map f (List.takeWhile (p ∘ f) l)

full_name: List.dropWhile_map
code: theorem dropWhile_map (f : α → β) (p : β → Bool) (l : List α) :
    (l.map f).dropWhile p = (l.dropWhile (p ∘ f)).map f 
goal: List.dropWhile p (List.map f l) = List.map f (List.dropWhile (p ∘ f) l)

full_name: List.takeWhile_append_dropWhile
code: @[simp] theorem takeWhile_append_dropWhile (p : α → Bool) :
    ∀ (l : List α), takeWhile p l ++ dropWhile p l = l
  
goal: List.takeWhile p l ++ List.dropWhile p l = l

full_name: List.dropWhile_append
code: theorem dropWhile_append {xs ys : List α} :
    (xs ++ ys).dropWhile p =
      if (xs.dropWhile p).isEmpty then ys.dropWhile p else xs.dropWhile p ++ ys 
goal: List.dropWhile p (xs ++ ys) =
  if (List.dropWhile p xs).isEmpty = true then List.dropWhile p ys else List.dropWhile p xs ++ ys

full_name: List.takeWhile_replicate_eq_filter
code: @[simp] theorem takeWhile_replicate_eq_filter (p : α → Bool) :
    (replicate n a).takeWhile p = (replicate n a).filter p 
goal: List.takeWhile p (List.replicate n a) = List.filter p (List.replicate n a)

full_name: List.takeWhile_replicate
code: theorem takeWhile_replicate (p : α → Bool) :
    (replicate n a).takeWhile p = if p a then replicate n a else [] 
goal: List.takeWhile p (List.replicate n a) = if p a = true then List.replicate n a else []

full_name: List.dropWhile_replicate_eq_filter_not
code: @[simp] theorem dropWhile_replicate_eq_filter_not (p : α → Bool) :
    (replicate n a).dropWhile p = (replicate n a).filter (fun a => !p a) 
goal: List.dropWhile p (List.replicate n a) = List.filter (fun a => !p a) (List.replicate n a)

full_name: List.dropWhile_replicate
code: theorem dropWhile_replicate (p : α → Bool) :
    (replicate n a).dropWhile p = if p a then [] else replicate n a 
goal: List.dropWhile p (List.replicate n a) = if p a = true then [] else List.replicate n a

full_name: List.partition_eq_filter_filter.aux
code: @[simp] theorem partition_eq_filter_filter (p : α → Bool) (l : List α) :
    partition p l = (filter p l, filter (not ∘ p) l) 
goal: List.partition.loop p l (as, bs) = (as.reverse ++ List.filter p l, bs.reverse ++ List.filter (not ∘ p) l)

full_name: List.partition_eq_filter_filter
code: @[simp] theorem partition_eq_filter_filter (p : α → Bool) (l : List α) :
    partition p l = (filter p l, filter (not ∘ p) l) 
goal: List.partition p l = (List.filter p l, List.filter (not ∘ p) l)

full_name: List.length_dropLast
code: @[simp] theorem length_dropLast : ∀ (xs : List α), xs.dropLast.length = xs.length - 1
  
goal: xs.dropLast.length = xs.length - 1

full_name: List.getElem_dropLast
code: @[simp] theorem getElem_dropLast : ∀ (xs : List α) (i : Nat) (h : i < xs.dropLast.length),
    xs.dropLast[i] = xs[i]'(Nat.lt_of_lt_of_le h (length_dropLast .. ▸ Nat.pred_le _))
  
goal: xs.dropLast[i] = xs[i]

full_name: List.get_dropLast
code: @[deprecated getElem_dropLast (since := "2024-06-12")]
theorem get_dropLast (xs : List α) (i : Fin xs.dropLast.length) :
    xs.dropLast.get i = xs.get ⟨i, Nat.lt_of_lt_of_le i.isLt (length_dropLast .. ▸ Nat.pred_le _)⟩ 
goal: xs.dropLast.get i = xs.get ⟨↑i, ⋯⟩

full_name: List.dropLast_cons_of_ne_nil
code: theorem dropLast_cons_of_ne_nil {α : Type u} {x : α}
    {l : List α} (h : l ≠ []) : (x :: l).dropLast = x :: l.dropLast 
goal: (x :: l).dropLast = x :: l.dropLast

full_name: List.dropLast_append_of_ne_nil
code: @[simp] theorem dropLast_append_of_ne_nil {α : Type u} {l : List α} :
    ∀ (l' : List α) (_ : l ≠ []), (l' ++ l).dropLast = l' ++ l.dropLast
  
goal: l ≠ [] → (l' ++ l).dropLast = l' ++ l.dropLast

full_name: List.dropLast_append_cons
code: theorem dropLast_append_cons : dropLast (l₁ ++ b::l₂) = l₁ ++ dropLast (b::l₂) 
goal: ∀ {α : Type u_1} {l₁ : List α} {b : α} {l₂ : List α}, (l₁ ++ b :: l₂).dropLast = l₁ ++ (b :: l₂).dropLast

full_name: List.dropLast_concat
code: @[simp 1100] theorem dropLast_concat : dropLast (l₁ ++ [b]) = l₁ 
goal: ∀ {α : Type u_1} {l₁ : List α} {b : α}, (l₁ ++ [b]).dropLast = l₁

full_name: List.map_dropLast
code: @[simp] theorem map_dropLast (f : α → β) (l : List α) : l.dropLast.map f = (l.map f).dropLast 
goal: List.map f l.dropLast = (List.map f l).dropLast

full_name: List.dropLast_replicate
code: @[simp] theorem dropLast_replicate (n) (a : α) : dropLast (replicate n a) = replicate (n - 1) a 
goal: (List.replicate n a).dropLast = List.replicate (n - 1) a

full_name: List.dropLast_cons_self_replicate
code: @[simp] theorem dropLast_cons_self_replicate (n) (a : α) :
    dropLast (a :: replicate n a) = replicate n a 
goal: (a :: List.replicate n a).dropLast = List.replicate n a

full_name: List.isPrefixOf_cons₂_self
code: @[simp] theorem isPrefixOf_cons₂_self [LawfulBEq α] {a : α} :
    isPrefixOf (a::as) (a::bs) = isPrefixOf as bs 
goal: (a :: as).isPrefixOf (a :: bs) = as.isPrefixOf bs

full_name: List.isPrefixOf_length_pos_nil
code: @[simp] theorem isPrefixOf_length_pos_nil {L : List α} (h : 0 < L.length) : isPrefixOf L [] = false 
goal: L.isPrefixOf [] = false

full_name: List.isPrefixOf_replicate
code: @[simp] theorem isPrefixOf_replicate {a : α} :
    isPrefixOf l (replicate n a) = (decide (l.length ≤ n) && l.all (· == a)) 
goal: l.isPrefixOf (List.replicate n a) = (decide (l.length ≤ n) && l.all fun x => x == a)

full_name: List.isSuffixOf_cons_nil
code: @[simp] theorem isSuffixOf_cons_nil : isSuffixOf (a::as) ([] : List α) = false 
goal: (a :: as).isSuffixOf [] = false

full_name: List.isSuffixOf_replicate
code: @[simp] theorem isSuffixOf_replicate {a : α} :
    isSuffixOf l (replicate n a) = (decide (l.length ≤ n) && l.all (· == a)) 
goal: l.isSuffixOf (List.replicate n a) = (decide (l.length ≤ n) && l.all fun x => x == a)

full_name: List.rotateLeft_zero
code: @[simp] theorem rotateLeft_zero (l : List α) : rotateLeft l 0 = l 
goal: l.rotateLeft 0 = l

full_name: List.rotateRight_zero
code: @[simp] theorem rotateRight_zero (l : List α) : rotateRight l 0 = l 
goal: l.rotateRight 0 = l

full_name: List.replace_cons_self
code: @[simp] theorem replace_cons_self [LawfulBEq α] {a : α} : (a::as).replace a b = b::as 
goal: (a :: as).replace a b = b :: as

full_name: List.replace_of_not_mem
code: @[simp] theorem replace_of_not_mem {l : List α} (h : !l.elem a) : l.replace a b = l 
goal: l.replace a b = l

full_name: List.replace_replicate_self
code: @[simp] theorem replace_replicate_self [LawfulBEq α] {a : α} (h : 0 < n) :
    (replicate n a).replace a b = b :: replicate (n - 1) a 
goal: (List.replicate n a).replace a b = b :: List.replicate (n - 1) a

full_name: List.replace_replicate_ne
code: @[simp] theorem replace_replicate_ne {a b c : α} (h : !b == a) :
    (replicate n a).replace b c = replicate n a 
goal: (List.replicate n a).replace b c = List.replicate n a

full_name: List.insert_nil
code: @[simp] theorem insert_nil (a : α) : [].insert a = [a] 
goal: List.insert a [] = [a]

full_name: List.insert_of_mem
code: @[simp] theorem insert_of_mem {l : List α} (h : a ∈ l) : l.insert a = l 
goal: List.insert a l = l

full_name: List.insert_of_not_mem
code: @[simp] theorem insert_of_not_mem {l : List α} (h : a ∉ l) : l.insert a = a :: l 
goal: List.insert a l = a :: l

full_name: List.mem_insert_iff
code: @[simp] theorem mem_insert_iff {l : List α} : a ∈ l.insert b ↔ a = b ∨ a ∈ l 
goal: a ∈ List.insert b l ↔ a = b ∨ a ∈ l

full_name: List.mem_insert_self
code: @[simp 1100] theorem mem_insert_self (a : α) (l : List α) : a ∈ l.insert a 
goal: a ∈ List.insert a l

full_name: List.mem_insert_of_mem
code: theorem mem_insert_of_mem {l : List α} (h : a ∈ l) : a ∈ l.insert b 
goal: a ∈ List.insert b l

full_name: List.eq_or_mem_of_mem_insert
code: theorem eq_or_mem_of_mem_insert {l : List α} (h : a ∈ l.insert b) : a = b ∨ a ∈ l 
goal: a = b ∨ a ∈ l

full_name: List.length_insert_of_mem
code: @[simp] theorem length_insert_of_mem {l : List α} (h : a ∈ l) :
    length (l.insert a) = length l 
goal: (List.insert a l).length = l.length

full_name: List.length_insert_of_not_mem
code: @[simp] theorem length_insert_of_not_mem {l : List α} (h : a ∉ l) :
    length (l.insert a) = length l + 1 
goal: (List.insert a l).length = l.length + 1

full_name: List.insert_replicate_self
code: @[simp] theorem insert_replicate_self {a : α} (h : 0 < n) : (replicate n a).insert a = replicate n a 
goal: List.insert a (List.replicate n a) = List.replicate n a

full_name: List.insert_replicate_ne
code: @[simp] theorem insert_replicate_ne {a b : α} (h : !b == a) :
    (replicate n a).insert b = b :: replicate n a 
goal: List.insert b (List.replicate n a) = b :: List.replicate n a

full_name: List.erase_cons_head
code: @[simp] theorem erase_cons_head [LawfulBEq α] (a : α) (l : List α) : (a :: l).erase a = l 
goal: (a :: l).erase a = l

full_name: List.erase_cons_tail
code: @[simp] theorem erase_cons_tail {a b : α} (l : List α) (h : ¬(b == a)) :
    (b :: l).erase a = b :: l.erase a 
goal: (b :: l).erase a = b :: l.erase a

full_name: List.erase_of_not_mem
code: theorem erase_of_not_mem [LawfulBEq α] {a : α} : ∀ {l : List α}, a ∉ l → l.erase a = l
  
goal: ¬a ∈ l → l.erase a = l

full_name: List.erase_replicate_self
code: @[simp] theorem erase_replicate_self [LawfulBEq α] {a : α} :
    (replicate n a).erase a = replicate (n - 1) a 
goal: (List.replicate n a).erase a = List.replicate (n - 1) a

full_name: List.erase_replicate_ne
code: @[simp] theorem erase_replicate_ne [LawfulBEq α] {a b : α} (h : !b == a) :
    (replicate n a).erase b = replicate n a 
goal: (List.replicate n a).erase b = List.replicate n a

full_name: List.find?_cons_of_pos
code: @[simp] theorem find?_cons_of_pos (l) (h : p a) : find? p (a :: l) = some a 
goal: ∀ {α : Type u_1} {p : α → Bool} {a : α} (l : List α), p a = true → List.find? p (a :: l) = some a

full_name: List.find?_cons_of_neg
code: @[simp] theorem find?_cons_of_neg (l) (h : ¬p a) : find? p (a :: l) = find? p l 
goal: ∀ {α : Type u_1} {p : α → Bool} {a : α} (l : List α), ¬p a = true → List.find? p (a :: l) = List.find? p l

full_name: List.find?_eq_none
code: @[simp] theorem find?_eq_none : find? p l = none ↔ ∀ x ∈ l, ¬ p x 
goal: ∀ {α : Type u_1} {p : α → Bool} {l : List α}, List.find? p l = none ↔ ∀ (x : α), x ∈ l → ¬p x = true

full_name: List.find?_some
code: theorem find?_some : ∀ {l}, find? p l = some a → p a
  
goal: ∀ {α : Type u_1} {p : α → Bool} {a : α} {l : List α}, List.find? p l = some a → p a = true

full_name: List.mem_of_find?_eq_some
code: @[simp] theorem mem_of_find?_eq_some : ∀ {l}, find? p l = some a → a ∈ l
  
goal: ∀ {α : Type u_1} {p : α → Bool} {a : α} {l : List α}, List.find? p l = some a → a ∈ l

full_name: List.find?_map
code: @[simp] theorem find?_map (f : β → α) (l : List β) : find? p (l.map f) = (l.find? (p ∘ f)).map f 
goal: List.find? p (List.map f l) = Option.map f (List.find? (p ∘ f) l)

full_name: List.find?_replicate
code: theorem find?_replicate : find? p (replicate n a) = if n = 0 then none else if p a then some a else none 
goal: ∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α},
  List.find? p (List.replicate n a) = if n = 0 then none else if p a = true then some a else none

full_name: List.find?_replicate_of_length_pos
code: @[simp] theorem find?_replicate_of_length_pos (h : 0 < n) : find? p (replicate n a) = if p a then some a else none 
goal: ∀ {α : Type u_1} {p : α → Bool} {a : α}, 0 < n → List.find? p (List.replicate n a) = if p a = true then some a else none

full_name: List.find?_replicate_of_pos
code: @[simp] theorem find?_replicate_of_pos (h : p a) : find? p (replicate n a) = if n = 0 then none else some a 
goal: ∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α},
  p a = true → List.find? p (List.replicate n a) = if n = 0 then none else some a

full_name: List.find?_replicate_of_neg
code: @[simp] theorem find?_replicate_of_neg (h : ¬ p a) : find? p (replicate n a) = none 
goal: ∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α}, ¬p a = true → List.find? p (List.replicate n a) = none

full_name: List.findSome?_cons_of_isSome
code: @[simp] theorem findSome?_cons_of_isSome (l) (h : (f a).isSome) : findSome? f (a :: l) = f a 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {a : α} (l : List α),
  (f a).isSome = true → List.findSome? f (a :: l) = f a

full_name: List.findSome?_cons_of_isNone
code: @[simp] theorem findSome?_cons_of_isNone (l) (h : (f a).isNone) : findSome? f (a :: l) = findSome? f l 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {a : α} (l : List α),
  (f a).isNone = true → List.findSome? f (a :: l) = List.findSome? f l

full_name: List.exists_of_findSome?_eq_some
code: theorem exists_of_findSome?_eq_some {l : List α} {f : α → Option β} (w : l.findSome? f = some b) :
    ∃ a, a ∈ l ∧ f a = b 
goal: ∃ a, a ∈ l ∧ f a = some b

full_name: List.findSome?_map
code: @[simp] theorem findSome?_map (f : β → γ) (l : List β) : findSome? p (l.map f) = l.findSome? (p ∘ f) 
goal: ∀ {α : Type u_3} {p : γ → Option α} (f : β → γ) (l : List β), List.findSome? p (List.map f l) = List.findSome? (p ∘ f) l

full_name: List.findSome?_replicate
code: theorem findSome?_replicate : findSome? f (replicate n a) = if n = 0 then none else f a 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {n : Nat} {a : α},
  List.findSome? f (List.replicate n a) = if n = 0 then none else f a

full_name: List.findSome?_replicate_of_pos
code: @[simp] theorem findSome?_replicate_of_pos (h : 0 < n) : findSome? f (replicate n a) = f a 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {a : α}, 0 < n → List.findSome? f (List.replicate n a) = f a

full_name: List.find?_replicate_of_isSome
code: @[simp] theorem find?_replicate_of_isSome (h : (f a).isSome) : findSome? f (replicate n a) = if n = 0 then none else f a 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {n : Nat} {a : α},
  (f a).isSome = true → List.findSome? f (List.replicate n a) = if n = 0 then none else f a

full_name: List.find?_replicate_of_isNone
code: @[simp] theorem find?_replicate_of_isNone (h : (f a).isNone) : findSome? f (replicate n a) = none 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {f : α → Option α_1} {n : Nat} {a : α},
  (f a).isNone = true → List.findSome? f (List.replicate n a) = none

full_name: List.lookup_cons_self
code: @[simp] theorem lookup_cons_self  {k : α} : ((k,b)::es).lookup k = some b 
goal: ∀ {β : Type u_1} {b : β} {es : List (α × β)} {k : α}, List.lookup k ((k, b) :: es) = some b

full_name: List.lookup_replicate
code: theorem lookup_replicate {k : α} :
    (replicate n (a,b)).lookup k = if n = 0 then none else if k == a then some b else none 
goal: ∀ {α_1 : Type u_1} {b : α_1} {k : α},
  List.lookup k (List.replicate n (a, b)) = if n = 0 then none else if (k == a) = true then some b else none

full_name: List.lookup_replicate_of_pos
code: theorem lookup_replicate_of_pos {k : α} (h : 0 < n) :
    (replicate n (a,b)).lookup k = if k == a then some b else none 
goal: ∀ {α_1 : Type u_1} {b : α_1} {k : α},
  0 < n → List.lookup k (List.replicate n (a, b)) = if (k == a) = true then some b else none

full_name: List.lookup_replicate_self
code: theorem lookup_replicate_self {a : α} :
    (replicate n (a, b)).lookup a = if n = 0 then none else some b 
goal: ∀ {α_1 : Type u_1} {b : α_1} {a : α}, List.lookup a (List.replicate n (a, b)) = if n = 0 then none else some b

full_name: List.lookup_replicate_self_of_pos
code: @[simp] theorem lookup_replicate_self_of_pos {a : α} (h : 0 < n) :
    (replicate n (a, b)).lookup a = some b 
goal: ∀ {α_1 : Type u_1} {b : α_1} {a : α}, 0 < n → List.lookup a (List.replicate n (a, b)) = some b

full_name: List.lookup_replicate_ne
code: @[simp] theorem lookup_replicate_ne {k : α} (h : !k == a) :
    (replicate n (a,b)).lookup k = none 
goal: ∀ {α_1 : Type u_1} {b : α_1} {k : α}, (!k == a) = true → List.lookup k (List.replicate n (a, b)) = none

full_name: List.not_any_eq_all_not
code: theorem not_any_eq_all_not (l : List α) (p : α → Bool) : (!l.any p) = l.all fun a => !p a 
goal: (!l.any p) = l.all fun a => !p a

full_name: List.not_all_eq_any_not
code: theorem not_all_eq_any_not (l : List α) (p : α → Bool) : (!l.all p) = l.any fun a => !p a 
goal: (!l.all p) = l.any fun a => !p a

full_name: List.and_any_distrib_left
code: theorem and_any_distrib_left (l : List α) (p : α → Bool) (q : Bool) :
    (q && l.any p) = l.any fun a => q && p a 
goal: (q && l.any p) = l.any fun a => q && p a

full_name: List.and_any_distrib_right
code: theorem and_any_distrib_right (l : List α) (p : α → Bool) (q : Bool) :
    (l.any p && q) = l.any fun a => p a && q 
goal: (l.any p && q) = l.any fun a => p a && q

full_name: List.or_all_distrib_left
code: theorem or_all_distrib_left (l : List α) (p : α → Bool) (q : Bool) :
    (q || l.all p) = l.all fun a => q || p a 
goal: (q || l.all p) = l.all fun a => q || p a

full_name: List.or_all_distrib_right
code: theorem or_all_distrib_right (l : List α) (p : α → Bool) (q : Bool) :
    (l.all p || q) = l.all fun a => p a || q 
goal: (l.all p || q) = l.all fun a => p a || q

full_name: List.any_eq_not_all_not
code: theorem any_eq_not_all_not (l : List α) (p : α → Bool) : l.any p = !l.all (!p .) 
goal: l.any p = !l.all fun x => !p x

full_name: List.all_eq_not_any_not
code: theorem all_eq_not_any_not (l : List α) (p : α → Bool) : l.all p = !l.any (!p .) 
goal: l.all p = !l.any fun x => !p x

full_name: List.any_map
code: theorem any_map (f : α → β) (l : List α) (p : β → Bool) : (l.map f).any p = l.any (p ∘ f) 
goal: (List.map f l).any p = l.any (p ∘ f)

full_name: List.all_map
code: theorem all_map (f : α → β) (l : List α) (p : β → Bool) : (l.map f).all p = l.all (p ∘ f) 
goal: (List.map f l).all p = l.all (p ∘ f)

full_name: List.zip_map
code: theorem zip_map (f : α → γ) (g : β → δ) :
    ∀ (l₁ : List α) (l₂ : List β), zip (l₁.map f) (l₂.map g) = (zip l₁ l₂).map (Prod.map f g)
  
goal: (List.map f l₁).zip (List.map g l₂) = List.map (Prod.map f g) (l₁.zip l₂)

full_name: List.zip_map_left
code: theorem zip_map_left (f : α → γ) (l₁ : List α) (l₂ : List β) :
    zip (l₁.map f) l₂ = (zip l₁ l₂).map (Prod.map f id) 
goal: (List.map f l₁).zip l₂ = List.map (Prod.map f id) (l₁.zip l₂)

full_name: List.zip_map_right
code: theorem zip_map_right (f : β → γ) (l₁ : List α) (l₂ : List β) :
    zip l₁ (l₂.map f) = (zip l₁ l₂).map (Prod.map id f) 
goal: l₁.zip (List.map f l₂) = List.map (Prod.map id f) (l₁.zip l₂)

full_name: List.zip_append
code: theorem zip_append :
    ∀ {l₁ r₁ : List α} {l₂ r₂ : List β} (_h : length l₁ = length l₂),
      zip (l₁ ++ r₁) (l₂ ++ r₂) = zip l₁ l₂ ++ zip r₁ r₂
  
goal: (l₁ ++ r₁).zip (l₂ ++ r₂) = l₁.zip l₂ ++ r₁.zip r₂

full_name: List.zip_map'
code: theorem zip_map' (f : α → β) (g : α → γ) :
    ∀ l : List α, zip (l.map f) (l.map g) = l.map fun a => (f a, g a)
  
goal: (List.map f l).zip (List.map g l) = List.map (fun a => (f a, g a)) l

full_name: List.of_mem_zip
code: theorem of_mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂
  
goal: (a, b) ∈ l₁.zip l₂ → a ∈ l₁ ∧ b ∈ l₂

full_name: List.map_fst_zip
code: theorem map_fst_zip :
    ∀ (l₁ : List α) (l₂ : List β), l₁.length ≤ l₂.length → map Prod.fst (zip l₁ l₂) = l₁
  
goal: l₁.length ≤ l₂.length → List.map Prod.fst (l₁.zip l₂) = l₁

full_name: List.map_snd_zip
code: theorem map_snd_zip :
    ∀ (l₁ : List α) (l₂ : List β), l₂.length ≤ l₁.length → map Prod.snd (zip l₁ l₂) = l₂
  
goal: l₂.length ≤ l₁.length → List.map Prod.snd (l₁.zip l₂) = l₂

full_name: List.zip_replicate'
code: /-- See also `List.zip_replicate` in `Init.Data.List.TakeDrop` for a generalization with different lengths. -/
@[simp] theorem zip_replicate' {a : α} {b : β} {n : Nat} :
    zip (replicate n a) (replicate n b) = replicate n (a, b) 
goal: (List.replicate n a).zip (List.replicate n b) = List.replicate n (a, b)

full_name: List.getElem?_zipWith
code: theorem getElem?_zipWith {f : α → β → γ} {i : Nat} :
    (List.zipWith f as bs)[i]? = match as[i]?, bs[i]? with
      | some a, some b => some (f a b) | _, _ => none 
goal: (List.zipWith f as bs)[i]? =
  match as[i]?, bs[i]? with
  | some a, some b => some (f a b)
  | x, x_1 => none

full_name: List.get?_zipWith
code: @[deprecated getElem?_zipWith (since := "2024-06-12")]
theorem get?_zipWith {f : α → β → γ} :
    (List.zipWith f as bs).get? i = match as.get? i, bs.get? i with
      | some a, some b => some (f a b) | _, _ => none 
goal: (List.zipWith f as bs).get? i =
  match as.get? i, bs.get? i with
  | some a, some b => some (f a b)
  | x, x_1 => none

full_name: List.zipWith_get?
code: @[deprecated getElem?_zipWith (since := "2024-06-07")] abbrev zipWith_get? 
goal: (List.zipWith f as bs).get? i =
  match as.get? i, bs.get? i with
  | some a, some b => some (f a b)
  | x, x_1 => none

full_name: List.zipWith_map
code: @[simp]
theorem zipWith_map {μ} (f : γ → δ → μ) (g : α → γ) (h : β → δ) (l₁ : List α) (l₂ : List β) :
    zipWith f (l₁.map g) (l₂.map h) = zipWith (fun a b => f (g a) (h b)) l₁ l₂ 
goal: List.zipWith f (List.map g l₁) (List.map h l₂) = List.zipWith (fun a b => f (g a) (h b)) l₁ l₂

full_name: List.zipWith_map_left
code: theorem zipWith_map_left (l₁ : List α) (l₂ : List β) (f : α → α') (g : α' → β → γ) :
    zipWith g (l₁.map f) l₂ = zipWith (fun a b => g (f a) b) l₁ l₂ 
goal: List.zipWith g (List.map f l₁) l₂ = List.zipWith (fun a b => g (f a) b) l₁ l₂

full_name: List.zipWith_map_right
code: theorem zipWith_map_right (l₁ : List α) (l₂ : List β) (f : β → β') (g : α → β' → γ) :
    zipWith g l₁ (l₂.map f) = zipWith (fun a b => g a (f b)) l₁ l₂ 
goal: List.zipWith g l₁ (List.map f l₂) = List.zipWith (fun a b => g a (f b)) l₁ l₂

full_name: List.zipWith_foldr_eq_zip_foldr
code: theorem zipWith_foldr_eq_zip_foldr {f : α → β → γ} (i : δ):
    (zipWith f l₁ l₂).foldr g i = (zip l₁ l₂).foldr (fun p r => g (f p.1 p.2) r) i 
goal: List.foldr g i (List.zipWith f l₁ l₂) = List.foldr (fun p r => g (f p.fst p.snd) r) i (l₁.zip l₂)

full_name: List.zipWith_foldl_eq_zip_foldl
code: theorem zipWith_foldl_eq_zip_foldl {f : α → β → γ} (i : δ):
    (zipWith f l₁ l₂).foldl g i = (zip l₁ l₂).foldl (fun r p => g r (f p.1 p.2)) i 
goal: List.foldl g i (List.zipWith f l₁ l₂) = List.foldl (fun r p => g r (f p.fst p.snd)) i (l₁.zip l₂)

full_name: List.zipWith_eq_nil_iff
code: @[simp]
theorem zipWith_eq_nil_iff {f : α → β → γ} {l l'} : zipWith f l l' = [] ↔ l = [] ∨ l' = [] 
goal: List.zipWith f l l' = [] ↔ l = [] ∨ l' = []

full_name: List.map_zipWith
code: theorem map_zipWith {δ : Type _} (f : α → β) (g : γ → δ → α) (l : List γ) (l' : List δ) :
    map f (zipWith g l l') = zipWith (fun x y => f (g x y)) l l' 
goal: List.map f (List.zipWith g l l') = List.zipWith (fun x y => f (g x y)) l l'

full_name: List.zipWith_distrib_take
code: theorem zipWith_distrib_take : (zipWith f l l').take n = zipWith f (l.take n) (l'.take n) 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {α_2 : Type u_3} {f : α → α_1 → α_2} {l : List α} {l' : List α_1} {n : Nat},
  List.take n (List.zipWith f l l') = List.zipWith f (List.take n l) (List.take n l')

full_name: List.zipWith_distrib_drop
code: theorem zipWith_distrib_drop : (zipWith f l l').drop n = zipWith f (l.drop n) (l'.drop n) 
goal: ∀ {α : Type u_1} {α_1 : Type u_2} {α_2 : Type u_3} {f : α → α_1 → α_2} {l : List α} {l' : List α_1} {n : Nat},
  List.drop n (List.zipWith f l l') = List.zipWith f (List.drop n l) (List.drop n l')

full_name: List.zipWith_append
code: theorem zipWith_append (f : α → β → γ) (l la : List α) (l' lb : List β)
    (h : l.length = l'.length) :
    zipWith f (l ++ la) (l' ++ lb) = zipWith f l l' ++ zipWith f la lb 
goal: List.zipWith f (l ++ la) (l' ++ lb) = List.zipWith f l l' ++ List.zipWith f la lb

full_name: List.zipWith_replicate'
code: /-- See also `List.zipWith_replicate` in `Init.Data.List.TakeDrop` for a generalization with different lengths. -/
@[simp] theorem zipWith_replicate' {a : α} {b : β} {n : Nat} :
    zipWith f (replicate n a) (replicate n b) = replicate n (f a b) 
goal: ∀ {α_1 : Type u_3} {f : α → β → α_1} {a : α} {b : β} {n : Nat},
  List.zipWith f (List.replicate n a) (List.replicate n b) = List.replicate n (f a b)

full_name: List.getElem?_zipWithAll
code: theorem getElem?_zipWithAll {f : Option α → Option β → γ} {i : Nat} :
    (zipWithAll f as bs)[i]? = match as[i]?, bs[i]? with
      | none, none => .none | a?, b? => some (f a? b?) 
goal: (List.zipWithAll f as bs)[i]? =
  match as[i]?, bs[i]? with
  | none, none => none
  | a?, b? => some (f a? b?)

full_name: List.get?_zipWithAll
code: @[deprecated getElem?_zipWithAll (since := "2024-06-12")]
theorem get?_zipWithAll {f : Option α → Option β → γ} :
    (zipWithAll f as bs).get? i = match as.get? i, bs.get? i with
      | none, none => .none | a?, b? => some (f a? b?) 
goal: (List.zipWithAll f as bs).get? i =
  match as.get? i, bs.get? i with
  | none, none => none
  | a?, b? => some (f a? b?)

full_name: List.zipWithAll_get?
code: @[deprecated getElem?_zipWithAll (since := "2024-06-07")] abbrev zipWithAll_get? 
goal: (List.zipWithAll f as bs).get? i =
  match as.get? i, bs.get? i with
  | none, none => none
  | a?, b? => some (f a? b?)

full_name: List.zipWithAll_map
code: theorem zipWithAll_map {μ} (f : Option γ → Option δ → μ) (g : α → γ) (h : β → δ) (l₁ : List α) (l₂ : List β) :
    zipWithAll f (l₁.map g) (l₂.map h) = zipWithAll (fun a b => f (g <$> a) (h <$> b)) l₁ l₂ 
goal: List.zipWithAll f (List.map g l₁) (List.map h l₂) = List.zipWithAll (fun a b => f (g <$> a) (h <$> b)) l₁ l₂

full_name: List.zipWithAll_map_left
code: theorem zipWithAll_map_left (l₁ : List α) (l₂ : List β) (f : α → α') (g : Option α' → Option β → γ) :
    zipWithAll g (l₁.map f) l₂ = zipWithAll (fun a b => g (f <$> a) b) l₁ l₂ 
goal: List.zipWithAll g (List.map f l₁) l₂ = List.zipWithAll (fun a b => g (f <$> a) b) l₁ l₂

full_name: List.zipWithAll_map_right
code: theorem zipWithAll_map_right (l₁ : List α) (l₂ : List β) (f : β → β') (g : Option α → Option β' → γ) :
    zipWithAll g l₁ (l₂.map f) = zipWithAll (fun a b => g a (f <$> b)) l₁ l₂ 
goal: List.zipWithAll g l₁ (List.map f l₂) = List.zipWithAll (fun a b => g a (f <$> b)) l₁ l₂

full_name: List.map_zipWithAll
code: theorem map_zipWithAll {δ : Type _} (f : α → β) (g : Option γ → Option δ → α) (l : List γ) (l' : List δ) :
    map f (zipWithAll g l l') = zipWithAll (fun x y => f (g x y)) l l' 
goal: List.map f (List.zipWithAll g l l') = List.zipWithAll (fun x y => f (g x y)) l l'

full_name: List.zipWithAll_replicate
code: @[simp] theorem zipWithAll_replicate {a : α} {b : β} {n : Nat} :
    zipWithAll f (replicate n a) (replicate n b) = replicate n (f a b) 
goal: ∀ {α_1 : Type u_3} {f : Option α → Option β → α_1} {a : α} {b : β} {n : Nat},
  List.zipWithAll f (List.replicate n a) (List.replicate n b) = List.replicate n (f (some a) (some b))

full_name: List.unzip_replicate
code: @[simp] theorem unzip_replicate {n : Nat} {a : α} {b : β} :
    unzip (replicate n (a, b)) = (replicate n a, replicate n b) 
goal: (List.replicate n (a, b)).unzip = (List.replicate n a, List.replicate n b)

full_name: List.enumFrom_length
code: @[simp] theorem enumFrom_length : ∀ {n} {l : List α}, (enumFrom n l).length = l.length
  
goal: (List.enumFrom n l).length = l.length

full_name: List.map_enumFrom
code: theorem map_enumFrom (f : α → β) (n : Nat) (l : List α) :
    map (Prod.map id f) (enumFrom n l) = enumFrom n (map f l) 
goal: List.map (Prod.map id f) (List.enumFrom n l) = List.enumFrom n (List.map f l)

full_name: List.enum_length
code: @[simp] theorem enum_length : (enum l).length = l.length 
goal: ∀ {α : Type u_1} {l : List α}, l.enum.length = l.length

full_name: List.enum_cons
code: theorem enum_cons : (a::as).enum = (0, a) :: as.enumFrom 1 
goal: ∀ {α : Type u_1} {a : α} {as : List α}, (a :: as).enum = (0, a) :: List.enumFrom 1 as

full_name: List.map_enum
code: theorem map_enum (f : α → β) (l : List α) : map (Prod.map id f) (enum l) = enum (map f l) 
goal: List.map (Prod.map id f) l.enum = (List.map f l).enum

full_name: List.minimum?_nil
code: @[simp] theorem minimum?_nil [Min α] : ([] : List α).minimum? = none 
goal: [].minimum? = none

full_name: List.minimum?_cons
code: theorem minimum?_cons [Min α] {xs : List α} : (x :: xs).minimum? = foldl min x xs 
goal: (x :: xs).minimum? = some (List.foldl min x xs)

full_name: List.minimum?_eq_none_iff
code: @[simp] theorem minimum?_eq_none_iff {xs : List α} [Min α] : xs.minimum? = none ↔ xs = [] 
goal: xs.minimum? = none ↔ xs = []

full_name: List.minimum?_mem
code: theorem minimum?_mem [Min α] (min_eq_or : ∀ a b : α, min a b = a ∨ min a b = b) :
    {xs : List α} → xs.minimum? = some a → a ∈ xs 
goal: xs.minimum? = some a → a ∈ xs

full_name: List.le_minimum?_iff
code: theorem le_minimum?_iff [Min α] [LE α]
    (le_min_iff : ∀ a b c : α, a ≤ min b c ↔ a ≤ b ∧ a ≤ c) :
    {xs : List α} → xs.minimum? = some a → ∀ x, x ≤ a ↔ ∀ b, b ∈ xs → x ≤ b
  
goal: xs.minimum? = some a → ∀ (x : α), x ≤ a ↔ ∀ (b : α), b ∈ xs → x ≤ b

full_name: List.minimum?_eq_some_iff
code: theorem minimum?_eq_some_iff [Min α] [LE α] [anti : Antisymm ((· : α) ≤ ·)]
    (le_refl : ∀ a : α, a ≤ a)
    (min_eq_or : ∀ a b : α, min a b = a ∨ min a b = b)
    (le_min_iff : ∀ a b c : α, a ≤ min b c ↔ a ≤ b ∧ a ≤ c) {xs : List α} :
    xs.minimum? = some a ↔ a ∈ xs ∧ ∀ b, b ∈ xs → a ≤ b 
goal: xs.minimum? = some a ↔ a ∈ xs ∧ ∀ (b : α), b ∈ xs → a ≤ b

full_name: List.minimum?_replicate
code: theorem minimum?_replicate [Min α] {n : Nat} {a : α} (w : min a a = a) :
    (replicate n a).minimum? = if n = 0 then none else some a 
goal: (List.replicate n a).minimum? = if n = 0 then none else some a

full_name: List.minimum?_replicate_of_pos
code: @[simp] theorem minimum?_replicate_of_pos [Min α] {n : Nat} {a : α} (w : min a a = a) (h : 0 < n) :
    (replicate n a).minimum? = some a 
goal: (List.replicate n a).minimum? = some a

full_name: List.maximum?_nil
code: @[simp] theorem maximum?_nil [Max α] : ([] : List α).maximum? = none 
goal: [].maximum? = none

full_name: List.maximum?_cons
code: theorem maximum?_cons [Max α] {xs : List α} : (x :: xs).maximum? = foldl max x xs 
goal: (x :: xs).maximum? = some (List.foldl max x xs)

full_name: List.maximum?_eq_none_iff
code: @[simp] theorem maximum?_eq_none_iff {xs : List α} [Max α] : xs.maximum? = none ↔ xs = [] 
goal: xs.maximum? = none ↔ xs = []

full_name: List.maximum?_mem
code: theorem maximum?_mem [Max α] (min_eq_or : ∀ a b : α, max a b = a ∨ max a b = b) :
    {xs : List α} → xs.maximum? = some a → a ∈ xs
  
goal: xs.maximum? = some a → a ∈ xs

full_name: List.maximum?_le_iff
code: theorem maximum?_le_iff [Max α] [LE α]
    (max_le_iff : ∀ a b c : α, max b c ≤ a ↔ b ≤ a ∧ c ≤ a) :
    {xs : List α} → xs.maximum? = some a → ∀ x, a ≤ x ↔ ∀ b ∈ xs, b ≤ x
  
goal: xs.maximum? = some a → ∀ (x : α), a ≤ x ↔ ∀ (b : α), b ∈ xs → b ≤ x

full_name: List.maximum?_eq_some_iff
code: theorem maximum?_eq_some_iff [Max α] [LE α] [anti : Antisymm ((· : α) ≤ ·)]
    (le_refl : ∀ a : α, a ≤ a)
    (max_eq_or : ∀ a b : α, max a b = a ∨ max a b = b)
    (max_le_iff : ∀ a b c : α, max b c ≤ a ↔ b ≤ a ∧ c ≤ a) {xs : List α} :
    xs.maximum? = some a ↔ a ∈ xs ∧ ∀ b ∈ xs, b ≤ a 
goal: xs.maximum? = some a ↔ a ∈ xs ∧ ∀ (b : α), b ∈ xs → b ≤ a

full_name: List.maximum?_replicate
code: theorem maximum?_replicate [Max α] {n : Nat} {a : α} (w : max a a = a) :
    (replicate n a).maximum? = if n = 0 then none else some a 
goal: (List.replicate n a).maximum? = if n = 0 then none else some a

full_name: List.maximum?_replicate_of_pos
code: @[simp] theorem maximum?_replicate_of_pos [Max α] {n : Nat} {a : α} (w : max a a = a) (h : 0 < n) :
    (replicate n a).maximum? = some a 
goal: (List.replicate n a).maximum? = some a

full_name: List.mapM'
code: /-- Alternate (non-tail-recursive) form of mapM for proofs. -/
def mapM' [Monad m] (f : α → m β) : List α → m (List β)
  
goal: List α → m (List β)

full_name: List.mapM'_nil
code: @[simp] theorem mapM'_nil [Monad m] {f : α → m β} : mapM' f [] = pure [] 
goal: List.mapM' f [] = pure []

full_name: List.mapM'_cons
code: @[simp] theorem mapM'_cons [Monad m] {f : α → m β} :
    mapM' f (a :: l) = return ((← f a) :: (← l.mapM' f)) 
goal: List.mapM' f (a :: l) = do
  let __do_lift ← f a
  let __do_lift_1 ← List.mapM' f l
  pure (__do_lift :: __do_lift_1)

full_name: List.mapM'_eq_mapM
code: theorem mapM'_eq_mapM [Monad m] [LawfulMonad m] (f : α → m β) (l : List α) :
    mapM' f l = mapM f l 
goal: List.mapM' f l = List.mapM f l

full_name: List.mapM'_eq_mapM.go
code: theorem mapM'_eq_mapM [Monad m] [LawfulMonad m] (f : α → m β) (l : List α) :
    mapM' f l = mapM f l 
goal: List.mapM.loop f l acc = do
  let __do_lift ← List.mapM' f l
  pure (acc.reverse ++ __do_lift)

full_name: List.mapM_nil
code: @[simp] theorem mapM_nil [Monad m] (f : α → m β) : [].mapM f = pure [] 
goal: List.mapM f [] = pure []

full_name: List.mapM_cons
code: @[simp] theorem mapM_cons [Monad m] [LawfulMonad m] (f : α → m β) :
    (a :: l).mapM f = (return (← f a) :: (← l.mapM f)) 
goal: List.mapM f (a :: l) = do
  let __do_lift ← f a
  let __do_lift_1 ← List.mapM f l
  pure (__do_lift :: __do_lift_1)

full_name: List.mapM_append
code: @[simp] theorem mapM_append [Monad m] [LawfulMonad m] (f : α → m β) {l₁ l₂ : List α} :
    (l₁ ++ l₂).mapM f = (return (← l₁.mapM f) ++ (← l₂.mapM f)) 
goal: List.mapM f (l₁ ++ l₂) = do
  let __do_lift ← List.mapM f l₁
  let __do_lift_1 ← List.mapM f l₂
  pure (__do_lift ++ __do_lift_1)

full_name: List.forM_nil'
code: @[simp] theorem forM_nil' [Monad m] : ([] : List α).forM f = (pure .unit : m PUnit) 
goal: [].forM f = pure PUnit.unit

full_name: List.forM_cons'
code: @[simp] theorem forM_cons' [Monad m] :
    (a::as).forM f = (f a >>= fun _ => as.forM f : m PUnit) 
goal: ∀ {α : Type u_3} {a : α} {as : List α} {f : α → m PUnit} [inst : Monad m],
  (a :: as).forM f = do
    f a
    as.forM f