module Cat.Internal.Opposite {o β} {C : Precategory o β} where
Opposites of internal categoriesπ
We can take the opposite of an internal category, by flipping the source and target morphisms. We begin by defining a little helper function that flips internal morphisms.
op-ihom : β {Cβ Cβ Ξ} {src tgt : Hom Cβ Cβ} {x y : Hom Ξ Cβ} β Internal-hom src tgt x y β Internal-hom tgt src y x op-ihom f .ihom = f .ihom op-ihom f .has-src = f .has-tgt op-ihom f .has-tgt = f .has-src op-ihom-nat : β {Cβ Cβ Ξ Ξ} {src tgt : Hom Cβ Cβ} {x y : Hom Ξ Cβ} β (f : Internal-hom src tgt x y) β (Ο : Hom Ξ Ξ) β op-ihom f [ Ο ] β‘ op-ihom (f [ Ο ]) op-ihom-nat f _ = Internal-hom-path refl
op-ihom-involutive : β {Cβ Cβ Ξ} {src tgt : Hom Cβ Cβ} {x y : Hom Ξ Cβ} β {f : Internal-hom src tgt x y} β op-ihom (op-ihom f) β‘ f op-ihom-involutive = Internal-hom-path refl
Showing that this operation yields an internal category is a routine calculation.
Internal-cat-on-opi : β {Cβ Cβ} {src tgt : Hom Cβ Cβ} β Internal-cat-on src tgt β Internal-cat-on tgt src Internal-cat-on-opi β = icat-opi-on where open Internal-cat-on module β = Internal-cat-on β icat-opi-on : Internal-cat-on _ _ icat-opi-on .idi x = op-ihom (β.idi x) icat-opi-on ._βi_ f g = op-ihom (op-ihom g β.βi op-ihom f) icat-opi-on .idli f = op-ihom (op-ihom f β.βi β op-ihom (op-ihom (β.idi _)) β) β‘β¨ ap! op-ihom-involutive β©β‘ op-ihom β op-ihom f β.βi β.idi _ β β‘β¨ ap! (β.idri (op-ihom f)) β©β‘ op-ihom (op-ihom f) β‘β¨ op-ihom-involutive β©β‘ f β icat-opi-on .idri f = ap op-ihom (apβ β._βi_ op-ihom-involutive refl β β.idli _) β op-ihom-involutive icat-opi-on .associ f g h = op-ihom (β op-ihom (op-ihom (op-ihom h β.βi op-ihom g)) β β.βi op-ihom f) β‘β¨ ap! op-ihom-involutive β©β‘ op-ihom β (op-ihom h β.βi op-ihom g) β.βi op-ihom f β β‘β¨ ap! (sym (β.associ _ _ _)) β©β‘ op-ihom β op-ihom h β.βi op-ihom g β.βi op-ihom f β β‘β¨ apΒ‘ (sym op-ihom-involutive) β©β‘ op-ihom (op-ihom h β.βi β op-ihom (op-ihom (op-ihom g β.βi op-ihom f)) β) β icat-opi-on .idi-nat Ο = op-ihom-nat (β.idi _) Ο β ap op-ihom (β.idi-nat Ο) icat-opi-on .βi-nat f g Ο = op-ihom-nat (op-ihom g β.βi op-ihom f) Ο β ap op-ihom ((β.βi-nat (op-ihom g) (op-ihom f) Ο) β apβ β._βi_ (op-ihom-nat g Ο) (op-ihom-nat f Ο)) _^opi : Internal-cat β Internal-cat β ^opi = op-icat where open Internal-cat op-icat : Internal-cat op-icat .Cβ = β .Cβ op-icat .Cβ = β .Cβ op-icat .src = β .tgt op-icat .tgt = β .src op-icat .has-internal-cat = Internal-cat-on-opi (β .has-internal-cat) infixl 60 _^opi