{-# OPTIONS --with-K --safe #-}
module Erased.With-K where
open import Equality.Propositional
open import Logical-equivalence using (_⇔_)
open import Prelude
open import Bijection equality-with-J using (_↔_)
open import Embedding equality-with-J as Emb using (Is-embedding)
open import Equivalence equality-with-J as Eq
using (_≃_; Is-equivalence)
open import H-level equality-with-J
open import Injection equality-with-J using (Injective)
open import Erased equality-with-J as Erased public
hiding (module []-cong₁; module []-cong₂; module []-cong₃;
Π-Erased↔Π0[])
open import Erased.Stability equality-with-J as Stability public
hiding (module []-cong)
private
variable
a p : Level
A : Set a
[]-cong : {@0 A : Set a} {@0 x y : A} →
Erased (x ≡ y) → [ x ] ≡ [ y ]
[]-cong [ refl ] = refl
[]-cong-equivalence :
{@0 A : Set a} {@0 x y : A} →
Is-equivalence ([]-cong {x = x} {y = y})
[]-cong-equivalence {x = x} {y = y} = _≃_.is-equivalence (Eq.↔⇒≃ (record
{ surjection = record
{ logical-equivalence = record
{ to = []-cong
; from = λ eq → [ cong erased eq ]
}
; right-inverse-of = λ { refl → refl }
}
; left-inverse-of = λ { [ refl ] → refl }
}))
[]-cong-[refl] :
{@0 A : Set a} {@0 x : A} →
[]-cong [ refl {x = x} ] ≡ refl {x = [ x ]}
[]-cong-[refl] = refl
instance-of-[]-cong-axiomatisation : []-cong-axiomatisation a
instance-of-[]-cong-axiomatisation = λ where
.Erased.[]-cong-axiomatisation.[]-cong → []-cong
.Erased.[]-cong-axiomatisation.[]-cong-equivalence → []-cong-equivalence
.Erased.[]-cong-axiomatisation.[]-cong-[refl] → []-cong-[refl]
open Erased.[]-cong₃ instance-of-[]-cong-axiomatisation public
hiding ([]-cong; []-cong-equivalence; []-cong-[refl])
open Stability.[]-cong instance-of-[]-cong-axiomatisation public
Injective-[] : {@0 A : Set a} → Injective ([_] {A = A})
Injective-[] refl = refl
Is-embedding-[] : {@0 A : Set a} → Is-embedding ([_] {A = A})
Is-embedding-[] _ _ refl = (refl , refl) , λ { (refl , refl) → refl }
Is-proposition-Erased→Is-proposition :
{@0 A : Set a} →
Is-proposition (Erased A) → Is-proposition A
Is-proposition-Erased→Is-proposition prop x y =
Injective-[] (prop [ x ] [ y ])
H-level′-1-Erased→H-level′-1 :
{@0 A : Set a} →
H-level′ 1 (Erased A) → H-level′ 1 A
H-level′-1-Erased→H-level′-1 prop x y
with proj₁ (prop [ x ] [ y ])
... | refl = refl , λ { refl → refl }
Very-stable-≡-trivial : Very-stable-≡ A
Very-stable-≡-trivial =
_⇔_.from (Very-stable-≡↔Is-embedding-[] _)
Is-embedding-[]
Π-Erased↔Π0[] :
{@0 A : Set a} {@0 P : Erased A → Set p} →
((x : Erased A) → P x) ↔ ((@0 x : A) → P [ x ])
Π-Erased↔Π0[] = record
{ surjection = record
{ logical-equivalence = Π-Erased⇔Π0
; right-inverse-of = λ _ → refl
}
; left-inverse-of = λ _ → refl
}
Π-Erased≃Π0[] :
{@0 A : Set a} {@0 P : Erased A → Set p} →
((x : Erased A) → P x) ≃ ((@0 x : A) → P [ x ])
Π-Erased≃Π0[] = record
{ to = λ f x → f [ x ]
; is-equivalence = λ f →
( (λ ([ x ]) → f x)
, refl
)
, λ { (_ , refl) → refl }
}
Π-Erased↔Π0 :
{@0 A : Set a} {@0 P : A → Set p} →
((x : Erased A) → P (erased x)) ↔ ((@0 x : A) → P x)
Π-Erased↔Π0 = Π-Erased↔Π0[]
Π-Erased≃Π0 :
{@0 A : Set a} {@0 P : A → Set p} →
((x : Erased A) → P (erased x)) ≃ ((@0 x : A) → P x)
Π-Erased≃Π0 = Π-Erased≃Π0[]
private
data Erased-no-η (@0 A : Set a) : Set a where
[_] : @0 A → Erased-no-η A
@0 erased-no-η : Erased-no-η A → A
erased-no-η [ x ] = x
Π-Erased-no-η→Π0[] :
{@0 A : Set a} {@0 P : Erased-no-η A → Set p} →
((x : Erased-no-η A) → P x) → (@0 x : A) → P [ x ]
Π-Erased-no-η→Π0[] f x = f [ x ]
Π0[]→Π-Erased-no-η :
{@0 A : Set a} (@0 P : Erased-no-η A → Set p) →
((@0 x : A) → P [ x ]) → (x : Erased-no-η A) → P x
Π0[]→Π-Erased-no-η _ f [ x ] = f x
Π0[]→Π-Erased-no-η-Π-Erased-no-η→Π0[] :
{@0 A : Set a} {@0 P : Erased-no-η A → Set p}
(f : (x : Erased-no-η A) → P x) (x : Erased-no-η A) →
Π0[]→Π-Erased-no-η P (Π-Erased-no-η→Π0[] f) x ≡ f x
Π0[]→Π-Erased-no-η-Π-Erased-no-η→Π0[] f [ x ] = refl
Π-Erased-no-η↔Π0[] :
{@0 A : Set a} {@0 P : Erased-no-η A → Set p} →
Extensionality′ (Erased-no-η A) P →
((x : Erased-no-η A) → P x) ↔ ((@0 x : A) → P [ x ])
Π-Erased-no-η↔Π0[] {P = P} ext = record
{ surjection = record
{ logical-equivalence = record
{ to = Π-Erased-no-η→Π0[]
; from = Π0[]→Π-Erased-no-η _
}
; right-inverse-of = λ _ → refl
}
; left-inverse-of = λ f →
ext (Π0[]→Π-Erased-no-η-Π-Erased-no-η→Π0[] f)
}
Π-Erased-no-η≃Π0[] :
{@0 A : Set a} {@0 P : Erased-no-η A → Set p} →
Extensionality′ (Erased-no-η A) P →
((x : Erased-no-η A) → P x) ≃ ((@0 x : A) → P [ x ])
Π-Erased-no-η≃Π0[] {A = A} {P = P} ext = record
{ to = λ f x → f [ x ]
; is-equivalence = λ f →
( Π0[]→Π-Erased-no-η _ f
, refl
)
, λ { (g , refl) → lemma g }
}
where
Σ-≡,≡→≡′ :
{@0 A : Set a} {@0 P : A → Set p} {p₁ p₂ : Σ A P} →
(p : proj₁ p₁ ≡ proj₁ p₂) →
subst P p (proj₂ p₁) ≡ proj₂ p₂ →
p₁ ≡ p₂
Σ-≡,≡→≡′ refl refl = refl
subst-lemma :
({g} g′ : (x : Erased-no-η A) → P x)
(eq₁ : Π0[]→Π-Erased-no-η P (λ (@0 x) → g′ [ x ]) ≡ g)
(eq₂ : (λ (@0 x) → g′ [ x ]) ≡ (λ (@0 x) → g [ x ])) →
subst (λ f → (λ (@0 x) → f [ x ]) ≡ (λ (@0 x) → g [ x ]))
eq₁ eq₂ ≡
refl
subst-lemma _ refl refl = refl
lemma :
(g : (x : Erased-no-η A) → P x) →
(Π0[]→Π-Erased-no-η P (λ (@0 x) → g [ x ]) , refl) ≡ (g , refl)
lemma g = Σ-≡,≡→≡′ eq (subst-lemma g eq refl)
where
eq = ext (Π0[]→Π-Erased-no-η-Π-Erased-no-η→Π0[] g)
Π-Erased-no-η↔Π0 :
{@0 A : Set a} {@0 P : A → Set p} →
Extensionality′ (Erased-no-η A) (P ∘ erased-no-η) →
((x : Erased-no-η A) → P (erased-no-η x)) ↔ ((@0 x : A) → P x)
Π-Erased-no-η↔Π0 = Π-Erased-no-η↔Π0[]
Π-Erased-no-η≃Π0 :
{@0 A : Set a} {@0 P : A → Set p} →
Extensionality′ (Erased-no-η A) (P ∘ erased-no-η) →
((x : Erased-no-η A) → P (erased-no-η x)) ≃ ((@0 x : A) → P x)
Π-Erased-no-η≃Π0 = Π-Erased-no-η≃Π0[]