open import Graded.Modality
module Definition.Typed.Restrictions
{a} {M : Set a}
(𝕄 : Modality M)
where
open Modality 𝕄
open import Definition.Typed.Variant
open import Definition.Untyped M
open import Definition.Untyped.Properties M
open import Tools.Function
open import Tools.Level
open import Tools.Product
open import Tools.Relation
open import Tools.PropositionalEquality
open import Tools.Sum
private variable
Γ : Con Term _
record Type-restrictions : Set (lsuc a) where
no-eta-equality
field
type-variant : Type-variant
open Type-variant type-variant public
field
Unit-allowed : Strength → Set a
ΠΣ-allowed : BinderMode → (p q : M) → Set a
Unitˢ-allowed : Set a
Unitˢ-allowed = Unit-allowed 𝕤
Unitʷ-allowed : Set a
Unitʷ-allowed = Unit-allowed 𝕨
Π-allowed : M → M → Set a
Π-allowed = ΠΣ-allowed BMΠ
Σ-allowed : Strength → M → M → Set a
Σ-allowed = ΠΣ-allowed ∘→ BMΣ
Σˢ-allowed : M → M → Set a
Σˢ-allowed = Σ-allowed 𝕤
Σʷ-allowed : M → M → Set a
Σʷ-allowed = Σ-allowed 𝕨
Erased-allowed : Strength → Set a
Erased-allowed s = Unit-allowed s × Σ-allowed s 𝟘 𝟘
Erasedˢ-allowed = Erased-allowed 𝕤
Erasedʷ-allowed = Erased-allowed 𝕨
field
K-allowed : Set a
[]-cong-allowed : Strength → Set a
[]-cong→Erased : ∀ {s} → []-cong-allowed s → Erased-allowed s
[]-cong→¬Trivial : ∀ {s} → []-cong-allowed s → ¬ Trivial
[]-congˢ-allowed = []-cong-allowed 𝕤
[]-congʷ-allowed = []-cong-allowed 𝕨
field
Equality-reflection : Set a
Equality-reflection? : Dec Equality-reflection
data No-equality-reflection : Set a where
no-equality-reflection :
¬ Equality-reflection → No-equality-reflection
opaque
No-equality-reflection⇔ :
No-equality-reflection ⇔ (¬ Equality-reflection)
No-equality-reflection⇔ =
(λ { (no-equality-reflection not-ok) → not-ok })
, no-equality-reflection
opaque
No-equality-reflection? : Dec No-equality-reflection
No-equality-reflection? =
Dec-map (sym⇔ No-equality-reflection⇔) (¬? Equality-reflection?)
opaque
No-equality-reflection-or-empty⇔ :
No-equality-reflection or-empty Γ ⇔
(¬ Equality-reflection ⊎ Empty-con Γ)
No-equality-reflection-or-empty⇔ {Γ} =
No-equality-reflection or-empty Γ ⇔⟨ or-empty⇔ ⟩
No-equality-reflection ⊎ Empty-con Γ ⇔⟨ No-equality-reflection⇔ ⊎-cong-⇔ id⇔ ⟩
¬ Equality-reflection ⊎ Empty-con Γ □⇔
opaque
No-equality-reflection-or-empty? :
Dec (No-equality-reflection or-empty Γ)
No-equality-reflection-or-empty? =
No-equality-reflection? or-empty?
BindingType-allowed : BindingType → Set a
BindingType-allowed (BM b p q) = ΠΣ-allowed b p q
Unit-with-η : Strength → Set
Unit-with-η s = s ≡ 𝕤 ⊎ Unitʷ-η
opaque
Unit-with-η? : ∀ s → Unit-with-η s ⊎ s ≡ 𝕨 × ¬ Unitʷ-η
Unit-with-η? 𝕤 = inj₁ (inj₁ refl)
Unit-with-η? 𝕨 = case Unitʷ-η? of λ where
(yes η) → inj₁ (inj₂ η)
(no no-η) → inj₂ (refl , no-η)
opaque
Unit-with-η-𝕨→Unitʷ-η : Unit-with-η 𝕨 → Unitʷ-η
Unit-with-η-𝕨→Unitʷ-η (inj₂ η) = η
Unit-with-η-𝕨→Unitʷ-η (inj₁ ())
open Type-restrictions