You have 24-hours to finish this test.  The test must be returned by Friday at midnight at the latest.  You are allowed to use your text and your notes for this text, but no other references.  You are permitted to discuss this exam only with the instructor until after the Friday deadline.

1. Show that {a, b}* - L, where L is the language

L = {babaaba3. . .ban-1banb: n>=1}

is context-free.

2. The stack machines we use make moves independent of their input unless they perform a scan operation. We could relax this restriction and allow the input symbol scanned to influence the move even when the input head remains stationary (a sort of peek operation). Show that this extension still accepts only CFLs (in other words these machines are no more powerful than normal stack machines).

3. By analogy with a universal Turing machine, a universal counter machine would accept a pair of strings coding a counter machine and an input, and simulate the machine computing the input. Explain why a universal counter machine cannot exist (in this problem we are dealing with single-counter machines only).

4. Professors Curly, Moe, and Larry report discovering an algorithm with the following marvelous property: On input of a deterministic TM program P, it outputs a deterministic TM program P' such that P and P' are guaranteed to compute different functions. Duplicate their feat, or prove that it is impossible.

5.  TRUE/FALSE questions:

a)  The proof to the halting problem implies that you can never tell if a given program will halt.
b)  A Turing machine with two read/write heads is more powerful than one with only one.
c)  The answer to this question is True.
d)  The answer to this question is False.

6.p is called a larger of twin prime if p and p - 2 are both primes. (5, 7, 13, 19) are larger twin primes.) Let T(0) = 0, T(n) = the nth larger twin prime. It is widely believed, but has not been proved, that there are infinitely many larger twin primes. Assuming that this is true prove that T(n) is computable.

7.  Fill in the blanks  (Thanks to Steve Fisk)

Kermit:  This is ___________ the Frog reporting for Sesame Street News.  Today we interview Professor Biskit who works on cookie research.  Hello Professor Biskit, what have you got there?

Prof:  Accch, I am trying to find out if there is such a thing as an infinitely long cookie.  This machine will produce every sort of cookie possible:  big cookies, little cookies, square cookies, round cookies.  The cookies come out this hole here.

Kermit:  You mean if you get a really long cookie, it will come out of the hole like a sausage?

Prof:  Yaaas, that's right.  Now I will set the machine going, and we can start watching de cookies.

GRRRRRRUNNNNNNNNNCCCHHHHHH     CHUGGAA  CHUGGAA CHUGGA . . .

Prof:  And here comes one . . .

CLUNK

Cookie Monster:  Cooookie!!  Chomp.

Prof:  And another.  This one is square.

CLUNK

Kermit:  Uh, Professor . . .

Prof:  Don't bother me now, I'm watching cookies.

Kermit:  What if there isn't an infinitely long cookie?

Prof:  Then they will come out of this machine forever - there is an infinite number of cookies you know.

Kermit:  And what if the machine starts making an infinitely long cookie?

Prof:  That's obvious you frong, I will have to wait for it to come out.

Kermit:  And how long will that take?

Prof:  _______________

Kermit:  So if there isn't an infinitely long cookie, you have to wait forever, and if there is, you have to wait forever too.  How are you going to find out if there is an infinitely long cookie today?

Prof:  Don't interrupt.  Here comes a triangular one with purple spots.

Cookie Monster:  CRUNCH.  _____________   GULP.

Prof:  My machine!

Kermit:  Well, it looks as if the cookie monster has transcended the question of whether there is an infinitely long cookie by eating the cookie machine.  A good thing, as the computation was _______________.

8.  Who is the most electrifying person in entertainment today and why?