λ-calculus #
The λ-calculus with polymorphism and subtyping, with a locally nameless representation of syntax. This file defines opening, local closure, and substitution.
References #
- A. Chargueraud, The Locally Nameless Representation
- See also https://www.cis.upenn.edu/~plclub/popl08-tutorial/code/, from which this is adapted
Variable opening (type opening to type) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.openRec X δ Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.top = Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.top
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.openRec X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.bvar Y) = if X = Y then δ else Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.bvar Y
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.openRec X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.fvar X_1) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.fvar X_1
Instances For
Variable opening (type opening to type) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variable opening (type opening to type) of the closest binding.
Equations
Instances For
Variable opening (type opening to type) of the closest binding.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Locally closed types.
- top {Var : Type u_1} : Ty.top.LC
- var {Var : Type u_1} {X : Var} : (fvar X).LC
- arrow {Var : Type u_1} {σ τ : Ty Var} : σ.LC → τ.LC → (σ.arrow τ).LC
- all {Var : Type u_1} {σ τ : Ty Var} (L : Finset Var) : σ.LC → (∀ X ∉ L, (τ.open' (fvar X)).LC) → (σ.all τ).LC
- sum {Var : Type u_1} {σ τ : Ty Var} : σ.LC → τ.LC → (σ.sum τ).LC
Instances For
Type substitution.
Equations
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.top = Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.top
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.bvar Y) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.bvar Y
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.fvar X_1) = if X_1 = X then δ else Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.fvar X_1
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ (σ.arrow τ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ σ).arrow (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ τ)
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ (σ.all τ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ σ).all (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ τ)
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ (σ.sum τ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ σ).sum (Cslib.LambdaCalculus.LocallyNameless.Fsub.Ty.subst X δ τ)
Instances For
Equations
- One or more equations did not get rendered due to their size.
A locally closed type is unchanged by opening.
Opening to a type is equivalent to opening to a free variable and substituting.
Specialize Ty.openRec_subst_intro to the first opening.
Variable opening (term opening to type) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_1) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_1
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_1) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_1
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ t₁.inl = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ t₁).inl
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ t₂.inr = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_ty X δ t₂).inr
Instances For
Variable opening (term opening to type) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variable opening (term opening to type) of the closest binding.
Equations
Instances For
Variable opening (term opening to type) of the closest binding.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variable opening (term opening to term) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_2) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_2
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s (t₁.tapp σ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s t₁).tapp σ
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s t₁.inl = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s t₁).inl
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s t₂.inr = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.openRec_tm x s t₂).inr
Instances For
Variable opening (term opening to term) of the ith bound variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variable opening (term opening to term) of the closest binding.
Equations
Instances For
Variable opening (term opening to term) of the closest binding.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Locally closed terms.
- var {Var : Type u_1} {x : Var} : (fvar x).LC
- abs {Var : Type u_1} {t₁ : Term Var} {σ : Ty Var} (L : Finset Var) : σ.LC → (∀ x ∉ L, (t₁.open_tm (fvar x)).LC) → (Term.abs σ t₁).LC
- app {Var : Type u_1} {t₁ t₂ : Term Var} : t₁.LC → t₂.LC → (t₁.app t₂).LC
- tabs {Var : Type u_1} {t₁ : Term Var} {σ : Ty Var} (L : Finset Var) : σ.LC → (∀ X ∉ L, (t₁.open_ty (Ty.fvar X)).LC) → (Term.tabs σ t₁).LC
- tapp {Var : Type u_1} {t₁ : Term Var} {σ : Ty Var} : t₁.LC → σ.LC → (t₁.tapp σ).LC
- let' {Var : Type u_1} {t₁ t₂ : Term Var} (L : Finset Var) : t₁.LC → (∀ x ∉ L, (t₂.open_tm (fvar x)).LC) → (t₁.let' t₂).LC
- inl {Var : Type u_1} {t₁ : Term Var} : t₁.LC → t₁.inl.LC
- inr {Var : Type u_1} {t₁ : Term Var} : t₁.LC → t₁.inr.LC
- case {Var : Type u_1} {t₁ t₂ t₃ : Term Var} (L : Finset Var) : t₁.LC → (∀ x ∉ L, (t₂.open_tm (fvar x)).LC) → (∀ x ∉ L, (t₃.open_tm (fvar x)).LC) → (t₁.case t₂ t₃).LC
Instances For
An opening (term to type) appearing in both sides of an equality of terms can be removed.
Elimination of mixed term and type opening.
A locally closed term is unchanged by type opening.
Substitution of a type within a term.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_1) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_1
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_1) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.fvar x_1
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ (t₁.tapp σ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ t₁).tapp (σ[X:=δ])
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ t₁.inl = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ t₁).inl
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ t₂.inr = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_ty X δ t₂).inr
Instances For
Equations
- One or more equations did not get rendered due to their size.
Substitution of a locally closed type distributes with term opening to a type .
Specialize Term.open_ty_subst to free type variables.
Opening a term to a type is equivalent to opening to a free variable and substituting.
Specialize Term.openRec_ty_subst_ty_intro to the first opening.
Substitution of a term within a term.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_2) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.bvar x_2
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s (t₁.tapp σ) = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s t₁).tapp σ
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s t₁.inl = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s t₁).inl
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s t₂.inr = (Cslib.LambdaCalculus.LocallyNameless.Fsub.Term.subst_tm x s t₂).inr
Instances For
Equations
- One or more equations did not get rendered due to their size.
An opening (term to term) appearing in both sides of an equality of terms can be removed.
Elimination of mixed term and type opening.
A locally closed term is unchanged by term opening.
Substitution of a locally closed term distributes with term opening to a term.
Specialize Term.openRec_tm_subst_tm to free term variables.
Substitution of a locally closed type distributes with term opening to a term.
Substitution of a locally closed term distributes with term opening to a type.
Specialize Term.open_ty_subst_tm to free type variables.
Opening a term to a term is equivalent to opening to a free variable and substituting.
Specialize Term.openRec_tm_subst_tm_intro to the first opening.
Binding substitution of types.
Equations
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.subst X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.sub γ) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.sub (γ[X:=δ])
- Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.subst X δ (Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.ty γ) = Cslib.LambdaCalculus.LocallyNameless.Fsub.Binding.ty (γ[X:=δ])
Instances For
Equations
- One or more equations did not get rendered due to their size.