Anna Williams 3 February 2026
Definition of functor composition
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import MLTT.Spartan
open import Categories.Wild
open import Categories.Functor
open import Categories.Notation.Wild
open import Categories.Notation.Functor
module Categories.Functor-Composition where
\end{code}
We now define functor composition in the expected way.
\begin{code}
_Fâ_ : {A : WildCategory đ¤ đĽ}
{B : WildCategory đŚ đŁ}
{C : WildCategory đ¤' đĽ'}
(G' : Functor B C)
(F' : Functor A B)
â Functor A C
_Fâ_ {_} {_} {_} {_} {_} {_} {A} {B} {C} G' F' = combined-functor
where
open WildCategoryNotation A
open WildCategoryNotation B
open WildCategoryNotation C
open FunctorNotation F' renaming (functor-map to F)
open FunctorNotation G' renaming (functor-map to G)
Fâ : obj A â obj C
Fâ a = G (F a)
Fâ : {a b : obj A} â hom a b â hom (Fâ a) (Fâ b)
Fâ f = G (F f)
id-eq : (a : obj A)
â G (F đđ
) ďź đđ
id-eq a = G (F đđ
) ďźâ¨ i âŠ
G đđ
ďźâ¨ ii âŠ
đđ
â
where
i = ap G (id-preserved a)
ii = id-preserved (F a)
f-distrib : {a b c : obj A}
(g : hom b c)
(f : hom a b)
â G (F (g â f)) ďź G (F g) â G (F f)
f-distrib g f = G (F (g â f)) ďźâ¨ i âŠ
G (F g â F f) ďźâ¨ ii âŠ
G (F g) â G (F f) â
where
i = ap G (distributivity g f)
ii = distributivity (F g) (F f)
combined-functor : Functor A C
combined-functor = functor Fâ Fâ id-eq f-distrib
\end{code}