scieee AI-readable full text Open interactive document viewer

Eleventh Brainstorming Week on Membrane Computing Sevilla, February 4-8, 2013 : RGNC REPORT 1/2013

Valencia Cabrera, Luis; García Quismondo, Manuel; Macías Ramos, Luis Felipe; Martínez del Amor, Miguel Ángel; Paun, Gheorghe; Riscos Núñez, Agustín

Full text

Eleventh Brainstorming Week on Membrane Computing Sevilla, February 4 – 8, 2013 Luis Valencia-Cabrera, Manuel Garc´ıa-Quismondo Luis F. Mac´ıas-Ramos, Miguel ´ A. Mart´ınez-del-Amor Gheorghe P˘aun, Agust´ın Riscos-N´u˜nez Editors Eleventh Brainstorming Week on Membrane Computing Sevilla, February 4 – 8, 2013 Luis Valencia-Cabrera, Manuel Garc´ıa-Quismondo Luis F. Mac´ıas-Ramos, Miguel ´ A. Mart´ınez-del-Amor Gheorghe P˘aun, Agust´ın Riscos-N´u˜nez Editors RGNC REPORT 1/2013 Research Group on Natural Computing Sevilla University F´enix Editora, Sevilla, 2013 c Authors ISBN: 978-84-940691-9-2 Edita: F´enix Editora c/Patricio S´enz, 13 - 41004 Sevilla [email protected] www.fenixeditora.com Telf. (+34) 954 90 74 36 Impreso en Espa˜na - Printed in Spain Preface The Eleventh Brainstorming Week on Membrane Computing (BWMC) was organized in Sevilla, from February 4 to February 8, 2013, in the organization of the Research Group on Natural Computing from the Department of Computer Science and Artificial Intelligence of Sevilla University. The first edition of BWMC was organized at the beginning of February 2003 in Rovira i Virgili University, Tarragona, and all the next editions took place in Sevilla at the beginning of February, each year. In the style of previous meetings in this series, the eleventh BWMC was conceived as a period of active interaction among the participants, with the emphasis on exchanging ideas and cooperation. Several “provocative” talks were delivered, mainly devoted to open problems, research topics, conjectures waiting for proofs, followed by an intense cooperation among the 33 participants – see the list in the end of this preface. The efficiency of this type of meetings was again proved to be very high and the present volume illustrates this assertion. The papers included in this volume, arranged in the alphabetic order of the authors, were collected in the form available at a short time after the brainstorming; several of them are still under elaboration. The idea is that the proceedings are a working instrument, part of the interaction started during the stay of authors in Sevilla, meant to make possible a further cooperation, this time having a written support. Selections of the papers from these volumes will be considered for publication in special issues of International Journal of Unconventional Computing. After each BWMC, one or two special issues of various international journals were published. Here is their list: •BWMC 2003: Natural Computing – volume 2, number 3, 2003, and New Generation Computing – volume 22, number 4, 2004; •BWMC 2004: Journal of Universal Computer Science – volume 10, number 5, 2004, and Soft Computing – volume 9, number 5, 2005; •BWMC 2005: International Journal of Foundations of Computer Science – volume 17, number 1, 2006); vi Preface •BWMC 2006: Theoretical Computer Science – volume 372, numbers 2-3, 2007; •BWMC 2007: International Journal of Unconventional Computing – volume 5, number 5, 2009; •BWMC 2008: Fundamenta Informaticae – volume 87, number 1, 2008; •BWMC 2009: International Journal of Computers, Control and Communication – volume 4, number 3, 2009; •BWMC 2010: Romanian Journal of Information Science and Technology – volume 13, number 2, 2010; •BWMC 2011: International Journal of Natural Computing Research – volume 2, numbers 2-3, 2011. •BWMC 2012: International Journal of Computer Mathematics – volume 99, number 4, 2013 Other papers elaborated during the eleventh BWMC will be submitted to other journals or to suitable conferences. The reader interested in the final version of these papers is advised to check the current bibliography of membrane computing available in the domain website http://ppage.psystems.eu. *** The list of participants as well as their email addresses are given below, with the aim of facilitating the further communication and interaction: 1. Ludek Cienciala, Silesian University in Opava, Czech Republic, [email protected] 2. Lucie Ciencialov´a, Silesian University in Opava, Czech Republic, [email protected] 3. Mari Angels Colomer Cugat, University of Lleida, Spain, [email protected] 4. Rudolf Freund, Technological University of Vienna, Austria, [email protected] 5. Manuel Garc´ıa Quismondo Fern´andez, University of Seville, Spain, [email protected] 6. Adolfo Gastalver-Rubio, University of Seville, Spain, [email protected] 7. Marian Gheorghe, University of Sheffield, United Kingdom, [email protected] 8. Carmen Graciani D´ıaz, University of Seville, Spain, [email protected] 9. Miguel A. Guti´errez Naranjo, University of Seville, Spain, [email protected] 10. Florentin Ipate, University of Bucharest, Romania, [email protected] 11. Sergiu Ivanov, Universit´e Paris-Est Cr´eteil, France, [email protected] 12. Alica Kelemenov´a, Silesian University in Opava, Czech Republic, [email protected] 13. Miroslav Langer, Silesian University in Opava, Czech Republic, [email protected] Preface vii 14. Raluca Lefticaru, University of Bucharest, Romania, [email protected] 15. Alberto Leporati, University of Milan – Bicocca, Italy, [email protected] 16. Luis Felipe Mac´ıas Ramos, University of Seville, Spain, [email protected] 17. Miguel A. Mart´ınez del Amor, University of Seville, Spain, [email protected] 18. Giancarlo Mauri, University of Milan – Bicocca, Italy, [email protected] 19. Santiago Maza L´opez de los Mozos, University of Seville, Spain, [email protected] 20. Niall Murphy, Universidad Polit´ecnica de Madrid, Spain, [email protected] 21. David Orellana Mart´ın, University of Seville, Spain, [email protected] 22. Adam Obtu lowicz, Polish Academy of Sciences, Warsaw, Poland, [email protected] 23. Gheorghe P˘aun, University of Seville, Spain, and Institute of Mathematics of the Romanian Academy, [email protected] 24. Ignacio P´erez Hurtado de Mendoza, University of Seville, Spain, [email protected] 25. Mario de J. P´erez Jim´enez, University of Seville, Spain, [email protected] 26. Antonio Enrico Porreca, University of Milan – Bicocca, Italy, [email protected] 27. Jos´e Luis Pro Mart´ın, University of Seville, Spain, [email protected] 28. Agust´ın Riscos N´u˜nez, University of Seville, Spain, [email protected] 29. Francisco Jos´e Romero Campero, University of Seville, Spain, [email protected] 30. ´ Alvaro Romero Jim´enez, University of Seville, Spain, [email protected] 31. Juan Carlos Soriano Ram´ırez, University of Seville, Spain, [email protected] 32. Luis Valencia Cabrera, University of Seville, Spain, [email protected] 33. Claudio Zandron, University of Milan – Bicocca, Italy, [email protected] As mentioned above, the meeting was organized by the Research Group on Natural Computing from Sevilla University (http://www.gcn.us.es) and all its members were enthusiastically involved in this (not always easy) work. The meeting was supported from various sources: (i) Ministerio de Econom´ıa y Competitividad (grants TIN2008–04487–E, TIN2009 – 13192, TIN2012 – 37434, cofinanced by FEDER funds), (ii) Junta de Andaluc´ıa (grant P08 – TIC 04200, also cofinanced by FEDER funds), (iii) Instituto de Matem´aticas de la Universidad de Sevilla (IMUS), (iv) Fundaci´on para la Investigaci´on y el Desarrollo de las Tecnolog´ıas de la Informaci´on en Andaluc´ıa (FIDETIA), as well as by the Department of Computer Science and Artificial Intelligence from Sevilla University. Gheorghe P˘aun Mario de Jes´us P´erez-Jim´enez (Sevilla, May 2013) Contents Flattening P Systems with Active Membranes B. Aman, G. Ciobanu .................................................... 1 Studying the Chlorophyll Fluorescence in Cyanobacteria with Membrane Computing Techniques I. Ardelean, D. D´ıaz-Pernil, M.A. Guti´errez-Naranjo, F. Pe˜na-Cantillana, I. Sarchizian ........................................ 9 A GPU Simulation for Evolution-Communication P Systems with Energy Having no Antiport Rules Z.F. Bangalan, K.A.N. Soriano, R.A.B. Juayong, F.G.C. Cabarle, H.N. Adorna, M.A. Mart´ınez–del–Amor................................. 25 2D P Colonies and Modelling of Liquid Flow Over the Earth’s Surface L. Cienciala, L. Ciencialov´a, M. Langer................................. 51 Scenario Based P Systems G. Ciobanu, D. Sburlan ................................................. 67 Universal P Systems: One Catalyst Can Be Sufficient R. Freund, Gh. P˘aun ................................................... 81 Kernel P Systems – Version I M. Gheorghe, F. Ipate, C. Dragomir, L. Mierl˘a, L. Valencia-Cabrera, M. Garc´ıa-Quismondo, M.J. P´erez-Jim´enez........ 97 Rete Algorithm for P Systems Simulators C. Graciani, M.A. Guti´errez-Naranjo, A. Riscos-N´u˜nez ................ 125 On Controlled P Systems K. Krithivasan, Gh. P˘aun, A. Ramanujan ............................. 137 An Application of the PCol Automata in Robot Control M. Langer, L. Cienciala, L. Ciencialov´a, M. Perdek, A. Kelemenov´a . . . 153 6 B. Aman, G. Ciobanu which membrane in the initial system, we consider that the new copies of the membrane and its inner objects have labels that uniquely identify them, namely h1and h2. To be able to apply similar rules as for the initial membrane halso to the newly created membranes labelled by h1 and h2we duplicate the rules from hin the newly created membranes by replacing the objects ahby the objects ah1or ah2, respectively. As an example, for the rule αhah→αhvhof membrane h, an instance of it is created for each membrane hi,i∈ {1,2}, namely αhiahi→αhivhi. ii. αm hah→αm ha0 h1a0 h2 In the presence of the object αm hany object from the initial membrane his duplicated in the two new copies of membrane h, namely the object ahis replaced with the objects a0 h1and a0 h2. iii. αm h→αh1αh2 After all objects of membrane hare replicated into the new copies of membrane h, namely h1and h2, the object αm his replaced with the objects αh1and αh2, representing the polarizations of the newly created membranes. The rules are applied according to the following sequence of priorities: (e).i > (e).ii > (e).iii f) a rule [ [ ]α1 h1. . . [ ]α1 hk[ ]α2 hk+1 . . . [ ]α2 hn]α0 h0→[ [ ]α3 h1. . . [ ]α3 hk]α5 h0[ [ ]α4 hk+1 . . . [ ]α4 hn]α6 h0 is simulated with the rules: i. phih0+hiphjh0−hj→αm 0h0phih01 +0 hiphjh02 −0 hj The division of the non-elementary membrane h0is possible only if it contains two immediately lower membranes hi,hjof opposite polarization, + and −. In this case, the membranes of opposite polarizations are separated in the two new membranes h01 and h02 together with all the membranes of similar charge, but for which the polarizations can change. The membranes with neutral charge are copied in both obtained membranes. The newly created object αm h0indicates that the membrane h0will multiply. The labels h01 and h02 are used to indicate uniquely the two instances of membrane h0. We shall use the subscript 1 for the membrane containing the membranes initially charged with +, and the subscript 2 for the membrane containing the membranes initially charged with −. ii. αm h0phih0+hi→αm h0phi1h01 +0 hi iii. αm h0phih0−hi→αm h0phi2h02 −0 hi iv. αm h0phih00hi→αm h0phi1h01 phi2h02 00 hi Using these rules, is modelled the change of the membrane structure in the initial membrane system such that the membranes with charge + are included in membrane h01 and the label is changed from hito hi1, while the membranes with charge −are included in membrane h02 and the label is changed from hito hi2. For the membranes with charge 0 a fresh copy is included both in membranes h01 and h02 and the label Flattening P Systems with Active Membranes 7 hiis changed to hi1and hi2. The charge is primed so no other rule can be used for the obtained membranes until the division ends. v. +0 hiahi→+0 hia0 hi1 vi. −0 hiahi→ −0 hia0 hi2 vii. 00 hiahi→00 hia0 hi1a0 hi2 The objects are relocated to the new obtained membranes, and when necessary duplicated. viii. +0 hi→αhi1 ix. −0 hi→αhi2 x. 00 hi→αhi1αhi2 xi. αm h0→αh01 αh02 This rules have a lower priority than the one above. When there are no more objects to be transferred to the newly obtained membranes, the primed polarizations are changed to new polarizations. If there are no primed polarizations remained, then modelling of the division process is finished by changing the label αm h0to two new membranes αh01 and αh02 . To be able to apply similar rules as for the initial membranes h0,h1, . . . , hnalso to the newly created membranes the rules for hiare duplicated for the newly created membranes using instead of objects ahi, objects ahi1or ahi2, respectively. As an example, for the rule αhiahi→ αhivhiof membrane hi, an instance of it is created for each membrane hij,j∈ {1,2}namely αhij ahij →αhij vhij . The rules are applied according to the following sequence of priorities: (f).ii > (f).i > (f).xi (f).iii > (f).i > (f).xi (f).iv > (f).i > (f).xi (f).v > (f).viii (f).vi > (f).ix (f).vii > (f).x g) a0 h→ah After applying all possible rules in a step, in order to mve the next step of the evolution, the primed objects (e.g., a0 h) are transformed into simple objects (e.g., ah). The rules are simulated using the application details for P systems with active membranes, except for rule (g) that has the lowest priority among all rules and is applied last in order to prepare the system for a new evolution step. Remark 1. We end by emphasizing the size of the P system Πfwith respect to that of Π. The cardinality depends on the size of a halting configuration of the initial membrane system. Consider that the largest configuration has mmembranes. Thus, the cardinality of the alphabet Vfis, card(Vf) = m×(card(V) + 10 ×m) while the cardinality of the rule set Rfis,: card(Rf) = m×(card(R(a)) + card(R(a)) + card(R(c))+ 8 B. Aman, G. Ciobanu +5 ×card(R(d)) + 3 ×card(R(e)) + 11 ×card(R(f)) + card(Vf)), where R(a) denotes the number of (a) rules from the set of rules R. 4 Conclusion The idea of using a flat membrane system to simulate P systems with multiple membranes has previously appeared in several papers; a formal presentation can be found in [5]. However, the P systems with multiple membranes had a static structure, not involving dissolution. The dissolution aspects where tackled in [1]. In this paper we presented a general approach for P systems with active membranes, based on the use of catalysts, cooperation and priorities. The translation presented here can be used to simplify proofs of statements involving general P systems with active membranes by using only flat P systems. However, concerns may appear regarding the increasing number of objects and rules in the P system Πf, according to Remark 1. References 1. O. Agrigoroaiei, G. Ciobanu. Flattening the Transition P Systems with Dissolution. Lecture Notes in Computer Science, vol.6501, 53–64, 2011. 2. G. Ciobanu. Membrane Computing and Biologically Inspired Process Calculi. “A.I.Cuza” University Press, Ia¸si, 2010. 3. G. Ciobanu. Semantics of P Systems. Oxford Handbook of Membrane Computing, Oxford University Press, 413–436, 2010. 4. G. Ciobanu, Gh. P˘aun, M.J. P´erez-Jim´enez. Applications of Membrane Computing, Springer, Natural Computing Series, 2006. 5. R. Freund, S. Verlan. A Formal Framework for Static (Tissue) P Systems. Lecture Notes in Computer Science, vol.4860, 271–284, 2007. 6. Gh. P˘aun. Membrane Computing. An Introduction. Springer, 2002. 7. Gh. P˘aun, G. Rozenberg, A. Salomaa (Eds.) The Oxford Handbook of Membrane Computing. Oxford University Press, 2010. Studying the Chlorophyll Fluorescence in Cyanobacteria with Membrane Computing Techniques Ioan Ardelean1, Daniel D´ıaz-Pernil2, Miguel A. Guti´errez-Naranjo3, Francisco Pe˜na-Cantillana3, Iris Sarchizian4 1Institute of Biology Bucharest, Romanian Academy, 060031 Bucharest, Romania [email protected] 2Research Group on Computational Topology and Applied Mathematics Department of Applied Mathematics - University of Sevilla, 41012, Spain [email protected] 3Research Group on Natural Computing Department of Computer Science and Artificial Intelligence University of Sevilla, 41012, Spain [email protected], [email protected] 4Scoala Gimnaziala nr.38 Dimitrie Cantemir, Constanta, Romania [email protected] Summary. In this paper, we report a pioneer study of the decrease in chlorophyll fluorescence produced by the reduction of MTT (a dimethyl thiazolyl diphenyl tetrazolium salt) monitored using an epifluorescence microscope coupled to automate image analysis in the framework of P systems. Such analysis has been performed by a family of tissue P systems working on the images as data input. 1 Introduction Membrane Computing has many features that makes it suitable for the study and the implementation of algorithms of digital images. One of them is that, usually, these algorithms can be parallelized and locally solved. Regardless how large the picture is, many algorithmic processes can be performed in parallel in different local areas. Another interesting feature is that the local information needed for a pixel transformation can also be easily encoded in the data structures used in Membrane Computing. Recently, a new research line has been open by applying well-known Membrane Computing techniques for solving problems from digital images. For example, segmentation is a well-known problem in the process of digital images which tries to 10 I. Ardelean et al. assign a label to every pixel in an image in such way that pixels with the same label share certain visual characteristics. Segmentation has shown its utility, for example, in bordering tumors and other pathologies or computer-guided surgery. In [11, 12, 13, 15, 31] we can find several approaches to this problem with Membrane Computing techniques. Other problems as thresholding [10] or smoothing [25] has also been considered in the framework of membrane computing. Special attention deserves [18], where the symmetric dynamic programming stereo (SDPS) algorithm [19] for stereo matching was implemented by using simple P modules with duplex channels or [33], where the authors combine Membrane Computing and quantum-inspired algorithms for image processing. In [2], a first approach of the application of Membrane Computing techniques to the study of images from Microbiology was presented. Automated image analysis is increasingly used in Microbiology to quantify important parameters for research and application. The most studied so far are the cell numbers, cell volumes, frequencies of dividing cells, in situ classification of bacteria, enumeration of actively respiring bacteria, characterization of bacterial growth on solid medium, viability and physiological activity in biofilms (e.g. [9, 17, 29, 30]). In [2], the focus was the study of the application of Membrane Computing techniques to the problem of counting cells. The whole process is a combination of different techniques of processing images (binarization, segmentation, noise reduction . . . ) which can be performed by different families of P systems. The final algorithm is a sequence of partial processes which can be performed by Membrane Computing techniques, and the application of such processes can be seen as a global machine which takes as input a digital image showing a biological entity (usually, a photograph taken with a microscopy in a wet lab) and the output is the number of cells in the picture. In this paper, we focus on the problem of considering the intensity of color in cyanobacteria, a phylum of bacteria that obtain their energy through photosynthesis, by using algorithms based on Membrane Computing techniques. We report a new study of the decrease in chlorophyll fluorescence produced by the reduction of MTT (a dimethyl thiazolyl diphenyl tetrazolium salt) monitored using an epifluorescence microscope coupled to automate image analysis in the framework of P systems The different stages of the analysis have been performed by a family of tissue P systems working on the images as data input. Such families of P systems used in the stages of the process have inspired parallel software programs which have been developed by using a device architecture called CUDATM , (Compute Unified Device Architecture). CUDATM is a general purpose parallel computing architecture that allows the parallel NVIDIA1Graph- ics Processors Units (GPUs) to solve many complex computational problems in a more efficient way than on a CPU. GPUs constitute nowadays a solid alternative for high performance computing, and the advent of CUDA allows programmers a friendly model to accelerate a broad range of applications. This novel architecture has been previously used to implement parallel software that simulates the behav- 1http://www.nvidia.com. Studying the Chlorophyll Fluorescence in Cyanobacteria 11 ior of P systems [5, 6, 7, 8, 24, 25], and, in a similar way to other implementations, the obtained results in the problem of detecting cyanobacteria are quite promising. The paper is organized as follows: Next, we recall the computational model used to design the different families of P systems that performs the stages of the algorithm. In Section 3, a short presentation of the biological experiment on cyanobacteria is presented. Section 4 outlines the steps of the analysis via a family of P systems with takes as input data the images taken in the wet lab. Section 5 provides some details of the implementation of such families on CUDA and finally, the paper ends with some conclusions and open lines for future research. 2 Formal Framework Next, we recall some basics on the P system model chosen for implementing the solution described below. The model is tissue-like P systems with promoters. Promoters are usually defined on cell-like models [20] and its extension to tissue-like is quite natural. Next, we recall the formal definition. Definition 1. A tissue-like P system with promoters of degree q≥1is a tuple of the form Π= (Γ, Σ, E, w1, . . . , wq,R, iin, iout) where 1. Γis a finite alphabet, whose symbols will be called objects; 2. Σ⊆Γis the input alphabet; 3. E ⊆ Γis a finite alphabet representing the set of the objects in the environment available in an arbitrary large amount of copies; 4. w1, . . . , wqare strings over Γrepresenting the multisets of objects associated with the cells in the initial configuration; 5. Ris a finite set of rules of the following form: (pro |i, u/v, j),for 0≤i6=j≤q, pro, u, v ∈Γ∗ In these rules, the labels 1, . . . , q correspond to the qcells and the label 0cor- responds to the environment; 6. iin ∈ {1,2, . . . , q}denotes the input region; 7. iout ∈ {1,2, . . . , q}denotes the output region. The rule (pro |i, u/v, j) can be applied over two cells (or a cell and the environment) iand jsuch that u(contained in cell i) is traded against v(contained in cell j). The rule is applied if in ithe objects of the promoter pro are present. The promoter is not modified by the application of the rule. If the promoter is empty, we will write (i, u/v, j) instead of (∅ | i, u/v, j). Rules are used as usual in the framework of membrane computing, that is, in a maximally parallel way (a universal clock is considered). In one step, each 12 I. Ardelean et al. object in a membrane can only be used for one rule (non-deterministically chosen when there are several possibilities), but any object which can participate in a rule of any form must do it, viz., in each step we apply a maximal multiset of rules. A configuration is an instantaneous description of the system Π, and it is represented as a tuple (w0, w1, . . . , wq), where w1, . . . , wq, where represent the multiset of objects contained in the qcells and w0represent the multiset of objects from Γ−E placed in the environment (initially w0=∅). Given a configuration, we can perform a computation step and obtain a new configuration by applying the rules in a parallel manner as it is shown above. A sequence of computation steps is called a computation. A configuration is halting when no rules can be applied to it. 3 Cyanobacteria The object of study of our research are cyanobacteria. It is a phylum of bacteria that obtain their energy through photosynthesis. The ability of cyanobacteria to perform oxygenic photosynthesis is the reason why the primitive reducing atmosphere has became an oxidizing one. This new atmosphere sustained the emergence of living beings depending of oxygen, and changed the face of the Earth. It is thought that chloroplasts in plants and eukaryotic algae evolved from cyanobacterial ancestors. Cyanobacteria are the most diversified, ecologically most successful and evolutionary most important group of prokaryotes [27] clearly defined by the ability to carry out oxygenic photosynthesis in the thylakoid membranes and respiration both in plasma membrane and thylakoid membrane [26]. Oxygenic photosynthesis, the ability to use the light energy to synthetize glucides from carbon dioxide and water, and to evolve oxygen from water molecules is essential for all the other forms of life on Earth. Historically, cyanobacteria were the first organisms to perform oxygenic photosynthesis and this metabolic ability of early cyanobacteria have converted the early reducing atmosphere of Earth (when no free molecular oxygen was available) into an oxidizing one. This process emerged approximately 3.5 billion years and had an essential effect on the evolution of life on our planet. There is a general agreement that the oxic atmosphere allowed the emergence and evolution of aerobic microorganisms, this is the occurrence of one of the greatest evolutive events on Earth, the emergence of eukaryotic cells most probably by endosymbiotic association between different types of prokaryotic cells. The early cyanobacteria participated to this endosymbiosis thus all photosynthetic organisms on Earth have some cyanobacteria as ancestors; together with cyanobacteria (50 % contribution at planetary level) all these photosynthetic eukaryotes, including higher plants, contribute today to the synthesis of organic matter and oxygen production, the basis of all life forms here. As an example of the importance of cyanobacteria for the life on our planet, one can remember that Prochorococcus -the most abundant cyanobacterium on Studying the Chlorophyll Fluorescence in Cyanobacteria 13 Earthis responsible for 20 % of the molecular oxygen evolved (and, corresponding for 20 % of the consumed carbon dioxide and 20 % organic matter synthetized during oxygenic photosynthesis). Some cyanobacteria have also the ability to use atmospheric nitrogen as nitrogen source for growth, thus being able to live in environments where the concentrations of organic or inorganic nitrogen are very low. Cyanobacteria being very versatile microorganisms can live in very different environments for example from warmer springs to many cold sites, including glaciers. The important functions in Nature make cyanobacteria very strong candidates for the development of bio(nano)technologies the most known topics being the photoproduction of molecular hydrogen or electricity, biomass (and related processes, including valuable products) production and removal of different pollutants (petroleum hydrocarbon, heavy metals, nitrogen and phosphorus etc., ) from the environment. The concentration of metalimnetic populations of Planktothrix sp. can be measured by epifluorescence microscopy of filaments collected on membrane filters. Computer image analysis is used to determine the length of filaments whose phycoerythrin fluoresces strongly in green light [32]. Similar methods have been used for enumeration of picoplanktonic cyanobacteria [1]. Image analysis was used in a previous work done on color analysis of cyanobacteria under labelling with quantum dots [3] and the cells within filamentous cyanobacteria were counted with tissue-like P systems [2]. Sarchizian et al. [28] investigated the ability of a cyanobacterial strainiso- late IS-H- to reduce MTT [(3-(4,5-Dimethylthiazol-2-yl)-2,5-diphenyltetrazolium bromide)], an artificial electron acceptor, with special emphasis on quantitative determinations at single cell level using automated image analysis for precise color measurement of cells within the filaments of this strain. Up to our best knowledge this is the first report on the use of automated image analysis for the measurement of reduction of artificial redox carriers at single cell level in cyanobacteria or any other levels. The results show a strong decrease in the blue signal during MTT reductions by each individual analyzed cell, as a consequence of orange light absorption by reduced MTT. Cyanobacterial filaments (actually each filament is one biological specimen) contains chlorophyll a which has a characteristic red fluorescence. This red fluorescence can be seen using different physical instruments, as fluorescence microscopes. This fluorescence is related to the light initially absorbed by the cell. In constant experimental conditions the fluorescence as one can be seen using a fluorescence microscope is practically constant. In our experiments cyanobacterial culture were challenged with a special chemical, namely MTT. MTT (3-(4,5-Dimethylthiazol- 2-yl)-2,5-diphenyltetrazolium bromide, a yellow tetrazole), a chemical belonging to tetrazolium salts that is largely used to measure the metabolic activity in living cells (see, e.g., [4] or [28]). The rationale design of our experiments is the following: the interaction of living cyanobacteria with MTT causes the reduction of MTT with electrons coming from cyanobacterial metabolism (photosynthesis, respiration and intermedi- 14 I. Ardelean et al. Fig. 1. The decrease of chlorophyll red fluorescence as a consequence of the accumulation inside the cell of MTT formazans crystal can be used to measure the intensity of MTT metabolic, light -dependent, reduction by cyanobacteria ary metabolism). The reduction of MTT further decrease the intensity of chlorophyll fluorescence. The chemical reduction of MTT changes some of its properties, namely the color and the physical state of the molecule. The oxidized molecule is yellowish and water soluble whereas the reduced molecule (the so-called formazan) is dark brown, having a specific absorption spectrum, and it is insoluble in water (Fig. 1 (A)). Fig. 1 (B) shows how MTT is reduced by enzymes called reductase (acting in photosynthesis, respiration and intermediary metabolism) to formazan. MTT is yellowish, soluble in water, and reduced MTT (MTT formazan) is insoluble (not Studying the Chlorophyll Fluorescence in Cyanobacteria 15 shown); when an appropriate chemical is added to dissolve the insoluble purple formazan product into a colored solution, this colored solution can be quantified by measuring the optical density at a certain wavelength (usually between 500 and 600 nm, as one can see, by a spectrophotometer). Thus the reduction of MTT generate crystals of formazan which remain inside the cyanobacterial cell covering the intracellular structures of cyanobacteria. The most important intracellular structures of cyanobacteria involved in the reduction of MTT (as well as in the reduction of other artificial electron acceptors) are the thylakoides. Thylakoides are the sites where some of the light energy absorbed by thylakoids is converted in chemical stable energy found in molecules such as ATP and reduced form of chemical compounds (e.g NADPH etc.,); other part of some of the light energy absorbed by thylakoids is re-emitted as fluorescence. During the process of MTT reduction by living cyanobacteria in light, the reduced MTT (formazan) accumulate inside the cell; this accumulation can be seen microscopically using light microscopy and even quantificated by automated image analysis [28]. This accumulation of reduced MTT inside the cell physically covers intracellular structures, including thylakoides thus acting as a shield which blocks the access of light to thylakoides, thus decreasing the intensity of chlorophyll fluorescence. Up to our best knowledge, this is for the first time when the decrease in chlorophyll fluorescence produced by the reduction of MTT is monitored using an epifluorescence microscope. However, the inhibition of important metabolic processes in cyanobacteria during tetrazolim salt reduction is documented in literature. Paerl and Bland [23] show the effects of localized reduction of five tetrazolium salts has strong negative impact on three important metabolic processes in cyanobacteria : N2fixation (acetylene reduction), CO2fixation, and H2consumption. During short-term (within 30 min) exposures in the cyanobacterium A. oscillarioides, salt reduction in heterocysts occurred simultaneously with inhibition of acetylene reduction Conversely, when salts failed to either penetrate or be reduced in heterocysts, no inhibition of acetylene reduction occurred. When salts were rapidly reduced in vegetative cells, 14CO2fixation and 3H2utilization rates decreased [23] . The type of experiment presented in this paper has a deeper biological theoretical significance and a stronger practical application than our previous work done on color analysis of cyanobacteria under labelling with quantum dots [3] because of metabolic background. The decrease of chlorophyll fluorescence as a consequence of the accumulation inside the cell of MTT formazans crystal can be used to (indirectly) measure the intensity of MTT reduction at the level of filaments or even at the level of individual cells within each filament, cells which are subcomponents of the biological individual (the filament in the case of filamentous cyanobacteria). 22 I. Ardelean et al. 15. D´ıaz-Pernil, D., Guti´errez-Naranjo, M.A., Molina-Abril, H., Real, P.: Designing a new software tool for digital imagery based on P systems. Natural Computing pp. 1–6 (2011) 16. D´ıaz-Pernil, D., Guti´errez-Naranjo, M.A., Real, P., S´anchez-Canales, V.: Computing homology groups in binary 2D imagery by tissue-like P systems. Romanian Journal of Information Science and Technology 13(2), 141–152 (2010) 17. Fero, M., Pogliano, K.: Automated quantitative live cell fluorescence microscopy. Cold Spring Harb Perspectives in Biology 2(8), a000455 (2010) 18. Gimel’farb, G., Nicolescu, R., Ragavan, S.: P systems in stereo matching. In: Real, P., D´ıaz-Pernil, D., Molina-Abril, H., Berciano, A., Kropatsch, W. (eds.) Computer Analysis of Images and Patterns, Lecture Notes in Computer Science, vol. 6855, pp. 285–292. Springer Berlin / Heidelberg (2011) 19. Gimel’farb, G.L.: Probabilistic regularisation and symmetry in binocular dynamic programming stereo. Pattern Recognition Letters 23(4), 431–442 (2002) 20. Ionescu, M., Sburlan, D.: On P systems with promoters/inhibitors. Journal of Universal Computer Science 10(5), 581–599 (may 2004) 21. Nickolls, J., Buck, I., Garland, M., Skadron, K.: Scalable parallel programming with CUDA. Queue 6, 40–53 (March 2008) 22. Owens, J.D., Houston, M., Luebke, D., Green, S., Stone, J.E., Phillips, J.C.: GPU Computing. Proceedings of the IEEE 96(5), 879–899 (May 2008) 23. Paerl, H.W., Bland, P.T.: Localized tetrazolium reduction in relation to N2fixation, CO2fixation, and H2uptake in aquatic filamentous cyanobacteria. Applied and Environmental Microbiology 43(1), 218–226 (January 1982) 24. Pe˜na-Cantillana, F., D´ıaz-Pernil, D., Berciano, A., Guti´errez-Naranjo, M.A.: A parallel implementation of the thresholding problem by using tissue-like P systems. In: Real, P., D´ıaz-Pernil, D., Molina-Abril, H., Berciano, A., Kropatsch, W.G. (eds.) CAIP (2). Lecture Notes in Computer Science, vol. 6855, pp. 277–284. Springer (2011) 25. Pe˜na-Cantillana, F., D´ıaz-Pernil, D., Christinal, H.A., Guti´errez-Naranjo, M.A.: Implementation on CUDA of the smoothing problem with tissue-like P systems. International Journal of Natural Computing Research 2(3), 25–34 (2011) 26. Peschek, G.A.: Structure-function relationships in the dual-function photosyntheticrespiratory electron-transport assembly of cyanobacteria (blue-green algae). Biochemical Society Transactions 24(3), 729–733 (August 1996) 27. Peschek, G.A., Obinger, C., Fromwald, S., Bergman, B.: Correlation between immuno-gold labels and activities of the cytochrome-c oxidase (aa3-type) in membranes of salt stressed cyanobactria. FEMS Microbiology Letters 124(3), 431–437 (1994) 28. Sarchizian, I., Cˆırnu, M., Ardelean, I.I.: Isolation of a heterocyts - forming cyanobacterium and quantification of its biotechnological potential with respect to redox properties at single cell level. Romanian Biotechnological Letters 16(6), 3–9 (2011) 29. Selinummi, J., Ruusuvuori, P., Podolsky, I., Ozinsky, A., Gold, E., Yli-Harja, O., Aderem, A., Shmulevich, I.: Bright field microscopy as an alternative to whole cell fluorescence in automated analysis of macrophage images. PLoS ONE 4(10), 1 9 (2009) 30. Selinummi, J., Sepp¨al¨a, J., Yli-Harja, O., Puhakka, J.A.: Software for quantification of labeled bacteria from digital microscope images by automated image analysis. Biotechniques 39(6), 859–863 (2005) Studying the Chlorophyll Fluorescence in Cyanobacteria 23 31. Sheeba, F., Thamburaj, R., Nagar, A.K., Mammen, J.J.: Segmentation of peripheral blood smear images using tissue-like P systems. Sixth International Conference on Bio-Inspired Computing: Theories and Applications (BIC-TA), 2011, 257–261 (sept 2011) 32. Walsby, A.E., Avery, A.: Measurement of filamentous cyanobacteria by image analysis. Journal of Microbiological Methods 26(1-2), 11 – 20 (1996) 33. Zhang, G.X., Gheorghe, M., Li, Y.: A membrane algorithm with quantum-inspired subalgorithms and its application to image processing. Natural Computing 11(4), 701–717 (2012) A GPU Simulation for Evolution-Communication P Systems with Energy Having no Antiport Rules Zylynn F. Bangalan1, Krizia Ann N. Soriano1, Richelle Ann B. Juayong1, Francis George C. Cabarle1, Henry N. Adorna1, Miguel A. Mart´ınez–del–Amor2 1Algorithms & Complexity Lab Department of Computer Science University of the Philippines Diliman Diliman 1101 Quezon City, Philippines E-mail: [email protected],[email protected],[email protected], [email protected],[email protected] 2Research Group on Natural Computing Department of Computer Science and Artificial Intelligence University of Seville Avda. Reina Mercedes s/n, 41012 Sevilla, Spain E-mail: [email protected] Summary. Evolution-Communication P system with energy (ECPe systems) is a celllike variant P system which establishes a dependence between evolution and communication through special objects, called ‘energy,’ produced during evolution and utilized during communication. This paper presents our initial progress and efforts on the implementation and simulation of ECPe systems using Graphics Processing Units (GPUs). Our implementation uses matrix representation and operations presented in a previous work. Specifically, an implementation of computations on ECPe systems without antiport rules is discussed. 1 Introduction Evolution-Communication P system with energy (ECPe systems) is a modification to Evolution-Communication P system (ECP system). Objects evolve through evolution rules while communication of objects to other regions bounded by membranes is done through symport/antiport rules. The unique features of an ECPe system not present for Evolution-Communication P system are listed below. •A communication rule must require at least one quantum of energy, referred to as e, to be triggered. •This quantum of energy, e, is produced by evolution rules and consumed by communication rules only i.e. it can never be present at the initial configuration. 26 Z.F. Bangalan et al. ECPe systems are actually presented to provide a measure for communication over Evolution-Communication P systems [1]. Other important characteristics of ECPe systems which are common to other variants of P systems are also worth mentioning. Objects in each membrane are considered as multisets since there can be multiple instances and type of objects present within membranes. Evolution rules and communication rules within each membrane are applied in a nondeterministic maximally parallel manner. Maximal parallelism ensures that all rules that can be applied must be applied given the multiset of objects in each membrane while nondeterministic application of rules arises because it is possible that more than one rule is applicable at the same time. Further definition and discussion about ECPe systems is found in section 2. Computations in ECPe system have been represented using vectors, matrices and linear algebra in [6]. As suggested in [8], we can make these vectors and matrix representations local to regions to avoid dealing with sparse vectors and matrices and to make computations in the system suitable for parallel processing. Many works have been made for simulating P systems. Efforts for simulation is motivated by the fact that simulations help in the analysis of P systems. Since P systems are highly parallel in nature, many of the works are focused on its parallel implementation. One example is the parallel implementation of Transition P systems on a cluster of computers presented in [5]. Another is that in [3] wherein Spiking Neural P systems are simulated in parallel using GPUs. Though there are already a number of parallel implementations for P systems, none of these is directly applicable to ECPe systems. We are interested in a parallel implementation of ECPe systems in GPUs to contribute on researches implementing cell-like variant of P systems on GPUs. We also aim to spark interest and aid in further researchers in the field of Membrane computing, particularly ECPe systems, and parallel computing paradigms in general. Just like the work in [3], we will make use of NVIDIA GPUs for this parallel simulation and implementation. NVIDIA, a manufacturer of GPUs, introduced Compute Unified Device Architecture (CUDA). CUDA is a software and hardware architecture that permits programmers to have a control over NVIDIA’s GPU hardware and use them for parallel computations. Our parallel implementation of ECPe systems is a continuation on an earlier study [8]. Algorithms for the methodology presented in [8] are developed and are implemented in CUDA C. It is important to emphasize that the implementation done only involves methodology for forward computing of Evolution Communication P system without antiport rules only 2 ECPe system 2.1 Definitions and notations ECPe system is introduced in [1] as a model where special objects are used to establish dependence of communication on evolution. The goal of [1] is mainly to A GPU Simulation for ECPe Systems Having no Antiport Rules 27 initiate communication complexity analysis for P systems. In order to evaluate communication complexity for computations in ECPe systems, a cost of using a communication rule is considered. This cost is in the form of a quantity of “energy”. A single object can be transported by a communication rule with the help of one or more quantum of energy, e. This quantum of energy is a special object, e6∈ O, which can be produced by evolution rules and consumed through communication rules only. No communication rules can be applied without consuming an amount of “energy”. When objects are transported, the quanta of energy consumed are lost. They do not pass across membranes. Following the definition in [1], an EC P System with energy is a construct of the form Π= (O, e, µ, ω1, ..., ωm, R1, R0 1, ..., Rm, R0 m, iout) where: 1. Ois the alphabet of objects; 2. mis the total number of membranes; 3. µis the membrane structure Membrane iis called the parent membrane of a membrane j, denoted parent(j), if the paired-labelled square brackets corresponding to membrane jis inside the paired-labelled square brackets corresponding to membrane i, i.e., [i. . . [j]j]i. Conversely, membrane jis called a child membrane of membrane i, denoted j∈children(i) where children(i) is referring to the set of membranes inside membrane i. 4. ω1, ..., ωmare multisets of objects present in the regions bounded by membranes; 5. R1, ..., Rmare sets of evolution rules, each associated with a region delimited by a membrane; An evolution rule is of the form a→vwhere a∈O,v∈(O∪{e})∗i.e eshould never be in the initial configuration and cannot be evolved. 6. R0 1, ..., R0 mare sets of symport/antiport rules each associated with a membrane; A symport rule is of the form (aei, in) or (aei, out), where a∈O,i≥1. The number iis called the energy of the rule. An antiport rule is of the form (aei, out;bej, in) where i, j ≥1. The number i+jis called the energy of the rule. 7. iout ∈ {0,1, ..., m}is the output region where i0is the environment; As in classical cell-like variants, rules must be applied in a nondeterministic and maximally parallel manner. A configuration at any time iis denoted by Ciwhile a transition from Cito Ci+1 through nondeterministic and maximally parallel manner of rule application can be denoted as Ci⇒Ci+1. A series of transition is said to be a computation and can be denoted as Ci⇒∗Cjwhere i < j. Computation succeeds when the system halts; this occurs when the system reaches a configuration wherein none of the rules can be applied. This configuration is called a halting configuration. If the system doesn’t halt, this implication failure of computation because the system did not produce any output. 28 Z.F. Bangalan et al. Fig. 1. An ECPe system with a construct of Π= ({a, #, e}, e, [1[2]2]1, ω1, ω2, R1, R2, R0 1, R0 2,2) where ω1={a2,#},ω2=∅,R1= {r11 :a→aa, r12 :a→ee},R2={#→#},R0 1=∅,R0 2={r 0 21(ae, in), r 0 22 : (#e, in)} 2.2 Matrix Representations In [6], a matrix representation for ECPe system is obtained. With this representation, matrix operations can be used to model computations in ECPe system. The work is motivated by the fact that an algebraic representation helps in simulating P system. An implementation can help in easier or faster analysis of ECPe system. To obtain a matrix representation, a total order over the objects and over the rules are defined so that the elements can be identified by their positions. The following are also defined: •Configuration vector Ciis a vector with length |(O∪ {e})× {1, ..., m}| and whose elements are numbers representing the multiplicity of objects in each region at time i. •Application vector aiis a vector with length |S1≤k≤mRk∪R0 k|and whose elements are the number of times each rule is applied during a transition Ci−1⇒Ci. •Transition matrix MΠis an nby rmatrix (n=|S1≤k≤mRk∪R0 k|and r= |(O∪ {e})× {1, ..., m}|) that shows the effect of the application of each rule. The matrix MΠ(r, (α, k)) gives the number of consumed or produced object αin region kwhen the rule ris applied once. Elements with negative value represent the number of objects consumed or moved out of a given region while elements with positive value represent the number of objects that will be produced or moved in a given region. Elements with zero value represent the objects that are either not involved in the rule or involved but the total effect of their production and consumption is zero. •Trigger matrix is an r×nmatrix that represents all the needed objects in order to activate the rule. The elements are the number of objects required for a rule to be applied. A GPU Simulation for ECPe Systems Having no Antiport Rules 29 (Formal definitions of the vectors and matrices above are presented in [6]). Forward computing is the process of finding all possible next configuration given an input configuration. Equation 1 shows that given a configuration vector for a certain time Ck−1, transition matrix MΠand an application vector for a transition Ck−1⇒Ck, the next configuration vector Ckcan be computed: (Ck=Ck−1+ak·MΠ) (1) The equation above implies that in order to compute all next configurations for forward computing, there is a need to find all valid application vectors ak. [7] shows that this problem can be reduced into solving a system of linear equations. 2.3 Localization of Computations In [7], the localization of rules in ECPe system are taken into consideration, dividing equation (1) into multiple equations (one for every local region) making them suitable for parallel processing. Localization also provides a hint to unreachability based on rules and initial multiset of objects. The following notations are defined over an ECPe system Πwithout antiport rules. •Let IO(r, k) be the set of objects in region kinvolved in a rule r. •Let TO(r, k) be the set of objects in region kthat trigger a rule r. The following definitions and theorems taken from [7]. Definition 1 Involved Rules in Region k IR(k) = Rk∪R0 k∪(Sk0∈children(k)R0 k0) Definition 2 Possible Objects in Region k PO(k) = {α|αappeared in wk} ∪ (Sr∈IR(k)IO(r, k)) Definition 3 Effect Rules in Region k ER(k) = {r|r∈Rk} ∪ (IR(k)− {r0|r0∈IR(k)and T O(r0, k)6=∅}) Definition 4 Trigger Rules in Region k TR(k) = {r|T O(r, k)6=∅} Definition 5 Configuration Vector for each Region k A configuration vector Ci,k is a vector whose length is |P O(k)|. The vector Ci,k(α) refers to the multiplicity of object αin region kat configuration Ci. Definition 6 Application Vector for each Region k An application vector ai,k is a vector whose length is |IR(k)|. The vector ai,k(r) refers to the number of application of rule rspecifically in region kduring the transition Ci−1⇒Ci. 30 Z.F. Bangalan et al. Definition 7 Transition Matrix for each Region k A transition matrix MΠ,k is a matrix whose dimension is |IR(k)|×|PO(k)|. The matrix MΠ,k(r, α)returns the number of consumed or produced object αin region k upon single application of rule r. The consumed objects have negative values while the produced objects are positive. If object αin region kis not used in rule r, then its value is zero. Theorem 1 (from [7]) The effect of Equation (1) is the same as the effect of performing Ci,k =Ci−1,k +ai,k ·MΠ,k (2) for each region kprovided that if kand k0are the sender and receiver regions corresponding to a communication rule r0∈IR(k)∩IR(k0), then ai,k(r0) = ai,k0(r0). Corollary 1 (from [7]) The formula for computing backward is Ci−1,k =Ci,k −ai,k ·MΠ,k (3) for each region kprovided that if kand k0are the sender and receiver regions corresponding to a communication rule r0∈IR(k)∩IR(k0), then ai,k(r0) = ai,k0(r0). The above definitions and theorems are used to make vectors and matrices local to regions to exploit independence between regions for parallel computations. 2.4 Methodology for Forward Computing Given Ci,k, we determine Ci+1,k by forward computing using the methodology presented in [8]. 1. Categorize all possible objects in P O(k)for all region k.First, categorize all α∈PO(k) for a certain region k. The categories are: •Category 1: Evolution Trigger Object αis in this category if there exists r∈Rksuch that T O(r, k) = {α}. •Category 2: Communication Trigger Only Object αbelongs in this category if there does not exist r∈Rksuch that TO(r, k) = {α}but there exists r0∈IR(k) such that α∈TO(r0, k). •Category 3: Not a Trigger Object αis not in Category 1 and is not in Category 2. 2. Construct identity rules for objects in Category 2 and 3 for all region k.For each α∈PO(k) that belongs to one of Category 2 and Category 3, include an identity rule α→α. Place all these rules in a set labelled Radd,k. Also, keep a list of α0∈PO(k)− {e}that fall under Category 2. Call this list as Listcat2and sort it in increasing order of transport energy requirement. 3. Construct Trigger Matrix TMΠ,k for all region kThe defined rules associated with the rows of T MΠ,k must be the rules that lessen the multiplicity of objects in region k. These rules are represented in the set T R(k). Again, let A GPU Simulation for ECPe Systems Having no Antiport Rules 31 the additional rules from Radd,k be represented in the rows as well. The set of objects represented in the columns of T MΠ,k remains PO(k). TMΠ,k has dimensions |TR(k)∪Radd,k| × |P O(k)|.TMΠ,k(r, α) gives the multiplicity of αin region k that is required to apply rule ronce. 4.Set the length of the vector of unknowns (extended application vector) a0 i,k for all region kThe length of a0 i,k is |TR(k)∪Radd,k|. 5. Solve system of linear equation Find all solutions to the equation a0 i,k ·TMΠ,k =Ci−1,k (4) Again, because the application vector’s ( a0 i,k) elements represent the number of application of rules, it must not contain negative numbers i.e. the elements must always be natural numbers. The value a0 i,k(r) returns either the number of application of each rule r∈T R(k) or how many object αis unevolved or unmoved (if (r:α→α)∈Radd,k). T R(k) and Radd,k are disjoint sets. 6. Filter solutions in step 5 For each region k, if Listcat26=∅, scan the sorted Listcat2and find out the first object, labelled αcat2,min, falling under Category 2 whose corresponding identity rule application is non-zero, i.e. a0 i,k(αcat2,min → αcat2,min)>0. Since Listcat2is sorted in increasing order of energy requirement for transport, αcat2,min has the least energy required for communication. Label its corresponding energy as energy(αcat2,min). Filter solutions in step 5 by adding, for each region kwith a non-empty Listcat2, the inequality below: a0 i,k(e→e)< energy(αcat2,min) (5) 7. For each solution in step 6, find ai,k When values for a0 i,k in all region k are found, disregard all identity rules r0∈Radd,k. Fill the values of an application vector ai,k through the equation ai,k(r) = a0 i,k(r), r ∈Rk.(6) For every communication rule r∈IR(r, k0)∩IR(r, k00), ai,k0(r) = ai,k00 (r) = a0 i,k0(r) (7) for all communication rule r∈IR(k0)∩IR(k00) where region k0is the sending region. Theorem 2 (from [7]) All possible ai,k generated through the above methodology leads to a valid Ci,k yielded from Ci−1,k in one computational step. 3 Graphics Processing Unit (GPU) 3.1 On Using GPUs Although GPUs are initially used for image processing, it is actually designed to handle computationally demanding applications. Thus, its use is extended to accommodate different applications. GPU has been widely used to work with highly 38 Z.F. Bangalan et al. a0 i,1(r11) + a0 i,1(r12)=2−2 = 0 a0 i,1(Add11) = 1 −0=1 2 + 0 + 0 = 2 a0 i,1(r11) + a0 i,1(r12)=2−1 = 1 a0 i,1(Add11) = 1 −1=0 2 + 0 + 0 = 2 a0 i,1(r11) + a0 i,1(r12)=2−0 = 2 a0 i,1(Add11)=1−2 = −1 2 + 0 + 0 = 2 If this yields a negative number, then this solution for energy equation is not applicable. If not, solutions for the objects constitute one extended application vector [8]. In the above illustrations the solution 0 2 0 is not a valid solution. The new linear systems of equation to solve are now, a0 i,1(r11) + a0 i,1(r12) = 0 a0 i,1(Add11)=1 a0 i,1(r11) + a0 i,1(r12) = 1 a0 i,1(Add11)=0 a0 i,1(r11) + a0 i,1(r12)=2 a0 i,1(Add11) = 0 a0 i,1(r11) + a0 i,1(r12)=2 a0 i,1(Add11) = 2 a0 i,1(r11) + a0 i,1(r12)=1 a0 i,1(Add11)=1 The new systems of linear equations are then solved independently of each other. Solving Equations. As what has been observed, each equation in the system of linear equations are not always independent nor dependent of each other. In case of regions that has energy condition, each non-energy object condition are dependent on it. However, each non-energy equation iscomputation independent of each other, this is also true in regions that does not have energy condition. Thus, the approach is to solve each equation independently of each other, except for energy conditions. As discussed in the previous section, regions with energy condition solves the equation for the energy condition first. After reflecting the solutions for the energy condition to the equations for the non-energy condition, solutions to the equations for the non-energy solutions are computed. For regions without energy condition, the computation goes straight to the independent computations for solutions to the equations for the non-energy equation. The computation for the solutions to each equation can be reduced to the Integer Partition Problem as proposed in [8]. Solving Integer Partition Problem. Integer partitioning means finding a way of writing ras a sum of positive integers which are called partitions. To use these partitions in solving a non-energy equation, the number of partitions must be less than or equal to the number of variables min the left hand side of the equation. A GPU Simulation for ECPe Systems Having no Antiport Rules 39 Fig. 6. Interpreting 5 3as integer partitions through the sticks and pebbles analogy. If the number of partitions is less than m, zeroes must be padded accordingly so that it represents a vector with melements. Then permutations of the partitions must be obtained. The problem of partitioning rwith mcomponents and then obtaining permutation of the partition can be reduced to solving combinations of n swhere n=r+m−1, s =m−1. Combinations can be interpreted or converted into integer partitions through the sticks and pebbles analogy (see Figure 6). In a n scombinations, there are npositions, ssticks, and n−spebbles. Elements in the combinations represent the position of each sticks and the pebbles take the position where there is no stick. The number of pebbles between each stick are the elements of the integer partition. However, solutions to each equation in the system of linear equations does not end on the generation of integer partitions. Since equations for the energy condition can contain a coefficient greater than or equal to 1, the generated integer partitions need to be further filtered to ensure that they are valid solutions to the equation for the energy condition.Given an energy equation of the form c1a1+c2a2+...+cmak= n, we first obtain a lexicographic order of the partitions, add zeroes to these partitions accordingly, and get the permutations of the partitions. Equate these permutated partitions to the equation to get the energy solutions. Let p1, p2, ..., pm be the partitions of rwith mcomponents. a1=c1 p1, a2=c2 p2, ..., am=cm pmis an energy solution if every ai, i ∈1,2, ..., m is a natural number. No similar filtering is needed for the solutions to the equations for the nonenergy condition since we have observed that the coefficient of the equations for the non-energy condition is always equal to 1. Parallel Implementation To solve the equation for energy condition, the process of generation of combinations and its conversion to integer partitions (whose process is described in the previous section), are given to the threads in the GPU device. 40 Z.F. Bangalan et al. If the number of permuted integer partitions C(also equal to the number of combinations of n s) is less than or equal to the number of all available threads Tthen each thread will produce one permuted integer partition only and equate this to the energy equation to check if it is valid. If C > T , then each thread will produce and check dC Tepartitions except for the last thread. The last thread will produce at most dC Tepartitions. The number of blocks to be used is equal to dT Me, where Mis equal to maximum threads per block. Since the non-energy equations Fig. 7. When C > T . If there are three (3) available threads, each thread, except for the last thread, will generate four (4) integer partitions namely, Ci, ..., Ci+4and the last thread will generate three (3) integer partitions. are independent of one another (they depend only on the energy equation) their solutions can be obtained in parallel. If there is an energy equation, the solutions to non-energy equations can be obtained in parallel after the solutions of energy equations are substituted in the system. For the implementation in GPU, a block is responsible for generating solutions of a non-energy equation. At most Mthreads will produce the partitions for the assigned non-energy equation to the block where they belong. If the number of non-energy equations NC is less than or equal to the number of blocks Bthen each block will produce solutions for one non-energy equation only. If NC > B, then each block will produce solutions for dNC Benumber of non-energy equations except for the last block. The last block will produce solutions for at most dC Tenumber of non-energy equations. Step 6: Filter extended application vectors. If the system has an energy equation, the extended application vectors must be filtered. Filtering is done in parallel. If the number of extended application vectors Eis less than or equal to the number of all available threads Tthen each thread will filter one extended application vector only. If E > T, then each thread will filter dE Teextended application vectors except for the last thread. The last thread will produce at most dE Te extended application vectors. The number of blocks to be used is equal to dE Me. The analogy of job allocation to threads is similar to Figure 7. Step 7: Finding all valid application vectors In this step other necessary values are loaded from a file as well as the extended application vectors generated from the previous steps (namely, Step 5 and 6) Identity rules at each region is removed. Thereafter, the extended application vectors are merged with each other to reflect the application of symport rules from sending regions to receiving regions A GPU Simulation for ECPe Systems Having no Antiport Rules 41 Fig. 8. When NC ≤B. If there are three (3) available blocks and equation for non-energy conditions, each block will generate solutions to each equations utilizing the threads allocated for each block to generate integer partitions similar to since the computation done are local to each region only. This will give us all the valid application vectors of region kat time i. This step is done in the host only, using computing and memory resources of the host only. 5 Space and Communication Requirements STEP HOST ALLOCATION HOST TO DEVICE DEVICE ALLOCATION DEVICE TO HOST Finding solutions 1 (C ×left) 1 for the energy equation solcount ×left 1 solcount ×left in the system of linear equations solcount ×left Finding solutions for nonenergy equation in TM rows ×TM cols NEeqCount ×2 NEeqCount × TM rows ×2 the system of linear equations NEeqCount × TM rows ×2 NEeqCount × validCount NEeqCount NEIPsize Finding extended application vectors TM rows ×extAppVecCount TM rows ×extAppVecCount TM rows ×extAppVecCount 1 1 1 Table 1. Memory allocations in Host and Device together with the communication between them if there is an energy equation. Tables 1 and 2 summarizes the space requirements and size of message communicated between host and device. Note that in case of allocation, the value one 42 Z.F. Bangalan et al. STEP HOST ALLOCATION HOST TO DEVICE DEVICE ALLOCATION DEVICE TO HOST Finding solutions for nonenergy equation in the system of linear equations TM rows× TM cols NEeqCount×2 NEeqCount× NEIPsize Finding extended application vectors TM rows Table 2. Memory allocations in Host and Device together with the communication between them if no energy equation. (1) on the table implies that an extra variable is allocated to hold values for use as counter or flag. A value 1 is also used as signal for communication between host and device. In Tables 1 and 2, cells without values indicate no allocation or communication. The variables used are defined as follows: •membraneCount is the number of membranes in the system •IR is the number of involved rules in the region •TM rows is the number of rows of the trigger matrix •TM cols is the number of columns in the trigger matrix •NEeqCount is the number of non-energy equations. For sender regions, this is equal to TM rows −1. •left is the number of terms(partitions) in the left-hand side of the energy equation •right is the multiplicity of an object at the right-hand side of the energy equation. •C=(left+right−1)! (right)!(left−1)!) is the number of integer partitions of right hand side of the energy equation (multiplicity of energy in the system) with components equal to the number of partitions in the left hand side. •solcount =O(C) is the number of valid solutions for the energy equation •validCount is the number of energy solutions for the system of linear equations. •extAppV ecCount =O(CNEeqCount) is the number of extended application vectors of the region •NEIP size is the summation of combinations of i jof each non-energy equation, where i=m2+r2−1, j=m2, m2 being the new number of partitions in the left-hand side of the equation, and r2 being the new right-hand side after the energy solutions are substituted. •validExtAppCount =O(CNEeqCount) In the variables given, the first six items are variables that is only dependent on rules and membrane structures for a given P system, while the rest are variables that are also dependent on configuration. Consequently, this means that the rest of the variables excluding the first six potentially changes every time a new configuration is explored. From these tables, it can be observed that the required variables for regions without energy equations are significantly less than regions with energy equations. A GPU Simulation for ECPe Systems Having no Antiport Rules 43 This is expected since regions without energy equations only act as receivers and need not be concerned with the number of application of communication rules. Thus, we only analyze the requirement for sending regions where energy equations needs to be addressed. Focusing on sender regions, Table 1 shows that the most expensive communication step occurs upon accomplishment of finding extended valid application vectors where the set of all valid application vectors will be communicated from host to device as a matrix with size at most CNEeqCount ×T M cols. The required memory space in host in finding all valid extended application vectors (i.e. Steps 1-6 of the methodology for forward computing described section 2.4) when the region has energy is, Eh=C×left +T M rows ×T M cols + (NEeqCount ×TM rows ×2) +(TM rows ×CNEeqCount ×2) + 3 The needed memory space in host when finding all valid application vectors(i.e. Step 7 of the methodology for forward computing described section 2.4) is, M=membraneCount ×(membraneCount +IR +IR ×validAppV ecCount) From this, we can conclude that the upperbound of the memory needed in host is O((Eh+M)). On the other hand, the required memory space in device in finding all valid extended application vectors (i.e. Steps 1-6 of the methodology for forward computing described in Section 2.4) when the region has energy is, Ed=C×left×2+(NEeqCount×T M rows×2)+NEeqCount×C+NEeqCount +NEIP size + (T M rows ×CNEeqCount ×2) + 3 Note that, when finding all valid application vectors (i.e. Step 7 of the methodology for forward computing described in Section 2.4), there is no need to allocate memory in device. 6 Conclusion and Future Works In this paper, we were able to present a hybrid implementation of computation for ECPe systems without antiport by employing GPUs. Our implementation makes use of matrix representation and operations discussed in [6]. To improve our implementation, the following are recommended for further study: •Optimize memory usage Some processes in the parallel simulation makes use of arrays that may become large (depending on the number of rules and objects in a region, number of regions, and etc). An example is the padding of energy and non-energy solutions 44 Z.F. Bangalan et al. with 0s so that all generated solutions will have the same dimension and is faithful to the size of extended application vector determined in Step 4 of the methodology for forward computing described in Section 2.4. It is primarily done to make merging easier when it comes to finding valid application vectors. However, doing so might require a significant amount of memory. •Accept input from P Lingua It is a good characteristic of the program if it is P Lingua compatible. That is, from the definition of an ECPe system, say Π. Its corresponding P Lingua format is accepted as an input of the program. In this way, running any ECPe system in the program would be easier. The number of input files used by the program will also lessen. •Concurrent processes for solving energy solutions of a region and non-energy solutions of regions without energy equation Our approach in solving system of linear equations is to solve first for the energy solutions if there is an energy equation in the said system of linear equations. Thus, in this way we cannot generate solutions for the non-energy equations yet. However, it can be done that while energy solutions are being generated, non-energy solutions for other regions are also being generated. •Extend parallel simulation of ECPe system to include antiport rules Since the current implementation is done without antiport rules and there is still no existing parallel simulation of ECPe systems which include antiport rules as of the writing of this paper, it is attractive to extend the work to include antiport rules. Acknowledgements F.G.C. Cabarle and R.A. B. Juayong are supported by the Engineering Research and Development (ERDT) Scholarship Program. H.N. Adorna is funded by a DOST-ERDT research grant and the Semirara Mining Corporation professorial chair of the UP Diliman, College of Engineering. M.A. Mart´ınez-del-Amor is supported by “Proyecto de Excelencia con Investigador de Reconocida Val´ıa P08-TIC- 04200” from Junta de Andaluc´ıa, and project TIN2012-37434 from “Ministerio de Ciencia e Innovaci´on” of Spain, both co-financed by FEDER funds. References 1. H. Adorna, Gh. P˘aun, M.J. P´erez-Jim´enez: On Communication Complexity in Evolution-Communication P Systems, Romanian Journal of Information Science and Technology, Vol. 13 No. 2 pp. 113-130, 2010 2. S. G. Akl: Adaptive and optimal parallel algorithms for enumerating permutations and combinations, The Computer Journal,30, 5 (1987), 433436 3. F. Cabarle, H. Adorna, M. A. Mart´ınez-del-Amor.: Simulating Spiking Neural P Systems Without Delays Using GPUs, International Journal of Natural Computing Research (IJNCR), Vol. 2 No. 2 pp. 19-31, 2011 A GPU Simulation for ECPe Systems Having no Antiport Rules 45 4. F. Cabarle, H. Adorna, M.A. Mart´ınez-del-Amor, M.J. P´erez-Jim´enez: Improving GPU Simulations of Spiking Neural P Systems, Romanian Journal of Information Science and Technology Volume 15, Number 1, pp. 520, 2012. 5. G. Ciobanu, G. Wenyuan: P Systems Running on a Cluster of Computers, In Workshop on Membrane Computing pp. 123-139, 2003. 6. R.A. Juayong, H. Adorna: A Matrix Representation for Computations in Evolution-Communication P Systems with Energy, Proc. of Philippine Computing Science Congress, Naga, Camarines Sur, Philippines, March 3-4, 2011 7. R.A. Juayong, H. Adorna: Computing on Evolution-Communication P Systems with Energy Using Symport Only, Workshop on Computation: Theory and Practice 2011 (WCTP 2011), UP Diliman NISMED auditorium 8. R.A. Juayong, F.G.C. Cabarle, H. Adorna, M. Mart´ınez-del-Amor: On the Simulations of Evolution-Communication P Systems with energy without Antiport Rules for GPUs, Technical report of the 10th Brainstorming Week in Membrane Computing, Seville, Spain, Feb 2012. 9. G. D. Knott: A Numbering System for Combinations. Comm. ACM, Vol. 17, No. 1, pp. 45-46, January 1974. 10. C. Mifsud, Algorithm 154: combination in lexicographical order,Communications of the ACM, p. 103. Volume 6 Issue 3, March 1963. 11. J.D. Owens, M. Houston, D. Luebke, S. Green, J.E. Stone, J.C. Phillips: GPU Computing, Proceedings of the IEEE, Vol. 96 No. 5 pp. 879-899, 2008 12. Gh. P˘aun: Introduction to Membrane Computing. In: Gabriel Ciobanu, Mario J. P´erez-Jim´enez and Gheorghe P˘aun, eds: Applications of Membrane Computing, Natural Computing Series. Springer, pp.142. (2006) 13. Gh. P˘aun, M.J. P´erez-Jim´enez: Spiking Neural P Systems. Recent Results, Research Topics. Algorithmic Bioprocesses, Natural Computing Series. Springer. pp. 273-291. (2009) 14. Gh. P˘aun, M.J. P´erez-Jim´enez: Solving Problems in Distributed Way in Membrane Computing: dP System, Int. J. of Computers, Communication and Control, Vol. 5 No. 2 pp. 238-250, 2010 15. A.E. Porreca, A. Leporati, G. Mauri, C. Zandron: Introducing a space complexity measure for P systems, Intern. J. Computers, Communications and Control, Vol. 4 No. 3 pp. 301310, 2009. 46 Z.F. Bangalan et al. Appendix Assumptions on input files Figure 9 and 11 shows the file format for all the necessary input files. Given below are the assumptions for the input files needed in our implementation. •A total order for objects is assumed for all of the vectors and matrices used. For example, if the correspondence of possible objects in the Transition matrix is < a, #, e >, then the correspondence of possible objects in the Trigger matrix must also be < a, #, e >. •A total order for rules is assumed for all of the vectors and matrices used. For example, if the correspondence of involved rules in the Transition matrix is < r11, r12, r0 21 >, then the correspondence of involved rules in the Trigger matrix must also be < r11, r12, r0 21 >. •If a region involves symport rule(s), the correspondence of the rule(s) is assumed to be at the latter part of the vectors and matrices defined for the region. For example, if r11,r12,r0 21,r0 22 are the rules involved in region k, and r0 21,r0 22 are symport rules, The total order should be < r11, r12, r0 21, r0 22 >or < r11, r12, r0 22, r0 21 >. •If a region contains symport rule(s) wherein it is a receiving region, the correspondence of the said symport rules(s) is assumed to be at the last part of the vector and matrices defined for the region. For example, if r11,r12,r0 21, r0 22,r0 23 are the involved rules in region k, and r0 21 is the symport rules where in region kis a sending region and r0 22,r0 23 are symport rules where in region kis a receiving region. The total order should be, < r11, r12, r0 21, r0 22, r0 23 >or < r11, r12, r0 21, r0 23, r0 22 >. A GPU Simulation for ECPe Systems Having no Antiport Rules 47 Fig. 9. Input file for generating all possible next configuration (trans file.txt) Fig. 10. Output file of all possible next configurations Left: list of all possible next configurations(conf.txt), Right: label of all possible next configurations(conf index.txt) 54 L. Cienciala, L. Ciencialov´a, M. Langer by the state of all agents - pairs of objects from alphabet Aand the coordinates of the agents. An initial configuration is given by the definition of the 2D P colony. The computational step consists of three parts. The first part lies in determining the applicable set of programs according to the actual configuration of the P colony. There are programs belonging to all agents in this set of programs. In the second part we have to choose one program corresponding to each agent from the set of applicable programs. There is no collision between the communication rules belonging to different programs. The third part is the execution of the chosen programs. A change of the configuration is triggered by the execution of programs and it involves changing the state of the environment, contents and placement of the agents. The computation is nondeterministic and maximally parallel. The computation ends by halting when no agent has an applicable program. The result of the computation is the number of copies of the final object placed in the environment at the end of the computation. Another way to determine the result of the computation is to take into account not only the number of objects but also their location. The result could then be a grayscale image, a character string or a number that is dependent on both the number and pposition of the objects (for example, g=Pn−1 j=0 Pm−1 i=0 f(i, j)· ni, where f(i, j) is the number of copies of object fin the [i, j]-cell). The reason for the introduction of 2D P colonies is not the study of their computational power but monitoring their behaviour during the computation. We can define certain measures to assess the dynamics of the computation: •the number of moves of agents •the number of visited cells (or not visited cells) •the number of copies of a certain object in the home cell or throughout the environment. These measures can be observed both for the individual steps of the computation and the computation as a whole. 4 The issue of the flow of liquid over the surface The issue of the flow of liquid over the Earth’s surface is studied by experts from two areas - hydrology and geoinformatics. Both of these disciplines work closely together on the issue of the so-called “surface runoff”. Surface runoff is the water flow that occurs when the soil is infiltrated to full capacity and excess water from rain, meltwater, or other sources flows over the land. Surface runoff can be generated in four reasons: infiltration excess overland flow, saturation excess overland flow, antecedent soil moisture, subsurface return flow. Infiltration excess overland flow occurs when the rate of rainfall on a surface exceeds the rate at which water can infiltrate the ground, and any depression 2D P Colonies 55 storage has already been filled. When the soil is saturated and the depression storage filled, and rain continues to fall, the rainfall will immediately produce surface runoff - saturation excess overland flow. Soil retains a degree of moisture after a rainfall. This residual water moisture (antecedent soil moisture) affects the soil’s infiltration capacity. During the next rainfall event, the infiltration capacity will cause the soil to be saturated at a different rate. The higher the level of antecedent soil moisture, the more quickly the soil becomes saturated. Once the soil is saturated, runoff occurs. After water infiltrates the soil on an up-slope portion of a hill, the water may flow laterally through the soil, and exfiltrate (flow out of the soil) closer to a channel. This is called subsurface return flow or throughflow. We can say that generation surface runoff depends on type of soil, temperature, humidity and rainfall. The task of our model is to determine which way the flow would run and which areas could be affected by flash floods. 5 Problem solution We divide solution of the problem into two parts - (1) preparation of maps (2D P colony’s environment) and (2) definition of agents. We assume that the soil is already saturated thus the main factor of overland flow is the slope of the field. 5.1 Preparation of maps Map data is obtained from the geographic information system (GIS) and processing system ArcGIS. We use the map data for the Czech Republic called the digital model of the terrain in scale 1: 25 000 (DM´ U25). Raster graphics images are probably the most appropriate format for modelling real-world phenomena in the field of GIS. To process this format, many tools were created and can be used for performing various analyses. A raster image is composed of a regular network of cells, usually in a square shape, to which values of displayed properties can be assigned independently. More information about GIS and image processing the reader can find in [3] and about geosimulation in [10]. The first step to simulate the flow of liquid over relief was the determination of its runoff from individual pixels (cells). Gradient with respect to an adjacent cell is defined as the ratio of the height difference to the horizontal distance. Gradient is positive due to the lower neighbours, or negative due to higher and zero in relation to the neighbours of the same height. Lowest neighbour is neighbour with the largest positive gradient. Basic classification algorithms to calculate the runoff: •Single flow direction (SFD) - each pixel of the liquid flows in one direction only (toward neighbour in the direction of the largest gradient). Each pixel belongs to only one basin. 56 L. Cienciala, L. Ciencialov´a, M. Langer •Multiple flow direction (MFD) - fluid can flow out of each pixel in multiple directions, maximum of eight. In the case of MFD a unit volume flow is fairly distributed among all lower neighbours. The MFD may include the pixel to multiple basins. There is implemented a tool for calculating the flow direction in ArcGIS software, called simply Flow direction. Flow Direction tool works as a simple flow direction (SFD). After its execution integer raster file is created that specifies the flow direction for each cell. Every cell can reach value ranging from 1 to 255. Eight basic directions of the flow are represented by the numbers 1,2,4,8,16, 32,64 and 128 (see Table 1). Other directions are generated as sums of values of the basic directions. 32 64 128 16 - ↑ % ← → . ↓ & 1 8 4 2 Table 1. The numbers of eight basic directions When creating the model, we used the test data to propose group of programs. The final visualization is based on data from DM´ U 25. What we obtain from ArcGIS is a raster file with natural number in each cell corresponding to the runoff from this cell. Because 2D P colony works with discrete symbols and not with numbers, it needed to transcode numbers to symbols. A coding table is shown on Table 2 direction → ← ↑ ↓ & . % - symbol a E i m q u y 2 Table 2. The coding table The first processed map is map without drainless area and its size is 20 ×12 and it is shown on the Table 3. Transcoded symbols are shown on the Table 4. 5.2 Definition of the agent Agents in 2D P colonies have capacity 2. It follows that the agent contains two objects, and each program is composed by two rules. 2D P Colonies 57 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0-↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑% 1←%%%%%%%%%%%%%%%%%%→ 2←%%%%%%%%%%%%%%%%%%→ 3←%%%%%%%%%%%%%%%%%%→ 4←%%%%%%%%%%%%%%%%%%→ 5←→%%%%%%%%%%%%%%%%% → 6← ↓ ↓ %%%%%%%%%%%%%%%%→ 7← ↓ ↓ ↓ ↓ ↓ & % % % % % %%%%%%%→ 8← ↓ ↓ ↓ ↓ ↓ ↓ & & & % % %%%%%%%→ 9←↓↓↓↓↓↓↓↓&&&→%%%%%%→ 10 ←↓↓↓↓↓↓↓↓↓↓↓&&%%%%%→ 11 ←↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓& Altitude (meters above sea level) 1320 1330 1340 1350 1360 1370 1380 1390 Table 3. Processed map 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 2 iiiiiiiiiiiiiiiiiiy 1Eyyyyyyyyyyyyyyyyyya 2Eyyyyyyyyyyyyyyyyyya 3Eyyyyyyyyyyyyyyyyyya 4Eyyyyyyyyyyyyyyyyyya 5Eayyyyyyyyyyyyyyyyya 6Emmyyyyyyyyyyyyyyyya 7E m m m m m q y y y y y y y y y y y y a 8E m m m m m m q q q y y y y y y y y y a 9E m m m m m m m m q q q a y y y y y y a 10 E m m m m m m m m m m m q q y y y y y a 11 Emmmmmmmmmmmmmmmmmm t Table 4. Transcoded symbols Each of the objects carries the information about the state of the agent. The first object has information about the activity of the agent. At this stage of the simulation it is the information that the agent “flows” down the terrain or it is still inactive (belonging to the rainfall that have not fall). The second object stores information about the previous direction of flow. This information can further modify the way of the agent as inertia. Objects and their association to the flow directions are given in the following table. direction → ← ↑ ↓ & . % - symbol 9 8 6 7 D D U U symbol L K H I I I H H 58 L. Cienciala, L. Ciencialov´a, M. Langer The inertia of crossing directions is modified because of longer distance between the centres of the cells. The first subset of programs with priority 0 is defined for the first step of computation. The initial configuration of each “working” agent is Xe. (1) *  ∗ ∗ ∗ ∗a∗ ∗ ∗ ∗  → ⇒;e→9+; (2) *  ∗∗∗ ∗E∗ ∗∗∗ → ⇐;e→8+; (3) *  ∗∗∗ ∗i∗ ∗∗∗ → ⇑;e→6+; (4) *  ∗∗∗ ∗m∗ ∗∗∗ → ⇓;e→7+; (5) *  ∗∗∗ ∗q∗ ∗∗∗ → ⇒;e→D+; (6) *  ∗∗∗ ∗u∗ ∗∗∗ → ⇐;e→D+; (7) *  ∗∗∗ ∗y∗ ∗∗∗ → ⇒;e→U+; (8) *  ∗∗∗ ∗2∗ ∗∗∗ → ⇐;e→U+; In the case of programs (5) and (6) (resp. (7) and (8)) it is neccessary to take one step down (resp. up). (9) *  ∗∗∗ ∗∗∗ ∗∗∗ → ⇓;D→I+; (10) *  ∗∗∗ ∗∗∗ ∗∗∗ → ⇑;U→H+; While agents apply programs with priority 1 (9) and (10), agents, that do not move in a cross direction, must stand. Therefore, they use a program composed of two rewriting rules. The programs have priority 2. (11) hX→X; 6 →Hi; (12) hX→X; 7 →Ii; (13) hX→X; 8 →Ki; (14) hX→X; 9 →Li; The following programs with priority 0 are used to guide the agent in the next steps, the agent may hold information about the movement in the previous step. (15) *  ∗ ∗ ∗ ∗a∗ ∗ ∗ ∗  → ⇒;H→9+; (16) *  ∗∗∗ ∗E∗ ∗∗∗ → ⇐;H→8+; (17) *  ∗∗∗ ∗i∗ ∗∗∗ → ⇑;H→U+; (18) *  ∗∗∗ ∗m∗ ∗∗∗ → ⇓;H→7+; (19) *  ∗∗∗ ∗q∗ ∗∗∗ → ⇒;H→D+; (20) *  ∗∗∗ ∗u∗ ∗∗∗ → ⇐;H→D+; (21) *  ∗∗∗ ∗y∗ ∗∗∗ → ⇒;H→U+; (22) *  ∗∗∗ ∗2∗ ∗∗∗ → ⇐;H→U+; 2D P Colonies 59 (23) *  ∗ ∗ ∗ ∗a∗ ∗ ∗ ∗  → ⇒;I→9+; (24) *  ∗∗∗ ∗E∗ ∗∗∗ → ⇐;I→8+; (25) *  ∗∗∗ ∗i∗ ∗∗∗ → ⇑;I→6+; (26) *  ∗∗∗ ∗m∗ ∗∗∗ → ⇓;I→7+; (27) *  ∗∗∗ ∗q∗ ∗∗∗ → ⇒;I→D+; (28) *  ∗∗∗ ∗u∗ ∗∗∗ → ⇐;I→D+; (29) *  ∗∗∗ ∗y∗ ∗∗∗ → ⇒;I→U+; (30) *  ∗∗∗ ∗2∗ ∗∗∗ → ⇐;I→U+; (31) *  ∗ ∗ ∗ ∗a∗ ∗ ∗ ∗  → ⇒;J→9+; (32) *  ∗∗∗ ∗E∗ ∗∗∗ → ⇐;J→L+; (33) *  ∗∗∗ ∗i∗ ∗∗∗ → ⇑;J→6+; (34) *  ∗∗∗ ∗m∗ ∗∗∗ → ⇓;J→7+; (35) *  ∗∗∗ ∗q∗ ∗∗∗ → ⇒;J→7+; (36) *  ∗∗∗ ∗u∗ ∗∗∗ → ⇐;J→D+; (37) *  ∗∗∗ ∗y∗ ∗∗∗ → ⇒;J→6+; (38) *  ∗∗∗ ∗2∗ ∗∗∗ → ⇐;J→U+; (39) *  ∗ ∗ ∗ ∗a∗ ∗ ∗ ∗  → ⇒;K→N+; (40) *  ∗∗∗ ∗E∗ ∗∗∗ → ⇐;K→8+; (41) *  ∗∗∗ ∗i∗ ∗∗∗ → ⇑;K→6+; (42) *  ∗∗∗ ∗m∗ ∗∗∗ → ⇓;K→7+; (43) *  ∗∗∗ ∗q∗ ∗∗∗ → ⇒;K→D+; (44) *  ∗∗∗ ∗u∗ ∗∗∗ → ⇐;K→7+; (45) *  ∗∗∗ ∗y∗ ∗∗∗ → ⇒;K→U+; (46) *  ∗∗∗ ∗2∗ ∗∗∗ → ⇐;K→6+; We need one more program for “resetting” inertia. This is for the case when the slope of the terrain changes extremely. (47) hX→X;N→ei; If we run the obtained 2D P colony in the simulator, agents, which represent a unit volume of water, will begin to move around the environment. The number of agents located in one cell at one moment corresponds to the amount of water that at once flowed through the territory in one unit of time. 60 L. Cienciala, L. Ciencialov´a, M. Langer A source of water is placed into cells [5,6],[5,7],[6,6],[6,7]. In every source cell there are four agents. To simulate rain all agents are not active in the initial configuration. Only one agent has the configuration of Xe in each cell. The next three become active always in two computational steps. The numbers of active agents in the environment are shown in the Tables 5 - 13. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Table 5. The numbers of active agents in the initial configuration 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Table 6. The numbers of active agents after 2 step of computation The obtained results were compared with data that are listed in the master thesis [9]. This work is devoted to the simulation flow of liquid over the Earth’s surface using cellular automata. In work [9], the author devotes a great deal of time preparing data for cellular automaton, calculates not only the direction of flow but also the number and direction of outflows and inflows into the cell. After then cellular automaton starts 2D P Colonies 61 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Table 7. The numbers of active agents after 4 step of computation 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Table 8. The numbers of active agents after 6 step of computation 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Table 9. The numbers of active agents after 8 step of computation 62 L. Cienciala, L. Ciencialov´a, M. Langer 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Table 10. The numbers of active agents after 10 step of computation 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Table 11. The numbers of active agents after 12 step of computation 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Table 12. The numbers of active agents after 14 step of computation 2D P Colonies 63 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Table 13. The numbers of active agents after 16 step of computation working. The results are shown in Figure 1. Cells shown white are cells that contain water. Fig. 1. Cellular automaton If we compare the simulation process using 2D P colonies and using cellular automaton we obtain the following: •Cells are flooded with water in the same time sequence. 70 G. Ciobanu, D. Sburlan •Ei, 1 ≤i≤m, is a finite set of regular expressions over Li∪ {d}, where dis a special symbol (the “delay” symbol), d6∈ m S i=0 Li; moreover, if e∈Eithen L(e)⊆(Li∪ {d})∗Li(Li∪ {d})∗(that is, any word in L(e) contains at least one symbol from Li); •i0∈ {1, . . . , m}is the label of the output region of Π. Aconfiguration of Πis a vector (α1, . . . , αm), where αi∈O∗, 1 ≤i≤m, is the multiset of objects present in the region iof Π. The initial configuration of Π is the vector C0= (w1, . . . , wm). Let Ei={e(i,1), . . . , e(i,si)}, where 1 ≤i≤mand such that si≥1; in addition, let L(i,1), . . . , L(i,si)be the corresponding regular languages. A word l0. . . lt∈ L(i,j), 1 ≤i≤m, 1 ≤j≤si(a finite sequence of symbols from Li∪ {d}) is called ascenario and illustrates the fact that the corresponding rules (if there exists such corresponding rules; recall that dis not associated with any rule) will be applied (if possible) in the implicit order of symbols. Given a multiset of objects w, a scenario l0. . . ltis applicable to wif the rule having the label l0is applicable to w or l0=d; similarly, a scenario is started if the rule labeled with l0is applied to w or l0=d. As usually in the P system framework, a computation of Πis a sequence of configurations (possibly infinite) C0, C1, . . . , Ck, Ck+1, . . .. Given a configuration Ck= (w(k,1), . . . , w(k,m)), then one gets the next configuration Ck+1 = (w(k+1,1), . . . , w(k+1,m)) by applying on each multiset w(k,i), 1 ≤i≤m, some rules from Riin a nondeterministic, maximal parallel manner and with competition on objects; these rules are selected according with the conditions described below. For a scenario l0. . . ltthat is started in configuration Ck, the rule labeled li, 1≤i≤t,li6=d, compete for objects in configuration Ck+iiff the rules labeled li−j, 1 ≤j≤i,li−j6=dwere applied (won the competitions) in the corresponding configurations Ck+i−j. A started scenario is said to be entirely applied if the rules corresponding to all labels were applied in the given order, in consecutive configurations; in case there exists a rule labeled li, 1 ≤i≤t,li6=d, that lost the competition on objects or if the rule cannot be applied then the started scenario is said to be interrupted; the executions of the remaining rules (in case they exist, that is, not all the remaining symbols in the scenario are d) in the subsequent configurations are dropped. In any configuration, new scenarios from each L(i,j), 1 ≤i≤m, 1 ≤j≤ si, are nondeterministically selected for applications.Given such a scenario and a configuration Ck, if the first label of rule appears in the scenario on position l≥0 (the first symbols being all d) then the corresponding rule will compete for objects with other rules (from the scenarios in progress) after lcomputational steps. For each multiset w(k,i)from Ck, 1 ≤i≤m, there might exist new scenarios, scenarios in progress, and interrupted scenarios, which determine the rules to be applied in order to obtain the next configuration Ck+1. Scenario Based P Systems 71 A computation of Πis a halting one if no rule can be applied (all the started scenarios are interrupted and no matter how a new scenario is selected for application it becomes interrupted at the first symbol corresponding to a rule) in the last configuration (the halting configuration). The result of a halting computation is the number of objects from Ocontained in the output region i0, in the halting configuration. A non-halting computation yields no result. By collecting the results of all possible halting computations of a given P system Π, one gets N(Π) – the set of all natural numbers generated by Π. The family of all sets of numbers computed by SBP systems with at most m membranes and with a list of features fis denoted by NOSBPm(f). The features considered in this paper are ncoo (P systems using only non-cooperative rules) and catk(P systems using non-cooperative rules and catalytic rules with at most kcatalysts). The above definition can be relaxed such that in a halting configuration one counts only the symbols from a given alphabet Σ⊆O. Given a scenario based P system Πwith m > 1 membranes and using the features f, it is easy to construct an equivalent scenario based P system with the same features but having only one region. This can be accomplished by a simple encoding of the region labels into the objects and expressing the rules accordingly [1]. Theorem 2. NOSBPm(cat1) = NRE,k≥1. Proof. The inclusion NOSBPm(cat)⊆NRE is supposed to be true by invoking the Church-Turing thesis. The opposite inclusion can be shown to be true by simulating the computation of an arbitrary register machine M= (n, P, l0, lh) with a scenario based P system Π= (O, C, µ, w1, R1, E1) where O={ai|1≤i≤n} ∪ {l1, l2|l1: (add(r), l2)∈ P} ∪ {l1, l2, l3, l1, l2, S, S, S, X |l1: (sub(r), l2, l3)} C={c}, µ =[]1, w1=l0. The set of rules R1and the set of regular expressions E1are defined as follows: •for each register machine instruction l1: (add(r), l2), the rule rl1:l1→arl2is added to R1and the regular expression rl1is added to E1. •for each register machine instruction l1: (sub(r), l2, l3), the next rules are added to R1: r(l1,1) :l1→l1S , r(l1,2) :car→cX r(l1,3) :X→λ,r(l1,4) :l1→l2 r(l1,5) :S→S , r(l1,6) :S→S r(l1,7) :S→λ,r(l1,8) :l1→l3 r(l1,9) :l2→l2. 72 G. Ciobanu, D. Sburlan The regular expressions r(l1,1)r(l1,2),r(l1,3)r(l1,4),r(l1,5)r(l1,6), r(l1,7)r(l1,8),r(l1,9) are added to E1. •for the register machine instruction l1:halt, the rule rl1:l1→λis added to R1and the regular expression rl1is added to E1. The simulation of the register machine Mby the scenario based P system Π proceeds as follows. At a certain moment during the computation of Mthe values stored by the registers are t1, . . . , tr,...tn, and the label of the instruction that has to be executed is l1. Correspondingly, the multiset contained in the region of Πis at1 1. . . atr r. . . atn nl1c(that is, the value trstored by the register rof Mis modeled in this simulation as the multiplicity of the object arin a configuration of Π). If l1is the label of an addition instruction l1: (add(r), l2), then Πis executing the scenario described by rl1, that is the rule l1→arl2is applied. As a consequence the next configuration of Πwill be at1 1. . . atr+1 r. . . atn nl2c(which indicates that the addition instruction was simulated correctly). If l1is the label of a subtraction instruction l1: (sub(r), l2, l3), then Πis executing the scenario described by r(l1,1)r(l1,2). Consequently, because in this scenario the rule r(l1,1) :l1→l1Sis executed firstly, the next configuration of Πis described by the multiset at1 1. . . atr r. . . atn nl1Sc. Because the object Sappeared in the multiset, then the scenario r(l1,5)r(l1,6) will be started. Next, two cases might happen: •if tr>0 then the rule r(l1,2) :car→cX is executed (the second rule from the already started scenario r(l1,1)r(l1,2)) in the same moment with the rule r(l1,5) :S→S(from scenario r(l1,5)r(l1,6)). The configuration of Π becomes at1 1. . . atr−1 r. . . atn nl1XSc. Next, the scenario r(l1,3)r(l1,4) is started. It follows that the rules r(l1,6) :S→S(from scenario r(l1,5)r(l1,6)) and r(l1,3) :X→λ(from scenario r(l1,3)r(l1,4)) are simultaneously executed; the configuration of Πbecomes at1 1. . . atr−1 r. . . atn nl1Sc. Finally, the scenario r(l1,7)r(l1,8) is started. Accordingly, the rules r(l1,4) :l1→l2(from scenario r(l1,3)r(l1,4)) and r(l1,7) :S→λ(from scenario r(l1,7)r(l1,8)) are executed in the same time; the configuration of Πbecomes at1 1. . . atr−1 r. . . atn nl2c. Next, the scenario r(l1,7)r(l1,8) interrupts its execution (the object l1is not anymore present in the current configuration of Π, hence the rule r(l1,8) cannot be executed); the scenario r(l1,9) starts its execution and this yields to the configuration at1 1. . . atr−1 r. . . atn nl2c(which indicates a correct simulation of the register machine subtraction instruction in the case when register ris not empty); •if tr= 0 then the rule r(l1,2) :car→cX cannot be executed and consequently the object X(which triggered the execution of the scenario r(l1,3)r(l1,4)) is not produced anymore. However, in this case the scenario r(l1,5)r(l1,6) is started and the rules r(l1,5) :S→Sand r(l1,6) :S→Sare executed in consecutive configurations of Π. The resulting configuration becomes at1 1. . . atr r. . . atn nl1Sc. Next, the scenario r(l1,7)r(l1,8) starts its execution and after two computational Scenario Based P Systems 73 steps the resulting multiset becomes at1 1. . . atr r. . . atn nl3c(which indicates a correct simulation of the register machine subtraction instruction in the case when register ris empty). In case the configuration of Πis at1 1. . . atn nl1cwhere the object l1corresponds to the label of the register machine halting instruction, then the scenario rl1is started (the rule rl1:l1→λis executed). The next configuration of Πbecomes at1 1. . . atn ncand the computation stops. Consequently, since the computation of Mwas correctly simulated by Πand the register machines are computational universal, we have NOSBPm(cat)⊇ NRE. 4 A More Realistic Scenario A particular case, interesting from a biological point of view, is when all possible scenarios used by a SBP system Πin any region iare of type dl1w1dl2w2dl3. . . dlkwkdlk+1 , where wi∈ L+ i,li∈IN, 1 ≤i≤k+ 1. We will consider that the regular expressions from each Ei, 1 ≤i≤m, are of type d∗α1d∗α2d∗. . . d∗αkd∗where each αj, 1 ≤j≤k, are regular expressions over Liwhich use only the grouping and the Boolean OR operations in their definitions (consequently, each αiindicates a finite language). Such regular expressions and their corresponding scenarios suggest that one knows the application order of the rules but does not know when their executions will actually happen. Let Ei={e(i,1), . . . , e(i,si)}, where 1 ≤i≤m,si≥1, and consider the corresponding regular languages L(i,j), 1 ≤i≤m, 1 ≤j≤si. In the above conditions, for a scenario x=dl1w1dl2w2dl3. . . dlkwkdlk+1 ∈L(i,j)we define deg(x) = max 1≤i≤k{|wi|}. For a given SBP system Πwe define the degree of synchronization deg(Π) = max{deg(s)|(∃)1 ≤i≤m, 1≤j≤sisuch that s∈L(i,j)}. In this case, the family of all sets of numbers computed by such SBP systems with the feature f∈ {ncoo, cat}and of synchronization degree at most nwill be denoted by NOSBP dn m(f). The following example shows how to generate a non-semilinear set of numbers with a SBP systems with non-cooperative rules and with a synchronization degree 1. Example 1. Let Π1= (O, C, µ, w1, R1, E1, i0) such that O={a, b};C=∅;µ=[]1;w1=ab; R1={r1:b→b, r2:a→aa, r3:b→λ}; E1={d∗r1d∗r2d∗r3d∗};i0= 1. The system Π1computes the set {a2n|n≥1}, the well know non–semilinear set from NET 0L\NCF . The regular expression used in the definition of Πcan 74 G. Ciobanu, D. Sburlan be simplified such that E1={r1d∗r2d∗r3}.Using this simplification, the system performs the computation as follows. In the first configuration C0= (ab), a scenario r1dn1r2dn2r3,n1, n2≥0, is selected for application. This means that the rule labeled r1is applied in the configuration C0because there exists an object b; the rule labeled r2will compete for objects after n1computational steps (where n1can be any natural number) and if it is applied, it will double the objects a. Finally, after the next n2computational steps the rule r3compete for the object b, and if it is applied then it will delete the objects b(and consequently the selection of a scenario for an application is blocked). I all these computational steps (between the starting of the first scenario and the application of its last rule labeled r3) new scenarios are selected for applications. Each of them will double the number of symbols a. Consequently, the system computes the set {a2n|n≥1}. Theorem 3. For any n≥2, NOSBPm(f)⊇NOSBP dn m(f)⊇NOSBP dn−1 m(f), f ∈ {ncoo, catk}, k ≥1. The following result shows the relation between the family of all sets of numbers computed by SBP systems with at most mmembranes and using only noncooperative rules and the family of length sets of context-free languages. Proposition 1. NOSBP d1 m(ncoo)⊃NCF =NREG. Proof. From the above observation one knows that NOSBPm(ncoo) = NOSBP1(ncoo), hence in our proof we will use a scenario based P system with one region. Let G= (N, T, P, S) be a context-free grammar and let P={r1, . . . , rk} be the set of labeled productions. Then one can construct an equivalent scenario based P system Π= (O, C, [ ]1, R1, E1, i0= 1) defined by: O=N∪T, C =∅, R1=P∪ {rA:A→A|A∈N}, E1={d∗rd∗|r∈P}∪{d∗rXd∗|X∈N}. At any moment during the computation of Πscenarios from the languages indicated by the regular expressions from E1can be started. A scenario of type dkrdp, r=A→α∈R1,k, p ≥0, simulates the application of the context-free production A→α∈P. In order to prevent the maximal parallel rewriting of the object Ain a given configuration of Π, scenario of type dkrAdp,rA=A→A∈R1are employed. It follows that there exist a computation of Πwhere for any configuration exactly one object A∈Nis rewritten. Thus, Πcorrectly simulates G, and so we conclude that NOSBP d1 m(ncoo)⊇ NCF =NREG. The strict inclusion follows easily from Example 1. The length set of any language generated by an ET0L system can be generated by a SBP systems with non-cooperative rules and synchronization degree 2. Theorem 4. NOSBP d2 m(ncoo)⊇NET 0L. Scenario Based P Systems 75 Proof. To prove this result, we simulate the computation of a arbitrary ET0L system using a SBP system with non-cooperative rules and having the synchronization degree 2. Without loss of generality, let H= (V, T, ω, ∆) be an ET0L system, such that V={a1, . . . , ak},∆={a1, . . . , ap},p≤k, and T={T1, T2}, where T1={ai→α1,j |1≤i≤k, 1≤j≤l1,i}, T2={ai→α2,j |1≤i≤k, 1≤j≤l2,i}. Then we construct the SBP system Π= (O, C, µ, w1, R1, E1, i0= 1) that simulates the computation of Has follows: O=V∪ {a|a∈V} ∪ {ti,j |i∈ {1,2},1≤j≤2k+ 1} ∪ {t, f, #}; C=∅;µ=[]1;w1=tω. In order to simplify the notation and construction, we will present the regular expressions from E1by using directly the rules in their descriptions (and not the labels of the rules). The set of rules R1is composed by all the rules appearing in these regular expressions. In addition, the regular expressions will be grouped according to their usage in the simulation. 1. regular expressions/rules used to select a table to be simulated: d∗t→tmax{l1,i|1≤i≤k} 1,1X d∗ d∗t→tmax{l2,i|1≤i≤k} 2,1X d∗ 2. regular expressions/rules used to simulate an application of the table T1: d∗t1,1→t1,1a1→α1,j d∗where 1 ≤j≤l1,1 d∗t1,1→t1,2a1→#d∗ d∗t1,2→t1,2a2→α1,j d∗where 1 ≤j≤l1,2 d∗t1,2→t1,3a2→#d∗ . . . d∗t1,k →t1,k ak→α1,j d∗where 1 ≤j≤l1,k d∗t1,k →t1,k+1 ak→#d∗ d∗t1,k+1 →t1,k+2 a1→a1d∗ d∗t1,k+2 →t1,k+3 a2→a2d∗ . . . d∗t1,2k→t1,2k+1 ak→akd∗ 3. regular expressions/rules used to simulate an application of the table T2: d∗t2,1→t2,1a1→α2,j d∗where 1 ≤j≤l2,1 d∗t2,1→t2,2a1→#d∗ d∗t2,2→t2,2a2→α2,j d∗where 1 ≤j≤l2,2 d∗t2,2→t2,3a2→#d∗ . . . d∗t2,k →t2,k ak→α2,j d∗where 1 ≤j≤l2,k 76 G. Ciobanu, D. Sburlan d∗t2,k →t2,k+1 ak→#d∗ d∗t2,k+1 →t2,k+2 a1→a1d∗ d∗t2,k+2 →t2,k+3 a2→a2d∗ . . . d∗t2,2k→t2,2k+1 ak→akd∗ 4. starting over the simulation or ending the simulation: d∗t1,2k+1 →λ X →t d∗ d∗t1,2k+1 →λ X →f d∗ 5. checking if there are ”nonterminals” in the last configuration: d∗f→f1a1→#d∗ d∗f1→f2a2→#d∗ . . . d∗fp→λ ap→#d∗ d∗#→#d∗. The SBP system constructed above simulates the computation of an ET0L system as follows. At the beginning of simulation, scenarios from all the languages indicated by the regular expressions from E1are started. However, because there is an object tin the initial configuration, only the rules that appear in scenarios from the group 1 can be applied (that is it will be applied either t→tmax{l1,i|1≤i≤k} 1,1X or t→tmax{l2,i|1≤i≤k} 2,1X). Let us assume that the rule t→tmax{l1,i|1≤i≤k} 1,1Xwas executed, hence the table to be simulated is T1. The number max{l1,i |1≤i≤k} of objects t1,1guarantees that any combination of the rules from T1which have the same symbol on the left and which are executed at certain moment by H, can be simulated by Π. Consequently, scenarios indicated by the regular expressions d∗t1,1→t1,1a1→α1,j d∗where 1 ≤j≤l1,1 are started. In these scenarios the rules of type a1→α1,j (which correspond to the rules a1→α1,j ∈T1) are applied at a certain moment. However, also the scenarios indicated by the regular expression d∗t1,1→t1,2a1→#d∗ start their execution; in case the rule t1,1→t1,2is executed and there are objects a1in the region, then the symbol # will be produced and the system Πwill never stop (no output). This scenario is used to check if all objects a1were rewritten. The computation continues in the same manner for all the objects from V. After all objects from Vwere rewritten (i.e., in the current configuration there are only objects from the set {a|a∈V}and object t1,k+1), the system Πrewrites back all the objects from the set {a|a∈V}into their corresponding version from V. Scenarios indicated by the following regular expressions are used to complete the task: d∗t1,k+1 →t1,k+2 a1→a1d∗ d∗t1,k+2 →t1,k+3 a2→a2d∗ . . . d∗t1,2k→t1,2k+1 ak→akd∗ Scenario Based P Systems 77 Finally, scenarios from group 4 start, and object Xis rewritten either into object t(and Πrestarts the computation by simulating the application of another table of H) or into object f(which will be used to check whether the current configuration of Πcorresponds to a string computed by Hwhich is formed only by symbols from ∆). In case object fis generated, then scenarios indicated by regular expressions d∗f→f1ap+1 →#d∗ d∗f1→f2ap+2 →#d∗ . . . d∗fp→λ ak→#d∗ d∗#→#d∗. are applied and if in the current configuration there exists a symbol from V\∆, then the symbol # is generated and the computation never stop. Otherwise, the system stops generating a multiset that correspond to a string from L(H). Consequently, it was proved that NOSBP d2 m(ncoo)⊇NET 0L. The following result shows the computation power of SBP systems using noncooperative and catalytic rules, and the degree of synchronization 3. Theorem 5. NOSBP d3 m(cat1) = NRE. Proof. For the inclusion NOSBP d3 m(cat1)⊇NRE we will simulate with a SBP system with one region Π= (O, C, µ, w1, R1, E1, i0= 1) a register machine M= (n, P, l0, lh). The system Πis defined as follows: O={ai|1≤i≤n}∪{l1, l2|l1: (add(r), l2)∈ P} ∪ {l1, l2, l3, l1, l2, X, Y |l1: (sub(r), l2, l3)}; C={c}, µ = [ ]1, w1=l0. The sets R1of rules and E1of regular expressions are constructed as follows: •for any instruction l1: (add(r), l2) we add the rule r(l1,1) :l1→arl2to R1and the regular expression d∗r(l1,1)d∗to E1; •for any instruction l1: (sub(r), l2, l3) we add the following rules to R1and the regular expressions to E1 The rules added to R1The regular expressions added to E1 r(l1,1) :l1→l1X r(l1,2) :car→c d∗r(l1,1)r(l1,2)r(l1,3)d∗ r(l1,3) :l1→l2 r(l1,4) :X→Y r(l1,5) :Y→λ d∗r(l1,4)r(l1,5)r(l1,6)d∗ r(l1,6) :l1→l3 r(l1,7) :l2→l2d∗r(l1,7)d∗ •for the instruction l1:halt, the rule rl1:l1→λis added to R1and the regular expression d∗rl1d∗is added to E1. 78 G. Ciobanu, D. Sburlan Similarly as in the proof of Theorem 2, we model the value stored in the register rof Mas the multiplicity of the object arin a configuration of Π. Since the scenarios are nondeterministically selected from the languages indicated by the regular expressions, and these scenarios may contain as a prefix a string of an arbitrary length and which is composed only by symbols d, then we don’t know when the first rules of the scenarios will be executed. Let Πbe in a configuration C1=at1 1. . . atr r. . . atn nl1cand let us assume that in the configuration C1a rule from R1will be executed. In this configuration there might exist scenarios already in execution and/or scenarios that can be started. No matter which is the case, the single rule that can be applied in configuration C1is l1→l1Xwhich belongs to a scenario s1from L(d∗l1→l1X car→c l1→l2d∗) (a scenario started in a previous configuration). This rule will be applied once and the resulting configuration will be C2=at1 1. . . atr r. . . atn nl1Xc. Next, we distinguish two cases: •if tr>0 (that is, in C2there exists objects ar) then the rule car→cfrom scenario swill be executed. Moreover in this configuration will start new scenarios (apart from those already in execution). In particular, a scenario s2from L(d∗X→Y Y →λ l1→l3d∗) will be executed (which means that the rule X→Ywill compete for objects, at a certain moment, in one subsequent configuration). However, there might be the case that a scenario of the same kind, started in a previous step, attempts to execute the rule X→Yin configuration C2. Consequently we have two possible cases: in configuration C2will be only executed the rule car→c(hence the next configuration will become C(3,1) =at1 1. . . atr−1 r. . . atn nl1Xc) or the pair of rules car→cand X→Y (hence the next configuration will become C(3,2) =at1 1. . . atr−1 r. . . atn nl1Y c). In the first case (i.e., in configuration C(3,1)) we have again a branch in the computation: either will be executed the rule l1→l2(which means that the next configuration will be C(3,1,1) =at1 1. . . atr−1 r. . . atn nl2Xc) or the pair of rules l1→l2and X→Y(which means that the next configuration will be C(3,1,2) =at1 1. . . atr−1 r. . . atn nl2Y c). It follows that for the configuration C(3,1,1) will be executed a scenario that, at a certain moment, will rewrite firstly the object Xinto Y(by an application of the rule X→Y) and then will delete the object Y(by an application of the rule Y→λ). In the same time, a scenario that applies the rule l2→l2 will be executed and the configuration reached will be at1 1. . . atr−1 r. . . atn nl2c which corresponds to a correct simulation of the register machine subtraction instruction. •if tr= 0 then the rule car→cfrom scenario scannot be executed anymore and so, the execution of the scenario swill be interrupted (hence the rule r(l1,3) :l1→l2is not executed anymore in this simulation of the subtraction instruction). However the rule r(l1,4) :X→Yin a scenario from the set L(d∗r(l1,4)r(l1,5)r(l1,6)d∗) will be executed at a certain moment. Next, the object Ywill trigger the execution of the rule r(l1,5) :Y→λ. Finally the rule r(l1,6) : Scenario Based P Systems 79 l1→l3is applied and the resulting multiset will become at1 1. . . atn nl3cwhich again corresponds to a correct simulation of the register machine subtraction instruction. It follows that Πcorrectly simulates the computation of M, and so, taking into account the Turing-Church thesis, NOSBP d3 m(cat1) = NRE. 5 Conclusion Metabolic pathways are usually composed of chains of enzymatically catalyzed chemical reactions. They are interconnected in a complex way in the framework of a metabolic network. Inspired by this biological phenomenon, we have defined and studied the scenario based P systems. In this computational model, regular expressions are used to express the causal dependence relations existing between various executions of the rules. In this way we intend to identify certain causalities in the chains of reactions connecting different parts of the metabolic network. References 1. Agrigoroaiei, O., Ciobanu, G., Flattening the Transition P Systems with Dissolution, Lecture Notes in Computer Science vol.6501, pp.53–64, 2011. 2. Agrigoroaiei, O., Ciobanu, G., Quantitative Causality in Membrane Systems, Lecture Notes in Computer Science vol.7184, pp.62–72, 2012. 3. Busi, N., Causality in Membrane Systems, Lecture Notes in Computer Science vol.4860, pp.160–171, 2007. 4. Ciobanu, G., Lucanu, D., Events, Causality and Concurency in Membrane Systems, Lecture Notes in Computer Science vol.4860, pp.209–227, 2007. 5. Rozenberg, G., Salomaa, A. (Eds.): Handbook of Formal Languages, Springer Verlag, Berlin, 2004. 6. Minsky, M., Computation: Finite and Infinite Machines, Prentice-Hall, Englewood Cliffs, 1967. 7. P˘aun, G.: Membrane Computing. An Introduction, Springer, 2002. 8. Sburlan, D., P Systems with Chained Rules, Lecture Notes in Computer Science vol.7184, pp.359–370, 2012. 86 R. Freund, Gh. P˘aun region iwe choose a maximal non-empty (if it exists) multiset of rules from Ri having the same target indication tar (for different membranes these targets may be different). The families of sets N(Π) and P s (Π) computed by P systems with target selection with at most mmembranes and rules of type Xare denoted by NOPm(X, ts) and PsOPm(X, ts), respectively. For all the variants of P systems of type X, we may consider to label all the rules in the sets R1, . . . , Rmin a one-to-one manner by labels from a set Hand to take a set Wcontaining subsets of H. Then a P system with label selection is a construct Π= (O, µ, w1, . . . , wm, R1, . . . , Rm, H, W, f) where Π0= (O, µ, w1, . . . , wm, R1, . . . , Rm, f) is a P system as defined above, His a set of labels for the rules in the sets R1, . . . , Rm, and W⊆2H. In any transition step in Πwe first select a set of labels U∈Wand then apply a non-empty multiset Rof rules such that all the labels of these rules in Rare in Uand the set Rcannot be extended by any further rule with a label from Uso that the obtained multiset of rules would still be applicable to the existing objects in the membrane regions 1, . . . , m. The family of sets N(Π) and Ps (Π) computed by P systems with label selection with at most mmembranes and rules of type Xis denoted by NOPm(X, ls) and P sOPm(X, ls), respectively. Another method to control the application of the labeled rules is to use control languages (see [6] and [1]). A controlled P system is a construct Π= (O, µ, w1, . . . , wm, R1, . . . , Rm, H, W, f) where Π0= (O, µ, w1, . . . , wm, R1, . . . , Rm, f) is a P system as defined above, H is a set of labels for the rules in the sets R1, . . . , Rm, and Wis a string language over 2Hfrom a family F L. Every successful computation in Πhas to follow a control word U1. . . Un∈W: in transition step i, only rules with labels in Uiare allowed to be applied, and after the n-th transition, the computation halts; we may relax this end condition, and then we speak of weakly controlled P systems. If W= (U1. . . Up)∗,Πis called a (weakly) time-varying P system: in the computation step pn +i,n≥0, rules from the set Uihave to be applied; pis called the period. The family of sets Y(Π), Y∈ {N, P s}, computed by (weakly) controlled P systems and (weakly) time-varying P systems with period p, with at most mmembranes and rules of type Xas well as control languages in FL is denoted by Y OPm(X, C (FL)) (Y OPm(X, wC (F L))) and Y OPm(X, TVp) (Y OPm(X, wTVp)), respectively. In the P systems with membrane creation considered in this paper, besides the catalytic rules ca →c(u, tar) and the non-cooperative rules a→(u, tar) we also use catalytic membrane creation rules of the form ca →c[u]i(in the context of c, from the object aa new membrane with label icontaining the multiset u is generated) and membrane dissolution rules a→uδ (we assume that no objects can be sent into a membrane which is going to be dissolved; with dissolving the membrane iby applying δ, all objects contained inside this membrane are collected in the region surrounding the dissolved membrane); in all cases, cis a Universal P Systems: One Catalyst Can Be Sufficient 87 catalyst, ais an object, uis a multiset, and tar is a target indication of the form here,out, and inj. The family of sets Y(Π), Y∈ {N, Ps}, computed by such P systems with membrane creation and using at most kcatalysts, with minitial membranes and having at most hmembranes during its computations is denoted by Y Pm,h (catk, mcre). 3 Computational Completeness of P Systems with Label Selection Theorem 1. Y OP1(cat1, ls) = Y RE,Y∈ {N, Ps}. Proof. We only prove the inclusion P sRE ⊆P sOP1(cat1, ls). Let us consider a register machine M= (n+ 2, B, l0, lh, I) with only the first and the second register ever being decremented, and let A={a1, . . . , an+2}be the set of objects for representing the contents of the registers 1 to n+ 2 of M. We construct the following P system: Π= (O, {c},[ ]1, cdl0, R1, H, W, 0), O=A∪B∪ {c, d, #}, H={l, l0|l∈B}∪{lx|x∈ {1,2, d, #}} , and the sets of labels in Wand the rules for R1are defined as follows: A. Let li: (ADD (r), lj, lk) be an ADD instruction in I. If r > 2, then the (labeled) rules li:li→lj(ar, out), l0 i:li→lk(ar, out), are introduced, and for r∈ {1,2}, we introduce the rules li:li→ljar, l0 i:li→lkar. In both cases, we define {li, l0 i}to be the corresponding set of labels in W. The contents of each register r,r∈ {1,2}, is represented by the number of objects ar present in the skin membrane; any object arwit r > 2 is immediately sent out into the environment. B. The simulation of a SUB instruction li: (SUB (r), lj, lk), for r∈ {1,2}, is carried out by the following rules and the corresponding sets of labels in W: For the case that the register r,r∈ {1,2}, is empty we take the (labeled) rules li:li→lk, lr:car→c, ld:cd →c#, (if no symbol aris present, i.e., if the register ris empty, then the trap symbol # is introduced) and for the case that the register ris not empty, we introduce the rules l0 i:li→lj, l0 r:car→c# 88 R. Freund, Gh. P˘aun (if at least one symbol aris present, i.e., if the register ris not empty, then the trap symbol # is introduced); the corresponding sets of labels to be taken into W are {li, lr, ld}and {l0 i, l0 r}, respectively. In both cases, the simulation of the SUB instruction works correctly, if we have made the right choice. C. We also add the labeled rule l#: # →# to R1and {#}to W, hence, the computation cannot halt once the trap symbol # has been generated. In sum, we have the equality P s (M) = Ps (Π), which completes the proof. 4 Computational Completeness of P Systems with Target Selection Theorem 2. Y OP7(cat1, ts) = Y RE,Y∈ {N, Ps}. Proof. We only prove the inclusion P sRE ⊆PsOP7(cat1, ts). Let us consider a register machine M= (n+ 2, B, l0, lh, I) with only the first and the second register ever being decremented, and let A={a1, . . . , an+2}be the set of objects for representing the contents of the registers 1 to n+ 2 of M. The set of labels B\ {lh}is divided into three disjoint subsets: B+={l|li: (ADD (r), lj, lk)∈I}, B−r={l|li: (SUB (r), lj, lk)∈I}, r ∈ {1,2}; moreover, we define B−=B−1∪B−2,B0 −={l0|l∈B−},B00 −={l00 |l∈B−}, and B0=B+∪B−∪B0 −∪B00 −as well as A={a1, . . . , an+2}. We construct the following P system: Π= (O, {c},[ [ ]2. . . [ ]7]1, w1, . . . , w7, R1, . . . , R7,0), O=A∪ {a0 1, a0 2} ∪ B0∪ {c, d, #}, with w1=l0,w2=c, and wi=λfor 3 ≤i≤7. In order to make argumentation easier, in the following we refer to the membrane labels 1 to 7 according to the following table: 1 2 3 4 5 6 7 skin −0102−1−2+ The sets of rules now are constructed as follows: A. The simulation of any instruction from Istarts in the skin membrane with moving all objects except the output symbols arfor r > 2 into an inner membrane; according to the definition, taking the target in means non-deterministically choosing one of the inner membranes, but the same membrane for all objects to be moved in. The output symbols arfor r > 2 are sent out into the environment by ar→(ar, out), thus yielding the result of a halting computation as the number of symbols arsent out into the environment during this computation. Hence, in sum we get Universal P Systems: One Catalyst Can Be Sufficient 89 R1={x→(x, in)|x∈B+∪B−∪ {a1, a2, a0 1, a0 2,#}} ∪ x→(xd, in)|x∈B0 − ∪ {ar→(ar, out)|3≤r≤n+ 2}. B. For the simulation of an ADD instruction li: (ADD (r), lj, lk)∈Iall nonterminal symbols (all symbols except arfor r > 2) are expected to have been sent to membrane +: R+={li→(ljar, out), li→(lkar, out)|li: (ADD (r), lj, lk)∈I} ∪ {l→(#, out)|l∈B0\B+} ∪ {x→(x, out)|x∈ {a1, a2,#}} . If the symbols arrive in membrane + with a label l∈B0\B+, then the trap symbol # is generated and the computation will never halt. Sending out all terminal symbols arfor r > 2 from the skin membrane can be done as a last step of a successful computation, but we may also choose to send out all those present there at a specific moment instead of immediately continuing the simulation of an instruction of the register machine. Hence, the simulation of an ADD instruction by Πtakes at most three steps. C. The simulation of a SUB instruction li: (SUB (r), lj, lk) is carried out in two steps for the zero test, i.e., when the register ris empty, using (the rules in) membrane 0r, and in five steps for decrementing the number of symbols ar, first using membrane −rto mark the corresponding symbols arinto a0 rand then using the catalyst cin membrane −to erase one of these primed objects; the marking procedure is necessary to guarantee that the catalyst erases the correct object. For r∈ {1,2}, we define the following sets of rules: R0r={li→(lk, out), ar→(#, out)|li: (SUB (r), lj, lk)∈I} ∪ {l→(#, out)|l∈B0\B−r} ∪ {x→(x, out)|x∈ {a3−r,#}} . If the number of objects aris not zero, i.e., if the register ris not empty, the introduction of the trap symbol # causes the computation to never halt. On the other hand, if we want to decrement the register, we have to guarantee that exactly one symbol aris erased: R−r={li→(l0 i, out)|li∈B−r}∪{ar→(a0 r, out)} ∪ {l→(#, out)|l∈B0\B−r} ∪ {x→(x, out)|x∈ {a3−r,#}} . The whole multiset of objects, with the primed versions of liand the ar, via the skin membrane now has to enter membrane −; here the dummy symbol dguarantees that the catalyst cannot do nothing if no primed symbol a0 rhas arrived; again the generation of # causes the computation to not halt anymore: R−=l0 i→l00 j, ca0 r→c, l00 i→#, l00 i→(lj, out)|li: (SUB (r), lj, lk)∈I ∪ {cd →c#, d →(λ, out)}∪{a0 r→(ar, out)|r∈ {1,2}} , ∪l→(#, out)|l∈B0\B00 − ∪ {x→(x, out)|x∈ {a3−r,#}} . 90 R. Freund, Gh. P˘aun In R−, for correctly continuing the simulation of a SUB instruction, exactly two steps have to be carried out: In the first step, the target indication here has to be used with applying the two rules l0 i→l00 jand ca0 r→c(eliminating exactly one copy of a0 r, i.e., decrementing register r) and leaving all other objects unchanged; if instead the target indication out were chosen, the forced application of the rule l0 i→(#, out) would yield the trap symbol #. In the second step, the target indication out has to be chosen and the rules l00 i→(lj, out), d→(λ, out), and a0 r→(ar, out) are to be applied; if instead the target indication here were chosen again, the forced application of the rule l00 i→# would yield the trap symbol #. Whenever a trap symbol is generated in one of the inner membranes, we get an infinite computation, as in R1we have the rule # →(#, in) and in every inner membrane we have the rule # →(#, out). We finally observe that a computation in Πhalts if and only if the final label lh appears (and then stays in the skin membrane) and no trap symbol # is present, hence, we conclude P s (M) = P s (Π). To eventually reduce the number of inner membranes remains as a challenging task for future research. 5 Computational Completeness of Time-Varying P Systems Theorem 3. NOP1(cat1, αT V6) = NRE,Y∈ {N, Ps},α∈ {λ, w}. Proof. We only prove the inclusion P sRE ⊆P sOP1(cat1, TV6). Let us consider a register machine M= (n+ 2, B, l0, lh, I) with only the first and the second register ever being decremented. Again, we define A={a1, . . . , an+2}and divide the set of labels B\ {lh}into three disjoint subsets: B+={l|li: (ADD (r), lj, lk)∈I}, B−r={l|li: (SUB (r), lj, lk)∈I}, r ∈ {1,2}; moreover, we define B−=B−1∪B−2as well as B0=nl, ˜ l, ˆ l|l∈B\ {lh}o∪l−, l0,¯ l−,¯ l0,|l∈B−. The main challenge in the construction for the time-varying P system Πis that the catalyst has to fulfill its task to erase an object ar,r∈ {1,2}, for both objects in the same membrane where all other computations are carried out, too; hence, at a specific moment in the cycle of period six, parts of simulations of different instructions have to be coordinated in parallel. The basic components of the timevarying P system Πare defined as follows (we here do not distinguish between a rule and its label): Universal P Systems: One Catalyst Can Be Sufficient 91 Π= (O, {c},[ ]1, l0, R1∪ · · · ∪ R6, R1∪ · · · ∪ R6,(R1. . . R6)∗,0), O=A∪ {a0 1, a0 2} ∪ B0∪ {c, h, #}. We now list the rules in the sets of rules Rito be applied in computation steps 6n+i,n≥0, 1 ≤i≤6: R1: in this step, the ADD instructions are simulated, i.e., for each li: (ADD (r), lj, lk)∈Iwe take cli→car˜ lj,cli→car˜ lk(only in the sixth step of the cycle, from ˜ ljand ˜ lkthe corresponding unmarked labels ljand lkwill be generated); in order to obtain the output in the environment, for r≥3, arhas to be replaced by (ar, out); cl →cl−,cl →cl0initiate the simulation of a SUB instruction for register 1 labeled by l∈B−1; cl →cˆ lmarks a label l∈B−2(the simulation of such a SUB instruction for register 2 will start in step 4 of the cycle); #→# keeps the trap symbol # alive guaranteeing an infinite loop once # has been generated; h→λeliminates the auxiliary object hneeded for simulating SUB instructions and eventually generated two steps before. R2: in the second and the third step, the SUB instructions on register 1 are simulated, i.e., for all l∈B−1we start with ca1→ca0 1(if present, exactly one copy of a1can be primed) and l−→¯ l−h,l−→¯ l0hfor all l∈B−1; #→#; c˜ l→c˜ l,˜ l→# for all l∈B+, cˆ l→cˆ l,ˆ l→# for all l∈B−2. R3: for all li: (SUB (1) , lj, lk)∈Iwe take c¯ l0 i→c˜ lk,a0 1→#, ¯ l0 i→# (zero test; if a primed copy of a1is present, then the trap symbol # is generated); ¯ l− i→˜ lj,ca0 1→c,ch →c# (decrement; the auxiliary symbol his needed to keep the catalyst cbusy with generating the trap symbol # if we have taken the wrong guess when assuming the register 1 to be non-empty); #→#; c˜ l→c˜ l,˜ l→# for all l∈B+; cˆ l→cˆ l,ˆ l→# for all l∈B−2. R4: in the fourth step, the simulation of SUB instructions on register 2 is initiated, i.e., we take cˆ l→cl−,cˆ l→cl0for all l∈B−2; c˜ l→c˜ l,˜ l→# for all l∈B+∪B−1; #→#, h→λ. R5: in the fifth and the sixth step, the SUB instructions on register 2 are simulated, i.e., for all l∈B−2we start with 92 R. Freund, Gh. P˘aun ca2→ca0 2(if present, exactly one copy of a2can be primed) and l−→¯ l−h,l−→¯ l0hfor all l∈B−2; c˜ l→c˜ l,˜ l→# for all l∈B+∪B−1; #→#. R6: the simulation of SUB instructions li: (SUB (2) , lj, lk)∈Ion register 2 is finished by c¯ l0 i→clk,a0 2→#, ¯ l0 i→# (zero test; if a primed copy of a2is present, then the trap symbol # is generated); ¯ l− i→lj,ca0 2→c,ch →c# (decrement; the auxiliary symbol his needed to keep the catalyst cbusy with generating the trap symbol # if we have taken the wrong guess when assuming the register 2 to be non-empty); c˜ l→cl,˜ l→# for all l∈B+∪B−1. Without loss of generality, we may assume that the final label lhin Mis only reached by using a zero test on register 2; then, at the beginning of a new cycle, after a correct simulation of a computation from Min the time-varying P system Πno rule will be applicable in R1(another possibilty would be to take c¯ l0 i→c instead of c¯ l0 i→clhin R6). At the end of the cycle, in case all guesses have been correct, the requested instruction of Mhas been simulated and the label of the next instruction to be simulated is present in the skin membrane. Only in the case that Mhas reached the final label lh, the computation in Πhalts, too, but only if during the simulation of the computation of Min Πno trap symbol # has been generated; hence, we conclude Ps (M) = P s (Π). 6 Computational Completeness of P Systems with Membrane Creation Theorem 4. Y OP1,2(cat1, mcre) = Y RE,Y∈ {N, P s}. Proof. We only prove the inclusion PsRE ⊆P sOP1,2(cat1, mcre). Let us consider a register machine M= (n+ 2, B, l0, lh, I) with only the first and the second register ever being decremented, and let A={a1, . . . , an+2}. We construct the following P system: Π=O, {c},[ ]1, cdl0, R1, R2, R3,0, O=A∪ {l, l0, l00 |l∈B}∪{c, d, d0, d00,#}, and the sets of rules are constructed as follows. A. For each ADD instruction li: (ADD (r), lj, lk) in I, the rules step 1: li→l0 i, d →d0, step 2: l0 i→arlj, l0 i→arlk, d0→d. Universal P Systems: One Catalyst Can Be Sufficient 93 are introduced in R1and obviously simulate an ADD instruction in two steps. B. For each SUB instruction li: (SUB (r), lj, lk) in I, the following rules are introduced in R1and Rr+1,r∈ {1,2}: Step R1Rr+1 1cli→c[li]r+1, d →d0– 2car→c(ar, inr+1), d0→(d0, inr+1)li→l0 i 3 – ar→λδ, l0 i→l00 i, d0→d00 4cl00 i→clj, d00 →d l00 i→lk, d00 →dδ A SUB instruction li: (SUB (r), lj, lk) (with r∈ {1,2}) is simulated according to the four steps suggested in the table given above: In the first step, we create a membrane with the label r+ 1, where liis sent to, and simultaneously dbecomes d0. In the next step, if any arexists, i.e., if register ris not empty, then one copy of arshould enter the membrane r+ 1 just having been created in the preceding step. Note that the selection of the membrane (the use of inr+1 instead of in) is important: arhas to go to the membrane created in the previous step, when r+ 1 has been specified by the label li. At the same time, d0enters the membrane r+ 1, and libecomes l0 iin this membrane. If the register ris empty, then the catalyst is doing nothing in this second step. In the third step, in membrane r+ 1, l0 ibecomes l00 iand d0becomes d00. If ar is not present in membrane r+ 1, nothing else happens there in this step; if ar is present, it dissolves the membrane and disappears. Observe that in both cases car→c(ar, inr+1) will not be applicable (anymore) in R1. Thus, we either have cl00 id00 in the skin membrane (when the register has been non-empty), or we have only cin the skin membrane and l00 id00 in the inner membrane r+ 1. In the first case, in the fourth step we use the rules cl00 i→cljand d00 →dfrom R1, which is the correct continuation of the simulation of the SUB instruction; in the latter case, we use l00 i→lkand d00 →dδ in Rr+1. The inner membrane is dissolved, and in the skin membrane we get the objects clkd. In both cases, the simulation of the SUB instruction is correct and we return to a configuration as that we started with, hence the simulation of another instruction can start. C. We also add the rules ar→(ar, out) for 3 ≤r≤n+ 2 and # →# to R1. In any moment, any copy of a terminal symbol arin the skin membrane is sent out to the environment. Once the trap symbol # has been introduced, the computation continues forever. There is one interference between the rules of Πsimulating the ADD and the SUB instructions of M. If in the second step of simulating a SUB instruction, instead of d0→(d0, inr+1) we use d0→d, then the case when register ris nonempty continues correctly, as the simulation lasts four steps, and in the end dis present in the skin membrane (the dissolution of membrane ris done by ar). If the register rhas been empty, l00 iwill become lkin membrane r+ 1 and it will remain there until d0enters the membrane, changes to d00 , and then dissolves it (as long as d, d0switch to each other in the skin membrane, the computation cannot 94 R. Freund, Gh. P˘aun halt). Thus, also in this case we return to the correct submultiset clkdin the skin membrane. Consequently, exactly the halting computations of Mare simulated by the halting computations in Π; hence, P s (M) = P s (Π). The observation that the maximal number of membranes in any computation of Πis two completes the proof. It remains as an open problem whether it is possible to use the target indication in only instead of the inj. 7 Computational Completeness of P Systems with Mobile Catalysts If the membrane creation rules are of the form ca →[cb ]i, then this implicitly means that the catalyst is moving from one region to another one. However, for mobile catalysts, the universality of such systems with only one catalyst has already been proved in [5], using three membranes and target indications of the forms here,out, and inj. In this paper, we improve this result from the last point of view, making only use of the target indications here,out, and in. In fact, if in the proof of Theorem 2 we let the catalyst cmove with all the other objects, then we immediately obtain a proof for NOP7(mcat1) = NRE where even only the target indications out and in are used (but instead of three we need seven membranes). Theorem 5. Y OP3(mcat1) = Y RE,Y∈ {N, Ps}. Proof. We only prove the inclusion P sRE ⊆P sOP1(cat1, ls). Let us consider a register machine M= (n+ 2, B, l0, lh, I) with only the first and the second register ever being decremented, and let A={a1, . . . , an+2}be the set of objects for representing the contents of the registers 1 to n+ 2 of M. We construct the following P system: Π= (O, {c},[ [ ]2[ ]3]1, cl0, R1, R2, R3,0), O=A∪ {l, l0, l00, l000 |l∈B}∪{c, #}, and the sets of rules are constructed as follows: A. Let li: (ADD (r), lj, lk) be an ADD instruction in I. If r= 3, then the rules li→lj(a3, out), li→lk(a3, out) are introduced in R1; if r∈ {1,2}, in R1we introduce the rules li→lj(ar, in), li→lk(ar, in),as well as the rules a4−j→# and # →# in Rj+1,j∈ {1,2}. The contents of each register r, r∈ {1,2}, is represented by the number of objects arpresent in membrane r+ 1; any object ar, 3 ≤r≤n+2, is immediately sent out into the environment. If a4−j is introduced in membrane j,j∈ {1,2}, then the trap object # is produced and the computation never halts. Universal P Systems: One Catalyst Can Be Sufficient 95 B. The simulation of a SUB instruction li: (SUB (r), lj, lk) is carried out by the following rules (the simulation again has four steps, as in the proof of Theorem 4): For the first step, we introduce the rule cli→(c, in) (li, in) in R1and the rule li→# in both R2and R3(if cand liare not moved together into an inner membrane, then the trap object # is produced and the computation never halts). In the second step, Rr+1 has to use the rule cli→cl0 i. This checks whether c and lihave been moved together into the right membrane r+ 1; if this is not the case, then the rule cli→cl0 iis not available and the rule li→# must be used, which causes the computation to never halt. Thus, after the second step, we know whether both cand li(l0 i) are in the correct membrane r+ 1. The rules car→(c, out) and l0 i→l00 iare introduced in Rr+1 in order to perform the third step of the simulation. If there is any copy of arin membrane r+1 (i.e., if register ris not empty), then the catalyst exits, while also removing a copy of ar. Simultaneously, l0 ibecomes l00 i. Hence, if the register rhas been non-empty, we now have cin the skin membrane and l00 iin membrane r+ 1; if register rhas been empty, we have both cand l00 iin membrane r+ 1. We introduce the rules cl00 i→(c, out) (lk, out), l00 i→(l000 i, out),in Rr+1 and the rules cl000 i→clj, l000 i→#,#→# in R1. If cis inside membrane r+1, we get clkin the skin membrane, which is the correct continuation for the case when the register is empty. If cis not in membrane r+ 1, then l00 iexits alone thereby becoming l000 i, and, together with c, which waits in the skin membrane, introduces lj, which is a correct continuation, too. If the rule l00 i→(l000 i, out) is used although cis inside membrane r+ 1, then in the skin membrane we have to use the rule l000 i→# and the computation never halts. In all cases, the simulation of the SUB instruction works correctly, and we return to a configuration with the catalyst and a label from Hin the skin region. In sum, we have the equality P s (M) = Ps (Π), which completes the proof. 8 Final Remarks Although we have exhibited several new universality results for P systems using only one catalyst together with some additional control mechanism, the orignal problem of characterizing the sets of non-negative integers generated by P systems with only one catalyst still remains open. A similar challenging problem is to consider purely catalytic P systems with only two catalysts: with only one catalyst, we obtain the regular sets; as shown in [3], three catalysts are enough to obtain universality. With two catalysts and some additional control mechanism, universality can be obtained, too; for example, the proof of Theorem 1 for P systems with label selection for the rules can easily be adapted for purely catalytic P systems, i.e., NOP1(pcat2, ls) = NRE. For the other variants of additional control mechanisms, the case of purely catalytic P systems with two catalysts remains for future research. 102 M. Gheorghe et al. σj, 1 ≤j≤3. As two instances of the compartment type t2,C2, C3, appear in the system, when the rule r1from the compartment C1is applied, the object bgoes non-deterministically to one of the two compartments labelled 2 (from t2) as long as premains in compartment C1; object cgoes always to the compartment C4, of type t3. The initial configuration of kΠ1is M0= (a3p, p, p, λ). The only applicable rules are r1, r2and r3from C1and r2, r3from C2, C3. If r1, r2are chosen in C1 and r2in C2, C3, then a3pis rewritten by r1, r2in C1and pin C2, C3by r2; then three a0s stay in C1, three b’s go non-deterministically to C2, C3, three c’s go to compartment C4, and each pin C2, C3stays in its compartment. Let us assume that two of them go to C2and one to C3. Hence, the next configuration is M1= (a3p, b2p, bp, c3). If in the next step the same rules are applied identically in the first compartment, C1, and rules r1, r2are used in C2and r1, r3in C3, then the next configuration is M2= (a3p, b2c2p, bc, c6). If now r1, r3are used in C1, with r1used in the same way and r1, r3in C2(no rule is available in C3) then M3= (a3, b2c4, b2c, c9); this is a final configuration as there is no pto trigger a further step. Example 3. Let us reconsider the example above enriched with rules dealing with the system’s structure. First the set Twill be replaced by T0={t1, t0 2, t3}, where t0 2= (R0 2, σ0 2), with R0 2=R2∪Rstr 2and σ0 2=Lab(R2)>&Lab(Rstr 2)>. We can notice that σ0 2tells us that first the rewriting and communication rules are applied in a maximal parallel manner and then one of system’s structure rules is chosen to be executed. The set Rstr 2denotes the set of membrane division rules for t0 2, i.e., Rstr 2={r4: []2→[]2[]2{≥ b2∧ ≥ p}}. The new kP system, denoted kΠ2, will have the following four compartments: C1= (t1, w1,0), C0 2= (t0 2, w2,0), C0 3= (t0 2, w3,0), C4= (t3, w4,0). If the system follows the same pathway as kΠ1then M2shows a different configuration given that in C0 2after applying R2in a maximal parallel manner, Rstr 2is applied as indicated by σ0 2, when the guard of r4is true. The compartment C0 2is divided into two compartments, C2,1, C2,2, instantiated from the same compartment type t2, with the content of C0 2and appearing on positions 2 and 3 in the new configuration, M0 2= (a3p, b2c2p, b2c2p, bc, c6); the new compartments, C2,1, C2,2, are linked to compartment C1. Compartment C0 3is not divided as the guard of r4is not true for its current multiset. In the next step both C2,1, C2,2are divided as they contain the guard triggering the membrane division rule r4. The process will stop when either pwill be rewritten to λor b2stops coming to these compartments. Remark 5. If we aim to dissolve one of the compartments instantiated from t2or to disconnect it from compartment C1, once a certain condition is true, for instance {≥ b2∧ ≥ c2∧ ≥ p}, then two more rules will be added to Rstr 2, namely r5: []2→λ{≥ b2∧ ≥ c2∧ ≥ p},r6: []2−[]1→[]2; []1{≥ b2∧ ≥ c2∧ ≥ p}. The expression σ0 2remains the same, but in this case Rstr 2contains three elements and at most one is applied at each step, in every compartment with label 2. For this reason σ0 2can also be written as Lab(R2)>&Lab(Rstr 2). Kernel P Systems 103 2.4 Final Remarks We will recap and summarise how various rules are applied in a compartment instantiated from a compartment type tli. The rules presented in Section 2.1 are applied as follows: •A rewrite - communication rule, x→(a1, t1). . . (ah, th){g}, is executable if and only if 1. its left hand side multiset, x, is contained within the current multiset; 2. its associated guard, g, holds (i.e., it is true for the current multiset); 3. for each right hand side element, (aj, tj), tj∈T(see Definition 1), there is at least one connected compartment of type tjto receive aj, otherwise the rule is not applicable. •A membrane division rule, [x]tli→[y1]ti1. . . [yp]tip{g}, is executable if and only if 1. the multiset on the left hand side, x, is included in the current multiset; 2. its associated guard, g, is true for the current multiset; 3. no other structure changing rule (see Definitions 6 and 7) has been applied in the same step; 4. the compartment instantiated from tliis replaced by pcompartments instantiated from the compartment types ti1, . . . , tip; their contents will be the same as the content of the compartment on the left hand side, but x will be replaced by y1, . . . , yp, respectively; 5. all the links of the compartment instantiated from tliwill be inherited by each of those instantiated from the compartment types ti1, . . . , tip. •A membrane dissolution rule, []tli→λ{g}, will destroy the compartment obtained from liand its links, given the guard gis true for the current multiset; no other structure changing rule (see Definitions 6 and 7) has been applied in the same step;. •A link creation rule, [x]tli; []tlj→[y]tli−[]tlj{g}, is executable if and only if 1. its left hand side multiset, x, is contained in the current multiset in the compartment; 2. its associated guard, g, holds; 3. there exists at least one membrane instance of type tljwhich is not connected to the instance of type tli(i.e there is at least one instance to link to); if there are more instances then one will be non-deterministically chosen; 4. no other structure changing rule (see Definitions 6 and 7) has been applied in the same step. •A link destruction rule is executed when conditions similar to those mentioned for link creation hold. 104 M. Gheorghe et al. 3 Neural-like P Systems and P Systems with Active Membranes versus kP Systems In order to prove how powerful and expressive kP systems are, we will show how two of the most used variants of P systems are simulated by kP systems. More precisely, we will show how neural-like P systems and P systems with active membranes are simulated by some reduced versions of kP systems. Definition 8. Aneural-like P system (tissue P system with states) of degree nis a construct Π= (O, σ1, ...σn, syn, i0)([14], p. 249), where: •Ois a finite, non-empty set of objects, the alphabet; •σi= (Qi, si,0, wi,0, Ri),1≤i≤n, represents a cell and –Qiis the finite set of states of cell σi; –si,0∈Qiis the initial state; –wi,0∈O∗is the initial multiset of objects contained in cell σi; –Riis a finite set of rewriting and communication rules, of the form sw → s0xygozout; when such a rule is applied, xwill replace win cell σi, the objects from ywill be sent to neighbouring cells, according to the transmission mode (see Remark 6) and the objects from zwill be sent out into the environment; cell σiwill move from state sto s0; •syn ⊆ {1, ..., n}×{1, ..., n}, the connections between cells, synapses; •i0is the output cell. Remark 6. We discuss here a special class of P systems introduced in Definition 8 that will help us to prove a first result. 1. For neural-like P systems, three processing modes are considered, called “max”, “min”, “par”, and three transmission modes, namely “one”, “repl”, “spread”. For formal definitions and other details we refer to [14]. 2. We denote by simple neural-like P systems the class of P systems given by Definition 8, where the rewriting and communication rules have the form sw → s0x(a1, t1)· · · (ap, tp), where th, 1 ≤h≤p, denotes the target cell (σh), and processing mode “max”, transmission mode defined by the target indications mentioned in each rule. Notation. For a given P system, Π, the set of numbers computed by Πwill be denoted by M(Π). Theorem 1. If Πis neural-like P system of degree n, then there is a kP system, Π0, of degree nand using only rules of type (a), rewriting and communication rules, simulating Πand such that M(Π0)⊆M(Π)∪ {2}. Proof. Let Πbe a simple neural-like P systems of degree n, as defined by Remark 6.2. We construct the kP system, Π0, as follows: the set of compartment types T={t1, . . . , tn}, where ti= (R0 i, σi), 1 ≤i≤n, (see below the definitions of ti components) and Π0= (A, µ, C1, . . . , Cn, i0) where: Kernel P Systems 105 •A=O∪(S1≤i≤nQi)∪ {γ};γis a new symbol neither in Onor in S1≤i≤nQi; •µ=syn; •Ci= (ti, w0 i,0),1≤i≤n; and –w0 i,0=γ, 1≤i≤n; –R0 icontains the following rules: 1. γ→si,0twi,0, where si,0, wi,0are the initial state and initial multiset, respectively, associated with cell σi, and t∈Q(i) si,0. For s∈Qi, denote by Q(i) s={t|t∈Qi, sx →ty ∈Ri}; i.e., Q(i) sgives, when the cell σi is in state s, all the states where σican move to. In the first step, in compartment Ci, a rule γ→si,0twi,0is applied and the current multiset becomes w0 i=si,0wi,0. 2. For each pair (s, t), t ∈Q(i) s, there are rules sxj→tyj∈Ri,1≤j≤p(∗). If there are no rules in Rifrom sto tthen another pair of states is considered. For the above rules from Ri, (∗), the following rules are considered in R0 i: xj→yj{=s∧=t}, 1 ≤j≤p, and st →tq {≥ x1∨. . . ∨ ≥ xp}, q∈Q(i) t(∗∗). In the above guards the notation ≥xj, if xj=aj,1. . . aj,lj, denotes ≥aj,1∧. . . ∧ ≥ aj,lj. The rules (∗∗) make use of guards; the first prules are applied iff the current multiset contains one sand one t, whereas the last one is applicable iff at least one or more of the occurrences of one of the multisets xj, 1 ≤j≤p, is included in the current multiset. Clearly, in state sonly the rules (∗) of Πare applicable for this P system, depending on the availability of the multisets occurring on the left hand side of them; the next state Πis moving to t. Similarly, in Π0only the rules denoted by (∗∗) are applicable; the rule st →tq {≥ x1∨. . . ∨ ≥ xp} is applied once whereas the first prules are applied as many times as their corresponding (∗) rules are applied. If the set Q(i) tused in st →tq {≥ x1∨. . . ∨ ≥ xp}of (∗∗) is empty, i.e., there are no rules from state t, then the rule is replaced by st →λ. When Q(i) si,0=∅then the rule γ→wi,0is introduced in R0 i. At any moment the component Ciof the kP system Π0contains a multiset which is the multiset of σiaugmented by the current state of σi,s, and one of the next states, t, if it exists. The process will stop in component Ciof Π0when no pair of rules of type (∗∗) is applicable, which means no sxi→tyirule is applicable in state s. The multiset M(Π0) contains M(Π) and maybe two states s, t occurring in the last step of the computation. Hence M(Π0)⊆M(Π)∪ {2}.ut Remark 7. A few comments regarding Theorem 1. 1. The above simulation can be assessed with respect to number of compartments, objects and rules as well as the computation steps. 106 M. Gheorghe et al. 2. When rules sw →txygo ∈Riare used in the “spread” mode, this means that any a∈Ooccurring in ymay go to any of the neighbours. In this case if y=y1ay2then for each such a∈O, in the set R0 ithe rule w→xy {=s∧=t}, defined in the proof of Theorem 1, will be replaced by w→xy1(a, j)y2{=s∧= t}, where jthe label of one of the neighbours of the current compartment. For “one” mode all a0s in ywill point to the same target, j, for all neighbours of the compartment i. 3. The transmission replicative mode - when a symbol is sent to all the neighbours, can also be simulated. Indeed if j1, . . . , jhare the neighbours of i, then w→ xy1(a, j)y2is transformed into w→xy1(a, j1). . . (a, jh)y2for each a. 4. If a rewriting rule contains zout on its right side, i.e., sw →txygoxout then in the set of rules transcribing it, w→α, we will have α=xy1(a, j)y2z0, where if z=a1. . . ak, then z0=a0 1· · · a0 k; also rules a0→λwill be added to R0 i, for any a∈O. In this way in the next step all the prime elements are removed from the compartment. 5. If we want to simulate the “min” processing mode then this can be obtained by specifying the sequential behaviour of the component iby changing the definition of σicorresponding to the component. We study now how P systems with active membranes are simulated by kP systems. In this case we are dealing with a cell-like system, so the underlying structure is a tree and a set of labels (types) for the compartments of the system. The system will start with a number of compartment and its structure will evolve. In the study below it will be assumed that the number of compartments simultaneously present in the system is bounded. Definition 9. A P system with active membranes of initial degree nis a tuple (see [15], Chapter 11) Π= (O, H, µ, w1,0, . . . , wn,0, R, i0)where: •O,w1,0, . . . , wn,0and i0are as in Definition 8; •His the set of labels for compartments; •µdefines the tree structure associated with the system; •Rconsists of rules of the following types – (a) rewriting rules:[u→v]e h, for h∈H,e∈ {+,−,0}(set of electrical charges), u∈O+,v∈O∗; – (b) in communication rules:u[]e1 h→[v]e2 h, for h∈H,e1, e2∈ {+,−,0}, u∈O+,v∈O∗; – (c) out communication rules:[u]e1 h→[]e2 hv, for h∈H,e1, e2∈ {+,−,0}, u∈O+,v∈O∗; – (d) dissolution rules:[u]e h→v, for h∈H\{s},sdenotes the skin membrane (the outmost one), e∈ {+,−,0},u∈O+,v∈O∗; – (e) division rules for elementary membranes:[u]e1 h→[v]e2 h[w]e3 h, for h∈H, e1, e2, e3∈ {+,−,0},u∈O+,v, w ∈O∗; The following result shows how a P system with active membranes starting with n1compartments and having no more than n2simultaneously present ones can be simulated by a kP system using only rules of type (a). Kernel P Systems 107 Theorem 2. If Πis a P system with active membrane having n1initial compartments and utilising no more than n2compartments at any time, then there is a kP system, Π0, of degree 1and using only rules of type (a), rewriting and communication rules, such that Π0simulates Π. Proof. Let us denote J0={(i, h)|1≤i≤n2, h ∈H}; for a multiset w=a1. . . am, (w, i, h), (i, h)∈J0, denotes (a1, i, h). . . (am, i, h). Let us consider the P system with active membranes, Π= (O, H, µ, w1,0, . . . , wn1,0, R, i0). The polarizations of the n1compartments are all 0, i.e., e1=. . . =en1= 0. We construct Π0using T={t1}, where t1= (R0 1, σ1) (where R0 1and σ1will be defined later) as follows: Π0= (A, µ0, C1,1) where: •A=S(i,h)∈J0{(a, i, h)|a∈O∪ {+,−,0}∪{δ}}, where δis a new symbol; let us denote by = δall the guard ¬= (δ, 1,1) ∧. . . ∧ ¬ = (δ, n2,|H|), |H|is the number of elements in H(= δall stands for none of the (δ, i, h), (i, h)∈J0); •µ0= []1; •C1= (t1, w0 1,0), and –w0 1,0= (w1,0,1, h1). . . (wn1,0, n1, hn1)(e1,1, h1). . . (en1, n1, hn1), e1=. . . =en1= 0; let Jc=J0\ {(i, hi)|1≤i≤n1}(Jcdenotes indexes available for new compartments and J0\Jcthe set of indexes of the current compartments); –R0 1contains the following rules 1. for each h∈Hand each rule [u→v]e h∈R,e∈ {+,−,0}, we add the rules (u, i, h)→(v, i, h){= (e, i, h)∧=δall}, 1 ≤i≤n2; these rules are applied to every multiset containing elements with h∈H, only when the polarization (e, i, h) appears and none of the (δ, j, h0) appears; 2. for each h∈Hand each rule u[]e1 h→[v]e2 h∈R,e1, e2∈ {+,−,0}, we add the rules (u, j, l)(e1, i, h)→(v, i, h)(e2, i, h){=δall}, 1 ≤i≤n2, jis the parent of iof label l; these rules will transform (u, j, l) corresponding to ufrom the parent compartment jto (v, i, h) corresponding to vfrom compartment iof label h, the polarization is changed; for each polarization, (e1, i, h) only one single rule can be applied at any moment of the computation; 3. for each h∈Hand each rule [u]e1 h→[]e2 hv∈R,e1, e2∈ {+,−,0}, we add the rules (u, i, h)(e1, i, h)→(v, j, l)(e2, i, h){=δall}, 1 ≤i≤n2,j is the parent of iof label l; 4. for each h∈Hand each rule [u]e h→v∈R,e∈ {+,−,0}, we add the rules (u, i, h)(e, i, h)→(v, j, l)(δ, i, h){=δall}, 1 ≤i≤n2,jis the parent of iof label l; all the elements corresponding to those in compartment imust be moved to jthis will happen in the presence of (δ, i, h) when no other transformation will take place; this is obtained by using rules (a, i, h)→(a, j, l){= (δ, i, h)},a∈Oand (δ, i, h)→λ{= (δ, i, h)}; the set of available indexes will change now to Jc=Jc∪{(i, h)}; 108 M. Gheorghe et al. 5. for each h∈Hand each rule [u]e1 h→[v]e2 h[w]e3 h∈R,e1, e2, e3∈ {+,−,0}; if j1, j2are the indexes of the new compartments, we add (u, i, h)(e1, i, h)→(v, j1, k1)(e2, j1, k1)(w, j2, k2)(e3, j2, k2)(δ, i, h){= δall}, 1 ≤i≤n2; the content corresponding to compartment ishould be moved to j1and j2, hence rules (a, i, h)→(a, j1, k1)(a, j2, k2{= (δ, i, h)},a∈Oand finally (δ, i, h)→λ{= (δ, i, h)};Jcis updated, Jc=Jc∪ {(i, h)}\{(j1, k1),(j2, k2)}. The size of the multiset obtained in i0by using Πcomputation is the same as the size of the multiset in Π, when only (a, i0, h) are considered, minus 1 (the polarization is also included). ut 4 Case Study - Static Sorting In this section we analyse the newly introduced kP systems by comparing them with established P system classes by using them to specify a static sorting algorithm. This algorithm was first written with symport/antiport rules [4] and then reconsidered in some other cases [2]. The specification below mimics this algorithm. 4.1 Static Sorting with kP Systems Let us consider a kP system having the following n= 6 compartment types: ti= (Ri, σi) and corresponding compartments Ci= (ti, wi,0), 1 ≤i≤n, where w1,0=a3;w2,0=a6p;w3,0=a9;w4,0=a5p;w5,0=a7;w6,0=a8p. The rules of the set Ri, 1 ≤i≤n, are : r1:a→(b, i −1) {≥ p}, only for i > 1 r2:p→p0 r3:p0→(p, i −1), for ieven and r0 3:p0→(p, i + 1), for iodd r4:ab →a(a, i + 1), i<n r5:b→a,i<n. We assume that any two compartments, Ci, Ci+1, 1 ≤i<n, are connected. The aim of this problem is to order the content of these compartments such that the highest element (a9) will be in the leftmost compartment, C1, and the smallest one (a3) in the rightmost compartment, Cn, (n= 6). Remark 8. The functioning of the kP systems is presented below: •A={a, b, p, p0}is the set of objects; •the rule r1is absent from the compartment C1; •the last two rules, r4, r5, are only present in compartments C1to Cn−1; •for n= 2k+ 1 we need an auxiliary compartment, Cn+1, which will start with an initial multiset pand will contain a set of rules with r2:p→p0and r3:p0→(p, n); whereas Cnshould have an additional rule r0 3:p0→(p, n + 1); Kernel P Systems 109 •in each compartment Ci,σi={r1, r2, r3, r4}>{r5}>, if iis even; for odd values of i,r3is replaced by r0 3;σitells us that firstly the rules from the first set are applied in a maximal parallel manner and then r5, also in a maximal way; •σidescribes an order relationship, r1, r2, r3, r4> r5; so we can replace this kP system by a P system with promoters and having an order relationships on the set of rules associated with each membrane. The table below presents the first steps of the computation. In the first step the only applicable rules are r1, r2; given the presence of p, rule r1moves all a0s from each even compartment to the left compartment as b0s and rule r2transforms p into p0. Next, rules r3, r4, r5are applicable; first r3and r4are applied, this means p0is moved as pto the left compartments and for each ab an ais kept in the current compartment and a bis moved as an ato the right compartment; finally, the remaining b0s, if any, are transformed into a’s. These two steps implement a sort of comparators between two adjacent compartments moving to the left bigger elements. In the previous steps the comparators have been considered between odd and even compartments. In the next step p0s appear in even compartments and the comparators are now acting between an even and an odd compartment. The algorithm does not have a stopping condition. It must stop when no changes appear in two consecutive steps. Given that the algorithm must stop in maximum 2(n−1) steps, then we can introduce such a counter, c, in each compartment and rules c→c1,ci→ci+1, 1 ≤i≤2(n−1) −2 and c2(n−1)−1p→λ. Compartments - Step C1C2C3C4C5C6 0a3a6p a9a5p a7a8p 1a3b6p0a9b5p0a7b8p0 2a6p a3a9p a5a8p a7 3a6p0a3b9p0a5b8p0a7 4a6a9p a3a8p a5a7p 5a6b9p0a3b8p0a5b7p0 Remark 9. Bounded number of compartment types. The above solution is using ncompartment types for ncompartments. As the rules are the same in each compartment, with two exceptions involving the components at both ends of the system (compartments C1and Cn), it is natural to look for a solutions with a bounded number of types. If we use the same type everywhere except for the two margins then we face the problem of replacing the rules using targets with different rules where the targets are now the new types; if these are the same we can no longer distinguish between left and right neighbours, so we should have at least two distinct ones. Additionally, we have to distinguish odd and even positions. Consequently, four types, and two more for the two ends are enough. Are there further simplifications? The answer to this question and the solution in this case are left as exercises to the reader. 110 M. Gheorghe et al. 4.2 Static Sorting with States We consider the same n-compartment tissue-like P system structure as in the previous subsection. Additionally, in this case, the rules in each compartment use states; an order relationship between rules in each compartment is also considered. Initial states are s1in odd compartments and s0otherwise; the content of the 6 regions is illustrated by the first line, step 0, of the table below. The addition of states is potentially very useful from a modelling point of view since many widely-used modelling languages are state-based and, therefore, such rules were a strong candidate for inclusion in our kP system model. However, as shown below, states can be effectively simulated by rewriting rules, as shown below. For the algorithm considered, the rules in each compartment and the order relationships are as follows Compartment 1: r1:s0x→s0y r2:s0y→s1x r3:s1ab →s0a(a, 2) r4:s1b→s0a The rules satisfy: r1, r2, r3> r4. Compartment i, 2 ≤i≤n−1: r1:s0a→s1(b, i −1) r3:s1ab →s0a(a, i + 1) r4:s1b→s0a The rules satisfy: r1, r3> r4. Compartment n: r1:s0a→s1bn−1 r2:s1x→s1y r3:s1y→s1z r4:s1z→s0x Membranes - Step C1C2C3C4C5C6 0s1:a3x s0:a6s1:a9s0:a5s1:a7s0:a8x 1s1:a3b6x s1:s1:a9b5s1:s1:a7b8s1:x 2s0:a6x s1:a3s0:a9s1:a5s0:a8s1:a7y 3s0:a6y s1:a3b9s1:s1:a5b8s1:s1:a7z 4s1:a6x s0:a9s1:a3s0:a8s1:a5s0:a7x 5s1:a6b9s1:s1:a3b8s1:s1:a5b7s1:x In the case where we have an odd number of compartments, the n−th region must contain an yinstead of x. Thus the starting configuration for n= 7 is the Kernel P Systems 111 following: w1,0=a3x;w2,0=a6;w3,0=a9;w4,0=a5;w5,0=a7;w6,0=a8;w7,0=a13y. 4.3 Static Sorting with P Systems Using Polarizations on Membranes We now use cell-like P systems with active membranes to specify the same algorithm. P systems with active membranes were introduced with the primary aim of solving NP-complete problems in polynomial (often linear) time [15]. The key features of this variant is the possibility of multiplying the number of compartments during the computation process by using membrane division rules in addition to multiset rewriting and communication rules. Each membrane can have one of the three electrical charges {+,−,0}and a rule can only be executed if the membrane has the required electrical charge; a rule can also change the polarization of the membrane when objects cross it (either in or out). In our static sorting example compartments with two states were used, so, when the algorithm is implemented using electrical charges, it is expected that two electrical charges would suffice. Indeed, from the list of rules below one may observe that 0 and + are the only polarizations utilised. There is, however, a problem with this approach, arising from the rule application strategy. In P systems with membrane division and polarizations, only one rule which can change the polarization of a membrane can be applied per step [8]. The sorting algorithm however, employs maximal parallel communication rules to operate the comparator procedure between membranes. In order to correctly implement this procedure we will accept maximal parallel communication rules which change the charge of the membrane they traverse to/from if and only if they target the same final polarization. In the case of P systems with polarizations on membranes we will use a cell-like structure with n= 6 regions defined below with the initial multisets included and initial polarizations; the implementation of the static sorting with P systems with polarization on membranes is using priorities over the sets of rules. µ= [[[[[[[a3x1]0 1a6x1]+ 2a9x1]0 3a5x1]+ 4a7x1]0 5a8x1]+ 6]0 aux Rules: ”Comparator” rules: r1:a[]0 j→[b]0 j,1≤j≤n; r2: [ab]0 j→a[a]+ j,1≤j≤n; r3: [b→a]0 j,1≤j≤n; Rules for switching polarities between adjacent membranes: r4: [x1→x2]i j,1≤j≤n; r5: [x2]0 j→y1[]+ j,1≤j≤n; r6: [x2]+ j→y1[]0 j,1≤j≤n; r7: [y1→y2]i j,1< j ≤n+ 1; 118 M. Gheorghe et al. A Case Study - Partition Problem In the previous section we have introduced the subset of kP systems which is included in P–Lingua platform, as well as the main features of the software tool. This section describes a case study to be modelled and simulated, as explained in the next section. The problem we will focus on is the well-known NP-complete problem called the partition problem. This is formulated as follows: let Vbe a finite set and weight, an additive function on Vwith positive integer values. It is requested to find, if exists, a partition of V, denoted V1,V2, such that weight(V1) = weight(V2). A solution to this problem is provided in [9] by using a recogniser tissue P system with cell division and symport/antiport rules. In this case study we adapt the solution to skP systems. Let V={v1, . . . , vn}be a finite set with weight(vi) = ki, where kiis a positive integer, 1 ≤i≤n. The following skP system is built, depending on n(the number of elements in the set), in order to check whether there is a partition, V1,V2, with weight(V1) = weight(V2) = k(please note we also check that the weights of both subsets are k). The set of component types, T={t1, t2},ti= (Ri, σi),1≤i≤2. R1and R2are given as follows: •R1contains r1,1:S→(yes, 0) {≥ T}, r1,2:S→(no, 0) {≥ F∧< T}; r1,1or r1,2sends an answer yes or no, respectively, to the environment; •R2contains membrane division rules: r2,i : [Ai]2→[BiAi+1]2[Ai+1]2,1≤i<n, r2,n : [An]2→[BnX]2[X]2,1≤i<n; these rules generate in nsteps all the subsets of V(2nsubsets); each of them being a potential V1and V2its complement; rewriting rules: r2,i,j :vivj→v{=Bi∧ 6=Bj∧=X∨ 6=Bi∧=Bj∧=X}, 1≤i<j≤n, r2,n+1 :X→Y; and rewriting and communication rules: r2,n+2 :Y→(F, 1) {≥ v1∨. . . ∨ ≥ vn∨ 6=vk}, r2,n+3 :Y→(T, 1) {< v1∧. . . ∧< vn∧=vk}. The execution strategies are given by σi=Lab(Ri)>,1≤i≤2,i.e., maximal parallelism. The skP system is given by skΠ3(n) = (A, µ, C1, C2,0),where: •Ais the alphabet; •µis given by the graph with edge (1,2); •C1= (t1, w1,0), C2= (t2, w2,0), where w1,0=S,w2,0=A1code(n), with code(n) = v1k1. . . vnknbeing the code of the weights of the elements in V, and being k, half the sum of the kivalues. Kernel P Systems 119 The computation leads to an answer, yes or no, in n+3 steps. In fact, in nsteps all the subsets of Vare generated, as it can be observed above. In step n+1, in each compartment C2every occurrence of an element viof the subset of Vis paired up with an element vjof the complement as many times as the weights allow to, by using r2,i,j as many times as possible; objects Xare simultaneously transformed into objects Y. The step n+ 2 consists of sending either Tor Fto compartment C1depending on whether all the elements of the subset and their complements are paired up and the number of pairs is k(i.e., the weight of the partition), or the weights of the subsets are different or are not equal to k(rules r2,n+3 and r2,n+2 are respectively used). Finally, in step n+ 3 the answer is provided by using one of the rules of C1. This solution might be easily changed to only verify that weight(V1) = weight(V2), by simply removing the condition referred to vkin guards attached to rules r2,n+2 and r2n+3. skP Systems Simulation The previous sections have introduced some background details about P– Lingua specification language and its new features with regard to skP systems, along with the description of a case study, the Partition problem, modelled within this approach. This section has the aim of outlining the basic facts concerning the simulation environment to work with the above presented model. An integrated methodology for modelling, simulation, analysis and formal verification of skP systems was first presented in [11]. This methodology was supported by the software environment provided by MeCoSim and P–Lingua. P–Lingua provides the P systems designer with a powerful and expressive language to specify skP systems or families of them, possibly including variable parameters whose values depend on the specific instance of the skP system to be generated, such as nfor the size of the input set. MeCoSim provides a customisable and extensible visual environment to enable the end user interacting with the P system model implementation. The user provides the input data by custom visual tables, and then runs the simulations (by using the simulation engine of pLinguaCore, that includes simulators for skP systems). Finally, custom visual outputs are generated in the form of tables, charts and/or graphs. The cited methodology has been applied to our case study, that is, partition problem. The described model has been specified in P–Lingua format, having n and the weights in code(n) as variable parameters, depending on the specific set to analyse. P–Lingua file and some additional details about the interface and simulation are available at [17]. In addition, a custom application has been defined in MeCoSim, enabling the user entering n,kand the different weights k1to knfor the elements in the input set, as showed in Fig 1. As part of the custom application definition, a mapping is 120 M. Gheorghe et al. set to translate the input data into parameters for the model written in P–Lingua, possibly after performing additional tasks over the input data. This way, when the user introduces the specific input data and clicks Simulate!, the values for the parameters are calculated, the initial configuration is generated, the specific skP system is instantiated, and then the computation runs until a halting configuration is reached. Fig. 1. Input parameters in MeCoSim for Partition After the simulation has finished, the desired custom outputs are provided to the end user from the results of the computation, depending on the required information to be shown. For instance, a skP systems designer might be interested to know the contents of every membrane, or find out the answer, yes or no, to the problem. Both outputs have been set in MeCoSim custom application, as shown in Fig 2. The explained process should be enough to solve the decision problem, but a small additional effort could lead us to provide additional information, such as the elements contained in every specific valid partition, in an automatic way. This additional stuff has been provided by extending the original model with some additional informational objects, and some extra output charts defined for the custom output. The details can be found again in [17], but an example of output chart for a specific partition is shown in Fig. 3. 6 Conclusions The kP system introduced in this work represents a low level modelling language. Its syntax and informal semantics and some examples have been introduced and discussed. A case study based around a simple sorting algorithm has allowed us to compare different specifications of this using various types of P systems. Finally Kernel P Systems 121 Fig. 2. Output tables in MeCoSim for Partition Fig. 3. Partitions Chart in MeCoSim 122 M. Gheorghe et al. two specification languages and an implementation are discussed. In the next stage an implementation using the SPIN model checker is expected. Acknowledgement. The work of MG, FI and LM was partially supported by the MuVet project, Romanian National Authority for Scientific Research (CNCS – UEFISCDI), grant number PN-II-ID-PCE-2011-3-0688; CD’s work was supported by a DTA PhD studentship. MGQ, LVC and MJPJ were supported by project TIN 2012-37434 from “Ministerio de Econom´ıa y Competitividad” of Spain, and “Proyecto de Excelencia con Investigador de Reconocida Val´ıa P08-TIC-04200” from Junta de Andaluc´ıa, both co-financed by FEDER funds. MGQ was also supported by the National FPU Grant Programme from the Spanish Ministry of Education. References 1. A. Alhazov, L. Pan, Gh. P˘aun, Trading Polarizations for Labels in P Systems with Active Membranes, Acta Informatica, 41, 111-144, 2004. 2. A. Alhazov, D. Sburlan, Static Sorting P Systems. In [5], 215 – 252, 2006. 3. M. Ben-Ari, Principles of the SPIN Model Checker, Springer, 2008. 4. R. Ceterchi, C. Mart´ın-Vide, P Systems with Communication for Static Sorting. In Pre-Proceedings of Brainstorming Week on Membrane Computing, Tarragona, February 2003, M. Cavaliere, C. Mart´ın-Vide, Gh. P˘aun, eds., Technical Report no 26, Rovira i Virgili Univ., Tarragona, 101–117, 2003. 5. G. Ciobanu, Gh. P˘aun, M. J. P´erez-Jim´enez, eds., Applications of Membrane Computing, Springer, 2006. 6. M. Clavel, F.J. Dur´an, S. Eker, P. Lincoln, N. Mart´ı-Oliet, J. Meseguer, Maude: Specification and Programming in Rewriting Logic, Theoretical Computer Science, 285, 187 – 243, 2002. 7. M.A. Colomer, I. P´erez-Hurtado, M.J. P´erez-Jim´enez, A. Riscos-N´u˜nez. Comparing simulation algorithms for multienvironment probabilistic P system over a standard virtual ecosystem. Natural Computing, 11, 369–379, 2012. 8. D. D´ıaz-Pernil, M. A. Guti´errez-Naranjo, M. J. P´erez-Jim´enez, A Uniform Family of Tissue P Systems with Cell Division Solving 3-COL in a Linear Time, Theoretical Computer Science, 404, 76 – 87, 2008. 9. D. D´ıaz-Pernil, M. A. Guti´errez-Naranjo, M. J. P´erez-Jim´enez, A. Riscos-N´u˜nez. A linear time solution to the partition problem in a cellular tissue-like model. Journal of Computational and Theoretical Nanoscience, 7, 5, 884 – 889, 2010. 10. M. Gheorghe, F. Ipate, C. Dragomir, Kernel P Systems. In Membrane Computing, Tenth Brainstorming Week, BWMC 2012, Sevilla, Spain, February 2009, M. A. Mart´ınez-del-Amor, Gh. P˘aun, F. Romero-Campero, eds., Universidad de Sevilla, 153 – 170, 2012. 11. M. Gheorghe, F. Ipate, R. Lefticaru, M.J. P´erez-Jim´enez, A. Turcanu, L. Valencia, M. Garca-Quismondo, L. Mierl˘a. 3-COL problem modelling using simple kernel P systems. International Journal of Computer Mathematics, online version (http://dx.doi.org/10.1080/00207160.2012.743712). 12. M. Gheorghe, V. Manca, F.J. Romero-Campero, Deterministic and Stochastic P Ssytems for Modelling Cellular Processes, Natural Computing, 9, 457–473, 2010. Kernel P Systems 123 13. R. Nicolescu, M. J. Dinneen, Y.-B. Kim, Structured Modelling with Hyperdag P Systems: Part A. In Membrane Computing, Seventh Brainstorming Week, BWMC 2009, Sevilla, Spain, February 2009, R. Guti´errez-Escudero, M. A Guti´errez-Naranjo, Gh. P˘aun, I. P´erez-Hurtado, eds., Universidad de Sevilla, 85 – 107, 2009. 14. Gh. P˘aun, Membrane Computing: An Introduction, Springer, 2002. 15. Gh. P˘aun, G. Rozenberg, A. Salomaa, eds., The Oxford Handbook of Membrane Computing, Oxford University Press, 2010. 16. http://www.p-lingua.org – P–Lingua web page. 17. http://www.p-lingua.org/mecosim/doc/case studies/partition.html – Partition case study at MeCoSim web page. 7 Appendix 7.1 The EBNF formal description of kP–Lingua’s syntax kpsystem ::= {statement}; statement ::= type definition |instantiation |link; type definition ::= ‘type’, space, [space], identifier, [space], ‘{’, [space], {(rule | rule ensemble), [space]}, ‘}’; rule ensemble ::= (‘choice’ |‘max’ |‘arbitrary’), space, [space], ‘{’, [space], {rule}, [space], ‘}’; rule ::= [guard, [space], ‘:’], non-empty multiset, ‘->’ (empty multiset |non-empty multiset |targeted multiset |link creation |link destruction |dissolution | division), [space], ‘.’; multiset ::= empty multiset |non-empty multiset; empty multiset ::= ‘{}’; multiset atom ::= [multiplicity], [space], object; non-empty multiset ::= multiset atom |(multiset atom, [space], ‘,’, [space], nonempty multiset); type reference ::= ‘(’, identifier, ‘)’; targeted multiset atom ::= (multiset atom, [space], type reference) |(‘{’, nonempty multiset, ‘}’, [space], type reference); 124 M. Gheorghe et al. targeted multiset ::= targeted multiset atom |(targeted multiset atom, [space], ‘,’ [space], targeted multiset); link creation ::= ‘-’, [space], type reference; link destruction ::= ‘\-’, [space], type reference; dissolution ::= ‘#’; division atom ::= ‘[’, [space], [non-empty multiset], [space], ‘]’; division ::= {division atom, [space], type reference [space]}; instance ::= [identifier], space, [space], ‘{’, multiset, ‘}’, [space], type reference; instantiation ::= (instance, [space], ‘.’) |(instance, [space], ‘,’, [space], instantiation); link operand ::= instance |identifier; link ::= (link operand, [space], ‘-’, [space], link operand) |link, [space], ‘-’, [space], link operand, ‘.’; letter ::= ? A-Za-z ?; digit ::= ? 0-9 ?; alphanumeric ::= letter |‘ ’ |digit; identifier ::= letter, {alphanumeric}; object ::= letter, {alphanumeric |‘”}; space ::= ? any space character ?; Rete Algorithm for P System Simulators Carmen Graciani, Miguel A. Guti´errez-Naranjo, Agust´ın Riscos-N´u˜nez Research Group on Natural Computing Department of Computer Science and Artificial Intelligence University of Sevilla {cgdiaz,magutier,ariscosn}@us.es Summary. The Rete algorithm is a well-known algorithm in rule-based production systems which builds directed acyclic graphs that represent higher-level rule sets. This allows the rule-based systems to avoid complete re-evaluation of all conditions of the rules each step in order to check the applicability of the rules and, therefore, the computational efficiency of the production systems is improved. In this paper we study how these ideas can be applied in the improvement of the design of computational simulators in the framework of Membrane Computing. 1 Introduction Rules is one of the most used paradigms in Computer Science for dealing with information. Given two pieces of knowledge Vand W, expressed in some language, the rule V→Wis usually considered as a causal relation between Vand W. The interpretation of the rule can change according to the context, but roughly speaking, the rule V→Wclaims that the statement Wcan be derived from the statement V. The problem of knowing if a piece of information Gcan be obtained via derivation from a set of current statements Aand a set of rules Rarises in a natural way. This is usually called a reasoning problem and it will be denoted by hA, R, Gi. In Computer Science, there are two basic methods for seeking a solution of a reasoning problem, both of them based on the inference rule known as Modus Ponens: V V →W W which allows to obtain Wfrom the rule V→Wand the piece of information W. The first method is data-driven and it is known as forward chaining, the latter is query-driven and it is called backward chaining [1]. A study of these methods in the framework of Membrane Computing can be found in [12, 13]. The piece of information V(the left-hand side of the rule or LHS) is usually split into unit pieces v1, v2, . . . , vn. The forward chaining derivation of W(the right 126 C. Graciani et al. Forward chaining Input: A reasoning problem hA, R, Gi Initialise: Memory =A, Deduced =∅ if G∈Memory then return true end if while Memory 6=Deduced do Deduced ←Memory for all (v1v2. . . vn→W)∈Rsuch that {v1, v2,...,vn} ⊆ Deduced do if W=Gthen return true else Deduced ←Deduced ∪ {W} end if end for end while return false Fig. 1. From a computational point of view, the reasoning problem hA, R, Gi, can be solved with the forward chaining algorithm hand side of the rule or RHS) according to the Modus Ponens via the rule V→W needs to check if the statements v1, v2, . . . , vnbelong to the set of statements currently accepted. Figure 1 shows a detailed description of the forward chaining method. The key point of this algorithm is to check for all rules v1v2. . . vn→Wwhether {v1, v2, . . . , vn} ⊆ Deduced or not. A naive algorithm for this checking consists on 1. Enumerating the rules and the Deduced set. 2. Performing a sequential pattern matching between them. In the framework of Expert Systems [10], a solution to this problem was proposed by Charles L. Forgy in his Ph.D. dissertation at the Carnegie-Mellon University in 1979 [8, 9]. The solution was called the Rete1algorithm. The Rete algorithm places pieces of information in the nodes of a graph and gets faster response time than the naive algorithm of checking one by one the information units in the LHS of the rules. In spite of the notable differences between the semantics of the rules in Expert Systems and in Membrane Computing, the problem of checking if the restrictions of the LHS of the rule hold is common in both paradigms. In Membrane Computing, a rule of the form un1 1. . . unk k[vm1 1. . . vml l]α i→u0[v0]α0 i 1Rete means net in Latin. Rete Algorithm for P System Simulators 127 is applicable if, in the current configuration, there exists a membrane labelled by i, with polarisation α, containing enough objects v1. . . vland such that its surrounding membrane contains enough objects u1. . . uk. Although the application of the rule is different in both paradigms (in Membrane Computing, the objects in the LHS are consumed and the objects in the RHS are created; in Expert Systems the information in the LHS does not change, and the one in the RHS is considered true), in both cases it is necessary a checking of the conditions in order to decide the applicability of the rule. In this paper we explore if the successful ideas underlying the Rete algorithm can be adapted to the current P systems simulators and contribute to improve their efficiency so that they can face medium-size instances of real life problems. The paper is organised as follows: Next, we recall some preliminaries on the derivation process in logic and rule-based expert systems. In Section 3 a short description of the Rete algorithm is provided. Section 4 shows how this algorithm can be adapted to P system simulators. Some final remarks and lines for future research are provided in the last section. 2 Production Systems Next, we recall some preliminaries on production systems and the derivation of pieces of knowledge by using rules. 2.1 Formal Logic Preliminaries An atomic formula (also called an atom) is a formula with no deeper structure. An atomic formula is used to express some fact in the context of a given problem. The universal set of atoms is denoted with U. A knowledge base is a construct KB = (A, R) where A={a1, a2, . . . , an} ⊆ Uis the set of known atoms and R, a set of rules of the form V→Wwith V, W ⊆U, is the set of production rules. In propositional logic, the derivation of a proposition is done via the inference rule known as Generalised Modus Ponens P1, P2, . . . , PnP1∧P2∧ · · · ∧ Pn→Q Q The meaning of this rule is as follows: if P1∧P2∧ · · · ∧ Pn→Qis a production rule and P1, P2, . . . , Pn⊆Athen Qcan be derived from this knowledge. Given a knowledge base KB = (A, R) and an atomic formula g∈U, we say that g can be derived from KB, denoted by KB `g, if there exists a finite sequence of atomic formulas F1, . . . , Fksuch that Fk=gand for each i∈ {1, . . . , k}one of the following claims holds: •Fi∈A. •Fican be derived via Generalised Modus Ponens from Rand the set of atoms {F1, F2, . . . , Fi−1} 134 C. Graciani et al. technique into any other P system simulator. The adaptation of the algorithm has been made by considering that the computer where the software runs has only one processor and, in this way, the software simulation of the P systems is made sequentially in an one-processor machine. Nonetheless, new hardware architectures are being used for simulating P systems [3, 4, 5, 6, 15, 16, 17], so the parallel versions of the Rete algorithm [11, 14] and their relations with parallel simulators of P systems should be considered in the future. Acknowledgements The authors acknowledge the support of the Project of Excellence with Investigador de Reconocida Val´ıa of the Junta de Andaluc´ıa, grant P08-TIC-04200 and the project TIN2012-37434 of the Ministerio de Econom´ıa y Competitividad of Spain, both cofinanced by FEDER funds. References 1. Apt, K.R.: Logic Programming. In: Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics (B), pp. 493–574. The MIT Press (1990) 2. Cardona, M., Colomer, M.´ A., Margalida, A., Palau, A., P´erez-Hurtado, I., P´erez- Jim´enez, M.J., Sanuy, D.: A computational modeling for real ecosystems based on P systems. Natural Computing 10(1), 39–53 (2011) 3. Cecilia, J.M., Garc´ıa, J.M., Guerrero, G.D., Mart´ınez-del-Amor, M.A., P´erez- Hurtado, I., P´erez-Jim´enez, M.J.: Implementing P systems parallelism by means of GPUs. In: P˘aun, G. et al. (eds.) Workshop on Membrane Computing. Lecture Notes in Computer Science, vol. 5957, pp. 227–241. Springer, Berlin Heidelberg (2009) 4. Cecilia, J.M., Garc´ıa, J.M., Guerrero, G.D., Mart´ınez-del-Amor, M.A., P´erez- Hurtado, I., P´erez-Jim´enez, M.J.: Simulating a P system based efficient solution to SAT by using GPUs. Journal of Logic and Algebraic Programming 79(6), 317–325 (2010) 5. Cecilia, J.M., Garc´ıa, J.M., Guerrero, G.D., Mart´ınez-del-Amor, M.A., P´erez- Hurtado, I., P´erez-Jim´enez, M.J.: Simulation of P systems with active membranes on CUDA. Briefings in Bioinformatics 11(3), 313–322 (2010) 6. Cecilia, J.M., Garc´ıa, J.M., Guerrero, G.D., Mart´ınez-del-Amor, M.A., P´erez- Jim´enez, M.J., Ujaldon, M.: The GPU on the simulation of cellular computing models. Soft Computing 16(2), 231–246 (2012) 7. Colomer, M.A., Margalida, A., Sanuy, D., P´erez-Jim´enez, M.J.: A bio-inspired computing model as a new tool for modeling ecosystems: The avian scavengers as a case study. Ecological Modelling 222(1), 33 – 47 (2011) 8. Forgy, C.: Rete: A fast algorithm for the many pattern/many object pattern match problem. Artificial Intelligence 19(1), 17–37 (1982) 9. Forgy, C.L.: On the efficient implementation of production systems. Ph.D. thesis, Department of Computer Science, Pittsburgh, PA, USA (1979) 10. Giarratano, J., Riley, G.: Expert systems: principles and programming. Thomson Course Technology (2005) Rete Algorithm for P System Simulators 135 11. Gupta, A., Forgy, C., Newell, A., Wedig, R.: Parallel algorithms and architectures for rule-based systems. ACM SIGARCH Computer Architecture News 14(2), 28–37 (1986) 12. Guti´errez-Naranjo, M.A., Rogojin, V.: Deductive databases and P systems. Computer Science Journal of Moldova 12(1), 80–88 (2004) 13. Ivanov, S., Alhazov, A., Rogojin, V., Guti´errez-Naranjo, M.A.: Forward and backward chaining with P systems. International Journal on Natural Computing Research 2(2), 56–66 (2011) 14. Kuo, S., Moldovan, D.: The state of the art in parallel production systems. Journal of Parallel and Distributed Computing 15(1), 1 – 26 (1992) 15. Nguyen, V., Kearney, D., Gioiosa, G.: An extensible, maintainable and elegant approach to hardware source code generation in reconfig-P. Journal of Logic and Algebraic Programming 79(6), 383–396 (2010) 16. Pe˜na-Cantillana, F., D´ıaz-Pernil, D., Berciano, A., Guti´errez-Naranjo, M.A.: A parallel implementation of the thresholding problem by using tissue-like P systems. In: Real, P. et al. (eds.) CAIP (2). Lecture Notes in Computer Science, vol. 6855, pp. 277–284. Springer (2011) 17. Pe˜na-Cantillana, F., D´ıaz-Pernil, D., Christinal, H.A., Guti´errez-Naranjo, M.A.: Implementation on CUDA of the smoothing problem with tissue-like P systems. International Journal of Natural Computing Research 2(3), 25–34 (2011) On Controlled P Systems Kamala Krithivasan1, Gheorghe P˘aun2,3, Ajeesh Ramanujan1 1Department of Computer Science and Engineering Indian Institute of Technology, Madras Chennai-36, India [email protected], [email protected] 2Institute of Mathematics of the Romanian Academy PO Box 1-764, 014700 Bucure¸sti, Romania, and 3Department of Computer Science and Artificial Intelligence University of Sevilla Avda. Reina Mercedes s/n, 41012 Sevilla, Spain [email protected], [email protected] Summary. We introduce and briefly investigate P systems with controlled computations. First, P systems with label restricted transitions are considered (in each step, all rules used have either the same label, or, possibly, the empty label, λ), then P systems with the computations controlled by languages (as in context-free controlled grammars). The relationships between the families of sets of numbers computed by the various classes of controlled P systems are investigated, also comparing them with length sets of languages in Chomsky and Lindenmayer hierarchies (characterizations of the length sets of ET0L and of recursively enumerable languages are obtained in this framework). A series of open problems and research topics are formulated. 1 Introduction Most investigations in membrane computing deal with cell-like distributed computing devices (P systems) which process multisets of objects (symbols) in the compartments defined by membranes. That is, the data structure used is the multiset, sets with multiplicities associated with their elements; as a consequence, in a natural way, the results of computations are numbers. However, numerous researches were devoted to computations which have as results strings over given alphabets (in this way, the P systems generate/compute languages). Details and references can be found in [5]. A concise presentation of this research direction, also indicating a series of recent developments and several research topics, is provided by [4]. One of the suggestions in [4] is to associate a control language to a P system, in the way already well-known in formal language theory, e.g., in the case of 138 K. Krithivasan, Gh. P˘aun, A. Ramanujan context-free controlled grammars (see [2]). The difficulty in the case of P systems is the parallelism of computations: arbitrarily many rules can be used in the same step. There are two ways to overcome this difficulty. The first one, followed in [1], assumes the computations sequential, but here we follow the way suggested in [6] and further explored in [7]: in a step one may use only rules with the same label from a given set of labels, maybe also rules having no label (we say that such a rule has an empty label, denoted by λ). (Note that the sequential mode is not obtained as a particular case, considering the rules labeled in a one-to-one manner and without using the empty label: each single rule r:a→ushould be used as many times as aappears in a multiset.) Several possibilities appear: to allow rules with empty labels or not; in the latter case, to allow steps when only rules with empty labels are used or not; to have a control language which is finite, regular, or from a subregular family of languages other than the finite ones. Part of these possibilities will be considered here, for non-cooperating P systems and for catalytic P systems. Some delicate issues appear in comparison with the standard definition of successful computations in P systems (where successful means halting). In the case when no rule is labeled with λ, then in the end of the control word the computation ends, hence we do not need to consider the halting condition. On the contrary, when λsteps are possible, the halting condition should be preserved, as the computation can continue forever by means of λ-steps without interacting with the control word. Moreover, the rules are used in the maximally parallel manner, which means that if no rule can be applied, then the maximally applicable multiset of rules is the empty one; this means that no rule (with the specified label is applied), but still we consider this as a step of the computation. In the case of rules with a nonempty label, one symbol of the control word is “consumed”, hence a change in the system configuration (taking into account both the objects and the control word) is obtained, but a λ-step where no rule is applied changes nothing and the computation can continue forever. That is why we impose the restriction that after a λ-step when no rule can be applied, no further λ-step is permitted. This is important in ensuring the halting of computations. Note that a rule of the form λ:a→acan be applied forever to a multiset which contains the object a: nothing is changed, but the rule is effectively applied, this is not a λ-step when no rule is applied. As expected, by imposing restrictions on the way the rules of a P system are used the computing power is increased. This is confirmed for several cases, both by comparing the power of classes of controlled P systems to each other and to (the sets of numbers associated with) classes of languages in Chomsky and Lindenmayer hierarchies. In this framework, new characterizations of the length sets of ET0L languages and of recursively enumerable languages are obtained. Still, many problems remain open, while further related research topics can be considered (we formulate part of these problems and topics in the last section of the paper). On Controlled P Systems 139 As we mentioned before, P systems with computations controlled by means of regular languages were also considered in [1], but in a restricted case: the computations were considered sequential and, moreover, the halting condition was replaced with a more powerful condition. 2 Prerequisites We assume the reader to be familiar with basic notions and results in formal language theory (for details, one can consult [9]) and in membrane computing (see, e.g., [5] and the area website from [10]), that is why we introduce here only the notations we use. For an alphabet V, we denote by V∗the set of all strings over V, including the empty string, denoted with λ;V∗− {λ}is denoted by V+. A Chomsky grammar is a tuple G= (N, T, S, P), where Nis the nonterminal alphabet, Vis the terminal alphabet, S∈Nis the axiom, and Pis the set of rewriting rules. If the rules are of the forms A→aB, A →a, for A, B ∈N, a ∈T, then the grammar is said to be regular. (We omit the rules of the form A→λ, A ∈ N, as they can be removed without changing the generated language, possibly having only a rule S→λin the case when λ∈L(G); however, as usual in formal language theory, in what follows the empty string is ignored when comparing the power of two string processing devices. Correspondingly, number 0 is ignored when comparing the power of two number computing devices.) We denote by FIN, REG, RE the families of finite, regular, and recursively enumerable languages, respectively. In general, for a family FL of languages, we denote by NFL the family of length sets of languages in F L; formally, NFL = {length(L)|L∈FL}, where length(L) = {|x| | x∈L}and |x|is the length of the string x.NREG is the family of semilinear sets of numbers (sometimes denoted by SLIN1), and NRE is the family of sets of numbers which can be computed by Turing machines. A regularly controlled context-free grammar (with appearance checking) is a 6-tuple G= (N, T, S, P, K, F), where G0= (N, T, S, P) is a usual context-free grammar (nonterminal alphabet, terminal alphabet, axiom, set of rules), K⊆Lab∗ is a regular language over an alphabet Lab of labels associated in a one-to-one manner to rules in P(thus, we can imagine that K⊆P∗, with the rules considered elements of an alphabet) and F⊆Lab. A derivation in Gis a terminal derivation in G0which follows a control word w∈K, in the appearance checking mode: if a rule r:A→uis to be used, rnot in F, then the rule must be used, otherwise (if Ais not present in the sentential form) the derivation is blocked; if r∈Fand Aappears in the sentential form, then the rule must be used, but if Adoes not appear in the sentential form, then the rule is skipped and one passes to the next label indicated by the control word w. All terminal words generated in this way form the language L(G). One knows that context-free grammars (using λ-rules) with regular control languages characterize RE (hence, in terms of length set, characterize NRE). 140 K. Krithivasan, Gh. P˘aun, A. Ramanujan We will also need the notion of an ET0L system (extended tabled interactionless Lindenmayer system). Such a device is a quadruple γ= (V, T, w, P), where Vis the total alphabet, T⊆Vis the terminal alphabet, w∈V+is the axiom, and Pis the finite set of tables; a table is a set of rules of the form a→u, a ∈V, u ∈V∗, which is complete, i.e., for each a∈Vthere is a rule a→uin the table. The derivation starts from w; in a derivation step w=⇒w0we use a table in P, and this means rewriting in parallel all symbols from wusing the rules in the table. The generated language, L(γ), consists of all strings in T∗generated in this way. The families of languages of this form is denoted by ET0L. It is known that using or not λ-rules in ET0L systems makes no difference in the generative power, the same family ET0L is obtained, and that ET0L⊂RE and NET0L⊂NRE. If the terminal alphabet Tis not present, we have a (non-extended) tabled interactionless Lindenmayer system, in short, a T0L system; then all strings generated are accepted in the language L(γ) (hence each step of a derivation produces a string). It is known that T0L⊂ET0Land NREG ⊂NT 0L⊆NET0L(see [8]). In what concerns the classes of P systems we consider in this paper, they are the cell-like transition P systems (in short, P systems), specifically, with non-cooperating and with catalytic rules. Such a system is a tuple Π= (O, C, µ, w1, . . . , wm, R1, . . . , Rm) where Ois the alphabet of objects, C⊆Ois the set of catalysts (this component is present only in the catalytic systems and it is omitted in non-cooperating P systems), µis the membrane structure, with m membranes, wiis the multiset of objects present in region iof µin the initial configuration, and Riis the set of rules present in region iof µ; these rules are of the forms a→uand ca →cu, where a∈O, c ∈C, u ∈({bhere, bout |b∈O} ∪ {binj| b∈O, 1≤j≤m})∗; the target indication here is omitted. If C=∅, hence all rules are of the form a→u, then Πis called non-cooperating. The computation proceeds in a maximally parallel way and it provides an output only if it halts, a configuration is reached where no rule can be applied. The result of a computation is the number of objects which are sent out of the system during the computation (objects bwhich appear in the form bout in the right hand side of rules used in the skin region are sent out of the system, into the environment). The number mof membranes in µis called the degree of the system. The set of numbers generated by a P system Πis denoted by N(Π). The family of sets N(Π) generated by P systems of degree at most mis denoted by NPm(ncoo) when using non-cooperating rules and NPm(cati) when using catalytic rules, with at most icatalysts present in the system. If the number of membranes is not bounded, then the subscript mis replaced by ∗. The following results are known: NP∗(ncoo) = NREG,NP1(cat2) = NRE, but the size of the family NP∗(cat1) is not known (it is believed that it is strictly included in NRE). As only the case of one catalyst is of interest, in what follows we will investigate only this case. On Controlled P Systems 141 3 Label Restricted P Systems Consider a catalytic P system Π= (O, C, µ, w1, . . . , wm, R1, . . . , Rm) (of course, if C=∅, then we have a non-cooperating system) and associate with each rule in sets R1, . . . , Rma label, which can be either a symbol from an alphabet H or it can be λ; thus, the rules are written in the form r:u→v, with r∈H, or λ:u→v. We add then the alphabet of labels to the system, in the form Π= (O, C, µ, w1, . . . , wm, R1, . . . , Rm, H) and we say that Πis labeled. (Note that this time the labeling is not necessarily one-to-one like in controlled context-free grammars.) A computation in a labeled P system Πis label restricted if in each step one uses (in the maximally parallel manner) only rules with the empty label and rules labeled with the same label in H. A step where only rules λ:u→vare used is called a λ-step. The computations proceed exactly as in a usual P system: we start from the initial configuration, we proceed through maximally parallel steps (which are label restricted), and we get a result (in the environment) after the computation halts. Only halting computations provide a result. Two cases can be distinguished: using only labels in H(indicated by lr) or also allowing empty labels (indicated by lrλ). Correspondingly, we obtain four families of sets of numbers: NP∗(ncoo, lr), NP∗(cat1, lr),and NP∗(ncoo, lrλ), NP∗(cat1, lrλ), respectively. (Of course, when the number of membranes is bounded, the subscript of NP specifies the bound.) Note the important detail that lrλindicates that rules λ:u→vare allowed and, moreover, λ-steps are allowed. A possible case of interest would be to allow rules with the empty label, but not λ-steps (i.e., to ask that in each step at least a rule with a non-empty label to be used); this case remains as a research topic. We will mention now, in the form of lemmas, a series of relations about families defined up to now, and later we will synthesize all of them (as well as some results from the literature) in a diagram theorem. Lemma 1. NP∗(α) = NP1(α)and NP∗(α, β) = NP1(α, β), α ∈ {ncoo, cat1}, β ∈ {lr, lrλ}. Proof. The first equality is known, the second one can be proved in the same way: objects in a membrane iare indexed with i, and then all membranes different from the skin membrane can be omitted, the rules are handling indexed objects in the same way as in the compartments of the initial membrane structure. The target indications in the right hand side of rules are easily implemented by changing the subscripts of objects. According to this lemma, from now on we will use only P systems with only one membrane, and the subscript ∗in the notation of the generated families is omitted. Lemma 2. NP(ncoo, α)⊆NP (cat1, α), α ∈ {lr, lrλ}. 142 K. Krithivasan, Gh. P˘aun, A. Ramanujan Proof. Directly from the definition. Lemma 3. NP(α, lr)⊆NP(α, lrλ),α∈ {ncoo, cat1}. Proof. Directly from the definition. Lemma 4. NP(α)⊆NP(α, lr),α∈ {ncoo, cat1}. Proof. Consider a system Π= (O, C, µ, w1, R1) and add to it the set H={r}, with the same label rassociated with all rules in R1. Denote by Π0the obtained labeled P system. Clearly, no restriction is imposed on using the rules of Π0, hence N(Π) = N(Π0). Lemma 5. NET 0L⊆NP(ncoo, lr). Proof. Let γ= (V, T, w, P) be an ET0L system with ntables. Label all rules in table iwith ri,1≤i≤n, and let P1be the union of all these tables. We construct the labeled P system Π= (O, [ ]1, w, R1, H), where O=V∪ {#}, R1=P1∪ {f:A→#|A∈V−T}∪{f: # →#}∪{f:a→(a, out)|a∈T}, H={ri|1≤i≤n}∪{f}. In each step of a computation in Πwe use either only rules from a table of γor rules with the label f. If these latter rules are used before completing a terminal derivation in γ, then the trap object # is introduced, and the computation never halts. In the end of the computation, if the derivation in γis not terminal, the rules with the label fmust be used – in this way we check whether the derivation in γ was terminal; simultaneously, all terminal symbols of γare sent to the environment, hence the computation halts. Thus, we have, length(L(γ)) = N(Π). Somewhat surprisingly, we also have the following result. Lemma 6. NRE =NP (cat1, lr). Proof. We only have to prove the inclusion ⊆, the opposite one is a consequence of the Turing-Church thesis (it can also be proved by a direct, straightforward but cumbersome construction of a Turing machine simulating a label restricted P system). Let us consider a regularly controlled context-free grammar G= (N, T, S, P, K, F), with K⊆Lab∗, where Lab is an alphabet of labels associated in a one-to-one manner with rules in P. Consider a regular grammar GK= (NK, Lab, SK, PK) generating the language K; assume the rules in PK to be labeled in a one-to-one manner with symbols in a set LabK. We construct the labeled catalytic P system On Controlled P Systems 143 Π= (O, {c},[ ]1, cSKSE, R1, H), where: O=N∪T∪NK∪ {c, E, t, #}, H={(s, r)|s∈LabK, r ∈Lab}∪{f}, and the set R1is constructed as follows: 1. For s:XK→rYK∈PKand r:A→u∈Psuch that r /∈F, we introduce in R1the following rules: (s, r) : XK→YK, (s, r) : ZK→#, ZK∈NK, ZK6=XK, (s, r) : cA →cuhereuout, uhere contains all nonterminal symbols of uand uout contains all terminal symbols of u, with the subscript out, (s, r) : cE →c#, (s, r) : t→#; 2. For s:XK→rYK∈PKand r:A→u∈Psuch that r∈F, we introduce in R1the following rules: (s, r) : XK→YK, (s, r) : ZK→#, ZK∈NK, ZK6=XK, (s, r) : cA →cuhereuout, uhere contains all nonterminal symbols of uand uout contains all terminal symbols of u, with the subscript out, (s, r) : t→#; 3. For s:XK→r∈PKand r:A→u∈Psuch that r /∈F, we introduce in R1 the following rules: (s, r) : XK→t, (s, r) : ZK→#, ZK∈NK, ZK6=XK, (s, r) : cA →cuhereuout, uhere contains all nonterminal symbols of uand uout contains all terminal symbols of u, with the subscript out, (s, r) : cE →c#, (s, r) : t→#; 4. For s:XK→r∈PKand r:A→u∈Psuch that r∈F, we introduce in R1 the following rules: 246 Gh. P˘aun, M.J. P´erez-Jim´enez, G. Rozenberg can be used in the decidability mode: the code of an instance of a decision problem is introduced in iin and the result is obtained in iout: an object yes is placed in iout at a specified step of the computation if and only if the instance of the problem has a positive answer. More precise definitions of what it means to solve a decision problem in terms of P systems (complexity classes, uniform versus semi-uniform solutions, frontiers of efficiency etc.) can be found in many places – we mention here only [15] and the corresponding chapter from [14]. Several results in this area say that P systems able to produce an exponential workspace in a linear time (e.g., by membrane division, membrane creation, string replication) can solve computationally hard problems (typically, NP-problems) in polynomial time; the term fypercomputation was proposed in [12] for this situation, a sort of analogy to an established term hypercomputation, see, e.g., [2]. It is known that symport/antiport P systems (with a small number of membranes and with rules of a low complexity) used in the generative or the accepting mode characterize NRE (see, e.g., [14]). Note that in the previous definitions multisets play a crucial role: objects appear with a finite multiplicity and the objects which do not evolve by a rule remain unchanged. However, the objects from the set Eare used according to the threshold assumption (but they do not obey the non-permanency assumption). The threshold assumption can be applied to some or to all membranes of a symport/antiport P system. In such distinguished membranes (where the threshold assumption applies), any object – even if it comes from a neighboring membrane with a specified multiplicity, maybe in only one copy – is present in arbitrarily many copies. A P system with such membranes is said to be an ωPsystem. Another class of P systems investigated in this paper is that of spiking neural P systems, in short, SN P systems. Such a system (with extended rules, without delay, of degree m≥1) is a construct of the form Π= (O, σ1, . . . , σm, syn, out), where: 1. O={a}is the singleton alphabet (ais called spike); 2. σ1, . . . , σmare neurons of the form σi= (ni, Ri),1≤i≤m, where: a) ni≥0 is the initial number of spikes contained by the neuron; b) Riis a finite set of rules each of which is in one of the following two forms: (1) E/ac→ap, where Eis a regular expression over {a}and 1 ≤p≤c; (2) as→λ, for some s≥1, with the restriction that as∈L(E) for no rule E/ac→aof type (1) from Ri; 3. syn ⊆ {1,2, . . . , m}×{1,2, . . . , m}with (i, i)/∈syn for 1 ≤i≤m(synapses between neurons); Bridging Membrane and Reaction Systems – Further Results 247 4. out ∈ {1,2, . . . , m}indicates the output neuron. The rules of type (1) are firing (we also say spiking)rules, and they are applied as follows. If the neuron σicontains kspikes, ak∈L(E) and k≥c, then the rule E/ac→apcan be applied, and this means that cspikes are consumed, only k−c remain in the neuron, and pspikes are produced and submitted to all neurons σj such that (i, j)∈syn (each σjreceives pspikes). The rules of type (2) are forgetting rules: if the neuron contains exactly sspikes, then the rule as→λcan be used, and this means that all sspikes are removed. The rules are used in the sequential manner within each neuron, and in parallel for all neurons of the system. Using the rules as described above (see more detailed/precise definitions in the literature), we can define transitions among configurations. With a computation we can associate a result in several ways. The basic one associates a number to each computation (halting or not), viz., as the number of steps elapsed between the first and the second time when the output neuron spikes. The set of such numbers “generated” by Πis denoted by N2(Π). Another possibility is to count all spikes sent to the environment by the output neuron during halting computations. The set of numbers computed by Πin this way is denoted by Nout(Π). For both modes two types of results were obtained: Turing computability in the case of neurons without any bound on the number of spikes present inside, and a characterization of semilinear sets of numbers in the case of systems whose neurons have a bound on the number of spikes (we also call such systems bounded). Note that also for SN P systems the multisets (counting the spikes in each neuron) and the permanency (spikes unused remain in the neurons) are essential. 3 The Effect of Non-Permanency The non-permanency feature was considered in [13] for two classes of P systems: cooperative transition P systems and symport/antiport P systems, and in both cases the universality was proved. Hence there is no loss of power with respect to the traditional membrane computing case, where the objects which do not evolve survive. The case of catalytic P systems was stated as an open problem – recall that under the permanence assumption catalytic P systems are universal, even with two catalysts only, [7]. The effect of non-permanency was not investigated neither for non-cooperative transition P systems nor for the spiking neural P systems. Let us denote by NoutSNPm(np) the family of sets of numbers Nout(Π), for SN P systems Πwith at most mneurons having the non-permanency property. When the generated numbers are taken as the number of steps between the first two steps when spikes are emitted by the output neuron, then we replace the subscript out by 2. The subscript mis replaced by ∗if no bound on the number of neurons is assumed. Lemma 1. NαSNP∗(np)⊆SLIN1,for α∈ {2, out}. 248 Gh. P˘aun, M.J. P´erez-Jim´enez, G. Rozenberg Proof. If an SN P system Π(with mneurons) works in the non-permanency mode, then after each computation step each neuron has a number of spikes which is bounded by a constant depending on Π: each neuron emits a number of spikes, bounded by the maximum number of spikes produced by any rule of the system – denote this number by M. The spikes produced by a neuron σican be replicated and submitted to at most m−1 other neurons (to which there is a synapse from σi), hence in total we have at most m(m−1)Mspikes. We start with a given initial number of spikes and at any moment we have in the system a bounded number of spikes, distributed to mneurons, which means a finite number of possible configurations of the system. These configurations can be taken as states of a finite automaton (or the nonterminals of a regular grammar) which simulates the work of the system. Taking as a result of a computation (of the automaton or of the grammar) either all spikes sent to the environment by the output neuron of Πor the number of steps between the first two spikes sent to the environment (e.g., we record in the configuration-nonterminal the fact that a spike was emitted, then we “count” until a second spike is emitted, and in that moment we stop the computation of the grammar), we obtain the inclusions of the lemma. The above reasoning actually shows that an SN P system with non-permanency cannot use rules of the form E/ac→apwhere for the regular expression Eits language L(E) is infinite. Thus, we can assume that each neuron contains only bounded rules, which then implies the semilinearity of the generated set of numbers (see already [8]). Also the converse of the previous lemma holds. It was proved in [8] for bounded SN P systems, but the proof in [8] is rather complex (it starts from the characterization of semilinear sets of numbers as the union of a finite set with a finite number of arithmetical progressions), and it does not provide a bound on the number of neurons. Here we provide a direct proof (also bounding the number of neurons), starting from the characterization of semilinear sets of numbers as the length sets of regular languages. Of course, it is sufficient to consider regular languages over the one-letter alphabet. Lemma 2. SLIN1⊆NoutSNP5(np). Proof. Let us consider a regular grammar G= (N, {a}, S, P ) and assume that N={A1=S, A2, A3, . . . , An}. We construct the following SN P system (its initial configuration is given in a graphical form in Figure 1): Π= ({a}, σ1, . . . , σ5, syn, 5),where σ1= (n+ 1,{an+i→an|1≤i≤n}), σ2= (0,{an+i→an|1≤i≤n}), σ3= (n+ 1,{an+i→aj|1≤i, j ≤n, Ai→aAj∈P} ∪ {an+i→an+i|1≤i≤n, Ai→a∈P}), σ4= (0,{an+i→aj|1≤i, j ≤n, Ai→aAj∈P} Bridging Membrane and Reaction Systems – Further Results 249 ∪ {an+i→an+i|1≤i≤n, Ai→a∈P}), σ5= (0,{ai→a|1≤i≤2n}), syn ={(1,2),(2,1),(1,4),(4,1),(2,3),(3,2),(3,4),(4,3),(3,5),(4,5)}. With each nonterminal Ai,1≤i≤n, we associate n+ispikes, in neurons σ3and σ4, where the rules in Pare simulated. Initially, only neurons σ1and σ3 spike, sending spikes to “partner neurons” σ2and σ4; when these later neurons spike, they send spikes to the former neurons. The computation consists of such alternating steps. Neurons σ3and σ4also send spikes to the output neuron, σ5, which sends a spike to the environment in each step. When a terminal rule Ai→a in Pis simulated, neurons σ3and σ4produce n+ispikes. The output neuron spikes once again, but all other neurons stop working: there is no rule which processes 2n+ispikes (these spikes are removed because of the non-permanency axiom, but this is not important since the computation halts anyway). Consequently, the system Πproduces kspikes if and only if ak∈L(G), hence SLIN1⊆NoutSNP5(np). Lemma 3. SLIN1⊆N2SNP5(np). Proof. We consider the SN P system from the proof of Lemma 2, but now we replace the output neuron σ5by the following neuron: σ5= (a2n+1,{a2n+1 →a}∪{an+i→a|1≤i≤n}). The output neuron spikes in the first step and then it spikes only one step after the moment when a rule Ai→awas simulated in one of the neurons σ3or σ4. In the steps for which ai,1≤i≤n, spikes are sent to neuron σ5; these spikes are removed – this is implied by the non-permanency axiom, because there is no rule to process them. Consequently, the modified system spikes twice, at a distance of ksteps if and only if ak∈L(G), hence SLIN1⊆N2SNP5(np). Combining the previous three lemmas we obtain: Theorem 1. SLIN1=NαSNPβ(np), for all α∈ {2, out}and β∈ {5,6, . . .} ∪ {∗}. What about the SN P systems using less than five neurons? It is easy to see that computations in one-neuron systems last only one step, hence they produce only finite sets. SN P systems with two neurons can generate infinite sets – in the out mode. Here is an example of such a system: Π= ({a}, σ1, σ2,{(1,2),(2,1)},2),where σ1= (2,{a2→a2, a2→a}), σ2= (0,{a2→a2}). 250 Gh. P˘aun, M.J. P´erez-Jim´enez, G. Rozenberg ' & $ % ' & $ % ' & $ % ' & $ % ' & $ % -  ? 6 ? 6 -  ZZZ Z~    = - 1 an+1 an+i→an, 1≤i≤n 2 an+i→an, 1≤i≤n 3 an+1 an+i→aj, Ai→aAj∈P an+i→an+i, Ai→a∈P 4 an+i→aj, Ai→aAj∈P an+i→an+i, Ai→a∈P 5 ai→a, 1≤i≤2n Fig. 1. The SN P system in the proof of Lemma 2 The computation can continue until using the rule a2→ain the first neuron – at that moment no rule can be applied in any neuron and all spikes vanishes. We have Nout(Π) = {2n|n≥0}. Interestingly enough, when the result is the distance between the first two spikes, SN P systems with two neurons generate only singletons. If there is only one synapse between the two neurons, then each computation lasts one or two steps, hence only one of the numbers 0 and 1 can be generated. If the two neurons can communicate with each other, this can be done simultaneously or at most in alternate steps (after using a rule, no spikes remains in a neuron, because of the non-permanency assumption, hence new spikes must be obtained from the partner neuron); one of the neurons is the output neuron, hence it must spike twice in the first four steps of the computation and so only numbers 1 and 2 can be computed. One can easily see that the generated set is a singleton, containing one of the numbers 1, 2. However, SN P systems with three neurons can generate infinite sets also as the distance between the first two spikes sent to the environment. This is the case Bridging Membrane and Reaction Systems – Further Results 251 for the system Πin Figure 2, for which we have N2(Π) = {n|n≥1}. The output neuron spikes in the first step of a computation and then only after the step when neuron σ2uses the rule a?2 →a; as long as both σ1and σ2use their rules a2→a2, neuron σ3cannot use its rule, hence the four spikes it receives are lost, due to the non-permanency assumption. ' & $ % ' & $ % ' & $ % ? 6 -  - 1 a2 a2→a2 2 a2 a2→a2 a2→a a3 a3→a 3 Fig. 2. An SN P system with three neurons generating an infinite set. It remains an open problem whether SN P systems with four neurons characterize SLIN1. 4 The Effect of the Threshold Assumption It was proved in [12] that cooperative P systems without permanency, with two membranes where the inner one works under the threshold assumption (any object present here is available in arbitrarily many copies), can solve SAT in a polynomial time (actually, linear with respect to the number of clauses and independent of the number of variables) in a uniform way. This result can be extended to symport/antiport P systems, with one additional feature: the system uses precomputed resources. More specifically, for a SAT(n, m) problem (nvariables and mclauses) we work with a number of objects of the order of nm, i.e., all sets of at most mvariables. These objects are given in advance, available in the initial configuration of the system, but they are “precomputed”, provided at no cost, although there are exponentially many of them (but without containing other information than that provided by nand m). Of course, in this case we do not work in the standard complexity framework, as the systems solving a class of problems cannot be constructed in a polynomial time with respect to the size of the problems (actually, up to now there is no definition of complexity classes for the case of precomputed resources). 252 Gh. P˘aun, M.J. P´erez-Jim´enez, G. Rozenberg The proof follows the same idea as that of the result in [12], implemented for symport/antiport systems. Since in such systems the objects are only moved across membranes and they cannot be changed during the computation, we see no way to avoid using an exponential number of objects given in advance (in [12] these objects are created during the computation by means of cooperative multiset rewriting rules). Theorem 2. SAT can be solved (in a uniform way) in a polynomial time by symport/antiport ωP systems with precomputed resources. Proof. Let us consider the SAT problem for nvariables, x1, x2, . . . , xn, and m clauses. We denote Lit ={xi,¬xi|1≤i≤n}and V al ={ti, fi|1≤i≤n}. Let v(xi) = tiand v(¬xi) = fi, for all 1 ≤i≤n. We have ¬ti=fiand ¬fi=ti, for 1≤i≤n. (Note that ti, fiidentify, by their subscripts, the variables with which they are associated.) An instance γ=C1∧C2∧. . .∧Cmof SAT(n, m), with Ci=yi,1∨yi,2∨. . .∨yi,ki, for yi,j ∈Lit, 1≤j≤ki, is encoded as code(γ) = v(y1,1)(1) . . . v(y1,k1)(1)v(y2,1)(2) . . . v(y2,k2)(2) . . . v(ym,1)(m). . . v(ym,km)(m). We now construct the following symport/antiport ωP system (the system works under the non-permanency assumption, the three inner membranes are distinguished, and the objects are present in them with ωmultiplicity): Π= (O, µ, w1, . . . , wm+1, w0, w00, E, R1, R2, . . . , Rm+1, R0, R00, m + 1, env), O={α(j)|α∈V al, 1≤j≤m} ∪ V al ∪ {a, hai,yes}∪{d(i)|1≤i≤m+ 1} ∪ {hawi | w⊆V al, |w| ≤ m}, µ= [ [ . . . [[[[ ]00]0]1]2. . . ]m]m+1, w00=w0={yes} ∪ {hawi | w⊆V al, |w| ≤ m}, w1=w2=. . . =wm=λ, wm+1 =ad(m+1), E={d(i)|1≤i≤m}∪{d, hai} ∪ V al, R00={(yes, out;yes, in}∪{(hawi, out;hawi, in)|w⊆V al, 0≤ |w| ≤ m}, R0={(hawi, out;hawiα, in)|α∈V al, w ⊆V al, 0≤ |w| ≤ m, α ∈w} ∪ {(hawαi, out;hawiα, in)|α∈V al, w ⊆V al, 0≤ |w| ≤ m, α /∈w, ¬α /∈w} ∪ {(yes, out;hawid, in)|w⊆V al, 1≤ |w| ≤ m}, Ri={(α, in)|α∈V al}∪{(d, in),(yes, out),(hai, in)},1≤i≤m, Rm+1 ={(d(1), out;d, in),(yes, out)}∪{(d(i+1), out;d(i), in)|1≤i≤m} ∪ {(α(j+1), out;α(j), in)|α∈V al, 1≤j≤m−1} ∪ {(α(1), out;α, in)|α∈V al}∪{(a, out;hai, in)}. For an easier understanding, we also present this system in a graphical form, in Figure 3. (We follow here the standard way of representing a P system with Bridging Membrane and Reaction Systems – Further Results 253 symport/antiport rules, i.e., indicating inside membranes the objects present in the initial configuration of the system, and on the outside side of each membrane the associated rules.) (yes, out),(a, out;hai, in) (α(1), out;α, in), α ∈V al (α(j+1), out;α(j), in), α ∈V al, 1≤j≤m−1 (d(1), out;d, in) (d(i+1), out;d(i), in),1≤i≤m ' & $ % ' & $ % m+ 1 m (α, in), α∈V al (d, in) (yes, out) (hai, in) . . . ' & $ % a d(m+1) 1 (α, in), α∈V al (d, in) (yes, out) (hai, in) (yes, out;hawid, in), w 6=λ (hawαi, out;hawiα, in), α /∈w, ¬α /∈w (hawi, out;hawiα, in), α ∈w ' & $ % 0 (yes, out;yes, in) (hawi, out;hawi, in), w⊆V al, |w| ≤ m yes hawi, w ⊆V al, |w| ≤ m ' & $ % 00 yes hawi, w⊆V al, |w| ≤ m Fig. 3. The symport/antiport ωP system from the proof of Theorem 2 The computation of Πstarts after introducing the multiset code(γ) into the skin membrane, for a given instance γof the SAT(n, m) problem. The truth-values 254 Gh. P˘aun, M.J. P´erez-Jim´enez, G. Rozenberg which satisfy the first clause bring from the environment the corresponding truthvalues without superscripts. Simultaneously, object ais replaced by hai, and all other truth-values, corresponding to clauses C2, . . . , Cm, decrease by one their superscripts. Also the “checker” object ddecreases, step by step, its superscript – but starting from m+1, hence by one greater than the superscripts of objects associated with Cm. The truth-values without superscripts and object hai“migrate”, step by step, towards membrane 1. First, the truth-values which satisfy C1(at the same time with hai) reach membrane 1, then those which satisfy C2, and so on. In membrane 1, objects of the form hawigrow, starting from the “seed” hai, with wcontaining the truth-values which satisfy one by one the clauses. Specifically, if αsatisfy clause Ciand it arrives in membrane 1, where we have the object hawi(for i= 1 we have w=λ), with wcontaining the truth-values of the variables which satisfy all clauses Cj,1≤j≤i−1, then: (1) if αis in w, then the object hawiis not changed, and αis moved in membrane 0, where it will not survive, (2) if neither αnor ¬αis in w, then this new truth-value αis added to w, by means of the rule (hawαi, out;hawiα, in)∈R0, (3) if none of the previous cases holds (i.e., ¬αappears in w), then no reaction takes place – hence both αand hawiwill disappear because of the non-permanency condition. Note the important fact that the threshold assumption is crucial in this operation: each object, whether of the form αor hawi, appears in membrane 1 (and in membranes 0,00) in the ωway, sufficient for all rules which can be applied (there is no competition for objects), hence all rules are applied simultaneously! One step after the truth-values corresponding to the last clause, Cm, entered membrane 1, also dmoves to membrane 1. It finds here all truth-assignments w which satisfy all clauses. If there is no such truth-assignment, then no reaction takes place in membrane 1 at that time – thus object ddisappears and object yes is not released from membrane 0. If there is at least one non-empty truthassignment w, then the rule (yes, out;hawid, in)∈R0is used and yes is moved out of membrane 0 and from here it starts its way out of the system. The internal membranes 0,00have the role of suppliers of objects: because of the non-permanency assumption, only objects which are moved by a rule survive. If the formula γis satisfiable, then object yes exits the system, otherwise this object remains inside. Let us count now the number of steps necessary to bring out object yes. Objects d(i)decrease their superscript from m+ 1 to 1 (hence m+ 1 steps), then d(1) is replaced by d(one more step). In further msteps, dcrosses all membranes from region m+ 1 to region 1. Taking yes from membrane 0 needs one more step. Crossing all membranes 1,2, . . . , m + 1 requires m+ 1 steps. Thus, provided that γis satisfiable, object yes exits the system in 3m+ 4 steps. Because of the rules associated with membrane 00, the system never halts, but the answer whether or not the formula γis satisfiable is obtained in step 3m+ 4: γis satisfiable if and only if in this step we get yes out of the system. Bridging Membrane and Reaction Systems – Further Results 255 Note that we work with precomputed resources: the total alphabet of the system as well as the contents (objects and rules) of membranes 0,00are exponential (of the order of nm), the computation of these objects and rules is done in advance, at no cost, but there is no information in the system at the beginning of the computation related to γdifferent from nand m. Finally, we notice that the construction is uniform (it starts from the problem itself, SAT(n, m), not from a given instance of the problem), which concludes the proof. 5 Concluding Remarks. Other Cases to Consider In this paper we continued the study of the effect of transferring to membrane computing the two basic axioms of reaction systems: the non-permanency assumption (an object which does not evolve disappears) and the threshold assumption (an object either does not appear, or it is present in arbitrarily many copies). After recalling the results from [12] and [13], we established two new results: in the non-permanency case, SN P systems characterize the semilinear sets of numbers, and symport/antiport systems under the threshold assumption (imposed in only two membranes) can solve SAT in a polynomial time. All these results and the cases which were not yet investigated are displayed in Table 1. coop cat ncoop S/A SN P Non-permanency Univ. ? ? Univ. SLIN1 [13] [13] Theorem 1 Threshold assumption Fyper. ? ? Fyper. ? [12] Theorem 2 Table 1. Cases studied – cases to be studied Of course, there also are other open problems and research topics. Several of them were also mentioned in the previous sections. Certainly, an interesting question is whether the threshold assumption adds power to SN P systems working under the non-permanency assumption. A natural research topic is to avoid using precomputed resources in Theorem 2 and instead to construct the exponentially many components of the initial configuration of the symport/antiport P system by using additional features of the system, e.g., using membrane division. A “dual” research area is a transfer of ideas from membrane computing to reaction systems, but we do not address this issue here – some comments can be found in [13]. 262 L. Valencia–Cabrera et al. Table 1. Parameters Parameter Description General parameters for the system ng Number of genes in the network nb Number of binary interactions nu Number of unary interactions threshold Maximum strength for an interaction cc Clock control Gene configuration parameters gi,1Gene number (id) gi,3Initial state of the gene Binary interactions parameters ti,1Binary interaction number (id) ti,2Interaction type (or: 1, and: 2, xor: 3) ti,31st source gene number (id) ti,41st source gene contribution (positive: 1, negative: 0) ti,52nd source gene number (id) ti,62nd source gene contribution (positive: 1, negative: 0) ti,7Destination gene number (id) ti,8Influence over destination gene (positive: 1, negative: 0) ti,9Strength of the destination Unary interactions parameters unti,1Unary interaction number (id) unti,2Interaction type (strong promotion: 1, inhibition: 2; weak ones: 3, 4) unti,3Source gene number (id) unti,4Source gene contribution (positive, negative) unti,5Destination gene number (id) unti,6Influence over destination gene (positive, negative) 2.3 Model output The state of the network is encoded as the multiplicity of objects a1and a0in each gene environment. The presence of objects a1inside a gene environment represents that its gene is active (a0for inactive). Due to the nature of the system, membrane genes cannot have objects a1and a0simultaneously. Therefore, to know the final state of the network, it suffices to identify which environments contain object a1 and which ones a0at configuration T. Analysing Gene Networks with PDP Systems 263 3 Modelling and simulation on MeCoSim This section explains some relevant issues concerning the software environment, putting the focus on the needed changes in P-Lingua framework and the configuration of MeCoSim. The P–Lingua definition used to analyse the PDP model adheres to P–Lingua version 4 standard, available at [10]. 3.1 Custom interface in MeCoSim In our previous work [16], a P–Lingua model for the family of logic networks based on PDP systems has been extensively described. This model contains a number of parameters representing relevant information about each specific scenario. Thus, although a general model has been presented, a mechanism to ease the task of introducing the specific data for each scenario is needed. This task is performed through the software environment provided by MeCoSim [14, 12]. MeCoSim permits the definition of a custom visual simulator. This simulator includes an interface with the needed inputs, outputs, and a way to translate the input data into parameters for the model. The simulation engine is provided by pLinguaCore, available at [10]. The most relevant facts of this process are listed below. Definition of a custom visual simulator for Logic Networks Here, the process for defining a custom simulator based on MeCoSim is provided. This process is very simple, and consists of the following steps: Configuration file: The first step is to define a spreadsheet file containing the configuration for the definition of visual tabs, input tables, output tables and charts, and the mechanism to generate both model parameters from input tables and outputs from the simulation results. The contents of the simulation parameters tab in the file is shown in figure 1. The configuration file is available by contacting the authors. Fig. 1. MeCoSim configuration file. Simulation params Loading configuration file on MeCoSim: That file is loaded through the main window in MeCoSim by clicking the “Load config file” button, choosing the file, selecting “Update all information” option and pressing “Update config info” button. After these steps, the configuration file is loaded, so the custom simulator is ready to use. Finally, the message “The Application has been successfully initialized” is prompted in MeCoSim main display. 264 L. Valencia–Cabrera et al. Running custom simulator: The newly configured simulator is ready to use by selecting “Gene network” application and pressing “Run Application” button. Then, the custom interface is visualized, enabling the user to load the model (.pli file) and enter the input data for a specific scenario, as shown in figure 2. Fig. 2. MeCoSim window 3.2 Simulation methodology In [16], we describe a methodology to simulate LN DP systems on MeCoSim. This methodology can be summarized in the following steps: •Load the model specification by clicking on Model > Set model. •Fill in the input tables in tab Input. Optionally, it is possible to save this data by clicking on Scenario > Save. This data can be loaded later by clicking on Scenario > Open. •Set the number of steps on Simulation > Number of steps. •Click on Simulation > Simulate!. •Visualize the results in tab Output. A toy example on a 3–gene logic network is provided in [16]. This network is taken from [15]. In this network, interactions have no associated weights. Hence, we presume all interactions to have the same weight (say 100). Although interaction scoring based on Pearson correlation coefficient is a rather widespread metric for measuring gene interaction strength [9], there is little literature on LNs, thus making it hard to find LN toy examples. Analysing Gene Networks with PDP Systems 265 4 A case study on Arabidopsis thaliana In order to experimentally verify our model, we have tested our algorithm by using a logic network which regulates flowering processes associated to Arabidopsis thaliana on a long day scenario. This relatively large network integrates gene interaction samples from NCBI/EBI database [5]. This logic network has been constructed according to the procedure described by Bowers et al. [2]. A. thaliana is a species widely used in genetic and protein interaction networks. The total number of genes in the network is 29, whereas the total number of interactions is 99. These interactions consist of 23 unary interactions and 76 binary interactions. We notice that only a few different types of all possible interactions are present in this network. In the case of unary interactions only strong promotions and strong inhibitions are present. When it comes to binary interactions, only AND– like and OR–like interactions are present. As regards to the distribution of the present interactions, the vast majority of them are AND–like interactions with both inputs in non–negated form (that is, G0 j=Gjand G0 k=Gk), as well as non–negated result (G0 l=Gl). Gene network data is provided as an appendix in section 7. Specifically, gene initial states are reflected in table 5. Unary gene interactions are reflected in figure 6. Similarly, binary gene interactions are reflected in figures 7, and 8. Figure 3 displays the MeCoSim input tables used in this case study. Eventually, we have simulated the corresponding P system for the A. thaliana network entered. The improved LAPP method (as presented in Wang et al. [18]) has been run for 30 steps on this data. Similarly, the LN DP model has been simulated for 30 cycles. As each cycle in an LN DP system consists of 15 computation steps, the total number of steps simulated in the model is 30 ×15 = 450. The results (see figure 4) match the ones obtained from the execution of the improved LAPP method on the same input data. Therefore, it is verified that, on this gene network and scenario, the P system model behaviour is analogous to that from the improved LAPP method. 266 L. Valencia–Cabrera et al. General parameters (that is, number of unary and binary interactions) Initial state of each gene (active or inactive) Unary interactions Binary interactions Fig. 3. Arabidopsis - MeCoSim Interface - Input Data Fig. 4. Final gene states used for the simulation on MeCoSim interface Analysing Gene Networks with PDP Systems 267 5 Conclusions In this work, we have presented a case study on LN DP systems for a gene network which regulates the flowering process of Arabidopsis thaliana. We suplement this case study with a guide for generating a custom MeCoSim simulator for LN DP systems. In the case study, we validate the model against the improved LAPP method [18]. We conclude that our Membrane Computing model matches the output data obtained by the latter algorithm. As a future work, it would be interesting to apply this model to gene networks with different biological functions, so as to test if the model matches the improved LAPP algorithm for a sufficiently representative number and variety of cases. This task can be complemented with a comparative study of the improved LAPP algorithm and different biochemical simulation methods (such as the Gillespie algorithm [6]) by means of Membrane Computing models. 6 Acknowledgements Luis Valencia–Cabrera, Manuel Garc´ıa-Quismondo and Mario J. P´erez-Jim´enez are supported by project TIN2012-37434 from “Ministerio de Ciencia e Innovaci´on” of Spain, and “Proyecto de Excelencia con Investigador de Reconocida Val´ıa P08- TIC-04200” from Junta de Andaluc´ıa, both co-financed by FEDER funds. Manuel Garc´ıa-Quismondo is also supported by the National FPU Grant Programme from the Spanish Ministry of Education. References 1. Mitsutomo Abe, Yasushi Kobayashi, Sumiko Yamamoto, Yasufumi Daimon, Ayako Yamaguchi, Yoko Ikeda, Harutaka Ichinoki, Michitaka Notaguchi, Koji Goto, and Takashi Araki. (2005). Fd, a bzip protein mediating signals from the floral pathway integrator ft at the shoot apex. Science, 309(5737):1052–1056. 2. Peter M. Bowers, Shawn J. Cokus, Todd O. Yeates, and David Eisenberg. (2004). Use of logic relationships to decipher protein network organization. Science, 5705(306):2246–2249. 3. Peter M. Bowers, Brian D. O’Connor, Shawn J. Cokus, Eniat Sprinzak, Todd O. Yeates, and David Eisenberg. (2005). Utilizing logical relationships in genomic data to decipher cellular processes. the FEBS journal, 272(1):5110–5118. 4. Miguel A. Mart´ınez del Amor, Ignacio P´erez-Hurtado, Manuel Garc´ıa-Quismondo, Luis F. Mac´ıas-Ramos, Luis Valencia-Cabrera, ´ Alvaro Romero-Jim´enez, Carmen Graciani-D´ıaz, Agust´ın Riscos-N´u˜nez, M. Angels Colomer, and Mario J. P´erez- Jim´enez. (2013). Dcba: Simulating population dynamics p systems with proportional objects distribution. Lecture Notes in Computer Science, pages 257–276. 5. National Center for Biotechnology Information, (March 2013). http://www.ncbi.nlm.nih.gov/. 268 L. Valencia–Cabrera et al. 6. Daniel T. Gillespie. (1977). Exact stochastic simulation of coupled chemical reactions. The Journal of Physical Chemistry, 81(25):2340–2361. 7. Takato Imaizumi, Thomas F. Schultz, Frank G. Harmon, Lindsey A. Ho, and Steve A. Kay. (2005). Fkf1 f-box protein mediates cyclic degradation of a repressor of constans in arabidopsis. Science, 309(5732):293–297. 8. Takato Imaizumi, Hien G. Tran, Trevor E. Swartz, Winslow R. Briggs, and Steve A. Kay. (2003). Fkf1 is essential for photoperiodic-specific light signaling in arabidopsis. Nature, 426:301–309. 10.1007/s11424-010-0205-0. 9. Bolan Linghu, EricA. Franzosa, and Yu Xia. (2013). Construction of functional linkage gene networks by data integration. In Hiroshi Mamitsuka, Charles DeLisi, and Minoru Kanehisa, editors, Data Mining for Systems Biology, volume 939 of Methods in Molecular Biology, pages 215–232. Humana Press. 10. P Lingua Web Page, (February 2009). http://www.p-lingua.org. 11. Miguel A. Mart´ınez-del Amor, Ignacio P´erez-Hurtado, Adolfo Gastalver-Rubio, Anne C. Elster, and Mario J. P´erez-Jim´enez. (2012). Population dynamics p systems on cuda. In David Gilbert and Monika Heiner, editors, Computational Methods in Systems Biology, Lecture Notes in Computer Science, pages 247–266. Springer Berlin Heidelberg. 12. MeCoSim Web Page, (July 2010). http://www.p-lingua.org/mecosim. 13. Gheorghe Paun, Grzegorz Rozenberg, and Arto Salomaa. (2010). The Oxford Handbook of Membrane Computing. Oxford University Press, Inc., New York, NY, USA. 14. Ignacio P´erez-Hurtado, Luis Valencia-Cabrera, Mario J. P´erez-Jim´enez, M. A. Colomer, and Agust´ın Riscos-N´u˜nez. (2010). MeCoSim: a general purpose software tool for simulating biological phenomena by means of P systems. IEEE Fifth International Conference on Bio-inpired Computing: Theories and Applications (BIC-TA 2010), I:637–643. 15. Thomas Schlitt and Alvis Brazma. (2007). Current approaches to gene regulatory network modelling. BMC Bioinformatics, 8(Suppl 6):S9. 16. Luis Valencia-Cabrera, Manuel Garc´ıa-Quismondo, Yansen Su, Mario J. Perez- Jimenez, Hui Yu, and Linqiang Pan. (2013). Modeling logic gene networks by means of probabilistic dynamic p systems, (accepted publication). International Journal of Unconventional Computing. 17. Shudong Wang, Yan Chen, Qingyun Wang, Eryan Li, Yansen Su, and Dazhi Meng. (2006). Analysis for stimuli to shoot genes of arabidopsis thaliana based on logical relationships. Optimization and Systems Biology, 11(-):435–447. 18. Shudong Wang, Yan Chen, Qingyun Wang, Eryan Li, Yansen Su, and Dazhi Meng. (2010). Analysis for gene networks based on logic relationships. Journal of Systems Science and Complexity, 23:999–1011. 10.1007/s11424-010-0205-0. 19. Su-Zhil Zhang and Zuo Jian-Rhu. (2006). Advance in the flowering time control of arabidopsis. Progress in Biochemistry and Biophysics, 33:301–309. 20. Xin Zhang, Seungchan Kim, Tie Wang, and C. Baral. (October 2006). Joint learning of logic relationships for studying protein function using phylogenetic profiles and the rosetta stone method. Trans. Sig. Proc., 54(6):2427–2435. Analysing Gene Networks with PDP Systems 269 7 Appendix A: Gene Network Data Gene number Initial state 1 0 2 0 3 1 4 0 5 0 6 1 7 0 8 1 9 1 10 1 11 0 12 0 13 0 14 1 15 1 Gene number Initial state 16 0 17 1 18 1 19 1 20 0 21 0 22 1 23 1 24 0 25 1 26 0 27 1 28 1 29 1 Fig. 5. Initial gene states in the Arabidosis thaliana gene network on the longday scenario taken as case study ID Logic Weight 1g1→g70.402 2g2→ ¬g60.409 3g2→g70.878 4g6→g16 0.353 5g6→g21 0.353 6g7→g11 0.965 7g7→g16 0.802 8g7→g21 0.802 9g10 → ¬g13 0.1000 10 g10 →g18 0.456 11 g10 →g27 0.544 12 g10 →g28 0.309 ID Logic Weight 13 g11 → ¬g26 0.273 14 g12 →g16 0.282 15 g12 →g21 0.282 16 g16 → ¬g29 0.713 17 g17 →g24 0.425 18 g17 →g26 0.389 19 g19 →g29 0.551 20 g20 → ¬g22 0.303 21 g21 → ¬g29 0.713 22 g22 →g26 0.439 23 g28 →g29 0.292 Fig. 6. Unary gene interactions present in the logic network associated to the behaviour of Arabidosis thaliana taken as case study 270 L. Valencia–Cabrera et al. ID Logic Weight 1g11 ∧g27 →g70.708 2g11 ∧g28 →g71 3g11 ∧g29 →g70.814 4g16 ∧g27 →g70.708 5g16 ∧g28 →g71 6g16 ∧g29 →g70.814 7g21 ∧g27 →g70.708 8g21 ∧g28 →g71 9g21 ∧g29 →g70.814 10 g1∨ ¬g13 →g10 1 11 g6∧g13 → ¬g10 1 12 g7∨ ¬g13 →g10 1 13 g9∧g13 → ¬g10 0.829 14 g11 ∨ ¬g13 →g10 1 15 g12 ∨ ¬g13 →g10 0.829 16 ¬g13 ∨g16 →g10 1 17 ¬g13 ∨g18 →g10 0.728 18 g13 ∧g19 → ¬g10 0.829 19 ¬g13 ∨g21 →g10 1 20 ¬g13 ∨g27 →g10 1 21 g27 ∨ ¬g28 →g10 0.728 22 g10 ∧g16 →g11 0.741 23 g10 ∧g21 →g11 0.741 24 g14 ∧g16 →g11 0.741 25 g14 ∧g21 →g11 0.741 26 g15 ∧g16 →g11 0.741 27 g15 ∧g21 →g11 0.741 28 g16 ∧g17 →g11 0.741 29 g16 ∧ ¬g20 →g11 0.741 30 g16 ∧g21 →g11 0.741 ID Logic Weight 31 g16 ∧g22 →g11 0.741 32 g16 ∧g23 →g11 0.741 33 g16 ∧ ¬g24 →g11 0.741 34 g16 ∧g25 →g11 0.741 35 g16 ∧ ¬g26 →g11 0.741 36 g16 ∨g29 →g11 0.741 37 g17 ∧g21 →g11 0.741 38 ¬g20 ∧g21 →g11 0.741 39 g21 ∧g22 →g11 0.741 40 g21 ∧g23 →g11 0.741 41 g21 ∧ ¬g24 →g11 0.741 42 g21 ∧g25 →g11 0.741 43 g21 ∧ ¬g26 →g11 0.741 44 g21 ∨ ¬g29 →g11 0.741 45 g8∧g21 →g16 0.801 46 g10 ∧g21 →g16 1 47 g11 ∨g21 →g16 1 48 g11 ∨ ¬g29 →g16 1 49 g14 ∧ ¬g19 →g16 0.801 50 g14 ∧g21 →g16 1 51 g15 ∧g21 →g16 1 52 g17 ∧g21 →g16 1 53 ¬g19 ∧g21 →g16 0.801 54 ¬g20 ∧g21 →g16 1 55 g21 ∧g22 →g16 1 56 g21 ∧g23 →g16 1 57 g21 ∧ ¬g24 →g16 1 58 g21 ∧g25 →g16 1 59 g21 ∧ ¬g26 →g16 1 60 g21 ∨ ¬g29 →g16 1 Fig. 7. Binary gene interactions present in the logic network associated to the behaviour of Arabidosis thaliana taken as case study (1/2) Analysing Gene Networks with PDP Systems 271 ID Logic Weight 61 g8∧g16 →g21 0.801 62 g10 ∧g16 →g21 1 63 g11 ∨g16 →g21 1 64 g11 ∨ ¬g29 →g21 1 65 g14 ∧g16 →g21 1 66 g14 ∧ ¬g19 →g21 0.801 67 g15 ∧g16 →g21 1 68 g16 ∧g17 →g21 1 69 g16 ∧ ¬g19 →g21 0.801 70 g16 ∧ ¬g20 →g21 1 71 g16 ∧g22 →g21 1 72 g16 ∧g23 →g21 1 73 g16 ∧ ¬g24 →g21 1 74 g16 ∧g25 →g21 1 75 g16 ∧ ¬g26 →g21 1 76 g16 ∨ ¬g29 →g21 1 Fig. 8. Binary gene interactions present in the logic network associated to the behaviour of Arabidosis thaliana taken as case study (2/2) Gene number Initial state 1 0 2 0 3 1 4 0 5 0 6 1 7 0 8 1 9 1 10 1 11 0 12 0 13 0 14 1 15 1 Gene number Initial state 16 0 17 1 18 1 19 1 20 0 21 0 22 1 23 1 24 0 25 1 26 1 27 1 28 1 29 1 Fig. 9. Final gene states in the Arabidosis thaliana gene network on the longday scenario taken as case study