{-# OPTIONS --without-K --rewriting #-}
module Interval where
open import Equality.Propositional hiding (elim)
open import Prelude
postulate
I : Set
[0] [1] : I
0≡1 : [0] ≡ [1]
module _ {p}
(P : I → Set p)
(p₀ : P [0])
(p₁ : P [1])
(p₀≡p₁ : subst P 0≡1 p₀ ≡ p₁)
where
postulate
elim : (x : I) → P x
elim-[0] : elim [0] ≡ p₀
elim-[1] : elim [1] ≡ p₁
{-# REWRITE elim-[0] #-}
{-# REWRITE elim-[1] #-}
postulate
elim-0≡1 : dependent-cong elim 0≡1 ≡ p₀≡p₁
rec : ∀ {p} {P : Set p}
(p₀ p₁ : P)
(p₀≡p₁ : p₀ ≡ p₁) →
I → P
rec p₀ p₁ p₀≡p₁ =
elim _ p₀ p₁ (
subst (const _) 0≡1 p₀ ≡⟨ subst-const 0≡1 ⟩
p₀ ≡⟨ p₀≡p₁ ⟩∎
p₁ ∎)
interval-contractible : Contractible I
interval-contractible = [1] , sym ∘ f
where
f : (x : I) → x ≡ [1]
f = elim (_≡ [1]) 0≡1 refl
(subst (_≡ [1]) 0≡1 0≡1 ≡⟨ cong (λ p → subst (_≡ [1]) p 0≡1)
(sym $ sym-sym 0≡1) ⟩
subst (_≡ [1]) (sym (sym 0≡1)) 0≡1 ≡⟨ subst-trans (sym 0≡1) ⟩
trans (sym 0≡1) 0≡1 ≡⟨ trans-symˡ 0≡1 ⟩∎
refl ∎)
ext : ∀ {a b} → Extensionality a b
ext {A = A} {B = B} {f = f} {g = g} f≡g =
f ≡⟨⟩
h [0] ≡⟨ cong h 0≡1 ⟩
h [1] ≡⟨ refl ⟩∎
g ∎
where
h : I → ((x : A) → B x)
h i x = rec (f x) (g x) (f≡g x) i