Back to index

Chapter 2. Homotopy Type Theory - Exercises

module Chapter2.Exercises where

open import Chapter2.Book public

-- Exercise 2.1
_βˆ™β‚‚_ : {A : 𝒰 𝒾} {x y z : A} β†’ x ≑ y β†’ y ≑ z β†’ x ≑ z
_βˆ™β‚‚_ (refl x) p = p

_βˆ™β‚ƒ_ : {A : 𝒰 𝒾} {x y z : A} β†’ x ≑ y β†’ y ≑ z β†’ x ≑ z
_βˆ™β‚ƒ_ p (refl x) = p

βˆ™β‚β‰‘βˆ™β‚‚ :
    {A : 𝒰 𝒾} {x y z : A} (p : x ≑ y) (q : y ≑ z)
  β†’ p βˆ™ q ≑ p βˆ™β‚‚ q
βˆ™β‚β‰‘βˆ™β‚‚ (refl _) (refl _) = refl _

βˆ™β‚‚β‰‘βˆ™β‚ƒ :
    {A : 𝒰 𝒾} {x y z : A} (p : x ≑ y) (q : y ≑ z)
  β†’ p βˆ™β‚‚ q ≑ p βˆ™β‚ƒ q
βˆ™β‚‚β‰‘βˆ™β‚ƒ (refl _) (refl _) = refl _

βˆ™β‚β‰‘βˆ™β‚ƒ :
    {A : 𝒰 𝒾} {x y z : A} (p : x ≑ y) (q : y ≑ z)
  β†’ p βˆ™ q ≑ p βˆ™β‚ƒ q
βˆ™β‚β‰‘βˆ™β‚ƒ (refl _) (refl _) = refl _

-- Exercise 2.2
Exercise-2-2 :
    {A : 𝒰 𝒾} {x y z : A} (p : x ≑ y) (q : y ≑ z)
  β†’ (βˆ™β‚β‰‘βˆ™β‚‚ p q) βˆ™ (βˆ™β‚‚β‰‘βˆ™β‚ƒ p q) ≑ (βˆ™β‚β‰‘βˆ™β‚ƒ p q)
Exercise-2-2 (refl _) (refl _) = refl _

-- Exercise 2.3
_βˆ™β‚„_ : {A : 𝒰 𝒾} {x y z : A} β†’ x ≑ y β†’ y ≑ z β†’ x ≑ z
_βˆ™β‚„_ {x = x} p q = tr (Ξ» - β†’ x ≑ -) q p

βˆ™β‚β‰‘βˆ™β‚„ :
    {A : 𝒰 𝒾} {x y z : A} (p : x ≑ y) (q : y ≑ z)
  β†’ p βˆ™ q ≑ p βˆ™β‚„ q
βˆ™β‚β‰‘βˆ™β‚„ (refl _) (refl _) = refl _

-- Exercise 2.10
Ξ£-assoc : {A : 𝒰 𝒾} {B : A β†’ 𝒰 𝒿} (C : (Ξ£ x κž‰ A , B x) β†’ 𝒰 𝓀)
        β†’ (Ξ£ x κž‰ A , (Ξ£ y κž‰ B x , C (x , y))) ≃ (Ξ£ p κž‰ (Ξ£ x κž‰ A , B x) , C p)
Ξ£-assoc C = map , invsβ‡’equivs map (map⁻¹ , Ξ΅ , Ξ·)
 where
  map = Ξ» (x , y , c) β†’ ((x , y) , c)
  map⁻¹ = Ξ» ((x , y) , c) β†’ (x , y , c)
  Ξ΅ = refl
  Ξ· = refl

-- Exercise 2.17 iii)
-- Ξ£-≃-fst is on Chapter6, as it is easier to prove it with more theorems
Ξ£-≃-snd : {A : 𝒰 𝒾} {P : A β†’ 𝒰 𝒿} {Q : A β†’ 𝒰 𝓀}
        β†’ ((x : A) β†’ P x ≃ Q x)
        β†’ -Ξ£ A P ≃ -Ξ£ A Q
Ξ£-≃-snd f = map , invsβ‡’equivs map (map⁻¹ , Ξ΅ , Ξ·)
 where
  map = Ξ» (x , px) β†’ (x , ≃-β†’ (f x) px)
  map⁻¹ = Ξ» (x , px) β†’ (x , ≃-← (f x) px)
  Ξ΅ = Ξ» (x , px) β†’ pair⁼(refl x , ≃-Ξ΅ (f x) px)
  Ξ· = Ξ» (x , px) β†’ pair⁼(refl x , ≃-Ξ· (f x) px)