Typecheck / agda (push) Successful in 1m52s
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
134 lines
3.4 KiB
Agda
134 lines
3.4 KiB
Agda
module univTypes.Specification.LevelEquality where
|
|
|
|
open import Data.Nat using (suc)
|
|
|
|
open import univTypes.Specification.Syntax
|
|
|
|
infix 4 _~_
|
|
|
|
-- Level equality, lifted to whole terms: the congruence closure of the
|
|
-- equations of a join-semilattice with least element `lzero and an
|
|
-- inflationary endomorphism `lsuc that distributes over `⊔.
|
|
--
|
|
-- The equations only hold between level expressions (sort `lv`). On terms,
|
|
-- _~_ is a pure congruence, so ~-equal terms have the same shape; in
|
|
-- particular a term is a redex iff every ~-equal term is one.
|
|
--
|
|
-- This is the specification; the level normaliser has to be proven sound
|
|
-- and complete with respect to it.
|
|
|
|
data _~_ : ∀ {s n} → Tm s n → Tm s n → Set where
|
|
|
|
-- Equivalence
|
|
|
|
~-refl : ∀ {s n} {e : Tm s n}
|
|
→ e ~ e
|
|
|
|
~-sym : ∀ {s n} {e₁ e₂ : Tm s n}
|
|
→ e₁ ~ e₂
|
|
→ e₂ ~ e₁
|
|
|
|
~-trans : ∀ {s n} {e₁ e₂ e₃ : Tm s n}
|
|
→ e₁ ~ e₂
|
|
→ e₂ ~ e₃
|
|
→ e₁ ~ e₃
|
|
|
|
-- Level equations
|
|
|
|
-- equality decidable? Claude!
|
|
⊔-assoc : ∀ {n} {l₁ l₂ l₃ : Lvl n}
|
|
→ (l₁ `⊔ l₂) `⊔ l₃ ~ l₁ `⊔ (l₂ `⊔ l₃)
|
|
|
|
⊔-comm : ∀ {n} {l₁ l₂ : Lvl n}
|
|
→ l₁ `⊔ l₂ ~ l₂ `⊔ l₁
|
|
|
|
⊔-idem : ∀ {n} {l : Lvl n}
|
|
→ l `⊔ l ~ l
|
|
|
|
⊔-lzero : ∀ {n} {l : Lvl n}
|
|
→ l `⊔ `lzero ~ l
|
|
|
|
lsuc-⊔ : ∀ {n} {l₁ l₂ : Lvl n}
|
|
→ `lsuc (l₁ `⊔ l₂) ~ `lsuc l₁ `⊔ `lsuc l₂
|
|
|
|
⊔-lsuc : ∀ {n} {l : Lvl n}
|
|
→ l `⊔ `lsuc l ~ `lsuc l
|
|
|
|
-- Congruence (variables, `Level, `lzero and `refl are covered by ~-refl)
|
|
|
|
~-λ : ∀ {n} {A A' : Term n} {e e' : Term (suc n)}
|
|
→ A ~ A'
|
|
→ e ~ e'
|
|
→ `λ[x⦂ A ] e ~ `λ[x⦂ A' ] e'
|
|
|
|
~-· : ∀ {n} {e₁ e₁' e₂ e₂' : Term n}
|
|
→ e₁ ~ e₁'
|
|
→ e₂ ~ e₂'
|
|
→ e₁ · e₂ ~ e₁' · e₂'
|
|
|
|
~-∀ : ∀ {n} {t₁ t₁' : Term n} {t₂ t₂' : Term (suc n)}
|
|
→ t₁ ~ t₁'
|
|
→ t₂ ~ t₂'
|
|
→ ∀[x⦂ t₁ ] t₂ ~ ∀[x⦂ t₁' ] t₂'
|
|
|
|
~-Setn : ∀ {n} {l l' : Lvl n}
|
|
→ l ~ l'
|
|
→ `Setn l ~ `Setn l'
|
|
|
|
~-lvl : ∀ {n} {l l' : Lvl n}
|
|
→ l ~ l'
|
|
→ `lvl l ~ `lvl l'
|
|
|
|
~-latom : ∀ {n} {e e' : Term n}
|
|
→ e ~ e'
|
|
→ `latom e ~ `latom e'
|
|
|
|
~-lsuc : ∀ {n} {l l' : Lvl n}
|
|
→ l ~ l'
|
|
→ `lsuc l ~ `lsuc l'
|
|
|
|
~-⊔ : ∀ {n} {l₁ l₁' l₂ l₂' : Lvl n}
|
|
→ l₁ ~ l₁'
|
|
→ l₂ ~ l₂'
|
|
→ l₁ `⊔ l₂ ~ l₁' `⊔ l₂'
|
|
|
|
~-∃ : ∀ {n} {t₁ t₁' : Term n} {t₂ t₂' : Term (suc n)}
|
|
→ t₁ ~ t₁'
|
|
→ t₂ ~ t₂'
|
|
→ ∃[x⦂ t₁ ] t₂ ~ ∃[x⦂ t₁' ] t₂'
|
|
|
|
~-, : ∀ {n} {e₁ e₁' e₂ e₂' : Term n}
|
|
→ e₁ ~ e₁'
|
|
→ e₂ ~ e₂'
|
|
→ (e₁ `, e₂) ~ (e₁' `, e₂')
|
|
|
|
~-proj₁ : ∀ {n} {e e' : Term n}
|
|
→ e ~ e'
|
|
→ `proj₁ e ~ `proj₁ e'
|
|
|
|
~-proj₂ : ∀ {n} {e e' : Term n}
|
|
→ e ~ e'
|
|
→ `proj₂ e ~ `proj₂ e'
|
|
|
|
~-≡ : ∀ {n} {e₁ e₁' e₂ e₂' : Term n}
|
|
→ e₁ ~ e₁'
|
|
→ e₂ ~ e₂'
|
|
→ (e₁ `≡ e₂) ~ (e₁' `≡ e₂')
|
|
|
|
~-subst : ∀ {n} {t t' : Term (suc n)} {e₁ e₁' e₂ e₂' : Term n}
|
|
→ t ~ t'
|
|
→ e₁ ~ e₁'
|
|
→ e₂ ~ e₂'
|
|
→ `subst t e₁ e₂ ~ `subst t' e₁' e₂'
|
|
|
|
~-suc : ∀ {n} {k k' : Term n}
|
|
→ k ~ k'
|
|
→ `suc k ~ `suc k'
|
|
|
|
~-natrec : ∀ {n} {P P' z z' s s' t t' : Term n}
|
|
→ P ~ P'
|
|
→ z ~ z'
|
|
→ s ~ s'
|
|
→ t ~ t'
|
|
→ `natrec P z s t ~ `natrec P' z' s' t'
|