Documentation

Init.Data.List.Basic

theorem List.length_add_eq_lengthTRAux {α : Type u} (as : List α) (n : Nat) :
@[simp]
theorem List.length_nil {α : Type u} :
def List.reverseAux {α : Type u} :
List αList αList α
Equations
def List.reverse {α : Type u} (as : List α) :
List α
Equations
theorem List.reverseAux_reverseAux_nil {α : Type u} (as : List α) (bs : List α) :
theorem List.reverseAux_reverseAux {α : Type u} (as : List α) (bs : List α) (cs : List α) :
@[simp]
theorem List.reverse_reverse {α : Type u} (as : List α) :
def List.append {α : Type u} :
List αList αList α
Equations
def List.appendTR {α : Type u} (as : List α) (bs : List α) :
List α
Equations
instance List.instAppendList {α : Type u} :
Equations
  • List.instAppendList = { append := List.append }
@[simp]
theorem List.nil_append {α : Type u} (as : List α) :
[] ++ as = as
@[simp]
theorem List.append_nil {α : Type u} (as : List α) :
as ++ [] = as
@[simp]
theorem List.cons_append {α : Type u} (a : α) (as : List α) (bs : List α) :
a :: as ++ bs = a :: (as ++ bs)
@[simp]
theorem List.List.append_eq {α : Type u} (as : List α) (bs : List α) :
List.append as bs = as ++ bs
theorem List.append_assoc {α : Type u} (as : List α) (bs : List α) (cs : List α) :
as ++ bs ++ cs = as ++ (bs ++ cs)
theorem List.append_cons {α : Type u} (as : List α) (b : α) (bs : List α) :
as ++ b :: bs = as ++ [b] ++ bs
Equations
  • List.instEmptyCollectionList = { emptyCollection := [] }
def List.erase {α : Type u_1} [inst : BEq α] :
List ααList α
Equations
def List.eraseIdx {α : Type u} :
List αNatList α
Equations
def List.isEmpty {α : Type u} :
List αBool
Equations
@[specialize]
def List.map {α : Type u} {β : Type v} (f : αβ) :
List αList β
Equations
@[specialize]
def List.mapTRAux {α : Type u} {β : Type v} (f : αβ) :
List αList βList β
Equations
@[inline]
def List.mapTR {α : Type u} {β : Type v} (f : αβ) (as : List α) :
List β
Equations
theorem List.reverseAux_eq_append {α : Type u} (as : List α) (bs : List α) :
@[simp]
theorem List.reverse_nil {α : Type u} :
@[simp]
theorem List.reverse_cons {α : Type u} (a : α) (as : List α) :
@[simp]
theorem List.reverse_append {α : Type u} (as : List α) (bs : List α) :
theorem List.mapTRAux_eq {α : Type u} {β : Type v} (f : αβ) (as : List α) (bs : List β) :
@[specialize]
def List.map₂ {α : Type u} {β : Type v} {γ : Type w} (f : αβγ) :
List αList βList γ
Equations
def List.join {α : Type u} :
List (List α)List α
Equations
@[specialize]
def List.filterMap {α : Type u} {β : Type v} (f : αOption β) :
List αList β
Equations
def List.filter {α : Type u} (p : αBool) :
List αList α
Equations
@[specialize]
def List.filterTRAux {α : Type u} (p : αBool) :
List αList αList α
Equations
@[inline]
def List.filterTR {α : Type u} (p : αBool) (as : List α) :
List α
Equations
theorem List.filterTRAux_eq {α : Type u} (p : αBool) (as : List α) (bs : List α) :
@[specialize]
def List.partitionAux {α : Type u} (p : αBool) :
List αList α × List αList α × List α
Equations
@[inline]
def List.partition {α : Type u} (p : αBool) (as : List α) :
List α × List α
Equations
def List.dropWhile {α : Type u} (p : αBool) :
List αList α
Equations
def List.find? {α : Type u} (p : αBool) :
List αOption α
Equations
def List.findSome? {α : Type u} {β : Type v} (f : αOption β) :
List αOption β
Equations
def List.replace {α : Type u} [inst : BEq α] :
List αααList α
Equations
def List.elem {α : Type u} [inst : BEq α] (a : α) :
List αBool
Equations
def List.notElem {α : Type u} [inst : BEq α] (a : α) (as : List α) :
Equations
@[inline]
abbrev List.contains {α : Type u} [inst : BEq α] (as : List α) (a : α) :
Equations
inductive List.Mem {α : Type u} :
αList αProp
instance List.instMembershipList {α : Type u} :
Equations
  • List.instMembershipList = { mem := List.Mem }
theorem List.mem_of_elem_eq_true {α : Type u} [inst : DecidableEq α] {a : α} {as : List α} :
∀ (a : List.elem a as = true), a as
theorem List.elem_eq_true_of_mem {α : Type u} [inst : DecidableEq α] {a : α} {as : List α} (h : a as) :
theorem List.mem_append_of_mem_left {α : Type u} {a : α} {as : List α} (bs : List α) :
∀ (a : a as), a as ++ bs
theorem List.mem_append_of_mem_right {α : Type u} {b : α} {bs : List α} (as : List α) :
b bsb as ++ bs
def List.eraseDupsAux {α : Type u_1} [inst : BEq α] :
List αList αList α
Equations
def List.eraseDups {α : Type u_1} [inst : BEq α] (as : List α) :
List α
Equations
def List.eraseRepsAux {α : Type u_1} [inst : BEq α] :
αList αList αList α
Equations
def List.eraseReps {α : Type u_1} [inst : BEq α] :
List αList α

Erase repeated adjacent elements.

Equations
@[specialize]
def List.spanAux {α : Type u} (p : αBool) :
List αList αList α × List α
Equations
@[inline]
def List.span {α : Type u} (p : αBool) (as : List α) :
List α × List α
Equations
@[specialize]
def List.groupByAux {α : Type u} (eq : ααBool) :
List αList (List α)List (List α)
Equations
@[specialize]
def List.groupBy {α : Type u} (p : ααBool) :
List αList (List α)
Equations
def List.lookup {α : Type u} {β : Type v} [inst : BEq α] :
αList (α × β)Option β
Equations
def List.removeAll {α : Type u} [inst : BEq α] (xs : List α) (ys : List α) :
List α
Equations
def List.drop {α : Type u} :
NatList αList α
Equations
def List.take {α : Type u} :
NatList αList α
Equations
def List.takeWhile {α : Type u} (p : αBool) :
List αList α
Equations
@[specialize]
def List.foldr {α : Type u} {β : Type v} (f : αββ) (init : β) :
List αβ
Equations
@[inline]
def List.any {α : Type u} (l : List α) (p : αBool) :
Equations
@[inline]
def List.all {α : Type u} (l : List α) (p : αBool) :
Equations
def List.or (bs : List Bool) :
Equations
def List.and (bs : List Bool) :
Equations
def List.zipWith {α : Type u} {β : Type v} {γ : Type w} (f : αβγ) :
List αList βList γ
Equations
def List.zip {α : Type u} {β : Type v} :
List αList βList (α × β)
Equations
def List.unzip {α : Type u} {β : Type v} :
List (α × β)List α × List β
Equations
Equations
Equations
def List.enumFrom {α : Type u} :
NatList αList (Nat × α)
Equations
def List.enum {α : Type u} :
List αList (Nat × α)
Equations
def List.init {α : Type u} :
List αList α
Equations
def List.intersperse {α : Type u} (sep : α) :
List αList α
Equations
def List.intercalate {α : Type u} (sep : List α) (xs : List (List α)) :
List α
Equations
@[inline]
def List.bind {α : Type u} {β : Type v} (a : List α) (b : αList β) :
List β
Equations
@[inline]
def List.pure {α : Type u} (a : α) :
List α
Equations
inductive List.lt {α : Type u} [inst : LT α] :
List αList αProp
  • nil: ∀ {α : Type u} [inst : LT α] (b : α) (bs : List α), List.lt [] (b :: bs)
  • head: ∀ {α : Type u} [inst : LT α] {a : α} (as : List α) {b : α} (bs : List α), a < bList.lt (a :: as) (b :: bs)
  • tail: ∀ {α : Type u} [inst : LT α] {a : α} {as : List α} {b : α} {bs : List α}, ¬a < b¬b < aList.lt as bsList.lt (a :: as) (b :: bs)
instance List.instLTList {α : Type u} [inst : LT α] :
LT (List α)
Equations
  • List.instLTList = { lt := List.lt }
instance List.hasDecidableLt {α : Type u} [inst : LT α] [h : DecidableRel fun a a_1 => a < a_1] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ < l₂)
Equations
def List.le {α : Type u} [inst : LT α] (a : List α) (b : List α) :
Prop
Equations
instance List.instLEList {α : Type u} [inst : LT α] :
LE (List α)
Equations
  • List.instLEList = { le := List.le }
instance List.instForAllListDecidableLeInstLEList {α : Type u} [inst : LT α] [inst : DecidableRel fun a a_1 => a < a_1] (l₁ : List α) (l₂ : List α) :
Decidable (l₁ l₂)
Equations
def List.isPrefixOf {α : Type u} [inst : BEq α] :
List αList αBool

isPrefixOf l₁ l₂ returns true Iff l₁ is a prefix of l₂. That is, there exists a t such that l₂ == l₁ ++ t.

Equations
def List.isSuffixOf {α : Type u} [inst : BEq α] (l₁ : List α) (l₂ : List α) :

isSuffixOf l₁ l₂ returns true Iff l₁ is a suffix of l₂. That is, there exists a t such that l₂ == t ++ l₁.

Equations
@[specialize]
def List.isEqv {α : Type u} :
List αList α(ααBool) → Bool
Equations
def List.beq {α : Type u} [inst : BEq α] :
List αList αBool
Equations
instance List.instBEqList {α : Type u} [inst : BEq α] :
BEq (List α)
Equations
  • List.instBEqList = { beq := List.beq }
def List.replicate {α : Type u} (n : Nat) (a : α) :
List α
Equations
def List.replicateTR {α : Type u} (n : Nat) (a : α) :
List α
Equations
def List.replicateTR.loop {α : Type u} (a : α) :
NatList αList α
Equations
theorem List.replicateTR_loop_replicate_eq {α : Type u} (a : α) (m : Nat) (n : Nat) :
def List.dropLast {α : Type u_1} :
List αList α
Equations
@[simp]
theorem List.length_replicate {α : Type u} (n : Nat) (a : α) :
@[simp]
theorem List.length_concat {α : Type u} (as : List α) (a : α) :
@[simp]
theorem List.length_set {α : Type u} (as : List α) (i : Nat) (a : α) :
@[simp]
theorem List.length_dropLast_cons {α : Type u} (a : α) (as : List α) :
@[simp]
theorem List.length_append {α : Type u} (as : List α) (bs : List α) :
@[simp]
theorem List.length_map {α : Type u} {β : Type v} (as : List α) (f : αβ) :
@[simp]
theorem List.length_reverse {α : Type u} (as : List α) :
def List.maximum? {α : Type u} [inst : LT α] [inst : DecidableRel LT.lt] :
List αOption α
Equations
def List.minimum? {α : Type u} [inst : LE α] [inst : DecidableRel LE.le] :
List αOption α
Equations
theorem List.of_concat_eq_concat {α : Type u} {as : List α} {bs : List α} {a : α} {b : α} (h : List.concat as a = List.concat bs b) :
as = bs a = b