Lecture 2 1 BPP and NP

Lecture 2 1 BPP and NP

Theory of Computer Science to Msc Students, Spring 2007 Lecture 2 Lecturer: Dorit Aharonov Scribe: Bar Shalem and Amitai Gilad Revised: Shahar Dobzinski, March 2007 1 BPP and NP The theory of computer science attempts to capture the notion of computation. To under- stand this notion, we ¯rst need to understand the computing devices. The commonly used de¯nition of a computing device stems from the Church-Turing thesis: The Church-Turing Thesis: A Turing machine can simulate any reasonable physical computational model. In the sixties it became clear that we are interested in e±cient computational devices. The de¯nition of e±cient is absolutely not straightforward. Nowadays, we are interested in understanding the power of polynomial-time algorithms (i.e., polynomial time Turing machines). However, it seems that even polynomial time Turing machine does not fully capture the power of e±cient computation: we might let the algorithm to err with some small probability. That is, we should also consider randomized algorithms. We have already seen the de¯nitions of the relevant complexity classes, namely BPP and RP. Our current knowledge of the complexity classes is described in the next scheme: As the diagram shows, NP contains RP (why?), but the relationship between NP and BPP is unknown. For most problems if a randomized algorithm is known, then also a deterministic algorithm is known. Primality is one example. It is believed that randomness adds no computational power. 2-1 In the recitation, we have also considered the class of P=P oly (a family of polynomial size circuits). What is the power of randomness comparing to this class? Surprisingly, we know of a very interesting connection, known as Hardness vs. Randomness: if there are hard problems (with \large" circuit size), then randomness adds no computational power, and vice versa. Later in this course we will go over this informally-described connection in more details. 2 Polynomial Identity Testing An interesting (an exceptional) example to a program for which we know a randomized algorithm but no deterministic algorithm is known is the problem of testing whether two polynomials are equal. Recall that the degree of a polynomial de¯ned over n variables is de¯ned as the maximum over the monomial degrees. The input to the problem is two polynomials P and Q over n variables X1 ¢ ¢ ¢ Xn and some ¯eld F. The question is to determine if P ¡ Q ´ 0. (Of course, the problem is equivalent to asking if a given polynomial over n variables is zero, by letting the polynomial be P ¡ Q.) For polynomials with one variable of degree d, a solution can be given using algebraic considerations: arbitrarily choose d + 1 points in F and assign them to the polynomials. If the polynomials are equal on all points, then the polynomials are equivalent. This algorithm is always correct. However, this solution is not applicable for general polynomials. Thus we turn to a probabilistic algorithm using the Schwartz-Zippel lemma. Lemma 1 (Schwartz-Zippel Lemma) Let P 6´ 0 be a polynomial over the ¯eld F with degree d, S ⊆ F. Select, uniformly at random, n points ai 2 S. Then, d Pr[P (a ; : : : ; a ) = 0] · 1 n jSj The proof will be given in the recitation. Sanity check: A polynomial P 6´ 0 with a single variable, has at most d (the degree) roots (points where P = 0). Hence, for a random assignment the probability to hit a root is at d most jSj . ? For the sake of our problem (P ´ 0), we choose jSj = 2d and pick a random assignment (uniformly over S) to our polynomial P . using the Schwartz-Zippel Lemma, if P 6´ 0 we 1 ? have probability ¸ 2 to answer P 6´ 0. The general P ´ Q problem, is resolved using the ? Schwartz-Zippel lemma by trivially converting to the equivalent (P ¡ Q) ´ 0 problem. Remark The problem we have just described is complete in RP, in the sense that solving it without randomization power will solve all RP problems as well. Application: Assume we have two (very long) vectors w, z of size n on separate remote machines. We would like to know w =? z without broadcasting w or z. We resort to polynomial identity checking in the following manner. 2-2 1. Select a ¯eld S, s.t. jSj ¸ 2n. S is known to both sides a-priori. def i def i 2. De¯ne polynomials W (x) = §iwix (side A), and Z(x) = §izix (side B). Notice that if W ¡ Z ´ 0 then w = z. 3. Side A chooses x 2 S and sends it to side B, together with W (x). 4. If W (x) = Z(x) then side B declares \w = z", otherwise \w 6= z". Note that all broadcasted messages are of length O(log n). As for the correctness of the protocol, notice that if w is equal to z then we will always output that the strings are equal. Otherwise, by the discussion above, we will output that the strings are not equal 1 with probability of at least 2 . The error probability can be reduced to any ² > 0, by repeating the described procedure O(nlog ²) times. 3 Finding a Perfect Matching We will now see another application of the polynomial identity problem: ¯nding a perfect matching in a graph. First recall that a matching in a graph G is a set of non-adjacent edges. A perfect matching is a matching which covers all vertices of the graph (i.e. every vertex of the graph is incident in exactly one edge of the matching). Our goal will be to reduce the perfect matching problem to the polynomial identity problem. To do so, we ¯rst de¯ne the following matrix: ½ x ; if (i; j) 2 E M = i;j i;j 0; otherwise This means that the (i; j) entry contains the xi;j variable if the edge (i; j) appears in the graph, and 0 otherwise. The key step is understanding that all we have to do is to check if the determinant of M is 0. sign(σ) n det(M) = §σ2Sn (¡1) ¦i=1Mi,σ(i) where Sn is the set of all permutations, and sign(σ) is the parity permutation. Computing the determinant results in a polynomial of a degree of at most n, over n2 variables. We claim that there is no perfect matching in the graph if and only if det(M) = 0. Let us start by sketching the proof of the \only if" direction. First note that in a perfect matching no two edges ar adjacent to a common vertex. Thus, the edges in a perfect match- ing are actually represented by a one-to-one correspondence between the vertices 1; :::; n to themselves, meaning a permutation. In our case, the perfect matching is represented by the monomial x1,σ(1) ¢ ¢ ¢ xn,σ(n). Thus, if no perfect matching exists, all monomials equal zero, meaning that det(M) = 0. 2-3 As for the \if" direction, observe that if a perfect matching exists, the perfect matching de¯nes a unique permutation, represented by a unique monomial (each edge is represented by a di®erent variable). Therefore the sum will not be zero, thus det(M) 6= 0. In order to determine if there is a matching in the bipartite graph G, we can check the polynomial which is the determinant of M, using the Schwarz-Zippel lemma. Notice that it is not clear that we can compute the determinant in polynomial time, since the matrix is symbolic. One could wonder why we would want such a probabilistic algorithm, if other deter- ministic algorithms for this problem exist. One answer is that the algorithm we have just described can be parallelized. 4 Polynomial Reductions The class NP contains most of the \interesting" problems. For example, it contains math- ematical theorems with polynomial proofs and SAT. We would like to compare between problems, i.e. to have an order of \hardness". This results in the following de¯nitions of the reduction term: De¯nition 2 We say that a language L is Karp-reducible to L' if there exist a polynomial- time function f, such that: 8x : x 2 L , f(x) 2 L0 Thus, L is \no-harder" than L0. Another de¯nition for a reduction is the Cook reduction: De¯nition 3 We say that a language L is Cook-reducible to L0 if there exists a polynomial- time Turing machine that decides L with the help of an (oracle) Turing machine that decides L0. Cook reduction is weaker than Karp reduction, since any Karp reduction is also a Cook reduction. We note that SAT is Cook reducible to SAT . Also, it is known that SAT 2 coNP (prove it!), but we do not know whether SAT 2 coNP . However, using Karp-reduction, the problems are in the same class. The next scheme illustrates the relationships between NP problems. There are 3 possi- bilities: P=NP P NP P NP We know that the rightmost option is not possible. This means that unless P = NP, there are NP problems which are a bit \easier", but still not in P. For example, consider 3-SAT: if we adapt the random-walk we presented for 2-SAT to 3-SAT, we get a biased 1 2 random walk (using the probabilities 3 and 3 ). The probability of getting to a solution 2-4 3 n after n iterations is 4 . As before, we will reach a solution with high probability (if one 3 n n exists) after 3n ¢ ( 4 ) steps.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us