Given categories and , their product has objects pairs and morphisms pairs with and ; composition and identities are componentwise: , (7S Exercise 3.90).
Sources: 7 Sketches Example 3.89, Exercise 3.90, Example 1.56; DaoFP §8.1 (“Product categories”), §10.1–10.2; Product of Enriched Categories.
- ; for preorders the product category is the Product Preorder (7S Exercise 3.90).
- is the Product in , and , the Functor Category from the discrete two-object category; hence the Diagonal Functor is the constant-diagram functor and (DaoFP §10.2).
- Functors out of are bifunctors; functors are profunctors, e.g. the Hom Functor. is cartesian closed: (DaoFP §10.1), which is how the Yoneda Embedding is obtained by currying the hom-functor.
Docs: ThCategory (GATlab)
Builds on: Category (Category) — run that note’s Julia code first.
struct ProductCat{C<:Category, D<:Category} <: Category{Tuple, Tuple}
c::C; d::D
end
Categories.dom(p::ProductCat, (f, g)) = (dom(p.c, f), dom(p.d, g))
Categories.codom(p::ProductCat, (f, g)) = (codom(p.c, f), codom(p.d, g))
Categories.compose(p::ProductCat, (f, g), (f′, g′)) = (compose(p.c, f, f′), compose(p.d, g, g′))
Categories.id(p::ProductCat, (x, y)) = (id(p.c, x), id(p.d, y))#check CategoryTheory.prod -- instance : Category (C × D), morphisms are pairs
#check CategoryTheory.Functor.prod
example {C D : Type} [CategoryTheory.Category C] [CategoryTheory.Category D] :
CategoryTheory.Category (C × D) := inferInstance-- the product of two categories: pairs of arrows
newtype (cat1 :*: cat2) (a, b) (c, d) = ProdArr (cat1 a c, cat2 b d)
-- with componentwise identity and composition