6.045 Lecture 24: Randomized Complexity, Course Summary 1
1/4 1/16 1/4 1/4 1/32 1/16 1/32 Probabilistic TMs 1/16 A probabilistic TM M is a nondeterministic TM where: Each nondeterministic step is called a coin flip Each nondeterministic step has only two legal next moves (heads or tails) The probability that M runs on a branch b is: Pr [ b ] = 2 -k where k is the number of coin flips that occur on branch b 2
Definition. A probabilistic TM M decides a language A with error if for all strings w, w A Pr [ M accepts w ] 1 - w A Pr [ M doesn t accept w ] 1 - Theorem: A language A is in NP if there is a nondeterministic polynomial time TM M such that for all strings w: w A Pr[ M accepts w ] > 0 w A Pr[ M accepts w ] = 0 3
BPP = Bounded Probabilistic P BPP = { L L is recognized by a probabilistic polynomial-time TM with error at most 1/3 } Why 1/3? It doesn t matter what error value we pick, as long as the error is smaller than 1/2. When the error is smaller than 1/2, we can apply the error reduction lemma. 4
Checking Matrix Multiplication CHECK = { (M 1,M 2,N) M 1, M 2 and N are matrices and M 1 M 2 = N } If M 1 and M 2 are n x n matrices, computing M 1 M 2 takes O(n 3 ) time normally, and O(n 2.373 ) time using very clever methods. Here is an O(n 2 )-time randomized algorithm for CHECK: Pick a 0-1 bit vector r at random, test if M 1 M 2 r = Nr Claim: If M 1 M 2 = N, then Pr [M 1 M 2 r = Nr ] = 1 If M 1 M 2 N, then Pr [M 1 M 2 r = Nr ] 1/2 WHY? 5
Checking Matrix Multiplication CHECK = { (M 1,M 2,N) M 1, M 2 and N are matrices and M 1 M 2 = N } If M 1 and M 2 are n x n matrices, computing M 1 M 2 takes O(n 3 ) time normally, and O(n 2.373 ) time using very clever methods. Here is an O(n 2 )-time randomized algorithm for CHECK: Pick a 0-1 bit vector r at random, test if M 1 M 2 r = Nr Claim: If M 1 M 2 = N, then Pr [M 1 M 2 r = Nr ] = 1 If M 1 M 2 N, then Pr [M 1 M 2 r = Nr ] 1/2 If we pick 20 random vectors and test them all, what is the probability of incorrect output? 1/2 20 < 0.000001 6
An arithmetic formula is like a Boolean formula, except it has +,, and * instead of OR, NOT, AND. ZERO-POLY = { p p is an arithmetic formula that is identically zero} Two examples of polynomials in ZERO-POLY: (x + y) (x + y) x x y y 2 x y Abbreviate as: (x + y) 2 x 2 y 2 2xy (x 2 + a 2 ) (y 2 + b 2 ) (x y a b) 2 (x b + a y) 2 There is a rich history of polynomial identities in mathematics. Useful also in program testing! 7
Testing Polynomials Let p(x) be a polynomial in one variable over Z p(x) = a 0 + a 1 x + a 2 x 2 + + a d x d Suppose p is hidden in a black box we can only see its inputs and outputs. Want to determine if p is identically 0 Simply evaluate p on d+1 distinct values! Non-zero degree d polynomials have d roots. But the zero polynomial has every value as a root. 8
Testing General Polynomials Let p(x 1,,x n ) be a polynomial in n variables over Z Suppose p(x 1,,x n ) is given to us, but as a very complicated arithmetic formula. Can we efficiently determine if p is identically 0? If p(x 1,,x n ) is a product of m polynomials, each of which is a polynomial in t terms, expanding out the whole expression could take t m time! Big Idea: Evaluate p on random values 9
Theorem (Schwartz-Zippel) Let p(x 1,x 2,,x n ) be a nonzero polynomial on n variables, where each variable has degree at most d. Let F ½ Z be finite. If a 1,, a m are selected randomly from F, then: Pr [ p(a 1,, a m ) = 0 ] dn/ F Proof (by induction on n): Base Case (n = 1): Pr [ p(a 1 ) = 0 ] d/ F Nonzero polynomials of degree d have most d roots, so at most d elements in F make p zero 10
Inductive Step (n > 1): Assume true for n-1 and prove true for n First we factor out the last variable, x n Write: p = p 0 + x n p 1 + x n2 p 2 + + x nd p d where x n does not occur in any p i (x 1,,x n-1 ) If p(a 1,,a n ) = 0, there are two possibilities: (1) For all i, p i (a 1,,a n-1 ) = 0 (2) Some p i (a 1,,a n-1 ) 0, and a n is a root of the 1-variable degree-d polynomial on x n that results from evaluating p 0,,p d on (a 1,,a n-1 ) Pr [ (1) ] (n-1)d/ F Pr [ (2) ] d/ F Pr [ (1) or (2) ] nd/ F 11
An arithmetic formula is like a Boolean formula, except it has +,, and * instead of OR, NOT, AND. ZERO-POLY = { p p is an arithmetic formula that is identically zero} Theorem: ZERO-POLY BPP Proof Idea: Suppose n= p. Then p has k n variables, and the degree of each variable is O(n). For all i=1,,k, choose r i randomly from {1,,n 3 }. If p(r 1,, r k ) = 0 then output zero else output nonzero This actually WORKS with high probability! 12
ZERO-POLY = { p p is an arithmetic formula that is identically zero} Theorem: ZERO-POLY BPP It is not known how to solve this problem efficiently without randomness! Showing ZERO-POLY P WOULD IMPLY NEW LOWER BOUNDS (not P NP, but still a breakthrough!) 13
BPP = { L L is recognized by a probabilistic polynomial-time TM with error at most 1/3 } Is BPP NP? THIS IS AN OPEN QUESTION! 14
Is BPP PSPACE? Yes! Run through all possible sequences of coin flips one at a time, and count the number of branches that accept. In fact, BPP NP NP is known, but BPP P NP is open! 15
Is NP BPP? THIS IS AN OPEN QUESTION! 16
Is BPP = EXPTIME? THIS IS AN OPEN QUESTION!?*!#! 17
Definition: A language A is in RP (Randomized P) if there is a nondeterministic polynomial time TM M such that for all strings x: x A Pr[M(x) accepts] = 0 x A Pr[M(x) accepts] > 2/3 NONZERO-POLY = { p p is an arithmetic formula that is not identically zero} Theorem: NONZERO-POLY RP 18
Is RP NP? Yes! 19
Is RP BPP? Yes! 20
Deterministic Finite Automata states 0 q 1 accept states (F) 1 0,1 1 q 0 q 2 0 0 start state (q 0 ) q 3 1 states 21
Deterministic Computation Non-Deterministic Computation reject accept or reject accept Are these equally powerful??? YES for finite automata 22
Regular Languages are closed under all of the following operations: Union: A B = { w w A or w B } Intersection: A B = { w w A and w B } Complement: A = { w Σ* w A } Reverse: A R = { w 1 w k w k w 1 A } Concatenation: A B = { vw v A and w B } Star: A* = { w 1 w k k 0 and each w i A } 23
Streaming Algorithms Have three components Initialize: <variables and their assignments> When next symbol seen is σ: <pseudocode using σ and vars> When stream stops (end of string): <accept/reject condition on vars> (or: <pseudocode for output>) Algorithm A computes L Σ if A accepts the strings in L, rejects strings not in L
Communication Complexity A theoretical model of distributed computing Function f : {0,1}* {0,1}*! {0,1} Two inputs, x {0,1}* and y {0,1}* We assume x = y =n. Think of n as HUGE Two computers: Alice and Bob Alice only knows x, Bob only knows y Goal: Compute f(x, y) by communicating as few bits as possible between Alice and Bob We do not count computation cost. We only care about the number of bits communicated. 25
Deterministic TM Computation (Decidable) Non-Deterministic TM Computation (Recognizable) reject accept or reject accept Are these equally powerful??? NO for Turing machines 26
recognizable decidable Always halts with answer co-recognizable
Reducing One Problem to Another f : Σ* Σ* is a computable function if there is a Turing machine M that halts with just f(w) written on its tape, for every input w A language A is mapping reducible to language B, written as A m B, if there is a computable f : Σ* Σ* such that for every w Σ*, w A f(w) B f is called a mapping reduction (or many-one reduction) from A to B 28
recognizable decidable co-recognizable
Deterministic Poly-Time Computation Non-Deterministic Poly-Time Computation reject accept or reject accept Are these equally powerful??? P = NP???? 30
conp NP MIN-FORMULA conp BPP P NP TAUT P FACTORING RP SAT NP NP NP EXPTIME PSPACE
What s next? A few possibilities 6.046 Design and Analysis of Algorithms 6.841/18.405 Advanced Complexity Theory 18.408 Topics in Theoretical Computer Science 18.416 Randomized Algorithms 6.875 Cryptography and Cryptanalysis 6.XXX Fine-Grained Algorithms & Complexity 32
Thank you! For being a great class