module univTypes.Decidability.Statement where open import Data.Product using (∃-syntax; _×_) open import Relation.Nullary using (Dec) open import univTypes.SubjectReduction.Specification -- Decidability of conversion, stated as types (to be inhabited). -- -- On arbitrary terms conversion is undecidable (by Scott–Curry, already -- `e ≈ λx. x` is undecidable for untyped e), so the statement is restricted -- to well-typed terms. The two terms may have different types: the type -- checker compares types that live in different universes. Decidable-≈ : Set Decidable-≈ = ∀ {n} {Γ : Context n} {e₁ e₂ t₁ t₂ : Term n} → Γ ⊢ e₁ ⦂ t₁ → Γ ⊢ e₂ ⦂ t₂ → Dec (e₁ ≈ e₂) -- The same for level expressions (well-formed levels may contain atoms, -- i.e. arbitrary terms of type Level). Decidable-≈ₗ : Set Decidable-≈ₗ = ∀ {n} {Γ : Context n} {l₁ l₂ : Lvl n} → Γ ⊢ₗ l₁ → Γ ⊢ₗ l₂ → Dec (l₁ ≈ l₂) -- The expected route: normalisation (every well-typed term reduces to a -- normal form, Value), then confluence modulo ~ (ConfluenceModulo) reduces -- e₁ ≈ e₂ to comparing the normal forms modulo ~, which the level -- normaliser decides (LevelEqualityDecision). Normalisation : Set Normalisation = ∀ {n} {Γ : Context n} {e t : Term n} → Γ ⊢ e ⦂ t → ∃[ v ] e ↪* v × Value v