From 7fbca1aeebee93ca07b09720db77408f3c20ba52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hangh=C3=B8j=20Iversen?= Date: Mon, 5 Mar 2018 14:04:04 +0100 Subject: [PATCH] Clean-up yoneda embedding --- src/Cat/Category/Yoneda.agda | 55 ++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/src/Cat/Category/Yoneda.agda b/src/Cat/Category/Yoneda.agda index 365f441..87d37c0 100644 --- a/src/Cat/Category/Yoneda.agda +++ b/src/Cat/Category/Yoneda.agda @@ -5,23 +5,18 @@ module Cat.Category.Yoneda where open import Agda.Primitive open import Data.Product open import Cubical +open import Cubical.NType.Properties open import Cat.Category open import Cat.Category.Functor open import Cat.Equality -open Equality.Data.Product --- TODO: We want to avoid defining the yoneda embedding going through the --- category of categories (since it doesn't exist). -open import Cat.Categories.Cat using (RawCat) +open import Cat.Categories.Fun +open import Cat.Categories.Sets +open import Cat.Categories.Cat module _ {β„“ : Level} {β„‚ : Category β„“ β„“} where private - open import Cat.Categories.Fun - open import Cat.Categories.Sets - module Cat = Cat.Categories.Cat - open import Cat.Category.Exponential - open Functor 𝓒 = Sets β„“ open Fun (opposite β„‚) 𝓒 prshf = presheaf β„‚ @@ -34,33 +29,31 @@ module _ {β„“ : Level} {β„‚ : Category β„“ β„“} where -- -- In stead we'll use an ad-hoc definition -- which is definitionally -- equivalent to that other one. - _⇑_ = Cat.CatExponential.prodObj + _⇑_ = CatExponential.prodObj module _ {A B : β„‚.Object} (f : β„‚ [ A , B ]) where :funcβ†’: : NaturalTransformation (prshf A) (prshf B) :funcβ†’: = (Ξ» C x β†’ β„‚ [ f ∘ x ]) , Ξ» f₁ β†’ funExt Ξ» _ β†’ β„‚.isAssociative - module _ {c : Category.Object β„‚} where - eqTrans : (Ξ» _ β†’ Transformation (prshf c) (prshf c)) - [ (Ξ» _ x β†’ β„‚ [ β„‚.πŸ™ ∘ x ]) ≑ identityTrans (prshf c) ] - eqTrans = funExt Ξ» x β†’ funExt Ξ» x β†’ β„‚.isIdentity .projβ‚‚ + rawYoneda : RawFunctor β„‚ Fun + RawFunctor.func* rawYoneda = prshf + RawFunctor.funcβ†’ rawYoneda = :funcβ†’: + open RawFunctor rawYoneda - open import Cubical.NType.Properties - open import Cat.Categories.Fun - :ident: : :funcβ†’: (β„‚.πŸ™ {c}) ≑ Category.πŸ™ Fun {A = prshf c} - :ident: = lemSig (naturalIsProp {F = prshf c} {prshf c}) _ _ eq - where - eq : (Ξ» C x β†’ β„‚ [ β„‚.πŸ™ ∘ x ]) ≑ identityTrans (prshf c) - eq = funExt Ξ» A β†’ funExt Ξ» B β†’ projβ‚‚ β„‚.isIdentity + isIdentity : IsIdentity + isIdentity {c} = lemSig (naturalIsProp {F = prshf c} {prshf c}) _ _ eq + where + eq : (Ξ» C x β†’ β„‚ [ β„‚.πŸ™ ∘ x ]) ≑ identityTrans (prshf c) + eq = funExt Ξ» A β†’ funExt Ξ» B β†’ projβ‚‚ β„‚.isIdentity + + isDistributive : IsDistributive + isDistributive = {!!} + + instance + isFunctor : IsFunctor β„‚ Fun rawYoneda + IsFunctor.isIdentity isFunctor = isIdentity + IsFunctor.isDistributive isFunctor = isDistributive yoneda : Functor β„‚ Fun - yoneda = record - { raw = record - { func* = prshf - ; funcβ†’ = :funcβ†’: - } - ; isFunctor = record - { isIdentity = :ident: - ; isDistributive = {!!} - } - } + Functor.raw yoneda = rawYoneda + Functor.isFunctor yoneda = isFunctor