Journal of Algebra 433 (2015) 168–182
Contents lists available at ScienceDirect
Journal of Algebra www.elsevier.com/locate/jalgebra
The arctic rank of a Boolean matrix LeRoy B. Beasley a , Alexander E. Guterman b,∗ , Yaroslav Shitov c a
Department of Mathematics and Statistics, Utah State University, Logan, UT 84322-3900, USA b Department of Higher Algebra, Faculty of Mathematics and Mechanics, Moscow State University, Moscow, 119899, Russia c National State University Higher School of Economics, 20 Myasnitskaya str., 101000, Moscow, Russia
a r t i c l e
i n f o
Article history: Received 15 August 2013 Available online 4 April 2015 Communicated by Louis Rowen MSC: 15B34 15A03 Keywords: Boolean matrix Rank function
a b s t r a c t Among different rank functions on tropical matrices, there is one known as tropical rank which is a lower bound for any other. Here we introduce a new concept (for being opposed to tropical rank, it is called arctic) which gives an upper bound for other ranks. Our definition is based on the perimeter notion previously studied for rank-one matrices. We study the arithmetic behavior of the arctic rank and compare it with that of other rank functions. Finally, we provide an algorithm computing the arctic rank. We show that no algorithm is likely to find the arctic rank in polynomial time by proving that computing the perimeter of a matrix is an NP-hard problem. © 2015 Elsevier Inc. All rights reserved.
1. Introduction The binary Boolean semiring is the set B = {0, 1} with operations ⊕ and ⊗ which send a pair (a, b) to max{a, b} and ab, respectively. We also use the Boolean arithmetic extended in a usual way to vector and matrix arguments. * Corresponding author. E-mail addresses:
[email protected] (L.B. Beasley),
[email protected] (A.E. Guterman),
[email protected] (Y. Shitov). http://dx.doi.org/10.1016/j.jalgebra.2015.03.005 0021-8693/© 2015 Elsevier Inc. All rights reserved.
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
169
We write Bm×n for the set of m-by-n Boolean matrices, and Aij or [A]ij for the (i, j)th entry of a matrix A. Ei,j denotes a matrix cell, i.e., the matrix with 1 on (i, j)th position and 0 elsewhere. For Boolean matrices A and B of the same order, we write A B if Aij Bij holds for all i and j. The support of a Boolean column or row vector z (to be denoted by Sup z) is the set of numbers of positions where the entry is 1. By |S| we denote the cardinality of a set S. Our paper is devoted to studying the rank functions on Boolean matrices, so let us start with their definitions. The Boolean rank of a matrix A ∈ Bm×n is the minimal number of rank-one matrices needed to obtain A as the Boolean sum. In other words, the Boolean rank is the minimal possible k for which A = x1 y1 ⊕ . . . ⊕ xk yk
(1.1)
with x1 , . . . , xk from Bm and y1 , . . . , yk from Bn . The term rank of A is the minimum number of lines (rows or columns) needed to include all nonzero entries of A. By Theorem 1.2.1 from [5], the term rank equals the largest cardinality of a set S = {(i1 , j1 ), . . . , (ir , jr )} satisfying Ait ,jt = 1 for all t, with pairwise different i1 , . . . , ir and pairwise different j1 , . . . , jr . A submatrix A[i1 , . . . , ir |j1 , . . . , jr ] of A is called tropically non-singular if the condition Ai1 ,jσ(1) · . . . · Air ,jσ(r) = 1 holds for a unique permutation σ on {1, . . . , r}. The tropical rank of A is the size of its largest tropically non-singular submatrix. A family F of rows of A is called weakly linearly independent if no row of F can be expressed as a Boolean linear combination of the other rows from F . The row weak rank of A is the largest cardinality of a weakly linearly independent family of rows of A. The column weak rank is the row weak rank of a transpose matrix. We note that there are many other rank functions for Boolean matrices, and refer the reader to [1,6,8] for their survey. The mutual behavior of those rank concepts has been studied in [1] and the following result was obtained. Theorem 1.1. (See [1, Theorem 8.6].) The tropical rank never exceeds the Boolean rank, and each of them is less than or equal to the term and weak ranks. The situation with a lower bound for rank functions was clear, but no rank function provides an upper bound for others (see also Fig. 1 in [1]). In fact, the row and column ranks are not equal in general and both can be less than or greater than the term rank, see Example 7.17 in [1]. In our paper, we propose the definition of a new rank function which will give an upper bound for other ranks. We first need the concept of a perimeter of a Boolean matrix. Definition 1.2. The perimeter of a Boolean matrix A, perim (A), is the least value of |Sup x1 | + |Sup y1 | + · · · + |Sup xl | + |Sup yl |
(1.2)
170
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
over all decompositions A = x1 y1 ⊕ . . . ⊕ xl yl .
(1.3)
Note that the value of l introduced in Definition 1.2 can be greater than the Boolean rank of a matrix. In fact, the value of l providing the optimal decomposition (1.3) can be even greater than the size n of a matrix as shown in Example 2.6 below, see also Remark 2.5. The perimeter concept has been previously studied for rank-one matrices, see for example [3] and references therein. Definition 1.2 provides a natural generalization of this concept which makes sense for arbitrary matrices. We can now define the new rank function, which is the main object of study in our paper and will be shown to provide an upper bound for other ranks. In order to point out a contrast with the tropical rank (which is a lower bound for other ranks), we introduce the term ‘arctic’ for the new function. Definition 1.3. The arctic rank of a Boolean matrix is half its perimeter. We denote the arctic rank of the matrix A by arct (A). Let us note that there are different possible generalizations of Definitions 1.2 and 1.3 for the case of a matrix over an arbitrary semiring. For example, one can define the perimeter of such a matrix as the perimeter of its zero-nonzero pattern, but such a definition will not work well in the important case of the tropical semiring (R ∪{∞}, min, +), in which all matrices from Rm×n will have the same perimeter. Moreover, a straightforward generalization of Definition 1.3 to an arbitrary semiring will face different obstructions like arct (AB) ≥ arct (A) + arct (B) as in Corollary 2.8 below, and so such a function can hardly be thought of as a ‘rank function’ of matrices, say, over a field. In an interesting special case of tropical matrices, one can also provide another way of defining the arctic rank by making the use of the tropical patterns defined in [9]. However, this approach has also significant disadvantages, in particular, the tropical pattern does not yet give a satisfactory description of tropical rank functions as shown in [10]. Also, it is unclear how one can generalize the tropical pattern approach for non-tropical semirings. In view of the comments above, we leave a problem of defining the arctic rank over arbitrary semirings for future research, and we devote our paper to a detailed investigation of the arctic rank function of Boolean matrices. In Section 2, the arithmetic behavior of the arctic rank with respect to elementary matrix operations is considered. We prove the relations between arctic rank and other well-known matrix rank functions and show that they can be illustrated by Fig. 1 which generalizes a similar picture from [1]. The definitions and relations between these functions other than arctic rank can be found in [1]. We also construct some examples illustrating our results on the mutual behavior of functions considered. In Section 3 we prove that the arctic rank is in fact an upper
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
171
Fig. 1. Rank inequalities.
bound for other rank functions. In Section 4 we explore the computational issues, and we provide an algorithm computing the arctic rank. Finally we show that no algorithm is likely to find the arctic rank in polynomial time by proving that computing the perimeter of a matrix is an NP-hard problem. 2. Arithmetic behavior of the arctic rank Let us first examine the behavior of the arctic rank with a number of basic properties that normally hold for rank functions. Lemma 2.1. Let A ∈ Bm×n and A be a submatrix of A. Then perim (A ) ≤ perim (A). Moreover, perim (A ) = perim (A) if and only if A is obtained from A by deleting some zero rows or columns. Proof. Using the decomposition (1.3), we see that it suffices to check the statement for rank-one matrices, for which the corresponding question is trivial. 2 The following proposition summarizes the result of Lemma 2.1 with some further observations on the behavior of arctic rank. Proposition 2.2. The following is true for any Boolean matrices. 1. The arctic rank of a diagonal matrix equals the number of ones. 2. Matrices of arctic rank 0 are exactly those consisting entirely of zeros. 3. If C is a submatrix of A, then arct (C) ≤ arct (A).
172
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
4. If A and B are of the same size, then arct (A ⊕ B) ≤ arct (A) + arct (B). 5. If A and B are of the same size, then arct (A|B) ≤ arct (A) + arct (B), here (A|B) denotes the concatenation of A and B. 6. Let T : Bm×n → Bm×n be a mapping which is additive and preserves the perimeter (that is, satisfies T (A ⊕ B) = T (A) ⊕ T (B) and perim (A) = perim (T (A)), for all A and B). Then there exist permutation matrices P ∈ Bm×m and Q ∈ Bn×n such that T (A) = P AQ for all A ∈ Bm×n or, if m = n, T (A) = P A Q for all A ∈ Bn×n , here A denotes the transpose of A. Proof. 1. It is true because the only way to decompose a diagonal matrix in the form (1.3) is to write this matrix as a sum of matrix units. 2. and 3. follow directly from Lemma 2.1. 4. The Boolean sum of any decompositions (1.3) for A and B provides such a decomposition for A ⊕ B. 5. We write (A|B) as a sum (O1 |B) ⊕ (A|O2 ) with O1 and O2 consisting of zeros and then use item 4 and Lemma 2.1. 6. Since T preserves perimeter 2, it must send any matrix unit to a matrix unit. If Eij = Ekl then 3 ≤ perim (Eij + Ekl ) ≤ 4. Now if T (Eij ) = T (Ekl ), then perim (T (Eij + Ekl )) = perim (T (Eij ) + T (Ekl )) = 2 < 3. Hence, T is injective, thus surjective on the set of matrix units. If T also preserves perimeter 3, then it sends matrix units from the same line (row or column) to those sharing a line as well. Then T is a composition of row and column permutations and, if m = n, possibly the transposition. In particular, it follows that T is bijective. 2 Remark 2.3. In Proposition 2.2 we characterized additive maps preserving the perimeter. Many interesting results of this kind are proven in [2,3] for the perimeter preservers of rank-one matrices that can probably also be generalized to the case of all Boolean matrices. As the following example shows, without the additivity restriction, there are many mappings with pathological properties. Example 2.4. Consider T : Bm×n → Bm×n defined by T (Eij ) = E11 for all i, j and T (X) = X for all X ∈ Bm×n \ {Eij |1 ≤ i ≤ m, 1 ≤ j ≤ n}. Then T preserves the perimeter and the arctic rank, however it is not of the aforesaid form. Remark 2.5. 1. It turns out that the number of summands in the rank-1 decomposition (1.3) providing the minimum for the perimeter (1.2) is not necessarily minimal possible over all rank-1 decompositions of a matrix, see Example 2.6 below. 2. This number can be not only greater than the factor rank of a matrix, but even greater than the size of a matrix, as the following example shows.
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
173
Example 2.6. The perimeter of the 10 × 10 Boolean matrix ⎛
1 ⎜1 ⎜ ⎜ ⎜0 ⎜ ⎜0 ⎜ ⎜0 A=⎜ ⎜1 ⎜ ⎜1 ⎜ ⎜ ⎜0 ⎜ ⎝0 0
1 1 0 0 0 0 0 1 1 0
0 0 1 1 0 0 0 1 1 0
1 0 1 1 0 0 0 0 0 1
1 0 0 0 1 1 0 0 0 1
0 1 1 0 1 1 0 0 0 0
0 1 1 0 0 0 1 1 0 0
1 0 0 1 1 0 1 1 0 0
0 0 0 1 1 0 0 0 1 1
⎞ 0 0⎟ ⎟ ⎟ 0⎟ ⎟ 0⎟ ⎟ 0⎟ ⎟ 1⎟ ⎟ 1⎟ ⎟ ⎟ 0⎟ ⎟ 1⎠ 1
equals 42. If the condition (1.3) holds with some l 10, then the value of the expression (1.2) is greater than 42. So, the value of perimeter is achieved only for more than 10 summands in the decomposition (1.3). Proof. Step 1. Consider the decomposition (1.3) with l = 11 such that Sup xv = Sup yv = {2v − 1, 2v} for v ∈ {1, . . . , 5}, Sup x6 = {1, 10}, Sup x7 = {2, 3}, Sup x8 = {4, 5}, Sup x9 = {6, 7}, Sup x10 = {8, 9}, Sup x11 = {1}, Sup y6 = {4, 5}, Sup y7 = {6, 7}, Sup y8 = {8, 9}, Sup y9 = {1, 10}, Sup y10 = {2, 3}, Sup y11 = {8}. Then (1.3) holds and the value of (1.2) equals 42. This shows that perim (A) ≤ 42. Step 2. Consider an arbitrary rank-one decomposition (1.3) of A. Since the maximal (by inclusion) submatrices of ones in A are 1-by-5, 5-by-1 and 2-by-2, we have that the number |Sup xi ||Sup yi | of nonzero entries in any xi yi does not exceed |Sup xi | +|Sup yi |. Step 3. From the result of Step 2 it follows that k i=1
(|Sup xi | + |Sup yi |)
k
|Sup xi ||Sup yi |
(2.1)
i=1
with equality possible only if |Sup xi | = |Sup yi | = 2, for every i. Step 4. Similarly, if the left-hand side of (2.1) is one greater than the right-hand side, then there is j such that either |Sup xj | = 1 or |Sup yj | = 1, and it holds that |Sup xj | = |Sup yj | = 2, for every j = j . Step 5. Note that A contains 41 ones, so the right-hand side of (2.1) is greater than or equal to 41. Thus by Step 3, the value of |Sup x1 | + |Sup y1 | + . . . + |Sup xk | + |Sup yk | may equal 41 only when |Sup xi | = |Sup yi | = 2 for every i. This is impossible, so the perimeter of A is at least 42. The perimeter is in fact equal to 42 as Step 1 now shows. Step 6. Finally, assume (1.3) holds for l 10 and the value of (1.2) equals 42 (that is, one greater than the number of units in A). By Step 4, there are k − 1 of the xi yi
matrices having their ones in 11 11 submatrices, and the other tenth is either a 1-by-u or a u-by-1 submatrix (note that u ≤ 5 by Step 2). Those submatrices would have 4k +u −4 ones in common, so that k = 10, u = 5, and the matrices xi yi are pairwise disjoint. By
174
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
the construction of A it is, however, impossible to partition the 1-entries of A into ten
pairwise disjoint submatrices such that nine of them have the form 11 11 and the tenth is either ( 1 1 1 1 1 ) or its transpose. 2 In Proposition 2.2 it was noted that the classical rank-sum and rank-union inequalities hold for the arctic rank. These inequalities hold also for tropical and Boolean rank functions [1]. There is another rank inequality, related to the Boolean products of matrices, and it holds that the tropical and Boolean ranks of A ⊗ B do not exceed those of A and B [1]. For the weak ranks of A ⊗ B, the row rank does not exceed that of A and the column rank that of B [4]. As to the arctic rank, the rank-product inequality turns out to fail. In fact, the arctic rank of a product of matrices can be greater than the sum of their ranks as the following results show. Example 2.7. Let A = A(m, n) be the m-by-n matrix for which Aij = 0 if i = j = 1 and Aij = 1 otherwise. If min{m, n} 2, then the perimeter of A(m, n) equals m + n + min{m, n} − 1. Proof. Assume that (1.3) holds. Using the notation from (1.3), we consider the subset I ⊂ {1, . . . , l} consisting of all i satisfying 1 ∈ Sup xi . For this set I, consider the vectors ξ1 = i∈I xi , γ1 = i∈I yi , ξ2 = j ∈I / xj , and γ2 = j ∈I / yj . It is then clear that |Sup ξ1 | + |Sup γ1 | + |Sup ξ2 | + |Sup γ2 | does not exceed the value of (1.2), and also l ξ1 γ1 ⊕ ξ2 γ2 i=1 xi yi = A. / Sup ξ2 since 1 does not lie in the support of any xj which is a summand Note that 1 ∈ of ξ2 by its definition. Further, the condition 1 ∈ Sup γ1 would imply 1 ∈ Sup yi for some
i ∈ I, which in turn implies xi yi 11 = 1 and contradicts A11 = 0. This shows that
1∈ / Sup γ1 , and thus ξ1 γ1 ⊕ ξ2 γ2 11 = 0. Since A11 = 0 is the unique zero entry in A, this implies ξ1 γ1 ⊕ ξ2 γ2 A. We see that ξ1 γ1 ⊕ ξ2 γ2 = A and that |Sup ξ1 | + |Sup γ1 | + |Sup ξ2 | + |Sup γ2 | does not exceed (1.2). Therefore, the value (1.2) can be optimal when l = 2. To check the result for l = 2, we assume without loss of generality that n m. In this case the condition A = u1 v1 ⊕u2 v2 holds with u1 = (1, 0, . . . , 0), v1 = (0, 1, . . . , 1), u2 = (0, 1, . . . , 1), v2 = (1, . . . , 1), and then |Sup (u1 )| + |Sup (u2 )| + |Sup (v1 )| + |Sup (v2 )| = 1 + (n − 1) + (m − 1) + n = m + n + min{m, n} − 1. 2 Corollary 2.8. The arctic rank of a product of matrices can be greater than the sum of their ranks. Proof. If A(m, n) denotes the matrix from Example 2.7, then the product of A(n, 2) and A(2, n) with rows permuted equals A(n, n), and for n > 7 we obtain the result we need. 2
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
175
3. The arctic rank and other rank functions Let us start the section with a proof that the arctic rank is greater than or equal to other existing rank functions over Boolean matrices. The following lemma is a key of our proof. Theorem 3.1. Assume the rows of a matrix A ∈ Bm×n are nonzero and pairwise different. Then the arctic rank of A is greater than or equal to m. Proof. For m = 1, the statement is true because the perimeter of a nonzero matrix cannot be less than 2. In what follows, we assume m > 1 and proceed by induction on m. Step 1. Denote by i the index of a row whose support is maximal by inclusion. Note that the support of the ith row is a subset of support of no other row in A because the rows are pairwise different. Step 2. Consider a decomposition (1.3) of A into the Boolean sum of rank-one matrices. Denote by A, x1 , . . . , xl matrices obtained from A, x1 , . . . , xl by deleting their ith rows, respectively. By the inductive assumption, |Sup x1 | + |Sup y1 | + · · · + |Sup xl | + |Sup yl | ≥ 2m − 2.
(3.1)
Step 3. If i belongs to both Sup xs and Sup xt , for different s and t, then we have |Sup xs | = |Sup xs | + 1 and |Sup xt | = |Sup xt | + 1, so the value of (1.2) is greater than or equal to 2m because of (3.1). Step 4. Now let i belong to the support of xs but not to that of any other xt , then the ith row of A equals ys . If also some i belongs to Sup xs , then the i th row of xs ys also equals ys , and thus the support of the i th row of A includes the support of its ith row. Step 1 then implies i = i, so Sup xs is a singleton {i}. In other words, xs is a zero vector, so that A = j=s xj yj . By the inductive assumption, the sum j=s (|Sup xj | + |Sup yj |) is then at least 2m − 2. This implies that the value of (1.2) is at least 2m because |Sup xs | ≥ 1 and |Sup ys | ≥ 1. Steps 3 and 4 cover all the possibilities and complete the proof. 2 Remark 3.2. It is impossible to generalize Theorem 3.1 to matrices with certain rows coinciding, as the following Example 3.4 shows. However, to formulate and prove this example we need at first the following lemma. Lemma 3.3. The perimeter of a k-by-n Boolean matrix cannot be greater than n + k2k−1 . Proof. For A a k-by-n matrix and s a subset of {1, . . . , k}, construct the matrix As as follows. Let the ith column of As be equal to the ith column of A if s is in the support of that column of A, and let the ith column of As consist of zeros otherwise. Denote the number of nonzero columns in As (equal to the number of columns in A with
176
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
support s) by ns , then the perimeter of As is either 0 or ns + |s|. It remains to note that A equals the Boolean sum of As over all s, and that also s⊂{1,...,k} ns = n and k−1 . 2 s⊂{1,...,k} |s| = k2 Example 3.4. Lemma 3.3 implies that the arctic rank of any n-by-2 matrix does not exceed n n 2 + 2 and that of any n-by-3 matrix is always at most 2 + 6. So, if n is sufficiently large (greater than 4 or 12, correspondingly) it appears that the arctic rank is less than the number of rows. Note that there are coinciding rows in this case since there are just 4 different rows of the length 2 and 8 different rows of the length 3. Now we can prove that the arctic rank is an upper bound for the Boolean and weak ranks. Corollary 3.5. The arctic rank of a Boolean matrix is greater than or equal to its tropical, Boolean, and weak ranks. Proof. By the definition, the row weak rank of a matrix cannot exceed the number of different nonzero rows, and so it is less than or equal to the arctic rank by Lemma 2.1 and Theorem 3.1. That the column weak rank cannot exceed the arctic rank is also now clear because the perimeter is invariant under transposition. For the tropical and Boolean ranks, the result then follows from Theorem 1.1. 2 Remark 3.6. The arctic rank is also an upper bound for the term rank. However, we need a separate proof for that fact since the term rank may grow under repeating the same row of a matrix. For example, t(Jn ) = n. Theorem 3.7. Let A ∈ Bm×n . Then arct (A) ≥ t(A). Proof. Assume the term rank of a matrix A is r, then there are subsets I = {i1 , . . . , ir } of row indexes and J = {j1 , . . . , jr } of column indexes of A both of cardinality r such that Ait ,jt = 1, for any t. Consider a rank-one matrix B satisfying Biτ ,jτ = 1, for ρ distinct values of τ . Then the perimeter of B is at least 2ρ. Now if A = B 1 ⊕ · · · ⊕ B s is a rank-one decomposition of A, then for any t, 1 ≤ t ≤ r, there is a B s with (it , jt ) entry equal to 1. Therefore, the perimeter of A cannot be less than 2r. 2 4. Computing the perimeter In this section we explore the computational aspects of the perimeter function for Boolean matrices. To construct a general algorithm for the perimeter of a given matrix A, we first provide an algorithm which checks whether the perimeter of A exceeds a given integer k or not. For fixed k, that algorithm turns out to have a polynomial time
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
177
complexity, in contrast with our general algorithm for the perimeter. Finally, we show that in fact no polynomial-time algorithm is likely to compute the perimeter of a general matrix by proving that this problem is NP-complete. 4.1. An algorithm for the perimeter First, we describe an algorithm that for a given n-by-m Boolean matrix A and an integer p checks whether the perimeter of A exceeds p or not. Algorithm 4.1. For any vectors x1 , . . . , xk from Bn and y1 , . . . , yk from Bm satisfying |Sup (x1 )| + |Sup (y1 )| + · · · + |Sup (xk )| + |Sup (yk )| p, check whether x1 y1 ⊕ . . . ⊕ xk yk = A or not. If the latter equality never holds, then conclude that the perimeter of A exceeds p, otherwise it is at most p. Note that Algorithm 4.1 directly uses the definition of the perimeter, so it works correctly. Let us find its complexity. Lemma 4.2. Algorithm 4.1 can work within O(pp+3 (m + n)p+3 ) time. Proof. It suffices to take k = p (because the zero matrices will appear among xi yi if k > p). Then we will list all the tuples T = (x1 , . . . , xp , y1 , . . . , yp ) satisfying p p i=1 |Sup (xi )| + i=1 |Sup (yi )| ≤ p. Here instead of each xi , yj , 1 ≤ i, j ≤ k we substitute the row of its coordinates, so T is a vector from Bp(n+m) . The supports of such tuples T (considered as the vectors from Bp(n+m) ) have cardinality at most p. We consider the functions ϕ from {1, . . . , p} to {1, . . . , (m + n)p}, which choose q ≤ p positions with units from p(n + m) possible positions in the vector T . So supports of such T can be thought of as the images of the functions ϕ. There are (p(m + n))p such functions, and, given a specific ϕ, it takes O(p(m + n)) time to list a corresponding tuple T = (x1 , . . . , xp , y1 , . . . , yp ). Finally, checking that x1 y1 ⊕ . . . ⊕ xp yp = A can be made within O(pnm) time. 2 So we can check in polynomial time whether the perimeter of a given matrix equals p or not, for every fixed integer p. The perimeter of A cannot exceed mn + m because A can be written as the sum of its rows (which are rank-one). Therefore, Algorithm 4.1 allows us to compute the perimeter of an m-by-n matrix in eO(mn ln(mn)) time. 4.2. Auxiliary results and intermediate perimeter Although the problem of computing the perimeter is algorithmically solvable as the previous subsection shows, the algorithm provided is not practically feasible due to its enormous time complexity. So the question arises: do there exist fast algorithms computing the perimeter? We will show that the answer is likely to be ‘no’ by proving that the
178
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
perimeter is NP-hard to compute. In other words, computing the perimeter turns out to be equivalent to a number of combinatorial problems that are widely believed to be hard. It will be the most convenient to provide a formulation for the perimeter problem in a decision form. Problem 4.3. PERIMETER OF A 01-MATRIX. Given an n-by-m Boolean matrix A and an integer p. Question: Do there exist vectors x1 , . . . , xk from Bn and y1 , . . . , yk from Bm satisfying |Sup (x1 )| + |Sup (y1 )| + · · · + |Sup (xk )| + |Sup (yk )| p and x1 y1 ⊕ . . . ⊕ xk yk = A? To be more concise, we will write simply PERIMETER for Problem 4.3 in the rest of our paper. In contrast with the special case of fixed p (which is solvable in polynomial time by the result of Section 4.1), PERIMETER turns out to be NP-complete, and our goal for the rest of the present section is to prove that result. We will further construct a polynomial reduction from a known NP-complete problem. We need to formulate a problem of computing the quantity related to the perimeter. Recall that we write A B in the case when Aij Bij holds for all i and j. Problem 4.4. INTERMEDIATE PERIMETER. Given an integer q and two Boolean n-by-m matrices satisfying A B. Question: Do there exist vectors x1 , . . . , xk from Bn and y1 , . . . , yk from Bm satisfying |Sup (x1 )| + |Sup (y1 )| + · · · + |Sup (xk )| + |Sup (yk )| q and A x1 y1 ⊕ . . . ⊕ xk yk B? Speaking less formally, Problem 4.4 asks whether there exists a Boolean matrix C which has perimeter not exceeding q and satisfies A C B. The smallest value of the perimeter over all such C will further be called the intermediate perimeter of B with respect to A, denote it by ipA (B). Problem 4.4 is clearly at least as hard as PERIMETER because we can take B = A in the formulation. However, the reduction is possible as well in the opposite direction. Notation 4.5. Assume a pair (A, B) of Boolean n-by-m matrices satisfies A B, and let w1 = (e1 , g1 ), . . ., wt = (et , gt ) be the list of all entries which equal 0 in B and 1 in A. By D = D(A, B) denote the (n + t)-by-(m + t) matrix with rows indexed by 1, . . . , n, w1 , . . . , wt and columns by 1, . . . , m, w1 , . . . , wt constructed as follows. For integer indexes i, j, τ , 1 ≤ i ≤ n, 1 ≤ j ≤ m, 1 ≤ τ ≤ t, we take Dij = 1 if and only if Aij = 1, take Diwτ = 1 only if i = eτ , take Dwτ j = 1 only if j = gτ , and take, finally, Dwτ wτ = 1 only if τ = τ . Let us give a less formal description of how we construct the matrix D(A, B). We take the matrix A and, for every w = (i, j) satisfying Aij > Bij , we add a new row and a new column both indexed w. Then we set Diw = Dwj = Dww = 1, and we define all other
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
179
entries from the row and column indexed w to be zero. For instance, if A =
B = 10 00 00 , then the matrix D(A, B) is ⎛
1 ⎜1 ⎜ D=⎜ ⎝1 0
1 0 0 1
0 0 0 0
0 1 1 0
1 1 0
100
and
⎞ 1 0⎟ ⎟ ⎟. 0⎠ 1
Notation 4.5 is in fact a reduction from Problem 4.4 to PERIMETER. Lemma 4.6. Matrices A, B, D from Notation 4.5 satisfy ipA (B) = perim (D) − 4t. Proof. By xτ and y τ denote the vectors with supports equal to {eτ , wτ } and {gτ , wτ }, respectively. Note that if A x1 y1 ⊕ . . . ⊕ xk yk B, for certain Boolean vectors, then x1 y1 ⊕ . . . ⊕ xk yk ⊕ x1 y 1 ⊕ . . . ⊕ xt y t = D,
so we have ipA (B) ≥ perim (D) − 4t. On the other hand, assume that D = u1 v1 ⊕ . . . ⊕ us vs , for certain Boolean vectors.
Note that, if ui vi w w = 1, there are exactly four possibilities: (i) Sup ui = Sup vi = r r {wr }, (ii) Sup ui = {er , wr } and Sup vi = {wr }, (iii) Sup ui = {wr } and Sup vi = {gr , wr }, (iv) Sup ui = {er , wr } and Sup vi = {gr , wr }. In any of these cases, we take
u ˆi and vˆi to be zero vectors. If ui vi w w = 0 holds for all τ , there can be at most τ τ
one index r for which either ui vi e w = 1 or ui vi w g = 1. In the former case, we r r r r define the vectors u ˆi , vˆi by u ˆi = ui and Sup vˆi = Sup vi \ {wr }; in the former case, we define Sup u ˆi = Sup ui \ {wr } and vˆi = vi . Then, we have A0 u ˆ1 vˆ1 ⊕ . . . ⊕ u ˆs vˆs B 0 , 0 0 where A and B denote the matrices obtained from A and B by adding zero rows and columns with indexes from W . By definition of u ˆi and vˆi , one has that, for every i = 1, . . . , s, perim (ui vi ) = |Sup (ˆ ui )| + |Sup (ˆ vi )| + removed entries = perim (ˆ ui vˆi ) + 2
t ui vi w
τ wτ
+
τ =1
t τ =1
ui vi
wτ gτ
+
t ui vi e
τ wτ
.
τ =1
t Since D = u1 v1 ⊕. . .⊕us vs , for every (α , β ) from τ =1 {(wτ , gτ ), (eτ , wτ ), (wτ , wτ )} there is an i such that ui vi has 1 as the entry indexed (α , β ). Therefore, the previous display implies s i=1
perim (ui vi )
s
perim (ˆ ui vˆi ) + 4t,
i=1
which means that ipA (B) ≤ perim (D) − 4t. 2
180
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
Now we summarize the latest results in the following theorem. Theorem 4.7. PERIMETER admits a polynomial reduction from INTERMEDIATE PERIMETER. Proof. The matrix D(A, B) from Notation 4.5 is constructed in polynomial time, given matrices A and B. So the result follows from Lemma 4.6, which shows that D(A, B) is a reduction. 2 4.3. PERIMETER is NP-complete Now we are about to prove the hardness result for the perimeter problem. What remains is to construct a polynomial reduction from some NP-complete problem to Problem 4.4, and our reduction will use a number of graph theoretic concepts. Mentioning a graph G = (V, E), we will mean an undirected graph with no loops and no multiple edges. A clique in G is a nonempty subset C ⊂ V such that {u, v} ∈ E for any pair of distinct vertices u and v from C. The following is a classical decision problem related to graphs. Problem 4.8. (See [7, Problem GT15].) PARTITION INTO CLIQUES. Given a graph G = (V, E) and an integer K. Question: Does G contain k cliques V1 , . . . , Vk with k K, V1 ∩ · · · ∩ Vk = ∅, and V1 ∪ · · · ∪ V k = V ? If G satisfies the condition from the above question, then we say that it can be partitioned into at most K cliques. The following is an easy observation on the problem introduced. Lemma 4.9. Assume that cliques G1 , . . . , Gk of a graph G = (V, E) satisfy G1 ∪ · · · ∪ Gk = V . Then G admits a partition into at most k cliques. k Proof. If i=1 |Gi | = |V | +h > |V |, then there are i, j, t satisfying i = j and t ∈ Gi ∩Gj . In this case we set Gi = Gi \ {t} and proceed by induction on h. 2 Let us now show how PARTITION INTO CLIQUES can be reduced to INTERMEDIATE PERIMETER. Lemma 4.10. Let G be a graph with vertices indexed with 1, . . . , n and the set E of edges. Let H, H ∈ Bn+1×n be matrices with rows indexed by 0, 1 . . . , n and columns by 1, . . . , n defined by: Hst = 1 if and only if s ∈ {0, t}, Hst
= 1 if and only if either Hst = 1 or {s, t} ∈ E.
Then ipH (H) ≤ 2n + k if and only if G can be partitioned into at most k cliques.
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
181
Proof. 1. Let V1 , . . . , Vk be a partition of G into k cliques. Consider vectors ξi ∈ {0, 1}n+1 and γi ∈ {0, 1}n with supports equal to Vi ∪ {0} and Vi , respectively, for every i ∈ {1, . . . , k}. Then the sum of cardinalities over all supports of ξi and γi equals 2n + k, and also H ξ1 γ1 ⊕ . . . ⊕ ξk γk H . 2. On the other hand, assume that ipH (H) ≤ 2n + k. This means that there are vectors xi and yi satisfying H x1 y1 ⊕ . . . ⊕ xl yl H l
|Sup (xi )| +
i=1
l
and
|Sup (yi )| 2n + k.
(4.1) (4.2)
i=1
3. Now we will show that there are xi and yi that satisfy the above conditions and have a certain special form. Note that, if g ∈ Sup xi and g ∈ / {0} ∪ Sup yi , then H and the gth row of xi yi share no unit entry. Therefore, we can remove all such g from Sup xi without violating inequalities (4.1) and (4.2). So we can assume without loss of generality that Sup xi ⊂ {0} ∪ Sup yi , for every i. 4. Since Htt = 1, for every t ∈ {1, . . . , n}, the inequality (4.1) shows that there is j(t) for which t ∈ Sup xj(t) ∩ Sup yj(t) . 5. Assume that there is τ ∈ {1, . . . , n} satisfying, for some i, the conditions τ ∈ Sup yi and τ ∈ / Sup xi . In this case, the τ th column of xi yi and H have no common unit entry except possibly (0, τ ). Therefore, if we remove τ from the support of yi and then add 0 to the support of xj(τ ) , we will not violate inequality (4.1). Since these operations cannot increase the left-hand side of (4.2), we can assume without loss of generality that no index τ satisfying the assumption of Step 5 exists. Using Step 3, we conclude that Sup xi is either Sup yi or {0} ∪ Sup yi .
6. For every i and t, t ∈ Sup yi , Step 5 implies xi yi tt = 1. From inequality (4.1) we obtain Htt = 1, thus proving that Sup yi is a clique in G. 7. Denote by I the set of all i satisfying 0 ∈ Sup xi . Since the 0th row of H consists of units, the inequality (4.1) shows that i∈I Sup yi = {1, . . . , n}. 8. In particular, Step 7 implies i∈I |Sup (yi )| n, and from the definition of I we deduce |Sup (xi )| + |Sup (yi )| = 2 |Sup (yi )| + |I| 2n + |I|. i∈I
i∈I
i∈I
The inequality (4.2) now shows, finally, that |I| k. 9. By Step 8, there are at most k sets Sup yi satisfying i ∈ I. By Step 7, the union of these sets is {1, . . . , n}, and by Step 6, they are cliques in G. Application of Lemma 4.9 completes the proof. 2 We finalize our paper with the main result of the present section. Theorem 4.11. PERIMETER is NP-complete.
182
L.B. Beasley et al. / Journal of Algebra 433 (2015) 168–182
Proof. Assume A is an n-by-m Boolean matrix satisfying A = A1 ⊕ . . . ⊕ Ak . If k > nm, then there is i such that Ai j=i Aj , and so A = j=i Aj . Therefore, having perimeter at most p can be certified with nm Boolean n-by-m matrices, so that PERIMETER belongs to NP. Finally, Theorem 4.7 and Lemma 4.10 point out the polynomial reducibility to PERIMETER from PARTITION INTO CLIQUES (which is the NP-complete problem GT15 from [7]). 2 Acknowledgments The authors are grateful to Professor E.S. Golod for his question about the existence of a rank function which dominates all other known rank functions for matrices over semirings and to the anonymous referee for the useful comments and suggestions. The authors wish to thank the Schloss Dagstuhl – Leibniz-Zentrum für Informatik, where this research was started, for partial financial support and creative atmosphere. The research of the second and third authors is also partially financially supported by the grants RFFI 15-01-01132a and MD-962.2014.1. References [1] M. Akian, S. Gaubert, A. Guterman, Linear independence over tropical semirings and beyond, Contemp. Math. 495 (2009) 1–38, arXiv:0812.3496. [2] L.B. Beasley, N.J. Pullman, Boolean-rank-preserving operators and Boolean-rank-1 spaces, Linear Algebra Appl. 59 (1984) 55–77. [3] L.B. Beasley, G.-S. Cheon, Y.-B. Jun, S.-Z. Song, Rank and perimeter preservers on Boolean rank-1 matrices, J. Korean Math. Soc. 41 (2) (2004) 397–406. [4] L.B. Beasley, A.E. Guterman, Rank inequalities over semirings, J. Korean Math. Soc. 42 (2) (2005) 223–241. [5] R. Brualdi, H. Ryser, Combinatorial Matrix Theory, Cambridge University Press, Cambridge, 1991. [6] M. Develin, F. Santos, B. Sturmfels, On the rank of a tropical matrix, in: Combinatorial and Computational Geometry, in: Math. Sci. Res. Inst. Publ., vol. 52, 2005, pp. 213–242. [7] M.R. Garey, D.S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman and Company, San Francisco, 1979. [8] Z. Izhakian, L. Rowen, The tropical rank of a tropical matrix, Comm. Algebra 37 (11) (2009) 3912–3927. [9] Ya.N. Shitov, A.E. Guterman, Tropical patterns of matrices and the Gondran–Minoux rank function, Linear Algebra Appl. 437 (2012) 1793–1811. [10] Ya. Shitov, Mixed subdivisions and ranks of tropical matrices, Proc. Amer. Math. Soc. 142 (2014) 15–19.