Pair = \x y z. z x yNote that this definition is a correct encoding, since we have (Pair M N) First = M and (Pair M N) Second = N. Now define P = Predecessor as follows:
First = [True] = \x y. x
Second = [False] = \x y. y
Aux = \x. Pair (Successor (x First)) (x First)Where Successor = \n x y. x(n x y) is the usual encoding of the successor function.
Predecessor = \n. n Aux (Pair [0] [0]) Second
hence Factorial must be a fixpoint of the following function F (i.e.it must satisfy Factorial = F Factorial):Factorial = \n. [if_then_else] ([is_zero][n]) [1] (Times n (Facorial (Predecessor n)))
Therefore we can defineF = \f. \n. [if_then_else] ([is_zero][n]) [1] (Times n (f (Predecessor n)))
where Y is the fixpoint operator.Factorial = Y F
M = \x. x MThis is equivalent to saying that M is the fixpoint of the following function G:
G = \y x. x yHence we can define
M = Y G