Research Article | Open Access
Jing Luan, Zhong Yao, "Research on P System with Chain Structure and Application and Simulation in Arithmetic Operation", Discrete Dynamics in Nature and Society, vol. 2015, Article ID 123960, 11 pages, 2015. https://doi.org/10.1155/2015/123960
Research on P System with Chain Structure and Application and Simulation in Arithmetic Operation
Considering the advantages of distribution and maximum parallelism of membrane computing and availability of discrete Morse theory to deal with discrete structure, in this paper, combining discrete Morse theory and membrane computing, a novel membrane structure—P system with chain structure, is proposed, which is constructed on the basis of discrete gradient vector path of the discrete Morse theory. At the theoretical level, due to its unique chain structure, compared with traditional P system, its structure, object, and rule are described in details. In the practical aspect, a specific application example, P chain system for arithmetic operation, is presented to demonstrate the superiority, computational efficiency, and ability of P system with chain structure. Moreover, a simulation system of arithmetic operations based on P chain system is designed, giving a visual display of the implementation of P chain system for arithmetic operation, and verifying the feasibility and effectiveness of P chain system.
Membrane computing is a new computational model proposed by Romanian scientist Păun in 1998, due to being introduced by Păun at the first time, it is also called P system . Membrane computing abstracts cell as the computational unit, permitting every computational unit to calculate dependently and the whole system to operate in the way of maximum parallelism, whose computational efficiency has been improved obviously [2–5]. It has been proved that the computation capacity of membrane computing is equivalent with that of turing machines, so due to its strong parallel computing power it has been the highlight of the recent study.
Morse theory  is a useful tool in differential topology, applied for investigating the topology of smooth manifolds, particular for computer graphics, having been the focus of the research. Forman  extended it to the discrete aspect, which provides an effective tool to describe the topology of discrete object, such as simplex and simplicial complex and plays a vital role in pure mathematics and applied mathematics. Concepts in discrete Morse theory, such as simplex , discrete gradient vector path and so on, provide a useful tool to research the topology of discrete structure.
Generally, the structure of P system is abstracted as the nested structure of the cell wall and organelle, so it is a kind of nested and hierarchical structure. Of course, there are many other structures, such as reticular formation of neural network. Up to now, there are three main P systems, cell-like P system, tissue-like P system and neural P system , and the study of cell-like P system has been well-developed. In literature , Păun pointed out that the focus of the next stage of membrane computing study was the nonhierarchical arrangement of membranes. In literature , the author has proposed a P system based on simplicial complexes, which is an innovative try in the aspect of nonhierarchical membrane structure. Inspired from this, in this paper, a P system with chain structure is introduced, which combines membrane computing with discrete Morse theory and constructs a P system based on the discrete gradient vector path, forming a new kind of nonhierarchical membrane structure—P chain system. To try to arrange a novel nonhierarchical structure of P system not only makes a contribution to knowledge but also makes a clear methodological contribution.
The organization of the reminder in this paper is described as follows: Section 2 is the part of theoretical discussion, reviewing theories and properties of discrete Morse theory and P system, which are the foundation of P system with chain structure, and then giving the specific description of structure, object, and rule of P chain system. In Section 3, a practical application of P chain system, P chain system for arithmetic operation, is proposed, displaying four kinds of P chain systems. In Section 4, by a computer simulation, the specific implementation of P chain system for arithmetic operation is demonstrated, showing the computational efficiency and power of P system with chain structure. In Section 5, the summary and prospect are included.
2. P System with Chain Structure
2.1. Foundation of P System with Chain Structure
2.1.1. Discrete Morse Theory
Definition 1 (-simplex). Assuming that are points which cover the widest position in -dimensional Euclidean space and , that is to say, vectors , are linearly independent relationship with each other, then defining , written as , and real number satisfying two factors: (1) ; (2) , the set of in is called -simplex, marked as , while are called vertices of the simplex. A simplex is uniquely denoted by its vertices; therefore it can be expressed as  or simply.
Definition 2 (simplex with orientation). For a -simplex , there are permutations of different sequences for its vertices ; when , there are two kinds of permutations; any two permutations of the same kind differ in even commutations, while any two permutations in different group differ in odd commutations. These two kinds are called two orientations of . The simplex which has been given an orientation is called simplex with orientation, one denoted as and the other as .
Definition 3 (-chain). Suppose a fundamental constituent of -complex , for an integer , there is , and a linear combination with integer coefficient is called -chain of .
Definition 4 (discrete gradient vector field). For the gradient vector field on a -complex , it is a series of ordered pair sets denoted as and subjected to (1) , (2) each simplex of belongs to one pair in at most. Specifically, a gradient vector field is called discrete gradient vector field if and only if there is no nontrivial closed -path on it, which is an alternating sequence of simplexes , where and .
2.1.2. P System Theory
Membrane computing is a novel computational model abstracted from biochemical reactions in living cells, whose merit is internal maximum parallelism. The essential components of P system are membrane structure, objects, and rules. The formalization definition of P system is shown as follows:
Here is the alphabet, representing the object; is the output alphabet and ; is the catalyst and ; is the set of membranes; is the object multisets, is the membrane label; is the set of evolutionary rules, some rules are applied to reflect the chemical reactions, such as rewriting rules, and others are employed to simulate biological processes, such as communication rules, and is the priority set of these rules.
2.2. Description of the P Chain System
2.2.1. Definitions and Properties of P Chain System
Definition 5 (P system with chain structure). Generalized P system with chain structure is written as , where is integer and represents the number of the membranes. Additionally, if , represents positive generalized P system with chain structure, especially if , denotes positive standard P chain system. Moreover, if , represents negative generalized P chain system, particularly if , denotes negative standard P chain system. Furthermore, if or , represents multiply generalized P chain system, especially if or , denotes multiply standard P chain system.
Generally, what we call P system with chain structure is referred to the standard P chain system. Here is an example for the above definition. There is a complex in Figure 1(a), and 0-simplex are these vertices , , , , , , , , 1-simplex are these segments , , , , , 2-simplex are these surfaces , 3-simplex are these bodies , and so on. There is a discrete gradient vector path on the 3-complex, composed by and , so there are 0-chain whose units come from and 1-chain whose units belong to . And then membranes from 0-chain or from 1-chain can compose a P system with chain structure. is an example of positive standard P chain system. can be called multiply generalized P chain system shown in Figure 1(b), where two-way arrow represents the repeated appearance of membrane, figure denotes the number of repeated appearance of its front membrane, that is to say, appears 5 times and 3 times, usually 1 is omitted.
(b) chain system based on discrete gradient vector path
Property 1 (oriented property of P chain system). There are three orientations of P chain system due to the orientation of simplex. What we entitle as P chain system with the same direction is that all the membranes are the same orientation, specifically in order to determine the direction of the P chain system, we need to predefine the orientation of complex, that is to say, if we stipulate the positive surface as positive, all the membranes from positive simplex of form P chain system with positive orientation, marked by “+”, its membrane called positive membrane. On the contrary, all the membranes from the negative simplex of constitute the P chain system with negative orientation, marked by “−”, corresponding membrane called negative membrane. Moreover, if there are membranes from positive simplex or negative simplex at the same time in a P chain system, it is called P chain system with multiply orientation, marked by “,” that is to say, in the P chain system with multiply orientation there are both positive membranes and negative membranes.
Take the P chain system in Figure 1 for example. If we define clocklike orientation as the positive direction, P chain system is positive one, and P chain system is with negative orientation, while P chain system is the example of multiply orientation.
Property 2 (additive property of P chain system). Supposing that and are any two -chain, their addition is also a -chain. For the addition, all the -chain of complex are a free Abelian group, which is called -chain group of .
Property 3 (precursory and subsequent relationships between adjacent membranes in P chain system). Because P chain system is based on a discrete gradient vector path, the order of membranes is determined; that is, for a given P system with chain structure, the relationship between adjacent membranes is precursor or subsequent. For a P chain system , where is integer and , except the first membrane, usually the input membrane, for each membrane where , its ahead membrane is called its precursor; the relationship between and is entitled as precursory relationship. Moreover, except for the last membrane, usually the output membrane, for arbitrary membrane , where , its back membrane is called its subsequence; the relationship between and is entitled as subsequent relationship.
The algorithm for constructing the P system with chain structure is shown in Algorithm 1.
2.2.2. Description of Structure, Object, and Rule of P Chain System
For the structure of P chain system, we know that it is nonhierarchical, specifically if it is a chain structure based on discrete gradient vector path, while for the object, it is similar with the former P system, which is denoted by multisets, meaning that is used to represent objects of each membrane. But considering the oriented property of P chain system, the membrane is divided into positive and negative one, so objects in membrane with different orientations are different too; for example, supporting that object in positive membrane is marked as , then object in negative membrane is marked as correspondingly. and are antimatter, meaning that they cannot coexist; when they encounter each other, they will counteract immediately. This is similar with positive and negative spikes in spiking neural P system, where rule makes their coexistence impossible.
Based on the rules of former P system, combining the particularities of P system with chain structure, there are three main rules of P chain system: rewriting rules, communication rules, and forgetting rules.
Rewriting rule is with the form of , where and , from the alphabet , are the objects which represent the multisets, and this rule can be used in membrane when and only when the object set in satisfies . Rewriting rules are used to control the type and number of objects in membrane. Here are some target indications used to manage the movement of objects. They include , where “here” indicates that object remains in the membrane, “out” denotes that object leaves the membrane into its subsequence, and “in” shows that object is sent out to its precursor. So rewriting rule with target indication is formed as , where is a string representing multisets of objects from a given set , and is a string over . Usually they are formed as , where is the object from and tar is here (usually omitted) or in or out. For example, P chain system ; there are object and rule in membrane ; the result of the execution of the rule is to produce , where and will be sent into subsequence and and will be sent into precursor , eventually remaining in membrane .
Communication rules are used to manage the communication across the membranes, including symport rules and antiport rules. Here another target indication is introduced, where “pre” indicates that which move to the precursor of the membrane and “sub” denotes that which move to its subsequence. So in communication rules, target indication is shown in pair, formed as , where and and where can be omitted, meaning that objects will be sent into the precursor or subsequence randomly. In a P chain system where the structure is determined, defining that the membrane where rule resides is , its precursor is , and its subsequence is . Symport rules, formed as or or , express that object from membrane or membrane is sent into membrane , “pre” or “sub” specifying the source of object . Also there is the form of or or , which means that object from membrane is sent out into membrane or membrane randomly or determined by the target “pre” or “sub”. Antiport rules is formed as or , where means that object from membrane is sent out into membrane or membrane randomly, at the same time, object from the membrane or membrane is sent into membrane , while rule elaborates the specific precursor and subsequence. In fact, the target indication can be simplified as , for example, symport rule in membrane can be expressed as , in the same way, antiport rule can be shown as , which means that object from precursory membrane is sent into membrane , at the same time object from membrane is sent out into subsequent membrane .
Forgetting rule is defined as the form of , where is object over alphabet which is used to represent multisets, and is null. The function of forgetting rule is to disappear some certain objects in membrane. A typical example of forgetting rule is objects which are antimatter in membranes with different orientation, when they encounter with each other, they will counteract immediately, resulting from the execution of rule . In most situations, forgetting rule does not appear explicitly, but is defaulted to execute with the highest priority. Note that when execute this rule, if there are object or in membrane where the rule resides, its objects or will be used at first, if there is no object or , supporting that there are enough object or in environment can be used to counteract the antimatter.
2.3. Formalization Definition of P Chain System
The formalization definition of standard P system with chain structure is described as followed: (1)is the alphabet, and the element from is called object;(2) is output alphabet, and ;(3) is catalyst ; the element of is unchanged during the evolutionary process of system; that is to say, the char of does not disappear and there is no new char generated, but its participation is necessary for some certain rules to execute;(4) is the set of membrane structures, each membrane and its enclosed area are expressed as label set , ;(5) denote that there are membranes with chain structure , and membrane is represented as , , where① denotes the number of objects of membrane at the beginning of calculation;② shows the limited set of rules in membrane , there are three main forms.(i)Rewriting rules are showed as , where from the alphabet represents the multisets; is the string over set , written as , where is the object from and tar is here (usually omitted), out or in.(ii)Communication Rules include symport rules and antiport rules. Symport rules are formed as , and antiport rules are showed as , where are the objects of alphabet representing the multisets, and , , is used to control the direction of object in or out of the membrane, and explains the object will be sent into which membrane.(iii)Forgetting Rules are formed as , where is the object over representing the multisets, and represents null. The execution of forgetting rules makes the number of objects in membrane less.(6) is used to show the relationship among membranes in P chain system, for each , there is ;(7) denote the input and output membranes.
3. P Chain System for Arithmetic Operation
The calculating power of P system has been concerned and researched generally, and previous study has proved that NP-hard problem can be resolved by P system in polynomial time . So there are crucial theoretical value and heightened practical significance if we can take advantage of the maximum parallelism of P system to improve computational efficiency for a series of calculation problems, such as arithmetic operation. The fundamental arithmetic operation includes addition, subtraction, multiplication, and division, which is the base of other complex operations. We try to achieve arithmetic operation with P chain system in order to explore more complex operation fulfilled by P chain system. Literature  has proved the possibility to fulfill arithmetic operation by P system. Based on this, P chain system for arithmetic operation is proposed here; compared with the former method, there are some improvements of both time performance and space performance.
When designing the P chain system for arithmetic, standard P system with chain structure is chosen; that is to say, each membrane in P chain system appears only once. Moreover, we suppose that there are enough objects in environment which can be used for the execution of certain rules. Note that the P chain system for arithmetic operation designed now can only achieve the arithmetic operation between any two natural numbers, and the result of the calculation is shown as the number of object in output membrane.
3.1. P Chain System for Addition
In order to fulfill addition by P chain system, we select P system with single direction; that is to say, there is only membrane with positive orientation or negative orientation. Here is the example of P chain system with positive orientation to carry out the addition operation of P chain system. P system with chain structure for addition is designed as Figure 2, and its formalization expression is described as follows: +: show that it is a P chain system with positive orientation; ; , ; , ; , ; , , here output membrane does not appear in Figure 2 and is represented by alphabet .
As shown in Figure 2, there are two membranes with positive orientation, where and represent two natural numbers to add, and and are the objects of the P chain system, using the number change of object and to achieve the addition between any two natural numbers, here the number of object are used to represent the calculating result. The specific process of P system with chain structure to fulfill addition is stated as followed. First, due to that there are operable rules in both membrane and , in membrane , rule is executed and there will generate an object sent into membrane , at the same time, rule in membrane is performed too and produces an object sent into output membrane. Reactions in membrane and are done at the same time in the mode of maximum parallelism, and it will continue until all the object in membrane are transformed into and sent into membrane . Then membrane will go into stable condition, and in membrane the rules will be used until all object from membrane or are converted into and sent into output membrane. Now membrane reaches stable, meaning that the whole P system is stable and the calculation ends, left object in output membrane. Until then, the P chain system completes the addition of arbitrary two natural numbers and .
3.2. P Chain System for Subtraction
In order to achieve subtraction by P chain system, we select P chain system with multiplied orientation; that is, there are both membrane with positive orientation and negative orientation. P chain system for subtraction is designed as Figure 3 and its formalization expression is described as followed. : show that it is a P chain system with multiply orientation; ; , ; , ; ; ; ; , , here output membrane isn’t shown in Figure 3 and is represented by alphabet .
As Figure 3 showed, there is one membrane with positive orientation and the other is with negative orientation, where and represent any two natural numbers to subtract, specifically is subtrahend and is minuend, and , and which are antimatter are the objects in the P chain system, using the number variation of object and to achieve the subtraction between any two natural numbers, here the number of object are used to represent the calculating result. The process of P system with chain structure to achieve subtraction is described as followed. At first, rule in membrane with positive orientation will be used, where “” denotes the condition for the rule to be executed, that is, only when the condition is met, the rule can be used. So rule will be performed, producing object sent into membrane with negative orientation, and when and encounter, they will disappear immediately by the defaulted rule . And then there is only one object left in membrane , which satisfies the executive condition of rule , and objects and generated will be sent into membrane . The appearance of object activates the rule , and object left in membrane will be sent into output membrane. Until then, the P chain system completes the subtraction of any two natural numbers and .
3.3. P Chain System for Multiplication
In order to complete multiplication by P chain system, we select P chain system with single orientation, membrane with positive orientation or negative orientation. Here take the P chain system with positive orientation for example, and P chain system for multiplication is designed as Figure 4 and its formalization expression is described as followed. +: show that it is a P chain system with positive orientation; ; , ; , ; ; ; , , here output membrane does not appear in Figure 4 and is represented by alphabet .
As shown in Figure 4, there are two membranes with positive orientation, where and represent any two natural numbers to multiply, and and are the objects of the P chain system, using the number change of and to achieve the multiplication between any two natural numbers, here the number of object are used to represent the calculating result. The process of P system with chain structure to fulfill multiplication is explained as followed. First, the existence of object needed by rule makes it usable in membrane , due to the execution of rule , the object produced will be sent into membrane , which will trigger rule in membrane . Here rule is a chained rule, which contains two rule vectors. Referred to the literature , chained rule is a vector set of rules, in the membrane if the first rule in the vector of chained rules is applied, in the next step the rest of the rules from will be applied in order in consecutive steps. And if any one rule from a vector of chained rules which has already started to carry out cannot be used, the execution of is dropped, that is, for the current application of , the remaining rules are not executed anymore. So by rule , generate object , and then the executive condition of rule is satisfied. So in membrane rule will be used continuously until object in membrane are used up, and the whole system reaches stable, calculation ending and object left in output membrane. Until then, the P chain system completes the multiplication of arbitrary two natural numbers and . Specific implementation is shown in Table 1.
3.4. P Chain System for Division
In order to achieve division by P chain system, we use P chain system with single orientation. Here taking the P chain system with positive orientation for example, P chain system for division is designed as Figure 5 and its formalization definition is described as followed. +: show that it is a P chain system with positive orientation; ; , ; , ; , ; , , here output membrane does not appear in Figure 5 and is represented by alphabet .
As shown in Figure 5, there are two membranes with positive orientation, where and represent any two natural numbers to divide, and and are the objects of the P chain system, using the number variation of object and to achieve the division between any two natural numbers, here the number of object are used to represent the calculating result. Because at present the object defined in P chain system can only represent nonnegative integer, division taken into consideration here ignores the remainder. The process of P system with chain structure to fulfill division is explained as followed. First, there are operable objects for rule in membrane , so the rule is used, generation object sent into membrane , which activates the rule . Here rule is a chained rule too. So by rule produce one object , and then the executive condition of rule is met. So in membrane rule will be performed continuously until the object is used up or less than and rule isn’t executed any more, the whole system reaches stable, calculation ending and result is the number of object left in output membrane. Until then, the P chain system completes the division of arbitrary two natural numbers and . Specific implementation of exact division is shown in Table 2, and Table 3 gives the computational process of an example of nonexact division 9/2.
3.5. The Analysis of System Performance
Time complexity used in literature  is referred to the number of execution of all rules. Following this way, the comparison of time complexity of the two different methods is shown in Table 4. We can see that the time complexity of arithmetic operation fulfilled by P system with chain structure has been improved obviously, especially the division, which can testify the efficiency and improvement of the new method. Meanwhile, the design of membrane structure and rule is simpler, more effective and more conducive to simulate than the former P system.
4. Simulation of Arithmetic Operation P Chain System
The simulation of P system has a vital practical significance, and there has been a series of success P system simulation software which can be obtained from P system web page . Based on this, in this paper we try to do the simulation program of P chain system for arithmetic operation, as a result, it has stood out its lower time-cost and higher efficiency significantly. The development platform of the system is Microsoft Visual Studio 2008 on Windows 7 and the development language is C#. The whole system can operate normally, and can produce the executable file, which is with portability and robustness.
4.1. Description of Storage Mode of the Simulation System
During the process to develop system, we need to choose the appropriate storage mode for different elements, and the specification is demonstrated as followed .
We have known that we need to store the membrane structure, object and rule. Here we abstract those contents in each P system instance as an input file, marked “pcs” as the expanded name, for example, the input file of a P system to achieve the addition operation is named as “Addition.pcs”. And taking the addition operation for example, the input file which includes the definition of the membrane structure, object and rule is showed in Table 5.
After explain the structure, object and rule in a P chain system which need stored, how to store them is the next consideration, which is also the problem that needs to be resolved in the process of system initialization.
For the object multisets in the P chain system, it is stored by the form of nonnegative integer. The reason that we do not choose char is when the number of the object is large, the length of char may be very long, not only occupying large storage space, but also consuming much time when read. However, by using the INT array, huge amount of data can be denoted briefly.
For the rules in the P chain system, they are input into the system in the form of strings. If we want to fulfill the correspondence between the rules and object multisets, some rule transformations are needed. The way is that, first, determine the alphabets used in the P chain system, taking the P chain system for addition operation for example, the alphabet set and the rule involved in membrane 1, we need divide the rule into two parts, namely the former and the latter, and store them respectively. The former part of the rule is presented as , meaning that there are 1 object and 0 object , and the latter part of the rule is denoted as and , noting that the number 1 and 2 after semicolon display the membrane 1, 2, and the part before semicolon shows the change of numbers of objects. For the rule , we know that after the operation of the rule, there are 1 object consumed and no consumption of object in membrane 1, and in membrane 2, the number of object are unchanged and the object is added one more.
For the storage of the structure of P chain system, due to the special chain structure, we choose linear structure to save. Specifically, it is a kind of linear list, that is to say, two elements which are adjacent logically are adjacent physically. Here we use the vector representation, and there are three marks in each storage unit, the node mark , precursor node mark and subsequent node mark . Take the P chain system for example, its storage form showed as Table 6.
Following is the code of object and rule for P chain system for addition operation to illustrate the specific storage mode.(1);(2);(3)