mathlib documentation

control.bifunctor

Functors with two arguments #

This file defines bifunctors.

A bifunctor is a function F : Type* → Type* → Type* along with a bimap which turns F α β into F α' β' given two functions α → α' and β → β'. It further

Main declarations #

@[class]
structure bifunctor (F : Type u₀Type u₁Type u₂) :
Type (max (u₀+1) (u₁+1) u₂)
  • bimap : Π {α α' : Type ?} {β β' : Type ?}, (α → α')(β → β')F α βF α' β'

Lawless bifunctor. This typeclass only holds the data for the bimap.

Instances
@[class]
structure is_lawful_bifunctor (F : Type u₀Type u₁Type u₂) [bifunctor F] :
Type
  • id_bimap : ∀ {α : Type ?} {β : Type ?} (x : F α β), bimap id id x = x
  • bimap_bimap : ∀ {α₀ α₁ α₂ : Type ?} {β₀ β₁ β₂ : Type ?} (f : α₀ → α₁) (f' : α₁ → α₂) (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α₀ β₀), bimap f' g' (bimap f g x) = bimap (f' f) (g' g) x

Bifunctor. This typeclass asserts that a lawless bifunctor is lawful.

Instances
theorem is_lawful_bifunctor.bimap_id_id {F : Type l_3Type l_2Type l_1} [bifunctor F] [self : is_lawful_bifunctor F] {α : Type l_3} {β : Type l_2} :
theorem is_lawful_bifunctor.bimap_comp_bimap {F : Type l_3Type l_2Type l_1} [bifunctor F] [self : is_lawful_bifunctor F] {α₀ α₁ α₂ : Type l_3} {β₀ β₁ β₂ : Type l_2} (f : α₀ → α₁) (f' : α₁ → α₂) (g : β₀ → β₁) (g' : β₁ → β₂) :
bimap f' g' bimap f g = bimap (f' f) (g' g)
def bifunctor.fst {F : Type u₀Type u₁Type u₂} [bifunctor F] {α α' : Type u₀} {β : Type u₁} (f : α → α') :
F α βF α' β

Left map of a bifunctor.

Equations
def bifunctor.snd {F : Type u₀Type u₁Type u₂} [bifunctor F] {α : Type u₀} {β β' : Type u₁} (f : β → β') :
F α βF α β'

Right map of a bifunctor.

Equations
theorem bifunctor.id_fst {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α : Type u₀} {β : Type u₁} (x : F α β) :
theorem bifunctor.fst_id {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α : Type l_3} {β : Type l_2} :
theorem bifunctor.snd_id {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α : Type l_3} {β : Type l_2} :
theorem bifunctor.id_snd {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α : Type u₀} {β : Type u₁} (x : F α β) :
theorem bifunctor.fst_comp_fst {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ α₂ : Type l_3} {β : Type l_2} (f : α₀ → α₁) (f' : α₁ → α₂) :
theorem bifunctor.comp_fst {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ α₂ : Type u₀} {β : Type u₁} (f : α₀ → α₁) (f' : α₁ → α₂) (x : F α₀ β) :
theorem bifunctor.fst_snd {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ : Type u₀} {β₀ β₁ : Type u₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) :
theorem bifunctor.fst_comp_snd {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ : Type l_3} {β₀ β₁ : Type l_2} (f : α₀ → α₁) (f' : β₀ → β₁) :
theorem bifunctor.snd_comp_fst {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ : Type l_3} {β₀ β₁ : Type l_2} (f : α₀ → α₁) (f' : β₀ → β₁) :
theorem bifunctor.snd_fst {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α₀ α₁ : Type u₀} {β₀ β₁ : Type u₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) :
theorem bifunctor.snd_comp_snd {F : Type l_3Type l_2Type l_1} [bifunctor F] [is_lawful_bifunctor F] {α : Type l_3} {β₀ β₁ β₂ : Type l_2} (g : β₀ → β₁) (g' : β₁ → β₂) :
theorem bifunctor.comp_snd {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α : Type u₀} {β₀ β₁ β₂ : Type u₁} (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α β₀) :
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
  • bifunctor.const = {bimap := λ (α α' : Type u_1) (β β_1 : Type u_2) (f : α → α') (_x : β → β_1), f}
@[protected, instance]
Equations
@[protected, instance]
def bifunctor.flip {F : Type u₀Type u₁Type u₂} [bifunctor F] :
Equations
@[protected, instance]
def is_lawful_bifunctor.flip {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] :
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
def bifunctor.functor {F : Type u₀Type u₁Type u₂} [bifunctor F] {α : Type u₀} :
functor (F α)
Equations
@[protected, instance]
def bifunctor.is_lawful_functor {F : Type u₀Type u₁Type u₂} [bifunctor F] [is_lawful_bifunctor F] {α : Type u₀} :
@[protected, instance]
def function.bicompl.bifunctor {F : Type u₀Type u₁Type u₂} [bifunctor F] (G : Type u_1Type u₀) (H : Type u_2Type u₁) [functor G] [functor H] :
Equations
@[protected, instance]
def function.bicompl.is_lawful_bifunctor {F : Type u₀Type u₁Type u₂} [bifunctor F] (G : Type u_1Type u₀) (H : Type u_2Type u₁) [functor G] [functor H] [is_lawful_functor G] [is_lawful_functor H] [is_lawful_bifunctor F] :
Equations
@[protected, instance]
def function.bicompr.bifunctor {F : Type u₀Type u₁Type u₂} [bifunctor F] (G : Type u₂Type u_1) [functor G] :
Equations
@[protected, instance]
def function.bicompr.is_lawful_bifunctor {F : Type u₀Type u₁Type u₂} [bifunctor F] (G : Type u₂Type u_1) [functor G] [is_lawful_functor G] [is_lawful_bifunctor F] :
Equations