module Cat.Diagram.Exponential
{o β} (C : Precategory o β) (fp : has-products C) (term : Terminal C) where
Exponential objectsπ
In a category with all finite products (including a terminal object!), where by the usual internal logic dictionary we regard a morphism as an in context , the notion of exponential object captures what it means for an object to interpret function types. An exponential object for and is an object equipped with an evaluation map
standing for the essence of function application: if I have a function and I have an then application gives me an
Moreover, exponential objects must satisfy a universal property relative to the product functor: if I have a derivation of a in a context extended by then I should be able to form the βabstractionβ
record is-exponential (B^A : Ob) (ev : Hom (B^A ββ A) B) : Type (o β β) where
no-eta-equality
field
: β {Ξ} (m : Hom (Ξ ββ A) B) β Hom Ξ B^A
Ζ : β {Ξ} (m : Hom (Ξ ββ A) B) β ev β Ζ m ββ id β‘ m
commutes : β {Ξ} {m : Hom (Ξ ββ _) _} m'
unique β ev β m' ββ id β‘ m
β m' β‘ Ζ m
The data above is an unpacked way of saying that the evaluation map extends to an equivalence between and since being an equivalence is a proposition, once we have fixed the evaluation map, having abstractions is a property, not extra structure.
: β {C} (m : Hom C B^A) β Hom (C ββ A) B
unlambda = ev β m ββ id
unlambda m
: β {C} β is-equiv (Ζ {C})
lambda-is-equiv = is-isoβis-equiv Ξ» where
lambda-is-equiv .is-iso.inv β unlambda
.is-iso.rinv x β sym (unique x refl)
.is-iso.linv x β commutes x
As an aside, let us remark that the evaluation map is sufficient to interpret the more familiar formation rule for function application,
by relativising to an arbitrary context through composition, and that this indeed interprets the rule:
private
: β {Ξ} (f : Hom Ξ B^A) (x : Hom Ξ A) β Hom Ξ B
app = ev β f ββ id β β¨ id , x β©
app f x
: β {Ξ} (f : Hom (Ξ ββ A) B) (x : Hom Ξ A)
beta β app (Ζ f) x β‘ f β β¨ id , x β©
= pulll (commutes _) beta f x
Putting this data together, we can define an exponential object to be a pair with a witness that supports abstraction.
record Exponential (A B : Ob) : Type (o β β) where
no-eta-equality
field
: Ob
B^A : Hom (B^A ββ A) B
ev : is-exponential B^A ev
has-is-exp open is-exponential has-is-exp public
Since a finite-products category is called Cartesian monoidal, a finite-products category where every pair of objects has an exponential is called Cartesian closed, and we abbreviate the phrase βCartesian closed categoryβ to βCCCβ.
record Cartesian-closed : Type (o β β) where
no-eta-equality
field has-exp : β A B β Exponential A B
module _ {A} {B} where open Exponential (has-exp A B) hiding (B^A) public
module Exp A B = Exponential (has-exp A B)
The connection between Cartesian closed categories and the lambda calculus is fundamental: however, it would take us too far afield of the basic properties of CCCs to discuss that in this module. You can find extended discussion, and an implementation, in the page on simply typed lambda calculus.
Functorialityπ
In a Cartesian closed category, we can think of the exponential-assigning operation as an internalised analogue of the In the same way that a pair of morphisms and would act on the ordinary sets by composition, they act on internal homs, too, defining a mapping
: β {a a' b b'} β Hom b b' β Hom a' a β Hom (Exp.B^A a b) (Exp.B^A a' b')
[-,-]β = Ζ (f β ev β β¨ Οβ , g β Οβ β©)
[-,-]β f g
: Functor (C ^op ΓαΆ C) C
[-,-] .Fβ (A , B) = Exp.B^A A B
[-,-] .Fβ (f , g) = [-,-]β g f [-,-]
Through some calculations that are just annoying enough to stun the unsuspecting reader, we can show that this is indeed a functor With a bit more effort, we can show that our defining equivalence between the and satisfies the naturality condition required to to characterise as the right adjoint to
.F-id =
[-,-] (id β ev β β¨ Οβ , id β Οβ β©) β‘β¨ ap Ζ (idl _ β ap (ev β_) (sym (apβ β¨_,_β© (idl _) refl))) β©
Ζ (ev β id ββ id) β‘Λβ¨ unique id refl β©
Ζ
id β.F-β (f , g) (f' , g') = sym $ unique _ $
[-,-] (Ζ (g β ev β β¨ Οβ , f β Οβ β©) β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©)) β Οβ , id β Οβ β© β‘β¨ reflβ©ββ¨ apβ _ββ_ refl (introl refl) β Γ-functor .F-β _ _ β©
ev β β¨ (g β ev β β¨ Οβ , f β Οβ β©) ββ id β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©) ββ id β‘β¨ pulll (commutes _) β©
ev β Ζ (g β ev β β¨ Οβ , f β Οβ β©) β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©) ββ id β‘β¨ pullr (pullr (apβ _β_ (apβ β¨_,_β© (introl refl) refl) refl β sym (Bifunctor.firstβsecond Γ-functor))) β©
(g' β ev β β¨ Οβ , f' β Οβ β©) ββ id β id ββ f β‘β¨ reflβ©ββ¨ pulll (commutes _) β©
g β ev β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©) β id ββ f β‘β¨ pulll refl β extendr (pullr (pullr (Product.unique (fp _ _) _ (pulll Οβββ¨β© Β·Β· Οβββ¨β© Β·Β· idl _) (pulll Οβββ¨β© β extendr Οβββ¨β©)))) β©
g β (g β g') β ev β β¨ Οβ , (f' β f) β Οβ β© β
: β {A} β Bifunctor.Left Γ-functor A β£ Bifunctor.Right [-,-] A
productβ£exponential {A} = hom-isoβadjoints Ζ lambda-is-equiv nat where
productβ£exponential module _ {a b c d} (g : Hom a b) (h : Hom c d) (x : Hom (d ββ A) a) where
: Ζ (g β x β β¨ h β Οβ , id β Οβ β©) β‘ Ζ (g β ev β β¨ Οβ , id β Οβ β©) β Ζ x β h
nat = sym $ unique _ $
nat (Ζ (g β ev β β¨ Οβ , id β Οβ β©) β Ζ x β h) ββ id β‘β¨ reflβ©ββ¨ apβ _ββ_ refl (introl refl) β Γ-functor .F-β _ _ β©
ev β (g β ev β β¨ Οβ , id β Οβ β©) ββ id β (Ζ x β h) ββ id β‘β¨ pulll (commutes _) β©
ev β Ζ (g β β ev β β¨ Οβ , id β Οβ β© β) β (Ζ x β h) ββ id β‘β¨ ap! (elimr (apβ β¨_,_β© (introl refl) refl β Γ-functor .F-id)) β©
(g β ev) β (Ζ x β h) ββ id β‘β¨ pullr (apβ _β_ refl (Bifunctor.firstβfirst Γ-functor)) β©
(commutes _) β©
g β ev β Ζ x ββ id β h ββ id β‘β¨ reflβ©ββ¨ pulll g β x β h ββ id β
From an adjunctionπ
As a converse to the results above, if each product functor has a right adjoint then is a Cartesian closed category, with the object serving as the exponential. This means that we can prove that a category is Cartesian closed by appealing to general facts about the existence of right adjoints, if any apply.
product-adjointβcartesian-closed: (-^_ : Ob β Functor C C)
β (β A β Bifunctor.Left Γ-functor A β£ -^ A)
β Cartesian-closed
= cc where
product-adjointβcartesian-closed Aβ adj open Exponential
open is-exponential
: β A B β Exponential A B
exp .B^A = Aβ A .Fβ B
exp A B .ev = adj A .Ξ΅ B
exp A B .has-is-exp .Ζ = L-adjunct (adj A)
exp A B .has-is-exp .commutes m = R-L-adjunct (adj A) m
exp A B .has-is-exp .unique m' x = sym $
exp A B .injectiveβ (_ , R-adjunct-is-equiv (adj A))
Equiv(R-L-adjunct (adj A) _) x
: Cartesian-closed
cc .Cartesian-closed.has-exp = exp cc
Exponentiable objectsπ
We refer to an object as exponentiable if, for every other the exponential object exists. This means that we have a right adjoint to the functor by the discussion above. It will, however, be more useful to us to characterise exponentiability of by a condition on the slice category
: Functor C C
-^B .Fβ = -^Bβ
-^B .Fβ h = Ζ (h β ev)
-^B .F-id = ap Ζ (idl ev) β lambda-ev _
-^B .F-β f g = sym $ Exponential.unique (exp _) _
-^B ( apβ _β_ refl (apβ _ββ_ refl (introl refl) β Γ-functor .F-β _ _)
(Exponential.commutes (exp _) _)
Β·Β· pulll (Exponential.commutes (exp _) _)) Β·Β· extendr
Recall the constant families functor which sends an object to the product projection Following (Johnstone 2002, A1.5.2), we have the following characterisation of exponentiability: In a category with pullbacks, an object is exponentiable iff. we have a right adjoint functor
Suppose is exponentiable. The value on a family is defined to be the pullback
where the map on the right, is the action of on An application of the universal properties at hand shows that we can extend maps over to maps The calculation that this is functorial is routine, so we omit it from the page.
exponentiableβproduct: has-pullbacks C
β Functor (Slice C B) C
= f where
exponentiableβproduct pb : Functor (Slice C B) C
f .Fβ h = pb {B = top} (-^B .Fβ (h .map)) (Ζ Οβ) .apex
f .Fβ {x} {y} h = pb _ _ .universal (sym p) where abstract
f : Ζ Οβ β ! β‘ -^B .Fβ (y .map) β -^B .Fβ (h .map) β pb {B = top} (-^B .Fβ (x .map)) (Ζ Οβ) .pβ
p = Ζ Οβ β ! β‘β¨ ap (Ζ Οβ β_) (!-unique _) β©
p _ _ .pβ β‘Λβ¨ pb _ _ .square β©
Ζ Οβ β pb (x .map β ev) β pb _ _ .pβ β‘Λβ¨ ap (-^B .Fβ) (h .commutes) β©ββ¨refl β©
Ζ ((y .map β h .map) β ev) β pb _ _ .pβ β‘β¨ pushl (-^B .F-β _ _) β©
Ζ (y .map β ev) β Ζ (h .map β ev) β pb _ _ .pβ β Ζ
It remains to prove that this functor is actually a right adjoint to the constant-families functor like we had claimed. We start with an elementary observation: given maps and asking for
is equivalent to asking for
which is in turn equivalent to asking that be a map over
: β {X} (f : /-Obj B) (q : Hom X (-^Bβ (f .domain)))
cohβ β (Ζ (f .map β ev) β q β‘ Ζ Οβ β !)
(f .map β app q β‘ Οβ)
β = prop-ext!
cohβ f h (Ξ» p β Equiv.injective (_ , lambda-is-equiv _) (sym (Ζ-β (has-is-exp _)) Β·Β· p Β·Β· done))
(Ξ» p β Ζ-β (has-is-exp _) Β·Β· ap Ζ p Β·Β· sym done)
This is the last piece that we need to establish an equivalence between the and and even though it factors through the rather complicated path displayed below, it definitionally sends to
Having this very simple computational description will greatly simplify the proof that this meandering equivalence is actually natural β and that naturality is all that stands between us and the adjunction weβve been chasing.
(Ξ .β f)
Hom X .pullback-univ (pb _ _) β©
ββ¨ Pullback(Hom X (-^B .Fβ (f .domain))) (Ξ» h β Ξ£ (Hom X top) Ξ» h' β Ζ (f .map β ev) β h β‘ Ζ Οβ β h')
Ξ£ (Ξ» x β Ξ£-contr-eqv (hasβ€ X)) β©
ββ¨ Ξ£-ap-snd (Hom X (-^B .Fβ (f .domain))) (Ξ» h β Ζ (f .map β ev) β h β‘ Ζ Οβ β !)
Ξ£ (Equiv.inverse (Ζ , lambda-is-equiv _)) (cohβ f) β©
ββ¨ Ξ£-ap (Hom (X ββ B) (f .domain)) (Ξ» h β f .map β h β‘ Οβ)
Ξ£ ((Ξ» x β record { commutes = x .snd }) , iso (Ξ» x β _ , x .commutes) (Ξ» _ β trivial!) (Ξ» _ β trivial!)) β©
ββ¨ IsoβEquiv .Precategory.Hom (b.β X) f
Slice C B
ββ
: β {X} (f : /-Obj B) (h : Hom X (Ξ .β f))
remβ-Ξ² β Equiv.to (remβ f) h .map β‘ app (pb _ _ .pβ β h)
= refl
remβ-Ξ² f h
: hom-iso-inv-natural {L = constant-family fp} {R = exponentiableβproduct pb} (remβ _ .fst)
nat = ext $
nat g h x _ .fst (Ξ .β g β x β h) .map β‘β¨ remβ-Ξ² _ _ β©
remβ (pb _ _ .pβ β Ξ .β g β x β h) β‘β¨ ap app (pulll (pb _ _ .pββuniversal β Ζ-β {f = g .map} {g = pb _ _ .pβ} (has-is-exp _))) β©
app (Ζ (g .map β ev β pb _ _ .pβ ββ id) β x β h) β‘β¨ apβ _β_ refl (apβ _ββ_ refl (sym (idl id)) β Γ-functor .F-β _ _) β pulll refl β©
app (Ζ (g .map β ev β pb _ _ .pβ ββ id)) β (x β h) ββ id β‘β¨ apβ _β_ (Equiv.Ξ· (_ , lambda-is-equiv _) _) refl β©
app (g .map β ev β pb _ _ .pβ ββ id) β (x β h) ββ id β‘β¨ pullr (pullr (sym (Γ-functor .F-β _ _) β apβ _ββ_ (assoc _ _ _) refl β Γ-functor .F-β _ _)) β©
.map β ev β (pb _ _ .pβ β x) ββ id β h ββ id β‘β¨ reflβ©ββ¨ (pulll refl β apβ _β_ refl (apβ β¨_,_β© refl (idl _))) β©
g .map β (ev β (pb _ _ .pβ β x) ββ id) β b.β h .map β‘β¨ apβ _β_ refl (apβ _β_ (sym (remβ-Ξ² _ _)) refl) β©
g .map β remβ _ .fst x .map β b.β h .map β g
References
- Johnstone, Peter T. 2002. Sketches of an Elephant: a Topos Theory Compendium. Oxford Logic Guides. New York, NY: Oxford Univ. Press. https://cds.cern.ch/record/592033.