open import Cat.Displayed.Diagram.Total.Terminal
open import Cat.Displayed.Diagram.Total.Product
open import Cat.Diagram.Exponential
open import Cat.Displayed.Base
open import Cat.Cartesian
open import Cat.Prelude

import Cat.Displayed.Reasoning
module Cat.Displayed.Diagram.Total.Exponential
  {o β„“ o' β„“'} {B : Precategory o β„“} (E : Displayed B o' β„“')
  {bcart : Cartesian-category B} (ecart : Cartesian-over E bcart)
  where
open Cat.Displayed.Reasoning E
open Cartesian-category bcart
open Cartesian-over ecart

Total exponential objectsπŸ”—

Let be a displayed category with total products over a Cartesian category and be the evaluation map for an exponential object in

A map is the evaluation map for a total exponential object in if we have an operation assigning to each a universal morphism with uniqueness and commutativity lying over those for

This definition follows the logic of β€œtotal universal constructions”, where we can display universal constructions in over the corresponding constructions in and this is equivalent to the total category having, and the projection functor preserving, those same constructions.

module
  _ {A B B^A : Ob} {ev : Hom (B^A βŠ—β‚€ A) B}
    (exp : is-exponential _ bcart B^A ev)
    {A' : E Κ» A} {B' : E Κ» B} (B^A' : E Κ» B^A)
  where
  record is-exponential-over (ev' : Hom[ ev ] (B^A' βŠ—β‚€' A') B')
    : Type (o βŠ” β„“ βŠ” o' βŠ” β„“') where
    open is-exponential exp

    field
      Ζ›'
        : βˆ€ {Ξ“ Ξ“'} {m : Hom (Ξ“ βŠ—β‚€ A) B} (m' : Hom[ m ] (Ξ“' βŠ—β‚€' A') B')
        β†’ Hom[ Ζ› m ] Ξ“' B^A'

      commutes'
        : βˆ€ {Ξ“ Ξ“'} {m : Hom (Ξ“ βŠ—β‚€ A) B} (m' : Hom[ m ] (Ξ“' βŠ—β‚€' A') B')
        β†’ ev' ∘' ⟨ Ζ›' m' ∘' π₁' , id' ∘' Ο€β‚‚' ⟩' ≑[ commutes m ] m'

      unique'
        : βˆ€ {Ξ“ Ξ“'} {m : Hom (Ξ“ βŠ—β‚€ _) _} {n}
        β†’ {p : ev ∘ (n βŠ—β‚ id) ≑ m}
        β†’ {m' : Hom[ m ] (Ξ“' βŠ—β‚€' _) _} (n' : Hom[ n ] Ξ“' _)
        β†’ ev' ∘' ⟨ n' ∘' π₁' , id' ∘' Ο€β‚‚' ⟩' ≑[ p ] m'
        β†’ n' ≑[ unique n p ] Ζ›' m'
module _ {A B : Ob} (exp : Exponential _ bcart A B) where
  open Exponential exp

  record ExponentialP (A' : E Κ» A) (B' : E Κ» B) : Type (o βŠ” β„“ βŠ” o' βŠ” β„“') where
    no-eta-equality
    field
      B^A'                : E Κ» B^A
      ev'                 : Hom[ ev ] (B^A' βŠ—β‚€' A') B'
      has-is-exponential' : is-exponential-over has-is-exp B^A' ev'

    open is-exponential-over has-is-exponential' public

Cartesian-closed-over : Cartesian-closed B bcart β†’ Type _
Cartesian-closed-over cc =
  let open Cartesian-closed cc
   in βˆ€ {A B} (A' : E Κ» A) (B' : E Κ» B) β†’ ExponentialP (has-exp A B) A' B'

module Cartesian-closed-over {cc : Cartesian-closed B bcart} (cco : Cartesian-closed-over cc) where
  module _ {a b : Ob} (a' : E Κ» a) (b' : E Κ» b) where open ExponentialP (cco a' b') renaming (B^A' to [_,_]') using () public
  module _ {a b : Ob} {a' : E Κ» a} {b' : E Κ» b} where open ExponentialP (cco a' b') renaming (unique' to Ζ›'-unique) hiding (B^A') public