The P System Design Method based on the P Module

Membrane computing is a kind of biocomputing model. At present, the main research areas of membrane computing are computational models and P system design. With the expansion of the P system scale, how to rapidly construct the P system has become a prominent issue. Designing P system based on P module is a P system design method proposed in recent years. This method provides information hiding and can build P system through recursive combination. However, the current P module design lacks a unified design method and lacks the standard process of building P system from P module. This paper studies the structural characteristics of cell-like P systems, and proposes an improved P module design method and a process for assembling P systems through P modules. In order to fully expound the design method of P module, the P system for the square root of the large number was analyzed and designed. And the correctness of the P system based on the P module design method was verified by an instance. Keywords—P module; P System; P system design; membrane computing; biocomputing models


I. INTRODUCTION
Membrane computing, also known as P system, is a branch of natural computing [1].The models of P system are mainly divided into three types, namely, the cell-like P system [2], the tissue-like P system [3] and the neural-like P system [4].They have been applied to solve the problems such as NP problems [5]- [8], image processing [9], [10], arithmetic operations [11]- [14] and so on.
In our previous work, most energy are put to implement the arithmetic operations in cell-like P systems: Ref. [11] firstly proposed an arithmetic P systems to implement the arithmetic operation in 2001; in [12] proposes an algorithm and builds expression P systems without priority rules for evaluating arithmetic expression; in [13] designed the P systems for addition, subtraction and multiplication; in [14] proposes a family of systems for solving Matrix-Vector Multiplication.Although we have obtained many excellent research results in the celllike P system, the difficulty for constructing the P system has continued to increase due to the increasingly complex algorithm.As a result, some experts and scholars began to propose some new models of modular constructing the P system.In 2009, Romero-Campero et al. proposed a biology model for modular combination cells [15] and Serbanuta et al. proposed K systems embedded in P system which can develop new extensions of P system [16].In 2010, Pȃun et al. proposed the dp system [17], which contains ideas for modularity.
Based on the above models, the modularized construction model, the P module [18], is proposed for simplifing the computing system structure and improving the reusability.At present, this model has been applied to some areas of research.In [19] proposed an improved generic version of P modules, an extensible framework for recursive composition of P systems.It proposed an solution to solve Byzantine agreement problem by P module.In [20] presented an improved deterministic solution for Flow-shop Scheduling problem.In [21] extended the P module theoretically and proposes the P module to solve the stereo matching problem in the application.Besides, it realized the discovering neighbors and Echo Algorithm.In [22] studied on the problem which aims to find out a point-disjoint and edge-disjoint path between source point and target point.All of these literature researches are related to the algorithms application of the P module.However, due to the lack of a unified design method, the P system based on the P module have low design efficiency and high error rate.In order to improve such problems, this paper designs a well-structured P module by combining the structural design methods in design methodology.The correctness of the dynamic execution of the P system is ensured with a good structure, making the P system easy to understand, easy to debug, and easy to maintain.In this paper, the cell-like P system and the P module are introduced in Section 2. Section 3 improves the P module and proposes the design and assembly of the P module.With the method of structural design in design methodology, four methods for constructing P module are proposed to design well-structured P system based on P modules in Section 4. Section 5 gives an instance to show the working mechanism of P module by using the related definitions and design methods of the P module.Section 6 summarizes the research work and presents a deeper level of research in the future.

A. Cell-like P System
The cell-like P system is a class of P system constructed by biochemical reactions in abstract biological cells.In the cell-like P system, the substances in the cells are abstracted as computational objects and the biochemical reactions within the cells are abstracted as object evolutionary rules.A cell-like P system containing five membranes is shown by Fig. 1.Fig. 1 is a schematic representation of a cell-like P system.A cell-like P system consists of the membranes (elementary membrane and combination membrane), the membrane regions surrounded by membranes, the membrane object collection in the regions and membrane rule collection.Formally, a cell-like P system (of degree m≥1) can be defined as form [23]: In the general model, the structure is in the form of nested membrane, which is not easy to be modularized, componentized and expanded.The rules in the cell-like P system can lead to high coupling degree.
In the general model, the structure is in the form of nested membrane, which is not easy to be modularized, componentized and expanded.The rules in the cell-like P system can lead to high coupling degree.

B. The Related Works
The P module is a model that modularizes the biochemical reaction of a group of cells and supports information hiding.Formally, a P module can be defined as form: 1) O is a finite non-empty alphabet of objects; 2) K is a finite set of cells, where each cell, δ ∈ K, has the form δ = (Q, s 0 , ω 0 , R) where, a) Q is a finite set of states; b) s 0 ∈ Q is the initial state; c) ω 0 ∈ O * is the initial multiset of objects; d) R is a finite ordered set of multiset rewriting rules of the general form: where, (iii) α is a rewriting operator, α ∈ {min, max}, The rewriting operator α = min indicates that the rewriting is applied once, if the rule is applicable; and α = max indicates that the rewriting is applied as many times as possible, if the rule is applicable.When α = max, α can be omitted in the rule.(iv) β ∈ {↑, ↓, }; (v) γ ∈ {one, spread, repl}; 3) δ is a binary relation on K, i.e. a set of parent-child structural arcs, representing duplex or simplex communication channels between cells; 4) P is a subset of K,indicating the port cells, i.e. the only cells can be connected to other modules.
P module is a modular combination model of cells.It mainly uses the characteristics of its recursive combination to realize the hidden functions of internal information and internal structure, so as to facilitate the construction of a complex P system.

III. DESIGN AND ASSEMBLY OF THE P MODULE
This section improves the P module with high encapsulation, information hiding, modular combination and high concurrency.Its special external definition, external reference and assembly mechanism make it highly independent, realize the reuse of modules and speed up the construction of P system.

A. P Module Improvement
The P module is a model of cell-like P system, which abstracts a cell into a P module.It has the characteristics of module encapsulation and the inheritance of rules and objects.Each module is independent and several P modules can be combined into the combination P module by a structured way.Formally, a P module (of degree m ≥1) can be defined as form: O is a finite non-empty alphabet of objects, O=O 1 ∪O 2 .
For each submodule, they contain the public objects from the parent module and their own objects.
where, a) L represents the inheritance rights of the rules; L = {Γ, ∆, Φ}; Γ represents this rule as a public rule, ∆ represents this rule as a protected rule, Φ represents this rule as a private rule(this can be omitted).b) S is a finite set of states; c) s 0 ∈ S is the initial state; d) ω 0 ∈ O * is the initial multiset of objects; e) R is a finite ordered set of rules: where, (i) l ∈ L; (iv) α is a rewriting operator, α ∈ {min, max}, The rewriting operator α = min indicates that the rewriting is applied once, if the rule is applicable; and α = max indicates that the rewriting is applied as many times as possible, if the rule is applicable.When α = max, α can be omitted in the rule.(v) id is a number identified the sequence of rule execution.Prior and preference can be given highranking.If the rules in the same state are in the same priority, id can be omitted in the rule.
In this model, the connection relationship between P modules is a parent-child relationship, and theirs inheritance can be reflected by objects, O, and rules, R. Through the inheritance of the P module, we can organize system structure more effectively, clarify the relationship between modules, and make full use of existing modules to achieve more complex and deeper development.

B. P Module Assembly Mechanism
According to the definition of P module introduced above, a P system is a P module which is constructed by nested P modules.The nested P module is expressed by the combination P module which is constructed by P modules in the same layer.Given an arbitrary finite set of disjoint P modules, we can construct a combination P module by instantiating some of their external references to some of their external definitions, which implicitly instantiates the relationship of P modules in the same layer.When the parent P module is executed, the submodule will inherit the public objects and public rules of the parent P module to further initialize the internal structure of the module and start to work.The siblings can be executed in parallel, this shows the powerful computing power of the whole system.The combination P module can encapsulate the details of the interior, users only pay attention to their input and output.
Considering of a finite family of n P modules, ), the result of a composition P module depends on one kind of actual instantiation that the external reference and the definition are matched.The external reference is matched to external definition by two partial mappings, ρ ↑ : , and a previously uninstantiated arc (r, σ), where Based on what has been described above, the P module family Ψ can be expressed as the form, Π = (O, K, δ, Q, D ↑ , D ↓ , R ↑ , R ↓ ), when ρ ↑ , ρ ↓ are the partial mappings that define the instantiation (as previously introduced), if: As described above, we can know the concrete the construction and assembly mechanism of P modules in P system, which includes the nested combination principle of the P module in the same layer and the perfect encapsulation mechanism.The construction and assembly mechanism also make a detailed definition of δ, D, R as a way of communication.The P modules construction and assembly mechanism facilitates the design of P system for complex algorithms, where every P module provides encapsulation and information hiding to other P modules.

IV. BASIC STRUCTURE OF THE P SYSTEM
The P system is constructed by layer upon layer encapsulation using P module.P modules in the same layer are assembled by the construction and assembly mechanism and encapsulated into a combination P module.The construction and assembly methods of a combination P module include four ways, i.e. the sequence method, the branch method, the cycle method and the parallel method, which show the four structures of the P module, respectively.

A. Sequential Method
Since the specific implementation rules of each P module will be determined by the function to be performed, the definition of the rules in each P module need to be abstracted to be a form,which is shown below through the two rules.The general design definition of a elementary P module perform a series of calculations on the initial object set, and finally output the result set.As shown below, here are two rules to represent this process, r 1 represents a series of operations on the initial object set, which are a series of operations except the output of the result set, and the evolution from the initial set of objects x to y is accomplished by multiple rules in the specific implementation.r 2 represents the calculated set of objects is evolved into the set of public objects required by the submodule, so that the submodule can inherit from it to obtain a complete initial set of objects.r 1 : Γ/∆/ΦS 0 x 0 , . . ., x i0 → min/max S 1 y 0 , . . ., y j0 r 2 : Γ/∆/ΦS 1 y 0 , . . ., y j0 → min/max S 0 z 0 , . . ., z k0 Fig. 2 illustrates a combined P module through the sequential modular composition of two elementary P modules.
Fig. 2. The sequential structure based on the P module.

D. Parallel Method
The parallel structure can be seen as a variant of the branch structure, but the operation rules in this structure are very different from the branch structure due to the large number of P modules in parallel computation and its unique parallelism.Fig. 5 shows the generic parallel structure of parallel computing modules of degree m(m is a variable).The parallelism of the parallel structure is embodied in the 1 − m P module.They equally inherit the public object set from Π 0 , and Π m+1 inherits the object set of m parallel P modules.
For the parallel structure, each parallel module first inherits the same object set form Π 0 , then uses some of the inheriting object sets to execute the respective calculation rules, and finally outputs the result set and remaining inherited objects to Π m+1 .Π m+1 inherits the object set of all parallel P modules, Π m+1 module needs to process these inheriting objects in order to run correctly .
Due to the existence of multiple inheritance and the existence of a special case of 1 pair n and n pair 1, it becomes more complicated to maintain the consistency of the data.Some inheriting object set still remain the submodule,because the parallel execution P modules use only part of the inheriting object set.In the remaining inherited objects, one is the object set as the public global variables that need pass to the child module, and the other is the redundant object set.For the first case, the submodules of the parallel modules inherits the object sets of the m P modules and results in a multiple of the number of object sets.Therefore, it is necessary to divide the public global variables in the submodule (i.e. the public global variables/the number of the parallel P modules).In the second case, since it is useless data, each parallel submodule needs to destroy the redundant object set (because the redundant object set does not have a general purpose, so specific problems need to be specifically designed).To make the above situation clear, set the public global variable to be ω for the rule design.The following is the general structure design of the parallel structure.

V. AN EXAMPLE: P SYSTEM DESIGN BASED ON P MODULE
Based on the high computational complexity of calculating the arithmetic square root of a large number, this section proposes an efficient algorithm to reduce its computational complexity, and implement the algorithm in the P system by using the P module and four P module construction methods.

A. Square Root Algorithm of a Large Number
Two algorithms for calculating the square root of a large number are introduced here.One is a square root estimation algorithm for estimating the scope of the square root.This algorithm is illustrated by Table I.
The algorithm is applied to estimate the square root, including four steps and the time complexity of Sqrte The other is a square root algorithm through m bisection calculation algorithm.This algorithm is an improved algorithm of 2-points, which is illustrated by Table II.
According Table II, the complexity of M bisection (b,n,a,m) is about O(log m n) (m is the number of the interval splited, n is the interval size ).Steps: (1) Circularly dividing 100 with no remainder,then get the high-value of the inputting number expressed as the numbers, y,and the number of cycles.
(3) Combinate the square root of the high-value and the cycles.The previous chapter proposed two algorithms for solving the square root of a large number, but the computational efficiency of each algorithm is not optimized.To reduce the computational complexity, the two algorithms can be combined to form an efficient algorithm named Bigsplite, which integrates the square root estimation algorithm, EstimateSqr(x), and the square root algorithm through m bisection calculation algorithm, M bisection(b, l, x, m).By using P modules, the P system, Bigsplite, has high powerful parallel execution capabilities, high reusability and low coupling.two kinds of objects for each module, one is one of the α i , β i , γ i (i =the id of cell−30), the second is that each module has a common global variable, α.Go to step (6).(ParallelComputing) 6) In Π 13 , determine whether there is an accurate result from the results of the calculation, γ i , if so, then the square root value, δ = γ i , inherited by Π 15 and go to step (7); otherwise, find the interval of the square root, i.e. [β, At present, there is either δ and α or β, γ and α.Go to step (8).7) In Π 15 ,output the final result ε(ε = δ).8) In the cell Π 14 , determine whether the size of the interval, i.e. γ, is more than 2, if so, the result, δ = β + 1 is given to Π 15 and go to step (7); otherwise,pass β, γ, α to Π 12 and go to step (4).
The square root algorithm of a large number based on the P module, Bigsplite(α), can pass through two phases, EstimateSqr(α) and M bisection(β, γ, α, m), when the result interval of the square root is [β, β + γ] by EstimateSqr(α).The size of the second parameter of the algorithm named M bisection is much smaller than the original input number, α, so the total number of the recursive computing is decreased, but the time complexity of M bisection(β, γ, α, m) is still O(log m n).So the time complexity of the square root algorithm of large number based on the P module is O(log m n).As is shown Fig. 7, the number of P modules in the P system are (19 + m).The P system can be expressed as the biggest combination P module Π 17 < def ↓Π 0 , ref ↓i 9 >.The entire definition and operation mechanism of the system is mainly represented by public object sets, rule sets, and construction and assembly mechanism.The description of the public object set can not only show the evolutionary direction and flow of the entire system calculation, but also more easily incorporate the rule set in the appendix to ensure the correctness of the rule design of P system.The following is a simple description of the public and private objects in the evolution of the rules of each module.

D. Calculate Instance
We assume that the inputting data is 69399 and the number of parallel computing P module is 11, namely, m=11.So 69399 copies of objects into the membrane system to evolve.

VI. CONCLUSION
In this paper, the design and assembly of the P module is formed to provide a framework for constructing a P system by recursive combined P modules, so that the P module combines the three characteristics of packaging, information hiding and modular combination.By designing a well-structured P module, the correctness of the dynamic execution of the P system is ensured with a good structure, the efficiency of software development is improved, and the error rate is reduced.
As the application of this paper, we use the definition and design method of P module to solve the large number square root problem.By designing a P system for solving the square root of a large number, the correctness and high efficiency of the P system design method based on the P module are clarified.
The design method in this paper is mainly aimed at the celllike P system and further work can apply it to other models of P systems, such as the tissue-like P system and neural-like P system.

Fig. 1 .
Fig. 1.The structure of cell-like P system.

Fig. 3 Fig. 3 .
Fig.3illustrates a combined P module through the branch modular composition of four P modules.

Fig. 4 .
Fig. 4. The cycle structure based on the P module.

Fig. 5 .
Fig. 5.The parallel structure based on the P module.

( 4 )
Output: the left interval point of estimated square root and the size of estimated square root.End TABLE II.M bisection(b, l, x, m) Input: b, l, x x :the original number to be squared; b: the left interval point of √ x ; l: the size of the interval of √ x; m: the quantity of equidistant intervals original interval: [b, b + l] Output: the square root Steps: (1) Splite the interval into m equidistant intervals and obtain m + 1 copies of endpoint number in the interval, x0, x1, . . ., xm. (2) Parallelly calculate f(xi) = x 2 i − x(i ∈ [0, m]), then output these key value pairs (xi, f (xi)) (i ∈ [0, m]).(3)Filter these key value pairs, if there is the number, f (xi) = 0, then output xi as the final result; otherwise, output two adjacent numbers, xi, xi+1 when f (xi) < 0 and f (xi+1) > 0.

( 4 )
If xi+1 − xi >= 2, xi+1 and xi are as a new round of inputting and enter (1); otherwise, output xi + 1 as the final result.End B. Square Root Algorithm of a Large Number based on the P Module

C 8 Fig. 7 .
Fig. 7 is a P module flow chart illustrating the modular combination of P modules that calculates the square root of a large number.
↑ is a subset of K, representing def ↑ definitions, e.g.def ↑Π i represents that the entrance module of this P module is Π i ; D ↓ is a subset of K, representing def ↓ definitions, e.g.def ↓Π i represents that the export module of this P module isΠ i .6)R ↑ is a finite set, disjoint of K,representing ref ↑ references, e.g.ref ↑a i represents that the entrance arc of this P module is a i ; R ↓ is a finite set, disjoint of K, representing ref ↓ references, e.g.ref ↑ b i represents that the export arc of this P module is b