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 Tools.Function
open import Tools.Level
open import Tools.Product
open import Tools.Relation
open import Tools.PropositionalEquality
open import Tools.Sum
open import Tools.Unit
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 𝕨
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-η)
open Type-restrictions