Q1: 10 points Q2: 10 points Q3: 10 points Q4: 10 points Q5: 10 points Q6: 30 points Q7: 20+10 points Q8: 20 points Total: 120+10 points
Question 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.
Although we did not prove this in lecture, you may assume both:
Congressman Bob Forehead is the chair of a powerful House commmittee. He is preparing the final draft of a bill and must decide exactly which provisions, out of a set {p1,..., pn}, he will include in it. He is in contact with a set of m lobbyists, each of who has a set of one or more requests -- a request may be to include a particular provision in the bill, or to not include a particular provision. Bob wants to make all the lobbyists happy, which he can do by fulfilling at least one request on each lobbyist's list.
Let BILLCHECK be the set {(B, LL): B is a bill, LL is a list of lobbyist requests, and every lobbyist is happy with the bill because B fulfills at least one request on every list in LL}.
Let POSSIBLE be the set {LL: LL is a list of lobbyist requests such that some bill exists that makes all the lobbyists happy}.
A transposition Turing machine or TransTM has a state set Q, an input alphabet Σ, and a tape alphabet Γ like an ordinary TM, except that here Γ = Σ ∪ {$}. For an input string w, the TransTM's single tape begins with contents $w$, in the initial state with the read head on the first $. There are two final states, one accepting and one rejecting, and the machine halts when it reaches either of these states.
The transition function δ is from Q × Γ to Q × {TL, TR, I} × {L, R}. When in state p and reading an a, the machine takes one of three actions on the tape: if the middle component of δ(p, a) is TL, it switches the current letter with the one to its left. If it is TR, it switches the current letter with the one to its right, and if it is I it does not change the tape. It then moves the read head left or right (from the new current letter) depending on the last component of δ(p, a). If it is on the first or last character of the take, it may not change the tape.
TRUE. Suppose it were; let p be the constant for the language given by the CFL Pumping Lemma and let w be the string apbp2. Then by the CFLPL, w = uvxyz where vy is nonempty and for all i, uvixyiz is in the language. We will derive a contradiction from this assumption. If vy consists of all a's or all b's, then the string uxz is not in the language because the number of its b's is not the square of the number of its a's. If either v or y contains both a's and b's, then the string uv2xy2z is not in a*b* and thus cannot be in the language. The only remaining possibility is that v = aj and y = bk for some nonzero j and k. We are then given that for any i, since the string uvixyiz is in the language, that p2 + (i-1)k = (p + (i-1)j)2. This is possible for at most one value of i other than 1, since it implies the equation k = (i-1)j2 + j, which has at most one solution for i.
TRUE. It is true that if the machine ever finds an a when in state p, and there is a b right after the a, then it will loop forever. But there is no reason this ever has to happen. For example, the machine might go from its initial state to the accepting state on any possible letter, so that it accepts any input string.
FALSE. The language ECFG meets all these conditions, and was shown to be Turing decidable both in lecture and in Sipser. (There are many examples of other languages, like ALLCFG, that meet these conditions and are not TD, but one counterexample suffices to make the given statement false.) This statement is similar to that of the Rice-Myhill-Shapiro theorem, but that theorem applies to Turing machines rather than grammars.
TRUE. Z could be SAT, which is not in P given the assumption that P ≠ NP, and Y could be the set of pairs (u, v) such that u is a setting of n boolean variables, v is a formula with n boolean variables, and v(u) is true. This language Y is clearly in P because we need only evaluate the truth of the formula on the given setting.
TRUE. Many classes that we studied are closed downward under p-reductions, but the class LBA provably is not. Proving this, however, takes an idea that we did not cover in class. Let D be the language given by our assumption, let $ be a new letter not in the input alphabet of D, and let E be the language {u$n2: |u| = n and u ∈ D}. E is in the class LBA, because we can decide whether a string is in E by counting the $'s (rejecting if the number of them is wrong), stripping them off, then deciding whether the remaining string u is in D. This takes space O(n2) where |u| = n, and this is linear in the size of the input, so this decision procedure puts E in LBA. Clearly we can poly-time reduce D to E by taking an input u and appending the correct number of $'s. So we may let L2 be D and let L1 be E.
For each lobbyist, we must loop through their list of requests and check whether each one is fulfilled by the bill, breaking the loop if one is and rejecting if we reach the end of the list without any being fulfilled. If the lists of the requests and the list of provisions in the bill are in read-only memory, then the only memory we need to carry out this decision procedure is the indices for the two loops, which take O(log n) space each.
The language POSSIBLE is in NP because it is the set of requests LL for
which some bill B exists such that (B, LL) is in BILLCHECK, and
our
proof in (a) suffices to show that BILLCHECK is in P.
So BILLCHECK is a poly-time verifier for POSSIBLE. (We do need to
assume
here that the format for lobbyist lists requires that a list
cannot be much shorter than the bill in question, so that we know
that "polynomial in |B|" and "polynomial in |LL|" are the same
thing.)
To show that POSSIBLE is NP-complete, we reduce the known
NP-complete problem CNF-SAT to it. Given an formula φ in CNF,
with n boolean variables, we construct a lobbyist list f(φ) where
the bill has n provisions, there is a lobbyist for each clause of
φ,
and the requests for each lobbyist are to include all provisions
that occur positively in the clause and to not include any provisions
that occur negatively. The clause is then satisfied if and only if
the lobbyist is happy, and φ is satisfiable if and only if some
bill exists making all the lobbyists happy, which is true if and only
if f(φ) is in POSSIBLE. The function f is clearly computable in
polynomial time.
Yes, both remain true. The algorithm of (a) is unchanged, and the reduction of (b) applied to the language 3-SAT always produces a lobbyist list meeting this restriction. Since 3-SAT is NP-complete, the same reduction proves that the restricted version of POSSIBLE is NP-complete.
Let L be an arbitrary regular language and let M be a DFA whose language is L. We can easily build a TransTM that simulates M. It has a state set matching M's, plus the accepting and rejecting states. It begins in M's start state and moves right on every move, never changing the tape. When it reaches the $ on the right end of the tape, it moves into its accept state if it is in a final state of M and into its reject state if it is in a nonfinal state of M. (I took off some points if you neglected the fact that the terminating condition of the TransTM is different from that of a DFA.)
One easy way to prove this is to note that a TransTM can be simulated
by an LBA (a deterministic Turing machine that never uses space to the
right of its input), and we know from lecture and from Sipser that
ALBA is Turing decidable.
More directly, we can note that on an input w of size n, the
number of possible configurations of the TransTM is bounded. (For
example, there are O(1) possible states, n+2 possible head
positions, and (n+2)! possible tape contents since the letters on
the tape are always a permutation of the original letters.) We
can simulate the TransTM for a number of steps exceeding this
number of configurations. If it is still running, we can reject
the input since it must have repeated a configuration and thus now
it is in an infinite loop.
We show that the language {0n1n: n ≥ 0},
shown in lecture and in Sipser to be non-regular, is the language
of a TransTM. My solution was to have the TransTM first check
that the input is in 0*1*, then move the 0's
and 1's on the tape to be alternating 010101..., accepting if and only
if they can be rearranged to be in the language (01)*.
Some of you came up with another solution that is at least as good, and
arguably better. It uses the fact that you
are allowed to
move the $'s, as long as you didn't change the tape when the head
was on their initial positions. Check that the input is in
0*1*, then alternately transpose the left $ with
a 0 and transpose the right $ with a 1, accepting only if this process
ends with the two $'s adjacent.
Let L be an arbitary regular language and let M be a DFA whose
language is L. On input w of length n, the DFA does n individual
computations, one on each letter. We can build circuit elements
of O(1) size to carry out each of these computations. By coding
letters and states as strings of O(1) boolean values, we can
represent the computation of δ(p, a) from p and a as a
function with O(1) boolean inputs and O(1) boolean outputs. We
observed in our proof of the Cook-Levin Theorem that any such
function may be computed by a circuit with O(1) gates. The
entire circuit does these n computations sequentially, using O(n)
size, concluding with a circuit element that tests whether the
concluding state is final.
The depth of this circuit is O(n). It is possible to make
this same test in O(n) size and O(log n) depth, as we did for the
particular regular language PARITY in lecture.
This follows from two results proved in lecture and in Sipser -- that
every CFL is in the class P and that any language in P can be
decided by a circuit family of polynomial size.
More directly, we can implement the CKY algorithm with
circuits as follows.
Let L be a context-free language with Chomsky Normal Form grammar
G, and let w be an input of length n. For every nonterminal A in
the grammar, and every pair of numbers i and j with 1 ≤ i ≤
j ≤ n, our circuit will have a gate gA,i,j that
will have value 1 if and only if it is possible to derive the
string wi...wj from A by the rules of G.
If i = j, the gate gA,i,i is the output of a circuit
(of O(1) size) that tests whether A --> wi is a rule of G.
Otherwise gA,i,j is the OR, over all numbers k with i ≤
k < j and all nonterminals B and C, of the AND of gB,i,k
and gC,k+1,j. The output of the circuit is the gate
gS,1,n. There are O(n2) gates of the form
gA,i,j, and for each we need O(n) gates to calculate its
value,
making our entire circuit O(n3) size.
Last modified 18 May 2014