ebook img

Non-overlapping matrices PDF

0.33 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Non-overlapping matrices

Non-overlapping matrices Elena Barcucci∗ Antonio Bernini∗ Stefano Bilotta∗ Renzo Pinzani∗ 6 1 Abstract 0 2 Two matrices are said non-overlapping if one of them can not be put on the other one in a way such that the corresponding entries n a coincide. We provide a set of non-overlapping binary matrices and J a formula to enumerate it which involves the k-generalized Fibonacci 8 numbers. Moreover, the generating function for the enumerating se- 2 quence is easily seen to be rational. ] M 1 Introduction D . A stringuovera finite alphabet Σ is said self non-overlapping (or equiv- s c alently unbordered or bifix-free) if it does not contain proper prefixes which [ are also proper suffixes. In other words, a string u ∈ Σ∗ is unbordered if 1 it can not be factorized as u = vu(cid:48)v with v ∈ Σ+ and u(cid:48) ∈ Σ∗. Nielsen in v [13] provided the set X ⊂ Σn of all bifix-free strings by means of a recur- 3 2 sive construction. More recently, several researches [5, 7, 8, 9] have been 7 conducted in order to define particular subsets of X constituted by non- 7 overlapping (or cross-bifix-free) strings: two n length strings u,v ∈ X are 0 . said non-overlapping if any non-empty proper prefix of u is different from 1 0 any non-empty proper suffix of v, and viceversa. 6 In [3] the notion of unbordered strings is generalized to the two dimen- 1 sional case by means of unbordered pictures which are rectangular matrices : v overΣbyimposingthatallpossibleoverlapsbetweentwocopiesofthesame i X picture are forbidden. In particular, the authors extend in two dimensions r the construction of unbordered strings proposed in [13] and describe an al- a gorithm to generate the set U of all the unbordered pictures of fixed size m×n. The aim of the present paper is to find a subset of unbordered matrices which are non-overlapping. As well as the sets given in [5, 7, 8, 9] are non- overlapping subsets (or cross-bifix-free subsets) of strings of X, in the same ∗Dipartimento di Matematica e Informatica “U. Dini”, Universita` degli Studi di Firenze, Viale G.B. Morgagni 65, 50134 Firenze, Italy. [email protected], [email protected], [email protected], [email protected] 1 waythesetwearegoingtopresentisanon-overlappingsubsetofmatricesof U. RoughlyspeakingtwounborderedmatricesAandB arenon-overlapping if all possible overlaps between A and B are forbidden. More precisely, we can imagine to make a rigid movement of B on A such that B glides on A. At the end of each slipping, which can be geometrically interpreted as a translation in a given direction on the plane, a (non empty) common area (in the sequel control window) is formed. This common area can be seen as the usual intersection between the two rectangular arrays containing the entries of A and B, which is, in turn, a rectangular array constituted by a finite number of 1×1 cells of the discrete plane. Each cell of the control window contains an entry of A and an entry of B. If in each cell of the window the entry of A coincides with the entry of B, then such window is said overlapping window and A and B overlapping matrices. On the contrary, if for any translation we never find an overlapping window, A and B are said non-overlapping matrices. For example, the unbordered matrices     1 0 0 1 1 0 1 1 0 0 A = 0 1 0 1 1 and B = 1 1 0 0 0 can be overlapped as in 0 1 1 1 0 1 0 1 1 1 Figure 1 where the control window is showed. 1 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 1 1 1 Figure 1: An example of overlap Actually,afirstattemptinordertogeneralizetheconceptofnon-overlap in two dimensions between two distinct matrices can be found in [4] where the authors define a set of cross-bibifix-free square matrices over a finite alphabet. For the sake of clearness, two square matrices are said to be cross-bibifix-free when, essentially, they are non-overlapping only along the direction of the main diagonal. Here, using a completely different approach, weconsidertranslationsinanydirectionontheplaneandmatriceswhichcan be also rectangular matrices, even if they have only binary entries. In this waythedefinitionofnon-overlappingsetofmatriceswearegoingtopropose seems to be very close to the natural generalization in two dimensions of the concept of non-overlapping set of strings. As it often happens, the extension to the bidimensional case of a typical concept related to strings is carried on by taking into account matrices. There are several cases in the literature where this process is occurred. For example, in [10] a bidimensional variant of the string matching problem is 2 considered for sets of matrices. Another interesting example is given by the extension of classical finite automata for strings to the two-dimensional rational automata for pictures introduced in [1]. Moreover, it is worth to mention the problem of the pattern avoidance in matrices [11], which is a typical topic in linear structures as permutations and words. In Section 2 we formally define a set of binary matrices which are proved tobenon-overlappingmatrices. ThecardinalityofthissetisgiveninSection 3 where we also show that it is related to the well-known k-generalized Fibonacci numbers. 2 A set of non-overlapping binary matrices The definition of non-overlapping matrices given in the Introduction can be formalized in terms of blocks matrices. Indeed, the control window we have referred in the previous section is essentially a particular block whose dimensionsimposetheonesoftheotherblocksofthepartitionofthematrix. Definition 2.1 Let M be the set of all the matrices with m rows and m×n n columns. Two distinct matrices A,B ∈ M are said non-overlapping m×n if all the following conditions are satisfied by A and B: • there do not exist two block partitions (cid:20) (cid:21) (cid:20) (cid:21) A A B B A = 11 12 and B = 11 12 A A B B 21 22 21 22 such that A ,B ∈ M , with 1 ≤ r ≤ m−1, 1 ≤ s ≤ n−1, and 11 22 r×s neither A = B , nor A = B , nor A = B , nor A = B . 11 22 12 21 21 12 22 11 • there do not exist two block partitions (cid:20) (cid:21) (cid:20) (cid:21) A B A = 11 and B = 11 A B 21 21 such that A ,B ∈ M , with 1 ≤ r ≤ m−1, and neither A = 11 21 r×n 11 B , nor A = B . 21 21 11 • there do not exist two block partitions (cid:2) (cid:3) (cid:2) (cid:3) A = A A and B = B B 11 12 11 12 such that A ,B ∈ M , with 1 ≤ s ≤ n−1, and neither A = 11 12 m×s 11 B , nor A = B . 12 12 11 3   1 1 0 ∗ ∗ ∗ ∗ 1 0 0 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 0   ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 0   ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 0   ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 0 1 1 1 ∗ ∗ ∗ ∗ 0 0 0 (3) Figure 2: The structure of the matrices in S . 6×10 In other words, two distinct matrices are non-overlapping if any control window is not an overlapping window. Therefore, we can also define a self non-overlapping (or unbordered) matrix A ∈ M as a matrix such that m×n there does not exist a translation of A on itself such that we never find an overlapping window. Clearly, this last definition can be easily deduced from Definition 2.1 with A = B and suitably adapting the block partitions. Definition 2.2 A set S ⊂ M is called non-overlapping if each m×n m×n matrix of S is self non-overlapping and for any two matrices A,B ∈ m×n S they are non-overlapping matrices. m×n Fixed the dimension m × n of the matrices, we now define a possible non-overlappingsetwherethematriceshaveaparticularstructureinvolving some of the entries on the frame of the matrix. Definition 2.3 Let 3 ≤ k ≤ (cid:4)n(cid:5). We denote S(k) ⊂ M the set of the 2 m×n m×n matrices A = (a ) satisfying the following conditions: i,j • A = 1k−10w 10k−1, where v = 0w 1 is a binary string of length 1 1 1 1 n−2k+2 avoiding both 0k and 1k; • for i = 2,...,m − 1, A = w 0 = v , where v is a binary string of i i i i length n avoiding both 0k and 1k; • A = 1kv 0k, where v is a binary string of length n−2k avoiding m m m both 0k and 1k. (With A , A and A we denote the first, the i-th and the m-th row 1 i m of the matrix A.) (k) In other words, some entries on the frame of a matrix in S are fixed. m×n (3) For example, the matrices in S are represented in Figure 2 where the 6×10 generic entries ∗ ∈ {0,1} are chosen so that the conditions of Definition 2.3 (2) are satisfied. We note that for k = 2 and n odd the set S can not be m×n defined since the strings v can not avoid both 00 and 11. i 4 (k) Proposition 2.1 The set S ⊂ M is non-overlapping, for each k m×n m×n with 3 ≤ k ≤ (cid:4)n(cid:5), m ≥ 2 and n ≥ 2k. 2 (k) Proof. Given to matrices A,B ∈ S , we present two possible slip- m×n pings of B on A (without loss of generality A and B can be interchanged). 1. In the case represented in Figure 3 the obtained control window con- tains, in its lower row, a string having k consecutive equal symbols. If A and B would be overlapping matrices, then these k consecutive equal symbols, belonging to the frame of B, should also appear in a (k) row v of A, against the hypothesis that A ∈ S . i m×n 1 1 0 1 0 0 0 1 1 0 1 0 0 0 =B 0 0 0 0 A = 1 1 1 0 0 0 0 0 1 1 1 0 0 0 Figure 3: The slipping of case 1: the grey entries are a forbidden sequence of A. 2. Another possible slipping is pictured in Figure 4 where the control window is non-overlapping (and then A and B are non-overlapping matrices) since it presents certain cells where the fixed entries of A do not coincide with the fixed entries of B. These fixed entries belong to the frame of A and B. 1 1 0 1 0 0 0 1 1 0 1 0 0 0 =B 0 0 0 0 A = 1 1 0 0 0 0 1 1 1 0 0 0 Figure 4: The slipping of case 2: the grey entry contains different values of A and B. 5 In general, given a control window of dimension r×s, with 1 ≤ r ≤ m and 1 ≤ s ≤ n, we can refer to one of the two above cases depending on the values of r and s. In particular we have: • r = 1 : – if 1 ≤ s ≤ 2k−2, there exists a slipping as in case 2; – if 2k−1 ≤ s ≤ n−k, there exists a slipping as in case 1; – if n−k+1 ≤ s ≤ n, there exists a slipping as in case 2; • 2 ≤ r ≤ m−1 : – if 1 ≤ s ≤ k, there exists a slipping as in case 2; – if k+1 ≤ s ≤ n, there exists a slipping as in case 1; • r = m : – if 1 ≤ s ≤ 2k−1, there exists a slipping as in case 2; – if 2k ≤ s ≤ n−k, there exists a slipping as in case 1; – if n−k+1 ≤ s ≤ n−1, there exists a slipping as in case 2. To complete the proof, if A = B, then it immediately follows from the (k) above argument that the matrices of S are self non-overlapping. m×n (cid:4) (k) 3 The enumeration of S m×n (k) In this section we are going to enumerate the set S . It is easy to m×n realize that its cardinality depends on the number of rows satisfying the constraints of Definition 2.3. We denote by R (0k,1k) be the set of binary string starting with 0, n ending with 1 and avoiding k consecutive 0’s and k consecutive 1’s. Let Z (0k,1k) be the set of binary strings ending with 0 and avoiding k consec- n utive 0’s and k consecutive 1’s. Moreover, let B (0k,1k) the set of binary n strings avoiding k consecutive 0’s and k consecutive 1’s. We indicate with r(k), z(k) and b(k) the cardinality of R (0k,1k), Z (0k,1k) and B (0k,1k), n n n n n n respectively. It is straightforward that (cid:16) (cid:17)m−2 |S(k) | = r(k) · z(k) ·b(k) (1) m×n n−2k+2 n n−2k (k) where,referringtoDefinition2.3,thetermr countsthenumberof n−2k+2 (k) stringsv ,thetermsz countthenumberofstringsv fori = 2,3,...,m−1, 1 n i (k) and b is the number of strings v . n−2k m 6 3.1 The sequence r(k) n (k) Now we consider a possible recursive relation for r by means of a n recursive construction of R (0k,1k). We first observe that R (0k,1k) = {λ}, n 0 R (0k,1k) = ∅ and R (0k,1k) is formed by all the binary strings of length j, 1 j (k) (k) with 2 ≤ j ≤ k, starting with 0 and ending with 1. Then r = 1, r = 0 0 1 and r(k) = 2j−2 for 2 ≤ j ≤ k. Clearly, if k = 2, then r(k) = 0 in the case of j n n odd and r(k) = 1 if n is even (in this case R (0k,1k) = {0101...01}). n n (cid:124) (cid:123)(cid:122) (cid:125) n Fixed k ≥ 3 and n ≥ k+1, each string u ∈ R (0k,1k) can be factorized n as u = u(cid:48)0i1j, with 1 ≤ i,j ≤ k−1, and u(cid:48) ∈ R (0k,1k). Denoting with n−i−j h = i+j the length of the suffix 0i1j, it is 2 ≤ h ≤ 2k−2. If2 ≤ h ≤ k,thenicanassumethevalues1,2,...,h−1andconsequently j = h−1,h−2,...,1 for a total of h−1 possibilities for the suffix 0i1j, for each fixed h. Indeed, in this case, the suffix 0i1j contains neither 0k nor 1k. If k +1 ≤ h ≤ 2k −2, in order to avoid the forbidden patterns i can assume the values h − k + 1,h − k + 2,...,k − 1 and consequently j = k−1,k−2,...,h−k+1 for a total of 2k−h−1 possibilities for the suffix 0i1j, for each fixed h. Therefore, for n ≥ k+1, k 2k−2 r(k) = (cid:88)(h−1)r(k) + (cid:88) (2k−h−1)r(k) . n n−h n−h h=2 h=k+1 Summarizing:  1 if n = 0         0 if n = 1      rn(k) = 2n−2 if 2 ≤ n ≤ k       k 2k−2  (cid:88)(h−1)r(k) + (cid:88) (2k−h−1)r(k) if n ≥ k+1.  n−h n−h  h=2 h=k+1 (k) Note that the coefficients of r , for n ≥ k + 1, are the coefficients n of Smarandache Crescendo Pyramidal sequence (see sequence A004737 in The On-line Encyclopedia of Integer Sequence). In Table 1 we list the first (k) numbers of the recurrence r for some fixed values of k. n Since the strings u ∈ R (0k,1k) have been factorized with u = u(cid:48)0i1j, n where the suffix 0i1j has length at least 2, the first term in the recurrence (k) (k) for r is r . In the following we provide another construction for the n n−2 (k) (k) strings u leading to a recurrence for r which involves also the term r . n n−1 7 (cid:72) (cid:72) k (cid:72) 3 4 5 6 7 8 n (cid:72)(cid:72) 0 1 1 1 1 1 1 1 0 0 0 0 0 0 2 1 1 1 1 1 1 3 2 2 2 2 2 2 4 2 4 4 4 4 4 5 4 6 8 8 8 8 6 7 12 14 16 16 16 7 10 22 28 30 32 32 8 17 41 54 60 62 64 9 28 74 104 118 124 126 10 44 137 201 232 246 252 11 72 252 386 456 488 502 12 117 464 745 897 968 1000 13 188 852 1436 1762 1920 1992 14 305 1568 2768 3465 3809 3968 15 494 2884 5336 6812 7554 7904 (k) Table 1: Sequences r for some fixed values of k. n LetR(1i)(0k,1k)bethesubsetofR (0k,1k)ofthestringsendingwithiones, n n k−1 with i = 1,2,...,k−1. Then R (0k,1k) = (cid:91) R(1i)(0k,1k). n n i=1 The strings of R(11)(0k,1k) are obtained by the strings of R (0k,1k) n n−j−1 appending 0j1, for j = 1,2,...,k−1. So that (cid:12) (cid:12) (cid:12)R(11)(0k,1k)(cid:12) = r(k) +r(k) +...+r(k) . (2) (cid:12) n (cid:12) n−2 n−3 n−k The strings of R(1i)(0k,1k), with 2 ≤ i ≤ k −1, can be obtained from n all the strings of R (0k,1k), appending one 1 at the end of each string, n−1 excluding the strings in R(1k−1)(0k,1k) since the forbidden pattern 1k would n−1 appear. So, k−1 (cid:88)(cid:12)(cid:12)R(1i)(0k,1k)(cid:12)(cid:12) = r(k) −(cid:12)(cid:12)R(1k−1)(0k,1k)(cid:12)(cid:12) . (3) (cid:12) n (cid:12) n−1 (cid:12) n−1 (cid:12) i=2 For what the last term is concerned, we observe that the strings of R(1k−1)(0k,1k)areobtainedfromthestringsofR(11) (0k,1k)appending n−1 n−1−(k−2) (cid:12) (cid:12) (cid:12) (cid:12) 1k−2. Clearly, (cid:12)R(1k−1)(0k,1k)(cid:12) = (cid:12)R(11) (0k,1k)(cid:12). The set R(11) (0k,1k) (cid:12) n−1 (cid:12) (cid:12) n−k+1 (cid:12) n−k+1 is obtained from the strings of R (0k,1k) appending 0j1, for n−k+1−(j+1) j = 1,2,...,k−1. Then, (cid:12) (cid:12) (cid:12)R(1k−1)(0k,1k)(cid:12) = r(k) +r(k) +...+r(k) . (4) (cid:12) n−1 (cid:12) n−k−1 n−k−2 n−2k+1 8 Summarizing, since k−1 r(k) = (cid:12)(cid:12)R(11)(0k,1k)(cid:12)(cid:12)+(cid:88)(cid:12)(cid:12)R(1i)(0k,1k)(cid:12)(cid:12) , n (cid:12) n (cid:12) (cid:12) n (cid:12) i=2 from Equation (2), (3) and (4), we obtain: k 2k−1 r(k) = (cid:88)r(k) − (cid:88) r(k) , (5) n n−j n−j j=1 j=k+1 (k) (k) (k) with initial conditions r = 0, r = 1, r = 0. −i 0 1 (k) We observe that the sequence r satisfies also a recurrence which is n used in the rest of the paragraph. The n-th term of such a recurrence is given by the sum of the k−1 preceding terms plus 0 or 1 or -1, depending on n and k. The result is stated in the following proposition. (k) (k) (k) Proposition 3.1 Let r = 0, r = 1, r = 0 be the initial conditions, −i 0 1 then k−1 r(k) = (cid:88)r(k) +d(k) , n n−j n j=1 where  1 if (n mod k) = 0      d(k) = −1 if (n mod k) = 1 n      0 if (n mod k) ≥ 2 . (k) Proof. We can proceed by induction. If n = 2, we have that r = 2 (k) (k) (k) (k) (k) (k) (k) r +r +r +...+r +d . Since k ≥ 3 and r = 0, then d = 0 1 0 −1 3−k 2 −1 2 (k) (k) (k) and r = r +r = 1 which is the same value obtained by recurrence 2 1 0 (5). Suppose that r(k) = (cid:80)k−1r(k) +d(k) for each s < n. We have, from s j=1 s−j s recurrence (5), 2k−1 r(k) = r(k) +...+r(k) +r(k) − (cid:88) r(k) . n n−1 n−k+1 n−k n−j k+1 For the inductive hypothesis (k) (k) (k) (k) r = r +...+r +d . n−k n−k−1 n−2k+1 n−k Then, r(k) = r(k) +...+r(k) +d(k) . n n−1 n−k−1 n−k Since d(k) = d(k), the thesis follows. (cid:4) n−k n 9 3.2 The sequences b(k) and z(k) n n (k) We give a recursive relation for b by means of a recursive construction n of the set B (0k,1k). We first observe that B (0k,1k) = {λ}, where λ is the n 0 empty string, and B (0k,1k) is formed by all the binary strings of length j, j with 0 < j < k. Then b(k) = 2j for 0 ≤ j < k. j In order to consider the strings in B (0k,1k) having length n ≥ k, we n denote by B(0)(0k,1k) and B(1)(0k,1k) the two subsets of B (0k,1k) consti- n n n tuted by the strings ending with 0 and ending with 1, respectively. Let |B(0)(0k,1k)| = b(k) and |B(1)(0k,1k)| = b(k), it is easy to realize that n n,0 n n,1 (k) (k) (k) b = b = b /2. n,0 n,1 n The set B(0)(0k,1k) can be generated from the strings in B(1) (0k,1k) n n−j followed by the suffix 0j, with 0 < j < k, so we have k−1 (k) (cid:88) (k) b = b , for n ≥ k. n,0 n−j,1 j=1 Analogously, the set B(1)(0k,1k) can be generated from the strings in n B(0) (0k,1k) followed by the suffix 1j, with 0 < j < k, so we have n−j k−1 (k) (cid:88) (k) b = b , for n ≥ k. n,1 n−j,0 j=1 Therefore, for n ≥ k, k−1 k−1 b(k) = b(k) +b(k) = (cid:88)(cid:16)b(k) +b(k) (cid:17) = (cid:88)b(k) . n n,0 n,1 n−j,1 n−j,0 n−j j=1 j=1 Summarizing:  2n if 0 ≤ n ≤ k−1  b(k) = (6) n  b(k) +b(k) +...+b(k) if n ≥ k. n−1 n−2 n−k+1 (k) In Table 2 we list the first numbers of the recurrence b for same fixed n values of k. Obviously the set B(0)(0k,1k) coincides with Z(k)(0k,1k), hence n n  1 if n = 0  z(k) = (7) n  (k) b / 2 if n ≥ 1. n 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.