Upcoming SlideShare
×

# Randomized Computation

448 views
397 views

Published on

Published in: Education, Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
448
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
7
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Randomized Computation

1. 1. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryChapter 7: Randomized ComputationJhoirene ClementeFebruary 7, 2013S. Arora, B. BarakComputational Complexity: A Modern Approach
2. 2. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
3. 3. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryA randomized algorithm is an algorithm that is allowed access toa source of independent, unbiased, random bits. The algorithm isthen permitted to use these random bits to inﬂuence itscomputation.We want to study TMs that has the power to toss random coins.S. Arora, B. BarakComputational Complexity: A Modern Approach
4. 4. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryA randomized algorithm is an algorithm that is allowed access toa source of independent, unbiased, random bits. The algorithm isthen permitted to use these random bits to inﬂuence itscomputation.We want to study TMs that has the power to toss random coins.S. Arora, B. BarakComputational Complexity: A Modern Approach
5. 5. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryIntroductionRecallDeﬁnition (Turing Machine)A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q,Σ, Γ are all ﬁnites sets and1 Q is the set of states,2 Σ is the input alphabet not containing the blank symbol .3 Γ is the tape alphabet, where ∈ Γ and Σ ⊆ Γ,4 δ : Q × Γ → Q × Γ × {L, R} is the transition function,5 q0 ∈ Q is the start,6 qaccept ∈ Q is the accept state, and7 qreject ∈ Q is the reject state, where qreject = qacceptS. Arora, B. BarakComputational Complexity: A Modern Approach
6. 6. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryExample Deterministic Turing MachineS. Arora, B. BarakComputational Complexity: A Modern Approach
7. 7. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryNondeterministic Turing MachineDeﬁnition (Nondeterministic Turing Machine)A nondeterministic Turing machine is a 7-tuple,(Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all ﬁnites sets andδ : Q × Γ → P(Q × Γ × {L, R})From each conﬁguration, there may be several possible transitions,generating a ‘tree’ of computations.If some computation branch leads to accept, then the machine acceptsits input.S. Arora, B. BarakComputational Complexity: A Modern Approach
8. 8. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
9. 9. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryProbabilistic Turing Machines (PTMs)Deﬁnition (PTMs)A Probabilistic Turing Machine (PTM) is a Turing machine with twotransition functions δ0, δ1.To execute a PTM M on an input x, we choose in each step withprobability 1/2 to apply δ0 and with probability 1/2 to apply δ1.This choice is made independently of all previous choices.The machine outputs ACCEPT (1) or REJECT (0). M(x) denotesthe output of M on x and surely this is a random variable.For a function T : N → N,we say that M runs in T(n) time if forany input x, M halts on x within T(|x|) steps regardless of therandom choices M makes.S. Arora, B. BarakComputational Complexity: A Modern Approach
10. 10. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryProbabilistic Turing Machine (PTM)In a PTM M, each transition is taken with probability 1/2. If Mhas chosen the transition function t times, then M would havechosen any one of the 2t branches with a probability of 12t .We assign a probability to each branch b of M’s computation oninput w as follows. Deﬁne the probability of branch b to bePr[b] = 2−k, where k is the number of coin ﬂip steps that occuron branch b.An NDTM accepts if ∃ one accepting branch. Deﬁne theprobability that M accepts w to bePr[M accepts w] =b is an accepting branchPr[b].The probability that M rejects w isPr[M rejects w] = 1 − Pr[M accepts w]S. Arora, B. BarakComputational Complexity: A Modern Approach
11. 11. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryProbabilistic Turing Machine (PTM)In a PTM M, each transition is taken with probability 1/2. If Mhas chosen the transition function t times, then M would havechosen any one of the 2t branches with a probability of 12t .We assign a probability to each branch b of M’s computation oninput w as follows. Deﬁne the probability of branch b to bePr[b] = 2−k, where k is the number of coin ﬂip steps that occuron branch b.An NDTM accepts if ∃ one accepting branch. Deﬁne theprobability that M accepts w to bePr[M accepts w] =b is an accepting branchPr[b].The probability that M rejects w isPr[M rejects w] = 1 − Pr[M accepts w]S. Arora, B. BarakComputational Complexity: A Modern Approach
12. 12. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryProbabilistic Turing Machine (PTM)In a PTM M, each transition is taken with probability 1/2. If Mhas chosen the transition function t times, then M would havechosen any one of the 2t branches with a probability of 12t .We assign a probability to each branch b of M’s computation oninput w as follows. Deﬁne the probability of branch b to bePr[b] = 2−k, where k is the number of coin ﬂip steps that occuron branch b.An NDTM accepts if ∃ one accepting branch. Deﬁne theprobability that M accepts w to bePr[M accepts w] =b is an accepting branchPr[b].The probability that M rejects w isPr[M rejects w] = 1 − Pr[M accepts w]S. Arora, B. BarakComputational Complexity: A Modern Approach
13. 13. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryProbabilistic Turing Machine (PTM)In a PTM M, each transition is taken with probability 1/2. If Mhas chosen the transition function t times, then M would havechosen any one of the 2t branches with a probability of 12t .We assign a probability to each branch b of M’s computation oninput w as follows. Deﬁne the probability of branch b to bePr[b] = 2−k, where k is the number of coin ﬂip steps that occuron branch b.An NDTM accepts if ∃ one accepting branch. Deﬁne theprobability that M accepts w to bePr[M accepts w] =b is an accepting branchPr[b].The probability that M rejects w isPr[M rejects w] = 1 − Pr[M accepts w]S. Arora, B. BarakComputational Complexity: A Modern Approach
14. 14. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryError ProbabilityWhen a PTM recognized a language it must accept all strings in thelanguage and reject all strings out of the language as usual, except thatnow we allow the machine a small probability of error.For 0 ≤ < 1/2 we say that M recognizes A with error probabilityif1 w ∈ A implies Pr[M accepts w] ≥ (1 − ), and2 w /∈ A implies Pr[M rejects w] ≥ (1 − ).Deﬁnition (Bounded Error Probabilistic Polynomial (BPP))BPP is the class of languages that are recognized by probabilisticpolynomial time Turing machines with an error probability of 1/3.S. Arora, B. BarakComputational Complexity: A Modern Approach
15. 15. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryError ProbabilityWhen a PTM recognized a language it must accept all strings in thelanguage and reject all strings out of the language as usual, except thatnow we allow the machine a small probability of error.For 0 ≤ < 1/2 we say that M recognizes A with error probabilityif1 w ∈ A implies Pr[M accepts w] ≥ (1 − ), and2 w /∈ A implies Pr[M rejects w] ≥ (1 − ).Deﬁnition (Bounded Error Probabilistic Polynomial (BPP))BPP is the class of languages that are recognized by probabilisticpolynomial time Turing machines with an error probability of 1/3.S. Arora, B. BarakComputational Complexity: A Modern Approach
16. 16. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryError ProbabilityWhen a PTM recognized a language it must accept all strings in thelanguage and reject all strings out of the language as usual, except thatnow we allow the machine a small probability of error.For 0 ≤ < 1/2 we say that M recognizes A with error probabilityif1 w ∈ A implies Pr[M accepts w] ≥ (1 − ), and2 w /∈ A implies Pr[M rejects w] ≥ (1 − ).Deﬁnition (Bounded Error Probabilistic Polynomial (BPP))BPP is the class of languages that are recognized by probabilisticpolynomial time Turing machines with an error probability of 1/3.S. Arora, B. BarakComputational Complexity: A Modern Approach
17. 17. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryBPTIME and BPPDeﬁnition (The classes BPTIME and BPP)For T : N → N and L ⊆ {0, 1}∗, we say that a PTM M decides L intime T(n), if for every x ∈ {0, 1}∗, M halts in T(|x|) steps regardlessof its random choices, andPr[M(x) = L(x)] ≥ 2/3, swhere we denote L(x) = 1 if X /∈ L and L(x) = 0 if x ∈ L.We let BPTIME(T(n)) denote the class of languages decided byPTMs in O(T(n)) time and letBPP = ∪cBPTIME(nc).S. Arora, B. BarakComputational Complexity: A Modern Approach
18. 18. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummarySome Remarks1 For every input x, M(x) will output the right value L(x) withprobability at least 2/3.2 The coin need not to be fair. The constant 2/3 is arbitrary in thesense that it can be replaced with any other constant greater than1/2 without changing the classes BPTIME(T(n)) and BPP.3 Instead of requiring the machine to always halt in a polynomialtime, we could allow it to halt in expected polynomial time.S. Arora, B. BarakComputational Complexity: A Modern Approach
19. 19. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryExpected Running TimeFor a PTM M, and input x, we deﬁne the random variable TM,x to bethe running time of M on input x. That is, Pr[TM,x = T] = p if withprobability p over the random choices of M on input x, it will haltwithin T steps.We say that M has an expected running time T(n) if the expectationE[TM,x] is at most T(|x|) for every x ∈ {0, 1}∗.S. Arora, B. BarakComputational Complexity: A Modern Approach
20. 20. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummarySome RemarksTheoremP ⊆ BPP ⊆ EXP.Proof.Since a deterministic TM is a special case of a PTM (where bothtransition functions are equal) BPP clearly contains P.Given a polynomial-time PTM M and input x ∈ {0, 1}n in time2poly(n) it is possible to enumerate all possible random choicesand compute precisely the probability that M(x) = 1.S. Arora, B. BarakComputational Complexity: A Modern Approach
21. 21. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryExample: Primality TestingIn primality testing we are given an integer N and wish to determinewhether or not it is prime.S. Arora, B. BarakComputational Complexity: A Modern Approach
22. 22. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryExample: Primality TestingIn primality testing we are given an integer N and wish to determinewhether or not it is prime.PRIME(A, N):IF (gcd(A, N) > 1) or ((N/A) = A(N−1)/2 mod N)output COMPOSITEELSEoutput PRIMETheoremPRIMES ∈ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
23. 23. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryExample: Primality TestingIn primality testing we are given an integer N and wish to determinewhether or not it is prime.PRIME(A, N):IF (gcd(A, N) > 1) or ((N/A) = A(N−1)/2 mod N)output COMPOSITEELSEoutput PRIMETheoremPRIMES ∈ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
24. 24. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
25. 25. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOne sided zero sided error: RP, coRP, ZPPThe probabilistic primality algorithm has one-sided error. When thealgorithm outputs accept, we know that the input must be prime.When the output is reject, we know only that the input could be primeor composite.Deﬁnition (RP)A language L ⊆ {0, 1}∗ is said to be in RTIME(T (n)) if there exists aPTM running in time T(n) s.t.∀ x ∈ L, Pr[M(x) = 1] ≥ 2/3∀ x ∈ L, Pr[M(x) = 0] = 1The class RP = c<0 RTIME(T(n)).TheoremRP ⊆ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
26. 26. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOne sided zero sided error: RP, coRP, ZPPThe probabilistic primality algorithm has one-sided error. When thealgorithm outputs accept, we know that the input must be prime.When the output is reject, we know only that the input could be primeor composite.Deﬁnition (RP)A language L ⊆ {0, 1}∗ is said to be in RTIME(T (n)) if there exists aPTM running in time T(n) s.t.∀ x ∈ L, Pr[M(x) = 1] ≥ 2/3∀ x ∈ L, Pr[M(x) = 0] = 1The class RP = c<0 RTIME(T(n)).TheoremRP ⊆ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
27. 27. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummarycoRPDeﬁnition (coRP)A language L ⊂ {0, 1}∗ is said to be in coRP if there exists a PTMrunning in polynomial time s.t.∀ x ∈ L, Pr[M(x) = 1] = 1∀ x ∈ L, Pr[M(x) = 0] ≥ 2/3TheoremPRIMES ∈ coRPTheoremcoRP ⊆ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
28. 28. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryZPPDeﬁnition (ZTIME(T(n)) and ZPP)The class ZTIME(T(n)) contains all languages L for which there is anexpected time O(T((n)) machine that never errs. That isx ∈ L ⇒ Pr[M accepts x] =1x /∈ L ⇒ Pr[M halts without accepting x] =1We deﬁne ZPP = c>0 ZTIME(nc).TheoremZPP = RP ∩ coRPS. Arora, B. BarakComputational Complexity: A Modern Approach
29. 29. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryComplexity ClassesS. Arora, B. BarakComputational Complexity: A Modern Approach
30. 30. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
31. 31. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryAmpliﬁcation LemmaWe deﬁned BPP with an error probability of 1/3, but any constanterror probability would yield an equivalent deﬁnition as long as it isstrictly between 0 and 1/2 by virtue of ampliﬁcation lemma.Lemma (Ampliﬁcation Lemma)Let be a ﬁxed constant strictly between 0 and 1/2. Then for anypolynomial poly(n) with a probabilistic polynomial time Turingmachine M1 that operates with error probability has an equivalentprobabilistic polynomial time Turing machine M2 that operates withan error probability of 2−poly(n).PROOF IDEA: M2 simulates M1 by running it a polynomial numberof times and taking the majority vote of the outcomes. The probabilityof error decreases exponentially with the number of runs of M1 made.S. Arora, B. BarakComputational Complexity: A Modern Approach
32. 32. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
33. 33. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryRelation of BPP with other classes1 P ⊆ BPP2 BPP ⊆ EXP3 RP ⊆ BPP4 coRP ⊆ BPP5 ZPP = RP ∩ coRP6 ZPP ⊆ BPPS. Arora, B. BarakComputational Complexity: A Modern Approach
34. 34. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryBPP is in P/polyTheoremBPP ⊆ P/polyS. Arora, B. BarakComputational Complexity: A Modern Approach
35. 35. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryPHS. Arora, B. BarakComputational Complexity: A Modern Approach
36. 36. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryIs BPP in PH?It is enough to prove that BPP ⊆ Σp2 because BPP is closed undercomplementation, i.e. BPP = coBPP.S. Arora, B. BarakComputational Complexity: A Modern Approach
37. 37. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummaryOutline1 Introduction2 Probabilistic Turing Machines (PTM)3 RP, coRP, ZPP4 Error Reduction for BPP5 Relation of BPP with other classes6 SummaryS. Arora, B. BarakComputational Complexity: A Modern Approach
38. 38. Introduction Probabilistic Turing Machines (PTM) RP, coRP, ZPP Error Reduction for BPP Relation of BPP with other classes SummarySummary1 The class BPP consists of languages that can be solved by aprobabilistic polynomial-time algorithm.2 RP, coRP, and ZPP are subclasses of BPP corresponding toprobabilistic algorithms with one sided and ”zero sided” error.3 Using repetition, we can considerably amplify the successprobability of probabilistic algorithms.4 We only know that P ⊆ BPP ⊆ EXP, but we suspect thatBPP = P.5 BPP is a subset of both P/poly and PH. in particular, the latterimplies that if NP = P then BPP = P.S. Arora, B. BarakComputational Complexity: A Modern Approach