Restructure products

This commit is contained in:
Frederik Hanghøj Iversen 2018-03-08 10:20:29 +01:00
parent b61749bb91
commit fae492a1e3
3 changed files with 63 additions and 63 deletions

View file

@ -151,16 +151,17 @@ module _ { ' : Level} (unprovable : IsCategory (RawCat ')) where
private private
module P = CatProduct 𝔻 module P = CatProduct 𝔻
instance rawProduct : RawProduct { = Cat} 𝔻
isProduct : IsProduct Cat P.proj₁ P.proj₂ RawProduct.obj rawProduct = P.obj
isProduct = P.isProduct RawProduct.proj₁ rawProduct = P.proj₁
RawProduct.proj₂ rawProduct = P.proj₂
isProduct : IsProduct Cat rawProduct
IsProduct.isProduct isProduct = P.isProduct
product : Product { = Cat} 𝔻 product : Product { = Cat} 𝔻
product = record Product.raw product = rawProduct
{ obj = P.obj Product.isProduct product = isProduct
; proj₁ = P.proj₁
; proj₂ = P.proj₂
}
instance instance
hasProducts : HasProducts Cat hasProducts : HasProducts Cat

View file

@ -64,17 +64,17 @@ module _ { : Level} where
lem : proj₁ Function.∘′ (f &&& g) f × proj₂ Function.∘′ (f &&& g) g lem : proj₁ Function.∘′ (f &&& g) f × proj₂ Function.∘′ (f &&& g) g
proj₁ lem = refl proj₁ lem = refl
proj₂ lem = refl proj₂ lem = refl
instance rawProduct : RawProduct { = 𝓢} 0A 0B
isProduct : IsProduct 𝓢 {0A} {0B} {0A×0B} proj₁ proj₂ RawProduct.obj rawProduct = 0A×0B
isProduct {X = X} f g = (f &&& g) , lem {0X = X} f g RawProduct.proj₁ rawProduct = Data.Product.proj₁
RawProduct.proj₂ rawProduct = Data.Product.proj₂
isProduct : IsProduct 𝓢 rawProduct
IsProduct.isProduct isProduct {X = X} f g
= (f &&& g) , lem {0X = X} f g
product : Product { = 𝓢} 0A 0B product : Product { = 𝓢} 0A 0B
product = record Product.raw product = rawProduct
{ obj = 0A×0B Product.isProduct product = isProduct
; proj₁ = Data.Product.proj₁
; proj₂ = Data.Product.proj₂
; isProduct = λ { {X} isProduct {X = X}}
}
instance instance
SetsHasProducts : HasProducts 𝓢 SetsHasProducts : HasProducts 𝓢

View file

@ -2,61 +2,60 @@ module Cat.Category.Product where
open import Agda.Primitive open import Agda.Primitive
open import Cubical open import Cubical
open import Data.Product as P hiding (_×_) open import Data.Product as P hiding (_×_ ; proj₁ ; proj₂)
open import Cat.Category open import Cat.Category hiding (module Propositionality)
open Category open Category
module _ { ' : Level} ( : Category ') {A B obj : Object } where module _ {a b : Level} where
IsProduct : (π₁ : [ obj , A ]) (π₂ : [ obj , B ]) Set ( ') record RawProduct { : Category a b} (A B : Object ) : Set (a b) where
IsProduct π₁ π₂ no-eta-equality
= {X : Object } (x₁ : [ X , A ]) (x₂ : [ X , B ]) field
∃![ x ] ( [ π₁ x ] x₁ P.× [ π₂ x ] x₂) obj : Object
proj₁ : [ obj , A ]
proj₂ : [ obj , B ]
-- Tip from Andrea; Consider this style for efficiency: record IsProduct ( : Category a b) {A B : Object } (raw : RawProduct { = } A B) : Set (a b) where
-- record IsProduct {a b : Level} ( : Category a b) open RawProduct raw public
-- {A B obj : Object } (π₁ : Arrow obj A) (π₂ : Arrow obj B) : Set (a ⊔ b) where field
-- field isProduct : {X : Object } (x₁ : [ X , A ]) (x₂ : [ X , B ])
-- issProduct : ∀ {X : Object } (x₁ : [ X , A ]) (x₂ : [ X , B ]) ∃![ x ] ( [ proj₁ x ] x₁ P.× [ proj₂ x ] x₂)
-- → ∃![ x ] ( [ π₁ ∘ x ] ≡ x₁ P.× [ π₂ ∘ x ] ≡ x₂)
-- open IsProduct -- | Arrow product
_P[_×_] : {X} (π₁ : [ X , A ]) (π₂ : [ X , B ])
[ X , obj ]
_P[_×_] π₁ π₂ = P.proj₁ (isProduct π₁ π₂)
-- TODO `isProp (Product ...)` record Product { : Category a b} (A B : Object ) : Set (a b) where
-- TODO `isProp (HasProducts ...)` field
record Product { ' : Level} { : Category '} (A B : Object ) : Set ( ') where raw : RawProduct { = } A B
no-eta-equality isProduct : IsProduct {A} {B} raw
field
obj : Object
proj₁ : [ obj , A ]
proj₂ : [ obj , B ]
{{isProduct}} : IsProduct proj₁ proj₂
-- | Arrow product open IsProduct isProduct public
_P[_×_] : {X} (π₁ : [ X , A ]) (π₂ : [ X , B ])
[ X , obj ]
_P[_×_] π₁ π₂ = proj₁ (isProduct π₁ π₂)
record HasProducts { ' : Level} ( : Category ') : Set ( ') where record HasProducts ( : Category a b) : Set (a b) where
field field
product : (A B : Object ) Product { = } A B product : (A B : Object ) Product { = } A B
open Product hiding (obj) module _ (A B : Object ) where
open Product (product A B)
_×_ : Object
_×_ = obj
module _ (A B : Object ) where -- | Parallel product of arrows
open Product (product A B) --
_×_ : Object -- The product mentioned in awodey in Def 6.1 is not the regular product of
_×_ = obj -- arrows. It's a "parallel" product
module _ {A A' B B' : Object } where
open Product
open Product (product A B) hiding (_P[_×_]) renaming (proj₁ to fst ; proj₂ to snd)
_|×|_ : [ A , A' ] [ B , B' ] [ A × B , A' × B' ]
a |×| b = product A' B'
P[ [ a fst ]
× [ b snd ]
]
-- | Parallel product of arrows module Propositionality where
-- -- TODO `isProp (Product ...)`
-- The product mentioned in awodey in Def 6.1 is not the regular product of -- TODO `isProp (HasProducts ...)`
-- arrows. It's a "parallel" product
module _ {A A' B B' : Object } where
open Product (product A B) hiding (_P[_×_]) renaming (proj₁ to fst ; proj₂ to snd)
_|×|_ : [ A , A' ] [ B , B' ] [ A × B , A' × B' ]
a |×| b = product A' B'
P[ [ a fst ]
× [ b snd ]
]