2018-01-15 15:13:23 +00:00
|
|
|
|
{-# OPTIONS --allow-unsolved-metas #-}
|
|
|
|
|
|
|
|
|
|
module Cat.Categories.Sets where
|
2017-11-15 20:51:10 +00:00
|
|
|
|
|
|
|
|
|
open import Cubical.PathPrelude
|
|
|
|
|
open import Agda.Primitive
|
2018-01-15 15:13:23 +00:00
|
|
|
|
open import Data.Product
|
|
|
|
|
open import Data.Product renaming (proj₁ to fst ; proj₂ to snd)
|
|
|
|
|
|
|
|
|
|
open import Cat.Category
|
|
|
|
|
open import Cat.Functor
|
2017-11-15 20:51:10 +00:00
|
|
|
|
|
|
|
|
|
-- Sets are built-in to Agda. The set of all small sets is called Set.
|
|
|
|
|
|
|
|
|
|
Fun : {ℓ : Level} → ( T U : Set ℓ ) → Set ℓ
|
|
|
|
|
Fun T U = T → U
|
|
|
|
|
|
|
|
|
|
Sets : {ℓ : Level} → Category {lsuc ℓ} {ℓ}
|
|
|
|
|
Sets {ℓ} = record
|
|
|
|
|
{ Object = Set ℓ
|
|
|
|
|
; Arrow = λ T U → Fun {ℓ} T U
|
|
|
|
|
; 𝟙 = λ x → x
|
|
|
|
|
; _⊕_ = λ g f x → g ( f x )
|
|
|
|
|
; assoc = refl
|
|
|
|
|
; ident = funExt (λ x → refl) , funExt (λ x → refl)
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 11:16:07 +00:00
|
|
|
|
Representable : {ℓ ℓ' : Level} → (ℂ : Category {ℓ} {ℓ'}) → Set (ℓ ⊔ lsuc ℓ')
|
|
|
|
|
Representable {ℓ' = ℓ'} ℂ = Functor ℂ (Sets {ℓ'})
|
|
|
|
|
|
|
|
|
|
representable : {ℓ ℓ' : Level} → {ℂ : Category {ℓ} {ℓ'}} → Category.Object ℂ → Representable ℂ
|
2018-01-17 11:10:18 +00:00
|
|
|
|
representable {ℂ = ℂ} A = record
|
2018-01-15 15:13:23 +00:00
|
|
|
|
{ func* = λ B → ℂ.Arrow A B
|
|
|
|
|
; func→ = λ f g → f ℂ.⊕ g
|
|
|
|
|
; ident = funExt λ _ → snd ℂ.ident
|
|
|
|
|
; distrib = funExt λ x → sym ℂ.assoc
|
|
|
|
|
}
|
|
|
|
|
where
|
|
|
|
|
open module ℂ = Category ℂ
|
|
|
|
|
|
2018-01-17 11:16:07 +00:00
|
|
|
|
Presheaf : {ℓ ℓ' : Level} → (ℂ : Category {ℓ} {ℓ'}) → Set (ℓ ⊔ lsuc ℓ')
|
|
|
|
|
Presheaf {ℓ' = ℓ'} ℂ = Functor (Opposite ℂ) (Sets {ℓ'})
|
|
|
|
|
|
|
|
|
|
presheaf : {ℓ ℓ' : Level} → {ℂ : Category {ℓ} {ℓ'}} → Category.Object (Opposite ℂ) → Presheaf ℂ
|
|
|
|
|
presheaf {ℂ = ℂ} B = record
|
2018-01-15 15:13:23 +00:00
|
|
|
|
{ func* = λ A → ℂ.Arrow A B
|
2018-01-17 11:10:18 +00:00
|
|
|
|
; func→ = λ f g → g ℂ.⊕ f
|
|
|
|
|
; ident = funExt λ x → fst ℂ.ident
|
|
|
|
|
; distrib = funExt λ x → ℂ.assoc
|
2018-01-15 15:13:23 +00:00
|
|
|
|
}
|
|
|
|
|
where
|
|
|
|
|
open module ℂ = Category ℂ
|