`Unit : Set and `tt : `Unit, both values and inert under renaming, substitution, reduction and level equality. Cases added throughout confluence, conversion, the level normaliser, substitution lemmas, subject reduction and progress (new head hUnit for canonical forms). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
336 lines
16 KiB
Agda
336 lines
16 KiB
Agda
module univTypes.SubjectReduction.ConversionProperties where
|
||
|
||
open import Data.Product renaming (_,_ to ⟨_,_⟩)
|
||
open import Data.Nat using (ℕ; zero; suc)
|
||
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym)
|
||
|
||
open import univTypes.SubjectReduction.Specification
|
||
open import univTypes.SubjectReduction.ConfluenceModulo using (confluence-modulo; ↪*→↪~*; ~→↪~*)
|
||
open import univTypes.SubjectReduction.LevelEqualityProperties using (~-ren; ~-sub)
|
||
open import univTypes.SubjectReduction.Composition using (swap-0↦-extᵣ-fusion; swap-0↦-extₛ-fusion)
|
||
open import Data.Fin using (Fin; zero; suc)
|
||
|
||
--------------------------------------------------------------------------------
|
||
|
||
-- Conversion is an equivalence relation
|
||
|
||
≈-refl : ∀ {s n} {e : Tm s n}
|
||
→ e ≈ e
|
||
≈-refl = mk-≈ _ ↪~*-refl ↪~*-refl
|
||
|
||
≈-sym : ∀ {s n} {e₁ e₂ : Tm s n}
|
||
→ e₁ ≈ e₂
|
||
→ e₂ ≈ e₁
|
||
≈-sym (mk-≈ x y z) = mk-≈ x z y
|
||
|
||
≈-trans : ∀ {s n} {e₁ e₂ e₃ : Tm s n}
|
||
→ e₁ ≈ e₂
|
||
→ e₂ ≈ e₃
|
||
→ e₁ ≈ e₃
|
||
≈-trans (mk-≈ x e₁↪~*x e₂↪~*x) (mk-≈ y e₂↪~*y e₃↪~*y) with confluence-modulo e₂↪~*x e₂↪~*y
|
||
... | ⟨ e' , ⟨ x↪~*e' , y↪~*e' ⟩ ⟩ = mk-≈ e' (↪~*-trans e₁↪~*x x↪~*e') (↪~*-trans e₃↪~*y y↪~*e')
|
||
|
||
----------------------------------------------------------------------------
|
||
|
||
-- Reduction and level equality imply conversion
|
||
|
||
↪→≈ : ∀ {s n} {e₁ e₂ : Tm s n}
|
||
→ e₁ ↪ e₂
|
||
→ e₁ ≈ e₂
|
||
↪→≈ e↪e' = mk-≈ _ (↪~*-step (↪~-↪ e↪e') ↪~*-refl) ↪~*-refl
|
||
|
||
↪*→≈ : ∀ {s n} {e₁ e₂ : Tm s n}
|
||
→ e₁ ↪* e₂
|
||
→ e₁ ≈ e₂
|
||
↪*→≈ e↪*e' = mk-≈ _ (↪*→↪~* e↪*e') ↪~*-refl
|
||
|
||
~→≈ : ∀ {s n} {e₁ e₂ : Tm s n}
|
||
→ e₁ ~ e₂
|
||
→ e₁ ≈ e₂
|
||
~→≈ p = mk-≈ _ (~→↪~* p) ↪~*-refl
|
||
|
||
≡→≈ : ∀ {s n} {e₁ e₂ : Tm s n}
|
||
→ e₁ ≡ e₂
|
||
→ e₁ ≈ e₂
|
||
≡→≈ refl = ≈-refl
|
||
|
||
--------------------------------------------------------------------------------
|
||
|
||
-- Congruence. Every function that preserves reduction steps and level
|
||
-- equality preserves reduction modulo level equality and conversion; this
|
||
-- covers the term constructors, renaming and substitution.
|
||
|
||
↪~*-map : ∀ {s s' m n} (f : Tm s m → Tm s' n)
|
||
→ (∀ {a b} → a ↪ b → f a ↪ f b)
|
||
→ (∀ {a b} → a ~ b → f a ~ f b)
|
||
→ ∀ {a b} → a ↪~* b → f a ↪~* f b
|
||
↪~*-map f ↪f ~f ↪~*-refl = ↪~*-refl
|
||
↪~*-map f ↪f ~f (↪~*-step (↪~-↪ r) rs) = ↪~*-step (↪~-↪ (↪f r)) (↪~*-map f ↪f ~f rs)
|
||
↪~*-map f ↪f ~f (↪~*-step (↪~-~ p) rs) = ↪~*-step (↪~-~ (~f p)) (↪~*-map f ↪f ~f rs)
|
||
|
||
≈-map : ∀ {s s' m n} (f : Tm s m → Tm s' n)
|
||
→ (∀ {a b} → a ↪ b → f a ↪ f b)
|
||
→ (∀ {a b} → a ~ b → f a ~ f b)
|
||
→ ∀ {a b} → a ≈ b → f a ≈ f b
|
||
≈-map f ↪f ~f (mk-≈ u a↪~*u b↪~*u) = mk-≈ (f u) (↪~*-map f ↪f ~f a↪~*u) (↪~*-map f ↪f ~f b↪~*u)
|
||
|
||
≈-λ : ∀ {n} {e e' : Term (suc n)} → e ≈ e' → `λ e ≈ `λ e'
|
||
≈-λ = ≈-map `λ_ ξ-λ ~-λ
|
||
|
||
≈-· : ∀ {n} {e₁ e₁' e₂ e₂' : Term n} → e₁ ≈ e₁' → e₂ ≈ e₂' → e₁ · e₂ ≈ e₁' · e₂'
|
||
≈-· p q = ≈-trans (≈-map (_· _) ξ-·₁ (λ r → ~-· r ~-refl) p) (≈-map (_ ·_) ξ-·₂ (~-· ~-refl) q)
|
||
|
||
≈-∀ : ∀ {n} {t₁ t₁' : Term n} {t₂ t₂'} → t₁ ≈ t₁' → t₂ ≈ t₂' → ∀[x⦂ t₁ ] t₂ ≈ ∀[x⦂ t₁' ] t₂'
|
||
≈-∀ p q = ≈-trans (≈-map (∀[x⦂_] _) ξ-∀₁ (λ r → ~-∀ r ~-refl) p) (≈-map (∀[x⦂ _ ]_) ξ-∀₂ (~-∀ ~-refl) q)
|
||
|
||
≈-∃ : ∀ {n} {t₁ t₁' : Term n} {t₂ t₂'} → t₁ ≈ t₁' → t₂ ≈ t₂' → ∃[x⦂ t₁ ] t₂ ≈ ∃[x⦂ t₁' ] t₂'
|
||
≈-∃ p q = ≈-trans (≈-map (∃[x⦂_] _) ξ-∃₁ (λ r → ~-∃ r ~-refl) p) (≈-map (∃[x⦂ _ ]_) ξ-∃₂ (~-∃ ~-refl) q)
|
||
|
||
≈-, : ∀ {n} {e₁ e₁' e₂ e₂' : Term n} → e₁ ≈ e₁' → e₂ ≈ e₂' → (e₁ `, e₂) ≈ (e₁' `, e₂')
|
||
≈-, p q = ≈-trans (≈-map (_`, _) ξ-,₁ (λ r → ~-, r ~-refl) p) (≈-map (_ `,_) ξ-,₂ (~-, ~-refl) q)
|
||
|
||
≈-≡ : ∀ {n} {e₁ e₁' e₂ e₂' : Term n} → e₁ ≈ e₁' → e₂ ≈ e₂' → (e₁ `≡ e₂) ≈ (e₁' `≡ e₂')
|
||
≈-≡ p q = ≈-trans (≈-map (_`≡ _) ξ-≡₁ (λ r → ~-≡ r ~-refl) p) (≈-map (_ `≡_) ξ-≡₂ (~-≡ ~-refl) q)
|
||
|
||
≈-proj₁ : ∀ {n} {e e' : Term n} → e ≈ e' → `proj₁ e ≈ `proj₁ e'
|
||
≈-proj₁ = ≈-map `proj₁ ξ-proj₁ ~-proj₁
|
||
|
||
≈-proj₂ : ∀ {n} {e e' : Term n} → e ≈ e' → `proj₂ e ≈ `proj₂ e'
|
||
≈-proj₂ = ≈-map `proj₂ ξ-proj₂ ~-proj₂
|
||
|
||
≈-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₂'
|
||
≈-subst p q r = ≈-trans (≈-map (λ x → `subst x _ _) ξ-subst₁ (λ r → ~-subst r ~-refl ~-refl) p)
|
||
(≈-trans (≈-map (λ x → `subst _ x _) ξ-subst₂ (λ r → ~-subst ~-refl r ~-refl) q)
|
||
(≈-map (λ x → `subst _ _ x) ξ-subst₃ (λ r → ~-subst ~-refl ~-refl r) r))
|
||
|
||
≈-Setn : ∀ {n} {l l' : Lvl n} → l ≈ l' → `Setn l ≈ `Setn l'
|
||
≈-Setn = ≈-map `Setn_ ξ-Setn ~-Setn
|
||
|
||
≈-lvl : ∀ {n} {l l' : Lvl n} → l ≈ l' → `lvl l ≈ `lvl l'
|
||
≈-lvl = ≈-map `lvl ξ-lvl ~-lvl
|
||
|
||
≈-latom : ∀ {n} {e e' : Term n} → e ≈ e' → `latom e ≈ `latom e'
|
||
≈-latom = ≈-map `latom ξ-latom ~-latom
|
||
|
||
≈-lsuc : ∀ {n} {l l' : Lvl n} → l ≈ l' → `lsuc l ≈ `lsuc l'
|
||
≈-lsuc = ≈-map `lsuc ξ-lsuc ~-lsuc
|
||
|
||
≈-⊔ : ∀ {n} {l₁ l₁' l₂ l₂' : Lvl n} → l₁ ≈ l₁' → l₂ ≈ l₂' → l₁ `⊔ l₂ ≈ l₁' `⊔ l₂'
|
||
≈-⊔ p q = ≈-trans (≈-map (_`⊔ _) ξ-⊔₁ (λ r → ~-⊔ r ~-refl) p) (≈-map (_ `⊔_) ξ-⊔₂ (~-⊔ ~-refl) q)
|
||
|
||
--------------------------------------------------------------------------------
|
||
-- "Substituting two convertible terms into another term, yields again convertible terms."
|
||
|
||
-- A substitution σ₁ is convertible to a σ₂, if each
|
||
-- term of σ₁ is convertible to the corresponding term of σ₂
|
||
_≈σ_ : ∀ {m n} (σ₁ σ₂ : Sub m n) → Set
|
||
σ₁ ≈σ σ₂ = ∀ x → σ₁ x ≈ σ₂ x
|
||
|
||
-- Renaming preserves reduction
|
||
|
||
β-λ₁ : ∀ {n} {e₁ : Term (suc n)} {e₂ : Term n}
|
||
→ (`λ e₁) · e₂ ↪ e₁ [ e₂ ] → Term (suc n)
|
||
β-λ₁ {e₁ = e₁} _ = e₁
|
||
|
||
β-λ₂ : ∀ {n} {e₁ : Term (suc n)} {e₂ : Term n}
|
||
→ (`λ e₁) · e₂ ↪ e₁ [ e₂ ] → Term n
|
||
β-λ₂ {e₂ = e₂} _ = e₂
|
||
|
||
↪-ren : ∀ {s m n} {e e' : Tm s m} (ρ : Ren m n)
|
||
→ e ↪ e'
|
||
→ ren ρ e ↪ ren ρ e'
|
||
-- HINT: can also be solved with eq chains instead of subst
|
||
↪-ren ρ x@β-λ rewrite sym (swap-0↦-extᵣ-fusion ρ (β-λ₂ x) (β-λ₁ x)) = β-λ
|
||
↪-ren ρ (ξ-λ x) = ξ-λ (↪-ren (extᵣ ρ) x)
|
||
↪-ren ρ (ξ-proj₁ x) = ξ-proj₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-proj₂ x) = ξ-proj₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-·₁ x) = ξ-·₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-·₂ x) = ξ-·₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-≡₁ x) = ξ-≡₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-≡₂ x) = ξ-≡₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-,₁ x) = ξ-,₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-,₂ x) = ξ-,₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-∀₁ x) = ξ-∀₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-∀₂ x) = ξ-∀₂ (↪-ren (extᵣ ρ) x)
|
||
↪-ren ρ β-proj₁ = β-proj₁
|
||
↪-ren ρ β-proj₂ = β-proj₂
|
||
↪-ren ρ β-subst = β-subst
|
||
↪-ren ρ (ξ-∃₁ x) = ξ-∃₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-∃₂ x) = ξ-∃₂ (↪-ren (extᵣ ρ) x)
|
||
↪-ren ρ (ξ-subst₁ x) = ξ-subst₁ (↪-ren (extᵣ ρ) x)
|
||
↪-ren ρ (ξ-subst₂ x) = ξ-subst₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-subst₃ x) = ξ-subst₃ (↪-ren ρ x)
|
||
-- New
|
||
↪-ren ρ β-latom = β-latom
|
||
↪-ren ρ (ξ-lvl x) = ξ-lvl (↪-ren ρ x)
|
||
↪-ren ρ (ξ-latom x) = ξ-latom (↪-ren ρ x)
|
||
↪-ren ρ (ξ-⊔₁ x) = ξ-⊔₁ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-⊔₂ x) = ξ-⊔₂ (↪-ren ρ x)
|
||
↪-ren ρ (ξ-lsuc x) = ξ-lsuc (↪-ren ρ x)
|
||
↪-ren ρ (ξ-Setn x) = ξ-Setn (↪-ren ρ x)
|
||
|
||
-- Renaming preserves convertibility
|
||
|
||
≈-ren : ∀ {s m n} {e e' : Tm s m} (ρ : Ren m n)
|
||
→ e ≈ e'
|
||
→ ren ρ e ≈ ren ρ e'
|
||
≈-ren ρ = ≈-map (ren ρ) (↪-ren ρ) (~-ren ρ)
|
||
|
||
-- Substitution preserves reduction
|
||
|
||
↪-sub : ∀ {s m n} {e e' : Tm s m} (σ : Sub m n)
|
||
→ e ↪ e'
|
||
→ sub σ e ↪ sub σ e'
|
||
-- HINT: can also be solved with eq chains instead of subst
|
||
↪-sub σ x@β-λ rewrite sym (swap-0↦-extₛ-fusion σ (β-λ₂ x) (β-λ₁ x)) = β-λ
|
||
↪-sub σ (ξ-λ x) = ξ-λ (↪-sub (extₛ σ) x)
|
||
↪-sub σ (ξ-·₁ x) = ξ-·₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-·₂ x) = ξ-·₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-,₁ x) = ξ-,₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-,₂ x) = ξ-,₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-∀₁ x) = ξ-∀₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-∀₂ x) = ξ-∀₂ (↪-sub (extₛ σ) x)
|
||
↪-sub σ (ξ-∃₁ x) = ξ-∃₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-∃₂ x) = ξ-∃₂ (↪-sub (extₛ σ) x)
|
||
↪-sub σ β-proj₁ = β-proj₁
|
||
↪-sub σ β-proj₂ = β-proj₂
|
||
↪-sub σ β-subst = β-subst
|
||
↪-sub σ (ξ-proj₁ x) = ξ-proj₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-proj₂ x) = ξ-proj₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-≡₁ x) = ξ-≡₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-≡₂ x) = ξ-≡₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-subst₁ x) = ξ-subst₁ (↪-sub (extₛ σ) x)
|
||
↪-sub σ (ξ-subst₂ x) = ξ-subst₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-subst₃ x) = ξ-subst₃ (↪-sub σ x)
|
||
-- New
|
||
↪-sub σ β-latom = β-latom
|
||
↪-sub σ (ξ-lvl x) = ξ-lvl (↪-sub σ x)
|
||
↪-sub σ (ξ-latom x) = ξ-latom (↪-sub σ x)
|
||
↪-sub σ (ξ-⊔₁ x) = ξ-⊔₁ (↪-sub σ x)
|
||
↪-sub σ (ξ-⊔₂ x) = ξ-⊔₂ (↪-sub σ x)
|
||
↪-sub σ (ξ-lsuc x) = ξ-lsuc (↪-sub σ x)
|
||
↪-sub σ (ξ-Setn x) = ξ-Setn (↪-sub σ x)
|
||
|
||
-- Substitution preserves convertibility
|
||
|
||
≈-sub : ∀ {s m n} {e e' : Tm s m} (σ : Sub m n)
|
||
→ e ≈ e'
|
||
→ sub σ e ≈ sub σ e'
|
||
≈-sub σ = ≈-map (sub σ) (↪-sub σ) (~-sub σ)
|
||
|
||
-- Substituting convertible terms
|
||
|
||
ext-≈σ : ∀ {m n} {σ σ' : Sub m n}
|
||
→ σ ≈σ σ'
|
||
→ extₛ σ ≈σ extₛ σ'
|
||
ext-≈σ ≈ₛ zero = ≈-refl
|
||
ext-≈σ ≈ₛ (suc x) = ≈-ren wk (≈ₛ x)
|
||
|
||
≈σ-sub : ∀ {s m n} {σ σ' : Sub m n} {e : Tm s m}
|
||
→ σ ≈σ σ'
|
||
→ sub σ e ≈ sub σ' e
|
||
≈σ-sub {e = ` x} p = p x
|
||
≈σ-sub {e = `λ e} p = ≈-λ (≈σ-sub {e = e} (ext-≈σ p))
|
||
≈σ-sub {e = l · r} p = ≈-· (≈σ-sub {e = l} p) (≈σ-sub {e = r} p)
|
||
≈σ-sub {e = ∀[x⦂ t₁ ] t₂} p = ≈-∀ (≈σ-sub {e = t₁} p) (≈σ-sub {e = t₂} (ext-≈σ p))
|
||
≈σ-sub {e = `Setω l} p = ≈-refl
|
||
≈σ-sub {e = `Setn l} p = ≈-Setn (≈σ-sub {e = l} p)
|
||
≈σ-sub {e = `Level} p = ≈-refl
|
||
≈σ-sub {e = `lvl l} p = ≈-lvl (≈σ-sub {e = l} p)
|
||
≈σ-sub {e = `latom e} p = ≈-latom (≈σ-sub {e = e} p)
|
||
≈σ-sub {e = `lzero} p = ≈-refl
|
||
≈σ-sub {e = `lsuc l} p = ≈-lsuc (≈σ-sub {e = l} p)
|
||
≈σ-sub {e = l `⊔ r} p = ≈-⊔ (≈σ-sub {e = l} p) (≈σ-sub {e = r} p)
|
||
≈σ-sub {e = ∃[x⦂ t₁ ] t₂} p = ≈-∃ (≈σ-sub {e = t₁} p) (≈σ-sub {e = t₂} (ext-≈σ p))
|
||
≈σ-sub {e = l `, r} p = ≈-, (≈σ-sub {e = l} p) (≈σ-sub {e = r} p)
|
||
≈σ-sub {e = `proj₁ e} p = ≈-proj₁ (≈σ-sub {e = e} p)
|
||
≈σ-sub {e = `proj₂ e} p = ≈-proj₂ (≈σ-sub {e = e} p)
|
||
≈σ-sub {e = l `≡ r} p = ≈-≡ (≈σ-sub {e = l} p) (≈σ-sub {e = r} p)
|
||
≈σ-sub {e = `refl} p = ≈-refl
|
||
≈σ-sub {e = `tt} p = ≈-refl
|
||
≈σ-sub {e = `Unit} p = ≈-refl
|
||
≈σ-sub {e = `subst t e₁ e₂} p = ≈-subst (≈σ-sub {e = t} (ext-≈σ p)) (≈σ-sub {e = e₁} p) (≈σ-sub {e = e₂} p)
|
||
|
||
≈→≈σ : ∀ {n} {e e' : Term n}
|
||
→ e ≈ e'
|
||
→ 0↦ e ≈σ 0↦ e'
|
||
≈→≈σ e≈e' zero = e≈e'
|
||
≈→≈σ e≈e' (suc x) = ≈-refl
|
||
|
||
≈σ-sub₁ : ∀ {s n} {e : Tm s (suc n)} {e₁ e₂ : Term n}
|
||
→ e₁ ≈ e₂
|
||
→ e [ e₁ ] ≈ e [ e₂ ]
|
||
≈σ-sub₁ {e = e} e₁≈e₂ = ≈σ-sub {e = e} (≈→≈σ e₁≈e₂)
|
||
|
||
≈σ-refl : ∀ {m n} {σ : Sub m n} →
|
||
σ ≈σ σ
|
||
≈σ-refl x = ≈-refl
|
||
|
||
--------------------------------------------------------------------------------
|
||
-- "Typing is preserved along convertible types in the context"
|
||
|
||
-- Two contexts Γ₁ and Γ₂ are convertible, if each type in Γ₁ is
|
||
-- convertible to the corresponding type in Γ₂.
|
||
|
||
_≈ᶜ_ : ∀ {n} → Context n → Context n → Set
|
||
Γ₁ ≈ᶜ Γ₂ = ∀ x → lookup Γ₁ x ≈ lookup Γ₂ x
|
||
|
||
≈ᶜ-refl : ∀ {n} {Γ : Context n}
|
||
→ Γ ≈ᶜ Γ
|
||
≈ᶜ-refl x = ≈-refl
|
||
|
||
≈-ext : ∀ {n} {Γ₁ Γ₂ : Context n} {t₁ t₂ : Term n}
|
||
→ Γ₁ ≈ᶜ Γ₂
|
||
→ t₁ ≈ t₂
|
||
→ (Γ₁ , t₁) ≈ᶜ (Γ₂ , t₂)
|
||
≈-ext Γ₁≈Γ₂ t₁≈t₂ zero = ≈-ren wk t₁≈t₂
|
||
≈-ext Γ₁≈Γ₂ t₁≈t₂ (suc x) = ≈-ren wk (Γ₁≈Γ₂ x)
|
||
|
||
≈-Γ-⊢ : ∀ {n} {Γ₁ Γ₂ : Context n} {e t : Term n}
|
||
→ Γ₁ ≈ᶜ Γ₂
|
||
→ Γ₁ ⊢ e ⦂ t
|
||
→ Γ₂ ⊢ e ⦂ t
|
||
|
||
≈-Γ-⊢ₗ : ∀ {n} {Γ₁ Γ₂ : Context n} {l : Lvl n}
|
||
→ Γ₁ ≈ᶜ Γ₂
|
||
→ Γ₁ ⊢ₗ l
|
||
→ Γ₂ ⊢ₗ l
|
||
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-` x refl) = ⊢-≈ (≈-sym (Γ₁≈Γ₂ x)) (⊢-` x refl)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-λ ⊢e₁ ⊢e₂) = ⊢-λ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-· ⊢l ⊢r) = ⊢-· (≈-Γ-⊢ Γ₁≈Γ₂ ⊢l) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢r)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∀ ⊢e₁ ⊢e₂) = ⊢-∀ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∀ω ⊢e₁ ⊢e₂) = ⊢-∀ω (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∀-dep ⊢e₁ ⊢e₂) = ⊢-∀-dep (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-≈ x ⊢e) = ⊢-≈ x (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∃ ⊢e₁ ⊢e₂) = ⊢-∃ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∃ω ⊢e₁ ⊢e₂) = ⊢-∃ω (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-∃-dep ⊢e₁ ⊢e₂) = ⊢-∃-dep (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e₁) (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) ⊢e₂)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-, ⊢l ⊢r) = ⊢-, (≈-Γ-⊢ Γ₁≈Γ₂ ⊢l) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢r)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-proj₁ ⊢e) = ⊢-proj₁ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-proj₂ ⊢e) = ⊢-proj₂ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-≡ ⊢t ⊢l ⊢r) = ⊢-≡ (≈-Γ-⊢ Γ₁≈Γ₂ ⊢t) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢l) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢r)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-refl ⊢e) = ⊢-refl (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-subst t'⊢t ⊢u₁ ⊢u₂ ⊢≡ ⊢t[u₁])
|
||
= ⊢-subst (≈-Γ-⊢ (≈-ext Γ₁≈Γ₂ ≈-refl) t'⊢t) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢u₁) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢u₂) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢≡) (≈-Γ-⊢ Γ₁≈Γ₂ ⊢t[u₁])
|
||
-- New
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-Setn ⊢l) = ⊢-Setn (≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢l)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ ⊢-Setω = ⊢-Setω
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-lvl ⊢l) = ⊢-lvl (≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢l)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ ⊢-Level = ⊢-Level
|
||
≈-Γ-⊢ Γ₁≈Γ₂ (⊢-Set<Setω ⊢A) = ⊢-Set<Setω (≈-Γ-⊢ Γ₁≈Γ₂ ⊢A)
|
||
≈-Γ-⊢ Γ₁≈Γ₂ ⊢-tt = ⊢-tt
|
||
≈-Γ-⊢ Γ₁≈Γ₂ ⊢-Unit = ⊢-Unit
|
||
|
||
≈-Γ-⊢ₗ Γ₁≈Γ₂ (⊢-latom ⊢e) = ⊢-latom (≈-Γ-⊢ Γ₁≈Γ₂ ⊢e)
|
||
≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢-lzero = ⊢-lzero
|
||
≈-Γ-⊢ₗ Γ₁≈Γ₂ (⊢-lsuc ⊢l) = ⊢-lsuc (≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢l)
|
||
≈-Γ-⊢ₗ Γ₁≈Γ₂ (⊢-⊔ ⊢l₁ ⊢l₂) = ⊢-⊔ (≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢l₁) (≈-Γ-⊢ₗ Γ₁≈Γ₂ ⊢l₂)
|
||
|
||
≈-Γ-⊢₁ : ∀ {n} {Γ : Context n} {t₁ t₂ : Term n} {e t : Term (suc n)}
|
||
→ t₁ ≈ t₂
|
||
→ Γ , t₁ ⊢ e ⦂ t
|
||
→ Γ , t₂ ⊢ e ⦂ t
|
||
≈-Γ-⊢₁ {Γ = Γ} t₁≈t₂ = ≈-Γ-⊢ (≈-ext (≈ᶜ-refl {Γ = Γ}) t₁≈t₂)
|