# Final Exam, Spring 2017

### Directions:

• Answer the problems on the exam pages.
• There are eight problems (some with multiple parts) for 120 total points plus 10 extra credit. Actual scale was A = 100, C = 50.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.
• 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: 20+10 points
Q8: 40 points
Total: 120+10 points
```

If C is any class of computers, such as DFA's, CFG'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) = Σ*}

• EQC = {(M1, M2): M1, M2 are both computers in C and L(M1) = L(M2)}

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

It is Turing recognizable (TR) if it is equal to L(M) for any Turing machine M.

A function f from strings to strings 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.

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: Σ* → Σ* such that for any string w, w ∈ A ↔ f(w) ∈ B. If such an f exists that is computable in polynomial time, we say that A is poly-time reducible to B, written A ≤p B. If f is computable in log space, we say that A is log-space reducible to B, written A ≤L B.

A homomorphism from Σ* to Σ* is a function f that obeys the rule f(xy) = f(x)f(y) for any strings x and y. It is determined by the strings f(a) for each letter of Σ and f(ε) must be equal to ε.

A boolean matrix is one whose entries are each 0 or 1, and where we define "addition" and "multiplication" as the boolean operators OR and AND, respectively. If A and B are each n × n boolean matrices, the matrix product AB is the matrix C such that for each i and j, the boolean value Cij is the OR, over all k from 1 to n, of Aik ∧ Bkj.

Given this definition of matrix product, we define the language BMM (for "boolean matrix multiplication") to be {(A, B, C): AB = C} and the language IBMM (for "iterated boolean matrix multiplication") to be {(A1,..., An, C): A1A2...An = C}. The variables A, B, Ai, and C each range over n × n boolean matrices. That is, all the matrices in a product must be square matrices of the smae size, and the number of matrices in an iterated product must equal the size of the matrices.

The following language is proved to be NP-complete in the text or in Exercises, and you may assume without proof that it is NP-complete. (There are lots of other languages proved NP-complete in the course -- this is the one you will need on this exam.

• 3-COLOR = {G: G is an undirected graph and the vertices of G may each be assigned one of three colors so that no edge connects two vertices of the same color}

The language X over the alphabet {0, 1, #} is the set of strings in which every pair of #'s has at least one 1 between them.

The language Y over the alphabet {0, 1, #} is the set of strings w for which there exists a string v in {0, 1}* and strings x, y, and z in {0, 1, #}* such that w = x#v#y#v#z#.

The language Z is the set of encodings of undirected graphs G such that if the nodes of G are partitioned into any five sets, then there is at least one edge of G that has both its endpoints in the same set.

Given a directed acyclic graph G and a goal node g, we define three versions of a Race Game on G. A position in the Race Game is a tuple (p, x, y) where p is a player (White or Black), x is a node where White's token is, and y is a node where Black's token is. A move in the game from posiiton (p, x, y) is for player p to move their token from x or y along an edge of G. A player wins (and ends the game) by moving their token to g. If a player cannot move, they lose their turn but the game continues as long as the other player can move. If neither player can move, the game ends in a draw. Note that since the graph is acyclic, the game cannot continue forever.

In Version 1 of the game, there are no restrictions on the players' moves beyond the definition above. In Version 2, a move is prohibited if it would place the two tokens on the same node. In Version 3, a move is prohibited if it would take one player's token to a node that was ever occupied by the other player's token.

• Question 1 (10): True or false with justification: Assuming that P ≠ NP, the language EQDFA is in P.

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

• Question 3 (10): True or false with justification: The Myhill-Nerode equivalence relation of the language X (defined above) has exactly three equivalence classes.

• Question 4 (10): True or false with justification: The language Y (defined above) is context-free.

• Question 5 (10): True or false with justification: Assuming that NP and co-NP are not equal, the language Z (defined above) is NP-complete.

• Question 6 (10): True or false with justification: Let Σ = {a, b}. Let f be any homomorphism from Σ* to Σ*. (Homomorphisms are defined above.) Then for any language R, R is a regular language if and only if {f(w): w ∈ R} is a regular language.

• Question 7 (20+10): The definition of boolean matrix multiplication and of the languages BMM and IBMM are given above.

• (a, 10) Prove that the language BMM is in the circuit class AC0. Don't worry about uniformity.

• (b, 10) Prove that the language IBMM is in the circuit class AC1. Don't worry about uniformity.

• (c, 10XC) Prove that the language IBMM is complete for the class NL under ≤L reductions.

• Question 8 (40): These questions involve the three versions of the Race Game defined above.

• (a, 10) In Version 1 of the game, there are no restrictions on the two tokens occupying the same node. Prove that the set of positions in Version 1 of the game, for which White has a winning strategy, is in the class NL.

• (b, 10) Prove that the set of positions of Version 1 of the game, for which White has a winning strategy, is complete for NL under ≤L reductions. (You may assume the result of part (a).)

• (c, 10) In Version 2 of the game, the two tokens may not occupy the same position. Prove that the set of White-winning positions of Version 2 of the game is in the class P.

• (d, 10) In Version 3 of the game, no player may move their token to a node previously occupied by the other player. Prove that the set of White-winning positions of Version 3 of the game is in the class PSPACE.