{-# OPTIONS --without-K --rewriting --overlapping-instances #-}
open import lib.Basics
open import lib.types.TLevel
open import lib.types.Pi
open import lib.types.Truncation
module lib.types.PathSet where
_=₀_ : ∀ {i} {A : Type i} → A → A → Type i
_=₀_ x y = Trunc 0 (x == y)
_=0_ : ∀ {i} {A : Type i} → A → A → Type i
_=0_ = _=₀_
infixr 80 _∙₀_ _∙₀'_
_∙₀_ : ∀ {i} {A : Type i} {x y z : A} → x =₀ y → y =₀ z → x =₀ z
_∙₀_ = Trunc-fmap2 _∙_
_∙₀'_ : ∀ {i} {A : Type i} {x y z : A} → x =₀ y → y =₀ z → x =₀ z
_∙₀'_ = Trunc-fmap2 _∙'_
!₀ : ∀ {i} {A : Type i} {x y : A} → x =₀ y → y =₀ x
!₀ = Trunc-fmap !
idp₀ : ∀ {i} {A : Type i} {a : A} → a =₀ a
idp₀ = [ idp ]
ap₀ : ∀ {i j} {A : Type i} {B : Type j} {x y : A} (f : A → B)
→ x =₀ y → f x =₀ f y
ap₀ f = Trunc-rec ([_] ∘ ap f)
coe₀ : ∀ {i} {A B : Type i} {{_ : is-set B}} (p : A =₀ B) → A → B
coe₀ = Trunc-rec coe
transport₀ : ∀ {i j} {A : Type i} (B : A → Type j) {x y : A}
{{_ : is-set (B y)}} (p : x =₀ y) → (B x → B y)
transport₀ B p = coe₀ (ap₀ B p)
module _ {i} {A : Type i} where
abstract
∙₀=∙₀' : ∀ {x y z : A} (p : x =₀ y) (q : y =₀ z)
→ p ∙₀ q == p ∙₀' q
∙₀=∙₀' = Trunc-elim
(λ p → Trunc-elim
(λ q → ap [_] $ ∙=∙' p q))
∙₀'=∙₀ : ∀ {x y z : A} (p : x =₀ y) (q : y =₀ z)
→ p ∙₀' q == p ∙₀ q
∙₀'=∙₀ = Trunc-elim
(λ p → Trunc-elim
(λ q → ap [_] $ ∙'=∙ p q))
∙₀-unit-r : ∀ {x y : A} (q : x =₀ y) → (q ∙₀ idp₀) == q
∙₀-unit-r = Trunc-elim
(λ p → ap [_] $ ∙-unit-r p)
∙₀-unit-l : ∀ {x y : A} (q : x =₀ y) → (idp₀ ∙₀ q) == q
∙₀-unit-l = Trunc-elim
(λ _ → idp)
∙₀'-unit-r : ∀ {x y : A} (q : x =₀ y) → (q ∙₀' idp₀) == q
∙₀'-unit-r = Trunc-elim
(λ _ → idp)
∙₀'-unit-l : ∀ {x y : A} (q : x =₀ y) → (idp₀ ∙₀' q) == q
∙₀'-unit-l = Trunc-elim
(λ p → ap [_] $ ∙'-unit-l p)
∙₀-assoc : {x y z t : A} (p : x =₀ y) (q : y =₀ z) (r : z =₀ t)
→ (p ∙₀ q) ∙₀ r == p ∙₀ (q ∙₀ r)
∙₀-assoc = Trunc-elim
(λ p → Trunc-elim
(λ q → Trunc-elim
(λ r → ap [_] $ ∙-assoc p q r)))
∙₀'-assoc : {x y z t : A} (p : x =₀ y) (q : y =₀ z) (r : z =₀ t)
→ (p ∙₀' q) ∙₀' r == p ∙₀' (q ∙₀' r)
∙₀'-assoc = Trunc-elim
(λ p → Trunc-elim
(λ q → Trunc-elim
(λ r → ap [_] $ ∙'-assoc p q r)))
!₀-inv-l : {x y : A} (p : x =₀ y) → (!₀ p) ∙₀ p == idp₀
!₀-inv-l = Trunc-elim
(λ p → ap [_] $ !-inv-l p)
!₀-inv-r : {x y : A} (p : x =₀ y) → p ∙₀ (!₀ p) == idp₀
!₀-inv-r = Trunc-elim
(λ p → ap [_] $ !-inv-r p)
∙₀-ap₀ : ∀ {j} {B : Type j} (f : A → B) {x y z : A} (p : x =₀ y) (q : y =₀ z)
→ ap₀ f p ∙₀ ap₀ f q == ap₀ f (p ∙₀ q)
∙₀-ap₀ f = Trunc-elim
(λ p → Trunc-elim
(λ q → ap [_] $ ∙-ap f p q))
ap₀-∘ : ∀ {j k} {B : Type j} {C : Type k} (g : B → C) (f : A → B)
{x y : A} (p : x =₀ y) → ap₀ (g ∘ f) p == ap₀ g (ap₀ f p)
ap₀-∘ f g = Trunc-elim
(λ p → ap [_] $ ap-∘ f g p)
coe₀-∙₀ : {B C : Type i} {{_ : is-set B}} {{_ : is-set C}}
→ (p : A =₀ B) (q : B =₀ C) (a : A)
→ coe₀ (p ∙₀ q) a == coe₀ q (coe₀ p a)
coe₀-∙₀ = Trunc-elim
(λ p → Trunc-elim
(λ q a → coe-∙ p q a))
transp₀-∙₀ : ∀ {j} {B : A → Type j}
→ {{_ : ∀ {a} → is-set (B a)}}
→ {x y z : A} (p : x =₀ y) (q : y =₀ z) (b : B x)
→ transport₀ B (p ∙₀ q) b
== transport₀ B q (transport₀ B p b)
transp₀-∙₀ = Trunc-elim (λ p → Trunc-elim (λ q b → transp-∙ p q b))
transp₀-∙₀' : ∀ {j} {B : A → Type j}
→ {{_ : ∀ {a} → is-set (B a)}}
→ {x y z : A} (p : x =₀ y) (q : y =₀ z) (b : B x)
→ transport₀ B (p ∙₀' q) b
== transport₀ B q (transport₀ B p b)
transp₀-∙₀' = Trunc-elim (λ p → Trunc-elim (λ q b → transp-∙' p q b))
module _ {i} {A : Type i} where
transp₀-cst=₀idf : {a b c : A} (p : b =₀ c) (q : a =₀ b)
→ transport₀ (a =₀_) p q == q ∙₀' p
transp₀-cst=₀idf {a = a} {b} = Trunc-elim
{P = λ p → ∀ q → transport₀ (a =₀_) p q == q ∙₀' p}
(λ p q → lemma p q)
where
lemma : ∀ {c : A} (p : b == c) (q : a =₀ b)
→ transport (a =₀_) p q == q ∙₀' [ p ]
lemma idp q = ! (∙₀'-unit-r q)
transp₀-idf=₀cst : {a b c : A} (p : a =₀ b) (q : a =₀ c)
→ transport₀ (_=₀ c) p q == !₀ p ∙₀ q
transp₀-idf=₀cst {a = a} {c = c} = Trunc-elim
{P = λ p → ∀ q → transport₀ (_=₀ c) p q == !₀ p ∙₀ q}
(λ p q → lemma p q)
where
lemma : ∀ {b} (p : a == b) (q : a =₀ c)
→ transport (_=₀ c) p q == [ ! p ] ∙₀ q
lemma idp q = ! (∙₀-unit-l q)