Please write your solutions as clearly and concisely as possible.
Hint: the predecessor function pred can be defined in pseudo-code by the following declarations:
fun aux(m,n) = (m+1,m)Where Second is the projection on the second element of a pair, i.e. (a,b) Second = b. To see that the above is a correct definition, note that auxn (0,0) = (n,n-1), hence (auxn(0,0)) Second = n-1.
fun pred(n) = (auxn(0,0)) Second
As for the iteration of application, needed for encoding auxn(0,0), note that the Church's numerals provide this capability. In fact, we have [n] M N =beta MnN.
Finally, for representing pairs (which are argument and result of aux), note that we can encode the pair (M,N) as \x. x M N. The projections First and Second will then be provided by the terms [True] and [False]. In fact: (\x. x M N)[True] =beta [True] M N =beta M and (\x. x M N)[False] =beta [False] M N =beta N. (Notation: the symbol "\" stands for the Greek letter lambda; [True] and [false] are the encodings of True and False as defined in Lecture 2). See also Barendregt92, Section 2.2 for the definition and use of the pairing construct.