{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core using (Category)
module Categories.Category.CartesianClosed.Canonical {o β e} (π : Category o β e) where
open import Level using (levelOfTerm)
open import Function using (flip)
open import Categories.Category.BinaryProducts π
open import Categories.Category.Cartesian π using (Cartesian)
import Categories.Category.CartesianClosed π as π-CC
import Categories.Object.Exponential.Canonical as Exponentials
open import Categories.Object.Product π
open import Categories.Object.Terminal π using (Terminal)
open import Categories.Morphism.Reasoning π
private
open Category π
open HomReasoning
variable
A B C : Obj
f g h : A β B
record CartesianClosed : Set (levelOfTerm π) where
infixr 7 _Γ_
infixr 9 _^_
infix 10 β¨_,_β©
field
β€ : Obj
_Γ_ : Obj β Obj β Obj
! : A β β€
Οβ : A Γ B β A
Οβ : A Γ B β B
β¨_,_β© : C β A β C β B β C β A Γ B
!-unique : (f : A β β€) β ! β f
Οβ-comp : Οβ β β¨ f , g β© β f
Οβ-comp : Οβ β β¨ f , g β© β g
β¨,β©-unique : β {f g} {h : C β A Γ B} β
Οβ β h β f β Οβ β h β g β β¨ f , g β© β h
β€-terminal : Terminal
β€-terminal = record { β€-is-terminal = record { !-unique = !-unique } }
Γ-product : β {A B} β Product A B
Γ-product {A} {B} =
record { projectβ = Οβ-comp; projectβ = Οβ-comp; unique = β¨,β©-unique }
isCartesian : Cartesian
isCartesian = record
{ terminal = β€-terminal
; products = record { product = Γ-product }
}
open Cartesian isCartesian using (_β_)
open Exponentials isCartesian using (Exponential)
field
_^_ : Obj β Obj β Obj
eval : B ^ A Γ A β B
curry : C Γ A β B β C β B ^ A
eval-comp : eval β (curry f β id) β f
curry-unique : eval β (f β id) β g β f β curry g
curry-resp-β : f β g β curry f β curry g
curry-resp-β fβg = curry-unique (eval-comp β fβg)
^-exponential : β {A B} β Exponential A B
^-exponential {A} {B} = record
{ B^A = B ^ A
; eval = eval
; Ξ»g = Ξ» f β curry f
; Ξ² = eval-comp
; Ξ»-unique = curry-unique
}
module Equivalence where
open π-CC using () renaming (CartesianClosed to CartesianClosedβ²)
fromCanonical : CartesianClosed β CartesianClosedβ²
fromCanonical cc = record
{ cartesian = CartesianClosed.isCartesian cc
; exp = CartesianClosed.^-exponential cc
}
toCanonical : CartesianClosedβ² β CartesianClosed
toCanonical cc = record
{ β€ = β€
; _Γ_ = _Γ_
; ! = !
; Οβ = Οβ
; Οβ = Οβ
; β¨_,_β© = β¨_,_β©
; !-unique = !-unique
; Οβ-comp = projectβ
; Οβ-comp = projectβ
; β¨,β©-unique = unique
; _^_ = _^_
; eval = eval
; curry = Ξ»g
; eval-comp = Ξ²
; curry-unique = Ξ»-unique
}
where
open CartesianClosedβ² cc
open BinaryProducts (Cartesian.products cartesian)
open Terminal (Cartesian.terminal cartesian)