Preliminaries

Calculus is a formal system for expressing computation in terms of function application and abstraction.

Info

Vanilla calculus is untyped (or type-free), that is, any function can be applied to any term. It is Turing complete (being allowed to consider expressions like allows us to simulate recursion), but you can easily write meaningless or non-terminating terms, like .

Application and abstraction are the two basic operations of the Calculus.

The expression denotes being considered as an operator being applied to being considered as data.

The other basic operation is abstraction: If is an expression containing , then denotes the function .

Notation

denotes an expression containing variable .

Abstraction binds the variables of the local scope.

  • It is a notational convention that the bound variables that occur in an expression are always different form the free ones.
  • Expressions that differ only in the names of bound variables are identical.

Iterated application uses association to the left

Dually, iterated abstraction used association to the right:

For arguments, we have (recall currying):

Using vector notation, we have

However, considering our notational convention from above, it would be more appropriate to write


The formal definitions

Definition 1( terms).

The set of -terms, denoted by , is built up from an infinite set of variables using application and abstraction:

It is a convention that lower case letters denote variables and upper case letters denote -terms. denotes that and are the same term or can be obtained from each other by renaming bound variables. We also associate iterated application to the left and iterated abstraction to the right.

Definition 2(free variables).

The set of free variables of , denoted by , is defined inductively as follows:

A variable in is said to be bound if it is not free.

Definition 3(Combinator).

is a closed -term (or combinator) if . The set of closed -terms is denoted by .

Variable convention: If occur in a certain mathematical context, then in these terms all bound variables are chosen to be different from the free variables.

Definition 4.

The result of substituting for the free occurrences of in , denoted by , is defined as follows:

Note that in the fourth clause of the above definition, it is not needed to say “Provided that “. By the variable convention, this is the case: is a bound variable in , and hence cannot be a free variable in .

Now, we can introduce the calculus as a formal theory:

Definition 5.

The principal axiom of the -calculus is

for all .

There are also the logical axioms:

and compatibility rules:

If is provable in the -calculus, then we write .

Thanks to the compatibility rules, one can replace subterms by equal terms in any term context. For example, , so .

The following lemma is clear from the principal axiom:

Lemma 6.


Fixed point theorem

Definition 7(Standard combinators).

Define standard combinators

Theorem 8(Fixed point theorem).

For all , there exists such that . More precisely, for all , there exists a fixed point combinator

such that .

Example 9.

Show that there exists such that for all , .

Let . Then, is a fixed point of , and

Note that taking also works.

Example 10.

Show that there exists such that for all , .

Let . Then,

so for all .

Alternatively, for a solution that does not use the fixed point combinator, let and :

More alternative solutions can be obtained by taking the s in in powers of :








Note that all the proofs converge when we obtain . In general, we have:






Church numerals

Definition 11(Notation for repeated application).

with and is defined inductively as follows:

Definition 12(Church numerals).

The Church numerals are defined by .

Lemma 13.

  1. , for .

Theorem 14(Arithmetic on Church numerals).

Define

Then,


Lambda definability and recursive functions

Booleans and conditionals

Definition 15.

, , where and are the combinators defined here.

Note that if is a boolean, then

is equivalent to the -term

Definition 16.

For , define

Then, , and . can serve as an ordered pair.

Multiple fixed point theorem

Theorem 17(Multiple fixed point theorem).

Let be -terms. Then, we can find such that

For , this is the ordinary fixed point theorem.

Barendregt numerals

We can use the pairing construction for an alternative representation of natural numbers.

Definition 18(Barendregt Numerals).

For each , the numeral is defined inductively as follows:

Lemma 19.

The exist combinators , and such that

Equivalence of lambda definable and recursive functions

Definition 20(Lambda definability).

A numeric function is a map for some . In this case, is called -ary.
A numeric -ary function is called -definable if for some combinator ,

for all , in which case, is said to be -defined by .

Definition 21(Initial functions).

The initial functions are the numeric functions , defined by

Notation

Let be a numeric relation. denotes the least number such that holds if there is such a number; otherwise it is undefined.

We will now characterize the -definable functions.

Definition 22(Recursive functions).

The class of recursive functions is the smallest class of numeric functions that contains all initial functions and is

  1. closed under composition: for all defined by

with , one has ;
2. closed under primitive recursion: for all defined by

with , one has ;
3. closed under minimalization: for all defined by

with such that

one has .

Our claim is that all recursive functions are -definable.

Lemma 23.

The initial functions are -definable.

Lemma 24.

The -definable functions are closed under composition.

Therefore we want a term satisfying

This equation can be solved using the fixed point combinator:

The general case follows.

Lemma 25.

The -definable functions are closed under primitive recursion.

Lemma 26.

The -definable functions are closed under minimalization.

Hence, we have the following theorem.

Theorem 27.

All recursive functions are -definable.