CMPSCI 501: Theory of Computation

Solutions to Final Exam, Spring 2017

David Mix Barrington

Exam given May 2017

Solutions posted 19 May 2017


  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

Exam text is in black, solutions in blue.

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

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.

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 y 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.

Last modified 19 May 2017