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
@[specialize]
Equations
- List.filterAux p [] _fun_discr = List.reverse _fun_discr
- List.filterAux p (a :: l) _fun_discr = match p a with | true => List.filterAux p l (a :: _fun_discr) | false => List.filterAux p l _fun_discr
@[inline]
Equations
- List.filter p as = List.filterAux 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
- List.eraseRepsAux _fun_discr [] _fun_discr = List.reverse (_fun_discr :: _fun_discr)
- List.eraseRepsAux _fun_discr (a' :: as) _fun_discr = match _fun_discr == a' with | true => List.eraseRepsAux _fun_discr as _fun_discr | false => List.eraseRepsAux a' as (_fun_discr :: _fun_discr)
Equations
- List.eraseReps _fun_discr = match _fun_discr with | [] => [] | a :: as => List.eraseRepsAux a as []
Erase repeated adjacent elements.
@[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
- List.groupByAux eq (a :: as) ((ag :: g) :: gs) = match eq a ag with | true => List.groupByAux eq as ((a :: ag :: g) :: gs) | false => List.groupByAux eq as ([a] :: List.reverse (ag :: g) :: gs)
- 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) = (a :: (List.unzip t).1, b :: (List.unzip t).2)
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 α)
:
Equations
- List.hasDecidableLt [] [] = isFalse (_ : [] < [] → False)
- List.hasDecidableLt [] (head :: tail) = isTrue (_ : List.lt [] (head :: tail))
- List.hasDecidableLt (head :: tail) [] = isFalse (_ : head :: tail < [] → False)
- List.hasDecidableLt (a :: as) (b :: bs) = match h a b with | isTrue h₁ => isTrue (_ : List.lt (a :: as) (b :: bs)) | isFalse h₁ => match h b a with | isTrue h₂ => isFalse (_ : a :: as < b :: bs → False) | isFalse h₂ => match List.hasDecidableLt as bs with | isTrue h₃ => isTrue (_ : List.lt (a :: as) (b :: bs)) | isFalse h₃ => isFalse (_ : a :: as < b :: bs → False)
instance
List.instForAllListDecidableLeInstLEList
{α : Type u}
[inst : LT α]
[inst : DecidableRel fun a a_1 => a < a_1]
(l₁ : List α)
(l₂ : List α)
:
Equations
Equations
- List.isPrefixOf [] _fun_discr = true
- List.isPrefixOf _fun_discr [] = false
- List.isPrefixOf (a :: as) (b :: bs) = (a == b && List.isPrefixOf as bs)
isPrefixOfl₁l₂
returns true
Iff l₁
is a prefix of l₂
.
Equations
- List.isSuffixOf l₁ l₂ = List.isPrefixOf (List.reverse l₁) (List.reverse l₂)
isSuffixOfl₁l₂
returns true
Iff l₁
is a suffix of 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)
noncomputable instance
List.instLawfulBEqListInstBEqList
{α : Type u}
[inst : BEq α]
[inst : LawfulBEq α]
:
theorem
List.of_concat_eq_concat
{α : Type u}
{as : List α}
{bs : List α}
{a : α}
{b : α}
(h : List.concat as a = List.concat bs b)
: