Simplify proof and move propUnivalent to a more general setting

This commit is contained in:
Frederik Hanghøj Iversen 2018-04-09 16:03:43 +02:00
parent 472dbba84d
commit 735b25de23

View file

@ -141,6 +141,9 @@ record RawCategory (a b : Level) : Set (lsuc (a ⊔ b)) where
-- This is not so straight-forward so you can assume it
postulate from[Contr] : Univalent[Contr] Univalent
propUnivalent : isProp Univalent
propUnivalent a b i = propPi (λ iso propIsContr) a b i
module _ {a b : Level} ( : RawCategory a b) where
record IsPreCategory : Set (lsuc (a b)) where
open RawCategory public
@ -192,7 +195,8 @@ module _ {a b : Level} ( : RawCategory a b) where
propIsAssociative = propPiImpl (λ _ propPiImpl (λ _ propPiImpl (λ _ propPiImpl (λ _ propPiImpl (λ _ propPiImpl (λ _ propPiImpl λ _ arrowsAreSets _ _))))))
propIsIdentity : {f : {A} Arrow A A} isProp (IsIdentity f)
propIsIdentity = propPiImpl (λ _ propPiImpl λ _ propPiImpl (λ _ propSig (arrowsAreSets _ _) λ _ arrowsAreSets _ _))
propIsIdentity {id} = propPiImpl (λ _ propPiImpl λ _ propPiImpl (λ f
propSig (arrowsAreSets (id f) f) λ _ arrowsAreSets (f id) f))
propArrowIsSet : isProp ( {A B} isSet (Arrow A B))
propArrowIsSet = propPiImpl λ _ propPiImpl (λ _ isSetIsProp)
@ -303,9 +307,6 @@ module _ {a b : Level} ( : RawCategory a b) where
-- | All projections are propositions.
module Propositionality where
propUnivalent : isProp Univalent
propUnivalent a b i = propPi (λ iso propIsContr) a b i
-- | Terminal objects are propositional - a.k.a uniqueness of terminal
-- | objects.
--
@ -403,30 +404,28 @@ module _ {a b : Level} ( : RawCategory a b) where
-- adverse effects this may have.
module Prop = X.Propositionality
isIdentity : (λ _ IsIdentity identity) [ X.isIdentity Y.isIdentity ]
isIdentity = X.propIsIdentity X.isIdentity Y.isIdentity
isIdentity= : (λ _ IsIdentity identity) [ X.isIdentity Y.isIdentity ]
isIdentity= = X.propIsIdentity X.isIdentity Y.isIdentity
isPreCategory= : X.isPreCategory Y.isPreCategory
isPreCategory= = propIsPreCategory X.isPreCategory Y.isPreCategory
private
p = cong IsPreCategory.isIdentity isPreCategory=
univalent= : (λ i Univalent (p i))
[ X.univalent Y.univalent ]
univalent= = lemPropF
{A = IsIdentity identity}
{B = Univalent}
propUnivalent
{a0 = X.isIdentity}
{a1 = Y.isIdentity}
p
U : {a : IsIdentity identity}
(λ _ IsIdentity identity) [ X.isIdentity a ]
(b : Univalent a)
Set _
U eqwal univ =
(λ i Univalent (eqwal i))
[ X.univalent univ ]
P : (y : IsIdentity identity)
(λ _ IsIdentity identity) [ X.isIdentity y ] Set _
P y eq = (univ : Univalent y) U eq univ
p : (b' : Univalent X.isIdentity)
(λ _ Univalent X.isIdentity) [ X.univalent b' ]
p univ = Prop.propUnivalent X.univalent univ
helper : P Y.isIdentity isIdentity
helper = pathJ P p Y.isIdentity isIdentity
eqUni : U isIdentity Y.univalent
eqUni = helper Y.univalent
done : x y
IsCategory.isPreCategory (done i)
= propIsPreCategory X.isPreCategory Y.isPreCategory i
IsCategory.univalent (done i) = eqUni i
IsCategory.isPreCategory (done i) = isPreCategory= i
IsCategory.univalent (done i) = univalent= i
propIsCategory : isProp (IsCategory )
propIsCategory = done
@ -454,7 +453,7 @@ module _ {a b : Level} { 𝔻 : Category a b} where
module _ (rawEq : .raw 𝔻.raw) where
private
isCategoryEq : (λ i IsCategory (rawEq i)) [ .isCategory 𝔻.isCategory ]
isCategoryEq = lemPropF propIsCategory rawEq
isCategoryEq = lemPropF {A = RawCategory _ _} {B = IsCategory} propIsCategory rawEq
Category≡ : 𝔻
Category.raw (Category≡ i) = rawEq i
@ -482,16 +481,13 @@ module Opposite {a b : Level} where
RawCategory.Object opRaw = .Object
RawCategory.Arrow opRaw = Function.flip .Arrow
RawCategory.identity opRaw = .identity
RawCategory._∘_ opRaw = Function.flip ._∘_
RawCategory._∘_ opRaw = ._>>>_
open RawCategory opRaw
isIdentity : IsIdentity identity
isIdentity = swap .isIdentity
isPreCategory : IsPreCategory opRaw
IsPreCategory.isAssociative isPreCategory = sym .isAssociative
IsPreCategory.isIdentity isPreCategory = isIdentity
IsPreCategory.isIdentity isPreCategory = swap .isIdentity
IsPreCategory.arrowsAreSets isPreCategory = .arrowsAreSets
open IsPreCategory isPreCategory
@ -512,9 +508,6 @@ module Opposite {a b : Level} where
flopDem : A .≅ B A B
flopDem (f , g , inv) = g , f , inv
flipInv : {x} (flipDem flopDem) x x
flipInv = refl
-- Shouldn't be necessary to use `arrowsAreSets` here, but we have it,
-- so why not?
lem : (p : A B) idToIso A B p flopDem (.idToIso A B p)