@[simp]
@[simp]
Set.image2 in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism.
@[implicit_reducible]
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.
Moreover, 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
@[simp]
Monadic coercion lemmas #
theorem
Set.mem_coe_of_mem
{α : Type u}
{β : Set α}
{γ : Set ↑β}
{a : α}
(ha : a ∈ β)
(ha' : ⟨a, ha⟩ ∈ γ)
:
a ∈ do
let a ← γ
pure ↑a
theorem
Set.mem_of_mem_coe
{α : Type u}
{β : Set α}
{γ : Set ↑β}
{a : α}
(ha :
a ∈ do
let a ← γ
pure ↑a)
:
⟨a, ⋯⟩ ∈ γ
theorem
Set.eq_univ_of_coe_eq
{α : Type u}
{β : Set α}
{γ : Set ↑β}
(hγ :
(do
let a ← γ
pure ↑a) = β)
:
γ = univ
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.
theorem
Set.mem_image_val_of_mem
{α : Type u}
{β : Set α}
{γ : Set ↑β}
{a : α}
(ha : a ∈ β)
(ha' : ⟨a, ha⟩ ∈ γ)
:
a ∈ Subtype.val '' γ
theorem
Set.mem_of_mem_image_val
{α : Type u}
{β : Set α}
{γ : Set ↑β}
{a : α}
(ha : a ∈ Subtype.val '' γ)
:
⟨a, ⋯⟩ ∈ γ