Documentation

Mathlib.Control.Applicative

applicative instances #

This file provides Applicative instances for concrete functors:

theorem Applicative.map_seq_map {F : Type u → Type v} [Applicative F] [LawfulApplicative F] {α : Type u} {β : Type u} {γ : Type u} {σ : Type u} (f : αβγ) (g : σβ) (x : F α) (y : F σ) :
(Seq.seq (f <$> x) fun (x : Unit) => g <$> y) = Seq.seq (((fun (x : βγ) => x g) f) <$> x) fun (x : Unit) => y
theorem Applicative.pure_seq_eq_map' {F : Type u → Type v} [Applicative F] [LawfulApplicative F] {α : Type u} {β : Type u} (f : αβ) :
(fun (x : F α) => Seq.seq (pure f) fun (x_1 : Unit) => x) = fun (x : F α) => f <$> x
theorem Applicative.ext {F : Type u → Type u_1} {A1 : Applicative F} {A2 : Applicative F} [LawfulApplicative F] [LawfulApplicative F] :
(∀ {α : Type u} (x : α), pure x = pure x)(∀ {α β : Type u} (f : F (αβ)) (x : F α), (Seq.seq f fun (x_1 : Unit) => x) = Seq.seq f fun (x_1 : Unit) => x)A1 = A2
theorem Functor.Comp.map_pure {F : Type u → Type w} {G : Type v → Type u} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G] {α : Type v} {β : Type v} (f : αβ) (x : α) :
f <$> pure x = pure (f x)
theorem Functor.Comp.seq_pure {F : Type u → Type w} {G : Type v → Type u} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G] {α : Type v} {β : Type v} (f : Functor.Comp F G (αβ)) (x : α) :
(Seq.seq f fun (x_1 : Unit) => pure x) = (fun (g : αβ) => g x) <$> f
theorem Functor.Comp.seq_assoc {F : Type u → Type w} {G : Type v → Type u} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G] {α : Type v} {β : Type v} {γ : Type v} (x : Functor.Comp F G α) (f : Functor.Comp F G (αβ)) (g : Functor.Comp F G (βγ)) :
(Seq.seq g fun (x_1 : Unit) => Seq.seq f fun (x_2 : Unit) => x) = Seq.seq (Seq.seq (Function.comp <$> g) fun (x : Unit) => f) fun (x_1 : Unit) => x
theorem Functor.Comp.pure_seq_eq_map {F : Type u → Type w} {G : Type v → Type u} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G] {α : Type v} {β : Type v} (f : αβ) (x : Functor.Comp F G α) :
(Seq.seq (pure f) fun (x_1 : Unit) => x) = f <$> x
theorem Functor.Comp.applicative_id_comp {F : Type u_1 → Type u_2} [AF : Applicative F] [LawfulApplicative F] :
Functor.Comp.instApplicativeComp = AF
theorem Functor.Comp.applicative_comp_id {F : Type u_1 → Type u_2} [AF : Applicative F] [LawfulApplicative F] :
Functor.Comp.instApplicativeComp = AF
theorem Comp.seq_mk {α : Type w} {β : Type w} {f : Type u → Type v} {g : Type w → Type u} [Applicative f] [Applicative g] (h : f (g (αβ))) (x : f (g α)) :
(Seq.seq (Functor.Comp.mk h) fun (x_1 : Unit) => Functor.Comp.mk x) = Functor.Comp.mk (Seq.seq ((fun (x1 : g (αβ)) (x2 : g α) => Seq.seq x1 fun (x : Unit) => x2) <$> h) fun (x_1 : Unit) => x)
Equations
  • instApplicativeConstOfOneOfMul = Applicative.mk
Equations
  • =
Equations
  • instApplicativeAddConstOfZeroOfAdd = Applicative.mk