Have yoneda without having a category of categories

I did break some things in Cat.Categories.Cat but since this is
unprovable anyways it's not that big a deal.
This commit is contained in:
Frederik Hanghøj Iversen 2018-03-05 13:52:41 +01:00
parent 5c3616bca5
commit 1bf565b87a
5 changed files with 259 additions and 225 deletions

View file

@ -11,7 +11,7 @@ open import Data.Product renaming (proj₁ to fst ; proj₂ to snd)
open import Cat.Category open import Cat.Category
open import Cat.Category.Functor open import Cat.Category.Functor
open import Cat.Category.Product open import Cat.Category.Product
open import Cat.Category.Exponential open import Cat.Category.Exponential hiding (_×_ ; product)
open import Cat.Category.NaturalTransformation open import Cat.Category.NaturalTransformation
open import Cat.Equality open import Cat.Equality
@ -174,22 +174,19 @@ module _ { ' : Level} (unprovable : IsCategory (RawCat ')) where
hasProducts = record { product = product } hasProducts = record { product = product }
-- Basically proves that `Cat ` is cartesian closed. -- Basically proves that `Cat ` is cartesian closed.
module _ ( : Level) (unprovable : IsCategory (RawCat )) where module CatExponential { : Level} ( 𝔻 : Category ) where
private
open Data.Product open Data.Product
open import Cat.Categories.Fun open import Cat.Categories.Fun
Cat : Category (lsuc ( )) ( ) Category = Category
Cat = Cat unprovable
module _ ( 𝔻 : Category ) where
open Fun 𝔻 renaming (identity to idN) open Fun 𝔻 renaming (identity to idN)
private private
:obj: : Object Cat
:obj: = Fun
:func*: : Functor 𝔻 × Object Object 𝔻 :func*: : Functor 𝔻 × Object Object 𝔻
:func*: (F , A) = func* F A :func*: (F , A) = func* F A
prodObj : Category
prodObj = Fun
module _ {dom cod : Functor 𝔻 × Object } where module _ {dom cod : Functor 𝔻 × Object } where
private private
F : Functor 𝔻 F : Functor 𝔻
@ -226,7 +223,7 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
result : 𝔻 [ func* F A , func* G B ] result : 𝔻 [ func* F A , func* G B ]
result = l result = l
_×p_ = product unprovable open CatProduct renaming (obj to _×p_) using ()
module _ {c : Functor 𝔻 × Object } where module _ {c : Functor 𝔻 × Object } where
private private
@ -244,7 +241,7 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
:ident: : :func→: {c} {c} (NT.identity F , 𝟙 {A = proj₂ c}) 𝟙 𝔻 :ident: : :func→: {c} {c} (NT.identity F , 𝟙 {A = proj₂ c}) 𝟙 𝔻
:ident: = begin :ident: = begin
:func→: {c} {c} (𝟙 (Product.obj (:obj: ×p )) {c}) ≡⟨⟩ :func→: {c} {c} (𝟙 (prodObj ×p ) {c}) ≡⟨⟩
:func→: {c} {c} (idN F , 𝟙 ) ≡⟨⟩ :func→: {c} {c} (idN F , 𝟙 ) ≡⟨⟩
𝔻 [ identityTrans F C func→ F (𝟙 )] ≡⟨⟩ 𝔻 [ identityTrans F C func→ F (𝟙 )] ≡⟨⟩
𝔻 [ 𝟙 𝔻 func→ F (𝟙 )] ≡⟨ proj₂ 𝔻.isIdentity 𝔻 [ 𝟙 𝔻 func→ F (𝟙 )] ≡⟨ proj₂ 𝔻.isIdentity
@ -262,7 +259,7 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
H = H×C .proj₁ H = H×C .proj₁
C = H×C .proj₂ C = H×C .proj₂
-- Not entirely clear what this is at this point: -- Not entirely clear what this is at this point:
_P⊕_ = Category._∘_ (Product.obj (:obj: ×p )) {F×A} {G×B} {H×C} _P⊕_ = Category._∘_ (prodObj ×p ) {F×A} {G×B} {H×C}
module _ module _
-- NaturalTransformation F G × .Arrow A B -- NaturalTransformation F G × .Arrow A B
{θ×f : NaturalTransformation F G × [ A , B ]} {θ×f : NaturalTransformation F G × [ A , B ]}
@ -314,8 +311,9 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
open Category 𝔻 open Category 𝔻
module H = Functor H module H = Functor H
:eval: : Functor ((:obj: ×p ) .Product.obj) 𝔻 eval : Functor (CatProduct.obj prodObj ) 𝔻
:eval: = record -- :eval: : Functor (prodObj ×p ) 𝔻
eval = record
{ raw = record { raw = record
{ func* = :func*: { func* = :func*:
; func→ = λ {dom} {cod} :func→: {dom} {cod} ; func→ = λ {dom} {cod} :func→: {dom} {cod}
@ -326,12 +324,16 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
} }
} }
module _ (𝔸 : Category ) (F : Functor ((𝔸 ×p ) .Product.obj) 𝔻) where module _ (𝔸 : Category ) (F : Functor (𝔸 ×p ) 𝔻) where
open HasProducts (hasProducts {} {} unprovable) renaming (_|×|_ to parallelProduct) -- open HasProducts (hasProducts {} {} unprovable) renaming (_|×|_ to parallelProduct)
postulate postulate
transpose : Functor 𝔸 :obj: parallelProduct
eq : Cat [ :eval: (parallelProduct transpose (𝟙 Cat {A = })) ] F : Functor 𝔸 prodObj Functor
Functor (𝔸 ×p ) (prodObj ×p )
transpose : Functor 𝔸 prodObj
eq : F[ eval (parallelProduct transpose (identity {C = })) ] F
-- eq : F[ :eval: ∘ {!!} ] ≡ F
-- eq : Cat [ :eval: ∘ (HasProducts._|×|_ hasProducts transpose (𝟙 Cat {o = })) ] ≡ F -- eq : Cat [ :eval: ∘ (HasProducts._|×|_ hasProducts transpose (𝟙 Cat {o = })) ] ≡ F
-- eq' : (Cat [ :eval: ∘ -- eq' : (Cat [ :eval: ∘
-- (record { product = product } HasProducts.|×| transpose) -- (record { product = product } HasProducts.|×| transpose)
@ -344,20 +346,39 @@ module _ ( : Level) (unprovable : IsCategory (RawCat )) where
-- :eval: (parallelProduct F~ (𝟙 Cat {o = }))] F) catTranspose = -- :eval: (parallelProduct F~ (𝟙 Cat {o = }))] F) catTranspose =
-- transpose , eq -- transpose , eq
postulate :isExponential: : IsExponential Cat 𝔻 :obj: :eval: module _ ( : Level) (unprovable : IsCategory (RawCat )) where
-- :isExponential: : IsExponential Cat 𝔻 :obj: :eval: private
-- :isExponential: = {!catTranspose!} Cat : Category (lsuc ( )) ( )
-- where Cat = Cat unprovable
-- open HasProducts (hasProducts {} {} unprovable) using (_|×|_) module _ ( 𝔻 : Category ) where
-- :isExponential: = λ 𝔸 F transpose 𝔸 F , eq' 𝔸 F open CatExponential 𝔻 using (prodObj ; eval)
-- Putting in the type annotation causes Agda to loop indefinitely.
-- eval' : Functor (CatProduct.obj prodObj ) 𝔻
-- Likewise, using it below also results in this.
eval' : _
eval' = eval
-- private
-- -- module _ ( 𝔻 : Category ) where
-- postulate :isExponential: : IsExponential Cat 𝔻 prodObj :eval:
-- -- :isExponential: : IsExponential Cat 𝔻 :obj: :eval:
-- -- :isExponential: = {!catTranspose!}
-- -- where
-- -- open HasProducts (hasProducts {} {} unprovable) using (_|×|_)
-- -- :isExponential: = λ 𝔸 F → transpose 𝔸 F , eq' 𝔸 F
-- :exponent: : Exponential (Cat ) A B -- -- :exponent: : Exponential (Cat ) A B
:exponent: : Exponential Cat 𝔻 exponent : Exponential Cat 𝔻
:exponent: = record exponent = record
{ obj = :obj: { obj = prodObj
; eval = :eval: ; eval = {!evalll'!}
; isExponential = :isExponential: ; isExponential = {!:isExponential:!}
} }
where
open HasProducts (hasProducts unprovable) renaming (_×_ to _×p_)
open import Cat.Categories.Fun
open Fun
-- _×p_ = CatProduct.obj -- prodObj
-- eval' : Functor CatP.obj 𝔻
hasExponentials : HasExponentials Cat hasExponentials : HasExponentials Cat
hasExponentials = record { exponent = :exponent: } hasExponentials = record { exponent = exponent }

View file

@ -1,40 +1,44 @@
module Cat.Category.Exponential where module Cat.Category.Exponential where
open import Agda.Primitive open import Agda.Primitive
open import Data.Product open import Data.Product hiding (_×_)
open import Cubical open import Cubical
open import Cat.Category open import Cat.Category
open import Cat.Category.Product open import Cat.Category.Product
open Category
module _ { '} ( : Category ') {{hasProducts : HasProducts }} where module _ { '} ( : Category ') {{hasProducts : HasProducts }} where
open HasProducts hasProducts open Category
open Product hiding (obj) open HasProducts hasProducts public
private
_×p_ : (A B : Object ) Object
_×p_ A B = Product.obj (product A B)
module _ (B C : Object ) where module _ (B C : Object) where
IsExponential : (Cᴮ : Object ) [ Cᴮ ×p B , C ] Set ( ') record IsExponential'
IsExponential Cᴮ eval = (A : Object ) (f : [ A ×p B , C ]) (Cᴮ : Object)
(eval : [ Cᴮ × B , C ]) : Set ( ') where
field
uniq
: (A : Object) (f : [ A × B , C ])
∃![ f~ ] ( [ eval f~ |×| Category.𝟙 ] f)
IsExponential : (Cᴮ : Object) [ Cᴮ × B , C ] Set ( ')
IsExponential Cᴮ eval = (A : Object) (f : [ A × B , C ])
∃![ f~ ] ( [ eval f~ |×| Category.𝟙 ] f) ∃![ f~ ] ( [ eval f~ |×| Category.𝟙 ] f)
record Exponential : Set ( ') where record Exponential : Set ( ') where
field field
-- obj ≡ Cᴮ -- obj ≡ Cᴮ
obj : Object obj : Object
eval : [ obj ×p B , C ] eval : [ obj × B , C ]
{{isExponential}} : IsExponential obj eval {{isExponential}} : IsExponential obj eval
-- If I make this an instance-argument then the instance resolution
-- algorithm goes into an infinite loop. Why? transpose : (A : Object) [ A × B , C ] [ A , obj ]
exponentialsHaveProducts : HasProducts
exponentialsHaveProducts = hasProducts
transpose : (A : Object ) [ A ×p B , C ] [ A , obj ]
transpose A f = proj₁ (isExponential A f) transpose A f = proj₁ (isExponential A f)
record HasExponentials { ' : Level} ( : Category ') {{_ : HasProducts }} : Set ( ') where record HasExponentials { ' : Level} ( : Category ') {{_ : HasProducts }} : Set ( ') where
open Category
open Exponential public open Exponential public
field field
exponent : (A B : Object ) Exponential A B exponent : (A B : Object) Exponential A B
_⇑_ : (A B : Object) Object
A B = (exponent A B) .obj

View file

@ -27,9 +27,10 @@ module _ (a b : Level) where
open Category category public open Category category public
field field
{{hasProducts}} : HasProducts category {{hasProducts}} : HasProducts category
mempty : Object empty : Object
-- aka. tensor product, monoidal product. -- aka. tensor product, monoidal product.
mappend : Functor (category × category) category append : Functor (category × category) category
open HasProducts hasProducts public
record MonoidalCategory : Set where record MonoidalCategory : Set where
field field
@ -40,10 +41,10 @@ module _ {a b : Level} ( : MonoidalCategory a b) where
private private
= a b = a b
module MC = MonoidalCategory open MonoidalCategory public
open HasProducts MC.hasProducts
record Monoid : Set where record Monoid : Set where
field field
carrier : MC.Object carrier : Object
mempty : MC.Arrow (carrier × carrier) carrier mempty : Arrow empty carrier
mappend : MC.Arrow MC.mempty carrier mappend : Arrow (carrier × carrier) carrier

View file

@ -31,6 +31,7 @@ record Product { ' : Level} { : Category '} (A B : Object ) :
proj₂ : [ obj , B ] proj₂ : [ obj , B ]
{{isProduct}} : IsProduct proj₁ proj₂ {{isProduct}} : IsProduct proj₁ proj₂
-- | Arrow product
_P[_×_] : {X} (π₁ : [ X , A ]) (π₂ : [ X , B ]) _P[_×_] : {X} (π₁ : [ X , A ]) (π₂ : [ X , B ])
[ X , obj ] [ X , obj ]
_P[_×_] π₁ π₂ = proj₁ (isProduct π₁ π₂) _P[_×_] π₁ π₂ = proj₁ (isProduct π₁ π₂)
@ -39,16 +40,21 @@ record HasProducts { ' : Level} ( : Category ') : Set (
field field
product : (A B : Object ) Product { = } A B product : (A B : Object ) Product { = } A B
open Product open Product hiding (obj)
_×_ : (A B : Object ) Object module _ (A B : Object ) where
A × B = Product.obj (product A B) open Product (product A B)
-- The product mentioned in awodey in Def 6.1 is not the regular product of arrows. _×_ : Object
-- It's a "parallel" product _×_ = obj
_|×|_ : {A A' B B' : Object } [ A , A' ] [ B , B' ]
[ A × B , A' × B' ] -- | Parallel product of arrows
_|×|_ {A = A} {A' = A'} {B = B} {B' = B'} a b --
= product A' B' -- The product mentioned in awodey in Def 6.1 is not the regular product of
P[ [ a (product A B) .proj₁ ] -- arrows. It's a "parallel" product
× [ b (product A B) .proj₂ ] module _ {A A' B B' : Object } where
open Product (product A B) hiding (_P[_×_]) renaming (proj₁ to fst ; proj₂ to snd)
_|×|_ : [ A , A' ] [ B , B' ] [ A × B , A' × B' ]
a |×| b = product A' B'
P[ [ a fst ]
× [ b snd ]
] ]

View file

@ -15,7 +15,7 @@ open Equality.Data.Product
-- category of categories (since it doesn't exist). -- category of categories (since it doesn't exist).
open import Cat.Categories.Cat using (RawCat) open import Cat.Categories.Cat using (RawCat)
module _ { : Level} { : Category } (unprovable : IsCategory (RawCat )) where module _ { : Level} { : Category } where
private private
open import Cat.Categories.Fun open import Cat.Categories.Fun
open import Cat.Categories.Sets open import Cat.Categories.Sets
@ -24,15 +24,17 @@ module _ { : Level} { : Category } (unprovable : IsCategory (RawCat
open Functor open Functor
𝓢 = Sets 𝓢 = Sets
open Fun (opposite ) 𝓢 open Fun (opposite ) 𝓢
Cat : Category _ _
Cat = Cat.Cat unprovable
prshf = presheaf prshf = presheaf
module = Category module = Category
_⇑_ : (A B : Category.Object Cat) Category.Object Cat -- There is no (small) category of categories. So we won't use _⇑_ from
A B = (exponent A B) .obj -- `HasExponential`
where --
open HasExponentials (Cat.hasExponentials unprovable) -- open HasExponentials (Cat.hasExponentials unprovable) using (_⇑_)
--
-- In stead we'll use an ad-hoc definition -- which is definitionally
-- equivalent to that other one.
_⇑_ = Cat.CatExponential.prodObj
module _ {A B : .Object} (f : [ A , B ]) where module _ {A B : .Object} (f : [ A , B ]) where
:func→: : NaturalTransformation (prshf A) (prshf B) :func→: : NaturalTransformation (prshf A) (prshf B)