mathlib documentation

control.applicative

applicative instances #

This file provides applicative instances for concrete functors:

theorem applicative.map_seq_map {F : Type uType v} [applicative F] [is_lawful_applicative F] {α β γ σ : Type u} (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
f <$> x <*> g <$> y = (flip function.comp g f) <$> x <*> y
theorem applicative.pure_seq_eq_map' {F : Type uType v} [applicative F] [is_lawful_applicative F] {α β : Type u} (f : α → β) :
theorem applicative.ext {F : Type uType u_1} {A1 A2 : applicative F} [is_lawful_applicative F] [is_lawful_applicative F] (H1 : ∀ {α : Type u} (x : α), pure x = pure x) (H2 : ∀ {α β : Type u} (f : F (α → β)) (x : F α), f <*> x = f <*> x) :
A1 = A2
@[protected, instance]
theorem functor.comp.map_pure {F : Type uType w} {G : Type vType u} [applicative F] [applicative G] [is_lawful_applicative F] [is_lawful_applicative G] {α β : Type v} (f : α → β) (x : α) :
f <$> pure x = pure (f x)
theorem functor.comp.seq_pure {F : Type uType w} {G : Type vType u} [applicative F] [applicative G] [is_lawful_applicative F] [is_lawful_applicative G] {α β : Type v} (f : functor.comp F G (α → β)) (x : α) :
f <*> pure x = (λ (g : α → β), g x) <$> f
theorem functor.comp.seq_assoc {F : Type uType w} {G : Type vType u} [applicative F] [applicative G] [is_lawful_applicative F] [is_lawful_applicative G] {α β γ : Type v} (x : functor.comp F G α) (f : functor.comp F G (α → β)) (g : functor.comp F G (β → γ)) :
g <*> (f <*> x) = function.comp <$> g <*> f <*> x
theorem functor.comp.pure_seq_eq_map {F : Type uType w} {G : Type vType u} [applicative F] [applicative G] [is_lawful_applicative F] [is_lawful_applicative G] {α β : Type v} (f : α → β) (x : functor.comp F G α) :
pure f <*> x = f <$> x
@[protected, instance]
theorem functor.comp.applicative_id_comp {F : Type u_1Type u_2} [AF : applicative F] [LF : is_lawful_applicative F] :
theorem functor.comp.applicative_comp_id {F : Type u_1Type u_2} [AF : applicative F] [LF : is_lawful_applicative F] :
@[protected, instance]
def functor.comp.is_comm_applicative {f : Type uType w} {g : Type vType u} [applicative f] [applicative g] [is_comm_applicative f] [is_comm_applicative g] :
theorem comp.seq_mk {α β : Type w} {f : Type uType v} {g : Type wType u} [applicative f] [applicative g] (h : f (g (α → β))) (x : f (g α)) :
@[protected, instance]
def functor.const.applicative {α : Type u_1} [has_one α] [has_mul α] :
Equations
@[protected, instance]
@[protected, instance]