scieee AI-readable full text Open interactive document viewer

Kernel P Systems - Version 1

Gheorgue, Marian; Ipate, Florentin; Dragomir, Ciprian; Mierla, Laurentiu; Valencia Cabrera, Luis; García Quismondo, Manuel; Pérez Jiménez, Mario de Jesús

Abstract

A basic P system, called kernel P system4 (kP system for short), combining features of di erent P systems introduced and studied so far is de ned and discussed. The structure of such systems is de ned as a dynamic graph, similar to tissue-like P systems, the objects are organised as multisets, and the rules in each compartment, rewriting and communication together with system structure changing rules, are applied in accordance with a speci c execution strategy. The de nition of kP systems is introduced and some examples illustrate this concept. Two classes of P systems, namely neural-like and generalised communicating P systems are simulated by kP systems. Some case studies prove the expressive power of these systems.

Full text

Kernel P Systems - Version 1 Marian Gheorghe1,2, Florentin Ipate2, Ciprian Dragomir1, Laurent¸iu Mierl˘a2, Luis Valencia-Cabrera3, Manuel Garc´ıa-Quismondo3, and Mario J. P´erez-Jim´enez3 1Department of Computer Science University of Sheffield Portobello Street, Regent Court, Sheffield, S1 4DP, UK {m.gheorghe, c.dragomir}@sheffield.ac.uk 2Department of Computer Science University of Bucarest Str Academiei, 14, Bucarest, Romania [email protected], [email protected] 3Research Group on Natural Computing Department of Computer Science and Artificial Intelligence University of Seville Avda. Reina Mercedes s/n, 41012 Seville, Spain {lvalencia, mgarciaquismondo, marper}@us.es Summary. A basic P system, called kernel P system4(kP system for short), combining features of different P systems introduced and studied so far is defined and discussed. The structure of such systems is defined as a dynamic graph, similar to tissue-like P systems, the objects are organised as multisets, and the rules in each compartment, rewriting and communication together with system structure changing rules, are applied in accordance with a specific execution strategy. The definition of kP systems is introduced and some examples illustrate this concept. Two classes of P systems, namely neural-like and generalised communicating P systems are simulated by kP systems. Some case studies prove the expressive power of these systems. 1 Introduction Different classes of P systems have been introduced and studied for their computational power or for specifying or modelling various problems, like solving simple algorithms [4, 2], NP-complete problems [8] and other applications [5]. More recently various distributed algorithms and problems [13] have been studied with a new variant of P systems. In many cases the specification of the system investigated requires features, constraints or types of behaviour which are not always provided 4This concept was introduced initially in [10]; in this paper it is presented a revised version of it. 98 M. Gheorghe et al. by the model in its initial definition. It helps in many cases to have some flexibility with modelling approaches, especially in the early stages of modelling, as it might simplify the model, shorten associated processes and clarify more complex or unknown aspects of the system. The downside of this is the lack of a coherent and well-defined framework that allows us to analyse, verify and test this behaviour and simulate the system. In this respect in [10] the concept of kernel P system (kP system) has ben introduced in order to include the most used concepts from P systems. It is intended to formally define these systems in an operational style and finally implement it within a model checker (SPIN [3], Maude [6]) and integrate it into the P–Lingua platform. This new class of P systems use a graph-like structure (so called, tissue P systems) with a set of symbols, labels of membranes, and rules of various types. A broad range of strategies to run the rules against the multiset of objects available in each compartment is provided. The rules in each compartment will be of two types: (i) object processing rules which transform and transport objects between compartments or exchange objects between compartments and environment and (ii) structure changing rules responsible for changing the system’s topology. Each rule has a guard resembling activators and inhibitors associated with certain variants of P systems. We consider rewriting and communication rules, membrane division, dissolution, bond creation and destruction. The paper consists of five chapters. Chapter 2 introduces basic definitions, Chapter 3 compares the newly introduce kP systems with some other classes of P systems, Chapter 4 presents a case study based on a static sorting, studying how this problem is solved with various variants of P systems. Finally Chapter 5 briefly describes two specification languages for kP systems with their implementations and some examples. 2 kP Systems A kP system is a formal model that uses some well-known features of existing P systems and includes some new elements and, more importantly, it offers a coherent view on integrating them into the same formalism. The key elements of a kP system will be formally defined in this section, namely objects, types of rules, internal structure of the system and strategies for running such systems. Some preliminary formal concepts describing the syntax of kP systems and an informal description of the way these systems are executed will be introduced. We consider that standard concepts like strings, multisets, rewriting rules, and computation are well-known concepts in P systems and indicate [15] as a comprehensive source of information in this respect. First we introduce the key concept of a compartment. Definition 1. Tis a set of compartment types,T={t1, . . . , ts},where ti= (Ri, σi),1≤i≤s, consists of a set of rules, Ri, and an execution strategy, σi, defined over Lab(Ri), the labels of the rules of Ri. Kernel P Systems 99 Remark 1. The compartments used by the definition of the kP systems will be instantiated from the compartment types defined above. The types of rules and the execution strategy will be discussed later. Definition 2. Akernel P (kP) system of degree nis a tuple kΠ = (A, µ, C1, . . . , Cn, i0), where Ais a finite set of elements called objects;µdefines the membrane structure, which is a graph, (V, E), where Vare vertices indicating components, and Eedges; Ci= (ti, wi),1≤i≤n, is a compartment of the system consisting of a compartment type from Tand an initial multiset,wiover A;iois the output compartment where the result is obtained. Remark 2. The inner part of each compartment is called region, which is delimited by a membrane. 2.1 kP System Rules The discussion below assumes that the rules introduced belong to the same compartment, Ci. Each rule rmay have a guard g, its generic form is r{g}. The rule ris applicable to a multiset wwhen its left hand side is contained into wand gis true for w. In the sequel we will analyse how the guards are specified and evaluated. The guards are constructed using multisets over Aand relational and Boolean operators – like Boolean expressions. Before presenting the definition we introduce some notations. For a multiset wover Aand an element a∈A, we denote by #a(w) the number of a0s occurring in w. Let Rel ={<, ≤,=,6=,≥, >}be the set of relational operators, γ∈Rel, a relational operator, ana multiset and r{g}a rule with guard g. Definition 3. If gis the abstract relational expression γanand the current multiset is w, then the guard denotes the relational expression #a(w)γn. The guard g is true for the multiset wif #a(w)γn is true. Let us consider the Boolean operators ¬(negation), ∧(conjunction) and ∨(disjunction), listed wrt decreasing precedence order. Abstract relational expressions can be connected by Boolean operators generating abstract Boolean expressions. Definition 4. If gis the abstract Boolean expression and the current multiset is w, then the guard denotes the Boolean expression for w, obtained by replacing abstract relational expressions with relational expressions for w. The guard gis true for the multiset wwhen the Boolean expression for wis true. Definition 5. A guard is: (i) one of the Boolean constants true or false; (ii) an abstract relational expression; or (iii) an abstract Boolean expression. 100 M. Gheorghe et al. Example 1. If the rule is r:ab →c{≥ a5∧ ≥ b5∨¬ > c}, then this can be applied iff the current multiset, w, includes the left hand side of r, i.e., ab and the guard is true for wit has at least 5 a0s and 5 b0s or no more than a c. Definition 6. A rule from a compartment Cli= (tli, wli)can have one of the following types: •(a) rewriting and communication rule: x→y{g}, where x∈A+and yhas the form y= (a1, t1). . . (ah, th),h≥0,aj∈A and tjindicates a compartment type from T– see Definition 2 – with instance compartments linked to the current compartment; tjmight indicate the type of the current compartment, i.e., tli– in this case it is ignored; if a link does not exist (the two compartments are not in E) then the rule is not applied; if a target, tj, refers to a compartment type that has more than one instance connected to li, then one of them will be non-deterministically chosen; •(b) structure changing rules; the following types are considered: – (b1) membrane division rule: [x]tli→[y1]ti1. . . [yp]tip{g}, where x∈A+and yjhas the form yj= (aj,1, tj,1). . . (aj,hj, tj,hj)like in rewriting and communication rules; the compartment liwill be replaced by pcompartments; the j-th compartment, instantiated from the compartment type tijcontains the same objects as li, but x, which will be replaced by yj; all the links of liare inherited by each of the newly created compartments; – (b2) membrane dissolution rule: []tli→λ{g}; the compartment liwill be destroyed together with its links; – (b3) link creation rule: [x]tli; []tlj→[y]tli−[]tlj{g}; the current compartment is linked to a compartment of type tljand xis transformed into y; if more than one instance of the compartment type tlj exists then one of them will be non-deterministically picked up; gis a guard that refers to the compartment instantiated from the compartment type tl1; – (b4) link destruction rule: [x]tli−[]tlj→[y]tli; []tlj{g}; is the opposite of link creation and means that the compartments are disconnected. Input-output rules considered in [10] will be expressed as rewriting and communication rules. 2.2 kP System Execution Strategy In kP systems the way in which rules are executed is defined for each compartment type tfrom T– see Definition 1 and Remark 1. As in Definition 1, Lab(R) is the set of labels of the rules R. Definition 7. For a compartment type t= (R, σ)from Tand r∈Lab(R), r1, . . . , rs∈Lab(R), the execution strategy,σ, is defined by the following •σ=λ, means no rule from the current compartment will be executed; Kernel P Systems 101 •σ={r}– the rule ris executed; •σ={r1, . . . , rs}– one of the rules labelled r1, . . . , rswill be chosen nondeterministically and executed; if none is applicable then none is executed; this is called alternative or choice; •σ={r1, . . . , rs}∗– the rules are applied an arbitrary number of times ( arbitrary parallelism); •σ={r1, . . . , rs}>– the rules are executed according to maximal parallelism strategy [15]; •σ=σ1&. . . &σs, means executing sequentially σ1, . . . , σs, where σi,1≤i≤ s, describes any of the above cases, namely λ, one rule, a choice, arbitrary parallelism or maximal parallelism; if one of σifails to be executed then the rest is no longer executed; •for any of the above σstrategy only one single structure changing rule is allowed. Remark 3. Let us suppose that a certain order relationship exists, e.g., r1, r2> r3, r4, which means that when weak priority is applied, the first two rules are executed first, if possible, then the next two. If both are executed with maximal parallelism, this is described by {r1, r2}>{r3, r4}>. Remark 4. The result of a computation will be the number of objects collected in the output compartment. For a kP systems kΠ, the set of all these numbers will be denoted by M(kΠ). 2.3 kP System Examples In this section we illustrate the newly introduced P system model with some examples. Example 2. Let us consider the set of component types T={t1, t2, t3}, where t1= (R1, σ1), t2= (R2, σ2), t3= (R3, σ3),with R1={r1:a→a(b, 2)(c, 3) {≥ p};r2:p→p;r3:p→λ},and σ1=Lab(R1)>, R2={r1:b→(b, 0)c{≥ p};r2:p→p;r3:p→λ},and σ2=Lab(R2)>, R3=∅and σ3=Lab(R3)>. A kP system with n= 4 compartments is kΠ1= (A, µ, C1, . . . , C4,1), where A={a, b, c, p},C1= (t1, w1,0), C2= (t2, w2,0), C3= (t2, w3,0), C4= (t3, w4,0); with w1,0=a3p,w2,0=w3,0=p,w4,0=λ; µis given by the graph with nodes {C1, C2, C3, C4}and edges {C1, C2},{C1, C3}, {C1, C4}. One can note that we do not use targets for objects meant to stay in the current compartment (i.e., we have r1:a→a(b, 2)(c, 3) {≥ p}instead of r1: a→(a, 1)(b, 2)(c, 3) {≥ p}). The rule r1in R2simulates an input/output rule [10] which is meant to bring a cfrom the environment (0) and to send out a binstead. In this example there are only rewriting and communication rules; some rules have a guard, ≥p(pis a promoter), others do not have any and in each compartment the rules are applied in maximal parallel way in every step, as indicated by 102 M. Gheorghe et al. σj, 1 ≤j≤3. As two instances of the compartment type t2,C2, C3, appear in the system, when the rule r1from the compartment C1is applied, the object bgoes non-deterministically to one of the two compartments labelled 2 (from t2) as long as premains in compartment C1; object cgoes always to the compartment C4, of type t3. The initial configuration of kΠ1is M0= (a3p, p, p, λ). The only applicable rules are r1, r2and r3from C1and r2, r3from C2, C3. If r1, r2are chosen in C1 and r2in C2, C3, then a3pis rewritten by r1, r2in C1and pin C2, C3by r2; then three a0s stay in C1, three b’s go non-deterministically to C2, C3, three c’s go to compartment C4, and each pin C2, C3stays in its compartment. Let us assume that two of them go to C2and one to C3. Hence, the next configuration is M1= (a3p, b2p, bp, c3). If in the next step the same rules are applied identically in the first compartment, C1, and rules r1, r2are used in C2and r1, r3in C3, then the next configuration is M2= (a3p, b2c2p, bc, c6). If now r1, r3are used in C1, with r1used in the same way and r1, r3in C2(no rule is available in C3) then M3= (a3, b2c4, b2c, c9); this is a final configuration as there is no pto trigger a further step. Example 3. Let us reconsider the example above enriched with rules dealing with the system’s structure. First the set Twill be replaced by T0={t1, t0 2, t3}, where t0 2= (R0 2, σ0 2), with R0 2=R2∪Rstr 2and σ0 2=Lab(R2)>&Lab(Rstr 2)>. We can notice that σ0 2tells us that first the rewriting and communication rules are applied in a maximal parallel manner and then one of system’s structure rules is chosen to be executed. The set Rstr 2denotes the set of membrane division rules for t0 2, i.e., Rstr 2={r4: []2→[]2[]2{≥ b2∧ ≥ p}}. The new kP system, denoted kΠ2, will have the following four compartments: C1= (t1, w1,0), C0 2= (t0 2, w2,0), C0 3= (t0 2, w3,0), C4= (t3, w4,0). If the system follows the same pathway as kΠ1then M2shows a different configuration given that in C0 2after applying R2in a maximal parallel manner, Rstr 2is applied as indicated by σ0 2, when the guard of r4is true. The compartment C0 2is divided into two compartments, C2,1, C2,2, instantiated from the same compartment type t2, with the content of C0 2and appearing on positions 2 and 3 in the new configuration, M0 2= (a3p, b2c2p, b2c2p, bc, c6); the new compartments, C2,1, C2,2, are linked to compartment C1. Compartment C0 3is not divided as the guard of r4is not true for its current multiset. In the next step both C2,1, C2,2are divided as they contain the guard triggering the membrane division rule r4. The process will stop when either pwill be rewritten to λor b2stops coming to these compartments. Remark 5. If we aim to dissolve one of the compartments instantiated from t2or to disconnect it from compartment C1, once a certain condition is true, for instance {≥ b2∧ ≥ c2∧ ≥ p}, then two more rules will be added to Rstr 2, namely r5: []2→λ{≥ b2∧ ≥ c2∧ ≥ p},r6: []2−[]1→[]2; []1{≥ b2∧ ≥ c2∧ ≥ p}. The expression σ0 2remains the same, but in this case Rstr 2contains three elements and at most one is applied at each step, in every compartment with label 2. For this reason σ0 2can also be written as Lab(R2)>&Lab(Rstr 2). Kernel P Systems 103 2.4 Final Remarks We will recap and summarise how various rules are applied in a compartment instantiated from a compartment type tli. The rules presented in Section 2.1 are applied as follows: •A rewrite - communication rule, x→(a1, t1). . . (ah, th){g}, is executable if and only if 1. its left hand side multiset, x, is contained within the current multiset; 2. its associated guard, g, holds (i.e., it is true for the current multiset); 3. for each right hand side element, (aj, tj), tj∈T(see Definition 1), there is at least one connected compartment of type tjto receive aj, otherwise the rule is not applicable. •A membrane division rule, [x]tli→[y1]ti1. . . [yp]tip{g}, is executable if and only if 1. the multiset on the left hand side, x, is included in the current multiset; 2. its associated guard, g, is true for the current multiset; 3. no other structure changing rule (see Definitions 6 and 7) has been applied in the same step; 4. the compartment instantiated from tliis replaced by pcompartments instantiated from the compartment types ti1, . . . , tip; their contents will be the same as the content of the compartment on the left hand side, but x will be replaced by y1, . . . , yp, respectively; 5. all the links of the compartment instantiated from tliwill be inherited by each of those instantiated from the compartment types ti1, . . . , tip. •A membrane dissolution rule, []tli→λ{g}, will destroy the compartment obtained from liand its links, given the guard gis true for the current multiset; no other structure changing rule (see Definitions 6 and 7) has been applied in the same step;. •A link creation rule, [x]tli; []tlj→[y]tli−[]tlj{g}, is executable if and only if 1. its left hand side multiset, x, is contained in the current multiset in the compartment; 2. its associated guard, g, holds; 3. there exists at least one membrane instance of type tljwhich is not connected to the instance of type tli(i.e there is at least one instance to link to); if there are more instances then one will be non-deterministically chosen; 4. no other structure changing rule (see Definitions 6 and 7) has been applied in the same step. •A link destruction rule is executed when conditions similar to those mentioned for link creation hold. 104 M. Gheorghe et al. 3 Neural-like P Systems and P Systems with Active Membranes versus kP Systems In order to prove how powerful and expressive kP systems are, we will show how two of the most used variants of P systems are simulated by kP systems. More precisely, we will show how neural-like P systems and P systems with active membranes are simulated by some reduced versions of kP systems. Definition 8. Aneural-like P system (tissue P system with states) of degree nis a construct Π= (O, σ1, ...σn, syn, i0)([14], p. 249), where: •Ois a finite, non-empty set of objects, the alphabet; •σi= (Qi, si,0, wi,0, Ri),1≤i≤n, represents a cell and –Qiis the finite set of states of cell σi; –si,0∈Qiis the initial state; –wi,0∈O∗is the initial multiset of objects contained in cell σi; –Riis a finite set of rewriting and communication rules, of the form sw → s0xygozout; when such a rule is applied, xwill replace win cell σi, the objects from ywill be sent to neighbouring cells, according to the transmission mode (see Remark 6) and the objects from zwill be sent out into the environment; cell σiwill move from state sto s0; •syn ⊆ {1, ..., n}×{1, ..., n}, the connections between cells, synapses; •i0is the output cell. Remark 6. We discuss here a special class of P systems introduced in Definition 8 that will help us to prove a first result. 1. For neural-like P systems, three processing modes are considered, called “max”, “min”, “par”, and three transmission modes, namely “one”, “repl”, “spread”. For formal definitions and other details we refer to [14]. 2. We denote by simple neural-like P systems the class of P systems given by Definition 8, where the rewriting and communication rules have the form sw → s0x(a1, t1)· · · (ap, tp), where th, 1 ≤h≤p, denotes the target cell (σh), and processing mode “max”, transmission mode defined by the target indications mentioned in each rule. Notation. For a given P system, Π, the set of numbers computed by Πwill be denoted by M(Π). Theorem 1. If Πis neural-like P system of degree n, then there is a kP system, Π0, of degree nand using only rules of type (a), rewriting and communication rules, simulating Πand such that M(Π0)⊆M(Π)∪ {2}. Proof. Let Πbe a simple neural-like P systems of degree n, as defined by Remark 6.2. We construct the kP system, Π0, as follows: the set of compartment types T={t1, . . . , tn}, where ti= (R0 i, σi), 1 ≤i≤n, (see below the definitions of ti components) and Π0= (A, µ, C1, . . . , Cn, i0) where: Kernel P Systems 105 •A=O∪(S1≤i≤nQi)∪ {γ};γis a new symbol neither in Onor in S1≤i≤nQi; •µ=syn; •Ci= (ti, w0 i,0),1≤i≤n; and –w0 i,0=γ, 1≤i≤n; –R0 icontains the following rules: 1. γ→si,0twi,0, where si,0, wi,0are the initial state and initial multiset, respectively, associated with cell σi, and t∈Q(i) si,0. For s∈Qi, denote by Q(i) s={t|t∈Qi, sx →ty ∈Ri}; i.e., Q(i) sgives, when the cell σi is in state s, all the states where σican move to. In the first step, in compartment Ci, a rule γ→si,0twi,0is applied and the current multiset becomes w0 i=si,0wi,0. 2. For each pair (s, t), t ∈Q(i) s, there are rules sxj→tyj∈Ri,1≤j≤p(∗). If there are no rules in Rifrom sto tthen another pair of states is considered. For the above rules from Ri, (∗), the following rules are considered in R0 i: xj→yj{=s∧=t}, 1 ≤j≤p, and st →tq {≥ x1∨. . . ∨ ≥ xp}, q∈Q(i) t(∗∗). In the above guards the notation ≥xj, if xj=aj,1. . . aj,lj, denotes ≥aj,1∧. . . ∧ ≥ aj,lj. The rules (∗∗) make use of guards; the first prules are applied iff the current multiset contains one sand one t, whereas the last one is applicable iff at least one or more of the occurrences of one of the multisets xj, 1 ≤j≤p, is included in the current multiset. Clearly, in state sonly the rules (∗) of Πare applicable for this P system, depending on the availability of the multisets occurring on the left hand side of them; the next state Πis moving to t. Similarly, in Π0only the rules denoted by (∗∗) are applicable; the rule st →tq {≥ x1∨. . . ∨ ≥ xp} is applied once whereas the first prules are applied as many times as their corresponding (∗) rules are applied. If the set Q(i) tused in st →tq {≥ x1∨. . . ∨ ≥ xp}of (∗∗) is empty, i.e., there are no rules from state t, then the rule is replaced by st →λ. When Q(i) si,0=∅then the rule γ→wi,0is introduced in R0 i. At any moment the component Ciof the kP system Π0contains a multiset which is the multiset of σiaugmented by the current state of σi,s, and one of the next states, t, if it exists. The process will stop in component Ciof Π0when no pair of rules of type (∗∗) is applicable, which means no sxi→tyirule is applicable in state s. The multiset M(Π0) contains M(Π) and maybe two states s, t occurring in the last step of the computation. Hence M(Π0)⊆M(Π)∪ {2}.ut Remark 7. A few comments regarding Theorem 1. 1. The above simulation can be assessed with respect to number of compartments, objects and rules as well as the computation steps. 112 M. Gheorghe et al. r8:y2[]0 j→[x1]+ j,1≤j≤n; r9:y2[]+ j→[x1]0 j,1≤j≤n; where i∈ {0,+}; and the order relationship r1, r2, r4, r5, r6, r7, r8, r9> r3. M/S []1[]2[]3[]4[]5[]6[]aux 0 [a3x1]0[a6x1]+[a9x1]0[a5x1]+[a7x1]0[a8x1]+[ ]0 1 [a3b6x2]0[x2]+[a9b5x2]0[x2]+[a7b8x2]0[x2]+[ ]0 2 [a6]+[a3y1]0[a9y1]+[a5y1]0[a8y1]+[a7y1]0[y1]0 3 [a6]+[a3b9y2]0[y2]+[a5b8y2]0[y2]+[a7y2]0[y2]0 4 [a6x1]0[a9x1]+[a3x1]0[a8x1]+[a5x1]0[a7x1]+[ ]0 5 [a6b9x2]0[x2]+[a3b8x2]0[x2]+[a5b7x2]0[x2]+[ ]0 There are no additional requirements in the case where n= 2k+ 1, however we always entail an extra auxiliary membrane to enable out communication of the n−th membrane, therefore allowing it to switch polarity. A similar implementation of the static sorting algorithm can be obtained by using P systems with labels on membranes. As illustrated in [1], we can encode electrical charges in strings of the membrane labels, in order to differentiate between the two necessary states. For each membrane hiwe synthesise its complementary label h0 i, which is changed to by a communication rule. We leave this as an exercise to the reader. A number of (preliminary) conclusions can be drawn from the above case study: •kP systems are conceptually closer to tissue P systems than cell-like P systems; in our case studies, this is reflected by the similarity between the specifications using kP systems and tissue P systems, respectively. On the other hand, the model realised using the cell-like P system variant is significantly more complex. •In terms of complexity, the three implementations are roughly equivalent. The kP system executes in each step one more rule then the P system with states; this rule is either r2or r3(dealing with p). On the other hand, the number of rules applied in each compartment for every step by cell-like P systems is similar to the case of kP systems. 5 Specification Languages In this section a specification language covering the entire model of the kP system will be described in Section 5.1 and a specification language with a different syntax for a subset of the same model will be presented in Section 5.2. 5.1 Specification Language for kP Systems Our Kernel P system research is to be complemented by a set of tools targeting the simulation and trace analysis of various models on the one hand, but also the formal Kernel P Systems 113 verification by means of automated model checking on the other hand. In order to utilise such applications, a formal, unambiguous representation of the model is required. We have attained this objective by designing a modelling language capable of mapping the kernel P system specification into a machine readable representation. We call this language kP–Lingua. There are two principal and naturally opposing precepts which influenced and guided the development of kP–Lingua: 1. Conciseness, simplicity, minimalism: the language must consist of a minimal set of (meta-)descriptive symbols, keywords or constructs, such that it satisfies the necessity for an unambiguous syntax. 2. Clarity, coherence, intelligibility: each statement or sequence of statements must overly express an entity with its associated values or a binding between two or more entities in the model; each proposition should be transparent in its context and intuitive, intelligible in the absence of a reference manual. This proposal stands at the confluence of these orthogonal aspirations and the formal description of the computational model. Since kP systems explicitly apply the type - instance paradigm with respect to compartments, a model definition reflects this distinction in its structure, which is bi-partitioned as follows: 1. Type definitions - encompassing the instruction set, organised in accordance with the type’s associated execution strategy. 2. Instance definitions and interlinking - establish the set of compartments and related connections, assembling the graph-like structure of membranes. A type is declared using the keyword type followed by the name of the type - any combination of alphanumeric characters excluding the restricted keywords. The body of a type declaration consists of a succession of guarded rules or rule ensembles (choice, arbitrary execution and maximal parallel execution blocks) as specified in the type’s execution strategy. A rule is represented as a guarded transition, symbolised by an arrow, between two terms. We illustrate the syntax of a type definition and its constituents with a comprehensive example: Example 4. A type definition in kP–Lingua. type C1 { 2a, 3b -> c . >=2c&>2b:b,c->a. choice { b -> 2b . < 3b : b -> 3b . } max { a -> a, a(C2), {a, 2b}(C3) . 114 M. Gheorghe et al. } 2c -> -(C2) . 2b -> \-(C2) . = 5a : a -> [3a, 3b](C1) [3b](C2) [3a](C3) . } In this example we define type C1 with the following sequence of rules: a rewriting rule which takes two aobjects and three bobjects and produces a c; a guarded rewriting rule which yields an object aif and only if there are at least two c’s and more than two b’s in the compartment the rule is applied on; next we have a choice block with two rewriting rules of which one is guarded, followed by a maximally parallel block where the rewrite communication rule is exhaustively executed, producing an object ainside the membrane and sending an object ato compartments of type C2, one aand two b’s to membranes of type C3 respectively; next, a link creation rule expends two cobjects to establish a new connection with an instance of type C2; conversely, the following rule breaks a link with a compartment of type C2, using two b’s; finally, a guarded membrane division rule takes one object a and divides the compartment into three distinct compartments of types C1,C2,C3 respectively, if the number of a’s in the membrane is precisely five. The newly created cells are initialised with the a copy of the multiset contained in the divisible compartment, however, one ais substituted with the multiset denoted by the value enclosed in the square brackets. In kP–Lingua every statement terminates with a full stop and, similar to other programming languages, each block which groups a set of statements together is enclosed in curly braces. An instance is declared as a typed multiset which also designates the initial configuration of the compartment. Hence, a membrane of type C1 containing two aand three bobjects is encoded as {2a, 3b}(C1). We underline our choice of a consistent notation both for type references and multiset values across different declarative contexts. A variable is considered to be a type variable if it is enveloped by parentheses. Any other identifier within the scope of a type definition is interpreted as an object and is prefixed by its multiplicity (if greater than one). Membrane instances may also bear an identifier, a variable name nominating a specific compartment in a ‘link’ statement. We further illustrate instantiation and binding in Example 5. Example 5. Instantiation and interlinking of compartments expressed in kP–Lingua. m1 {a, b, 3c} (C1). m2 {10 xx, 10 xy} (C2). m1 - m2 . m2 - m3 {} (C2) - {5 xx, 5 xy} (C2) - {m, 2n} (C3) . m1 - m3 . In the first line, compartment m1 of type C1 is declared, with an initial multiset consisting of an a, a band three cobjects. m2 of type C2 is defined analogous. The Kernel P Systems 115 third statement is a ‘link’ instruction, connecting the two previously instantiated compartments. In kernel P systems links are bidirectional and consequently, the connect binary operator (-) is neutral to the order of its arguments. This, however, becomes relevant when we consider a succession of contiguous vertices in our graph of compartments. Line four emphasises a more condensed way to link instances together: the first one is a reference to compartment m2 which connects to a new compartment of type C2 with an empty multiset and label m3; this is further joined with an anonymous membrane of type C2 and finally, a second unlabelled instance of type C3. The last line of the example connects m1 with m3, demonstrating the necessity for identifiers and referencing when organising instances in a non-linear structure (i.e., one that is more complex than a list). We conclude this section by noting the two remaining elements which are not featured in the examples, namely membrane dissolution, symbolised by ‘#’ and the arbitrary execution block respectively. We also acknowledge the expressive power of kP–Lingua whose syntax can intuitively represent a kernel P system model with its plethora of components, using no more than four keywords (type, choice,arbitrary,max), five delimiters ((),{},[],:and .), eight relational operators (=,!=,<,<=,>,>=,&,|) and four meta-symbols (->,-,\-,#) to identify an instruction. A complete EBNF formal description of kP–Lingua’s syntax is available in the Appendix. 5.2 Specification Language for a Subset of kP Systems The previous section has described in detail the specification language for kernel P systems (kP systems). However, a previous specification language was provided to specify and simulate simple kernel P systems (skP systems), a simpler version not taking into account some of the detailed current features of this model of computation. The next subsections describe the syntax, the methodology and the software environment provided with this alternative simpler model, illustrating the process of specification and simulation through a case study, the NP-complete Partition problem. P–Lingua structures The following structures, including kP–related features, have been added into P– Lingua version 4, which will be shortly available [16]. The current version of P– Lingua describes simple kP systems, a subset of kP systems [11]. Thus, it does not support link creation rules, link destruction rules nor execution strategies (only maximal parallelism). These features might be incorporated in future releases. Guards: A guard gdenoting a relational expression #a(w)γn (see Section 3) is represented as {γ0a∗n}, where γ0is a representation of γsuch as <(for <),<= (for ≤),=(for =),<> (for 6=),>= (for ≥) and >(for >). As illustrative examples, {<=c*2}represents the guard denoting #c(w)≤2, whereas{>=b}represents #b(w)≥1. As described in Section 4, guards denoting relational expressions (namely relational guards) can be used in Boolean expressions (namely 116 M. Gheorghe et al. Boolean guards). Boolean operators involved in Boolean expressions, ∧and ∨, are represented as && and ||, respectively. For instance, {<=a*2}&&{<=b} represents the guard {≤ a2∧ ≤ b}. Similarly, {<=a*2}||{<=b}represents the guard {≤ a2∨ ≤ b}.∧and ∨operators can be combined to describe complex guards, such as {<=a*2}&&{<=b}||{<=a*3}&&{<=c*3}. A rule r{g}is defined as @guard g?r. For instance, rule a→b{=a2}is defined as @guard {=a*2}? [a --> b]. Membrane initialisation: Membrane initialisation enables users to define membranes in the initial configuration. According to the membrane structure of the system defined, the syntax for membrane differs. In this respect, mu(label1)+=[multiset]’label2; is used for cell–like membrane structures (i.e, those of PDP systems [7]), whereas mu(0)*=[multiset]’label; is used for tissue–like membrane structures, such as those of kernel P systems. The former instruction adds a new membrane labelled label2with associated multiset multiset as a child of membrane label1, whereas the latter adds a new membrane labelled label with associated multiset multiset to the initial configuration. New rules: In order to define the currently supported subset of kernel P systems, some rules defined in Section 6 have been incorporated, which are: Rewriting and communication rules: A rewriting and communication rule x→ y{g}, where x∈A+and y, has the form y= (a1, t1). . . (ah, th), h≥0, aj∈Aand tjindicates a compartment type from T, is represented as @guard g? [x]’t0--> [a1]’t1, ..., [ah]’th, with t0being the current compartment. In contrast to the definition given in Section 6, the P–Lingua implementation of these rules does not require t0to be linked to every compartment ti,1≤i≤h. Structure changing rules: A structure changing rule [x]tli→[y1]ti1. . . [yp]tip{g}, where x∈A+and yjhas the form yj= (aj,1, tj,1). . . (aj,hj, tj,hj) like in rewriting and communication rules, is represented in P–Lingua as @guard g? [x]’tli|--> [y1]’ti1, ..., [yp]’tip;. If any yj,1≤j≤pcontains the special symbol @d, then membrane tijis dissolved. These rules can be used in conjunction with membrane internal iterators (see below), resulting in arbitrary division and relabelling rules such as [a]’1 |--> [b]’2 &{[c,d{i}]’{i}}:{3<=i<=n};. Kernel P Systems 117 Internal iterators: These iterators enable users to define arbitrary, parameter– dependent multisets, membrane structures and guards. These iterators expand the possibilities for defining rules and initial configurations. The syntax for internal iterators is &{items}:{index ranges}, except for ∨–joined guards, which is |{items}:{index ranges}. Unless otherwise stated, different internal iterators can be combined in the same rule or sentence, but they cannot be nested. Internal iterators can be used within three contexts: Multiset internal iterators: The syntax for these iterators is &{multiset}:{index ranges}. These iterators allow the extension of multisets in rule definitions. For instance, given a value for nand a set of values for ei,1≤i≤n, the rules [a→b, ci, dei i,1≤i≤n]1are represented as [a --> b, &{c{i}, d{i}*e{i}}:{1<=i<=n}’1;. Membrane internal iterators: The syntax for these iterators is &{[multiset]’{label}}:{index ranges}. These iterators allow to specify communications to various compartments occurring on the right–hand side of the rules only. The left–hand side communication cannot be specified by using this mechanism. For instance, given a value for nand values for ei,1≤i≤n, rewriting and communication rules x→(aei i, ti),1≤i≤n, where x, ai∈A, 1≤i≤nand tjindicates a compartment type from T, are represented as [x]’t0--> &{[a{i}*e{i}]’{i}}:{1<=i<=n};, with t0being the current compartment. Guard internal iterators: These iterators are a special case, as they have two possible syntaxes, according to the Boolean operators involved. These forms are &{guard}:{index ranges}|{guard}:{index ranges}. The construct guards joined by ∧operators (∧–joined guards), whilst the latter uses ∨operators (∨–joined guards). In addition, they are the only internal iterators which can be nested, in the form of an ∧–joined guard inside an ∨–joined guard. On the other hand, ∨–joined guards cannot be defined into ∧–joined guards. As an example, given a value for nand a value for m, @guard |{{&{{<=B{i,j}*2}}:{1<=j<=m}}}:{1<=i<=n}? [a-->b]’1; can be applied iff, prior to the application of the rule, there exists at least one value i, 1≤i≤n, such that the cardinality of each object Bi,j,1≤j≤m, in membrane 1, is greater than or equal to 2. There are some constraints regarding indexes in internal iterators; they cannot be part of numerical expressions (such as &{a{i+1}}:{1 <= i <= 10}) nor be used as indexes for constants (such as &{a{g{i}}}:{1 <= i <= 10}). In addition, names used for indexes in any internal iterator cannot be used anywhere else, including another internal iterator. 118 M. Gheorghe et al. A Case Study - Partition Problem In the previous section we have introduced the subset of kP systems which is included in P–Lingua platform, as well as the main features of the software tool. This section describes a case study to be modelled and simulated, as explained in the next section. The problem we will focus on is the well-known NP-complete problem called the partition problem. This is formulated as follows: let Vbe a finite set and weight, an additive function on Vwith positive integer values. It is requested to find, if exists, a partition of V, denoted V1,V2, such that weight(V1) = weight(V2). A solution to this problem is provided in [9] by using a recogniser tissue P system with cell division and symport/antiport rules. In this case study we adapt the solution to skP systems. Let V={v1, . . . , vn}be a finite set with weight(vi) = ki, where kiis a positive integer, 1 ≤i≤n. The following skP system is built, depending on n(the number of elements in the set), in order to check whether there is a partition, V1,V2, with weight(V1) = weight(V2) = k(please note we also check that the weights of both subsets are k). The set of component types, T={t1, t2},ti= (Ri, σi),1≤i≤2. R1and R2are given as follows: •R1contains r1,1:S→(yes, 0) {≥ T}, r1,2:S→(no, 0) {≥ F∧< T}; r1,1or r1,2sends an answer yes or no, respectively, to the environment; •R2contains membrane division rules: r2,i : [Ai]2→[BiAi+1]2[Ai+1]2,1≤i<n, r2,n : [An]2→[BnX]2[X]2,1≤i<n; these rules generate in nsteps all the subsets of V(2nsubsets); each of them being a potential V1and V2its complement; rewriting rules: r2,i,j :vivj→v{=Bi∧ 6=Bj∧=X∨ 6=Bi∧=Bj∧=X}, 1≤i<j≤n, r2,n+1 :X→Y; and rewriting and communication rules: r2,n+2 :Y→(F, 1) {≥ v1∨. . . ∨ ≥ vn∨ 6=vk}, r2,n+3 :Y→(T, 1) {< v1∧. . . ∧< vn∧=vk}. The execution strategies are given by σi=Lab(Ri)>,1≤i≤2,i.e., maximal parallelism. The skP system is given by skΠ3(n) = (A, µ, C1, C2,0),where: •Ais the alphabet; •µis given by the graph with edge (1,2); •C1= (t1, w1,0), C2= (t2, w2,0), where w1,0=S,w2,0=A1code(n), with code(n) = v1k1. . . vnknbeing the code of the weights of the elements in V, and being k, half the sum of the kivalues. Kernel P Systems 119 The computation leads to an answer, yes or no, in n+3 steps. In fact, in nsteps all the subsets of Vare generated, as it can be observed above. In step n+1, in each compartment C2every occurrence of an element viof the subset of Vis paired up with an element vjof the complement as many times as the weights allow to, by using r2,i,j as many times as possible; objects Xare simultaneously transformed into objects Y. The step n+ 2 consists of sending either Tor Fto compartment C1depending on whether all the elements of the subset and their complements are paired up and the number of pairs is k(i.e., the weight of the partition), or the weights of the subsets are different or are not equal to k(rules r2,n+3 and r2,n+2 are respectively used). Finally, in step n+ 3 the answer is provided by using one of the rules of C1. This solution might be easily changed to only verify that weight(V1) = weight(V2), by simply removing the condition referred to vkin guards attached to rules r2,n+2 and r2n+3. skP Systems Simulation The previous sections have introduced some background details about P– Lingua specification language and its new features with regard to skP systems, along with the description of a case study, the Partition problem, modelled within this approach. This section has the aim of outlining the basic facts concerning the simulation environment to work with the above presented model. An integrated methodology for modelling, simulation, analysis and formal verification of skP systems was first presented in [11]. This methodology was supported by the software environment provided by MeCoSim and P–Lingua. P–Lingua provides the P systems designer with a powerful and expressive language to specify skP systems or families of them, possibly including variable parameters whose values depend on the specific instance of the skP system to be generated, such as nfor the size of the input set. MeCoSim provides a customisable and extensible visual environment to enable the end user interacting with the P system model implementation. The user provides the input data by custom visual tables, and then runs the simulations (by using the simulation engine of pLinguaCore, that includes simulators for skP systems). Finally, custom visual outputs are generated in the form of tables, charts and/or graphs. The cited methodology has been applied to our case study, that is, partition problem. The described model has been specified in P–Lingua format, having n and the weights in code(n) as variable parameters, depending on the specific set to analyse. P–Lingua file and some additional details about the interface and simulation are available at [17]. In addition, a custom application has been defined in MeCoSim, enabling the user entering n,kand the different weights k1to knfor the elements in the input set, as showed in Fig 1. As part of the custom application definition, a mapping is 120 M. Gheorghe et al. set to translate the input data into parameters for the model written in P–Lingua, possibly after performing additional tasks over the input data. This way, when the user introduces the specific input data and clicks Simulate!, the values for the parameters are calculated, the initial configuration is generated, the specific skP system is instantiated, and then the computation runs until a halting configuration is reached. Fig. 1. Input parameters in MeCoSim for Partition After the simulation has finished, the desired custom outputs are provided to the end user from the results of the computation, depending on the required information to be shown. For instance, a skP systems designer might be interested to know the contents of every membrane, or find out the answer, yes or no, to the problem. Both outputs have been set in MeCoSim custom application, as shown in Fig 2. The explained process should be enough to solve the decision problem, but a small additional effort could lead us to provide additional information, such as the elements contained in every specific valid partition, in an automatic way. This additional stuff has been provided by extending the original model with some additional informational objects, and some extra output charts defined for the custom output. The details can be found again in [17], but an example of output chart for a specific partition is shown in Fig. 3. 6 Conclusions The kP system introduced in this work represents a low level modelling language. Its syntax and informal semantics and some examples have been introduced and discussed. A case study based around a simple sorting algorithm has allowed us to compare different specifications of this using various types of P systems. Finally Kernel P Systems 121 Fig. 2. Output tables in MeCoSim for Partition Fig. 3. Partitions Chart in MeCoSim