scieee AI-readable full text Open interactive document viewer

Towards an Integrated Approach for Model Simulation, Property Extraction and Veri cation of P Systems

Lefticaru, Raluca; Ipate, Florentin; Valencia Cabrera, Luis; Turcanu, Adrian; Tudose, Cristina; Gheorgue, Marian; Pérez Jiménez, Mario de Jesús; Niculescu, Ionut Mihai; Dragomir, Ciprian

Abstract

This paper presents an integrated approach for model simulation, property extraction and formal veri cation of P systems, illustrated on a tissue P system with active membranes solving the 3-colouring problem. The paper focuses on this problem and reports the invariants and the properties extracted and veri ed using a series of tools (Daikon, MeCoSim, Maple, Spin, ProB) and languages (P{Lingua, Promela, Event-B). Appropriate tools and integration plugins, which facilitate and even automate the steps involved in the aforementioned approach, have also been developed. The case study chosen is complex (it involves an exponential growth of the number of states through the use of membrane division rules) and the properties obtained are non-trivial.

Full text

Towards an Integrated Approach for Model Simulation, Property Extraction and Verification of P Systems Raluca Lefticaru1, Florentin Ipate1, Luis Valencia Cabrera2, Adrian T¸urcanu1, Cristina Tudose1, Marian Gheorghe3, Mario de J. P´erez-Jim´enez2, Ionut¸ Mihai Niculescu1, and Ciprian Dragomir3 1Department of Mathematics and Computer Science, University of Pite¸sti Str. Tˆargu din Vale 1, 110040, Pite¸sti, Romania {name.surname}@upit.ro 2Research Group on Natural Computing Dpt. of Computer Science and Artificial Intelligence, University of Sevilla Avda. Reina Mercedes s/n. 41012, Sevilla, Spain {lvalencia,marper}@us.es 3Department of Computer Science, University of Sheffield Regent Court, Portobello Street, Sheffield S1 4DP, UK {m.gheorghe,c.dragomir}@sheffield.ac.uk Summary. This paper presents an integrated approach for model simulation, property extraction and formal verification of P systems, illustrated on a tissue P system with active membranes solving the 3-colouring problem. The paper focuses on this problem and reports the invariants and the properties extracted and verified using a series of tools (Daikon, MeCoSim, Maple, Spin, ProB) and languages (P–Lingua, Promela, Event-B). Appropriate tools and integration plugins, which facilitate and even automate the steps involved in the aforementioned approach, have also been developed. The case study chosen is complex (it involves an exponential growth of the number of states through the use of membrane division rules) and the properties obtained are non-trivial. 1 Introduction Inspired by the behaviour and structure of the living cell, P systems have emerged in recent years as powerful computational tools [21]. Many variants of P systems have been introduced and a number of theoretical aspects have been intensely studied: the computational power of different variants, their capabilities to solve hard problems, like NP-complete ones, decidability, complexity aspects and hierarchies of classes of languages produced by these devices [23]. In the last years 292 R. Lefticaru et al. there have also been significant developments in using the P systems paradigm to model, simulate and formally verify various systems [5, 23]. Up to now, two main areas concerning P system formal verification have been investigated: property verification through model checking and property extraction. However, there is no approach which integrates these two aspects (or other related aspects such as simulation). Initial research on P system model checking has tackled the problem of identifying decidable (or undecidable) problems [7, 8]. Verifying properties for P systems implies defining and implementing an operational semantics of the P system and using a corresponding model-checker. Among the tools used we mention: Maude [2], the probabilistic model-checker Prism [24, 4], the symbolic model verifier NuSMV [17], the Spin [19, 18] and ProB model checkers [16]. Property extraction using Daikon, a dynamic invariant detector, and further verification of the P systems was tackled in [4, 15]. In [4] a simple example involving a regulatory network is presented, along with the properties (preconditions, postconditions, invariants) inferred by Daikon. The relationships discovered regard the boundaries of the number of objects (e.g., 0 ≤prot ≤205) and relations between objects, such as rna < orig(rep) or (rna = 0) →(prot = 0). They have been checked using the Prism probabilistic model checker. In [15] simple cell like P systems have been used and invariants like 2∗c−d= 0, (b= 0) →(orig(b) = 0) have been obtained and further verified using NuSMV. In this paper, we propose an integrated methodology for modelling, simulation, analysis, property extraction (invariant detection) and verification through model checking for P systems. The approach integrates a modelling and simulation environment (P–Lingua and MeCoSim) with model checkers, property extraction tools (Daikon) and tools for mathematical and symbolic calculus (Maple). Appropriate integration tools (plugins) have also been developed (see Fig. 1). Starting from a problem, this process involves: the modelling of the problem by means of P systems, the model transcription into a language like P–Lingua [14], understandable by a machine; the definition of a visual interface, to enter the needed inputs and show the desired outputs from the computation; the simulation of the model under different initial parameters; the data extraction from the simulation; the invariants detection from the extracted data, and the analysis and verification of the detected properties. A detailed description of the methodology has been provided in section 4, applying the process until the invariants detection for the 3–Col problem in subsection 4.4. The approach is illustrated on a case study involving the tissue P system model for the well-known 3-colouring (3-Col) problem [10, 12]. The paper is structured as follows. We start by presenting in Section 2 the notation and main concepts to be used in the paper. Section 3 presents a set of initial properties for the 3-colouring problem, which have been verified using Spin and ProB model checker. In the next two sections are presented a methodology for properties extraction (invariants detection), its integration with the MeCoSim An Integrated Approach for Model Simulation of P Systems 293 platform [20] and the empirical detection and validation of additional properties. Finally, conclusions are drawn in Section 6. { Simulation } MeCoSim P-lingua model Simulation traces { Verification } Spin { Invariant detector } Daikon Promela model Property extraction cycle Properties Fig. 1. Methodology Overview 2 Background Before presenting our approach, let us establish the notations used and define the class of P systems addressed in the paper. Given a finite alphabet V={a1, ..., ap}, a multiset is either denoted by a string u∈V∗(in which the order is not important, the string notation is only used as a convention), or by an associated vector of non-negative integers, ΨV(u) = (|u|a1, ..., |u|ap), where |u|aidenotes the number of aioccurrences in u, for each 1≤i≤p. The following definition refers to a model of tissue P systems with cell division, introduced in [22]. This model can be seen as a network of cells, whose structure is not static: it is inspired by the way cells are duplicated in a natural way via mitosis. Definition 1. Formally, a tissue P system with cell division of degree q≥1is a tuple of the form Π= (Γ, w1, . . . , wq, ε, R, i0), where: 1. q≥1is the initial degree of the system; the system contains qcells, labelled with 1,2, . . . , m;0represents the environment. 294 R. Lefticaru et al. 2. Γis a finite alphabet (called working alphabet), whose symbols will be called objects. 3. w1, . . . , wqare strings over Γ, describing the multisets of objects placed in the qcells of the system. 4. ε⊆Γis the set of objects present in the environment in arbitrarily many copies each. 5. Ris a finite set of developmental rules of the following form: a) Communication rules: (i, u/v, j), for i, j ∈ {0,1,2, . . . , q},i6=j,u, v ∈Γ∗. When applying a rule (i, u/v, j), the objects of the multiset represented by uare sent from region ito region jand simultaneously the objects of the multiset vare sent from region jto region i. b) Division rules: [a]i→[b]i[c]i, where i∈ {1,2, . . . , q}and a, b, c ∈Γ. The cell with label iis divided in two cells with the same label; in the first copy the object ais replaced by b, in the second copy the object ais replaced by c; all other objects are replicated and copies of them are placed in the two new cells. 6. i0∈ {0,1,2, . . . , q}denotes the output region (which can be the region inside a membrane or the environment). Rules are applied as usual in a maximally parallel way, with only one restriction: when a cell is divided, the division rule is the only one which is applied for that cell in that step; the objects inside that cell do not evolve in that step. This class of P systems can be further extended, for solving NP-complete problems, to recognizer P systems. A recognizer tissue P system with cell division is a tuple (Γ, Σ, w1, . . . , wq, ε, R, iin, i0), which has, in addition to a tissue P system with cell division: •Two distinguished objects yes, no ∈Γ, present in at least one copy in w1, w2, . . . , wq, but not present in ε. •An input alphabet Σstrictly contained in Γ. •An input cell iin ∈ {1, . . . , q}. Also, it must satisfy the followings: •The output region i0is the environment. •All computations halt. •If Cis a computation of Π, then either the object yes or the object no (but not both) must have been released into the environment, and only in the last step of the computation. 3 Verifying a first set of properties for the 3-colouring problem In this section we will introduce a simplified version of a tissue P system solving the 3-colouring problem, we will present some of its properties and their verification using the Spin and ProB model checkers. An Integrated Approach for Model Simulation of P Systems 295 3.1 A P system for the 3-colouring problem In order to illustrate our approach regarding property extraction and verification for P systems, we have considered a simplified version of the 3-colouring problem from [9, 11]. The k-colouring problem is formulated as follows: given an undirected graph G= (V, E), decide whether or not Gis k-colourable; that is, if there exists a valid k-colouring of G(for every edge {u, v} ∈ Ethe colours of uand vare different). The 3-colouring problem can be solved in linear time by a family of recognizer tissue P systems with cell division [9]. The solution proposed in [9] is using a brute force algorithm, in the framework of recognizer tissue P systems with cell division, which consists of 4 stages: 1. Generation Stage: an initial cell, labelled by 2, is divided into two new cells; this process is repeated until all possible candidate solutions to the problem are generated (one solution for each membrane). 2. Prechecking Stage: after obtaining all possible 3-colourings (in cells labelled by 2), additional objects are generated in the cells, for every edge of the graph. 3. Checking Stage: it is verified if there exists a pair of adjacent vertices in the graph, with the same colour in the corresponding candidate solution. 4. Output Stage: the system sends to the environment the right answer according to the results of the previous stage (yes or no). As we will focus in the rest of the paper only on the properties from the Generation Stage, we will omit from the recognizer P system model given in [9] some rules and objects, which would hinder the understanding of the mechanism. More precisely, we will consider only the division rules and a restricted set of objects, so we can define the model using the basic class of tissue P systems with cell division. However, for a complete specification in terms of a family of recognizer tissue P systems, [9] can be consulted. Let Π(n) = (Γ(n), w1, w2(n), ε, R(n), i0) be a family of tissue P systems with cell division of degree 2, where: 1. Γ(n) = {Ai, Ri, Ti, Bi, Gi: 1 ≤i≤n} 2. w1=∅,w2(n) = {A1, . . . , An} 3. R(n) is a set of division rules: •r1,i ≡[Ai]2→[Ri]2[Ti]2for i= 1, . . . , n •r2,i ≡[Ti]2→[Bi]2[Gi]2for i= 1, . . . , n In this model Aiencodes the i-th vertex of the graph; Ri, Bi, Girepresent the three colours red, blue, green. Appendix A presents two examples of computation for Π(2) and Π(3). It can be observed that, after appropriate divisions, in the step 2nwe get exactly 3ncells encoding all the possible 3-colourings of the graph having vertices A1, . . . , An. Appendix B presents the number of cells labelled 2 at each computation step for 2 ≤n≤11, simulation results which help us formulate some interesting properties. 296 R. Lefticaru et al. Given the family of P systems Π(n) previously defined, an initial set of properties have been identified manually (without using property extraction tools): P1For each computation Cof the P system Π(n), there are 3ncells labelled with 2 at configuration C2n. P2For each computation Cof the P system Π(n), the configuration Cn+1 has exactly 2n+1 −1 cells labelled 2. P3For each computation Cof the P system Π(n), for each 0 ≤j≤nthe configuration Cjhas exactly 2jcells labelled 2. P4For each combination (X1, X2, . . . , Xn), Xi∈ {Ri, Gi, Bi},i= 1 . . . n, there exists, at configuration C2n, one and only one cell labelled by 2 that contains the multiset {X1, X2, . . . , Xn}. 3.2 3-Col property verification using model checking This initial set of properties is now verified using two model checkers, Spin and ProB. Spin is a model checker widely used in industries that build critical systems and is considered one of the most powerful model checkers available [3]. It is designed for modelling and verifying concurrent and distributed systems specified in Promela (Process or Protocol Meta Language), a verification modelling language. The properties to be verified can be expressed in LTL or by using assertion statements. ProB is an animation and model checking tool integrated within the Rodin platform, which accepts Event-B models [1]. Unlike most model checking tools, ProB works on higher-level formalisms and so it enables a more convenient modelling. Besides verification of properties (expressed using the LTL or the CTL formalism), it also provides animation facilities, allowing to visualize, at any moment, the state space or to execute a given number of operations. Property verification using Spin As explained in [18], the executable specification for the Spin model checker associated to a P system will contain extra states and variables, corresponding to intermediate steps, which have no correspondence in the P system configurations. For this reason, the properties to be verified, that refer to the P system, need to be reformulated as equivalent LTL formulas for the associated Promela implementation. The P system properties verified in this section are of the form ‘G (φ→ψ)’, and the equivalent LTL formula for the Promela model is ‘[](!φ||ψ|| !pInS)’, as formally proven in [19] (pInS is used to express if the current configuration in the Promela model represents also a state in the P system). In our experiments, we have used one Promela specification file for each particular P system Π(n), for all n∈ {2,...,9}because these files were (semi-) An Integrated Approach for Model Simulation of P Systems 297 automatically generated from each corresponding instance of P–Lingua definition file using the plinguacore library. We have successfully simulated all these models with Spin, for n∈ {2,...,9}; typical state explosion problems appeared when we attempted to verify the properties mentioned earlier for n≥4. For n∈ {2,3}we have verified all the formulas presented bellow, using also some techniques that Spin provides to reduce the memory use. Starting with n= 4, we obtained out of memory for properties that involved checking many steps of the computations. The properties verified, expressed as LTL formulas for the Spin model checker, for n= 3, are: P1:[] ((!(noOfSteps == 6) || (noOfCells == 27) || (!pInS)) P2:[] ((!(noOfSteps == 4) || (noOfCells == 15) || (!pInS)) P3:[] ((!(noOfSteps >= 0 && noOfSteps <= 3)) || (noOfCells == pow2noOfSteps)|| (!pInS)), where pow2noOfSteps is a variable which computes 2noOfSteps P4:This property is hard to verify with Spin because of the complex operations involved. Property verification using ProB The Event-B model of a P system with active membranes can be specified using two functions cell and cellp, representing the number of objects of each type contained in every cell and the number of objects produced between two steps of maximal parallelism, respectively. The rules are represented by events. Each division rule adds a cell to the domain of these functions. Additionally, a special event called update, enabled after each step of maximal parallelism, is used to add each value of cellp to cell and to reset all the values of cellp to 0. More details can be found in [6]. First, we developed an Event-B model, using the Rodin platform, for each particular P system Π(n), with n∈ {2,3,4}. Then, the possibility to use quantifiers in ProB allowed us to develop a general Event-B model for the family of P systems Π(n), that has been instantiated for particular values of n. We animated the models in order to see how the system evolves and we verified their properties using the model checker ProB. Unlike the Promela specification, where the number of cells with label 2 was incremented after each division rule, we could specify the properties P1-P4neglecting the extra intermediary) states; this is because these properties refer only to the number of steps of maximal parallelism in the evolution of Π(n) (counted by a variable called noOfSteps) and to the number of cells with label two (counted by a variable called noOfCells), whose values are modified only in the update event. On the other hand, we used an additional state, Halt, to mark final configurations. However, we were able to verify all the properties only for n∈ {2,3,4}; for n= 5, due to the state explosion problem, the model checker crashed with an out of memory error before reaching the final configuration (after 298 R. Lefticaru et al. producing 196 cells labelled 2). Consequently, for n > 5, we could verify only some simple properties, that do not involve terminal configuration (e.g. P3for small values of j). The properties were specified using LTL as follows: P1:G{state =Halt ⇒noOfSteps = 2 ∗n&noOfCells = 3n} P2:G{noOfSteps =n+ 1 ⇒noOfCells = 2n+1 −1} P3:G{!j.j >= 0 &j <=n&noOfSteps =j⇒noOfCells = 2j} P4:We were able to verify P4splitting it in two properties, the first one for the existence and the second one for the unicity. For n= 2 these properties were formulated as follows: – For all x, y symbols in {Ri, Gi, Bi},i∈ {1,2}, there exist one cell in the final configuration that contains one xand one y: G{state =Halt ⇒(!x, y.x :{R1, R2, G1, G2, B1, B2}&y:{R1, R2, G1, G2, B1, B2}& (x/ =y)⇒(#c.c :dom(cell) & cell(c)(x) = 1 & cell(c)(y) = 1))} – In the final configuration any two different cells c1, c2 have different contents: G{state =Halt ⇒(!c1, c2.c1 : dom(cell) & c2 : dom(cell) & (c1/=c2) ⇒ (#s.s :{R1, R2, G1, G2, B1, B2}&cell(c1)(s)/=cell(c2)(s)))} For higher values of nthe formulas for these properties are very large and for space considerations, we will omit them. Here “!”, “#” and “:” correspond to the universal quantifier “∀”, existential quantifier “∃” and membership operator “∈”, respectively. 4 Integrating Daikon in MeCoSim and finding new relations The next stage in the proposed methodology is the automatic extraction of new properties from simulation traces. The main tools used (MeCoSim and Daikon) and their integration are presented next. The process of identifying new properties, broken down in a number of individual steps, is also described. 4.1 Modelling and formalization Once the 3-Col problem has been studied and modelled by means of P systems, this model must be expressed in a language that may be understood by a simulation machine. For this purpose, the standard P–Lingua [14] language has been chosen as our modelling language. The initial multisets and rules are expressed as follows: @ms(2) += A{i} : 1<=i<=n; /* r1 */ [A{i}]’2 --> [R{i}]’2 [T{i}]’2 : 1<=i<=n; /* r2 */ [T{i}]’2 --> [B{i}]’2 [G{i}]’2 : 1<=i<=n; An Integrated Approach for Model Simulation of P Systems 299 The full code of the model in P–Lingua is showed in Appendix C. This file will serve as an input for MeCoSim, so that the P system can be simulated, analyzed and debugged, and invariants can be detected, to be then verified by model checking. 4.2 MeCoSim In order to provide an integrated methodology for model simulation, properties extraction and verification, we need an integrated environment to simplify the user’s process. In this sense, a general purpose membrane computing simulator, MeCoSim [20], was provided. It was initially designed to enable the user defined customized interfaces, with inputs, outputs, charts, etc., adapted to each family of P systems. This permits entering data for different initial conditions, instantiating different P systems of the family. The initial aim of this software environment has been extended such that it can cover a more general set of applications by providing flexible and powerful methods to integrate various software applications and packages as MeCoSim plugins. These kind of plugins can be easily added to MeCoSim by setting appropriate parameters in a configuration file. Keeping in mind this architecture and the developed plugins, MeCoSim may provide a platform for the integration of different tools for the modelling, simulation, analysis, property extraction and verification of P systems. Some of this tools have already been developed and/or integrated, others are being developed, and many other could be added in a similar way. To take advantage of this framework for studying the 3-Col problem, we need to define our customized inputs, outputs, extractions, etc. The main steps of this process are illustrated in the next paragraphs. MeCoSim permits setting the hierarchy of tabs to be shown in the visual user interface, including input and output tables inside each leaf tab. In our case, we divide the information in two tabs, Input and Output (plus an additional tab, Debug console, provided by default in MeCoSim, used for debugging the models). For our example, we only need one input parameter, n, so one input table is defined inside the tab Input, as showed in Fig. 2. Now the simulation could be performed, in such a way that ntakes the value from the input table, this parameter complements the P–Lingua file to instantiate the initial configuration of the P system and the computation steps run until a halting condition is reached. In the debug console, we can run step by step, looking at all the objects of the multisets inside each cell and compartment, for each computation step. However, this process could be very slow if we are interested in several objects, membranes or steps, so we need a way to define customized outputs showing the desired information only. MeCoSim provides this mechanism, and we define outputs as shown in Fig. 3 to study different issues: entire configurations, objects per membrane, objects by type (R, G, B), number of cells, etc. 306 R. Lefticaru et al. –B <=Ris a direct consequence of the fact that rules [Ai]2→[Ri]2[Ti]2 are applied first, so Riobjects are produced, and later are applied rules of type [Ti]2→[Bi]2[Gi]2 –B >=orig(B) is obvious because Biobjects are never consumed by any rules. •Anomalous invariants: these indicate a fault in the model and its parameter values. In this case, we did not obtained any of these, but if the P–Lingua model would have been incorrect (not solving the proposed problem), we could have encountered anomalous values. •Interesting invariants: could even suggest novel relationships between the model variables. However, these properties should be further confirmed by a model checker verification. A summary of the extracted properties is presented in Table 1, where by noninteresting properties we refer to obvious invariants, such the ones presented previously. Also, the truth value given in the third column refers to the result returned by the model checkers, after verifying the corresponding properties. Extraction Result Truth Entire model (all simulation data) Non-interesting properties Objects grouped by type Non-interesting properties Objects grouped by type, filtered by R, G or B Non-interesting properties No. of cells for each nseparately Non-interesting properties No. of cells in the last configuration, for different values of ntogether numcells = 3ntrue No. of cells for each step 0 . . . n numcells = 2step true No. of cells for each step (n+ 1) . . . 2n numcells = 3(mod 4) false No. of cells for each step (n+ 1) . . . (n+ (n/2) + 1) numcells = 3(mod 12) false Table 1. Summary of detected invariants 5 Discovering other properties with Maple 5.1 Model simplification for simulation As we have discussed in Section 3.2, verification through model checking is possible for nup to 5. Beyond this point, due to the state explosion problem, both model An Integrated Approach for Model Simulation of P Systems 307 checkers (Spin and ProB) will crash with an out of memory error, at least for some of the verified properties. This led us to build and use a simplified model of the investigated P system, based on the observation that the evolution of the number of cells and the actual contents of each cell are two separable issues, because only the symbols Aand Tappear in the left hand side of the rules. Thus, the number of objects R, G, B was ignored; first, a simplified Event-B model was produced, but with only limited performance gains, i.e. verification of properties for nup to 6; secondly, a Python implementation was developed, which enabled the verification of properties for nup to 19. Based on the backtracking technique, the simulation Algorithm 1 follows the evolution of a cell placed in the top of a stack, across the configurations of Π(n) for as long as it contains non-terminals. Each cell is stored as a tuple containing the multiplicity of A’s and T’s and the step number. If the current cell still contains terminals, a new cell is added on to the stack, otherwise it is removed. We also used an array to count the number of cells produced at each step. The algorithm ends when the stack is empty. The verification Algorithm 2 checks if the values from the array calculated in the first algorithm are the same with the values returned by a function implemented for each property. Both algorithms are given in Appendix E. 5.2 Obtaining the polynomial coefficients with Maple As we have seen in Section 4.4, using Daikon we have managed to find a number of (simpler) invariants but have failed to find other potentially interesting properties, such as the number of cells from configurations n+ 2 up to configuration 2 ∗n. This is due to the quite complex nature of the formulae for these numbers: Using the number of cells with label 2 given in Appendix B, we deduced that the number of cells in configuration n+k,k∈ {2,3,4,5, . . .}, is a sum between 2n+kand a polynomial Qkof degree k−1. In order to determine the exact expression of this polynomial we used Maple. Maple is a powerful software that can be used to solve various mathematical problems with numerical and symbolic calculus. It also incorporates a programming language that allows working with formulas containing symbols and formal operations. Maple provides users over 5000 predefined functions and commands, with suggestive names, dedicated to various branches of mathematics. In order to obtained Qkwe used the idea that a polynomial of degree k−1 can be obtained solving a recurrence of order kand some Maple functions and commands: •rgf findrecur(k, seq, f, n): function contained in the package genfunc that finds the linear recurrence with constant coefficients of order kthat is satisfied by the sequence with 2kterms seq;fis the name of the general term and nis the index variable of the recurrence; •rsolve({rec}, f(n)): command returning an expression for the general term of the function f(n) by solving the recurrence rec; 308 R. Lefticaru et al. •expand(expr): command used to distribute products over sums in the given expression. For k= 4, using rgf findrecur(4,[(81 −28),(227 −29),(585 −210),(1403 − 211),(3185 −212),(6947 −213),(14729 −214),(30619 −215)], f, t) we obtained the recurrence: f(t)=4∗f(t−1) −6∗f(t−2) + 4 ∗f(t−3) −f(t−4). Solving this recurrence with the command rsolve({f(t) = 4∗f(t−1)−6∗f(t−2)+4∗f(t−3)− f(t−4), f(4) = −175, f(5) = −285, f(6) = −439, f(7) = −645}, f(n)) we obtain the general term: −19+12(n+1) 1 2n+ 1−14n−8(n+1) 1 2n+ 11 3n+ 1, and expanding it: −15 −32 3n−2n2−4 3n3. Adding 2n+4 to this general term we obtain the number of cells with label 2 in the configuration n+ 4. The recurrences from Table 2 have been obtained similarly. Configuration Recurrence n+ 2 f(t) = 2 ·f(t−1) −f(t−2) n+ 3 f(t) = 3 ·f(t−1) −3·f(t−2) + f(t−3) n+ 4 f(t) = 4 ·f(t−1) −6·f(t−2) + 4 ·f(t−3) −f(t−4) n+ 5 f(t) = 5 ·f(t−1) −10 ·f(t−2) + 10 ·f(t−3) −5·f(t−4) + f(t−5) n+ 6 f(t) = 6 ·f(t−1) −15 ·f(t−2) + 20 ·f(t−3) −15 ·f(t−4) + 6 ·f(t−5) −f(t−6) Table 2. Recurrence for the number of cells with label 2 in configuration n+k We notice that all these recurrences have, for each configuration n+k, the following form: f(t) = k P i=1 (−1)i+1 ·Ci k·f(t−i). Unfortunately, the current limitations of our tools (n < 20) does not allow us to continue the calculus with the next steps and so we cannot establish unequivocally if the recurrences have the same form for larger values of k. Solving these recurrences (using rsolve), expanding the expressions (with expand) and adding 2n+k, we obtain the number of cells with label 2 in the configuration n+k, for k∈ {2,3,4,5,6}, as presented in Table 3. All these formulas were verified using Algorithm 2 from Appendix E for n < 20. As we can see from Table 3 the coefficient of the polynomial that follows 2n+kare rational but we could not establish any further rule for them except the fact that, in each case, the free term is −2k+ 1. An Integrated Approach for Model Simulation of P Systems 309 Configuration Number of cells n+ 2 2n+2 −2n−3 n+ 3 2n+3 −2n2−4n−7 n+ 4 2n+4 −4 3·n3−2·n2−32 3·n−15 n+ 5 2n+5 −2 3·n4−28 3·n2−20 ·n−31 n+ 6 2n+6 −4 15 ·n5+2 3·n4−20 3·n3−32 3·n2−676 15 ·n−63 Table 3. Number of cells with label 2 in configuration n+k 6 Conclusion In this paper, we have outlined an integrated methodology for P system formal verification, comprising modelling using P–Lingua, simulation with MeCoSim, properly extraction using Daikon and model checking using tools such as Spin and ProB. A plugin which allows Daikon to be called and used within MeCoSim has been developed and a (semi)-automatic Promela implementation has been generated from the P–Lingua model. A number of steps involved in property extraction using Daikon have been identified and the whole process has been illustrated with an example, a tissue P system model of the 3-colouring problem; this is a complex problem since, by using active membranes (cell division), the number of cells grows exponentially. As some of the sought properties have proved to be quite complex and could not be directly extracted using Daikon, a tool for mathematical and symbolic calculus (Maple) has been used to supplement our methodology. Further work involves the development of completely integrated environment for automatic modelling, simulation and verification of P systems as well as applying the proposed methodology to other, more complex, P systems. Acknowledgment The work of MG, FI and RL was supported by a grant of the Romanian National Authority for Scientific Research, CNCS–UEFISCDI, project number PN-II-ID- PCE-2011-3-0688. The authors MPJ and LVC acknowledge the support of the project TIN2009–13192 of the Ministerio de Ciencia e Innovaci´on of Spain, cofinanced by FEDER funds, and the support of the Project of Excellence with Investigador de Reconocida Val´ıa of the Junta de Andaluc´ıa, grant P08–TIC– 04200. AT was supported by project POSDRU - “Dezvoltarea ¸scolilor doctorale prin acordarea de burse tinerilor doctoranzi cu frecvent¸˘a”- 88/1.5/S/52826. 310 R. Lefticaru et al. References 1. Abrial, J.R.: Modeling in Event-B - System and Software Engineering. Cambridge University Press (2010) 2. Andrei, O., Ciobanu, G., Lucanu, D.: Executable specifications of P systems. In: Mauri, G., P˘aun, G., P´erez-Jim´enez, M., Rozenberg, G., Salomaa, A. (eds.) Membrane Computing, Lecture Notes in Computer Science, vol. 3365, pp. 126–145. Springer Berlin / Heidelberg (2005) 3. Ben-Ari, M.: Principles of the Spin Model Checker. Springer-Verlag, London (2008) 4. Bernardini, F., Gheorghe, M., Romero-Campero, F.J., Walkinshaw, N.: A hybrid approach to modeling biological systems. In: Eleftherakis, G., Kefalas, P., Paun, G., Rozenberg, G., Salomaa, A. (eds.) Workshop on Membrane Computing. Lecture Notes in Computer Science, vol. 4860, pp. 138–159. Springer (2007) 5. Ciobanu, G., P´erez-Jim´enez, M.J., P˘aun, G. (eds.): Applications of Membrane Computing. Natural Computing Series, Springer (2006) 6. T¸urcanu, A., Ipate, F.: Modelling, testing and verification of P systems with active membranes using Rodin and ProB modelling. In: Proceedings of the 12th International Conference on Membrane Computing. pp. 459–468. Paris-Est University Press (2011) 7. Dang, Z., Ibarra, O., Li, C., Xie, G.: On model-checking of P systems. In: Calude, C., Dinneen, M., P˘aun, G., P´erez-J´ımenez, M., Rozenberg, G. (eds.) Unconventional Computation, Lecture Notes in Computer Science, vol. 3699, pp. 82–93. Springer Berlin / Heidelberg (2005) 8. Dang, Z., Ibarra, O.H., Li, C., Xie, G.: On the decidability of model-checking for P systems. Journal of Automata, Languages and Combinatorics 11(3), 279–298 (2006) 9. D´ıaz-Pernil, D., Guti´errez-Naranjo, M.A., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: A linear-time tissue P system based solution for the 3-coloring problem. Electr. Notes Theor. Comput. Sci. 171(2), 81–93 (2007) 10. D´ıaz-Pernil, D., Guti´errez-Naranjo, M.A., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: A logarithmic bound for solving Subset Sum with P systems. In: Eleftherakis, G., Kefalas, P., Paun, G., Rozenberg, G., Salomaa, A. (eds.) Workshop on Membrane Computing. Lecture Notes in Computer Science, vol. 4860, pp. 257–270. Springer (2007) 11. D´ıaz-Pernil, D., Guti´errez-Naranjo, M.A., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: A uniform family of tissue P systems with cell division solving 3-COL in a linear time. Theor. Comput. Sci. 404(1-2), 76–87 (2008) 12. D´ıaz-Pernil, D., P´erez-Hurtado, I., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: A P- Lingua programming environment for membrane computing. In: Corne, D.W., Frisco, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) Membrane Computing - 9th International Workshop, WMC 2008, Revised Selected and Invited Papers. Lecture Notes in Computer Science, vol. 5391, pp. 187–203. Springer (2009) 13. Ernst, M.D., Cockrell, J., Griswold, W.G., Notkin, D.: Dynamically discovering likely program invariants to support program evolution. IEEE Trans. Software Eng. 27(2), 99–123 (2001) 14. Garc´ıa-Quismondo, M., Guti´errez-Escudero, R., P´erez-Hurtado, I., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: An overview of P-Lingua 2.0. In: P˘aun, G., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A., Rozenberg, G., Salomaa, A. (eds.) Membrane Computing - 10th International Workshop, WMC 2009, Revised Selected and Invited Papers. Lecture Notes in Computer Science, vol. 5957, pp. 264–288. Springer (2010) An Integrated Approach for Model Simulation of P Systems 311 15. Gheorghe, M., Ipate, F., Lefticaru, R., Dragomir, C.: An integrated approach to P systems formal verification. In: CMC11: Proceedings of the Eleventh International Conference on Membrane Computing. pp. 225–238. ProBusiness Verlag Berlin (2010) 16. Ipate, F., T¸urcanu, A.: Modelling, verification and testing of P systems using Rodin and ProB. In: Ninth Brainstorming Week on Membrane Computing (BWMC 2011). pp. 209–220 (2011) 17. Ipate, F., Gheorghe, M., Lefticaru, R.: Test generation from P systems using model checking. Journal of Logic and Algebraic Programming 79(6), 350–362 (2010) 18. Ipate, F., Lefticaru, R., P´erez-Hurtado, I., P´erez-Jim´enez, M.J., Tudose, C.: Formal verification of p systems with active membranes through model checking. In: Gheorghe, M., Paun, G., Rozenberg, G., Salomaa, A., Verlan, S. (eds.) Int. Conf. on Membrane Computing. Lecture Notes in Computer Science, vol. 7184, pp. 215–225. Springer (2011) 19. Ipate, F., Lefticaru, R., Tudose, C.: Formal verification of P systems using Spin. International Journal of Foundations of Computer Science 22(1), 133–142 (2011) 20. P´erez-Hurtado, I., Valencia-Cabrera, L., P´erez-Jim´enez, M.J., Colomer, M.A., Riscos-N´u˜nez, A.: Mecosim: A general purpose software tool for simulating biological phenomena by means of p systems. IEEE Fifth International Conference on Bioinpired Computing: Theories and Applications (BIC-TA 2010) I, 637–643 (2010), http://www.cs.us.es/~marper/investigacion/mecosim.pdf 21. P˘aun, G.: Computing with membranes. Journal of Computer and System Sciences 61(1), 108–143 (2000) 22. P˘aun, G., P´erez-Jim´enez, M.J., Riscos-N´u˜nez, A.: Tissue P system with cell division. In: P˘aun, G., Riscos-N´u˜nez, A., Romero-Jim´enez, A., Sancho-Caparrini, F. (eds.) Second Brainstorming Week on Membrane Computing. vol. Report RGNC 01/2004, pp. 308–386 (2004) 23. P˘aun, G., Rozenberg, G., Salomaa, A. (eds.): The Oxford Handbook of Membrane Computing. Oxford University Press (2010) 24. Romero-Campero, F.J., Gheorghe, M., Bianco, L., Pescini, D., P´erez-Jim´enez, M.J., Ceterchi, R.: Towards probabilistic model checking on P systems using PRISM. In: Hoogeboom, H.J., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) Membrane Computing - 7th International Workshop, WMC 2006, Revised, Selected, and Invited Papers. Lecture Notes in Computer Science, vol. 4361, pp. 477–495. Springer (2006) 312 R. Lefticaru et al. Appendices A Computation examples for Π(n), n∈ {2,3} Crt. No. of cells Current configuration step labelled 2 (only cells labelled with 2) 0 1 [A1A2]2 1 2 [R1A2]2[T1A2]2 2 4 [R1R2]2[R1T2]2[B1A2]2[G1A2]2 3 7 [R1R2]2[R1B2]2[R1G2]2[B1R2]2[B1T2]2 [G1R2]2[G1T2]2 4 9 [R1R2]2[R1B2]2[R1G2]2[B1R2]2[B1B2]2 [B1G2]2[G1R2]2[G1B2]2[G1G2]2 Table 4. Computation example for Π(2) Crt. No. of cells Current configuration step labelled 2 (only cells labelled with 2) 0 1 [A1A2A3]2 1 2 [R1A2A3]2[T1A2A3]2 2 4 [R1R2A3]2[R1T2A3]2[B1A2A3]2[G1A2A3]2 3 8 [R1R2R3]2[R1R2T3]2[R1B2A3]2[R1G2A3]2 [B1R2A3]2[B1T2A3]2[G1R2A3]2[G1T2A3]2 4 15   [R1R2R3]2[R1R2B3]2[R1R2G3]2[R1B2R3]2[R1B2T3]2 [R1G2R3]2[R1G2T3]2[B1R2R3]2[B1R2T3]2[B1B2A3]2 [B1G2A3]2[G1R2R3]2[G1R2T3]2[G1B2A3]2[G1G2A3]2   5 23       [R1R2R3]2[R1R2B3]2[R1R2G3]2[R1B2R3]2[R1B2B3]2 [R1B2G3]2[R1G2R3]2[R1G2B3]2[R1G2G3]2[B1R2R3]2 [B1R2B3]2[B1R2G3]2[B1B2R3]2[B1B2T3]2[B1G2R3]2 [B1G2T3]2[G1R2R3]2[G1R2B3]2[G1R2G3]2[G1B2R3]2 [G1B2T3]2[G1G2R3]2[G1G2T3]2       6 27         [R1R2R3]2[R1R2B3]2[R1R2G3]2[R1B2R3]2[R1B2B3]2 [R1B2G3]2[R1G2R3]2[R1G2B3]2[R1G2G3]2[B1R2R3]2 [B1R2B3]2[B1R2G3]2[B1B2R3]2[B1B2B3]2[B1B2G3]2 [B1G2R3]2[B1G2B3]2[B1G2G3]2[G1R2R3]2[G1R2B3]2 [G1R2G3]2[G1B2R3]2[G1B2B3]2[G1B2G3]2[G1G2R3]2 [G1G2B3]2[G1G2G3]2         Table 5. Computation example for Π(3) An Integrated Approach for Model Simulation of P Systems 313 B Number of cells labelled with 2 nNumber of cells labelled 2 at each configuration (from 0 to 17) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 1 2 4 7 9 3 1 2 4 8 15 23 27 4 1 2 4 8 16 31 53 73 81 5 1 2 4 8 16 32 63 115 179 227 243 6 1 2 4 8 16 32 64 127 241 409 585 697 729 7 1 2 4 8 16 32 64 128 255 495 891 1403 1867 2123 2187 8 1 2 4 8 16 32 64 128 256 511 1005 1881 3185 4673 5857 6433 6561 9 1 2 4 8 16 32 64 128 256 512 1023 2027 3891 6947 11043 15203 18147 19427 10 1 2 4 8 16 32 64 128 256 512 1024 2047 4073 7945 14729 24937 37289 48553 11 1 2 4 8 16 32 64 128 256 512 1024 2048 4095 8167 16091 30619 54395 87163 12 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8191 16357 32425 62801 115633 13 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16383 32739 65139 127651 14 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32767 65505 130617 15 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65535 131039 16 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131071 17 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 18 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 19 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 Table 6. Number of cells labelled 2 at each configuration. Steps 0 to 17. nNumber of cells labelled 2 at each configuration (from 18 to 25) 18 19 20 21 22 23 24 25 2 - 8 9 19683 10 55721 58537 59049 11 123131 152827 169979 176123 177147 12 195953 297457 399089 475633 516081 529393 531441 13 241235 427219 689363 994003 1273811 1467347 1561555 1590227 14 257929 496537 909689 1543801 2372729 3261817 4014969 4496249 15 261627 519163 1012395 1902763 3363179 5460331 8007275 10538603 16 262109 523705 1042417 2050721 3927553 7168705 12186689 18927937 17 262143 524251 1047923 2089827 4135555 8028995 15023811 26524099 18 262144 524287 1048537 2096425 4185673 8315209 16300105 31081801 19 262144 524288 1048575 2097111 4193499 8378523 16686555 32930523 Table 7. Number of cells labelled 2 at each configuration. Steps 18 to 25. 314 R. Lefticaru et al. nNumber of cells labelled 2 at each configuration 26 27 28 29 30 31 32 2 - 12 13 1594323 14 4713337 4774777 4782969 15 12526187 13705835 14201451 14332523 14348907 16 26553153 33603393 38758209 41613121 42735425 43013953 43046721 17 43301315 64409027 86709699 105964995 119129539 125961667 128484803 18 56571721 96349513 151011657 215527753 279384393 331059529 364220745 19 63682011 118735323 209492955 343710683 517551067 710439899 889828315 Table 8. Number of cells labelled 2 at each configuration. Steps 26 to 32. nNumber of cells labelled 2 at each configuration 33 34 35 36 37 38 2 - 16 17 129074627 129140163 18 380408137 386044233 387289417 387420489 19 1026339803 1108849627 1146860507 1159377883 1161999323 1162261467 Table 9. Number of cells labelled 2 at each configuration. Steps 33 to 38. C P–Lingua model file The content of the file in P–Lingua format, containing the specification of the model, is shown below. @model<tissue_psystems> def main() { /* tissue P system skeleton */ call example_tissue(n); } def example_tissue(n) { call init_cells(); call init_multisets(n); call init_rules(n); } def init_cells() { @mu = [[]’2]’0; } def init_rules(n) { An Integrated Approach for Model Simulation of P Systems 315 /* r1 */ [A{i}]’2 --> [R{i}]’2 [T{i}]’2 : 1<=i<=n; /* r2 */ [T{i}]’2 --> [B{i}]’2 [G{i}]’2 : 1<=i<=n; } def init_multisets(n) { @ms(2) += A{i} : 1<=i<=n; } D Daikon integration in MeCoSim - plugin and config files This appendix presents some technical details about the developed plugin, and the simple process of integration with MeCoSim. The main code of the program is contained in DaikonInterface.jar program, that receives an input file with a compatible format for Daikon invariants detector. However, an additional jar file has been developed, DaikonPlugin.jar, to permit selecting among the different extraction files generated by the simulator. To implement the integration of the program, the only work we have to do is the addition of a few lines in the file plugins-properties of MeCoSim, as follows: plugin-daikon = daikonPlugin.Main pluginname-daikon = Daikon pluginmethod-daikon = pluginHook pluginparam-daikon-1 = userfiles/daikon-files.txt pluginjar-daikon-1 = DaikonInterface.jar pluginjar-daikon-2 = DaikonPlugin.jar