# Powers of 2 (Or ‘Representing Primative Recurrsive functions in PA’)

March 25, 2010 Leave a comment

The question was raised on how to represent the operation in Peano Arithmetic.

It is easily recursively defined as follows:

We want to represent it in Peano Arithmetic. That means we want to find some formula *p*, consisiting of just the basic logical and mathematical operations, such that:

The first thought might be to try this:

But there is a problem; we cannot actually define a formula in terms of itself. If you use a formula in another formula, it is really just a shorthand that you could replace with the real formula if you wanted. In this case, it isn’t a shorthand, as you absolutely replace it with itself, as each time you try it introduces another *p*.

Gödel proved in “On Formally Undecidable Propositions of Principia Mathematica and Related Systems” that you can in fact represent any recursively defined function inside Peano Arithmetic, providing the functions it is made up of are representable in it. The rest of this article is the proof.

What is recursion, formally? Suppose we have two functions, and . It is possible to define a third function, , by combining them together as follows: Then we can define another function as follows:

We want to show that is representable in PA providing that both and are.

To do this we need to recast the idea of recursion into something more manageable. Recursion lets you determine new values from the old values, and so really it is about of a sequence of numbers which are all related to each other. Specifically,

is the same as saying there is a sequence of numbers with:

and

So if the relation holds, there is such a sequence; if there is such a sequence, the relation holds. Therefore, if we could quantify across sequences, we could represent it as:

The problem is First-order Peano does not allow us to quantify across sequences, and so we need a way to get rid of them.

Enter Gödel’s trick: His idea is to generate a sequence by taking a fixed number modulo different numbers.

For example, take the sequence 3, 5, 9, 6, 3, 0. We can generate this sequence by taking the number 19 modulo the bases 4, 7, 10, 13 and 16.

So given a sequence how do we find a number, *n*, and an easily generatable set of *k* numbers, call them to use as moduli. If all the *g* numbers are coprime then we can easily find *n*: The Chinese Remainder Theorem!

So the problem is we want an easily generatable sequence. How much easier can we get than a linear progression? So if we decide that the moduli are in the form then the work is cut down. We wish to apply the Chinese Remainder Theorem to it, so we need each of the *k* terms to be coprime.

So where have we previously seen a trick which lets you get a number which is coprime to a given set of other numbers? Euclid’s classic proof of there being an infinite number of prime numbers!

So the idea there is that is coprime to every number lower or equal to . This is because it is one greater than a factor of 2, one greater than a factor of 3, and so forth.

and . If they are not coprime then there is some prime *p* which divides both. Hence it must divide the difference also. The difference is . But each of the numbers was coprime to all numbers lower or equal to , so definitely the prime is not in and so must be in the other term. If we have , then *s-t* is also an integer smaller or equal to , and so it must be coprime to that as well. Hence we have that the numbers:

are pairwise coprime providing .

Thus we can have a set of simultaneous linear congruence equations, in the unknown *n*, as below, and by the Chinese Remainder Theorem there is a solution:

At this point you need to verify that the CRT works in Peano. If you recall, the proof is very simple – you just take a number which is the sum of *k* terms, where each term has all the moduli except for one multiples together, and then multiples by a constant. It definitely works in PA.

So now we have a number, *n*, such that modulo certain numbers in an arithmetic progression, we have the original numbers from the sequence. This isn’t *quite* what we want, as we want the actual number, not something congruent to it.

The solution is as follows: If is also greater than each , then we would definitely have being less than . Now not only is *n* congruent to , modulo , for each *i*, but also is the *least positive number than is congruent to n*.

If we let denote the least positive number that is congruent to *n* mod *p*, then this can be represented as the following relation in PA:

So in summary, given a sequence , there is are numbers *n * and such that:

So now there is no need to quantify across sequences. Instead of saying:

We can now say:

And so we have represented recursion in Peano!

Providing that the two functions used to represents it are representable in PA, then so can the result of them combined using recursion.

It is also obvious that substitution of variables for functions forms something that can be represented in PA if the original functions can be, and that the successor function, identity function and zero function are all representable in PA too. It hence follows that every primitively recursive function is representable in Peano Arithmetic.

So how do we represent the power of two problem? As follows:

Of course, the definition of the could be substituted in there in order to show the formula in all its entirety.