File: Mathlib/Control/Basic.lean

full_name: Functor.map_map
code: @[functor_norm]
theorem Functor.map_map (m : α → β) (g : β → γ) (x : f α) : g <$> m <$> x = (g ∘ m) <$> x 
goal: g <$> m <$> x = (g ∘ m) <$> x

full_name: zipWithM
code: /-- A generalization of `List.zipWith` which combines list elements with an `Applicative`. -/
def zipWithM {α₁ α₂ φ : Type u} (f : α₁ → α₂ → F φ) : ∀ (_ : List α₁) (_ : List α₂), F (List φ)
  
goal: List α₁ → List α₂ → F (List φ)

full_name: zipWithM'
code: /-- Like `zipWithM` but evaluates the result as it traverses the lists using `*>`. -/
def zipWithM' (f : α → β → F γ) : List α → List β → F PUnit
  
goal: List α → List β → F PUnit.{u + 1}

full_name: pure_id'_seq
code: @[simp]
theorem pure_id'_seq (x : F α) : (pure fun x => x) <*> x = x 
goal: (Seq.seq (pure fun x => x) fun x_1 => x) = x

full_name: seq_map_assoc
code: @[functor_norm]
theorem seq_map_assoc (x : F (α → β)) (f : γ → α) (y : F γ) :
    x <*> f <$> y = (· ∘ f) <$> x <*> y 
goal: (Seq.seq x fun x => f <$> y) = Seq.seq ((fun x => x ∘ f) <$> x) fun x => y

full_name: map_seq
code: @[functor_norm]
theorem map_seq (f : β → γ) (x : F (α → β)) (y : F α) :
    f <$> (x <*> y) = (f ∘ ·) <$> x <*> y 
goal: (f <$> Seq.seq x fun x => y) = Seq.seq ((fun x => f ∘ x) <$> x) fun x => y

full_name: map_bind
code: theorem map_bind (x : m α) {g : α → m β} {f : β → γ} :
    f <$> (x >>= g) = x >>= fun a => f <$> g a 
goal: f <$> (x >>= g) = do
  let a ← x
  f <$> g a

full_name: seq_bind_eq
code: theorem seq_bind_eq (x : m α) {g : β → m γ} {f : α → β} :
    f <$> x >>= g = x >>= g ∘ f 
goal: f <$> x >>= g = x >>= g ∘ f

full_name: fish_pure
code: @[functor_norm]
theorem fish_pure {α β} (f : α → m β) : f >=> pure = f 
goal: f >=> pure = f

full_name: fish_pipe
code: @[functor_norm]
theorem fish_pipe {α β} (f : α → m β) : pure >=> f = f 
goal: pure >=> f = f

full_name: fish_assoc
code: @[functor_norm]
theorem fish_assoc {α β γ φ} (f : α → m β) (g : β → m γ) (h : γ → m φ) :
    (f >=> g) >=> h = f >=> g >=> h 
goal: (f >=> g) >=> h = f >=> g >=> h

full_name: List.mapAccumRM
code: /-- Takes a value `β` and `List α` and accumulates pairs according to a monadic function `f`.
Accumulation occurs from the right (i.e., starting from the tail of the list). -/
def List.mapAccumRM (f : α → β' → m' (β' × γ')) : β' → List α → m' (β' × List γ')
  
goal: β' → List α → m' (β' × List γ')

full_name: List.mapAccumLM
code: /-- Takes a value `β` and `List α` and accumulates pairs according to a monadic function `f`.
Accumulation occurs from the left (i.e., starting from the head of the list). -/
def List.mapAccumLM (f : β' → α → m' (β' × γ')) : β' → List α → m' (β' × List γ')
  
goal: β' → List α → m' (β' × List γ')

full_name: joinM_map_map
code: theorem joinM_map_map {α β : Type u} (f : α → β) (a : m (m α)) :
    joinM (Functor.map f <$> a) = f <$> joinM a 
goal: joinM (Functor.map f <$> a) = f <$> joinM a

full_name: joinM_map_joinM
code: theorem joinM_map_joinM {α : Type u} (a : m (m (m α))) : joinM (joinM <$> a) = joinM (joinM a) 
goal: joinM (joinM <$> a) = joinM (joinM a)

full_name: joinM_map_pure
code: @[simp]
theorem joinM_map_pure {α : Type u} (a : m α) : joinM (pure <$> a) = a 
goal: joinM (pure <$> a) = a

full_name: joinM_pure
code: @[simp]
theorem joinM_pure {α : Type u} (a : m α) : joinM (pure a) = a 
goal: joinM (pure a) = a

full_name: succeeds
code: /-- Returns `pure true` if the computation succeeds and `pure false` otherwise. -/
def succeeds {α} (x : F α) : F Bool 
goal: F Bool

full_name: tryM
code: /-- Attempts to perform the computation, but fails silently if it doesn't succeed. -/
def tryM {α} (x : F α) : F Unit 
goal: F Unit

full_name: try?
code: /-- Attempts to perform the computation, and returns `none` if it doesn't succeed. -/
def try? {α} (x : F α) : F (Option α) 
goal: F (Option α)

full_name: guard_true
code: @[simp]
theorem guard_true {h : Decidable True} : @guard F _ True h = pure () 
goal: guard True = pure ()

full_name: guard_false
code: @[simp]
theorem guard_false {h : Decidable False} : @guard F _ False h = failure 
goal: guard False = failure

full_name: Sum.bind
code: /-- The monadic `bind` operation for `Sum`. -/
protected def bind {α β} : e ⊕ α → (α → e ⊕ β) → e ⊕ β
  
goal: e ⊕ α → (α → e ⊕ β) → e ⊕ β

full_name: Sum.instMonad_mathlib
code: instance : Monad (Sum.{v, u} e) 
goal: Monad (Sum e)

full_name: Sum.instLawfulFunctor_mathlib
code: instance : LawfulFunctor (Sum.{v, u} e) 
goal: LawfulFunctor (Sum e)

full_name: Sum.instLawfulMonad_mathlib
code: instance : LawfulMonad (Sum.{v, u} e) 
goal: LawfulMonad (Sum e)

full_name: CommApplicative
code: /-- A `CommApplicative` functor `m` is a (lawful) applicative functor which behaves identically on
`α × β` and `β × α`, so computations can occur in either order. -/
class CommApplicative (m : Type u → Type v) [Applicative m] extends LawfulApplicative m : Prop where
  /-- Computations performed first on `a : α` and then on `b : β` are equal to those performed in
  the reverse order. -/
  commutative_prod : ∀ {α β} (a : m α) (b : m β),
    Prod.mk <$> a <*> b = (fun (b : β) a => (a, b)) <$> b <*> a
goal: Prop

full_name: CommApplicative.commutative_prod
code: /-- A `CommApplicative` functor `m` is a (lawful) applicative functor which behaves identically on
`α × β` and `β × α`, so computations can occur in either order. -/
class CommApplicative (m : Type u → Type v) [Applicative m] extends LawfulApplicative m : Prop where
  /-- Computations performed first on `a : α` and then on `b : β` are equal to those performed in
  the reverse order. -/
  commutative_prod : ∀ {α β} (a : m α) (b : m β),
    Prod.mk <$> a <*> b = (fun (b : β) a => (a, b)) <$> b <*> a
goal: (Seq.seq (Prod.mk <$> a) fun x => b) = Seq.seq ((fun b a => (a, b)) <$> b) fun x => a

full_name: CommApplicative.commutative_map
code: theorem CommApplicative.commutative_map {m : Type u → Type v} [h : Applicative m]
    [CommApplicative m] {α β γ} (a : m α) (b : m β) {f : α → β → γ} :
  f <$> a <*> b = flip f <$> b <*> a 
goal: (Seq.seq (f <$> a) fun x => b) = Seq.seq (flip f <$> b) fun x => a