TCS: Randomized Computation
Randomized Computation
Randomized Algorithm
A randomized algorithm outputs the correct value with good probability on every possible input.
Matrix multiplication
Input matrix A,B,C, decide if C=AB
Obviously there is a deterministic and polynomial algorithm for this.
A random algorithm: Freivalds’ algorithm
- Repeat the following for k times.
- Randomly choose v∈{0,1}n
- Compute (d=A(Bv)−Cv)
- Reject if d=0
- Accept
We have that this algorithm can solve this problem in O(kn2) time with
a probability of failure ≤2−k
Proof:
If AB=C, we prove P(d=0)≤21 for each time.
So D=AB−C=0. Let Dij=0
The i-th entry of d holds that:
di=∑Dikvk=Dijvj+k=j∑Dikvk
Let s=k=j∑Dikvk, so:
P(di=0)=P(di=0∣s=0)P(s=0)+P(di=0∣s=0)P(s=0)≤P(vi=0)P(s=0)+P(vi=1)P(s=0)≤21(P(s=0)+P(s=0))≤21
So P(d=0n)≤P(di=0)≤21
Maxcut Approximation
The MAX-CUT problem is NP-Complete. So our task is to find a cut C whose size is not far from the optimal one C∗.
If sizeC≥αsizeC∗, we call C is an α-approximation, then we have an easily way to find 21-approximation, which is universal randomly distribute each vertex into set 0 or 1.
E(sizeC)=E{u,v}∈E∑1xu=xv=21∣E∣≥21sizeC∗.
This is just sufficient expection, but we can give an always-large-enough cut by conditional expection if we can compute this equation efficiently.
E(sizeC(x1,…,xi,Xi+1,…Xn)),
We maximize this in each choice.
Derandomize
Above algorithm uses n random choices, covering 2n possibilities. We can try to reduce the randomness to a polynomial number of possibilities, we can derandomize the algorithm.
Considering Universal hash function:
Consider a family of hash functions H={h:U→R}. Universal hash functions are a family of functions with the random-like property while the size of the family is small. We can use a small seed to choose hash functions from the family.
Pairwise independent hash functions.
A family H={h:U→R} is called Pairwise independent if for any distinct x1,x2∈Uand any y1,y2∈R, we have:
Ph∈H(h(x1)=y1 and h(x2)=y2)=∣R∣21.
A pairwise independent hash functions mapping {0,1}k to {0,1}.
H={h(x)=(ax+b)(mod 2)∣a∈{0,1}kb∈{0,1}}
This family size is ∣H∣=2k+1. Assign k=⌈logn⌉, then U can encoding each vertex in G. So ∣H∣≤2n, which means we can go through all the hash function in H and output the maximized cut.
BPP
Define Prob TM as follows:
A probabilistic Turing machine is a type of NTM in which each nondeterministic step is called a coin-flip step and has two legal next moves. We assign a probability 2−k to each branch of the machine’s computation where k is the number of coin flips occur in the branch.
The probability of the machine accepting the input is defined as
P(M accepts w)=b:b is accepting∑P(b).
This is equvilant to that each son of a vertex in NTM can be reach in the same probability.
Define the error probability ε:
- If w∈A, then P(M(w)=1)≥1−ε
- If w∈/A, then P(M(w)=1)≤ε
Then we can define BPP with error probability:
BPP is the class of languages decided by probabilistic polynomial-time Turing machines with an error probability of 31
Actually, the 31 can be replaced by any constant exactly greatly than 21
BPP can be also defined with verifier:
A decision problem A is in BPP if and only if there is a polynomial-time verifier V such that for all x, x∈A if and only if
Pr(V(x,r)=1)≥32.
Error Reduction
Any decision problem A∈BPP has a polynomial-time randomized algorithm whose error probability is 2−p(n) where p is a polynomial and n is the input size.
This can be proved by Chernoff bound or Sampling Theroem
Circuits v.s. BPP
Define SIZEn(s):
For a finite function g:{0,1}n→{0,1}, g∈SIZEn(s) if there is a circuit of at most s NAND gates computing g.
And we define the restricted function:
F↾n(x)=F(x) for x∈{0,1}n.
Then F is non-uniformly computable in T(n) size, as F∈SIZE(T) if there is a sequence C0,C1,… of NAND circuits such that:
- Cn computes F↾n
- Cn has at most T(n) gates when n is sufficiently large
So the non-uniform analog P:
P/poly=c∈N⋃SIZE(nc)
Obviously, P⊊P/poly and it can be proved BPP⊂P/poly as follows:
Due to error reduction, A∈BPP has a polynomial-time randomized algorithm whose error probability is less than 2−n, which means there is a verifier V, such that
∀xPy(V(x,y)=A(x))<2n1
So due to the union bound:
Py(∃xV(x,y)=A(x))≤x∑Py(V(x,y)=A(x))<1
As this probability is not 1, there must exist some y∗ for which ∀xV(x,y∗)=A(x).
Thus there exists a circuit with poly(n) gates to caculate problem A beacuse y∗ is polynomial
P = BPP <= P = NP
Sipser–Gács Theorem: BPP∈Σ2P∩Π2P, while the ΣP and ΠP are defined as:
ΣiPΠiP=∃∀∃…P=∀∃∀…P
And we have the following theroem
P=NP implies P=BPP
The proof is diffcult with the technique ‘probabilistic method’
And there is also a theroem that reveals the relation between B and BPP
Relations with P NP EXP
We know P⊊EXP and BPP⊆EXP
- Expected: P=BPP⊊NP⊆EXP
- Extreme: P⊊NP⊆BPP=EXP
- Extreme also: P=BPP=NP⊊EXP