CMPSCI 601: Theory of Computation

David Mix Barrington

Spring, 2003

This page currently contains interesting questions I have received from students in CMPSCI 601, together with my answers. These are questions related to the HW#6 -- links to earlier questions and answers are at the bottom of this page and the latest questions and answers are here. weeks. Questions are in black, answers in blue. Most recently answered questions are listed first.

Question 6.11, 22 April 2003

3b is my last stumbling block in the homework. I'm not sure what I'm allowed to do with the variables ng, nh, and ni or what nh and ni are. For instance, for the NOT gate, I start by saying (g iff !h) AND (ng iff h). Expanded, this gives me (!g OR !h) AND (h OR g) AND (!ng OR h) AND (!h OR ng). This is not Horn because of the (h OR g) clause. Can I simply replace g with !ng to get (h OR !ng) which is now Horn? Also, when I'm working with the OR gate, I end up with a clause (!g OR h OR i) in addition to others. Here, can I replace h with !nh for instance to get (!g OR !nh OR i)? My concern is that if I can do this, wouldn't it allow me to turn any CNF formula into a Horn formula simply by defining an extra $n$ n-variables?

You're trying to do too much. If gate G is a NOT gate in the circuit with input from gate H, you want to set the variables g and ng correctly given that h and nh are set correctly. You may assume (by induction, essentially) that one of h and nh will be set to true. At that point you need to set the correct variable from the set {g, ng} to true. And you can do that by Horn clauses.

But as I think I noted in class, you also need to make sure that your formula isn't accidentally satisfiable by a setting that makes both g and ng true, so you need a clause such as "!g OR !ng" which is Horn.

Question 6.10, 22 April 2003

In the TRIPARTITE MATCHING problem on page 199 of [P], when it says that no two of the triples have a component in common, does this mean that the triples are pairwise disjoint?

Yes, exactly. There are 3n items in total, and you want to find n triples such that together the triples include all 3n items. They have to be pairwise disjoint for this to happen.

Question 6.9, 21 April 2003

In lecture you showed that a logspace Turing machine can take n n-bit numbers and compute their sum. May we assume this result without proof in solving question 4?

Yes, that's the main reason I proved it for you.

Question 6.8, 18 April 2003

Hello, Dave. In thinking through a solution to the PARTITION problem, it's a little unclear to me what you can and cannot store in log-space. Below is my understanding. Could you confirm, clarify, or correct my explanation?

Given as input a graph G, we often talk about storing the 'current node' or 'current edge.' We can do this in log-space because we're actually storing a pointer to the ith node on the input tape. On the other hand, given as input a set of numbers (presumably coded in binary), we *cannot* store the 'current number.' Again we could store a pointer to the current number on the input tape, or we could compute and store the length of the current number, etc. But if we wanted to compare two of the numbers given as input, we would need to do something clever: i.e. we could compare their lengths, and then if lengths are equal, we could compare the numbers bit by bit, etc.

Yes, this is all correct, assuming that the input numbers are "long" (n bits, or sqrt(n) bits, just not as short as log n).

Note that comparing two numbers is a first-order question "there exists a bit position i such that A has a 1 there and B has a 0 there and for all higher-order bit positions j, A and B have the same value at j". We proved that all first-order properties are logspace -- the logspace algorithm, as you say, would sweep the two numbers from the high-order end looking for the first difference.

Often an apparent use of a large amount of intermediate memory can be avoided by using the "composition of logspace functions" result. For example, to multiply two n-bit numbers you can imagine a table of the partial products and then add up those partial products. The partial products can't be stored in log space but the two functions "input to partial products" and "partial product to final product" are _each_ logspace so their composition is logspace. It's instructive to think of how the actual logspace deterministic TM multiplies the two numbers.

Question 6.7, 18 April 2003

In question 3, part 1, I am verifying that the alpha, beta, eta, and zeta terms are each horn-CNF when the Turing machine is deterministic. I am having trouble with the alpha, where there is a term NOT R(0) -> C3(0,0). This will not convert to horn-CNF. I am attempting to solve this problem by redefining the R(i) relation from being return the ith symbol of the input (so return a 0=false or 1=true) to being two predicates:

I am wondering: is this allowable, or should I try to verify that alpha is horn-CNF in some other way? (or am I misinterpreting the R predicate?)

You're quite right, if you're trying to solve the problem of showing P equal to SOExists-Horn this way then it seems to me that you _have_ to redefine R as being two different predicates, as you suggest. And my problem statement suggests that you do this.

But actually this issue doesn't come up in proving HORN-SAT to be P-complete (the given problem), because the function that takes the input to a Horn-CNF formula replaces the input predicate with a constant 0 or 1. So it's being negated doesn't count against the Hornishness of the clause.

Question 6.6, 16 April 2003

Some questions on problem 3 on homework 6:

1) For the alpha term of phi in the proof of Fagin's theorem, why are the two implications needed in the sentance to define the input bin(A)? Can we just get away with a conjuction of statments that say (informally) "cell 0,0 is w0", "cell 1,0 is w1", and so on? This appears to be how Sipser encodes this requirement.

Your statement "C(0,0) = w(0)" is an iff of two booleans, so it's also two implications. Neil wants to write all these clauses in terms of implications so the whole formula will be as close to Horn as possible.

2) You say that eta_0 and eta_2 "encode the same information when s = 0 and max respectively". This seems to be referring to the beginning and end of the rows, but do these sentances differ in any other way from eta_1? For instance, is eta_0 missing the a-1 term because it is on the far left of the row?

Yes, exactly, the formal statement must be slightly different on the ends because one of the three predecessor cells is missing.

3) When you use the variables t-bar and s-bar, is this just saying there is some sequence (vector) of digits which is encoding a particular time or space value?

Yes.

4) Is the syntax on slide 18.17 "forall t.t < max" the same as "forall t such that t < max"?

Yes.

5) Can you briefly explain the relationship between this proof and the Bloop implementation of the COMP predicate we saw earlier?

Before we argued that if were given an alleged computation of a TM, we could verify (with a p.r. function, or even a P or even an L function) that it is correct. We are doing the same thing here, but to get the full Fagin's Theorem result we are taking a bit more care to see that the verification can be made by a first-order formula. It is exactly the same test, that the computation begins with the start configuration on w, always proceeds according to the rules, and finishes with acceptance.

Question 6.5, 16 April 2003

I haven't given up trying to do this problem the way it's suggested in the book, by reducing from KNAPSACK, but if it's more obvious to me how to do a reduction from SUBSET-SUM is this ok?

Yes, certainly, the hint really seems to mean SUBSET-SUM. And you may use any NP-complete problem to reduce from, it's just a matter of which is easiest.

Question 6.4, 15 April 2003

For Question 5, should we prove that EXACT COVER BY 3-SETS, SET COVERING, and SET PACKING are in NP, or do you just want the reductions?

It is pretty obvious in each case that they're in NP, but you might as well make the case. For example, a "proof" at the level "3-Color is in NP because it asks whether there exists a coloring (O(n) bits) such that the coloring is valid (clearly P-testable)" would be enough. (Fagin's Theorem is your friend here.)

Question 6.3, 15 April 2003

I just want to clarify something in the book and on the homework. For question 4 we're to prove PARTITION is NP-complete and both you and the book suggest using the modified KNAPSACK problem. For the KNAPSACK problem, all items have positive integer weights. However, it seems as though for the PARTITION problem you're allowed ALL integers. Is this correct?

I was pulling my hair out trying to do the necessary reduction using only positive integers, so I hope negative integers are allowed!

No, [P] means positive integers here as well, though he forgot to say so. But if you have a solution that uses both positive and negative, you should be able to convert to an equivalent problem that has only positive weights. Note that [P] suggests you add more items. Hint -- if there are two huge items each of weight nearly K, you know that in any solution one of them will go on each side.

Question 6.2, 15 April 2003

On question 4 of HW 6 where we are asked to show that KNAPSACK is reducible to PARTITION, do you want us to give a log space reduction, or is a polynomial time reduction acceptable? Given an instance of KNAPSACK = <{w_1...w_m},k> my proposed reduction involves adding up all of these input numbers, the result of which might not be able to be stored on the work tape using only log space. If you do want a log space reduction, can I output some of my integers as a sum?

Remember that the logspace reduction doesn't need to store the sum on its _worktape_, just on the output tape.

It is true, though perhaps not obvious, that the ITERATED-ADD problem (input n n-bit numbers, output their sum) is in LOGSPACE. (Hint: when you do this by hand, how much _worktape_ do you need, remembering that your output is write-only.)

I'll give you nine out of ten for a PTIME reduction that isn't shown to be logspace.

Question 6.1, April 2003

You imply in Question 3, Part 1 that it's the "Delta" (Δ) part of the construction that keeps all the clauses from being Horn in the nondeterministic case. But on slide 17 of Lecture 18, the formula with the big AND sign in front of it seems to be Horn already, even though it contains Delta.

Ah, there's a confusing bit of notation here that I should have explained. Remember that the small-delta (δ) variable here represents a bit. In front of the capital Delta is a negation sign raised to the power "delta". What this means is that there is a negation sign there if delta is 1 and no negation sign if delta is zero. (The notation is by analogy to "(-1)d" where d is zero or one.) So if delta happens to be zero, there is no negation sign here and the clause has two positive literals and thus fails to be Horn.

Answers to Questions during HW#5 (through 9 Apr 2003)

Answers to Questions on the Midterm

Answers to Questions during HW#4 (through 26 Mar 2003)

Answers to Questions during HW#3 (through 17 Mar 2003)

Answers to Questions during HW#2 (through 3 Mar 2003)

Answers to Questions during HW#1 (through 12 Feb 2003)

Last modified 22 April 2003