Prefixes, suffixes, infixes #
This file proves properties about
List.isPrefix
:l₁
is a prefix ofl₂
ifl₂
starts withl₁
.List.isSuffix
:l₁
is a suffix ofl₂
ifl₂
ends withl₁
.List.isInfix
:l₁
is an infix ofl₂
ifl₁
is a prefix of some suffix ofl₂
.List.inits
: The list of prefixes of a list.List.tails
: The list of prefixes of a list.insert
on lists
All those (except insert
) are defined in Mathlib.Data.List.Defs
.
Notation #
l₁ <+: l₂
:l₁
is a prefix ofl₂
.l₁ <:+ l₂
:l₁
is a suffix ofl₂
.l₁ <:+: l₂
:l₁
is an infix ofl₂
.
prefix, suffix, infix #
@[deprecated List.IsSuffix.reverse (since := "2024-08-12")]
Alias of List.IsSuffix.reverse
.
@[deprecated List.IsPrefix.reverse (since := "2024-08-12")]
Alias of List.IsPrefix.reverse
.
@[deprecated List.IsInfix.reverse (since := "2024-08-12")]
Alias of List.IsInfix.reverse
.
theorem
List.dropSlice_sublist
{α : Type u_1}
(n m : ℕ)
(l : List α)
:
(List.dropSlice n m l).Sublist l
theorem
List.mem_of_mem_dropSlice
{α : Type u_1}
{n m : ℕ}
{l : List α}
{a : α}
(h : a ∈ List.dropSlice n m l)
:
a ∈ l
instance
List.instIsPartialOrderIsPrefix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <+: x2
instance
List.instIsPartialOrderIsSuffix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <:+ x2
instance
List.instIsPartialOrderIsInfix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <:+: x2
theorem
List.inits_eq_tails
{α : Type u_1}
(l : List α)
:
l.inits = (List.map List.reverse l.reverse.tails).reverse
theorem
List.tails_eq_inits
{α : Type u_1}
(l : List α)
:
l.tails = (List.map List.reverse l.reverse.inits).reverse
theorem
List.inits_reverse
{α : Type u_1}
(l : List α)
:
l.reverse.inits = (List.map List.reverse l.tails).reverse
theorem
List.tails_reverse
{α : Type u_1}
(l : List α)
:
l.reverse.tails = (List.map List.reverse l.inits).reverse
theorem
List.map_reverse_inits
{α : Type u_1}
(l : List α)
:
List.map List.reverse l.inits = l.reverse.tails.reverse
theorem
List.map_reverse_tails
{α : Type u_1}
(l : List α)
:
List.map List.reverse l.tails = l.reverse.inits.reverse
insert #
@[simp]
theorem
List.suffix_insert
{α : Type u_1}
[DecidableEq α]
(a : α)
(l : List α)
:
l <:+ List.insert a l
theorem
List.infix_insert
{α : Type u_1}
[DecidableEq α]
(a : α)
(l : List α)
:
l <:+: List.insert a l
theorem
List.sublist_insert
{α : Type u_1}
[DecidableEq α]
(a : α)
(l : List α)
:
l.Sublist (List.insert a l)
@[deprecated List.IsSuffix.mem (since := "2024-08-15")]
theorem
List.mem_of_mem_suffix
{α✝ : Type u_1}
{l₁ : List α✝}
{a : α✝}
{l₂ : List α✝}
(hx : a ∈ l₁)
(hl : l₁ <:+ l₂)
:
a ∈ l₂
Alias of List.IsSuffix.mem
.
@[deprecated List.IsPrefix.head (since := "2024-08-15")]
theorem
List.IsPrefix.head_eq
{α : Type u_1}
{x y : List α}
(h : x <+: y)
(hx : x ≠ [])
:
x.head hx = y.head ⋯
Alias of List.IsPrefix.head
.