# Second Midterm Exam, Spring 2012

### Directions:

• Answer the problems on the exam pages.
• There are eight problems for 120 total points plus 10 extra credit. Actual scale was A = 98, C = 62.
• 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: 30+10 points
Q8: 30 points
Total: 120+10 points
```

If C is any class of computers, such as DFA's, CFG's, LBA's TM, 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) = Σ*}
• EQC = {(M, N): M and N are computers in C and L(M) = L(N)}
• A function f: Σ* → Σ* is a C-complementer if for any computer M in C, f((M)) is a representation (M') of a computer M' in C such that L(M') is the complement of L(M), that is, L(M') = Σ* ∖ L(M).
• If D is another class of computers, then SUBC,D = {(M, N): M is a computer in C, N is a computer in D, and L(M) ⊆ L(N)}. So, for example, SUBNFA,TM = {(M, N): M is an NFA, N is a TM, and L(M) ⊆ L(N)}.

A queue machine (QM) is a deterministic machine with a finite state set and one additional memory organized as a queue. At any time step the QM sees the next input character and the character at the front of the queue. Its move is to dequeue that character, move to the next input character (if any), enqueue zero or more characters, and change its state. It has and accepting and a rejecting final state, and it may continue computing after finishing its input.

A right-end Turing machine (RETM) has one or more tapes, each of which has a \$ as its leftmost character. The first tape has the input after the \$, and the others (if any) have blanks. The head of each tape starts on the leftmost blank on its tape. The RETM must satisfy the following rule -- on each tape the head must always be either on the rightmost nonblank character of its tape or on the leftmost blank character of 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 function f: Σ* → Σ* such that for any string w, w ∈ A ↔ f(w) ∈ B. The languages A and B are mapping equivalent, written A ≡m B, if both A ≤m B and B ≤m A are true.

A language A is Turing recognizable (TR) if it equals L(M) for some Turing machine M. A is Turing decidable if A = L(M) for some Turing machine M that always halts. A function f is Turing computable if there exists a Turing machine M such that for any string w, M when started on w halts with f(w) on its tape.

• Question 1 (10): True or false with justification: The language SUBDFA,DFA is Turing decidable.

• Question 2 (10): True or false with justification: The language SUBCFG,DFA is Turing decidable.

• Question 3 (10): True or false with justification: The language SUBTM,DFA is Turing decidable.

• Question 4 (10): True or false with justification: The language SUBTM,DFA is Turing recognizable.

• Question 5 (10): True or false with justification: The language AQM is Turing decidable.

• Question 6 (10): True or false with justification: The language ALLCFG and the complement of the language ATM are mapping equivalent.

• Question 7 (30): These questions all deal with the definition of a C-complementer above.

• (a, 5): Demonstrate that a Turing computable NFA-complementer exists by explaining informally how it would work.

• (b, 10): Assume that a Turing computable TM-complementer exists. Using this assumption (which we will prove to be false below), prove that every Turing recognizable language is Turing decidable.

• (c, 5): Explain why the existence of a Turing computable TM-complementer would contradict the Recursion Theorem.

• (d, 5): Prove that no TM-complementer can exist, whether Turing computable or not.

• (e, 5): Does a Turing computable CFG-complementer exist? Justify your answer.

• (f, 10XC): Does a Turing computable LBA-complementer exist? Justify your answer carefully. (Recall that an LBA is a one-tape TM that never moves right of the area originally holding its input.)

• Question 8 (30): This question deals with the definition of right-end TM's above.

• (a, 10): Explain how to determine, from the state table (the δ function) of an ordinary Turing machine, whether it obeys the RETM restriction. Assume that your ordinary TM will start with the first tape's head to the right of the input, as is defined to be the case for an RETM.

• (b, 10): Explain why the language of any one-tape RETM is Turing decidable.

• (c, 10): Explain why the language ARETM, where the RETM's are allowed to have more than one tape, is not Turing decidable.