M = (\x.x (\y.y))(\z.z)wWe get the following lambda conversions:
(\x.x (\y.y))(\z.z)w = (\z.z)(\y.y)w by beta conversion on (\x.x (\y.y))(\z.z) and by Congruence 1 = (\y.y)w by beta conversion on (\z.z)(\y.y) and by Congruence 1 = w by beta conversionNote that there were other possibilities. For instance, at the second step, we could have applied beta conversion on \x.x (\y.y). It is easy to see, however, that the final result would have been the same (w). This is not a coincidence: in general, all ways of converting a term bring to the same reult. We will study in more detail this property, called "confluence", in some future lecture.
Note that we *cannot* apply beta conversion to the subterm (\z.z)w In fact, according to the prentheses convention, the structure of M is the following:
((\x.x (\y.y))(\z.z))w
N = (\z.z)((\x.(\y.y)x)w)We get the following lambda conversions:
(\z.z)((\x.(\y.y)x)w) = (\z.z)((\x.x)w) by beta conversion on (\y.y)x, the rule xi, Congruence 1 and Congruence 2 = (\z.z)w by beta conversion on (\x.x)w and by Congruence 2 = w by beta conversionAgain, this is only one of the possible conversion sequences.
By using transitivity and symmetry we can derive also that
M = N
As a definition of computable function, we will use the system of "Recursive Functions" defined by Gödel in 1931.
(f o (g1,...,gk)) (n1,...,nh) = f(g1(n1,...,nh),..., gk(n1,...,nh))Example: the function f(n) = n + 2 can be defined as the composition of the successor function with itself, namely f = S o S.
f(0,n1,...,nk) = g(n1,...,nk)Examples:
f(n+1,n1,...,nk) = h(n, f(n,n1,...,nk), n1,...,nk)
f(n1,...,nk) = mu n. (g(n,n1,...,nk) = 0)where mu is the minimalization operator: mu n. P(n) returns the least natural number n such that P(n) holds. If such n does not exists, then the result is undefined.
Note that f could be computed by general iteration, i.e. using a while loop of the form
n := 0; while (g(n,n1,...,nk) <> 0) do n := n+1;
Example: Consider the function log2 n = k, where k is the number, if it exists, such that 2k = n (the result is undefined otherwise). Then log2 can be defined by minimalization from the function g(k,n) = | 2k - n |, where | m | represents the absolute value of m.
Definition The set of Recursive Functions is the smallest set which contains the initial functions and is closed w.r.t. composition, primitive recursion, and minimalization.
If we exclude minimalization from this construction, we get the set of Primitive Recursive Fuctions, which are all total. Minimalization is the only operator which introduces non-termination, i.e. partiality.