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

View file

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

View file

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

View file

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