Documentation

Mathlib.Data.List.Infix

Prefixes, suffixes, infixes #

This file proves properties about

All those (except insert) are defined in Mathlib.Data.List.Defs.

Notation #

prefix, suffix, infix #

theorem List.prefix_rfl {α : Type u_1} {l : List α} :
l <+: l
theorem List.suffix_rfl {α : Type u_1} {l : List α} :
l <:+ l
theorem List.infix_rfl {α : Type u_1} {l : List α} :
l <:+: l
theorem List.prefix_concat {α : Type u_1} (a : α) (l : List α) :
theorem List.prefix_concat_iff {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} :
l₁ <+: l₂ ++ [a] l₁ = l₂ ++ [a] l₁ <+: l₂
theorem List.isSuffix.reverse :
∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <:+ l₂List.reverse l₁ <+: List.reverse l₂

Alias of the reverse direction of List.reverse_prefix.

theorem List.isPrefix.reverse :
∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <+: l₂List.reverse l₁ <:+ List.reverse l₂

Alias of the reverse direction of List.reverse_suffix.

theorem List.isInfix.reverse :
∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <:+: l₂List.reverse l₁ <:+: List.reverse l₂

Alias of the reverse direction of List.reverse_infix.

theorem List.eq_nil_of_infix_nil :
∀ {α : Type u_1} {l : List α}, l <:+: []l = []

Alias of the forward direction of List.infix_nil.

theorem List.eq_nil_of_prefix_nil :
∀ {α : Type u_1} {l : List α}, l <+: []l = []

Alias of the forward direction of List.prefix_nil.

theorem List.eq_nil_of_suffix_nil :
∀ {α : Type u_1} {l : List α}, l <:+ []l = []

Alias of the forward direction of List.suffix_nil.

theorem List.eq_of_infix_of_length_eq {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <:+: l₂) :
List.length l₁ = List.length l₂l₁ = l₂
theorem List.eq_of_prefix_of_length_eq {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) :
List.length l₁ = List.length l₂l₁ = l₂
theorem List.eq_of_suffix_of_length_eq {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <:+ l₂) :
List.length l₁ = List.length l₂l₁ = l₂
theorem List.dropSlice_sublist {α : Type u_1} (n : ) (m : ) (l : List α) :
theorem List.dropSlice_subset {α : Type u_1} (n : ) (m : ) (l : List α) :
theorem List.mem_of_mem_dropSlice {α : Type u_1} {n : } {m : } {l : List α} {a : α} (h : a List.dropSlice n m l) :
a l
theorem List.takeWhile_prefix {α : Type u_1} {l : List α} (p : αBool) :
theorem List.dropWhile_suffix {α : Type u_1} {l : List α} (p : αBool) :
theorem List.dropLast_prefix {α : Type u_1} (l : List α) :
theorem List.tail_suffix {α : Type u_1} (l : List α) :
theorem List.drop_sublist_drop_left {α : Type u_1} (l : List α) {m : } {n : } (h : m n) :
theorem List.dropLast_subset {α : Type u_1} (l : List α) :
theorem List.tail_subset {α : Type u_1} (l : List α) :
theorem List.mem_of_mem_dropLast {α : Type u_1} {l : List α} {a : α} (h : a List.dropLast l) :
a l
theorem List.mem_of_mem_tail {α : Type u_1} {l : List α} {a : α} (h : a List.tail l) :
a l
theorem List.Sublist.drop {α : Type u_1} {l₁ : List α} {l₂ : List α} :
List.Sublist l₁ l₂∀ (n : ), List.Sublist (List.drop n l₁) (List.drop n l₂)
theorem List.prefix_iff_eq_append {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <+: l₂ l₁ ++ List.drop (List.length l₁) l₂ = l₂
theorem List.suffix_iff_eq_append {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <:+ l₂ List.take (List.length l₂ - List.length l₁) l₂ ++ l₁ = l₂
theorem List.prefix_iff_eq_take {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <+: l₂ l₁ = List.take (List.length l₁) l₂
theorem List.prefix_take_iff {α : Type u_1} {x : List α} {y : List α} {n : } :
theorem List.concat_get_prefix {α : Type u_1} {x : List α} {y : List α} (h : x <+: y) (hl : List.length x < List.length y) :
x ++ [List.get y { val := List.length x, isLt := hl }] <+: y
theorem List.suffix_iff_eq_drop {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <:+ l₂ l₁ = List.drop (List.length l₂ - List.length l₁) l₂
instance List.decidablePrefix {α : Type u_1} [DecidableEq α] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ <+: l₂)
Equations
instance List.decidableSuffix {α : Type u_1} [DecidableEq α] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ <:+ l₂)
Equations
instance List.decidableInfix {α : Type u_1} [DecidableEq α] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ <:+: l₂)
Equations
theorem List.prefix_take_le_iff {α : Type u_1} {m : } {n : } {L : List (List (Option α))} (hm : m < List.length L) :
theorem List.cons_prefix_iff {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} {b : α} :
a :: l₁ <+: b :: l₂ a = b l₁ <+: l₂
theorem List.IsPrefix.map {α : Type u_1} {β : Type u_2} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) (f : αβ) :
List.map f l₁ <+: List.map f l₂
theorem List.IsPrefix.filterMap {α : Type u_1} {β : Type u_2} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) (f : αOption β) :
@[deprecated List.IsPrefix.filterMap]
theorem List.IsPrefix.filter_map {α : Type u_1} {β : Type u_2} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) (f : αOption β) :

Alias of List.IsPrefix.filterMap.

theorem List.IsPrefix.reduceOption {α : Type u_1} {l₁ : List (Option α)} {l₂ : List (Option α)} (h : l₁ <+: l₂) :
instance List.instIsPartialOrderListIsPrefix {α : Type u_1} :
IsPartialOrder (List α) fun (x x_1 : List α) => x <+: x_1
Equations
  • =
instance List.instIsPartialOrderListIsSuffix {α : Type u_1} :
IsPartialOrder (List α) fun (x x_1 : List α) => x <:+ x_1
Equations
  • =
instance List.instIsPartialOrderListIsInfix {α : Type u_1} :
IsPartialOrder (List α) fun (x x_1 : List α) => x <:+: x_1
Equations
  • =
@[simp]
theorem List.mem_inits {α : Type u_1} (s : List α) (t : List α) :
@[simp]
theorem List.mem_tails {α : Type u_1} (s : List α) (t : List α) :
theorem List.inits_cons {α : Type u_1} (a : α) (l : List α) :
List.inits (a :: l) = [] :: List.map (fun (t : List α) => a :: t) (List.inits l)
theorem List.tails_cons {α : Type u_1} (a : α) (l : List α) :
List.tails (a :: l) = (a :: l) :: List.tails l
@[simp]
theorem List.inits_append {α : Type u_1} (s : List α) (t : List α) :
List.inits (s ++ t) = List.inits s ++ List.map (fun (l : List α) => s ++ l) (List.tail (List.inits t))
@[simp]
theorem List.tails_append {α : Type u_1} (s : List α) (t : List α) :
List.tails (s ++ t) = List.map (fun (l : List α) => l ++ t) (List.tails s) ++ List.tail (List.tails t)
theorem List.inits_eq_tails {α : Type u_1} (l : List α) :
theorem List.tails_eq_inits {α : Type u_1} (l : List α) :
theorem List.inits_reverse {α : Type u_1} (l : List α) :
theorem List.tails_reverse {α : Type u_1} (l : List α) :
theorem List.map_reverse_inits {α : Type u_1} (l : List α) :
theorem List.map_reverse_tails {α : Type u_1} (l : List α) :
@[simp]
theorem List.length_tails {α : Type u_1} (l : List α) :
@[simp]
theorem List.length_inits {α : Type u_1} (l : List α) :
@[simp]
theorem List.get_tails {α : Type u_1} (l : List α) (n : Fin (List.length (List.tails l))) :
@[simp]
theorem List.get_inits {α : Type u_1} (l : List α) (n : Fin (List.length (List.inits l))) :
@[simp, deprecated List.get_tails]
theorem List.nth_le_tails {α : Type u_1} (l : List α) (n : ) (hn : n < List.length (List.tails l)) :
@[simp, deprecated List.get_inits]
theorem List.nth_le_inits {α : Type u_1} (l : List α) (n : ) (hn : n < List.length (List.inits l)) :

insert #

@[simp]
theorem List.insert_nil {α : Type u_1} [DecidableEq α] (a : α) :
insert a [] = [a]
theorem List.insert_eq_ite {α : Type u_1} [DecidableEq α] (a : α) (l : List α) :
insert a l = if a l then l else a :: l
@[simp]
theorem List.suffix_insert {α : Type u_1} [DecidableEq α] (a : α) (l : List α) :
theorem List.infix_insert {α : Type u_1} [DecidableEq α] (a : α) (l : List α) :
theorem List.sublist_insert {α : Type u_1} [DecidableEq α] (a : α) (l : List α) :
theorem List.subset_insert {α : Type u_1} [DecidableEq α] (a : α) (l : List α) :
theorem List.mem_of_mem_suffix {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} (hx : a l₁) (hl : l₁ <:+ l₂) :
a l₂
theorem List.IsPrefix.ne_nil {α : Type u_1} {x : List α} {y : List α} (h : x <+: y) (hx : x []) :
y []
theorem List.IsPrefix.get_eq {α : Type u_1} {x : List α} {y : List α} (h : x <+: y) {n : } (hn : n < List.length x) :
List.get x { val := n, isLt := hn } = List.get y { val := n, isLt := }
theorem List.IsPrefix.head_eq {α : Type u_1} {x : List α} {y : List α} (h : x <+: y) (hx : x []) :
List.head x hx = List.head y