Simply typed lambda calculus

InductiveSimple types#✓fully proved

Given a type \(B\) of base types, the simple types over \(B\) are generated by two rules: every base type \(b \in B\) is a simple type, and for simple types \(A\) and \(C\) the function type \(A \Rightarrow C\) is a simple type.

inductive Ty (Base : Type u) where
  | base : Base → Ty Base
  | arr : Ty Base → Ty Base → Ty Base
  deriving DecidableEq, Repr
Used by 315
Used byClosure conversion with accessors · Correctness of closure conversion · Flat closure conversion · Correctness of flat closure conversion · Flat closure conversion preserves scoping · Converted terms are well scoped · Source evaluation is deterministic · Big-step semantics of the closure-conversion source · Free variables one binder deeper · Call-by-name CPS translation of terms · Computation types of the call-by-name CPS translation · Related computations in the call-by-name CPS translation · Denotational correctness of the call-by-name CPS translation · The call-by-name CPS translation at base types · Running the call-by-name CPS translation with the identity continuation · Related environments for the call-by-name CPS translation · Call-by-name evaluation is preserved by the CPS translation · The call-by-name CPS translation commutes with instantiation · Logical relation for the call-by-name CPS translation · The call-by-name CPS translation of a renaming · The call-by-name CPS translation commutes with renaming · Plotkin's simulation theorem for the call-by-name CPS translation · The call-by-name CPS translation commutes with substitution · Call-by-name CPS translation of types · The translation of a closed term is a value · Call-by-name CPS translation of variables · The call-by-name CPS translation commutes with weakening · CPS computation type · Call-by-value CPS translation of terms · Denotational correctness of the CPS translation (Meyer–Wand) · CPS translation at a base type · CPS translation at a base type with the identity continuation · The CPS translation commutes with instantiation by a value or variable · Translated renaming · The call-by-value CPS translation commutes with renaming · Plotkin's simulation theorem, big-step form · Simulation for terms evaluating to an abstraction · The CPS translation commutes with substitution of values and variables · Call-by-value CPS translation of types · CPS translation of variables · The CPS translation commutes with weakening · Related environments · Evaluation of an application depends on the function only through its results · A β-redex with a value argument evaluates as its contractum · The translation of an abstraction passes the translated function to its continuation · Call-by-name big-step evaluation · Administrative step of the call-by-name translation of an application · Instantiating a return to the continuation · Plotkin's value translation \(\Psi\) · Logical relation for the CPS translation · The value translation preserves values · Computational adequacy for PCF · Formal approximation relation · The least element approximates every term · Fundamental lemma of formal approximation · Formal approximation is closed under head expansion · Formal approximation is closed under suprema of chains · Composition of PCF contexts · Associativity of PCF context composition · Extending a PCF substitution by a term · One-hole contexts of PCF · Denotation of PCF terms · Soundness of the PCF denotational semantics · Fixed-point equation for the PCF denotation of fix · PCF denotation of instantiation · Equal denotations are preserved by plugging into PCF contexts · Plugging into a PCF context is monotone in the denotation · PCF denotation of a renamed term · PCF denotation of a substituted term · Weakening preserves the PCF denotation · Determinism of PCF big-step evaluation · Determinism of PCF call-by-name reduction · Domain of a PCF type · Closed values of ground type are numerals · Big-step call-by-name evaluation of PCF · Backward reduction preserves evaluation in PCF · Identity PCF substitution · Instantiating the newest variable of a PCF term · Instantiation after substitution under a binder · Lifting a PCF substitution under a binder · Variable lookup in a PCF environment · Natural number type of PCF · PCF values are normal forms · Injectivity of PCF numerals · PCF numerals are normal forms · Environment from a family of values · PCF values evaluate to themselves · Least elements of PCF domains · Plugging a term into a PCF context · Plugging into a composite PCF context · Renaming of PCF terms · Renaming a PCF term by the identity · Renaming after substitution in PCF · Single-variable substitution in PCF · Call-by-name reduction step of PCF · Big-step evaluation implies reduction in PCF · Parallel substitutions for PCF · Substitution in PCF terms · Substitution after renaming in PCF · Composition of PCF substitutions · PCF terms · PCF types · Values of PCF · PCF evaluation results are values · PCF variables · Weakening of PCF terms · Semantic equality is a congruence for application · Model-independent beta equality · Beta is sound for the denotational semantics · Composition of STLC contexts · Associativity of composition of STLC contexts · Extending a semantic environment in STLC · Model equality is a congruence for STLC contexts · Beta equality inside an STLC context · Eta equality inside an STLC context · Denotation of simple types · Denotation of an STLC term · One reduction step preserves STLC denotation · Multi-step reduction preserves STLC denotation · Big-step evaluation preserves STLC denotation · Denotation of an instantiated STLC body · Renaming lemma for STLC denotation · Denotation of an STLC substitution · Substitution lemma for STLC denotation · Weakening preserves STLC denotation · Semantic environments for the denotational semantics of STLC · Semantic equality is an equivalence relation · Model-independent eta equality · Eta is sound for the denotational semantics · Semantic equality is a congruence for lambda abstraction · Model equality of STLC terms · Single-step evaluation is a semantic equation · Multi-step evaluation is a semantic equation · Plugging a term into an STLC context · Plugging into a composite STLC context · Semantic equality is reflexive · Pointwise semantic equality of substitutions is reflexive · Renaming an environment · Renaming preserves semantic equality · Semantic equality is a congruence for typed contexts · Semantic equality of terms in a model · Pointwise semantic equality of substitutions · Substitution preserves semantic equality · Semantically equal substitutions give semantically equal results · Symmetry of semantic equality of terms · Symmetry of pointwise semantic equality of substitutions · Typed one-hole contexts · Transitivity of semantic equality of terms · Transitivity of pointwise semantic equality of substitutions · Embedding of raw STLC terms into the calculus with references · Typing is preserved by the embedding of raw STLC terms · Embedding of simple types into the calculus with references · Typing of embedded intrinsically typed STLC terms · Certified canonical terms · Extending a semantic environment by one variable · The identity environment under a binder · The identity semantic environment · The identity semantic environment realizes every environment · Canonical terms · Canonical terms have a unique normal form · Canonical terms are the fixed points of normalization · Normalized terms are canonical · Equal NbE normal forms imply model equality · Realization of environments · Evaluation into the Kripke semantic domain · Evaluation respects pointwise equal environments · Evaluating a neutral term reflects it · Fundamental lemma for NbE evaluation · Kripke realization relation for NbE · Normalization by evaluation · Normal forms are fixed points of normalization · Normalization of terms · NbE preserves denotation · Normalization by evaluation is idempotent · Every term is model-equal to its NbE normal form · Renormalizing a computed normal form · Every term is semantically equal to its NbE normal form in each model · Normalization fixes the terms of normal forms · Reflection commutes with renaming · Renaming a semantic value · Renaming a semantic environment · Renaming preserves canonical terms · Realization is stable under renaming · Kripke semantic values · Semantic environments for normalization by evaluation · Normal forms as canonical terms · The normal form of a canonical term · Erasing normal forms is injective · Termination is closed under backward evaluation · Reducibility is closed under backward evaluation · Left expansion preserves having the same result · Right expansion preserves having the same result · Application preserves having the same result · Evaluating the argument of a value function is a multi-step congruence · Multi-step evaluation is a congruence in function position · Closed functions evaluate to lambda abstractions · Extending a reducible substitution by a reducible term keeps it reducible · Substitutions on the empty context are reducible · Values reduce only to themselves · Termination is closed under forward evaluation · Reducibility is closed under forward evaluation · Fundamental theorem of the reducibility relation · Reducibility is invariant under evaluation · Normalization and termination coincide · No closed terms of base type · Uniqueness of normal forms · Normalizing closed terms · Normalization of closed terms · Evaluation preserves the result of a closed term · Values terminate · Tait reducibility for closed terms · Closed terms are reducible · Reducible substitutions · Reflexivity of having the same result · Closed terms with the same result · Having the same result is an equivalence relation · Evaluation to a value passes through every reduct · Symmetry of having the same result · Termination of closed terms · Reducible terms terminate · Termination of the call-by-value simply typed lambda calculus · Transitivity of having the same result · Uniqueness of the value reached by evaluation · Big-step evaluation is closed under backward reduction steps · Big-step evaluation is closed under backward multi-step reduction · Canonical forms for closed function values · Closed normal forms are exactly the values · Determinism of big-step evaluation in the simply typed lambda calculus · Small-step call-by-value reduction in STLC is deterministic · Big-step call-by-value evaluation in the simply typed lambda calculus · Closed simply typed terms have a big-step evaluation · Big-step evaluation is small-step evaluation to a value · Normal forms for call-by-value reduction in STLC · Small-step evaluation to a value implies big-step evaluation · Progress for closed STLC terms · Small-step call-by-value reduction in STLC · Multi-step call-by-value reduction in STLC · Termination in terms of big-step evaluation · Big-step evaluation implies small-step evaluation · Big-step evaluation produces values · Values of STLC · Values are irreducible · Values evaluate to themselves · Composition of simply typed substitutions · Composition of renamings of simply typed contexts · Right identity law for composition of substitutions · Composing a single substitution with a substitution · Extension of a simply typed substitution · Identity substitution (simply typed lambda calculus) · Identity renaming of a simply typed context · Instantiating a binder body (simply typed lambda calculus) · Instantiation is substitution by an extended identity · Instantiating a weakened term · Lifting a substitution under a binder (simply typed lambda calculus) · Lifting a renaming under a binder · Lifting followed by single substitution · Substitution induced by a renaming (simply typed lambda calculus) · Renamings of simply typed contexts · Renaming the images of a substitution · Renaming a simply typed term · Renaming commutes with instantiation · Lifting commutes with renaming substitution images · Renaming after substitution in the simply typed calculus · Renaming commutes with weakening for intrinsically typed STLC terms · Single-variable substitution (simply typed lambda calculus) · Simultaneous substitutions of simply typed contexts · Simultaneous substitution (simply typed lambda calculus) · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms · Lifted substitution commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Single substitution cancels weakening · Composition of substitutions for intrinsically typed STLC terms · Intrinsically typed terms of the simply typed lambda calculus · Typed de Bruijn variables of the simply typed lambda calculus · Weakening a simply typed term · Type checking for raw STLC terms · Checked terms · Agreement of renamings is preserved by composition · Elaboration of raw STLC terms · Completeness of elaboration · Elaboration inverts erasure · Elaboration preserves the input syntax · Soundness of elaboration · Erasure of intrinsically typed terms · Erasure preserves typing · Erasure is injective · Erasure commutes with renaming · Erasure of a weakened term · Free indices of a raw term · Declarative typing of raw terms · Declarative typing agrees with elaboration · Indices occurring in a raw term · Type inference for raw terms · Type inference is sound and complete · Agreement of renamings is preserved by lifting · Variable lookup · Lookup returns a variable with the queried index · Lookup recovers an intrinsic variable from its index · Normalization of raw terms · Raw normalization of an erased term · Raw normalization produces well-typed terms · Raw normalization is idempotent · Raw normalization reports the inferred type · Raw lambda terms · Agreement of a typed and a numerical renaming · Renaming of raw terms · Composition of renamings of raw terms · Agreeing numerical renamings coincide on erased terms · Shifting raw terms · Size of a raw term · Renaming preserves the size of a raw term · Shifting preserves the size of a raw term · Index of a typed variable · Uniqueness of types for raw terms

InductiveTyped de Bruijn variables of the simply typed lambda calculus#✓fully proved

For a context \(\Gamma\) (a list of simple types) and a simple type \(A\), the variables of type \(A\) in \(\Gamma\) are generated by two rules: the variable \(0\) is a variable of type \(A\) in the context \(A :: \Gamma\) obtained by prepending \(A\) to \(\Gamma\), and if \(x\) is a variable of type \(A\) in \(\Gamma\), then for every simple type \(B\) the successor of \(x\) is a variable of type \(A\) in \(B :: \Gamma\).

inductive Var {Base : Type u} : List (Ty Base) → Ty Base → Type u where
  | zero {A : Ty Base} {Γ : List (Ty Base)} : Var (A :: Γ) A
  | succ {A B : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Var (B :: Γ) A
Uses 1 · Used by 154
Statement usesSimple types
Used byCall-by-name CPS translation of terms · Denotational correctness of the call-by-name CPS translation · Related environments for the call-by-name CPS translation · Call-by-name evaluation is preserved by the CPS translation · The call-by-name CPS translation commutes with instantiation · The call-by-name CPS translation of a renaming · The call-by-name CPS translation commutes with renaming · The call-by-name CPS translation commutes with substitution · The translation of a closed term is a value · Call-by-name CPS translation of variables · The call-by-name CPS translation commutes with weakening · Call-by-value CPS translation of terms · Denotational correctness of the CPS translation (Meyer–Wand) · The CPS translation commutes with instantiation by a value or variable · Translated renaming · The call-by-value CPS translation commutes with renaming · Plotkin's simulation theorem, big-step form · Simulation for terms evaluating to an abstraction · The CPS translation commutes with substitution of values and variables · CPS translation of variables · The CPS translation commutes with weakening · Related environments · Evaluation of an application depends on the function only through its results · A β-redex with a value argument evaluates as its contractum · The translation of an abstraction passes the translated function to its continuation · Administrative step of the call-by-name translation of an application · Instantiating a return to the continuation · Plotkin's value translation \(\Psi\) · The value translation preserves values · Computational adequacy for PCF · Fundamental lemma of formal approximation · Extending a PCF substitution by a term · PCF denotation of instantiation · PCF denotation of a renamed term · PCF denotation of a substituted term · Weakening preserves the PCF denotation · Instantiation after substitution under a binder · Lifting a PCF substitution under a binder · Variable lookup in a PCF environment · Environment from a family of values · Renaming a PCF term by the identity · Renaming after substitution in PCF · Single-variable substitution in PCF · Substitution after renaming in PCF · Composition of PCF substitutions · PCF variables · Weakening of PCF terms · Extending a semantic environment in STLC · Eta equality inside an STLC context · Denotation of an STLC term · Denotation of an instantiated STLC body · Renaming lemma for STLC denotation · Denotation of an STLC substitution · Substitution lemma for STLC denotation · Weakening preserves STLC denotation · Semantic environments for the denotational semantics of STLC · Model-independent eta equality · Eta is sound for the denotational semantics · Pointwise semantic equality of substitutions is reflexive · Renaming an environment · Pointwise semantic equality of substitutions · Semantically equal substitutions give semantically equal results · Symmetry of pointwise semantic equality of substitutions · Transitivity of pointwise semantic equality of substitutions · Typing is preserved by the embedding of raw STLC terms · Extending a semantic environment by one variable · The identity environment under a binder · The identity semantic environment · The identity semantic environment realizes every environment · Canonical terms · Canonical terms have a unique normal form · Canonical terms are the fixed points of normalization · Realization of environments · Evaluation into the Kripke semantic domain · Evaluation respects pointwise equal environments · Evaluating a neutral term reflects it · Fundamental lemma for NbE evaluation · Kripke realization relation for NbE · Normalization by evaluation · Normal forms are fixed points of normalization · Normalization of terms · NbE preserves denotation · Renormalizing a computed normal form · Normalization fixes the terms of normal forms · Reflection commutes with renaming · Renaming a semantic value · Renaming a semantic environment · Renaming preserves canonical terms · Realization is stable under renaming · Kripke semantic values · Semantic environments for normalization by evaluation · Normal forms as canonical terms · Erasing normal forms is injective · Extending a reducible substitution by a reducible term keeps it reducible · Substitutions on the empty context are reducible · Fundamental theorem of the reducibility relation · Closed terms are reducible · Reducible substitutions · Big-step evaluation is closed under backward reduction steps · Small-step call-by-value reduction in STLC is deterministic · Progress for closed STLC terms · Values are irreducible · Composition of simply typed substitutions · Composition of renamings of simply typed contexts · Right identity law for composition of substitutions · Composing a single substitution with a substitution · Extension of a simply typed substitution · Identity substitution (simply typed lambda calculus) · Identity renaming of a simply typed context · Instantiation is substitution by an extended identity · Lifting a substitution under a binder (simply typed lambda calculus) · Lifting a renaming under a binder · Lifting followed by single substitution · Substitution induced by a renaming (simply typed lambda calculus) · Renamings of simply typed contexts · Renaming the images of a substitution · Renaming a simply typed term · Renaming commutes with instantiation · Lifting commutes with renaming substitution images · Renaming after substitution in the simply typed calculus · Renaming commutes with weakening for intrinsically typed STLC terms · Single-variable substitution (simply typed lambda calculus) · Simultaneous substitutions of simply typed contexts · Simultaneous substitution (simply typed lambda calculus) · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms · Lifted substitution commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Single substitution cancels weakening · Composition of substitutions for intrinsically typed STLC terms · Intrinsically typed terms of the simply typed lambda calculus · Weakening a simply typed term · Agreement of renamings is preserved by composition · Elaboration of raw STLC terms · Completeness of elaboration · Elaboration inverts erasure · Elaboration preserves the input syntax · Soundness of elaboration · Erasure of intrinsically typed terms · Erasure preserves typing · Erasure commutes with renaming · Erasure of a weakened term · Declarative typing of raw terms · Agreement of renamings is preserved by lifting · Variable lookup · Lookup returns a variable with the queried index · Lookup recovers an intrinsic variable from its index · Raw normalization of an erased term · Raw normalization produces well-typed terms · Raw normalization is idempotent · Raw normalization reports the inferred type · Agreement of a typed and a numerical renaming · Index of a typed variable · Uniqueness of types for raw terms

InductiveIntrinsically typed terms of the simply typed lambda calculus#✓fully proved

Let \(A\) and \(B\) range over simple types and \(\Gamma\) over contexts (lists of simple types); write \(A \Rightarrow B\) for the function type from \(A\) to \(B\) and \(A :: \Gamma\) for the context obtained by prepending \(A\) to \(\Gamma\). The terms of type \(A\) in context \(\Gamma\) are generated by three rules: every variable of type \(A\) in \(\Gamma\) is a term of type \(A\) in context \(\Gamma\); if \(f\) is a term of type \(A \Rightarrow B\) and \(a\) is a term of type \(A\), both in context \(\Gamma\), then the application \(f\,a\) is a term of type \(B\) in context \(\Gamma\); and if \(t\) is a term of type \(B\) in the context \(A :: \Gamma\), then the abstraction \(\lambda t\) is a term of type \(A \Rightarrow B\) in context \(\Gamma\).

inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
  | var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
  | app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
  | lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
Uses 2 · Used by 188
Used byCall-by-name CPS translation of terms · Denotational correctness of the call-by-name CPS translation · The call-by-name CPS translation at base types · Running the call-by-name CPS translation with the identity continuation · Call-by-name evaluation is preserved by the CPS translation · The call-by-name CPS translation commutes with instantiation · The call-by-name CPS translation commutes with renaming · Plotkin's simulation theorem for the call-by-name CPS translation · The call-by-name CPS translation commutes with substitution · The translation of a closed term is a value · The call-by-name CPS translation commutes with weakening · Call-by-value CPS translation of terms · Denotational correctness of the CPS translation (Meyer–Wand) · CPS translation at a base type · CPS translation at a base type with the identity continuation · The CPS translation commutes with instantiation by a value or variable · The call-by-value CPS translation commutes with renaming · Plotkin's simulation theorem, big-step form · Simulation for terms evaluating to an abstraction · The CPS translation commutes with substitution of values and variables · The CPS translation commutes with weakening · Evaluation of an application depends on the function only through its results · A β-redex with a value argument evaluates as its contractum · The translation of an abstraction passes the translated function to its continuation · Call-by-name big-step evaluation · Administrative step of the call-by-name translation of an application · Instantiating a return to the continuation · Plotkin's value translation \(\Psi\) · The value translation preserves values · Semantic equality is a congruence for application · Model-independent beta equality · Beta is sound for the denotational semantics · Composition of STLC contexts · Associativity of composition of STLC contexts · Model equality is a congruence for STLC contexts · Beta equality inside an STLC context · Eta equality inside an STLC context · Denotation of an STLC term · One reduction step preserves STLC denotation · Multi-step reduction preserves STLC denotation · Big-step evaluation preserves STLC denotation · Denotation of an instantiated STLC body · Renaming lemma for STLC denotation · Substitution lemma for STLC denotation · Weakening preserves STLC denotation · Semantic equality is an equivalence relation · Model-independent eta equality · Eta is sound for the denotational semantics · Semantic equality is a congruence for lambda abstraction · Model equality of STLC terms · Single-step evaluation is a semantic equation · Multi-step evaluation is a semantic equation · Plugging a term into an STLC context · Plugging into a composite STLC context · Semantic equality is reflexive · Renaming preserves semantic equality · Semantic equality is a congruence for typed contexts · Semantic equality of terms in a model · Substitution preserves semantic equality · Semantically equal substitutions give semantically equal results · Symmetry of semantic equality of terms · Typed one-hole contexts · Transitivity of semantic equality of terms · Typing of embedded intrinsically typed STLC terms · Certified canonical terms · The identity semantic environment realizes every environment · Canonical terms · Canonical terms have a unique normal form · Canonical terms are the fixed points of normalization · Normalized terms are canonical · Equal NbE normal forms imply model equality · Evaluation into the Kripke semantic domain · Evaluation respects pointwise equal environments · Evaluating a neutral term reflects it · Fundamental lemma for NbE evaluation · Kripke realization relation for NbE · Normalization by evaluation · Normal forms are fixed points of normalization · Normalization of terms · NbE preserves denotation · Normalization by evaluation is idempotent · Every term is model-equal to its NbE normal form · Renormalizing a computed normal form · Every term is semantically equal to its NbE normal form in each model · Normalization fixes the terms of normal forms · Renaming preserves canonical terms · Realization is stable under renaming · Normal forms as canonical terms · The normal form of a canonical term · Erasing normal forms is injective · Termination is closed under backward evaluation · Reducibility is closed under backward evaluation · Left expansion preserves having the same result · Right expansion preserves having the same result · Application preserves having the same result · Evaluating the argument of a value function is a multi-step congruence · Multi-step evaluation is a congruence in function position · Closed functions evaluate to lambda abstractions · Extending a reducible substitution by a reducible term keeps it reducible · Values reduce only to themselves · Termination is closed under forward evaluation · Reducibility is closed under forward evaluation · Fundamental theorem of the reducibility relation · Reducibility is invariant under evaluation · Normalization and termination coincide · No closed terms of base type · Uniqueness of normal forms · Normalizing closed terms · Normalization of closed terms · Evaluation preserves the result of a closed term · Values terminate · Tait reducibility for closed terms · Closed terms are reducible · Reflexivity of having the same result · Closed terms with the same result · Having the same result is an equivalence relation · Evaluation to a value passes through every reduct · Symmetry of having the same result · Termination of closed terms · Reducible terms terminate · Termination of the call-by-value simply typed lambda calculus · Transitivity of having the same result · Uniqueness of the value reached by evaluation · Big-step evaluation is closed under backward reduction steps · Big-step evaluation is closed under backward multi-step reduction · Canonical forms for closed function values · Closed normal forms are exactly the values · Determinism of big-step evaluation in the simply typed lambda calculus · Small-step call-by-value reduction in STLC is deterministic · Big-step call-by-value evaluation in the simply typed lambda calculus · Closed simply typed terms have a big-step evaluation · Big-step evaluation is small-step evaluation to a value · Normal forms for call-by-value reduction in STLC · Small-step evaluation to a value implies big-step evaluation · Progress for closed STLC terms · Small-step call-by-value reduction in STLC · Multi-step call-by-value reduction in STLC · Termination in terms of big-step evaluation · Big-step evaluation implies small-step evaluation · Big-step evaluation produces values · Values of STLC · Values are irreducible · Values evaluate to themselves · Right identity law for composition of substitutions · Composing a single substitution with a substitution · Extension of a simply typed substitution · Identity substitution (simply typed lambda calculus) · Instantiating a binder body (simply typed lambda calculus) · Instantiation is substitution by an extended identity · Instantiating a weakened term · Lifting a substitution under a binder (simply typed lambda calculus) · Lifting followed by single substitution · Substitution induced by a renaming (simply typed lambda calculus) · Renaming a simply typed term · Renaming commutes with instantiation · Lifting commutes with renaming substitution images · Renaming after substitution in the simply typed calculus · Renaming commutes with weakening for intrinsically typed STLC terms · Single-variable substitution (simply typed lambda calculus) · Simultaneous substitutions of simply typed contexts · Simultaneous substitution (simply typed lambda calculus) · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms · Lifted substitution commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Single substitution cancels weakening · Composition of substitutions for intrinsically typed STLC terms · Weakening a simply typed term · Checked terms · Elaboration of raw STLC terms · Completeness of elaboration · Elaboration inverts erasure · Elaboration preserves the input syntax · Soundness of elaboration · Erasure of intrinsically typed terms · Erasure preserves typing · Erasure is injective · Erasure commutes with renaming · Erasure of a weakened term · Declarative typing agrees with elaboration · Type inference for raw terms · Type inference is sound and complete · Normalization of raw terms · Raw normalization of an erased term · Raw normalization produces well-typed terms · Raw normalization is idempotent · Raw normalization reports the inferred type · Agreeing numerical renamings coincide on erased terms

AbbreviationRenamings of simply typed contexts#✓fully proved

For contexts \(\Gamma\) and \(\Delta\) (lists of simple types), a renaming from \(\Gamma\) to \(\Delta\) assigns to every simple type \(A\) and every variable of type \(A\) in \(\Gamma\) a variable of type \(A\) in \(\Delta\).

abbrev Ren {Base : Type u} (Γ Δ : List (Ty Base)) := ∀ {A}, Var Γ A → Var Δ A
Uses 2 · Used by 44
Used byThe call-by-name CPS translation of a renaming · The call-by-name CPS translation commutes with renaming · The call-by-name CPS translation commutes with weakening · Translated renaming · The call-by-value CPS translation commutes with renaming · The CPS translation commutes with substitution of values and variables · The CPS translation commutes with weakening · PCF renamings · Renaming lemma for STLC denotation · Renaming an environment · Renaming preserves semantic equality · The identity environment under a binder · The identity semantic environment · The identity semantic environment realizes every environment · Evaluation into the Kripke semantic domain · Evaluation respects pointwise equal environments · Evaluating a neutral term reflects it · Fundamental lemma for NbE evaluation · Kripke realization relation for NbE · Normalization by evaluation · Normal forms are fixed points of normalization · NbE preserves denotation · Reflection commutes with renaming · Renaming a semantic value · Renaming a semantic environment · Renaming preserves canonical terms · Realization is stable under renaming · Kripke semantic values · Composition of renamings of simply typed contexts · Identity renaming of a simply typed context · Lifting a renaming under a binder · Substitution induced by a renaming (simply typed lambda calculus) · Renaming the images of a substitution · Renaming a simply typed term · Renaming commutes with instantiation · Lifting commutes with renaming substitution images · Renaming after substitution in the simply typed calculus · Renaming commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Agreement of renamings is preserved by composition · Erasure commutes with renaming · Agreement of renamings is preserved by lifting · Agreement of a typed and a numerical renaming · Agreeing numerical renamings coincide on erased terms

AbbreviationSimultaneous substitutions of simply typed contexts#✓fully proved

For contexts \(\Gamma\) and \(\Delta\) (lists of simple types), a substitution from \(\Gamma\) to \(\Delta\) assigns to every simple type \(A\) and every variable of type \(A\) in \(\Gamma\) a term of type \(A\) in context \(\Delta\).

abbrev Sub {Base : Type u} (Γ Δ : List (Ty Base)) := ∀ {A}, Var Γ A → Tm Δ A
Uses 3 · Used by 36
Used byThe call-by-name CPS translation commutes with substitution · The CPS translation commutes with substitution of values and variables · Denotation of an STLC substitution · Substitution lemma for STLC denotation · Pointwise semantic equality of substitutions is reflexive · Pointwise semantic equality of substitutions · Substitution preserves semantic equality · Semantically equal substitutions give semantically equal results · Symmetry of pointwise semantic equality of substitutions · Transitivity of pointwise semantic equality of substitutions · Extending a reducible substitution by a reducible term keeps it reducible · Substitutions on the empty context are reducible · Fundamental theorem of the reducibility relation · Closed terms are reducible · Reducible substitutions · Composition of simply typed substitutions · Right identity law for composition of substitutions · Composing a single substitution with a substitution · Extension of a simply typed substitution · Identity substitution (simply typed lambda calculus) · Instantiation is substitution by an extended identity · Lifting a substitution under a binder (simply typed lambda calculus) · Lifting followed by single substitution · Substitution induced by a renaming (simply typed lambda calculus) · Renaming the images of a substitution · Renaming commutes with instantiation · Lifting commutes with renaming substitution images · Renaming after substitution in the simply typed calculus · Single-variable substitution (simply typed lambda calculus) · Simultaneous substitution (simply typed lambda calculus) · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms · Lifted substitution commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Single substitution cancels weakening · Composition of substitutions for intrinsically typed STLC terms

DefinitionIdentity renaming of a simply typed context#✓fully proved

For every context \(\Gamma\), the identity renaming from \(\Gamma\) to \(\Gamma\) sends each variable to itself.

def id : Ren Γ Γ := fun x ↦ x
Uses 3 · Used by 9

DefinitionComposition of renamings of simply typed contexts#✓fully proved

For contexts \(\Gamma\), \(\Delta\) and \(\Xi\), a renaming \(\rho\) from \(\Gamma\) to \(\Delta\) and a renaming \(\sigma\) from \(\Delta\) to \(\Xi\), the composite of \(\rho\) followed by \(\sigma\) is the renaming from \(\Gamma\) to \(\Xi\) that sends each variable \(x\) to \(\sigma(\rho(x))\).

def comp (ρ : Ren Γ Δ) (σ : Ren Δ Ξ) : Ren Γ Ξ := fun x ↦ σ (ρ x)
Uses 3 · Used by 5

DefinitionLifting a renaming under a binder#✓fully proved

Let \(\rho\) be a renaming from a context \(\Gamma\) to a context \(\Delta\) and let \(A\) be a simple type, and write \(A :: \Gamma\) for the context obtained by prepending \(A\) to \(\Gamma\). The lift of \(\rho\) is the renaming from \(A :: \Gamma\) to \(A :: \Delta\) that sends the variable \(0\) to \(0\) and sends the successor of a variable \(x\) of \(\Gamma\) to the successor of \(\rho(x)\).

def lift (ρ : Ren Γ Δ) : Ren (A :: Γ) (A :: Δ)
  | _, .zero => .zero
  | _, .succ x => .succ (ρ x)
Uses 3 · Used by 30

DefinitionRenaming a simply typed term#✓fully proved

For a renaming \(\rho\) from a context \(\Gamma\) to a context \(\Delta\), the renaming \(t[\rho]\) of a term \(t\) of type \(A\) in context \(\Gamma\) is the term of type \(A\) in context \(\Delta\) defined by recursion on \(t\): \(x[\rho] = \rho(x)\) for a variable \(x\), \((f\,a)[\rho] = f[\rho]\,a[\rho]\) for an application, and \((\lambda s)[\rho] = \lambda (s[\rho^{\uparrow}])\) for an abstraction, where \(\rho^{\uparrow}\) is the lift of \(\rho\) under one binder.

def rename : {Γ Δ : List (Ty Base)} → Ren Γ Δ → {A : Ty Base} → Tm Γ A → Tm Δ A
  | _, _, ρ, _, .var x => .var (ρ x)
  | _, _, ρ, _, .app f a => .app (rename ρ f) (rename ρ a)
  | _, _, ρ, _, .lam body => .lam (rename (Var.lift ρ) body)
Uses 5 · Used by 23

DefinitionWeakening a simply typed term#✓fully proved

For a term \(t\) of type \(A\) in a context \(\Gamma\) and a simple type \(B\), write \(B :: \Gamma\) for the context obtained by prepending \(B\) to \(\Gamma\). The weakening of \(t\) is the term of type \(A\) in the context \(B :: \Gamma\) obtained by renaming \(t\) along the renaming that sends each variable of \(\Gamma\) to its successor in \(B :: \Gamma\).

def weaken (t : Tm Γ A) : Tm (B :: Γ) A := rename .succ t
Uses 4 · Used by 36
Used byCall-by-name CPS translation of terms · Denotational correctness of the call-by-name CPS translation · Call-by-name evaluation is preserved by the CPS translation · The call-by-name CPS translation commutes with renaming · The call-by-name CPS translation commutes with substitution · The translation of a closed term is a value · The call-by-name CPS translation commutes with weakening · Call-by-value CPS translation of terms · Denotational correctness of the CPS translation (Meyer–Wand) · The call-by-value CPS translation commutes with renaming · Plotkin's simulation theorem, big-step form · The CPS translation commutes with substitution of values and variables · The CPS translation commutes with weakening · The translation of an abstraction passes the translated function to its continuation · Administrative step of the call-by-name translation of an application · Instantiating a return to the continuation · Eta equality inside an STLC context · Weakening preserves STLC denotation · Model-independent eta equality · Eta is sound for the denotational semantics · Closed terms are reducible · Right identity law for composition of substitutions · Instantiation is substitution by an extended identity · Instantiating a weakened term · Lifting a substitution under a binder (simply typed lambda calculus) · Lifting followed by single substitution · Renaming commutes with instantiation · Renaming after substitution in the simply typed calculus · Renaming commutes with weakening for intrinsically typed STLC terms · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms · Lifted substitution commutes with weakening for intrinsically typed STLC terms · Renaming then substituting an intrinsically typed STLC term · Single substitution cancels weakening · Composition of substitutions for intrinsically typed STLC terms · Erasure of a weakened term

DefinitionIdentity substitution (simply typed lambda calculus)#✓fully proved

For a context \(\Gamma\), the identity substitution from \(\Gamma\) to \(\Gamma\) sends each variable of \(\Gamma\) to the term consisting of that variable alone.

def id : Sub Γ Γ := fun x ↦ .var x
Uses 4 · Used by 5

DefinitionSubstitution induced by a renaming (simply typed lambda calculus)#✓fully proved

For contexts \(\Gamma\) and \(\Delta\) and a type-preserving renaming \(\rho\) from \(\Gamma\) to \(\Delta\), the induced substitution from \(\Gamma\) to \(\Delta\) sends each variable \(x\) of \(\Gamma\) to the term consisting of the variable \(\rho(x)\) alone.

def ofRen (ρ : Ren Γ Δ) : Sub Γ Δ := fun x ↦ .var (ρ x)
Uses 5

DefinitionLifting a substitution under a binder (simply typed lambda calculus)#✓fully proved

Write \(A :: \Gamma\) for the context \(\Gamma\) extended by a newest variable of type \(A\). Given a substitution \(\sigma\) from a context \(\Gamma\) to a context \(\Delta\) and a type \(A\), its lift is the substitution from \(A :: \Gamma\) to \(A :: \Delta\) that sends the newest variable to the term consisting of the newest variable alone, and sends the successor of each variable \(x\) of \(\Gamma\) to the weakening of the term \(\sigma(x)\) into the context \(A :: \Delta\).

def lift (σ : Sub Γ Δ) : Sub (A :: Γ) (A :: Δ)
  | _, .zero => .var .zero
  | _, .succ x => Tm.weaken (σ x)
Uses 5 · Used by 20

DefinitionSingle-variable substitution (simply typed lambda calculus)#✓fully proved

Write \(A :: \Gamma\) for the context \(\Gamma\) extended by a newest variable of type \(A\). Given a term \(a\) of type \(A\) in context \(\Gamma\), the single-variable substitution for \(a\) is the substitution from \(A :: \Gamma\) to \(\Gamma\) that sends the newest variable to \(a\) and sends the successor of each variable \(x\) of \(\Gamma\) to the term consisting of the variable \(x\) alone.

def single (a : Tm Γ A) : Sub (A :: Γ) Γ
  | _, .zero => a
  | _, .succ x => .var x
Uses 4 · Used by 15

DefinitionSimultaneous substitution (simply typed lambda calculus)#✓fully proved

Given a substitution \(\sigma\) from a context \(\Gamma\) to a context \(\Delta\), the result \(t[\sigma]\) of applying \(\sigma\) to a term \(t\) of type \(A\) in context \(\Gamma\) is the term of type \(A\) in context \(\Delta\) defined by recursion on \(t\): \(x[\sigma] = \sigma(x)\) for a variable \(x\), \((f\,a)[\sigma] = f[\sigma]\,a[\sigma]\) for an application, and \((\lambda u)[\sigma] = \lambda\,(u[\sigma'])\) for an abstraction with body \(u\), where \(\sigma'\) is the lift of \(\sigma\) under the binder. Because variables are de Bruijn indices, this substitution is capture-avoiding.

def subst : {Γ Δ : List (Ty Base)} → Sub Γ Δ → {A : Ty Base} → Tm Γ A → Tm Δ A
  | _, _, σ, _, .var x => σ x
  | _, _, σ, _, .app f a => .app (subst σ f) (subst σ a)
  | _, _, σ, _, .lam body => .lam (subst (Sub.lift σ) body)
Uses 5 · Used by 26

DefinitionInstantiating a binder body (simply typed lambda calculus)#✓fully proved

Write \(A :: \Gamma\) for the context \(\Gamma\) extended by a newest variable of type \(A\). Given a term \(t\) of type \(B\) in context \(A :: \Gamma\) and a term \(a\) of type \(A\) in context \(\Gamma\), the instantiation of \(t\) with \(a\) is the term of type \(B\) in context \(\Gamma\) obtained by applying to \(t\) the single-variable substitution for \(a\), which replaces the newest variable by \(a\) and leaves the older variables unchanged.

def instantiate (body : Tm (A :: Γ) B) (a : Tm Γ A) : Tm Γ B :=
  subst (Sub.single a) body
Uses 4 · Used by 30
Used byCall-by-name evaluation is preserved by the CPS translation · The call-by-name CPS translation commutes with instantiation · The CPS translation commutes with instantiation by a value or variable · Plotkin's simulation theorem, big-step form · Evaluation of an application depends on the function only through its results · A β-redex with a value argument evaluates as its contractum · The translation of an abstraction passes the translated function to its continuation · Call-by-name big-step evaluation · Administrative step of the call-by-name translation of an application · Instantiating a return to the continuation · Model-independent beta equality · Beta is sound for the denotational semantics · Beta equality inside an STLC context · One reduction step preserves STLC denotation · Denotation of an instantiated STLC body · Application preserves having the same result · Fundamental theorem of the reducibility relation · Big-step evaluation is closed under backward reduction steps · Small-step call-by-value reduction in STLC is deterministic · Big-step call-by-value evaluation in the simply typed lambda calculus · Progress for closed STLC terms · Small-step call-by-value reduction in STLC · Big-step evaluation implies small-step evaluation · Big-step evaluation produces values · Values are irreducible · Instantiation is substitution by an extended identity · Instantiating a weakened term · Renaming commutes with instantiation · Substituting by an extended substitution, via lifting · Substitution commutes with instantiation for intrinsically typed STLC terms

DefinitionExtension of a simply typed substitution#✓fully proved

Given a term \(a\) of type \(A\) in a context \(\Delta\) and a substitution \(\sigma\) from \(\Gamma\) to \(\Delta\), the extension of \(\sigma\) by \(a\) is the substitution from the context \(\Gamma\) extended by a newest variable of type \(A\) to \(\Delta\) that sends the newest variable to \(a\) and each older variable \(x\) of \(\Gamma\) to \(\sigma(x)\).

def cons (a : Tm Δ A) (σ : Sub Γ Δ) : Sub (A :: Γ) Δ
  | _, .zero => a
  | _, .succ x => σ x
Uses 4 · Used by 6

DefinitionComposition of simply typed substitutions#✓fully proved

For substitutions \(\sigma\) from a context \(\Gamma\) to \(\Delta\) and \(\tau\) from \(\Delta\) to \(\Xi\), the composite of \(\sigma\) followed by \(\tau\) is the substitution from \(\Gamma\) to \(\Xi\) that sends each variable \(x\) of \(\Gamma\) to the term obtained by applying \(\tau\) to \(\sigma(x)\).

def comp (σ : Sub Γ Δ) (τ : Sub Δ Ξ) : Sub Γ Ξ := fun x ↦ Tm.subst τ (σ x)
Uses 4 · Used by 6

TheoremRenaming commutes with weakening for intrinsically typed STLC terms#✓fully proved

Let \(\rho\) be a renaming from the typing context \(\Gamma\) to the typing context \(\Delta\), \(t\) a term of type \(A\) in context \(\Gamma\), and \(B\) a type. Weakening \(t\) by a new newest variable of type \(B\) and then renaming by the lift of \(\rho\) under that variable gives the same term as renaming \(t\) by \(\rho\) and then weakening by a new newest variable of type \(B\).

theorem rename_weaken (ρ : Ren Γ Δ) (t : Tm Γ A) :
    rename (Var.lift (A := B) ρ) (weaken (B := B) t) = weaken (B := B) (rename ρ t)
Uses 8 · Used by 4

TheoremRenaming after substitution in the simply typed calculus#✓fully proved

Let \(\sigma\) be a substitution from \(\Gamma\) to \(\Delta\), \(\rho\) a renaming from \(\Delta\) to \(\Xi\) and \(t\) a term of type \(A\) in \(\Gamma\). Renaming by \(\rho\) the result of applying \(\sigma\) to \(t\) gives the result of applying to \(t\) the substitution that sends each variable \(x\) of \(\Gamma\) to \(\sigma(x)\) renamed by \(\rho\).

theorem rename_subst (ρ : Ren Δ Ξ) (σ : Sub Γ Δ) (t : Tm Γ A) :
    rename ρ (subst σ t) = subst (fun x ↦ rename ρ (σ x)) t
Uses 11 · Used by 2

TheoremRenaming then substituting an intrinsically typed STLC term#✓fully proved

Let \(\rho\) be a renaming from the typing context \(\Gamma\) to the typing context \(\Delta\), \(\sigma\) a substitution from \(\Delta\) to the typing context \(\Xi\), and \(t\) a term of type \(A\) in context \(\Gamma\). Renaming \(t\) by \(\rho\) and then applying \(\sigma\) gives the same term as applying to \(t\) the substitution that sends each variable \(x\) of \(\Gamma\) to \(\sigma(\rho(x))\).

theorem subst_rename (σ : Sub Δ Ξ) (ρ : Ren Γ Δ) (t : Tm Γ A) :
    subst σ (rename ρ t) = subst (fun x ↦ σ (ρ x)) t
Uses 10 · Used by 4

TheoremLifted substitution commutes with weakening for intrinsically typed STLC terms#✓fully proved

Let \(\sigma\) be a substitution from the typing context \(\Gamma\) to the typing context \(\Delta\), \(t\) a term of type \(A\) in context \(\Gamma\), and \(B\) a type. Weakening \(t\) by a new newest variable of type \(B\) and then applying the lift of \(\sigma\) under that variable gives the same term as applying \(\sigma\) to \(t\) and then weakening by a new newest variable of type \(B\).

theorem subst_lift_weaken (σ : Sub Γ Δ) (t : Tm Γ A) :
    subst (Sub.lift (A := B) σ) (weaken (B := B) t) = weaken (B := B) (subst σ t)
Uses 10 · Used by 5

TheoremComposition of substitutions for intrinsically typed STLC terms#✓fully proved

Let \(\sigma\) be a substitution from the typing context \(\Gamma\) to the typing context \(\Delta\), \(\tau\) a substitution from \(\Delta\) to the typing context \(\Xi\), and \(t\) a term of type \(A\) in context \(\Gamma\). Applying \(\sigma\) to \(t\) and then applying \(\tau\) gives the same term as applying to \(t\) the composite substitution, which sends each variable \(x\) of \(\Gamma\) to the result of applying \(\tau\) to \(\sigma(x)\).

theorem subst_subst (σ : Sub Γ Δ) (τ : Sub Δ Ξ) (t : Tm Γ A) :
    subst τ (subst σ t) = subst (Sub.comp σ τ) t
Uses 9 · Used by 2

TheoremRight identity law for composition of substitutions#✓fully proved

For every simultaneous substitution \(\sigma\) from a context \(\Gamma\) to a context \(\Delta\) and every variable \(x\) of type \(A\) in \(\Gamma\), the composite of \(\sigma\) followed by the identity substitution on \(\Delta\) sends \(x\) to \(\sigma(x)\).

@[simp] theorem comp_id_apply (σ : Sub Γ Δ) (x : Var Γ A) :
    comp σ (id : Sub Δ Δ) x = σ x
Uses 9

DefinitionRenaming the images of a substitution#✓fully proved

Given a substitution \(\sigma\) from the typing context \(\Gamma\) to the typing context \(\Delta\) and a renaming \(\rho\) from \(\Delta\) to the typing context \(\Xi\), the substitution from \(\Gamma\) to \(\Xi\) obtained by renaming images sends each variable \(x\) of \(\Gamma\) to the renaming of the term \(\sigma(x)\) by \(\rho\).

def rename (σ : Sub Γ Δ) (ρ : Ren Δ Ξ) : Sub Γ Ξ := fun x ↦ Tm.rename ρ (σ x)
Uses 5 · Used by 1

TheoremLifting commutes with renaming substitution images#✓fully proved

Let \(\sigma\) be a substitution from \(\Gamma\) to \(\Delta\) and \(\rho\) a renaming from \(\Delta\) to \(\Xi\). Lift \(\sigma\) under a binder of type \(A\) and rename each of its images by the lift of \(\rho\) under the same binder. At every variable \(x\) of the context \(\Gamma\) extended by a newest variable of type \(A\), this gives the same term as the lift under that binder of the substitution that renames each image of \(\sigma\) by \(\rho\).

theorem rename_lift_apply (σ : Sub Γ Δ) (ρ : Ren Δ Ξ) (x : Var (A :: Γ) B) :
    rename (lift σ) (Var.lift ρ) x = lift (rename σ ρ) x
Uses 9

TheoremComposing a single substitution with a substitution#✓fully proved

Let \(a\) be a term of type \(A\) in a context \(\Gamma\) and \(\sigma\) a substitution from \(\Gamma\) to \(\Delta\), and write \(a[\sigma]\) for the result of applying \(\sigma\) to \(a\). The composite of the single substitution of \(a\) for the newest variable followed by \(\sigma\) agrees, at every variable \(x\) of the context \(\Gamma\) extended by a newest variable of type \(A\), with the extension of \(\sigma\) that sends the newest variable to \(a[\sigma]\).

theorem comp_single_apply (a : Tm Γ A) (σ : Sub Γ Δ) (x : Var (A :: Γ) B) :
    comp (single a) σ x = cons (Tm.subst σ a) σ x
Uses 8

TheoremLifting followed by single substitution#✓fully proved

Let \(\sigma\) be a substitution from \(\Gamma\) to \(\Delta\) and \(a\) a term of type \(A\) in \(\Delta\). The composite of the lift of \(\sigma\) under a binder of type \(A\) followed by the single substitution of \(a\) for the newest variable agrees, at every variable \(x\) of the context \(\Gamma\) extended by a newest variable of type \(A\), with the extension of \(\sigma\) that sends the newest variable to \(a\) and each older variable \(y\) to \(\sigma(y)\).

theorem lift_single_apply (σ : Sub Γ Δ) (a : Tm Δ A) (x : Var (A :: Γ) B) :
    comp (lift σ) (single a) x = cons a σ x
Uses 13 · Used by 1

TheoremSingle substitution cancels weakening#✓fully proved

Let \(t\) be a term of type \(A\) in the typing context \(\Gamma\) and \(a\) a term of type \(B\) in context \(\Gamma\). Weakening \(t\) by a new newest variable of type \(B\) and then applying the substitution that replaces the newest variable by \(a\) and leaves every older variable unchanged gives back \(t\).

@[simp] theorem subst_single_weaken (a : Tm Γ B) (t : Tm Γ A) :
    subst (Sub.single a) (weaken (B := B) t) = t
Uses 11 · Used by 6

TheoremInstantiating a weakened term#✓fully proved

For terms \(b\) of type \(B\) and \(a\) of type \(A\) in a context \(\Gamma\), weakening \(b\) to the context \(\Gamma\) extended by a newest variable of type \(A\) and then instantiating that newest variable by \(a\) gives back \(b\).

@[simp] theorem instantiate_weaken (body : Tm Γ B) (a : Tm Γ A) :
    instantiate (weaken (B := A) body) a = body
Uses 5

TheoremRenaming commutes with instantiation#✓fully proved

Let \(\rho\) be a renaming from \(\Gamma\) to \(\Delta\), \(b\) a term of type \(B\) in the context \(\Gamma\) extended by a newest variable of type \(A\), and \(a\) a term of type \(A\) in \(\Gamma\). Renaming by \(\rho\) the instantiation of the newest variable of \(b\) by \(a\) gives the instantiation of the newest variable of \(b'\) by \(a'\), where \(b'\) is \(b\) renamed by the lift of \(\rho\) under the binder and \(a'\) is \(a\) renamed by \(\rho\).

theorem rename_instantiate (ρ : Ren Γ Δ) (body : Tm (A :: Γ) B) (a : Tm Γ A) :
    rename ρ (instantiate body a) =
      instantiate (rename (Var.lift ρ) body) (rename ρ a)
Uses 14

TheoremSubstitution commutes with instantiation for intrinsically typed STLC terms#✓fully proved

Let \(\sigma\) be a substitution from the typing context \(\Gamma\) to the typing context \(\Delta\), \(s\) a term of type \(B\) in the context \(\Gamma\) extended by a newest variable of type \(A\), and \(a\) a term of type \(A\) in context \(\Gamma\). Replacing the newest variable of \(s\) by \(a\) and then applying \(\sigma\) gives the same term as applying the lift of \(\sigma\) to \(s\) and then replacing the newest variable of the result by the term obtained by applying \(\sigma\) to \(a\).

theorem subst_instantiate (σ : Sub Γ Δ) (body : Tm (A :: Γ) B) (a : Tm Γ A) :
    subst σ (instantiate body a) =
      instantiate (subst (Sub.lift σ) body) (subst σ a)
Uses 12

TheoremSubstituting by an extended substitution, via lifting#✓fully proved

Let \(\sigma\) be a substitution from the typing context \(\Gamma\) to the typing context \(\Delta\), \(s\) a term of type \(B\) in the context \(\Gamma\) extended by a newest variable of type \(A\), and \(a\) a term of type \(A\) in context \(\Delta\). Applying to \(s\) the extension of \(\sigma\) that sends the newest variable to \(a\) gives the same term as applying the lift of \(\sigma\) to \(s\) and then replacing the newest variable of the result by \(a\).

theorem subst_cons (σ : Sub Γ Δ) (body : Tm (A :: Γ) B) (a : Tm Δ A) :
    subst (Sub.cons a σ) body = instantiate (subst (Sub.lift σ) body) a
Uses 13 · Used by 1

TheoremInstantiation is substitution by an extended identity#✓fully proved

Let \(b\) be a term of type \(B\) in the context \(\Gamma\) extended by a newest variable of type \(A\), and \(a\) a term of type \(A\) in \(\Gamma\). Instantiating the newest variable of \(b\) by \(a\) gives the same term as applying to \(b\) the substitution that sends the newest variable to \(a\) and each older variable to itself, that is, the extension of the identity substitution on \(\Gamma\) by \(a\).

theorem instantiate_eq_subst_cons (body : Tm (A :: Γ) B) (a : Tm Γ A) :
    instantiate body a = subst (Sub.cons a Sub.id) body
Uses 11
34 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.