Universität Koblenz-Landau FB 4 Informatik
Prof. Dr. Viorica Sofronie-Stokkermans∗1 28.11.2019
M.Ed. Dennis Peuter∗2
Exercises for Advances in Theoretical Computer Science Exercise Sheet 6
Due at 02.12.2019, 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 6.1
Prove that the following functions are primitive recursive:
1. cks :Nk →N, wheres∈N, dened for every n∈Nk by:cks(n) =s. 2. fac:N→N, dened for every n∈Nby:fac(n) =n!.
3. exp:N×N→N, dened for every (n, m)∈N×Nby:exp(n, m) =nm. 4. eq:N×N→N, dened for every (n, m)∈N×Nby: eq(n, m) =
(1 if n=m 0 otherwise.
Exercise 6.2
Consider the following primitive recursive functions:
I) f1 = +◦(− ◦(π21, c25),∗ ◦(π22, π22)) II) f2 =PR[(+1)◦0,∗ ◦((+1)◦π12, π22)]
III) f3 =PR[c11,∗ ◦(π13, π33)]◦((−1)◦π12, π22)
a) Which is the arity of f1, off2 and off3? (i.e. how many arguments does each of these functions have?)
b) What do these functions compute if all arguments are equal to 2?
c) What do these functions compute in general?
Exercise 6.3
Express in the formh(n) = 0 withh primitive recursive the following conditions:
I) nis between 5and 12, or nis unequal to 2m: n≥5 andn≤12, or n6= 2m .
II) nis greater than 20 and is a perfect square:
n >20 and∃k≤n:k∗k=n.
Exercise 6.4
Prove that the following functions are primitive recursive:
I) max:N2 →Ndened bymax(x, y) =
(x if x≥y y otherwise. II) min:N2 →Ndened bymin(x, y) =
(x if x < y y otherwise. III) even:N→Ndened by even(x) =
(1 if ∃k≤x: 2∗k=x
0 otherwise .
∗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 02.12.2019, 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.