Documentation

Mathlib.Data.List.Infix

Prefixes, subfixes, infixes #

This file proves properties about

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

Notation #

l₁ <+: l₂: l₁ is a prefix of l₂. l₁ <:+ l₂: l₁ is a subfix of l₂. l₁ <:+: l₂: l₁ is an infix of l₂.

prefix, suffix, infix #

@[simp]
theorem List.prefix_append {α : Type u_1} (l₁ : List α) (l₂ : List α) :
l₁ <+: l₁ ++ l₂
@[simp]
theorem List.suffix_append {α : Type u_1} (l₁ : List α) (l₂ : List α) :
l₂ <:+ l₁ ++ l₂
theorem List.infix_append {α : Type u_1} (l₁ : List α) (l₂ : List α) (l₃ : List α) :
l₂ <:+: l₁ ++ l₂ ++ l₃
@[simp]
theorem List.infix_append' {α : Type u_1} (l₁ : List α) (l₂ : List α) (l₃ : List α) :
l₂ <:+: l₁ ++ (l₂ ++ l₃)
theorem List.isPrefix.isInfix {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <+: l₂l₁ <:+: l₂
theorem List.isSuffix.isInfix {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <:+ l₂l₁ <:+: l₂
theorem List.nil_prefix {α : Type u_1} (l : List α) :
[] <+: l
theorem List.nil_suffix {α : Type u_1} (l : List α) :
[] <:+ l
theorem List.nil_infix {α : Type u_1} (l : List α) :
[] <:+: l
theorem List.prefix_refl {α : Type u_1} (l : List α) :
l <+: l
theorem List.suffix_refl {α : Type u_1} (l : List α) :
l <:+ l
theorem List.infix_refl {α : Type u_1} (l : List α) :
l <:+: l
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
@[simp]
theorem List.suffix_cons {α : Type u_1} (a : α) (l : List α) :
l <:+ a :: l
theorem List.prefix_concat {α : Type u_1} (a : α) (l : List α) :
theorem List.infix_cons {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} :
l₁ <:+: l₂l₁ <:+: a :: l₂
theorem List.infix_concat {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} :
l₁ <:+: l₂l₁ <:+: List.concat l₂ a
theorem List.isPrefix.trans {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} :
l₁ <+: l₂l₂ <+: l₃l₁ <+: l₃
theorem List.isSuffix.trans {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} :
l₁ <:+ l₂l₂ <:+ l₃l₁ <:+ l₃
theorem List.isInfix.trans {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} :
l₁ <:+: l₂l₂ <:+: l₃l₁ <:+: l₃
theorem List.isInfix.sublist {α : Type u_1} {l₁ : List α} {l₂ : List α} :
l₁ <:+: l₂List.Sublist l₁ l₂
theorem List.isInfix.subset {α : Type u_1} {l₁ : List α} {l₂ : List α} (hl : l₁ <:+: l₂) :
l₁ l₂
theorem List.isPrefix.sublist {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) :
List.Sublist l₁ l₂
theorem List.isPrefix.subset {α : Type u_1} {l₁ : List α} {l₂ : List α} (hl : l₁ <+: l₂) :
l₁ l₂
theorem List.isSuffix.sublist {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <:+ l₂) :
List.Sublist l₁ l₂
theorem List.isSuffix.subset {α : Type u_1} {l₁ : List α} {l₂ : List α} (hl : l₁ <:+ l₂) :
l₁ l₂
@[simp]
theorem List.reverse_suffix {α : Type u_1} {l₁ : List α} {l₂ : List α} :
List.reverse l₁ <:+ List.reverse l₂ l₁ <+: l₂
@[simp]
theorem List.reverse_prefix {α : Type u_1} {l₁ : List α} {l₂ : List α} :
List.reverse l₁ <+: List.reverse l₂ l₁ <:+ l₂
@[simp]
theorem List.reverse_infix {α : Type u_1} {l₁ : List α} {l₂ : List α} :
List.reverse l₁ <:+: List.reverse l₂ l₁ <:+: l₂
theorem List.isSuffix.reverse {α : Type u_1} {l₁ : List α} {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₁ : List α} {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₁ : List α} {l₂ : List α} :
l₁ <:+: l₂List.reverse l₁ <:+: List.reverse l₂

Alias of the reverse direction of List.reverse_infix.

theorem List.isInfix.length_le {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <:+: l₂) :
theorem List.isPrefix.length_le {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) :
theorem List.isSuffix.length_le {α : Type u_1} {l₁ : List α} {l₂ : List α} (h : l₁ <:+ l₂) :
theorem List.eq_nil_of_infix_nil {α : Type u_1} {l : List α} (h : l <:+: []) :
l = []
@[simp]
theorem List.infix_nil_iff {α : Type u_1} {l : List α} :
l <:+: [] l = []
@[simp]
theorem List.prefix_nil_iff {α : Type u_1} {l : List α} :
l <+: [] l = []
@[simp]
theorem List.suffix_nil_iff {α : Type u_1} {l : List α} :
l <:+ [] l = []
theorem List.eq_nil_of_prefix_nil {α : Type u_1} {l : List α} :
l <+: []l = []

Alias of the forward direction of List.prefix_nil_iff.

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

Alias of the forward direction of List.suffix_nil_iff.

theorem List.infix_iff_prefix_suffix {α : Type u_1} (l₁ : List α) (l₂ : List α) :
l₁ <:+: l₂ t, l₁ <+: t t <:+ l₂
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.prefix_of_prefix_length_le {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} :
l₁ <+: l₃l₂ <+: l₃List.length l₁ List.length l₂l₁ <+: l₂
theorem List.prefix_or_prefix_of_prefix {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) :
l₁ <+: l₂ l₂ <+: l₁
theorem List.suffix_of_suffix_length_le {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : List.length l₁ List.length l₂) :
l₁ <:+ l₂
theorem List.suffix_or_suffix_of_suffix {α : Type u_1} {l₁ : List α} {l₂ : List α} {l₃ : List α} (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) :
l₁ <:+ l₂ l₂ <:+ l₁
theorem List.suffix_cons_iff {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} :
l₁ <:+ a :: l₂ l₁ = a :: l₂ l₁ <:+ l₂
theorem List.infix_cons_iff {α : Type u_1} {l₁ : List α} {l₂ : List α} {a : α} :
l₁ <:+: a :: l₂ l₁ <+: a :: l₂ l₁ <:+: l₂
theorem List.infix_of_mem_join {α : Type u_1} {l : List α} {L : List (List α)} :
l Ll <:+: List.join L
theorem List.prefix_append_right_inj {α : Type u_1} {l₁ : List α} {l₂ : List α} (l : List α) :
l ++ l₁ <+: l ++ l₂ l₁ <+: l₂
theorem List.prefix_cons_inj {α : Type u_1} {l₁ : List α} {l₂ : List α} (a : α) :
a :: l₁ <+: a :: l₂ l₁ <+: l₂
theorem List.take_prefix {α : Type u_1} (n : ) (l : List α) :
theorem List.drop_suffix {α : Type u_1} (n : ) (l : List α) :
theorem List.take_sublist {α : Type u_1} (n : ) (l : List α) :
theorem List.drop_sublist {α : Type u_1} (n : ) (l : List α) :
theorem List.take_subset {α : Type u_1} (n : ) (l : List α) :
theorem List.drop_subset {α : Type u_1} (n : ) (l : List α) :
theorem List.mem_of_mem_take {α : Type u_1} {l : List α} {a : α} {n : } (h : a List.take n l) :
a 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.tail_sublist {α : Type u_1} (l : List α) :
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.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.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} [inst : DecidableEq α] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ <+: l₂)
Equations
instance List.decidableSuffix {α : Type u_1} [inst : DecidableEq α] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ <:+ l₂)
Equations
instance List.decidableInfix {α : Type u_1} [inst : 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.filter_map {α : Type u_1} {β : Type u_2} {l₁ : List α} {l₂ : List α} (h : l₁ <+: l₂) (f : αOption β) :
theorem List.isPrefix.reduceOption {α : Type u_1} {l₁ : List (Option α)} {l₂ : List (Option α)} (h : l₁ <+: l₂) :
theorem List.isPrefix.filter {α : Type u_1} (p : αBool) ⦃l₁ : List α ⦃l₂ : List α (h : l₁ <+: l₂) :
theorem List.isSuffix.filter {α : Type u_1} (p : αBool) ⦃l₁ : List α ⦃l₂ : List α (h : l₁ <:+ l₂) :
theorem List.isInfix.filter {α : Type u_1} (p : αBool) ⦃l₁ : List α ⦃l₂ : List α (h : l₁ <:+: l₂) :
@[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 => 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 => 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 => 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 α) :
@[simp]
theorem List.length_tails {α : Type u_1} (l : List α) :
@[simp]
theorem List.length_inits {α : Type u_1} (l : List α) :
@[simp]
theorem List.nth_le_tails {α : Type u_1} (l : List α) (n : ) (hn : n < List.length (List.tails l)) :
@[simp]
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} [inst : DecidableEq α] (a : α) :
insert a [] = [a]
theorem List.insert.def {α : Type u_1} [inst : DecidableEq α] (a : α) (l : List α) :
insert a l = if a l then l else a :: l
@[simp]
theorem List.suffix_insert {α : Type u_1} [inst : DecidableEq α] (a : α) (l : List α) :
theorem List.infix_insert {α : Type u_1} [inst : DecidableEq α] (a : α) (l : List α) :
theorem List.sublist_insert {α : Type u_1} [inst : DecidableEq α] (a : α) (l : List α) :
theorem List.subset_insert {α : Type u_1} [inst : 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₂