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.inserton lists
All those (except insert) are defined in Mathlib/Data/List/Defs.lean.
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 #
Equations
- [].decidableInfix x✝ = isTrue ⋯
- (a :: l₁).decidableInfix [] = isFalse ⋯
- x✝.decidableInfix (b :: l₂) = decidable_of_decidable_of_iff ⋯
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
insert #
@[simp]
theorem
List.sublist_insert
{α : Type u_1}
[DecidableEq α]
(a : α)
(l : List α)
:
l.Sublist (List.insert a l)