Abstract 1 Introduction 2 Preliminaries 3 A chain reaction algorithm 4 Characterization of 𝜹𝟏-affine 𝜹𝟎-affine kernels 5 Hardness result References

Eulerian Orientations and Hadamard Codes:
A Novel Connection via Counting

Shuai Shao ORCID School of Computer Science and Technology & Hefei National Laboratory, University of Science and Technology of China, Hefei, China Zhuxiao Tang School of the Gifted Young, University of Science and Technology of China, Hefei, China
Abstract

We discover a novel connection between two classical mathematical notions, Eulerian orientations and Hadamard codes by studying the counting problem of Eulerian orientations (#EO) with local constraint functions imposed on vertices. We present two special classes of constraint functions and a chain reaction algorithm, and show that the #EO problem defined by each class alone is polynomial-time solvable by the algorithm. These tractable classes of functions are defined inductively, and quite remarkably the base level of these classes is characterized perfectly by the well-known Hadamard code. Thus, we establish a novel connection between counting Eulerian orientations and coding theory. We also prove a #P-hardness result for the #EO problem when constraint functions from the two tractable classes appear together.

Keywords and phrases:
Eulerian orientations, Hadamard codes, Counting problems, Tractable classes
Copyright and License:
[Uncaptioned image] © Shuai Shao and Zhuxiao Tang; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Graph theory
Related Version:
Full Version: https://arxiv.org/abs/2411.02612.
Acknowledgements:
The first author wants to thank Jin-Yi Cai and Zhiguo Fu for many valuable discussions. The authors want to thank anonymous reviewers for their helpful comments.
Funding:
Supported by the Innovation Program for Quantum Science and Technology, 2021ZD0302901.
Editors:
Raghu Meka

1 Introduction

The notion of Eulerian orientations arises from the historically notable Seven Bridges of Königsberg problem, whose solution by Euler in 1736 [14] is considered to be the first result of graph theory. Given an undirected graph G, an Eulerian orientation of G is an assignment of a direction to each edge of G such that at each vertex v, the number of incoming edges is equal to the number of outgoing edges. A connected graph has an Eulerian orientation, called an Eulerian graph if and only if every vertex has even degree. This is the well-known Euler’s theorem, whose first complete proof was given back in the 1800s [3]. In terms of computational complexity, Euler’s theorem implies that the decision problem of Eulerian orientations of a graph is polynomial-time solvable (tractable). While for the counting problem, Mihail and Winkler showed that counting the number of Eulerian orientations of an undirected graph is #P-complete in 1996 [18], more than one hundred years later after Euler’s theorem. However, the counting problem becomes tractable when certain particular restrictions are imposed on edges. An intriguing example of such tractable problems comes from computing the partition function of the six-vertex model [19, 22, 20], one of the most intensively studied models in statistical physics. In this example, the graphs are 4 regular graphs and on each vertex exactly one edge incident to it is restricted to take the direction coming into the vertex. Then counting the number of Eulerian orientations obeying restrictions on these edges is proved to be tractable [7].

In this paper, we further study the counting restricted Eulerian orientations (#EO) problem, defined by constraint functions placed at each vertex that represent restrictions on edges incident to the vertex. We consider for which class of constraint functions, the #EO problem is tractable. Before we formally define the problem and describe our results, we first take a detour to another classical notion in coding theory, the Hadamard code. The Hadamard code is an error-correcting code used for error detection and correction when transmitting messages over very noisy or unreliable channels. Because of its plentiful mathematical properties, the Hadamard code is not only used in coding and communication, but also intensely studied in various areas of mathematics and theoretical computer science. However, it is not known how the Hadamard code can be related to Eulerian orientations, and particularly, how it can be used to carve out tractable classes for the #EO problem. Quite surprisingly, in this paper, we establish a novel connection between these two well-studied mathematical notions. We present new tractable classes for the #EO problem and a corresponding algorithm based on a chain reaction. These classes are defined inductively and the base levels of them, defined as kernels are characterized perfectly by the Hadamard code (or more precisely, the balanced Hadamard code).

Now we formally define the #EO problem. A 0-1 valued constraint function (or a signature) f of arity n is a map 2n{0,1}. The support of f is 𝒮(f)={α2n|f(α)=1}. A signature f of arity 2n is an Eulerian orientation (EO) signature if for every α𝒮(f), wt(α)=n. The problem #EO() specified by a set of EO signatures is defined as follows. The input is a graph G where each vertex v of G is associated with some function fv from . The incident edges to v are totally ordered and correspond to input variables to fv. Each edge has two ends, and an orientation of the edge is denoted by assigning 0 to the head and 1 to the tail. Thus, locally at every vertex v, a 0 represents an incoming edge and a 1 represents an outgoing edge. An Eulerian orientation corresponds to an assignment to each edge (01 or 10) where the numbers of 0’s and 1’s at each v are equal. Then, the local constraint function fv takes value 1 if the restriction imposed by fv are satisfied by the local assignment on edges incident to v. Otherwise, fv=0. Since every fv is an EO signature, it takes value 1 only if the numbers of input 0’s and 1’s are equal. Thus, only Eulerian orientations can contribute value 1. An Eulerian orientation contributes value 1 if fv=1 for every vertex v. The #EO problem outputs the number of Eulerian orientations contributing value 1.

Example 1.

Let ={g2,g4,g2n,}, where 𝒮(g2n)={α22nwt(α)=n}. Then #EO() counts the total number of all Eulerian orientations of the input graph, which is #P-hard.

Example 2.

Let f2 be a signature of arity 4 with support 𝒮(f2)={1100,1010,1001}. Then, #EO({f2}) computes the partition function of a six-vertex model which is tractable. The reason for naming this function f2 will be explained in Section 4.

The #EO problem has an intrinsic significance in counting problems. In [5], the framework of #EO problems is formally introduced and is showed to be expressive enough to encompass all Boolean counting constraint satisfaction problems (#CSP) [12, 13, 4, 10] with arbitrary constraint functions that are not necessarily supported on half weighted inputs, although the #EO problem itself requires all constraint functions to be supported on half weighted inputs. Also, the #EO problem encompasses many natural problems from statistical physics and combinatorics, such as the partition function of the six-vertex model and the evaluation of the Tutte polynomial at the point (3,3) [15]. Cai, Fu and Xia proved a complexity classification of the partition function of the six-vertex model on general 4-regular graphs [7].

Besides these interesting concrete problems expressible as #EO problems, the study of the #EO framework plays a crucial role in a broader picture, the complexity classification program for a much more expressive counting framework, the Holant problem. Significant progress has been made in the complexity classification of Holant problems [9, 8, 1, 11, 2, 16, 6], and a full complexity dichotomy for all real-valued Holant problems is achieved [21]. This dichotomy is crucially based on a complexity dichotomy for the #EO problem [5] with complex-valued signatures assuming a physical symmetry called arrow reversal symmetry (ARS) since under a suitable holographic transformation, the ARS property corresponds to precisely real-valued signatures. In this paper, we consider the 0-1 valued #EO problem without assuming ARS, which may serve as a building block for the ultimate classification for all complex-valued Holant problems. For this problem, we give new tractable classes that are not covered by all the previously known tractable classes for Holant problems.

We use a(f) to denote the arity of f, and A(f)={1,2,,a(f)} to denote the indices of variables of f. We use δ1 and δ0 to denote the unary signatures where 𝒮(δ1)={1} and 𝒮(δ0)={0} respectively. Pinning the i-th variable of f to 0 gives the signature f(x1,,xi1,0,xi+1,,xn) of arity n1, denoted by fi0. Similarly, we define fi1. Let f and g be two signatures of support size n and m respectively. Suppose 𝒮(f)={α1,α2,,αn} and 𝒮(g)={β1,β2,,βm}. Then the tensor product fg of f and g is the signature where 𝒮(fg)={αiβj|1in,1jm}. Note that when we take a tensor product of the functions, the variables need not be in the same order of the product. A nonzero signature g is a factor of f, denoted by gf, if there is a signature h such that f=gh or there is a constant λ such that f=λg. Otherwise, g is not factor of f, denoted by gf. In the following, we first state the definition of affine signatures, which are known to be tractable for the #EO problem. Then we give the new tractable classes.

Definition 3 (Affine).

A signature f(x1,x2,,xn) of arity n is affine, denoted by f𝒜 if 𝒮(f)={x2n|AX=0}, where X=(x1,x2,,xn,1) and A is a matrix over 2. Note that f𝒜 when 𝒮(f)=, is called a zero signature.

Definition 4 (δ1-affine and δ0-affine).

An EO signature f is δ1-affine, denoted by f𝒟1 if f=δ1g for some g where for every iA(g), gi0𝒜𝒟1. Symmetrically, an EO signature f is δ0-affine, denoted by f𝒟0 if f=δ0g for some g where for every iA(g), gi1𝒜𝒟0.

For example, the 4-ary signature f in Example 2 is an δ1-affine signature. Note that 𝒟1 (or 𝒟0) does not encompass 𝒜, since an affine signature may not have a δ1 (or δ0) factor. Thus, our tractable classes are 𝒜𝒟1 and 𝒜𝒟0, rather than 𝒟1 and 𝒟0.

Theorem 5.

#EO(𝒜𝒟1) and #EO(𝒜𝒟0) are tractable.

The tractability result is established via a chain reaction algorithm, in which the presence of a δ1 or δ0 signature plays a role similar to a neutron in a nuclear chain reaction which initializes the reaction and generates a new neutron (a δ1 or δ0 signature respectively) by propagation which makes the chain reaction continue. Eventually, the chain reaction terminates when a stable state (a tractable instance of #EO(𝒜)) is reached.

Although the reaction algorithm works for δ1-affine signatures or δ0-affine signatures alone, it does not work when both of them appear. This is because when both δ1-affine signatures and δ0-affine signatures appear, by connecting δ1 and δ0 using , both of them are killed by each other and no new δ1 or δ0 are generated. Thus, the chain reaction is unsustainable. This is somewhat similar to the phenomenon of electron–positron annihilation in nuclear physics. In fact, we can show that the #EO problem is #P-hard when they both appear.

Theorem 6.

#EO(𝒟0𝒟1) is #P-hard.

Since the classes 𝒟1 and 𝒟0 are defined inductively, it is not an easy task to get explicit expressions for them in a form similar to other known tractable classes for counting problems such as affine signatures. Note that the tractability of 𝒟1 or 𝒟0 is obtained by eventually reducing the problem into a problem where all signatures are affine signatures. Thus, we focus on δ1-affine (or δ0-affine) signatures from which by pinning an arbitrary variable to 0 (or 1 respectively), we always get an affine signature. In other words, these δ1-affine (or δ0-affine) signatures are at the first level of the inductive hierarchy. We define them as kernels.

Definition 7 (δ1-affine and δ0-affine kernel).

An EO signature f is a δ1-affine kernel, denoted by fK(𝒟1) if it satisfies the following two properties:

  1. 1.

    f=δ1mh, for some m+ where h is a signature of positive arity, δ1h and h𝒜;

  2. 2.

    for every iA(h), hi0𝒜.

Symmetrically, we define δ0-affine kernels denoted by K(𝒟0) by switching 0 and 1 everywhere. Notice that h𝒜 implies f𝒜. Thus, δ1-affine and δ0-affine kernels are not affine.

A main technical contribution of the paper is a complete characterization of δ1-affine and δ0-affine kernels using the Hadamard code. The Hadamard code refers to the code based on Sylvester’s construction of Hadamard matrices. A Hadamard matrix Hn is a square matrix of size n such that all its entries are in {1,1} and HnHnT=nIn. Sylvester’s construction gives Hadamard matrices H2k of size 2k for all k0, where H2k+1=[H2kH2kH2kH2k] and H20=1. The Hadamard code 2k1 derived from the Hadamard matrices H2k by Sylvester’s construction is a code over the binary alphabet {0,1} of which the 2k codewords are rows of H2k where the entry 1 of H2k is mapped to 1 and the entry 1 is mapped to 0. Symmetrically, we can also get the Hadamard code 2k0 by mapping the 1 entry to 0 and 1 to 1. Note that 2k1 contains an all-1 codeword and 2k0 contains an all-0 codeword. We call the former the 1-Hadamard code and the latter the 0-Hadamard code. In standard coding theory notation for block codes, 2k1 and 2k0 are [2k,k,2k1]-code, which is a binary linear code having block length 2k, message length k, and minimum Hamming distance 2k/2. By removing the all-1 codeword from 2k1, we get a balanced code, i.e., each codeword has Hamming weight 2k1, half of its block length. We call it the balanced 1-Hadamard code, denoted by 2k1b. Symmetrically, we can get the balanced 0-Hadamard code, denoted by 2k0b. A binary code 𝒞n of block length n can be viewed equivalently as a 0-1 valued constraint function f of arity n by taking the support 𝒮(f)={α2n|f(α)0} to be 𝒞n. An m-multiple of the code 𝒞n is a code of block length nm, each codeword of which is obtained from a codeword α of 𝒞n by taking the concatenation of m copies of α.

Theorem 8.

An EO signature f is a δ1-affine kernel if and only if 𝒮(f) is an m-multiple of a balanced 1-Hadamard code 2k1b for some k3 and m1, or δ0f and |𝒮(f)|=3.

A symmetric statement holds for the δ0-affine kernel by switching 0 and 1 everywhere.

Due to the existence of newly discovered non-trivial tractable classes corresponding to the Hadamard code in the #EO problem without assuming ARS, the complexity classification for the complex-valued Holant problem is much more challenging. It’s hard to imagine how many more tractable classes with remarkable properties are yet to be discovered. The results in this paper are a tiny step towards an ambitious goal. Very recently, independent of this work, Meng, Wang and Xia discover new larger tractable classes for the #EO problem [17]. In addition, we note that the presented result in this paper is not the first time that a tractable class for counting problems is found to be related to coding theory. Even in the classification of real-valued Holant problems, a tractable family called local affine [11] was already discovered using the well-known Hamming code. Are there other interesting tractable classes for counting problems that can be carved out with the help of coding theory? In the other direction, it is also worth pursuing whether these new tractability results for counting problems can be applied back to coding theory? We leave the questions in both directions for further study.

The paper is organized as follows. In Section 2, we give some definitions and notations. In Section 3, we give a chain reaction algorithm which establishes the tractability result (Theorem 5) for δ1-affine and δ0-affine signatures. In Section 4, we prove the characterization theorem (Theorem 8) for δ1-affine and δ0-affine kernels. In Section 5, we prove the hardness result Theorem 6. In fact, the proof of the hardness result highly depends on the characterization of δ1-affine and δ0-affine kernels. Omitted proofs can be founded in the full version.

2 Preliminaries

A 0-1 valued signature is determined by its support 𝒮(f). In the paper, we use f and 𝒮(f) interchangeably. We can also view 𝒮(f) as a binary code of block length a(f) where each α𝒮(f) is a codeword. We say 𝒮(f) (or equivalently f) has a constant Hamming weight if wt(α)= for every α𝒮(f). For simplicity, we say f is -weighted or constant-weighted in general. The following fact can be easily checked. Any factor of a constant-weighted signature is still constant-weighted. If a vertex v in a graph is labeled by a signature f=gh, we can replace the vertex v by two vertices v1 and v2 and label v1 with the factor g and v2 with h, respectively. The incident edges of v become incident edges of v1 and v2 respectively according to the partition of variables of f in the tensor product of g and h. This does not affect the evaluation of the instance. We represent f or 𝒮(f) by a matrix which lists all vectors in 𝒮(f) by its rows. All matrices that are equal up to a permutation of rows and columns represent the same signature. Normally, the columns indexing variables are ordered from the smallest index to the largest, and are omitted for convenience when the context is clear. For example, the signature f={1100,1010,1001} can be written as .

For iA(f), we use #i0(f) and #i1(f) to denote the number of 0s and 1s respectively in the i-th column of 𝒮(f). The complement of a signature f, denoted by f¯ is the signature with the support 𝒮(f¯)={α2n|α¯𝒮(f)} where α¯ is the standard complement of α, i.e., α¯α=0n. Let f^(x1,x2,,xn)=x1x2xnf(x1,x2,,xn). Then, 𝒮(f^)={1n}Δ𝒮(f). Similarly, let fˇ(x1,x2,,xn)=(1x1)(1x2)(1xn)f(x1,x2,,xn). Then 𝒮(fˇ)={0n}Δ𝒮(f). We use to denote the binary disequality signature {01,10}. Connecting δ1 with the i-th variable of f using is equivalent to pinning the i-th variable of f to 0, which gives the signature fi0. Extracting the i-th variable of f to 0 gives the signature (xi1)f(x1,x2,,xn) of arity n, denoted by fxi=0. Clearly fxi=0=δ0fi0. Similarly we define fi1 and fxi=1. We use fijab to denote the signature (fia)jb=(fjb)ia for distinct i,jA(f) and any a,b2. The signature fxixj is defined to be fij01+fij10 which can be obtained by connecting the i-th and j-th variables of f using . For a signature f, we define its m-multiple, denoted by f×m to be the signature 𝒮(f×m)={αmα𝒮(f)} where αm2nm is obtained from α by taking the concatenation of m copies of α.

Now we give some basic properties of affine signatures. Equivalently, f is affine if and only if it satisfies the property that for any α,β,γ𝒮(f), αβγ𝒮(f). One can also check that affine signatures are closed under pinning, extracting, tensor product and factoring. Also, f𝒜 if and only if f×m𝒜 for any m+.

Lemma 9.

If a signature f𝒜 is constant-weighted and δ0,δ1f, then #i0(f)=#i1(f) for any iA(f). Moreover, f is an EO signature.

Definition 10 (Pairwise opposite).

Let f be a signature of arity 2n. We say f is pairwise opposite if we can partition the 2n variables into n pairs such that in 𝒮(f), two variables of each pair always take opposite values.

Lemma 11 (Lemma 5.7 in [5]).

If f is an affine EO signature, then f is pairwise opposite.

3 A chain reaction algorithm

In the section, we show #EO(𝒟1𝒜) and #EO(𝒟0𝒜) are tractable by giving a chain reaction algorithm. We only consider #EO(𝒟1𝒜), since the other case is symmetric. Given an instance Ω of #EO(𝒟1𝒜), we may assume that there is at least one vertex labelled by a δ1-affine signature f. Otherwise, all signatures in the instance are affine. Such an instance of #EO(𝒜) is tractable.

Since f is δ1-affine, consider a factor δ1 of f. This δ1 is connected to another variable of some signature (which may be f itself) using 2. Then, the connected variable is pinned to 0. A key property that ensures our algorithm work is that after connecting δ1 to another variable no matter whether it is a variable of f itself, an affine signature, or another δ1-affine signature, either the resulting signature is affine, or we can realize another δ1. In the later case, we call it a propagation step. After a propagation step, the new realized δ1 can be used to pin another variable to 0. Thus, we get a chain reaction, and it terminates when an instance of #EO(𝒜) is reached. Note that, after each propagation step, the number of edges (total variables) in the instance is reduced by 2. Thus, the chain reaction terminates after at most |E|/2 many steps where E is the edge set of the underlying graph in Ω.

Lemma 12.

Suppose that f=δ1h is δ1-affine and g𝒟1𝒜. For any variable xi of g, by connecting it with δ1 of f using 2, we can get a zero signature or a signature hδ1gij01 where gij01𝒟1𝒜 for some jA(g)\{i}.

Proof.

If g𝒜, then g is pairwise opposite by Lemma 11. Suppose xj is opposite to xi. Then pinning xi to 0 makes xj be a δ1 factor, i.e., gi0=δ1(xj)gij01, where gij01𝒜. Otherwise g𝒟1\𝒜. Suppose g=δ1(xj)g for some variable xj. If xi=xj, then by connecting the δ1 factor of f and xj of g using , we get a zero signature. Now assume xixj. Then (g)i0𝒜𝒟1 since g𝒟1. In this case, we get hδ1(xj)gij01, where gij01=(g)i0𝒜𝒟1.

Theorem 13.

#EO(𝒜𝒟1) and #EO(𝒜𝒟0) are tractable.

Proof.

We only prove #EO(𝒜𝒟1) is tractable, the other case is symmetric.

Consider an instance Ω of #EO(𝒜𝒟1). If all signatures in Ω are affine, then we are done. Otherwise, there is a vertex u in Ω that is labeled by a δ1-affine signature f=δ1h. Without loss of generality, we name the variable associated with δ1 after x1. Suppose that in Ω, x1 is connected to another variable xi of some g labeling the vertex v using 2.

  • If u=v, i.e., f and g are labeled on the same vertex in Ω, then by definition the resulting signature fx1xi=f1i10=hi0 obtained from f by connecting variables x1 and xi is in 𝒟1𝒜. Then, the instance is reduced to a smaller instance with two fewer edges where f is replaced by fx1xi of smaller arity. Since fx1xi𝒟1𝒜, the reduced instance is still an instance of #EO(𝒜𝒟1).

  • Otherwise, f and g are labeled on two different vertices. By Lemma 12, connecting δ1 of f with a variable xi of g, we get a zero signature or a signature hδ1g where g=gij01𝒟1𝒜 for some jA(g)\{i}. If a zero signature is realized, then clearly we are done. Otherwise, by renaming variables and decomposing hδ1g into two parts f=hδ1 and g, again we can reduce the original instance to a smaller instance with two fewer edges where the edges incident to f is changed and g is replaced by g of smaller arity. Still, since g𝒟1𝒜, the reduced instance is still an instance of #EO(𝒜𝒟1).

Thus, in both cases, the instance can be solved recursively and the number of recursions is bounded by |E|/2 where E is the edge set of the underlying graph of Ω.

4 Characterization of 𝜹𝟏-affine 𝜹𝟎-affine kernels

In this section, we prove the main characterization theorem for δ1-affine and δ0-affine kernels using the Hadamard code. We first give an equivalent definition for the δ1-affine kernel. Note that in Definition 7 we require h𝒜, while in the following lemma we require δ0h.

Lemma 14.

An EO signature fK(𝒟1) if and only if it satisfies the following two properties:

  1. 1.

    f=δ1mh for some m+ where h is a signature of positive arity, δ1,δ0h;

  2. 2.

    for every iA(h), hi0𝒜.

Note that the signature f2 in Example 2 is a δ1-affine kernel. Trivially, any EO signature of support size 3 with at least one δ1 factor and no δ0 factor is a δ1-affine kernel, since any signature obtained from it by pinning a variable to 0 has a support of size 1 or 2, which is affine. We say fK(𝒟1) (or K(𝒟0)) is a trivial kernel if |𝒮(f)|=3. Below, we prove the characterization theorem for non-trivial δ1-affine and δ0-affine kernels, which is essentially equivalent to Theorem 8.

Theorem 15.

An EO signature f is a non-trivial δ1-affine (or δ0-affine) kernel if and only if 𝒮(f) is an m-multiple of a balanced 1-Hadamard (or balanced 0-Hadamard respectively) code of size 2k1 for some k3 and m1.

We give a proof outline for this theorem. First, we prove δ1-affine kernels admit certain arities and support sizes by carefully counting the number of 0s and 1s in each column of their supports. More specifically, we prove a non-trivial δ1-affine kernel f must have support size 2k1 and arity m2k, for some m,kZ+,k3 (Lemma 17). Then, we define basic δ1-affine kernels (Definition 18) of support size 2k1 and arity 2k. We show every non-trivial δ1-affine kernel is a multiple of some non-trivial basic kernel (Lemma 19). Finally, we characterize the basic δ1-affine kernel by the balanced 1-Hadamard code 2k1b. We define a special affine signature called butterfly (Definition 20), serving as a bridge connecting basic kernels and balanced Hadamard codes. We show 2k1 (or 2k0) is just a half of butterfly (Lemma 24). We also define left and right wings of butterfly (Definition 21) by removing the all-0 (or all-1) row from a half of butterfly. Notice 2k0b (or 2k1b) is obtained by removing the all-0 (or all-1) codeword from 2k1. Thus, wings of butterfly coincide with 2k0b and 2k1b (Lemma 24). Finally, we prove basic kernels are precisely wings of butterfly (Lemma 26 and Lemma 28). Therefore, basic kernels, balanced Hadamard codes and wings of butterfly are precisely the same things.

Lemma 16.

Suppose fK(𝒟1). If δ0fxi=1 for some iA(f), then fxi=1K(𝒟1).

Lemma 17.

Suppose that f=δ1mhK(𝒟1) where m1,δ1,δ0h, and |𝒮(f)|>3. Then there exists some k2 such that |𝒮(f)|=2k+11 and a(f)=m2k+1. Moreover, we have δ1hi0,δ0hi1 and #i0(h)=2k for every iA(h).

Definition 18 (Basic δ1-affine kernel).

A basic δ1-affine kernel fk of order k (or a k-th basic δ1-affine kernel) is a δ1-affine kernel of arity 2k and support size 2k1.

For example, the basic δ1-affine kernel of order 1 is f1=δ1δ0 and the basic δ1-affine kernel of order 2 is f2=δ1{(001),(010),(100)}.

Lemma 19.

An EO signature of arity m2k is a non-trivial δ1-affine kernel if and only if it is an m-multiple of a non-trivial basic δ1-affine kernel of arity 2k.

Proof.

First we assume f=δ1g is a non-trivial basic δ1-affine kernel. Then |𝒮(f×m)|=|𝒮(f)|>3. We want to show f×mK(𝒟1). Note that f×m=δ1mg×m and δ1,δ0g×m. Pinning 0 to the i-th variable of one copy of g in g×m, each of the remaining m1 copies contributes a δ0 factor. i.e, (g×m)i0=δ0(m1)(gi0)×m. Clearly (g×m)i0𝒜 since gi0𝒜. It follows that f×mK(𝒟1).

Conversely, assume f=δ1mh is a non-trivial δ1-affine kernel, where m+,δ1,δ0h. We want to show there exists a non-trivial basic δ1-affine kernel f0 such that f=(f0)×m. By Lemma 17, we have |𝒮(f)|=2k1 and #i0(h)=2k1 for every iA(h). Fix any iA(h), consider fxi=0=δ1mhxi=0. It is an affine EO signature of support size 2k1. By Lemma 17, δ1hxi=0. Factoring out δ0 in hxi=0, we suppose hxi=0=δ0m0h, δ1,δ0h. At the same time, notice h is constant-weighted. Thus, h is an EO signature by Lemma 9. Since fxi=0=δ1mδ0m0h is also EO, we have m=m0.

On one hand, if xj is a variable taking constant 0 in 𝒮(fxi=0), then the values of xj and xi must be identical in 𝒮(h), because the j-th column already contributes 2k1 many 0s in 𝒮(fxi=0) and the remaining 2k11 rows must be all 1s. On the other, if xj is a variable of h, then xj and xi are not identical in 𝒮(h) since they are not identical in 𝒮(hxi=0). Therefore, there are exactly m0=m copies of the i-th column in 𝒮(h). Since iA(h) is arbitrary, we have h=(h0)×m for some signature h0. Clearly δ1,δ0h0 since δ1,δ0h. Notice for every iA(h0), (h0xi=0)×m=((h0)×m)xi=0=hxi=0=δ0hi0𝒜, so h0xi=0𝒜 and then (h0)i0𝒜. Therefore, f0=δ1h0 is a basic δ1-affine kernel and f=(f0)×m.

Below, we show balanced Hadamard codes characterize basic kernels via the bridge of butterfly.

Definition 20 (Butterfly).

Let k1. An affine signature g of arity 2k+1 is a butterfly and denoted by Bk, if it has exactly k free (linearly independent) variables x1,x2,,xk and any two different variables do not always take identical values in 𝒮(g).

The butterfly Bk is unique up to a permutation of variables. It is precisely the affine signature of k free variables with the maximum arity, assuming any two different variables are not identical.

Definition 21 (Wings of butterfly).

We represent the butterfly Bk by a matrix in the following way. Let (x2,x3,,xk+1) be free variables of Bk, and x1 be constant 0. Moreover, let xm=λ2x2+λ3x3++λk+1xk+1 and xm+2k=xm+1 for 1m2k, where λ2,,λk+12. Through a permutation of rows, we let the first row be 02k12k.

Then, Bk can be split into the left half and the right half, each of which consisting of 2k columns. The left wing of Bk, denoted by Lk is the signature obtained form the left half of Bk by removing the first row 02k. Symmetrically, we define the right wing of Bk denoted by Rk.

 Remark 22.

Recall that Lkˇ and Rk^ are obtained from Lk and Rk by adding an all-0 or all-1 row respectively. They are the left and right halves of Bk respectively which are affine. In fact, Lkˇ is precisely the affine signature of k free variables with maximum arity, assuming every variable is a linear combination of free variables and any two variables are not identical. While Rk^ is the complement of Lkˇ.

Example 23.

We give a butterfly with 2 free variables x2,x3. The other variables are decided by the following linear or affine linear combinations. x1=0x2+0x3,x4=x2+x3,x5=0x2+0x3+1,x6=x2+0x3+1,x7=0x2+x3+1,x8=x2+x3+1.

The left and right wings of B2 are and .

Lemma 24.

As a signature, the balanced 1-Hadamard (or 0-Hadamard) code is the right (or left) wing of butterfly up to a permutation of variables.

Proof.

We only need to prove 2k0 is the left half of Bk. Note that 2k0 is a linear code, then it is affine as a signature. By the definition of Hadamard matrix and Hadamard code, every two different rows of 2k0 do not take identical values. By Sylvester’s construction, 2k0 is symmetic as a matrix. Thus, every two different variables of 2k0 do not take identical values in its support. Because 2k0 is of arity 2k, support size 2k, and has an all-0 vector in its support, it is precisely the affine signature of k free variables with maximum arity, assuming every variable is a linear combination of free variables and any two variables are not identical. Therefore, 2k0b=Lk is just removing the all-0 row of 2k0.

So far we show the equivalence of balanced Hadamard code and wings of butterfly. Next we focus on the relationship between basic kernels and wings of butterfly. For convenience, we only consider the basic δ1-affine kernel and the right wing of butterfly in the following. The other case is symmetric.

Lemma 25.

Let k3 and Rk be the right wing of Bk, then Rk is an EO signature. Moreover, every two different rows (or columns) of Rk do not take identical or opposite values.

Proof.

Because 2k1b is an EO signature and every two different rows and columns do not take identical or opposite values, this lemma is true because Rk=2k1b by Lemma 24.

Lemma 26.

Let Rk be the right wing of a butterfly. Then Rk is the k-th basic δ1-affine kernel.

Proof.

For k=1,2 it can be checked by definition. Now we assume k3. First by Lemma 25 Rk is EO. Then we show RkK(𝒟1). Notice Rk=δ1rk,δ0,δ1rk, and (rk)i0=(rk^)i0𝒜, since rk^𝒜. Finally, because Rk is of arity 2k and support size 2k1, it is a basic δ1-affine kernel of order k.

Below, we prove the more complicated direction that a basic δ1-affine kernel of order k is just Rk up to a permutation of variables. We prove this by induction. We first prove certain properties for the k+1-th δ1-affine kernel assuming the k-th δ1-affine kernel is unique up to a permutation of variables.

Lemma 27.

Suppose k+,k2. If the k-th basic δ1-affine kernel fk is unique up to a permutation of variables, then any (k+1)-th basic δ1-affine kernel f=δ1h satisfies the following properties for every lA(h).

  1. 1.

    fxl=1=(fk)×2 up to a permutation of variables.

  2. 2.

    fxl=0=Bk up to a permutation of variables.

  3. 3.

    Two variables xi and xj take opposite values in 𝒮(fxl=0) if and only if they take identical values in 𝒮(fxl=1).

Lemma 28.

The k-th basic δ1-affine kernel fk is precisely Rk up to a permutation of variables.

Proof.

For k=1, we have f1=δ1δ0 and this lemma is clear. For k=2, f2=δ1{(001),(010),(100)} and this lemma is true by Example 23. Now assume this lemma holds for positive integers less or equal than k(k2). By Lemma 27, we know any (k+1)-th δ1-affine kernel fk+1=δ1hk+1 satisfies the following three properties:

  1. 1.

    Extracting any variable of hk+1 to 0, up to a permutation of rows, the first 2k rows of fk+1 is butterfly Bk.

  2. 2.

    Extracting any variable of hk+1 to 1, up to a permutation of rows, the last 2k1 rows is (fk)×2. However, when we write the above butterfly into the specific form, we fix the order of columns. Then we denote the last 2k1 rows by two fk, where fk=fk up to a permutation of rows and columns.

  3. 3.

    Every two different variables take identical values in 𝒮((fk+1)xi=1) if and only if they take opposite values in 𝒮((fk+1)xi=0), iA(hk+1).

Because every two different columns of fk (as well as fk) do not take identical or opposite values by Lemma 25, we can easily check this proposition still holds for fk+1. Next we show the signature fk+1^ is affine. We first notice fk+1^ has the following properties, which holds for every iA(fk+1^):

  1. 1.

    (fk+1^)xi=0=(fk+1)xi=0=Bk𝒜.

  2. 2.

    (fk+1^)xi=1=(fk^)×2𝒜, since fk is the right wing of Bk by induction hypothesis, hence fk^ is the right half of Bk, which is affine.

We prove fk+1^𝒜 by contradiction. If fk+1^𝒜, there exists α,β,γ𝒮(fk+1^), such that θ=αβγ𝒮(fk+1^). If there exists a position j such that αj=βj=γj=0, assume j=1 without loss of generality. Then α=0α,β=0β,γ=0γ,θ=0θ, where α,β,γ𝒮((fk+1^)j0) and θ=αβγ. Because (fk+1^)j0𝒜, we have θ𝒮((fk+1^)j0). Then θ=0θ𝒮(fk+1^), contradiction! Similarly, if there exists a position j such that αj=βj=γj=1, we also get a contradiction. Then, by enumerating all possible combinations of α,β,γ𝒮(fk+1^), we can show fk+1^𝒜. Because 𝒮(fk+1^) contains an all-1 vector; |𝒮(fk+1^)|=a(fk+1^)=2k+1; and there is no identical pair in 𝒮(fk+1^), fk+1 is precisely the right wing of Bk+1.

So far by Lemma 26 and Lemma 28 we prove the equivalence between basic kernels and wings of butterfly. Combining with Lemma 24 we get the proof of Theorem 15.

5 Hardness result

Recall that the binary disequality signature () is {10,01}. The symbol ”T” stands for Turing reduction.

Definition 29 (ARS).

A signature f satisfies ARS if f(α)=f(α¯) for every α𝒮(f).

First, we show that δ1δ0 is always realizable from an EO signature not satisfying ARS.

Lemma 30.

If an EO signature f does not satisfy ARS, then #EO(f,δ1δ0)T #EO(f).

With the help of δ1δ0, we have the following reduction.

Lemma 31.

If an EO signature f does not satisfy ARS, then #EO({f,fxi=1,fxi=0})T#EO(f) for every iA(f).

Next we will prove #EO(f,g) is #P-hard if f𝒟1\𝒜 and g𝒟0\𝒜, which implies that #EO(𝒟1𝒟0) is #P-hard. We first consider a basic case where f and g are basic δ1-affine and δ0-affine kernels of order 2 respectively.

Lemma 32.

Let and . Then #EO(f2,g2) is #P-hard.

Proof.

Connecting the variables x1 and y1, x2 and y2 using respectively, we realize a signature h of arity 4 where It is known that #EO(h) is #P-hard by the complexity classification for the six-vertex model [7]. Then, #EO(f2,g2) is #P-hard.

This #P-hardness result can be generalized to any multiples of f2 and g2.

Lemma 33.

Let f=(f2)×a,g=(g2)×b, where a,b+. Then #EO(f,g) is #P-hard.

Proof.

Connect f and g using block by block. That is, connect variables xi and yi using for 1i4, where xi,yi are variables of one block f2 and g2 as denoted in Lemma 32.

If a=b=1, it is the case in Lemma 32. If a=b>1, we can realize which is also #P-hard by the complexity classification of the six vertex model.

If ab, we may assume a>b without loss of generality. Then we can realize f=(f2)×(ab). Then connect f and g block by block and continue this process. We finally realize (f2)×d and (g2)×d where d=gcd(a,b) is computed by the Euclidean algorithm. Then it is reduced to the case a=b.

This #P-hardness result can still be generalized to any basic δ1-affine and δ0-affine kernels of support size 3.

Lemma 34.

Let f𝒟1\𝒜,g𝒟0\𝒜, and |𝒮(f)|=|𝒮(g)|=3. Then #EO(f,g) is #P-hard.

Theorem 35.

If f𝒟1\𝒜,g𝒟0\𝒜, then #EO(f,g) is #P-hard.

Proof.

We first show we can realize a signature f𝒟1\𝒜 of support size 3 if |𝒮(f)|>3. If fK(𝒟1), suppose f=(fk)×m by Lemma 19, where fk is the δ1-affine kernel of order k. we can extract 1 in some variable xi of f by Lemma 31 and realize fxi=1, which is a multiple of fk1 by Lemma 27. Continuing this process we can finally realize multiple of f2. If fK(𝒟1), suppose f=δ1h. Then there exists iA(h) such that hi0𝒟1\𝒜. We have 3<|𝒮(hi0)|<|𝒮(f)|. Repeating the process, either hi0K(𝒟1) or it can realize a signature in 𝒟1\𝒜 of smaller support size. Finally we can realize f𝒟1\𝒜 of support size 3. Similarly, we can realize g𝒟0\𝒜 of support size 3. Then by Lemma 34 we prove #EO(f,g) is #P-hard.

References

  • [1] Miriam Backens. A new Holant dichotomy inspired by quantum computation. In Proceedings of the 44th International Colloquium on Automata, Languages, and Programming (ICALP 2017). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.ICALP.2017.16.
  • [2] Miriam Backens. A complete dichotomy for complex-valued Holantc. In Proceedings of the 45th International Colloquium on Automata, Languages, and Programming (ICALP 2018). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPIcs.ICALP.2018.12.
  • [3] Norman Biggs, E Keith Lloyd, and Robin J Wilson. Graph Theory, 1736-1936. Oxford University Press, 1986.
  • [4] Andrei Bulatov, Martin Dyer, Leslie Ann Goldberg, Markus Jalsenius, and David Richerby. The complexity of weighted Boolean #CSP with mixed signs. Theoretical Computer Science, 410(38-40):3949–3961, 2009. doi:10.1016/J.TCS.2009.06.003.
  • [5] Jin-Yi Cai, Zhiguo Fu, and Shuai Shao. Beyond #CSP: A dichotomy for counting weighted eulerian orientations with ars. Information and Computation, 275:104589, 2020. doi:10.1016/J.IC.2020.104589.
  • [6] Jin-Yi Cai, Zhiguo Fu, and Shuai Shao. From Holant to quantum entanglement and back. In Proceedings of the 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ICALP.2020.22.
  • [7] Jin-Yi Cai, Zhiguo Fu, and Mingji Xia. Complexity classification of the six-vertex model. Information and Computation, 259:130–141, 2018. doi:10.1016/J.IC.2018.01.003.
  • [8] Jin-Yi Cai, Heng Guo, and Tyson Williams. A complete dichotomy rises from the capture of vanishing signatures. SIAM Journal on Computing, 45(5):1671–1728, 2016. doi:10.1137/15M1049798.
  • [9] Jin-Yi Cai, Pinyan Lu, and Mingji Xia. Dichotomy for Holant problems of Boolean domain. In Proceedings of the 22nd annual ACM-SIAM symposium on Discrete Algorithms, pages 1714–1728. SIAM, 2011.
  • [10] Jin-Yi Cai, Pinyan Lu, and Mingji Xia. The complexity of complex weighted Boolean #CSP. Journal of Computer and System Sciences, 80(1):217–236, 2014. doi:10.1016/J.JCSS.2013.07.003.
  • [11] Jin-Yi Cai, Pinyan Lu, and Mingji Xia. Dichotomy for real Holantc problems. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1802–1821. SIAM, 2018. doi:10.1137/1.9781611975031.118.
  • [12] Nadia Creignou and Miki Hermann. Complexity of generalized satisfiability counting problems. Information and computation, 125(1):1–12, 1996. doi:10.1006/INCO.1996.0016.
  • [13] Martin Dyer, Leslie Ann Goldberg, and Mark Jerrum. The complexity of weighted Boolean #CSP. SIAM Journal on Computing, 38(5):1970–1986, 2009. doi:10.1137/070690201.
  • [14] Leonhard Euler. Solutio problematis ad geometriam situs pertinentis. Commentarii academiae scientiarum Petropolitanae, pages 128–140, 1741.
  • [15] Michel Las Vergnas. On the evaluation at (3, 3) of the Tutte polynomial of a graph. Journal of Combinatorial Theory, Series B, 45(3):367–372, 1988. doi:10.1016/0095-8956(88)90079-2.
  • [16] Jiabao Lin and Hanpin Wang. The complexity of Boolean Holant problems with nonnegative weights. SIAM Journal on Computing, 47(3):798–828, 2018. doi:10.1137/17M113304X.
  • [17] Boning Meng, Juqiu Wang, and Mingji Xia. P-time algorithms for typical #EO problems. arXiv preprint, 2024. doi:10.48550/arXiv.2410.11557.
  • [18] Milena Mihail and Peter Winkler. On the number of Eulerian orientations of a graph. Algorithmica, 16(4-5):402–414, 1996. doi:10.1007/BF01940872.
  • [19] Linus Pauling. The structure and entropy of ice and of other crystals with some randomness of atomic arrangement. Journal of the American Chemical Society, 57(12):2680–2684, 1935.
  • [20] Franz Rys. Über ein zweidimensionales klassisches Konfigurationsmodell. In Helvetica Physica Acta, volume 36(5), page 537, 1963.
  • [21] Shuai Shao and Jin-Yi Cai. A dichotomy for real Boolean Holant problems. In Proceedings of the 61st IEEE Annual Symposium on Foundations of Computer Science (FOCS 2020), pages 1091–1102. IEEE, 2020. doi:10.1109/FOCS46700.2020.00105.
  • [22] John C Slater. Theory of the transition in KH2PO4. The Journal of Chemical Physics, 9(1):16–33, 1941.