Monad #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Attributes #
- ext
- functor_norm
- monad_norm
Implementation Details #
Set of rewrite rules and automation for monads in general and
reader_t
, state_t
, except_t
and option_t
in particular.
The rewrite rules for monads are carefully chosen so that simp with functor_norm
will not introduce monadic vocabulary in a context where
applicatives would do just fine but will handle monadic notation
already present in an expression.
In a context where monadic reasoning is desired simp with monad_norm
will translate functor and applicative notation into monad notation
and use regular functor_norm
rules as well.
Tags #
functor, applicative, monad, simp
theorem
map_eq_bind_pure_comp
(m : Type u → Type v)
[monad m]
[is_lawful_monad m]
{α β : Type u}
(f : α → β)
(x : m α) :
f <$> x = x >>= has_pure.pure ∘ f