![]() |
CSCI 256
|
Only turn in problems from the second section.
Please do problem 36.2-8 on page 929 in CLR.
Solution: Note that phi is a tautology iff not-phi is not satisfiable. Therefore TAUTOLOGY = {phi | not-phi is not satisfiable} = the complement of {phi | not-phi is satisfiable}. The set {phi | not-phi is satisfiable} is in NP for the same reason that SAT is in NP: Let a certificate be an assignment of values to the propositional variables that makes not-phi true. It is easy to check the truth-value of not-phi in polynomial time.
Please do problem 36.3-1 on page 938 in CLR.
Solution: Suppose L1 <=P L2 and L2 <=P L2. Let f be the poly time function that transforms inputs of L1 to inputs of L2 and g be the function that transforms inputs of L2 to inputs of L3. Thus x in L1 iff f(x) in L2 iff g(f(x)) in L3. Thus g(f(x)) is the translation function, and because each of them is poly-time, so is their composition.
Please do problem 36.3-7 on page 939 in CLR.
Solution: The proof of Lemma 36.6 constructs C = f(x) based on knowledge of x, A, and k. Let A and k be such that A verifies x iff x in L. We know that given x, we can use A and k to build a circuit f(x) that is satisfiable iff x in L. Thus even if we don't know A and k, just the knowledge of their existence tells us of the existence of the function f to build the circuit. Now L <=P CSP is true iff there exists such a computable f. Given an A there is a poly-time f. But, just as we don't necessarily know which A works for L, we don't know exactly what f is. However, we do know it exists!
Consider the following algorithm to determine whether a graph has a clique of size k. First generate all subsets of the vertices caontaining exactly k vertices. There are "n choose k" or O(nk) subsets of size k altogether. Then, we check whether any of the subgraphs induced by these subsets is complete. Why is this not a polynomial algorithm for the clique problem, which implies that P = NP?
Solution: If one fixes k in advance, this is a polynomial time algorithm. However, if k is not fixed, it does not work because we cannot find a constant c such that CLIQUE is solvable in time O(nc) for every graph G of size n and every k <= n. In particular, even if we look just at the specialized problem where k is always fixed to be n/2, the complexity of this algorithm with be O(nn/2). (Of course this does not mean there is not a polynomial algorithm -- though if there is then we know that P = NP.)
Show by reduction from CLIQUE that the INDEPENDENT SET problem is NP-complete. (That is, you may assume that CLIQUE is NP-complete in your proof.)
INDEPENDENT SET: An independent set in a graph G = (V,E) is a set of vertices, no two of which are connected. The problem is to determine, given G and an integer k, whether G contains an independent set with >= k vertices.
Solution: We must show that CLIQUE <=P INDEPENDENT SET and that INDEPENDENT SET is in NP. Clearly INDEPENDENT SET is in NP because we can choose as the certificate an independent set of size k. Given that there is an easy quadratic time algorithm to determine if any two vertices in the set are connected. If not, then answer yes. Otherwise answer no.
Next we show that CLIQUE <=P INDEPENDENT SET. Suppose we are given (G,k) and asked to find out whether G has a clique of size k. We describe a poly-time function f such that f(G,k) = (G',k') is an input to INDEPENDENT SET such that (G,k) has a clique of size k iff G' has an independent set of size k'.
Define f(G,k) = (Gc,k) where Gc is the complement of G. That is, Gc = (V,Ec) where e in Ec iff e not in E.
Clearly f is polynomial time. For example if G is represented by an adjacency matrix, just go through the matrix flipping all trues to falses.
Let V' be a subset of V. Then:
V' is a clique of G
iff for all v1, v2 in V', (v1,
v2) is in E
iff for all v1, v2 in V', (v1,
v2) is not in Ec
iff V' is an independent set of Gc.
Please do problem 36.2-5 in CLR. Hint: How can you get the needed certificate?
Solution: If L is in NP, there exist a poly-time verification algorithm A, and a number c such that for all x, x in L iff there is a y with |y| <= p(n) where p(n) in O(nc) s.t. A(x,y) returns true.
Design an algorithm A' that successively generates all y with |y| <= p(n) and runs A(x,y) on each of them. It stops and returns true if A(x,y) ever stops and returns true. Otherwise it returns false.
Clearly this algorithm will find a certificate y if one exists. Suppose A takes time q(n) where n is the size of input x. (Actually A is poly-time in |x| + |y|, but because |y| has a polynomial bound, we can rewrite this as a polynomial function of |x| alone - I leave this as an exercise for the reader.) Then running the entire algorithm takes time 2p(n) * (log p(n)) * q(n) (notice that generating successive y's takes time log p(n) for each new value). Note that (log p(n)) * q(n) is O(2n). Therefore the time of the algorithm is (eventually) bounded above by 2p(n)+1 and thus by 2O(nc+1).
Back to:
kim@cs.williams.edu