Bootstrapping theorems about arrays #
This file contains some theorems about Array
and List
needed for Init.Data.List.Impl
.
theorem
Array.foldlM_eq_foldlM_toList
{m : Type u_1 → Type u_2}
{β : Type u_1}
{α : Type u_3}
[Monad m]
(f : β → α → m β)
(init : β)
(arr : Array α)
:
Array.foldlM f init arr = List.foldlM f init arr.toList
theorem
Array.foldl_eq_foldl_toList
{β : Type u_1}
{α : Type u_2}
(f : β → α → β)
(init : β)
(arr : Array α)
:
Array.foldl f init arr = List.foldl f init arr.toList
theorem
Array.foldrM_eq_reverse_foldlM_toList.aux
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m β)
(arr : Array α)
(init : β)
(i : Nat)
(h : i ≤ arr.size)
:
List.foldlM (fun (x : β) (y : α) => f y x) init (List.take i arr.toList).reverse = Array.foldrM.fold f arr 0 i h init
theorem
Array.foldrM_eq_reverse_foldlM_toList
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m β)
(init : β)
(arr : Array α)
:
Array.foldrM f init arr = List.foldlM (fun (x : β) (y : α) => f y x) init arr.toList.reverse
theorem
Array.foldrM_eq_foldrM_toList
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m β)
(init : β)
(arr : Array α)
:
Array.foldrM f init arr = List.foldrM f init arr.toList
theorem
Array.foldr_eq_foldr_toList
{α : Type u_1}
{β : Type u_2}
(f : α → β → β)
(init : β)
(arr : Array α)
:
Array.foldr f init arr = List.foldr f init arr.toList
@[simp]
@[simp]
@[reducible, inline, deprecated Array.foldlM_eq_foldlM_toList]
abbrev
Array.foldlM_eq_foldlM_data
{m : Type u_1 → Type u_2}
{β : Type u_1}
{α : Type u_3}
[Monad m]
(f : β → α → m β)
(init : β)
(arr : Array α)
:
Array.foldlM f init arr = List.foldlM f init arr.toList
Instances For
@[reducible, inline, deprecated Array.foldl_eq_foldl_toList]
abbrev
Array.foldl_eq_foldl_data
{β : Type u_1}
{α : Type u_2}
(f : β → α → β)
(init : β)
(arr : Array α)
:
Array.foldl f init arr = List.foldl f init arr.toList
Instances For
@[reducible, inline, deprecated Array.foldrM_eq_reverse_foldlM_toList]
abbrev
Array.foldrM_eq_reverse_foldlM_data
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m β)
(init : β)
(arr : Array α)
:
Array.foldrM f init arr = List.foldlM (fun (x : β) (y : α) => f y x) init arr.toList.reverse
Instances For
@[reducible, inline, deprecated Array.foldrM_eq_foldrM_toList]
abbrev
Array.foldrM_eq_foldrM_data
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m β)
(init : β)
(arr : Array α)
:
Array.foldrM f init arr = List.foldrM f init arr.toList
Instances For
@[reducible, inline, deprecated Array.foldr_eq_foldr_toList]
abbrev
Array.foldr_eq_foldr_data
{α : Type u_1}
{β : Type u_2}
(f : α → β → β)
(init : β)
(arr : Array α)
:
Array.foldr f init arr = List.foldr f init arr.toList
Instances For
@[reducible, inline, deprecated Array.push_toList]
Equations
Instances For
@[reducible, inline, deprecated Array.toListImpl_eq]
Equations
Instances For
@[reducible, inline, deprecated Array.pop_toList]
Equations
Instances For
@[reducible, inline, deprecated Array.toList_append]
Equations
Instances For
@[reducible, inline, deprecated Array.appendList_toList]