1 slides by vera asodi & tomer naveh updated by : avi ben-aroya & alon brook adapted from...
Post on 19-Dec-2015
223 views
TRANSCRIPT
1
Slides by Vera Asodi & Tomer NavehSlides by Vera Asodi & Tomer Naveh
Updated By : Avi Ben-Aroya & Alon BrookUpdated By : Avi Ben-Aroya & Alon Brook
Adapted from Oded Goldreich’s course lecture Adapted from Oded Goldreich’s course lecture notes by Oded Lachish, Yoav Rodeh and Yael notes by Oded Lachish, Yoav Rodeh and Yael Tauman.Tauman.
2
IntroductionIntroductionIn this lecture we’ll cover:Definition and characterization of #PCompleteness in #PRange problemsPromise problemsThe relation between NP and #PUnique SAT
3
#P#PDef: An NP-relation is a relation R** s.t.R is polynomial-time decidable.There exists a polynomial p(.) such that for
every (x,y)R |y|p(|x|).
Def: LR = {x*|y s.t. (x,y)R}
y is a witness to the membership of x in LR.The class NP relates to whether such y exists.Another natural question may be:
“how many such y’s exist?”This is the question the class #P concerned
with
10.1
4
#P - Def#P - Def
Def: For every binary relation R**, the counting function fR:*N, is defined by:fR(x) = |{y | (x,y)R}|
Def: #P = {fR: R is an NP-relation}
Def (counting language): The language of thresholds for the number of witnesses for each x*
#R = { (x,k) : |{y : (x,y)R}| k }
5
Plan of the lecturePlan of the lecture
We are interested in how does the power of #P compared with complexity classes.
This will be viewed by the following reductions :StrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
6
Some simple properties of #PSome simple properties of #P
Prop: For any NP-relation R: #R is Cook reducible to fR
fR is Cook reducible to #R
Proof:The first is trivial. For the second, we know that fR(x) is in the range
{0,…,2|p(x)|}, where p(.) is the polynomial bounding the length of the witness in the NP-relation.We use binary search to compute fR(x) , given an oracle for #R, in polynomial time in |x|.
7
Some simple properties of #P Some simple properties of #P (2)(2)Prop: For every NP-relation R, the corresponding
language LR Cook reduces to fR.
Corollary: NP Cook reduces to #P.
10.2
LRfR
8
Some simple properties of #P Some simple properties of #P (3)(3)Claim: #P Cook reduces to PSPACE.
Proof: Let p(.) be the polynomial bounding the length of the witnesses of R. We run over all possible witnesses of length p(|x|), checking for every one if it is indeed a witness, and counting the number of witnesses. Checking a witness can be done in polynomial time (since R is an NP-relation) and hence in polynomial space. Both the witness and the working area are polynomial in |x|, so the problem is in PSPACE.
9
Completeness in #PCompleteness in #P
Def: f is #P-complete if:1. f is in #P2. For every g in #P, g Cook reduces to f.
Def: A reduction :** is parsimonious with relation to NP-relations Q and R if for every x: | { y : (x,y)Q } | = | { y : ((x), y)R } |
Corollary: If R is an NP-relation, and for every NP-relation Q there exists a reduction Q from Q to R, such that Q is parsimonious with respect to Q and R, then fR is #P-complete.
10.3
That is, the number of witnesses is unchanged
10
A #P-Complete problemA #P-Complete problem
Def:
Def: #SAT =
V( )is a boolean f ormula on variables
is a truth assignm( , )
ent f o V( ) r : 1SATR
V( )is a boolean f ormula on variables
is a truth assignm( , )
ent f o V( ) r : 1SATR
SATRf SATRf
10.4
11
A #P-Complete problem (2)A #P-Complete problem (2)
Thm: #SAT is #P-complete
Proof (Outline):1. #SAT is in #P since RSAT is an NP-relation.2. We have proved that SAT is NP-complete by a
reduction from any NP-relation to bounded halting, a reduction from bounded halting to circuit-SAT, and a reduction from circuit-SAT to SAT.If we look at these reductions, we can see that the correspondence between the witnesses is 1-1, and therefore the reductions are parsimonious.By the previous corollary, it follows that #SAT is #P-complete
That’s the reduction we used at the time
12
Example: fExample: fRR is #P-complete, L is #P-complete, LRRPP
Thm: There exists an NP-relation R s.t. fR is #P-complete, and LR is in P.
Proof:We define a relation:R’SAT = { (,(,)) | [(() = 1) ( = 1)] ( = 0) }.
Every has a witness it is in P.
But #SAT() + 2|variables()| = , so #SAT can be calculated from , therefore is #P-complete.
SAT'RL
SAT'Rf
SAT'RfSAT'Rf
10.5
13
Def: RPM = { (G,f): G is a bipartite graph and f is a perfect matching of G }
Prop: is polynomial-time decidable.
Thm: is #P-Complete.
This result is proved by showing that calculating the permanent of a {0,1} matrix is #P-complete (not proven), and computationally equivalent to perfect matching.
Perfect MatchingPerfect Matching
PMRL
PMRf
10.6
14
Perfect Matching (2)Perfect Matching (2)Def: The permanent of an nn matrix
is: . Perm(A) is, in fact, the number of ways to choose
n 1’s from the matrix, one in each column and one in each row.
If we look at a bipartite graph with n vertices in each side, then we can represent its edges as an {0,1} matrix of size nn. Each perfect matching is n 1’s from this matrix, one in each column and one in each row. Therefore Perm(A) and the number of perfect matchings are equivalent problems.
n1j,ij,iaA
nS
n
1ii,iaAPerm
Hot news a PTAS for the Permanent problem
has been discovered recently
15
Perfect matching (3)Perfect matching (3)
1
2
3
4
1
2
3
4
1234
11101
20100
31111
40010
16
Cycle CoverCycle Cover
Def: A cycle cover of a directed graph G, is a set of vertex-disjoint simple cycles that cover all the vertices of G.
Prop: For every directed graph G, Perm(A(G)) = #Cycle(G), where A(G) is the adjacency matrix of G.
10.7
17
Cycle Cover (2)Cycle Cover (2)
2
6
7
3
54
1 1234567
10010000
21010000
30000100
40010010
50100000
60010001
70101010
18
How Close is #P to NP?How Close is #P to NP?
We’ve seen that NP Cook #P Cook PSPACE.
We’ll now try to refine these bounds by showing that a counting problem in #P can be probabilistically approximated in polynomial time using an NP oracle.
10.8
19
Range ProblemsRange Problems
Def: A range problem is defined by two functions =(l, u), l,, u:*N,x l(x) u(x), such that on input x* the problem is to find t[l(x), u(x)].
Def (strong range): For f: *N and a polynomial p(.), we define the range problem StrongRangep(f)=(l,u), where andMeaning that on input x* the problem is to find t[l(x), u(x)]
xp11xfxl xp11xfxl xp
11xfxu xp11xfxu
10.9
20
Range Problems (2)Range Problems (2)
Prop: If we can approximate #SAT strongly, we can just as strongly approximate any f in #P, i.e. StrongRangep(f) Cook StrongRangep(#SAT).
Proof: As we have seen, for every f in #P there is a parsimonious reduction f with relation to f and #SAT. We may assume that |f(x)||x|, because we can always pad f(x) with something that will not change the number of witnesses.We now use our oracle to StrongRangep(#SAT) on f(x), and get a result t that satisfies:
. xf1xSAT# 1t xp
1fxp
1f
xf1xSAT# 1t xp1
fxp1f
21
Range Problems (3) Range Problems (3)
Def (constant range): For f:*N, and a constant c>0, we define a range problem ConstantRangec(f)=(l,u), where:
l(x)= f(x)/cu(x)=cf(x)
Def (weak range): For f:*N, and a constant >0, we define a range problem WeakRangec(f)=(l,u), where:
l(x)= f(x)u(x)= f(x)
1x
21
1x21
1x21x2
22
Range Problems (4)Range Problems (4)
Prop: For every polynomial p(.) and constant 0<<1:StrongRangep(#SAT) Cook WeakRange(#SAT).
Proof:Given , a Boolean formula on variables , we
define a polynomial , and build
where each is a distinct copy of the variables of .
Obviously #SAT(’)=(#SAT())q(||).Notice that |’|2||q(||).
x
1
npn2nq iq
1ix'
ix
x
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
23
Range Problems (5) Range Problems (5)
Claim: For every 0<<1 and c>0:WeakRange(#SAT) Cook ConstantRangec(#SAT).
Proof: For a large enough n: .
11 nn
21
c1 2,c,
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
24
Range Problems (6)Range Problems (6) Now, assuming we have an oracle to WeakRange(#SAT), we can
call it on ’ to get:
Our result would be .Then we have:
.
'SAT# 2,t
11''
21
q1
ts
SAT# 2,SAT# 2,s p22
p22
q
2
q
2
21
21
SAT# 1SAT# 2, p
121 p
1p
1
qq2q2
21 SAT#2,
11
25
Promise ProblemsPromise Problems
Def: A promise problem =(Y, N), where Y, N*, and YN=, is the question: given xPromise()=YN, decide whether xY.
Def (Gap8#SAT): The promise problem Gap8#SAT = (Gap8#SATY, Gap8#SATN), whereGap8#SATY = { (,K) : fSAT() > 8K }Gap8#SATN = { (,K) : fSAT() < K }
81
10.10
26
Promise Problems (2)Promise Problems (2)Prop: ConstantRange64(#SAT) Cook Gap8#SAT.
Proof: We run the following algorithm on input :
1. i = 02. while Gap8#SAT answers YES on (,8i) do i = i + 1
3. return
Denote = log8(#SAT()).
For all i < -1, #SAT() > 8·8i, so (,8i)Gap8#SATY.
Therefore, the algorithm will increment such i and will not stop.
21i8
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
27
Promise Problems (3)Promise Problems (3)
For all i > +1, #SAT() < ·8i, so (,8i)Gap8#SATN.Therefore, the algorithm must stop at the first such i or before it. Thus, the algorithm stops when i +2
Thus, the result 8k-½ satisfies:-1 k +2 -2 < k-½ < +2
SAT# 64,8 641k 2
1
81
28
Promise Problems (4)Promise Problems (4)
Comment (amplification): For every promise problem P, and machine M that satisfies: ,if we run M on xPromise(P) O(n) times, then the majority of the results will equal P(x) with probability greater than 1-2-n.
32xPxMPr PomisePrx
29
Promise Problems (5)Promise Problems (5)Prop: Given a problem P and a promise problem Q, such
that P Cook Q, if we have a probabilistic machine Q’ s.t. then for every polynomial p(.), we have a probabilistic polynomial time machine M that uses an oracle to Q’ s.t.Pr[MQ’(y) is a solution of P on input y] > 1-2-p(|y|)
Proof: Since the reduction from P to Q is polynomial, there
exists a polynomial q(.) s.t. the oracle Q is called less than q(|y|) times.
We can amplify the probability of success to The probability of M being correct is at least the
probability that all the oracle calls are correct, which is greater than 1-2-p(|y|).
32xQx'QPr QomisePrx
yp
yq1 21
30
Probabilistic Cook Probabilistic Cook ReductionsReductions
Def (probabilistic Cook reduction): Given promise problems P and Q, we say that there is a probabilistic Cook reduction from P to Q if there is a probabilistic time oracle machine M that uses Q as an oracle, and satisfies: xPromise(P) Pr[MQ(x) = P(x)] > [ where MQ(x) denotes the computation of machine M on input x when given oracle access to Q.]
Notice that in this definition the oracle has no probability of error, but using amplification we can show that an oracle with bounded error probability can be used.
32
10.11
31
UniversalUniversal22 Hashing Hashing
Def (universal2 hashing): A family of functions Hn,m mapping {0,1}n to {0,1}m is called universal2 if for a uniformly selected h from Hn,m, the random variables are pairwise independent and uniformly distributed over {0,1}m.
An efficient construction of such families should have polynomial-time algorithms for selecting and evaluating functions in the family.
n1,0eeh
10.12
32
UniversalUniversal22 Hashing (2) Hashing (2)
A popular example is the family of all affine transformations from {0,1}n to {0,1}m. That is, all functions of the form hA,b(x)=Ax+b, where A is an mn {0,1} matrix, b is an m-dimensional {0,1} vector, and the arithmetic is modulo 2.
Lemma (leftover hash): Let Hn,m be a family of universal2 hash functions mapping {0,1}n to {0,1}m, and let >0. Let S{0,1}n be arbitrary provided, s.t.|S| -32m. Then:
. 11 0eh:Se Pr m2Sm
h
33
UniversalUniversal22 Hashing (3) Hashing (3)Proof: define, for each e, a random variable Xe
Xe = 1 , h(e) = 0m
0 , otherwise
for each e1 e2, Xe1 , Xe2 are independent
(pending homework assignment)
Define now a random variable Y s.t.
SeeXY
mee (1/2) 1] Pr[X1 )E(X
)(1/2) -(1(1/2) 1]) Pr[X - (11] Pr[X1 )V(X mmeee
34
UniversalUniversal22 Hashing (4) Hashing (4)
2
2
))(/()(1)](|)([|Pr
)](1[Pr
1 0: Pr
YEYVYEYEY
YEY
ehSe m
Sm
Se
me SXEYE 2/||)()(
)2/11)(()2/11)(2/|(|)()( m
Se
mme YESXVYV
Since the X-s are pairwise independent we get :
By Chebychev inequality, we get :
1)2/11(1|)|/(2)2/11(1
))(/()()2/11(12
2
mmm
m
S
YEYE
35
GapGap88#SAT reduces to SAT#SAT reduces to SAT
Thm: Gap8#SAT R SAT.
Proof: We construct a probabilistic polynomial-time machine M which is given oracle access to SAT.On input (,2m), where has n variables, M operates as follows:
1. Select uniformlyhHn,m = {affine transformations from {0,1}n to {0,1}m}. The function h is represented by a {0,1} matrixAmn = (aij) and a {0,1} vector b = (bi)i=1,…,m.
10.13
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
36
GapGap88#SAT reduces to SAT (2)#SAT reduces to SAT (2)
2. We construct a formula h, on variables x1,…,xn,y1,…,yt such that x{0,1}n
a) h(x)=0m there exists an assignment to the yi’s s.t. h is true.
b) h(x)=0m there’s only one such assignment to the yi’s.
Now: h(x) = 0m
The formula on the right can be transformed into a CNF formula (using additional variables) which has the above properties
n
1jijj,i
m
1i2) (mod bxa
37
GapGap88#SAT reduces to SAT (3)#SAT reduces to SAT (3)
3. Define ’ = h. Use the oracle to SAT on ’, and return the result.
Claim 1: If (,2m)Gap8#SATy then ’SAT with probability greater than ½.
Proof: We define S = { x : (x)=1 }. |S|>82m because (,2m)Gap8#SATy.Prh[’SAT] = Prh[{x : (x) = 1 & h(x) = 0m} ] =
Prh[{xS : h(x) = 0m} ] Prh[|{xS : h(x) = 0m}| [1½] >½
m2
s By the Leftover Hash Lemma,
with =½
38
GapGap88#SAT reduces to SAT (4)#SAT reduces to SAT (4)
Claim 2: If (,2m)Gap8#SATN then ’SAT with probability less than .
Proof: We define S = { x : (x)=1 }. |S|< 2m because (,2m)Gap8#SATN.
Prh[’SAT] = Prh[{xS : h(x) = 0m} ] =
= Prh[( ) ]
< 2m 2-m =
81
81
Sx
m0)x(h:x
81
81
Sx
mh 0)x(hPr
39
GapGap88#SAT reduces to SAT (5)#SAT reduces to SAT (5)
{0,1}n h {0,1}m
0m
40
uniqueSATuniqueSATWe will see now a more restricted version of Gap8#SAT
called uniqueSAT, and show that SAT probabilistically Cook reduces to uniqueSAT.
Def: Gap8#SAT’ is the promise problem on input pairs (,k) defined by:
Gap8#SAT’Y = {(,k) : 8k < #SAT() < 32k)}
Gap8#SAT’N = {(,k) : #SAT() < k)}
Claim: SAT Cook reduces to Gap8#SAT’.
Proof: Given , we will create ’ s.t. #SAT(’) = 15#SAT() using 4 variables {x1,…,x4} that do not appear in .
81
10.14
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
41
uniqueSAT (2)uniqueSAT (2) We define: ’ = (x1 x2 x3 x4) Notice that:
#SAT(’)15 SAT
#SAT(’)=0 SAT We will call an oracle: Gap8#SAT’(’, 2i) for every 0i|
Variables(’)|. One of the answers is YES iff SAT:
– If SAT then all the answers are NO.– If SAT then #SAT(’)15, therefore,
log2(#SAT(’))log2(15) > 3. So there exists i0 s.t. i < log2(#SAT(’)) – 3 < i+2 82i < #SAT(’) < 322i
and for that i we get a YES answer.
42
uniqueSAT (3)uniqueSAT (3)
Def: fewSAT is the following promise problem:fewSATY = { : 1 #SAT() < 100}
fewSATN = { : #SAT() = 0}
Prop: Gap8#SAT’ probabilistically Cook reduces to fewSAT.
The proof uses the same reduction used when proving Gap8#SAT probabilistically Cook reduces to SAT.
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
43
uniqueSAT (4)uniqueSAT (4)Def: uniqueSAT is the following promise problem:
uniqueSATY = { : #SAT() = 1}
uniqueSATN = { : #SAT() = 0}
Prop: fewSAT Cook reduces to uniqueSAT
Proof: Given a formula , we construct formulas i for 1 i < 100 in the following way:
i.e. i copies of , each on a separate set of variables.
jnj1
i
1ji x,...,x
Reminder of the planStrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
44
uniqueSAT (5)uniqueSAT (5)
Now, if SAT, then so is i.
Every satisfying assignment of i corresponds to i satisfying assignments of , but these assignments are not necessarily different.
So we define i’s that will force them to be different, and even impose lexicographical order on the solutions.
Thus, i will have a unique satisfying assignment iff has exactly i satisfying assignments:
.
1jlex
j1i
1jii xx
45
The EndThe End
Let’s look at what we’ve done:
StrongRangepoly(#P) Cook
StrongRangepoly(#SAT) Cook
WeakRange(#SAT) Cook
ConstantRange64(#SAT) Cook
Gap8#SAT Probabilistic Cook
SAT Cook
Gap8#SAT’ Probabilistic Cook
fewSAT Cook
uniqueSAT
10.15