Files
Julius FischerandClaude Opus 5.5 d83c61261d
Typecheck / agda (push) Successful in 1m52s
Annotate λ with its domain: `λ[x⦂ A ] e
Preparation for the set-theoretic model, where a λ denotes the graph of
its body over its domain. ⊢-λ uses the annotation as the domain;
reduction also reduces it (ξ-λ₁) and β discards it, so inductive SN and
the backward closure get a side condition for it. All proofs, tests and
Examples/Issue (annotations only) are updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7dfaHQ3dYSfqcxR7V5UrJ
2026-11-22 21:12:06 +01:00

80 lines
2.7 KiB
Agda
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
`ℕ : ∀ {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)