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
open Binary-products C fp hiding (uniqueβ) open Cat.Reasoning C open Terminal term open Functor open _β£_ private variable A B : Ob
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 commutes : β {Ξ} (m : Hom (Ξ ββ A) B) β ev β Ζ m ββ id β‘ m unique : β {Ξ} {m : Hom (Ξ ββ _) _} m' β 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.
unlambda : β {C} (m : Hom C B^A) β Hom (C ββ A) B unlambda m = ev β m ββ id lambda-is-equiv : β {C} β is-equiv (Ζ {C}) lambda-is-equiv = is-isoβis-equiv Ξ» where .is-iso.inv β unlambda .is-iso.rinv x β sym (unique x refl) .is-iso.linv x β commutes x
uniqueβ : β {C} {m : Hom (C ββ _) _} mβ mβ β ev β mβ ββ id β‘ m β ev β mβ ββ id β‘ m β mβ β‘ mβ uniqueβ _ _ p q = unique _ p β sym (unique _ q) lambda-ev : Ζ ev β‘ id lambda-ev = sym (unique id (sym (intror (Γ-functor .F-id))))
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 app : β {Ξ} (f : Hom Ξ B^A) (x : Hom Ξ A) β Hom Ξ B app f x = ev β f ββ id β β¨ id , x β© beta : β {Ξ} (f : Hom (Ξ ββ A) B) (x : Hom Ξ A) β app (Ζ f) x β‘ f β β¨ id , x β© beta f x = pulll (commutes _)
module _ where open is-exponential is-exponential-is-prop : β {B^A} {ev : Hom (B^A ββ A) B} β is-prop (is-exponential B^A ev) is-exponential-is-prop {B^A = B^A} {ev} x y = q where p : Path (β {C} m β Hom C B^A) (x .Ζ) (y .Ζ) p i {C} m = y .unique (x .Ζ m) (x .commutes m) i q : x β‘ y q i .Ζ = p i q i .commutes m = is-propβpathp (Ξ» i β Hom-set _ _ (ev β p i m ββ id) m) (x .commutes m) (y .commutes m) i q i .unique {m = m} m' q = is-propβpathp (Ξ» i β Hom-set _ _ m' (p i m)) (x .unique m' q) (y .unique m' q) i
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 B^A : Ob ev : Hom (B^A ββ A) B has-is-exp : is-exponential B^A ev 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)
exponential-unique : β {A B B^A B^A'} {ev : Hom (B^A ββ A) B} {ev' : Hom (B^A' ββ A) B} β is-exponential B^A ev β is-exponential B^A' ev' β B^A β B^A' exponential-unique {ev = ev} {ev'} exp1 exp2 = make-iso (exp2 .Ζ ev) (exp1 .Ζ ev') (uniqueβ exp2 (exp2 .Ζ ev β exp1 .Ζ ev') id ( ap (ev' β_) (apβ _ββ_ refl (sym (idl id)) β Γ-functor .F-β _ _) Β·Β· pulll (exp2 .commutes _) Β·Β· exp1 .commutes _) (elimr (Γ-functor .F-id))) (uniqueβ exp1 (exp1 .Ζ ev' β exp2 .Ζ ev) id ( ap (ev β_) (apβ _ββ_ refl (sym (idl id)) β Γ-functor .F-β _ _) Β·Β· pulll (exp1 .commutes _) Β·Β· exp2 .commutes _) (elimr (Γ-functor .F-id))) Ζ-β : β {A B C X A^X B^X} {evA : Hom (A^X ββ X) A} {evB : Hom (B^X ββ X) B} β {f : Hom A B} {g : Hom C A^X} β (exp : is-exponential B^X evB) β exp .is-exponential.Ζ (f β evA) β g β‘ exp .is-exponential.Ζ (f β evA β g ββ id) Ζ-β exb = is-exponential.unique exb _ ( apβ _β_ refl (apβ _ββ_ refl (sym (idl id)) β Γ-functor .F-β _ _) β extendl (is-exponential.commutes exb _))
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 g = Ζ (f β ev β β¨ Οβ , 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 _ $ ev β β¨ (Ζ (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 _) β©β‘ (g β ev β β¨ Οβ , f β Οβ β©) β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©) ββ id β‘β¨ pullr (pullr (apβ _β_ (apβ β¨_,_β© (introl refl) refl) refl β sym (Bifunctor.firstβsecond Γ-functor))) β©β‘ g β ev β Ζ (g' β ev β β¨ Οβ , f' β Οβ β©) ββ id β id ββ f β‘β¨ reflβ©ββ¨ pulll (commutes _) β©β‘ g β (g' β ev β β¨ Οβ , f' β Οβ β©) β id ββ f β‘β¨ pulll refl β extendr (pullr (pullr (Product.unique (fp _ _) (pulll Οβββ¨β© Β·Β· Οβββ¨β© Β·Β· idl _) (pulll Οβββ¨β© β extendr Οβββ¨β©)))) β©β‘ (g β g') β ev β β¨ Οβ , (f' β f) β Οβ β© β productβ£exponential : β {A} β Bifunctor.Left Γ-functor A β£ Bifunctor.Right [-,-] A productβ£exponential {A} = hom-isoβadjoints Ζ lambda-is-equiv nat where module _ {a b c d} (g : Hom a b) (h : Hom c d) (x : Hom (d ββ A) a) where nat : Ζ (g β x β β¨ h β Οβ , id β Οβ β©) β‘ Ζ (g β ev β β¨ Οβ , id β Οβ β©) β Ζ x β h nat = sym $ unique _ $ ev β (Ζ (g β ev β β¨ Οβ , id β Οβ β©) β Ζ x β h) ββ id β‘β¨ reflβ©ββ¨ apβ _ββ_ refl (introl refl) β Γ-functor .F-β _ _ β©β‘ ev β Ζ (g β ev β β¨ Οβ , id β Οβ β©) ββ id β (Ζ x β h) ββ id β‘β¨ pulll (commutes _) β©β‘ (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)) β©β‘ g β ev β Ζ x ββ id β h ββ id β‘β¨ reflβ©ββ¨ pulll (commutes _) β©β‘ 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 product-adjointβcartesian-closed Aβ adj = cc where open Exponential open is-exponential exp : β A B β Exponential A B exp A B .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 $ Equiv.injectiveβ (_ , R-adjunct-is-equiv (adj A)) (R-L-adjunct (adj A) _) x cc : Cartesian-closed cc .Cartesian-closed.has-exp = exp
Exponentiable objectsπ
open /-Obj open /-Hom open Pullback module _ B (exp : β A β Exponential B A) where private module _ A where open Exponential (exp A) renaming (B^A to -^Bβ) hiding (Ζ ; unlambda ; ev) public private module _ {A} where open Exponential (exp A) renaming (unlambda to app) using (ev ; Ζ) public
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
-^B : 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 _) _ ( apβ _β_ refl (apβ _ββ_ refl (introl refl) β Γ-functor .F-β _ _) Β·Β· pulll (Exponential.commutes (exp _) _) Β·Β· extendr (Exponential.commutes (exp _) _))
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 exponentiableβproduct pb = f where f : 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 p : Ζ Οβ β ! β‘ -^B .Fβ (y .map) β -^B .Fβ (h .map) β pb {B = top} (-^B .Fβ (x .map)) (Ζ Οβ) .pβ p = Ζ Οβ β ! β‘β¨ ap (Ζ Οβ β_) (!-unique _) β©β‘ Ζ Οβ β pb _ _ .pβ β‘Λβ¨ pb _ _ .square β©β‘Λ Ζ (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β β
f .F-id = sym $ pb _ _ .Pullback.unique (sym (eliml (-^B .F-id) β intror refl)) (sym (!-unique _)) f .F-β f g = sym $ pb _ _ .Pullback.unique (pulll (pb _ _ .pββuniversal) Β·Β· pullr (pb _ _ .pββuniversal) Β·Β· pulll (sym (-^B .F-β _ _))) (sym (!-unique _)) exponentiableβconstant-familyβ£product : (pb : has-pullbacks C) β constant-family fp β£ exponentiableβproduct pb exponentiableβconstant-familyβ£product pb = hom-iso-invβadjoints (remβ _ .fst) (remβ _ .snd) nat where module b = Functor (constant-family fp) module Ξ = Functor (exponentiableβproduct pb)
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
cohβ : β {X} (f : /-Obj B) (q : Hom X (-^Bβ (f .domain))) β (Ζ (f .map β ev) β q β‘ Ζ Οβ β !) β (f .map β app q β‘ Οβ) cohβ f h = prop-ext! (Ξ» p β Equiv.injective (_ , lambda-is-equiv _) (sym (Ζ-β (has-is-exp _)) Β·Β· p Β·Β· done)) (Ξ» p β Ζ-β (has-is-exp _) Β·Β· ap Ζ p Β·Β· sym done)
where done : Ζ Οβ β ! β‘ Ζ Οβ done = Exponential.unique (exp _) _ $ apβ _β_ refl (apβ _ββ_ refl (sym (idl id)) β Γ-functor .F-β _ _) Β·Β· pulll (Exponential.commutes (exp _) _) Β·Β· (Οβββ¨β© β idl _) opaque remβ : β {X} (f : /-Obj B) β Hom X (Ξ .β f) β Slice C B .Precategory.Hom (b.β X) f remβ {X = X} f =
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.
Hom X (Ξ .β f) ββ¨ Pullback.pullback-univ (pb _ _) β©β Ξ£ (Hom X (-^B .Fβ (f .domain))) (Ξ» h β Ξ£ (Hom X top) Ξ» h' β Ζ (f .map β ev) β h β‘ Ζ Οβ β h') ββ¨ Ξ£-ap-snd (Ξ» x β Ξ£-contr-eqv (hasβ€ X)) β©β Ξ£ (Hom X (-^B .Fβ (f .domain))) (Ξ» h β Ζ (f .map β ev) β h β‘ Ζ Οβ β !) ββ¨ Ξ£-ap (Equiv.inverse (Ζ , lambda-is-equiv _)) (cohβ f) β©β Ξ£ (Hom (X ββ B) (f .domain)) (Ξ» h β f .map β h β‘ Οβ) ββ¨ IsoβEquiv ((Ξ» x β record { commutes = x .snd }) , iso (Ξ» x β _ , x .commutes) (Ξ» _ β trivial!) (Ξ» _ β trivial!)) β©β Slice C B .Precategory.Hom (b.β X) f ββ remβ-Ξ² : β {X} (f : /-Obj B) (h : Hom X (Ξ .β f)) β Equiv.to (remβ f) h .map β‘ app (pb _ _ .pβ β h) remβ-Ξ² f h = refl nat : hom-iso-inv-natural {L = constant-family fp} {R = exponentiableβproduct pb} (remβ _ .fst) nat g h x = ext $ remβ _ .fst (Ξ .β g β x β h) .map β‘β¨ remβ-Ξ² _ _ β©β‘ app (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 β©β‘ (g .map β ev β pb _ _ .pβ ββ id) β (x β h) ββ id β‘β¨ pullr (pullr (sym (Γ-functor .F-β _ _) β apβ _ββ_ (assoc _ _ _) refl β Γ-functor .F-β _ _)) β©β‘ g .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 β
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.