dfoldrM #
theorem
Fin.dfoldrM_loop
{m : Type u_1 → Type u_2}
{n : Nat}
{α : Fin (n + 1 + 1) → Type u_1}
{i : Nat}
{h : i + 1 < n + 1 + 1}
[Monad m]
[LawfulMonad m]
(f : (i : Fin (n + 1)) → α i.succ → m (α i.castSucc))
(x : α ⟨i + 1, h⟩)
:
dfoldrM.loop (n + 1) α f (i + 1) h x = dfoldrM.loop n (α ∘ succ) (fun (x : Fin n) => f x.succ) i ⋯ x >>= f 0
dfoldr #
dfoldlM #
@[irreducible]
theorem
Fin.dfoldlM_loop
{m : Type u_1 → Type u_2}
{n : Nat}
{α : Fin (n + 1 + 1) → Type u_1}
{i : Nat}
[Monad m]
(f : (i : Fin (n + 1)) → α i.castSucc → m (α i.succ))
(h : i < n + 1)
(x : α ⟨i, ⋯⟩)
:
dfoldlM.loop (n + 1) α f i ⋯ x = do
let x ← f ⟨i, h⟩ x
dfoldlM.loop n (α ∘ succ) (fun (x1 : Fin n) (x2 : (α ∘ succ) x1.castSucc) => f x1.succ x2) i h x
dfoldl #
Fin.fold{l/r}{M}
equals List.fold{l/r}{M}
#
theorem
Fin.foldlM_eq_foldlM_finRange
{m : Type u_1 → Type u_2}
{α : Type u_1}
{n : Nat}
[Monad m]
(f : α → Fin n → m α)
(x : α)
:
foldlM n f x = List.foldlM f x (List.finRange n)
@[deprecated Fin.foldlM_eq_foldlM_finRange (since := "2024-11-19")]
theorem
Fin.foldlM_eq_foldlM_list
{m : Type u_1 → Type u_2}
{α : Type u_1}
{n : Nat}
[Monad m]
(f : α → Fin n → m α)
(x : α)
:
foldlM n f x = List.foldlM f x (List.finRange n)
Alias of Fin.foldlM_eq_foldlM_finRange
.
theorem
Fin.foldrM_eq_foldrM_finRange
{m : Type u_1 → Type u_2}
{n : Nat}
{α : Type u_1}
[Monad m]
[LawfulMonad m]
(f : Fin n → α → m α)
(x : α)
:
foldrM n f x = List.foldrM f x (List.finRange n)
@[deprecated Fin.foldrM_eq_foldrM_finRange (since := "2024-11-19")]
theorem
Fin.foldrM_eq_foldrM_list
{m : Type u_1 → Type u_2}
{n : Nat}
{α : Type u_1}
[Monad m]
[LawfulMonad m]
(f : Fin n → α → m α)
(x : α)
:
foldrM n f x = List.foldrM f x (List.finRange n)
Alias of Fin.foldrM_eq_foldrM_finRange
.
theorem
Fin.foldl_eq_foldl_finRange
{α : Type u_1}
{n : Nat}
(f : α → Fin n → α)
(x : α)
:
foldl n f x = List.foldl f x (List.finRange n)
@[deprecated Fin.foldl_eq_foldl_finRange (since := "2024-11-19")]
theorem
Fin.foldl_eq_foldl_list
{α : Type u_1}
{n : Nat}
(f : α → Fin n → α)
(x : α)
:
foldl n f x = List.foldl f x (List.finRange n)
Alias of Fin.foldl_eq_foldl_finRange
.
theorem
Fin.foldr_eq_foldr_finRange
{n : Nat}
{α : Type u_1}
(f : Fin n → α → α)
(x : α)
:
foldr n f x = List.foldr f x (List.finRange n)
@[deprecated Fin.foldr_eq_foldr_finRange (since := "2024-11-19")]
theorem
Fin.foldr_eq_foldr_list
{n : Nat}
{α : Type u_1}
(f : Fin n → α → α)
(x : α)
:
foldr n f x = List.foldr f x (List.finRange n)
Alias of Fin.foldr_eq_foldr_finRange
.