760 likes | 940 Views
P/Poly. Slides by Golan Weisz, Omer Ben Shalom Nir Ailon & Tal Moran Adapted from Oded Goldreich’s course lecture notes by Moshe Lewenstien , Yehuda Lindell & Tamar Seeman. In This Lecture. The non-uniform polynomial time class ( P/Poly ) The two equivalent definitions for the class
E N D
P/Poly Slides by Golan Weisz, Omer Ben Shalom Nir Ailon & Tal Moran Adapted from Oded Goldreich’s course lecture notes by Moshe Lewenstien , Yehuda Lindell & Tamar Seeman
In This Lecture • The non-uniform polynomial time class (P/Poly) • The two equivalent definitions for the class • The power of P/Poly • BPP is contained in P/Poly • P/Poly includes non recursive languages
8.1 What is P/Poly? • P/Polycomprise all languages accepted by TMs working with an external “advice” • Formally - LP/Poly if there exists a polynomial time two-input machine M and a sequence {an} of “advice” strings |an|p(n)s.t
What is P/Poly? TM M Advice Answer Input If the advice were not polynomially bounded it could have been a lookup table for the language.
P/Poly as Circuits ? An alternative def: • For L in P/Poly there is a sequence of circuits {Cn}, where Cn has n inputs and 1 output, its size is bounded by p(n), and: • Referred to as a non-uniform family of circuits. circuits for distinct n are not necessarily correlated
Non-Uniform Circuits A family of circuits {Cn} where circuit Cn has n inputs and 1output. Circuit 2 Circuit 3 Circuit 1
P/Poly def’s equivalent 8.1.1 • Circuit TM w/advice • a family of circuits {Cn} deciding L s.t. |Cn| is poly-bounded. • For every n, use a standard circuit encoding for C|x| as advice • Have a TM simulate the circuit and accepts/rejects accordingly.
P/Poly def’s equivalent (2) • TM w/advice circuit • a TM taking advice {an} • Construct, given M(an,.) a circuit that, on input xof length n, outputs M(an,x) • Over all n’s we get a family of circuits, based on the advices
8.1.2 P/Poly and the P=NP ? • P P/poly- empty advice • If we find a languageLNPs.t.LP/Polywe would provePNP • P/PolyandNPboth use an external string for computation. How are they different? P/poly uses a universal witness an for all inputs of size n, while for NP there may be different witnesses for inputs of same size. For L in NP, any witness is rejected if xLFor P/poly, however, there can be bad advices!
8.2.4 The power of P/Poly (1) • Claim:BPP P/Poly • Proof:By simple amplification onBPPwe get that for anyx{0,1}n, the probability forMto err onx is < 2-2n Recall: In BPP, the computation uses a sequence r of poly(n) coin tosses.
Overlapped, the black areas do not cover everything Boxes: x’s Black area: the “bad” r’s The black areas cover less than 1/4 of the boxes Apply Union Bound • Now, there are 2nx’s, for any x the probability of a bad r is at most 2-2n • Therefore, there exists at least 1 r which is good for all x’s. • To illustrate (n=2): Therefore there are r’s that are good for all x’s
8.2.3 The Extreme Power of P/Poly In fact P/Poly is even much stronger class • P/Polyincludes non-recursive languages!!!
The power of P/Poly (3) Example: • All unary languages (subsets of{1}*)are inP/Poly:the advice string can be exactlyL(1n) and the machine checks if the input is unary. • Fact: There are non-recursive unary languages. Take {1index(x) | xL} where L is non-recursive
8.3 Uniform Families of Circuits • P/Poly includes non-recursive languages due to it being non-uniform, hence, there is no guarantee the advice is even computable • A more reasonable class of circuits is the uniform family of circuits
Uniform Advice Def:A family of circuits{Cn} isuniformif there exists a poly-time TM Mthat generatesCnon input1n Thm:L isdecided by a uniform family of circuits iff L P
Simulation Proof: • If{Cn}is a uniform family of circuits decidingLandMis a TM as above,then on inputx • RunMto obtain Cn • Simulate Cn onxand output the outcome • The algorithm’s running time is polynomial
Uniform Circuits Proof(other direction): • L is a language in P. So there is a poly-time machine M decidingL. • As in the proof of Cook’s theorem, a poly-time machine M’ , given input 1ncan construct a poly-size circuit simulating M on inputs of size n. • The family of circuits generated by M’ is uniform and decides L.
8.4 Sparse languages (1) Def:A languageSis sparse if there exists a polynomialP(.)s.t. for every n |S{0,1}n| p(n) (That is, the language contains at most p(n) strings of length n) Claim: NPP/Polyiff for everyLNP, Lis Cook reducible to a sparse language Suffices to consider SAT as it is NP-complete
Sparse languages (2) Proof: • SATP/Poly SATis Cook reducible to a sparse language • FromP/Polydef, there exist a family of advice strings{an}s.t.n |an| ≤ q(n) • Let • Sin = 000…00011111…..1 • S = { 1n0Sin | n>0 and i ‘thbitof an is 1} • Sis actually a list of unary pointers to positions of“1”s in{an} S is sparse as n |S{0,1}n+q(n)+1| |an| q(n)
Sparse languages (3) The reduction: • On input,reconstructanbyq(n)queries to an oracle forS of type1n0SinRunM(an,)thereby solvingSATin polynomial time • We showed a polynomial-time solution forSATusing anS-oracletherefore it is Cook reducible to the sparse languageS
Sparse languages (4) Proof of other direction: • SATis Cook reducible to a sparse language impliesSATP/Poly • an oracle machineMSwhich decidesSATin poly-timet(.)Mmakes at mostt(|x|)oracle queries of size t(|x|) • Constructanby concatenating all the strings of length t(n)inSinto a ‘table’, SinceSis sparse the total length ofanispoly(n). • The “advice machine” will takeanas advice and use it to simulate the oracle.
8.4.9 Sparse, Karp and P vs NP Claim: • P=NPiff every languageLin NPis Karp-reducible to a sparse language Proof: P=NP Any L in NP is Karp-reducible to a sparse language Trivially Karp-reduce a language L in NP(=P) to the sparse language {0,1} using f is poly-time computable if P=NP
guarded Sparse, Karp and P vs NP (2) (a weaker version) Proof of other direction: SATis Karp-reducible to a sparse langP=NP • Def of a guarded sparse language: • Sis guarded sparseifGs.tGis a sparse language inP andSG. • Remark:Any unary language is guarded by the language{1n |n>=0}(sparse and in P)
Sparse, Karp and P vs NP(3) • Let f be the Karp-reduction of SAT to a guarded sparse language S. • Input: A Boolean formula =(x1,…,xn) • The strategy will be to compute with a DFS on the tree of all possible assignments of ’s variables.
Sparse, Karp and P vs NP (4) • Let: • We construct a tree with the ’s as nodes. Each node has two children, 0and 1. The root is the empty assignment , and the leaves have a Boolean constant value.
Sparse, Karp and P vs NP (5) 0= (0,x2,…,xn) 1= (1,x2,…,xn) 0 1 00 01 10 11 00
P=NP using the Karp-reduction(5) • The algorithm will perform a DFS on the tree. • At each node it will calculate x • The algorithm will backtrack from a node if either: • xG ( xS SAT) • It backtracked from both child. of . Can be computed in poly-time because G is in P. In this case we add x to the set BG-S - xB ( xG-S SAT)
P=NP using the Karp-reduction(6) • The algorithm stops and accept if it reaches a leaf and verifies that the assignment satisfies • The algorithm stops and rejects if it backtracks from both children of the root node. Complexity analysis: • Call a node “bad” if it does not lead to a satisfying assignment, but the algorithm proceeds to its descendants
Sparse, Karp and P vs NP (7) The point is that by keeping the data structure B, we make sure that there is no more than a polynomial number of bad nodes: that number cannot exceed |G-S| which is polynomial due to G’s sparseness
The DFS Algorithm Start:B<-Tree-Search() In case the above call was not halted, reject. Tree-Search(): if ||=n /* Leaf */ if True halt and accept else return compute x=f() /* case not at a leaf */ if xG return if xB return Tree-Search(0)Tree-Search(1) add x to B /* in case we return from the recursions */ return
Polynomial-time Hierarchy Slides by Golan Weisz && Omer Ben Shalom. Adapted from Oded Goldreich’s course lecture notes by Ronen Mizrahi
Introduction • The Polynomial-time Hierarchy is an extension of the classes P/NP. • Two ways to define the class: • By generalizing the notion of Cook reduction. • By using logical quantifiers. • We show that this class also upper bounds the notion of ‘efficient computation’. • We find conditions for the hierarchy to collapse.
PH def - by oracle machines (1) 9.1.1 • Basic definitions • MA- TMwith oracleA • L(MA) - the language of inputs accepted byMA • MA(x) – the output ofMAon inputx • L(MC) is defined as the set of languages accepted byMwith access to oracleAof classC.
PH def - by oracle machines (2) • LC1C2There exists aTMof classC1with access to an oracle in classC2that acceptsL • Examples: • PC= Languages accepted by DTM with access to an oracle A in class C. • NPC= Languages accepted byNTMwith access to an oracleAin classC • BPPC=Languages accepted by a probabilisticTMwith access to an oracleAinC.
PH def - by oracle machines (3) • We define by induction: • 1 := NP • i+1 := NPi • i := Coi • i+1:= Pi
PH def - by oracle machines (4) • Proposition: • ii i+1 i+1i+1 • Proof: • i i i+1=pi( for example NPcoNP pNP=2) • We have an oracle for L i • Ask the oracle and return answer for i • Ask the oracle and return the opposite for i(which is co-i).
PH def - by oracle machines (5) • pi i+1i+1 • pi NPi = i+1as anNP TM can compute anything aP TM machine can • Aspiis closed under complementation (any reply of the oracle can be reversed) then: L pi & pi i+1 Li+1 -
->9.1.2 PH def - by quantifiers (1) • We are building on one of the basic NP definition • A k-ary relation R is polynomially bounded if exists a polynomial P(.) s.t.(x1,x2,….,xk) [(x1,x2….,xk)R i |xi| p(|x1|) • Note that the polynomial condition here is that all variables are bounded by the x1which we define as the input
PH def - by quantifiers (2) • Recall the Quantifier definition of NP:LNP if there exists a polynomially bounded relation RL, recognizable in poly-time, s.t xL iff y s.t (x,y) RL
PH def - by quantifiers (3) • One can now define 2i:L2iifexists a polynomially bounded, polynomial time recognizable, (i+1)-ary relation RL s.txL iff y1y2y3..Qiyi s.t (x,y1,…,yi)RL • Qiis“” if i is even and “” if odd
->9.1.3 PH def equivalent (side 1) • We prove2i 1i by induction • (base) For i=1 both are NP. • Assume 2i 1i, prove 2i+1 1i+1: • The i+1st quantifiers can be viewed as (y1)+ the last i quantifiers • (*) we write: xL iff y1 s.t. (x,y1)Liwhere:(x’,y’)Li iff y2…Qi+1yi+1:(x’,y’,y2…,yi+1)RL
PH def equivalence: Li1i • RLiis polynomially bounded and polynomial-time recognizable (as RL is) • xLi iff y1…Qi+1yi:(x,y1…,yi)Rli • xco-Li iff y1…Qiyi:(x,y1…,yi)RLi • Therefore, co-Li2i, soLi2i • By the inductive hypothesis, 2i1i so we have Li1i
PH def equivalence: L1i+1 • A TMM in NPi can check the claim (*) by guessing the value of y1and using the oracle for Li • Therefore L1i+1
PH def equivalent (side 2) • We prove 1i 2iby induction • Base as before on NP with same hypothesis • L1i+1 a NTM M s.t. LL(Mi) which meansL’1i s.t. L=L(ML’)
PH def equivalent (3) L=L(ML’) means that: xL iff y1,q1,a1,…,qt,at s.tthe TM M accepts x with non-deterministic choices y receiving ai to oracle query qi: • (aj=1) qjL’ • (aj=0) qjL’
PH def equivalent (4) • “y1” is a polynomial-time predicate • We assume L’i1 and by induction 1i2i L’2i.Therefore for each question/answer we can write a relation RL’s.t: (aj=1) y1(j,1)y2(j,1)…Qiyi(j,1)s.t (qj,y1(j,1),…,yi(j,1)) RL’ (aj=0) y1(j,2) y2(j,2)…Qi+1yi(j,2)s.t (qj,y1(j,2),…,yi(j,2)) Co-RL’
PH def equivalent (5) • Let j11,…,j1k be the indices for which aj=1 • Def: w1:=y q1 a1…qi ai y1(j11,1)…y1(j1k,1) w2:=y1(j01,2)…y1(j0i-k,2) y2(j11,1)…y2(j1k,1) wi:=yi-1(j01,2)…yi-1(j0i-k,2) yi(j11,1)…yi(j1k,1) wi+1:= yi (j01,2)…yi (j0i-k,2)
PH def equivalent (?) • We can now define RLto be the (i+1)-ary relation (w1,…,wi+1)RL iff for all j(aj=1)(qj,y1(j,1),…,yi(j,1))RL’(aj=0)(qj,y1(j,2),…,yi(j,2))Co-RL’
PH def equivalent (6) • Since both RL’and its complement are polynomially bounded and polynomial-time recognized we have: xL iff W1W2…Qi+1Wi+1s.t (w1,w2,…,wi+1)RLwhich is the definition of 2i+1
->9.2.1 Thm: PH PSPACE Proof: • From the definition with quantifiers we get that xL iff y1y2y3..Qiyi (x,y1,…,yi)RL • Given x we can use i variables to try all combinations of assignments for y1…yi