File: Mathlib/Data/Set/Functor.lean

full_name: Set.monad
code: /-- 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. -/
protected def monad : Monad.{u} Set 
goal: Monad Set

full_name: Set.bind_def
code: @[simp]
theorem bind_def : s >>= f = ⋃ i ∈ s, f i 
goal: s >>= f = ⋃ i ∈ s, f i

full_name: Set.fmap_eq_image
code: @[simp]
theorem fmap_eq_image (f : α → β) : f <$> s = f '' s 
goal: f <$> s = f '' s

full_name: Set.seq_eq_set_seq
code: @[simp]
theorem seq_eq_set_seq (s : Set (α → β)) (t : Set α) : s <*> t = s.seq t 
goal: (Seq.seq s fun x => t) = s.seq t

full_name: Set.pure_def
code: @[simp]
theorem pure_def (a : α) : (pure a : Set α) = {a} 
goal: pure a = {a}

full_name: Set.image2_def
code: /-- `Set.image2` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
theorem image2_def {α β γ : Type u} (f : α → β → γ) (s : Set α) (t : Set β) :
    image2 f s t = f <$> s <*> t 
goal: Set.image2 f s t = Seq.seq (f <$> s) fun x => t

full_name: Set.instLawfulMonad
code: instance : LawfulMonad Set 
goal: LawfulMonad Set

full_name: Set.instCommApplicative
code: instance : CommApplicative (Set : Type u → Type u) 
goal: CommApplicative Set

full_name: Set.instAlternative
code: instance : Alternative Set 
goal: Alternative Set

full_name: Set.mem_coe_of_mem
code: theorem mem_coe_of_mem {a : α} (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) 
goal: a ∈ do
  let a ← γ
  pure ↑a

full_name: Set.coe_subset
code: theorem coe_subset : (γ : Set α) ⊆ β 
goal: (do
    let a ← γ
    pure ↑a) ⊆
  β

full_name: Set.mem_of_mem_coe
code: theorem mem_of_mem_coe {a : α} (ha : a ∈ (γ : Set α)) : ⟨a, coe_subset ha⟩ ∈ γ 
goal: ⟨a, ⋯⟩ ∈ γ

full_name: Set.eq_univ_of_coe_eq
code: theorem eq_univ_of_coe_eq (hγ : (γ : Set α) = β) : γ = univ 
goal: γ = Set.univ

full_name: Set.image_coe_eq_restrict_image
code: theorem image_coe_eq_restrict_image {δ : Type*} {f : α → δ} : f '' γ = β.restrict f '' γ 
goal: (f '' do
    let a ← γ
    pure ↑a) =
  β.restrict f '' γ

full_name: Set.coe_eq_image_val
code: /-- The coercion from `Set.monad` as an instance is equal to the coercion in `Data.Set.Notation`. -/
theorem coe_eq_image_val (t : Set s) :
    @Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) 
goal: Lean.Internal.coeM t = ↑t

full_name: Set.mem_image_val_of_mem
code: theorem mem_image_val_of_mem (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) 
goal: a ∈ ↑γ

full_name: Set.image_val_subset
code: theorem image_val_subset : (γ : Set α) ⊆ β 
goal: ↑γ ⊆ β

full_name: Set.mem_of_mem_image_val
code: theorem mem_of_mem_image_val (ha : a ∈ (γ : Set α)) : ⟨a, image_val_subset ha⟩ ∈ γ 
goal: ⟨a, ⋯⟩ ∈ γ

full_name: Set.eq_univ_of_image_val_eq
code: theorem eq_univ_of_image_val_eq (hγ : (γ : Set α) = β) : γ = univ 
goal: γ = Set.univ

full_name: Set.image_image_val_eq_restrict_image
code: theorem image_image_val_eq_restrict_image {δ : Type*} {f : α → δ} : f '' γ = β.restrict f '' γ 
goal: f '' ↑γ = β.restrict f '' γ

full_name: SetM
code: /-- This is `Set` but with a `Monad` instance. -/
def SetM (α : Type u) 
goal: Type u

full_name: instMonadSetM
code: instance : Monad SetM 
goal: Monad SetM

full_name: SetM.run
code: /-- Evaluates the `SetM` monad, yielding a `Set`.
Implementation note: this is the identity function. -/
protected def SetM.run {α : Type*} (s : SetM α) : Set α 
goal: Set α