Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Complexity 23-1 More Probabilistic Algorithms Complexity Andrei Bulatov Complexity Polynomial Identity As we know, Primes can be solved in polynomial time. Therefore, the probabilistic algorithm for this problem has great practical significance, but no “theoretical” interest. For the following problem, no polynomial time deterministic algorithm is known yet Polynomial Identity Instance: Two polynomials P and G in variables x1 , x2 ,, xn Question: Is P identically equal to G? 23-2 Complexity Representation of Polynomials If P and G are represented explicitly, then the problem makes no sense: Fact Two polynomials on N are identical if and only if their coefficients are equal. The polynomials are given implicitly There is a polynomial time algorithm that, given a1 , a2 ,, an computes P(a1 , a2 ,, an ) and G(a1 , a2 ,, an ) 23-3 Complexity 23-4 Example A11 A21 Eigenvalues of a matrix A Ak 1 the determinant A11 x A21 Ak 1 A12 A22 x Ak 2 A12 A22 Ak 2 A1k A2 k are the roots of Akk A1k A2 k Akk x This determinant can be computed explicitly (using Gaussian elimination), but the time complexity of this algorithm is O ( n 3 ) under the assumption that operations on polynomials are done in one step; which is unrealistic Complexity Algorithm Clearly, it is enough to check if P( x1 , x2 ,, xn ) G( x1 , x2 ,, xn ) 0 Thus, we assume that G( x1 , x2 ,, xn ) is 0 Let d be the degree of P and N = 3d On the input P of degree d • choose randomly a1 , a2 ,, an such that 0 ai N • if P(a1 , a2 ,, an ) 0 then accept; otherwise reject 23-5 Complexity Analysis We prove that • if P is equal 0 identically then Pr[P accepted] = 1 • if P is not equal 0 identically then Pr[P accepted] 1/3 The first part is obvious. The second part is based on the following theorem Theorem (The Main Theorem of Algebra) A polynomial F(x) of degree d has at most d roots. 23-6 Complexity 23-7 Suppose first that P is a polynomial in one variable Then if P does not equal 0, then P(a) 0 for at least 2/3 of the numbers a 1,2,…,3d Let P(x,y) be in two variables Then, for any 0 a 3d, the polynomial P(a,y) is a polynomial in one variable. y x 0 a This polynomial has at most d roots in the interval 1,2,…,3d 3d Therefore, P(a,b) 0 for at least 2/3 of the numbers b 1,2,…,3d Complexity Random Walk We have seen random walk algorithms for graphs Similar algorithms are possible for other problems. For example for SAT Given a CNF • take an arbitrary truth assignment T • for i = 1 to k do - if T is a satisfying assignment then accept - otherwise take any unsatisfied clause (all literals in this clause are false) - randomly flip a literal from this clause updating T • reject 23-8 Complexity Analysis If the formula is unsatisfiable, then it cannot be accepted A satisfiable formula can be accepted and can be rejected How large must the length of the walk be to guarantee significant probability of success? Lemma If is a satisfying formula with n variables and k ln 2 2n then Pr[ rejected] 1/2. 23-9 Complexity 23-10 Proof If is satisfiable, it has at least 1 satisfying assignment. Therefore the probability that a random assignment is satisfying is at least 2n The probability that the algorithm fails after one attempt is at most 1 2n and after k attempts at most (1 2 n ) k We need a k such that 1 2 k ln(1 2 n ) ln 2 (1 2 n ) k It is known that | log(1 x) | x ln 2 ln 2 2 n | ln(1 2 n ) | Thus we may take any k ln 2 2n k ln 2 | ln(1 2 n ) | Complexity 2-SAT Theorem If is a satisfiable 2-CNF with n variables and k 2n 2 then Pr[ rejected] 1/2. 23-11 Complexity 3-SAT For any n, we consider CNF n consisting of the following clauses • ( X1 ) ( X 2 ) ( X n ) • for every different 1 i, j, k n, the clause ( X i X j X k ) Lemma For any polynomial p(n), any n, and k = p(n), Pr[ n rejected] 1 3 n. 23-12