quest 2 complete

This commit is contained in:
Jlh18 2021-10-07 22:57:21 +01:00
parent be2f38fc06
commit 324568407a
3 changed files with 29 additions and 18 deletions

View File

@ -33,7 +33,7 @@ Your definition of ⊔NoConfusion goes here.
Your definition of Path≡⊔NoConfusion goes here. Your definition of Path≡⊔NoConfusion goes here.
Your definition of isProp⊔NoConfusion goes here. Your definition of isSet⊔NoConfusion goes here.
Your definition of isSet⊔ goes here. Your definition of isSet⊔ goes here.

View File

@ -79,17 +79,34 @@ isProp⊥ ()
⊔NoConfusion (inr x) (inl y) = ⊔NoConfusion (inr x) (inl y) =
⊔NoConfusion (inr x) (inr y) = x y -- Path B x y ⊔NoConfusion (inr x) (inr y) = x y -- Path B x y
isProp⊔NoConfusion : isSet A isSet B isSet⊔NoConfusion : isSet A isSet B
(x y : A B) isProp (⊔NoConfusion x y) (x y : A B) isProp (⊔NoConfusion x y)
isProp⊔NoConfusion hA hB (inl x) (inl y) = hA x y isSet⊔NoConfusion hA hB (inl x) (inl y) = hA x y
isProp⊔NoConfusion hA hB (inl x) (inr y) = isProp⊥ isSet⊔NoConfusion hA hB (inl x) (inr y) = isProp⊥
isProp⊔NoConfusion hA hB (inr x) (inl y) = isProp⊥ isSet⊔NoConfusion hA hB (inr x) (inl y) = isProp⊥
isProp⊔NoConfusion hA hB (inr x) (inr y) = hB x y isSet⊔NoConfusion hA hB (inr x) (inr y) = hB x y
⊔NoConfusionSelf : (x : A B) ⊔NoConfusion x x ⊔NoConfusionSelf : (x : A B) ⊔NoConfusion x x
⊔NoConfusionSelf (inl x) = refl ⊔NoConfusionSelf (inl x) = refl
⊔NoConfusionSelf (inr x) = refl ⊔NoConfusionSelf (inr x) = refl
Path≅⊔NoConfusion' : (x y : A B) (x y) ⊔NoConfusion x y
Path≅⊔NoConfusion' x y = iso (fun _ _) ({!!}) ({!!}) ({!!}) where
-- if you case on x and y you would have to show that inl and inr are injective
-- J avoids this, but leads to needing J and JRefl for showing section and retract
fun : (x y : A B) (x y) ⊔NoConfusion x y
fun x y = J (λ y₂ x₂ ⊔NoConfusion x y₂) (⊔NoConfusionSelf x)
inv : (x y : A B) ⊔NoConfusion x y x y
inv (inl x) (inl y) p = cong inl p
inv (inr x) (inr y) p = cong inr p
rightInv : (x y : A B) section (fun x y) (inv x y)
rightInv {A} {B} (inl x) (inl x₁) = J ((λ y' p fun {A} {B} (inl x) (inl y') (inv (inl x) (inl y') p) p)) {!!}
rightInv {A} {B} (inl x) (inr x₁) = {!!}
rightInv {A} {B} (inr x) y = {!!}
Path≅⊔NoConfusion : (x y : A B) (x y) ⊔NoConfusion x y Path≅⊔NoConfusion : (x y : A B) (x y) ⊔NoConfusion x y
Path≅⊔NoConfusion x y = iso (fun _ _) (inv _ _) (rightInv _ _) (leftInv _ _) where Path≅⊔NoConfusion x y = iso (fun _ _) (inv _ _) (rightInv _ _) (leftInv _ _) where
@ -103,27 +120,21 @@ Path≅⊔NoConfusion x y = iso (fun _ _) (inv _ _) (rightInv _ _) (leftInv _ _)
inv (inr x) (inr y) p = cong inr p inv (inr x) (inr y) p = cong inr p
rightInv : (x y : A B) section (fun x y) (inv x y) rightInv : (x y : A B) section (fun x y) (inv x y)
rightInv {B = B} (inl x) (inl y) p = leml x y p where rightInv {A} {B} (inl x) (inl y) p = J (λ y' p fun {A} {B} (inl x) (inl y') (inv (inl x) (inl y') p) p)
leml : (x y : A) (p : x y) fun {A} {B} (inl x) (inl y) (inv (inl x) (inl y) p) p
leml {A} x y = J (λ y' p fun {A} {B} (inl x) (inl y') (inv (inl x) (inl y') p) p)
( (
fun {A} {B} (inl x) (inl x) refl fun {A} {B} (inl x) (inl x) refl
≡⟨ JRefl {x = inl x} ((λ y' p ⊔NoConfusion {A} {B} (inl x) y')) _ ≡⟨ JRefl {x = inl x} ((λ y' p ⊔NoConfusion {A} {B} (inl x) y')) _
-- uses how J computes on refl -- uses how J computes on refl
refl refl
) ) p
rightInv {A = A} (inr x) (inr y) p = lemr x y p where rightInv {A} {B} (inr x) (inr y) p = J (λ y' p fun {A} {B} (inr x) (inr y') (inv (inr x) (inr y') p) p)
lemr : (x y : B) (p : x y) fun {A} {B} (inr x) (inr y) (inv (inr x) (inr y) p) p
lemr {B} x y = J (λ y' p fun {A} {B} (inr x) (inr y') (inv (inr x) (inr y') p) p)
( (
fun {A} {B} (inr x) (inr x) refl fun {A} {B} (inr x) (inr x) refl
≡⟨ JRefl {x = inr x} ((λ y' p ⊔NoConfusion {A} {B} (inr x) y')) _ ≡⟨ JRefl {x = inr x} ((λ y' p ⊔NoConfusion {A} {B} (inr x) y')) _
-- uses how J computes on refl -- uses how J computes on refl
refl refl
) ) p
leftInv : (x y : A B) retract (fun x y) (inv x y) leftInv : (x y : A B) retract (fun x y) (inv x y)
leftInv x y = J (λ y' p inv x y' (fun x y' p) p) leftInv x y = J (λ y' p inv x y' (fun x y' p) p)
@ -144,11 +155,11 @@ Path≡⊔NoConfusion x y = isoToPath (Path≅⊔NoConfusion x y)
isSet⊔ : {A B : Type} isSet A isSet B isSet (A B) isSet⊔ : {A B : Type} isSet A isSet B isSet (A B)
isSet⊔ hA hB x y = pathToFun (cong isProp (sym (Path≡⊔NoConfusion x y))) isSet⊔ hA hB x y = pathToFun (cong isProp (sym (Path≡⊔NoConfusion x y)))
(isProp⊔NoConfusion hA hB x y) (isSet⊔NoConfusion hA hB x y)
isSet⊔' : {A B : Type} isSet A isSet B isSet (A B) isSet⊔' : {A B : Type} isSet A isSet B isSet (A B)
isSet⊔' hA hB x y = endPt (λ A isProp A) (sym (Path≡⊔NoConfusion x y)) isSet⊔' hA hB x y = endPt (λ A isProp A) (sym (Path≡⊔NoConfusion x y))
(isProp⊔NoConfusion hA hB x y) (isSet⊔NoConfusion hA hB x y)
isSet : isSet isSet : isSet
isSet = pathToFun (cong isSet (sym ℤ≡ℕ⊔ℕ)) (isSet⊔ isSet isSet) isSet = pathToFun (cong isSet (sym ℤ≡ℕ⊔ℕ)) (isSet⊔ isSet isSet)