Typecheck / agda (push) Successful in 2m22s
True is the unit type (`True = `Unit, `trivial = `tt). `False : Set has no introduction form; `absurd P e : P for e : False never reduces at the root (neutral when e is). Covered through level equality, confluence, the level normaliser, subject reduction, progress, decidability and strong normalisation (members of False are terms reducing to a neutral term). The set-theory interface gains an empty set, which False denotes; Model/Consistency proves no-False. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
91 lines
3.0 KiB
Agda
91 lines
3.0 KiB
Agda
module univTypes.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⦂_]_ ∃[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
|
||
-- The domain annotation lets a λ denote a graph over its domain
|
||
-- (set-theoretic model).
|
||
`λ[x⦂_]_ : ∀ {n} → Term 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
|
||
|
||
-- The empty type, and ex falso: `absurd P e : P for e : `False.
|
||
`False : ∀ {n : ℕ} → Term n
|
||
`absurd : ∀ {n : ℕ} (P e : Term n) → Term n
|
||
|
||
`ℕ : ∀ {n : ℕ} → Term n
|
||
`zero : ∀ {n : ℕ} → Term n
|
||
`suc_ : ∀ {n : ℕ} (k : Term n) → Term n
|
||
`natrec : ∀ {n : ℕ} (F z s t : Term 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)
|
||
|
||
-- True is the unit type, with its one member.
|
||
`True : ∀ {n} → Term n
|
||
`True = `Unit
|
||
|
||
`trivial : ∀ {n} → Term n
|
||
`trivial = `tt
|