18.405J/6.841J Advanced Complexity Theory March 6, 2001 Lecture 8 Lecturer: Daniel A. Spielman Scribe: Aram Harrow This lecture will prove the Valiant-Vazirani theorem and introduce hash functions. 8.1 The Valiant-Vazirani theorem The Valiant-Vazirani theorem claims that if we can solve instances of SAT that are known to have only one satisfying assignment, then using randomization we can solve any problem in SAT. It is important both for historical reasons (it ended the question of whether nonlinear search could solve NP-complete problems) and because it introduces a useful tool that led to other so-called isolation theorems being proved. Theorem 1 (Valiant-Vazirani) If there exists an RP algorithm that can nd a satisfying assignment of a SAT or CIRCUIT-SAT instance, given that there is only a single satisfying assignment, then NP=RP. Proof outline: We will consider the case of CIRCUIT-SAT, though this will only aect the notation used. The idea is to construct a polytime random algorithm that inputs a circuit ( 1 ) and outputs + 2 circuits 1 +2 such that C x : : : xn n C : : : Cn (i) If is unsatisable, then so are 1 +2 . (ii) If is satisable, then with probability at least 1 8, one of the assignment that also is a solution to . C C : : : Cn C = Ci will have exactly one satisfying C Now, if an RP algorithm exists to solve instances of CIRCUIT-SAT with a single satisfying assignment, we can use it to solve the general case of CIRCUIT-SAT with one-sided probability of 1 8. To construct the , we will let = \ , for some masks such that the number of solutions to will be no more than 2; +1 times the number of solutions to . = Ci Ci C Mi Mi i Ci C 8.2 Universal hash functions To construct the masks we will need to develop the concept of a universal hash function. In general, a hash function is a function h : f0 1g ! f0 1g , where we would like that for any S f0 1g such that jS j < 2 , we have jh(S )j 2 . This, of course, is not possible for a xed h. For example, let S be the largest pre-image of anything in f0 1g and jS j 2 ; , but jh(S )j = 1. Instead we will choose hash functions randomly from a probability distribution in which the action on all inputs are uniform and pairwise independant. More precisely, n k n k k n k Denition 2 A family of functions H : f0 1g ! f0 1g is said to be universal if n 1. 8a 2 f0 1g 8b 2 f0 1g Pr 2H h(a) = b] = 2; n k h k 8-1 k k 8-2 Lecture 8: March 6, 2001 2. 8a1 = 6 a2 2 f0 1g 8b1 b2 2 f0 1g Pr 2H h(a2 ) = b2 jh(a1 ) = b1 ] = 2; n k k h H can also be called a family of pairwise independant functions. From the denition, it immediately follows that for any distinct a1 and a2 , X ( ) = ( 2 )] = P r h a1 h a X ( ) = \ ( 2) = ] P r h a1 b h a b b = X b = ( ) = j ( 2) = ] ( 2) = ] P r h a1 b h a b Pr h a b 2; 2; = 2; k k k b The specic family of hash functions we will use will be the set of all ane linear tranformations over the integers mod 2. So dene H=f : 2 f0 1g 2 f0 1g where ( )= + (mod 2) hM y M hM y x k Mx n y k y So, multiplies its input by a random matrix and adds a random vector, all mod 2. First, we prove that H is a univeral family of hash functions. h 1. We must show that 8 ( ) = ] = 2; . For this, all we need is the fact that we're adding a randomly chosen vector . ( )= ]= + = ]= = + ] = 2; a bP r h a k b y Pr h a 2. 8 1 = 6 a a2 b1 b2 , such that b M a1 P r Ma + = y b1 and y b M a2 Pr y Ma k b + = 2 , adding gives that y b ( + 2) = 1 + 2. M a1 a b b So, Pr M a2 + = 2j y b M a1 + = 1] = Pr ( 1 + 2 ) = 1 + 2 j = Pr ( 1 + 2 ) = 12;+ 2 \ = Pr ( 1 + 2 ) = 1 + 2 ] y b M a a b M a a b b M a1 b + = 1] 1 + = 1] y Ma b y b k M a a b (8.1) b Since 1 = 6 2 , we have that 1 + 2 has at least one nonzero component and thus ( 1 + 2 ) is the sum of at least one column of . Since each column is an independant uniformly distibuted vector drawn from f0 1g , the result is also uniformly distributed. Thus, eq. 8.1 becomes 2; , as desired. The following lemma demonstrates how universal hash functions are useful in constructing instances of SAT with a single satisfying assignment. a a a a M a a M k k Lemma 3 Let f0 1g such that 2 ;2 j j 2 ;1 and H a universal family from f0 1g ! f0 1g . S n Then Pr 2Hjh;1 (0 ) \ S j = 1] 1=8. h Proof: Let k S < k k = ( ( ) = 0) \ (8 = 6 ( ) 6= 0 ). An equivalent probability to the one we want is Pr 2H 9! 2 : ( ) = 0 ] = Pr 2H9 2 : ( ) = 0 \ 8 = 6 Ea h a h b a S h a a h b k k h a S h a k b ( ) 6= 0 ] a h b k n k 8-3 Lecture 8: March 6, 2001 Since all the are disjoint, the probability that any is true is simply Ea X Ea h 2 a Pr 2H ] = S X 2 X a = 2 h a h b h ( ) 6= 0j ( ) = 0] a h b h a 2; (1 ; Pr 2H9 = 6 s.t. ( ) 6= 0j ( ) = 0]) k b h a h b h a S X a = Pr 2H ( ) = 0]Pr 2H8 = 6 0 1 X 2; @1 ; Pr 2H ( ) 6= 0j ( ) = 0]A 2 � 6 X ; ; ; 2 1 ; (j j ; 1)2; = j j2; 1 + 2; ; j 2 1 1 1 ; a S k h S b k a h b h a a k S S k k S jS j2; 1 ; jS j2; jS j2; k k k S j2; k 1 2 =8 2 4 Now we return to the theorem. To construct , choose a hash function at random from bits to bits. Since is computable in polynomial time we can easily construct a circuit (or boolean function, if you prefer) such that ( ) = ( ). The rst statement that we need to prove is that if has no satisfying assignment then no does. This follows trivially from the fact that = \ . We also need the probability of at least one having a unique satisfying assignment to be at least 1 8 If we let = f 2 f0 1g : ( ) = 1g, then lemma 3 implies that such that 2 ;2 j j 2 ;1 will suce and obviously one such exists between 1 and + 2. Q.E.D. A random closing note. The universal family of hash functions that we chose requires ( ) random bits, but it's possible to bring this down to ( + ). Mk hk n k hk Mk Mk x hk x C Ci C Ci Mi Ck S x n = : C x k k k S < k n O kn O n k