A Normal Form for P-Systems

0 downloads 0 Views 152KB Size Report
Abstract. The P-systems have been recently introduced in [4] as a new model for distributed parallel computing. We describe in this paper a normal form for the ...
A Normal Form for P-Systems Ion Petre Turku Centre for Computer Science and Department of Mathematics, University of Turku Lemmink¨aisenkatu 14A, 4-th floor 20520 Turku, Finland E-mail: [email protected]

Abstract The P-systems have been recently introduced in [4] as a new model for distributed parallel computing. We describe in this paper a normal form for the class of non-cooperative P-systems and prove a normalization theorem. By this result, we also prove that the hierarchy of non-cooperative P-systems with respect to depth collapses on the second level.

1

Introduction

A new biologically motivated model for distributed parallel computing has been recently proposed in [4]: the P-systems. Such a system is based on a hierarchically arranged, finite cell-structure. Each cell is delimited by a membrane and can contain several other cells and some objects floating in it. These objects evolve according to some given prioritized evolution rules, can pass through a membrane to go to an adjacent cell, or can dissolve the membrane of their current cell. In the case of this last event, all the objects in the former membrane remain in the immediate superior cell and they will further evolve according to this one’s evolution rules. The rules of the dissolved cell are lost. The objects can evolve in dependence to each other (cooperative systems) or independently (non-cooperative systems). Such a system evolves in parallel: all the cells evolve in the same time and moreover, all the objects inside a cell evolve in parallel. In this way, a computing device is obtained: we start from an initial configuration (a cell-structure, with some initial content in each cell) and we let the system evolve until it halts. If the P-system does not halt at all, we have an unsuccesfull computation. During the evolution of the system, we observe it from outside and we build a string by sequentially arranging the objects in the order they leave the system (the skin cell). When several objects leave the system in the same time, any ordering of them will be accepted. The set of finite words obtained in this way forms a language which is said to be generated by the P-system. We call the family of languages generated by P-systems as the family of P-languages. The Pn -languages are those languages generated by the n-degree P-systems, for all n ≥ 1. A number of variants has already been considered in [4], [1], and [6]: with or without priority relations among the rules of each cell, cooperative or non-cooperative systems, with or without membrane dissolving rules. In this paper we will consider only the family of languages generated by prioritized, non-cooperative P-systems, with membrane dissolving rules, in short: P (P ri, nCat, δ). We consider membrane structures of a very simple form: a skin cell in which there are some elementary cells floating. We will say that this is a normal form membrane structure, and a P-system having such an underlying membrane structure will be called a normal form P-system. Our main 1

result proves that for any P-system, one can construct an equivalent normal form P-system with the same degree. There is a natural question which arises in this framework: how many different membrane structures with n cells can be constructed, for some n ≥ 1? Cf [2], this is the number of oriented trees with n vertices. Denoting it by xn , one can find in [3] that x10 = 719, x15 = 87811, and x20 = 12826228. We prove in this paper that one single type of membrane structure is enough to generate the whole family of P-languages.

2

Definitions and notations

The notions of membrane structure and P-systems are formally defined in [4] and we do not recall them here. We give just few definitions and notations that we will use in the sequel. We say that a cell is elementary at some moment of the evolution if there are no other cells floating in it at that moment. Two cells are adjacent in a P-system if one of them is floating in the other. If the cell mi is floating in the cell mj , then we say that mj is the father of mi and we denote this by mi → mj . The path from a cell mi1 to a cell mij of a P-system is the sequence of cells mi1 , mi2 , . . . , mij , such that mik+1 is the father of mik for all 1 ≤ k ≤ j − 1. We denote this path by mi1 → mi2 → · · · → mij . We will say that the cells mi2 , . . . , mij−1 are intermediate cells between mi1 and mij , and that the cells mi2 , . . . , mij are superiors of mi1 . Definition 1. A membrane structure is said to be in the normal form if it is of depth 2. A P-system is said to be in the normal form if it has an underlying normal form membrane structure. We say that two P-systems are equivalent if they generate the same language. For further notions, variants and results on the computing power of P-systems, we refer to [1], [4], [5], and [6].

3

The normal form

First we prove the normal form theorem announced above. Theorem 1. Any language L ∈ P(Pri,nCat,δ) can be generated by a P-system in the normal form. Proof. Let Π = (Σ, T, ∅, µ, M0 , . . . , Mn−1 , (R0 , ρ0 ), . . . , (Rn−1 , ρn−1 )) be a n-degree P-system generating L. Assume that the skin membrane of Π is labeled by 0 and the other membranes of Π are labeled by numbers from 1 to n−1. We denote by mi the membrane labeled with i, for all 0 ≤ i ≤ n−1. We construct an n-degree P-system Π0 in the normal form,   Π0 = (∆, T, ∅, [ ]10 [ ]20 . . . [ ]n−10 00 , N0 , . . . , Nn−1 , (S0 , η0 ), . . . , (Sn−1 , ηn−1 )) such that L(Π) = L(Π0 ). The construction will be such that each cell i0 of Π0 , with 0 ≤ i ≤ n − 1, is simulating the corresponding cell i of the system Π. For any cells i and j of Π, if the cell i is j-s superior in the membrane structure µ, then we will say that i0 is the former superior of j 0 . We describe in the following the construction of Π0 . Let us consider n copies of Π-s alphabet Σ. We denote these copies by Σi , with 0 ≤ i ≤ n − 1. For all a ∈ Σ, we denote by ai the corresponding object from Σi , for all i, 0 ≤ i ≤ n − 1. 2

Since the model of membrane computing allows an object to travel only between two adjacent membranes, an object going in one step from a membrane i to a membrane j in Π has to travel in Π0 in 2 steps from the membrane i0 to the skin membrane 00 and then to the membrane j 0 . We will actually need one aditional step in Π0 to simulate an evolution step of Π, for reasons which will become clear in the following. Thus, a computing step of Π will be simulated in Π0 in 3 consecutive phases. In one phase, the only applicable rules of Π0 will be the old rules of Π, slightly modified as we shall see below, plus a few other rules. We will call these rules the transformation rules of Π0 . In another phase, there will be applicable in Π0 some traveling rules, which we will introduce in the following. We will also introduce some coordination rules (only in the skin membrane) which will be applicable in the third phase. We can control the set of applicable rules in each phase of any computation of Π0 by considering 3 new symbols z1 , z2 , z3 evolving cyclicly in each cell according to the rules r 1 : z1 → z 2 , r 2 : z2 → z 3 , r 3 : z3 → z 1 . If we initially place one copy of z1 in each cell of Π0 , then each phase will be characterized by the presence of one of these symbols in the cells of Π0 . Thus, by properly setting the priorities between r1 , r2 , r3 and the other rules of the cell i0 , for all 0 ≤ i ≤ n − 1, we will fix the set of applicable rules in each phase of any computation, in all cells of Π0 . Let us consider a cell i of Π, for some 0 ≤ i ≤ n − 1. For every object a ∈ Σ, initially placed in the cell mi , we will place in the cell mi0 of Π0 the object ai ∈ Σi . Our construction will work such that in any moment of a computation, the content of the cell i0 is included in Σi . Consider a rule r ∈ Ri of the cell i, r : A → α. We will put in the cell i0 of Π a corresponding transformation rule r0 : Ai → α0 , where α0 is obtained from α in the following way: i) α0 contains δ if and only if α contains δ. ii) Each (a, here) of α is changed in α0 to (ai ,here). iii) Each (a, out) is kept unchanged if i = 0: the skin membranes 0 and 00 send outside the systems the same objects. For i 6= 0, let us consider the path in the membrane structure µ, from the membrane i up to the skin membrane 0: mi → mi1 → . . . → mik , where ik = 0. The object a of Π, going outside the membrane mi , according to the rule r, will be found in the next step of Π-s computation in a cell mil , 1 ≤ l ≤ k, which is the current father of the cell mi (note that the father of a given cell is a dynamical notion). In α0 , we replace (a, out) by (ai1 , out), signaling the skin membrane 00 that this object has to be directed into the cell i01 , or, if this one has been dissolved, into its closest living former superior, irrespective of who that is at that moment of the computation. To complete the construction in this case, we introduce in the skin membrane 00 of Π0 , the following traveling rules, for all j1 , 0 ≤ j1 ≤ n − 1, and all aj1 ∈ Σj1 : taj1 ,j1 taj1 ,j2 .. .

: aj1 → (aj1 , inj10 ), : aj1 → (aj2 , inj20 ),

taj1 ,jk−1 taj1 ,0

0 : aj1 → (ajk−1 , injk−1 ), : aj1 → (a0 , here),

3

where mj1 → mj2 → . . . → mjk−1 → m0 is the path in µ, from the membrane j1 up to the skin membrane 0. The priority relation between these rules, taj1 ,j1 > taj1 ,j2 > . . . > taj1 ,jk−1 > taj1 ,0 , insures the correct destination of an object aj1 , as announced above: if aj1 is in 00 , then a rule taj1 ,jd is applied in 00 at that moment if and only if the cells m0j1 , . . . , m0jd−1 have all been dissolved in Π0 , but the cell m0jd is still alive in Π0 . It is important to notice here that in this way, we also solve the problem of a membrane’s dissolvation. Consider the case when the membrane m0j is dissolved, for some j ≥ 0. Since all the objects formerly inside it are from the alphabet Σj , the above traveling rules will correctly direct these objects to their new home cell, similarly as in the system Π. iv) If α contains an (a, inj ), then we have 2 cases. If this rule belongs to the skin membrane 0 of Π, then in α0 we put (aj , inj 0 ). Otherwise, we replace it in α0 by (aj , out), and the skin membrane will direct this object into the cell j 0 , using the above traveling rules. In both these cases, the rule r ∈ Ri of Π is applicable only when the cell j is floating in the cell i. In other words, if mj → mk1 → . . . → mkl → mi , l ≥ 0, is the path in µ from the membrane j up to the membrane i, the rule r is applicable only when the membranes k1 , . . . , kl have all been dissolved in Π, but the membrane j is still alive. We want to insure the same applicability conditions for r0 in the cell i0 of Π0 . For this aim, the cell 0 i must have information about the current state of the membranes k10 , . . . , kl0 , and j 0 of Π0 . For each h ∈ {k1 , . . . , kl , j}, we add to the initial content of the membrane h0 the new objects $hi,r , which we will use to restrain the rule r0 of the cell i0 in the case of h0 -s dissolvation. We also add to the initial content of the skin membrane 00 the new objects #hi,r , to be used for the same purpose, as long as the cell h0 is still alive in Π0 . The objects $hi,r , with h0 ∈ {k10 , . . . , kl0 , j 0 } will not evolve in their own membranes. Thus, an object $hi,r will be found in the skin membrane of Π0 only after the cell h0 has been dissolved. In this case, in the coordination phase, the skin membrane will place in the membrane i0 an object $h,r , signaling that the cell h0 has been dissolved. Otherwise, the skin will place in i0 an object #h,r to signal that the cell h0 is still alive. The rules needed in the skin membrane for this purpose are the following coordination rules: dhi,r : $hi,r → ($hi,r , here)($h,r , ini0 ), lhi,r : #hi,r → (#hi,r , here)(#h,r , ini0 ), for all h ∈ {k1 , . . . , kl , j} (if i = 0 we actually have here instead of in0 ), with the priority relation among them dhi,r > lhi,r , for all h. In this way, in each evolution phase of any computation of Π0 , we have in the cell i0 information about the current state of Π0 . Now, for all h ∈ {k1 , . . . , kl , j}, we introduce in the cell i0 the transformation rules dh : $h,r → , lh : #h,r → , where  is the empty word. In order to insure the same applicability conditions for the rule r of the cell i and for the rule r0 of i0 , we set the following priority relations in i0 : lk1 > r0 , . . . , lkl > r0 , dj > r0 . 0 is still alive in Thus, if any of the rules lk1 , . . . , lkl can be applied in i0 (i.e. one of the cells k10 , . . . , km 0 0 0 0 Π ), or dj can be applied in i (i.e. the cell j has been dissolved), then r is not applicable in i0 . The problem is solved: r0 is now applicable in the same conditions as r.

4

There is still one problem to solve in the cell i0 in this case. Before that, we mention that the priority order between the old rules of Π, modified here, remains the same: we have in the cell i0 the priority relation s01 ≤ s02 if and only if in the cell i we have s1 ≤ s2 . We continue the discussion of the case iv) above. In the system Π, if the cell j is not floating in the cell i, then the rule r is not applicable. We managed to impose the same condition on the rule r0 of the cell i0 . Consider now all the rules s1 , . . . , sp , p ≥ 0 of the i-th cell of Π, such that r > s1 , . . . , r > sp . If the cell j is not floating in the cell i, then the rule r is not applicable, but the rules s1 , . . . , sp can be applicable. On the other hand, in Π0 , the corresponding rules s01 , . . . , s0p are themselves dominated by the coordination rules introduced for r0 : lk1 > r0 > s0q , . . . , lkl > r0 > s0q , dj > r0 > s0q , for all 1 ≤ q ≤ p. Thus, in a similar situation as above, when in Π0 one of the cells k10 , . . . , kl0 is alive, or j 0 has been dissolved, the rules s01 , . . . , s0p cannot be applied, as it was happenning in Π. The solution for this problem is to eliminate in Π0 the order relations r0 > s01 , . . . , r0 > s0p and introduce a new transformation rule r00 , with r00 > s01 , . . . , r00 > s0p , such that r00 is applicable if and only if r0 is applicable. In this way, the rules s01 , . . . , s0p will be restricted only by the applicability conditions of r0 , as in Π. 0 have all been dissolved and So, the rule r00 must be applicable if and only if the cells k10 , . . . , km 0 the cell j is still alive and, moreover, there are some objects labeled by A in the cell i0 (we recall that we considered the rule r as being of the form r : A → α). This new evolution rule will be r00 : ∧k1 ,...,kl ;j;A → , where ∧k1 ,...,kl ;j;A is a new object introduced in the previous coordination phase by the skin membrane 00 into the cell i0 , exactly in the conditions mentioned above: when the cells k10 , . . . , kl0 have been dissolved, the cell j 0 is alive and there will be at least one A-object in the cell i0 , in the next evolution step. This is precisely the reason for which we need 3 computing phases in Π0 (otherwise 2 would be enough). We describe in the following what rules we still need to add to Π0 to obtain the correct behaviour. It is convenient to describe just how the skin membrane will introduce a symbol ∧k;j;A into the cell i0 . The general case, of a symbol ∧k1 ,...,kl ;j1 ,...,jp ;A is easy to handle following the same idea. First of all, we introduce in the cell i0 the following traveling rule: A → (A, here)(∃A,i , out), signaling the skin membrane that there will be some A-s in i0 in the next evolution step. We remark that this rule does not erase any A-s from the cell i0 . For the same purpose, we also modify the traveling rules introduced in 00 in the case iii) above, as follows: taj1 ,j1 taj1 ,j2 .. .

: aj1 → (a, inj10 )(∃a,j1 , here), : aj1 → (a, inj20 )(∃a,j2 , here),

taj1 ,jk−1 taj1 ,0

0 : aj1 → (a, injk−1 )(∃a,jk−1 , here), : aj1 → (a, here)(∃a,0 , here).

(1)

(1)

Finally, to correctly produce a symbol ∧k;j;A , we will consider the copies dji,r and lji,r of the rules 5

dji,r , respective lji,r , and set the priorities as shown in the picture: lki;r

dji;r

∃A,i → (∧k;j;A , ini0 )

dki;r

(1)

lji;r

∃A,i → 

(1)

dji;r

lji;r

∃A,i → 

∃A,i → 

where an arrow from a rule x to a rule y means x > y. The result is indeed correct: if the cell k 0 has been dissolved and the cell j 0 is still alive in Π0 , the applicable rules from the above tree are dki,r , lji,r , and ∃A,i → (∧k;j;A , ini0 ). In any other case, the symbols ∃A,i (if there are any) are erased from 00 . We remark that here it is essential that for all 0 ≤ g, h ≤ n − 1 and all r, the rules dgh,r and lgh,r are complementary rules, that is to say, in each coordination phase, exactly one of them is applicable in 00 . In the general case of a symbol ∧k1 ,...,kp ;j1 ,...,jq ;A , one should build a similar priority tree, with p + q levels. We are done now with the construction of Π0 . The system works as follows: it begins the computation by a traveling phase and a coordination phase in which it collects information about the state of its cells. Then, it performs a transformation phase, similar to a computing step of Π. This sequence is then iterated. We already mentioned that the transformation rules of Π0 are equivalent to Π-s rules: the same applicability conditions and the same effects on the objects from Σ. The traveling and the coordination rules do not affect any object from Σ, their role being just to colect informations about the system. From this, it is clear that for any computation of Π, there is a computation of Π0 such that for any object A ∈ Σ, A is in the cell i after t computing steps in Π, if and only if A is in the cell i0 after 3t computing steps in Π0 . It is also clear that the converse holds true as well: any computation of Π0 is simulating a computation of Π. Thus, Π and Π0 are equivalent P-systems: L(Π) = L(Π0 ). As we proved that any P-language can be generated by a P-system in the normal form, we immediately obtain the following consequence: Corollary 2. The hierarchy of non-cooperative P-systems with respect to depth collapses on the second level. Example 1. We consider the P-system drawn in the left part of the below picture. This system works as follows: as long as the cell 1 is alive in the system, it produces a number of a’s which are sent in the skin cell and then outside the system. An equal number of b’s is produced in the cell 2 and sent in the cell 1 and then in the skin cell, where they do not evolve as long as the cell 1 keeps sending a’s (due to the priority relation r1 > r3 ). After the cell 1 has been dissolved, the b’s are sent outside the system and an y is introduced in the cell 2, eventually dissolving this cell and thus, halting the system. So, it is clear that the language generated by this system is { am bn | 0 < m < n }. 6

0

00 y

y0 , #10 , #20

r1 : a → (a, out) r2 : y → y(y, in2 )

r1 > r3

Transformation rules

r3 : b → (b, out)

Traveling rules

1 x

Coordination rules

x → (a, out)(x, here) x → (a, out)δ

10

20

b → (b, out) 2 x x → (b, out)(x, here)

x1 → (a0 , out)(x1 , here)

x2 → (b1 , out)(x2 , here)

y→y

x1 → (a0 , out)δ

y2 → y 2

y→δ

b1 → (b0 , out)

y2 → δ

x1 , $10

x2 , $20

In the right part of the above picture there is an equivalent normal form P-system, constructed as in the proof of the theorem. The rules of the skin cell 00 are: i) The transformation rules: r10 : a0 → (a, out), r20 : y0 → y0 (y2 , in2 ), r30 : b0 → (b, out), d1 : $1 → , l1 : #1 → , d2 : $2 → , l2 : #2 → ,

r10 > r30 , l1 > r20 , d2 > r20 .

ii) The traveling rules: x1 → (x1 , in1 ) b1 → (b1 , in1 ) x2 → (x2 , in2 ) y2 → (y2 , in2 )

> > > >

x1 → x0 , b1 → b0 , x2 → (x1 , in1 ) > x2 → x0 , y2 → (y1 , in1 ) > y2 → y0 .

iii) The coordination rules: $10 → $10 $1 > #10 → #10 #1 , $20 → $20 $2 > #20 → #20 #2 . By a similar argument as above, one can easily check that this system generates indeed the same language. The next theorem generalizes the above result, proving that given an arbitrary membrane structure of degree n ≥ 1, one can construct for any Pn -language L, a P-system based on the given structure, generating the language L. Theorem 3. For any P-language L ∈ Pn (P ri, nCat, δ) and any membrane structure µ of degree n, there is a P-system Π0 with the underlying membrane structure µ, such that L(Π0 ) = L. 7

Proof. Let Π be a n-dgree P-system which ghenerates L. By the previous theorem, it is enough to prove the result in the case of a normal form P-system Π. Let i be the depth of µ. Since in Π, the objects flow only from a cell to the skin or reversely, we must have a similar process in Π0 . We do this as in the proof of the previous theorem: any computing step of Π is simulated in Π0 by i computing steps: one evolution step, followed by i − 1 traveling steps, moving all the traveling objects from the cells to the skin or viceversa. In the same time, the living cells will also send an aknowledgement of their presence in the system to the skin membrane, such that this last one can determine the applicability of its rules in the next evolution step. Technically, the rules of Π0 are built in the same manner as in the previous theorem. The details are left to the reader.

4

Conclusions

The model of a P -system, although very natural and quite simple intuitively, is in this moment rather difficult to work with, for instance because of the lack of tools to produce counterexamples in the theory. The normal form introduced in this paper is clearly easier to analyse and thus, easier to use. The normal form theorem proves that the hierarchy of non-cooperative P -systems with respect to depth, collapses on the second level: any language from P(Pri,nCoo,δ) can be generated by a P -system of depth 2. It is an open problem whether the same is valid also for the families P(nPri,Coo,δ) and P(nPri,nCoo,δ). We believe that at least for the family P(nPri,nCoo,δ), the hierarchy with respect to depth is infinite. Finally, we mention a potential practical importance of our results. We proved that any language L ∈ Pn (Pri,nCoo,δ) can be generated using any membrane structure of degree n. Thus, if we succeed to implement P -systems with a particular underlying membrane structure, then we will immediately be able to implement all the P -systems in this family.

References [1] J. Dassow, Gh. P˘aun, On the power of membrane computing, submitted, 1998 (see also TUCS Technical Report No. 217, November 1998, http://www.tucs.fi). [2] D.E. Knuth, The Art of Computer Programming, vol 1, Fundamental Algorithms, 3rd edition, Addison-Wesley, 1997. [3] The Online Encyclopedia of Integer Sequences, AT&T Integer Research 1999, http://akpublic.research.att.com/∼ njas/sequences/Sbrowse.html. [4] Gh. P˘aun, Computing with membranes, submitted, 1998 (see also TUCS Technical Report No. 208, November 1998, http://www.tucs.fi). [5] Gh. P˘aun, Computing with membranes: An introduction, to appear in Bull of EATCS, 1999. [6] Gh. P˘aun, G. Rozenberg, A. Salomaa, Membrane computing with external output, submitted, 1998 (see also TUCS Technical Report No. 218, November 1998, http://www.tucs.fi).

8