A Bio-Inspired Model of Picture Array Generating P System with Restricted Insertion Rules

In the bio-inspired area of membrane computing, a novel computing model with a generic name of P system was introduced around the year 2000. Among its several variants, string or array language generating P systems involving rewriting rules have been considered. A new picture array model of array generating P system with a restricted type of picture insertion rules and picture array objects in its regions, is introduced here. The generative power of such a system is investigated by comparing with the generative power of certain related picture array grammar models introduced and studied in two-dimensional picture language theory. It is shown that this new model of array P system can generate picture array languages which cannot be generated by many other array grammar models. The theoretical model developed is for handling the application problem of generation of patterns encoded as picture arrays over a finite set of symbols. As an application, certain floor-design patterns are generated using such an array P system.

The operation of insertion on words [36][37][38][39] has been studied in string language theory in the context of DNA computing [40]. Fujioka [41] considered this operation in two-dimensional picture arrays and introduced a picture array generating model. This model has a feature which is analogous to the pure 2D context-free grammar [42] where the operation is rewriting in parallel all symbols in a column or a row of a (rectangular) picture array by strings of equal length while in [41], insertion (instead of rewriting ) of strings of equal length is done in parallel between columns or between rows.
Here we consider a restricted type of insertion rules with the "contexts" of length at most one, in the regions of a cell-like P system with the objects in the regions being rectangular picture arrays. The main objective of this study is to develop a new theoretical model of an array P system based on the bio-inspired computing model in the area of membrane computing, endowed with the capability to handle the problem of generation of two-dimensional patterns encoded as picture arrays. We compare the generative power of the resulting array P system model introduced here with other well-investigated picture array generating models. We also exhibit an application to generation of floor-design patterns, called "kolam" patterns [43]. A preliminary version of this paper was presented in the conference ACMC 2018 [44].
In Section 2, needed notions and notations relevant to the study undertaken are briefly described, with Section 2.1 providing the basic notions and Section 2.2 recalling picture-insertion system in a restricted form. In Section 3, the new model of array P system with restricted picture insertion rules (APRPIS) is introduced. In Section 4, APRPIS with one and two membranes are compared. In Section 5, comparison with Pure 2D context-free grammars is done while in Section 6, comparison with certain standard array generating models is carried out. Section 7 provides an application of the new model to generation of floor-designs. In the final Section 8, concluding remarks are given.

Preliminaries
For notions related to formal language theory, the reader can refer to [45] and to [42,46,47] for two-dimensional array grammars and languages. For P systems and array P systems, we refer to [4,34].

Basic Notions
A finite set V of symbols is called an alphabet. A word or a string α = a 1 a 2 . . . a m , a i ∈ V, 1 ≤ i ≤ m, (m ≥ 1) of length m over an alphabet V is a finite sequence of symbols belonging to V. The length of a word α is denoted by |α|. The set of all words over V, including the empty word λ with no symbols, is denoted by V * . For any word w = a 1 a 2 . . . a n , t w is the vertical word with the word w written vertically. For example, if α = bab over the alphabet {a, b}, then t α is b a b . If w is a single symbol of the alphabet, then we write t w as w itself. A rectangular p × q array (also called picture array) X over an alphabet V is of the form The number of rows of X and the number of columns of X are respectively denoted by |X| r and |X| c . The set of all rectangular arrays over V is denoted by V * * , which includes the empty array λ.
The column catenation X • Y of two arrays X and Y with the same number of rows is formed by juxtaposing Y to the right of X. The row catenation X Y of two arrays X and Y with the same number of columns is formed by juxtaposing Y below X. For example, if

Picture-Insertion System
A picture-insertion system has been considered in [41] with insertion in a picture array being done between columns or between rows, extending the notion of insertion in words [40]. We recall the definition of this system [41] with a special case, namely, with "contexts" of length one in the rules and call this system as a restricted picture-insertion system.
where c i , called a column insertion table, is a finite set of column insertion rules with alphabetic contexts of the form (a, α, b), a, b ∈ Σ ∪ {λ}, α ∈ Σ * such that for any two rules (a 1 , α, b 1 ), (a 2 , β, b 2 ) in c i , we have |α| = |β| and either both the left contexts a 1 and a 2 are in Σ (likewise the right contexts b 1 and b 2 are in Σ) or both are λ ; (iii) I r = {r j | 1 ≤ j ≤ n}, (n ≥ 1) where r j , called a row insertion table, is a finite set of row insertion rules with alphabetic contexts of the form (d, t γ, e), d, e ∈ Σ ∪ {λ}, γ ∈ Σ * such that for any two rules (d 1 , t γ, e 1 ), (d 2 , t δ, e 2 ) in r j , we have |γ| = |δ| and either both the up contexts d 1 and d 2 are in Σ (likewise the down contexts e 1 and e 2 are in Σ) or both are λ; (iv) A ⊆ Σ * * − {λ} is a finite set of axiom arrays.
For picture arrays P, Q ∈ Σ * * , a one-step derivation in the RPIS Γ, denoted by P ⇒ Q, yields Q from P whenever either (i) or (ii) holds: (i) if t a 1 · · · a m and t b 1 · · · b m are two adjacent columns, namely, columns j and j + 1 for some j, 1 ≤ j ≤ n − 1, in the picture array P of size m × n, and if (a i , α i , b i ), 1 ≤ i ≤ m are column insertion rules in a column insertion table in I c , then the rules can be applied in parallel by inserting α i in the ith row between a i and b i for all i, 1 ≤ i ≤ m or (ii) if d 1 · · · d n and e 1 · · · e n are two adjacent rows, namely, rows k and k + 1 for some k, 1 ≤ k ≤ m − 1, in the picture array P of size m × n, and if (d i , t β i , e i ), 1 ≤ i ≤ n are row insertion rules in a row insertion table in I r , then the rules can be applied in parallel by inserting t β i in the ith column between e i and d i for 1 ≤ i ≤ n. Likewise insertions to the immediate left or right (respy. immediate up or down) of a column (respy. row) in the picture array P can be defined by requiring the corresponding left or right or up or down contexts in the rules used, to be λ.
The picture language L(Γ) generated by Γ consists of picture arrays derived in one or more finite number of derivation steps starting with an axiom array in A. The family of picture languages generated by RPIS is denoted by RPIL. Γ 1 generates a picture language L 1 consisting of picture arrays X • Y with X over a and Y over b and |X| r = |Y| r , |X| c = |Y| c . A member of L 1 is shown in Figure 1. Starting with the axiom array in A, in any step of a derivation, the application of the column insertion rule of c 1 inserts ab in every row between a and b while the application of the row insertion rule of r 1 inserts in every column and just below a row, the symbol a below a and the symbol b below b. In other words, for example, a derivation in which rules of c 1 and then rules of r 1 are applied, is shown below:

Array P System with Restricted Picture Insertion Rules
Linking the two areas, namely, membrane computing and picture languages, an array P system with array-rewriting rules, was introduced in [33], which is one of the earliest models in this topic. This model motivated extensive research with several variants of array P systems being introduced based on different considerations (See, for example, [35] and references therein). We now introduce a new kind of array P system with picture arrays as objects and with restricted picture insertion rules in the regions.

Definition 2. An array P System with restricted picture insertion rules
where: Σ is the alphabet, µ is a membrane structure with m membranes labelled in a one-to-one way with 1, 2, · · · , m; F i , 1 ≤ i ≤ m, is a finite set (can be empty) of axiom picture arrays over Σ in the ith region of µ; R i , 1 ≤ i ≤ m is a finite set of column or row insertion tables as in a RPIS in the ith region of µ; each of the tables has an attached target here, out, in. (as usual, here is omitted and is understood). i o is the label of an elementary membrane of µ (the output membrane).
A computation in APRPIS is defined in the same way as in an array-rewriting P system [34,35] with the successful computations being the halting ones: each array, from each region of Π, which can be obtained by applying the restricted picture insertion rules to the arrays associated with that region, should be obtained but rules of only one table is applied; the array obtained in a region is placed in the region indicated by the target associated with the table of rules used; the target here indicates that the array remains in the same region, out indicates that the array is sent to the immediate outer region except for the outermost skin membrane in which case the array sent out is "lost" in the environment; and in indicates that the array is sent to the immediately inner membrane, nondeterministically chosen (but if no innner membrane exists, then the table of rules with the target indication in cannot be used). A computation is successful only if it stops and a configuration is reached where no table of rules can be applied to the existing arrays. The result of a halting computation consists of the arrays placed in the output membrane with label i o in the halting configuration. The set of all such arrays computed or generated by the system Π is denoted by AL(Π). The family of all array languages AL(Π) generated by systems Π as above, with at most m membranes, is denoted by AP m (RPIS).
We illustrate with an example.
consists of the column insertion tables (c 1 , in), (c 2 , in) and R 2 consists of row insertion In a computation in Π 1 , since only the region 1 has an axiom picture array a b a b , application of the rule of the table c 1 will insert ab between a and b in every row and the resulting array is sent to region 2 due to target indication in. Application of the rules in r in region 2 inserts a row below one of the rows with a below a and b below b and the array is sent back to region 1 due to target indication out. The process can repeat. If in region 1, the rule of the table c 2 is applied then e is inserted between a and b in every row resulting in an array of the form and the array is sent to the output region 2. The computation halts as no other rule could be applied. Note that in the rules in r there is no rule that allows insertion below e and hence the rules of the table r can no longer be applied. The arrays generated are of the form is an array over a, M 3 is an array over b and M 2 is an array with only one column of e s. Also, In otherwords, the number of rows of the array generated equals the number of columns of M 1 which equals the number of columns of M 3 . One such array is shown in Figure 2.

A Hierarchy between One Membrane and Two Membranes
We now compare the families AP 1 (RPIS) and AP 2 (RPIS) and establish that AP 1 (RPIS) is properly included in AP 2 (RPIS). It remains to explore whether the hierarchy collapses or not for higher number of membranes.
Proof. In a RPIS as well as APRPIS with one membrane, the rules are only the RPIS rules and so it is clear that RPIL = AP 1 (RPIS). Also by definition, the inclusion AP 1 (RPIS) ⊆ AP 2 (RPIS) follows. The proper inclusion follows from Example 2 on noting that in any picture array M generated, the number of columns = 2× the number of rows +1. If there is only one membrane, there is no way to control application of the rules of the column and row tables as all the tables of rules are in the same region.

Comparison with Pure 2D Context-Free Grammars
We now compare the generative power of APRPIS with certain similar picture generating models. The insertion rules considered both in RPIS and APRPIS are restricted forms of the insertion rules considered in the picture insertion system defining the class I NPA [41]. Yet we show that there are picture array languages generated by APRPIS with two membranes that are not in the class I NPA. Also, in [42], a picture array generating model, called pure 2D context-free grammar (P2DCFG), is proposed and the generative power of this model is investigated. In this model, all symbols in a column or in a row of a m × n picture array are rewritten by pure context-free rules [42] of the form a → α with α in all the rules in a table having the same length. The family of languages generated by P2DCFG is denoted by P2DCFL. Two variants of P2DCFG, called (l/u)P2DCFG and (r/d)P2DCFG which are incomparable with P2DCFG have also been considered [48,49]. In a (l/u)P2DCFG the symbols in the leftmost column or the uppermost row only are rewritten while in a (r/d)P2DCFG the symbols in the rightmost column or the lowermost row are rewritten. We show that there are picture array languages that can be generated by APRPIS with two membranes but cannot be in P2DCFL, (l/u)P2DCFL and (r/d)P2DCFL.
Proof. Consider the picture array language L 2 consisting of m × (3n + 2) arrays (m ≥ 2, n ≥ 1), such that an array in L 2 is of the form The region 1 alone has an axiom picture array. So a computation in Π 2 can start in this region with the applicable tables of rules. If the rule of column insertion table c 1 is applied then ab will be inserted in every row between two adjacent columns of a s and b s and the array is sent to region 2. If in this region the rule of column insertion table c 3 is applied then d will be inserted in every row between two adjacent columns of b s and d s and the array is sent back to region 1. The process can repeat. At any time, the rule of the row insertion table r can be applied, thus inserting in the picture array a row of the form a · · · ab · · · bd · · · d. If at any time, instead of c 3 , the rule of the column insertion table c 2 (respy. c 4 ) is applied in region 2, then a column of e s will be inserted between two adjacent columns of a s and b s (respy. columns of b s and d s ). A correct sequence of application of the rules is to apply now in region 2, the rule of the column table c 2 followed by c 4 or c 4 followed by c 2 , thus generating a picture array of the form shown in Figure 3. Region 2 is the output region and arrays collected here form the picture array language generated which is L 2 .

Comparison with Certain Standard 2D Grammar Models
A well-known class of two-dimensional picture array languages, called the family of context-sensitive matrix languages (CSML), was introduced by Siromoney et al. [50]. The corresponding class of grammars, known as CSMG involves two phases of generation with the first phase generating a string s over intermediate symbols and in the second phase all the intermediate symbols in s are rewritten in parallel by regular nonterminal rules of the form A → aB, or together terminated by regular terminal rules of the form A → a, (A, B are nonterminals and a is a terminal symbol), thus generating the columns of the picture array. The words in the first phase form a context-sensitive language. An extension, called TCSML of the family CSML was introduced in [51] by having in a CSMG, an additional feature of tables of nonterminal rules or tables of terminal rules in the second phase. It was shown in [51] that CSML ⊂ TCSML. We show here that there are picture array languages that cannot be in TCSML but can be generated by APRPIS with two membranes.  Figure 4. The language L 3 cannot belong to the family TCSML. In fact in a grammar generating a picture array in a language in TCSML, the number of rows above and below a distinct row of a generated array, cannot be maintained to be equal as the application of the tables of rules cannot be controlled.
The language L 3 is generated by the APRPIS Π 3 with two membranes where Starting with the axiom picture array in region 1, a computation in Π 3 can start in this region with the applicable tables of rules. If the rules of column insertion table c 1 are applied then ab will be inserted in every row between the two symbols a and b in two adjacent columns while ba will be inserted in every row between the two symbols b and a in the same two adjacent columns, thus adding two columns to the picture array. The array generated is sent to region 2. If in this region the rules of row insertion table r 3 is applied then ab will be inserted in all columns between the symbols a and b in two adjacent rows while ba will be inserted between the symbols b and a in the same two adjacent rows, thus adding two rows to the picture array and the array is sent back to region 1. The process can repeat. If at any time, the rules of the column insertion table c 2 are applied in region 1, then a column of e s will be inserted between the two adjacent columns t a · · · ab · · · b and t b · · · ba · · · a and the array is sent to region 2. A correct sequence of application of the tables of rules is to apply now in region 2, the rules of the row table r 4 , thus generating a picture array of the form shown in Figure 4. Region 2 is the output region and arrays collected here form the picture array language generated which is L 3 .
a · · · a e b · · · b e · · · e e e · · · e b · · · b e a · · · a . . . Head [52] introduced splicing systems while proposing a theoretical model of DNA recombination. Berstel et al. [53] introduced a variant of splicing system, known as flat splicing system and noted ([53] P4) that the flat splicing system involving the operation of flat splicing on words and the insertion system [40] involving the operation of insertion on words, have similarity but the systems are incomparable. Extending the operation of flat splicing to picture arrays, a picture array generating model, called array flat splicing system (AFS), was introduced and investigated in [54]. Here we show that picture array languages that cannot be generated by any AFS can be generated by APRPIS with two membranes. The family of picture array languages generated by AFS is denoted by L(AFS).  Figure 5. The language L 4 does not belong to the family L(AFS) [54].
The language L 4 is generated by the APRPIS Π 4 with two membranes where We note that the rule of the column insertion table c 1 inserts a column of a s but the array remains in the region 1 itself. The rule of the column insertion table c 2 has the same effect but the array is sent to the output region 2. The rule of the row insertion table r inserts a row of the form xa · · · ay while an array is generated.
x a a a a y  x a a a a y  x a a a a y x a a a a y A class of array grammars called parallel contextual array grammars was considered in [55]. Several variants were introduced and their properties established. External parallel contextual array grammar is one such variant generating rectangular picture arrays and the family of picture array languages generated by this kind of array grammars is denoted by EPCA. Here we show that there are picture array languages not in EPCA, which can be generated by (APRPIS).
Proof. Consider the picture array language L 5 = L 5 ∪ L 5 . L 5 consists of 3 × (2n + 1) arrays, (n ≥ 0), such that an array M in L 5 is over {a} and is of the form as shown in Figure 6. L 5 consists of 3 × (2n + 3) arrays, (n ≥ 0), such that an array M in L 5 is over {a, b} and is of the form as shown in while all other symbols are a.
The language L 5 has been proved to be not in the family EPCA ([55] Lemma 4.5).
But the language L 5 is generated by the APRPIS Π 5 with two membranes where  a a a a b  b a a a a  a a a a b , a a a a a a a a a a a a a a a but the arrays remain in the same region 1 as the column table c 1 has target here associated with it. The process can repeat. If the rule of the table c 2 is applied to any of the arrays generated in an earlier step (including the axiom arrays), then again two columns of a s are inserted into the array but the generated array is sent to output region 2. Since there are no rules in region 2, these arrays cannot evolve further and are collected in the language generated by Π 5 . The language generated is L 5 .
a a a a a a a a a a a a a a a  a a a a a a b  b a a a a a a  a a a a a a b   Figure 7. A picture array in L 5 .

An Application of the Model to "Kolam" Pattern Generation
A "kolam" pattern [43] is a visually pleasing floor design, more common in South India, drawn with curly lines around points arranged in a particular pattern, resulting in the intended "kolam" drawing. In [43] "kolam" patterns were considered as picture arrays in the two-dimensional plane with the labels of the cells of the picture array representing primitive "kolam" patterns [56]. In fact array grammars developed in [43] were used to generate the picture arrays and the labels were replaced by the corresponding primitive patterns, thus yielding the kolam pattern composed of these primitive patterns. Here we illustrate by constructing a APRPIS generating picture arrays representing a particular set of "kolam patterns", one member of which is shown in Figure 8. The labels of the arrays stand for the primitive kolam patterns defining the "kolam". An array representing this kind of a kolam is shown in Figure 9.
Let L k be the picture language consisting of (m + 2) × (2n + 3), m ≥ 1, n ≥ 1 picture arrays p such that p(i, 1) = p(i, n + 2) = p(i, 2n + 3) = b, for i ∈ {1, m + 2}, p(1, j) = d 1 for 2 ≤ j ≤ n + 1; n + 3 ≤ j ≤ 2n + 2, p(n + 2, j) = d 2 for 2 ≤ j ≤ n + 1; n + 3 ≤ j ≤ 2n + 2, p(i, 1) = d 3 , for 2 ≤ i ≤ n + 1, p(i, 2n + 3) = d 4 , for 2 ≤ j ≤ n + 1, p(i, n + 2) = e, for 2 ≤ i ≤ n + 1 and all other p(i, j) = d. Here d 1 , d 2 , d 3 , d 4 , d, e stand for the "kolam" primitive patterns as in Figure 10 and b stands for blank.   The picture language L k is generated by the APRPIS with alphabet. {d 1 , d 2 , d 3 , d 4 , d, e, b}, in region 1 and no axiom array in regions 2 and 3, with 3 as the output region. The sets R 1 , R 2 , R 3 are the sets of tables of insertion rules in regions 1,2 and 3 respectively, where R 1 contains a column insertion table (c 1 , in) and a row insertion table (r 1 , here), R 2 contains two column insertion tables (c 2 , out) and (c 3 , in). Here In a computation, the rules of table c 1 insert a column of the form t d 1 d · · · dd 2 to the left of the middle column of e s while the rules of table c 2 insert a similar column to the right of the middle column of e s. The generated array is sent to region 2 from region 1 on applying c 1 while it is sent from region 2 to region 1 on applying c 2 . The process can repeat adding equal number of columns to the left and right of the middle column. The application of the rules of the table r 1 inserts below the first row, a row of symbols d 3 d · · · ded · · · dd 4 as many times as needed and the generated array remains in region 1. When the rules of the table c 3 are applied in region 2, it has the same effect as applying c 2 but the insertion is to the left of the last column and the array is sent to the output region 3, with the computation halting. The generated arrays are the picture arrays of L k and no other array is generated. On replacing the labels of the squares in a generated picture array by the corresponding primitive kolam patterns shown in Figure 10, we obtain the "kolam" itself. One such generated "kolam" is shown in Figure 8. It is interesting to note that the "kolam" pattern in Figure 8 has a mathematically pleasing feature of symmetrical subpatterns on the left and right of the middle line made of the primitive pattern e shown in Figure 10.

Concluding Remarks
In the framework of membrane computing, a new picture array generating model, called array P System with restricted picture insertion rules (APRIS) has been introduced. The generative power of this model is exhibited by comparing it with many standard families of picture languages. The main theoretical contribution is that the new model APRIS can generate picture array languages which cannot be generated by the other picture array grammar models considered here. It will be of interest to compare with other families of picture languages not considered here such as the family of picture languages generated by internal parallel contextual array grammars [55]. As an application of this new theoretical model, certain floor-designs, called "kolam" patterns are generated, thereby showing that the model can handle the problem of generation of patterns encoded as picture arrays over a finite set of symbols.
Author Contributions: Conceptualization of this research was done by K.G.S.; Investigation of theoretical results established and applications were done by G.S. and N.G.D.; Writing and preparation of the draft version were done by K.G.S. and G.S.; Writing and editing and providing suggestions for improving the contents were done by G.Z. and A.K.N. Final submission version was prepared with the involvement of all the authors. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.