Binary Linear Codes, Dimers and Hypermatrices
Abstract.
We show that the weight enumerator of any binary linear code is equal to the permanent of a 3dimensional hypermatrix (3matrix). We also show that each permanent is a determinant of a 3matrix. As an application we write the dimer partition function of a finite 3dimensional cubic lattice as the determinant of the vertexadjacency 3matrix of a 2dimensional simplicial complex which preserves the natural embedding of the cubic lattice.
.
1. Introduction
The Kasteleyn method is a way how to calculate the Ising partition function on a finite graph . It goes as follows. We first realize that the Ising partition function is equivalent to a multivariable weight enumerator of the cut space of . We modify to graph so that this weight enumerator is equal to the generating function of the perfect matchings of (the dimer partition function of ). Such generating functions are hard to calculate. In particular, if is a bipartite graph then the generating function of the perfect matchings of is equal to the permanent of the biadjacency matrix of . If however this permanent may be turned into the determinant of a modified matrix then the calculation can be successfully carried over since the determinants may be calculated efficiently. Already in 1913 Polya asked for which nonnegative matrix we can change signs of its entries so that, denoting by the resulting matrix, we have . We call these matrices Kasteleyn after the physicist Kasteleyn who invented the Kasteleyn method. Kasteleyn proved in 1960’s that all biadjacency matrices of the planar bipartite graphs are Kasteleyn. We say that a bipartite graph is Pfaffian if its biadjacency matrix is Kasteleyn. The problem to characterize the Kasteleyn matrices (or equivalently Pfaffian bipartite graphs) was open until 1993, when Robertson, Seymour and Thomas [4] found a polynomial recognition method and a structural description of the Kasteleyn matrices. They showed that the class of the Kasteleyn matrices is rather restricted and extends only moderately beyond the biadjacency matrices of the planar bipartite graphs.
Some years ago M.L. suggested to (1) extend the Pfaffian method to weight enumerators of general binary linear codes, and (2) to use hypermatrices instead of matrices to gain new insight into the Ising and dimer problems for the cubic lattice.
In this paper we show that the weight enumerator of any binary linear code is equal to the permanent of the triadjacency 3matrix of a 2dimensional simplicial complex. In analogy to the standard (2dimensional) matrices we say that a 3dimensional nonnegative matrix is Kasteleyn if signs of its entries may be changed so that, denoting by the resulting 3dimensional matrix, we have . We show that in contrast with the 2dimensional case the class of Kasteleyn 3dimensional matrices is rich; namely, for each 2dimensional nonnegative matrix there is a 3dimensional nonnegative Kasteleyn matrix so that .
Summarising, we have the following applications for the basic 3dimensional statistical physics models.

We write the partition function of the dimer problem in the cubic lattice as 3determinant.

We write the partition function of the Ising problem in the cubic lattice as 3permanent.
Using some results of this paper ML showed in [3] how to write both these partition functions as a single formal product.
1.1. Basic definitions
A linear code of length and dimension over a field is a linear subspace with dimension of the vector space . Each vector in is called a codeword. The weight of a codeword is the number of nonzero entries of ; if we are given , then . The weight enumerator of a finite code is defined according to the formula
A simplex is the convex hull of an affine independent set in . The dimension of is , denoted by . The convex hull of any nonempty subset of that defines a simplex is called a face of the simplex. A simplicial complex is a set of simplices fulfilling the following conditions: Every face of a simplex from belongs to and the intersection of every two simplices of is a face of both. The dimension of is . Let be a dimensional simplicial complex. We define the incidence matrix as follows: The rows are indexed by dimensional simplices and the columns by dimensional simplices. We set
This paper studies 2dimensional simplicial complexes where each maximal simplex is a triangle. We call them triangular configurations. We denote the set of vertices of by , the set of edges by and the set of triangles by . The cycle space of over a field , denoted , is the kernel of the incidence matrix of over , that is .
Let be a triangular configuration. A matching of is defined with respect to edges; hence, a matching of is a subconfiguration of such that does not contain an edge for every distinct . Let be a triangular configuration. Let be a matching of . Then the defect of is the set . The perfect matching of is a matching with empty defect. We denote the set of all perfect matchings of by . Let be weights of the triangles of . The generating function of perfect matchings in is defined to be , where .
A triangular configuration is tripartite if the edges of can be divided into three disjoint sets such that every triangle of contains edges from all sets . We call the sets tripartition of .
We recall that biadjacency matrix of a bipartite graph is the matrix, defined as follows: We set
The triadjacency 3matrix of a tripartite triangular configuration with tripartition is the three dimensional array of numbers, defined as follows: We set
The permanent of a 3matrix is defined to be
The determinant of a 3matrix is defined to be
1.2. Main results
Theorem 1.
Let be a binary linear code. Then there exists a tripartite triangular configuration and weights such that: If is triadjacency matrix of then
Theorem 2.
Let be a binary linear code. Then there exists a triangular configuration and weights such that is equal to the weight enumerator of .
Proof.
This follows from Theorem 6 of [5] by setting the weights of all the auxiliary triangles to zero.
∎
This theorem is extended to linear codes over , where is a prime, in [6].
Theorem 3 (Rytíř [5]).
Let be a triangular configuration with weights . Then there exists a triangular configuration and weights such that .
Theorem 4.
Let be a triangular configuration with weights . Then there exists a tripartite triangular configuration and weights such that where is the triadjacency matrix of .
Definition 1.1.
We say that an 3matrix is Kasteleyn if there is 3matrix obtained from by changing signs of some entries so that .
Theorem 5.
Let be matrix. Then one can construct Kasteleyn 3matrix with and . Moreover, Kasteleyn signing is trivial, i.e., , and if is nonnegative then is nonnegative.
In the last section, applying Theorem 5, we write the dimer partition function of a finite 3dimensional cubic lattice as the determinant of the vertexadjacency 3matrix of a 2dimensional simplicial complex which preserves the natural embedding of the cubic lattice. We also include the BinetCauchy formula for the determinant of a 3matrix.
2. Triangular configurations and permanents
In this section we prove Theorem 4. We use basic building blocks as in Rytíř [5]. However, the use is novel and we need to stress the tripartitness of basic blocks. Hence we briefly describe them again.
2.1. Triangular tunnel
Triangular tunnel is depicted in Figure 1. An empty triangle is a set of three edges forming a boundary of a triangle. We call the empty triangles and ending.
Proposition 2.1.
The triangular tunnel has exactly one matching with defect and exactly one matching with defect .∎
Proposition 2.2.
The triangular tunnel is tripartite.
2.2. Triangular configuration
Triangular configuration is depicted in Figure 3. Letter ”X” denotes empty triangles. We call these empty triangles ending.
Proposition 2.3.
Triangular configuration has one exactly perfect matching and exactly one matching with defect on edges of all empty triangles.
Proof.
The unique perfect matching is . We denote it by . The unique matching with defect on edges of all empty triangles is . We denote it by . ∎
Proposition 2.4.
Triangular configuration is tripartite.
2.3. Matching triangular triangle
The matching triangular triangle is obtained from the triangular configuration and three triangular tunnels in the following way: Let , and be triangular tunnels. Let ; and be the ending empty triangles of , and , respectively. Let be ending empty triangles of . We identify with ; with and with . The matching triangular triangle is defined to be . The matching triangular triangle is depicted in Figure 5.
Proposition 2.5.
The matching triangular triangle has exactly one perfect matching and exactly one matching with defect . It has no matching with defect , where .
Proof.
The perfect matching is . The matching is .
Any matching of the matching triangular triangle with defect contains or . This determines remaining triangles in a matching with defect . Hence, there are just two matchings and with defect . ∎
Proposition 2.6.
Matching triangular triangle is tripartite and there is a tripartition of such that ; ; .
2.4. Linking three triangles by matching triangular triangle
Let be a triangular configuration. Let and be three edge disjoint triangles of .
The link by matching triangular triangle between and in is the triangular configuration defined as follows. Let be a matching triangular triangle defined in Section 2.3. Let be ending empty triangles of . Let and and be edges of and and , respectively. We relabel edges of such that and and . We let .
2.5. Construction
Let be a triangular configuration and let be weights of triangles. We construct a tripartite triangular configuration and weights in two steps. First step: We start with triangular configuration
where are disjoint copies of . Let be a triangle of . We denote the corresponding copies of in by , respectively.
Second step: For every triangle of , we link in by triangular matching triangle . We denote this triangular matching triangle by . Then we remove triangles from . We choose a triangle from and set . We set for . The resulting configuration is desired configuration .
Proposition 2.7.
Triangular configuration is tripartite.
Proof.
The triangular configuration is constructed from three disjoint triangular configurations . From these configurations all triangles are removed. Hence, we can put edges to set for . The remainder of is formed by matching triangular triangles. Every matching triangular triangle connects edges of . By Proposition 2.6 the matching triangular triangle is tripartite and its ends belong to different partities.
∎
We denote by the set of all subsets . We define a mapping as: Let be a subset of then
Proposition 2.8.
The mapping is a bijection between the set of perfect matchings of and the set of perfect matchings of and for every .
Proof.
By definition, the mapping is an injection. By Proposition 2.5, every inner edge of , , is covered by for any subset of . Let be a perfect matching of . We show that is perfect matching of .
Let be an edge of and let be corresponding copies in . Let be triangles incident with edge in . Let be the triangle from perfect matching incident with . By definition of , the edges are incident only with triangles of , . The edges are covered by . The edges of , , are covered by . Hence is a perfect matching of .
Let be a perfect matching of . By Proposition 2.5, for some set . The set is a perfect matching of . Thus, the mapping is a bijection.
∎
Corollary 2.9.
. ∎
Proposition 2.10.
Let be a triangular configuration with weights . Then there exist a tripartite triangular configuration and weights such that there is a bijection between the set of perfect matchings and the set of perfect matchings of . Moreover, for every , and .
Proposition 2.11.
Let be a tripartite triangular configuration with tripartition such that and let be its triadjacency matrix. Then .
Proof.
We have
Every perfect triangular matching between partities can be encoded by two permutations and vice versa. If matching is a subset of , then
where denotes a triangle of with edges . If is not a subset of , then there is such that . Hence . Therefore
∎
3. Kasteleyn 3matrices
We first introduce a necessary condition for a 3matrix to be Kasteleyn. Let be a nonnegative 3matrix, where . We first define two bipartite graphs as follows. We let, for , where
and
Theorem 6.
If is such that both are Pfaffian bipartite graphs then is Kasteleyn.
Proof.
Let be the biadjacency matrix of and let be the signing of the entries of which defines matrix such that . We define 3matrix by
We have
By the construction of we have that for each and each , if then
Hence
Analogously by the construction of we have that for each and each , if then
Hence
∎
In the introduction we defined the triadjacency 3matrix of a triangular configuration as the adjacency matrix of the edges of the triangles. We also defined a matching of a triangular configuration as a set of edgedisjoint triangles. In this section we concentrate on the vertices rather than on the edges.
A triangular configuration is vertextripartite if vertices of can be divided into three disjoint sets such that every triangle of contains one vertex from each set . We call the sets vertextripartition of .
The vertexadjacency 3matrix of a vertextripartite triangular configuration with vertextripartition is defined as follows: We set
We will need the following modification of the notion of a matching. A set of triangles of a triangular configuration is called strong matching if its triangles are mutually vertexdisjoint.
Proof of Theorem 5.
Let be a matrix and let be the bipartite graph of its nonzero entries. We have . We order vertices of each , arbitrarily and let . Let be disjoint copy of , .
We next define three sets of vertices and system of triangles so that each triangle intersects each in exactly one vertex.
We let be the vertexadjacency 3matrix of the triangular configuration . We first observe that both bipartite graphs of (introduced before Theorem 6) are planar; let us consider only , the reasoning for is the same. First, vertices and are connected only among themselves in . Further, the component of containing vertex contains also vertex and consists of disjoint paths of length between these two vertices. Here denotes the degree of in graph , i.e., the number of edges of incident with . Thus, by Theorem 6, is Kasteleyn.
We next observe that Kasteleyn signing is trivial. Let be the orientation of in which each edge is directed from to . In each planar drawing of , each inner face has an odd number of edges directed in clockwise. This means that is a Pfaffian orientation of , and (see e.g. Loebl [2] for basic facts on Pfaffian orientations and Pfaffian signings).
Finally there is a bijection between the perfect matchings of and the perfect strong matchings of : if is a perfect matching of then let
We observe that can be uniquely extended to a perfect strong matching of , namely by the set of triples where
Set is inevitable in any perfect strong matching containing since the vertices must be covered. This immediately implies that sets are inevitable as well.
On the other hand, if is a perfect strong matching of then contains for some perfect matching of .
∎
4. Application to 3D dimer problem
Let be cubic lattice. The dimer partition function of , which is equal to the generating function of the perfect matchings of , can be identified (by Theorem 5) with the determinant of the Kasteleyn vertexadjacency matrix of triangular configuration . Natural question arises whether this observation can be used to study the 3D dimer problem.
We first observe that the natural embedding of in 3space can be simply modified to yield an embedding of in 3space. This can perhaps best be understood by figures, see Figure 6; this figure depicts configuration around vertex of with neighbors .
Triangular configuration is obtained by identification of vertices in the left and right parts of Figure 6. Now assume that the embedding of left part of Figure 6 is such that for each vertex of , the vertices belong to the same plane and the convex closure of intersects the rest of the configuration only in . Then we add the embedding of the right part, for each vertex of , so that belongs to the plane of the ’s and is very near to but outside of this plane.
Summarizing, the dimer partition function of a finite 3dimensional cubic lattice may be written as the determinant of the vertexadjacency 3matrix of triangular configuration which preserves the natural embedding of the cubic lattice.
Calculating the determinant of a 3matrix is hard, but perhaps formulas for the determinant of the particular vertexadjacency 3matrix of , illuminating the 3dimensional dimer problem, may be found. An example of a formula valid for the determinant of a 3matrix is shown in the next subsection. It is new as far as we know but its proof is basically identical to the proof of Lemma 3.3 of Barvinok [1].
4.1. BinetCauchy formula for the determinant of 3matrices
We recall from the introduction that the determinant of a 3matrix is defined to be
The next formula is a generalization of BinetCauchy formula (see the proof of Lemma 3.3 in Barvinok [1]).
Lemma 4.1.
Let be real matrices, . For a subset of cardinality we denote by the submatrix of the matrix consisting of the columns of indexed by the elements of the set . Let be the 3matrix defined, for all by
Then
where the sum is over all subsets of cardinality
Proof.
Now, for all we have
where denotes the matrix whose th column is the th column of matrix .
If sequence contains a pair of equal numbers then the corresponding summand is zero, since is zero. Moreover, if is a permutation, and is obtained from by a transposition, then
Therefore Lemma 4.1 follows.
∎
References
 [1] A.I. Barvinok. New algorithms for linear kmatroid intersection and matroid kparity problems. Mathematical Programming, 69:449–470, 1995.
 [2] M. Loebl. Discrete mathematics in statistical physics. Vieweg+Teubner, 2010.
 [3] M. Loebl. Binary Linear Codes via 4D Discrete IharaSelberg Function. arXiv:1503.02525, 2015.
 [4] N. Robertson, P.D. Seymour, R. Thomas. Permanents, Pfaffian orientations, and even directed circuits. Annals of Mathematics, 150:929–975, 1999.
 [5] P. Rytíř. Geometric representations of binary codes and computation of weight enumerators. Adv. in Appl. Math., 45:290–301, 2010.
 [6] P. Rytíř. Geometric representations of linear codes. Advances in Mathematics, 282:1–22, 2015.