1.a. Valid Lambda Terms
(i) λx.xxx
Valid. The variable x is bound by the abstraction λx.
(ii) λλx.x
Invalid. Each lambda abstraction must be followed by a variable.
(iii) λy.(λx.x)
Valid. Both y and x are used in valid lambda abstractions, although y does not occur in the body.
(iv) λxy.(xy)(λz.z)
Valid. The variables x and y are bound by λxy, and z is bound by λz.
(v) λuv.((xy)xy)y)
Invalid as written because it contains an unmatched closing parenthesis.
1.b. Terms with the Minimum Number of
Parentheses
(i) λxyz.z(xy)
(ii) λy.yyyy
(iii) λy.yy(λx.x)(λx.x)
1.c. Free and Bound Variable Occurrences
(i) λxyz.xyz
All occurrences of x, y, and z are bound by the abstractions λx, λy, and λz, respectively. There
are no free variables.
(ii) λxyz.yz(λp.xyz)
All occurrences of x, y, z, and p are bound. The variables x, y, and z are bound by the outer
abstractions, while p is bound by the inner abstraction. There are no free variables.
(iii) λxy.yz(λz.zz)
The occurrence of y is bound by λy. The occurrence of z in yz is free because it is not within the
scope of an abstraction that binds it. The two occurrences of z in λz.zz are bound by the inner
abstraction. There is one free variable occurrence: z.
1.d. Substitution
(i) (xyz)[y/z] = xyy
(ii) (λx.x)[y/z] = λx.x
(iii) (λy.xy)[zz/x] = λy.(zz)y
(iv) (λy.xy)[yy/x] = λz.(yy)z
The bound variable y is renamed to z to prevent the free occurrences of y in the replacement
term from being captured.
(v) C[z] = λz.zz
Given C[X] ≡ λz.Xz, replacing X with z gives λz.zz.
(vi) C[zy] = λxy.y(zy)y
Given C[X] ≡ λxy.yXy, replacing X with zy gives λxy.y(zy)y.