explicit substitution

Explicit substitutions


Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism = propositions as types +programs as proofs +relation type theory/category theory

logiccategory theorytype theory
trueterminal object/(-2)-truncated objecth-level 0-type/unit type
falseinitial objectempty type
proposition(-1)-truncated objecth-proposition, mere proposition
proofgeneralized elementprogram
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
cut elimination for implicationcounit for hom-tensor adjunctionbeta reduction
introduction rule for implicationunit for hom-tensor adjunctioneta conversion
logical conjunctionproductproduct type
disjunctioncoproduct ((-1)-truncation of)sum type (bracket type of)
implicationinternal homfunction type
negationinternal hom into initial objectfunction type into empty type
universal quantificationdependent productdependent product type
existential quantificationdependent sum ((-1)-truncation of)dependent sum type (bracket type of)
equivalencepath space objectidentity type
equivalence classquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
completely presented setdiscrete object/0-truncated objecth-level 2-type/preset/h-set
setinternal 0-groupoidBishop set/setoid
universeobject classifiertype of types
modalityclosure operator, (idemponent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels


Explicit substitutions


Ordinary substitution is a meta-level notion, i.e. an operation on syntax. By contrast, explicit substitutions incorporate a notion of substitution as part of a syntax.


A paradigmatic (and in some sense universal) example is given by adding explicit substitutions to simply typed lambda calculus. For this we add a new term constructor

MxNM\langle x\coloneqq N\rangle

denoting internally “the substitution of NN for xx in MM”. That this is a term constructor means, for instance, that xxyx\langle x\coloneqq y\rangle is a term distinct from yy; whereas for the ordinary notion of substitution as an operation, x[xy]x[x\coloneqq y] would be a notation for the result of the operation of substituting the term yy for the variable xx in the term xx, which is precisely the term yy.

The relation between xxyx\langle x\coloneqq y\rangle and yy is recovered by modifying the reduction relation. We modify the usual beta-reduction rule (λx.M)(N)M[xN](\lambda x.M)(N) \to M[x\coloneqq N] to use an explict substitution instead:

(λx.M)(N)MxN(\lambda x.M)(N) \to M\langle x\coloneqq N\rangle

and then give reduction rules that mimic the inductive definition of the usual operation of substitution on terms:

xxN N yxN y(xy) (M 1M 2)xN (M 1xN)(M 2xN) (λy.M)xN λy.(MxN)(xyandynot free inN)\begin{aligned} x\langle x\coloneqq N\rangle &\to N\\ y \langle x\coloneqq N\rangle &\to y \quad (x\neq y)\\ (M_1 M_2)\langle x\coloneqq N\rangle &\to (M_1 \langle x\coloneqq N\rangle)(M_2 \langle x\coloneqq N\rangle) \\ (\lambda y.M)\langle x\coloneqq N\rangle &\to \lambda y. (M\langle x\coloneqq N\rangle) \quad (x\neq y \;\text{and}\; y \;\text{not free in}\; N) \end{aligned}

(We are being somewhat cavalier about variables; one can also implement explicit substitutions using de Bruijn indices?.)

Combining substitutions and strong normalization

Note that there is no rule for reducing a term of the form (MxN)yP(M \langle x\coloneqq N\rangle) \langle y\coloneqq P\rangle. Instead we have to first reduce MxNM \langle x\coloneqq N\rangle until its “head” is no longer an explicit substitution, and then we can apply reduction rules for the “outer” substitution yP\langle y\coloneqq P\rangle. We might be tempted to assert a rule such as

(MxN)yP(MyP)xNyP (M \langle x\coloneqq N\rangle) \langle y\coloneqq P\rangle \to (M\langle y\coloneqq P\rangle) \langle x\coloneqq N\langle y\coloneqq P\rangle \rangle

but such a rule is undesirable because it destroys the strong normalization? property of the reduction system: although every term still can be reduced to a normal form, there are also infinite reduction sequences that simply interchange pairs of substitutions forever.

One might hope that this could be avoided by introducing “explicit simultaneous substitutions” with a reduction rule

(MxN)yPMxN,yP. (M \langle x\coloneqq N\rangle) \langle y\coloneqq P\rangle \to M \langle x\coloneqq N, y\coloneqq P\rangle.

Apparently for a long time it was hoped that this would work, but Mellies showed that it doesn’t: explicit simultaneous substitutions with a rule of this sort also yield infinite reduction sequences. Note that Mellies worked with a de Bruijn version, so his rules look somewhat different; a version of the counterexample using named variables can be found in Bloo-Rose, along with a proof that without any way to “combine substitutions” strong normalization is preserved.


  • Paul-André Melliès, Typed λ\lambda-calculi with explicit substitution may not terminate. In M. Dezani (ed.), Int. Conf. on Typed Lambda Calculus and Applications, Lecture Notes in Computer Science, 1995.

  • Roel Bloo and Kristoffer H. Rose, Preservation of Strong Normalisation in Named Lambda Calculi with Explicit Substitution and Garbage Collection. In CSN-95: Computer Science in the Netherlands 1995, citeseer

Last revised on November 27, 2018 at 00:55:32. See the history of this page for a list of all contributions to it.