Skip to content
scrambled
Programming Language Theory Concept

Capture-avoiding substitution

Rules in Pure/Untyped lambda calculus:

  • [x→s]x=s

  • [x→s]y=y if x≠y

  • -
[x→s]λy. t={λy. [x→s]tif y≠x∧y∉FV(s)λy. tif y=x
  • [x→s](t1 t2)=[x→s]t1 [x→s]t2

  • Practical foundations for programming languages 's notation

    A substitution [b/x] is a Partial function on the set of Abstract syntax tree (AST)s 𝒜. Given the set of variables 𝒳 and an AST a∈𝒜:

    • If a=x∈𝒳 then [b/x]a=b.

    • If a=y∈𝒳 and y≠x then [b/x]y=y.

    • [b/x]o(x→1.a1;…;x→n.an)=o(x→1.a1′;…;x→n.an′), where for each 1≤i≤n, we require that x→i∉b, and we set ai′=[b/x]ai if x∉x→i, and ai′=ai otherwise.