{-# OPTIONS --without-K --safe #-}
open import Categories.Bicategory using (Bicategory)
module Categories.Bicategory.Opposite where
open import Data.Product using (_,_)
import Categories.Bicategory.Extras as BicategoryExtras
open import Categories.Category using (Category)
import Categories.Category.Cartesian as Cartesian
import Categories.Morphism as Morphism
import Categories.Morphism.Reasoning as MorphismReasoning
open import Categories.Category.Product using (Swap)
open import Categories.Functor using (Functor; _∘F_)
open import Categories.NaturalTransformation.NaturalIsomorphism
using (NaturalIsomorphism; niHelper)
module _ {o ℓ e t} (C : Bicategory o ℓ e t) where
open BicategoryExtras C
open Shorthands
private
module MR {A} {B} where
open Morphism (hom A B) public using (module ≅)
open MorphismReasoning (hom A B) public using (switch-tofromʳ)
open MR
op : Bicategory o ℓ e t
op = record
{ enriched = record
{ Obj = Obj
; hom = λ A B → hom B A
; id = id
; ⊚ = ⊚ ∘F Swap
; ⊚-assoc = niHelper (record
{ η = λ{ ((f , g) , h) → ⊚-assoc.⇐.η ((h , g) , f) }
; η⁻¹ = λ{ ((f , g) , h) → ⊚-assoc.⇒.η ((h , g) , f) }
; commute = λ{ ((α , β) , γ) → ⊚-assoc.⇐.commute ((γ , β) , α) }
; iso = λ _ → record
{ isoˡ = ⊚-assoc.iso.isoʳ _ ; isoʳ = ⊚-assoc.iso.isoˡ _ }
})
; unitˡ = niHelper (record
{ η = λ{ (_ , g) → unitʳ.⇒.η (g , _) }
; η⁻¹ = λ{ (_ , g) → unitʳ.⇐.η (g , _) }
; commute = λ{ (_ , β) → unitʳ.⇒.commute (β , _) }
; iso = λ{ (_ , g) → record
{ isoˡ = unitʳ.iso.isoˡ (g , _) ; isoʳ = unitʳ.iso.isoʳ (g , _) } }
})
; unitʳ = niHelper (record
{ η = λ{ (f , _) → unitˡ.⇒.η (_ , f) }
; η⁻¹ = λ{ (f , _) → unitˡ.⇐.η (_ , f) }
; commute = λ{ (α , _) → unitˡ.⇒.commute (_ , α) }
; iso = λ{ (f , _) → record
{ isoˡ = unitˡ.iso.isoˡ (_ , f) ; isoʳ = unitˡ.iso.isoʳ (_ , f) } }
})
}
; triangle = λ {_ _ _ f g} → begin
ρ⇒ ◁ g ∘ᵥ α⇐ ≈˘⟨ switch-tofromʳ (≅.sym associator) triangle ⟩
f ▷ λ⇒ ∎
; pentagon = λ {_ _ _ _ _ f g h i} → begin
α⇐ ◁ i ∘ᵥ α⇐ ∘ᵥ f ▷ α⇐ ≈˘⟨ hom.assoc ⟩
(α⇐ ◁ i ∘ᵥ α⇐) ∘ᵥ f ▷ α⇐ ≈⟨ pentagon-inv ⟩
α⇐ ∘ᵥ α⇐ ∎
}
where open hom.HomReasoning
co : Bicategory o ℓ e t
co = record
{ enriched = record
{ Obj = Obj
; hom = λ A B → Category.op (hom A B)
; id = Functor.op id
; ⊚ = Functor.op ⊚
; ⊚-assoc = NaturalIsomorphism.op′ ⊚-assoc
; unitˡ = NaturalIsomorphism.op′ unitˡ
; unitʳ = NaturalIsomorphism.op′ unitʳ
}
; triangle = triangle-inv
; pentagon = pentagon-inv
}
coop : ∀ {o ℓ e t} → Bicategory o ℓ e t → Bicategory o ℓ e t
coop C = co (op C)