# Second Midterm Exam, Spring 2009

### Directions:

• Answer the problems on the exam pages.
• There are seven problems for 120 total points. Probable scale is around A=100, C=70 but will be determined after I grade the exam.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.
• The first five 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: 30 points
Q7: 40 points

Total: 120 points
```

• Question 1 (10): True or false with justification: Define a bizarro Turing machine to be like an ordinary deterministic one-tape Turing machine except that the tape alphabet Γ is countably infinite, so that Γ = {a1, a2, a3,...}. The input alphabet Σ is still finite. The transition function δ from (Q × Γ) to (Q × Γ × {L, R}) can no longer be given by a finite lookup table, but it is computable by an ordinary Turing machine (that always halts).

Given this definition, there exists a bizarro Turing machine B whose language L(B) = {w ∈ Σ*: B halts in its accepting state on input w} is not TR.

• Question 2 (10): True or false with justification: It is possible to have a countably infinite family S1, S2, S3,... of countably infinite sets, such that for any positive integers i and j where i ≠ j, the intersection Si ∩ Sj is a nonempty finite set. (Recall that a set is countably infinite if and only if it can be put into one-to-one correspondence with the positive integers.)

• Question 3 (10): True or false with justification: For every ordinary Turing machine M with input alphabet Σ and every string w in Σ*, the set of accepting computation histories of M on w is a regular language.

• Question 4 (10): True or false with justification: If f is a one-to-one function from {0, 1}* to {0, 1}*, and n is a positive integer, then there must exist a string w of length n such that the length of f(w) is at least n.

• Question 5 (10): True or false with justification: Recall that an LBA is a deterministic one-tape Turing machine that never leaves the portion of its tape that originally contained its input. Define ALLLBA to be the set {<M>: M is an LBA with input alphabet Σ and L(M) = Σ*}. Then the language ALLLBA is not TD.

• Question 6 (30): A Latin square is a d by d matrix of numbers, each in the set {1, 2, 3,..., d}, such that each row and each column has each possible number exactly once. (For example, a solution to a standard Sudoku puzzle is a 9 by 9 Latin square that also has an additional property.) Let LS be the following language: A string in {a, b}* is in LS if it is of the form ai1bai2bai3b... ainb where n is equal to d2 for some positive integer d, each ij is in the set {1, 2, 3,..., d}, and the numbers i1, i2,..., in form a Latin square if arranged into a d by d matrix in row-major order. Describe a deterministic k-tape Turing machine deciding the language LS, where k is a fixed positive integer of your choice.

• Question 7 (40): Let Z be the language {<M1, M2>: M1 and M2 are Turing machines and there exists a string w such that M1 and M2 both accept w and M1 does so in fewer steps than does M2}. Here are four questions concerning Z. Your answers to some may imply answers to others --- it is fine to quote your solutions to other problems, but beware of circular reasoning!

• (a, 10) Is the language Z a TR language? Prove your answer.

• (b, 10) Is the language Z a TD language? Prove your answer.

• (c, 10) Is it true that ATMm Z? Prove your answer by either describing a mapping reduction or proving that it cannot exist.

• (d, 10) Is it true that ATMm Z? Prove your answer by either describing a mapping reduction or proving that it cannot exist.