Factor out category

This commit is contained in:
Frederik Hanghøj Iversen 2018-03-08 10:23:37 +01:00
parent faf4c54188
commit 181bd1af53

View file

@ -6,20 +6,21 @@ open import Data.Product as P hiding (_×_ ; proj₁ ; proj₂)
open import Cat.Category hiding (module Propositionality) open import Cat.Category hiding (module Propositionality)
open Category module _ {a b : Level} ( : Category a b) where
module _ {a b : Level} where open Category
record RawProduct ( : Category a b) (A B : Object ) : Set (a b) where
record RawProduct (A B : Object) : Set (a b) where
no-eta-equality no-eta-equality
field field
obj : Object obj : Object
proj₁ : [ obj , A ] proj₁ : [ obj , A ]
proj₂ : [ obj , B ] proj₂ : [ obj , B ]
record IsProduct ( : Category a b) {A B : Object } (raw : RawProduct A B) : Set (a b) where record IsProduct {A B : Object} (raw : RawProduct A B) : Set (a b) where
open RawProduct raw public open RawProduct raw public
field field
isProduct : {X : Object } (x₁ : [ X , A ]) (x₂ : [ X , B ]) isProduct : {X : Object} (x₁ : [ X , A ]) (x₂ : [ X , B ])
∃![ x ] ( [ proj₁ x ] x₁ P.× [ proj₂ x ] x₂) ∃![ x ] ( [ proj₁ x ] x₁ P.× [ proj₂ x ] x₂)
-- | Arrow product -- | Arrow product
@ -27,27 +28,27 @@ module _ {a b : Level} where
[ X , obj ] [ X , obj ]
_P[_×_] π₁ π₂ = P.proj₁ (isProduct π₁ π₂) _P[_×_] π₁ π₂ = P.proj₁ (isProduct π₁ π₂)
record Product ( : Category a b) (A B : Object ) : Set (a b) where record Product (A B : Object) : Set (a b) where
field field
raw : RawProduct A B raw : RawProduct A B
isProduct : IsProduct {A} {B} raw isProduct : IsProduct {A} {B} raw
open IsProduct isProduct public open IsProduct isProduct public
record HasProducts ( : Category a b) : Set (a b) where record HasProducts : Set (a b) where
field field
product : (A B : Object ) Product A B product : (A B : Object) Product A B
module _ (A B : Object ) where module _ (A B : Object) where
open Product (product A B) open Product (product A B)
_×_ : Object _×_ : Object
_×_ = obj _×_ = obj
-- | Parallel product of arrows -- | Parallel product of arrows
-- --
-- The product mentioned in awodey in Def 6.1 is not the regular product of -- The product mentioned in awodey in Def 6.1 is not the regular product of
-- arrows. It's a "parallel" product -- arrows. It's a "parallel" product
module _ {A A' B B' : Object } where module _ {A A' B B' : Object} where
open Product open Product
open Product (product A B) hiding (_P[_×_]) renaming (proj₁ to fst ; proj₂ to snd) open Product (product A B) hiding (_P[_×_]) renaming (proj₁ to fst ; proj₂ to snd)
_|×|_ : [ A , A' ] [ B , B' ] [ A × B , A' × B' ] _|×|_ : [ A , A' ] [ B , B' ] [ A × B , A' × B' ]