File: Mathlib/Data/List/Infix.lean

full_name: List.prefix_rfl
code: theorem prefix_rfl : l <+: l 
goal: l <+: l

full_name: List.suffix_rfl
code: theorem suffix_rfl : l <:+ l 
goal: l <:+ l

full_name: List.infix_rfl
code: theorem infix_rfl : l <:+: l 
goal: l <:+: l

full_name: List.prefix_concat
code: theorem prefix_concat (a : α) (l) : l <+: concat l a 
goal: l <+: l.concat a

full_name: List.prefix_concat_iff
code: theorem prefix_concat_iff {l₁ l₂ : List α} {a : α} :
    l₁ <+: l₂ ++ [a] ↔ l₁ = l₂ ++ [a] ∨ l₁ <+: l₂ 
goal: l₁ <+: l₂ ++ [a] ↔ l₁ = l₂ ++ [a] ∨ l₁ <+: l₂

full_name: List.eq_of_infix_of_length_eq
code: theorem eq_of_infix_of_length_eq (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂ 
goal: l₁.length = l₂.length → l₁ = l₂

full_name: List.eq_of_prefix_of_length_eq
code: theorem eq_of_prefix_of_length_eq (h : l₁ <+: l₂) : l₁.length = l₂.length → l₁ = l₂ 
goal: l₁.length = l₂.length → l₁ = l₂

full_name: List.eq_of_suffix_of_length_eq
code: theorem eq_of_suffix_of_length_eq (h : l₁ <:+ l₂) : l₁.length = l₂.length → l₁ = l₂ 
goal: l₁.length = l₂.length → l₁ = l₂

full_name: List.dropSlice_sublist
code: lemma dropSlice_sublist (n m : ℕ) (l : List α) : l.dropSlice n m <+ l 
goal: (List.dropSlice n m l).Sublist l

full_name: List.dropSlice_subset
code: lemma dropSlice_subset (n m : ℕ) (l : List α) : l.dropSlice n m ⊆ l 
goal: List.dropSlice n m l ⊆ l

full_name: List.mem_of_mem_dropSlice
code: lemma mem_of_mem_dropSlice {n m : ℕ} {l : List α} {a : α} (h : a ∈ l.dropSlice n m) : a ∈ l 
goal: a ∈ l

full_name: List.takeWhile_prefix
code: theorem takeWhile_prefix (p : α → Bool) : l.takeWhile p <+: l 
goal: List.takeWhile p l <+: l

full_name: List.dropWhile_suffix
code: theorem dropWhile_suffix (p : α → Bool) : l.dropWhile p <:+ l 
goal: List.dropWhile p l <:+ l

full_name: List.dropLast_prefix
code: theorem dropLast_prefix : ∀ l : List α, l.dropLast <+: l
  
goal: l.dropLast <+: l

full_name: List.tail_suffix
code: theorem tail_suffix (l : List α) : tail l <:+ l 
goal: l.tail <:+ l

full_name: List.dropLast_sublist
code: theorem dropLast_sublist (l : List α) : l.dropLast <+ l 
goal: l.dropLast.Sublist l

full_name: List.drop_sublist_drop_left
code: @[gcongr]
theorem drop_sublist_drop_left (l : List α) {m n : ℕ} (h : m ≤ n) : drop n l <+ drop m l 
goal: (List.drop n l).Sublist (List.drop m l)

full_name: List.dropLast_subset
code: theorem dropLast_subset (l : List α) : l.dropLast ⊆ l 
goal: l.dropLast ⊆ l

full_name: List.tail_subset
code: theorem tail_subset (l : List α) : tail l ⊆ l 
goal: l.tail ⊆ l

full_name: List.mem_of_mem_dropLast
code: theorem mem_of_mem_dropLast (h : a ∈ l.dropLast) : a ∈ l 
goal: a ∈ l

full_name: List.mem_of_mem_tail
code: theorem mem_of_mem_tail (h : a ∈ l.tail) : a ∈ l 
goal: a ∈ l

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

full_name: List.prefix_iff_eq_append
code: theorem prefix_iff_eq_append : l₁ <+: l₂ ↔ l₁ ++ drop (length l₁) l₂ = l₂ 
goal: l₁ <+: l₂ ↔ l₁ ++ List.drop l₁.length l₂ = l₂

full_name: List.suffix_iff_eq_append
code: theorem suffix_iff_eq_append : l₁ <:+ l₂ ↔ take (length l₂ - length l₁) l₂ ++ l₁ = l₂ 
goal: l₁ <:+ l₂ ↔ List.take (l₂.length - l₁.length) l₂ ++ l₁ = l₂

full_name: List.prefix_iff_eq_take
code: theorem prefix_iff_eq_take : l₁ <+: l₂ ↔ l₁ = take (length l₁) l₂ 
goal: l₁ <+: l₂ ↔ l₁ = List.take l₁.length l₂

full_name: List.prefix_take_iff
code: theorem prefix_take_iff {x y : List α} {n : ℕ} : x <+: y.take n ↔ x <+: y ∧ x.length ≤ n 
goal: x <+: List.take n y ↔ x <+: y ∧ x.length ≤ n

full_name: List.concat_get_prefix
code: theorem concat_get_prefix {x y : List α} (h : x <+: y) (hl : x.length < y.length) :
    x ++ [y.get ⟨x.length, hl⟩] <+: y 
goal: x ++ [y.get ⟨x.length, hl⟩] <+: y

full_name: List.suffix_iff_eq_drop
code: theorem suffix_iff_eq_drop : l₁ <:+ l₂ ↔ l₁ = drop (length l₂ - length l₁) l₂ 
goal: l₁ <:+ l₂ ↔ l₁ = List.drop (l₂.length - l₁.length) l₂

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

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

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

full_name: List.prefix_take_le_iff
code: theorem prefix_take_le_iff {L : List (List (Option α))} (hm : m < L.length) :
    L.take m <+: L.take n ↔ m ≤ n 
goal: List.take m L <+: List.take n L ↔ m ≤ n

full_name: List.cons_prefix_iff
code: theorem cons_prefix_iff : a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂ 
goal: a :: l₁ <+: b :: l₂ ↔ a = b ∧ l₁ <+: l₂

full_name: List.IsPrefix.map
code: protected theorem IsPrefix.map (h : l₁ <+: l₂) (f : α → β) : l₁.map f <+: l₂.map f 
goal: List.map f l₁ <+: List.map f l₂

full_name: List.IsPrefix.filterMap
code: protected theorem IsPrefix.filterMap (h : l₁ <+: l₂) (f : α → Option β) :
    l₁.filterMap f <+: l₂.filterMap f 
goal: List.filterMap f l₁ <+: List.filterMap f l₂

full_name: List.IsPrefix.reduceOption
code: protected theorem IsPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂) :
    l₁.reduceOption <+: l₂.reduceOption 
goal: l₁.reduceOption <+: l₂.reduceOption

full_name: List.instIsPartialOrderIsPrefix
code: instance : IsPartialOrder (List α) (· <+: ·) 
goal: IsPartialOrder (List α) fun x x_1 => x <+: x_1

full_name: List.instIsPartialOrderIsSuffix
code: instance : IsPartialOrder (List α) (· <:+ ·) 
goal: IsPartialOrder (List α) fun x x_1 => x <:+ x_1

full_name: List.instIsPartialOrderIsInfix
code: instance : IsPartialOrder (List α) (· <:+: ·) 
goal: IsPartialOrder (List α) fun x x_1 => x <:+: x_1

full_name: List.mem_inits
code: @[simp]
theorem mem_inits : ∀ s t : List α, s ∈ inits t ↔ s <+: t
  
goal: s ∈ t.inits ↔ s <+: t

full_name: List.mem_tails
code: @[simp]
theorem mem_tails : ∀ s t : List α, s ∈ tails t ↔ s <:+ t
  
goal: s ∈ t.tails ↔ s <:+ t

full_name: List.inits_cons
code: theorem inits_cons (a : α) (l : List α) : inits (a :: l) = [] :: l.inits.map fun t => a :: t 
goal: (a :: l).inits = [] :: List.map (fun t => a :: t) l.inits

full_name: List.tails_cons
code: theorem tails_cons (a : α) (l : List α) : tails (a :: l) = (a :: l) :: l.tails 
goal: (a :: l).tails = (a :: l) :: l.tails

full_name: List.inits_append
code: @[simp]
theorem inits_append : ∀ s t : List α, inits (s ++ t) = s.inits ++ t.inits.tail.map fun l => s ++ l
  
goal: (s ++ t).inits = s.inits ++ List.map (fun l => s ++ l) t.inits.tail

full_name: List.tails_append
code: @[simp]
theorem tails_append :
    ∀ s t : List α, tails (s ++ t) = (s.tails.map fun l => l ++ t) ++ t.tails.tail
  
goal: (s ++ t).tails = List.map (fun l => l ++ t) s.tails ++ t.tails.tail

full_name: List.inits_eq_tails
code: theorem inits_eq_tails : ∀ l : List α, l.inits = (reverse <| map reverse <| tails <| reverse l)
  
goal: l.inits = (List.map List.reverse l.reverse.tails).reverse

full_name: List.tails_eq_inits
code: theorem tails_eq_inits : ∀ l : List α, l.tails = (reverse <| map reverse <| inits <| reverse l)
  
goal: l.tails = (List.map List.reverse l.reverse.inits).reverse

full_name: List.inits_reverse
code: theorem inits_reverse (l : List α) : inits (reverse l) = reverse (map reverse l.tails) 
goal: l.reverse.inits = (List.map List.reverse l.tails).reverse

full_name: List.tails_reverse
code: theorem tails_reverse (l : List α) : tails (reverse l) = reverse (map reverse l.inits) 
goal: l.reverse.tails = (List.map List.reverse l.inits).reverse

full_name: List.map_reverse_inits
code: theorem map_reverse_inits (l : List α) : map reverse l.inits = (reverse <| tails <| reverse l) 
goal: List.map List.reverse l.inits = l.reverse.tails.reverse

full_name: List.map_reverse_tails
code: theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l) 
goal: List.map List.reverse l.tails = l.reverse.inits.reverse

full_name: List.length_tails
code: @[simp]
theorem length_tails (l : List α) : length (tails l) = length l + 1 
goal: l.tails.length = l.length + 1

full_name: List.length_inits
code: @[simp]
theorem length_inits (l : List α) : length (inits l) = length l + 1 
goal: l.inits.length = l.length + 1

full_name: List.getElem_tails
code: @[simp]
theorem getElem_tails (l : List α) (n : Nat) (h : n < (tails l).length) :
    (tails l)[n] = l.drop n 
goal: l.tails[n] = List.drop n l

full_name: List.get_tails
code: theorem get_tails (l : List α) (n : Fin (length (tails l))) : (tails l).get n = l.drop n 
goal: l.tails.get n = List.drop (↑n) l

full_name: List.getElem_inits
code: @[simp]
theorem getElem_inits (l : List α) (n : Nat) (h : n < length (inits l)) :
    (inits l)[n] = l.take n 
goal: l.inits[n] = List.take n l

full_name: List.get_inits
code: theorem get_inits (l : List α) (n : Fin (length (inits l))) : (inits l).get n = l.take n 
goal: l.inits.get n = List.take (↑n) l

full_name: List.nth_le_tails
code: @[simp, deprecated get_tails (since := "2024-04-16")]
theorem nth_le_tails (l : List α) (n : ℕ) (hn : n < length (tails l)) :
    nthLe (tails l) n hn = l.drop n 
goal: l.tails.nthLe n hn = List.drop n l

full_name: List.nth_le_inits
code: @[simp, deprecated get_inits (since := "2024-04-16")]
theorem nth_le_inits (l : List α) (n : ℕ) (hn : n < length (inits l)) :
    nthLe (inits l) n hn = l.take n 
goal: l.inits.nthLe n hn = List.take n l

full_name: List.insert_eq_ite
code: theorem insert_eq_ite (a : α) (l : List α) : insert a l = if a ∈ l then l else a :: l 
goal: insert a l = if a ∈ l then l else a :: l

full_name: List.suffix_insert
code: @[simp]
theorem suffix_insert (a : α) (l : List α) : l <:+ l.insert a 
goal: l <:+ List.insert a l

full_name: List.infix_insert
code: theorem infix_insert (a : α) (l : List α) : l <:+: l.insert a 
goal: l <:+: List.insert a l

full_name: List.sublist_insert
code: theorem sublist_insert (a : α) (l : List α) : l <+ l.insert a 
goal: l.Sublist (List.insert a l)

full_name: List.subset_insert
code: theorem subset_insert (a : α) (l : List α) : l ⊆ l.insert a 
goal: l ⊆ List.insert a l

full_name: List.mem_of_mem_suffix
code: theorem mem_of_mem_suffix (hx : a ∈ l₁) (hl : l₁ <:+ l₂) : a ∈ l₂ 
goal: a ∈ l₂

full_name: List.IsPrefix.ne_nil
code: theorem IsPrefix.ne_nil {x y : List α} (h : x <+: y) (hx : x ≠ []) : y ≠ [] 
goal: y ≠ []

full_name: List.IsPrefix.getElem
code: theorem IsPrefix.getElem {x y : List α} (h : x <+: y) {n} (hn : n < x.length) :
    x[n] = y[n]'(hn.trans_le h.length_le) 
goal: x[n] = y[n]

full_name: List.IsPrefix.get_eq
code: theorem IsPrefix.get_eq {x y : List α} (h : x <+: y) {n} (hn : n < x.length) :
    x.get ⟨n, hn⟩ = y.get ⟨n, hn.trans_le h.length_le⟩ 
goal: x.get ⟨n, hn⟩ = y.get ⟨n, ⋯⟩

full_name: List.IsPrefix.head_eq
code: theorem IsPrefix.head_eq {x y : List α} (h : x <+: y) (hx : x ≠ []) :
    x.head hx = y.head (h.ne_nil hx) 
goal: x.head hx = y.head ⋯