# Complexity 1 coNP Having Proofs for Incorrectness.

## Presentation on theme: "Complexity 1 coNP Having Proofs for Incorrectness."— Presentation transcript:

1 Complexity 1 coNP Having Proofs for Incorrectness

2 Complexity 2 Introduction Objectives: –To introduce the complexity class coNP –To explore the primality problem. Overview: –coNP: Definition and examples –coNP=NP? and NP=P? –PRIMES and Pratt’s theorem

3 Complexity 3 CoNP Def: CoNP is the class of problems that have succinct non-membership witnesses.

4 Complexity 4 VALIDITY Instance: A Boolean formula Problem: To decide if the formula is valid (i.e satisfiable by all possible assignments) A valid Boolean formula: An invalid Boolean formula:

5 Complexity 5 VALIDITY is in coNP Guess an assignment Verify it doesn’t satisfy the formula  (x)=F x Indeed it doesn’t satisfy x!

6 Complexity 6 Using what we Know about NP By definition, the complement of every NP language is in coNP. The complement of a coNP language is NP. VALIDITY is in coNP! Since SAT is in NP...

7 Complexity 7 NP and coNP P NP coNP P  coNP: As coP = P, and P  NP

8 Complexity 8 NP-Complete & coNP-Complete L NP-Complete  L c coNP-Complete. A c  NP L  NP- Complet e A  coNP R R L c  coNP -Complete

9 Complexity 9 NP=P? & coNP=NP? Claim: P=NP implies coNP=NP. Proof: P=coP, hence if P=NP, NP=coNP. Does the opposite direction also hold?

10 Complexity 10 coNP=NP? & Completeness in coNP Claim: If a coNP-Complete problem L is in NP, under Karp reduction, then coNP=NP. A  coNP L  coNP- Complete R L  NP A  NP Proof: in that case, any A  coNP, must be in NP

11 Complexity 11 What’s coNP’s Proper Position? P NP

12 Complexity 12 Here It Is! P Open question: Are NP\coNP, coNP\NP actually empty? NPcoNP

13 Complexity 13 PRIMES Instance: A number in binary representation. Problem: To decide if this number is prime Yes instance: No instance:10110

14 Complexity 14 Is Primes in P ?! What’s the problem with the following algorithm? Input: a number N Output: is N prime? for i in 2..  N do for j in 2..  N do if i*j=N, return FALSE return TRUE

15 Complexity ## PRIMES is in coNP Given a number N ### Guess two numbers i and j Verify i*j=N Don’t forget to make sure this takes polynomial time

16 Complexity 16 Is PRIMES in NP? Claim: A number p > 2 is prime iff  a number 1

17 Complexity 17 Pratt’s Theorem Pratt’s Theorem: PRIMES is in NP  coNP. Proof: Assuming the above claim we need to find some type of a guess that can be easily verify...

18 Complexity 18 What Can We Get By Guessing r? We first need to verify r p-1 =1 (mod p) r p-1 can be super- exponential! BUT r p-1 mod p requires only poly-space

19 Complexity 19 Performing p-1 multiplications is not polynomial! What Can We Get By Guessing r? We first need to verify r p-1 =1 (mod p) But you can start with r and square  log(p-1)  times!

20 Complexity 20 Verifying the Second Requirement Next we need to verify, that  prime divisor q of p-1: r (p-1)/q  1 (mod p) Lemma: Any n>1 has k  logn prime divisors. Proof: Denote the prime divisors of n by q 1,...,q k. Note that n  q 1 ·... ·q k and all q i  2. Thus n  2 k, i.e - k  logn.

21 Complexity 21 Verifying the Second Requirement Next we need to verify, that  prime divisor q of p-1: r (p-1)/q  1 (mod p) How would you find the prime divisors of p-1? Obviously I wouldn’t! I’d just guess them!

22 Complexity 22 Verifying the Second Requirement Next we need to verify, that  prime divisor q of p-1: r (p-1)/q  1 (mod p) How would you verify they are prime? Exactly the same way!

23 Complexity 23 Claim  Theorem The certificate that a natural p is a prime is the following: p=2C(p)=() p>2C(p)=(r,q 1,C(q 1 ),...,q k,C(q k )) Make sure it’s succinct

24 Complexity 24 The Verification 1. If p=2, accept 2. Otherwise, verify r p-1 =1 (mod p). 3. Check that p can be reduced to 1 by repeated divisions by the q i ’s. 4. Check r (p-1)/q i  1 (mod p) for all the q i ’s. 5. Recursively apply this algorithm upon every q i,C(q i ) Make sure it takes poly-time

25 Complexity 25 Proof of Claim Need to show that every prime satisfies both conditions and that any number satisfying both conditions is a prime

26 Complexity 26 Euler’s Function  (n) = { m | 1  m < n AND gcd(m,n)=1 } Euler’s function:  (n)=|  (n)|  (12)={1,2,3,4,5,6,7,8,9,10,11}  (12)=4 Example: Observe: For any prime p,  (p)={1,...,p-1}

27 Complexity 27 Fermat’s Little Theorem Fermat’s Little Theorem: Let p be a prime number  0 < a < p, a p-1 =1 (mod p) p=5; a= mod 5 = 16 mod 5 = 1 p=5; a= mod 5 = 16 mod 5 = 1 Example:

28 Complexity 28 Observation  0

29 Complexity 29 Fermat’s Theorem: Proof Therefore, for any 0

30 Complexity 30 Generalization Claim: For all a  (n), a  (n) =1 (mod n). n=8,  (8) = {1,3,5,7} 3 4 =1 (mod 8) n=8,  (8) = {1,3,5,7} 3 4 =1 (mod 8) Example:

31 Complexity 31 Generalization: Proof  (8) Example: * (mod 8) Again: For any a  (n), a·  (n)=  (n) Again:  m  (n) m  0 (mod n) And the claim follows.

32 Complexity 32 What have we got So Far We know if p is prime condition (1) holds for all a For non prime n, condition (1) may hold for some a but then a  (n) =1 (mod n) as well, hence a n-1-  (n) =1 (mod n)

33 Complexity 33 Exponents Def: If m  (p), the exponent of m is the smallest integer k > 0 such that m k =1 (mod p). p=7, m=4  (7), the exponent of 4 is 3. p=7, m=4  (7), the exponent of 4 is 3. Example:

34 Complexity 34 All Residues Have Exponents Let s   (p).  j > i  N that satisfy s i =s j (mod p). s i is indivisible by p.  s j-i =1 (mod p).

35 Complexity 35 Regarding Exponents Observation: The only powers of m that are 1 (mod p) are multiplies of its exponent! Assuming r p-1 = 1 (mode p), by Fermat’s theorem, r’s exponent divides p-1

36 Complexity 36 Non Primes Must Fail For a non prime n: It must be that  (p) < p-1. Assume there is r s.t r p-1 =1 (mod p) We’ve shown r  (p) =1 (mod p) So there is also a prime divisor q of p-1, s.t r (p-1)/q =1 mod p. We may conclude: if both conditions hold p is prime!

37 Complexity 37 An Equivalent Definition of Euler’s Function Using Prime Divisors Let p be a prime divisor of n. The probability p divides a candidate is 1/p. Thus:... all the residues modulo n are candidates for  (n)

38 Complexity 38 Corollaries Corollary: If gcd(m,n)=1,  (mn)=  (m)  (n). Proof:  (6)=|{1,5}|=2  (2)=|{1}|=1  (3)=|{1,2}|=2  (6)=|{1,5}|=2  (2)=|{1}|=1  (3)=|{1,2}|=2

39 Complexity 39 21=7·3  (21)={1,2,4,5,8,10,11,13,16,17,19,20}  (3) ={1,2}  (7) ={1,2,3,4,5,6} 21=7·3  (21)={1,2,4,5,8,10,11,13,16,17,19,20}  (3) ={1,2}  (7) ={1,2,3,4,5,6} The Chinese Remainder Theorem The Chinese Remainder Theorem: If n is the product of distinct primes p 1,...,p k, for each k-tuple of residues (r 1,...,r k ), where r i  (p i ), there is a unique r  (n), where r i =r mod p i for every 1  i  k.

40 Complexity 40 The Chinese Remainder Theorem Proof: If n is the product of distinct primes p 1,...,p k, then  (n)=  1  i  k (p i -1). This means |  (n)|=|  (p 1 ) ...  (p k )|. The following is a 1-1 correspondence between the two sets: r (r mod p 1,...,r mod p k )

41 Complexity 41 Another Property of the Euler Function Claim:  m|n  (m)=n.  m|12  (m)=  (1) +  (2) +  (3) +  (4) +  (6) +  (12)= |{1}| + |{1}| + |{1,2}| + |{1,3}| + |{1,5}| + |{1,5,7,11}|= = 12  m|12  (m)=  (1) +  (2) +  (3) +  (4) +  (6) +  (12)= |{1}| + + |{1,2}| + |{1,3}| + |{1,5}| + |{1,5,7,11}|= = 12 Example:

42 Complexity 42 Another Property of the Euler Function Claim:  m|n  (m)=n. Proof: Let  1  i  l p i k i be the prime factorization of n.  (n)=n  p|n (1-1/p) telescopic sum  m|n  (m)= Since  ( ab )=  ( a )  ( b )  ( ab )=  ( a )  ( b )

43 Complexity 43 Group together Residues with Same Exponent Fix a p and let R(k) denote the number of residues with exponent k. If k does not divide p-1, R(k)=0. Can you upper bound R(k)?

44 Complexity 44 Polynomials Have Few Roots Claim: Any polynomial of degree k that is not identically zero has at most k distinct roots modulo p. Proof: By induction on k. Trivially holds for k=0. Suppose it also holds for some k-1. By way of contradiction, assume x 1,...,x k+1 are roots of  (x)=a k x k +...+a 0.  ’(x)=  (x)-a k  1  i  k (x-x i ) is of degree k-1 and not identically zero. x 1,...,x k are its roots - Contradiction!

45 Complexity 45 How Many Residues Can Share an Exponent? Conclusion: There are at most k residues of exponent k. Claim: R(k) ≤  (k) Proof: –Let s be a residue of exponent k. –(1,s,s 2,…,s k-1 ) are k distinct solutions of x k =1 (mod p) (why?) –If s l has exponent k, l  (k) (otherwise its exponent is lower).

46 Complexity 46 Summing Up p-1 = = p-1 All p-1 residues have exponents  m|n  (m)=n

47 Complexity 47 Summing Up  R(k)=  (k) for all divisors of p-1  R(p-1) =  (p-1) > 0  p has at least one primitive root

48 Complexity 48 Where Do We Stand? We’ve shown every prime has a primitive root. Hence any prime satisfied both conditions We’ve previously shown any non prime does not satisfy both conditions

49 Complexity 49 Q.E.D! This finally proves the validity of our alternative characterization of primes, which implies that PRIMES is in NP.

50 Complexity 50 Place PRIMES P PRIMES NPcoNP

51 Complexity 51 Summary We’ve studied the complexity class coNP, and explored the relations between coNP and other classes, such as P and NP. We’ve introduced PRIMES and showed it’s in NP  coNP, though it’s believed not to be in P. 

Similar presentations