Chapter 19

Partial Recursive Functions

[13/100%]
Show
LaTeX
Problem 289

Show that the following functions are general recursive:

?
(a)

fact⁡(x)=x!\operatorname {fact}(x)=x! — factorial;

(b)

min⁡(n)(x1,…,xn)\min^{(n)}\left(x_{1}, \ldots , x_{n}\right) — the smallest of the arguments, n>0n>0;

(c)

max⁡(n)(x1,…,xn)\max^{(n)}\left(x_{1}, \ldots , x_{n}\right) — the largest of the arguments, n>0n>0;

(d)

diff =∣x−y∣=\left|x-y\right| — the absolute value of the difference;

Problem 290

Prove that if the function f(x1,…,xn)f\left(x_{1}, \ldots , x_{n}\right) is partial recursive, then the function g(x1,…,xn)=f(xi1,…,xin)g\left(x_{1}, \ldots , x_{n}\right)=f\left(x_{i_{1}}, \ldots , x_{i_{n}}\right) is also partial recursive for every permutation (i1,…,in)\left(i_{1}, \ldots , i_{n}\right) of the numbers 1,2,…,n1,2, \ldots , n.

?
Problem 291

Let g(x1,…,xn−1,xn)g\left(x_{1}, \ldots , x_{n-1}, x_{n}\right) be a partial recursive function, and let aa and b>0b>0 be natural numbers. Prove that the function

f(x1,…,xn−1,xn)={a, if xn<b,g(x1,…,xn−1,xn−b), if xn⩾b f\left(x_{1}, \ldots , x_{n-1}, x_{n}\right)= \begin{cases} a, & \text{ if } x_{n}<b, \\ g\left(x_{1}, \ldots , x_{n-1}, x_{n}-b\right), & \text{ if } x_{n} \geqslant b \end{cases}

is also partial recursive.

?
Problem 292

Show that the following functions are partial recursive:

?
(a)

rt⁡(n,x)=⌊xn⌋\operatorname {rt}(n, x)=\lfloor \sqrt[n]{x}\rfloor — the integer part of the nn-th root of xx;

(b)

log⁡(i,x)=⌊log⁡ix⌋\log (i, x)=\left\lfloor \log_{i} x\right\rfloor;

(c)

τ(x)\tau (x) — the number of distinct divisors of xx, τ(0)=0\tau (0)=0;

(d)

p(x)=1p(x)=1, if xx is a prime number, and p(x)=0p(x)=0 otherwise;

(e)

pn⁡(k)\operatorname {pn}(k) — the kk-th prime number in increasing order, pn⁡(0)=2\operatorname {pn}(0)=2;

(f)

σ(x)\sigma (x) — the sum of the divisors of xx; take σ(0)=0\sigma (0)=0;

(g)

digit⁡(n,m,i)\operatorname {digit}(n, m, i) — the ii-th digit in the base-mm representation of nn: that is, if n=∑i=0∞aimin=\sum_{i=0}^{\infty } a_{i} m^{i}, where 0⩽ai<m0 \leqslant a_{i}<m, then digit⁡(n,m,i)=ai;\operatorname {digit}(n, m, i)=a_{i} ;

(h)

gcd⁡(x,y)\gcd (x, y) — the greatest common divisor of xx and yy.

Problem 293

A general recursive function that can be constructed without using minimization is called primitive recursive. Let the functions gg and ff be primitive recursive, h=μgh=\mu g, hh — a general recursive function, and let hh be majorized by the function f:h(xˉ)<f(xˉ)f: h(\bar{x})<f(\bar{x}) for all xˉ\bar{x}. Prove that hh is also primitive recursive.

?
Problem 294

Prove that if the values of a general recursive function f(x)f(x) are changed on a finite set, then the resulting function f′(x)f^{\prime }(x) is also general recursive.

?
Problem 295

Prove that from the constant 0 and the functions id⁡mn\operatorname {id}_{m}^{n}, using superposition and primitive recursion, one cannot obtain the function s(x)=x+1s(x)=x+1 or the function d(x)=2xd(x)=2 x. Hint. By induction on the construction of the function, prove that for all functions constructed in this way the inequality f(x1,…,xn)<2f\left(x_{1}, \ldots , x_{n}\right)<2 holds for arbitrary x1,…,xn<2x_{1}, \ldots , x_{n}<2.

?
Problem 296

Let ff be a general recursive function that is one-to-one on ω\omega. Prove that the inverse function f−1f^{-1} is also general recursive, by explicitly constructing it.

?
Problem 297

Let g(x1,…,xn,y)g\left(x_{1}, \ldots , x_{n}, y\right) be a general recursive function. Prove that the function

f(x1,…,xn,y,z)={∑i=0zg(x1,…,xn,y+i), if y⩽z,0, if y>z f\left(x_{1}, \ldots , x_{n}, y, z\right)= \begin{cases} \sum _{i=0}^{z} g\left(x_{1}, \ldots , x_{n}, y+i\right), & \text{ if } y \leqslant z, \\ 0, & \text{ if } y>z \end{cases}

is general recursive.

?
Problem 298

Prove that if the functions f(x1,…,xn,y),g(x1,…,xn,y)f\left(x_{1}, \ldots , x_{n}, y\right), g\left(x_{1}, \ldots , x_{n}, y\right) and h(x1,…,xn,y)h\left(x_{1}, \ldots , x_{n}, y\right) are general recursive, then the function F(x1,…,xn)=min⁡{y:f(x1,…,xn,y)=0 or g(x1,…,xn,y)>h(x1,…,xn,y)}F\left(x_{1}, \ldots , x_{n}\right)=\min \left\{ y: f\left(x_{1}, \ldots , x_{n}, y\right)=0 \text{ or } g\left(x_{1}, \ldots , x_{n}, y\right)>h\left(x_{1}, \ldots , x_{n}, y\right)\right\} is partial recursive.

?
Problem 299

Suppose that all pairs (x,y)(x, y) of natural numbers are ordered by increasing sum x+yx+y, and pairs with the same sum are ordered by increasing coordinate xx. This order looks as follows:

(0,0),(0,1),(1,0),(0,2),(1,1),(2,0),……,(0,x+y),(1,x+y−1),…,(x,y),…,(x+y,0),… \begin{aligned} (0,0),(0,1),(1,0),(0,2) & ,(1,1),(2,0), \ldots \\ & \ldots ,(0, x+y),(1, x+y-1), \ldots ,(x, y), \ldots ,(x+y, 0), \ldots \end{aligned}

Let ⟨x,y⟩\langle x, y\rangle be the number of the pair (x,y)(x, y) in this order (we take the pair (0,0)(0,0) to have number 0). Then the function ⟨⋅,⋅⟩\langle \cdot ,\cdot \rangle enumerates all pairs of natural numbers bijectively.

?
(a)

Prove that ⟨x,y⟩=(x+y)(x+y+1)2+x\langle x, y\rangle =\frac{(x+y)(x+y+1)}{2}+x.

(b)

Find the inverse functions ⟩1\left\rangle_{1}\right. and ⟩2\left\rangle_{2}\right. such that the equalities ⟨⟨x,y⟩⟩1=x,⟨⟨x,y⟩⟩2=y\langle \langle x, y\rangle \rangle_{1}=x,\langle \langle x, y\rangle \rangle_{2}=y hold, and hence ⟨⟨z⟩1,⟨z⟩2⟩=z\left\langle \langle z\rangle_{1},\langle z\rangle_{2}\right\rangle =z.

(c)

Show that all these functions are general recursive.

Problem 300

Show that the function F(x)F(x) from Problem 281 on page 381 is general recursive. Hint. First show that the function g(x)=⟨F(x),F(x+1)⟩g(x)=\langle F(x), F(x+1)\rangle is general recursive.

?
Problem 301

For the Ackermann function

?
(a)

find A(1,y)A(1, y) and A(2,y)A(2, y) for all natural numbers yy;

(b)

prove that A(3,y)=2y+3−3A(3, y)=2^{y+3}-3.