Factor out more from IsCategory

This commit is contained in:
Frederik Hanghøj Iversen 2018-02-20 17:59:48 +01:00
parent a016c67b88
commit 159bffa6ae

View file

@ -79,6 +79,28 @@ record IsCategory {a b : Level} ( : RawCategory a b) : Set (lsuc
ident : IsIdentity 𝟙
arrowIsSet : {A B : Object} isSet (Arrow A B)
idIso : (A : Object) A A
idIso A = 𝟙 , (𝟙 , ident)
id-to-iso : (A B : Object) A B A B
id-to-iso A B eq = transp (\ i A eq i) (idIso A)
-- TODO: might want to implement isEquiv
-- differently, there are 3
-- equivalent formulations in the book.
Univalent : Set (a b)
Univalent = {A B : Object} isEquiv (A B) (A B) (id-to-iso A B)
field
univalent : Univalent
-- `IsCategory` is a mere proposition.
module _ {a b : Level} {C : RawCategory a b} where
open RawCategory C
module _ ( : IsCategory C) where
open IsCategory
open import Cubical.NType
open import Cubical.NType.Properties
propIsAssociative : isProp IsAssociative
propIsAssociative x y i = arrowIsSet _ _ x y i
@ -99,20 +121,6 @@ record IsCategory {a b : Level} ( : RawCategory a b) : Set (lsuc
hh = arrowIsSet _ _ (snd x) (snd y)
in h i , hh i
idIso : (A : Object) A A
idIso A = 𝟙 , (𝟙 , ident)
id-to-iso : (A B : Object) A B A B
id-to-iso A B eq = transp (\ i A eq i) (idIso A)
-- TODO: might want to implement isEquiv
-- differently, there are 3
-- equivalent formulations in the book.
Univalent : Set (a b)
Univalent = {A B : Object} isEquiv (A B) (A B) (id-to-iso A B)
field
univalent : Univalent
module _ {A B : Object} {f : Arrow A B} where
isoIsProp : isProp (Isomorphism f)
isoIsProp a@(g , η , ε) a'@(g' , η' , ε') =
@ -128,24 +136,20 @@ record IsCategory {a b : Level} ( : RawCategory a b) : Set (lsuc
𝟙 g' ≡⟨ snd ident
g'
module _ {a b : Level} {C : RawCategory a b} { : IsCategory C} where
open IsCategory
open import Cubical.NType
open import Cubical.NType.Properties
propUnivalent : isProp Univalent
propUnivalent a b i = propPi (λ iso propHasLevel ⟨-2⟩) a b i
module _ {a} {b} { : RawCategory a b} where
open RawCategory
private
module _ (x y : IsCategory ) where
module _ (x y : IsCategory C) where
module IC = IsCategory
module X = IsCategory x
module Y = IsCategory y
-- ident : X.ident {?} ≡ Y.ident
-- In a few places I use the result of propositionality of the various
-- projections of `IsCategory` - I've arbitrarily chosed to use this
-- result from `x : IsCategory C`. I don't know which (if any) possibly
-- adverse effects this may have.
ident : (λ _ IsIdentity 𝟙) [ X.ident Y.ident ]
ident = X.propIsIdentity X.ident Y.ident
ident = propIsIdentity x X.ident Y.ident
-- A version of univalence indexed by the identity proof.
-- Note of course that since it's defined where `RawCategory ` has been opened
-- this is specialized to that category.
@ -165,12 +169,12 @@ module _ {a} {b} { : RawCategory a b} where
foo = pathJ P helper Y.ident ident
eqUni : U ident Y.univalent
eqUni = foo Y.univalent
IC.assoc (done i) = X.propIsAssociative X.assoc Y.assoc i
IC.assoc (done i) = propIsAssociative x X.assoc Y.assoc i
IC.ident (done i) = ident i
IC.arrowIsSet (done i) = X.propArrowIsSet X.arrowIsSet Y.arrowIsSet i
IC.arrowIsSet (done i) = propArrowIsSet x X.arrowIsSet Y.arrowIsSet i
IC.univalent (done i) = eqUni i
propIsCategory : isProp (IsCategory )
propIsCategory : isProp (IsCategory C)
propIsCategory = done
record Category (a b : Level) : Set (lsuc (a b)) where