module Cat.Instances.Twisted where

Twisted arrow categories🔗

The category of arrows of is the category which has objects given by morphisms 1, and morphisms given by pairs as indicated making the diagram below commute.

Now, add a twist. Literally! Invert the direction of the morphism in the definition above. The resulting category is the twisted arrow category of written You can think of a morphism in as a factorisation of through

module _ {o } (C : Precategory o ) where
  open Precategory C
  open Cat.Functor.Hom C

  record Twist {a₀ a₁ b₀ b₁} (f : Hom a₀ a₁) (g : Hom b₀ b₁) : Type  where
    constructor twist
    no-eta-equality
    field
      before : Hom b₀ a₀
      after  : Hom a₁ b₁
      commutes : after  f  before  g
  Twisted : Precategory (o  ) 
  Twisted .Precategory.Ob = Σ[ (a , b)  Ob × Ob ] Hom a b
  Twisted .Precategory.Hom (_ , f) (_ , g) = Twist f g
  Twisted .Precategory.Hom-set (_ , f) (_ , g) = Iso→is-hlevel! 2 eqv
  Twisted .Precategory.id = record
    { before   = id ; after    = id ; commutes = idl _  idr _ }
  Twisted .Precategory._∘_ t1 t2 .Twist.before = t2 .Twist.before  t1 .Twist.before
  Twisted .Precategory._∘_ t1 t2 .Twist.after   = t1 .Twist.after  t2 .Twist.after

Note that the twisted arrow category is equivalently the covariant category of elements of the Hom functor:

  Twisted≡∫Hom : Twisted   Hom[-,-]
  Twisted≡∫Hom = Precategory-path F F-precat-iso where
    open Element
    open Element-hom
    open is-precat-iso

    F : Functor Twisted ( Hom[-,-])
    F .F₀ a    = elem (a .fst) (a .snd)
    F .F₁ f    = elem-hom (f .before , f .after) (f .commutes)
    F .F-id    = trivial!
    F .F-∘ f g = trivial!

    F-precat-iso : is-precat-iso F
    F-precat-iso .has-is-ff = injective-surjective→is-equiv!
       p  Twist-path (ap (fst  hom) p) (ap (snd  hom) p))
      λ f  inc (twist (f .hom .fst) (f .hom .snd) (f .commute) , trivial!)
    F-precat-iso .has-is-iso = is-iso→is-equiv (iso
       e  e .ob , e .section)
       e  refl) λ e  refl)

The twisted arrow category admits a forgetful functor which sends each arrow to the pair and forgets the commutativity datum for the diagram. Since commutativity of diagrams is a property (rather than structure), this inclusion functor is faithful, though it is not full.

  πₜ : Functor Twisted (C ^op ×ᶜ C)
  πₜ .F₀   = fst
  πₜ .F₁ f = Twist.before f , Twist.after f
  πₜ .F-id    = refl
  πₜ .F-∘ f g = refl

module _ {o  o' ℓ'} {C : Precategory o } {D : Precategory o' ℓ'} where
  open Functor
  open Twist

  twistᵒᵖ : Functor (C ^op ×ᶜ C) D  Functor (Twisted (C ^op) ^op) D
  twistᵒᵖ F .F₀ ((a , b) , _) = F .F₀ (a , b)
  twistᵒᵖ F .F₁ arr  = F .F₁ (arr .before , arr .after)
  twistᵒᵖ F .F-id    = F .F-id
  twistᵒᵖ F .F-∘ f g = F .F-∘ _ _

  1. We will metonymically refer to the triple using simply ↩︎