Second Midterm Exam, Spring 2011

Directions:

• Answer the problems on the exam pages.
• There are eight problems for 125 total points. Actual scale was A=100, C=64.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.
• The first six questions are true/false, with five points for the correct boolean answer and up to five for a correct justification of your answer -- a proof, counterexample, quotation from the book or from lecture, etc. -- note that there is no reason not to guess if you don't know.

Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 10 points
Q6: 10 points
Q7: 40 points
Q8: 25 points

Total: 125 points

Some questions refer to two particular kinds of one-tape deterministic Turing machines. A Double=move Turing machine (DMTM) always moves exactly two squares left or right on a move. A Double-right Turing machine (DRTM) moves two squares when it moves right, but one square when it moves left. Recall that our Turing machines start on the leftmost square of the tape, on the first letter of the input (if any), and do not move if they are ordered to move left from leftmost square. We define ADMTM to be the set of pairs (M, w) where M is a DMTM, w is a string over the correct alphabet, and w ∈ L(M). We define ADRTM similarly.

The language REGCFG is the set of context-free grammars G such that L(G) is regular.

The language REGTM is the set of Turing machines M such that L(M) is regular.

The language CFLDFA is the set of DFA's M such that L(M) is a context-free language.

Recall that for two languages A and B, A ≤m B means that there is a function f, computed by a Turing machine that always halts, such that for any string w, w ∈ A if and only if f(w) ∈ B.

• Question 1 (10): True or false with justification: Any regular language is the language of some DMTM, as defined above.

• Question 2 (10): True or false with justification: REGCFGm REGTM, where these languages are defined above.

• Question 3 (10): True or false with justification: Recall the construction from the proof in Sipser that ALLCFG is not decidable. Define the function f to take a Turing machine M and a string w and output the grammar, given by that construction, for the language of all strings that are not acception computation histories of M on w. Then f proves that ATMm REGCFG, i.e., f is a mapping reduction from ATM to REGCFG.

• Question 4 (10): True or false with justification: The language CFGDFA, defined above, is Turing decidable.

• Question 5 (10): True or false with justification: Any Java program that always outputs the same string w must be longer, as a string, than w itself.

• Question 6 (10): True or false with justification: It is not true that REGTMm ATM.

• Question 7 (40): Two types of Turing machines, DMTM's and DRTM's, were defined above.

• (a,10) If M is any ordinary one-tape Turing machine, prove that there exists a DRTM M' such that L(M) = L(M').

• (c,10) If M is any ordinary one-tape Turing machine, prove that there is a language X such that X is the language of some DMTM and L(M) ≤m X.

• (d,10) Prove that ATMm ADMTM.

• Question 8 (25): Recall the Regular Language Pumping Lemma and the CFL Pumping Lemma. We say that a language A "regular-pumps at the beginning" if there exists a number p such that for every string w with w ∈ A and |w| ≥ p, w can be written as xyz where |xy| ≤ p, |y| > 0, and for all i, xyiz is in A.

We say that A "CFL-pumps at the beginning" if there exists p such that for every string w with w ∈ A and |w| ≥ p, w can be written as uvxyz where |uvxy| ≤ p, |vy| > 0, and for all i, uvixyiz is in A.

• (a,10) Review the argument that every regular langauge regular-pumps at the beginning. You may be informal, but make clear why the condition |xy| ≤ p can be guaranteed.

• (b,15) Prove that it is not true that every context-free language CFL-pumps at the beginning.