theorem
List.length_add_eq_lengthTRAux
{α : Type u}
(as : List α)
(n : Nat)
:
List.length as + n = List.lengthTRAux as n
Equations
- List.reverseAux [] _fun_discr = _fun_discr
- List.reverseAux (a :: l) _fun_discr = List.reverseAux l (a :: _fun_discr)
Equations
- List.reverse as = List.reverseAux as []
theorem
List.reverseAux_reverseAux_nil
{α : Type u}
(as : List α)
(bs : List α)
:
List.reverseAux (List.reverseAux as bs) [] = List.reverseAux bs as
theorem
List.reverseAux_reverseAux
{α : Type u}
(as : List α)
(bs : List α)
(cs : List α)
:
List.reverseAux (List.reverseAux as bs) cs = List.reverseAux bs (List.reverseAux (List.reverseAux as []) cs)
@[simp]
Equations
- List.append [] _fun_discr = _fun_discr
- List.append (a :: l) _fun_discr = a :: List.append l _fun_discr
Equations
- List.appendTR as bs = List.reverseAux (List.reverse as) bs
Equations
- List.instAppendList = { append := List.append }
@[simp]
Equations
- List.instEmptyCollectionList = { emptyCollection := [] }
Equations
- List.erase [] _fun_discr = []
- List.erase (a :: as) _fun_discr = match a == _fun_discr with | true => as | false => a :: List.erase as _fun_discr
Equations
- List.eraseIdx [] _fun_discr = []
- List.eraseIdx (head :: as) 0 = as
- List.eraseIdx (a :: as) (Nat.succ n) = a :: List.eraseIdx as n
Equations
- List.isEmpty _fun_discr = match _fun_discr with | [] => true | head :: tail => false
@[specialize]
Equations
- List.mapTRAux f [] _fun_discr = List.reverse _fun_discr
- List.mapTRAux f (a :: as) _fun_discr = List.mapTRAux f as (f a :: _fun_discr)
@[inline]
Equations
- List.mapTR f as = List.mapTRAux f as []
theorem
List.reverseAux_eq_append
{α : Type u}
(as : List α)
(bs : List α)
:
List.reverseAux as bs = List.reverseAux as [] ++ bs
@[simp]
theorem
List.reverse_cons
{α : Type u}
(a : α)
(as : List α)
:
List.reverse (a :: as) = List.reverse as ++ [a]
@[simp]
theorem
List.reverse_append
{α : Type u}
(as : List α)
(bs : List α)
:
List.reverse (as ++ bs) = List.reverse bs ++ List.reverse as
theorem
List.mapTRAux_eq
{α : Type u}
{β : Type v}
(f : α → β)
(as : List α)
(bs : List β)
:
List.mapTRAux f as bs = List.reverse bs ++ List.map f as
@[specialize]
Equations
- List.filterMap f [] = []
- List.filterMap f (head :: tail) = match f head with | none => List.filterMap f tail | some b => b :: List.filterMap f tail
Equations
- List.filter p [] = []
- List.filter p (head :: tail) = match p head with | true => head :: List.filter p tail | false => List.filter p tail
@[specialize]
Equations
- List.filterTRAux p [] _fun_discr = List.reverse _fun_discr
- List.filterTRAux p (a :: l) _fun_discr = match p a with | true => List.filterTRAux p l (a :: _fun_discr) | false => List.filterTRAux p l _fun_discr
@[inline]
Equations
- List.filterTR p as = List.filterTRAux p as []
theorem
List.filterTRAux_eq
{α : Type u}
(p : α → Bool)
(as : List α)
(bs : List α)
:
List.filterTRAux p as bs = List.reverse bs ++ List.filter p as
@[specialize]
Equations
- List.partitionAux p [] (bs, cs) = (List.reverse bs, List.reverse cs)
- List.partitionAux p (a :: as) (bs, cs) = match p a with | true => List.partitionAux p as (a :: bs, cs) | false => List.partitionAux p as (bs, a :: cs)
@[inline]
Equations
- List.partition p as = List.partitionAux p as ([], [])
Equations
- List.dropWhile p [] = []
- List.dropWhile p (head :: tail) = match p head with | true => List.dropWhile p tail | false => head :: tail
Equations
- List.find? p [] = none
- List.find? p (head :: tail) = match p head with | true => some head | false => List.find? p tail
Equations
- List.findSome? f [] = none
- List.findSome? f (head :: tail) = match f head with | some b => some b | none => List.findSome? f tail
Equations
- List.replace [] _fun_discr _fun_discr = []
- List.replace (a :: as) _fun_discr _fun_discr = match a == _fun_discr with | true => _fun_discr :: as | false => a :: List.replace as _fun_discr _fun_discr
Equations
- List.notElem a as = !List.elem a as
@[inline]
Equations
- List.contains as a = List.elem a as
Equations
- List.instMembershipList = { mem := List.Mem }
theorem
List.elem_eq_true_of_mem
{α : Type u}
[inst : DecidableEq α]
{a : α}
{as : List α}
(h : a ∈ as)
:
instance
List.instDecidableMemListInstMembershipList
{α : Type u}
[inst : DecidableEq α]
(a : α)
(as : List α)
:
Equations
- List.instDecidableMemListInstMembershipList a as = decidable_of_decidable_of_iff (_ : List.elem a as = true ↔ a ∈ as)
Equations
- List.eraseDupsAux [] _fun_discr = List.reverse _fun_discr
- List.eraseDupsAux (a :: l) _fun_discr = match List.elem a _fun_discr with | true => List.eraseDupsAux l _fun_discr | false => List.eraseDupsAux l (a :: _fun_discr)
Equations
- List.eraseDups as = List.eraseDupsAux as []
Equations
- One or more equations did not get rendered due to their size.
- List.eraseRepsAux _fun_discr [] _fun_discr = List.reverse (_fun_discr :: _fun_discr)
Erase repeated adjacent elements.
Equations
- List.eraseReps _fun_discr = match _fun_discr with | [] => [] | a :: as => List.eraseRepsAux a as []
@[specialize]
Equations
- List.spanAux p [] _fun_discr = (List.reverse _fun_discr, [])
- List.spanAux p (a :: l) _fun_discr = match p a with | true => List.spanAux p l (a :: _fun_discr) | false => (List.reverse _fun_discr, a :: l)
@[specialize]
Equations
- One or more equations did not get rendered due to their size.
- List.groupByAux eq _fun_discr _fun_discr = List.reverse _fun_discr
@[specialize]
Equations
- List.groupBy p _fun_discr = match _fun_discr with | [] => [] | a :: as => List.groupByAux p as [[a]]
Equations
- List.lookup _fun_discr [] = none
- List.lookup _fun_discr ((k, b) :: es) = match _fun_discr == k with | true => some b | false => List.lookup _fun_discr es
Equations
- List.removeAll xs ys = List.filter (fun x => List.notElem x ys) xs
Equations
- List.takeWhile p [] = []
- List.takeWhile p (head :: tail) = match p head with | true => head :: List.takeWhile p tail | false => []
@[specialize]
Equations
- List.foldr f init [] = init
- List.foldr f init (head :: tail) = f head (List.foldr f init tail)
Equations
- List.zipWith f (x :: xs) (y :: ys) = f x y :: List.zipWith f xs ys
- List.zipWith f _fun_discr _fun_discr = []
Equations
- List.unzip [] = ([], [])
- List.unzip ((a, b) :: t) = match List.unzip t with | (al, bl) => (a :: al, b :: bl)
Equations
- List.rangeAux 0 _fun_discr = _fun_discr
- List.rangeAux (Nat.succ n) _fun_discr = List.rangeAux n (n :: _fun_discr)
Equations
- List.iotaTR.go 0 _fun_discr = List.reverse _fun_discr
- List.iotaTR.go (Nat.succ n) _fun_discr = List.iotaTR.go n (Nat.succ n :: _fun_discr)
Equations
- List.enumFrom _fun_discr [] = []
- List.enumFrom _fun_discr (x :: xs) = (_fun_discr, x) :: List.enumFrom (_fun_discr + 1) xs
Equations
- List.intersperse sep [] = []
- List.intersperse sep [head] = [head]
- List.intersperse sep (a :: l) = a :: sep :: List.intersperse sep l
Equations
- List.intercalate sep xs = List.join (List.intersperse sep xs)
- nil: ∀ {α : Type u} [inst : LT α] (b : α) (bs : List α), List.lt [] (b :: bs)
- head: ∀ {α : Type u} [inst : LT α] {a : α} (as : List α) {b : α} (bs : List α), a < b → List.lt (a :: as) (b :: bs)
- tail: ∀ {α : Type u} [inst : LT α] {a : α} {as : List α} {b : α} {bs : List α}, ¬a < b → ¬b < a → List.lt as bs → List.lt (a :: as) (b :: bs)
instance
List.hasDecidableLt
{α : Type u}
[inst : LT α]
[h : DecidableRel fun a a_1 => a < a_1]
(l₁ : List α)
(l₂ : List α)
:
instance
List.instForAllListDecidableLeInstLEList
{α : Type u}
[inst : LT α]
[inst : DecidableRel fun a a_1 => a < a_1]
(l₁ : List α)
(l₂ : List α)
:
Equations
isPrefixOf l₁ l₂
returns true
Iff l₁
is a prefix of l₂
.
That is, there exists a t
such that l₂ == l₁ ++ t
.
Equations
- List.isPrefixOf [] _fun_discr = true
- List.isPrefixOf _fun_discr [] = false
- List.isPrefixOf (a :: as) (b :: bs) = (a == b && List.isPrefixOf as bs)
isSuffixOf l₁ l₂
returns true
Iff l₁
is a suffix of l₂
.
That is, there exists a t
such that l₂ == t ++ l₁
.
Equations
- List.isSuffixOf l₁ l₂ = List.isPrefixOf (List.reverse l₁) (List.reverse l₂)
@[specialize]
Equations
- List.isEqv [] [] _fun_discr = true
- List.isEqv (a :: as) (b :: bs) _fun_discr = (_fun_discr a b && List.isEqv as bs _fun_discr)
- List.isEqv _fun_discr _fun_discr _fun_discr = false
Equations
- List.replicate 0 _fun_discr = []
- List.replicate (Nat.succ n) _fun_discr = _fun_discr :: List.replicate n _fun_discr
Equations
- List.replicateTR n a = List.replicateTR.loop a n []
Equations
- List.replicateTR.loop a 0 _fun_discr = _fun_discr
- List.replicateTR.loop a (Nat.succ n) _fun_discr = List.replicateTR.loop a n (a :: _fun_discr)
theorem
List.replicateTR_loop_replicate_eq
{α : Type u}
(a : α)
(m : Nat)
(n : Nat)
:
List.replicateTR.loop a n (List.replicate m a) = List.replicate (n + m) a
Equations
- List.dropLast [] = []
- List.dropLast [head] = []
- List.dropLast (a :: l) = a :: List.dropLast l
@[simp]
@[simp]
theorem
List.length_concat
{α : Type u}
(as : List α)
(a : α)
:
List.length (List.concat as a) = List.length as + 1
@[simp]
theorem
List.length_set
{α : Type u}
(as : List α)
(i : Nat)
(a : α)
:
List.length (List.set as i a) = List.length as
@[simp]
theorem
List.length_dropLast_cons
{α : Type u}
(a : α)
(as : List α)
:
List.length (List.dropLast (a :: as)) = List.length as
@[simp]
theorem
List.length_append
{α : Type u}
(as : List α)
(bs : List α)
:
List.length (as ++ bs) = List.length as + List.length bs
@[simp]
theorem
List.length_map
{α : Type u}
{β : Type v}
(as : List α)
(f : α → β)
:
List.length (List.map f as) = List.length as
@[simp]
theorem
List.length_reverse
{α : Type u}
(as : List α)
:
List.length (List.reverse as) = List.length as
Equations
- List.maximum? _fun_discr = match _fun_discr with | [] => none | a :: as => some (List.foldl max a as)
Equations
- List.minimum? _fun_discr = match _fun_discr with | [] => none | a :: as => some (List.foldl min a as)
theorem
List.of_concat_eq_concat
{α : Type u}
{as : List α}
{bs : List α}
{a : α}
{b : α}
(h : List.concat as a = List.concat bs b)
: