File: .lake/packages/lean4/src/lean/Init/Control/Lawful/Instances.lean

full_name: ExceptT.ext
code: theorem ext {x y : ExceptT ε m α} (h : x.run = y.run) : x = y 
goal: x = y

full_name: ExceptT.run_pure
code: @[simp] theorem run_pure [Monad m] (x : α) : run (pure x : ExceptT ε m α) = pure (Except.ok x) 
goal: (pure x).run = pure (Except.ok x)

full_name: ExceptT.run_lift
code: @[simp] theorem run_lift  [Monad.{u, v} m] (x : m α) : run (ExceptT.lift x : ExceptT ε m α) = (Except.ok <$> x : m (Except ε α)) 
goal: (ExceptT.lift x).run = Except.ok <$> x

full_name: ExceptT.run_throw
code: @[simp] theorem run_throw [Monad m] : run (throw e : ExceptT ε m β) = pure (Except.error e) 
goal: (throw e).run = pure (Except.error e)

full_name: ExceptT.run_bind_lift
code: @[simp] theorem run_bind_lift [Monad m] [LawfulMonad m] (x : m α) (f : α → ExceptT ε m β) : run (ExceptT.lift x >>= f : ExceptT ε m β) = x >>= fun a => run (f a) 
goal: (ExceptT.lift x >>= f).run = do
  let a ← x
  (f a).run

full_name: ExceptT.bind_throw
code: @[simp] theorem bind_throw [Monad m] [LawfulMonad m] (f : α → ExceptT ε m β) : (throw e >>= f) = throw e 
goal: throw e >>= f = throw e

full_name: ExceptT.run_bind
code: theorem run_bind [Monad m] (x : ExceptT ε m α)
        : run (x >>= f : ExceptT ε m β)
          =
          run x >>= fun
                     | Except.ok x => run (f x)
                     | Except.error e => pure (Except.error e) 
goal: (x >>= f).run = do
  let x ← x.run
  match x with
    | Except.ok x => (f x).run
    | Except.error e => pure (Except.error e)

full_name: ExceptT.lift_pure
code: @[simp] theorem lift_pure [Monad m] [LawfulMonad m] (a : α) : ExceptT.lift (pure a) = (pure a : ExceptT ε m α) 
goal: ExceptT.lift (pure a) = pure a

full_name: ExceptT.run_map
code: @[simp] theorem run_map [Monad m] [LawfulMonad m] (f : α → β) (x : ExceptT ε m α)
    : (f <$> x).run = Except.map f <$> x.run 
goal: (f <$> x).run = Except.map f <$> x.run

full_name: ExceptT.seq_eq
code: protected theorem seq_eq {α β ε : Type u} [Monad m] (mf : ExceptT ε m (α → β)) (x : ExceptT ε m α) : mf <*> x = mf >>= fun f => f <$> x 
goal: (Seq.seq mf fun x_1 => x) = do
  let f ← mf
  f <$> x

full_name: ExceptT.bind_pure_comp
code: protected theorem bind_pure_comp [Monad m] (f : α → β) (x : ExceptT ε m α) : x >>= pure ∘ f = f <$> x 
goal: x >>= pure ∘ f = f <$> x

full_name: ExceptT.seqLeft_eq
code: protected theorem seqLeft_eq {α β ε : Type u} {m : Type u → Type v} [Monad m] [LawfulMonad m] (x : ExceptT ε m α) (y : ExceptT ε m β) : x <* y = const β <$> x <*> y 
goal: (SeqLeft.seqLeft x fun x => y) = Seq.seq (Function.const β <$> x) fun x => y

full_name: ExceptT.seqRight_eq
code: protected theorem seqRight_eq [Monad m] [LawfulMonad m] (x : ExceptT ε m α) (y : ExceptT ε m β) : x *> y = const α id <$> x <*> y 
goal: (SeqRight.seqRight x fun x => y) = Seq.seq (Function.const α id <$> x) fun x => y

full_name: ExceptT.«instLawfulMonad_.lake»
code: instance [Monad m] [LawfulMonad m] : LawfulMonad (ExceptT ε m) 
goal: LawfulMonad (ExceptT ε m)

full_name: «instLawfulMonadExcept_.lake»
code: instance : LawfulMonad (Except ε) 
goal: LawfulMonad (Except ε)

full_name: «instLawfulApplicativeExcept_.lake»
code: instance : LawfulApplicative (Except ε) 
goal: LawfulApplicative (Except ε)

full_name: «instLawfulFunctorExcept_.lake»
code: instance : LawfulFunctor (Except ε) 
goal: LawfulFunctor (Except ε)

full_name: ReaderT.ext
code: theorem ext {x y : ReaderT ρ m α} (h : ∀ ctx, x.run ctx = y.run ctx) : x = y 
goal: x = y

full_name: ReaderT.run_pure
code: @[simp] theorem run_pure [Monad m] (a : α) (ctx : ρ) : (pure a : ReaderT ρ m α).run ctx = pure a 
goal: (pure a).run ctx = pure a

full_name: ReaderT.run_bind
code: @[simp] theorem run_bind [Monad m] (x : ReaderT ρ m α) (f : α → ReaderT ρ m β) (ctx : ρ)
    : (x >>= f).run ctx = x.run ctx >>= λ a => (f a).run ctx 
goal: (x >>= f).run ctx = do
  let a ← x.run ctx
  (f a).run ctx

full_name: ReaderT.run_mapConst
code: @[simp] theorem run_mapConst [Monad m] (a : α) (x : ReaderT ρ m β) (ctx : ρ)
    : (Functor.mapConst a x).run ctx = Functor.mapConst a (x.run ctx) 
goal: (Functor.mapConst a x).run ctx = Functor.mapConst a (x.run ctx)

full_name: ReaderT.run_map
code: @[simp] theorem run_map [Monad m] (f : α → β) (x : ReaderT ρ m α) (ctx : ρ)
    : (f <$> x).run ctx = f <$> x.run ctx 
goal: (f <$> x).run ctx = f <$> x.run ctx

full_name: ReaderT.run_monadLift
code: @[simp] theorem run_monadLift [MonadLiftT n m] (x : n α) (ctx : ρ)
    : (monadLift x : ReaderT ρ m α).run ctx = (monadLift x : m α) 
goal: (monadLift x).run ctx = monadLift x

full_name: ReaderT.run_monadMap
code: @[simp] theorem run_monadMap [MonadFunctor n m] (f : {β : Type u} → n β → n β) (x : ReaderT ρ m α) (ctx : ρ)
    : (monadMap @f x : ReaderT ρ m α).run ctx = monadMap @f (x.run ctx) 
goal: (monadMap f x).run ctx = monadMap f (x.run ctx)

full_name: ReaderT.run_read
code: @[simp] theorem run_read [Monad m] (ctx : ρ) : (ReaderT.read : ReaderT ρ m ρ).run ctx = pure ctx 
goal: ReaderT.read.run ctx = pure ctx

full_name: ReaderT.run_seq
code: @[simp] theorem run_seq {α β : Type u} [Monad m] (f : ReaderT ρ m (α → β)) (x : ReaderT ρ m α) (ctx : ρ)
    : (f <*> x).run ctx = (f.run ctx <*> x.run ctx) 
goal: (Seq.seq f fun x_1 => x).run ctx = Seq.seq (f.run ctx) fun x_1 => x.run ctx

full_name: ReaderT.run_seqRight
code: @[simp] theorem run_seqRight [Monad m] (x : ReaderT ρ m α) (y : ReaderT ρ m β) (ctx : ρ)
    : (x *> y).run ctx = (x.run ctx *> y.run ctx) 
goal: (SeqRight.seqRight x fun x => y).run ctx = SeqRight.seqRight (x.run ctx) fun x => y.run ctx

full_name: ReaderT.run_seqLeft
code: @[simp] theorem run_seqLeft [Monad m] (x : ReaderT ρ m α) (y : ReaderT ρ m β) (ctx : ρ)
    : (x <* y).run ctx = (x.run ctx <* y.run ctx) 
goal: (SeqLeft.seqLeft x fun x => y).run ctx = SeqLeft.seqLeft (x.run ctx) fun x => y.run ctx

full_name: ReaderT.«instLawfulFunctor_.lake»
code: instance [Monad m] [LawfulFunctor m] : LawfulFunctor (ReaderT ρ m) 
goal: LawfulFunctor (ReaderT ρ m)

full_name: ReaderT.«instLawfulApplicative_.lake»
code: instance [Monad m] [LawfulApplicative m] : LawfulApplicative (ReaderT ρ m) 
goal: LawfulApplicative (ReaderT ρ m)

full_name: ReaderT.«instLawfulMonad_.lake»
code: instance [Monad m] [LawfulMonad m] : LawfulMonad (ReaderT ρ m) 
goal: LawfulMonad (ReaderT ρ m)

full_name: «instLawfulMonadStateRefT'_.lake»
code: instance [Monad m] [LawfulMonad m] : LawfulMonad (StateRefT' ω σ m) 
goal: LawfulMonad (StateRefT' ω σ m)

full_name: StateT.ext
code: theorem ext {x y : StateT σ m α} (h : ∀ s, x.run s = y.run s) : x = y 
goal: x = y

full_name: StateT.run'_eq
code: @[simp] theorem run'_eq [Monad m] (x : StateT σ m α) (s : σ) : run' x s = (·.1) <$> run x s 
goal: x.run' s = (fun x => x.fst) <$> x.run s

full_name: StateT.run_pure
code: @[simp] theorem run_pure [Monad m] (a : α) (s : σ) : (pure a : StateT σ m α).run s = pure (a, s) 
goal: (pure a).run s = pure (a, s)

full_name: StateT.run_bind
code: @[simp] theorem run_bind [Monad m] (x : StateT σ m α) (f : α → StateT σ m β) (s : σ)
    : (x >>= f).run s = x.run s >>= λ p => (f p.1).run p.2 
goal: (x >>= f).run s = do
  let p ← x.run s
  (f p.fst).run p.snd

full_name: StateT.run_map
code: @[simp] theorem run_map {α β σ : Type u} [Monad m] [LawfulMonad m] (f : α → β) (x : StateT σ m α) (s : σ) : (f <$> x).run s = (fun (p : α × σ) => (f p.1, p.2)) <$> x.run s 
goal: (f <$> x).run s = (fun p => (f p.fst, p.snd)) <$> x.run s

full_name: StateT.run_get
code: @[simp] theorem run_get [Monad m] (s : σ)    : (get : StateT σ m σ).run s = pure (s, s) 
goal: get.run s = pure (s, s)

full_name: StateT.run_set
code: @[simp] theorem run_set [Monad m] (s s' : σ) : (set s' : StateT σ m PUnit).run s = pure (⟨⟩, s') 
goal: (set s').run s = pure (PUnit.unit, s')

full_name: StateT.run_modify
code: @[simp] theorem run_modify [Monad m] (f : σ → σ) (s : σ) : (modify f : StateT σ m PUnit).run s = pure (⟨⟩, f s) 
goal: (modify f).run s = pure (PUnit.unit, f s)

full_name: StateT.run_modifyGet
code: @[simp] theorem run_modifyGet [Monad m] (f : σ → α × σ) (s : σ) : (modifyGet f : StateT σ m α).run s = pure ((f s).1, (f s).2) 
goal: (modifyGet f).run s = pure ((f s).fst, (f s).snd)

full_name: StateT.run_lift
code: @[simp] theorem run_lift {α σ : Type u} [Monad m] (x : m α) (s : σ) : (StateT.lift x : StateT σ m α).run s = x >>= fun a => pure (a, s) 
goal: (StateT.lift x).run s = do
  let a ← x
  pure (a, s)

full_name: StateT.run_bind_lift
code: @[simp] theorem run_bind_lift {α σ : Type u} [Monad m] [LawfulMonad m] (x : m α) (f : α → StateT σ m β) (s : σ) : (StateT.lift x >>= f).run s = x >>= fun a => (f a).run s 
goal: (StateT.lift x >>= f).run s = do
  let a ← x
  (f a).run s

full_name: StateT.run_monadLift
code: @[simp] theorem run_monadLift {α σ : Type u} [Monad m] [MonadLiftT n m] (x : n α) (s : σ) : (monadLift x : StateT σ m α).run s = (monadLift x : m α) >>= fun a => pure (a, s) 
goal: (monadLift x).run s = do
  let a ← monadLift x
  pure (a, s)

full_name: StateT.run_monadMap
code: @[simp] theorem run_monadMap [Monad m] [MonadFunctor n m] (f : {β : Type u} → n β → n β) (x : StateT σ m α) (s : σ)
    : (monadMap @f x : StateT σ m α).run s = monadMap @f (x.run s) 
goal: (monadMap f x).run s = monadMap f (x.run s)

full_name: StateT.run_seq
code: @[simp] theorem run_seq {α β σ : Type u} [Monad m] [LawfulMonad m] (f : StateT σ m (α → β)) (x : StateT σ m α) (s : σ) : (f <*> x).run s = (f.run s >>= fun fs => (fun (p : α × σ) => (fs.1 p.1, p.2)) <$> x.run fs.2) 
goal: (Seq.seq f fun x_1 => x).run s = do
  let fs ← f.run s
  (fun p => (fs.fst p.fst, p.snd)) <$> x.run fs.snd

full_name: StateT.run_seqRight
code: @[simp] theorem run_seqRight [Monad m] (x : StateT σ m α) (y : StateT σ m β) (s : σ) : (x *> y).run s = (x.run s >>= fun p => y.run p.2) 
goal: (SeqRight.seqRight x fun x => y).run s = do
  let p ← x.run s
  y.run p.snd

full_name: StateT.run_seqLeft
code: @[simp] theorem run_seqLeft {α β σ : Type u} [Monad m] (x : StateT σ m α) (y : StateT σ m β) (s : σ) : (x <* y).run s = (x.run s >>= fun p => y.run p.2 >>= fun p' => pure (p.1, p'.2)) 
goal: (SeqLeft.seqLeft x fun x => y).run s = do
  let p ← x.run s
  let p' ← y.run p.snd
  pure (p.fst, p'.snd)

full_name: StateT.seqRight_eq
code: theorem seqRight_eq [Monad m] [LawfulMonad m] (x : StateT σ m α) (y : StateT σ m β) : x *> y = const α id <$> x <*> y 
goal: (SeqRight.seqRight x fun x => y) = Seq.seq (Function.const α id <$> x) fun x => y

full_name: StateT.seqLeft_eq
code: theorem seqLeft_eq [Monad m] [LawfulMonad m] (x : StateT σ m α) (y : StateT σ m β) : x <* y = const β <$> x <*> y 
goal: (SeqLeft.seqLeft x fun x => y) = Seq.seq (Function.const β <$> x) fun x => y

full_name: StateT.«instLawfulMonad_.lake»
code: instance [Monad m] [LawfulMonad m] : LawfulMonad (StateT σ m) 
goal: LawfulMonad (StateT σ m)

full_name: «instLawfulMonadEStateM_.lake»
code: instance : LawfulMonad (EStateM ε σ) 
goal: LawfulMonad (EStateM ε σ)