[WIP] Univalence in ad-hoc category in product

This commit is contained in:
Frederik Hanghøj Iversen 2018-04-10 17:17:04 +02:00
parent fd18985e53
commit 772e6778f3
2 changed files with 106 additions and 37 deletions

View file

@ -136,12 +136,25 @@ record RawCategory (a b : Level) : Set (lsuc (a ⊔ b)) where
Univalent[Contr] : Set _ Univalent[Contr] : Set _
Univalent[Contr] = A isContr (Σ[ X Object ] A X) Univalent[Contr] = A isContr (Σ[ X Object ] A X)
Univalent[Andrea] : Set _
Univalent[Andrea] = A B (A B) (A B)
-- From: Thierry Coquand <Thierry.Coquand@cse.gu.se> -- From: Thierry Coquand <Thierry.Coquand@cse.gu.se>
-- Date: Wed, Mar 21, 2018 at 3:12 PM -- Date: Wed, Mar 21, 2018 at 3:12 PM
-- --
-- This is not so straight-forward so you can assume it -- This is not so straight-forward so you can assume it
postulate from[Contr] : Univalent[Contr] Univalent postulate from[Contr] : Univalent[Contr] Univalent
from[Andrea] : Univalent[Andrea] Univalent
from[Andrea] = from[Contr] Function.∘ step
where
module _ (f : Univalent[Andrea]) (A : Object) where
aux : isContr (Σ[ B Object ] A B)
aux = ?
step : isContr (Σ Object (A ≅_))
step = {!subst {P = isContr} {!!} aux!}
propUnivalent : isProp Univalent propUnivalent : isProp Univalent
propUnivalent a b i = propPi (λ iso propIsContr) a b i propUnivalent a b i = propPi (λ iso propIsContr) a b i
@ -205,9 +218,9 @@ module _ {a b : Level} ( : RawCategory a b) where
propIsInverseOf : {A B f g} isProp (IsInverseOf {A} {B} f g) propIsInverseOf : {A B f g} isProp (IsInverseOf {A} {B} f g)
propIsInverseOf = propSig (arrowsAreSets _ _) (λ _ arrowsAreSets _ _) propIsInverseOf = propSig (arrowsAreSets _ _) (λ _ arrowsAreSets _ _)
module _ {A B : Object} {f : Arrow A B} where module _ {A B : Object} (f : Arrow A B) where
isoIsProp : isProp (Isomorphism f) propIsomorphism : isProp (Isomorphism f)
isoIsProp a@(g , η , ε) a'@(g' , η' , ε') = propIsomorphism a@(g , η , ε) a'@(g' , η' , ε') =
lemSig (λ g propIsInverseOf) a a' geq lemSig (λ g propIsInverseOf) a a' geq
where where
geq : g g' geq : g g'
@ -303,12 +316,19 @@ module _ {a b : Level} ( : RawCategory a b) where
univalent≃ = _ , univalent univalent≃ = _ , univalent
module _ {A B : Object} where module _ {A B : Object} where
iso-to-id : (A B) (A B) private
iso-to-id = fst (toIso _ _ univalent) iso : TypeIsomorphism (idToIso A B)
iso = toIso _ _ univalent
isoToId : (A B) (A B)
isoToId = fst iso
asTypeIso : TypeIsomorphism (idToIso A B) asTypeIso : TypeIsomorphism (idToIso A B)
asTypeIso = toIso _ _ univalent asTypeIso = toIso _ _ univalent
inverse-from-to-iso' : AreInverses (idToIso A B) isoToId
inverse-from-to-iso' = snd iso
-- | All projections are propositions. -- | All projections are propositions.
module Propositionality where module Propositionality where
-- | Terminal objects are propositional - a.k.a uniqueness of terminal -- | Terminal objects are propositional - a.k.a uniqueness of terminal
@ -338,7 +358,7 @@ module _ {a b : Level} ( : RawCategory a b) where
iso : X Y iso : X Y
iso = X→Y , Y→X , left , right iso = X→Y , Y→X , left , right
p0 : X Y p0 : X Y
p0 = iso-to-id iso p0 = isoToId iso
p1 : (λ i IsTerminal (p0 i)) [ Xit Yit ] p1 : (λ i IsTerminal (p0 i)) [ Xit Yit ]
p1 = lemPropF propIsTerminal p0 p1 = lemPropF propIsTerminal p0
res : Xt Yt res : Xt Yt
@ -368,7 +388,7 @@ module _ {a b : Level} ( : RawCategory a b) where
iso : X Y iso : X Y
iso = Y→X , X→Y , right , left iso = Y→X , X→Y , right , left
res : Xi Yi res : Xi Yi
res = lemSig propIsInitial _ _ (iso-to-id iso) res = lemSig propIsInitial _ _ (isoToId iso)
module _ {a b : Level} ( : RawCategory a b) where module _ {a b : Level} ( : RawCategory a b) where
open RawCategory open RawCategory

View file

@ -1,4 +1,4 @@
{-# OPTIONS --allow-unsolved-metas --cubical #-} {-# OPTIONS --allow-unsolved-metas --cubical --caching #-}
module Cat.Category.Product where module Cat.Category.Product where
open import Cat.Prelude as P hiding (_×_ ; fst ; snd) open import Cat.Prelude as P hiding (_×_ ; fst ; snd)
@ -183,7 +183,7 @@ module Try0 {a b : Level} { : Category a b}
-- ; _∎ to _∎! ) -- ; _∎ to _∎! )
-- lawl -- lawl
-- : ((X , xa , xb) (Y , ya , yb)) -- : ((X , xa , xb) (Y , ya , yb))
-- ≈ (Σ[ iso ∈ (X .≅ Y) ] let p = .iso-to-id iso in (PathP (λ i → .Arrow (p i) A) xa ya) × (PathP (λ i → .Arrow (p i) B) xb yb)) -- ≈ (Σ[ iso ∈ (X .≅ Y) ] let p = .isoToId iso in (PathP (λ i → .Arrow (p i) A) xa ya) × (PathP (λ i → .Arrow (p i) B) xb yb))
-- lawl = {!begin! ? ≈⟨ ? ⟩ ? ∎!!} -- lawl = {!begin! ? ≈⟨ ? ⟩ ? ∎!!}
-- Problem with the above approach: Preorders only work for heterogeneous equaluties. -- Problem with the above approach: Preorders only work for heterogeneous equaluties.
@ -192,7 +192,7 @@ module Try0 {a b : Level} { : Category a b}
-- Σ[ p ∈ (X ≡ Y) ] (PathP (λ i → .Arrow (p i) A) xa ya) × (PathP (λ i → .Arrow (p i) B) xb yb) -- Σ[ p ∈ (X ≡ Y) ] (PathP (λ i → .Arrow (p i) A) xa ya) × (PathP (λ i → .Arrow (p i) B) xb yb)
-- ≅ -- ≅
-- Σ (X .≅ Y) (λ iso -- Σ (X .≅ Y) (λ iso
-- → let p = .iso-to-id iso -- → let p = .isoToId iso
-- in -- in
-- ( PathP (λ i → .Arrow (p i) A) xa ya) -- ( PathP (λ i → .Arrow (p i) A) xa ya)
-- × PathP (λ i → .Arrow (p i) B) xb yb -- × PathP (λ i → .Arrow (p i) B) xb yb
@ -207,63 +207,104 @@ module Try0 {a b : Level} { : Category a b}
-- , (λ x → λ i → fst x i , (fst (snd x) i) , (snd (snd x) i)) -- , (λ x → λ i → fst x i , (fst (snd x) i) , (snd (snd x) i))
, (λ{ (p , q , r) Σ≡ p λ i q i , r i}) , (λ{ (p , q , r) Σ≡ p λ i q i , r i})
, record , record
{ verso-recto = {!!} { verso-recto = funExt (λ{ p refl})
; recto-verso = {!!} ; recto-verso = funExt (λ{ (p , q , r) refl})
} }
where where
open import Function renaming (_∘_ to _⊙_) open import Function renaming (_∘_ to _⊙_)
-- Should follow from c being univalent
iso-id-inv : {p : X Y} p .isoToId (.idToIso X Y p)
iso-id-inv {p} = sym (λ i AreInverses.verso-recto .inverse-from-to-iso' i p)
id-iso-inv : {iso : X .≅ Y} iso .idToIso X Y (.isoToId iso)
id-iso-inv {iso} = sym (λ i AreInverses.recto-verso .inverse-from-to-iso' i iso)
lemA : {A B : Object} {f g : Arrow A B} fst f fst g f g
lemA {A} {B} {f = f} {g} p i = p i , h i
where
h : PathP (λ i
( [ fst (snd B) p i ]) fst (snd A) ×
( [ snd (snd B) p i ]) snd (snd A)
) (snd f) (snd g)
h = lemPropF (λ a propSig
(.arrowsAreSets ( [ fst (snd B) a ]) (fst (snd A)))
λ _ .arrowsAreSets ( [ snd (snd B) a ]) (snd (snd A)))
p
step1 step1
: (Σ[ p (X Y) ] (PathP (λ i .Arrow (p i) A) xa ya) × (PathP (λ i .Arrow (p i) B) xb yb)) : (Σ[ p (X Y) ] (PathP (λ i .Arrow (p i) A) xa ya) × (PathP (λ i .Arrow (p i) B) xb yb))
Σ (X .≅ Y) (λ iso Σ (X .≅ Y) (λ iso
let p = .iso-to-id iso let p = .isoToId iso
in in
( PathP (λ i .Arrow (p i) A) xa ya) ( PathP (λ i .Arrow (p i) A) xa ya)
× PathP (λ i .Arrow (p i) B) xb yb × PathP (λ i .Arrow (p i) B) xb yb
) )
step1 step1
= (λ{ (p , x) (.idToIso _ _ p) , {!snd x!}}) = (λ{ (p , x)
(.idToIso _ _ p)
, let
P-l : (p : X Y) Set _
P-l φ = PathP (λ i .Arrow (φ i) A) xa ya
P-r : (p : X Y) Set _
P-r φ = PathP (λ i .Arrow (φ i) B) xb yb
left : P-l p
left = fst x
right : P-r p
right = snd x
in subst {P = P-l} iso-id-inv left , subst {P = P-r} iso-id-inv right
})
-- Goal is: -- Goal is:
-- --
-- φ x -- φ x
-- --
-- where `x` is -- where `x` is
-- --
-- .iso-to-id (.idToIso _ _ p) -- .isoToId (.idToIso _ _ p)
-- --
-- I have `φ p` in scope, but surely `p` and `x` are the same - though -- I have `φ p` in scope, but surely `p` and `x` are the same - though
-- perhaps not definitonally. -- perhaps not definitonally.
, (λ{ (iso , x) .iso-to-id iso , x}) , (λ{ (iso , x) .isoToId iso , x})
, record { verso-recto = {!!} ; recto-verso = {!!} } , record
lemA : {A B : Object} {f g : Arrow A B} fst f fst g f g { verso-recto = funExt (λ{ (p , q , r) Σ≡ (sym iso-id-inv) (toPathP {A = λ i {!!}} {!!})})
lemA {A} {B} {f = f} {g} p i = p i , h i -- { verso-recto = funExt (λ{ (p , q , r) → Σ≡ (sym iso-id-inv) {!!}})
where ; recto-verso = funExt (λ x Σ≡ (sym id-iso-inv) {!!})
h : PathP (λ i }
( [ fst (snd B) p i ]) fst (snd A) ×
( [ snd (snd B) p i ]) snd (snd A)
) (snd f) (snd g)
h = lemPropF (λ a propSig
(.arrowsAreSets ( [ fst (snd B) a ]) (fst (snd A)))
λ _ .arrowsAreSets ( [ snd (snd B) a ]) (snd (snd A)))
p
step2 step2
: Σ (X .≅ Y) (λ iso : Σ (X .≅ Y) (λ iso
let p = .iso-to-id iso let p = .isoToId iso
in in
( PathP (λ i .Arrow (p i) A) xa ya) ( PathP (λ i .Arrow (p i) A) xa ya)
× PathP (λ i .Arrow (p i) B) xb yb × PathP (λ i .Arrow (p i) B) xb yb
) )
((X , xa , xb) (Y , ya , yb)) ((X , xa , xb) (Y , ya , yb))
step2 step2
= ( λ{ ((f , f~ , inv-f) , x) = ( λ{ ((f , f~ , inv-f) , p , q)
( f , {!!}) ( f , (let r = fromPathP p in {!r!}) , {!!})
, ( (f~ , {!!}) , ( (f~ , {!!} , {!!})
, lemA {!!} , lemA (fst inv-f)
, lemA {!!} , lemA (snd inv-f)
) )
} }
) )
, (λ x {!!}) , (λ{ (f , f~ , inv-f , inv-f~)
, {!!} let
iso : X .≅ Y
iso = fst f , fst f~ , cong fst inv-f , cong fst inv-f~
helper : PathP (λ i .Arrow (.isoToId ? i) A) xa ya
helper = {!!}
in iso , helper , {!!}})
, record
{ verso-recto = funExt (λ x lemSig
(λ x propSig prop0 (λ _ prop1))
_ _
(Σ≡ {!!} (.propIsomorphism _ _ _)))
; recto-verso = funExt (λ{ (f , _) lemSig propIsomorphism _ _ {!refl!}})
}
where
prop0 : {x} isProp (PathP (λ i .Arrow (.isoToId x i) A) xa ya)
prop0 {x} = pathJ (λ y p x isProp (PathP (λ i .Arrow (p i) A) xa x)) (λ x .arrowsAreSets _ _) Y (.isoToId x) ya
prop1 : {x} isProp (PathP (λ i .Arrow (.isoToId x i) B) xb yb)
prop1 {x} = pathJ (λ y p x isProp (PathP (λ i .Arrow (p i) B) xb x)) (λ x .arrowsAreSets _ _) Y (.isoToId x) yb
-- One thing to watch out for here is that the isomorphisms going forwards -- One thing to watch out for here is that the isomorphisms going forwards
-- must compose to give idToIso -- must compose to give idToIso
iso iso
@ -273,8 +314,16 @@ module Try0 {a b : Level} { : Category a b}
where where
infixl 5 _⊙_ infixl 5 _⊙_
_⊙_ = composeIso _⊙_ = composeIso
equiv1
: ((X , xa , xb) (Y , ya , yb))
((X , xa , xb) (Y , ya , yb))
equiv1 = _ , fromIso _ _ (snd iso)
res : TypeIsomorphism (idToIso (X , xa , xb) (Y , ya , yb)) res : TypeIsomorphism (idToIso (X , xa , xb) (Y , ya , yb))
res = {!snd iso!} res = {!snd equiv1!}
univalent2 : X Y (X Y) (X Y)
univalent2 = {!!}
isCat : IsCategory raw isCat : IsCategory raw
IsCategory.isPreCategory isCat = isPreCat IsCategory.isPreCategory isCat = isPreCat