{-# OPTIONS --without-K #-}
open import lib.Base
open import lib.PathGroupoid
module lib.PathFunctor {i} {A : Type i} where
module _ {j} {B : Type j} (f : A → B) where
!-ap : {x y : A} (p : x == y)
→ ! (ap f p) == ap f (! p)
!-ap idp = idp
ap-! : {x y : A} (p : x == y)
→ ap f (! p) == ! (ap f p)
ap-! idp = idp
∙-ap : {x y z : A} (p : x == y) (q : y == z)
→ ap f p ∙ ap f q == ap f (p ∙ q)
∙-ap idp q = idp
ap-∙ : {x y z : A} (p : x == y) (q : y == z)
→ ap f (p ∙ q) == ap f p ∙ ap f q
ap-∙ idp q = idp
∙'-ap : {x y z : A} (p : x == y) (q : y == z)
→ ap f p ∙' ap f q == ap f (p ∙' q)
∙'-ap p idp = idp
ap-∙' : {x y z : A} (p : x == y) (q : y == z)
→ ap f (p ∙' q) == ap f p ∙' ap f q
ap-∙' p idp = idp
module _ {j} {B : A → Type j} (f : Π A B) where
apd-∙ : {x y z : A} (p : x == y) (q : y == z)
→ apd f (p ∙ q) == apd f p ∙ᵈ apd f q
apd-∙ idp idp = idp
apd-∙' : {x y z : A} (p : x == y) (q : y == z)
→ apd f (p ∙' q) == apd f p ∙'ᵈ apd f q
apd-∙' idp idp = idp
module _ {j k} {B : A → Type j} {C : A → Type k} (f : {a : A} → B a → C a) where
ap↓-◃ : {x y z : A} {u : B x} {v : B y} {w : B z}
{p : x == y} {p' : y == z} (q : u == v [ B ↓ p ]) (r : v == w [ B ↓ p' ])
→ ap↓ f (q ◃ r) == ap↓ f q ◃ ap↓ f r
ap↓-◃ {p = idp} {p' = idp} idp idp = idp
ap↓-▹! : {x y z : A} {u : B x} {v : B y} {w : B z}
{p : x == y} {p' : z == y} (q : u == v [ B ↓ p ]) (r : w == v [ B ↓ p' ])
→ ap↓ f (q ▹! r) == ap↓ f q ▹! ap↓ f r
ap↓-▹! {p = idp} {p' = idp} idp idp = idp
∘-ap : ∀ {j k} {B : Type j} {C : Type k} (g : B → C) (f : A → B)
{x y : A} (p : x == y) → ap g (ap f p) == ap (g ∘ f) p
∘-ap f g idp = idp
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 idp = idp
ap-cst : ∀ {j} {B : Type j} (b : B) {x y : A} (p : x == y)
→ ap (cst b) p == idp
ap-cst b idp = idp
ap-idf : {u v : A} (p : u == v) → ap (idf A) p == p
ap-idf idp = idp
coe-∙ : {B C : Type i} (p : A == B) (q : B == C) (a : A)
→ coe (p ∙ q) a == coe q (coe p a)
coe-∙ idp q a = idp
coe-! : {B : Type i} (p : A == B) → coe (! p) == coe! p
coe-! idp = idp
coe!-inv-r : {B : Type i} (p : A == B) (b : B)
→ coe p (coe! p b) == b
coe!-inv-r idp b = idp
coe!-inv-l : {B : Type i} (p : A == B) (a : A)
→ coe! p (coe p a) == a
coe!-inv-l idp a = idp
coe-ap-! : ∀ {j} (P : A → Type j) {a b : A} (p : a == b)
(x : P b)
→ coe (ap P (! p)) x == coe! (ap P p) x
coe-ap-! P idp x = idp
trans-∙ : ∀ {j} {B : A → Type j} {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)
trans-∙ idp _ _ = idp
htpy-natural : ∀ {j} {B : Type j} {x y : A} {f g : A → B}
(p : ∀ x → (f x == g x)) (q : x == y) → ap f q ∙ p y == p x ∙ ap g q
htpy-natural p idp = ! (∙-unit-r _)
htpy-natural-toid : {f : A → A}
(p : ∀ (x : A) → f x == x) → (∀ x → ap f (p x) == p (f x))
htpy-natural-toid {f = f} p x = anti-whisker-right (p x) $
htpy-natural p (p x) ∙ ap (λ q → p (f x) ∙ q) (ap-idf (p x))
trans-pathfrom : ∀ {a x y : A} (p : x == y) (q : a == x)
→ transport (λ x → a == x) p q == q ∙ p
trans-pathfrom idp q = ! (∙-unit-r q)