Clean up some stuff

This commit is contained in:
Frederik Hanghøj Iversen 2018-01-25 12:01:37 +01:00
parent c5a3673d9b
commit a480fca956
4 changed files with 107 additions and 117 deletions

View file

@ -22,6 +22,7 @@ eqpair eqa eqb i = eqa i , eqb i
open Functor open Functor
open Category open Category
module _ { ' : Level} {A B : Category '} where module _ { ' : Level} {A B : Category '} where
lift-eq-functors : {f g : Functor A B} lift-eq-functors : {f g : Functor A B}
(eq* : f .func* g .func*) (eq* : f .func* g .func*)
@ -179,21 +180,24 @@ module _ { ' : Level} where
module _ { ' : Level} where module _ { ' : Level} where
open Category open Category
instance instance
CatHasProducts : HasProducts (Cat ') hasProducts : HasProducts (Cat ')
CatHasProducts = record { product = product } hasProducts = record { product = product }
-- Basically proves that `Cat ` is cartesian closed. -- Basically proves that `Cat ` is cartesian closed.
module _ { : Level} { : Category } {{_ : HasProducts (Opposite )}} where module _ ( : Level) where
open Data.Product
open Category
private private
Cat : Category (lsuc ( )) ( ) open Data.Product
Cat = Cat open Category
open import Cat.Categories.Fun open import Cat.Categories.Fun
open Functor open Functor
Cat : Category (lsuc ( )) ( )
Cat = Cat
module _ ( 𝔻 : Category ) where module _ ( 𝔻 : Category ) where
private private
_𝔻⊕_ = 𝔻 ._⊕_
_⊕_ = ._⊕_
:obj: : Cat .Object :obj: : Cat .Object
:obj: = Fun { = } {𝔻 = 𝔻} :obj: = Fun { = } {𝔻 = 𝔻}
@ -216,7 +220,6 @@ module _ { : Level} { : Category } {{_ : HasProducts (Opposite )
𝔻 .Arrow (F .func* A) (G .func* B) 𝔻 .Arrow (F .func* A) (G .func* B)
:func→: ((θ , θNat) , f) = result :func→: ((θ , θNat) , f) = result
where where
_𝔻⊕_ = 𝔻 ._⊕_
θA : 𝔻 .Arrow (F .func* A) (G .func* A) θA : 𝔻 .Arrow (F .func* A) (G .func* A)
θA = θ A θA = θ A
θB : 𝔻 .Arrow (F .func* B) (G .func* B) θB : 𝔻 .Arrow (F .func* B) (G .func* B)
@ -247,23 +250,22 @@ module _ { : Level} { : Category } {{_ : HasProducts (Opposite )
C = proj₂ c C = proj₂ c
-- NaturalTransformation F G × .Arrow A B -- NaturalTransformation F G × .Arrow A B
:ident: : :func→: {c} {c} (identityNat F , .𝟙) 𝔻 .𝟙 -- :ident: : :func→: {c} {c} (identityNat F , .𝟙) 𝔻 .𝟙
:ident: = trans (proj₂ 𝔻.ident) (F .ident) -- :ident: = trans (proj₂ 𝔻.ident) (F .ident)
where
_𝔻⊕_ = 𝔻 ._⊕_
open module 𝔻 = IsCategory (𝔻 .isCategory)
-- Unfortunately the equational version has some ambigous arguments.
-- :ident: : :func→: (identityNat F , .𝟙 {o = proj₂ c}) 𝔻 .𝟙
-- :ident: = begin
-- :func→: ((:obj: ×p ) .Product.obj .𝟙) ≡⟨⟩
-- :func→: (identityNat F , .𝟙) ≡⟨⟩
-- (identityTrans F C 𝔻⊕ F .func→ ( .𝟙)) ≡⟨⟩
-- (𝔻 .𝟙 𝔻⊕ F .func→ ( .𝟙)) ≡⟨ proj₂ 𝔻.ident ⟩
-- F .func→ ( .𝟙) ≡⟨ F .ident ⟩
-- 𝔻 .𝟙
-- where -- where
-- _𝔻⊕_ = 𝔻 ._⊕_ -- _𝔻⊕_ = 𝔻 ._⊕_
-- open module 𝔻 = IsCategory (𝔻 .isCategory) -- open module 𝔻 = IsCategory (𝔻 .isCategory)
-- Unfortunately the equational version has some ambigous arguments.
:ident: : :func→: {c} {c} (identityNat F , .𝟙 {o = proj₂ c}) 𝔻 .𝟙
:ident: = begin
:func→: {c} {c} ((:obj: ×p ) .Product.obj .𝟙 {c}) ≡⟨⟩
:func→: {c} {c} (identityNat F , .𝟙) ≡⟨⟩
(identityTrans F C 𝔻⊕ F .func→ ( .𝟙)) ≡⟨⟩
𝔻 .𝟙 𝔻⊕ F .func→ ( .𝟙) ≡⟨ proj₂ 𝔻.ident
F .func→ ( .𝟙) ≡⟨ F .ident
𝔻 .𝟙
where
open module 𝔻 = IsCategory (𝔻 .isCategory)
module _ {F×A G×B H×C : Functor 𝔻 × .Object} where module _ {F×A G×B H×C : Functor 𝔻 × .Object} where
F = F×A .proj₁ F = F×A .proj₁
A = F×A .proj₂ A = F×A .proj₂
@ -271,68 +273,50 @@ module _ { : Level} { : Category } {{_ : HasProducts (Opposite )
B = G×B .proj₂ B = G×B .proj₂
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⊕_ = (:obj: ×p ) .Product.obj ._⊕_ {F×A} {G×B} {H×C} _P⊕_ = (:obj: ×p ) .Product.obj ._⊕_ {F×A} {G×B} {H×C}
module _ module _
-- NaturalTransformation F G × .Arrow A B -- NaturalTransformation F G × .Arrow A B
{θ×α : NaturalTransformation F G × .Arrow A B} {θ×f : NaturalTransformation F G × .Arrow A B}
{η×β : NaturalTransformation G H × .Arrow B C} where {η×g : NaturalTransformation G H × .Arrow B C} where
θ : Transformation F G private
θ = proj₁ (proj₁ θ×α) θ : Transformation F G
θNat : Natural F G θ θ = proj₁ (proj₁ θ×f)
θNat = proj₂ (proj₁ θ×α) θNat : Natural F G θ
f : .Arrow A B θNat = proj₂ (proj₁ θ×f)
f = proj₂ θ×α f : .Arrow A B
η : Transformation G H f = proj₂ θ×f
η = proj₁ (proj₁ η×β) η : Transformation G H
ηNat : Natural G H η η = proj₁ (proj₁ η×g)
ηNat = proj₂ (proj₁ η×β) ηNat : Natural G H η
g : .Arrow B C ηNat = proj₂ (proj₁ η×g)
g = proj₂ η×β g : .Arrow B C
-- :func→: ((θ , θNat) , f) = θB 𝔻⊕ F→f g = proj₂ η×g
_ : (:func→: {F×A} {G×B} θ×α) (θ B 𝔻⊕ F .func→ f)
_ = refl ηθNT : NaturalTransformation F H
ηθ : NaturalTransformation F H ηθNT = Fun ._⊕_ {F} {G} {H} (η , ηNat) (θ , θNat)
ηθ = Fun ._⊕_ {F} {G} {H} (η , ηNat) (θ , θNat)
_ : ηθ Fun ._⊕_ {F} {G} {H} (η , ηNat) (θ , θNat) ηθ = proj₁ ηθNT
_ = refl ηθNat = proj₂ ηθNT
ηθT = proj₁ ηθ
ηθN = proj₂ ηθ
_ : ηθT λ T η T 𝔻⊕ θ T -- Fun ._⊕_ {F} {G} {H} (η , ηNat) (θ , θNat)
_ = refl
:distrib: : :distrib: :
:func→: {F×A} {H×C} (η×β P⊕ θ×α) (η C 𝔻⊕ θ C) 𝔻⊕ F .func→ (g ℂ⊕ f)
(:func→: {G×B} {H×C} η×β) 𝔻⊕ (:func→: {F×A} {G×B} θ×α) (η C 𝔻⊕ G .func→ g) 𝔻⊕ (θ B 𝔻⊕ F .func→ f)
:distrib: = begin :distrib: = begin
:func→: {F×A} {H×C} (η×β P⊕ θ×α) ≡⟨⟩ (ηθ C) 𝔻⊕ F .func→ (g ℂ⊕ f) ≡⟨ ηθNat (g ℂ⊕ f)
:func→: {F×A} {H×C} (ηθ , g ℂ⊕ f) ≡⟨⟩ H .func→ (g ℂ⊕ f) 𝔻⊕ (ηθ A) ≡⟨ cong (λ φ φ 𝔻⊕ ηθ A) (H .distrib)
(ηθT C 𝔻⊕ F .func→ (g ℂ⊕ f)) ≡⟨ ηθN (g ℂ⊕ f) (H .func→ g 𝔻⊕ H .func→ f) 𝔻⊕ (ηθ A) ≡⟨ sym assoc
(H .func→ (g ℂ⊕ f) 𝔻⊕ ηθT A) ≡⟨ cong (λ φ φ 𝔻⊕ ηθT A) (H .distrib) H .func→ g 𝔻⊕ (H .func→ f 𝔻⊕ (ηθ A)) ≡⟨⟩
((H .func→ g 𝔻⊕ H .func→ f) 𝔻⊕ ηθT A) ≡⟨ sym 𝔻.assoc H .func→ g 𝔻⊕ (H .func→ f 𝔻⊕ (ηθ A)) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) assoc
(H .func→ g 𝔻⊕ (H .func→ f 𝔻⊕ ηθT A)) ≡⟨⟩ H .func→ g 𝔻⊕ ((H .func→ f 𝔻⊕ η A) 𝔻⊕ θ A) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) (cong (λ φ φ 𝔻⊕ θ A) (sym (ηNat f)))
(H .func→ g 𝔻⊕ (H .func→ f 𝔻⊕ (η A 𝔻⊕ θ A))) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) 𝔻.assoc H .func→ g 𝔻⊕ ((η B 𝔻⊕ G .func→ f) 𝔻⊕ θ A) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) (sym assoc)
(H .func→ g 𝔻⊕ ((H .func→ f 𝔻⊕ η A) 𝔻⊕ θ A)) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) (cong (λ φ φ 𝔻⊕ θ A) (sym (ηNat f))) H .func→ g 𝔻⊕ (η B 𝔻⊕ (G .func→ f 𝔻⊕ θ A)) ≡⟨ assoc
(H .func→ g 𝔻⊕ ((η B 𝔻⊕ G .func→ f) 𝔻⊕ θ A)) ≡⟨ cong (λ φ H .func→ g 𝔻⊕ φ) (sym 𝔻.assoc) (H .func→ g 𝔻⊕ η B) 𝔻⊕ (G .func→ f 𝔻⊕ θ A) ≡⟨ cong (λ φ φ 𝔻⊕ (G .func→ f 𝔻⊕ θ A)) (sym (ηNat g))
(H .func→ g 𝔻⊕ (η B 𝔻⊕ (G .func→ f 𝔻⊕ θ A))) ≡⟨ 𝔻.assoc (η C 𝔻⊕ G .func→ g) 𝔻⊕ (G .func→ f 𝔻⊕ θ A) ≡⟨ cong (λ φ (η C 𝔻⊕ G .func→ g) 𝔻⊕ φ) (sym (θNat f))
((H .func→ g 𝔻⊕ η B) 𝔻⊕ (G .func→ f 𝔻⊕ θ A)) ≡⟨ cong (λ φ φ 𝔻⊕ (G .func→ f 𝔻⊕ θ A)) (sym (ηNat g)) (η C 𝔻⊕ G .func→ g) 𝔻⊕ (θ B 𝔻⊕ F .func→ f)
((η C 𝔻⊕ G .func→ g) 𝔻⊕ (G .func→ f 𝔻⊕ θ A)) ≡⟨ cong (λ φ (η C 𝔻⊕ G .func→ g) 𝔻⊕ φ) (sym (θNat f))
((η C 𝔻⊕ G .func→ g) 𝔻⊕ (θ B 𝔻⊕ F .func→ f)) ≡⟨⟩
((:func→: {G×B} {H×C} η×β) 𝔻⊕ (:func→: {F×A} {G×B} θ×α))
where where
lemθ : θ B 𝔻⊕ F .func→ f G .func→ f 𝔻⊕ θ A open IsCategory (𝔻 .isCategory)
lemθ = θNat f
lemη : η C 𝔻⊕ G .func→ g H .func→ g 𝔻⊕ η B
lemη = ηNat g
lemm : ηθT C 𝔻⊕ F .func→ (g ℂ⊕ f) (H .func→ (g ℂ⊕ f) 𝔻⊕ ηθT A)
lemm = ηθN (g ℂ⊕ f)
final : η B 𝔻⊕ G .func→ f H .func→ f 𝔻⊕ η A
final = ηNat f
open module 𝔻 = IsCategory (𝔻 .isCategory)
-- Type of `:eval:` is aka.:
-- Functor ((:obj: ×p ) .Product.obj) 𝔻
-- :eval: : Cat .Arrow ((:obj: ×p ) .Product.obj) 𝔻
:eval: : Functor ((:obj: ×p ) .Product.obj) 𝔻 :eval: : Functor ((:obj: ×p ) .Product.obj) 𝔻
:eval: = record :eval: = record
{ func* = :func*: { func* = :func*:
@ -342,14 +326,8 @@ module _ { : Level} { : Category } {{_ : HasProducts (Opposite )
} }
module _ (𝔸 : Category ) (F : Functor ((𝔸 ×p ) .Product.obj) 𝔻) where module _ (𝔸 : Category ) (F : Functor ((𝔸 ×p ) .Product.obj) 𝔻) where
instance open HasProducts (hasProducts {} {}) using (parallelProduct)
CatHasProducts : HasProducts Cat
CatHasProducts = CatHasProducts {} {}
t : Cat .Arrow ((𝔸 ×p ) .Product.obj) 𝔻 Functor ((𝔸 ×p ) .Product.obj) 𝔻
t = refl
tt : Category
tt = (𝔸 ×p ) .Product.obj
open HasProducts CatHasProducts
postulate postulate
transpose : Functor 𝔸 :obj: transpose : Functor 𝔸 :obj:
eq : Cat ._⊕_ :eval: (parallelProduct transpose (Cat .𝟙 {o = })) F eq : Cat ._⊕_ :eval: (parallelProduct transpose (Cat .𝟙 {o = })) F
@ -369,5 +347,5 @@ module _ { : Level} { : Category } {{_ : HasProducts (Opposite )
; isExponential = :isExponential: ; isExponential = :isExponential:
} }
CatHasExponentials : HasExponentials Cat hasExponentials : HasExponentials (Cat )
CatHasExponentials = record { exponent = :exponent: } hasExponentials = record { exponent = :exponent: }

View file

@ -1,5 +1,3 @@
{-# OPTIONS --allow-unsolved-metas #-}
module Cat.Categories.Sets where module Cat.Categories.Sets where
open import Cubical.PathPrelude open import Cubical.PathPrelude
@ -25,17 +23,19 @@ module _ { : Level} where
private private
module _ {X A B : Set } (f : X A) (g : X B) where module _ {X A B : Set } (f : X A) (g : X B) where
pair : (X A × B) _&&&_ : (X A × B)
pair x = f x , g x _&&&_ x = f x , g x
lem : Sets ._⊕_ proj₁ pair f × Sets ._⊕_ snd pair g module _ {X A B : Set } (f : X A) (g : X B) where
_S⊕_ = Sets ._⊕_
lem : proj₁ S⊕ (f &&& g) f × snd S⊕ (f &&& g) g
proj₁ lem = refl proj₁ lem = refl
snd lem = refl proj₂ lem = refl
instance instance
isProduct : {A B : Sets .Object} IsProduct Sets {A} {B} fst snd isProduct : {A B : Sets .Object} IsProduct Sets {A} {B} fst snd
isProduct f g = pair f g , lem f g isProduct f g = f &&& g , lem f g
product : (A B : Sets .Object) Product { = Sets} A B product : (A B : Sets .Object) Product { = Sets} A B
product A B = record { obj = A × B ; proj₁ = fst ; proj₂ = snd ; isProduct = {!!} } product A B = record { obj = A × B ; proj₁ = fst ; proj₂ = snd ; isProduct = isProduct }
instance instance
SetsHasProducts : HasProducts Sets SetsHasProducts : HasProducts Sets

View file

@ -141,8 +141,8 @@ module _ { ' : Level} { : Category '} where
Hom A B Hom A B' Hom A B Hom A B'
HomFromArrow _A = _⊕_ HomFromArrow _A = _⊕_
module _ { '} ( : Category ') {{HasProducts : HasProducts }} where module _ { '} ( : Category ') {{hasProducts : HasProducts }} where
open HasProducts HasProducts open HasProducts hasProducts
open Product hiding (obj) open Product hiding (obj)
private private
_×p_ : (A B : .Object) .Object _×p_ : (A B : .Object) .Object
@ -161,8 +161,8 @@ module _ { '} ( : Category ') {{HasProducts : HasProducts
{{isExponential}} : IsExponential obj eval {{isExponential}} : IsExponential obj eval
-- If I make this an instance-argument then the instance resolution -- If I make this an instance-argument then the instance resolution
-- algorithm goes into an infinite loop. Why? -- algorithm goes into an infinite loop. Why?
productsFromExp : HasProducts exponentialsHaveProducts : HasProducts
productsFromExp = HasProducts exponentialsHaveProducts = hasProducts
transpose : (A : .Object) .Arrow (A ×p B) C .Arrow A obj transpose : (A : .Object) .Arrow (A ×p B) C .Arrow A obj
transpose A f = fst (isExponential A f) transpose A f = fst (isExponential A f)

View file

@ -48,25 +48,37 @@ epi-mono-is-not-iso f =
in {!!} in {!!}
-} -}
open import Cat.Categories.Cat module _ { : Level} { : Category } where
open import Cat.Category
open Category
open import Cat.Categories.Cat using (Cat)
module Cat = Cat.Categories.Cat
open Exponential open Exponential
open HasExponentials CatHasExponentials private
Cat = Cat
CatHasExponentials : HasExponentials Cat
CatHasExponentials = Cat.hasExponentials
Exp : Set {!!} -- Exp : Set (lsuc (lsuc ))
Exp = Exponential (Cat {!!} {!!}) {{HasProducts = {!!}}} -- Exp = Exponential (Cat (lsuc ) )
Sets (Opposite {!!}) -- Sets (Opposite )
-- _⇑_ : (A B : Cat .Object) → Cat .Object _⇑_ : (A B : Cat .Object) Cat .Object
-- A ⇑ B = (exponent A B) .obj A B = (exponent A B) .obj
where
open HasExponentials CatHasExponentials
-- private private
-- :func*: : .Object (Sets Opposite ) .Object -- I need `Sets` to be a `Category ` but it simlpy isn't.
-- :func*: x = {!!} Setz : Category
Setz = {!Sets!}
:func*: : .Object (Setz Opposite ) .Object
:func*: A = {!!}
-- yoneda : Functor (Sets ⇑ (Opposite )) yoneda : Functor (Setz (Opposite ))
-- yoneda = record yoneda = record
-- { func* = :func*: { func* = :func*:
-- ; func→ = {!!} ; func→ = {!!}
-- ; ident = {!!} ; ident = {!!}
-- ; distrib = {!!} ; distrib = {!!}
-- } }