@[simp]
theorem
ForInStep.bind_done
{m : Type u_1 → Type u_2}
{α : Type u_1}
[Monad m]
(a : α)
(f : α → m (ForInStep α))
:
ForInStep.bind (ForInStep.done a) f = pure (ForInStep.done a)
@[simp]
theorem
ForInStep.bind_yield
{m : Type u_1 → Type u_2}
{α : Type u_1}
[Monad m]
(a : α)
(f : α → m (ForInStep α))
:
ForInStep.bind (ForInStep.yield a) f = f a
@[simp]
@[simp]
@[simp]
theorem
ForInStep.bindList_cons
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m (ForInStep β))
(s : ForInStep β)
(a : α)
(l : List α)
:
ForInStep.bindList f (a :: l) s = ForInStep.bind s fun b => do
let x ← f a b
ForInStep.bindList f l x
@[simp]
theorem
ForInStep.done_bindList
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m (ForInStep β))
(a : β)
(l : List α)
:
ForInStep.bindList f l (ForInStep.done a) = pure (ForInStep.done a)
@[simp]
theorem
ForInStep.bind_yield_bindList
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m (ForInStep β))
(s : ForInStep β)
(l : List α)
:
(ForInStep.bind s fun a => ForInStep.bindList f l (ForInStep.yield a)) = ForInStep.bindList f l s
@[simp]
theorem
ForInStep.bind_bindList_assoc
{m : Type u_1 → Type u_2}
{β : Type u_1}
{α : Type u_3}
[Monad m]
[LawfulMonad m]
(f : β → m (ForInStep β))
(g : α → β → m (ForInStep β))
(s : ForInStep β)
(l : List α)
:
(do
let x ← ForInStep.bind s f
ForInStep.bindList g l x) = ForInStep.bind s fun b => do
let x ← f b
ForInStep.bindList g l x
theorem
ForInStep.bindList_cons'
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
[LawfulMonad m]
(f : α → β → m (ForInStep β))
(s : ForInStep β)
(a : α)
(l : List α)
:
ForInStep.bindList f (a :: l) s = do
let x ← ForInStep.bind s (f a)
ForInStep.bindList f l x
@[simp]
theorem
ForInStep.bindList_append
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
[LawfulMonad m]
(f : α → β → m (ForInStep β))
(s : ForInStep β)
(l₁ : List α)
(l₂ : List α)
:
ForInStep.bindList f (l₁ ++ l₂) s = do
let x ← ForInStep.bindList f l₁ s
ForInStep.bindList f l₂ x