scrambled
Concept

Capture avoiding substitution

Modified just now

Rules in Pure/Untyped lambda calculus:

  • [xs]x=s[x\to s]x = s
  • [xs]y=y if xy[x\to s ]y = y\ \text{if}\ x \neq y

[xs]λy. t={λy. [xs]tif yxyFV(s)λy. tif y=x[x\to s]\lambda y.\ t = \begin{cases} \lambda y.\ [x\to s]t & \text{if}\ y \neq x \land y \notin FV(s) \\ \lambda y.\ t & \text{if}\ y = x \end{cases}

  • [xs](t1 t2)=[xs]t1 [xs]t2[x \to s](t_1\ t_2) = [x \to s]t_1\ [x \to s]t_2

  • Practical foundations for programming languages 's notation

    A substitution [b/x][b / x] is a Partial function on the set of Abstract syntax tree (AST)s A\mathcal{A}. Given the set of variables X\mathcal{X} and an AST aAa \in \mathcal{A}:

    • If a=xXa = x \in \mathcal{X} then [b/x]a=b[b/x]a = b.
    • If a=yXa = y \in \mathcal{X} and yxy \neq x then [b/x]y=y[b/x]y = y.
    • [b/x]o(x1.a1;;xn.an)=o(x1.a1;;xn.an)[b/x]o(\vec{x}_1.a_1; \ldots; \vec{x}_n.a_n) = o(\vec{x}_1.a'_1; \ldots; \vec{x}_n.a'_n), where for each 1in1 \leq i \leq n, we require that xib\vec{x}_i \notin b, and we set ai=[b/x]aia'_i = [b/x]a_i if xxix \notin \vec{x}_i, and ai=aia'_i = a_i otherwise.