@[simp]
theorem
Option.foldlM_toList
{m : Type u_1 → Type u_2}
{β : Type u_3}
{α : Type u_1}
[Monad m]
[LawfulMonad m]
(o : Option β)
(a : α)
(f : α → β → m α)
:
List.foldlM f a o.toList = o.elim (pure a) fun (b : β) => f a b
@[simp]
theorem
Option.foldrM_toList
{m : Type u_1 → Type u_2}
{β : Type u_3}
{α : Type u_1}
[Monad m]
[LawfulMonad m]
(o : Option β)
(a : α)
(f : β → α → m α)
:
List.foldrM f a o.toList = o.elim (pure a) fun (b : β) => f b a
@[simp]
theorem
Option.foldl_toList
{β : Type u_1}
{α : Type u_2}
(o : Option β)
(a : α)
(f : α → β → α)
:
List.foldl f a o.toList = o.elim a fun (b : β) => f a b
@[simp]
theorem
Option.foldr_toList
{β : Type u_1}
{α : Type u_2}
(o : Option β)
(a : α)
(f : β → α → α)
:
List.foldr f a o.toList = o.elim a fun (b : β) => f b a