{-# OPTIONS --cubical-compatible --irrelevant-projections #-}
open import Equality
module Squash.Irrelevance
{c⁺} (eq : ∀ {a p} → Equality-with-J a p c⁺) where
open Derived-definitions-and-properties eq
open import Logical-equivalence using (_⇔_)
import Modality.Empty-modal
open import Prelude
open import Equivalence eq using (_≃_)
open import Equivalence.Path-split eq
using (Is-∞-extendable-along-[_])
open import Extensionality eq
open import Function-universe eq hiding (id; _∘_)
open import H-level eq
open import H-level.Closure eq
open import Modality.Basics eq
import Modality.Very-modal eq as VM
open import Monad eq
private
variable
a ℓ : Level
A B : Type a
record Squash (A : Type a) : Type a where
constructor [_]
field
.squashed : A
private
test : [ 4 ] ∷ [ 5 ] ∷ [] ≡ [ 3 ] ∷ [ 9 ] ∷ []
test = refl _
Squash-propositional : Is-proposition (Squash A)
Squash-propositional = λ _ _ → refl _
infixl 5 _>>=′_
_>>=′_ : Squash A → (A → Squash B) → Squash B
[ x ] >>=′ f = [ Squash.squashed (f x) ]
instance
raw-monad : Raw-monad {c = ℓ} Squash
Raw-monad.return raw-monad x = [ x ]
Raw-monad._>>=_ raw-monad = _>>=′_
monad : Monad {c = ℓ} Squash
Monad.raw-monad monad = raw-monad
Monad.left-identity monad = λ _ _ → refl _
Monad.right-identity monad = λ _ → refl _
Monad.associativity monad = λ _ _ _ → refl _
Stable : Type a → Type a
Stable A = Squash A → A
modality : Modality ℓ
modality {ℓ} = λ where
.Modality.◯ → Squash
.Modality.η x → [ x ]
.Modality.modality-for → λ where
.Modality-for.Modal → Modal
.Modality-for.Modal-propositional → prop
.Modality-for.Modal-◯ → Modal-Squash
.Modality-for.Modal-respects-≃ → resp
.Modality-for.extendable-along-η → extendable
where
Modal : Type ℓ → Type ℓ
Modal A = Stable A × Is-proposition A
Modal-Squash : Modal (Squash A)
Modal-Squash = _>>= id , Squash-propositional
prop :
{A : Type ℓ} →
Extensionality ℓ ℓ →
Is-proposition (Stable A × Is-proposition A)
prop ext =
[inhabited⇒+]⇒+ 0 λ (_ , prop) →
×-closure 1
(Π-closure ext 1 λ _ → prop)
(H-level-propositional ext 1)
resp : A ≃ B → Modal A → Modal B
resp {A} {B} A≃B =
Stable A × Is-proposition A →⟨ →-cong-→ (_>>= λ x → [ _≃_.from A≃B x ]) (_≃_.to A≃B)
×-cong
H-level-cong _ 1 A≃B ⟩□
Stable B × Is-proposition B □
Modal→Separated : {x y : A} → Modal A → Modal (x ≡ y)
Modal→Separated {A} {x} {y} (s , prop) =
(Squash (x ≡ y) →⟨ const prop ⟩
Is-proposition A →⟨ +⇒≡ ⟩
Contractible (x ≡ y) →⟨ proj₁ ⟩□
x ≡ y □)
, ⇒≡ 1 prop
extendable :
{A : Type ℓ} {P : Squash A → Type ℓ} →
(∀ x → Modal (P x)) →
Is-∞-extendable-along-[ (λ x → [ x ]) ] P
extendable _ zero = _
extendable {A} {P} m (suc n) =
(λ f → (λ x → m x .proj₁ (lemma x f))
, (λ x →
m [ x ] .proj₁ (lemma [ x ] f) ≡⟨ m [ x ] .proj₂ _ _ ⟩∎
f x ∎))
, (λ _ _ → extendable (Modal→Separated ∘ m) n)
where
lemma : (x : Squash A) → ((x : A) → P [ x ]) → Squash (P x)
lemma [ x ] f = [ f x ]
empty-modal : Empty-modal (modality {ℓ = ℓ})
empty-modal =
(λ { [ () ] })
, ⊥-propositional
private
module EM {ℓ} =
Modality.Empty-modal.Empty-modal eq (modality {ℓ = ℓ}) empty-modal
not-left-exact : ¬ Left-exact (Squash {a = a})
not-left-exact =
Empty-modal→Is-proposition-◯→¬-Left-exact
empty-modal Squash-propositional
where
open Modality modality
not-very-modal : ¬ Very-modal (modality {ℓ = ℓ})
not-very-modal =
Very-modal modality →⟨ VM.left-exact modality ⟩
Left-exact Squash →⟨ not-left-exact ⟩□
⊥ □
not-accessibility-modal :
¬ Modality.Accessibility-modal (modality {ℓ = ℓ})
not-accessibility-modal =
Is-proposition-◯→¬-Accessibility-modal Squash-propositional
where
open Modality modality