Research Article | Open Access
Algebraic Properties of Parikh Matrices of Binary Picture Arrays
A word is a finite sequence of symbols. Parikh matrix of a word is an upper triangular matrix with ones in the main diagonal and nonnegative integers above the main diagonal which are counts of certain scattered subwords in the word. On the other hand, a picture array, which is a rectangular arrangement of symbols, is an extension of the notion of a word to two dimensions. Parikh matrices associated with a picture array have been introduced, and their properties have been studied. Here, we obtain certain algebraic properties of Parikh matrices of binary picture arrays based on the notions of power, fairness, and a restricted shuffle operator extending the corresponding notions studied in the case of words. We also obtain properties of Parikh matrices of arrays formed by certain geometric operations.
“Combinatorics on words”  is a comparatively new branch of discrete mathematics with applications in many fields. The work  of the Norwegian mathematician Axel Thue (1863–1922) is considered to be the origin for the beginning of this new branch of mathematics. A finite word or simply a word is a finite sequence of symbols in a finite set called an alphabet. The Parikh vector  of a finite word, which has played a significant role in the theory of formal languages , expresses a numerical property of the word by counting the number of occurrences of the different symbols in the word.
The recently introduced notion of the Parikh matrix  of a word over an ordered alphabet is an extension of the Parikh vector. The Parikh matrix of a word, which is based on subwords (also called scattered subwords) of the word, is a very interesting and effective tool in the study of certain numerical properties of the word. Intensive work (see, for example, [5–11]) has taken place in investigating properties of words based on associated Parikh matrices. Such theoretical studies have dealt with problems of great interest related to words such as inequalities on the numbers of occurrences of subwords, injectivity of the mapping involved in defining the Parikh matrix, and other directions . An application of the Parikh matrix in message authentication is considered in .
On the other hand, a picture array or simply an array, having a rectangular arrangement of symbols in rows and columns, is an extension of a word to two dimensions (2D) . Several combinatorial properties of arrays have also been intensively investigated [14–20]. For instance, notions such as repetitions of subarrays in 2D arrays are studied in [15–17, 19], while periodicity in arrays is dealt with in [14, 18]. The notion of the Parikh matrix of a word has been extended to row and column Parikh matrices of picture arrays in , and their properties have been studied. The problem of reconstruction of 2D binary images has been studied  based on Parikh matrices.
Here, we consider binary picture arrays and establish properties of the Parikh matrices of power of an array, fairness of an array, and a restricted shuffle operator on arrays, by extending the corresponding notions [20, 23, 24] investigated in the case of words. We also obtain properties of Parikh matrices of arrays formed by certain geometric operations. A preliminary version of this work was presented in the conference MICOPAM 2018 .
For notions of formal string language theory and two-dimensional languages, not explained here, the reader is referred to . We recall only some basic notions.
A set , called an alphabet, is a finite set of symbols. A word over is a finite sequence of symbols over . The set of all words over is denoted by , and is the empty word with no symbols. An alphabet , with an order defined on it, is called an ordered alphabet, and we write . A word is said to be a scattered subword (or simply subword) of a word if there exist words (possibly empty) such that and . The length of a word , denoted by , is the number of symbols present in . The number of occurrences of a word as a subword of is denoted by .
A picture array (or simply an array) over of size is a rectangular arrangement of symbols in in rows and columns. For example, is a binary array over the binary alphabet . We denote the set of all arrays over by . If , we denote by , the number of symbol in the row (or in the column) of array , and by , the sum . For two arrays and with the same number of rows (resp. columns), the column (resp. rows) catenation (resp. ) is the array obtained by juxtaposing the array on the right (resp. below) of the array .
Throughout the rest of the paper, we consider only a binary ordered alphabet and binary arrays over unless specified otherwise. We now recall the definition of the Parikh matrix mapping  restricting it to a binary alphabet. Let be the monoid of upper triangular matrices with nonnegative integer entries and unit diagonal with respect to the multiplication of matrices. The unit matrix is denoted by . For a matrix , the entry is denoted by .
Definition 1. (see ). Let be an ordered alphabet. The Parikh matrix mapping, denoted by , is the morphism: defined as follows: and for where for , , and all other entries are zero. For a word with , the Parikh matrix of is given by .
If are two matrices, then the partial sum is defined  as the usual sum of matrices and except that the diagonal entries of by definition have the value 1.
3. Row and Column Parikh Matrices of a Binary Picture Array
The notion of the Parikh matrix of a word has been extended to a picture array in  by introducing a row Parikh matrix and a column Parikh matrix of an array, which we recall now again restricting to a binary alphabet.
Definition 2. Let and the array . Let the word in the row of be , , and the vertical word in the column of be , . Let the Parikh matrices of and be, respectively, , , and , . Then, the row Parikh matrix of is defined as and the column Parikh matrix of is defined as .
As an illustration, consider the array . Denoting the words in the rows as and , the row Parikh matrix of is .
We first obtain a property of the row (resp. column) Parikh matrix of a binary picture array, extending a corresponding property  of the Parikh matrix of a binary word.
Theorem 1. For integers , suppose . If is the row (resp. column) Parikh matrix of an binary array , then and (resp. ), where (resp. ()) with being the row (resp. column) of .
Proof. We prove the result only for the row Parikh matrix as the result for the column Parikh matrix can be proved in a similar manner. Let be the row Parikh matrix of an binary array . Then, has symbols, ’s, and ’s, so that . Let with being the row of . Then, , and the number of ’s in the row is . Therefore, the maximum number of ’s in the row is . Thus, the maximum number of ’s in the row Parikh matrix of is so that .
4. Parikh Matrix of Power of an Array
Definition 3. Let be an array. Then, power of , denoted by , is the picture array such that , for all and .
Example 1. Let be a two-dimensional array. The power of is given by .
Theorem 2. Let be the row Parikh matrix of a binary array over . Then, the row Parikh matrix of the power is given by , where and , with being the row of .
Proof. We have . Now, is the column catenation of with itself, times. Let , , and denote the number of ’s, ’s, and ’s in the row of . Then, the row of is . Using the formula in  (Theorem 3.1), the Parikh matrix of is given by . Therefore, the row Parikh matrix of is . Since the array is the row catenation of the array with itself times, each of the rows of the array is repeated times in the same order in . This means that is times , ., is . Likewise, for and . This proves the required result.
The notion of -ambiguity of words has been extended to two-dimensional picture arrays in . We now recall this.
Definition 4. The arrays are said to be -row equivalent if and -column equivalent if . The arrays and are said to be -equivalent, denoted by , if they are both -row equivalent and -column equivalent. An array is -ambiguous (or simply ambiguous) if it is -equivalent to another distinct array; otherwise, it is unambiguous.
In , it is shown that for any two words , , either of the following statements holds: , for all positive integers ; , for all positive integers . In the case of binary picture arrays, the situation is different as seen from the following proposition.
Proposition 1. There are -row equivalent picture arrays whose powers are not -row equivalent and conversely.
This proposition is illustrated in the following example.
Example 2. We consider binary arrays and . Then, and Now, so that the binary arrays and are equivalent.
But, and so that and are not equivalent.
We next consider binary arrays and . Then, and .
We have and so that the binary arrays and are not equivalent.
But, so that and are equivalent.
The next result gives a sufficient condition for two -row equivalent binary picture arrays to have their powers also -row equivalent.
Theorem 3. Let and be two -row equivalent binary arrays over . Then their powers and are -row equivalent if , where and , with and being the rows of and , respectively.
Proof. Let and be two -row equivalent binary arrays over and . Then, where and , , are the number of ’s in the row of and , respectively. Also, the number of ’s in the row of and , respectively, is and . Suppose . Now, using Theorem 2, we havewhere and . We now prove that which will complete the proof.
We haveThis proves that and are -row equivalent.
Remark 1. The sufficient condition in Theorem 3 is not vacuous as can be seen from the following illustration.
Consider the binary arrays and which are equivalent with the row Parikh matrix . If the number of subword in the rows of (resp. ) are and (resp. and ), then . Now, and and so that the binary arrays and are equivalent.
5. Fair Picture Arrays
Fair words and their properties have been studied in . A weak ratio property for an array is introduced in . We now extend the notion of fair words to two-dimensional arrays. We also recall the notion of the weak ratio property restricting it to binary arrays.
Definition 5. (i)A binary array is called fair if the total number of subwords in the rows (respectively, columns) of is equal to the total numbers of subwords in the rows (respectively, columns) of (ii)Let and be two binary arrays over . The arrays and are said to satisfy a weak ratio property if where is a nonzero constant
Theorem 4. Let and be two fair binary arrays over , both having the same number of rows, satisfying the weak ratio property. Then, the arrays and are also fair. A corresponding result holds good for and .
Proof. Let and be two fair words satisfying the weak ratio property with ratio constant . Denoting the total number of subwords in the rows of a binary array by , we have and . Also, we have . This implies that , i.e., .
Since is the column catenation of and , the column Parikh matrix of is . Therefore, the number of subword ’s column wise in is the same as the number of ’s column wise in .
Let and , , be the words in the row of and , respectively. Now, the number of ’s row wise in is given byWe also havesincesinceThis proves that is a fair array. In a similar manner, it can be shown that is also a fair array.
6. Restricted Shuffle Operator on Picture Arrays
In , a restricted shuffle operator on two binary words, denoted as , is considered and properties of Parikh matrices of words under this operator are derived, especially over a binary alphabet. Here, we extend this operator to picture arrays and obtain properties of Parikh matrices of arrays under this operator.
Definition 6. Let be two picture arrays over such that and . Then, the restricted row shuffle operator on the pair of arrays and is defined byand similarly the restricted column shuffle operator is defined by
Example 3. Let over the binary alphabet be given by , . Then, and .
We observe a few facts which are immediate from the definition:(i)(ii)In , the authors introduced a notion of the positions of letters in a word and using this notion characterized the -equivalent words over the binary alphabet. The sum of positions of a letter in a word of length over an alphabet , denoted by , is defined by .
Here, we introduce the sum of positions of a letter in a binary array over as follows.
Definition 7. Let be a binary array over , then the row-wise sum of positions of a letter in is defined by , where is the row of the array .
Similarly, the column-wise sum of positions of a letter in is defined by , where is the column of the array .
Theorem 5. Two arrays and over is -row equivalent (column equivalent) to each other if each row (column) of and has the same number of ’s and (, respectively).
Proof. Let and be the row of the arrays and , respectively. Also, let , for all , and . Then, the number of ’s in the row Parikh matrix of is equal to . Now,which is the number of ’s in the row Parikh matrix of . Hence, the binary arrays and are -row equivalent.
Similarly, the other case of -column equivalence can be proved.
Lemma 1. Let where , then and where is the number of ’s in the array .
Proof. Let and be the row of the arrays and , respectively. Then, we have
Similarly, we can prove the statement . A sufficient condition for the row shuffle operator of two binary arrays is given as follows.
Theorem 6. Let where , then if .
This can be seen using Lemma 1 and the fact that .
7. Geometric Operations on Picture Arrays
Geometric operations on picture arrays such as reflection and rotation are now considered. Properties of Parikh matrices of the arrays resulting from the geometric operations are obtained.
Proposition 2. Let be a binary picture array over . Reflection of about its rightmost vertical yields an array with the following properties:(i) and (ii)The column Parikh matrices of and are the same(iii)The number of ’s row wise in is , where is the row of Similarly, reflection of A about its bottommost horizontal yields an array with the following properties:(i) and (ii)The row Parikh matrices of and are the same(iii)The number of ’s column wise in is , where is the column of The following proposition is a consequence of Proposition 2.
Proposition 3. If two arrays and of the same sizes are -equivalent, then their reflections about their rightmost verticals and their bottommost horizontals are also -equivalent.
Definition 8. Let be a picture array over such that . A picture array obtained from by rotating it by clockwise, denoted by , is defined as .
Note that is an array of size such that the first row of is the last column of , the second row of is the last but the second column of , and so on, and the last row of is the first column of .
Similarly, one can define (which is the same as ), , and . It is easy to see that .
Now we state in the following proposition, the relations between the row and column Parikh matrices of the rotated arrays.
Proposition 4. Let be a picture array where , then and , and , and and where and are the reflections of the array about its bottommost horizontal and rightmost vertical.
8. Concluding Remarks
Motivated by applications in areas such as pattern recognition and computer vision several studies have been done on combinatorial properties of two-dimensional arrays . The study done in this paper is a contribution to this area as well, and it extends notions and concepts well studied in the context of strings. It will be of interest to consider picture arrays of three or more symbols and examine the applicability of the notions and results considered here.
The data related to the findings of this work are available in journal articles.
Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this article.
S. Bera and L. Pan were partially supported by the National Natural Science Foundation of China (61772214).
- M. Lothaire, Combinatorics on Words, Cambridge Mathematical Library, Cambridge University Press, Cambridge, UK, 1997.
- J. Berstel and D. Perrin, “The origins of combinatorics on words,” European Journal of Combinatorics, vol. 28, no. 3, pp. 996–1022, 2007.
- G. Rozenberg and A. Salomaa, Handbook of Formal Languages, vol. 1–3, Springer-Verlag, New York, NY, USA, 1997.
- A. Mateescu, A. Salomaa, K. Salomaa, and S. Yu, “A sharpening of the Parikh mapping,” RAIRO—Theoretical Informatics and Applications, vol. 35, no. 6, pp. 551–564, 2001.
- A. Atanasiu, “Binary amiable words,” International Journal of Foundations of Computer Science, vol. 18, no. 2, pp. 387–400, 2007.
- A. Atanasiu and W. C. Teh, “A new operator over Parikh languages,” International Journal of Foundations of Computer Science, vol. 27, no. 6, pp. 757–769, 2016.
- S. Fossé and G. Richomme, “Some characterizations of Parikh matrix equivalent binary words,” Information Processing Letters, vol. 92, no. 2, pp. 77–82, 2004.
- A. Mateescu, “Algebraic aspects of Parikh matrices,” in Theory is Forever, pp. 170–180, Springer, Berlin, Germany, 2004.
- K. G. Subramanian, A. M. Huey, and A. K. Nagar, “On Parikh matrices,” International Journal of Foundations of Computer Science, vol. 20, no. 2, pp. 211–219, 2009.
- W. C. Teh, “On core words and the Parikh matrix mapping,” International Journal of Foundations of Computer Science, vol. 26, no. 1, pp. 123–142, 2015.
- W. C. Teh and K. H. Kwa, “Core words and Parikh matrices,” Theoretical Computer Science, vol. 582, pp. 60–69, 2015.
- A. Salomaa, “Comparing subword occurrences in binary D0L sequences,” International Journal of Foundations of Computer Science, vol. 18, no. 6, pp. 1395–1406, 2007.
- R.-F. Atanasiu, “Message authentication code based on Parikh matrices,” in Proceedings of the International Conference on Security for Information Technology and Communication, pp. 7–14, Bucharest, Romania, 2008.
- A. Amir and G. Benson, “Two-dimensional periodicity in rectangular arrays,” SIAM Journal on Computing, vol. 27, no. 1, pp. 90–106, 1998.
- A. Amir, G. M. Landau, S. Marcus, and D. Sokol, “Two-dimensional maximal repetitions,” in Proceedings of the LIPIcs-Leibniz International Proceedings in Informatics 112, 26th Annual European Symposium on Algorithms (ESA), vol. 2, no. 1-2, p. 14, Helsinki, Finland, August 2018.
- A. Apostolico and V. E. Brimkov, “Fibonacci arrays and their two-dimensional repetitions,” Theoretical Computer Science, vol. 237, no. 1-2, pp. 263–273, 2000.
- A. Carpi and A. de Luca, “Repetitions and boxes in words and pictures,” Jewels are Forever, pp. 295–306, 1999.
- A. Carpi and A. de Luca, “Periodic-like words, periodicity, and boxes,” Acta Informatica, vol. 37, no. 8, pp. 597–618, 2001.
- A. Carpi and A. de Luca, “Repetitions, fullness, and uniformity in two-dimensional words,” International Journal of Foundations of Computer Science, vol. 15, no. 2, pp. 355–383, 2004.
- G. Gamard, G. Richomme, J. Shallit, and T. J. Smith, “Periodicity in rectangular arrays,” Information Processing Letters, vol. 118, pp. 58–63, 2017.
- K. G. Subramanian, K. Mahalingam, R. Abdullah, and A. K. Nagar, “Two-dimensional digitized picture arrays and Parikh matrices,” International Journal of Foundations of Computer Science, vol. 24, no. 3, pp. 393–408, 2013.
- V. Masilamani, K. Krithivasan, K. G. Subramanian, and A. M. Huey, “Efficient algorithms for reconstruction of 2D-arrays from extended Parikh images,” in ISVC 2008 Part II, Lecture Notes in Computer Science, vol. 5359, pp. 1137–1146, Springer, Berlin, Germany, 2008.
- A. Atanasiu, G. Poovanandran, and W. C. Teh, “Parikh matrices for powers of words,” Acta Informatica, vol. 56, no. 6, pp. 521–535, 2019.
- A. Cerny, “On fair words,” Journal of Automata, Languages, and Combinatorics, vol. 14, no. 2, pp. 163–174, 2009.
- S. Bera, A. K. Nagar, L. Pan, S. Sriram, and K. G. Subramanian, “Parikh matrices of binary picture arrays,” in Proceedings of the MICOPAM 2018 International Conference, pp. 157–161, Antalya, Turkey, October 2018.
Copyright © 2020 Somnath Bera et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.