File: Mathlib/Data/List/Basic.lean

full_name: List.uniqueOfIsEmpty
code: /-- There is only one list of an empty type -/
instance uniqueOfIsEmpty [IsEmpty α] : Unique (List α) 
goal: Unique (List α)

full_name: List.instLawfulIdentityAppendNil_mathlib
code: instance : Std.LawfulIdentity (α := List α) Append.append [] 
goal: Std.LawfulIdentity Append.append []

full_name: List.instAssociativeAppend_mathlib
code: instance : Std.Associative (α := List α) Append.append 
goal: Std.Associative Append.append

full_name: List.cons_injective
code: @[simp] theorem cons_injective {a : α} : Injective (cons a) 
goal: Function.Injective (List.cons a)

full_name: List.singleton_injective
code: theorem singleton_injective : Injective fun a : α => [a] 
goal: Function.Injective fun a => [a]

full_name: List.singleton_inj
code: theorem singleton_inj {a b : α} : [a] = [b] ↔ a = b 
goal: [a] = [b] ↔ a = b

full_name: List.set_of_mem_cons
code: theorem set_of_mem_cons (l : List α) (a : α) : { x | x ∈ a :: l } = insert a { x | x ∈ l } 
goal: {x | x ∈ a :: l} = insert a {x | x ∈ l}

full_name: Decidable.List.eq_or_ne_mem_of_mem
code: theorem _root_.Decidable.List.eq_or_ne_mem_of_mem [DecidableEq α]
    {a b : α} {l : List α} (h : a ∈ b :: l) : a = b ∨ a ≠ b ∧ a ∈ l 
goal: a = b ∨ a ≠ b ∧ a ∈ l

full_name: List.mem_pair
code: lemma mem_pair {a b c : α} : a ∈ [b, c] ↔ a = b ∨ a = c 
goal: a ∈ [b, c] ↔ a = b ∨ a = c

full_name: List.mem_map_of_injective
code: @[simp 1100, nolint simpNF]
theorem mem_map_of_injective {f : α → β} (H : Injective f) {a : α} {l : List α} :
    f a ∈ map f l ↔ a ∈ l 
goal: f a ∈ List.map f l ↔ a ∈ l

full_name: Function.Involutive.exists_mem_and_apply_eq_iff
code: @[simp]
theorem _root_.Function.Involutive.exists_mem_and_apply_eq_iff {f : α → α}
    (hf : Function.Involutive f) (x : α) (l : List α) : (∃ y : α, y ∈ l ∧ f y = x) ↔ f x ∈ l 
goal: (∃ y, y ∈ l ∧ f y = x) ↔ f x ∈ l

full_name: List.mem_map_of_involutive
code: theorem mem_map_of_involutive {f : α → α} (hf : Involutive f) {a : α} {l : List α} :
    a ∈ map f l ↔ f a ∈ l 
goal: a ∈ List.map f l ↔ f a ∈ l

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

full_name: List.exists_of_length_succ
code: theorem exists_of_length_succ {n} : ∀ 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_injective_iff
code: @[simp] lemma length_injective_iff : Injective (List.length : List α → ℕ) ↔ Subsingleton α 
goal: Function.Injective List.length ↔ Subsingleton α

full_name: List.length_injective
code: @[simp default+1] -- Porting note: this used to be just @[simp]
lemma length_injective [Subsingleton α] : Injective (length : List α → ℕ) 
goal: Function.Injective List.length

full_name: List.length_eq_two
code: theorem length_eq_two {l : List α} : l.length = 2 ↔ ∃ a b, l = [a, b] 
goal: l.length = 2 ↔ ∃ a b, l = [a, b]

full_name: List.length_eq_three
code: theorem length_eq_three {l : List α} : l.length = 3 ↔ ∃ a b c, l = [a, b, c] 
goal: l.length = 3 ↔ ∃ a b c, l = [a, b, c]

full_name: List.instSingletonList
code: instance instSingletonList : Singleton α (List α) 
goal: Singleton α (List α)

full_name: List.instInsertOfDecidableEq_mathlib
code: instance [DecidableEq α] : Insert α (List α) 
goal: Insert α (List α)

full_name: List.instLawfulSingleton_mathlib
code: instance [DecidableEq α] : LawfulSingleton α (List α) 
goal: LawfulSingleton α (List α)

full_name: List.singleton_eq
code: theorem singleton_eq (x : α) : ({x} : List α) = [x] 
goal: {x} = [x]

full_name: List.insert_neg
code: theorem insert_neg [DecidableEq α] {x : α} {l : List α} (h : x ∉ l) :
    Insert.insert x l = x :: l 
goal: insert x l = x :: l

full_name: List.insert_pos
code: theorem insert_pos [DecidableEq α] {x : α} {l : List α} (h : x ∈ l) : Insert.insert x l = l 
goal: insert x l = l

full_name: List.doubleton_eq
code: theorem doubleton_eq [DecidableEq α] {x y : α} (h : x ≠ y) : ({x, y} : List α) = [x, y] 
goal: {x, y} = [x, y]

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

full_name: List.exists_mem_cons_of
code: theorem exists_mem_cons_of {p : α → Prop} {a : α} (l : List α) (h : p a) : ∃ x ∈ a :: l, p x 
goal: ∃ x, x ∈ a :: l ∧ p x

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

full_name: List.or_exists_of_exists_mem_cons
code: theorem or_exists_of_exists_mem_cons {p : α → Prop} {a : α} {l : List α} : (∃ x ∈ a :: l, p x) →
    p a ∨ ∃ x ∈ l, p x 
goal: (∃ x, x ∈ a :: l ∧ p x) → p a ∨ ∃ x, x ∈ l ∧ p x

full_name: List.exists_mem_cons_iff
code: theorem exists_mem_cons_iff (p : α → Prop) (a : α) (l : List α) :
    (∃ x ∈ a :: l, p x) ↔ p a ∨ ∃ x ∈ l, p x 
goal: (∃ x, x ∈ a :: l ∧ p x) ↔ p a ∨ ∃ x, x ∈ l ∧ p x

full_name: List.instIsTransSubset
code: instance : IsTrans (List α) Subset 
goal: IsTrans (List α) Subset

full_name: List.cons_subset_of_subset_of_mem
code: theorem cons_subset_of_subset_of_mem {a : α} {l m : List α}
    (ainm : a ∈ m) (lsubm : l ⊆ m) : a::l ⊆ m 
goal: a :: l ⊆ m

full_name: List.append_subset_of_subset_of_subset
code: theorem append_subset_of_subset_of_subset {l₁ l₂ l : List α} (l₁subl : l₁ ⊆ l) (l₂subl : l₂ ⊆ l) :
    l₁ ++ l₂ ⊆ l 
goal: l₁ ++ l₂ ⊆ l

full_name: List.map_subset_iff
code: theorem map_subset_iff {l₁ l₂ : List α} (f : α → β) (h : Injective f) :
    map f l₁ ⊆ map f l₂ ↔ l₁ ⊆ l₂ 
goal: List.map f l₁ ⊆ List.map f l₂ ↔ l₁ ⊆ l₂

full_name: List.append_eq_has_append
code: theorem append_eq_has_append {L₁ L₂ : List α} : List.append L₁ L₂ = L₁ ++ L₂ 
goal: L₁.append L₂ = L₁ ++ L₂

full_name: List.append_left_eq_self
code: @[simp] theorem append_left_eq_self {x y : List α} : x ++ y = y ↔ x = [] 
goal: x ++ y = y ↔ x = []

full_name: List.self_eq_append_left
code: @[simp] theorem self_eq_append_left {x y : List α} : y = x ++ y ↔ x = [] 
goal: y = x ++ y ↔ x = []

full_name: List.append_right_eq_self
code: @[simp] theorem append_right_eq_self {x y : List α} : x ++ y = x ↔ y = [] 
goal: x ++ y = x ↔ y = []

full_name: List.self_eq_append_right
code: @[simp] theorem self_eq_append_right {x y : List α} : x = x ++ y ↔ y = [] 
goal: x = x ++ y ↔ y = []

full_name: List.append_right_injective
code: theorem append_right_injective (s : List α) : Injective fun t ↦ s ++ t 
goal: Function.Injective fun t => s ++ t

full_name: List.append_left_injective
code: theorem append_left_injective (t : List α) : Injective fun s ↦ s ++ t 
goal: Function.Injective fun s => s ++ t

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

full_name: List.replicate_add
code: theorem replicate_add (m n) (a : α) : replicate (m + n) a = replicate m a ++ replicate n a 
goal: List.replicate (m + n) a = List.replicate m a ++ List.replicate n a

full_name: List.replicate_succ'
code: theorem replicate_succ' (n) (a : α) : replicate (n + 1) a = replicate n a ++ [a] 
goal: List.replicate (n + 1) a = List.replicate n a ++ [a]

full_name: List.replicate_subset_singleton
code: theorem replicate_subset_singleton (n) (a : α) : replicate n a ⊆ [a] 
goal: List.replicate n a ⊆ [a]

full_name: List.subset_singleton_iff
code: theorem subset_singleton_iff {a : α} {L : List α} : L ⊆ [a] ↔ ∃ n, L = replicate n a 
goal: L ⊆ [a] ↔ ∃ n, L = List.replicate n a

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

full_name: List.replicate_right_injective
code: theorem replicate_right_injective {n : ℕ} (hn : n ≠ 0) : Injective (@replicate α n) 
goal: Function.Injective (List.replicate n)

full_name: List.replicate_right_inj
code: theorem replicate_right_inj {a b : α} {n : ℕ} (hn : n ≠ 0) :
    replicate n a = replicate n b ↔ a = b 
goal: List.replicate n a = List.replicate n b ↔ a = b

full_name: List.replicate_right_inj'
code: theorem replicate_right_inj' {a b : α} : ∀ {n},
    replicate n a = replicate n b ↔ n = 0 ∨ a = b
  
goal: List.replicate n a = List.replicate n b ↔ n = 0 ∨ a = b

full_name: List.replicate_left_injective
code: theorem replicate_left_injective (a : α) : Injective (replicate · a) 
goal: Function.Injective fun x => List.replicate x a

full_name: List.replicate_left_inj
code: theorem replicate_left_inj {a : α} {n m : ℕ} : replicate n a = replicate m a ↔ n = m 
goal: List.replicate n a = List.replicate m a ↔ n = m

full_name: List.head_replicate
code: @[simp] theorem head_replicate (n : ℕ) (a : α) (h) : head (replicate n a) h = a 
goal: (List.replicate n a).head h = a

full_name: List.mem_pure
code: theorem mem_pure (x y : α) : x ∈ (pure y : List α) ↔ x = y 
goal: x ∈ pure y ↔ x = y

full_name: List.bind_eq_bind
code: @[simp]
theorem bind_eq_bind {α β} (f : α → List β) (l : List α) : l >>= f = l.bind f 
goal: l >>= f = l.bind f

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

full_name: List.reverse_concat'
code: theorem reverse_concat' (l : List α) (a : α) : (l ++ [a]).reverse = a :: l.reverse 
goal: (l ++ [a]).reverse = a :: l.reverse

full_name: List.reverse_singleton
code: theorem reverse_singleton (a : α) : reverse [a] = [a] 
goal: [a].reverse = [a]

full_name: List.reverse_involutive
code: @[simp]
theorem reverse_involutive : Involutive (@reverse α) 
goal: Function.Involutive List.reverse

full_name: List.reverse_injective
code: @[simp]
theorem reverse_injective : Injective (@reverse α) 
goal: Function.Injective List.reverse

full_name: List.reverse_surjective
code: theorem reverse_surjective : Surjective (@reverse α) 
goal: Function.Surjective List.reverse

full_name: List.reverse_bijective
code: theorem reverse_bijective : Bijective (@reverse α) 
goal: Function.Bijective List.reverse

full_name: List.reverse_inj
code: @[simp]
theorem reverse_inj {l₁ l₂ : List α} : reverse l₁ = reverse l₂ ↔ l₁ = l₂ 
goal: l₁.reverse = l₂.reverse ↔ l₁ = l₂

full_name: List.reverse_eq_iff
code: theorem reverse_eq_iff {l l' : List α} : l.reverse = l' ↔ l = l'.reverse 
goal: l.reverse = l' ↔ l = l'.reverse

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

full_name: List.map_reverseAux
code: theorem map_reverseAux (f : α → β) (l₁ l₂ : List α) :
    map f (reverseAux l₁ l₂) = reverseAux (map f l₁) (map f l₂) 
goal: List.map f (l₁.reverseAux l₂) = (List.map f l₁).reverseAux (List.map f l₂)

full_name: List.isEmpty_iff_eq_nil
code: theorem isEmpty_iff_eq_nil {l : List α} : l.isEmpty ↔ l = [] 
goal: l.isEmpty = true ↔ l = []

full_name: List.getLast_cons
code: @[simp]
theorem getLast_cons {a : α} {l : List α} :
    ∀ h : l ≠ nil, getLast (a :: l) (cons_ne_nil a l) = getLast l h 
goal: (a :: l).getLast ⋯ = l.getLast h

full_name: List.getLast_append_singleton
code: theorem getLast_append_singleton {a : α} (l : List α) :
    getLast (l ++ [a]) (append_ne_nil_of_ne_nil_right l _ (cons_ne_nil a _)) = a 
goal: (l ++ [a]).getLast ⋯ = a

full_name: List.getLast_append'
code: theorem getLast_append' (l₁ l₂ : List α) (h : l₂ ≠ []) :
    getLast (l₁ ++ l₂) (append_ne_nil_of_ne_nil_right l₁ l₂ h) = getLast l₂ h 
goal: (l₁ ++ l₂).getLast ⋯ = l₂.getLast h

full_name: List.getLast_concat'
code: theorem getLast_concat' {a : α} (l : List α) : getLast (concat l a) (concat_ne_nil a l) = a 
goal: (l.concat a).getLast ⋯ = a

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

full_name: List.getLast_cons_cons
code: theorem getLast_cons_cons (a₁ a₂ : α) (l : List α) :
    getLast (a₁ :: a₂ :: l) (cons_ne_nil _ _) = getLast (a₂ :: l) (cons_ne_nil a₂ l) 
goal: (a₁ :: a₂ :: l).getLast ⋯ = (a₂ :: l).getLast ⋯

full_name: List.dropLast_append_getLast
code: theorem dropLast_append_getLast : ∀ {l : List α} (h : l ≠ []), dropLast l ++ [getLast l h] = l
  
goal: l.dropLast ++ [l.getLast h] = l

full_name: List.getLast_congr
code: theorem getLast_congr {l₁ l₂ : List α} (h₁ : l₁ ≠ []) (h₂ : l₂ ≠ []) (h₃ : l₁ = l₂) :
    getLast l₁ h₁ = getLast l₂ h₂ 
goal: l₁.getLast h₁ = l₂.getLast h₂

full_name: List.getLast_replicate_succ
code: theorem getLast_replicate_succ (m : ℕ) (a : α) :
    (replicate (m + 1) a).getLast (ne_nil_of_length_eq_add_one (length_replicate _ _)) = a 
goal: (List.replicate (m + 1) a).getLast ⋯ = a

full_name: List.getLast_filter
code: /-- If the last element of `l` does not satisfy `p`, then it is also the last element of
`l.filter p`. -/
lemma getLast_filter {p : α → Bool} :
    ∀ (l : List α) (hlp : l.filter p ≠ []), p (l.getLast (hlp <| ·.symm ▸ rfl)) = true →
      (l.filter p).getLast hlp = l.getLast (hlp <| ·.symm ▸ rfl)
  
goal: p (l.getLast ⋯) = true → (List.filter p l).getLast hlp = l.getLast ⋯

full_name: List.getLast?_cons_cons
code: @[simp]
theorem getLast?_cons_cons (a b : α) (l : List α) :
    getLast? (a :: b :: l) = getLast? (b :: l) 
goal: (a :: b :: l).getLast? = (b :: l).getLast?

full_name: List.getLast?_eq_none
code: @[simp]
theorem getLast?_eq_none : ∀ {l : List α}, getLast? l = none ↔ l = []
  
goal: l.getLast? = none ↔ l = []

full_name: List.getLast?_isSome
code: @[simp]
theorem getLast?_isSome : ∀ {l : List α}, l.getLast?.isSome ↔ l ≠ []
  
goal: l.getLast?.isSome = true ↔ l ≠ []

full_name: List.mem_getLast?_eq_getLast
code: theorem mem_getLast?_eq_getLast : ∀ {l : List α} {x : α}, x ∈ l.getLast? → ∃ h, x = getLast l h
  
goal: x ∈ l.getLast? → ∃ h, x = l.getLast h

full_name: List.getLast?_eq_getLast_of_ne_nil
code: theorem getLast?_eq_getLast_of_ne_nil : ∀ {l : List α} (h : l ≠ []), l.getLast? = some (l.getLast h)
  
goal: l.getLast? = some (l.getLast h)

full_name: List.mem_getLast?_cons
code: theorem mem_getLast?_cons {x y : α} : ∀ {l : List α}, x ∈ l.getLast? → x ∈ (y :: l).getLast?
  
goal: x ∈ l.getLast? → x ∈ (y :: l).getLast?

full_name: List.mem_of_mem_getLast?
code: theorem mem_of_mem_getLast? {l : List α} {a : α} (ha : a ∈ l.getLast?) : a ∈ l 
goal: a ∈ l

full_name: List.dropLast_append_getLast?
code: theorem dropLast_append_getLast? : ∀ {l : List α}, ∀ a ∈ l.getLast?, dropLast l ++ [a] = l
  
goal: a ∈ l.getLast? → l.dropLast ++ [a] = l

full_name: List.getLastI_eq_getLast?
code: theorem getLastI_eq_getLast? [Inhabited α] : ∀ l : List α, l.getLastI = l.getLast?.iget
  
goal: l.getLastI = l.getLast?.iget

full_name: List.getLast?_append_cons
code: @[simp]
theorem getLast?_append_cons :
    ∀ (l₁ : List α) (a : α) (l₂ : List α), getLast? (l₁ ++ a :: l₂) = getLast? (a :: l₂)
  
goal: (l₁ ++ a :: l₂).getLast? = (a :: l₂).getLast?

full_name: List.getLast?_append_of_ne_nil
code: theorem getLast?_append_of_ne_nil (l₁ : List α) :
    ∀ {l₂ : List α} (_ : l₂ ≠ []), getLast? (l₁ ++ l₂) = getLast? l₂
  
goal: l₂ ≠ [] → (l₁ ++ l₂).getLast? = l₂.getLast?

full_name: List.getLast?_append
code: theorem getLast?_append {l₁ l₂ : List α} {x : α} (h : x ∈ l₂.getLast?) :
    x ∈ (l₁ ++ l₂).getLast? 
goal: x ∈ (l₁ ++ l₂).getLast?

full_name: List.head!_nil
code: @[simp]
theorem head!_nil [Inhabited α] : ([] : List α).head! = default 
goal: [].head! = default

full_name: List.head_cons_tail
code: @[simp] theorem head_cons_tail (x : List α) (h : x ≠ []) : x.head h :: x.tail = x 
goal: x.head h :: x.tail = x

full_name: List.head!_eq_head?
code: theorem head!_eq_head? [Inhabited α] (l : List α) : head! l = (head? l).iget 
goal: l.head! = l.head?.iget

full_name: List.surjective_head!
code: theorem surjective_head! [Inhabited α] : Surjective (@head! α _) 
goal: Function.Surjective List.head!

full_name: List.surjective_head?
code: theorem surjective_head? : Surjective (@head? α) 
goal: Function.Surjective List.head?

full_name: List.surjective_tail
code: theorem surjective_tail : Surjective (@tail α)
  
goal: Function.Surjective List.tail

full_name: List.eq_cons_of_mem_head?
code: theorem eq_cons_of_mem_head? {x : α} : ∀ {l : List α}, x ∈ l.head? → l = x :: tail l
  
goal: x ∈ l.head? → l = x :: l.tail

full_name: List.mem_of_mem_head?
code: theorem mem_of_mem_head? {x : α} {l : List α} (h : x ∈ l.head?) : x ∈ l 
goal: x ∈ l

full_name: List.head!_cons
code: @[simp] theorem head!_cons [Inhabited α] (a : α) (l : List α) : head! (a :: l) = a 
goal: (a :: l).head! = a

full_name: List.head!_append
code: @[simp]
theorem head!_append [Inhabited α] (t : List α) {s : List α} (h : s ≠ []) :
    head! (s ++ t) = head! s 
goal: (s ++ t).head! = s.head!

full_name: List.head?_append
code: theorem head?_append {s t : List α} {x : α} (h : x ∈ s.head?) : x ∈ (s ++ t).head? 
goal: x ∈ (s ++ t).head?

full_name: List.head?_append_of_ne_nil
code: theorem head?_append_of_ne_nil :
    ∀ (l₁ : List α) {l₂ : List α} (_ : l₁ ≠ []), head? (l₁ ++ l₂) = head? l₁
  
goal: l₁ ≠ [] → (l₁ ++ l₂).head? = l₁.head?

full_name: List.tail_append_singleton_of_ne_nil
code: theorem tail_append_singleton_of_ne_nil {a : α} {l : List α} (h : l ≠ nil) :
    tail (l ++ [a]) = tail l ++ [a] 
goal: (l ++ [a]).tail = l.tail ++ [a]

full_name: List.cons_head?_tail
code: theorem cons_head?_tail : ∀ {l : List α} {a : α}, a ∈ head? l → a :: tail l = l
  
goal: a ∈ l.head? → a :: l.tail = l

full_name: List.head!_mem_head?
code: theorem head!_mem_head? [Inhabited α] : ∀ {l : List α}, l ≠ [] → head! l ∈ head? l
  
goal: l ≠ [] → l.head! ∈ l.head?

full_name: List.cons_head!_tail
code: theorem cons_head!_tail [Inhabited α] {l : List α} (h : l ≠ []) : head! l :: tail l = l 
goal: l.head! :: l.tail = l

full_name: List.head!_mem_self
code: theorem head!_mem_self [Inhabited α] {l : List α} (h : l ≠ nil) : l.head! ∈ l 
goal: l.head! ∈ l

full_name: List.head_mem
code: theorem head_mem {l : List α} : ∀ (h : l ≠ nil), l.head h ∈ l 
goal: l.head h ∈ l

full_name: List.tail_append_of_ne_nil
code: theorem tail_append_of_ne_nil (l l' : List α) (h : l ≠ []) : (l ++ l').tail = l.tail ++ l' 
goal: (l ++ l').tail = l.tail ++ l'

full_name: List.getElem_eq_getElem?
code: theorem getElem_eq_getElem? (l : List α) (i : Nat) (h : i < l.length) :
    l[i] = l[i]?.get (by simp [getElem?_eq_getElem, h]) 
goal: l[i] = l[i]?.get ⋯

full_name: List.get_eq_get?
code: theorem get_eq_get? (l : List α) (i : Fin l.length) :
    l.get i = (l.get? i).get (by simp [getElem?_eq_getElem]) 
goal: l.get i = (l.get? ↑i).get ⋯

full_name: List.nthLe
code: /-- nth element of a list `l` given `n < l.length`. -/
@[deprecated get (since := "2023-01-05")]
def nthLe (l : List α) (n) (h : n < l.length) : α 
goal: α

full_name: List.nthLe_tail
code: @[simp] theorem nthLe_tail (l : List α) (i) (h : i < l.tail.length)
    (h' : i + 1 < l.length := (by simp only [length_tail] at h; omega)) :
    l.tail.nthLe i h = l.nthLe (i + 1) h' 
goal: l.tail.nthLe i h = l.nthLe (i + 1) h'

full_name: List.nthLe_cons_aux
code: theorem nthLe_cons_aux {l : List α} {a : α} {n} (hn : n ≠ 0) (h : n < (a :: l).length) :
    n - 1 < l.length 
goal: n - 1 < l.length

full_name: List.nthLe_cons
code: theorem nthLe_cons {l : List α} {a : α} {n} (hl) :
    (a :: l).nthLe n hl = if hn : n = 0 then a else l.nthLe (n - 1) (nthLe_cons_aux hn hl) 
goal: (a :: l).nthLe n hl = if hn : n = 0 then a else l.nthLe (n - 1) ⋯

full_name: List.modifyHead_modifyHead
code: @[simp 1100]
theorem modifyHead_modifyHead (l : List α) (f g : α → α) :
    (l.modifyHead f).modifyHead g = l.modifyHead (g ∘ f) 
goal: List.modifyHead g (List.modifyHead f l) = List.modifyHead (g ∘ f) l

full_name: List.reverseRecOn
code: /-- Induction principle from the right for lists: if a property holds for the empty list, and
for `l ++ [a]` if it holds for `l`, then it holds for all lists. The principle is given for
a `Sort`-valued predicate, i.e., it can also be used to construct data. -/
@[elab_as_elim]
def reverseRecOn {motive : List α → Sort*} (l : List α) (nil : motive [])
    (append_singleton : ∀ (l : List α) (a : α), motive l → motive (l ++ [a])) : motive l 
goal: motive l

full_name: List.reverseRecOn_nil
code: @[simp]
theorem reverseRecOn_nil {motive : List α → Sort*} (nil : motive [])
    (append_singleton : ∀ (l : List α) (a : α), motive l → motive (l ++ [a])) :
    reverseRecOn [] nil append_singleton = nil 
goal: List.reverseRecOn [] nil append_singleton = nil

full_name: List.reverseRecOn_concat
code: @[simp, nolint unusedHavesSuffices]
theorem reverseRecOn_concat {motive : List α → Sort*} (x : α) (xs : List α) (nil : motive [])
    (append_singleton : ∀ (l : List α) (a : α), motive l → motive (l ++ [a])) :
    reverseRecOn (motive := motive) (xs ++ [x]) nil append_singleton =
      append_singleton _ _ (reverseRecOn (motive := motive) xs nil append_singleton) 
goal: List.reverseRecOn (xs ++ [x]) nil append_singleton = append_singleton xs x (List.reverseRecOn xs nil append_singleton)

full_name: List.bidirectionalRec
code: /-- Bidirectional induction principle for lists: if a property holds for the empty list, the
singleton list, and `a :: (l ++ [b])` from `l`, then it holds for all lists. This can be used to
prove statements about palindromes. The principle is given for a `Sort`-valued predicate, i.e., it
can also be used to construct data. -/
@[elab_as_elim]
def bidirectionalRec {motive : List α → Sort*} (nil : motive []) (singleton : ∀ a : α, motive [a])
    (cons_append : ∀ (a : α) (l : List α) (b : α), motive l → motive (a :: (l ++ [b]))) :
    ∀ l, motive l
  
goal: motive l

full_name: List.bidirectionalRec_nil
code: @[simp]
theorem bidirectionalRec_nil {motive : List α → Sort*}
    (nil : motive []) (singleton : ∀ a : α, motive [a])
    (cons_append : ∀ (a : α) (l : List α) (b : α), motive l → motive (a :: (l ++ [b]))) :
    bidirectionalRec nil singleton cons_append [] = nil 
goal: List.bidirectionalRec nil singleton cons_append [] = nil

full_name: List.bidirectionalRec_singleton
code: @[simp]
theorem bidirectionalRec_singleton {motive : List α → Sort*}
    (nil : motive []) (singleton : ∀ a : α, motive [a])
    (cons_append : ∀ (a : α) (l : List α) (b : α), motive l → motive (a :: (l ++ [b]))) (a : α) :
    bidirectionalRec nil singleton cons_append [a] = singleton a 
goal: List.bidirectionalRec nil singleton cons_append [a] = singleton a

full_name: List.bidirectionalRec_cons_append
code: @[simp]
theorem bidirectionalRec_cons_append {motive : List α → Sort*}
    (nil : motive []) (singleton : ∀ a : α, motive [a])
    (cons_append : ∀ (a : α) (l : List α) (b : α), motive l → motive (a :: (l ++ [b])))
    (a : α) (l : List α) (b : α) :
    bidirectionalRec nil singleton cons_append (a :: (l ++ [b])) =
      cons_append a l b (bidirectionalRec nil singleton cons_append l) 
goal: List.bidirectionalRec nil singleton cons_append (a :: (l ++ [b])) =
  cons_append a l b (List.bidirectionalRec nil singleton cons_append l)

full_name: List.bidirectionalRecOn
code: /-- Like `bidirectionalRec`, but with the list parameter placed first. -/
@[elab_as_elim]
abbrev bidirectionalRecOn {C : List α → Sort*} (l : List α) (H0 : C []) (H1 : ∀ a : α, C [a])
    (Hn : ∀ (a : α) (l : List α) (b : α), C l → C (a :: (l ++ [b]))) : C l 
goal: C l

full_name: List.Sublist.cons_cons
code: theorem Sublist.cons_cons {l₁ l₂ : List α} (a : α) (s : l₁ <+ l₂) : a :: l₁ <+ a :: l₂ 
goal: (a :: l₁).Sublist (a :: l₂)

full_name: List.cons_sublist_cons'
code: lemma cons_sublist_cons' {a b : α} : a :: l₁ <+ b :: l₂ ↔ a :: l₁ <+ l₂ ∨ a = b ∧ l₁ <+ l₂ 
goal: (a :: l₁).Sublist (b :: l₂) ↔ (a :: l₁).Sublist l₂ ∨ a = b ∧ l₁.Sublist l₂

full_name: List.sublist_cons_of_sublist
code: theorem sublist_cons_of_sublist (a : α) (h : l₁ <+ l₂) : l₁ <+ a :: l₂ 
goal: l₁.Sublist (a :: l₂)

full_name: List.tail_sublist
code: theorem tail_sublist : ∀ l : List α, tail l <+ l
  
goal: l.tail.Sublist l

full_name: List.Sublist.tail
code: @[gcongr] protected theorem Sublist.tail : ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → tail l₁ <+ tail l₂
  
goal: l₁.Sublist l₂ → l₁.tail.Sublist l₂.tail

full_name: List.Sublist.of_cons_cons
code: theorem Sublist.of_cons_cons {l₁ l₂ : List α} {a b : α} (h : a :: l₁ <+ b :: l₂) : l₁ <+ l₂ 
goal: l₁.Sublist l₂

full_name: List.sublist_of_cons_sublist_cons
code: @[deprecated (since := "2024-04-07")]
theorem sublist_of_cons_sublist_cons {a} (h : a :: l₁ <+ a :: l₂) : l₁ <+ l₂ 
goal: l₁.Sublist l₂

full_name: List.eq_nil_of_sublist_nil
code: theorem eq_nil_of_sublist_nil {l : List α} (s : l <+ []) : l = [] 
goal: l = []

full_name: List.sublist_singleton
code: @[simp] lemma sublist_singleton {l : List α} {a : α} : l <+ [a] ↔ l = [] ∨ l = [a] 
goal: l.Sublist [a] ↔ l = [] ∨ l = [a]

full_name: List.sublist_replicate_iff
code: theorem sublist_replicate_iff {l : List α} {a : α} {n : ℕ} :
    l <+ replicate n a ↔ ∃ k ≤ n, l = replicate k a 
goal: l.Sublist (List.replicate n a) ↔ ∃ k, k ≤ n ∧ l = List.replicate k a

full_name: List.Sublist.antisymm
code: theorem Sublist.antisymm (s₁ : l₁ <+ l₂) (s₂ : l₂ <+ l₁) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.decidableSublist
code: instance decidableSublist [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <+ l₂)
  
goal: Decidable (l₁.Sublist l₂)

full_name: List.indexOf_cons_self
code: @[simp]
theorem indexOf_cons_self (a : α) (l : List α) : indexOf a (a :: l) = 0 
goal: List.indexOf a (a :: l) = 0

full_name: List.indexOf_cons_eq
code: theorem indexOf_cons_eq {a b : α} (l : List α) : b = a → indexOf a (b :: l) = 0
  
goal: b = a → List.indexOf a (b :: l) = 0

full_name: List.indexOf_cons_ne
code: @[simp]
theorem indexOf_cons_ne {a b : α} (l : List α) : b ≠ a → indexOf a (b :: l) = succ (indexOf a l)
  
goal: b ≠ a → List.indexOf a (b :: l) = (List.indexOf a l).succ

full_name: List.indexOf_eq_length
code: theorem indexOf_eq_length {a : α} {l : List α} : indexOf a l = length l ↔ a ∉ l 
goal: List.indexOf a l = l.length ↔ ¬a ∈ l

full_name: List.indexOf_of_not_mem
code: @[simp]
theorem indexOf_of_not_mem {l : List α} {a : α} : a ∉ l → indexOf a l = length l 
goal: ¬a ∈ l → List.indexOf a l = l.length

full_name: List.indexOf_le_length
code: theorem indexOf_le_length {a : α} {l : List α} : indexOf a l ≤ length l 
goal: List.indexOf a l ≤ l.length

full_name: List.indexOf_lt_length
code: theorem indexOf_lt_length {a} {l : List α} : indexOf a l < length l ↔ a ∈ l 
goal: List.indexOf a l < l.length ↔ a ∈ l

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

full_name: List.indexOf_append_of_not_mem
code: theorem indexOf_append_of_not_mem {a : α} (h : a ∉ l₁) :
    indexOf a (l₁ ++ l₂) = l₁.length + indexOf a l₂ 
goal: List.indexOf a (l₁ ++ l₂) = l₁.length + List.indexOf a l₂

full_name: List.nthLe_of_mem
code: @[deprecated get_of_mem (since := "2023-01-05")]
theorem nthLe_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n h, nthLe l n h = a 
goal: ∃ n h, l.nthLe n h = a

full_name: List.nthLe_get?
code: @[deprecated get?_eq_get (since := "2023-01-05")]
theorem nthLe_get? {l : List α} {n} (h) : get? l n = some (nthLe l n h) 
goal: l.get? n = some (l.nthLe n h)

full_name: List.getElem?_length
code: @[simp]
theorem getElem?_length (l : List α) : l[l.length]? = none 
goal: l[l.length]? = none

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

full_name: List.nthLe_mem
code: @[deprecated get_mem (since := "2023-01-05")]
theorem nthLe_mem (l : List α) (n h) : nthLe l n h ∈ l 
goal: l.nthLe n h ∈ l

full_name: List.mem_iff_nthLe
code: @[deprecated mem_iff_get (since := "2023-01-05")]
theorem mem_iff_nthLe {a} {l : List α} : a ∈ l ↔ ∃ n h, nthLe l n h = a 
goal: a ∈ l ↔ ∃ n h, l.nthLe n h = a

full_name: List.nthLe_map
code: @[deprecated get_map (since := "2023-01-05")]
theorem nthLe_map (f : α → β) {l n} (H1 H2) : nthLe (map f l) n H1 = f (nthLe l n H2) 
goal: (List.map f l).nthLe n H1 = f (l.nthLe n H2)

full_name: List.getElem_map_rev
code: /-- A version of `getElem_map` that can be used for rewriting. -/
theorem getElem_map_rev (f : α → β) {l} {n : Nat} {h : n < l.length} :
    f l[n] = (map f l)[n]'((l.length_map f).symm ▸ h) 
goal: f l[n] = (List.map f l)[n]

full_name: List.get_map_rev
code: /-- A version of `get_map` that can be used for rewriting. -/
@[deprecated getElem_map_rev (since := "2024-06-12")]
theorem get_map_rev (f : α → β) {l n} :
    f (get l n) = get (map f l) ⟨n.1, (l.length_map f).symm ▸ n.2⟩ 
goal: f (l.get n) = (List.map f l).get ⟨↑n, ⋯⟩

full_name: List.nthLe_map_rev
code: /-- A version of `nthLe_map` that can be used for rewriting. -/
@[deprecated get_map_rev (since := "2023-01-05")]
theorem nthLe_map_rev (f : α → β) {l n} (H) :
    f (nthLe l n H) = nthLe (map f l) n ((l.length_map f).symm ▸ H) 
goal: f (l.nthLe n H) = (List.map f l).nthLe n ⋯

full_name: List.nthLe_map'
code: @[simp, deprecated get_map (since := "2023-01-05")]
theorem nthLe_map' (f : α → β) {l n} (H) :
    nthLe (map f l) n H = f (nthLe l n (l.length_map f ▸ H)) 
goal: (List.map f l).nthLe n H = f (l.nthLe n ⋯)

full_name: List.nthLe_singleton
code: @[simp, deprecated get_singleton (since := "2023-01-05")]
theorem nthLe_singleton (a : α) {n : ℕ} (hn : n < 1) : nthLe [a] n hn = a 
goal: [a].nthLe n hn = a

full_name: List.nthLe_append_right
code: @[deprecated get_append_right' (since := "2023-01-05")]
theorem nthLe_append_right {l₁ l₂ : List α} {n : ℕ} (h₁ : l₁.length ≤ n) (h₂) :
    (l₁ ++ l₂).nthLe n h₂ = l₂.nthLe (n - l₁.length) (get_append_right_aux h₁ h₂) 
goal: (l₁ ++ l₂).nthLe n h₂ = l₂.nthLe (n - l₁.length) ⋯

full_name: List.get_length_sub_one
code: theorem get_length_sub_one {l : List α} (h : l.length - 1 < l.length) :
    l.get ⟨l.length - 1, h⟩ = l.getLast (by rintro rfl; exact Nat.lt_irrefl 0 h) 
goal: l.get ⟨l.length - 1, h⟩ = l.getLast ⋯

full_name: List.nthLe_cons_length
code: @[deprecated get_cons_length (since := "2023-01-05")]
theorem nthLe_cons_length : ∀ (x : α) (xs : List α) (n : ℕ) (h : n = xs.length),
    (x :: xs).nthLe n (by simp [h]) = (x :: xs).getLast (cons_ne_nil x xs) 
goal: (x :: xs).nthLe n ⋯ = (x :: xs).getLast ⋯

full_name: List.take_one_drop_eq_of_lt_length
code: theorem take_one_drop_eq_of_lt_length {l : List α} {n : ℕ} (h : n < l.length) :
    (l.drop n).take 1 = [l.get ⟨n, h⟩] 
goal: List.take 1 (List.drop n l) = [l.get ⟨n, h⟩]

full_name: List.ext_get?'
code: theorem ext_get?' {l₁ l₂ : List α} (h' : ∀ n < max l₁.length l₂.length, l₁.get? n = l₂.get? n) :
    l₁ = l₂ 
goal: l₁ = l₂

full_name: List.ext_get?_iff
code: theorem ext_get?_iff {l₁ l₂ : List α} : l₁ = l₂ ↔ ∀ n, l₁.get? n = l₂.get? n 
goal: l₁ = l₂ ↔ ∀ (n : ℕ), l₁.get? n = l₂.get? n

full_name: List.ext_get_iff
code: theorem ext_get_iff {l₁ l₂ : List α} :
    l₁ = l₂ ↔ l₁.length = l₂.length ∧ ∀ n h₁ h₂, get l₁ ⟨n, h₁⟩ = get l₂ ⟨n, h₂⟩ 
goal: l₁ = l₂ ↔ l₁.length = l₂.length ∧ ∀ (n : ℕ) (h₁ : n < l₁.length) (h₂ : n < l₂.length), l₁.get ⟨n, h₁⟩ = l₂.get ⟨n, h₂⟩

full_name: List.ext_get?_iff'
code: theorem ext_get?_iff' {l₁ l₂ : List α} : l₁ = l₂ ↔
    ∀ n < max l₁.length l₂.length, l₁.get? n = l₂.get? n 
goal: l₁ = l₂ ↔ ∀ (n : ℕ), n < max l₁.length l₂.length → l₁.get? n = l₂.get? n

full_name: List.ext_nthLe
code: @[deprecated ext_get (since := "2023-01-05")]
theorem ext_nthLe {l₁ l₂ : List α} (hl : length l₁ = length l₂)
    (h : ∀ n h₁ h₂, nthLe l₁ n h₁ = nthLe l₂ n h₂) : l₁ = l₂ 
goal: l₁ = l₂

full_name: List.getElem_indexOf
code: @[simp]
theorem getElem_indexOf [DecidableEq α] {a : α} : ∀ {l : List α} (h : indexOf a l < l.length),
    l[indexOf a l] = a
  
goal: l[List.indexOf a l] = a

full_name: List.indexOf_get
code: theorem indexOf_get [DecidableEq α] {a : α} {l : List α} (h) : get l ⟨indexOf a l, h⟩ = a 
goal: l.get ⟨List.indexOf a l, h⟩ = a

full_name: List.getElem?_indexOf
code: @[simp]
theorem getElem?_indexOf [DecidableEq α] {a : α} {l : List α} (h : a ∈ l) :
    l[indexOf a l]? = some a 
goal: l[List.indexOf a l]? = some a

full_name: List.indexOf_get?
code: theorem indexOf_get? [DecidableEq α] {a : α} {l : List α} (h : a ∈ l) :
    get? l (indexOf a l) = some a 
goal: l.get? (List.indexOf a l) = some a

full_name: List.get_reverse_aux₁
code: @[deprecated (since := "2023-01-05")]
theorem get_reverse_aux₁ :
    ∀ (l r : List α) (i h1 h2), get (reverseAux l r) ⟨i + length l, h1⟩ = get r ⟨i, h2⟩
  
goal: (l.reverseAux r).get ⟨i + l.length, h1⟩ = r.get ⟨i, h2⟩

full_name: List.indexOf_inj
code: theorem indexOf_inj [DecidableEq α] {l : List α} {x y : α} (hx : x ∈ l) (hy : y ∈ l) :
    indexOf x l = indexOf y l ↔ x = y 
goal: List.indexOf x l = List.indexOf y l ↔ x = y

full_name: List.getElem_reverse_aux₂
code: theorem getElem_reverse_aux₂ :
    ∀ (l r : List α) (i : Nat) (h1) (h2),
      (reverseAux l r)[length l - 1 - i]'h1 = l[i]'h2
  
goal: (l.reverseAux r)[l.length - 1 - i] = l[i]

full_name: List.getElem_reverse
code: @[simp] theorem getElem_reverse (l : List α) (i : Nat) (h1 h2) :
    (reverse l)[length l - 1 - i]'h1 = l[i]'h2 
goal: l.reverse[l.length - 1 - i] = l[i]

full_name: List.get_reverse_aux₂
code: @[deprecated getElem_reverse_aux₂ (since := "2024-06-12")]
theorem get_reverse_aux₂ (l r : List α) (i : Nat) (h1) (h2) :
    get (reverseAux l r) ⟨length l - 1 - i, h1⟩ = get l ⟨i, h2⟩ 
goal: (l.reverseAux r).get ⟨l.length - 1 - i, h1⟩ = l.get ⟨i, h2⟩

full_name: List.get_reverse
code: @[deprecated getElem_reverse (since := "2024-06-12")]
theorem get_reverse (l : List α) (i : Nat) (h1 h2) :
    get (reverse l) ⟨length l - 1 - i, h1⟩ = get l ⟨i, h2⟩ 
goal: l.reverse.get ⟨l.length - 1 - i, h1⟩ = l.get ⟨i, h2⟩

full_name: List.nthLe_reverse
code: @[simp, deprecated get_reverse (since := "2023-01-05")]
theorem nthLe_reverse (l : List α) (i : Nat) (h1 h2) :
    nthLe (reverse l) (length l - 1 - i) h1 = nthLe l i h2 
goal: l.reverse.nthLe (l.length - 1 - i) h1 = l.nthLe i h2

full_name: List.nthLe_reverse'
code: theorem nthLe_reverse' (l : List α) (n : ℕ) (hn : n < l.reverse.length) (hn') :
    l.reverse.nthLe n hn = l.nthLe (l.length - 1 - n) hn' 
goal: l.reverse.nthLe n hn = l.nthLe (l.length - 1 - n) hn'

full_name: List.get_reverse'
code: theorem get_reverse' (l : List α) (n) (hn') :
    l.reverse.get n = l.get ⟨l.length - 1 - n, hn'⟩ 
goal: l.reverse.get n = l.get ⟨l.length - 1 - ↑n, hn'⟩

full_name: List.eq_cons_of_length_one
code: theorem eq_cons_of_length_one {l : List α} (h : l.length = 1) :
    l = [l.nthLe 0 (by omega)] 
goal: l = [l.nthLe 0 ⋯]

full_name: List.modifyNthTail_modifyNthTail
code: theorem modifyNthTail_modifyNthTail {f g : List α → List α} (m : ℕ) :
    ∀ (n) (l : List α),
      (l.modifyNthTail f n).modifyNthTail g (m + n) =
        l.modifyNthTail (fun l => (f l).modifyNthTail g m) n
  
goal: List.modifyNthTail g (m + n) (List.modifyNthTail f n l) = List.modifyNthTail (fun l => List.modifyNthTail g m (f l)) n l

full_name: List.modifyNthTail_modifyNthTail_le
code: theorem modifyNthTail_modifyNthTail_le {f g : List α → List α} (m n : ℕ) (l : List α)
    (h : n ≤ m) :
    (l.modifyNthTail f n).modifyNthTail g m =
      l.modifyNthTail (fun l => (f l).modifyNthTail g (m - n)) n 
goal: List.modifyNthTail g m (List.modifyNthTail f n l) = List.modifyNthTail (fun l => List.modifyNthTail g (m - n) (f l)) n l

full_name: List.modifyNthTail_modifyNthTail_same
code: theorem modifyNthTail_modifyNthTail_same {f g : List α → List α} (n : ℕ) (l : List α) :
    (l.modifyNthTail f n).modifyNthTail g n = l.modifyNthTail (g ∘ f) n 
goal: List.modifyNthTail g n (List.modifyNthTail f n l) = List.modifyNthTail (g ∘ f) n l

full_name: List.modifyNth_eq_set
code: theorem modifyNth_eq_set (f : α → α) :
    ∀ (n) (l : List α), modifyNth f n l = ((fun a => set l n (f a)) <$> l[n]?).getD l
  
goal: List.modifyNth f n l = ((fun a => l.set n (f a)) <$> l[n]?).getD l

full_name: List.length_modifyNthTail
code: theorem length_modifyNthTail (f : List α → List α) (H : ∀ l, length (f l) = length l) :
    ∀ n l, length (modifyNthTail f n l) = length l
  
goal: (List.modifyNthTail f n l).length = l.length

full_name: List.length_modifyNth
code: theorem length_modifyNth (f : α → α) : ∀ n l, length (modifyNth f n l) = length l 
goal: (List.modifyNth f n l).length = l.length

full_name: List.getElem_set_of_ne
code: @[simp]
theorem getElem_set_of_ne {l : List α} {i j : ℕ} (h : i ≠ j) (a : α)
    (hj : j < (l.set i a).length) :
    (l.set i a)[j] = l[j]'(by simpa using hj) 
goal: (l.set i a)[j] = l[j]

full_name: List.get_set_of_ne
code: @[deprecated getElem_set_of_ne (since := "2024-06-12")]
theorem get_set_of_ne {l : List α} {i j : ℕ} (h : i ≠ j) (a : α)
    (hj : j < (l.set i a).length) :
    (l.set i a).get ⟨j, hj⟩ = l.get ⟨j, by simpa using hj⟩ 
goal: (l.set i a).get ⟨j, hj⟩ = l.get ⟨j, ⋯⟩

full_name: List.bind_pure_eq_map
code: theorem bind_pure_eq_map (f : α → β) (l : List α) : l.bind (pure ∘ f) = map f l 
goal: l.bind (pure ∘ f) = List.map f l

full_name: List.bind_ret_eq_map
code: @[deprecated bind_pure_eq_map (since := "2024-03-24")]
theorem bind_ret_eq_map (f : α → β) (l : List α) : l.bind (List.ret ∘ f) = map f l 
goal: l.bind (List.ret ∘ f) = List.map f l

full_name: List.bind_congr
code: theorem bind_congr {l : List α} {f g : α → List β} (h : ∀ x ∈ l, f x = g x) :
    List.bind l f = List.bind l g 
goal: l.bind f = l.bind g

full_name: List.infix_bind_of_mem
code: theorem infix_bind_of_mem {a : α} {as : List α} (h : a ∈ as) (f : α → List α) :
    f a <:+: as.bind f 
goal: f a <:+: as.bind f

full_name: List.map_eq_map
code: @[simp]
theorem map_eq_map {α β} (f : α → β) (l : List α) : f <$> l = map f l 
goal: f <$> l = List.map f l

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

full_name: List.comp_map
code: /-- A single `List.map` of a composition of functions is equal to
composing a `List.map` with another `List.map`, fully applied.
This is the reverse direction of `List.map_map`.
-/
theorem comp_map (h : β → γ) (g : α → β) (l : List α) : map (h ∘ g) l = map h (map g l) 
goal: List.map (h ∘ g) l = List.map h (List.map g l)

full_name: List.map_comp_map
code: /-- Composing a `List.map` with another `List.map` is equal to
a single `List.map` of composed functions.
-/
@[simp]
theorem map_comp_map (g : β → γ) (f : α → β) : map g ∘ map f = map (g ∘ f) 
goal: List.map g ∘ List.map f = List.map (g ∘ f)

full_name: Function.LeftInverse.list_map
code: theorem _root_.Function.LeftInverse.list_map {f : α → β} {g : β → α} (h : LeftInverse f g) :
    LeftInverse (map f) (map g)
  
goal: Function.LeftInverse (List.map f) (List.map g)

full_name: Function.RightInverse.list_map
code: nonrec theorem _root_.Function.RightInverse.list_map {f : α → β} {g : β → α}
    (h : RightInverse f g) : RightInverse (map f) (map g) 
goal: Function.RightInverse (List.map f) (List.map g)

full_name: Function.Involutive.list_map
code: nonrec theorem _root_.Function.Involutive.list_map {f : α → α}
    (h : Involutive f) : Involutive (map f) 
goal: Function.Involutive (List.map f)

full_name: List.map_leftInverse_iff
code: @[simp]
theorem map_leftInverse_iff {f : α → β} {g : β → α} :
    LeftInverse (map f) (map g) ↔ LeftInverse f g 
goal: Function.LeftInverse (List.map f) (List.map g) ↔ Function.LeftInverse f g

full_name: List.map_rightInverse_iff
code: @[simp]
theorem map_rightInverse_iff {f : α → β} {g : β → α} :
    RightInverse (map f) (map g) ↔ RightInverse f g 
goal: Function.RightInverse (List.map f) (List.map g) ↔ Function.RightInverse f g

full_name: List.map_involutive_iff
code: @[simp]
theorem map_involutive_iff {f : α → α} :
    Involutive (map f) ↔ Involutive f 
goal: Function.Involutive (List.map f) ↔ Function.Involutive f

full_name: Function.Injective.list_map
code: theorem _root_.Function.Injective.list_map {f : α → β} (h : Injective f) :
    Injective (map f)
  
goal: Function.Injective (List.map f)

full_name: List.map_injective_iff
code: @[simp]
theorem map_injective_iff {f : α → β} : Injective (map f) ↔ Injective f 
goal: Function.Injective (List.map f) ↔ Function.Injective f

full_name: Function.Surjective.list_map
code: theorem _root_.Function.Surjective.list_map {f : α → β} (h : Surjective f) :
    Surjective (map f) 
goal: Function.Surjective (List.map f)

full_name: List.map_surjective_iff
code: @[simp]
theorem map_surjective_iff {f : α → β} : Surjective (map f) ↔ Surjective f 
goal: Function.Surjective (List.map f) ↔ Function.Surjective f

full_name: Function.Bijective.list_map
code: theorem _root_.Function.Bijective.list_map {f : α → β} (h : Bijective f) : Bijective (map f) 
goal: Function.Bijective (List.map f)

full_name: List.map_bijective_iff
code: @[simp]
theorem map_bijective_iff {f : α → β} : Bijective (map f) ↔ Bijective f 
goal: Function.Bijective (List.map f) ↔ Function.Bijective f

full_name: List.eq_of_mem_map_const
code: theorem eq_of_mem_map_const {b₁ b₂ : β} {l : List α} (h : b₁ ∈ map (const α b₂) l) :
    b₁ = b₂ 
goal: b₁ = b₂

full_name: List.nil_zipWith
code: theorem nil_zipWith (f : α → β → γ) (l : List β) : zipWith f [] l = [] 
goal: List.zipWith f [] l = []

full_name: List.zipWith_nil
code: theorem zipWith_nil (f : α → β → γ) (l : List α) : zipWith f l [] = [] 
goal: List.zipWith f l [] = []

full_name: List.zipWith_flip
code: @[simp]
theorem zipWith_flip (f : α → β → γ) : ∀ as bs, zipWith (flip f) bs as = zipWith f as bs
  
goal: List.zipWith (flip f) bs as = List.zipWith f as bs

full_name: List.take_cons
code: theorem take_cons (n) (a : α) (l : List α) : take (succ n) (a :: l) = a :: take n l 
goal: List.take n.succ (a :: l) = a :: List.take n l

full_name: List.drop_tail
code: @[simp]
theorem drop_tail (l : List α) (n : ℕ) : l.tail.drop n = l.drop (n + 1) 
goal: List.drop n l.tail = List.drop (n + 1) l

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

full_name: List.cons_get_drop_succ
code: theorem cons_get_drop_succ {l : List α} {n} :
    l.get n :: l.drop (n.1 + 1) = l.drop n.1 
goal: l.get n :: List.drop (↑n + 1) l = List.drop (↑n) l

full_name: List.takeI_length
code: @[simp]
theorem takeI_length : ∀ n l, length (@takeI α _ n l) = n
  
goal: (List.takeI n l).length = n

full_name: List.takeI_nil
code: @[simp]
theorem takeI_nil : ∀ n, takeI n (@nil α) = replicate n default
  
goal: List.takeI n [] = List.replicate n default

full_name: List.takeI_eq_take
code: theorem takeI_eq_take : ∀ {n} {l : List α}, n ≤ length l → takeI n l = take n l
  
goal: n ≤ l.length → List.takeI n l = List.take n l

full_name: List.takeI_left
code: @[simp]
theorem takeI_left (l₁ l₂ : List α) : takeI (length l₁) (l₁ ++ l₂) = l₁ 
goal: List.takeI l₁.length (l₁ ++ l₂) = l₁

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

full_name: List.takeD_length
code: @[simp]
theorem takeD_length : ∀ n l a, length (@takeD α n l a) = n
  
goal: (List.takeD n l a).length = n

full_name: List.takeD_eq_take
code: theorem takeD_eq_take : ∀ {n} {l : List α} a, n ≤ length l → takeD n l a = take n l
  
goal: n ≤ l.length → List.takeD n l a = List.take n l

full_name: List.takeD_left
code: @[simp]
theorem takeD_left (l₁ l₂ : List α) (a : α) : takeD (length l₁) (l₁ ++ l₂) a = l₁ 
goal: List.takeD l₁.length (l₁ ++ l₂) a = l₁

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

full_name: List.foldl_ext
code: theorem foldl_ext (f g : α → β → α) (a : α) {l : List β} (H : ∀ a : α, ∀ b ∈ l, f a b = g a b) :
    foldl f a l = foldl g a l 
goal: List.foldl f a l = List.foldl g a l

full_name: List.foldr_ext
code: theorem foldr_ext (f g : α → β → β) (b : β) {l : List α} (H : ∀ a ∈ l, ∀ b : β, f a b = g a b) :
    foldr f b l = foldr g b l 
goal: List.foldr f b l = List.foldr g b l

full_name: List.foldl_concat
code: theorem foldl_concat
    (f : β → α → β) (b : β) (x : α) (xs : List α) :
    List.foldl f b (xs ++ [x]) = f (List.foldl f b xs) x 
goal: List.foldl f b (xs ++ [x]) = f (List.foldl f b xs) x

full_name: List.foldr_concat
code: theorem foldr_concat
    (f : α → β → β) (b : β) (x : α) (xs : List α) :
    List.foldr f b (xs ++ [x]) = (List.foldr f (f x b) xs) 
goal: List.foldr f b (xs ++ [x]) = List.foldr f (f x b) xs

full_name: List.foldl_fixed'
code: theorem foldl_fixed' {f : α → β → α} {a : α} (hf : ∀ b, f a b = a) : ∀ l : List β, foldl f a l = a
  
goal: List.foldl f a l = a

full_name: List.foldr_fixed'
code: theorem foldr_fixed' {f : α → β → β} {b : β} (hf : ∀ a, f a b = b) : ∀ l : List α, foldr f b l = b
  
goal: List.foldr f b l = b

full_name: List.foldl_fixed
code: @[simp]
theorem foldl_fixed {a : α} : ∀ l : List β, foldl (fun a _ => a) a l = a 
goal: List.foldl (fun a x => a) a l = a

full_name: List.foldr_fixed
code: @[simp]
theorem foldr_fixed {b : β} : ∀ l : List α, foldr (fun _ b => b) b l = b 
goal: List.foldr (fun x b => b) b l = b

full_name: List.foldl_join
code: @[simp]
theorem foldl_join (f : α → β → α) :
    ∀ (a : α) (L : List (List β)), foldl f a (join L) = foldl (foldl f) a L
  
goal: List.foldl f a L.join = List.foldl (List.foldl f) a L

full_name: List.foldr_join
code: @[simp]
theorem foldr_join (f : α → β → β) :
    ∀ (b : β) (L : List (List α)), foldr f b (join L) = foldr (fun l b => foldr f b l) b L
  
goal: List.foldr f b L.join = List.foldr (fun l b => List.foldr f b l) b L

full_name: List.foldr_eta
code: theorem foldr_eta : ∀ l : List α, foldr cons [] l = l 
goal: List.foldr List.cons [] l = l

full_name: List.reverse_foldl
code: @[simp]
theorem reverse_foldl {l : List α} : reverse (foldl (fun t h => h :: t) [] l) = l 
goal: (List.foldl (fun t h => h :: t) [] l).reverse = l

full_name: List.foldl_hom₂
code: theorem foldl_hom₂ (l : List ι) (f : α → β → γ) (op₁ : α → ι → α) (op₂ : β → ι → β)
    (op₃ : γ → ι → γ) (a : α) (b : β) (h : ∀ a b i, f (op₁ a i) (op₂ b i) = op₃ (f a b) i) :
    foldl op₃ (f a b) l = f (foldl op₁ a l) (foldl op₂ b l) 
goal: List.foldl op₃ (f a b) l = f (List.foldl op₁ a l) (List.foldl op₂ b l)

full_name: List.foldr_hom₂
code: theorem foldr_hom₂ (l : List ι) (f : α → β → γ) (op₁ : ι → α → α) (op₂ : ι → β → β)
    (op₃ : ι → γ → γ) (a : α) (b : β) (h : ∀ a b i, f (op₁ i a) (op₂ i b) = op₃ i (f a b)) :
    foldr op₃ (f a b) l = f (foldr op₁ a l) (foldr op₂ b l) 
goal: List.foldr op₃ (f a b) l = f (List.foldr op₁ a l) (List.foldr op₂ b l)

full_name: List.injective_foldl_comp
code: theorem injective_foldl_comp {l : List (α → α)} {f : α → α}
    (hl : ∀ f ∈ l, Function.Injective f) (hf : Function.Injective f) :
    Function.Injective (@List.foldl (α → α) (α → α) Function.comp f l) 
goal: Function.Injective (List.foldl Function.comp f l)

full_name: List.foldrRecOn
code: /-- Induction principle for values produced by a `foldr`: if a property holds
for the seed element `b : β` and for all incremental `op : α → β → β`
performed on the elements `(a : α) ∈ l`. The principle is given for
a `Sort`-valued predicate, i.e., it can also be used to construct data. -/
def foldrRecOn {C : β → Sort*} (l : List α) (op : α → β → β) (b : β) (hb : C b)
    (hl : ∀ b, C b → ∀ a ∈ l, C (op a b)) : C (foldr op b l) 
goal: C (List.foldr op b l)

full_name: List.foldlRecOn
code: /-- Induction principle for values produced by a `foldl`: if a property holds
for the seed element `b : β` and for all incremental `op : β → α → β`
performed on the elements `(a : α) ∈ l`. The principle is given for
a `Sort`-valued predicate, i.e., it can also be used to construct data. -/
def foldlRecOn {C : β → Sort*} (l : List α) (op : β → α → β) (b : β) (hb : C b)
    (hl : ∀ b, C b → ∀ a ∈ l, C (op b a)) : C (foldl op b l) 
goal: C (List.foldl op b l)

full_name: List.foldrRecOn_nil
code: @[simp]
theorem foldrRecOn_nil {C : β → Sort*} (op : α → β → β) (b) (hb : C b) (hl) :
    foldrRecOn [] op b hb hl = hb 
goal: [].foldrRecOn op b hb hl = hb

full_name: List.foldrRecOn_cons
code: @[simp]
theorem foldrRecOn_cons {C : β → Sort*} (x : α) (l : List α) (op : α → β → β) (b) (hb : C b)
    (hl : ∀ b, C b → ∀ a ∈ x :: l, C (op a b)) :
    foldrRecOn (x :: l) op b hb hl =
      hl _ (foldrRecOn l op b hb fun b hb a ha => hl b hb a (mem_cons_of_mem _ ha)) x
        (mem_cons_self _ _) 
goal: (x :: l).foldrRecOn op b hb hl = hl (List.foldr op b l) (l.foldrRecOn op b hb fun b hb a ha => hl b hb a ⋯) x ⋯

full_name: List.foldlRecOn_nil
code: @[simp]
theorem foldlRecOn_nil {C : β → Sort*} (op : β → α → β) (b) (hb : C b) (hl) :
    foldlRecOn [] op b hb hl = hb 
goal: [].foldlRecOn op b hb hl = hb

full_name: List.append_cons_inj_of_not_mem
code: /-- Consider two lists `l₁` and `l₂` with designated elements `a₁` and `a₂` somewhere in them:
`l₁ = x₁ ++ [a₁] ++ z₁` and `l₂ = x₂ ++ [a₂] ++ z₂`.
Assume the designated element `a₂` is present in neither `x₁` nor `z₁`.
We conclude that the lists are equal (`l₁ = l₂`) if and only if their respective parts are equal
(`x₁ = x₂ ∧ a₁ = a₂ ∧ z₁ = z₂`). -/
lemma append_cons_inj_of_not_mem {x₁ x₂ z₁ z₂ : List α} {a₁ a₂ : α}
    (notin_x : a₂ ∉ x₁) (notin_z : a₂ ∉ z₁) :
    x₁ ++ a₁ :: z₁ = x₂ ++ a₂ :: z₂ ↔ x₁ = x₂ ∧ a₁ = a₂ ∧ z₁ = z₂ 
goal: x₁ ++ a₁ :: z₁ = x₂ ++ a₂ :: z₂ ↔ x₁ = x₂ ∧ a₁ = a₂ ∧ z₁ = z₂

full_name: List.length_scanl
code: theorem length_scanl : ∀ a l, length (scanl f a l) = l.length + 1
  
goal: (List.scanl f a l).length = l.length + 1

full_name: List.scanl_nil
code: @[simp]
theorem scanl_nil (b : β) : scanl f b nil = [b] 
goal: List.scanl f b [] = [b]

full_name: List.scanl_cons
code: @[simp]
theorem scanl_cons : scanl f b (a :: l) = [b] ++ scanl f (f b a) l 
goal: List.scanl f b (a :: l) = [b] ++ List.scanl f (f b a) l

full_name: List.getElem?_scanl_zero
code: @[simp]
theorem getElem?_scanl_zero : (scanl f b l)[0]? = some b 
goal: (List.scanl f b l)[0]? = some b

full_name: List.get?_zero_scanl
code: @[deprecated getElem?_scanl_zero (since := "2024-06-12")]
theorem get?_zero_scanl : (scanl f b l).get? 0 = some b 
goal: (List.scanl f b l).get? 0 = some b

full_name: List.getElem_scanl_zero
code: @[simp]
theorem getElem_scanl_zero {h : 0 < (scanl f b l).length} : (scanl f b l)[0] = b 
goal: (List.scanl f b l)[0] = b

full_name: List.get_zero_scanl
code: @[deprecated getElem_scanl_zero (since := "2024-06-12")]
theorem get_zero_scanl {h : 0 < (scanl f b l).length} : (scanl f b l).get ⟨0, h⟩ = b 
goal: (List.scanl f b l).get ⟨0, h⟩ = b

full_name: List.nthLe_zero_scanl
code: @[simp, deprecated get_zero_scanl (since := "2023-01-05")]
theorem nthLe_zero_scanl {h : 0 < (scanl f b l).length} : (scanl f b l).nthLe 0 h = b 
goal: (List.scanl f b l).nthLe 0 h = b

full_name: List.get?_succ_scanl
code: theorem get?_succ_scanl {i : ℕ} : (scanl f b l).get? (i + 1) =
    ((scanl f b l).get? i).bind fun x => (l.get? i).map fun y => f x y 
goal: (List.scanl f b l).get? (i + 1) = ((List.scanl f b l).get? i).bind fun x => Option.map (fun y => f x y) (l.get? i)

full_name: List.nthLe_succ_scanl
code: theorem nthLe_succ_scanl {i : ℕ} {h : i + 1 < (scanl f b l).length} :
    (scanl f b l).nthLe (i + 1) h =
      f ((scanl f b l).nthLe i (Nat.lt_of_succ_lt h))
        (l.nthLe i (Nat.lt_of_succ_lt_succ (lt_of_lt_of_le h (le_of_eq (length_scanl b l))))) 
goal: (List.scanl f b l).nthLe (i + 1) h = f ((List.scanl f b l).nthLe i ⋯) (l.nthLe i ⋯)

full_name: List.get_succ_scanl
code: theorem get_succ_scanl {i : ℕ} {h : i + 1 < (scanl f b l).length} :
    (scanl f b l).get ⟨i + 1, h⟩ =
      f ((scanl f b l).get ⟨i, Nat.lt_of_succ_lt h⟩)
        (l.get ⟨i, Nat.lt_of_succ_lt_succ (lt_of_lt_of_le h (le_of_eq (length_scanl b l)))⟩) 
goal: (List.scanl f b l).get ⟨i + 1, h⟩ = f ((List.scanl f b l).get ⟨i, ⋯⟩) (l.get ⟨i, ⋯⟩)

full_name: List.scanr_nil
code: @[simp]
theorem scanr_nil (f : α → β → β) (b : β) : scanr f b [] = [b] 
goal: List.scanr f b [] = [b]

full_name: List.scanr_cons
code: @[simp]
theorem scanr_cons (f : α → β → β) (b : β) (a : α) (l : List α) :
    scanr f b (a :: l) = foldr f b (a :: l) :: scanr f b l 
goal: List.scanr f b (a :: l) = List.foldr f b (a :: l) :: List.scanr f b l

full_name: List.foldl1_eq_foldr1
code: theorem foldl1_eq_foldr1 (hassoc : Associative f) :
    ∀ a b l, foldl f a (l ++ [b]) = foldr f b (a :: l)
  
goal: List.foldl f a (l ++ [b]) = List.foldr f b (a :: l)

full_name: List.foldl_eq_of_comm_of_assoc
code: theorem foldl_eq_of_comm_of_assoc (hcomm : Commutative f) (hassoc : Associative f) :
    ∀ a b l, foldl f a (b :: l) = f b (foldl f a l)
  
goal: List.foldl f a (b :: l) = f b (List.foldl f a l)

full_name: List.foldl_eq_foldr
code: theorem foldl_eq_foldr (hcomm : Commutative f) (hassoc : Associative f) :
    ∀ a l, foldl f a l = foldr f a l
  
goal: List.foldl f a l = List.foldr f a l

full_name: List.foldl_eq_of_comm'
code: theorem foldl_eq_of_comm' : ∀ a b l, foldl f a (b :: l) = f (foldl f a l) b
  
goal: List.foldl f a (b :: l) = f (List.foldl f a l) b

full_name: List.foldl_eq_foldr'
code: theorem foldl_eq_foldr' : ∀ a l, foldl f a l = foldr (flip f) a l
  
goal: List.foldl f a l = List.foldr (flip f) a l

full_name: List.foldr_eq_of_comm'
code: theorem foldr_eq_of_comm' : ∀ a b l, foldr f a (b :: l) = foldr f (f b a) l
  
goal: List.foldr f a (b :: l) = List.foldr f (f b a) l

full_name: List.«_aux_Mathlib_Data_List_Basic___macroRules_List_term_⋆__1»
code: /-- Notation for `op a b`. -/
local notation a " ⋆ " b => op a b
goal: Lean.Macro

full_name: List.«_aux_Mathlib_Data_List_Basic___macroRules_List_term_<*>__1»
code: /-- Notation for `foldl op a l`. -/
local notation l " <*> " a => foldl op a l
goal: Lean.Macro

full_name: List._aux_Mathlib_Data_List_Basic___unexpand_List_foldl_1
code: /-- Notation for `foldl op a l`. -/
local notation l " <*> " a => foldl op a l
goal: Lean.PrettyPrinter.Unexpander

full_name: List.foldl_assoc
code: theorem foldl_assoc : ∀ {l : List α} {a₁ a₂}, (l <*> a₁ ⋆ a₂) = a₁ ⋆ l <*> a₂
  
goal: List.foldl op (op a₁ a₂) l = op a₁ (List.foldl op a₂ l)

full_name: List.foldl_op_eq_op_foldr_assoc
code: theorem foldl_op_eq_op_foldr_assoc :
    ∀ {l : List α} {a₁ a₂}, ((l <*> a₁) ⋆ a₂) = a₁ ⋆ l.foldr (· ⋆ ·) a₂
  
goal: op (List.foldl op a₁ l) a₂ = op a₁ (List.foldr (fun x x_1 => op x x_1) a₂ l)

full_name: List.foldl_assoc_comm_cons
code: theorem foldl_assoc_comm_cons {l : List α} {a₁ a₂} : ((a₁ :: l) <*> a₂) = a₁ ⋆ l <*> a₂ 
goal: List.foldl op a₂ (a₁ :: l) = op a₁ (List.foldl op a₂ l)

full_name: List.foldrM_eq_foldr
code: theorem foldrM_eq_foldr (f : α → β → m β) (b l) :
    foldrM f b l = foldr (fun a mb => mb >>= f a) (pure b) l 
goal: List.foldrM f b l = List.foldr (fun a mb => mb >>= f a) (pure b) l

full_name: List.foldlM_eq_foldl
code: theorem foldlM_eq_foldl (f : β → α → m β) (b l) :
    List.foldlM f b l = foldl (fun mb a => mb >>= fun b => f b a) (pure b) l 
goal: List.foldlM f b l =
  List.foldl
    (fun mb a => do
      let b ← mb
      f b a)
    (pure b) l

full_name: List.intersperse_singleton
code: @[simp]
theorem intersperse_singleton (a b : α) : intersperse a [b] = [b] 
goal: List.intersperse a [b] = [b]

full_name: List.intersperse_cons_cons
code: @[simp]
theorem intersperse_cons_cons (a b c : α) (tl : List α) :
    intersperse a (b :: c :: tl) = b :: a :: intersperse a (c :: tl) 
goal: List.intersperse a (b :: c :: tl) = b :: a :: List.intersperse a (c :: tl)

full_name: List.splitAt_eq_take_drop.go_eq_take_drop
code: @[simp]
theorem splitAt_eq_take_drop (n : ℕ) (l : List α) : splitAt n l = (take n l, drop n l) 
goal: List.splitAt.go l xs n acc = if n < xs.length then (acc.toList ++ List.take n xs, List.drop n xs) else (l, [])

full_name: List.splitAt_eq_take_drop
code: @[simp]
theorem splitAt_eq_take_drop (n : ℕ) (l : List α) : splitAt n l = (take n l, drop n l) 
goal: List.splitAt n l = (List.take n l, List.drop n l)

full_name: List.splitOn_nil
code: @[simp]
theorem splitOn_nil [DecidableEq α] (a : α) : [].splitOn a = [[]] 
goal: List.splitOn a [] = [[]]

full_name: List.splitOnP_nil
code: @[simp]
theorem splitOnP_nil : [].splitOnP p = [[]] 
goal: List.splitOnP p [] = [[]]

full_name: List.splitOnP.go_ne_nil
code: theorem splitOnP.go_ne_nil (xs acc : List α) : splitOnP.go p xs acc ≠ [] 
goal: List.splitOnP.go p xs acc ≠ []

full_name: List.splitOnP.go_acc
code: theorem splitOnP.go_acc (xs acc : List α) :
    splitOnP.go p xs acc = modifyHead (acc.reverse ++ ·) (splitOnP p xs) 
goal: List.splitOnP.go p xs acc = List.modifyHead (fun x => acc.reverse ++ x) (List.splitOnP p xs)

full_name: List.splitOnP_ne_nil
code: theorem splitOnP_ne_nil (xs : List α) : xs.splitOnP p ≠ [] 
goal: List.splitOnP p xs ≠ []

full_name: List.splitOnP_cons
code: @[simp]
theorem splitOnP_cons (x : α) (xs : List α) :
    (x :: xs).splitOnP p =
      if p x then [] :: xs.splitOnP p else (xs.splitOnP p).modifyHead (cons x) 
goal: List.splitOnP p (x :: xs) =
  if p x = true then [] :: List.splitOnP p xs else List.modifyHead (List.cons x) (List.splitOnP p xs)

full_name: List.splitOnP_spec.join_zipWith
code: /-- The original list `L` can be recovered by joining the lists produced by `splitOnP p L`,
interspersed with the elements `L.filter p`. -/
theorem splitOnP_spec (as : List α) :
    join (zipWith (· ++ ·) (splitOnP p as) (((as.filter p).map fun x => [x]) ++ [[]])) = as 
goal: (List.zipWith (fun x x_1 => x ++ x_1) (List.modifyHead (List.cons a) xs) ys).join =
  a :: (List.zipWith (fun x x_1 => x ++ x_1) xs ys).join

full_name: List.splitOnP_spec
code: /-- The original list `L` can be recovered by joining the lists produced by `splitOnP p L`,
interspersed with the elements `L.filter p`. -/
theorem splitOnP_spec (as : List α) :
    join (zipWith (· ++ ·) (splitOnP p as) (((as.filter p).map fun x => [x]) ++ [[]])) = as 
goal: (List.zipWith (fun x x_1 => x ++ x_1) (List.splitOnP p as) (List.map (fun x => [x]) (List.filter p as) ++ [[]])).join =
  as

full_name: List.splitOnP_eq_single
code: /-- If no element satisfies `p` in the list `xs`, then `xs.splitOnP p = [xs]` -/
theorem splitOnP_eq_single (h : ∀ x ∈ xs, ¬p x) : xs.splitOnP p = [xs] 
goal: List.splitOnP p xs = [xs]

full_name: List.splitOnP_first
code: /-- When a list of the form `[...xs, sep, ...as]` is split on `p`, the first element is `xs`,
  assuming no element in `xs` satisfies `p` but `sep` does satisfy `p` -/
theorem splitOnP_first (h : ∀ x ∈ xs, ¬p x) (sep : α) (hsep : p sep) (as : List α) :
    (xs ++ sep :: as).splitOnP p = xs :: as.splitOnP p 
goal: List.splitOnP p (xs ++ sep :: as) = xs :: List.splitOnP p as

full_name: List.intercalate_splitOn
code: /-- `intercalate [x]` is the left inverse of `splitOn x`  -/
theorem intercalate_splitOn (x : α) [DecidableEq α] : [x].intercalate (xs.splitOn x) = xs 
goal: [x].intercalate (List.splitOn x xs) = xs

full_name: List.splitOn_intercalate
code: /-- `splitOn x` is the left inverse of `intercalate [x]`, on the domain
  consisting of each nonempty list of lists `ls` whose elements do not contain `x`  -/
theorem splitOn_intercalate [DecidableEq α] (x : α) (hx : ∀ l ∈ ls, x ∉ l) (hls : ls ≠ []) :
    ([x].intercalate ls).splitOn x = ls 
goal: List.splitOn x ([x].intercalate ls) = ls

full_name: List.modifyLast.go_append_one
code: theorem modifyLast.go_append_one (f : α → α) (a : α) (tl : List α) (r : Array α) :
    modifyLast.go f (tl ++ [a]) r = (r.toListAppend <| modifyLast.go f (tl ++ [a]) #[]) 
goal: List.modifyLast.go f (tl ++ [a]) r = r.toListAppend (List.modifyLast.go f (tl ++ [a]) #[])

full_name: List.modifyLast_append_one
code: theorem modifyLast_append_one (f : α → α) (a : α) (l : List α) :
    modifyLast f (l ++ [a]) = l ++ [f a] 
goal: List.modifyLast f (l ++ [a]) = l ++ [f a]

full_name: List.modifyLast_append
code: theorem modifyLast_append (f : α → α) (l₁ l₂ : List α) (_ : l₂ ≠ []) :
    modifyLast f (l₁ ++ l₂) = l₁ ++ modifyLast f l₂ 
goal: l₂ ≠ [] → List.modifyLast f (l₁ ++ l₂) = l₁ ++ List.modifyLast f l₂

full_name: List.attach_nil
code: @[simp] lemma attach_nil : ([] : List α).attach = [] 
goal: [].attach = []

full_name: List.sizeOf_lt_sizeOf_of_mem
code: theorem sizeOf_lt_sizeOf_of_mem [SizeOf α] {x : α} {l : List α} (hx : x ∈ l) :
    SizeOf.sizeOf x < SizeOf.sizeOf l 
goal: sizeOf x < sizeOf l

full_name: List.pmap_eq_map
code: @[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (l : List α) (H) :
    @pmap _ _ p (fun a _ => f a) l H = map f l 
goal: List.pmap (fun a x => f a) l H = List.map f l

full_name: List.pmap_congr
code: theorem pmap_congr {p q : α → Prop} {f : ∀ a, p a → β} {g : ∀ a, q a → β} (l : List α) {H₁ H₂}
    (h : ∀ a ∈ l, ∀ (h₁ h₂), f a h₁ = g a h₂) : pmap f l H₁ = pmap g l H₂ 
goal: List.pmap f l H₁ = List.pmap g l H₂

full_name: List.map_pmap
code: theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (l H) :
    map g (pmap f l H) = pmap (fun a h => g (f a h)) l H 
goal: List.map g (List.pmap f l H) = List.pmap (fun a h => g (f a h)) l H

full_name: List.pmap_map
code: theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H) :
    pmap g (map f l) H = pmap (fun a h => g (f a) h) l fun a h => H _ (mem_map_of_mem _ h) 
goal: List.pmap g (List.map f l) H = List.pmap (fun a h => g (f a) h) l ⋯

full_name: List.pmap_eq_map_attach
code: theorem pmap_eq_map_attach {p : α → Prop} (f : ∀ a, p a → β) (l H) :
    pmap f l H = l.attach.map fun x => f x.1 (H _ x.2) 
goal: List.pmap f l H = List.map (fun x => f ↑x ⋯) l.attach

full_name: List.attach_map_coe'
code: theorem attach_map_coe' (l : List α) (f : α → β) :
    (l.attach.map fun (i : {i // i ∈ l}) => f i) = l.map f 
goal: List.map (fun i => f ↑i) l.attach = List.map f l

full_name: List.attach_map_val'
code: theorem attach_map_val' (l : List α) (f : α → β) : (l.attach.map fun i => f i.val) = l.map f 
goal: List.map (fun i => f ↑i) l.attach = List.map f l

full_name: List.attach_map_val
code: @[simp]
theorem attach_map_val (l : List α) : l.attach.map Subtype.val = l 
goal: List.map Subtype.val l.attach = l

full_name: List.mem_attach
code: @[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  
goal: x ∈ l.attach

full_name: List.mem_pmap
code: @[simp]
theorem mem_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H b} :
    b ∈ pmap f l H ↔ ∃ (a : _) (h : a ∈ l), f a (H a h) = b 
goal: b ∈ List.pmap f l H ↔ ∃ a h, f a ⋯ = b

full_name: List.length_pmap
code: @[simp]
theorem length_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H} : length (pmap f l H) = length l 
goal: (List.pmap f l H).length = l.length

full_name: List.length_attach
code: @[simp]
theorem length_attach (L : List α) : L.attach.length = L.length 
goal: L.attach.length = L.length

full_name: List.pmap_eq_nil
code: @[simp]
theorem pmap_eq_nil {p : α → Prop} {f : ∀ a, p a → β} {l H} : pmap f l H = [] ↔ l = [] 
goal: List.pmap f l H = [] ↔ l = []

full_name: List.attach_eq_nil
code: @[simp]
theorem attach_eq_nil (l : List α) : l.attach = [] ↔ l = [] 
goal: l.attach = [] ↔ l = []

full_name: List.getLast_pmap
code: theorem getLast_pmap (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) 
goal: (List.pmap f l hl₁).getLast ⋯ = f (l.getLast hl₂) ⋯

full_name: List.getElem?_pmap
code: theorem getElem?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    (pmap f l h)[n]? = Option.pmap f l[n]? fun x H => h x (getElem?_mem H) 
goal: (List.pmap f l h)[n]? = Option.pmap f l[n]? ⋯

full_name: List.get?_pmap
code: theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) 
goal: (List.pmap f l h).get? n = Option.pmap f (l.get? n) ⋯

full_name: List.getElem_pmap
code: theorem getElem_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) {n : ℕ}
    (hn : n < (pmap f l h).length) :
    (pmap f l h)[n] =
      f (l[n]'(@length_pmap _ _ p f l h ▸ hn))
        (h _ (getElem_mem l n (@length_pmap _ _ p f l h ▸ hn))) 
goal: (List.pmap f l h)[n] = f l[n] ⋯

full_name: List.get_pmap
code: theorem get_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) {n : ℕ}
    (hn : n < (pmap f l h).length) :
    get (pmap f l h) ⟨n, hn⟩ =
      f (get l ⟨n, @length_pmap _ _ p f l h ▸ hn⟩)
        (h _ (get_mem l n (@length_pmap _ _ p f l h ▸ hn))) 
goal: (List.pmap f l h).get ⟨n, hn⟩ = f (l.get ⟨n, ⋯⟩) ⋯

full_name: List.nthLe_pmap
code: @[deprecated get_pmap (since := "2023-01-05")]
theorem nthLe_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) {n : ℕ}
    (hn : n < (pmap f l h).length) :
    nthLe (pmap f l h) n hn =
      f (nthLe l n (@length_pmap _ _ p f l h ▸ hn))
        (h _ (get_mem l n (@length_pmap _ _ p f l h ▸ hn))) 
goal: (List.pmap f l h).nthLe n hn = f (l.nthLe n ⋯) ⋯

full_name: List.pmap_append
code: theorem pmap_append {p : ι → Prop} (f : ∀ a : ι, p a → α) (l₁ l₂ : List ι)
    (h : ∀ a ∈ l₁ ++ l₂, p a) :
    (l₁ ++ l₂).pmap f h =
      (l₁.pmap f fun a ha => h a (mem_append_left l₂ ha)) ++
        l₂.pmap f fun a ha => h a (mem_append_right l₁ ha) 
goal: List.pmap f (l₁ ++ l₂) h = List.pmap f l₁ ⋯ ++ List.pmap f l₂ ⋯

full_name: List.pmap_append'
code: theorem pmap_append' {p : α → Prop} (f : ∀ a : α, p a → β) (l₁ l₂ : List α)
    (h₁ : ∀ a ∈ l₁, p a) (h₂ : ∀ a ∈ l₂, p a) :
    ((l₁ ++ l₂).pmap f fun a ha => (List.mem_append.1 ha).elim (h₁ a) (h₂ a)) =
      l₁.pmap f h₁ ++ l₂.pmap f h₂ 
goal: List.pmap f (l₁ ++ l₂) ⋯ = List.pmap f l₁ h₁ ++ List.pmap f l₂ h₂

full_name: List.lookmap.go_append
code: theorem lookmap.go_append (l : List α) (acc : Array α) :
    lookmap.go f l acc = acc.toListAppend (lookmap f l) 
goal: List.lookmap.go f l acc = acc.toListAppend (List.lookmap f l)

full_name: List.lookmap_nil
code: @[simp]
theorem lookmap_nil : [].lookmap f = [] 
goal: List.lookmap f [] = []

full_name: List.lookmap_cons_none
code: @[simp]
theorem lookmap_cons_none {a : α} (l : List α) (h : f a = none) :
    (a :: l).lookmap f = a :: l.lookmap f 
goal: List.lookmap f (a :: l) = a :: List.lookmap f l

full_name: List.lookmap_cons_some
code: @[simp]
theorem lookmap_cons_some {a b : α} (l : List α) (h : f a = some b) :
    (a :: l).lookmap f = b :: l 
goal: List.lookmap f (a :: l) = b :: l

full_name: List.lookmap_some
code: theorem lookmap_some : ∀ l : List α, l.lookmap some = l
  
goal: List.lookmap some l = l

full_name: List.lookmap_none
code: theorem lookmap_none : ∀ l : List α, (l.lookmap fun _ => none) = l
  
goal: List.lookmap (fun x => none) l = l

full_name: List.lookmap_congr
code: theorem lookmap_congr {f g : α → Option α} :
    ∀ {l : List α}, (∀ a ∈ l, f a = g a) → l.lookmap f = l.lookmap g
  
goal: (∀ (a : α), a ∈ l → f a = g a) → List.lookmap f l = List.lookmap g l

full_name: List.lookmap_of_forall_not
code: theorem lookmap_of_forall_not {l : List α} (H : ∀ a ∈ l, f a = none) : l.lookmap f = l 
goal: List.lookmap f l = l

full_name: List.lookmap_map_eq
code: theorem lookmap_map_eq (g : α → β) (h : ∀ (a), ∀ b ∈ f a, g a = g b) :
    ∀ l : List α, map g (l.lookmap f) = map g l
  
goal: List.map g (List.lookmap f l) = List.map g l

full_name: List.lookmap_id'
code: theorem lookmap_id' (h : ∀ (a), ∀ b ∈ f a, a = b) (l : List α) : l.lookmap f = l 
goal: List.lookmap f l = l

full_name: List.length_lookmap
code: theorem length_lookmap (l : List α) : length (l.lookmap f) = length l 
goal: (List.lookmap f l).length = l.length

full_name: List.length_eq_length_filter_add
code: theorem length_eq_length_filter_add {l : List (α)} (f : α → Bool) :
    l.length = (l.filter f).length + (l.filter (! f ·)).length 
goal: l.length = (List.filter f l).length + (List.filter (fun x => !f x) l).length

full_name: List.Sublist.map
code: theorem Sublist.map (f : α → β) {l₁ l₂ : List α} (s : l₁ <+ l₂) : map f l₁ <+ map f l₂ 
goal: (List.map f l₁).Sublist (List.map f l₂)

full_name: List.filterMap_eq_bind_toList
code: theorem filterMap_eq_bind_toList (f : α → Option β) (l : List α) :
    l.filterMap f = l.bind fun a ↦ (f a).toList 
goal: List.filterMap f l = l.bind fun a => (f a).toList

full_name: List.filterMap_congr
code: theorem filterMap_congr {f g : α → Option β} {l : List α}
    (h : ∀ x ∈ l, f x = g x) : l.filterMap f = l.filterMap g 
goal: List.filterMap f l = List.filterMap g l

full_name: List.filterMap_eq_map_iff_forall_eq_some
code: theorem filterMap_eq_map_iff_forall_eq_some {f : α → Option β} {g : α → β} {l : List α} :
    l.filterMap f = l.map g ↔ ∀ x ∈ l, f x = some (g x) 
goal: List.filterMap f l = List.map g l ↔ ∀ (x : α), x ∈ l → f x = some (g x)

full_name: List.filter_singleton
code: theorem filter_singleton {a : α} : [a].filter p = bif p a then [a] else [] 
goal: List.filter p [a] = bif p a then [a] else []

full_name: List.filter_eq_foldr
code: theorem filter_eq_foldr (p : α → Bool) (l : List α) :
    filter p l = foldr (fun a out => bif p a then a :: out else out) [] l 
goal: List.filter p l = List.foldr (fun a out => bif p a then a :: out else out) [] l

full_name: List.filter_subset
code: @[simp]
theorem filter_subset (l : List α) : filter p l ⊆ l 
goal: List.filter p l ⊆ l

full_name: List.of_mem_filter
code: theorem of_mem_filter {a : α} {l} (h : a ∈ filter p l) : p a 
goal: p a = true

full_name: List.mem_of_mem_filter
code: theorem mem_of_mem_filter {a : α} {l} (h : a ∈ filter p l) : a ∈ l 
goal: a ∈ l

full_name: List.mem_filter_of_mem
code: theorem mem_filter_of_mem {a : α} {l} (h₁ : a ∈ l) (h₂ : p a) : a ∈ filter p l 
goal: a ∈ List.filter p l

full_name: List.monotone_filter_left
code: theorem monotone_filter_left (p : α → Bool) ⦃l l' : List α⦄ (h : l ⊆ l') :
    filter p l ⊆ filter p l' 
goal: List.filter p l ⊆ List.filter p l'

full_name: List.monotone_filter_right
code: theorem monotone_filter_right (l : List α) ⦃p q : α → Bool⦄
    (h : ∀ a, p a → q a) : l.filter p <+ l.filter q 
goal: (List.filter p l).Sublist (List.filter q l)

full_name: List.map_filter'
code: lemma map_filter' {f : α → β} (hf : Injective f) (l : List α)
    [DecidablePred fun b => ∃ a, p a ∧ f a = b] :
    (l.filter p).map f = (l.map f).filter fun b => ∃ a, p a ∧ f a = b 
goal: List.map f (List.filter p l) = List.filter (fun b => decide (∃ a, p a = true ∧ f a = b)) (List.map f l)

full_name: List.filter_attach'
code: lemma filter_attach' (l : List α) (p : {a // a ∈ l} → Bool) [DecidableEq α] :
    l.attach.filter p =
      (l.filter fun x => ∃ h, p ⟨x, h⟩).attach.map (Subtype.map id fun x => mem_of_mem_filter) 
goal: List.filter p l.attach = List.map (Subtype.map id ⋯) (List.filter (fun x => decide (∃ h, p ⟨x, h⟩ = true)) l).attach

full_name: List.filter_attach
code: lemma filter_attach (l : List α) (p : α → Bool) :
    (l.attach.filter fun x => p x : List {x // x ∈ l}) =
      (l.filter p).attach.map (Subtype.map id fun x => mem_of_mem_filter) 
goal: List.filter (fun x => p ↑x) l.attach = List.map (Subtype.map id ⋯) (List.filter p l).attach

full_name: List.filter_comm
code: lemma filter_comm (q) (l : List α) : filter p (filter q l) = filter q (filter p l) 
goal: List.filter p (List.filter q l) = List.filter q (List.filter p l)

full_name: List.filter_true
code: @[simp]
theorem filter_true (l : List α) :
    filter (fun _ => true) l = l 
goal: List.filter (fun x => true) l = l

full_name: List.filter_false
code: @[simp]
theorem filter_false (l : List α) :
    filter (fun _ => false) l = [] 
goal: List.filter (fun x => false) l = []

full_name: List.span.loop_eq_take_drop
code: theorem span.loop_eq_take_drop :
    ∀ l₁ l₂ : List α, span.loop p l₁ l₂ = (l₂.reverse ++ takeWhile p l₁, dropWhile p l₁)
  
goal: List.span.loop p l₁ l₂ = (l₂.reverse ++ List.takeWhile p l₁, List.dropWhile p l₁)

full_name: List.span_eq_take_drop
code: @[simp]
theorem span_eq_take_drop (l : List α) : span p l = (takeWhile p l, dropWhile p l) 
goal: List.span p l = (List.takeWhile p l, List.dropWhile p l)

full_name: List.dropWhile_nthLe_zero_not
code: theorem dropWhile_nthLe_zero_not (l : List α) (hl : 0 < (l.dropWhile p).length) :
    ¬p ((l.dropWhile p).nthLe 0 hl) 
goal: ¬p ((List.dropWhile p l).nthLe 0 hl) = true

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

full_name: List.takeWhile_cons_of_pos
code: theorem takeWhile_cons_of_pos {x : α} (h : p x) :
    List.takeWhile p (x :: l) = x :: takeWhile p l 
goal: List.takeWhile p (x :: l) = x :: List.takeWhile p l

full_name: List.takeWhile_cons_of_neg
code: theorem takeWhile_cons_of_neg {x : α} (h : ¬ p x) :
    List.takeWhile p (x :: l) = [] 
goal: List.takeWhile p (x :: l) = []

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

full_name: List.takeWhile_eq_nil_iff
code: @[simp]
theorem takeWhile_eq_nil_iff : takeWhile p l = [] ↔ ∀ hl : 0 < l.length, ¬p (l.nthLe 0 hl) 
goal: List.takeWhile p l = [] ↔ ∀ (hl : 0 < l.length), ¬p (l.nthLe 0 hl) = true

full_name: List.mem_takeWhile_imp
code: theorem mem_takeWhile_imp {x : α} (hx : x ∈ takeWhile p l) : p x 
goal: p x = true

full_name: List.takeWhile_takeWhile
code: theorem takeWhile_takeWhile (p q : α → Bool) (l : List α) :
    takeWhile p (takeWhile q l) = takeWhile (fun a => p a ∧ q a) l 
goal: List.takeWhile p (List.takeWhile q l) = List.takeWhile (fun a => decide (p a = true ∧ q a = true)) l

full_name: List.takeWhile_idem
code: theorem takeWhile_idem : takeWhile p (takeWhile p l) = takeWhile p l 
goal: List.takeWhile p (List.takeWhile p l) = List.takeWhile p l

full_name: List.length_eraseP_add_one
code: @[simp]
theorem length_eraseP_add_one {l : List α} {a} (al : a ∈ l) (pa : p a) :
    (l.eraseP p).length + 1 = l.length 
goal: (List.eraseP p l).length + 1 = l.length

full_name: List.length_erase_add_one
code: @[simp] theorem length_erase_add_one {a : α} {l : List α} (h : a ∈ l) :
    (l.erase a).length + 1 = l.length 
goal: (l.erase a).length + 1 = l.length

full_name: List.map_erase
code: theorem map_erase [DecidableEq β] {f : α → β} (finj : Injective f) {a : α} (l : List α) :
    map f (l.erase a) = (map f l).erase (f a) 
goal: List.map f (l.erase a) = (List.map f l).erase (f a)

full_name: List.map_foldl_erase
code: theorem map_foldl_erase [DecidableEq β] {f : α → β} (finj : Injective f) {l₁ l₂ : List α} :
    map f (foldl List.erase l₁ l₂) = foldl (fun l a => l.erase (f a)) (map f l₁) l₂ 
goal: List.map f (List.foldl List.erase l₁ l₂) = List.foldl (fun l a => l.erase (f a)) (List.map f l₁) l₂

full_name: List.erase_get
code: theorem erase_get [DecidableEq ι] {l : List ι} (i : Fin l.length) :
    Perm (l.erase (l.get i)) (l.eraseIdx ↑i) 
goal: (l.erase (l.get i)).Perm (l.eraseIdx ↑i)

full_name: List.length_eraseIdx_add_one
code: theorem length_eraseIdx_add_one {l : List ι} {i : ℕ} (h : i < l.length) :
    (l.eraseIdx i).length + 1 = l.length 
goal: (l.eraseIdx i).length + 1 = l.length

full_name: List.map_diff
code: @[simp]
theorem map_diff [DecidableEq β] {f : α → β} (finj : Injective f) {l₁ l₂ : List α} :
    map f (l₁.diff l₂) = (map f l₁).diff (map f l₂) 
goal: List.map f (l₁.diff l₂) = (List.map f l₁).diff (List.map f l₂)

full_name: List.erase_diff_erase_sublist_of_sublist
code: theorem erase_diff_erase_sublist_of_sublist {a : α} :
    ∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁
  
goal: l₁.Sublist l₂ → ((l₂.erase a).diff (l₁.erase a)).Sublist (l₂.diff l₁)

full_name: List.choose_spec
code: theorem choose_spec (hp : ∃ a, a ∈ l ∧ p a) : choose p l hp ∈ l ∧ p (choose p l hp) 
goal: List.choose p l hp ∈ l ∧ p (List.choose p l hp)

full_name: List.choose_mem
code: theorem choose_mem (hp : ∃ a, a ∈ l ∧ p a) : choose p l hp ∈ l 
goal: List.choose p l hp ∈ l

full_name: List.choose_property
code: theorem choose_property (hp : ∃ a, a ∈ l ∧ p a) : p (choose p l hp) 
goal: p (List.choose p l hp)

full_name: List.map₂Left'_nil_right
code: @[simp]
theorem map₂Left'_nil_right (f : α → Option β → γ) (as) :
    map₂Left' f as [] = (as.map fun a => f a none, []) 
goal: List.map₂Left' f as [] = (List.map (fun a => f a none) as, [])

full_name: List.map₂Right'_nil_left
code: @[simp]
theorem map₂Right'_nil_left : map₂Right' f [] bs = (bs.map (f none), []) 
goal: List.map₂Right' f [] bs = (List.map (f none) bs, [])

full_name: List.map₂Right'_nil_right
code: @[simp]
theorem map₂Right'_nil_right : map₂Right' f as [] = ([], as) 
goal: List.map₂Right' f as [] = ([], as)

full_name: List.map₂Right'_nil_cons
code: theorem map₂Right'_nil_cons : map₂Right' f [] (b :: bs) = (f none b :: bs.map (f none), []) 
goal: List.map₂Right' f [] (b :: bs) = (f none b :: List.map (f none) bs, [])

full_name: List.map₂Right'_cons_cons
code: @[simp]
theorem map₂Right'_cons_cons :
    map₂Right' f (a :: as) (b :: bs) =
      let r := map₂Right' f as bs
      (f (some a) b :: r.fst, r.snd) 
goal: List.map₂Right' f (a :: as) (b :: bs) =
  let r := List.map₂Right' f as bs;
  (f (some a) b :: r.1, r.2)

full_name: List.zipLeft'_nil_right
code: @[simp]
theorem zipLeft'_nil_right : zipLeft' as ([] : List β) = (as.map fun a => (a, none), []) 
goal: as.zipLeft' [] = (List.map (fun a => (a, none)) as, [])

full_name: List.zipLeft'_nil_left
code: @[simp]
theorem zipLeft'_nil_left : zipLeft' ([] : List α) bs = ([], bs) 
goal: [].zipLeft' bs = ([], bs)

full_name: List.zipLeft'_cons_nil
code: theorem zipLeft'_cons_nil :
    zipLeft' (a :: as) ([] : List β) = ((a, none) :: as.map fun a => (a, none), []) 
goal: (a :: as).zipLeft' [] = ((a, none) :: List.map (fun a => (a, none)) as, [])

full_name: List.zipLeft'_cons_cons
code: @[simp]
theorem zipLeft'_cons_cons :
    zipLeft' (a :: as) (b :: bs) =
      let r := zipLeft' as bs
      ((a, some b) :: r.fst, r.snd) 
goal: (a :: as).zipLeft' (b :: bs) =
  let r := as.zipLeft' bs;
  ((a, some b) :: r.1, r.2)

full_name: List.zipRight'_nil_left
code: @[simp]
theorem zipRight'_nil_left : zipRight' ([] : List α) bs = (bs.map fun b => (none, b), []) 
goal: [].zipRight' bs = (List.map (fun b => (none, b)) bs, [])

full_name: List.zipRight'_nil_right
code: @[simp]
theorem zipRight'_nil_right : zipRight' as ([] : List β) = ([], as) 
goal: as.zipRight' [] = ([], as)

full_name: List.zipRight'_nil_cons
code: theorem zipRight'_nil_cons :
    zipRight' ([] : List α) (b :: bs) = ((none, b) :: bs.map fun b => (none, b), []) 
goal: [].zipRight' (b :: bs) = ((none, b) :: List.map (fun b => (none, b)) bs, [])

full_name: List.zipRight'_cons_cons
code: @[simp]
theorem zipRight'_cons_cons :
    zipRight' (a :: as) (b :: bs) =
      let r := zipRight' as bs
      ((some a, b) :: r.fst, r.snd) 
goal: (a :: as).zipRight' (b :: bs) =
  let r := as.zipRight' bs;
  ((some a, b) :: r.1, r.2)

full_name: List.map₂Left_nil_right
code: @[simp]
theorem map₂Left_nil_right : map₂Left f as [] = as.map fun a => f a none 
goal: List.map₂Left f as [] = List.map (fun a => f a none) as

full_name: List.map₂Left_eq_map₂Left'
code: theorem map₂Left_eq_map₂Left' : ∀ as bs, map₂Left f as bs = (map₂Left' f as bs).fst
  
goal: List.map₂Left f as bs = (List.map₂Left' f as bs).1

full_name: List.map₂Left_eq_zipWith
code: theorem map₂Left_eq_zipWith :
    ∀ as bs, length as ≤ length bs → map₂Left f as bs = zipWith (fun a b => f a (some b)) as bs
  
goal: as.length ≤ bs.length → List.map₂Left f as bs = List.zipWith (fun a b => f a (some b)) as bs

full_name: List.map₂Right_nil_left
code: @[simp]
theorem map₂Right_nil_left : map₂Right f [] bs = bs.map (f none) 
goal: List.map₂Right f [] bs = List.map (f none) bs

full_name: List.map₂Right_nil_right
code: @[simp]
theorem map₂Right_nil_right : map₂Right f as [] = [] 
goal: List.map₂Right f as [] = []

full_name: List.map₂Right_nil_cons
code: theorem map₂Right_nil_cons : map₂Right f [] (b :: bs) = f none b :: bs.map (f none) 
goal: List.map₂Right f [] (b :: bs) = f none b :: List.map (f none) bs

full_name: List.map₂Right_cons_cons
code: @[simp]
theorem map₂Right_cons_cons :
    map₂Right f (a :: as) (b :: bs) = f (some a) b :: map₂Right f as bs 
goal: List.map₂Right f (a :: as) (b :: bs) = f (some a) b :: List.map₂Right f as bs

full_name: List.map₂Right_eq_map₂Right'
code: theorem map₂Right_eq_map₂Right' : map₂Right f as bs = (map₂Right' f as bs).fst 
goal: List.map₂Right f as bs = (List.map₂Right' f as bs).1

full_name: List.map₂Right_eq_zipWith
code: theorem map₂Right_eq_zipWith (h : length bs ≤ length as) :
    map₂Right f as bs = zipWith (fun a b => f (some a) b) as bs 
goal: List.map₂Right f as bs = List.zipWith (fun a b => f (some a) b) as bs

full_name: List.zipLeft_nil_right
code: @[simp]
theorem zipLeft_nil_right : zipLeft as ([] : List β) = as.map fun a => (a, none) 
goal: as.zipLeft [] = List.map (fun a => (a, none)) as

full_name: List.zipLeft_nil_left
code: @[simp]
theorem zipLeft_nil_left : zipLeft ([] : List α) bs = [] 
goal: [].zipLeft bs = []

full_name: List.zipLeft_cons_nil
code: theorem zipLeft_cons_nil :
    zipLeft (a :: as) ([] : List β) = (a, none) :: as.map fun a => (a, none) 
goal: (a :: as).zipLeft [] = (a, none) :: List.map (fun a => (a, none)) as

full_name: List.zipLeft_cons_cons
code: @[simp]
theorem zipLeft_cons_cons : zipLeft (a :: as) (b :: bs) = (a, some b) :: zipLeft as bs 
goal: (a :: as).zipLeft (b :: bs) = (a, some b) :: as.zipLeft bs

full_name: List.zipLeft_eq_zipLeft'
code: theorem zipLeft_eq_zipLeft' (as : List α) (bs : List β) : zipLeft as bs = (zipLeft' as bs).fst 
goal: as.zipLeft bs = (as.zipLeft' bs).1

full_name: List.zipRight_nil_left
code: @[simp]
theorem zipRight_nil_left : zipRight ([] : List α) bs = bs.map fun b => (none, b) 
goal: [].zipRight bs = List.map (fun b => (none, b)) bs

full_name: List.zipRight_nil_right
code: @[simp]
theorem zipRight_nil_right : zipRight as ([] : List β) = [] 
goal: as.zipRight [] = []

full_name: List.zipRight_nil_cons
code: theorem zipRight_nil_cons :
    zipRight ([] : List α) (b :: bs) = (none, b) :: bs.map fun b => (none, b) 
goal: [].zipRight (b :: bs) = (none, b) :: List.map (fun b => (none, b)) bs

full_name: List.zipRight_cons_cons
code: @[simp]
theorem zipRight_cons_cons : zipRight (a :: as) (b :: bs) = (some a, b) :: zipRight as bs 
goal: (a :: as).zipRight (b :: bs) = (some a, b) :: as.zipRight bs

full_name: List.zipRight_eq_zipRight'
code: theorem zipRight_eq_zipRight' : zipRight as bs = (zipRight' as bs).fst 
goal: as.zipRight bs = (as.zipRight' bs).1

full_name: List.forall_cons
code: @[simp]
theorem forall_cons (p : α → Prop) (x : α) : ∀ l : List α, Forall p (x :: l) ↔ p x ∧ Forall p l
  
goal: List.Forall p (x :: l) ↔ p x ∧ List.Forall p l

full_name: List.forall_iff_forall_mem
code: theorem forall_iff_forall_mem : ∀ {l : List α}, Forall p l ↔ ∀ x ∈ l, p x
  
goal: List.Forall p l ↔ ∀ (x : α), x ∈ l → p x

full_name: List.Forall.imp
code: theorem Forall.imp (h : ∀ x, p x → q x) : ∀ {l : List α}, Forall p l → Forall q l
  
goal: List.Forall p l → List.Forall q l

full_name: List.forall_map_iff
code: @[simp]
theorem forall_map_iff {p : β → Prop} (f : α → β) : Forall p (l.map f) ↔ Forall (p ∘ f) l 
goal: List.Forall p (List.map f l) ↔ List.Forall (p ∘ f) l

full_name: List.instDecidablePredForall
code: instance (p : α → Prop) [DecidablePred p] : DecidablePred (Forall p) 
goal: DecidablePred (List.Forall p)

full_name: List.getLast_reverse
code: theorem getLast_reverse {l : List α} (hl : l.reverse ≠ [])
    (hl' : 0 < l.length := (by
      contrapose! hl
      simpa [length_eq_zero] using hl)) :
    l.reverse.getLast hl = l.get ⟨0, hl'⟩ 
goal: l.reverse.getLast hl = l.get ⟨0, hl'⟩

full_name: List.getElem_attach
code: @[simp]
theorem getElem_attach (L : List α) (i : Nat) (h : i < L.attach.length) :
    L.attach[i].1 = L[i]'(length_attach L ▸ h) 
goal: ↑L.attach[i] = L[i]

full_name: List.get_attach
code: theorem get_attach (L : List α) (i) :
    (L.attach.get i).1 = L.get ⟨i, length_attach L ▸ i.2⟩ 
goal: ↑(L.attach.get i) = L.get ⟨↑i, ⋯⟩

full_name: List.mem_map_swap
code: @[simp 1100]
theorem mem_map_swap (x : α) (y : β) (xs : List (α × β)) :
    (y, x) ∈ map Prod.swap xs ↔ (x, y) ∈ xs 
goal: (y, x) ∈ List.map Prod.swap xs ↔ (x, y) ∈ xs

full_name: List.dropSlice_eq
code: theorem dropSlice_eq (xs : List α) (n m : ℕ) : dropSlice n m xs = xs.take n ++ xs.drop (n + m) 
goal: List.dropSlice n m xs = List.take n xs ++ List.drop (n + m) xs

full_name: List.length_dropSlice
code: @[simp]
theorem length_dropSlice (i j : ℕ) (xs : List α) :
    (List.dropSlice i j xs).length = xs.length - min j (xs.length - i) 
goal: (List.dropSlice i j xs).length = xs.length - min j (xs.length - i)

full_name: List.length_dropSlice_lt
code: theorem length_dropSlice_lt (i j : ℕ) (hj : 0 < j) (xs : List α) (hi : i < xs.length) :
    (List.dropSlice i j xs).length < xs.length 
goal: (List.dropSlice i j xs).length < xs.length

full_name: List.sizeOf_dropSlice_lt
code: @[deprecated (since := "2024-07-25")]
theorem sizeOf_dropSlice_lt [SizeOf α] (i j : ℕ) (hj : 0 < j) (xs : List α) (hi : i < xs.length) :
    SizeOf.sizeOf (List.dropSlice i j xs) < SizeOf.sizeOf xs 
goal: sizeOf (List.dropSlice i j xs) < sizeOf xs

full_name: List.disjoint_pmap
code: /-- The images of disjoint lists under a partially defined map are disjoint -/
theorem disjoint_pmap {p : α → Prop} {f : ∀ a : α, p a → β} {s t : List α}
    (hs : ∀ a ∈ s, p a) (ht : ∀ a ∈ t, p a)
    (hf : ∀ (a a' : α) (ha : p a) (ha' : p a'), f a ha = f a' ha' → a = a')
    (h : Disjoint s t) :
    Disjoint (s.pmap f hs) (t.pmap f ht) 
goal: (List.pmap f s hs).Disjoint (List.pmap f t ht)

full_name: List.disjoint_map
code: /-- The images of disjoint lists under an injective map are disjoint -/
theorem disjoint_map {f : α → β} {s t : List α} (hf : Function.Injective f)
    (h : Disjoint s t) : Disjoint (s.map f) (t.map f) 
goal: (List.map f s).Disjoint (List.map f t)

full_name: List.lookup_graph
code: lemma lookup_graph (f : α → β) {a : α} {as : List α} (h : a ∈ as) :
    lookup a (as.map fun x => (x, f x)) = some (f a) 
goal: List.lookup a (List.map (fun x => (x, f x)) as) = some (f a)