examples of primitive recursive encoding
In this entry, we present three examples of primitive recursive encodings. In all the examples, the following notations are used: is the set of all natural numbers (including ), is the set of all finite sequences over , and is the encoding in question. For any sequence , its image under is denoted by , and is called the sequence number corresponding to . Furthermore, denotes the empty sequence, and its sequence number is denoted by . The fact that the in each of the examples below is in fact encoding is proved in this entry (http://planetmath.org/EncodingWords).
Example 1. (Multiplicative encoding) is defined as follows:
where is the successor function, and are the first prime numbers.
To see that is primitive recursive, we verify the following:
-
•
the predicate “ is a sequence number” is primitive recursive: a number is a sequence number iff or, if for some prime , then for any prime . The predicates
where “ is prime”, are primitive recursive by bounded quantification. Thus “ is a sequence number” iff “ or ” iff “”, is primitive recursive as a result.
-
•
is clearly primitive recursive.
-
•
can be defined as the number of primes dividing , which is primitive recursive.
-
•
can be defined as the exponent of the -th prime in (the largest power of dividing ), which is again primitive recursive.
Example 2. (Encoding via a pairing function) First, let be a (primitive recursive) pairing function. For any , define
Then define by
is primitive recursive because
-
•
is a bijection, so the predicate “ is a sequence number” is the same as “”, which is clearly primitive recursive,
-
•
is primitive recursive since both and are, the latter of which can be shown to be primitive recursive by induction,
-
•
The two functions such that are primitive recursive. So in particular is primitive recursive.
-
•
If , then , and . Thus,
is primitive recursive, since each case is primitive recursive.
Example 3. (Digital Representation) Pick a positive integers . Define by
In other words,
(1) |
To see that is primitive recursive, we first define three functions given by , the exponent of in , given by , and given by
Clearly, are all primitive recursive. Furthermore, has the property that if , then , and therefore for large enough . Using , we may proceed to show that is primitive recursive:
-
•
the predicate “ is a sequence number” is equivalent to the predicate
“”
which is equivalent to the predicate
“”
since . As the quantification is bounded, the predicate is primitive recursive.
-
•
is primitive recursive by equation (1) above.
-
•
can be defined as the number of such that , or
which is primitive recursive, because it is a bounded sum.
-
•
If , then . Therefore, is just , which is primitive recursive.
Remark. In the third example, can be more generally defined so that
provided that are coprime. It is fairly straightforward to show that is again primitive recursive.
Title | examples of primitive recursive encoding |
---|---|
Canonical name | ExamplesOfPrimitiveRecursiveEncoding |
Date of creation | 2013-03-22 19:06:23 |
Last modified on | 2013-03-22 19:06:23 |
Owner | CWoo (3771) |
Last modified by | CWoo (3771) |
Numerical id | 8 |
Author | CWoo (3771) |
Entry type | Example |
Classification | msc 94A60 |
Classification | msc 68Q45 |
Classification | msc 68Q05 |
Classification | msc 03D20 |