The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Control.Applicative

17 declarations. Mathlib docs · Source

applicative instances

This file provides Applicative instances for concrete functors:

  • id
  • Functor.comp
  • Functor.const
  • Functor.add_const

theorem Applicative.map_seq_map E0 #

∀ {F : Type u → Type v} [inst : Applicative F] [LawfulApplicative F] {α β γ σ : Type u} (f : α → β → γ) (g : σ → β)
  (x : F α) (y : F σ), f <$> x <*> g <$> y = ((fun x ↦ x ∘ g) ∘ f) <$> x <*> y

theorem Applicative.pure_seq_eq_map' E1 #

∀ {F : Type u → Type v} [inst : Applicative F] [LawfulApplicative F] {α β : Type u} (f : α → β),
  (fun x ↦ pure f <*> x) = fun x ↦ f <$> x

theorem Applicative.ext E1 #

∀ {F : Type u → Type u_1} {A1 A2 : Applicative F} [LawfulApplicative F] [LawfulApplicative F],
  (∀ {α : Type u} (x : α), pure x = pure x) → (∀ {α β : Type u} (f : F (α → β)) (x : F α), f <*> x = f <*> x) → A1 = A2

instance instCommApplicativeId E0 #

CommApplicative Id

theorem Functor.Comp.map_pure E0 #

∀ {F : Type u → Type w} {G : Type v → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative F]
  [LawfulApplicative G] {α β : Type v} (f : α → β) (x : α), f <$> pure x = pure (f x)

theorem Functor.Comp.seq_pure E1 #

∀ {F : Type u → Type w} {G : Type v → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative F]
  [LawfulApplicative G] {α β : Type v} (f : Functor.Comp F G (α → β)) (x : α), f <*> pure x = (fun g ↦ g x) <$> f

theorem Functor.Comp.seq_assoc E1 #

∀ {F : Type u → Type w} {G : Type v → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative F]
  [LawfulApplicative 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 E1 #

∀ {F : Type u → Type w} {G : Type v → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative F]
  [LawfulApplicative G] {α β : Type v} (f : α → β) (x : Functor.Comp F G α), pure f <*> x = f <$> x

instance Functor.Comp.instLawfulApplicativeComp E0 #

∀ {F : Type u → Type w} {G : Type v → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative F]
  [LawfulApplicative G], LawfulApplicative (Functor.Comp F G)

theorem Functor.Comp.applicative_id_comp E1 #

∀ {F : Type u_1 → Type u_2} [AF : Applicative F] [LawfulApplicative F], Functor.Comp.instApplicativeComp = AF

theorem Functor.Comp.applicative_comp_id E1 #

∀ {F : Type u_1 → Type u_2} [AF : Applicative F] [LawfulApplicative F], Functor.Comp.instApplicativeComp = AF

instance Functor.Comp.instCommApplicative E0 #

∀ {f : Type u → Type w} {g : Type v → Type u} [inst : Applicative f] [inst_1 : Applicative g] [CommApplicative f]
  [CommApplicative g], CommApplicative (Functor.Comp f g)

theorem Comp.seq_mk E0 #

∀ {α β : Type w} {f : Type u → Type v} {g : Type w → Type u} [inst : Applicative f] [inst_1 : Applicative g]
  (h : f (g (α → β))) (x : f (g α)),
  Functor.Comp.mk h <*> Functor.Comp.mk x = Functor.Comp.mk ((fun x1 x2 ↦ x1 <*> x2) <$> h <*> x)

instance instApplicativeConstOfOneOfMul E0 #

{α : Type u_1} → [One α] → [Mul α] → Applicative (Functor.Const α)

instance instLawfulApplicativeConst E0 #

∀ {α : Type u_1} [inst : Monoid α], LawfulApplicative (Functor.Const α)

instance instApplicativeAddConstOfZeroOfAdd E0 #

{α : Type u_1} → [Zero α] → [Add α] → Applicative (Functor.AddConst α)

instance instLawfulApplicativeAddConst E0 #

∀ {α : Type u_1} [inst : AddMonoid α], LawfulApplicative (Functor.AddConst α)