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 #
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
@[deprecated List.IsPrefix.filterMap]
theorem
List.IsPrefix.filter_map
{α : Type u_1}
{β : Type u_2}
(f : α → Option β)
⦃l₁ : List α⦄
⦃l₂ : List α⦄
(h : l₁ <+: l₂)
:
List.filterMap f l₁ <+: List.filterMap f l₂
Alias of List.IsPrefix.filterMap
.
instance
List.instIsPartialOrderIsPrefix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <+: x2
Equations
- ⋯ = ⋯
instance
List.instIsPartialOrderIsSuffix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <:+ x2
Equations
- ⋯ = ⋯
instance
List.instIsPartialOrderIsInfix
{α : Type u_1}
:
IsPartialOrder (List α) fun (x1 x2 : List α) => x1 <:+: x2
Equations
- ⋯ = ⋯
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.IsPrefix.head]
theorem
List.IsPrefix.head_eq
{α : Type u_1}
{x : List α}
{y : List α}
(h : x <+: y)
(hx : x ≠ [])
:
x.head hx = y.head ⋯
Alias of List.IsPrefix.head
.