`Unit : Set and `tt : `Unit, both values and inert under renaming, substitution, reduction and level equality. Cases added throughout confluence, conversion, the level normaliser, substitution lemmas, subject reduction and progress (new head hUnit for canonical forms). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
2.4 KiB
Agda
73 lines
2.4 KiB
Agda
module univTypes.SubjectReduction.Specification.Syntax where
|
||
|
||
open import Data.Nat using (ℕ; suc)
|
||
|
||
open import Data.Fin using (Fin)
|
||
|
||
-- Terms come in two sorts: ordinary terms and level expressions. Level
|
||
-- expressions have their own syntax (`lzero, `lsuc, _`⊔_), so that level
|
||
-- equality (LevelEquality) can only rearrange levels and never changes the
|
||
-- shape of a term. The two sorts meet in two coercions:
|
||
-- `lvl : Lvl n → Term n a level expression used as a term of type `Level
|
||
-- `latom : Term n → Lvl n a term of type `Level used as a level
|
||
-- with the reduction `latom (`lvl l) ↪ l.
|
||
|
||
data Sort : Set where
|
||
tm lv : Sort -- terms, level expressions
|
||
|
||
-- Term operators, loosest to tightest. All bind tighter than the judgements
|
||
-- (_↪_, _≈_, _~_, _⊢_⦂_ at 4) and the context extension _,_ (at 5);
|
||
-- constructors used as functions (`lsuc, `lvl, `latom, `proj₁, `proj₂,
|
||
-- `subst) bind like application, i.e. tightest. _[_] (Substitution) is at 12.
|
||
infixr 6 `λ_ ∀[x⦂_]_ ∃[x⦂_]_ -- binders: the body extends to the right
|
||
infixr 7 _`,_
|
||
infix 8 _`≡_
|
||
infix 9 `Setn_ `Setω_ -- `Setn l₁ `⊔ l₂ = `Setn (l₁ `⊔ l₂)
|
||
infixl 10 _`⊔_
|
||
infixl 11 _·_
|
||
infix 13 `_
|
||
|
||
data Tm : Sort → ℕ → Set
|
||
|
||
Term : ℕ → Set
|
||
Term = Tm tm
|
||
|
||
Lvl : ℕ → Set
|
||
Lvl = Tm lv
|
||
|
||
data Tm where
|
||
`_ : ∀ {n} → Fin n → Term n
|
||
`λ_ : ∀ {n} → Term (suc n) → Term n
|
||
_·_ : ∀ {n} → Term n → Term n → Term n
|
||
∀[x⦂_]_ : ∀ {n} → Term n → Term (suc n) → Term n
|
||
|
||
-- My Extension
|
||
`Unit : ∀ {n : ℕ} → Term n
|
||
`tt : ∀ {n : ℕ} → Term n
|
||
|
||
`Setω_ : ∀ {n : ℕ} (l : ℕ) → Term n
|
||
`Setn_ : ∀ {n} (l : Lvl n) → Term n
|
||
`Level : ∀ {n} → Term n
|
||
`lvl : ∀ {n} → Lvl n → Term n
|
||
|
||
-- Level expressions
|
||
`latom : ∀ {n} → Term n → Lvl n
|
||
`lzero : ∀ {n} → Lvl n
|
||
`lsuc : ∀ {n} → Lvl n → Lvl n
|
||
_`⊔_ : ∀ {n} → Lvl n → Lvl n → Lvl n
|
||
|
||
-- Extension
|
||
∃[x⦂_]_ : ∀ {n} → Term n → Term (suc n) → Term n
|
||
_`,_ : ∀ {n} → Term n → Term n → Term n
|
||
`proj₁ : ∀ {n} → Term n → Term n
|
||
`proj₂ : ∀ {n} → Term n → Term n
|
||
_`≡_ : ∀ {n} → Term n → Term n → Term n
|
||
`refl : ∀ {n} → Term n
|
||
`subst : ∀ {n} → Term (suc n) → Term n → Term n → Term n
|
||
|
||
{-# DISPLAY Tm tm n = Term n #-}
|
||
{-# DISPLAY Tm lv n = Lvl n #-}
|
||
|
||
`Set : ∀ {n} → Term n
|
||
`Set = `Setn (`lzero)
|