2018-05-08 16:34:12 +00:00
|
|
|
|
{-# OPTIONS --cubical --caching #-}
|
2018-02-05 13:59:53 +00:00
|
|
|
|
module Cat.Category.Product where
|
2018-02-05 13:08:30 +00:00
|
|
|
|
|
2018-04-05 08:41:56 +00:00
|
|
|
|
open import Cat.Prelude as P hiding (_×_ ; fst ; snd)
|
2018-04-19 10:20:44 +00:00
|
|
|
|
open import Cat.Equivalence
|
2018-02-05 13:08:30 +00:00
|
|
|
|
|
2018-03-21 11:17:10 +00:00
|
|
|
|
open import Cat.Category
|
2018-02-05 13:08:30 +00:00
|
|
|
|
|
2018-03-08 09:23:37 +00:00
|
|
|
|
module _ {ℓa ℓb : Level} (ℂ : Category ℓa ℓb) where
|
|
|
|
|
open Category ℂ
|
|
|
|
|
|
2018-03-08 09:28:05 +00:00
|
|
|
|
module _ (A B : Object) where
|
|
|
|
|
record RawProduct : Set (ℓa ⊔ ℓb) where
|
|
|
|
|
no-eta-equality
|
|
|
|
|
field
|
2018-03-08 09:45:15 +00:00
|
|
|
|
object : Object
|
2018-04-05 08:41:56 +00:00
|
|
|
|
fst : ℂ [ object , A ]
|
|
|
|
|
snd : ℂ [ object , B ]
|
2018-03-08 09:28:05 +00:00
|
|
|
|
|
|
|
|
|
record IsProduct (raw : RawProduct) : Set (ℓa ⊔ ℓb) where
|
|
|
|
|
open RawProduct raw public
|
|
|
|
|
field
|
2018-03-14 09:23:23 +00:00
|
|
|
|
ump : ∀ {X : Object} (f : ℂ [ X , A ]) (g : ℂ [ X , B ])
|
2018-04-05 08:41:56 +00:00
|
|
|
|
→ ∃![ f×g ] (ℂ [ fst ∘ f×g ] ≡ f P.× ℂ [ snd ∘ f×g ] ≡ g)
|
2018-03-08 09:28:05 +00:00
|
|
|
|
|
|
|
|
|
-- | Arrow product
|
|
|
|
|
_P[_×_] : ∀ {X} → (π₁ : ℂ [ X , A ]) (π₂ : ℂ [ X , B ])
|
2018-03-08 09:45:15 +00:00
|
|
|
|
→ ℂ [ X , object ]
|
2018-04-05 08:41:56 +00:00
|
|
|
|
_P[_×_] π₁ π₂ = P.fst (ump π₁ π₂)
|
2018-03-08 09:28:05 +00:00
|
|
|
|
|
|
|
|
|
record Product : Set (ℓa ⊔ ℓb) where
|
|
|
|
|
field
|
|
|
|
|
raw : RawProduct
|
|
|
|
|
isProduct : IsProduct raw
|
|
|
|
|
|
|
|
|
|
open IsProduct isProduct public
|
2018-03-08 09:20:29 +00:00
|
|
|
|
|
2018-03-08 09:23:37 +00:00
|
|
|
|
record HasProducts : Set (ℓa ⊔ ℓb) where
|
2018-03-08 09:20:29 +00:00
|
|
|
|
field
|
2018-03-08 09:23:37 +00:00
|
|
|
|
product : ∀ (A B : Object) → Product A B
|
2018-03-08 09:20:29 +00:00
|
|
|
|
|
2018-03-08 09:30:35 +00:00
|
|
|
|
_×_ : Object → Object → Object
|
2018-03-08 09:45:15 +00:00
|
|
|
|
A × B = Product.object (product A B)
|
2018-03-08 09:20:29 +00:00
|
|
|
|
|
|
|
|
|
-- | Parallel product of arrows
|
|
|
|
|
--
|
|
|
|
|
-- The product mentioned in awodey in Def 6.1 is not the regular product of
|
|
|
|
|
-- arrows. It's a "parallel" product
|
2018-03-08 09:23:37 +00:00
|
|
|
|
module _ {A A' B B' : Object} where
|
2018-04-05 08:41:56 +00:00
|
|
|
|
open Product using (_P[_×_])
|
|
|
|
|
open Product (product A B) hiding (_P[_×_]) renaming (fst to fst ; snd to snd)
|
2018-03-08 09:20:29 +00:00
|
|
|
|
_|×|_ : ℂ [ A , A' ] → ℂ [ B , B' ] → ℂ [ A × B , A' × B' ]
|
2018-03-08 09:30:35 +00:00
|
|
|
|
f |×| g = product A' B'
|
|
|
|
|
P[ ℂ [ f ∘ fst ]
|
|
|
|
|
× ℂ [ g ∘ snd ]
|
2018-03-08 09:20:29 +00:00
|
|
|
|
]
|
|
|
|
|
|
2018-03-14 09:23:23 +00:00
|
|
|
|
module _ {ℓa ℓb : Level} {ℂ : Category ℓa ℓb} {A B : Category.Object ℂ} where
|
|
|
|
|
private
|
|
|
|
|
open Category ℂ
|
|
|
|
|
module _ (raw : RawProduct ℂ A B) where
|
|
|
|
|
module _ (x y : IsProduct ℂ A B raw) where
|
|
|
|
|
private
|
|
|
|
|
module x = IsProduct x
|
|
|
|
|
module y = IsProduct y
|
|
|
|
|
|
|
|
|
|
module _ {X : Object} (f : ℂ [ X , A ]) (g : ℂ [ X , B ]) where
|
2018-04-03 10:40:20 +00:00
|
|
|
|
module _ (f×g : Arrow X y.object) where
|
2018-04-05 08:41:56 +00:00
|
|
|
|
help : isProp (∀{y} → (ℂ [ y.fst ∘ y ] ≡ f) P.× (ℂ [ y.snd ∘ y ] ≡ g) → f×g ≡ y)
|
2018-04-03 10:40:20 +00:00
|
|
|
|
help = propPiImpl (λ _ → propPi (λ _ → arrowsAreSets _ _))
|
|
|
|
|
|
|
|
|
|
res = ∃-unique (x.ump f g) (y.ump f g)
|
|
|
|
|
|
2018-03-14 09:23:23 +00:00
|
|
|
|
prodAux : x.ump f g ≡ y.ump f g
|
2018-04-03 10:40:20 +00:00
|
|
|
|
prodAux = lemSig ((λ f×g → propSig (propSig (arrowsAreSets _ _) λ _ → arrowsAreSets _ _) (λ _ → help f×g))) _ _ res
|
2018-03-14 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
propIsProduct' : x ≡ y
|
|
|
|
|
propIsProduct' i = record { ump = λ f g → prodAux f g i }
|
|
|
|
|
|
|
|
|
|
propIsProduct : isProp (IsProduct ℂ A B raw)
|
|
|
|
|
propIsProduct = propIsProduct'
|
|
|
|
|
|
|
|
|
|
Product≡ : {x y : Product ℂ A B} → (Product.raw x ≡ Product.raw y) → x ≡ y
|
|
|
|
|
Product≡ {x} {y} p i = record { raw = p i ; isProduct = q i }
|
|
|
|
|
where
|
|
|
|
|
q : (λ i → IsProduct ℂ A B (p i)) [ Product.isProduct x ≡ Product.isProduct y ]
|
|
|
|
|
q = lemPropF propIsProduct p
|
|
|
|
|
|
2018-03-27 10:20:24 +00:00
|
|
|
|
module Try0 {ℓa ℓb : Level} {ℂ : Category ℓa ℓb}
|
2018-05-01 09:41:45 +00:00
|
|
|
|
(let module ℂ = Category ℂ) {𝒜 ℬ : ℂ.Object} where
|
2018-03-27 10:20:24 +00:00
|
|
|
|
|
2018-04-05 08:41:56 +00:00
|
|
|
|
open P
|
2018-03-27 10:20:24 +00:00
|
|
|
|
|
2018-03-29 22:12:01 +00:00
|
|
|
|
module _ where
|
|
|
|
|
raw : RawCategory _ _
|
|
|
|
|
raw = record
|
2018-05-01 09:41:45 +00:00
|
|
|
|
{ Object = Σ[ X ∈ ℂ.Object ] ℂ.Arrow X 𝒜 × ℂ.Arrow X ℬ
|
2018-04-25 06:19:36 +00:00
|
|
|
|
; Arrow = λ{ (A , a0 , a1) (B , b0 , b1)
|
|
|
|
|
→ Σ[ f ∈ ℂ.Arrow A B ]
|
|
|
|
|
ℂ [ b0 ∘ f ] ≡ a0
|
|
|
|
|
× ℂ [ b1 ∘ f ] ≡ a1
|
2018-03-29 22:12:01 +00:00
|
|
|
|
}
|
2018-04-04 15:45:36 +00:00
|
|
|
|
; identity = λ{ {X , f , g} → ℂ.identity {X} , ℂ.rightIdentity , ℂ.rightIdentity}
|
2018-04-11 08:58:50 +00:00
|
|
|
|
; _<<<_ = λ { {_ , a0 , a1} {_ , b0 , b1} {_ , c0 , c1} (f , f0 , f1) (g , g0 , g1)
|
|
|
|
|
→ (f ℂ.<<< g)
|
2018-03-29 22:12:01 +00:00
|
|
|
|
, (begin
|
|
|
|
|
ℂ [ c0 ∘ ℂ [ f ∘ g ] ] ≡⟨ ℂ.isAssociative ⟩
|
|
|
|
|
ℂ [ ℂ [ c0 ∘ f ] ∘ g ] ≡⟨ cong (λ φ → ℂ [ φ ∘ g ]) f0 ⟩
|
|
|
|
|
ℂ [ b0 ∘ g ] ≡⟨ g0 ⟩
|
|
|
|
|
a0 ∎
|
|
|
|
|
)
|
|
|
|
|
, (begin
|
|
|
|
|
ℂ [ c1 ∘ ℂ [ f ∘ g ] ] ≡⟨ ℂ.isAssociative ⟩
|
|
|
|
|
ℂ [ ℂ [ c1 ∘ f ] ∘ g ] ≡⟨ cong (λ φ → ℂ [ φ ∘ g ]) f1 ⟩
|
|
|
|
|
ℂ [ b1 ∘ g ] ≡⟨ g1 ⟩
|
|
|
|
|
a1 ∎
|
|
|
|
|
)
|
2018-03-29 13:47:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-27 10:20:24 +00:00
|
|
|
|
|
2018-04-05 12:37:25 +00:00
|
|
|
|
module _ where
|
2018-04-13 13:26:46 +00:00
|
|
|
|
open RawCategory raw
|
2018-03-29 22:12:01 +00:00
|
|
|
|
|
2018-04-13 12:35:54 +00:00
|
|
|
|
propEqs : ∀ {X' : Object}{Y' : Object} (let X , xa , xb = X') (let Y , ya , yb = Y')
|
2018-04-06 14:54:00 +00:00
|
|
|
|
→ (xy : ℂ.Arrow X Y) → isProp (ℂ [ ya ∘ xy ] ≡ xa × ℂ [ yb ∘ xy ] ≡ xb)
|
2018-04-13 12:35:54 +00:00
|
|
|
|
propEqs xs = propSig (ℂ.arrowsAreSets _ _) (\ _ → ℂ.arrowsAreSets _ _)
|
2018-03-30 09:06:45 +00:00
|
|
|
|
|
2018-04-26 08:20:57 +00:00
|
|
|
|
arrowEq : {X Y : Object} {f g : Arrow X Y} → fst f ≡ fst g → f ≡ g
|
|
|
|
|
arrowEq {X} {Y} {f} {g} p = λ i → p i , lemPropF propEqs p {snd f} {snd g} i
|
|
|
|
|
|
2018-04-13 12:35:54 +00:00
|
|
|
|
private
|
2018-04-06 14:54:00 +00:00
|
|
|
|
isAssociative : IsAssociative
|
2018-04-26 08:20:57 +00:00
|
|
|
|
isAssociative {f = f , f0 , f1} {g , g0 , g1} {h , h0 , h1} = arrowEq ℂ.isAssociative
|
2018-03-29 22:12:01 +00:00
|
|
|
|
|
2018-04-06 14:54:00 +00:00
|
|
|
|
isIdentity : IsIdentity identity
|
2018-04-26 08:20:57 +00:00
|
|
|
|
isIdentity {AA@(A , a0 , a1)} {BB@(B , b0 , b1)} {f , f0 , f1} = arrowEq ℂ.leftIdentity , arrowEq ℂ.rightIdentity
|
2018-04-06 14:54:00 +00:00
|
|
|
|
|
|
|
|
|
arrowsAreSets : ArrowsAreSets
|
|
|
|
|
arrowsAreSets {X , x0 , x1} {Y , y0 , y1}
|
2018-04-26 08:20:57 +00:00
|
|
|
|
= sigPresSet ℂ.arrowsAreSets λ a → propSet (propEqs _)
|
2018-04-05 12:37:25 +00:00
|
|
|
|
|
|
|
|
|
isPreCat : IsPreCategory raw
|
|
|
|
|
IsPreCategory.isAssociative isPreCat = isAssociative
|
|
|
|
|
IsPreCategory.isIdentity isPreCat = isIdentity
|
|
|
|
|
IsPreCategory.arrowsAreSets isPreCat = arrowsAreSets
|
|
|
|
|
|
|
|
|
|
open IsPreCategory isPreCat
|
2018-04-03 10:40:20 +00:00
|
|
|
|
|
2018-04-13 13:35:56 +00:00
|
|
|
|
module _ {𝕏 𝕐 : Object} where
|
2018-04-11 10:27:33 +00:00
|
|
|
|
open Σ 𝕏 renaming (fst to X ; snd to x)
|
|
|
|
|
open Σ x renaming (fst to xa ; snd to xb)
|
|
|
|
|
open Σ 𝕐 renaming (fst to Y ; snd to y)
|
|
|
|
|
open Σ y renaming (fst to ya ; snd to yb)
|
2018-04-19 10:20:44 +00:00
|
|
|
|
open import Cat.Equivalence using (composeIso) renaming (_≅_ to _≅_)
|
2018-04-06 14:54:00 +00:00
|
|
|
|
step0
|
|
|
|
|
: ((X , xa , xb) ≡ (Y , ya , yb))
|
2018-05-01 09:41:45 +00:00
|
|
|
|
≅ (Σ[ p ∈ (X ≡ Y) ] (PathP (λ i → ℂ.Arrow (p i) 𝒜) xa ya) × (PathP (λ i → ℂ.Arrow (p i) ℬ) xb yb))
|
2018-04-06 14:54:00 +00:00
|
|
|
|
step0
|
2018-04-11 09:10:33 +00:00
|
|
|
|
= (λ p → cong fst p , cong-d (fst ∘ snd) p , cong-d (snd ∘ snd) p)
|
2018-04-09 16:10:39 +00:00
|
|
|
|
-- , (λ x → λ i → fst x i , (fst (snd x) i) , (snd (snd x) i))
|
|
|
|
|
, (λ{ (p , q , r) → Σ≡ p λ i → q i , r i})
|
2018-04-11 11:53:33 +00:00
|
|
|
|
, funExt (λ{ p → refl})
|
|
|
|
|
, funExt (λ{ (p , q , r) → refl})
|
2018-04-10 15:17:04 +00:00
|
|
|
|
|
2018-04-06 14:54:00 +00:00
|
|
|
|
step1
|
2018-05-01 09:41:45 +00:00
|
|
|
|
: (Σ[ p ∈ (X ≡ Y) ] (PathP (λ i → ℂ.Arrow (p i) 𝒜) xa ya) × (PathP (λ i → ℂ.Arrow (p i) ℬ) xb yb))
|
2018-04-19 10:20:44 +00:00
|
|
|
|
≅ Σ (X ℂ.≊ Y) (λ iso
|
2018-04-10 15:17:04 +00:00
|
|
|
|
→ let p = ℂ.isoToId iso
|
2018-04-06 14:54:00 +00:00
|
|
|
|
in
|
2018-05-01 09:41:45 +00:00
|
|
|
|
( PathP (λ i → ℂ.Arrow (p i) 𝒜) xa ya)
|
|
|
|
|
× PathP (λ i → ℂ.Arrow (p i) ℬ) xb yb
|
2018-04-06 14:54:00 +00:00
|
|
|
|
)
|
|
|
|
|
step1
|
2018-04-13 12:18:28 +00:00
|
|
|
|
= symIso
|
2018-04-13 13:22:13 +00:00
|
|
|
|
(isoSigFst
|
2018-04-19 10:20:44 +00:00
|
|
|
|
{A = (X ℂ.≊ Y)}
|
2018-04-13 13:22:13 +00:00
|
|
|
|
{B = (X ≡ Y)}
|
|
|
|
|
(ℂ.groupoidObject _ _)
|
2018-05-01 09:41:45 +00:00
|
|
|
|
{Q = \ p → (PathP (λ i → ℂ.Arrow (p i) 𝒜) xa ya) × (PathP (λ i → ℂ.Arrow (p i) ℬ) xb yb)}
|
2018-04-13 13:22:13 +00:00
|
|
|
|
ℂ.isoToId
|
|
|
|
|
(symIso (_ , ℂ.asTypeIso {X} {Y}) .snd)
|
|
|
|
|
)
|
2018-04-13 12:18:28 +00:00
|
|
|
|
|
2018-04-06 14:54:00 +00:00
|
|
|
|
step2
|
2018-04-19 10:20:44 +00:00
|
|
|
|
: Σ (X ℂ.≊ Y) (λ iso
|
2018-04-10 15:17:04 +00:00
|
|
|
|
→ let p = ℂ.isoToId iso
|
2018-04-06 14:54:00 +00:00
|
|
|
|
in
|
2018-05-01 09:41:45 +00:00
|
|
|
|
( PathP (λ i → ℂ.Arrow (p i) 𝒜) xa ya)
|
|
|
|
|
× PathP (λ i → ℂ.Arrow (p i) ℬ) xb yb
|
2018-04-06 14:54:00 +00:00
|
|
|
|
)
|
2018-04-19 10:20:44 +00:00
|
|
|
|
≅ ((X , xa , xb) ≊ (Y , ya , yb))
|
2018-04-06 14:54:00 +00:00
|
|
|
|
step2
|
2018-04-13 11:24:17 +00:00
|
|
|
|
= ( λ{ (iso@(f , f~ , inv-f) , p , q)
|
2018-04-26 08:20:57 +00:00
|
|
|
|
→ ( f , sym (ℂ.domain-twist-sym iso p) , sym (ℂ.domain-twist-sym iso q))
|
|
|
|
|
, ( f~ , sym (ℂ.domain-twist iso p) , sym (ℂ.domain-twist iso q))
|
|
|
|
|
, arrowEq (fst inv-f)
|
|
|
|
|
, arrowEq (snd inv-f)
|
2018-04-06 14:54:00 +00:00
|
|
|
|
}
|
|
|
|
|
)
|
2018-04-10 15:17:04 +00:00
|
|
|
|
, (λ{ (f , f~ , inv-f , inv-f~) →
|
|
|
|
|
let
|
2018-04-19 10:20:44 +00:00
|
|
|
|
iso : X ℂ.≊ Y
|
2018-04-10 15:17:04 +00:00
|
|
|
|
iso = fst f , fst f~ , cong fst inv-f , cong fst inv-f~
|
2018-04-13 07:40:09 +00:00
|
|
|
|
p : X ≡ Y
|
|
|
|
|
p = ℂ.isoToId iso
|
2018-05-01 09:41:45 +00:00
|
|
|
|
pA : ℂ.Arrow X 𝒜 ≡ ℂ.Arrow Y 𝒜
|
|
|
|
|
pA = cong (λ x → ℂ.Arrow x 𝒜) p
|
|
|
|
|
pB : ℂ.Arrow X ℬ ≡ ℂ.Arrow Y ℬ
|
|
|
|
|
pB = cong (λ x → ℂ.Arrow x ℬ) p
|
2018-04-13 11:24:17 +00:00
|
|
|
|
k0 = begin
|
|
|
|
|
coe pB xb ≡⟨ ℂ.coe-dom iso ⟩
|
|
|
|
|
xb ℂ.<<< fst f~ ≡⟨ snd (snd f~) ⟩
|
|
|
|
|
yb ∎
|
|
|
|
|
k1 = begin
|
|
|
|
|
coe pA xa ≡⟨ ℂ.coe-dom iso ⟩
|
|
|
|
|
xa ℂ.<<< fst f~ ≡⟨ fst (snd f~) ⟩
|
|
|
|
|
ya ∎
|
|
|
|
|
in iso , coe-lem-inv k1 , coe-lem-inv k0})
|
2018-04-13 13:26:46 +00:00
|
|
|
|
, funExt (λ x → lemSig
|
2018-04-10 15:17:04 +00:00
|
|
|
|
(λ x → propSig prop0 (λ _ → prop1))
|
|
|
|
|
_ _
|
2018-04-13 12:35:54 +00:00
|
|
|
|
(Σ≡ refl (ℂ.propIsomorphism _ _ _)))
|
2018-04-13 13:26:46 +00:00
|
|
|
|
, funExt (λ{ (f , _) → lemSig propIsomorphism _ _ (Σ≡ refl (propEqs _ _ _))})
|
2018-04-10 15:17:04 +00:00
|
|
|
|
where
|
2018-05-01 09:41:45 +00:00
|
|
|
|
prop0 : ∀ {x} → isProp (PathP (λ i → ℂ.Arrow (ℂ.isoToId x i) 𝒜) xa ya)
|
|
|
|
|
prop0 {x} = pathJ (λ y p → ∀ x → isProp (PathP (λ i → ℂ.Arrow (p i) 𝒜) xa x)) (λ x → ℂ.arrowsAreSets _ _) Y (ℂ.isoToId x) ya
|
|
|
|
|
prop1 : ∀ {x} → isProp (PathP (λ i → ℂ.Arrow (ℂ.isoToId x i) ℬ) xb yb)
|
|
|
|
|
prop1 {x} = pathJ (λ y p → ∀ x → isProp (PathP (λ i → ℂ.Arrow (p i) ℬ) xb x)) (λ x → ℂ.arrowsAreSets _ _) Y (ℂ.isoToId x) yb
|
2018-04-06 14:54:00 +00:00
|
|
|
|
-- One thing to watch out for here is that the isomorphisms going forwards
|
|
|
|
|
-- must compose to give idToIso
|
|
|
|
|
iso
|
|
|
|
|
: ((X , xa , xb) ≡ (Y , ya , yb))
|
2018-04-19 10:20:44 +00:00
|
|
|
|
≅ ((X , xa , xb) ≊ (Y , ya , yb))
|
2018-04-06 14:54:00 +00:00
|
|
|
|
iso = step0 ⊙ step1 ⊙ step2
|
|
|
|
|
where
|
|
|
|
|
infixl 5 _⊙_
|
|
|
|
|
_⊙_ = composeIso
|
2018-04-10 15:17:04 +00:00
|
|
|
|
equiv1
|
|
|
|
|
: ((X , xa , xb) ≡ (Y , ya , yb))
|
2018-04-19 10:20:44 +00:00
|
|
|
|
≃ ((X , xa , xb) ≊ (Y , ya , yb))
|
2018-04-10 15:17:04 +00:00
|
|
|
|
equiv1 = _ , fromIso _ _ (snd iso)
|
|
|
|
|
|
2018-04-11 11:18:34 +00:00
|
|
|
|
univalent : Univalent
|
2018-04-13 13:35:56 +00:00
|
|
|
|
univalent = univalenceFrom≃ equiv1
|
2018-04-03 10:40:20 +00:00
|
|
|
|
|
2018-03-29 22:12:01 +00:00
|
|
|
|
isCat : IsCategory raw
|
2018-04-05 12:37:25 +00:00
|
|
|
|
IsCategory.isPreCategory isCat = isPreCat
|
|
|
|
|
IsCategory.univalent isCat = univalent
|
2018-03-27 10:20:24 +00:00
|
|
|
|
|
2018-03-29 22:12:01 +00:00
|
|
|
|
cat : Category _ _
|
|
|
|
|
cat = record
|
|
|
|
|
{ raw = raw
|
|
|
|
|
; isCategory = isCat
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
open Category cat
|
|
|
|
|
|
2018-05-01 09:41:45 +00:00
|
|
|
|
lemma : Terminal ≃ Product ℂ 𝒜 ℬ
|
|
|
|
|
lemma = fromIsomorphism Terminal (Product ℂ 𝒜 ℬ) (f , g , inv)
|
|
|
|
|
-- C-x 8 RET MATHEMATICAL BOLD SCRIPT CAPITAL A
|
|
|
|
|
-- 𝒜
|
2018-03-29 13:47:43 +00:00
|
|
|
|
where
|
2018-05-01 09:41:45 +00:00
|
|
|
|
f : Terminal → Product ℂ 𝒜 ℬ
|
2018-03-29 22:12:01 +00:00
|
|
|
|
f ((X , x0 , x1) , uniq) = p
|
2018-03-29 13:47:43 +00:00
|
|
|
|
where
|
2018-05-01 09:41:45 +00:00
|
|
|
|
rawP : RawProduct ℂ 𝒜 ℬ
|
2018-03-29 22:12:01 +00:00
|
|
|
|
rawP = record
|
|
|
|
|
{ object = X
|
2018-04-05 08:41:56 +00:00
|
|
|
|
; fst = x0
|
|
|
|
|
; snd = x1
|
2018-03-29 22:12:01 +00:00
|
|
|
|
}
|
2018-04-05 08:41:56 +00:00
|
|
|
|
-- open RawProduct rawP renaming (fst to x0 ; snd to x1)
|
2018-05-01 09:41:45 +00:00
|
|
|
|
module _ {Y : ℂ.Object} (p0 : ℂ [ Y , 𝒜 ]) (p1 : ℂ [ Y , ℬ ]) where
|
2018-03-29 22:12:01 +00:00
|
|
|
|
uy : isContr (Arrow (Y , p0 , p1) (X , x0 , x1))
|
|
|
|
|
uy = uniq {Y , p0 , p1}
|
2018-04-05 08:41:56 +00:00
|
|
|
|
open Σ uy renaming (fst to Y→X ; snd to contractible)
|
|
|
|
|
open Σ Y→X renaming (fst to p0×p1 ; snd to cond)
|
2018-03-29 22:12:01 +00:00
|
|
|
|
ump : ∃![ f×g ] (ℂ [ x0 ∘ f×g ] ≡ p0 P.× ℂ [ x1 ∘ f×g ] ≡ p1)
|
2018-05-01 16:54:08 +00:00
|
|
|
|
ump = p0×p1 , cond , λ {f} cond-f → cong fst (contractible (f , cond-f))
|
2018-05-01 09:41:45 +00:00
|
|
|
|
isP : IsProduct ℂ 𝒜 ℬ rawP
|
2018-03-29 22:12:01 +00:00
|
|
|
|
isP = record { ump = ump }
|
2018-05-01 09:41:45 +00:00
|
|
|
|
p : Product ℂ 𝒜 ℬ
|
2018-03-29 22:12:01 +00:00
|
|
|
|
p = record
|
|
|
|
|
{ raw = rawP
|
|
|
|
|
; isProduct = isP
|
|
|
|
|
}
|
2018-05-01 09:41:45 +00:00
|
|
|
|
g : Product ℂ 𝒜 ℬ → Terminal
|
2018-05-01 16:54:08 +00:00
|
|
|
|
g p = 𝒳 , t
|
2018-03-29 13:47:43 +00:00
|
|
|
|
where
|
2018-05-01 16:54:08 +00:00
|
|
|
|
open Product p renaming (object to X ; fst to x₀ ; snd to x₁) using ()
|
2018-03-29 22:12:01 +00:00
|
|
|
|
module p = Product p
|
|
|
|
|
module isp = IsProduct p.isProduct
|
2018-05-01 16:54:08 +00:00
|
|
|
|
𝒳 : Object
|
|
|
|
|
𝒳 = X , x₀ , x₁
|
|
|
|
|
module _ {𝒴 : Object} where
|
|
|
|
|
open Σ 𝒴 renaming (fst to Y)
|
|
|
|
|
open Σ (snd 𝒴) renaming (fst to y₀ ; snd to y₁)
|
|
|
|
|
ump = p.ump y₀ y₁
|
|
|
|
|
open Σ ump renaming (fst to f')
|
|
|
|
|
open Σ (snd ump) renaming (fst to f'-cond)
|
|
|
|
|
𝒻 : Arrow 𝒴 𝒳
|
2018-05-08 16:34:12 +00:00
|
|
|
|
𝒻 = f' , f'-cond
|
2018-05-01 16:54:08 +00:00
|
|
|
|
contractible : (f : Arrow 𝒴 𝒳) → 𝒻 ≡ f
|
|
|
|
|
contractible ff@(f , f-cond) = res
|
2018-03-29 22:12:01 +00:00
|
|
|
|
where
|
2018-05-01 16:54:08 +00:00
|
|
|
|
k : f' ≡ f
|
|
|
|
|
k = snd (snd ump) f-cond
|
|
|
|
|
prp : (a : ℂ.Arrow Y X) → isProp
|
|
|
|
|
( (ℂ [ x₀ ∘ a ] ≡ y₀)
|
|
|
|
|
× (ℂ [ x₁ ∘ a ] ≡ y₁)
|
2018-03-29 22:12:01 +00:00
|
|
|
|
)
|
2018-05-01 16:54:08 +00:00
|
|
|
|
prp f f0 f1 = Σ≡
|
|
|
|
|
(ℂ.arrowsAreSets _ _ (fst f0) (fst f1))
|
|
|
|
|
(ℂ.arrowsAreSets _ _ (snd f0) (snd f1))
|
2018-03-29 22:12:01 +00:00
|
|
|
|
h :
|
|
|
|
|
( λ i
|
2018-05-01 16:54:08 +00:00
|
|
|
|
→ ℂ [ x₀ ∘ k i ] ≡ y₀
|
|
|
|
|
× ℂ [ x₁ ∘ k i ] ≡ y₁
|
|
|
|
|
) [ f'-cond ≡ f-cond ]
|
2018-03-29 22:12:01 +00:00
|
|
|
|
h = lemPropF prp k
|
2018-05-01 16:54:08 +00:00
|
|
|
|
res : (f' , f'-cond) ≡ (f , f-cond)
|
|
|
|
|
res = Σ≡ k h
|
|
|
|
|
t : IsTerminal 𝒳
|
|
|
|
|
t {𝒴} = 𝒻 , contractible
|
2018-03-29 22:12:01 +00:00
|
|
|
|
ve-re : ∀ x → g (f x) ≡ x
|
|
|
|
|
ve-re x = Propositionality.propTerminal _ _
|
2018-04-03 10:40:20 +00:00
|
|
|
|
re-ve : ∀ p → f (g p) ≡ p
|
|
|
|
|
re-ve p = Product≡ e
|
|
|
|
|
where
|
|
|
|
|
module p = Product p
|
|
|
|
|
-- RawProduct does not have eta-equality.
|
|
|
|
|
e : Product.raw (f (g p)) ≡ Product.raw p
|
|
|
|
|
RawProduct.object (e i) = p.object
|
2018-04-05 08:41:56 +00:00
|
|
|
|
RawProduct.fst (e i) = p.fst
|
|
|
|
|
RawProduct.snd (e i) = p.snd
|
2018-03-29 22:12:01 +00:00
|
|
|
|
inv : AreInverses f g
|
2018-04-11 11:53:33 +00:00
|
|
|
|
inv = funExt ve-re , funExt re-ve
|
2018-03-28 22:07:49 +00:00
|
|
|
|
|
2018-05-01 09:41:45 +00:00
|
|
|
|
propProduct : isProp (Product ℂ 𝒜 ℬ)
|
2018-04-03 10:40:20 +00:00
|
|
|
|
propProduct = equivPreservesNType {n = ⟨-1⟩} lemma Propositionality.propTerminal
|
|
|
|
|
|
|
|
|
|
module _ {ℓa ℓb : Level} {ℂ : Category ℓa ℓb} {A B : Category.Object ℂ} where
|
|
|
|
|
open Category ℂ
|
|
|
|
|
private
|
|
|
|
|
module _ (x y : HasProducts ℂ) where
|
|
|
|
|
private
|
|
|
|
|
module x = HasProducts x
|
|
|
|
|
module y = HasProducts y
|
|
|
|
|
|
|
|
|
|
productEq : x.product ≡ y.product
|
|
|
|
|
productEq = funExt λ A → funExt λ B → Try0.propProduct _ _
|
|
|
|
|
|
|
|
|
|
propHasProducts : isProp (HasProducts ℂ)
|
|
|
|
|
propHasProducts x y i = record { product = productEq x y i }
|
2018-04-06 14:54:00 +00:00
|
|
|
|
|
|
|
|
|
fmap≡ : {A : Set} {a0 a1 : A} {B : Set} → (f : A → B) → Path a0 a1 → Path (f a0) (f a1)
|
|
|
|
|
fmap≡ = cong
|