Randomized Computation

Nabil Mustafa

Computational Complexity

1 / 85 Definition: ZPP The ZPP is the class of languages for which there exists a polynomial PTM M such that

x ∈ L =⇒ M(x) = 1 or M(x) = ‘Don’t know’

x ∈/ L =⇒ M(x) = 0 or M(x) = ‘Don’t know’

∀x, Prob[M(x) = ‘Don’t know’] ≤ 1/2 Whenever M answers with a 0 or a 1, it answers correctly. If M is not sure, it’ll output a ‘Don’t know’. On any input x, it outputs ‘Don’t know’ with probability at most 1/2.

Zero-error Probabilistic Polynomial time

2 / 85 x ∈/ L =⇒ M(x) = 0 or M(x) = ‘Don’t know’

∀x, Prob[M(x) = ‘Don’t know’] ≤ 1/2 Whenever M answers with a 0 or a 1, it answers correctly. If M is not sure, it’ll output a ‘Don’t know’. On any input x, it outputs ‘Don’t know’ with probability at most 1/2.

Zero-error Probabilistic Polynomial time

Definition: ZPP The complexity class ZPP is the class of all languages L for which there exists a polynomial PTM M such that

x ∈ L =⇒ M(x) = 1 or M(x) = ‘Don’t know’

3 / 85 ∀x, Prob[M(x) = ‘Don’t know’] ≤ 1/2 Whenever M answers with a 0 or a 1, it answers correctly. If M is not sure, it’ll output a ‘Don’t know’. On any input x, it outputs ‘Don’t know’ with probability at most 1/2.

Zero-error Probabilistic Polynomial time

Definition: ZPP The complexity class ZPP is the class of all languages L for which there exists a polynomial PTM M such that

x ∈ L =⇒ M(x) = 1 or M(x) = ‘Don’t know’

x ∈/ L =⇒ M(x) = 0 or M(x) = ‘Don’t know’

4 / 85 Whenever M answers with a 0 or a 1, it answers correctly. If M is not sure, it’ll output a ‘Don’t know’. On any input x, it outputs ‘Don’t know’ with probability at most 1/2.

Zero-error Probabilistic Polynomial time

Definition: ZPP The complexity class ZPP is the class of all languages L for which there exists a polynomial PTM M such that

x ∈ L =⇒ M(x) = 1 or M(x) = ‘Don’t know’

x ∈/ L =⇒ M(x) = 0 or M(x) = ‘Don’t know’

∀x, Prob[M(x) = ‘Don’t know’] ≤ 1/2

5 / 85 Zero-error Probabilistic Polynomial time

Definition: ZPP The complexity class ZPP is the class of all languages L for which there exists a polynomial PTM M such that

x ∈ L =⇒ M(x) = 1 or M(x) = ‘Don’t know’

x ∈/ L =⇒ M(x) = 0 or M(x) = ‘Don’t know’

∀x, Prob[M(x) = ‘Don’t know’] ≤ 1/2 Whenever M answers with a 0 or a 1, it answers correctly. If M is not sure, it’ll output a ‘Don’t know’. On any input x, it outputs ‘Don’t know’ with probability at most 1/2.

6 / 85 Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

7 / 85 Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP

8 / 85 We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP

9 / 85 Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar

10 / 85 Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’.

11 / 85 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x).

12 / 85 M(x) = 1 or M(x) =‘Don’t know’, so M0(x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x).

I x ∈ L:

13 / 85 or M(x) =‘Don’t know’, so M0(x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x).

I x ∈ L: M(x) = 1

14 / 85 , so M0(x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x).

I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’

15 / 85 I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

16 / 85 M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L:

17 / 85 , which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0

18 / 85 , or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct

19 / 85 where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’

20 / 85 So L ∈ coRP, and ZPP ⊆ coRP

A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2.

21 / 85 A Theorem on ZPP Theorem ZPP = RP ∩ coRP

Claim: ZPP ⊆ RP ∩ coRP Show that ZPP ⊆ RP and ZPP ⊆ coRP We prove ZPP ⊆ coRP , the other proof is similar Let L ∈ ZPP . Then ∃ PTM M that, for all x, either correctly decides x ∈ L or outputs ‘Don’t know’. Let M0 be the Turing Machine that on input x, returns 1 if M(x) =‘Don’t know’ and otherwise returns M(x). 0 I x ∈ L: M(x) = 1 or M(x) =‘Don’t know’, so M (x) = 1.

I x ∈/ L: M(x) = 0, which is correct, or M(x) =‘Don’t know’ where M0(x) returns incorrectly with probability ≤ 1/2. So L ∈ coRP, and ZPP ⊆ coRP

22 / 85 Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP

23 / 85 I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

24 / 85 I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

25 / 85 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2

26 / 85 I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

27 / 85 I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

28 / 85 I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

29 / 85 Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’.

30 / 85 Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct.

31 / 85 I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

32 / 85 I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

33 / 85 I The case for x ∈/ L similar.

A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

34 / 85 A Theorem on ZPP

Claim: RP ∩ coRP ⊆ ZPP Let L ∈ RP ∩ coRP . Then there exist two TM ’s s.t.:

I M1(x) = 1 if x ∈ L. Incorrect for x ∈/ L with prob. ≤ 1/2

I M2(x) = 0 if x ∈/ L. Incorrect for x ∈ L with prob. ≤ 1/2 Construct a PTM M0 which works as follows on M0(x):

I Run M1(x), and if M1(x) = 0, return x ∈/ L.

I Run M2(x), and if M2(x) = 1, return x ∈ L.

I Else return ‘Don’t know’. Claim: If M0(x) returns a 0 or a 1, it is correct. Claim: M0(x) returns ‘Don’t know’ with prob. ≤ 1/2

I Assume x ∈ L. Then we don’t return a 1 iff M2(x) = 0.

I By definition, M2(x) = 0 for x ∈ L with prob. ≤ 1/2.

I The case for x ∈/ L similar.

35 / 85 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2

36 / 85 Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP .

37 / 85 x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x|

38 / 85 To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x| where y is a m-bit random string.

39 / 85 m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

40 / 85 m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n.

41 / 85 Input to M is a m-bit string picked uniformly from all the yi ’s

A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

42 / 85 A Theorem on BPP

Theorem

BPP ⊆ Σ2 Let L ∈ BPP . Then ∃ a randomized TM M such that: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−|x| x ∈/ L: Prob [M(x, y) = 1] ≤ 2−|x|

where y is a m-bit random string. To prove L ∈ Σ2, show there exists TM N:

x ∈ L ⇐⇒ ∃ u ∀ v N(x, u, v) = 1

m is the number of random bits M uses on |x| = n. Note that m is polynomial in n. m y1,..., y2m denote the 2 possible random strings

Input to M is a m-bit string picked uniformly from all the yi ’s

43 / 85 This is equivalent to the following: −n m x ∈ L: ≥ (1 − 2 ) · 2 strings yi s.t. M(x, yi ) = 1 −n m x ∈/ L: ≤ (2 ) · 2 strings yi s.t. M(x, yi ) = 1

To prove L ∈ Σ2, have to find a way to distinguish the two cases using a ‘∃’ and a ‘∀’ quantifier. Basic idea: Find a way to formulate, with polynomial-sized certificates u and v, the fact that x ∈ L if and only if there exist lots (≥ (1 − 2−n) · 2m) of m-bit strings yi such that for all of them, N returns 1.

The Construction

From now on, lets fix the input x where |x| = n. Then: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−n x ∈/ L: Prob [M(x, y) = 1] ≤ 2−n

44 / 85 −n m x ∈/ L: ≤ (2 ) · 2 strings yi s.t. M(x, yi ) = 1

To prove L ∈ Σ2, have to find a way to distinguish the two cases using a ‘∃’ and a ‘∀’ quantifier. Basic idea: Find a way to formulate, with polynomial-sized certificates u and v, the fact that x ∈ L if and only if there exist lots (≥ (1 − 2−n) · 2m) of m-bit strings yi such that for all of them, N returns 1.

The Construction

From now on, lets fix the input x where |x| = n. Then: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−n x ∈/ L: Prob [M(x, y) = 1] ≤ 2−n This is equivalent to the following: −n m x ∈ L: ≥ (1 − 2 ) · 2 strings yi s.t. M(x, yi ) = 1

45 / 85 To prove L ∈ Σ2, have to find a way to distinguish the two cases using a ‘∃’ and a ‘∀’ quantifier. Basic idea: Find a way to formulate, with polynomial-sized certificates u and v, the fact that x ∈ L if and only if there exist lots (≥ (1 − 2−n) · 2m) of m-bit strings yi such that for all of them, N returns 1.

The Construction

From now on, lets fix the input x where |x| = n. Then: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−n x ∈/ L: Prob [M(x, y) = 1] ≤ 2−n This is equivalent to the following: −n m x ∈ L: ≥ (1 − 2 ) · 2 strings yi s.t. M(x, yi ) = 1 −n m x ∈/ L: ≤ (2 ) · 2 strings yi s.t. M(x, yi ) = 1

46 / 85 Basic idea: Find a way to formulate, with polynomial-sized certificates u and v, the fact that x ∈ L if and only if there exist lots (≥ (1 − 2−n) · 2m) of m-bit strings yi such that for all of them, N returns 1.

The Construction

From now on, lets fix the input x where |x| = n. Then: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−n x ∈/ L: Prob [M(x, y) = 1] ≤ 2−n This is equivalent to the following: −n m x ∈ L: ≥ (1 − 2 ) · 2 strings yi s.t. M(x, yi ) = 1 −n m x ∈/ L: ≤ (2 ) · 2 strings yi s.t. M(x, yi ) = 1

To prove L ∈ Σ2, have to find a way to distinguish the two cases using a ‘∃’ and a ‘∀’ quantifier.

47 / 85 The Construction

From now on, lets fix the input x where |x| = n. Then: x ∈ L: Prob [M(x, y) = 1] ≥ 1 − 2−n x ∈/ L: Prob [M(x, y) = 1] ≤ 2−n This is equivalent to the following: −n m x ∈ L: ≥ (1 − 2 ) · 2 strings yi s.t. M(x, yi ) = 1 −n m x ∈/ L: ≤ (2 ) · 2 strings yi s.t. M(x, yi ) = 1

To prove L ∈ Σ2, have to find a way to distinguish the two cases using a ‘∃’ and a ‘∀’ quantifier. Basic idea: Find a way to formulate, with polynomial-sized certificates u and v, the fact that x ∈ L if and only if there exist lots (≥ (1 − 2−n) · 2m) of m-bit strings yi such that for all of them, N returns 1.

48 / 85 Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s

49 / 85 I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string

50 / 85 I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p

51 / 85 I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p

52 / 85 I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function

53 / 85 The value in each cell: Aij = M(x, Pi ⊕ yj )

The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

54 / 85 The Construction m m Consider the 2 strings yi ’s and take 2 permutations

y1 y2 y3 y4 y5 y6 y1 y2m

p1 y1 p1 y2m p1 y2 y3 y1 y6 y4 y5 p1 ⊕ ⊕

p2 y6 y1 y5 y2 y3 y4

p3 y4 y3 y5 y1 y6 y2

p m p2m y1 p2m y2m p4 y3 y4 y6 y5 y2 y1 2 ⊕ ⊕

m p1, ..., p2m are 2 permutations of the yi ’s Claim: Each permutation pi can be coded by a m-bit string I For a fixed p, and any yi , consider m-bit string yi ⊕ p I For contradiction, assume T = yi ⊕ p = yj ⊕ p I A ⊕ B = C =⇒ A = B ⊕ C. So ⊕ is a 1-to-1 function I Hence yi = yj = T ⊕ p, contradiction since each yi distinct

The value in each cell: Aij = M(x, Pi ⊕ yj )

55 / 85 If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

56 / 85 No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

57 / 85 I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

58 / 85 I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

59 / 85 I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

60 / 85 I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

61 / 85 I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

62 / 85 If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

63 / 85 If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

64 / 85 Some Properties of these Permutations

Because each row is just a permutation of yi ’s, we have If x ∈ L, every row has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every row has ≤ (2−n) · 2m 1’s

No string yi is mapped to the same string yj twice

I Suppose p1 maps yi → yj and p2 also maps yi → yj

I Then yj = yi ⊕ p1 and yj = yi ⊕ p2

I But then, p1 = yj ⊕ yi and p2 = yj ⊕ yi

I Hence p1 = p2, contradiction since all pi distinct strings

I Each column is just a permutation of the yi ’s

If x ∈ L, every column has ≥ (1 − 2−n) · 2m 1’s

If x ∈/ L, every column has ≤ (2−n) · 2m 1’s

65 / 85 Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row , there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

66 / 85 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s.

67 / 85 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row

68 / 85 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row

69 / 85 This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row

70 / 85 2m The number of ways to choose m columns: m

Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row

71 / 85 Case: x ∈ L Claim 1 If x ∈ L, there exist m columns such that none of the rows have all 0’s in these m columns

Proof We know each row has at most 2m−n 0’s. 2m−n For a fixed row r, there are m ways to choose m columns such that each one of them contains a 0 for that row 2m−n Therefore, for each row r, there are at most m ways to choose m columns that are ‘bad’ for that row 2m−n m Therefore, there are at most m · 2 ways to choose m columns that are ‘bad’ for some row This is an over-count since same set of m columns can be ‘bad’ for more than one row 2m The number of ways to choose m columns: m

72 / 85 e2m−n m m 2m m n First note that ( m ) · 2 ≤ ( m ) since 2e < 2 Using the following well-known inequality,

n n e · n ( )k ≤ ≤ ( )k k k k

2m m 2m 2m−n e2m−n m we get that ( m ) ≤ m and m ≤ ( m )

2m−n m 2m Therefore, we have m · 2 < m Hence there exists a way to select m columns such that none of the rows have all 0’s in those columns.

Case: x ∈ L

Pigeon-hole Principle: If the number of ways to choose m columns that are ‘bad’ for some row is less than the total number of ways to choose m columns, then there must exist m columns that are ‘good’ for each row

73 / 85 Using the following well-known inequality,

n n e · n ( )k ≤ ≤ ( )k k k k

2m m 2m 2m−n e2m−n m we get that ( m ) ≤ m and m ≤ ( m )

2m−n m 2m Therefore, we have m · 2 < m Hence there exists a way to select m columns such that none of the rows have all 0’s in those columns.

Case: x ∈ L

Pigeon-hole Principle: If the number of ways to choose m columns that are ‘bad’ for some row is less than the total number of ways to choose m columns, then there must exist m columns that are ‘good’ for each row

e2m−n m m 2m m n First note that ( m ) · 2 ≤ ( m ) since 2e < 2

74 / 85 2m−n m 2m Therefore, we have m · 2 < m Hence there exists a way to select m columns such that none of the rows have all 0’s in those columns.

Case: x ∈ L

Pigeon-hole Principle: If the number of ways to choose m columns that are ‘bad’ for some row is less than the total number of ways to choose m columns, then there must exist m columns that are ‘good’ for each row

e2m−n m m 2m m n First note that ( m ) · 2 ≤ ( m ) since 2e < 2 Using the following well-known inequality,

n n e · n ( )k ≤ ≤ ( )k k k k

2m m 2m 2m−n e2m−n m we get that ( m ) ≤ m and m ≤ ( m )

75 / 85 Hence there exists a way to select m columns such that none of the rows have all 0’s in those columns.

Case: x ∈ L

Pigeon-hole Principle: If the number of ways to choose m columns that are ‘bad’ for some row is less than the total number of ways to choose m columns, then there must exist m columns that are ‘good’ for each row

e2m−n m m 2m m n First note that ( m ) · 2 ≤ ( m ) since 2e < 2 Using the following well-known inequality,

n n e · n ( )k ≤ ≤ ( )k k k k

2m m 2m 2m−n e2m−n m we get that ( m ) ≤ m and m ≤ ( m )

2m−n m 2m Therefore, we have m · 2 < m

76 / 85 Case: x ∈ L

Pigeon-hole Principle: If the number of ways to choose m columns that are ‘bad’ for some row is less than the total number of ways to choose m columns, then there must exist m columns that are ‘good’ for each row

e2m−n m m 2m m n First note that ( m ) · 2 ≤ ( m ) since 2e < 2 Using the following well-known inequality,

n n e · n ( )k ≤ ≤ ( )k k k k

2m m 2m 2m−n e2m−n m we get that ( m ) ≤ m and m ≤ ( m )

2m−n m 2m Therefore, we have m · 2 < m Hence there exists a way to select m columns such that none of the rows have all 0’s in those columns.

77 / 85 Proof We know each column has at most 2m−n 1’s. So each column picked can only ‘cover’ at most 2m−n rows The total number of rows covered with m columns: 2m−n · m The total number of rows is 2m. As m < 2n,

2m−n · m < 2m

Therefore, there will always be some rows having all 0’s, for any choice of m columns

Case: x ∈/ L

Claim 2 If x ∈/ L, no matter how we choose our m columns, at least one of the rows will have all 0’s.

78 / 85 So each column picked can only ‘cover’ at most 2m−n rows The total number of rows covered with m columns: 2m−n · m The total number of rows is 2m. As m < 2n,

2m−n · m < 2m

Therefore, there will always be some rows having all 0’s, for any choice of m columns

Case: x ∈/ L

Claim 2 If x ∈/ L, no matter how we choose our m columns, at least one of the rows will have all 0’s.

Proof We know each column has at most 2m−n 1’s.

79 / 85 The total number of rows covered with m columns: 2m−n · m The total number of rows is 2m. As m < 2n,

2m−n · m < 2m

Therefore, there will always be some rows having all 0’s, for any choice of m columns

Case: x ∈/ L

Claim 2 If x ∈/ L, no matter how we choose our m columns, at least one of the rows will have all 0’s.

Proof We know each column has at most 2m−n 1’s. So each column picked can only ‘cover’ at most 2m−n rows

80 / 85 The total number of rows is 2m. As m < 2n,

2m−n · m < 2m

Therefore, there will always be some rows having all 0’s, for any choice of m columns

Case: x ∈/ L

Claim 2 If x ∈/ L, no matter how we choose our m columns, at least one of the rows will have all 0’s.

Proof We know each column has at most 2m−n 1’s. So each column picked can only ‘cover’ at most 2m−n rows The total number of rows covered with m columns: 2m−n · m

81 / 85 Case: x ∈/ L

Claim 2 If x ∈/ L, no matter how we choose our m columns, at least one of the rows will have all 0’s.

Proof We know each column has at most 2m−n 1’s. So each column picked can only ‘cover’ at most 2m−n rows The total number of rows covered with m columns: 2m−n · m The total number of rows is 2m. As m < 2n,

2m−n · m < 2m

Therefore, there will always be some rows having all 0’s, for any choice of m columns

82 / 85 Claim 2: If x ∈/ L, whichever y1,..., ym we choose, for at least one particular p, the machine M will output 0 for all of M(x, yi ⊕ p), where 1 ≤ i ≤ m

From Claims 1 and 2 we conclude x ∈ L if and only if

∃y1,..., ym ∀p (M(x, y1 ⊕ z) ∨ ... ∨ M(x, ym ⊕ p)) = 1

Therefore, L ∈ Σ2, and so BPP ⊆ Σ2.

Putting Everything Together

Claim 1: If x ∈ L, we will be able to choose m strings, y1,..., ym, such that for all m-bit permutation strings p, the machine M will output 1 for at least one of M(x, yi ⊕ p), where 1 ≤ i ≤ m

83 / 85 From Claims 1 and 2 we conclude x ∈ L if and only if

∃y1,..., ym ∀p (M(x, y1 ⊕ z) ∨ ... ∨ M(x, ym ⊕ p)) = 1

Therefore, L ∈ Σ2, and so BPP ⊆ Σ2.

Putting Everything Together

Claim 1: If x ∈ L, we will be able to choose m strings, y1,..., ym, such that for all m-bit permutation strings p, the machine M will output 1 for at least one of M(x, yi ⊕ p), where 1 ≤ i ≤ m

Claim 2: If x ∈/ L, whichever y1,..., ym we choose, for at least one particular p, the machine M will output 0 for all of M(x, yi ⊕ p), where 1 ≤ i ≤ m

84 / 85 Putting Everything Together

Claim 1: If x ∈ L, we will be able to choose m strings, y1,..., ym, such that for all m-bit permutation strings p, the machine M will output 1 for at least one of M(x, yi ⊕ p), where 1 ≤ i ≤ m

Claim 2: If x ∈/ L, whichever y1,..., ym we choose, for at least one particular p, the machine M will output 0 for all of M(x, yi ⊕ p), where 1 ≤ i ≤ m

From Claims 1 and 2 we conclude x ∈ L if and only if

∃y1,..., ym ∀p (M(x, y1 ⊕ z) ∨ ... ∨ M(x, ym ⊕ p)) = 1

Therefore, L ∈ Σ2, and so BPP ⊆ Σ2.

85 / 85