Pairing Functions and Gödel Numberings
[18/33%]Show that the function , defined by
is a pairing function.
Show that the Fibonacci function is primitive recursive.
Show that the function
is a Gödel numbering.
Show that the following functions are primitive recursive:
and , if .
.
Show that the function , defined by , , is primitive recursive.
The function sort : maps a number to the number , where is a permutation of such that . Show that sort is primitive recursive.
Show that the following functions are pairing functions.
.
, where if , and if .
Let be defined by , where is the th prime.
Show that the is onto, primitive recursive and monotone. Also show that is almost one-to-one in the sense that if , and if , then for all , and for all .
Verify that if we use as a Gödel numbering, then the functions size, item and the functions of Example 4.35 all remain primitive recursive. (Here, is the number of items in the sequence , excluding the trailing zeros.)
Let are nonnegative integers. Prove that if , then .
Assume that and for some primitive recursive and . Also assume that for all . Prove that is also primitive recursive. (Note that Solution 1 of Example 4.38 actually used this result.)
Show that the following functions are primitive recursive:
the number of occurrences of integer in the sequence .
, where is the decimal representation of (e.g., ).
We may extend the notion of primitive recursive functions to functions from to , where is the set of integers. All we need is to treat a pair as a represention of an integer in : If , then it represents , otherwise it represents . Show that the following functions on integers are primitive recursive:
the inner product of two -dimensional vectors and , if (and it is 0, otherwise). (We treat a list as a -dimensional integer vector whose th element is the integer represented by ; that is, it is if , and is if .)
the determinant of the matrix if for some (and it is 0 otherwise). (We treat as a integer matrix with equal to the integer represented by the pair .)
We say a sequence is balanced if there exists a partition of into two subsets and (i.e., and ) such that . Prove that the predicate is balanced] is primitive recursive.
Show that the function that merges two sorted sequences into a single sorted sequence (and output 0 if any of the two inputs is not sorted) is primitive recursive.
Prove that sort is primitive recursive using the algorithm of merge sort.
Assume that and are two primitive recursive functions. Show that the following function is primitive recursive:
Assume that and are all primitive recursive. Show that the following function is primitive recursive:
Assume that and are all primitive recursive. Show that the following function is primitive recursive:
Assume that and are all primitive recursive. Let and be functions defined by the following formulas:
Show that both and are primitive recursive: