The complexity class coNP - West Virginia University

106
Outline The complexity class coNP Piotr Wojciechowski 1 1 Lane Department of Computer Science and Electrical Engineering West Virginia University Wojciechowski coNP

Transcript of The complexity class coNP - West Virginia University

Page 1: The complexity class coNP - West Virginia University

Outline

The complexity class coNP

Piotr Wojciechowski1

1Lane Department of Computer Science and Electrical EngineeringWest Virginia University

Wojciechowski coNP

Page 2: The complexity class coNP - West Virginia University

Outline

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 3: The complexity class coNP - West Virginia University

Outline

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 4: The complexity class coNP - West Virginia University

Outline

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 5: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 6: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

coNP as related to NP

Definition (coNP)

coNP is the complexity class which contains the complements of problems found in NP.

Another way of looking at coNP

Just as NP can be considered to be the set of problems with succinct ”yes” certificates,coNP can be considered to be the set of problems with succinct ”no” certificates. Thismeans that a ”no” instance of a problem in coNP has a short proof of it being a ”no”instance.

Wojciechowski coNP

Page 7: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

coNP as related to NP

Definition (coNP)

coNP is the complexity class which contains the complements of problems found in NP.

Another way of looking at coNP

Just as NP can be considered to be the set of problems with succinct ”yes” certificates,coNP can be considered to be the set of problems with succinct ”no” certificates. Thismeans that a ”no” instance of a problem in coNP has a short proof of it being a ”no”instance.

Wojciechowski coNP

Page 8: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 9: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

Examples

1 coSAT = {〈b〉 : b is a boolean expression with no satisfying assignments}2 PRIMES = {〈p〉 : p is a prime number}

Wojciechowski coNP

Page 10: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

What is coNPExamples of problems in coNP

Examples

1 coSAT = {〈b〉 : b is a boolean expression with no satisfying assignments}2 PRIMES = {〈p〉 : p is a prime number}

Wojciechowski coNP

Page 11: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 12: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Properties

Problems have both succinct ”yes” and succinct ”no” certificates.

Wojciechowski coNP

Page 13: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 14: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Examples

1 PRIMES2 All problems in P

Wojciechowski coNP

Page 15: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Examples

1 PRIMES2 All problems in P

Wojciechowski coNP

Page 16: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

PRIMES is in NP ∩ coNP

Goal

We first want to develop a different way of determining primality.Want to show that a number p > 1 is prime if and only if there is a number 1 < r < p

such that rp−1 = 1 mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Definition (Relative Primality)

Two numbers a and b are relatively prime iff their greatest common divisor, (a, b), is 1.

Examples

5 and 234 are relatively prime,57 and 95 are not, 19 is a common factor.

Wojciechowski coNP

Page 17: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

PRIMES is in NP ∩ coNP

Goal

We first want to develop a different way of determining primality.Want to show that a number p > 1 is prime if and only if there is a number 1 < r < p

such that rp−1 = 1 mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Definition (Relative Primality)

Two numbers a and b are relatively prime iff their greatest common divisor, (a, b), is 1.

Examples

5 and 234 are relatively prime,57 and 95 are not, 19 is a common factor.

Wojciechowski coNP

Page 18: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

PRIMES is in NP ∩ coNP

Goal

We first want to develop a different way of determining primality.Want to show that a number p > 1 is prime if and only if there is a number 1 < r < p

such that rp−1 = 1 mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Definition (Relative Primality)

Two numbers a and b are relatively prime iff their greatest common divisor, (a, b), is 1.

Examples

5 and 234 are relatively prime,57 and 95 are not, 19 is a common factor.

Wojciechowski coNP

Page 19: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

PRIMES is in NP ∩ coNP

Goal

We first want to develop a different way of determining primality.Want to show that a number p > 1 is prime if and only if there is a number 1 < r < p

such that rp−1 = 1 mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Definition (Relative Primality)

Two numbers a and b are relatively prime iff their greatest common divisor, (a, b), is 1.

Examples

5 and 234 are relatively prime,57 and 95 are not, 19 is a common factor.

Wojciechowski coNP

Page 20: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Definition (Φ(n))

Φ(n) = {m : 1 ≤ m < n, (m, n) = 1}.

Definition (Euler φ function)

φ(n) = |Φ(n)| and φ(1) = 1.In other words, φ(n) is the number of numbers between 1 and n − 1 which arerelatively prime to n

Lemma (1)

φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Proof.

Assume that p1, p2 . . . , pk are the prime divisors of n. Observe that each pi knocks offone in every pi candidates for φ(n), leaving n · (1− 1

pi) candidates for φ(n). It therefore

follows that φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Wojciechowski coNP

Page 21: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Definition (Φ(n))

Φ(n) = {m : 1 ≤ m < n, (m, n) = 1}.

Definition (Euler φ function)

φ(n) = |Φ(n)| and φ(1) = 1.In other words, φ(n) is the number of numbers between 1 and n − 1 which arerelatively prime to n

Lemma (1)

φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Proof.

Assume that p1, p2 . . . , pk are the prime divisors of n. Observe that each pi knocks offone in every pi candidates for φ(n), leaving n · (1− 1

pi) candidates for φ(n). It therefore

follows that φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Wojciechowski coNP

Page 22: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Definition (Φ(n))

Φ(n) = {m : 1 ≤ m < n, (m, n) = 1}.

Definition (Euler φ function)

φ(n) = |Φ(n)| and φ(1) = 1.In other words, φ(n) is the number of numbers between 1 and n − 1 which arerelatively prime to n

Lemma (1)

φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Proof.

Assume that p1, p2 . . . , pk are the prime divisors of n. Observe that each pi knocks offone in every pi candidates for φ(n), leaving n · (1− 1

pi) candidates for φ(n). It therefore

follows that φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Wojciechowski coNP

Page 23: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Definition (Φ(n))

Φ(n) = {m : 1 ≤ m < n, (m, n) = 1}.

Definition (Euler φ function)

φ(n) = |Φ(n)| and φ(1) = 1.In other words, φ(n) is the number of numbers between 1 and n − 1 which arerelatively prime to n

Lemma (1)

φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Proof.

Assume that p1, p2 . . . , pk are the prime divisors of n. Observe that each pi knocks offone in every pi candidates for φ(n), leaving n · (1− 1

pi) candidates for φ(n). It therefore

follows that φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Wojciechowski coNP

Page 24: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Definition (Φ(n))

Φ(n) = {m : 1 ≤ m < n, (m, n) = 1}.

Definition (Euler φ function)

φ(n) = |Φ(n)| and φ(1) = 1.In other words, φ(n) is the number of numbers between 1 and n − 1 which arerelatively prime to n

Lemma (1)

φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Proof.

Assume that p1, p2 . . . , pk are the prime divisors of n. Observe that each pi knocks offone in every pi candidates for φ(n), leaving n · (1− 1

pi) candidates for φ(n). It therefore

follows that φ(n) = nQ

p|n(1− 1p ) where p is a prime.

Wojciechowski coNP

Page 25: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Examples

Φ(8) = {1, 3, 5, 7}φ(8) = 8 · (1− 1

2 ) = 4

Theorem

If (m, n) = 1, then φ(m · n) = φ(m) · φ(n).

Proof.

Follows from the previous lemma as m and n share no common prime factors. Thusthe terms in the product m · n

Qp|m·n(1− 1

p ) are distributed without overlap to

nQ

p|n(1− 1p ) and m

Qp|m(1− 1

p ).

Example

φ(95) = 95 · (1− 15 ) · (1− 1

19 ) = 72 = 4 · 18 = φ(5) · φ(19)

Wojciechowski coNP

Page 26: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Examples

Φ(8) = {1, 3, 5, 7}φ(8) = 8 · (1− 1

2 ) = 4

Theorem

If (m, n) = 1, then φ(m · n) = φ(m) · φ(n).

Proof.

Follows from the previous lemma as m and n share no common prime factors. Thusthe terms in the product m · n

Qp|m·n(1− 1

p ) are distributed without overlap to

nQ

p|n(1− 1p ) and m

Qp|m(1− 1

p ).

Example

φ(95) = 95 · (1− 15 ) · (1− 1

19 ) = 72 = 4 · 18 = φ(5) · φ(19)

Wojciechowski coNP

Page 27: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Examples

Φ(8) = {1, 3, 5, 7}φ(8) = 8 · (1− 1

2 ) = 4

Theorem

If (m, n) = 1, then φ(m · n) = φ(m) · φ(n).

Proof.

Follows from the previous lemma as m and n share no common prime factors. Thusthe terms in the product m · n

Qp|m·n(1− 1

p ) are distributed without overlap to

nQ

p|n(1− 1p ) and m

Qp|m(1− 1

p ).

Example

φ(95) = 95 · (1− 15 ) · (1− 1

19 ) = 72 = 4 · 18 = φ(5) · φ(19)

Wojciechowski coNP

Page 28: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Examples

Φ(8) = {1, 3, 5, 7}φ(8) = 8 · (1− 1

2 ) = 4

Theorem

If (m, n) = 1, then φ(m · n) = φ(m) · φ(n).

Proof.

Follows from the previous lemma as m and n share no common prime factors. Thusthe terms in the product m · n

Qp|m·n(1− 1

p ) are distributed without overlap to

nQ

p|n(1− 1p ) and m

Qp|m(1− 1

p ).

Example

φ(95) = 95 · (1− 15 ) · (1− 1

19 ) = 72 = 4 · 18 = φ(5) · φ(19)

Wojciechowski coNP

Page 29: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 30: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 31: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 32: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 33: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 34: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 35: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

TheoremPm|n φ(m) = n

Proof.

LetQl

i=1 pkii be the prime factorization of n. Consider the following productQl

i=1(φ(1) + φ(pi ) + φ(p2i ) + · · ·+ φ(pki

i ))

Its easy to see that the i th term in this product is simply pkii . Thus the product is simply

equal to n. If the product is expanded out one term for each divisor of n is produced.

The term corresponding to m =Ql

i=1 pk′ii where 1 ≤ k ′i < ki , is

Qli=1 φ(p

k′ii ). However,

by the previous theorem, this term is simply φ(m).

ExamplePm|27 φ(m) = φ(1) + φ(3) + φ(9) + φ(27) = 1 + 2 + 6 + 18 = 27

Wojciechowski coNP

Page 36: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 37: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 38: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 39: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 40: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 41: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 42: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem (Fermat’s Little Theorem)

For all 0 < a < p, ap−1 ≡ 1 mod p, where p is a prime.

Proof.

Lets consider the set a · Φ(p) = {a · i mod p : 0 < i < p}. We have that this set isequal to the set Φ(p) = {i, 0 < i < p}. Suppose otherwise, thus there exist elementsm 6= m′ in Φ(p) such that a ·m ≡ a ·m′ mod p. Thus a · (m −m′) ≡ 0 mod pleading to a contradiction. Now take the products of all the elements in each set, thuswe have that ap−1 · (p − 1)! ≡ (p − 1)! mod p. Thus (ap−1 − 1) · (p − 1)! ≡ 0mod p. Since (p − 1)! 6= 0 mod p we have the desired result.

Corollary

For all a ∈ Φ(n), aφ(n) ≡ 1 mod n

Wojciechowski coNP

Page 43: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternative look at primality

Definition (Exponent of a number mod n)

The exponent of a number m ∈ Φ(n) is the smallest integer k > 0 for which mk ≡ 1mod n. It is worth noting that if ml ≡ 1 mod n then k |l . As otherwise l mod k wouldbe the exponent of m.

Example

The exponent of 10 mod 11 is 2 as 102 ≡ 1 mod 11 but 10 6= 1 mod 11.

Definition

Let R(k), for a given prime p, denote the number of residues in Φ(p) which haveexponent k .

Example

Let p = 5 thus R(3) = 0 and R(2) = 1.

Wojciechowski coNP

Page 44: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternative look at primality

Definition (Exponent of a number mod n)

The exponent of a number m ∈ Φ(n) is the smallest integer k > 0 for which mk ≡ 1mod n. It is worth noting that if ml ≡ 1 mod n then k |l . As otherwise l mod k wouldbe the exponent of m.

Example

The exponent of 10 mod 11 is 2 as 102 ≡ 1 mod 11 but 10 6= 1 mod 11.

Definition

Let R(k), for a given prime p, denote the number of residues in Φ(p) which haveexponent k .

Example

Let p = 5 thus R(3) = 0 and R(2) = 1.

Wojciechowski coNP

Page 45: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternative look at primality

Definition (Exponent of a number mod n)

The exponent of a number m ∈ Φ(n) is the smallest integer k > 0 for which mk ≡ 1mod n. It is worth noting that if ml ≡ 1 mod n then k |l . As otherwise l mod k wouldbe the exponent of m.

Example

The exponent of 10 mod 11 is 2 as 102 ≡ 1 mod 11 but 10 6= 1 mod 11.

Definition

Let R(k), for a given prime p, denote the number of residues in Φ(p) which haveexponent k .

Example

Let p = 5 thus R(3) = 0 and R(2) = 1.

Wojciechowski coNP

Page 46: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternative look at primality

Definition (Exponent of a number mod n)

The exponent of a number m ∈ Φ(n) is the smallest integer k > 0 for which mk ≡ 1mod n. It is worth noting that if ml ≡ 1 mod n then k |l . As otherwise l mod k wouldbe the exponent of m.

Example

The exponent of 10 mod 11 is 2 as 102 ≡ 1 mod 11 but 10 6= 1 mod 11.

Definition

Let R(k), for a given prime p, denote the number of residues in Φ(p) which haveexponent k .

Example

Let p = 5 thus R(3) = 0 and R(2) = 1.

Wojciechowski coNP

Page 47: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternative look at primality

Definition (Exponent of a number mod n)

The exponent of a number m ∈ Φ(n) is the smallest integer k > 0 for which mk ≡ 1mod n. It is worth noting that if ml ≡ 1 mod n then k |l . As otherwise l mod k wouldbe the exponent of m.

Example

The exponent of 10 mod 11 is 2 as 102 ≡ 1 mod 11 but 10 6= 1 mod 11.

Definition

Let R(k), for a given prime p, denote the number of residues in Φ(p) which haveexponent k .

Example

Let p = 5 thus R(3) = 0 and R(2) = 1.

Wojciechowski coNP

Page 48: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

Any polynomial of degree k that is not identically zero has at most k distinct rootsmod p.

Proof.

This will be shown by induction on k . If k = 0 this is obvious as the polynomial isconstant. Assume that the theorem holds for al polynomials of degree at most k − 1.Let π(x) = ak xk + . . .+ a1x + a0 be a polynomial of degree k with k + 1 distinct roots,say x1, x2, . . . , xk+1. Now let π′(x) = π(x)− ak ·

Qki=1(x − xi ). Thus π′(x) is a

polynomial of degree at most k − 1, which is not identically 0. Therefore, π′(x) musthave k − 1 distinct roots as per the inductive hypothesis, but x1, . . . , xk are all distinctroots of π′(x) contradicting the hypothesis!

Application to R(k)

Since xk − 1 for k 6∈ φ(p) is a non-zero polynomial it has at most k roots mod p andthus R(k) ≤ k .

Wojciechowski coNP

Page 49: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

Any polynomial of degree k that is not identically zero has at most k distinct rootsmod p.

Proof.

This will be shown by induction on k . If k = 0 this is obvious as the polynomial isconstant. Assume that the theorem holds for al polynomials of degree at most k − 1.Let π(x) = ak xk + . . .+ a1x + a0 be a polynomial of degree k with k + 1 distinct roots,say x1, x2, . . . , xk+1. Now let π′(x) = π(x)− ak ·

Qki=1(x − xi ). Thus π′(x) is a

polynomial of degree at most k − 1, which is not identically 0. Therefore, π′(x) musthave k − 1 distinct roots as per the inductive hypothesis, but x1, . . . , xk are all distinctroots of π′(x) contradicting the hypothesis!

Application to R(k)

Since xk − 1 for k 6∈ φ(p) is a non-zero polynomial it has at most k roots mod p andthus R(k) ≤ k .

Wojciechowski coNP

Page 50: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

Any polynomial of degree k that is not identically zero has at most k distinct rootsmod p.

Proof.

This will be shown by induction on k . If k = 0 this is obvious as the polynomial isconstant. Assume that the theorem holds for al polynomials of degree at most k − 1.Let π(x) = ak xk + . . .+ a1x + a0 be a polynomial of degree k with k + 1 distinct roots,say x1, x2, . . . , xk+1. Now let π′(x) = π(x)− ak ·

Qki=1(x − xi ). Thus π′(x) is a

polynomial of degree at most k − 1, which is not identically 0. Therefore, π′(x) musthave k − 1 distinct roots as per the inductive hypothesis, but x1, . . . , xk are all distinctroots of π′(x) contradicting the hypothesis!

Application to R(k)

Since xk − 1 for k 6∈ φ(p) is a non-zero polynomial it has at most k roots mod p andthus R(k) ≤ k .

Wojciechowski coNP

Page 51: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

Any polynomial of degree k that is not identically zero has at most k distinct rootsmod p.

Proof.

This will be shown by induction on k . If k = 0 this is obvious as the polynomial isconstant. Assume that the theorem holds for al polynomials of degree at most k − 1.Let π(x) = ak xk + . . .+ a1x + a0 be a polynomial of degree k with k + 1 distinct roots,say x1, x2, . . . , xk+1. Now let π′(x) = π(x)− ak ·

Qki=1(x − xi ). Thus π′(x) is a

polynomial of degree at most k − 1, which is not identically 0. Therefore, π′(x) musthave k − 1 distinct roots as per the inductive hypothesis, but x1, . . . , xk are all distinctroots of π′(x) contradicting the hypothesis!

Application to R(k)

Since xk − 1 for k 6∈ φ(p) is a non-zero polynomial it has at most k roots mod p andthus R(k) ≤ k .

Wojciechowski coNP

Page 52: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

Any polynomial of degree k that is not identically zero has at most k distinct rootsmod p.

Proof.

This will be shown by induction on k . If k = 0 this is obvious as the polynomial isconstant. Assume that the theorem holds for al polynomials of degree at most k − 1.Let π(x) = ak xk + . . .+ a1x + a0 be a polynomial of degree k with k + 1 distinct roots,say x1, x2, . . . , xk+1. Now let π′(x) = π(x)− ak ·

Qki=1(x − xi ). Thus π′(x) is a

polynomial of degree at most k − 1, which is not identically 0. Therefore, π′(x) musthave k − 1 distinct roots as per the inductive hypothesis, but x1, . . . , xk are all distinctroots of π′(x) contradicting the hypothesis!

Application to R(k)

Since xk − 1 for k 6∈ φ(p) is a non-zero polynomial it has at most k roots mod p andthus R(k) ≤ k .

Wojciechowski coNP

Page 53: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 54: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 55: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 56: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 57: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 58: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

For a given prime p, for all k ∈ Φ(p) we have that R(k) ≤ φ(k).

Proof.

If R(k) = 0 then were done. So we assume that there is an element s with exponent k .Then (1, s, s2, . . . , sk−1) are all distinct. And for all 0 ≤ i < k , (si )k = sik ≡ 1i = 1mod p. Thus these si constitute all k possible roots of xk − 1 mod p. Let sl haveexponent k . If l /∈ Φ(k) then d = (l, k) > 1 and (sl )k/d = s

lkd = (sk )l/d ≡ 1 mod p

leading to a contradiction. Thus if sl has exponent k mod p then l ∈ Φ(k), whichmeans that R(k) ≤ φ(k).

Wojciechowski coNP

Page 59: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 60: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 61: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 62: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 63: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 64: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

An alternate look at primality

Theorem

A number p > 1 is prime if and only if there is a number 1 < r < p such that rp−1 = 1

mod p and rp−1

q 6= 1 mod p for all prime divisors q of p − 1.

Proof.

p is a prime: As each 0 < i < p has an exponent, that divides p − 1,p − 1 =

Pl|p−1 R(l) ≤

Pl|p−1 φ(l) = p − 1. Thus R(l) = φ(l) for all l|p − 1. Namely

R(p − 1) = φ(p − 1) > 0 and so there is at least one r that has exponent p − 1.p is not a prime: let r ∈ Φ(p) be a number such that rp−1 ≡ 1 mod p, we also havethat rφ(p) ≡ 1 mod p. Let k be the exponent of r mod p. Thus k |p − 1 and k |φ(p).Since p is not a prime k ≤ φ(p) < p − 1. Let q be a prime factor of p−1

k . Thus k | p−1q

and so rp−1

q ≡ 1 mod p

Wojciechowski coNP

Page 65: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Showing that PRIMES is in NP ∩ coNP

Theorem (Pratt’s Theorem)

PRIMES is in NP ∩ coNP

Proof.

Part 1: PRIMES is in coNP. Trivially true, since the succinct disqualification forx /∈ PRIMES is simply the factorization of x.eg. 12 = 3 · 4 and 117 = 9 · 13.

Wojciechowski coNP

Page 66: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Showing that PRIMES is in NP ∩ coNP

Theorem (Pratt’s Theorem)

PRIMES is in NP ∩ coNP

Proof.

Part 1: PRIMES is in coNP. Trivially true, since the succinct disqualification forx /∈ PRIMES is simply the factorization of x.eg. 12 = 3 · 4 and 117 = 9 · 13.

Wojciechowski coNP

Page 67: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Showing that PRIMES is in NP ∩ coNP

Theorem (Pratt’s Theorem)

PRIMES is in NP ∩ coNP

Proof.

Part 1: PRIMES is in coNP. Trivially true, since the succinct disqualification forx /∈ PRIMES is simply the factorization of x.eg. 12 = 3 · 4 and 117 = 9 · 13.

Wojciechowski coNP

Page 68: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Showing that PRIMES is in NP ∩ coNP

Theorem (Pratt’s Theorem)

PRIMES is in NP ∩ coNP

Proof.

Part 1: PRIMES is in coNP. Trivially true, since the succinct disqualification forx /∈ PRIMES is simply the factorization of x.eg. 12 = 3 · 4 and 117 = 9 · 13.

Wojciechowski coNP

Page 69: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 70: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 71: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 72: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 73: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 74: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 75: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 76: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 77: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Part 2: PRIMES is in NP. First we will try to construct a certificate for any x ∈ PRIMES.Once a reasonable certificate is found we will show that it is succinct.

Possible Certificates, C(p), for p ∈ PRIMES

1 C(p) = r such that rp−1 = 1 mod p.Insufficient as 20 is a ”valid” certificate for 21 /∈ PRIMES.

2 C(p) = (r , p1, p2, . . . , pk ) where rp−1 = 1 mod p and rp−1

pi 6= 1 mod p for1 ≤ i ≤ k and p1 · · · · · pk = p − 1.Insufficient as (10, 2, 45) is a ”valid” certificate for 91 /∈ PRIMES.Need some way to ensure that p1, . . . , pk are primes without having to check.

3 C(p) = (r ; p1,C(p1), p2,C(p2), . . . , pk ,C(pk )) where C(1)=(1), rp−1 = 1 mod p,

and rp−1

pi 6= 1 mod p for 1 ≤ i ≤ k and p1 · · · · · pk = p − 1.eg. C(67) = (2; 2, (1), 3, (2; 2, (1)), 11, (8; 2, (1), 5, (3; 2, (1)))).

Wojciechowski coNP

Page 78: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 79: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 80: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 81: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 82: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 83: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 84: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 85: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 86: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 87: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

First we will show that the certificate is succinct. We will show that for all primes p thecertificate has length at most 4 · log2(p). If p = 2 or p = 3 this is trivial. For any p > 3,p − 1 will have k < log(p) prime divisors q1 = 2, q2, . . . , qk . Thus C(p) will contain 2kseparators, the number r , 2 and its certificate (1), the qi s (at most 2 log p bits), and theC(qi )s.By the inductive hypothesis, we have that |C(qi )| ≤ 4 log2 qi . Thus|C(p)| ≤ 4 log p + 5 + 4

Pki=2 log2 qi

The logarithms of the q1s add up to log p−12 < log p − 1, so the sum of their squares is

at most (log p − 1)2. Thus|C(p)| ≤ 4 log2 p + 9− 4 log p, which is less than 4 log2 p when p ≥ 5.

Wojciechowski coNP

Page 88: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 89: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 90: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 91: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 92: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 93: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 94: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 95: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 96: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 97: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

Now it needs to be shown that C(p) is verifiable in polynomial time. This hinges of thecomputation of rp−1 mod p. If repeated multiplication by r is done then this processclearly takes exponential time. However, repeated squaring can be used.Let l = dlog(p)e. First r , r2, r4, . . . , r2l

mod p are computed. Each of these stepstakes O(l2) time. Then multiply the appropriate exponents of r to obtain rp−1 mod p.As there are O(l) multiplications this entire process takes O(l3) time.

Example

p = 7, r = 5thus p − 1 = 6 and l = 3.so r2 = 25 ≡ 4, r4 = 16 ≡ 2, r8 = 4 mod 7 thus rp−1 = r4 · r2 = 8 ≡ 1 mod 7.

Wojciechowski coNP

Page 98: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

However, it is not enough that rp−1 mod p takes O(l3) time. We need to show that theentire verification process of C(p) runs in polynomial time. To do this we need to

compute rp−1 mod p, rp−1

qi mod p for each of the O(l) qi s, q1, q2, . . . , qk , and eachof the C(qi )s. This entire process takes O(l4) time.

Wojciechowski coNP

Page 99: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

However, it is not enough that rp−1 mod p takes O(l3) time. We need to show that theentire verification process of C(p) runs in polynomial time. To do this we need to

compute rp−1 mod p, rp−1

qi mod p for each of the O(l) qi s, q1, q2, . . . , qk , and eachof the C(qi )s. This entire process takes O(l4) time.

Wojciechowski coNP

Page 100: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

However, it is not enough that rp−1 mod p takes O(l3) time. We need to show that theentire verification process of C(p) runs in polynomial time. To do this we need to

compute rp−1 mod p, rp−1

qi mod p for each of the O(l) qi s, q1, q2, . . . , qk , and eachof the C(qi )s. This entire process takes O(l4) time.

Wojciechowski coNP

Page 101: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and P

Properties of NP∩ coNPProblems in NP∩ coNP

Proof.

However, it is not enough that rp−1 mod p takes O(l3) time. We need to show that theentire verification process of C(p) runs in polynomial time. To do this we need to

compute rp−1 mod p, rp−1

qi mod p for each of the O(l) qi s, q1, q2, . . . , qk , and eachof the C(qi )s. This entire process takes O(l4) time.

Wojciechowski coNP

Page 102: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and PHierarchy

Outline

1 Description of coNP and examples of problemsWhat is coNPExamples of problems in coNP

2 The NP ∩ coNP complexity classProperties of NP ∩ coNPProblems in NP ∩ coNP

3 NP, coNP, and PThe P, NP, coNP Hierarchy

Wojciechowski coNP

Page 103: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and PHierarchy

Inclusion Relationships

Relation to P

Just as P ⊆ NP, we have that P = coP ⊆ coNP. Thus P ⊆ NP ∩ coNP.It is also unknown if P = NP ∩ coNP.

Wojciechowski coNP

Page 104: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and PHierarchy

Inclusion Relationships

Relation to P

Just as P ⊆ NP, we have that P = coP ⊆ coNP. Thus P ⊆ NP ∩ coNP.It is also unknown if P = NP ∩ coNP.

Wojciechowski coNP

Page 105: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and PHierarchy

Inclusion Relationships

Relation to P

Just as P ⊆ NP, we have that P = coP ⊆ coNP. Thus P ⊆ NP ∩ coNP.It is also unknown if P = NP ∩ coNP.

Wojciechowski coNP

Page 106: The complexity class coNP - West Virginia University

coNPNP∩ coNP

NP, coNP, and PHierarchy

The Complexity Picture

P

NP ∩ coNP

coNPNP

NP-complete coNP-complete

Wojciechowski coNP