module univTypes.Specification.Conversion where open import univTypes.Specification.Syntax open import univTypes.Specification.Reduction open import univTypes.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