{-# OPTIONS --without-K #-}
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_ = _=₀_
infix 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 Trunc-level ([_] ∘ ap f)
coe₀ : ∀ {i} {A B : Type i} (_ : is-set B) (p : A =₀ B) → A → B
coe₀ B-level = Trunc-rec (→-is-set B-level) coe
transport₀ : ∀ {i j} {A : Type i} (B : A → Type j) {x y : A}
(B-level : is-set (B y)) (p : x =₀ y) → (B x → B y)
transport₀ B B-level p = coe₀ B-level (ap₀ B p)
module _ {i} {A : Type i} where
abstract
∙₀-unit-r : ∀ {x y : A} (q : x =₀ y) → (q ∙₀ idp₀) == q
∙₀-unit-r = Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ p → ap [_] $ ∙-unit-r p)
∙₀-unit-l : ∀ {x y : A} (q : x =₀ y) → (idp₀ ∙₀ q) == q
∙₀-unit-l = Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ _ → idp)
∙₀-assoc : {x y z t : A} (p : x =₀ y) (q : y =₀ z) (r : z =₀ t)
→ (p ∙₀ q) ∙₀ r == p ∙₀ (q ∙₀ r)
∙₀-assoc = Trunc-elim
(λ _ → Π-is-set λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ p → Trunc-elim
(λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ q → Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ r → ap [_] $ ∙-assoc p q r)))
!₀-inv-l : {x y : A} (p : x =₀ y) → (!₀ p) ∙₀ p == idp₀
!₀-inv-l = Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ p → ap [_] $ !-inv-l p)
!₀-inv-r : {x y : A} (p : x =₀ y) → p ∙₀ (!₀ p) == idp₀
!₀-inv-r = Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ 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
(λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ p → Trunc-elim
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ 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
(λ _ → =-preserves-level ⟨0⟩ Trunc-level)
(λ p → ap [_] $ ap-∘ f g p)
coe₀-∙₀ : {B C : Type i} (B-level : is-set B) (C-level : is-set C)
→ (p : A =₀ B) (q : B =₀ C) (a : A)
→ coe₀ C-level (p ∙₀ q) a == coe₀ C-level q (coe₀ B-level p a)
coe₀-∙₀ B-level C-level = Trunc-elim
(λ _ → Π-is-set λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ C-level)
(λ p → Trunc-elim
(λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ C-level)
(λ q a → coe-∙ p q a))
trans₀-∙₀ : ∀ {j} {B : A → Type j}
→ (B-level : ∀ a → is-set (B a))
→ {x y z : A} (p : x =₀ y) (q : y =₀ z) (b : B x)
→ transport₀ B (B-level _) (p ∙₀ q) b
== transport₀ B (B-level _) q (transport₀ B (B-level _) p b)
trans₀-∙₀ B-level = Trunc-elim
(λ _ → Π-is-set λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ $ B-level _)
(λ p → Trunc-elim
(λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ $ B-level _)
(λ q b → trans-∙ p q b))
trans₀-∙₀' : ∀ {j} {B : A → Type j}
→ (B-level : ∀ a → is-set (B a))
→ {x y z : A} (p : x =₀ y) (q : y =₀ z) (b : B x)
→ transport₀ B (B-level _) (p ∙₀' q) b
== transport₀ B (B-level _) q (transport₀ B (B-level _) p b)
trans₀-∙₀' B-level = Trunc-elim
(λ _ → Π-is-set λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ $ B-level _)
(λ p → Trunc-elim
(λ _ → Π-is-set λ _ → =-preserves-level ⟨0⟩ $ B-level _)
(λ q b → trans-∙' p q b))