In this section we show that weak log-modularity implies tractability, by showing that every weakly log-modular weighted constraint language is balanced in the following sense. We may associate a matrix Mwith an undirected bipartite graph GM whose vertex
partition consists of the set of rows R and columns C of M. A pair (r, c) ∈ R×C is an edge of GM if, and only if, Mrc 6= 0. A block of M is a submatrix whose rows and
columns form a connected component in GM. M has block-rank 1 if all its blocks have
rank 1.
We say that a weighted constraint language F is balanced [24] if, for every function
F(x1, . . . , xn)∈ hF i# with arityn≥2, and everyk with0< k < n, the|D|k× |D|n−k
matrix F((x1, . . . , xk),(xk+1, . . . , xn)) has block-rank 1. (This notion reduces to Dyer
and Richerby’s notion of “strong balance”[50] in the unweighted case.) A functionF:{0,1}n→
Rhasrank 1 if it has the formF(x1, . . . , xk) =U1(x1)· · ·Uk(xk).
We associate with any function F:{0,1}2 →
R, the matrixMF ∈ R2×2 defined by
(MF)ij =F(i, j).
Lemma 6.8. Let M∈Rk×k. LetF:{0,1}k→
R. Let T ∈R2≥×02 be non-singular.
1. A 2×2 matrix M has block-rank 1 if and only if it has rank 1 or it has at most two non-zero entries. F:{0,1}2→
R has rank 1 if and only if detMF = 0.
2. M has block-rank 1 if and only if the matrix
NM,u,u0,v,v0 = M(u,v) M(u,v 0) M(u0,v) M(u0,v0)
!
has block-rank 1 for everyu,u0,v,v0.
3. (Topkis’s theorem) If F is strictly positive and not of rank 1, there is a function
F0:{0,1}2→
R of the following form that is not of rank 1.
F0(xi, xj) =F(c1, . . . , ci−1, xi, ci+1, . . . , cj−1, xj, cj+1, . . . , ck).
Here 1≤i < j≤k, and each c` is a fixed element of {0,1}.
4. F has rank 1 if and only if T⊗kF has rank 1.
Proof. 1. A2×2matrix that has block-rank 1 either has rank 1 or is diagonal or anti- diagonal so has two zeroes. Conversely, a matrix that has rank 1 has no submatrix whose rank exceeds 1, so has block-rank 1. A matrix with two or more zeroes has no 2×2block so can only have blocks of rank 1.
For the second statement, if F has rank1 then there are unary functionsU0 and
U1 so thatF(x, y) =U0(x)U1(y), which implies thatdetMF = 0. Going the other
Let U0(x) = F(x, j) and U1(y) = F(i, y)/F(i, j). If detMF = 0 then F(x, y) =
U0(x)U1(y), so F has rank 1.
2. [50, Lemma 38].
3. Say that a strictly positive functionF islog-modular iff = logF is modular: that is, F(x∨y)F(x∧y) =F(x)F(y) for all x,y∈ {0,1}k. A modular function is an
affine map (see for example [11, Proposition 24]), so a strictly positive log-modular function is a product of unary functions, so it has rank 1. The result is then Topkis’s theorem [96] in the form stated in [22, Lemma 8].
4. IfF is of the form U1(x1)· · ·Un(xn)then
(T⊗nF)(x1, . . . , xn) = (T⊗1U1)(x1)· · ·(T⊗1Un)(xn)
The reverse implication follows from(T−1)⊗nT⊗nF =F, whereT−1 is the matrix inverse ofT.
A functionF:Dn→Q≥0 isessentially pseudo-Boolean if its support is contained in
a set D1× · · · ×Dn with|D1|, . . . ,|Dn| ≤2. The projection of a relation R ⊆Dn onto
indices 1 ≤i < j ≤ n is the set of pairs (a, b) ∈D2 such that there exists x ∈ R with
xi =aand xj =b. A generalisedNEQ is a relation of the form {(xi, xj),(yi, yj)} ⊂D2
for some xi 6=yi and xj 6=yj.
Lemma 6.9. LetF:Dn→Q≥0 be an essentially pseudo-Boolean function which is not
of rank 1, and assume that no binary projection of the support ofF is a generalisedNEQ. Then{F} ∪ UD is not weakly log-modular.
Proof. Let the support of F be contained in D1× · · · ×Dn where |Di| = 2 for all i.
Choose bijectionsρi:{0,1} →Di for each 1≤i≤n. DefineFρ:{0,1}n→
Q≥0 by
Fρ(x1, . . . , xn) =F(ρ1(x1), . . . , ρn(xn))
for allx1, . . . , xn∈ {0,1}. LetT = (2 11 2) and note thatT⊗nFρ is strictly positive. Since
F is not of rank 1,Fρis not of rank 1, so by Lemma 6.8 part (4),T⊗nFρis not of rank 1. By Lemma 6.8 part (3), there is a functionB:{0,1}2 →
Q≥0 of the following form that
is not of rank 1.
B(xi, xj) = (T⊗nFρ)(c1, . . . , ci−1, xi, ci+1, . . . , cj−1, xj, cj+1, . . . , cn).
For all indices k ∈ {1, . . . , n} \ {i, j}, define Uk ∈ UD by Uk(ρk(xk)) = Tckxk for all xk ∈ {0,1}, andUk(z) = 0ifz /∈Dk. DefineG, H:D2 →Q≥0andGρi,ρj, Hρi,ρi:{0,1}2 → Q≥0as follows. Note in these definitions thatiandjare fixed, butρiandρj are used as
being applied to the inputs. Thus, inHρi,ρi, the bijectionρi is applied to both arguments, even though the function depends on both iand j.
G(yi, yj) =X Y k6=i,j Uk(yk)
F(y1, . . . , yn) for all yi, yj ∈D
Gρi,ρj(xi, xj) = X Y k6=i,j Tck,xk Fρ(x1, . . . , xn) for all xi, xj ∈ {0,1} H(y0, y00) = X y∈D
G(y0, y)G(y00, y) for all y0, y00 ∈D
Hρi,ρi(x0, x00) = X
x∈{0,1}
Gρi,ρj(x0, x)Gρi,ρj(x00, x) for all x0, x00∈ {0,1}
where the first sum is over ally1, . . . , yi−1, yi+1, . . . , yj−1, yj+1, . . . , yn∈Dand the second
sum is over allx1, . . . , xi−1, xi+1, . . . , xj−1, xj+1, . . . , xn∈ {0,1}.
Note that MHρi,ρi =MGρi,ρjMGtρi,ρj =T−1MB(T−1)tT−1MBt(T−1)t wheretdenotes
transpose. Taking determinants and applying Lemma 6.8 part (1) this implies thatHρi,ρi
is not of rank 1. Also, since T is strictly positive, the support of Gρi,ρj is the binary projection of the support ofFρ onto iand j which, by assumption, is notNEQ or EQ.
Hence Hρi,ρi is strictly positive but not of rank 1. Again using Lemma 6.8 part (1) we
see that H is a witness that{F} ∪ UD is not weakly log-modular.
Lemma 6.10. Every conservative weakly log-modular weighted constraint language is balanced.
Proof. Let F be a conservative weighted constraint language that is not balanced. We will show thatF is not weakly log-modular.
By the definition of balance, there is a function F ∈ hF i# of aritynand a partition
x = (u,v) of its n variables, such that the matrix F(u,v) is not of block-rank 1. By Lemma 6.8 part (2) there is a two-by-two submatrix N = NF,u,u0,v,v0 that is not of block-rank 1.
Construct an essentially pseudo-Boolean function Gfrom F as follows. For all 1 ≤ i ≤ n let Ui ∈ hUDi# ⊆ hF i# be the indicator function of Di−1 ×Di×Dn−i, where Di ={ui, u0i} for all 1≤i≤k andDi ={vi, vi0}for all k < i≤n. Let G=FQn
i=1Ui.
ThenNG,u,u0,v,v0 =N is not of block-rank 1, andGis essentially pseudo-Boolean. If the binary projection of the support ofGonto two indicesi, jis a generalisedNEQ {(xi, xj),(yi, yj)}, construct (G0, ρ(u), ρ(u0), ρ(v), ρ(v0)) from (G,u,u0,v,v0) as follows. Letρ:Dn→Dn−1be the projection operator sendingxtox
1, . . . , xi−1, xi+1, . . . , xnand
letG0(x) =P
ρ(x0)=xG(x0)for allx∈Dn−1. Note that, for allx∈Dn,G(x)6=G0(ρ(x)) implies that G(x) = 0 because G(x) = 0 unless xi 6= xj. Note that N has at least three non-zero entries by Lemma 6.8 part (1). So the corresponding three pairs out of
((u,v)i,(u,v)j), ((u,v0)i,(u,v0)j), ((u0,v)i,(u0,v)j), and ((u0,v0)i,(u0,v0)j) must each
which implies that NG0,ρ(u),ρ(u0),ρ(v),ρ(v0) = N. Also, G0 is essentially pseudo-Boolean, and G0 is obtained by summing the i’th variable, so G0 ∈ hGi#.
Repeating this process if necessary, we obtain(G0,x,x0,y,y0)such thatG0is an essen- tially pseudo-Boolean function in hF,UDi# =hF i# and none of the binary projections
of the support of G0 is a generalised NEQ, andNG0,x,x0,y,y0 is not of block-rank 1. So, in particular,G0 is not of rank 1. By Lemma 6.9,{G0} ∪ UD is not weakly log-modular, so
hF i# is not weakly log-modular.
We now return to Theorem 6.4 and prove the tractable case. The proof relies on an important theorem of Cai, Chen and Lu about the complexity of exact evaluation.
Lemma 6.11. [24] Let F be a finite, weighted constraint language taking non-negative algebraic real values. If F is balanced, then#CSP(F)is in FP, and otherwise#CSP(F)
is#P-hard.
Theorem 6.12. Let F be a conservative weighted constraint language taking values in
Q≥0. IfF is weakly log-modular then, for any finite G ⊂ F,#CSP(G)∈FP.
Proof. By Lemma 6.10, F is balanced. Hence, every finite G ⊂ F is balanced, which implies that#CSP(G) is inFP by Lemma 6.11.