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.

- Zero: Z(n) = 0
- Successor: S(n) = n+1
- Projection:
U
^{p}_{i}(n_{1},...,n_{p}) = n_{i}

(f o (gExample: the function f(n) = n + 2 can be defined as the composition of the successor function with itself, namely f = S o S._{1},...,g_{k})) (n_{1},...,n_{h}) = f(g_{1}(n_{1},...,n_{h}),..., g_{k}(n_{1},...,n_{h}))

f(0,nExamples:_{1},...,n_{k}) = g(n_{1},...,n_{k})

f(n+1,n_{1},...,n_{k}) = h(n, f(n,n_{1},...,n_{k}), n_{1},...,n_{k})

- The function plus(n,m) = n + m can be defined by primitive recursion from g = U
^{1}_{1}and h = S o U^{3}_{2}. - The function times(n,m) = n * m can be defined by primitive recursion from g = Z
and h = plus o (U
^{3}_{3}, U^{3}_{2}).

f(nwhere 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._{1},...,n_{k}) = mu n. (g(n,n_{1},...,n_{k}) = 0)

Note that f could be computed by general iteration, i.e. using a while loop of the form

n := 0; while (g(n,n_{1},...,n_{k}) <> 0) do n := n+1;

Example: Consider the function
log_{2} n = k, where k is the number, if it exists, such that
2^{k} = n (the result is undefined otherwise).
Then log_{2} can be defined by minimalization from the function
g(k,n) = | 2^{k} - 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.