# Second Midterm Exam, Spring 2015

### Directions:

• Answer the problems on the exam pages.
• There are eight problems (some with multiple parts) for 125 total points plus 10 extra credit. Actual scale was A = 100, C = 60.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.
• Many useful definitions are given below.
• The first six questions are statements -- in each case say whether the statement is true or false and give a convincing justification of your answer -- a proof, counterexample, quotation from the book or from lecture, etc. You get five points for the correct boolean answer (so there is no reason not to guess if you don't know) and up to five for the justification.

```  Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 10 points
Q6: 10 points
Q7: 35 points
Q8: 30+10 points
Total: 125+10 points
```

The set N of natural numbers is {0, 1, 2, 3,...}, not quite as defined in Sipser.

If C is any class of computers, such as DFA's, CFG's, LBA's, TM's, strange variant TM's, etc.:

• AC = {<M, w>: M is a computer in C and w ∈ L(M)}
• EC = {<M>: M is a computer in C and L(M) = ∅}
• ALLC = {<M>: M is a computer in C and L(M) = Σ*}
• ALLEVENC = {<M>: M is a computer in C and L(M) includes all strings of even length in Σ*}. That is, ALLEVENC = {(M): (ΣΣ)* ⊆ L(M)}.
• ALLODDC = {<M>: M is a computer in C and L(M) includes all strings of odd length in Σ*}. That is, ALLODDC = {(M): Σ(ΣΣ)* ⊆ L(M)}.

A language is Turing recognizable (TR) if it is equal to L(M) for some Turing machine M.

A language is Turing decidable (TD) if it is equal to L(M) for some Turing machine M that halts on every input.

A language X is co-TR if and only if its complement is TR.

A function f from strings to strings is Turing computable if there exists a TM M such that for any string w, M when started on w halts with f(w) on its tape.

Recall that if A and B are two languages, A is mapping reducible to B, written A ≤m B, if there exists a Turing computable function f from Σ* to Σ* such that for any string w, w ∈ A ⇔ f(w) ∈ B.

A Deterministic Infinite Automaton (DIA) has a state set Q = {qi: i∈ N} = {q0, q1, q2,...}, a start state q0, a nonempty alphabet Σ, a final state set F ⊆ Q, and a transition function δ from Q × Σ to Q. It computes like a DFA, beginning at the left end of its finite input string, moving right one letter and updating its input string on every computation step, and finally accepting the input if and only if it finishes in a final state.

A Turing Computable DIA (TCDIA) is a DIA where the set F is Turing decidable and the function δ is Turing computable.

An All-String Turing Machine (ASTM) is a deterministic three-tape Turing machine with the following restrictions. The input alphabet Σ is {0, 1}, and the tape alphabet Γ contains Σ, a blank symbol, and perhaps other letters.

Tape 1 is read-only and gets the input string w on it, with a marker symbol at each end.

Tape 2, at any time during the computation, contains a string x ∈ Σ* between two marker symbols. At the beginning of the computation x is the empty string. The computation is divided into phases, during each of which Tape 2 remains unchanged. After the first phase x is changed to 0, after the second phase it is changed to 1, after the third to 00, and so on through all the possible strings of Σ* until or unless the machine accepts or rejects. No other computation takes place while Tape 2 is being updated at the end of each phase.

Tape 3 is read-write, and after every phase it is erased and reset to be blank, with two end markers that restrict the size of the useful portion of the tape to the current length of x.

As with the language of an ordinary TM, the language of an ASTM is the set of input strings w that cause it to eventually accept.

• Question 1 (10): True or false with justification: The language ALLEVENCFG ∩ ALLODDCFG is not Turing decidable.

• Question 2 (10): True or false with justification: The language ALLEVENCFG is Turing recognizable.

• Question 3 (10): True or false with justification: There exists a DIA whose language is neither TR nor co-TR.

• Question 4 (10): True or false with justification: The language of any TCDIA is TD.

• Question 5 (10): True or false with justification: The set of DIA languages and the set of TCDIA languages are both uncountable.

• Question 6 (10): True or false with justification: If a Turing machine M prints out the string w no matter what its input is, the description of M must be at least as long as w.

• Question 7 (35): These three questions all deal with the model of All-String Turing machines (or ASTM's) defined above.

• (a, 10) Explain, in terms of individual states and moves, how an ASTM can update the string on its Tape 2.

• (b, 15) Prove that if X is any language, X is Turing recognizable if and only if it is the language of some ASTM.

• (c, 10) Prove that if X is any language, X is Turing decidable if and only if it is the language of some ASTM that halts on every possible input.

• Question 8 (30+10): These questions deal with the ALLEVEN and ALLODD languages defined above.

• (a, 15) Prove that the language ALLEVENTM is not Turing decidable. (There are several valid ways to do this.)

• (b, 15) Prove that ALLEVENTMm ALLODDTM.

• (c, 10XC) Prove that the language ALLEVENCFG ∪ ALLODDCFG is co-TR.