/- Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Std.Control.ForInStep.Basic /-! # Additional theorems on `ForInStep` -/ @[simp] theoremForInStep.bind_done [Monadm] (m: ?m.5a :a: αα) (α: ?m.14f :f: α → m (ForInStep α)α →α: ?m.14m (ForInStepm: ?m.5α)) : (ForInStep.doneα: ?m.14a).a: αbind (m :=m)m: ?m.5f = pure (.donef: α → m (ForInStep α)a) := rfl @[simp] theorema: αForInStep.bind_yield [Monadm] (m: ?m.175a :a: αα) (α: ?m.184f :f: α → m (ForInStep α)α →α: ?m.184m (ForInStepm: ?m.175α)) : (ForInStep.yieldα: ?m.184a).a: αbind (m :=m)m: ?m.175f =f: α → m (ForInStep α)ff: α → m (ForInStep α)a := rfl attribute [simp] ForInStep.bindM @[simp] theorem ForInStep.run_done : (ForInStep.donea: αa).run =a: ?m.284a := rfl @[simp] theorem ForInStep.run_yield : (ForInStep.yielda: ?m.284a).run =a: ?m.332a := rfl @[simp] theorema: ?m.332ForInStep.bindList_nil [Monadm] (m: ?m.379f :f: α → β → m (ForInStep β)α →α: ?m.389β →β: ?m.401m (ForInStepm: ?m.379β)) (β: ?m.401s : ForInSteps: ForInStep ββ) :β: ?m.401s.bindLists: ForInStep βff: α → β → m (ForInStep β)[] = pure[]: List ?m.443s := rfl @[simp] theorems: ForInStep βForInStep.bindList_cons [Monadm] (m: ?m.577f :f: α → β → m (ForInStep β)α →α: ?m.587β →β: ?m.599m (ForInStepm: ?m.577β)) (β: ?m.599s : ForInSteps: ForInStep ββ) (β: ?m.599aa: αl) :l: List αs.bindLists: ForInStep βf (f: α → β → m (ForInStep β)a::a: ?m.617l) =l: ?m.620s.bind funs: ForInStep βb =>b: ?m.665ff: α → β → m (ForInStep β)aa: ?m.617b >>= (·.b: ?m.665bindListff: α → β → m (ForInStep β)l) := rfl @[simp] theoreml: ?m.620ForInStep.done_bindList [Monadm] (m: ?m.849f :f: α → β → m (ForInStep β)α →α: ?m.859β →β: ?m.871m (ForInStepm: ?m.849β)) (β: ?m.871aa: βl) : (ForInStep.donel: List αa).a: ?m.886bindListff: α → β → m (ForInStep β)l = pure (.donel: ?m.889a) :=a: ?m.886Goals accomplished! 🐙@[simp] theoremGoals accomplished! 🐙ForInStep.bind_yield_bindList [Monadm] (m: ?m.1419f :f: α → β → m (ForInStep β)α →α: ?m.1429β →β: ?m.1441m (ForInStepm: ?m.1419β)) (β: ?m.1441s : ForInSteps: ForInStep ββ) (β: ?m.1441l) : (l: ?m.1459s.bind funs: ForInStep βa => (yielda: ?m.1475a).a: ?m.1475bindListff: α → β → m (ForInStep β)l) =l: ?m.1459s.bindLists: ForInStep βff: α → β → m (ForInStep β)l :=l: ?m.1459Goals accomplished! 🐙
done
yield
done
yield@[simp] theoremGoals accomplished! 🐙ForInStep.bind_bindList_assoc [MonadForInStep.bind_bindList_assoc: ∀ {m : Type u_1 → Type u_2} {β : Type u_1} {α : Type u_3} [inst : Monad m] [inst_1 : LawfulMonad m] (f : β → m (ForInStep β)) (g : α → β → m (ForInStep β)) (s : ForInStep β) (l : List α), (do let x ← ForInStep.bind s f bindList g l x) = ForInStep.bind s fun b => do let x ← f b bindList g l xm] [LawfulMonadm: ?m.1878m] (m: ?m.1878f :f: β → m (ForInStep β)β →β: ?m.1899m (ForInStepm: ?m.1878β)) (β: ?m.1899g :g: α → β → m (ForInStep β)α →α: ?m.1925β →β: ?m.1899m (ForInStepm: ?m.1878β)) (β: ?m.1899s : ForInSteps: ForInStep ββ) (β: ?m.1899l) :l: List αs.binds: ForInStep βf >>= (·.f: β → m (ForInStep β)bindListgg: α → β → m (ForInStep β)l) =l: ?m.1959s.bind funs: ForInStep βb =>b: ?m.2088ff: β → m (ForInStep β)b >>= (·.b: ?m.2088bindListgg: α → β → m (ForInStep β)l) :=l: ?m.1959Goals accomplished! 🐙m: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
s: ForInStep β
l: List α(do let x ← ForInStep.bind s f bindList g l x) = ForInStep.bind s fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
l: List α
a✝: β
done(do let x ← ForInStep.bind (done a✝) f bindList g l x) = ForInStep.bind (done a✝) fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
l: List α
a✝: β
yield(do let x ← ForInStep.bind (yield a✝) f bindList g l x) = ForInStep.bind (yield a✝) fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
s: ForInStep β
l: List α(do let x ← ForInStep.bind s f bindList g l x) = ForInStep.bind s fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
l: List α
a✝: β
done(do let x ← ForInStep.bind (done a✝) f bindList g l x) = ForInStep.bind (done a✝) fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
l: List α
a✝: β
yield(do let x ← ForInStep.bind (yield a✝) f bindList g l x) = ForInStep.bind (yield a✝) fun b => do let x ← f b bindList g l xm: Type u_1 → Type u_2
β: Type u_1
α: Type u_3
inst✝¹: Monad m
inst✝: LawfulMonad m
f: β → m (ForInStep β)
g: α → β → m (ForInStep β)
s: ForInStep β
l: List α(do let x ← ForInStep.bind s f bindList g l x) = ForInStep.bind s fun b => do let x ← f b bindList g l xtheoremGoals accomplished! 🐙ForInStep.bindList_cons' [Monadm] [LawfulMonadm: ?m.2827m] (m: ?m.2827f :f: α → β → m (ForInStep β)α →α: ?m.2848β →β: ?m.2871m (ForInStepm: ?m.2827β)) (β: ?m.2871s : ForInSteps: ForInStep ββ) (β: ?m.2871aa: ?m.2900l) :l: List αs.bindLists: ForInStep βf (f: α → β → m (ForInStep β)a::a: ?m.2900l) =l: ?m.2903s.bind (s: ForInStep βff: α → β → m (ForInStep β)a) >>= (·.a: ?m.2900bindListff: α → β → m (ForInStep β)l) :=l: ?m.2903Goals accomplished! 🐙@[simp] theoremGoals accomplished! 🐙ForInStep.bindList_append [Monadm] [LawfulMonadm: ?m.3370m] (m: ?m.3370f :f: α → β → m (ForInStep β)α →α: ?m.3391β →β: ?m.3414m (ForInStepm: ?m.3370β)) (β: ?m.3414s : ForInSteps: ForInStep ββ) (β: ?m.3414l₁l₁: ?m.3443l₂) :l₂: ?m.3446s.bindLists: ForInStep βf (f: α → β → m (ForInStep β)l₁ ++l₁: ?m.3443l₂) =l₂: ?m.3446s.bindLists: ForInStep βff: α → β → m (ForInStep β)l₁ >>= (·.l₁: ?m.3443bindListff: α → β → m (ForInStep β)l₂) :=l₂: ?m.3446Goals accomplished! 🐙m: Type u_1 → Type u_2
α: Type u_3
β: Type u_1
inst✝¹: Monad m
inst✝: LawfulMonad m
f: α → β → m (ForInStep β)
l₂: List α
s: ForInStep β
nilm: Type u_1 → Type u_2
α: Type u_3
β: Type u_1
inst✝¹: Monad m
inst✝: LawfulMonad m
f: α → β → m (ForInStep β)
l₂: List α
head✝: α
tail✝: List α
tail_ih✝: ∀ (s : ForInStep β), bindList f (tail✝ ++ l₂) s = do let x ← bindList f tail✝ s bindList f l₂ x
s: ForInStep β
consm: Type u_1 → Type u_2
α: Type u_3
β: Type u_1
inst✝¹: Monad m
inst✝: LawfulMonad m
f: α → β → m (ForInStep β)
l₂: List α
s: ForInStep β
nilm: Type u_1 → Type u_2
α: Type u_3
β: Type u_1
inst✝¹: Monad m
inst✝: LawfulMonad m
f: α → β → m (ForInStep β)
l₂: List α
head✝: α
tail✝: List α
tail_ih✝: ∀ (s : ForInStep β), bindList f (tail✝ ++ l₂) s = do let x ← bindList f tail✝ s bindList f l₂ x
s: ForInStep β
consGoals accomplished! 🐙