In this section we compute the action of substitutions.
Write ↑ⁿ
for the n
-fold weakening substitution {n+i/i}
.
Write σ:k
for σ.vₖ₋₁.….v₁.v₀
.
The substitution ↑ⁿ⁺ᵏ:k
,
i.e., {0/0,…,k-1/k-1, k+n/k,k+1+n/k+1,…}
,
arises by starting with ↑ⁿ
and traversing under k
binders:
for example, (ΠA. B)[↑¹] = ΠA[↑¹]. B[↑².v₀]
.
The substitution ↑ᵏ.e[↑ᵏ]:k
,
i.e., {0/0,…,k-1/k-1, e[↑ᵏ]/k, k/k+1,k+2/k+3,…}
,
arises by starting with id.e
and traversing under k
binders:
for example (ΠA. B)[id.e] = ΠA[id.e]. B[↑.e[↑].v₀]
.
The substitution id.e
is used in β
-reduction:
(λa) b ↝ a[id.b]
.
Evaluate ↑ⁿ⁺ᵏ:k
at a type expression.
Equations
- TyExpr.liftN n TyExpr.univ x = TyExpr.univ
- TyExpr.liftN n (TyExpr.el A) x = TyExpr.el (Expr.liftN n A x)
- TyExpr.liftN n (ty.pi body) x = (TyExpr.liftN n ty x).pi (TyExpr.liftN n body (x + 1))
Instances For
Evaluate ↑ⁿ⁺ᵏ:k
at an expression.
Equations
- Expr.liftN n (Expr.bvar i) x = Expr.bvar (liftVar n i x)
- Expr.liftN n (Expr.app B fn arg) x = Expr.app (TyExpr.liftN n B (x + 1)) (Expr.liftN n fn x) (Expr.liftN n arg x)
- Expr.liftN n (Expr.lam ty body) x = Expr.lam (TyExpr.liftN n ty x) (Expr.liftN n body (x + 1))
- Expr.liftN n (ty.pi body) x = (Expr.liftN n ty x).pi (Expr.liftN n body (x + 1))
Instances For
Evaluate ↑¹
at a type expression.
Equations
- a.lift = TyExpr.liftN 1 a
Instances For
Evaluate ↑ᵏ.e[↑ᵏ]:k
at a type expression.
Equations
- TyExpr.univ.inst x✝ x = TyExpr.univ
- (TyExpr.el a).inst x✝ x = TyExpr.el (a.inst x✝ x)
- (ty.pi body).inst x✝ x = (ty.inst x✝ x).pi (body.inst x✝ (x + 1))
Instances For
Evaluate ↑ᵏ.e[↑ᵏ]:k
at an expression.
Equations
Instances For
In this section we specify typing judgments of the type theory
as Prop
-valued relations.
- weak: ∀ {e : Expr} {A : TyExpr} {Γ : List TyExpr}, HasType Γ e A → HasType (A :: Γ) e.lift A.lift
- bvar: ∀ {A : TyExpr} {Γ : List TyExpr}, HasType (A :: Γ) (Expr.bvar 0) A.lift
- app: ∀ {A B : TyExpr} {f a : Expr} {Γ : List TyExpr}, IsType (A :: Γ) B → HasType Γ f (A.pi B) → HasType Γ a A → HasType Γ (Expr.app B f a) (B.inst a)
- lam: ∀ {A B : TyExpr} {e : Expr} {Γ : List TyExpr}, IsType Γ A → HasType (A :: Γ) e B → HasType Γ (Expr.lam A e) (A.pi B)
Instances For
Equations
- wU = CategoryTheory.CategoryStruct.comp (CategoryTheory.yoneda.map (CategoryTheory.Limits.terminal.from Γ)) CategoryTheory.NaturalModel.U
Instances For
CtxStack Γ
witnesses that the semantic context Γ
is built by successive context extension operations.
- nil: {Ctx : Type u} → [inst : CategoryTheory.SmallCategory Ctx] → [inst_1 : CategoryTheory.Limits.HasTerminal Ctx] → [M : CategoryTheory.NaturalModel Ctx] → CtxStack (⊤_ Ctx)
- cons: {Ctx : Type u} → [inst : CategoryTheory.SmallCategory Ctx] → [inst_1 : CategoryTheory.Limits.HasTerminal Ctx] → [M : CategoryTheory.NaturalModel Ctx] → {Γ : Ctx} → (A : CategoryTheory.yoneda.obj Γ ⟶ CategoryTheory.NaturalModel.Ty) → CtxStack Γ → CtxStack (CategoryTheory.NaturalModel.ext Γ A)
Instances For
Instances For
Instances For
Instances For
Equations
- Γ.typed A = { x : Γ.tm // CategoryTheory.CategoryStruct.comp x CategoryTheory.NaturalModel.tp = A }
Instances For
Equations
- Context.typed.cast h x = ⟨↑x, ⋯⟩
Instances For
Instances For
Equations
- Γ.cons A = ⟨CategoryTheory.NaturalModel.ext Γ.fst A, CtxStack.cons A Γ.snd⟩
Instances For
Equations
- Γ.weak A f = CategoryTheory.CategoryStruct.comp (CategoryTheory.yoneda.map (CategoryTheory.NaturalModel.disp Γ.fst A)) f
Instances For
Equations
- CtxStack.nil.var x = Part.none
- (CtxStack.cons A a).var 0 = pure (CategoryTheory.NaturalModel.var Γ_2 A)
- (CtxStack.cons A S).var n.succ = Context.weak ⟨Γ_2, S⟩ A <$> S.var n
Instances For
Equations
- Γ.var i = Γ.snd.var i
Instances For
Equations
- substCons σ e A eTy = CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.pullback.lift e σ eTy) ⋯.isoPullback.inv
Instances For
Equations
- substFst σ = CategoryTheory.CategoryStruct.comp σ (CategoryTheory.yoneda.map (CategoryTheory.NaturalModel.disp Δ A))
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- weakSubst' σ A e = CategoryTheory.CategoryStruct.comp (CategoryTheory.eqToHom ⋯) (weakSubst σ A)
Instances For
Equations
- Context.typed.subst σ x = ⟨CategoryTheory.CategoryStruct.comp σ ↑x, ⋯⟩
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- mkPi A B = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi
Instances For
Equations
- mkLam' A e = CategoryTheory.CategoryStruct.comp (mkP A e) CategoryTheory.NaturalModel.NaturalModelPi.lam
Instances For
Equations
- Context.subst A B a = CategoryTheory.CategoryStruct.comp (substCons (CategoryTheory.CategoryStruct.id (CategoryTheory.yoneda.obj Γ.fst)) (↑a) A ⋯) B
Instances For
Instances For
Instances For
Equations
- mkPApp'_aux A B f f_tp = mkP_equiv (⋯.isLimit.lift (CategoryTheory.Limits.PullbackCone.mk f (mkP A B) f_tp))
Instances For
Equations
- ⋯ = ⋯
Instances For
Equations
- mkPApp A B f = ⟨CategoryTheory.CategoryStruct.comp (CategoryTheory.eqToHom ⋯) (mkPApp'_aux A B ↑f ⋯).snd, ⋯⟩
Instances For
Equations
- mkApp A B f a = ⟨Context.subst A (↑(mkPApp A B f)) a, ⋯⟩
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- CtxStack.nil.size = 0
- (CtxStack.cons A S).size = S.size + 1
Instances For
Equations
- CtxStack.dropN 0 x x_1 = ⟨Γ, x⟩
- CtxStack.dropN n.succ (CtxStack.cons A a) h = CtxStack.dropN n a ⋯
Instances For
Equations
- CtxStack.dropN_disp 0 x x_1 = CategoryTheory.CategoryStruct.id Γ
- CtxStack.dropN_disp n.succ (CtxStack.cons A a) h = CategoryTheory.CategoryStruct.comp (CategoryTheory.NaturalModel.disp Γ_2 A) (CtxStack.dropN_disp n a ⋯)
Instances For
Equations
- CtxStack.extN x_2 = ⟨(CtxStack.dropN 0 x x_1).cons x_2, CategoryTheory.yoneda.map (CategoryTheory.NaturalModel.disp (CtxStack.dropN 0 x x_1).fst x_2)⟩
- CtxStack.extN X = match CtxStack.extN X with | ⟨Δ, wk⟩ => ⟨Δ.cons (CategoryTheory.CategoryStruct.comp wk A), weakSubst wk A⟩
Instances For
Equations
- Γ.tyN k = ((h : k ≤ Γ.snd.size) ×' (CtxStack.dropN k Γ.snd h).ty)
Instances For
Equations
- Context.tyN.up ⟨h, X⟩ = ⟨⋯, X⟩
Instances For
Equations
- Context.tyN.down ⟨h, X⟩ = ⟨⋯, X⟩
Instances For
Equations
- Γ.consN A = (CtxStack.extN A.snd).fst
Instances For
Equations
- Γ.dispN A = (CtxStack.extN A.snd).snd
Instances For
Equations
- toModelType e = (ofType Context.nil A).get ⋯