Files
Julius FischerandClaude Opus 5.5 c1e10c1420 Separate syntax for level expressions
Terms are now indexed by a sort: Term = Tm term, Lvl = Tm level. Level
expressions (`lzero, `lsuc, _`⊔_) live in Lvl and meet terms only through
the coercions `lvl : Lvl → Term and `latom : Term → Lvl, with the new
reduction `latom (`lvl l) ↪ l. Level equality _~_ is unchanged on levels
and a pure congruence on terms, so it can no longer hide or create redexes.

Conversion _≈_ is now a common reduct under reduction modulo level
equality (_↪~*_). Typing gains the level well-formedness judgement _⊢ₗ_.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LG5WunTkTJFuvdzgET3Af
2026-10-22 11:14:30 +02:00

44 lines
1.4 KiB
Agda

module univTypes.SubjectReduction.Specification.Conversion where
open import univTypes.SubjectReduction.Specification.Syntax
open import univTypes.SubjectReduction.Specification.Reduction
open import univTypes.SubjectReduction.Specification.LevelEquality
infix 4 _↪~_ _↪~*_ _≈_
-- Reduction modulo level equality: a step is a reduction step or a level
-- equation.
data _↪~_ {s n} (e e' : Tm s n) : Set where
↪~-↪ : e ↪ e' → e ↪~ e'
↪~-~ : e ~ e' → e ↪~ e'
data _↪~*_ : ∀ {s n} → Tm s n → Tm s n → Set where
↪~*-refl : ∀ {s n} {e : Tm s n}
→ e ↪~* e
↪~*-step : ∀ {s n} {e₁ e₂ e₃ : Tm s n}
→ e₁ ↪~ e₂
→ e₂ ↪~* e₃
→ e₁ ↪~* e₃
↪~*-trans : ∀ {s n} {e₁ e₂ e₃ : Tm s n}
→ e₁ ↪~* e₂
→ e₂ ↪~* e₃
→ e₁ ↪~* e₃
↪~*-trans ↪~*-refl q = q
↪~*-trans (↪~*-step x p) q = ↪~*-step x (↪~*-trans p q)
-- Two terms are convertible iff they have a common reduct under reduction
-- modulo level equality. (Reducing first and comparing with _~_ only at the
-- end would make transitivity hard to prove: l `⊔ l ~ l duplicates l, and
-- the two copies can then be reduced differently.)
record _≈_ {s n} (e₁ e₂ : Tm s n) : Set where
constructor mk-≈
field
u : Tm s n
e₁↪~*u : e₁ ↪~* u
e₂↪~*u : e₂ ↪~* u
open _≈_ public