Universität Koblenz-Landau FB 4 Informatik
Prof. Dr. Viorica Sofronie-Stokkermans∗1 13.12.2017
M.Ed. Dennis Peuter∗2
Exercises for Advances in Theoretical Computer Science Exercise Sheet 8
Due at 18.12.2017, 10:00 s.t.
Remark: For the exercises where you have to dene primitive/µrecursive functions, you are allowed to use all functions that were proved to be primitive/µ recursive in the lecture or in a previous exercise.
Exercise 8.1
Letf :N→Nbe dened as follows:
f(n) =
3 if n= 0
7 if n= 1
4 if n= 2
4 if n= 3
(2∗f(n−4))−f(n−2) + (4∗f(n−3)) + (3∗f(n−1)) if n >3 Prove thatf is primitive recursive.
Exercise 8.2
Letg:N→Nbe dened by:g(n) =f(n, n+ 1)−1, andf :N2→Nbe dened by:
f(n,0) = 0
f(n, k+ 1) = f(n, k) + (1−(k2−n))
a) Show that g is primitive recursive.
b) Computeg(5)and g(10).
c) Give a LOOP program which computes g.
d) Can you describe what mathematical function is computed byg?
e) Give a primitive recursive function which computes blog2(n)c. (Forn= 0, the value of the function should be0, not−∞.)
Hint: Modify the functions g and f in a suitable way.
f) Prove that function log:N2→N dened bylog(n, m) =blogn(m)c isµ-recursive.
Hint: Modify the functions g and f in a suitable way.
Exercise 8.3
Show that there exists a functionf :N→Nwhich is not primitive recursive.
Exercise 8.4
Which functions are computed by:
I) f1 =µc21
II) f2 =µg, whereg(n, i) =
n+ 1 if i= 0
µj(j+ 1 +n= 0) if i= 1
0 if i≥2
III) f3 =µg, whereg(n, i) =
n+ 1 if i= 0
µj((j+ 1)−n= 0) if i= 1
0 if i≥2
Exercise 8.5
Consider the denition of the Ackermann function given in the lecture:
A(0, y) = y+ 1
A(x+ 1,0) = A(x,1) Ack(x) =A(x, x)
A(x+ 1, y+ 1) = A(x, A(x+ 1, y)) For everym∈N, let
Bm={f |f primitive recursive and for all n1, . . . , nr∈N wherer is the arity of f and f(n1, . . . , nr)< A(m,
r
X
i=1
ni)}
We assume that the following properties of the functionA are known (proving these facts is not part of this exercise).
(1) A(1, y) =y+ 2for every y∈N (2) A(2, y)>2y for every y∈N (3) A(3, y)>2y+1 for every y∈N (4) y < A(x, y)for all x, y∈N
(5) A(x, y)< A(x, y+ 1)for all x, y∈N (6) A(x, y+ 1)≤A(x+ 1, y)for all x, y∈N (7) A(x, y)< A(x+ 1, y) for all x, y∈N.
(8) A(x,2y)< A(x+ 3, y)for all x, y∈N.
(9) If f, g1, . . . , gr ∈Bm and h =f ◦(g1, . . . , gm) then there exists a natural number m0 (depending onm and r) such thath∈Bm0.
(10) If g, h∈Bm and f is dened by primitive recursion from g andh thenf ∈Bm+4.
Prove (possibly using some of the information above) that:
I) 0< A(0,0)for all n∈N II) πir(n1, . . . , nr)< A(0,Pr
i=1ni)for all n1, . . . , nr∈N III) n+ 1< A(1, n) for alln∈N
IV) For every primitive recursive functionf there existsm∈Nwithf ∈Bm.
V) The Ackermann functionAckdened byAck(n) =A(n, n)is not primitive recursive.
∗1 B 225 sofronie@uni-koblenz.de https://userpages.uni-koblenz.de/~sofronie/
∗2 B 223 dpeuter@uni-koblenz.de https://userpages.uni-koblenz.de/~dpeuter/
If you want to submit solutions, please do so until 18.12.2017, 10:00 s.t. via the cardboard box in the shelf in room B 222 or via e-mail (with Homework ACTCS in the subject) to dpeuter@uni-koblenz.de.