File: .lake/packages/lean4/src/lean/Init/Control/StateCps.lean

full_name: StateCpsT
code: def StateCpsT (σ : Type u) (m : Type u → Type v) (α : Type u) 
goal: Type (max (u + 1) v)

full_name: StateCpsT.runK
code: @[always_inline, inline]
def runK (x : StateCpsT σ m α) (s : σ) (k : α → σ → m β) : m β 
goal: m β

full_name: StateCpsT.run
code: @[always_inline, inline]
def run [Monad m] (x : StateCpsT σ m α) (s : σ) : m (α × σ) 
goal: m (α × σ)

full_name: StateCpsT.run'
code: @[always_inline, inline]
def run' [Monad m] (x : StateCpsT σ m α) (s : σ) : m α 
goal: m α

full_name: StateCpsT.instMonad
code: @[always_inline]
instance : Monad (StateCpsT σ m) 
goal: Monad (StateCpsT σ m)

full_name: StateCpsT.instLawfulMonad
code: instance : LawfulMonad (StateCpsT σ m) 
goal: LawfulMonad (StateCpsT σ m)

full_name: StateCpsT.instMonadStateOf
code: @[always_inline]
instance : MonadStateOf σ (StateCpsT σ m) 
goal: MonadStateOf σ (StateCpsT σ m)

full_name: StateCpsT.lift
code: @[always_inline, inline]
protected def lift [Monad m] (x : m α) : StateCpsT σ m α 
goal: StateCpsT σ m α

full_name: StateCpsT.instMonadLiftOfMonad
code: instance [Monad m] : MonadLift m (StateCpsT σ m) 
goal: MonadLift m (StateCpsT σ m)

full_name: StateCpsT.runK_pure
code: @[simp] theorem runK_pure (a : α) (s : σ) (k : α → σ → m β) : (pure a : StateCpsT σ m α).runK s k = k a s 
goal: (pure a).runK s k = k a s

full_name: StateCpsT.runK_get
code: @[simp] theorem runK_get (s : σ) (k : σ → σ → m β) : (get : StateCpsT σ m σ).runK s k = k s s 
goal: get.runK s k = k s s

full_name: StateCpsT.runK_set
code: @[simp] theorem runK_set (s s' : σ) (k : PUnit → σ → m β) : (set s' : StateCpsT σ m PUnit).runK s k = k ⟨⟩ s' 
goal: (set s').runK s k = k PUnit.unit s'

full_name: StateCpsT.runK_modify
code: @[simp] theorem runK_modify (f : σ → σ) (s : σ) (k : PUnit → σ → m β) : (modify f : StateCpsT σ m PUnit).runK s k = k ⟨⟩ (f s) 
goal: (modify f).runK s k = k PUnit.unit (f s)

full_name: StateCpsT.runK_lift
code: @[simp] theorem runK_lift [Monad m] (x : m α) (s : σ) (k : α → σ → m β) : (StateCpsT.lift x : StateCpsT σ m α).runK s k = x >>= (k . s) 
goal: (StateCpsT.lift x).runK s k = do
  let x ← x
  k x s

full_name: StateCpsT.runK_monadLift
code: @[simp] theorem runK_monadLift [Monad m] [MonadLiftT n m] (x : n α) (s : σ) (k : α → σ → m β)
    : (monadLift x : StateCpsT σ m α).runK s k = (monadLift x : m α) >>= (k . s) 
goal: (monadLift x).runK s k = do
  let x ← monadLift x
  k x s

full_name: StateCpsT.runK_bind_pure
code: @[simp] theorem runK_bind_pure (a : α) (f : α → StateCpsT σ m β) (s : σ) (k : β → σ → m γ) : (pure a >>= f).runK s k = (f a).runK s k 
goal: (pure a >>= f).runK s k = (f a).runK s k

full_name: StateCpsT.runK_bind_lift
code: @[simp] theorem runK_bind_lift [Monad m] (x : m α) (f : α → StateCpsT σ m β) (s : σ) (k : β → σ → m γ)
    : (StateCpsT.lift x >>= f).runK s k = x >>= fun a => (f a).runK s k 
goal: (StateCpsT.lift x >>= f).runK s k = do
  let a ← x
  (f a).runK s k

full_name: StateCpsT.runK_bind_get
code: @[simp] theorem runK_bind_get (f : σ → StateCpsT σ m β) (s : σ) (k : β → σ → m γ) : (get >>= f).runK s k = (f s).runK s k 
goal: (get >>= f).runK s k = (f s).runK s k

full_name: StateCpsT.runK_bind_set
code: @[simp] theorem runK_bind_set (f : PUnit → StateCpsT σ m β) (s s' : σ) (k : β → σ → m γ) : (set s' >>= f).runK s k = (f ⟨⟩).runK s' k 
goal: (set s' >>= f).runK s k = (f PUnit.unit).runK s' k

full_name: StateCpsT.runK_bind_modify
code: @[simp] theorem runK_bind_modify (f : σ → σ) (g : PUnit → StateCpsT σ m β) (s : σ) (k : β → σ → m γ) : (modify f >>= g).runK s k = (g ⟨⟩).runK (f s) k 
goal: (modify f >>= g).runK s k = (g PUnit.unit).runK (f s) k

full_name: StateCpsT.run_eq
code: @[simp] theorem run_eq [Monad m] (x : StateCpsT σ m α) (s : σ) : x.run s = x.runK s (fun a s => pure (a, s)) 
goal: x.run s = x.runK s fun a s => pure { fst := a, snd := s }

full_name: StateCpsT.run'_eq
code: @[simp] theorem run'_eq [Monad m] (x : StateCpsT σ m α) (s : σ) : x.run' s = x.runK s (fun a _ => pure a) 
goal: x.run' s = x.runK s fun a x => pure a