• No results found

This section establishes some reductions between #CSPs.

We will often implicitly use the fact that #CSPWK(F) ≤AP #CSPW

0

K0(F0) whenever

K ⊆K0 and W ⊆ W0 and F ⊆ F0. The reduction is to pass through the input to the oracle and return the result.

5.2.1 K-formulas

Another basic reduction uses a simple type of gadget we will call aK-formula, similar to the T-constructability of [103] and refining the pps-definability of [22]. A natural type of gadget for#CSPWK(F)would allow variable weights. However, this amount of generality is not needed in the reductions later. We will be more restrictive, defining K-formulas without variable weights.

Definition 5.18. LetF be a weighted constraint language (not necessarily finite). For any K⊆N, a K-formula over F of arityk is a tupleϕ= (V, C, v1, . . . , vk) where:

• V is a finite set of variables.

• C is a list of constraints over F on V.

• v1, . . . , vk are distinct elements ofV, called theexternal variables.

• The degree of each internal (i.e. not external) variable is inK.

• Each external variable has degree1, unlessK =N.

ϕ defines a functions[[ϕ]] : {0,1}k Q≥0: [[ϕ]] (x(v1), . . . ,x(vk)) = X x|V\{v1,...,vk} Y h(s1,...,sk),Fi∈C F(x(s1), . . . ,x(sk))

for all x:{v1, . . . , vk} → {0,1}, where the sum is over all extensions of x to functions V → {0,1}.

We will usually specify a K-formula implicitly as a summation of a product. For example, a {1,2}-formula({x, y, z},{h(y, z), Fi,h(x, y, z), Gi}, x) could be specified by:

[[ϕ]] (x) =X y,z

F(y, z)G(x, y, z).

The same conventions for the K in #CSPK also apply to the K in K-formulas:

(≤d)-formulas are{1, . . . , d}-formulas, and(=d)-formulas are{d}-formulas. The degree restriction on the external variables allows substitutions, defined below.

Definition 5.19. For all K ⊆ N, all W ⊆ Q≥0×Q≥0 containing (1,1), all sets F of

weight-functions, allK-formulas ϕ= (Vϕ, Cϕ, v1, . . . , vk) over F, all weight-functions F

of arityk, and all instancesI = (VI, CI, wI)of#CSPWK(F ∪ {F}), define thesubstitution

I[ϕ/F] = (VI[ϕ/F], CI[ϕ/F], wI[ϕ/F]) as follows.

• VI[ϕ/F] is the disjoint union of VI and Uϕ ×C0 where Uϕ is the set of internal

variables of ϕ, and C0 is the set of constraints in CI that use F. (If there are

• CI[ϕ/F]= (CI\C0)∪C00 whereC00 has one constrainth(Uc,d,1, . . . , Uc,d,kd), Gdifor

each c=h(sc,1, . . . , sc,k), Fi ∈C0 and eachd=h(ud,1, . . . , ud,kd), Gdi ∈Cϕ, where

Uc,d,i =  

(ud,i, c) if ud,i ∈ {v/ 1, . . . , vk}

sc,j otherwise, wherej satisfiesud,i =vj.

• wI[ϕ/F](v) =wI(v) for allv∈VI, andwI[ϕ/F]= (1,1)for all (u, t)∈Uϕ×C0.

The condition that external variables of ϕhave degree1(whenK 6=N) again means thatI[ϕ/F]is an instance of #CSPWK(F).

Lemma 5.20. If F = [[ϕ]] then ZI =ZI[ϕ/F].

Proof. We will use the notation from the definition ofI[ϕ/F]. Let

b(x) =   Y v∈VI w(v)x(v)     Y h(s1,...,sm),Hi∈CI\C0 H(x(s1), . . . ,x(sm))  . Then, ZI = X x:VI→{0,1} b(x) Y c∈C0 F(x(sc,1), . . . ,x(sc,k)) ! = X x:VI→{0,1}  b(x) Y c∈C0 X x|×{c} Y d∈Cϕ Gd(x(Uc,d,1), . . . ,x(Uc,d,kd))   whereP

x|×{c} denotes the sum over all extensions ofxto functionsV ∪(Uϕ× {c})→

{0,1}. By the distributivity of multiplication over summation,

ZI = X x:VI∪(Uϕ×C0)→{0,1}  b(x|VI) Y c∈C0 Y d∈Cϕ Gd(x(Uc,d,1), . . . ,x(Uc,d,kd))   =ZI[ϕ/F].

Lemma 5.21. Let F be a finite weighted constraint language. Let (1,1)∈W ⊆Q≥0× Q≥0. Let K ⊆ N. Let ϕ be a K-formula. Then #CSPWK(F ∪ {F}) ≤AP #CSPWK(F)

where F = [[ϕ]].

Proof. Given I, the reduction calls the oracle on I[ϕ/F], without changing the error parameter, and returns the result. This is a correct AP-reduction by Lemma 5.20.

5.2.2 h-maximisation

We now discuss a reduction which is an important step in the proof of Theorem 5.3: it shows that we can delete configurations in certain sense.

Definition 5.22. For all k ≥ 0, all h ∈ Zk and all F:{0,1}k

Q≥0 not identically

zero, define the h-maximisation Fh−max:{0,1}k→Q≥0 of F by setting

Fh−max(x) =    F(x) if Pk i=1xihi = maxy∈supp(F) Pk i=1yihi, and 0 otherwise.

Lemma 5.23. Let F be a finite weighted constraint language. Let W =Q≥0×Q≥0 or

W ={(2a,2b)|a, b

Z}. Then for every F ∈ F, and every h∈Zk where k is the arity

of F, we have

#CSPWK(F ∪ {Fh−max})≤AP#CSPWK(F).

Proof. The reduction is given an instance(V, C, w)of#CSPWK(F ∪ {Fh−max})and error

parameter ε > 0 which we can assume is less than 1/2. We wish to compute a value Z

such thate−εZV,C,w ≤Z≤eεZV,C,w.

Let s = |V|+|C|. Let M be the maximum over: the value 1, the values taken by weight-functions in F, and the values w(v)i for all v, i. Let m be the minimum over: the value 1, the non-zero values taken by weight-functions in F, and the values w(v)i

for all v, i such that w(v)i 6= 0. Let n = d|V|+slog2M −log2(msε/4)e. Note that

n is polynomially bounded in the size of the input, and2|V|+slog2M−n ≤(ε/4)ms. Let

H= maxy∈supp(F) Pk i=1yihi. DefineFn:{0,1}k→Q≥0 by Fn(x) =F(x)2n( Pk i=1xihi−H) (x∈ {0,1}k).

Note that for allxeither: Pk

i=1xihi =HsoFn(x) =Fh−max(x) =F(x), or

Pk

i=1xihi<

H soFh−max(x) = 0and Fn(x)≤M2−n. Let Cn be the result of replacing Fh−max by

FninC.

ZV,Cn,wcan be approximated using the oracle as follows. First, letC0 be the result of replacing Fh−max byF inC. Then definew0:V →W by w0(v)0 =w(v)0 and w0(v)1 =

w(v)12nh(v) whereh(v) is the sum ofhi over all pairs(h(s1, . . . , sk), Fh−maxi, i)∈C×N

with si = v. So every time that v is used in position i in an Fh−max constraint, we

get a contribution of hi to h(v). ThenZV,C0,w0 =ZV,Cn,w2nHt wheretis the number of constraints inCusingFh−max. Call the oracle on(V, C0, w0)with error parameterε/2and

divide the result by2nHtto obtain a valueZ0 such thate−ε/2ZV,Cn,w≤Z0≤eε/2ZV,Cn,w

with probability at least3/4.

We will argue that the following algorithm is a correct AP-reduction: compute Z0 as above; if Z0 < ms/4 then output Z = 0, and otherwise output Z = Z0. It suffices to show that e−ε/2ZV,Cn,w≤Z0 ≤eε/2ZV,Cn,w implies e−εZV,C,w ≤Z ≤eεZV,C,w.

For all configurations x, if wtV,C,w(x) 6= wtV,Cn,w(x) then wtV,C,w(x) = 0 and

wtV,Cn,w(x)≤Ms2−n. Hence

IfZV,C,w = 0thenZ0≤2ZV,Cn,w ≤2ms(ε/4)< ms/4, so the algorithm correctly outputs zero. Otherwise,ZV,C,w 6= 0, soZ0 > ZV,Cn,w/2≥(ZV,C,w−ms(ε/4))/2≥ms/4. In this

case|ZV,C,w−ZV,Cn,w| ≤ZV,C,w(ε/4), and sincee−ε/2 ≤1−ε/4we have

(1−ε/4)ZV,C,w ≤ZV,Cn,w≤(1 +ε/4)ZV,C,w e−ε/2ZV,C,w ≤ZV,Cn,w≤eε/2ZV,C,w

e−εZV,C,w ≤Z0≤eεZV,C,w.

5.2.3 Other reductions

We will use variable-weighted versions of known reductions.

Lemma 5.24. Let F be a finite weighted constraint language.

(i.) If F ⊆ WNEQ then #CSP≥0(F) ∈ FP [29]. If every weight-function in F is basically binary then #CSP≥02(F)∈FP [27, Theorem 2.2].

(ii.) IfF ⊆IMconj then #CSP≥0(F)≤#BIS.

(iii.) #CSP≥0(F)≤AP#SAT.

(iv.) #CSP≥0(F)≤AP#CSP≥≤02(F ∪ {EQ3}).

Proof. (i.) is a straightforward modification of the cited algorithms to include variable weights. In (ii.) and (iii.), by scaling we can assume all the variable weights and values taken by weight-functions are in fact integers.

For (ii.), we have #CSP(IMP,PIN0,PIN1)≤AP#BISby Proposition 4.1 ([48, Theo-

rem 3]), so it suffices to show that#CSP≥0(IMP,PIN0,PIN1)≤AP #CSP(IMP,PIN0,PIN1).

Since there is no degree bound, arity 1 functions can be used as variable weights. The construction in [22, Proposition 25] defines any positive-integer-valued arity 1 weight- function F in polynomial time in dlog(F(0)) + log(F(1))e, as a N-formula. So we can simulate any variable weight.

For (iii.), the problem of evaluating a #CSP, with explicit integer-valued weight- functions as part of the input, is in#Pand hence AP-reduces to#SAT- see the remarks in Section 3 of [46].

(iv.) is called “2-simulating equality” in [51]. Since this reduction is an important part of Theorem 5.3, we will give details here.

For allk≥3letϕkbe the(= 2)-formula over{EQ3}on the variable set{u1, . . . , uk, v1, . . . , vk}

with external variables (v1, . . . , vk) and constraints h(ui−1, vi, ui),EQ3i for 1 ≤ i ≤ k,

whereu0 means uk. Then[[ϕk]] = EQk.

The reduction is given an instance (V, C, w) of #CSP≥0(Γ) and an error param- eter ε. For each variable v ∈ V of degree degC(v) > 2, replace all but one of its occurrences in C by distinct new variables v2, . . . , vdegC(v) and add a new constraint

h(v, v2, . . . , vdegC(v)),EQdegC(v)i. Call the new variable setV

C0. Extendwto w0:V0 →Q≥0×Q≥0 by settingw(vi) = (1,1)for allvi ∈V0\V. Then

ZV0,C0,w0 =ZV,C,w. Let (V00, C00, w00) be the repeated substitution

(V0, C0, w0)[ϕ4/EQ4]. . .[ϕD/EQD]

where D = maxv∈V degC(v). This substitution can easily be computed in polynomial

time. By Lemma 5.20 we haveZV00,C00,w00 =ZV0,C0,w0 =ZV,C,w, so the reduction can just call the oracle onZV00,C00,w00 with error parameter εand return the result.

Pinning is very useful throughout.

Lemma 5.25. Let F be a finite weighted constraint language. LetF0:{0,1}m

Q≥0 be

a copy of a pinning of a weight-functionF ∈ F. Then#CSP≥02(F ∪{F0,PIN0,PIN1})≤AP

#CSP≥02(F).

Proof. F0 is [[ϕ]], for some(= 2)-formula ϕ over {F,PIN0,PIN1}. Specifically, let k be

the arity of F. PermutingF0 if necessary, there are indices 1 ≤i1 <· · ·< im ≤k and

constantsxi ∈ {0,1} for i∈ {1, . . . , k} \ {i1, . . . , im}such that

F0(xi1, . . . , xim) =F(x1, . . . , xk) for allxi1, . . . , xim ∈ {0,1}.

ThusF0= [[ϕ]]whereϕis the(= 2)-formula on the variable set{v1, . . . , vk}, with exter-

nal variables (vi1, . . . , vim), consisting of a constraint h(v1, . . . , vk), Fi, and a constraint

h(vi),PINxii for each i∈ {1, . . . , k} \ {i1, . . . , im}.

Therefore, by substitution (Lemma 5.21), it suffices to show#CSP≥02(F ∪{PIN0,PIN1})≤AP

#CSP≥02(F).Given an instance (V, C, w) of #CSP≥02(F ∪ {PIN0,PIN1}), let C0 be the

list of constraints in C not usingPIN0 or PIN1, and definew0:W →Q≥0×Q≥0 by

w0(v)i =    0 ifh(v),PIN1−ii ∈C, w(v)i otherwise.

Then wtV,C,w agrees with wtV,C0,w0 on all configurations, so ZV,C,w = ZV,C0,w0, and

(V, C0, w0) is an instance of#CSP≥02(F).

We can convert between finite sets of variable weights and simple weightings. This is useful for Theorems 5.13 and 5.15.

Lemma 5.26. Let K be a finite non-empty set of integers. Let F be a finite weighted constraint language.

1. LetG be a finite set of simple weightings of weight-functions inF. There is a finite setW ⊆Q≥0×Q≥0 such that #CSPK(G)≤AP#CSPWK(F).

2. For all finite sets W ⊆Q≥0×Q≥0 there is a finite set G of simple weightings of

Proof. (1.) Each G ∈ G can be expressed as G(x) = λGFG(x)QkG

j=1UG,j(xj) for some

FG∈ F and someλG, UG,1(0), UG,1(1), . . . , UG,kG(0), UG,kG(1)≥0wherekG is the arity

of G. Given a function ntaking pairs(G, j),G∈ G,1≤j≤kG, to integers 0≤nG,j≤ max(K), define wn=   Y G∈G,1≤j≤kG UG,j(0)nG,j, Y G∈G,1≤j≤kG UG,j(1)nG,j  ∈Q≥0×Q≥0.

Let W be the set of pairs wn where n ranges over all (max(K) + 1)PG∈GkG choices of the integersnG,j.

Given an instance(V, C)of#CSPK(G), letC0be the list with one constrainth(v1, . . . , vk), FGi

for each constraint h(v1, . . . , vk), Gi ∈ C. Define w:V → W by w(v) = wn(x), where

n(x)G,j is the number of constraints in C using G and using v in the j position:

h(v1, . . . , vk), Gi ∈ C with vj = v. This ensures that wtV,C(x) = µ·wtV,C0,w(x) for all x ∈ {0,1}V, where µ = Q

h(v1,...,vk),Gi∈CλG. So the reduction can just query the oracle with(V, C0, w), passing the error parameter to the oracle, and divide by µ.

(2.) For all F:{0,1}k

Q≥0 and allw∈(W ∪ {(1,1)})k, define

GF,w(x) =F(x) k Y

i=1

w(i)xi (x∈ {0,1}k).

LetG be the set of weight-functions of the form GF,w with F ∈ F.

We are given an instance (V, C, w) of#CSPWK(F). LetV0 ={v ∈V |degC(v)>0}. Letg:V0 →C be any map taking each variablev∈V0 to the index of a constraint with

v in its scope: if g(v) =h(v1, . . . , vk), Gi thenv=vi for some i. Let C0 be the list with

one constrainth(v1, . . . , vk), GF,wFi for each constraintc=h(v1, . . . , vk), Fi ∈C, where

wF(i) =  

w(vi) if g(vi) =c, and

(1,1) otherwise.

This ensures thatwtV0,C,w(x) = wtV0,C0(x)for allx∈ {0,1}V 0

, soZV,C,w =ZV0,C0·µ whereµ=Q

v∈V\V0(w(v)0+w(v)1), so the reduction can just call the#CSPK(G)oracle on ZV0,C0, passing through the error parameter, then multiply by the result by µ.