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,
as was defined in Data.Set.Notation.
The coercion from Set.monad as an instance is equal to the coercion in Data.Set.Notation.