CMPSCI 501: Theory of Computation

Solutions to Final Exam, Spring 2015

David Mix Barrington

Exam given 1 May 2015

Solutions posted 24 June 2015


  Q1: 10 points
  Q2: 10 points
  Q3: 10 points
  Q4: 10 points
  Q5: 10 points
  Q6: 30 points
  Q7: 40+10 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, LBA's, TM's, strange variant TM's, etc.:

A language 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.

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

The following languages were proved to be NP-complete in the text or in Exercises, and you may assume without proof that each of them is NP-complete:

King Arthur has n knights, including Sir Galahad and Sir Lancelot, and at any given time some of them may be quarreling with others. The relation Q(a, b) is defined to mean "knight a is quarreling with knight b", and this relation is assumed to be symmetric (that is, Q(a, b) → Q(b, a)). King Arthur himself is not quarreling with any knights.

Arthur of course has a Round Table at which he wishes to seat all the knights, without having two quarreling knights seated next to one another. Sometimes he sits at the table himself, with Sir Lancelot at his right and Sir Galahad on his left, but other times only the n knights are seated. (There is no empty seat in the latter case -- assume that the number of seats is always exactly what is needed.)

The language SEAT-CHECK is the set of pairs (Q, S) where Q is a list of which knights are quarreling with which, S is a seating arrangement for the table, and S does not have two quarreling knights seated next to one another.

The language SEAT-WITH-ARTHUR is the set of quarreling lists Q such that Q permits some arrangement of the n knights and Arthur at the table, with Galahad and Lancelot on either side of Arthur, and no quarreling knights seated next to one another. The language SEAT-WITHOUT-ARTHUR is the similar language where only the n knights must be seated.

Arthur also periodically sends all the knights out on quests, and he does not want to send two quarreling knights on the same quest. The language TWO-QUEST is the set of quarreling lists Q such that Q allows for a division of all the knights into two sets, neither of which contains a quarreling pair. The problem (not language) MIN-QUEST is to input a quarreling list Q and determine the minimum number of quests on which all the knights could be sent without a quarreling pair being sent on the same quest. (For example, if no knights are quarreling at all, the output of MIN-QUEST is 1.)

A Limited Alphabet Turing Machine is a two-tape deterministic Turing machine with a read-only input tape and a single read-write work tape. The input tape contains the input string w ∈ Σ*, with a special symbol $ on each end that is not part of Σ. The work tape alphabet Γ contains a blank symbol but need not include any letters of the input alphabet Σ. The leftmost cell of the work tape contains a special symbol $ that is not part of Γ and may not be overwritten.

In an LATM(k), the alphabet Γ has exactly k symbols, including the blank symbol but not including the special symbol $. The transition function δ of the machine is this a function from Q × (Σ∪{$}) × (Γ∪{$}) to Q × Σ × Γ × {L, R}2.

Last modified 24 June 2015