P-Lingua 2.0: New Features and First Applications
Abstract
P-Lingua is a programming language for membrane computing. It was rst presented in Edinburgh, during the Ninth Workshop on Membrane Computing (WMC9). In this paper, the models, simulators and formats included in P-Lingua in version 2.0 are explained. We focus on the stochastic model, associated simulators and updated features. Finally, we present two new applications based on P-Lingua 2.0: a tool for describing and simulating ecosystems and a framework (currently under development) for P systems design.
Full text
P-Lingua 2.0: New Features and First Applications Manuel Garc´ıa-Quismondo, Rosa Guti´errez-Escudero, Ignacio P´erez-Hurtado, Mario J. P´erez-Jim´enez 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}@us.es Summary. P-Lingua is a programming language for membrane computing. It was first presented in Edinburgh, during the Ninth Workshop on Membrane Computing (WMC9). In this paper, the models, simulators and formats included in P-Lingua in version 2.0 are explained. We focus on the stochastic model, associated simulators and updated features. Finally, we present two new applications based on P-Lingua 2.0: a tool for describing and simulating ecosystems and a framework (currently under development) for P systems design. 1 Introduction Membrane computing (or cellular computing) is a branch of Natural Computing that was introduced by Gh. P˘aun [14]. The main idea is to consider biochemical processes taking place inside living cells from a computational point of view, in a way that provides a new nondeterministic model of computation. The initial definition of this computing paradigm is very flexible, and many different models have been defined and investigated in the area: P systems with symport/antiport rules, with active membranes, with catalysts, with promoters/inhibitors, 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. 1.1 Introduction to P-Lingua When designing software simulators for membrane computing, one has to precisely define the P system that is to be simulated. This task is hard if we need to handle families of P systems where the set of rules, the alphabet, the initial contents
142 M. Garc´ıa-Quismondo et al. and even the membrane structure depend on the value assigned to some initial parameters. Current software applications are usually focused on, and adapted for, particular cases, making it difficult to get interoperability. In [3] it was introduced a programming language, called P-Lingua, whose programmes define active membrane P systems with division rules in a parametric and modular way. In this sense, it is possible to define a family of P systems with the use of parameters. After assigning values to the initial parameters, the compilation tool generates an XML document associated with the corresponding P system from the family, and furthermore it checks possible programming errors (both lexical/syntactical and semantical). Such documents can be integrated into other applications, thus guaranteeing interoperability by using the same P system definition in different software environments. P-Lingua 2.0 is able to define P systems within different models, at this stage: 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 which rules in the model’s P systems should follow (number of objects on each side, if membrane creation and/or membrane division are allowed, and so on) and the way rules are applied on configurations to evolve to other ones. Additional models can be added to the P-Lingua framework, but it is important to say that P-Lingua 2.0 supports only P systems whose configurations have a cell-like structure. P-Lingua 2.0 defines several algorithms (from now on, simulators) to simulate P system configuration computations for each supported model, so every computation on a configuration whose P system belongs to a model can be performed by any simulator defined for the model. P-Lingua 2.0 also supports different formats. For the purpose of this paper, a format is a way of representing P systems on a file. P-Lingua 2.0 supported formats range from XML and P-Lingua language to binary, and it provides a standard mechanism to add new formats, if needed. 1.2 An input standard for simulators Each model displays characteristic semantic constraints entailing the rules applied, such as number of objects specified on the left-hand side, membrane creation, polarization, and so on. Hence, the need for simulators capable of taking into account different scenarios when simulating P system computations comes to the fore. An initial approach could be defining inputs for each simulator specifically, so that it is able to carry out computations. Nevertheless, this approach involves defining new input formats for each simulator, so designing simulators would take a great amount of effort as a new input format needs to be defined for each new developed simulator. A second approach could be standardizing 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
P-Lingua 2.0: New Features and First Applications 143 could be defined in a more straightforward way, as the used format is closer to the P system features to simulate. Besides, the former point of view would spare researchers from analyzing different models and P systems in order to extract common patterns out of them. On the other hand, although the latter approach involves analyzing different P systems and models to develop a standard format, it allows to use common simulators for different P systems. In this way, there is no need to develop a new simulator every time a new P system should be simulated, as it is possible to specify it in the standard input format and simulate computations by using simulators able to process it. Moreover, researches would not have to devise a new input format every time they specify a P system; they would use the standard format instead. In addition, researchers 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 on P-Lingua 2.0. P-Lingua File XML file Binary file Another format Simulator Compiler Simulator Simulator The input Fig. 1. The standard input format 2 Models 2.1 Contemplating new models As mentioned, P-Lingua 1.0 provided support for active membrane P systems with division rules. However, as P-Lingua is intended to become a standard for P systems definition, it should contemplate other models. The supported models so far are enumerated below, but a standard mechanism for defining new models and simulators for each model has been defined on P-Lingua 2.0, easing those tasks. This mechanism has been used on all the existent models and simulators. 2.2 Transition P system model The basic P systems were introduced in [14].
144 M. Garc´ıa-Quismondo et al. 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 labeled with elements of L; as usual, we represent the membrane structures by strings of matching labeled 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 labeled 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.
P-Lingua 2.0: New Features and First Applications 145 •Ri, 1 ≤i≤q, are finite sets of rules associated with the qmembranes of µ. The rules from Rcan 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 2.4.1 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, labeled (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 mregions 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 labeled 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 labeled with his introduced in this membrane, possibly transformed into another object, and, simultaneously, the polarization of the membrane can be changed.
146 M. Garc´ıa-Quismondo et al. (c) [ a]α1 h→b[ ]α2 hfor h∈L,α1, α2∈ {+,−,0},a, b ∈Γ: An object is sent out from membrane labeled 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 labeled 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 their 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. •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 labeled 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, and before division is produced. Of course, this process takes only one step. •The rules associated with membranes labeled 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). 2.4.2 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 labeled (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:
P-Lingua 2.0: New Features and First Applications 147 (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 of 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 labeled 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
148 M. Garc´ıa-Quismondo et al. Π= (Γ, µ, 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 labeled 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.
P-Lingua 2.0: New Features and First Applications 149 We introduce in this section the specification of stochastic P systems, that constitute the framework for modeling 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 labeled 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 labeled 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 sis represented as s=ho1.o2.· · · .oji, where o1, o2, . . . , oj∈Γ. Each multiset of objects ujand string sj, 1 ≤j≤p, are replaced by a multiset of objects u0 jand 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].
156 M. Garc´ıa-Quismondo et al. 4.2.6 Objects The objects of the alphabet of a P system are written using valid identifiers, and the inclusion of sub-indexes is permitted. For example, xi,2n+1 and Y es are written as x{i,2*n+1}and Yes respectively. The multiplicity of an object is represented by using the *operator. For example, x2n+1 iis written as x{i}*(2*n+1). 4.2.7 Strings Strings are enclosed between <and >and made by concatenating valid identifiers with the character ., that is <identifier1. ... .identifierN>. For example, <cap.RNAP.op>. 4.2.8 Substrings Substrings are used in string rewriting rules and the syntax is similar to strings, but it is possible to use the character ?to represent any arbitrary sequence of valid identifiers concatenated by .. The empty sequence is included. For example, <cap.?.NAP.op> is a substring of the string <cap.op.op.op.NAP.op> and of the string <cap.NAP.op>. 4.2.9 Model specification As this programming language supports more than one model, it is necessary to specify in the beginning of the file which is the model of the P system defined. Not each type of rule is allowed in every model, for example, membrane creation rules are not permitted in P systems with symport/antiport rules. The built-in compiler of P-Lingua detects such error. Models are specified by using @model<model name> and at this stage, the allowed models are: @model<membrane_division> @model<membrane_creation> @model<transition_psystem> @model<probabilistic_psystem> @model<stochastic_psystem> @model<symport_antiport_psystem>
P-Lingua 2.0: New Features and First Applications 157 4.2.10 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. 4.2.11 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. 4.2.12 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:
158 M. Garc´ıa-Quismondo et al. 1. [[ ]0 2]0 1≡@mu =[[]’2]’1 2. [[ ]0 b[ ]− c]+ a≡@mu =+[[]’b, -[]’c]’a 4.2.13 Definition of multisets The next sentence defines the initial multiset associated to the membrane labeled 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. 4.2.14 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; 4.2.15 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 syntax 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
P-Lingua 2.0: New Features and First Applications 159 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>
160 M. Garc´ıa-Quismondo et al. 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
P-Lingua 2.0: New Features and First Applications 161 4.2.16 Parametric sentences In P-Lingua, it is possible to define parametric sentences by using the following format: sentence : range1, ..., rangeN; 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 <=. 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≡ +[x{i,j}--> x{i,j-1}]’2 : 1<=i<=m,2<=j<=n; 4.2.17 Inclusion of comments The programs in P-Lingua can be commented by writing phrases into the text strings /* and */. 4.2.18 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 5.1 Command-line tools changes 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.
162 M. Garc´ıa-Quismondo et al. 5.2 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.3 Simulation command-line tool The simulations are launched from the command line as follows: plingua sim 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 -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.
P-Lingua 2.0: New Features and First Applications 163 •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 [25], currently under development. This library is free software published under LGPL license [22], so everyone who is interested can change and distribute this library respecting the license restrictions. 7 Tools 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 2) 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 behavior for the animals. In this sense, a second version of the model is presented in [2]
164 M. Garc´ıa-Quismondo et al. 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. 2. Validation process 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 modeled ecosystem in order to make the virtual experiments suggested by experts (see figure 3). 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. The current version of this application is a prototype (Figure 4), and we will publish more information as soon as possible on the P-Lingua website. 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
P-Lingua 2.0: New Features and First Applications 165 VALIDATED MODEL Run virtual experiments Simulator HYPOTHESES FILTER REAL EXPERIMENTS NEW KNOWLEDGE Expert SELECTED HYPOTHESES Suggest virtual experiments Check results Fig. 3. Virtual experimentation Fig. 4. A tool for simulating ecosystems 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