module Cat.Functor.Adjoint.Compose

Composition of adjunctionsπŸ”—

Suppose we have four functors and such that they β€œfit together”, i.e.Β the composites and both exist. What can we say about their composites? The hope is that they would again be adjoints, and this is indeed the case.

We prove this here by explicitly exhibiting the adjunction natural transformations and the triangle identities, which is definitely suboptimal for readability, but is the most efficient choice in terms of the resulting Agda program.

    {o β„“ oβ‚‚ β„“β‚‚ o₃ ℓ₃}
    {A : Precategory o β„“} {B : Precategory oβ‚‚ β„“β‚‚}
    {C : Precategory o₃ ℓ₃}
    {F : Functor A B} {G : Functor B A}
    {L : Functor B C} {R : Functor C B}
    (F⊣G : F ⊣ G)
    (L⊣R : L ⊣ R)
  where
LF⊣GR : (L F∘ F) ⊣ (G F∘ R)
LF⊣GR .unit .Ξ· x          = G.₁ (lr.Ξ· _) A.∘ fg.Ξ· _
LF⊣GR .counit .Ξ· x        = lr.Ξ΅ _ C.∘ L.₁ (fg.Ξ΅ _)

LF⊣GR .unit .is-natural x y f =
  (G.₁ (lr.Ξ· _) A.∘ fg.Ξ· _) A.∘ f                β‰‘βŸ¨ A.pullr (fg.unit.is-natural _ _ _) βŸ©β‰‘
  G.₁ (lr.Ξ· _) A.∘ G.₁ (F.₁ f) A.∘ fg.Ξ· _        β‰‘βŸ¨ A.pulll (sym (G.F-∘ _ _)) βŸ©β‰‘
  G.₁ ⌜ lr.Ξ· _ B.∘ F.₁ f ⌝ A.∘ fg.Ξ· _            β‰‘βŸ¨ apβ‚‚ A._∘_ (ap G.₁ (lr.unit.is-natural _ _ _)) refl βŸ©β‰‘
  G.₁ (R.₁ (L.₁ (F.₁ f)) B.∘ lr.Ξ· _) A.∘ fg.Ξ· _  β‰‘βŸ¨ A.pushl (G.F-∘ _ _) βŸ©β‰‘
  GR.₁ (LF.₁ f) A.∘ G.₁ (lr.Ξ· _) A.∘ (fg.Ξ· _)    ∎

LF⊣GR .counit .is-natural x y f =
  (lr.Ξ΅ _ C.∘ L.₁ (fg.Ξ΅ _)) C.∘ LF.₁ (GR.₁ f) β‰‘βŸ¨ C.pullr (sym (L.F-∘ _ _)) βŸ©β‰‘
  lr.Ξ΅ _ C.∘ L.₁ ⌜ fg.Ξ΅ _ B.∘ F.₁ (GR.₁ f) ⌝  β‰‘βŸ¨ apβ‚‚ C._∘_ refl (ap L.₁ (fg.counit.is-natural _ _ _)) βŸ©β‰‘
  lr.Ξ΅ _ C.∘ ⌜ L.₁ (R.F₁ f B.∘ fg.Ξ΅ _) ⌝      β‰‘βŸ¨ apβ‚‚ C._∘_ refl (L.F-∘ _ _) βŸ©β‰‘
  lr.Ξ΅ _ C.∘ L.₁ (R.F₁ f) C.∘ L.₁ (fg.Ξ΅ _)    β‰‘βŸ¨ C.extendl (lr.counit.is-natural _ _ _) βŸ©β‰‘
  f C.∘ lr.Ξ΅ _ C.∘ L.₁ (fg.Ξ΅ _)               ∎

LF⊣GR .zig =
  (lr.Ξ΅ _ C.∘ L.₁ (fg.Ξ΅ _)) C.∘ ⌜ LF.₁ (G.₁ (lr.Ξ· _) A.∘ fg.Ξ· _) ⌝ β‰‘βŸ¨ C.extendr (apβ‚‚ C._∘_ refl (LF.F-∘ _ _) βˆ™ L.extendl (fg.counit.is-natural _ _ _)) βŸ©β‰‘
  (lr.Ξ΅ _ C.∘ L.₁ (lr.Ξ· _)) C.∘ (L.₁ (fg.Ξ΅ _) C.∘ LF.₁ (fg.Ξ· _))   β‰‘βŸ¨ C.elimr (L.annihilate fg.zig) βŸ©β‰‘
  lr.Ξ΅ _ C.∘ L.₁ (lr.Ξ· _)                                          β‰‘βŸ¨ lr.zig βŸ©β‰‘
  C.id                                                             ∎

LF⊣GR .zag =
  GR.₁ (lr.Ξ΅ _ C.∘ L.₁ (fg.Ξ΅ _)) A.∘ G.₁ (lr.Ξ· _) A.∘ fg.Ξ· _ β‰‘βŸ¨ A.pulll (G.collapse (B.pushl (R.F-∘ _ _) βˆ™ apβ‚‚ B._∘_ refl (sym (lr.unit.is-natural _ _ _)))) βŸ©β‰‘
  G.₁ (⌜ R.₁ (lr.Ξ΅ _) B.∘ lr.Ξ· _ B.∘ fg.Ξ΅ _ ⌝) A.∘ fg.Ξ· _    β‰‘βŸ¨ apβ‚‚ A._∘_ (ap G.₁ (B.cancell lr.zag)) refl βŸ©β‰‘
  G.₁ (fg.Ξ΅ _) A.∘ fg.Ξ· _                                    β‰‘βŸ¨ fg.zag βŸ©β‰‘
  A.id                                                       ∎