Docsity

Midterm Examination in Theory of Computation: Questions and Answers, Exams of Computer Science

Toggle sidebar
bg1
CS 590 (Spring 1995) Midterm Name: Page
1
Midterm (Answer Key)
CS 590: Theory of Computation
16 March (Lecture No. 27)
This is a 50 minute, closed book examination|though you may bring a single 8.5x11 inch
(or A4) sheet of paper with whatever you want written on it. There are 100 possible
points. Write your answers on the exam.
Please be sure
to put your name on every page (at the top).
Question 1 (5 points)
Is the following function computable? Whyorwhy not?
f
(0) = 17
f
(
x
+1) =
y
y
X
i
=0
i
2
>f
(
x
)
!
Answer
Yes, since it is composed by recursion from minimalization and the
composition of computable functions.
Question 2 (5 points)
Is the set of prime Godel numbers an index set? Is it recursive? Is
it recursively enumerable? Answer all three questions, and justify your answers.
Answer
It is in fact the set of prime numbers, which is recursive. It is not an
index set. If it were, it could not be recursive, by Rice's Theorem.
Question 3 (5 points)
Consider the following function:
f
(
x
) =
(
x
(
x
)+1 if
x
(
x
)
#
0 otherwise
Is
f
computable? Whyorwhy not?
Answer
No. Suppose, to the contrary, that
f
(
x
)=
e
for some
e
. Then if
e
(
e
)
#
then
f
(
x
)
6
=
e
(
e
). Otherwise
e
(
e
)
"
but
f
(
x
)
#
0. In either case
f
(
x
)
6
=
e
(
e
),
contrary to assumption.
pf3
pf4

Partial preview of the text

Download Midterm Examination in Theory of Computation: Questions and Answers and more Exams Computer Science in PDF only on Docsity!

Midterm (Answer Key)

CS 590: Theory of Computation

16 March (Lecture No. 27)

This is a 50 minute, closed b o ok examination|though you may bring a single 8.5x11 inch (or A4) sheet of pap er with whatever you want written on it. There are 100 p ossible p oints. Write your answers on the exam. Please b e sure to put your name on every page (at the top).

Question 1 (5 p oints) Is the following function computable? Why or why not?

f (0) = 17

f (x + 1) = y

X^ y

i=

i^2 > f (x)

Answer Yes, since it is comp osed by recursion from minimalization and the comp osition of computable functions.

Question 2 (5 p oints) Is the set of prime Godel numb ers an index set? Is it recursive? Is it recursively enumerable? Answer all three questions, and justify your answers.

Answer It is in fact the set of prime numb ers, which is recursive. It is not an index set. If it were, it could not b e recursive, by Rice's Theorem.

Question 3 (5 p oints) Consider the following function:

f (x) =

x (x) + 1 if x (x) # 0 otherwise

Is f computable? Why or why not?

Answer No. Supp ose, to the contrary, that f (x) = e for some e. Then if e (e) # then f (x) 6 = e (e). Otherwise e (e) " but f (x) # 0. In either case f (x) 6 = e (e), contrary to assumption.

Question 4 (10 p oints) Is it p ossible to write a URM program to take two Godel numb ers x and y as input and to pro duce the Godel numb er of a program which halts precisely when b oth Px and Py halt? Be sure to justify your answer. (Note: do not provide a program or an algorithm.)

Answer This is asking if there is a computable function s(x; y ) such that Ws(x;y ) = Wx \ Wy. By the smn theorem (and Church's thesis), there is indeed such a function, de ned so that

s(x;y ) (z ) =

1 if x (z ) # and y (z ) # " otherwise

Question 5 (10 p oints) Prove that P = fx : Wx  Primesg is not recursive, using Rice's Theorem. (\Primes"is the set of all prime numb ers.)

Answer This is clearly a non-trivial index set (details of which claim are left to the reader).

Question 6 (10 p oints) Is P in Question 5 recursively enumerable? Why or why not?

Answer No. Supp ose d is the Godel numb er of a program which diverges every- where. Then Wd = ;  Primes, so d 2 P. By a theorem in class, this makes P pro ductive, and hence not r.e.

Question 7 (10 p oints) Are there any recursive, creative sets? Why or why not?

Answer There are none. For a set C to b e recursive, its complement C would have to b e r.e. However, to b e creative, C must b e pro ductive, which means there is a computable function p(x) such that if We  C , then p(e) 2 C We , and so C = We is imp ossible for any e.

Question 11 (10 p oints) Show that K m T O T (recall that T O T = fe : We = N g).

Answer De ne f (x) by the smn theorem so that

f (x) (y ) =

0 if x 2 K " otherwise

Now, x 2 K i f (x) = 0 i f (x) 2 T O T , so f is the desired reduction.

Question 12 (5 p oints) Supp ose that T O T m A and A = ff (0); f (1); : : :g. What can you conclude ab out f?

Answer It cannot b e a total, recursive function. Otherwise, A would b e recur- sively enumerable, which would in turn imply that T O T is r.e. (by downward closure), which it is not.