Product of Categories

Given two categories , the product category combines both by having using the catesian product of objects in and for its set of objects, and the cartesian product of morphisms in and for its set of morphisms.

Definition

The product category has

  • objects
  • morphisms
  • identity given by the pair of identity morphisms
  • composition given by the pair of the composition of morphisms in and

In this definition is the cartesian product in and is the product of categories. We reproduce this convention in Idris.

(×) : Category o -> Category p -> Category (o * p)
(×) x y = MkCategory
  (\a, b => ((~:>) x a.π1 b.π1) * ((~:>) y a.π2 b.π2))
  (\v => x.id v.π1 && y.id v.π2)
  (\f, g => (|:>) x f.π1 g.π1 && (|:>) y f.π2 g.π2)
  (\_, _, idl => cong2 (&&)
      (x.idRight _ _ idl.π1)
      (y.idRight _ _ idl.π2) `trans` Data.Product.projIdentity idl
  )
  (\_, _, idr => cong2 (&&)
      (x.idLeft  _ _ idr.π1)
      (y.idLeft  _ _ idr.π2) `trans` Data.Product.projIdentity idr
  )
  (\_, _, _, _, f, g, h => cong2 (&&)
      (compAssoc x _ _ _ _ f.π1 g.π1 h.π1)
      (compAssoc y _ _ _ _ f.π2 g.π2 h.π2)
  )