scieee AI-readable full text Open interactive document viewer

An Overview of P-Lingua 2.0

García Quismondo, Manuel; Gutiérrez Escudero, Rosa; Pérez Hurtado de Mendoza, Ignacio; Pérez Jiménez, Mario de Jesús; Riscos Núñez, Agustín

Abstract

P–Lingua is a programming language for membrane computing which aims to be a standard to define P systems. In order to implement this idea, a Java library called pLinguaCore has been developed as a software framework for cell–like P systems. It is able to handle input files (either in XML or in P–Lingua format) defining P systems from a number of different cell–like P system models. Moreover, the library includes several built–in simulators for each supported model. For the sake of software portability, pLinguaCore can export a P system definition to any convenient output format (currently XML and binary formats are available). This software is not a closed product, but it can be extended to accept new input or output formats and also new models or simulators. The term P–Lingua 2.0 refers to the software package consisting of the above mentioned library together with a user interface called pLinguaPlugin (more details can be found at http://www.p-lingua.org). Finally, in order to illustrate the software, this paper includes an application using pLinguaCore for describing and simulating ecosystems by means of P systems.

Full text

An Overview of P-Lingua 2.0 Manuel Garc´ıa-Quismondo, Rosa Guti´errez-Escudero, Ignacio P´erez-Hurtado, Mario J. P´erez-Jim´enez, Agust´ın Riscos-N´u˜nez Research Group on Natural Computing Department of Computer Science and Artificial Intelligence University of Sevilla Avda. Reina Mercedes s/n, 41012, Sevilla, Spain [email protected], {rgutierrez,perezh,marper,ariscosn}@us.es Summary. P–Lingua is a programming language for membrane computing which aims to be a standard to define P systems. In order to implement this idea, a Java library called pLinguaCore has been developed as a software framework for cell–like P systems. It is able to handle input files (either in XML or in P–Lingua format) defining P systems from a number of different cell–like P system models. Moreover, the library includes several built–in simulators for each supported model. For the sake of software portability, pLinguaCore can export a P system definition to any convenient output format (currently XML and binary formats are available). This software is not a closed product, but it can be extended to accept new input or output formats and also new models or simulators. The term P–Lingua 2.0 refers to the software package consisting of the above mentioned library together with a user interface called pLinguaPlugin (more details can be found at http://www.p-lingua.org). Finally, in order to illustrate the software, this paper includes an application using pLinguaCore for describing and simulating ecosystems by means of P systems. 1 Introduction The initial definition of a membrane system as a computing device, introduced by Gh. P˘aun [14], can be interpreted as a flexible and general framework. Indeed, a large number of different models have been defined and investigated in the area: P systems with symport/antiport rules, with active membranes, with probabilistic rules, etc. There were some attempts to establish a common formalization covering most of the existing models (see e.g. [5]), but the membrane computing community is still using specific syntax and semantics depending on the model they work with. Each model displays characteristic semantic constraints that determine the way in which rules are applied. Hence, the need for software simulators capable of taking into account different scenarios when simulating P system computations comes to the fore. Moreover, simulators have to precisely define the specific P system that is to be simulated. Along this paper, the term simulator input will be used to refer to the definition (on a text file) of the P system to be simulated. One approach to implement the simulators input could be defining a specific input file format for each simulator. Nevertheless, this approach would require a great redundant effort. A second approach could be to standardize the simulator input, so all simulators need to process inputs specified in the same format. These two approaches raise up a trade-off: On the one hand, specific simulator inputs could be defined in a more straightforward way, as the used format is closer to the P system features to simulate. On the other hand, although the latter approach involves analyzing different P systems and models to develop a standard format, there is no need to develop completely a new simulator every time a new P system should be simulated, as it is possible to use a common software library in order to parse the standard input format. Moreover, users would not have to learn a new input format every time they use a different simulator and would not need to change the way to specify P systems which need to be simulated every time they move on to another model, as they would keep on using the standard input format. This second approach is the one considered in P–Lingua project, a programming language whose first version, presented in [3], is able to define P systems within the active membrane P system model with division rules. The authors also provide software tools for compilation, simulation and debug tasks. As P–Lingua is intended to become a standard for P systems definition, it should also consider other models. At the current stage, P–Lingua can define P systems within a number of different cell–like models: active membrane P systems with membrane division rules or membrane creation rules, transition P systems, symport/antiport P systems, stochastic P systems and probabilistic P systems. Each model follows semantics restrictions, which define several constraints for the rules (number of objects on each side, whether membrane creation and/or membrane division are allowed, and so on), and which indicate the way rules are applied on configurations. A Java [22] library called pLinguaCore has been developed as a software framework for cell–like P systems. It includes parsers to handle input files (either in XML or in P–Lingua format), and furthermore the parsers check possible programming errors (both lexical/syntactical and semantical). The library includes several built–in simulators to generate P system computations for the supported models, and it can export several output file formats to represent P systems (at the current stage, XML and binary file formats) in order to get interoperability between different software environments. The term P–Lingua 2.0 refers to the software framework under GNU GPL license [21] consisting of the above mentioned library together with a user interface called pLinguaPlugin. It is not a closed software because developers with knowledge of Java can include new components to the library: new supported models, built–in simulators for the supported models, parsers to process new input file formats and generators for new output file formats. In order to facilitate those tasks, a website for users and developers of P–Lingua 2.0 [24] has been created. It contains technical information about standard programming methods to expand the pLinguaCore library. These methods have been used on all the existent components. The website also contains a download section, tutorials, user manuals, information about projects using P–Lingua, and other useful stuff. Furthermore, pLinguaCore is not a stand–alone product, it is created to be used inside other software applications. In order to illustrate this idea, the paper includes an application using pLinguaCore for describing and simulating ecosystems by means of P systems. 2 Models 2.1 Contemplating New models The library pLinguaCore is able to accept input files (either in P–Lingua or XML file formats) that define P systems within the supported models. As mentioned in the Introduction, Java developers can include new models to the library by using standard programming methods, easing the task. The current supported models are enumerated below. 2.2 Transition P system model The basic P systems were introduced in [14] by Gh. P˘aun. Atransition P system of degree q≥1 is a tuple of the form Π= (Γ, L, µ, M1, . . . , Mq,(R1, ρ1), . . . , (Rq, ρq), io),where: •Γis an alphabet whose elements are called objects. •Lis a finite set of labels. •µis a membrane structure consisting of qmembranes with the membranes (and hence the regions, the space between a membrane and the immediately inner membranes, if any) injectively labelled with elements of L; as usual, we represent the membrane structures by strings of matching labelled parentheses. • Mi, 1 ≤i≤q, are strings which represent multisets over Γassociated with the qmembranes of µ. •Ri, 1 ≤i≤q, are finite sets of evolution rules over Γ, associated with the membranes of µ. An evolution rule is of the form u→v, where uis a string over Γand v=v0or v=v0δ, being v0a string over Γ×({here, out} ∪ {inj: 1≤j≤q}). •ρi, 1 ≤i≤q, are strict partial orders over Ri. •io, 1 ≤io≤q, is the label of an elementary membrane (the output membrane). The objects to evolve in a step and the rules by which they evolve are chosen in a non–deterministic manner, but in such a way that in each region we have a maximally parallel application of rules. This means that we assign objects to rules, non–deterministically choosing the rules and the objects assigned to each rule, but in such a way that after this assignation no further rule can be applied to the remaining objects. 2.3 Symport/antiport P system model Symport/antiport rules were incorporated in the framework of P systems in [13]. AP system with symport/antiport rules of degree q≥1 is a tuple of the form Π= (Γ, L, µ, M1, . . . , Mq, E, R1, . . . , Rq, io),where: •Γis the alphabet of objects, •Lis the finite set of labels for membranes (in general, one uses natural numbers as labels), µis the membrane structure (of degree q≥1), with the membranes labelled in a one-to-one manner with elements of L, • M1, . . . , Mqare strings over Γrepresenting the multisets of objects present in the qcompartments of µin the initial configuration of the system. •E⊆Γis the set of objects supposed to appear in the environment in arbitrarily many copies. •Ri, 1 ≤i≤q, are finite sets of rules associated with the qmembranes of µ. The rules can be of two types (by Γ+we denote the set of all non-empty strings over Γ, with λdenoting the empty string): –Symport rules, of the form (x, in) or (x, out), where x∈Γ+. When using such a rule, the objects specified by xenter or exit, respectively, the membrane with which the rule is associated. In this way, objects are sent to or imported from the surrounding region – which is the environment in the case of the skin membrane. –Antiport rules, of the form (x, out;y, in), where x, y ∈Γ+. When using such a rule for a membrane i, the objects specified by xexit the membrane and those specified by yenter from the region surrounding membrane i; this is the environment in the case of the skin membrane. •io∈Lis the label of a membrane of µ, which indicates the output region of the system. The rules are used in the non-deterministic maximally parallel manner, standard in membrane computing. 2.4 Active membranes P system model With membrane division rules P systems with membrane division were introduced in [15], and in this model the number of membranes can increase exponentially in polynomial time. Next, we define P systems with active membranes using 2-division for elementary membranes, with polarizations, but without cooperation and without priorities (and without permitting the change of membrane labels by means of any rule). AP system with active membranes using 2-division for elementary membranes of degree q≥1 is a tuple Π= (Γ, L, µ, M1, . . . , Mq, R, io), where: •Γis an alphabet of symbol-objects. •Lis a finite set of labels for membranes. •µis a membrane structure, of mmembranes, labelled (not necessarily in a one-to-one manner) with elements of L. • M1, . . . , Mqare strings over Γ, describing the initial multisets of objects placed in the qregions of µ. •Ris a finite set of rules, of the following forms: (a) [ a→ω]α hfor h∈L,α∈ {+,−,0},a∈Γ,ω∈Γ∗: This is an object evolution rule, associated with a membrane labelled with hand depending on the polarization of that membrane, but not directly involving the membrane. (b) a[ ]α1 h→[b]α2 hfor h∈L,α1, α2∈ {+,−,0},a, b ∈Γ: An object from the region immediately outside a membrane labelled with his introduced in this membrane, possibly transformed into another object, and, simultaneously, the polarization of the membrane can be changed. (c) [ a]α1 h→b[ ]α2 hfor h∈L,α1, α2∈ {+,−,0},a, b ∈Γ: An object is sent out from membrane labelled with hto the region immediately outside, possibly transformed into another object, and, simultaneously, the polarity of the membrane can be changed. (d) [ a]α h→bfor h∈L,α∈ {+,−,0},a, b ∈Γ: A membrane labelled with his dissolved in reaction with an object. The skin is never dissolved. (e) [ a]α1 h→[b]α2 h[c]α3 hfor h∈L,α1, α2, α3∈ {+,−,0},a, b, c ∈Γ: An elementary membrane can be divided into two membranes with the same label, possibly transforming some objects and the polarities. •io∈Lis the label of a membrane of µ, which indicates the output region of the system. These rules are applied according to the following principles: •All the rules are applied in parallel and in a maximal manner. In one step, one object of a membrane can be used by only one rule (chosen in a nondeterministic way), but any object which can evolve by one rule of any form, must do it (with the restrictions below indicated). •If a membrane is dissolved, its content (multiset and internal membranes) is left free in the surrounding region. •If at the same time a membrane labelled by his divided by a rule of type (e) and there are objects in this membrane which evolve by means of rules of type (a), then we suppose that the evolution rules of type (a) are used before division is produced. Of course, this process takes only one step. •The rules associated with membranes labelled by hare used for all copies of this membrane. At one step, a membrane can be the subject of only one rule of types (b)-(e). With membrane creation rules Membrane creation rules were first considered in [9], [10]. AP system with membrane creation of degree q≥1 is a tuple of the form Π= (Γ, L, µ, M1, . . . , Mq, R, io),where: •Γis the alphabet of objects. •Lis a finite set of labels for membranes. •µis a membrane structure consisting of qmembranes labelled (not necessarily in a one-to-one manner) with elements of L. • M1, . . . , Mqare strings over Γ, describing the initial multisets of objects placed in the qregions of µ. •Ris a finite set of rules of the following forms: (a) [a→v]hwhere h∈L,a∈Γ, and vis a string over Γdescribing a multiset of objects. These are object evolution rules associated with membranes and depending only on the label of the membrane. (b) a[ ]h→[b]hwhere h∈L,a, b ∈Γ. These are send-in communication rules. An object is introduced in the membrane possibly modified. (c) [a]h→[ ]hbwhere h∈L,a, b ∈Γ. These are send-out communication rules. An object is sent out of the membrane possibly modified. (d) [a]h→bwhere h∈L,a, b ∈Γ. These are dissolution rules. In reaction with an object, a membrane is dissolved, while the object specified in the rule can be modified. (e) [a→[v]h2]h1where h1, h2∈L,a∈Γ, and vis a string over Γdescribing a multiset of objects. These are creation rules. In reaction with an object, a new membrane is created. This new membrane is placed inside the membrane of the object which triggers the rule and has associated an initial multiset and a label. •io∈Lis the label of a membrane of µ, which indicates the output region of the system. Rules are applied according to the following principles: •Rules from (a) to (d) are used as usual in the framework of membrane computing, that is, in a maximally parallel way. In one step, each object in a membrane can only be used for applying one rule (non-deterministically chosen when there are several possibilities), but any object which can evolve by a rule of any form must do it (with the restrictions below indicated). •Rules of type (e) are used also in a maximally parallel way. Each object ain a membrane labelled with h1produces a new membrane with label h2placing in it the multiset of objects described by the string v. •If a membrane is dissolved, its content (multiset and interior membranes) becomes part of the immediately external one. The skin membrane is never dissolved. •All the elements which are not involved in any of the operations to be applied remain unchanged. •The rules associated with the label hare used for all membranes with this label, independently of whether or not the membrane is an initial one or it was obtained by creation. •Several rules can be applied to different objects in the same membrane simultaneously. The exception are the rules of type (d) since a membrane can be dissolved only once. 2.5 Probabilistic P system model A probabilistic approach in the framework of P systems was first considered by A. Obtulowicz in [12]. Aprobabilistic P system of degree q≥1 is a tuple Π= (Γ, µ, M1, . . . , Mq, R, {cr}r∈R, io),where: •Γis the alphabet (finite and nonempty) of objects (the working alphabet). •µis a membrane structure, consisting of qmembranes, labeled 1,2, . . . , q. The skin membrane is labeled by 0. We also associate electrical charges with membranes from the set {0,+,−}, neutral and positive. • M1, . . . , Mqare strings over Γ, describing the multisets of objects initially placed in the qregions of µ. •Ris a finite set of evolution rules. An evolution rule associated with the membrane labelled by iis of the form r:u[v]α i cr −→ u0[v0]β i, where u, v, u0, v0are a multiset over Γ,α, β ∈ {0,+,−} and cris a real number between 0 and 1 associated with the rule such that: – for each u, v ∈M(Γ), h∈Hand α∈ {0,+}, if r1, . . . , rtare the rules whose left–hand side is u[v]α h, then Pt j=1 crj= 1 •io∈Lis the label of a membrane of µ, which indicates the output region of the system. We assume that a global clock exists, marking the time for the whole system (for all compartments of the system); that is, all membranes and the application of all rules are synchronized. The q-tuple of multisets of objects present at any moment in the qregions of the system constitutes the configuration of the system at that moment. The tuple (M1, . . . , Mq) is the initial configuration of the system. We can pass from one configuration to another one by using the rules from R as follows: at each transition step, the rules to be applied are selected according to the probabilities assigned to them, all applicable rules are simultaneously applied, and all occurrences of the left–hand side of the rules are consumed, as usual. Rules with the same left–hand side and whose right–hand side has the same polarization can be applied simultaneously. 2.6 Stochastic P System model The original motivation of P systems was not to provide a comprehensive and accurate model of the living cell, but to imitate the computational nature of operations that take place in cell membranes. Most P system models have been proved to be Turing complete and computationally efficient, in the sense that they can solve computationally hard problems in polynomial time, by trading time for space. Most research in P systems focus on complexity classes and computational power. However, P systems have been used recently to model biological phenomena very successfully. Models of oscillatory systems [4], signal transduction [18], gene regulation control [16], quorum sensing [17] and metapopulations [19] have been presented. We introduce in this section the specification of stochastic P systems, that constitute the framework for modelling biological phenomena. Astochastic P system of degree q≥1 is a tuple Π= (Γ, L, µ, M1, . . . , Mq, Rl1, . . . , Rlm),where: •Γis a finite alphabet of symbols representing objects. •L={l1, . . . , lm}is a finite alphabet of symbols representing labels for the membranes. •µis a membrane structure containing q≥1 membranes identified in a one to one manner with values in {1, . . . , q}and labelled with elements from L. •Mi= (li, wi, si), for each 1 ≤i≤q, initial configuration of the membrane i, li∈Lis the label, wi∈Γ∗is a finite multiset of objects and siis a finite set of strings over Γ. •Rlt={rlt 1, . . . , rlt klt}, for each 1 ≤t≤m, is a finite set of rewriting rules associated with membranes of label lt∈L. Rules are of one of the following two forms: – Multiset rewriting rules: rlt j:u[w]l clt j −→ u0[w0]l with u, w, u0, w0∈Γ∗some finite multisets of objects and la label from L. A multiset of objects, uis represented as u=a1+· · ·+am, with a1, . . . , am∈ Γ. The empty multiset will be denoted by λand we will write oninstead of n z }| { o+· · · +o. The multiset uplaced outside of the membrane labelled with land the multiset wplaced inside of that membrane are simultaneously replaced with a multiset u0and w0respectively. – String rewriting rules: rlt j: [u1+s1;. . . ;up+sp]l clt j −→ [u0 1+s0 1,1+· · ·+s0 1,i1;. . . ;u0 p+s0 p,1+· · ·+s0 p,ip] A string s is represented as s = ho1.o2. · · · .oj i, where o1, o2, . . . , oj ∈ Γ . Each multiset of objects uj and string sj , 1 ≤ j ≤ p, are replaced by a multiset of objects u0 j and strings s0 j,1, . . . , sj,ij . A constant clt jis associated with each rule and will be referred to as stochastic constant and is needed to calculate the propensity of the rule according to the current context of the membrane to which this rule corresponds. Rules in stochastic P systems model biochemical reactions. The propensity aj of a reaction Rjis defined so that ajdt represents the probability that Rjwill occur in the infinitesimal time interval [t, t +dt] [7]. Applications of the rules and the semantics of stochastic P systems can vary, depending on which algorithm is used to simulate the model. At the present stage, two algorithms have been implemented and integrated as simulators within the pLinguaCore library. They will be discussed in Section 3.2. 3 Simulators 3.1 Contemplating new simulators In [3], only one simulator was implemented, since there was only one model to simulate. However, as new models have been included, new simulators have been developed inside the pLinguaCore library, providing at least one simulator for each supported model. All the current simulators can step backwards, but this option should be set before the simulation starts. The library also takes into account the existence of different simulation algorithms for the same model and provides means for selecting a simulator among the ones which are suitable to simulate the P system, by checking its model. Next, simulation algorithms for Stochastic and Probabilistic P systems are explained, but pLinguaCore integrates simulators for all supported models. 3.2 Simulators for Stochastic P Systems In the original approach to membrane computing P systems evolve in a nondeterministic and maximally parallel manner (that is, all the objects in every membrane that can evolve by a rule must do it [14]). When trying to simulate biological phenomena, like living cells, the classical non-deterministic and maximally parallel approach is not valid anymore. First, biochemical reactions, which are modeled by rules, occur at a specific rate (determined by the propensity of the rule), therefore they can not be selected in an arbitrary and non-deterministic way. Second, in the classical approach all time step are equal and this does not represent the time evolution of a real cell system. The strategies to replace the original approach are based on Gillespie’s Theory of Stochastic Kinetics [7]. As mentioned in Section 2.6, a constant clt jis associated Modules definition Similarities between various solutions to NP-complete numerical problems by using families of recognizing P systems are discussed in [8]. Also, a cellular programming language is proposed based on libraries of subroutines. Using these ideas, a P-Lingua program consists of a set of programming modules that can be used more times by the same, or other, programs. The syntax to define a module is the following. def module_name(param1,..., paramN) { sentence0; sentence1; ... sentenceM; } The name of a module, module name, must be a valid and unique identifier. The parameters must be valid identifiers and cannot appear repeated. It is possible to define a module without parameters. Parameters have a numerical value that is assigned at the module call (see below). All programs written in P-Lingua must contain a main module without parameters. The compiler will look for it when generating the output file. In P-Lingua there are sentences to define the membrane structure of a P system, to specify multisets, to define rules, to define variables and to call to other modules. Next, let us see how such sentences are written. Module calls In P-Lingua, modules are executed by using calls. The format of an sentence that calls a module for some specific values of its parameters is given next: call module name(value1, ..., valueN); where valueiis a numeric expression or a variable. Definition of the initial membrane structure of a P system In order to define the initial membrane structure of a P system, the following sentence must be written: @mu = expr; where expr is a sequence of matching square brackets representing the membrane structure, including some identifiers that specify the label and the electrical charge of each membrane. Examples: 1. [[ ]0 2]0 1≡@mu =[[]’2]’1 2. [[ ]0 b[ ]− c]+ a≡@mu =+[[]’b, -[]’c]’a Definition of multisets The next sentence defines the initial multiset associated to the membrane labelled by label. @ms(label) = list of objects; where label is a membrane label and list of objects is a comma-separated list of objects. The character #is used to represent an empty multiset. If a stochastic P system is being defined (that is, the file starts with @model<stochastic>), strings are also permitted in the initial content of a membrane: @ms(label) = list of objects and strings; list of objects and strings is a comma-separated list of objects and/or strings. Union of multisets P-Lingua allows to define the union of two multisets (recall that the input multiset is “added” to the initial multiset of the input membrane) by using a sentence with the following format. @ms(label) += list of objects; For stochastic P systems, it would be @ms(label) += list of objects and strings; Definition of rules The definition of rules has been significantly extended in this version of P- Lingua. A general rule is defined as follow (most elements are optional): u[v[w1]α1 h1. . . [wn]αn hn]α h k −→ x[y[z1]β1 h1. . . [zn]βn hn]β h[s]γ h where u, v, w1, . . . , wn, x, y, z1, . . . , znare multisets of objects or strings, h, h1, . . . , hnare labels, α, α1, . . . , αn, β, β1, . . . , βn, γ are electrical charges and k is a numerical value. The P-Lingua sintax for such a rule is: uα[vα1[w1]’h1. . . αn[wN]’hN]’h --> xβ[yβ1[z1]’h1. . . βn[zN]’hN]’h γ[s]’h :: k where u, v, w1. . . wN, x, y, z1. . . zN, s are comma-separated list of objects or strings (it is possible to use the character #in order to represent the empty multiset), h,h1,..., hN are labels, α, α1, . . . , αn, β, β1, . . . , βn, γ are identifiers for electrical charges and kis a numeric expression. As mentioned before, not each type of rule is permitted in every model. Below we enumerate the possible types of rules, classified by the model in which they are allowed. @model<mebrane division> 1. The format to define evolution rules of type [a→v]α his given next: α[a --> v]’h 2. The format to define send-in communication rules of type a[ ]α h→[b]β his given next: aα[]’h -->β[b] 3. The format to define send-out communication rules of type [a]α h→b[ ]β his given next: α[a]’h --> β[]b 4. The format to define division rules of type [a]α h→[b]β h[c]γ his given next: α[a]’h -->β[b]γ[c] 5. The format to define dissolution rules of type [a]α h→bis given next: α[a]’h --> b @model<membrane creation> 1. Rules 1, 2, 3 and 5 of @model<membrane division> can be defined in this model, with the same format. 2. The format to define membrane creation rules of type [a]α h→[[b]β h1]α his given next: α[a]’h --> α[β[b]’h1]’h @model<transition psystem> 1. The format to define evolution rules of type [u[u1]h1, . . . , [uN]hN→ v[v1]h1, . . . , [vN]hN, λ]his given next: [u [u1]’h1 . . . [uN]’hN --> v [v1]’h1, . . . [vN]’hN, @d]’h @d is a new keyword representing the containing membrane is marked to dissolved. @model<symport antiport psystem> 1. The format to define symmetric communication rules of type a[b]α h→b[a]α his given next: αa[b]’h --> βb[a]’h @model<probabilistic psystem> 1. The format to define rules of type u[v]α h p −→ u1[v1]β his given next: uα[v]’h --> u1β[v1]’h::p @model<stochastic psystem> 1. The format to define multiset rewriting rules of type u[v]h c −→ u1[v1]his given next: u[v]’h --> u1[v1]’h::c 2. The format to define string rewriting rules of type [u+s]h c −→ [v+r]his given next: [u,s]’h --> [v,r]’h::c •α,βand γare identifiers for electrical charges. •a,band care objects of the alphabet. •u, u1, v, v1, . . . , vN are comma-separated lists of objects that represents a multiset. •sand rare comma-separated lists of substrings. •h,h1, . . . , hN are labels. •pand care real numeric expressions. The result of evaluating pmust be between 0 and 1, and the result of evaluating cmust be greater or equal than 0. Some examples: •[xi,1→r4 i,1]+ 2≡+[x{i,1}--> r{i,1}*4]’2 •dk[ ]0 2→[dk+1]0 2≡d{k}[]’2 --> [d{k+1}] •[dk]+ 2→[]0 2dk≡+[d{k}]’2 --> []d{k} •[dk]0 2→[dk]+ 2[dk]− 2≡[d{k}]’2 --> +[d{k}]-[d{k}] •[a]− 2→b≡-[a]’2 --> b •Yi,j[]2 ki,8 −→ [Bki,12]2≡Y{i,j}[]’2 --> [B*k{i,12}]’2::k{i,8} •[RNAP+< cap.ω.op >]m c −→ [< cap.ω.RNAP.op >]m≡ [RNAP,<cap.?.op>]’m --> [<cap.?.RNAP.op>]’m::c Parametric sentences In P-Lingua, it is possible to define parametric sentences by using the following format: sentence : range1, ..., rangeN, restriction1, ..., restrictionN; where sentence is a sentence of the language, or a sequence of sentences in brackets, and range1, ..., rangeN is a comma-separated list of ranges with the format: min value <= index <= max value where min value and max value are numeric expressions, integer numbers or variables, and index is a variable that can be used in the context of the sentence. It is possible to use the operator <instead of <=. And restriction1, ..., restrictionN are optional restrictions for the indexes values which the next syntax: value1 <> value2 where value1 and value2 are numeric expressions, integer numbers or variables. The sentence will be repeated for each possible values of each index. Some examples of parametric sentences: 1. [dk]0 2→[dk]+ 2[dk]− 2: 1 ≤k≤n≡ [d{k}]’2 --> +[d{k}]-[d{k}] : 1<= k <= n; 2. [xi,j →xi,j−1]+ 2: 1 ≤i≤m, 2≤j≤n, i 6=j≡ +[x{i,j}--> x{i,j-1}]’2 : 1<=i<=m,2<=j<=n,i<>j; Inclusion of comments The programs in P-Lingua can be commented by writing phrases into the text strings /* and */.Inclusion of debug information Each rule sentence can optionally include a debug message which will be presented every time the rule is executed by the simulator. The syntax to write a debug message associated to a rule definition is defined as follows: rule definition @debug ‘‘debug message" 5 Command-line tools P-Lingua 1.0 provided command-line tools for simulating P systems and compiling files which specify P systems [3]. In P-Lingua 2.0, the command-line tool general syntax has changed but, as it provides backwards compatibility, all valid actions in P-Lingua 1.0 are still valid in P-Lingua 2.0, as well. 5.1 Compilation command-line tool The command-line tool general syntax for compiling input files is defined as follows: plingua [-input format] input file [-output format] output file [-v verbosity level] [-h] The command header plingua reports the system to compile the P system specified on a file to a file specified on another, whereas the file input file contains the program that we want to be compiled, and output file is the name of the file that is generated [3]. Optional arguments are in square brackets: •The option -input format defines the format followed by input file, which should be an input format. •At this stage, valid input formats are: –P-Lingua –XML •If no input format is set, the P-Lingua format is assumed. •The option -output format defines the format followed by output file, which should be an output format. •At this stage, valid output formats are: –XML –bin •If no input format is set, the XML format is assumed by default. •The option -v verbosity level is a number between 0 and 5 indicating the level of detail of the messages shown during the compilation process [3]. •The option -h displays some help information [3]. 5.2 Simulation command-line tool The simulations are launched from the command line as follows: plingua sim [-input format] input file -o output file [-v verbosity level] [-h] [-to timeout] [-st steps] [-mode simulatorID] [-a] [-b] The command header plingua sim reports the system to simulate the P system specified on a file, whereas input xml is an XML document where a P system is formatted on, and output file is the name of the file where the report about the simulated computation will be saved [3]. Optional arguments are in brackets: •The option -input format defines the format followed by input file, which should be an input format. •The option -v verbosity level is a number between 0 and 5 indicating the level of detail of the messages shown during the compilation process [3]. If no value is specified, by default it is 3. •The option -h displays some help information [3]. •The option -to sets a timeout for the simulation defined in timeout (in milliseconds), so when the time out has elapsed the simulation is halted. If the simulation has reached a halting configuration before the time out has elapsed this option has no effect. •The option -st sets a maximum number of steps the simulation can take (defined in steps), so when the time out has elapsed the simulation comes to a halt. If the simulation has reached a halting configuration or the time out has elapsed (in case the option -to is set) before the specified number of steps have been taken this option has no effect. •The option -mode sets the specific simulator to simulate the P system (defined in simulatorID). This option reports an error in case the simulator defined by simulatorID is not a valid simulator for the P system model. •The option -a defines if the simulation can take alternative steps. This option reports an error if the simulator does not support alternative steps. •The option -b defines if the simulation can step backwards. As every simulator supports stepping backwards, this option does not report errors. 6 pLinguaCore pLinguaCore c is a JAVA library which performs all functions supported by P- Lingua 2.0, that is, models definition, simulators and formats. This library reports the rules and membrane structure read from a file where a P system is defined, detects errors in the file, reports them. And, if the P system is defined in P-Lingua language, locates the error on the file. This library performs simulations by using the simulators implemented as well as taking into account all options defined. It reports the simulation process, by displaying the current configuration as text and reporting the elapsed time. Eventually, this library translates files, which define a P system, between formats, for instance, from P-Lingua language format to binary format. For more information and library documentation, please browse the P-Lingua website [24]. This library is free software published under GNU GPL license [21], so everyone who is interested can change and distribute this library respecting the license conditions. 7 A tool for simulating ecosystems based on P-Lingua The Bearded Vulture (Gypaetus barbatus) is an endangered species in Europe that feeds almost exclusively on bone remains of wild and domestic ungulates. In [1], it is presented a first model of an ecosystem related to the Bearded Vulture in the Pyrenees (NE Spain), by using probabilistic P systems where the inherent stochasticity and uncertainty in ecosystems are captured by using probabilistic strategies. In order to validate experimentally the designed P system (see figure 1) the authors have developed a simulator that allows them to analyze the evolution of the ecosystem under different initial conditions. That software application is focused on a particular P system, specifically, the initial model of the ecosystem presented in [1]. With the aim of improving the model, the authors are adding ingredients to it, such as new species and a more complex behaviour for the animals. In this sense, a second version of the model is presented in [2]. A new GPL [21] licensed JAVA application with a friendly user-interface sitting on the pLinguaCore library has been developed. This application provides a flexible way to check, validate and improve computational models of ecosystem based on P systems instead of designing new software tools each time new ingredients are added to the models. Furthermore, it is possible to change the initial parameters of the modelled ecosystem in order to make the virtual experiments suggested by experts (see figure 2). These experiments will provide results that can be interpreted in terms of hypotheses. Finally, some of these hypotheses will be selected by the experts in order to be checked in real experiments. REAL-LIFE PROCESS (e.g. an ecosystem) DATA Carrying out studies/experimets MODEL VALIDATION VALIDATED MODEL Inspiration Inspiration Run virtual experiments Simulator Fail Success Compare results Fig. 1. Validation proccess VALIDATED MODEL Run virtual experiments Simulator HYPOTHESES FILTER REAL EXPERIMENTS NEW KNOWLEDGE Expert SELECTED HYPOTHESES Suggest virtual experiments Check results Fig. 2. Virtual experimentation 8 Conclusions and future work Creating a programming language to specify P systems is an important task in order to facilitate the development of software applications for membrane computing. In [3], P-Lingua was presented as a programming language to define active membrane P systems with division rules. The present paper extends that language to other models: transition P systems, symport/antiport P systems, active membrane P systems with division or creation rules, probabilistic P systems and stochastic P systems. We have developed a JAVA library (pLinguaCore) that implements several simulators for each mentioned model and defines different formats to encode P systems, like the P-Lingua one or a new binary format. This library can be expanded to define new models, simulators and formats. It is possible to select different algorithms to simulate a P system, for example, there are two different algorithms for stochastic P systems. The library can be used inside other software applications, in this sense, we present a tool for virtual experimentation of ecosystems. An internet website [24] is available to download the applications, libraries and source-code, as well as provide information about the P-Lingua project. In addition, this site aims to be a meeting point for users and developers through the use of web-tools such as forums. The syntax of P-Lingua language is standard enough for specifying several different models of cell–like P systems. However, a new version is necessary in order to specify tissue P systems and this will be aim of a future work. Although P-Lingua 2.0 provides a way to simulate and compile P systems, command-line tools are usually not user-friendly. It means it is not easy and intuitive to use them. For this purpose, a new user interface called pLinguaPlugin has been developed. This one is integrated into the Eclipse platform [23], so it makes the most of Eclipse’s capabilities to provide a framework for translating, developing and testing P systems. It aims to be user-friendly and useful for P system researchers. Acknowledgement The authors acknowledge the support of the project TIN2006–13425 of the Ministerio de Educaci´on y Ciencia of Spain, cofinanced by FEDER funds, and the support of the “Proyecto de Excelencia con Investigador de Reconocida Val´ıa” of the Junta de Andaluc´ıa under grant TIC04200. References 1. M. Cardona, M.A. Colomer, M.J. P´erez–Jim´enez, D. Sanuy and A. Margalida. Modeling Ecosystems Using P Systems: The Bearded Vulture, a Case Study. LNCS 5391, 137–156, 2009 2. M. Cardona, M.A. Colomer, A. Margalida, I. P´erez–Hurtado, M.J. P´erez–Jim´enez, D. Sanuy. P System based model of an ecosystem of the Scavenger Birds. In this volume. 3. D. D´ıaz–Pernil, I. P´erez–Hurtado, M.J. P´erez–Jim´enez, A. Riscos–N´u˜nez. A P-lingua programming environment for Membrane Computing, Proceedings of the 9th Workshop on Membrane Computing, 155–172, 2008. 4. F. Fontana, L. Bianco and V. Manca. P Systems and the Modelling fo Biochemical Oscillations, Membrane Computing, Sixth international Workshop, WMC6, Vienna, Austria, LNCS 3850, 199–208, 2005. 5. R. Freund, S. Verlan. A Formal Framework for Static (Tissue) P Systems, LNCS 4860, 271–284, 2007. 6. M.A. Gibson and J. Bruck. Efficient Exact Stochastic Simulation of Chemical Systems with Many Species and Many Channels, J. Phys. Chem., 104, 1876–1889, 2000. 7. D.T. Gillespie. Exact stochastic simulation of coupled chemical reactions, J. Phys. Chem., 81, 2340–2361, 1977. 8. M.A. Guti´errez–Naranjo, M.J. P´erez–Jim´enez, A. Riscos–N´u˜nez. Towards a programming language in cellular computing. LNCS 123, 93–110 2005. 9. M. Ito, C. Mart´ın–Vide, Gh. P˘aun. A characterization of Parikh sets of ET0L languages in terms of P systems. In Words, semigroups and transducers (M- Ito, Gh. P˘aun, S. Yu, eds.), 239–254, Word Scientific, Singapore 2001. 10. M. Madhu, K. Krithivasan. P systems with membrane creation: Universality and efficiency. LNCS 2055, 276–287, 2001. 11. M.A. Mart´ınez–del–Amor, I. P´erez–Hurtado, M.J. P´erez–Jim´enez, J.M. Cecilia, G.D. Guerrero, J.M. Garc´ıa. Simulation of Recognizer P Systems by using Manycore GPUs. In this volume. 12. A. Obtulowicz. Probabilistic P systems. Lecture Notes in Computer Science, 2597, 377–387, 2002. 13. A. P˘aun, Gh. P˘aun. The power of communication: P systems with symport/antiport. New Generation Computing, 20, 3, 295–305, 2002. 14. Gh. P˘aun. Computing with Membranes, Journal of Computer and System Sciences 61(1) 108–143, 2000. 15. Gh. P˘aun. P systems with active membranes. Journal of Automata, Languages and Combinatorics, 6, 1, 75–90, 2001. 16. M.J. P´erez–Jim´enez, F.J. Romero–Campero. Modelling Gene Expression Control using P systems: The Lac Operon, a case study. BioSystems, 91, 438–457, 2008. 17. M.J. P´erez–Jim´enez, F.J. Romero–Campero. A model of the Quorum Sensing System in Vibrio Fischeri using P systems. Artificial Life, 14, 95–109, 2008. 18. M.J. P´erez–Jim´enez, F.J. Romero–Campero. P Systems, a new computational modelling tool for systems biology. Transactions on Computational Systems Biology VI, LNBI, 4220, 176–197, 2006. 19. D. Pescini, D. Besozzi, G. Mauri and C. Zandron. Dynamical probabilistic P systems. International Journal of Foundations of Computer Science, 17(1), 183–195, 2006. 20. F.J. Romero–Campero. P Systems, a Computational Modelling Framework for Systems Biology, Doctoral Thesis, University of Seville, Department of Computer Science and Artificial Intelligence, 2008. 21. The GNU General Public License: http://www.gnu.org/copyleft/gpl.html 22. Java web page: http://www.java.com/ 23. The Eclipse Project: http://www.eclipse.org 24. The P-Lingua website: http://www.p-lingua.org