module Cat.Cartesian whereCartesian categoriesπ
A Cartesian category is one that admits all binary products and a terminal object, hence all finite products.
record Cartesian-category {o β} (C : Precategory o β) : Type (o β β) where
  field
    products : has-products C
    terminal : Terminal C  open Cat.Reasoning   C          public
  open Binary-products C products public
  open Terminal          terminal publicmodule
  _ {o β o' β'} {C : Precategory o β} {D : Precategory o' β'}
    (F : Functor C D) (ccart : Cartesian-category C) (dcart : Cartesian-category D)
  where
  private
    module F = Cat.Functor.Reasoning F
    module C = Cartesian-category ccart
    module D = Cartesian-category dcartIf is a functor between Cartesian categories, we can define a product comparison map which is an isomorphism precisely when preserves products, in the coherent sense that the image under of a product diagram in i.e.Β the span becomes a product diagram in We say that is a Cartesian functor if it preserves the terminal object, and its product comparison map is an isomorphism.
  product-comparison : β a b β D.Hom (F.β (a C.ββ b)) (F.β a D.ββ F.β b)
  product-comparison a b = D.β¨ F.β C.Οβ , F.β C.Οβ β©
  record Cartesian-functor : Type (o β o' β β β β') where
    field
      pres-products : β a b β D.is-invertible (product-comparison a b)
      pres-terminal : is-terminal D (F.β C.top)
    image-is-product
      : β {a b} β is-product D {A = F.β a} {B = F.β b} (F.β C.Οβ) (F.β C.Οβ)
    image-is-product = is-product-iso-apex (pres-products _ _)
      D.Οβββ¨β© D.Οβββ¨β© D.has-is-product    module comparison {a} {b} = D.is-invertible (pres-products a b)
    module preserved  {a} {b} = is-product (image-is-product {a} {b})We can establish some useful algebraic properties of the
inverse of the comparison map, namely that composing it with
the projections
and
recovers the product projections in
This is a corollary of image-is-product.
    Οβinv : β {a} {b} β F.β C.Οβ D.β comparison.inv {a} {b} β‘ D.Οβ
    Οβinv =
      F.β C.Οβ D.β comparison.inv                       β‘β¨ apβ D._β_ refl (D.intror (sym (D.β¨β©-unique (D.idr _) (D.idr _)))) β©
      F.β C.Οβ D.β comparison.inv D.β D.β¨ D.Οβ , D.Οβ β© β‘β¨ preserved.Οβββ¨β© β©
      D.Οβ                                              β
    Οβinv : β {a} {b} β F.β C.Οβ D.β comparison.inv {a} {b} β‘ D.Οβ
    Οβinv =
      F.β C.Οβ D.β comparison.inv                       β‘β¨ apβ D._β_ refl (D.intror (sym (D.β¨β©-unique (D.idr _) (D.idr _)))) β©
      F.β C.Οβ D.β comparison.inv D.β D.β¨ D.Οβ , D.Οβ β© β‘β¨ preserved.Οβββ¨β© β©
      D.Οβ                                              βFinally, we can show that, if each product comparison map is an isomorphism, then this becomes a natural isomorphism between the two functors obtained by respectively taking a product in and applying and applying and taking a product in
    comparison-nat : is-natural-transformation
      (D.Γ-functor Fβ (F FΓ F)) (F Fβ C.Γ-functor)
      Ξ» (a , b) β comparison.inv {a} {b}
    comparison-nat (a , b) (a' , b') (f , g) = Product.uniqueβ
      record { has-is-product = image-is-product }
      preserved.Οβββ¨β© preserved.Οβββ¨β©
      (F.extendl C.Οβββ¨β© β apβ D._β_ refl Οβinv)
      (F.extendl C.Οβββ¨β© β apβ D._β_ refl Οβinv)