Q1: 10 points Q2: 10 points Q3: 10 points Q4: 10 points Q5: 20 points Q6: 20 points Q7: 40 points Total: 120 points
FALSE. We know that the language {anbncn: n ≥ 0} is not context-free. But this language is in L -- to test whether a string w is in this format we first check that it is in a*b*c* and if it is, count the a's, b's, and c's to see whether the three numbers are the same. Counting up to n, the input length, takes only O(log n) space.
TRUE. We proved in class that any language in the class P has polynomial-size circuits. PATH is in P because we can carry out a breadth-first or depth-first search of G from s in polynomial time, and accept iff we find t in this search.
TRUE. B must be Turing decidable, and it cannot be ∅ or Σ* because these languages are not NP-complete even if P = NP. We proved that any language mapping-reducible to a TD language is itself TD.
FALSE. There is no reason that a halting Turing machine must exist that can produce the circuits -- we are told only that they exist. In lecture we gave the example of the language {w: |w| = n and the binary description of n describes a TM that halts on blank input}. This language is clearly not TD, but for every input size there is a small circuit that either accepts all strings of that length or rejects them all.
We reduce ATM to the complement of ELOGSPACE. Let
(M,w) be any input to ATM -- we create a logspace TM called N
such that N accepts a string if and only if it describes an accepting
computation of M on w. N must check that its input is a sequence of valid
configurations of M, that the first of these configurations represents the
start position of M on input w, that each configuration after the first
follows from the one before it by the rules of M, and that the last
configuration is accepting. This is a mapping reduction from ATM
to the complement of ELOGSPACE because N has a non-empty
language if and only if M accepts w.
It remains to show that we can build such an N that runs in space
that is logarithmic in its input length. The time to test the first
configuration depends only on M and w, not the length of the input -- it is
O(1). To test that each configuration follows from the one before, we must
compare each corresponding place in the two configurations to see that the
rules of M have been followed. This requires a counter that records a
number that is less than n, the input size of N, so it takes only O(log n)
space. Finally checking for the accepting configuration takes only O(1)
space.
Let G be an arbitrary context-free grammar. We know that G can be converted
into Chomsky normal form without changing its language. Given G in this form,
we can determine which non-terminals of G, if any, can generate strings of
terminals. This is true for any non-terminal A that has an "A --> a" rule,
and recursively it is true for any A that has an "A --> BC" rule where B and
C are already known to generate strings of terminals. We mark the
terminal-generating non-terminals as we find them, and if we ever make a pass
over the rules without finding a new terminal-generating non-terminal, we have
found all of them. We then accept if and only if S generates a string of
terminals.
Sipser gives a slightly different proof -- we know we can test any
individual string for membership in L(G) with a halting Turing machine. From
the proof of the CFL Pumping Lemma we know that if L(G) contains any strings
at all, it must contain a string of length at most p, where p is a constant
computable from the number of terminals and non-terminals in G. So we can
test all strings up to this length, and report that L(G) is empty if and only
if none of these strings is in L(G).
For any fixed n, fixed finite Σ, and fixed set of rules, the number of feasible n by n boxes is finite because it is bounded by |Σ|n2. All finite languages are regular because we can make an NFA that has an accepting path for each string in the language.
We need to check, for each pair of numbers (i,j) with 1 ≤ i ≤ n-2 and 1 ≤ j ≤ n-2, whether the 3 by three box centered at (i,j) follows the rules. The check takes O(1) time and space once we have read the contents of the 3 by 3 box onto a work tape. Making sure that we have tried all possible i and j requires two counters ranging up to n, or O(log n) space.
(Note that proving both would prove that P = NP, which is probably not true
and almost certainly not proved by something you could come up with during an
exam.)
In fact BOX is NP-complete. We can reduce an arbitrary NP language to
BOX by a construction very similar to the Cook-Levin Theorem. Let M be a
one-tape NDTM with time bound p(m) and thus space bound p(m) on inputs of
length m. For any string w of length m in the proper alphabet, we want to
create an input f(w) to the BOX problem such that w is in L(M) if and only if
f(w) is in BOX.
The instance f(w) will have n = p(m), an alphabet that is the union of
M's state set and tape alphabet, a border that puts a start configuration of
M on the bottom and an accepting configuration at the top (we modify M to have
a unique accepting configuration), and rules that make sure that the box can
only be filled with the tableau of a valid computation of M. We know from the
proof of Cook-Levin that it is sufficient to check all 2 by 3 subboxes, and our
rules for 3 by 3 boxes can make sure that all 2 by 3 subboxes are valid.
Last modified 11 May 2008