The Set
functor is a monad.
This is not a global instance because it does not have computational content,
so it does not make much sense using do
notation in general.
Plus, this would cause monad-related coercions and monad lifting logic to become activated.
Either use attribute [local instance] Set.monad
to make it be a local instance
or use SetM.run do ...
when do
notation is wanted.
Instances For
Set.image2
in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism.
Monadic coercion lemmas #
Coercion applying functoriality for Subtype.val
#
The Monad
instance gives a coercion using the internal function Lean.Internal.coeM
.
In practice this is only used for applying the Set
functor to Subtype.val
.
We define this coercion here.
If the Set.Notation
namespace is open, sets of a subtype coerced to the ambient type are
represented with ↑
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The coercion from Set.monad
as an instance is equal to the coercion defined above.