Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany
6610
Jozef Kelemen Alica Kelemenová (Eds.)
Computation, Cooperation, and Life Essays Dedicated to Gheorghe P˘aun on the Occasion of His 60th Birthday
13
Volume Editors Jozef Kelemen Alica Kelemenová Silesian University Institute of Computer Science 74601 Opava, Czech Republic E-mail: {kelemen, kelemenova}@fpf.slu.cz
The photo on the cover is an artwork by Zden˘ek Stuchlík from 1993 and is entitled "Life in the Net"
ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-642-19999-8 e-ISBN 978-3-642-20000-7 DOI 10.1007/978-3-642-20000-7 Springer Heidelberg Dordrecht London New York Library of Congress Control Number: 2011923075 CR Subject Classification (1998): F.1, F.4, G.2, J.3 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues
© Springer-Verlag Berlin Heidelberg 2011 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)
Gheorghe P˘aun (Drawing by R´obert Kelemen)
Gheorghe P˘ aun:
Portrait (de math´ematicien) Les jeans us´es et, riche en dioptries, Sourire aux l`evres et, parlant tout seul, Je cherche `a la raison un fil parmi des signes Et, du silence au bal des constellations. Et, le regard fix´e dans l’entonnoir Je mets de l’ordre au monde miroir. Esclave du caf´e, je suis comme son esprit, Dans ses vapeurs j’en devine mon sentier, Je cherche des filandres sur terre, en lune aussi, Je baisse a` l’´eblouissement d’un epsilon le trait. De fum´ee et de rˆeves, des cit´es j’en bˆatis En me perdant sur des loxodrˆ omes interdits.
(Translated from Roumanian into French by Paula Romanescu)
Preface
This book is dedicated to Gheorghe P˘aun on the occasion of his 60th birthday (December 6, 2010). Contributions range from foundations of traditional computation theory and formal language theory to research on computation and computers looking for their inspirations in living nature. It is the spectrum of disciplines to the development of which Gheorghe P˘ aun has significantly contributed. Moreover, some of them he has initiated and pioneered with remarkable imagination and enthusiasm. As is evident from the contributions and the corresponding references to them, the central theme of all the articles is computation. To understand better what computation is, to find better models of computation, and to look for new computing devices inspired by the structure and/or functioning of robust and reliable enough natural or societal systems are attractive goals of research. Many of Gheorghe’s clever students and inventive collaborators follow them and present their new results in the articles dedicated to him in this volume. The roots of the majority of the contributions have led to the more or less intensive but in all cases friendly cooperation with Gheorghe and his colleagues in numerous places all over the world. In the Introduction of this volume, his teacher and life-long guru Solomon Marcus provides an account of Gheorghe’s activities in the field of cooperation. We allow ourselves to add only one small comment to this: It is definitely not complete! The number of specialists who cooperated or are cooperating with Gheorghe are too numerous to count (at least in the practical, pragmatic meaning of the word). We have already mentioned the focus of Gheorghe P˘ aun’s research on systems inspired by structures and processes which are found in living systems. The field of membrane systems is a convincing proof of this. However, let us point the reader’s attention also to another truth, to the truth of the Latin exempla trahunt. We are sure that Gheorghe’s unique way of life provides a kind of positive model for many of his students, younger colleagues, and followers all over the world. Let us hope that this volume will also contribute a little to this model. Two things are necessary for a good volume: good authors and a good publisher. You can find both in this volume. As a result we have the pleasure of expressing our gratitude to all contributors, to all reviewers for their cooperaˇarka Vavreˇckov´ tion, to our colleagues Lucie Ciencialov´ a and S´ a for their technical assistance, and to the publisher for all their work in order to have this book in the present form. Thank you to all! And, last but not least: Long live, Gheorghe!
December 2010
The Editors
Table of Contents
Introduction: Impact of GP’s Scientific Work . . . . . . . . . . . . . . . . . . . . . . . . Solomon Marcus
I
1
General Computing
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hans-Joachim B¨ ockenhauer, Juraj Hromkoviˇc, and Andreas Sprock
7
A Recurrent Enumeration of Free Hypermultisets . . . . . . . . . . . . . . . . . . . . Vincenzo Manca
16
Context Insertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Paolo Bottoni, Radu Gramatovici, Anna Labella, Florin Manea, and Victor Mitrana
24
A General Framework for Regulated Rewriting Based on the Applicability of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rudolf Freund, Marian Kogler, and Marion Oswald
II
35
Grammar Systems
CD Grammar Systems: Competence and Confidence . . . . . . . . . . . . . . . . . . Erzs´ebet Csuhaj-Varj´ u Cooperating Distributed Grammar Systems: Components with Nonincreasing Competence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Maurice H. ter Beek, Erzs´ebet Csuhaj-Varj´ u, Markus Holzer, and Gy¨ orgy Vaszil On the Expressive Power of Valences in Cooperating Distributed Grammar Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Henning Fernau and Ralf Stiebe Generative Power of Eco-Colonies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ˇarka Vavreˇckov´ Alica Kelemenov´ a and S´ a
57
70
90
107
XII
III
Table of Contents
Membrane Systems
Selected Topics in Computational Complexity of Membrane Systems . . . Petr Sos´ık
125
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bogdan Aman and Gabriel Ciobanu
138
Computing the Maximum Bisimulation with Spiking Neural P Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rodica Ceterchi and Alexandru I. Tomescu
151
P Colonies and their Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ludˇek Cienciala and Lucie Ciencialov´ a
158
On the Parallelizability of Languages Accepted by P Automata . . . . . . . . Gy¨ orgy Vaszil
170
IV
Inspirations from Natural Computing
On Some Biologically Motivated Control Devices for Parallel Rewriting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Arto Salomaa
181
Reaction Systems with Duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Robert Brijder, Andrzej Ehrenfeucht, and Grzegorz Rozenberg
191
Nanomachine Computing by Quorum Sensing . . . . . . . . . . . . . . . . . . . . . . . Jiˇr´ı Wiedermann
203
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
217
Introduction: Impact of GP’s Scientific Work Solomon Marcus Romanian Academy Bucharest, Romania
[email protected]
Ten years ago, I described the work and the life of Gheorghe P˘aun (GP) in the article “The Games of his Life” (p. 1–10 in Where Mathematics, Computer Science, Linguistics and Biology Meet (eds. Carlos Martin Vide, Victor Mitrana), Dordrecht/Boston/London: Kluwer, 2001). At the beginning of the 21st century, his scientific achievements were already impressive in all respects: emergent topics, strong interaction with the international community of computer scientists, publications in prestigious journals and at famous publishing houses, significant impact in his field of research, many disciples, invited lectures, presence in some editorial boards of computer science journals and in many program committees of international scientific meetings etc. It was enough for a successful life. Unfortunately, many scientists, if they don’t stop, they begin to decline when they enter the fifties. How far is this situation from that of GP! Now we can say that his today scientific stature places him among the best computer scientists in the world. In February 2009, ISI included him in the category highly cited scientists, taking into account that at that moment GP was among the 0.5 % most cited authors in computer science (see: http://isihighlycited.com). If we agree that the best objective indicator of the value of a scientist is his scientific impact, then we should pay attention, when referring to GP, to the fact that more than 1400 authors cited his works and among them there are names such as Y. Matyiasevich, A. Salomaa, G. Rozenberg and A. Ehrenfeucht. Practically, most authors active in GP’s favored fields of research paid at least once attention to his works and cited him. ISI indicators, when applied at a collective level (countries, universities, institutes etc.), remain predominantly at a quantitative aspect. However, when they refer to individual authors, it is obligatory to take into account some qualitative aspects too, if we want to make them relevant for the value of the considered author. Just for this reason, we underline that most authors citing GP are known in the community of computer scientists and many of them cited GP in notorious journals, in many cases ISI journals. There is a rich typology of citations. GP was cited in about 6 000 works, but this information reveals its right meaning only if we learn something more. How essential are these citations? To what extent are they substantial, or only marginal? What is the value of the authors of these citations? What is the value of the journals and books where they were published? What is the distance in time between the date of the citation of a paper and the date of its publication? The answers to these natural questions make citations more meaningful. Let us check GP’s situation in this respect. According to a rough estimation, about 4 000 citations of GP have his works as a starting point and this fact is often visible in J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 1–4, 2011. c Springer-Verlag Berlin Heidelberg 2011
2
S. Marcus
the titles, in the introductions or/and in the abstracts of the respective articles. In order to better understand the roots of this situation, it is necessary to remember GP’s basic inventions and initiatives. GP (co)pioneered several new fields in Computer Science. Chronologically, we should begin with the theory of grammar systems, a branch of formal language theory developed in Romania, Hungary, Germany, Slovakia, Finland, Holland, Austria, USA, Poland, Czech Republic, Spain, Japan, Canada, Italy, France. He shares with Arto Salomaa the invention of a special kind of self-generating infinite sequences. He has introduced a new kind of formal grammars: valence grammars. An important step in GP’s evolution was his increasing interest in bridging formal language and biology. Links with nervous systems early appeared in automata theory, while simulation of cell development was already in the seventies in the attention of Lindenmayer systems. But in the next decades GP was attracted by problems related to heredity. In this respect, he obtained basic results about the universality of the computing power of the operation of splicing, specific for the recombination of DNA, and the other operations involved in molecular computing (sticking, insertion-deletion). Fifteen universality models for DNA computing, among them: Watson-Crick automata, sticker systems, insertion-deletion models, stimulated researchers in Romania, Hungary, Czech Republic, Germany, Holland, Italy, Japan, New Zealand, Spain, France, Greece, Republic of Moldova. Another successful field for GP: his various extensions of Marcus contextual grammars, leading to some adequate models for natural languages, via the so-called mildly context sensitive grammars. But the most important field initiated by GP is what is called today membrane computing or P systems (P from P˘aun). GP conceived them as a way to test the capacity of the biological cell to behave as a computer, i.e., to fulfill computational tasks. In order to get an idea of the huge impact of P systems, we invite the reader to visit on google advanced scholar the syntagm “molecular computing”; thousand entries are explicit from the first inspection and one can see that the first ones, devoted to GP’s works where membrane computing is introduced, have already more than thousand citations. Other syntagms deserving to be visited, in order to get an idea of the GP’s impact, are “grammar systems”, “DNA computing” and “Marcus contextual grammars”. All these syntagms, characteristic for GP’s creativity, are the source of thousands of works where GP’s concepts, models and results are the starting point. GP published in tens of journals and a partial list of them will show to the reader familiar with the computer science literature (and partially with the mathematical journals) that he was always ready to send his papers to the most exigent publications and to face possible criticism: Information and Control, Acta Informatica, Acta Cybernetica, Acta Mathematica Japonica, Discrete Mathematics, Discrete Applied Mathematics, Theoretical Computer Science, Fundamenta Informaticae, Computing, Information Processing Letters, Journal of Computer and Systej Sciences, RAIRO-Informatique Th´eorique, International Journal of Computer Mathematics, Computers and Artificial Intelligence, Journal of Information Processing and Cybernetics (EIK), International Journal of Foundations of Computer Science, Journal of Universal Computer Science, Kybernetika, Acta Applicandae Mathematicae, Bulletin of the EATCS, Information Sciences,
Introduction: Impact of GP’s Scientific Work
3
Bio-Systems, New Generation Computing, many of the are ISI journals, some of them with a high impact index. But concomitantly with his capacity to prepare and to publish (sometimes in collaboration) papers, GP paid attention to monographs giving a general, systematic picture of the fields under the focus of his interest and mainly of the fields (co)pioneered by him. Here is a selection of them, in chronological order and with the indication of the number of their citations. He began (partner: J. Dassow) with Regulated Rewriting in Formal Language Theory (Berlin and Hidelberg: Springer, 1989): more than 600 citations. This monograph is characteristic for the topics of formal language under the focus of his attention in the first 15 years of his research activity; Gramar Systems. A grammatical approach to distribution and cooperation (partners: E. Csuhaj–Varj´u, J. Dassow, J Kelemen). London: Gordon and Breach, 1994: more than 300 citations; Marcus Contextual Grammars (Boston–Dordrecht–London: Kluwer, 1997): more than 150 citations; having G Rozenberg and A. Salomaa as partners, GP published DNA Computing: New Computing Paradigms (Heidelberg: Springer, 1998): more than 500 citations. This monograph was translated in Japanese (Tokyo: Springer, 1999), in Russian (Moscow: Mir, 2004) and in simplified Chinese (Beijing: Tsinghua Univ. Press, 2004). The impact of these translations is unknown for us; with C. Calude as partner, GP published Computing with Cells and Atoms: An Introduction to Quantum, DNA and Membrane Computing (London: Francis and Taylor, 2000): almost 100 citations. Our selection will end with Membrane Computing: An Introduction (Berlin: Springer, 2002): more than 1000 citations. A translation in Chinese is under prepararation. A clear sign of recognition of GP’s impact in the field of Computer Science is the large number (23) of journals inviting GP to be a member of their Editorial Board (or similar organisms). Here is a selection: Journal of Universal Computer Science (Springer, ISI); Journal of Computing and Informatics, former Computers and Artificial Intelligence (Bratislava); Acta Cybernetica (Szeged); Journal of Automata, Languages and Combinatorics (Magdeburg); Grammars (1998–2003, Kluwer); Fundamenta Informaticae (Warsaw, ISI); Romanian Journal of Information Science and Technology (Bucharest); International Journal of Foundations of Computer Science (World Scientific, ISI); International Journal of Computer Mathematics (Gordon and Breach, ISI); Natural Computing: An International Journal (Springer, ISI); Soft Computing (area editor, Springer, ISI); Theoretical Computer Science: Natural Computing Series (Elsevier, ISI); International Journal of Unconventional Computing: New Generation Computing (Springer and Omsha-Japan, ISI); Progress in Natural Science (Elsevier and Science in China Press, ISI). About twenty times, various international journals organized special issues devoted to “membrane computing”. Three times, GP received from ISI messages concluding that Your work is highly influential and is making a significant impact among your colleagues in your field of study. Congratulations on your extraordinary career accomplishment!. In March 2007, on ISI’s web page, at “Essential Science Indicators”, in the section “Highly cited papers” (last 10 years) 4 works of GP are mentioned, totalizing more than 350 citations. On this base, in “Scientist rankings in computer science” GP appears on position 83 (among 2101 computer scientists considered by ISI), the highest
4
S. Marcus
position occupied by a Romanian computer scientist (including here those, very many, living in countries other than Romania). As a consequence of his impact, GP was frequently invited in Program Committees of various international meetings, he gave a lot of invited (plenary) lectures at such meetings, while his PhD students in so many countries show clearly that his impact is strong in all respects. Today, many of his former disciples have in their turn some disciples. GP is proud now with his family organized in three generations, because he has two sons and three grandsons. But let us observe that, as a scientist, GP has much more than two sons and much more than three grandsons, his disciples and disciples of his disciples are spread over continents. The author of these lines is in his turn proud to have had the chance to be GP’s teacher when he was a university student, then to guide his diploma work, then to have him as a PhD student, to guide his PhD thesis and to remain in interaction with him until today. It comes the moment when former teachers learn from their former students. Thank you, Gheorghe P˘aun!
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization Hans-Joachim B¨ockenhauer, Juraj Hromkoviˇc, and Andreas Sprock Department of Computer Science, ETH Zurich, 8092 Zurich, Switzerland {hjb,jhromkov,andreas.sprock}@inf.ethz.ch
Abstract. The concept of reoptimization models the following question: Given an instance of an optimization problem together with an optimal solution, does this knowledge help for finding a high-quality solution for a locally modified instance? We briefly survey the known results about reoptimization and consider a generalization of the model where not only one optimal solution is given, but the set of all optimal solutions for an instance is available for free. We use the traveling salesman problem as an example to prove that there exist problems for which this additional knowledge does not help at all for improving the approximability. Keywords: Reoptimization, TSP, inapproximability.
1 Introduction In combinatorial optimization, we are traditionally concerned with finding optimal solutions to practically relevant input instances about which nothing is known in advance. Unfortunately, finding such optimal solutions is computationally hard in many cases, and thus we use different approaches like heuristics or approximation algorithms for computing good (but not necessarily optimal) feasible solutions. But in many cases even computing a solution of satisfactory approximation quality remains a hard task. On the other hand, in many applications, it might help to consider not only isolated input instances, but to take into account some knowledge about similar instances, for example gathered from prior solution attempts to similar instances. As an example, consider the problem of finding an optimal train schedule (for some railway network, for some objective function, and under some constraints). If we succeeded in computing such an optimal schedule, it is natural to expect that we can profit somehow from this schedule when some additional railway station is opened and we have to find a new optimal schedule. The concept of reoptimization formally describes this approach: Given a problem instance together with an optimal (or approximate) solution for it, and a locally modified new problem instance, what can we say about the optimal solution for the new instance? Does the knowledge about the old optimal solution help when computing a solution for the new instance? How much does it help? How much can it improve the running time or the quality of the output? J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 7–15, 2011. c Springer-Verlag Berlin Heidelberg 2011
8
H.-J. B¨ockenhauer, J. Hromkoviˇc, and A. Sprock
In this context, we usually measure the quality of a solution in terms of the approximation ratio, i. e., the quotient of the value of the computed solution and the optimal value. More precisely, for a minimization problem U and an algorithm A for U , the approximation ratio rA (n) for inputs of size n is defined as max{A(I)/Opt (I) | I is an instance of U of size n}. If rA (n) can be bounded from above by a constant, we say that A is a constant-factor approximation algorithm for U . The class APX contains all problems for which a constant-factor approximation algorithm exists. A polynomialtime approximation scheme (PTAS) is an algorithm that, for a given ε > 0, computes a (1 + ε)-approximate solution in time polynomial in the input size (but possibly exponential in 1/ε). APX -hard problems are the hardest problems inside APX . For them, no PTAS exists, unless P = N P. For a more detailed introduction to the theory of approximation algorithms, see, e. g., [1]. In this paper, we first give a brief overview of the known reoptimization results showing that the answers to these questions are very dependent on the optimization problem and the type of local modification. On the one hand, there exist APX -hard optimization problems where the knowledge of an optimal solution can help to improve the achievable approximation ratio on a locally modified instance, sometimes even to design a PTAS for the reoptimization variant of the problem. On the other hand, there exist problems for which the reoptimization variant is exactly as hard as the original problem. As the main result of this paper, we prove an even stronger inapproximability result. It is well known that the traveling salesman problem (TSP), i. e., the problem of finding a shortest Hamiltonian tour in an edge-weighted complete graph, is not approximable with an approximation ratio of 2n in an n-vertex graph with arbitrary edge weights [2], unless P = N P. We now consider a reoptimization situation where we are given a TSP instance together with the set of all optimal solutions. As a local modification, the cost of one edge is increased. We show that, even with this extra knowledge, it remains N P-hard to compute a 2n -approximate solution.
2 Overview of Reoptimization Results We consider the following reoptimization scenario: Given an instance of an optimization problem together with an optimal solution, we are supposed to compute a solution for a locally modified instance. Depending on the problem, one can think of many different local modifications. In graph problems, for instance, a single edge or vertex might be added or removed or the cost of a single edge might be changed. For an optimization problem U and some local modification lm, we denote the resulting reoptimization problem by lm-Reopt-U . The concept of reoptimization was mentioned for the first time in a paper on the postoptimality analysis of a scheduling problem [3]. In postoptimality analysis, one studies the related question of how much a given instance of an optimization problem may be altered without changing the set of optimal solutions, see for example the paper by van Hoesel and Wagelmans [4]. Since then, reoptimization has been applied to various problems like the TSP [5,6,7,8], the Steiner tree problem [9,10,11,12], the shortest common superstring problem [13,14], the knapsack problem [15], and several covering problems [16].
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization
9
The results obtained in these papers show that the hardness of reoptimization problems varies a lot. Obviously, lm-Reopt-U may be an easier problem than U , since we have access to an optimal solution for the original problem instance for free. Nevertheless, in most cases, the reoptimization variant of an N P-hard optimization problem remains N P-hard. This is due to the fact that, for most problems, it is possible to transform any given instance into a trivially solvable one by using a sequence of only polynomially many local modifications, see the paper by B¨ockenhauer et al.[17] for more details. For some optimization problems, the reoptimization problem trivially admits a very good approximation since the old optimal solution itself is a good approximate solution for the new instance. For example, adding a single edge in an instance of a graph coloring problem can increase the cost of an optimal solution by at most one. Let ΔTSP denote the restriction of the TSP to complete edge-weighted graphs where the edge-weights obey the triangle inequality, i. e., to instances G = (V, E, c) with c({u, v}) ≤ c({u, w}) + c({w, v}) for all u, v, w ∈ V . It is well known that the ΔTSP is APX -hard [18], and the best known approximation algorithm for it is due to Christofides [19] and achieves an approximation ratio of 3/2. We consider the local modification of increasing the cost of a single edge in such a way that the triangle inequality is still satisfied. We denote the resulting reoptimization problem by Inc-Edge-Reopt-ΔTSP. This reoptimization problem is N P-hard[7,20], but it admits an approximation algorithm which improves over the one from Christofides. Theorem 1 (B¨ockenhauer et al.[7,20]). There exists a polynomial-time approximation algorithm for the Inc-Edge-Reopt-ΔTSP with an approximation ratio of 7/5. The proof of this theorem is based on the following idea which can be used for several other reoptimization problems as well. The algorithm considers two possible solutions. One of these solutions is the given optimal solution for the old instance, possibly adapted slightly to become feasible for the new instance. The other solution is based on guessing (by exhaustive search) a small part of the new optimal solution which can be proven to have relatively high costs and to use some known approximation algorithm to approximate the rest of the new solution. Usually, it can be shown that the first solution is good if the local modification does not change the cost of the optimal solution too much, and the second solution can be proven to be good in the case that the value of the optimal solution changes a lot after applying the local modification. For some problems, the concept of reoptimization can help even more in lowering the approximation ratio. There exist APX -hard optimization problems for which some corresponding reoptimization problems admit a PTAS. As an example, we consider the Steiner tree problem on graphs with bounded edge weights. In the Steiner tree problem (STP), the input consists of a complete undirected graph with edge weights together with a subset of the vertices, called terminals. The goal is to find a minimum-weight subtree which contains all terminals (and may contain any of the non-terminal vertices). This problem is known to be APX -hard[21], even if all edge costs are drawn from the set {1, 2, . . . , r} for some integer constant r ≥ 2. By Inc-Term-Reopt-r-STP we denote
10
H.-J. B¨ockenhauer, J. Hromkoviˇc, and A. Sprock
the reoptimization variant of the STP on graphs with edge costs from {1, 2, . . . , r}, where a non-terminal vertex of the graph becomes a terminal. The Inc-Term-Reopt-rSTP is N P-hard[17], but it admits a PTAS. Theorem 2 (B¨ockenhauer et al.[17]). Let r be an arbitrary positive integer, r ≥ 2. There exists a polynomial-time approximation scheme for the Inc-Term-Reopt-r-STP. The proof of this theorem is based on the following idea. For a desired approximation ratio of 1 + ε, the algorithm computes the number m = r · 1/ε. If there are few terminals (i. e., less than m), then the optimal Steiner tree can be computed using the Dreyfus-Wagner algorithm[22] whose running time is exponential only in the number of terminals. Otherwise, in the case of many terminals, just adding one edge from the new terminal to the old optimal solution, if necessary, gives a solution which can be proven to be (1 + ε)-approximative. On the other hand, for some problems, reoptimization does not help at all. As an example, consider the TSP with arbitrary edge weights. As already mentioned above, it is well known that the TSP is not approximable within a polynomial approximation ratio[2]. This result generalizes to the Inc-Edge-Reopt-TSP as follows. Theorem 3 (B¨ockenhauer et al.[7,20]). It is N P-hard to approximate the Inc-EdgeReopt-TSP with an approximation ratio which is polynomial in the input size. The proof of this theorem is based on a diamond graph construction similar to the one used by Papadimitriou and Steiglitz for constructing instances of the TSP that are hard for local search[23]. We will not go into detail here since we will use a similar technique in the next section to prove an even stronger inapproximability result.
3 Knowing All Optimal Solutions In this section, we consider a generalization of the reoptimization model. We assume that we are not only given a single optimal solution for the old instance, but the set of all (possibly exponentially many) optimal solutions is available for free. We use the general TSP as an example to show that there exist optimization problems for which even this additional knowledge does not help at all for improving the approximability. We start with a formal definition of this TSP reoptimization variant. Definition 1. We define Inc-Edge-ReoptALL-TSP as the problem given by a complete graph G = (V, E) with two edge weight functions cold and cnew such that (G, cold ) and (G, cnew ) are both admissible inputs for the TSP and such that cold and cnew coincide, except for one edge echange ∈ E where cold (echange ) < cnew (echange ). Moreover, we are given all optimal TSP solutions for (G, cold ). The goal is to compute an optimal TSP solution for (G, cnew ). We measure the size of an instance of Inc-Edge-ReoptALL-TSP by the size of (G, cnew ) only. The size needed for representing all (possibly exponentially many) optimal solutions for (G, cold ) is not taken into account.
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization
11
For proving the inapproximability, we give a reduction from the Hamiltonian cycle problem (HC) to Inc-Edge-ReoptALL-TSP. The HC problem is the problem to decide whether a given undirected unweighted graph G contains a Hamiltonian cycle or not. For this reduction we employ a diamond graph construction similar to the construction of Papadimitriou and Steiglitz[23]. We start with the definition of the diamond graph. Definition 2. The diamond graph D = (V, E) is a graph with 8 vertices and 9 edges with V = {N, S, W, E, u, x, y, z} and E = {{W, x}, {x, N }, {N, u}, {u, z}, {z, S}, {S, y}, {y, E}, {W, z}, {u, E}}, see also Fig. 1. N x
u
W
E
z
y S
Fig. 1. Diamond graph
For our proof, we need the following lemma from Papadimitriou and Steiglitz[23], see also Hromkoviˇc (2003)[1]. Lemma 1 (Papadimitriou and Steiglitz[23]). If the diamond graph D is an induced subgraph of a graph G with a Hamiltonian cycle C, then C traverses D in exactly one of the following two modes: 1. from north N to south S (or vice versa): . . . , N, x, W, z, u, E, y, S, . . . (see Fig. 2(a)), or 2. from west W to east E (or vice versa): . . . , W, x, N, u, z, S, y, E, . . . (see Fig. 2(b)). That is, if a cycle C enters the diamond from the north, it must leave it from the south; and similarly with respect to the east-west vertices. Now we are ready to formulate our main result. Theorem 4. Under the assumption of P = N P, there does not exist any polynomial-time approximation algorithm with an approximation ratio of 2n for Inc-Edge-ReoptALL-TSP, where n is the number of vertices in the instance. Proof. For proving this theorem, we give a reduction from the Hamiltonian cycle problem (HC) to the Inc-Edge-ReoptALL-TSP. Let GHC be an input instance for HC with V (GHC ) = {v1 , . . . , vk } and E(GHC ) = {e1 , . . . , em }. To construct an instance of Inc-Edge-ReoptALL-TSP, we
12
H.-J. B¨ockenhauer, J. Hromkoviˇc, and A. Sprock N x
N u
W
x E
y
z
u
W
E y
z
S (a)
S (b)
Fig. 2. (a) Traversal of a diamond in north-south direction (b) traversal of a diamond in west-east direction
first build an unweighted graph GT SP . As a first step, we substitute every vertex vi ∈ V (GHC ), i ∈ {1, ..., k}, by a diamond graph Di with V (Di ) = {Ni, Si , Wi , Ei , ui , xi , yi , zi } as shown in Fig. 1. Secondly, we add edges from every S- and N-vertex of every diamond Di to every S- and N-vertex of all other diamonds Dj , j = i (see Fig. 3(a)). Furthermore, for every edge ei = {vj , vk } ∈ E(GHC ), the corresponding diamonds Dj and Dk are connected with two more edges: one between the W-vertex Wj of Dj and the E-vertex Ek of Dk and one edge between Wk and Ej (see Fig. 3(b)). Now we transform GT SP into an instance (GReopt , cold , cnew ) of Inc-Edge-ReoptALL-TSP. Let GReopt = (V, E) = K8k be the complete graph on 8k vertices. We define cold as follows: The edge eblock = {N1 , u1 } plays a special role in our argumentation, we set cold (eblock ) = 1 + ε. For all other edges ej ∈ {{vl , vk } | vl , vk ∈ V (GT SP )}, ej = eblock , we define 1 if ej ∈ E(GT SP ) − {eblock } cold (ej ) = M otherwise, where M = 29k . We now consider the local modification of changing the cost of one edge in cold leading to the new TSP instance (GReopt , cnew ). For this, we change the cost of the edge echange = {W1 , z1 } in the diamond D1 from cold (echange ) = 1 to cnew (echange ) = M . In addition to (GReopt , cold , cnew ), we have to specify the set of all optimal solutions for (GReopt , cold ). These are all the 2k · (k − 1)! many Hamiltonian tours which traverse every diamond in north-south or south-north direction. In the graph GT SP , independently from the original graph GHC , there exist 2k · (k − 1)! many Hamiltonian cycles traversing all diamonds in north-south or southnorth direction: The order of the diamonds can be varied arbitrarily, yielding (k − 1)! different possibilities, and all diamonds can be traversed either in north-south or southnorth direction which leads to (2k · (k − 1)!) different Hamiltonian tours in northsouth direction overall. Any of these Hamiltonian cycles leads to an optimal solution in (GReopt ,cold ) with cost of 8 · k because, for all edges ei = eblock , ei ∈ E(GT SP ), cold (ej ) = 1 holds and the edge eblock is not traversed by a run through the diamond D1 in north-south direction.
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization N1 eblock
13
Nj E1
W1 echange
Wj
Ej
S1 N2 Sj E2
W2 S2
...
Nk Nk Ek Wk
Ek
Wk
Sk
Sk (a)
(b)
Fig. 3. (a) North-south connections in the graph GT SP (b) west-east connections in the graph GT SP if {vj , vk } ∈ E(GHC )
Furthermore, if and only if there exists a Hamiltonian cycle in GHC , there also exist one or more (exactly as many as in GHC ) Hamiltonian cycles in GT SP that traverse every diamond in west-east direction. These Hamiltonian cycles lead to second-best solutions in GReopt of cost 8 · k + ε because every traversal of the diamond D1 in westeast direction has to use the edge eblock . Note that these west-east solutions do not use the edge echange . A Hamiltonian cycle in GReopt traversing some diamonds in northsouth direction and some other in west-east direction use at least two edges of cost M due to the construction, leading to a cost of at least 8 · k − 2 + 2 · M . By increasing the edge cost of echange from cold (echange ) = 1 to cnew (echange ) = M , all optimal solutions in (GReopt , cold ) get a cost of 8 · k − 1 + M in (GReopt , cnew ). Therefore, in (GReopt , cnew ) there exists an optimal solution with cost of 8 · k + ε if and only if there is a Hamiltonian cycles in GHC . Otherwise, the old optimal solutions in (GReopt , cold ) stay optimal in (GReopt , cnew ).
14
H.-J. B¨ockenhauer, J. Hromkoviˇc, and A. Sprock
Thus, an approximation algorithm with an approximation ratio smaller than (M + 8 · k − 1)/(8 · k + ε) would solve the HC problem. Due to M = 29k , we have M +8·k−1 > 28k 8·k+ε for almost all values of k. Since the constructed graph GReopt has 8k vertices, the claim follows.
4 Conclusion We have surveyed some of the known results about reoptimization and we have generalized the classical reoptimization model by allowing our algorithm to access not only one optimal solution for the old instance, but all optimal solutions. We have seen that the general TSP is an example of a problem where this extra knowledge does not help at all. Regarding future work, it seems to be worthwhile to consider this generalization of the reoptimization in greater detail and to investigate, how much the knowledge of all old optimal solutions can help for other reoptimization problems.
Acknowledgments This work was partially supported by SNF grant 200021-121745/1.
References 1. Hromkoviˇc, J.: Algorithmics for Hard Problems. Introduction to Combinatorial Optimization, Randomization, Approximation, and Heuristics. In: Texts in Theoretical Computer Science. An EATCS Series. Springer, Berlin (2003) 2. Sahni, S., Gonzalez, T.F.: P-complete approximation problems. Journal of the ACM 23(3), 555–565 (1976) 3. Sch¨affter, M.W.: Scheduling with forbidden sets. Discrete Applied Mathematics 72(1-2), 155–166 (1997) 4. van Hoesel, S., Wagelmans, A.: On the complexity of postoptimality analysis of 0/1 programs. Discrete Applied Mathematics 91(1-3), 251–263 (1999) 5. Archetti, C., Bertazzi, L., Speranza, M.G.: Reoptimizing the traveling salesman problem. Networks 42(3), 154–159 (2003) 6. Ausiello, G., Escoffier, B., Monnot, J., Paschos, V.T.: Reoptimization of minimum and maximum traveling salesman’s tours. In: Arge, L., Freivalds, R. (eds.) SWAT 2006. LNCS, vol. 4059, pp. 196–207. Springer, Heidelberg (2006) 7. B¨ockenhauer, H.-J., Forlizzi, L., Hromkoviˇc, J., Kneis, J., Kupke, J., Proietti, G., Widmayer, P.: Reusing optimal TSP solutions for locally modified input instances (extended abstract). In: Navarro, G., Bertossi, L.E., Kohayakawa, Y. (eds.) Proc. of the 4th IFIP International Conference on Theoretical Computer Science (TCS 2006). IFIP, vol. 209, pp. 251–270. Springer, New York (2006) 8. B¨ockenhauer, H.-J., Komm, D.: Reoptimization of the metric deadline TSP. In: Ochma´nski, E., Tyszkiewicz, J. (eds.) MFCS 2008. LNCS, vol. 5162, pp. 156–167. Springer, Heidelberg (2008)
Knowing All Optimal Solutions Does Not Help for TSP Reoptimization
15
9. Bil`o, D., B¨ockenhauer, H.-J., Hromkoviˇc, J., Kr´aloviˇc, R., M¨omke, T., Widmayer, P., Zych, A.: Reoptimization of steiner trees. In: Gudmundsson, J. (ed.) SWAT 2008. LNCS, vol. 5124, pp. 258–269. Springer, Heidelberg (2008) 10. B¨ockenhauer, H.-J., Hromkoviˇc, J., Kr´aloviˇc, R., M¨omke, T., Rossmanith, P.: Reoptimization of Steiner trees: Changing the terminal set. Theoretical Computer Science 410(36), 3428– 3435 (2009) 11. Escoffier, B., Milaniˇc, M., Paschos, V.T.: Simple and fast reoptimizations for the Steiner tree problem. Algorithmic Operations Research 4(2), 86–94 (2009) 12. B¨ockenhauer, H.-J., Freiermuth, K., Hromkoviˇc, J., M¨omke, T., Sprock, A., Steffen, B.: The Steiner tree problem with sharpened triangle inequality: hardness and reoptimization. In: Calamoneri, T., Diaz, J. (eds.) CIAC 2010. LNCS, vol. 6078, pp. 180–191. Springer, Heidelberg (2010) 13. Bil`o, D., B¨ockenhauer, H.-J., Komm, D., Kr´aloviˇc, R., M¨omke, T., Seibert, S., Zych, A.: Reoptimization of the shortest common superstring problem. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 78–91. Springer, Heidelberg (2009) 14. Bil`o, D., B¨ockenhauer, H.-J., Komm, D., Kr´aloviˇc, R., M¨omke, T., Seibert, S., Zych, A.: Reoptimization of the shortest common superstring problem. Algorithmica (2010) (to appear) 15. Archetti, C., Bertazzi, L., Speranza, M.G.: Reoptimizing the 0-1 knapsack problem. Technical Report 267, University of Brescia (2006) 16. Bil`o, D., Widmayer, P., Zych, A.: Reoptimization of weighted graph and covering problems. In: Bampis, E., Skutella, M. (eds.) WAOA 2008. LNCS, vol. 5426, pp. 201–213. Springer, Heidelberg (2009) 17. B¨ockenhauer, H.-J., Hromkoviˇc, J., M¨omke, T., Widmayer, P.: On the hardness of reoptimization. In: Geffert, V., Karhum¨aki, J., Bertoni, A., Preneel, B., N´avrat, P., Bielikov´a, M. (eds.) SOFSEM 2008. LNCS, vol. 4910, pp. 50–65. Springer, Heidelberg (2008) 18. Papadimitriou, C.H., Yannakakis, M.: The traveling salesman problem with distances one and two. Mathematics of Operations Research 18(1), 1–11 (1993) 19. Christofides, N.: Worst-case analysis of a new heuristic for the travelling salesman problem. Technical Report 388, Graduate School of Industrial Administration, Carnegie-Mellon University (1976) 20. B¨ockenhauer, H.-J., Forlizzi, L., Hromkoviˇc, J., Kneis, J., Kupke, J., Proietti, G., Widmayer, P.: On the approximability of TSP on local modifications of optimally solved instances. Algorithmic Operations Research 2(2), 83–93 (2007) 21. Bern, M.W., Plassmann, P.E.: The Steiner problem with edge lengths 1 and 2. Information Processing Letters 32(4), 171–176 (1989) 22. Dreyfus, S.E., Wagner, R.A.: The Steiner problem in graphs. Networks 1, 195–207 (1971/72) 23. Papadimitriou, C.H., Steiglitz, K.: Some examples of difficult traveling salesman problems. Operations Research 26, 434–443 (1978)
A Recurrent Enumeration of Free Hypermultisets Vincenzo Manca Department of Computer Science University of Verona, Italy
[email protected]
Abstract. A recurrent formula enumerating unlabeled membrane structures is presented, which is deduced by means of elementary combinatorial arguments by considering them as hypermultisets built from the empty set.
1 Introduction Tree enumeration formulae are an old subject [1], firstly investigated in connection to chemical structures. In Knuth’s book [3] many classical results are reported for different kinds of trees. In particular, labeled unordered rooted trees are enumerated by Caley’s formula nn−1 (n is the number of nodes). Unlabeled ordered rooted trees and labeled ordered rooted trees are enumerated by using Catalan numbers. Unlabeled unordered rooted trees, correspond to membrane structures of membrane computing [7]. For them no exact analytical formula is available, but a recurrent formula, obtained by means of generating functions, was given in [5], where also a complex asymptotic formula is presented. In this paper we improve and extend an approach developed in [4], by providing, by elementary combinatorial reasoning, a new recurrent enumeration of membrane structures, viewed as hypermultisets built from the empty set. We call them free hypermultisets, where the attribute “free” means existence-free, in the sense of free logics, that is, structures without individuals.
2 Free Hypermultisets A multiset can be obtained from a set by associating a multiplicity, to any of their elements, which provides a (non-null natural) number of occurrences. The sum of two multisets M1 and M2 is the multiset M1 + M2 where the elements of M1 and those of M2 occur with multiplicities which are the sums of the multiplicities they have in the original multisets (a null multiplicity is given to any element which does not occur in a multiset). Of course, the singleton set of an element a, which we denote by [a], is a special case of a multiset. Now, starting from the empty set, which we denote by [ ], we inductively define the set M of the finite free hypermultisets by setting: []∈M Base step X, X1 , X2 ∈ M =⇒ [X], X1 + X2 ∈ M Inductive step It is easy to realize that free hypermultisets represent (unlabeled) membrane structures and therefore unlabeled unordered rooted trees. J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 16–23, 2011. c Springer-Verlag Berlin Heidelberg 2011
A Recurrent Enumeration of Free Hypermultisets
17
The enumeration method we present is based on the following partitions of M. A multiset has the empty-membership property if the empty set occurs in it (with a non null multiplicity). Therefore M is the disjoint union of the following sets M = M0 ∪ M1 ∪ M2 , where M0 is the set of elements of M having the empty-membership property, M1 is the set of elements of M which are singletons and do not have the empty-membership property, and M2 is the set of elements of M which do not belong to M0 or to M1 . We call the elements of sets M0 , M1 , M2 neo-agglomerates, proto-agglomerates, and conglomerates respectively, for this reason we shortly call the free hypermultisets of M also agglomerates (see Fig. 1). We will denote by N the set of natural numbers and by i, j, k, m, n (possibly indexed) variables in N, and by x and x the floor and the ceiling of a real number x, respectively. Given a set A of n elements, the number of different k-multisets built on elements of A (k is the sum of all the multiplicities of the multiset) is given by the following formula [3]: n+k−1 (1) k and by using it, the following recurrent formula, given in Knuth’s book ([3], sect. 2.3.4.4), provides the number T (n) of unlabeled unordered rooted trees of n nodes (T (1) = 1): T (ni ) + ki − 1 T (n) = (2) ki i=1,..., j k1 ·n1 +k2 ·n2 +...+kj ·nj =n−1
Unfortunately, formula (2) is not manageable for an effective computation, because it is based on integer partitions, which grow, according to Hardy-Ramanujan’s exponential asymptotic formula [2]. The following Otter’s recurrent formula (see [5], formulae (6) (i) and (7)), with Sn = 0, for i > n, was obtained by advanced analytical methods based on generating functions: (i)
Sn(i) = Sn−i + T (n + i − 1) nT (n + 1) = 1T (1)Sn(1) + 2T (2)Sn(2) + . . . nT (n)Sn(n) . We denote by M (n) = T (n + 1) the number of agglomerates which, apart the skin membrane, have n membranes (pairs of matching brackets), and by P (n), N (n), C(n), the number of proto-agglomerates, neo-agglomerates, and conglomerates, respectively, having n membranes (apart the skin). Although unlabeled unordered rooted trees and agglomerates are equivalent notions, we will continue to speak in terms of agglomerates, because the intuition behind our analysis is directly related to the notion of a hypermultiset, where a membrane corresponds to the multiset construction. It easy to realize that an agglomerate with n membranes, when it is put inside a further membrane, provides a proto-agglomerate with n + 1 membranes, while united with the neoagglomerate [[ ]] provides a neo-agglomerate with n + 1 membranes. The following lemmas easily follow from the tripartite classification of agglomerates.
18
V. Manca
Fig. 1. Different types of agglomerates
Lemma 1. For n > 0 the following equations hold: M (n) = N (n + 1) = P (n + 1). Lemma 2. For n > 0 M (n + 1) = 2M (n) + C(n + 1).
(3)
Proof. The term 2M (n) refers to the number of proto-agglomerates and neo-agglomerates with n + 1 membranes. From the tripartition of agglomerates, the remaining agglomerates of n + 1 membranes are conglomerates. Lemma 3. C(1) = C(2) = C(3) = 0. For n > 2 C(n + 1) < M (n). Proof. Removing the external membrane in a component of a conglomerate with n + 1 membranes, provides an agglomerate with n membranes, but not all agglomerates with with n membranes can be obtained in this way. Therefore conglomerates with n + 1 membranes are less than M (n). Putting together Lemmas 2 and 3 we get the following lemmas. Lemma 4. For n > 2 2M (n) < M (n + 1) < 3M (n). 2n < M (n + 1) < 3n .
A Recurrent Enumeration of Free Hypermultisets
19
In the number M (n + 1) the part 2M (n) refers to proto-agglomerates plus neo-agglomerates. Therefore, if M (n) is known, the real problem for the computation of M (n + 1) is the evaluation of M (n + 1) − 2M (n) = C(n + 1), that is, the number of conglomerates with n + 1 membranes. We have M (0) = 1, M (1) = 1, M (2) = 2, M (3) = 4, as it is indicated in the following schema where skin membranes are denoted by braces. 0 {} 1{[]} 2{[], []}
{ [[ ]] }
3 { [ ], [ ], [ ] } { [[ [ ] ]] } { [ ], [[ ]] } { [[ ], [ ]] } From Lemma 2 we evaluate immediately M (4) = 2M (3) + 1 = 9. In fact, C(4) = 1, because there is only a conglomerate with 4 non-skin membranes: {[ [ ] ], [ [ ] ]}. Analogously, M (5) = 2M (4)+ 2 = 18 + 2 = 20, because there are two conglomerates with 5 membranes: {[ [ ] ], [ [ ], [ ] ]}, and {[ [ ] ], [ [ [ ] ] ]}. The sequence from M (1) up to M (12) (sequence A000081 of The On-Line Encyclopedia of Integer Sequences [8]) provides the following table. n 1 2 3 4 5 6 7 8 9 10 11 12 M(n) 1 2 4 9 20 48 115 286 719 1842 4766 12486 Now we consider an enumeration method which is based on the number Cmin(k) (n) of conglomerates having their smallest components of k + 1 membranes (k > 0). Lemma 5. For n > 3 Cmin(1) (n + 1) = M (n − 1) − M (n − 2) Proof. The number Cmin(1) (n + 1) counts the conglomerates of n + 1 membranes (apart the skin) having [[]] as smallest components. These conglomerates are of two different types: i) those having more than two components, one of them equal to [[]]; ii) those having a component equal to [[]] plus only a further component. The number of conglomerates i) is C(n − 1); the number of conglomerates ii) is M (n − 2) (after removing [[]] from the n + 1 original membranes , the skin of the further component is not counted). Therefore, they are C(n − 1) + M (n − 2). However, M (n − 1) = 2M (n − 2) + C(n − 1), therefore C(n − 1) = M (n − 1) − 2M (n − 2), so that C(n − 1) + M (n − 2) = M (n − 1) − M (n − 2). Lemma 6. For n > 3 Cmin(k) (n) = 0 if k > (n − 2)/2 and M (n + 1) = 2M (n) + M (n − 1) − M (n − 2) +
Cmin(k) (n + 1) (4)
k=2,(n−1)/2
20
V. Manca
Proof. Any conglomerate has at least two components, therefore no conglomerate with a component having more than (n − 2)/2 membranes can exist (two membranes need for the skins of the components). Therefore, conglomerates having at least 2 membranes inside their components can be partitioned into disjoint classes, by providing a total number of elements given by the summation in the right member of the formula above. The function Mk , defined by the following equations, will be used in the next lemma. ⎧ ⎪ ⎨M (i − 1) if i > k + 1 Mk (i) = 0 (5) if 0 < i ≤ k + 1 ⎪ ⎩ 1 if i = 0 The computation of terms Cmin(k) (n) concludes our enumeration method of conglomerates. Let j
j (m) = i
Lemma 7. For n > 3 and (n − 2)/2 ≥ k ≥ 2 Cmin(k) (n) = M (k) + i − 1 (Mk (n−i(k+1)) + Cmin> k (n−i(k+1))) i
n/(k+1)
i=1
(7)
Proof. Conglomerates with their smallest components having k + 1 membranes are of two disjoint types: i) those with one or more components of k + 1 membranes plus a remaining component with more than k + 1 membranes (if they exist); and ii) those with one or more components of k + 1 membranes plus a conglomerate having minimal components with more than k + 1 membranes (if they exist). For m > 1, we define m-multiplicity of a conglomerate as the number of its components with m membranes. Then, the two types i) and ii) of conglomerates are summed in formula (7), for each value i of their (k + 1)-multiplicity, and their sum is multiplied by a binomial coefficient giving the number of different conglomerates with (k + 1)-multiplicity i. The definition of the function Mk guarantees that, in the case of a conglomerate with (k + 1)-multiplicity i which has i + 1 components, the component, having a number of membranes different from k + 1, has more than k + 1 membranes. Putting together the two previous lemmas we get the final proposition. Proposition 1. For any n ∈ N, the number M (n + 1) is given by formulae (4), (5), (6), and (7) above. The following tables provide MATLAB functions computing the enumeration formula asserted in the previous proposition, with full accordance with Sloane’s sequence A000081.
A Recurrent Enumeration of Free Hypermultisets
% CM = computeCM(n,k) % % This function calculates Cmin>k (n) % % n +1 = number of membranes % k +1= size of smallest components
% MP = computeMP(i,k) % % This function calculates Mk (i) % % k +1= size of smallest components % i = number of minimal components
function CM = computeCM(n, k); CM = 0; if ((k + 1) <= (n − 2)/2) for i = k + 1 : (n − 2)/2 CM = CM + computeC(n, i); end end
function M P = computeM P (i, k); if (i == 0) M P = 1; elseif (i > (k + 1)) M P = computeM (i − 1); elseif (0 < i <= (k + 1)) M P = 0; end
% C = computeC(n,k) % % This function calculates Cmin(k) (n) the number of conglomerates of n membranes % having their smallest components with k+1 membranes. % % n +1 = number of membranes % k +1 = size of smallest components function C = computeC(n, k); if (k > (n − 2)/2 + 1); C = 0; else C = 0; for i = 1 : n/(k + 1) C = C + ((f actorial(computeM (k) + i − 1) / (f actorial(i) · f actorial(computeM (k) − 1))) · ((computeM P (n − i · (k + 1), k)) + computeCM(n − i · (k + 1), k))); end end
21
22
V. Manca % M = computeM(n) % % This function calculates the number M (n) % % n+1 = number of membranes function M = computeM (n); if (n > 0) n = n − 1; end if (n == 0) M = 1; elseif (n == 1) M = 2; elseif (n == 2) M = 4; elseif (n == 3) M = 9; elseif (n > 3) k = 2; if (k <= (n − 2)) if (k > (n − 1)/2) M = 2 · computeM (n) + computeM (n − 1) − computeM (n − 2); else sum = 0; for i = 2 : (n − 1)/2 sum = sum + computeC(n + 1, i); end M = 2 · computeM (n) + computeM (n − 1) − computeM (n − 2) + sum; end end end
Acknowledgments The author is grateful to Gheorghe P˘aun for drawing his attention to the combinatorial analysis of membrane structures [6], and to Sara Compri for implementing and testing the enumeration formulae, by computer programs (MATLAB and JAVA) on the values of sequence A000081 of [8].
References 1. Cayley, A.: On the analytical forms called trees, with application to the theory of chemical combinations. Mathematical Papers 9, 427–460 (1875) 2. Hardy, G.H., Ramanujan, S.: Asymptotic Formulae in Combinatory Analysis. Proc. London Math. Soc. 17, 75–115 (1918) 3. Knuth, D.: The Art of Computer Programming. Fundamental Algorithms, vol. 1. Addison Wesley, Reading (1968)
A Recurrent Enumeration of Free Hypermultisets
23
4. Manca, V.: Enumerating Membrane Structures. In: Corne, D., et al. (eds.) WMC 2008. LNCS, vol. 5391, pp. 292–298. Springer, Heidelberg (2009) 5. Otter, R.: The Number of Trees. The Annals of Mathematics, 2nd Ser. 49(3), 583–599 (1948) 6. P˘aun, G.: Personal Communication (October 1998) 7. P˘aun, G.: Membrane Computing: an introduction. Springer, Heidelberg (2002) 8. Sloane, N.J.A.: The On-Line Encyclopedia of Integer Sequences. Notices of The American Mathematical Society 59(8), 912–915 (2003)
Context Insertions Paolo Bottoni1 , Radu Gramatovici2, Anna Labella1 , Florin Manea2,3, , and Victor Mitrana2,4, 1
4
Department of Computer Science, “Sapienza” University of Rome Via Salaria 113, 00198 Rome, Italy {bottoni,labella}@di.uniroma1.it 2 University of Bucharest, Faculty of Mathematics and Computer Science, Academiei 14, 010014, Bucharest, Romania [email protected] 3 Faculty of Computer Science, Otto-von-Guericke University, P.O. Box 41 20, D-39016 Magdeburg, Germany [email protected] Depto. Organizaci´on y Estructura de la Informaci´on, Universidad Polit´ecnica de Madrid, Crta. de Valencia km. 7 - 28031 Madrid, Spain [email protected]
Abstract. In this paper we consider an operation of inserting contexts in a word controlled by a contextual scheme X which provides a selection criterion for contextual insertion. We say that a language L is k-stable w.r.t. a contextual scheme X if by making any k context insertions in a word of L we still obtain a word of L; L is k-anti-stable w.r.t. X if by making any k context insertions in a word of L we get a word not in L; L is called k-error-correctable w.r.t. X if by making any k context insertions in a word x of L we get either a word in L or a word not in L which cannot be also obtained by making k context insertions in a word z of L different from x. We prove that all these properties are decidable for regular languages. We then define a distance between two words that measures the minimal number of context insertions in one of the words in order to obtain the other. Some properties of this distance, which is actually a semimetric, are investigated.
1 Introduction The problem investigated in this paper is actually met in some rather different fields (coding theory, programming languages, computational linguistics, genetics). It may be briefly expressed as follows. One gives an arbitrary language L, by means of a generative/accepting device. The words in this language encode information. During their transmission, by different reasons, the words suffer some disturbances (called errors) which transform them in other words in a larger language L ⊇ L. The problem consists of accepting the new words and recovering the original ones, if the number of errors is rather small (the word was not completely deteriorated). The amount of errors that can be corrected constitutes a
Florin Manea acknowledges support from the Alexander von Humboldt Foundation. Supported by the Visiting Professor Programme — “Sapienza” University of Rome.
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 24–34, 2011. c Springer-Verlag Berlin Heidelberg 2011
Context Insertions
25
measure of the language L; this number can be completely determined in coding theory where the language is formed by words of equal length defined by algebraic means. The same problem occurs in fault-tolerant programming languages and operating systems [7]. In genetics, the genomes may be viewed as consisting of chromosomes with genes arranged in linear order. Treating chromosomes and genomes as languages raises the possibility to generalize and investigate the structural information contained in biological sequences. In the course of its evolution, the genome of an organism mutates by processes at the level of individual genes (point mutations): one of the basic nucleic acids is inserted or deleted or substituted by another one. However, the analysis of the genomes of some viruses (Epstein-Barr and Herpes simplex viruses, see for instance [8], [3]) have revealed that the evolution of these viruses involved a number of largescale rearrangements in one evolutionary event. Chromosomal rearrangements include insertions together with pericentric and paracentric inversions, intrachromosomal and interchromosomal transpositions, translocations, etc. In this paper we focus on the formal language operation of context insertion. In addition to its theoretic attractivity, another motivation for studying this operation is two-fold: it can be used as the basis for modeling DNA computation and it is already implementable in the laboratory. Indeed, by using available reagents and a standard technique called PCR site-specific oligonucleotide mutagenesis [1], one can perform insertions of nucleotide sequences at some specific sites. As the name of the procedure suggests, the insertions of oligonucleotide sequences are context-sensitive. Consequently, an attempt to better model the process is to use a modified notion of insertion so that insertion of a word takes place only if a certain site is present. This can be formalized by the notion of context insertion we are going to consider in this paper. It is known that very few mutations do not essentially change the properties of DNA. In terms of formal language theory, this may be stated as follows: given a set of strings L describing a certain species one should identify a new organism in the same species that gently differs from the organisms in L by context insertions. In linguistics [10] corrections of just one error are usually considered for regular languages only without taking into consideration the possibility of extending the algorithms for correction to more complex languages. A basic phenomenon in descriptive linguistics is the acceptance of contexts (pairs of words) by words and of words by contexts [5]. It is obvious that there is a close connection between adding contexts and insertion, as well as between erasing contexts and deletion. Contextual grammars were firstly considered in [5] with the aim of modelling some natural aspects from descriptive linguistics, like for instance the acceptance of a word construction only in certain contexts. These models do not involve nonterminals. Moreover, they do not have rules of derivation except one general rule: to adjoin contexts. For a detailed introduction to the topic, the reader is referred to the monograph [11]. In this paper we address the operation of inserting contexts in a word controlled by a contextual scheme (a Marcus contextual grammar without axioms) by means of formal language theory. The context insertion is viewed as an “error” or “mutation” that may appear in some situations like message transmission or genome evolution. We briefly refer to the former situation. There are two possible cases: one assumes that
26
P. Bottoni et al.
the transmitter has to encrypt the plain text in such a way that an adversary cannot decrypt it. One method for encrypting is the so-called “garbage in between” consisting in the insertion of parasitic strings in different places in the plain text. One requires that the meaning of the encrypted text be different from the meaning of the plain text and moreover the receiver be able to decrypt the message with small efforts. Another case assumes that the message is altered during transmission by some environmental disturbances. We say that a language L is k-stable w.r.t. a contextual scheme X, which provides a selection criterion for contextual insertion, if by making any k context insertions in a word of L we still obtain a word of L; L is k-anti-stable w.r.t. X, if by making any k context insertions in a word of L we get a word not in L; L is called k-error-correctable w.r.t. X if by making any k context insertions in a word x of L we get either a word in L or a word not in L which cannot be also obtained by making k context insertions in a word z of L different of x. We prove that all these properties are decidable for regular languages. We then define a distance between two words that measures the minimal number of context insertions in one of the words in order to obtain the other. Some properties of this distance, which is actually a semimetric, are investigated.
2 Preliminaries In this section we present the basic definitions and notations used throughout the paper. For further details concerning Marcus contextual grammars the reader is referred to the monograph [11], while for the basic notions in formal language theory the handbook [12] is a pretty complete reference. An alphabet is any finite non-empty set; a word over an alphabet V is a finite sequence of symbols from V , while a language over the alphabet V is any set of words over V . The empty word is denoted by and the length of a word w is denoted by |w|. If the empty word belongs to a language, then it is ignored; therefore two languages which differ from each other by the empty word only are considered to be equal. For any real number a we denote by [a] the integer part of a, namely the integer with the property [a] ≤ a ≤ [a] + 1. We say that X = (V, C, ϕ) is an internal contextual scheme, where V is an alphabet, C is a finite subset of V ∗ × V ∗ (the elements of C are called contexts), and ϕ : V ∗ −→ 2C is the selection mapping. For the rest of this paper, we suppose that the set of contexts of any internal contextual scheme does not contain the empty context (, ). An internal contextual scheme X = (V, C, ϕ) as above with ϕ−1 (Z) ∈ F, Z = ∅, where F is a class of languages, is called an internal contextual scheme with F -choice. In what follows, we consider internal contextual schemes with finite choice only, i.e. the set (called the set of selectors) SelX = {x ∈ V ∗ | ϕ(x) = ∅} is finite. Moreover, we omit the term internal as all contextual schemes considered in this paper are internal ones. Given a contextual scheme X = (V, C, ϕ) and a word x ∈ V ∗ , we define the context insertion in x with respect to X as follows: x ←− X = {y = x1 ux2 vx3 | x = x1 x2 x3 for some x1 , x2 , x3 ∈ V ∗ and (u, v) ∈ ϕ(x2 )}.
Context Insertions
27
Context insertion is naturally extended to languages: x ←− X. L ←− X = x∈L
For any integer k ≥ 1 we define the k-context insertion in a word x and a language L w.r.t. a contextual scheme X by k
k−1
k
x ←− X = (x ←− X) ←− X
L ←− X =
k
x ←− X.
x∈L 0
∗
By convention, x ←− X = {x} and x ←− X =
k
x ←− X.
k≥0
Remark 1. If X = (V, C, ϕ) is an internal contextual scheme and A is a finite set of words over V , then the pair G = (X, A) is an internal contextual grammar, in the classical sense. The language generated by G, denoted by L(G), is exactly L(G) = ∗ A ←− X. Remark 2. Note that the classic insertion is a special type of context insertion. Indeed, if we want to insert w at some position in the word x this can be done by setting ϕ() = (, w) (the context (, w) that is to be inserted is selected by an empty selector). However, for the rest of the paper we consider contextual schemes without the empty selector. This does not diminish the generality of our approach as the above insertion can be also simulated by setting ϕ(a) = {(, w), (w, )} for each letter a in the alphabet of the contextual scheme. We finish this section by pointing out some further bibliographical links. The context insertion defined here is a generalization of the contextual insertion introduced in [9] and resembles the one-sided (one of the two contexts is always empty) contextual insertion proposed in [2].
3 Stable, Anti-stable, and Error-Correctable Languages Let X = (V, C, ϕ) be a contextual scheme, L be a language over V , and k ≥ 1. k
– L is said to be k-stable w.r.t. X iff (L ←− X) ⊆ L. k
– L is said to be k-anti-stable w.r.t. X iff (L ←− X) ∩ L = ∅. – L is said to be k-error-correctable w.r.t. X iff for all y ∈ / L such that k k y ∈ (x ←− X) ∩ (z ←− X) for some x, z ∈ L, we have x = z. Thus, k context insertions (or errors/mutations, if we choose this terminology) in a word of a k-stable language produces a word in the same language (the transformation keeps us inside the same species, it is not perceived as an error). The anti-stable languages are placed at the opposite pole: any k context insertions in any string of L lead us outside
28
P. Bottoni et al.
L. In the case of k-error-correctable languages, the errors may bring us outside the language, but there is a unique source of each erroneous word, hence we can correct the error. Clearly, given a contextual scheme X, every 1-stable language w.r.t. X is k-stable w.r.t. X for every k ≥ 2. The converse does not hold as the language Lk = {abnk | n ≥ 1}, k ≥ 2, and the contextual scheme X = ({a, b}, {(, b)}, ϕ), with ϕ(a) = (, b) show. Indeed, Lk is k-stable but not 1-stable w.r.t. X. The following result will be very useful in the proofs of subsequent statements. Lemma 1. Let X = (V, C, ϕ) be a contextual scheme, L be a language over V , and k
k ≥ 1. Then L ←− X = g(L) for some gsm mapping g. Proof. In spite of the fact that a proof for this statement is just routine, we present here a bit more complicated gsm mapping in the view of using it in a more complicated proof later. By the fact that the class of gsm mappings is closed under composition, it suffices to give the construction for k = 1. Given X and L as above, we construct the following gsm, T = (Q, V, V, f, q0 , {[, , , ]}), where Q contains, apart from q0 , states defined by quadruples of words over V . The meaning of the four components of the state [α, β, δ, γ] is: the rest of the left context that remained to be inserted, the selector (for checking its presence in the input word immediately after the place where the left context is to be inserted), the right context that is to be inserted, and the part of the input word read during the insertion of the left context, respectively. The transition mapping f is defined in the following; note that each transition is accompanied by some explanations which makes the construction more easily understandable. (i) For every a ∈ V , f (q0 , a) contains the following pairs: – (q0 , a). T nondeterministically chooses the place for inserting a context. – ([u , x, v, a], b), for all x ∈ SelX , (u, v) ∈ ϕ(x), u = bu , b ∈ V . T starts to insert the left context u, provided it is nonempty, selected by x. – ([, x , v, ], a), for all x ∈ SelX , (, v) ∈ ϕ(x), x = au . As the left context is empty, T starts to check the presence of x. (ii) For every a, b ∈ V , x, β ∈ V + , α, v ∈ V ∗ , we have f ([aα, x, v, β], b) = {([α, x, v, βb], a)}. T continues the insertion process of the left context. (iii) For every a, b ∈ V , α, β, v ∈ V ∗, we set f ([, aα, v, aβ], b) = {([, α, v, βb], a)}. After finishing the insertion of the left context, T checks the presence of the selector in the input word immediately after the place where the left context has been inserted. (iv) For every a ∈ V , α, v ∈ V ∗ , we set f ([, aα, v, ], a) = {([, α, v, ], a)}. Now, T checks the presence of the selector in the case of an empty left context. (v) For every a, b ∈ V , α, β ∈ V ∗ , we set f ([, , aα, β], b) = {([, , α, βb], a)}. After T has finished successfully the checking process of the selector, it inserts the right context.
Context Insertions
29
(vi) For every a, b ∈ V , α ∈ V ∗ , we set f ([, , , aα], b) = {([, , , αb], a), ([, , , ], aαb)}. The part of the input word stored in the fourth component of the current state is written on the output tape. 1
It is rather plain that L ←− X = gT (L). The proof is complete as soon as we note that the length of each component of a state is bounded by the maximum between the longest selector and the maximal total length of the contexts, which means that the set of states Q is a finite set. With the help of this lemma, we can set up several decidability issues. Theorem 1 1. If the inclusion problem is decidable for a class of languages F which is closed under gsm mappings, then we can decide whether L ∈ F is k-stable w.r.t. a given contextual scheme X and integer k. 2. If the emptiness of the intersection is decidable for a class of languages F which is closed under gsm mappings, then we can decide whether L ∈ F is k-anti-stable w.r.t. a given contextual scheme X and integer k. The proof is immediate. As the class of regular languages satisfies all these conditions, we may state: Theorem 2. The k-stability and k-anti-stability of a regular language w.r.t. a given contextual scheme X and integer k is decidable. A rather interesting result whose proof is essentially based on the construction from the proof of Lemma 1 is Theorem 3. Given a regular language L, a contextual scheme X, and an integer k ≥ 1, one can algorithmically decide whether L is k-error-correctable w.r.t. X. Proof. Let X = (V, C, ϕ) be a contextual scheme, k ≥ 1, and L be a regular language ∗ over V . We set V = {a | a ∈ V } and define the homomorphism h : V ∗ → V by h(a) = a, for any a ∈ V . We now give the steps of an algorithm for checking whether or not L is k-error-correctable w.r.t. X. To this aim, we recall the definition of the (literal) shuffle operation applied to two words over the alphabet V defined recursively as follows: a⊥ b = ab, if a, b ∈ V, ax ⊥ by = ab(x ⊥ y), if a, b ∈ V, and x, y ∈ V + . Note that this shuffle operation is defined on two words of the same length only. The shuffle of two languages L1 , L2 is naturally defined by L1 ⊥ L2 = {x ⊥ y | x ∈ L1 , y ∈ L2 }.
30
P. Bottoni et al.
Algorithm 1. Input: X, k, L (a finite automaton or a regular grammar defining L); Output: YES/NO. Step 1. Compute L1 = ((L{#}∗ ) ⊥ (h(L){#}∗ )) ∩ ((V ∪ {#})(V ∪ {#}))∗ \ (V ∪ V ∪ {#, #})∗ {##}. We added a “tail” of # and # to the words from L and h(L), respectively, such that any such new word from L can be shuffled with a new word from h(L). However, we reject all those words obtained by a shuffle between two words both having a tail. By the closure properties of the class of regular languages, it follows that L1 is regular and either a finite automaton or a regular grammar defining it can be effectively constructed. Step 2. Compute L2 = L1 ∩ ((V V )∗ {ab | a, b ∈ V ∪ {#}, a = b}((V ∪ {#})(V ∪ {#}))∗ ). In other words, L2 is simply obtained from L1 by removing all words x ⊥ h(x), x ∈ L. Again, L2 is a regular language which can be effectively constructed. Step 3. Compute L3 = g(L2 ), where g is a gsm mapping working very similar to that described in the proof of Lemma 1. More precisely, g is an extension of the gsm constructed in the proof of Lemma 1 able to process the new symbols # and #. It works on the odd position symbols for producing a k-context insertion w.r.t. X, while on the even position symbols it produces a k-context insertion w.r.t. a suitable modified copy of X. Therefore, L3 contains the shuffle (extended with the two new symbols) of any k k two words x and h(y) such that x ∈ (u ←− X), y ∈ (v ←− X) and u, v ∈ L, u = v. Clearly, L3 is still regular and effectively constructible. Step 4. Compute L4 = L3 ∩ ({aa | a ∈ V }+ \ (L ⊥ h(L))). k
Now, L4 collects the shuffle of any pair of words (x, h(x)) such that x ∈ ((u ←− k
k
X) ∩ (v ←− X)), u, v ∈ L, u = v and x ∈ / (L ←− X). As L3 is intersected with a regular language, we infer that L4 is still regular and can effectively be computed. Step 5. L is k-error-correctable if and only if L4 = ∅. By all the above explanations, this statement is correct. Furthermore, the emptiness of L4 can be checked algorithmically, which concludes the algorithm and the proof. A natural question regards the decidability status of these problems for other classes of languages.
4 A Distance Based on Context Insertions Let X = (V, C, ϕ) be a contextual scheme and x, y be two words over V . The contextual distance between x and y with respect to the scheme X, is defined by k k min{k | y ∈ (x ←− X) or x ∈ (y ←− X)}, δX (x, y) = ∗ ∗ ∞, if y ∈ / (x ←− X) and x ∈ / (y ←− X).
Context Insertions
31
A notation that will turn out to be useful in the sequel is k
k
x −→ X = {y | x ∈ (y ←− X)}. Let δX be a contextual distance with respect to the contextual scheme X over an alphabet V . The following properties are immediate: 1. δX (x, y) ≥ 0, for any words x and y over V (non-negativity). 2. δX (x, y) = 0 iff x = y, for any word x over V (identity of indiscernibles). 3. δX (x, y) = δ(y, x), for any words x and y over V (symmetry). However, the triangle inequality, which is usually associated with a distance like the geometrical distance, does not hold. Take, for example, three words a2 b3 , a3 b2 , a3 b3 and the contextual scheme X over the alphabet {a, b} with the set of contexts C = {(a, b), (, b), (a, )} and the selection mapping defined by ϕ(ab) = C and ϕ(x) = ∅ for all x = ab. Clearly, δX (a2 b3 , a3 b3 ) = 1, δX (a3 b3 , a3 b2 ) = 1, but δX (a2 b3 , a3 b2 ) = ∞. Thus, δX defines a semimetric over V ∗ , but not a metric. However, we prefer to call it distance for sake of uniformity as many similar measures are called distances in the literature. The contextual distance is a non-trivial measure in the sense that for every natural k and every contextual scheme X = (V, C, ϕ), there exist words x and y such that δX (x, y) ≥ k. To show this, assume that c = (u, v) is a context from C having the sum of the lengths of its words maximal with respect to all the contexts in C. Also, let x be k a word with c ∈ ϕ(x). It is clear that y = uk xv k ∈ (x ←− X) cannot be obtained with less than k context insertions from the word x, due to the choice of c. Therefore, δX (x, y) = k. This shows not only that the contextual distance is not trivial, but also connected, that is for every natural k and every contextual scheme X = (V, C, ϕ), there exist words x and y such that δX (x, y) = k. This remark leads us to another fact regarding the contextual distance, stated in the following proposition. Proposition 1. For a contextual scheme X, a word x, and a natural number k, one can decide whether or not there exists y such that the δX (x, y) = k. Proof. It is clear that y with the required properties exists if and only if k
k
k−1
k−1
((x ←− X) ∪ (x −→ X)) \ ((x ←− X) ∪ (x −→ X)) = ∅. Since this condition can be algorithmically checked we are done. A desirable property of any measure is that of being computable. The contextual distance between two words has this property. A trivial enumeration technique provides the simplest reasoning. Proposition 2. For any contextual scheme X = (V, C, ϕ) and any two words x, y ∈ V ∗ , δX (x, y) is computable. Note that given two words x and y, there exists a contextual scheme X such that δX (x, y) is finite if and only if either x is a scattered subword of y or y is a scattered subword of x. Therefore, we can state:
32
P. Bottoni et al.
Proposition 3. Given two words x, y one can decide whether or not there exists a contextual scheme X such that δX (x, y) is finite in O((min(|x|, |y|))2 · max(|x|, |y|)) time. Proof. Given a word w of length n, the nondeterministic finite automaton accepting all words having w as a scattered subword has O(n) states and can be constructed in time quadratic in n. Moreover, it is well-known that given a word z and a nondeterministic finite automaton A with O(n) states one can decide whether or not z is accepted by A in O(n2 |z|) time. A word x is a k-scattered subword of another word y if y = y0 x1 y1 x2 y2 . . . xk yk and x = x1 x2 . . . xk , where all xi and yj are nonempty words for all 1 ≤ i ≤ k, 1 ≤ j ≤ k − 1 while y0 and yk are arbitrary words. A word x is a k-min scattered subword of another word y if x is a k-scattered subword of y and is not a p-scattered subword of y for any p < k. Clearly, the contextual distance between two words depends on the contextual scheme. The following result gives a lower bound for the minimal contextual distance between two given words. Proposition 4. Let x, y be two words over an alphabet V with |x| < |y|. For every positive k, if x is a k-min scattered subword of y, then δX (x, y) ≥ [ k2 ] for any contextual scheme X. Proof. We give an argument based on the induction on k. Clearly, if x is a k-min scattered subword of y, 1 ≤ k ≤ 3, then δX (x, y) ≥ 1 ≥ [ k2 ], for any contextual scheme X. Assume now that x is a k-min scattered factor of y, k ≥ 4, and δX (x, y) = p < [ k2 ] for some contextual scheme X = (V, C, ϕ). If p = 1, then x is an r-scattered factor of y with 1 ≤ r ≤ 3, a contradiction. We now assume that p ≥ 2; let z be a word in V + such that y ∈ (z ←− X) and ∗ z ∈ (x ←− X). By the induction hypothesis, x is an r-min scattered subword of z, with r ≤ 2p−1. On the other hand, p+ 1 ≤ [ k2 ] ≤ k2 which implies that 2p−1 ≤ k −3. It follows that z = z0 x1 z1 . . . xr zr , where x = x1 x2 . . . xr , xi ∈ V + , 1 ≤ i ≤ r, and z0 , zr ∈ V ∗ , zj ∈ V + , 1 ≤ j ≤ r − 1. We assume that the context (u, v) is applied to z in the process of obtaining y by the context insertion in z w.r.t. X. We distinguish three cases: Case 1: Both u and v are inserted in words (possibly the same) xi and xj , 1 ≤ i ≤ j ≤ r. It follows that x is an (r + 2)-scattered subword of y, a contradiction because r + 2 ≤ k − 1. Case 2: Both u and v are inserted in words (possibly the same) zi and zj , 0 ≤ i ≤ j ≤ r. It follows that x is an r-scattered subword of y, a contradiction because r ≤ k − 3. Case 3: One of u, v is inserted in a word xi , 1 ≤ i ≤ r, while the other is inserted in a word zj , 0 ≤ j ≤ r. It follows that x is an (r + 1)-scattered subword of y, a contradiction because r + 1 ≤ k − 2. Now the proof is complete. Finally, we note that given two words x and y and a contextual scheme X, it is undecidable whether there exists or not a word z at a finite contextual distance from x and y. The proof is based on a straightforward reduction to the Post Correspondence Problem.
Context Insertions
33
5 Distance of a Language Clearly, a desirable property of a language, from the cryptographic point of view, is to be k-error-correctable for any k ≥ 1. However, this is a quite strong condition rarely met for large classes of languages. On the other hand, to be k-error-correctable just for a single value of k might not be sufficient in many applications. Let us suppose the following hypothetical situation. Given a contextual scheme X = (V, C, ϕ) and a k-error-correctable w.r.t. X language L ⊆ V ∗ , let us suppose that a sentence β ∈ V ∗ has been received by a transmission channel. This sentence is actually a sentence from L altered by context insertions defined by X. The problem consists in finding the most probable string α ∈ L (if any) that has been transmitted. Although L is kerror-correctable, it might happen that β could be obtained by p-context insertions, for different values of p = k, from different words in L. Now, the process of recovering the original message cannot be guaranteed despite that L is k-error-correctable w.r.t. X. Many algorithms have been reported for solving this problem ([4],[10]). Basically, all of them are based on a measure called the correcting capacity of a language. This measure is generally inferred from the distance of that language. We consider here the contextual distance of a given language w.r.t. a contextual scheme. The contextual distance of the language L of cardinality at least two w.r.t. the contextual scheme X is the positive integer dX (L) defined by: dX (L) = min{δX (x, y) | x, y ∈ L, x = y}. It is an easy exercise to show that the contextual distance of a language is a connected measure, namely for any positive integer n there exists an infinite (regular) language L and a contextual scheme X such that dX (L) = n. In order to compute the correcting capacity of a language we need to compute firstly its distance. In this respect, it appears that a fundamental question concerns the possibility of computing algorithmically the contextual distance of a given language w.r.t. to a given contextual scheme. We conjecture that such an algorithm does exist for regular languages. Note that the distance of a language is finite if and only if that language is not k-anti-stable for some k. Actually, the contextual distance of a language is exactly the minimal k such that the given language is not k-anti-stable. However, we can state: Proposition 5. Given a contextual scheme X and a linear context-free language L, one cannot algorithmically compute dX (L). Proof. The proof is a pretty simple reduction to the Post Correspondence Problem. Let x = (x1 , x2 , . . . , xn ) and y = (y1 , y2 , . . . , yn ) be two Post lists over the alphabet {a, b}. We consider the contextual scheme X = ({a, b, c}, {(bia, xi ) | 1 ≤ i ≤ n}, ϕ), where ϕ(c) = {(bi a, xi ) | 1 ≤ i ≤ n}. If one takes the linear context-free language L = {bi1 abi2 a . . . bik acyik . . . yi2 yi1 | k ≥ 1, 1 ≤ i1 , i2 , . . . , ik ≤ n}, then dX (L) is finite if and only if the given instance of the Post Correspondence Problem has a solution.
34
P. Bottoni et al.
6 Conclusion and Further Work We considered here a generalization of the usual insertion operation, i.e. the context insertion. Algorithms for deciding the stability, anti-stability, and error-correctability of regular languages w.r.t. a contextual scheme have been presented. It would be of interest to investigate the decidability status of these problems for other classes of languages. Furthermore, we consider that total stability, anti-stability, and error-correctability (a language is totally stable/anti-stable/error-correctable if it is k-stable/anti-stable/errorcorrectable for all values of k) are worth investigating. Other attractive problems in our view regard the complexity of computing the minimal contextual distance of two given words and the contextual distance of a regular language.
References 1. Dieffenbach, C.W., Dveksler, G.S. (eds.): A Laboratory Manual. Cold Spring Harbor Laboratory Press (1995) 2. Kari, L., Thierrin, G.: Contextual Insertions/Deletions and Computability. Information and Computation 131, 47–61 (1996) 3. Karlin, S., Mocarski, E.S., Schachtel, G.A.: Molecular Evolution of Herpesviruses: Genomic and Protein Comparisons. J. of Virology 68, 1886–1902 (1994) 4. van Lindt, J.H.: Introduction to Coding Theory. Springer, Berlin (1982) 5. Marcus, S.: Contextual Grammars. Rev. Roum. Math. Pures Appl. 14, 1525–1534 (1969) 6. Marcus, S.: Contextual Grammars and Natural Languages. In: Rozenberg, G., Salomaa, A. (eds.) The Handbook of Formal Languages, pp. 215–235. Springer, Heidelberg (1997) 7. Mateescu, A., Salomaa, A., Salomaa, K., Yu, S.: Lexical Analysis With Simple Finite-FuzzyAutomaton Model. J. Universal Computer Science 1, 288–307 (1996) 8. McGeoch, D.J.: Molecular Evolution of Large DNA Viruses of Eukaryotes. Seminars in Virology 3, 399–408 (1992) 9. Mitrana, V.: Contextual Insertion and Deletion. In: P˘aun, G. (ed.) Mathematical Linguistics and Related Topics, pp. 271–278. The Publishing House of the Romanian Academy (1994) 10. Oflezer, K.: Error-Tolerant Finite State Recognition. In: Proceedings of the Fourth International Workshop on Parsing Technologies, Prague, pp. 196–207 (September 20-24, 1995) 11. P˘aun, G.: Marcus Contextual Grammars. Kluwer, Dordrecht (1997) 12. Rozenberg, G., Salomaa, A. (eds.): The Handbook of Formal Languages. Springer, Heidelberg (1997)
A General Framework for Regulated Rewriting Based on the Applicability of Rules Rudolf Freund1 , Marian Kogler1,2 , and Marion Oswald1,3 1
Faculty of Informatics, Vienna University of Technology Favoritenstr. 9–11, 1040 Vienna, Austria {rudi,marian,marion}@emcc.at 2 Institute of Computer Science Martin Luther University Halle-Wittenberg Von-Seckendorff-Platz 1, 06120 Halle (Saale), Germany [email protected] 3 Computer and Automation Research Institute Hungarian Academy of Sciences Kende utca 13–17, 1111 Budapest, Hungary [email protected]
Abstract. We introduce a general model for various mechanisms of regulated rewriting based on the applicability of rules, especially we consider graph-controlled, programmed, matrix, random context, and ordered grammars as well as some basic variants of grammar systems. Most of the general relations between graph-controlled grammars, matrix grammars, random-context grammars, and ordered grammars established in this paper are independent from the objects and the kind of rules and only based on the notion of applicability of rules within the different regulating mechanisms and their specific structure in allowing sequences of rules to be applied. For example, graph-controlled grammars are always at least as powerful as programmed and matrix grammars. For the simulation of random context and ordered grammars by matrix and graph-controlled grammars, some specific requirements have to be fulfilled by the types of rules.
1 Introduction The monograph on regulated rewriting by J¨urgen Dassow and Gheorghe P˘aun [5] gave a first comprehensive overview on the basic concepts of regulated rewriting, especially for the string case. Yet as it turned out later, many of the mechanisms considered there for guiding the application of productions/rules can also be applied to other objects than strings, e.g., to n-dimensional arrays [7]. Even in the emerging field of P systems [13,19] where mostly multisets are considered, such regulating mechanisms were used [1]. As we shall exhibit in this paper, for comparing the generating power of grammars working in the sequential derivation mode, several relations between various regulating mechanisms can be established in a very general setting without any reference to the underlying objects the rules are working on. For this purpose, we introduce a general J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 35–53, 2011. c Springer-Verlag Berlin Heidelberg 2011
36
R. Freund, M. Kogler, and M. Oswald
model for graph-controlled, programmed, random-context, and ordered grammars of arbitrary type based on the applicability of rules. Moreover, we consider hybrid grammar systems working with the basic modes ∗, t, and ≤ k, = k, ≥ k for k ≥ 1. In the second section, we recall some notions from formal language theory, introduce our general framework for grammars and give some illustrative examples; then we define the models of regulated rewriting mentioned above in our general framework. Specific results on relations between the mechanisms introduced in the previous section are established in section three. Finally, we discuss some future research topics extending the notions and results considered in this paper.
2 Definitions After some preliminaries from formal language theory, we define our general model for grammars and recall some notions for string, array, and multiset grammars and languages in the general setting of this paper. Moreover, we give some examples illustrating the expressiveness of our general framework. Then we formulate the models of graph-controlled, programmed, matrix grammars with and without appearance checking, as well as random-context grammars, based on the applicability of rules. Finally, we give a definition of (hybrid) cooperating distributed grammar systems within our framework. 2.1 Preliminaries The set of integers is denoted by Z, the set of non-negative integers by N. An alphabet V is a finite non-empty set of abstract symbols. Given V , the free monoid generated by V under the operation of concatenation is denoted by V ∗ ; the elements of V ∗ are called strings, and the empty string is denoted by λ; V ∗ \ {λ} is denoted by V + . Let {a1 , ..., an } be an arbitrary alphabet; the number of occurrences of a symbol ai in x is denoted by |x|ai ; the Parikh vector associated with x with respect to a1 , ..., an is |x|a1 , ..., |x|an . The Parikh image of a language L over {a1 , ..., an } is the set of all Parikh vectors of strings in L, and we denote it by P s (L). For a family of languages F L, the family of Parikh images of languages in F L is denoted by P sF L. A (finite) multiset over the (finite) alphabet V , V = {a1 , ..., an }, is a mapping f : V −→ N and represented by f (a1 ) , a1 ... f (an ) , an or by any string x the Parikh vector of which with respect to a1 , ..., an is (f (a1 ) , ..., f (an )). In the following we will not distinguish between a vector (m1 , ..., mn ) , its representation by a multiset m1 , a1 ...mn , an or its representation by a string x having the Parikh vector |x|a1 , ..., |x|an = (m1 , ..., mn ). Fixing the sequence of symbols a1 , ..., an in the alphabet V in advance, the representation of the multiset m1 , a1 ... mn , an by the mn 1 string am 1 ...an is unique. The set of all finite multisets over an alphabet V is denoted o by V . For more details of formal language theory the reader is referred to the monographs and handbooks in this area[5,17].
A General Framework for Regulated Rewriting Based on the Applicability of Rules
37
2.2 A General Model for Sequential Grammars In the following, we shall deal with various types of objects and grammars, hence, we first define a general model of a grammar generating a set of terminal objects by derivations where in each derivation step exactly one rule is applied (sequential derivation mode) to exactly one object. The model we propose in this paper does not cover rules involving more than one object – as, for example, splicing rules – or other derivation modes – as, for example, the maximally parallel mode considered in many variants of P systems [13,15]. A (sequential) grammar G is a construct (O, OT , w, P, =⇒G ) where – – – – –
O is a set of objects; OT ⊆ O is a set of terminal objects; w ∈ O is the axiom (start object); P is a finite set of rules; =⇒G ⊆ O × O is the derivation relation of G. We assume that each of the rules p ∈ P induces a relation =⇒p ⊆ O × O with respect to =⇒G fulfilling at least the following conditions: (i) for each object x ∈ O, (x, y) ∈ =⇒p for only finitely many objects y ∈ O; (ii) there exists a finitely described mechanism as, for example, a Turing machine, which, given an object x ∈ O, computes all objects y ∈ O such that (x, y) ∈ =⇒p . A rule p ∈ P is called applicable to an object x ∈ O if and only if there exists at least one object y ∈ O such that (x, y) ∈ =⇒p ; we also write x =⇒p y. The derivation relation =⇒G is the union of all =⇒p , i.e., =⇒G = p∈P =⇒p . The reflexive and transitive closure ∗
of =⇒G is denoted by =⇒G . In the following we shall consider different types of grammars depending on the components of G (where the set of objects O is infinite, e.g., V ∗ , the set of strings over the alphabet V ), especially with respect to different types of rules (e.g., context-free string rules). Some specific conditions on the elements of G, especially on the rules in P , may define a special type X of grammars which then will be called grammars of type X. The language generated by G is the set of all terminal objects (we also assume v ∈ OT to be decidable for every v ∈ O) derivable from the axiom, i.e., ∗ L (G) = v ∈ OT | w =⇒G v . The family of languages generated by grammars of type X is denoted by L (X). In an even more general definition, we might allow a finite set of axioms {wi | 1 ≤ i ≤ m} instead of a single axiom w only, i.e., we might consider grammars of the form G = (O, OT , {wi | 1 ≤ i ≤ m} , P, =⇒G ) with L (G) = 1≤i≤m {v ∈ OT | ∗ wi =⇒G v . Yet as the derivations from each of the axioms wi are independent from each other in this setting of a sequential grammar where the results of different derivation steps do not interact, we immediately infer L (G) = 1≤i≤m L (Gi ) for Gi = (O, OT , wi , P, =⇒G ), 1 ≤ i ≤ m. Due to this observation, we restrict ourselves to a single axiom throughout the rest of this paper.
38
R. Freund, M. Kogler, and M. Oswald
Let G = (O, OT , w, P, =⇒G ) be a grammar of type X. If for every G of type X we have OT = O, then X is called a pure type, otherwise it is called extended; X is called strictly extended if for any grammar G of type X, w ∈ / OT and for all x ∈ OT , no rule from P can be applied to x. In many cases, the type X of the grammar allows for (one or even both of the) following features: A type X of grammars is called a type with unit rules if for every grammar G =(O, OT , w, P, =⇒G ) of type X there exists a grammar G= O, OT , w, P ∪ P (+) ,=⇒G of type X such that =⇒G ⊆ =⇒G and – P (+) = p(+) | p ∈ P , – for all x ∈ O, p(+) is applicable to x if and only if p is applicable to x, and – for all x ∈ O, if p(+) is applicable to x, the application of p(+) to x yields x back again. A type X of grammars is called a type with trap rules if for every grammar G = (O, there exists a grammar OT , w, P, =⇒G ) of type X G = O, OT , w, P ∪ P (−) , =⇒G of type X such that =⇒G ⊆ =⇒G and – P (−) = p(−) | p ∈ P , – for all x ∈ O, p(−) is applicable to x if and only if p is applicable to x, and – for all x ∈ O, if p(−) is applicable to x, the application of p(−) to x yields an object y from which no terminal object can be derived anymore. String Grammars. In the general notion as defined above, a string grammar GS is represented as (N ∪ T )∗ , T ∗ , w, P, =⇒P where N is the alphabet of non-terminal symbols, T is the alphabet of terminal symbols, + N ∩ T = ∅, w ∈ (N ∪ T ) , P is a finite set of rules of the form u → v with u ∈ V ∗ (for generating grammars, u ∈ V + ) and v ∈ V ∗ (for accepting grammars, v ∈ V + ), with V := N ∪ T ; the derivation relation for u → v ∈ P is defined by xuy =⇒u→v xvy for all x, y ∈ V ∗ , thus yielding the well-known derivation relation =⇒GS for the string grammar GS . In the following, we shall also use the common notation GS = (N, T, w, P ) instead, too. We remark that, usually, the axiom w is supposed to be a non-terminal symbol, i.e., w ∈ V \ T , and is called the start symbol. Moreover, in contrast to the standard definition of a so-called phrase structure grammar, we do not require the left-hand side u of a rule u → v in such a generating grammar to contain at least one non-terminal symbol from N . As special types of string grammars we consider string grammars with arbitrary rules, context-free rules of the form A → v with A ∈ N and v ∈ V ∗ , and (right-) regular rules of the form A → v with A ∈ N and v ∈ T N ∪ {λ}. The corresponding types of grammars are denoted by ARB, CF , and REG, thus yielding the families of languages L (ARB), i.e., the family of recursively enumerable languages, as well as L (CF ), and L (REG), i.e., the families of context-free, and regular languages, respectively. As special subclasses of REG we shall also consider the types REGi for i ≥ 1,
A General Framework for Regulated Rewriting Based on the Applicability of Rules
39
denoting regular grammars using at most i non-terminal symbols, and the corresponding families of languages L (REGi ). Observe that the types ARB and CF are types with unit rules and trap rules (for / T is a p = w → v ∈ P , we can take p(+) = w → w and p(−) = w → F where F ∈ new symbol – the trap symbol), whereas the type REG (in the definition given above, but also in the more common definition where one takes v ∈ T N ∪ T ) is not a type with unit rules; therefore, we will also consider the type REG with regular rules of the most general form A → v with A ∈ N and v ∈ T ∗ N ∪ T ∗ and allow arbitrary axioms w ∈ (N ∪ T )∗ , and denote the corresponding family of languages by L (REG ). It is folklore that L (REG ) = L (REG). In the following, we give some examples for string grammars of specific types illustrating the expressive power of our general framework: Example 1. Let L be a recursive language over the alphabet T . Then consider the following grammar GL , GL = (T ∗ {S}, T ∗, S, P, =⇒GL ) , with the following rules in P : – S → aS for all a ∈ T ; – S → λ provided the underlying string is in L{S}. Using the rules S → aS we can derive any string wS with w ∈ T ∗ ; by the last rule, wS =⇒G w if and only if w ∈ L; hence L (GL ) = L. The rule checking for the underlying string to be in a recursive set may look strange, but in fact in many models known from the literature, the application of rules depends on some specific feature of the object derived so far. Yet usually these mechanisms are so powerful that the checking sets are much less complex than recursive sets. In the following two examples, we only need regular sets of strings (of even quite restricted forms): Example 2. In the usual definition of random context grammars, a context-free rule p is applicable if and only if some specific symbols from a subset R of the set of nonterminal symbols N occur in the underlying string and some other symbols of a specific set Q ⊂ N do not appear in this string; such a rule then is written as (p, R, Q). This condition – specified by the sets R, R = {Xi | 1 ≤ i ≤ m} for some m ≥ 0, and Q – could also be specified by the corresponding regular set L (N, R, Q) with L (N, R, Q) = {{i1 ,...,im }|{Xi |1≤j≤m}=R} j ∗ ∗ ∗ (N \ Q) {Xi1 } . . . (N \ Q) {Xim } (N \ Q) , i.e., we could also say that p is applicable if and only if the underlying string is in L (N, R, Q). During the last two decades, many models inspired by biology have appeared in the area of formal language theory. In the following example we describe a (special variant of the) model of networks of evolutionary processors [4] which reflects the derivation
40
R. Freund, M. Kogler, and M. Oswald
strategy of test tube systems – here the tubes are called (evolutionary) processors – and uses very restricted forms of string rewriting rules. In contrast to the preceding two examples where we consider derivations yielding step by step another string by choosing a rule to be applied in a non-deterministic way, in biologically motivated examples as the following one of networks of processors the whole set of possible evolutions is taken into account in parallel in each step yielding a new configuration. Because the objects do not interact as, for example, in test tube systems with splicing rules[3], in contrast to the original definitions, we need not consider objects that cannot pass any filter to another tube (processor) for further evolution; moreover, we can view these systems even as sequential grammars when looking at only one of the possible evolutions from an axiom to a terminal object: Example 3. A network of evolutionary processors with filters of type X is a construct E = (V, E1 , . . . , En , D, i0 ) where – V is a finite alphabet, – Ei = (Ri , Ai ), 1 ≤ i ≤ n, are the evolutionary processors with Ri being a set of rules of the forms a → b, a, b ∈ V (substitution rules), a → λ, a ∈ V (deletion rules) or λ → a, a ∈ V (insertion rules) and Ai being a finite subset of V ∗ , – D is a finite set of filters between the processors of the form (i, F, j), 1 ≤ i, j ≤ n, and F ⊆ V ∗ ∩ L (X), – i0 is the final processor, 1 ≤ i0 ≤ n. A configuration C of E is an n-tuple (C1 , . . . , Cn ), Ci ⊂ V ∗ , 1 ≤ i ≤ n, describing the contents of processor i. The computation in E starts with the initial configuration C (0), C (0) = (C1 (0) , . . . , Cn (0)), with Ci (0) = Ai , 1 ≤ i ≤ n. A computation step in E leading from the configuration C (t), C (t) = (C1 (t) , . . . , Cn (t)) to the configuration C (t + 1), C (t + 1) = (C1 (t + 1) , . . . , Cn (t + 1)), t ≥ 0, is defined as follows: Cj (t + 1) = ((Ri (Ci (t)) ∪ Ci (t)) ∩ F ) , 1 ≤ j ≤ n, (i,F,j)∈D
where Ri (Ci (t)) = {uβv | uαv ∈ Ci (t) , α → β ∈ Ri } describes the set of all strings obtained by applying one rule from Ri to any string in Ci (t). The computation step can be divided into two substeps – first the rules from Ri in each processor i are applied to its current contents Ci (t) and then the newly obtained contents Ri (Ci (t)) ∪ Ci (t) is distributed to all processors according to the filters from D. The language computed by Econsists of all strings ever appearing in the contents of processor i0 , i.e., L (E) = t≥0 Ci0 (t). The family of languages generated by networks of evolutionary processors with filters of type X is denoted by L (E (X)). Filters of type REG2 were shown to be sufficient for obtaining computational completeness [6], i.e. L (E (REG2 )) = L (RE), which means that with respect to the hierarchy of the types REGi the optimal result holds. The rather complicated definition of a network of processors can be reduced to a much simpler model based on sequential grammars as follows: Consider a network of processors GN P of type X with filters of type Y to be a construct GN P = (G, R1 , . . . , Rn , B, D, io , if , =⇒GN P )
A General Framework for Regulated Rewriting Based on the Applicability of Rules
41
where G = (O, OT , w, P, =⇒G ), and the grammars Gi = (O, OT , w, Pi , =⇒Gi ), 1 ≤ i ≤ n, are grammars of type X, the derivation relations =⇒Gi being the restrictions of =⇒G only induced by the corresponding rule sets Ri , B is a finite set of labels, and D ⊂ B × L (Y ) × B is a finite set of filters. For x, y ∈ O and i, j ∈ B we define (x, i) =⇒GN P (y, j) if and only if x =⇒Gi y and y ∈ F for some (i, F, j) ∈ D. The language generated by GN P is defined by L(GN P ) = v ∈ OT | (w, i0 ) =⇒∗GN P (v, if ) . Let L (N P (X, Y )) denote the family of languages generated by networks of processors GN P of type X with filters of type Y , then, with SID denoting the type of grammars using the evolutionary rules (substitution, insertion, deletion) as defined above, we again have L (N P (SID, REG2 )) = L (RE). This computational completeness result immediately follows from L (E (REG2 )) = L (RE), as the possibility to have axioms in more than one processor, which makes the main difference between the two models, is a feature not needed for obtaining full computational power. Array Grammars. We now introduce the basic notions for n-dimensional arrays and array grammars [7,16,18]. Let d ∈ N. Then a d-dimensional array A over an alphabet V is a function A : Zd → V ∪ {#}. shape (A) = v ∈ Zd | A (v) = # is finite and # ∈ / V is called the background or blank symbol. We usually write A = {(v, A (v)) | v ∈ shape (A)}. The set of all d-dimensional arrays over V is denoted by V ∗d . The empty array in V ∗d with empty shape is denoted by Λd . Moreover, we define V +d = V ∗d \ {Λd }. Let v ∈ Zd , v = (v1 , . . . , vd ). The translation τv : Zd → Zd is defined by τv (w) = w + v for all w ∈ Zd , and for any array A ∈ V ∗d we define τv (A), the corresponding d-dimensional array translated by v, by (τv (A)) (w) = A (w − v) for all w ∈ Zd . The vector (0, . . . , 0) ∈ Zd is denoted by Ωd . A d -dimensional array rule p over V is a triple (W, A1 , A2 ), where W ⊆ Zd is a finite set and A1 and A2 are mappings from W to V ∪ {#} such that shape (A1 ) = ∅. We say that the array B2 ∈ V ∗d is directly derivable from the array B1 ∈ V ∗d by the d-dimensional array rule (W, A1 , A2 ), i.e., B1 =⇒p B2 , if and only if there exists a vector v ∈ Zd such that B1 (w) = B2 (w) for all w ∈ Zd \ τv (W ) as well as B1 (w) = A1 (τ−v (w)) and B2 (w) = A2 (τ−v (w)) for all w ∈ τv (W ), i.e., the subarray of B1 corresponding to A1 is replaced by A2 , thus yielding B2 . In the following, we shall also write A1 → A2 , because W is implicitly given by the finite arrays A1 , A2 . A d -dimensional array grammar GA is represented as
∗d (N ∪ T ) , T ∗d , {(v0 , S)} , P, =⇒GA where – – – –
N is the alphabet of non-terminal symbols; T is the alphabet of terminal symbols, N ∩ T = ∅; {(v0 , S)} is the start array (axiom) with S ∈ N and v0 ∈ Zd ; P is a finite set of d-dimensional array rules over V , V := N ∪ T ;
42
R. Freund, M. Kogler, and M. Oswald
– =⇒GA is the derivation relation induced by the array rules in P according to the explanations given above, i.e., for arbitrary B1 , B2 ∈ V ∗d , B1 =⇒GA B2 if and only if there exists a d-dimensional array rule p = (W, A1 , A2 ) in P such that B1 =⇒p B2 . A d-dimensional array rule p = (W, A1 , A2 ) in P is called #-context-free, if shape (A1 ) = {Ωd }. A d-dimensional array grammar is said to be of type d-ARBA, d-#-CF A if every array rule in P is of the corresponding type, i.e., an arbitrary and #-context-free d-dimensional array rule, respectively. The corresponding families of d-dimensional array languages of type X are denoted by L (X), i.e., L (d-ARBA) and L (d-#-CF A) are the families of recursively enumerable and #-context-free d-dimensional array languages, respectively. Observe that the types d-ARBA and d-#-CF A are types with unit rules and trap rules – for p = (W, A1 , A2 ), we can take p(+) = (W, A1 , A1 ) and p(−) = (W, A1 , AF ) with AF (v) = F for v ∈ shape (A1 ) and AF (v) = # for v ∈ / shape (A1 ), where F is a new non-terminal symbol – the trap symbol. Multiset Grammars. A multiset grammar [1] Gm is of the form ((N ∪ T )o , T o , w, P, =⇒Gm ) where N is the alphabet of non-terminal symbols, T is the alphabet of terminal symbols, N ∩ T = ∅, w is a non-empty multiset over V , V := N ∪ T , and P is a (finite) set of multiset rules yielding a derivation relation =⇒Gm on the multisets over V ; the application of the rule u → v to a multiset x has the effect of replacing the multiset u contained in x by the multiset v. For the multiset grammar Gm we also write (N, T, w, P, =⇒Gm ). As special types of multiset grammars we consider multiset grammars with arbitrary rules, context-free rules of the form A → v with A ∈ N and v ∈ V o , and regular rules of the form A → v with A ∈ N and v ∈ T o N ∪ T o ; the corresponding types X of multiset grammars are denoted by mARB, mCF , and mREG, thus yielding the families of multiset languages L (X). Observe that all these types mARB, mCF , and mREG are types with unit rules and trap rules (for p = w → v ∈ P , we can take p(+) = w → w and p(−) = w → F where F is a new symbol – the trap symbol). Even with arbitrary multiset rules, it is not possible to get P s (L (ARB)) [10]: P s (L (REG)) = L (mREG) = L (mCF ) = P s (L (CF )) L (mARB) P s (L (ARB)) . Example 4. Consider the following multiset grammar Gm , Gm = ({A, C, D}, {a, b} , Cab, P, =⇒Gm ) , P = {Da → DAA, CA → Ca, C → Db, D → C, C → λ} . Each time when a new terminal symbol b is introduced by the rule C → Db, the number of symbols a can be at most doubled by repeatedly applying the rule Da → DAA and then, after having applied C → bD, renaming the non-terminal symbols A to symbols a again. Thus, the terminal multisets obtained after the application of C → λ are b, na, m with n ≥ 1 and 1 ≤ m ≤ 2n−1. As the n−1 set (n, m) | n ≥ 1, 1 ≤ m ≤ 2 is not semi-linear, L (Gm ) ∈ L (mARB) \ P s (L (CF )).
A General Framework for Regulated Rewriting Based on the Applicability of Rules
43
As a computationally complete model able to accept all sets in P s (L (ARB)) we will use deterministic register machines: A deterministic register machine is a construct M = (n, H, p0 , ph , I) where n, n ≥ 1, is the number of registers, B is the set of instruction labels, p0 is the start label, ph is the halting label (only used for the HALT instruction), and I is a set of (labeled) instructions, where every i ∈ I is of one of the following forms: – pi : (ADD (r) , pj ) increments the value in register r and continues with the instruction labeled by pj , – pi : (SUB (r) , pj , pk ) decrements the value in register r and continues the computation with the instruction labeled by pj if the register was non-empty, otherwise it continues with the instruction labeled by pk ; – ph : HALT halts the machine. A deterministic register machine accepts a (vector of) natural numbers by starting with the number(s) as input in the first register(s), with all other registers being empty. Starting from the instruction labeled by p0 , the instructions are applied and the contents of the registers changed; if and when the machine reaches ph and therefore halts, the vector or number is accepted. Register machines can accept all recursively enumerable sets of (vectors of) natural numbers (with k components) with k + 2 registers [11]. 2.3 Graph-Controlled and Programmed Grammars A graph-controlled grammar (with appearance checking) of type X is a construct GGC = (G, g, Hi , Hf , =⇒GC ) where G = (O, OT , w, P, =⇒G ) is a grammar of type X; g = (H, E, K) is a labeled graph where H is the set of node labels identifying the nodes of the graph in a one-toone manner, E ⊆ H × {Y, N } × H is the set of edges labeled by Y or N , K : H → 2P is a function assigning a subset of P to each node of g; Hi ⊆ H is the set of initial labels, and Hf ⊆ H is the set of final labels. The derivation relation =⇒GC is defined based on =⇒G and the control graph g as follows: For any i, j ∈ H and any u, v ∈ O, (u, i) =⇒GC (v, j) if and only if either – u =⇒p v by some rule p ∈ K (i) and (i, Y, j) ∈ E (success case), or – u = v, no p ∈ K (i) is applicable to u, and (i, N, j) ∈ E (failure case). The language generated by GGC is defined by L(GGC ) = v ∈ OT | (w, i) =⇒∗GGC (v, j) , i ∈ Hi , j ∈ Hf . If Hi = Hf = H, then GGC is called a programmed grammar. The families of languages generated by graph-controlled and programmed grammars of type X are denoted by L (X-GCac ) and L (X-Pac ), respectively. If the set E contains no edges of the form (i, N, j), then the graph-controlled grammar is said to be without appearance checking; the corresponding families of languages are denoted by L (X-GC) and L (X-P ), respectively. The notion without appearance checking (ac for short) comes from the fact that in the original definition the appearance of the non-terminal symbol on the left-hand side of a context-free rule was checked; in our general model, the notion without applicability checking would even be more adequate.
44
R. Freund, M. Kogler, and M. Oswald
2.4 Matrix Grammars A matrix grammar (with appearance checking) of type X is a construct GM = (G, M, F, =⇒GM ) where G = (O, OT , w, P, =⇒G ) is a grammar of type X, M is a finite set of sequences of the form (p1 , . . . , pn ), n ≥ 1, of rules in P , and F ⊆ P . For w, z ∈ O we write w =⇒GM z if there are a matrix (p1 , . . . , pn ) in M and objects wi ∈ O, 1 ≤ i ≤ n + 1, such that w = w1 , z = wn+1 , and, for all 1 ≤ i ≤ n, either – wi =⇒G wi+1 or – wi = wi+1 , pi is not applicable to wi , and pi ∈ F . L(GM ) = v ∈ OT | w =⇒∗GM v is the language generated by GM . The family of languages generated by matrix grammars of type X is denoted by L (X-M ATac ). If the set F is empty, then the grammar is said to be without appearance checking; the corresponding family of languages is denoted by L (X-M AT ). 2.5 Random-Context Grammars The following general notion of a random context-grammar was already introduced recently [8], [1] in a similar way. A random-context grammar GRC of type X is a construct (G, P , =⇒GRC ) where – G = (O, OT , w, P, =⇒G ) is a grammar of type X; – P is a set of rules of the form (q, R, Q) where q ∈ P , R ∪ Q ⊆ P ; – =⇒GRC is the derivation relation assigned to GRC such that for any x, y ∈ O, x =⇒GRC y if and only if for some rule (q, R, Q) ∈ P , x =⇒q y and, moreover, all rules from R are applicable to x as well as no rule from Q is applicable to x. A random-context grammar GRC = (G, P , =⇒GRC ) of type X is called a grammar with permitting contexts of type X if for all rules (q, R, Q) in P we have Q = ∅, i.e., we only check for the applicability of the rules in R. A random-context grammar GRC = (G, P , =⇒GRC ) of type X is called a grammar with forbidden contexts of type X if for all rules (q, R, Q) in P we have R = ∅, i.e., we only check for the non-applicability of the rules in Q. L(GRC ) = v ∈ OT | w =⇒∗GRC v is the language generated by GRC . The families of languages generated by random context grammars, grammars with permitting contexts, and grammars with forbidden contexts of type X are denoted by L (X-RC), L (X-pC), and L (X-f C), respectively. 2.6 Ordered Grammars An ordered grammar GO of type X is a construct (G, <, =⇒GO ) where – G = (O, OT , w, P, =⇒G ) is a grammar of type X; – < is a partial order relation on the rules from P ;
A General Framework for Regulated Rewriting Based on the Applicability of Rules
45
– =⇒GO is the derivation relation assigned to GO such that for any x, y ∈ O, x =⇒GO y if and only if for some rule q ∈ P x =⇒q y and, moreover, no rule p from P with p > q is applicable to x. L(GO ) = v ∈ OT | w =⇒∗GO v is the language generated by GO . The family of languages generated by ordered grammars of type X is denoted by L (X-O). 2.7 Cooperating Distributed Grammar Systems Basic results on the generating power of hybrid cooperating distributed grammar systems were established by Mitrana[12] and by P˘aun[14]; a general overview on this area of formal language theory is given in the monograph by Csuhj-Varj´u, Dassow, Kelemen, and P˘aun[2]. Let G = (O, OT , w, P, =⇒G ) be a grammar of type X; for the basic derivation modes from B = {∗, t} ∪ {≤ k, = k, ≥ k | k ≥ 1} and any objects u, v ∈ O we define – u =⇒∗G v to denote the usual reflexive and transitive closure of =⇒G ; – u =⇒tG v if and only if u =⇒∗G v and no rule from P is applicable to v; ≥k =k ∗ – u =⇒≤k G v, u =⇒G v, u =⇒G v if and only if u =⇒G v in at most k, exactly k, at least k derivation steps. A hybrid cooperating distributed grammar system (HCD system for short) GHCD of degree n and type X working in the derivation modes from B ⊆ B is a construct GHCD = (G, P1 , . . . , Pn , f1 , . . . , fn , =⇒GHCD ) n where Pi ⊆ P and fi ∈ B for 1 ≤ i ≤ n, i=1 Pi = P , and the grammars G and Gi = (O, OT , w, Pi , =⇒Gi ), 1 ≤ i ≤ n, are grammars of type X, the derivation relations =⇒Gi being the restrictions of =⇒G only induced by the corresponding rule sets Pi . For any u, v ∈ O, we define u =⇒GHCD v if and only if u =⇒fGii v for some i, 1 ≤ i ≤ n. We remark that the component Pi , i.e., the grammar Gi , in each step of the derivation in GHCD is chosen in a non-deterministic way, which also means that even the same component may be taken several times in a row. A cooperating distributed grammar system (CD system for short) GCD of degree n and type X working in the derivation mode f with f ∈ B is a special case of a hybrid cooperating distributed grammar system where all derivation modes fi equal f , i.e., a construct GCD = (G, P1 , . . . , Pn , f, =⇒GCD ) where Pi ⊆ P for 1 ≤ i ≤ n, n i=1 Pi = P , and the grammars G and Gi = (O, OT , w, Pi , =⇒Gi ), 1 ≤ i ≤ n, are grammars of type X. For any u, v ∈ O, we define u =⇒GCD v if and only if u =⇒fGi v for some i, 1 ≤ i ≤ n. The language generated by GHCD is defined by L(GHCD ) = v ∈ OT | w =⇒∗GHCD v .
46
R. Freund, M. Kogler, and M. Oswald
The family of languages generated by hybrid grammar systems of degree n and of type X working in derivation modes from B is denoted by L (X-HCDn (B )), the family of languages generated by grammar systems of degree n and of type X working in the derivation mode f is denoted by L (X-CDn (f )); in both cases we replace n by ∗ if we consider arbitrary degrees. In the following we will especially take into account B0 = {∗, = 1, ≥ 1} ∪ {≤ k | k ≥ 1} as a special subset of B.
3 Results In this section, we elaborate some general results holding true for many types of grammars. Some results even hold for any type X, whereas some of them rely on some specific conditions on X. Moreover, we shall recall some well-known results for strings, arrays, and multisets, and we give new simple proofs based on the general results shown in this paper for specific relations between some regulating mechanisms. 3.1 General Results for Arbitrary Types Our first results are obvious from the definitions: Lemma 1. For any type X, – L (X-Pac ) ⊆ L (X-GCac ) and L (X-P ) ⊆ L (X-GC); – L (X-pC) ⊆ L (X-RC) and L (X-f C) ⊆ L (X-RC). Although the equivalence of graph-controlled and programmed grammars can be established for many common types of grammars, the model of programmed grammars has a serious drawback - in programmed grammars we are not able to specify where to start the derivations, which, for example, may lead to a higher degree of descriptional complexity, e.g., with respect to the number of non-terminal symbols needed to obtain computational completeness [9], or even may lead to less computational power (see Example 5). The following inclusion is obvious from the definitions, too, but as we shall show later, it can be strict (e.g., in the case of strings for X = CF ) or an equality (e.g., in the case of 2-dimensional arrays for X = 2-#-CF A). Lemma 2. For any Y ∈ {M AT, P, GC} and any type X, L (X-Y ) ⊆ L (X-Yac ) . Our next result shows that each of the regulating mechanisms introduced in the preceding section cannot reduce the generating power of the underlying type of grammars: Lemma 3 L (X) ⊆ L (X-Y ) for any Y ∈ {O, pC, f C, RC, M AT, M ATac , P, Pac , GC, GCac } and any type X.
A General Framework for Regulated Rewriting Based on the Applicability of Rules
47
Proof. Let G = (O, OT , w, P, =⇒G ) be a grammar of type X. Then L (GO ) = L (GRC ) = L (GM ) = L (GGC ) = L (G) for – the graph-controlled grammar GGC = (G, g, Hi , Hf , =⇒GC ) with g = ({1} , {(1, Y, 1)} , {(1, P )}) and Hi = Hf = {1}; – the matrix grammar GM = (G, M, ∅, =⇒GM ) with M = {(q) | q ∈ P }; – the random context grammar GRC = (G, P , =⇒GRC ) with P = {(q, ∅, ∅) | q ∈ P }; – the ordered grammar GO = (G, <, =⇒GO ) with < being the empty order relation. The results for the remaining regulating mechanisms immediately follow from the constructions given above. As can be seen from the following result, matrix grammars (with or without appearance checking) are a special case of graph-controlled grammars (with or without appearance checking): Theorem 1. L (X-M ATac ) ⊆ L (X-GCac ) and L (X-M AT ) ⊆ L (X-GC). Proof. Let GM = (G, M, F, =⇒GM ) be a matrix grammar with G = (O, OT , w, P, =⇒G ) being a grammar of type X; let M = {(pi,1 , . . . , pi,ni ) | 1 ≤ i ≤ n} with pi,j ∈ P , 1 ≤ j ≤ ni , 1 ≤ i ≤ n. Then we construct the graph-controlled grammar GGC = (G, g, Hi , Hf , =⇒GC ) with g = (H, E, K), H = {(i, j) | 1 ≤ j ≤ ni , 1 ≤ i ≤ n}, K ((i, j)) = {pi,j }, 1 ≤ j ≤ ni , 1 ≤ i ≤ n, and E = {((i, j) , Y, (i, j + 1)) | 1 ≤ j < ni , 1 ≤ i ≤ n} ∪ {((i, j) , N, (i, j + 1)) | 1 ≤ j < ni , 1 ≤ i ≤ n, pi,j ∈ F } ∪ {((i, ni ) , Y, (j, 1)) | 1 ≤ j ≤ n, 1 ≤ i ≤ n} ∪ {((i, ni ) , N, (j, 1)) | 1 ≤ j ≤ n, 1 ≤ i ≤ n, pi,j ∈ F } as well as Hi = Hf = {(i, 1) | 1 ≤ i ≤ n}. We mention that there are definitions where the sequential application of the rules of the chosen matrix may stop at any moment, in which case we have to take Hf = H. By this construction it is guaranteed that GGC simulates a derivation in GM correctly by choosing a matrix to be simulated in a nondeterministic way and then applying the rules from this matrix in the desired sequence; the application of a rule pi,j may be skipped if and only if pi,j ∈ F ; hence, GGC is without appearance checking if and only if GM is without appearance checking, which observation completes the proof. The following theorem shows that forbidden contexts can simulate a partial order relation on the rules:
48
R. Freund, M. Kogler, and M. Oswald
Theorem 2. L (X-O) ⊆ L (X-f C) for any arbitrary type X. Proof. Let G = (O, OT , w, P, =⇒G ) be a grammar of type X. Consider the ordered grammar GO = (G, <, =⇒GO ) of type X with G = (O, OT , w, P, =⇒G ) and the corresponding grammar with forbidden contexts GRC = (G, PRC , =⇒GRC ) of type X where PRC = {(p, ∅, Q (p)) | p ∈ P } with Q (p) = {q | q ∈ P, q > p}. It is easy to see that L (GRC ) = L (GO ), because a rule p ∈ P can be applied in GRC if and only if no rule from Q (p) is applicable which is the same condition as for the applicability of p in GO . Grammar Systems Lemma 4. For any type X, each derivation mode fi ∈ B0 in a HCD system GHCD = (G, P1 , . . . , Pn , f1 , . . . , fn , =⇒GHCD ) can be replaced by any other derivation mode from B0 . Proof. Let G = (O, OT , w, P, =⇒G ) and Gi = (O, OT , w, Pi , =⇒Gi ), 1 ≤ i ≤ n, with the derivation relations =⇒Gi being the restrictions of =⇒G only induced by the corresponding rule sets Pi , be the underlying grammars of type X. By the definition of a derivation step in a grammar Gi , a derivation of length m in Gi can be simulated by m successive uses of this grammar for just one derivation step. Hence, instead of making m steps in the derivation modes ∗, ≥ 1 or m ≤ k steps in the derivation mode ≤ k we instead can make m times exactly one derivation step in any of the modes ∗, = 1, ≥ 1, or ≤ k. Therefore, the results of derivations in Gi in any of the modes from B0 are equal, i.e., each mode from B0 can be replaced by any other mode from B0 without influencing the generating power of the HCD system. The following result is an immediate consequence of the preceding lemma and the definitions of derivations in a grammar and in CD systems: Theorem 3. For any type X and any derivation mode f ∈ B0 , L (X) = L (X-CD∗ (f )) . Proof. Due to Lemma 4, we only have to show L (X) = L (X-CD∗ (= 1)). Consider a CD system GCD = (G, P1 , . . . , Pn , = 1, =⇒GCD ) of type X with G = (O, OT , w, P, =⇒G ) and Gi = (O, OT , w, Pi , =⇒Gi ), 1 ≤ i ≤ n, being of type X. As the derivation relation =⇒G equals the union of the derivation relations =⇒Gi , each derivation step in G corresponds with a derivation step in one of the grammars Gi (and therefore in GCD ) and vice versa, hence, we obviously obtain L (GCD ) = L (G). 3.2 Results Depending on the Underlying Type The following example shows that the inclusions inverse to those established in Theorem 1 need not be true:
A General Framework for Regulated Rewriting Based on the Applicability of Rules
49
Example 5. According to the definition of the type REG1 , a grammar of type REG1 is of the form ({S} , T, S, P ) with P ⊆ {S → λ} ∪ {S → aS | a ∈ T }, hence, the only languages in L (REG1 ) are ∅, {λ}, and the languages T ∗ for any alphabet T . The language {a} can be generated by the matrix grammar GM , GM = ( {S} , {a} , S, {S → aS, S → λ} , =⇒{S→aS} ∪ =⇒{S→λ} , {(S → aS, S → λ)} , ∅, =⇒GM ), i.e., {a} ∈ L (REG1 -M AT ) ⊆ L (REG1 -Y ) for Y ∈ {M ATac , GC, GCac } according to Lemma 2 and Theorem 1, but {a} ∈ / L (REG1 -Y ) for any other Y ∈ {O, pC, f C, RC, P, Pac }: in order to erase the non-terminal symbol S one has to use the rule S → λ, yet none of these regulating mechanisms can avoid the direct derivation of λ from S by using this rule. Matrix grammars (with appearance checking) can simulate random context grammars for any arbitrary type X with unit rules and trap rules [1]: Theorem 4. For any arbitrary type X with unit rules and trap rules, L (X-RC) ⊆ L (X-M ATac ) . Proof. Consider a random-context grammar GRC = (G, PRC , =⇒GRC ) where G = (O, OT , w, P, =⇒G ) is a grammar of a type X with unit rules and trap rules; then we define the matrix grammar with appearance checking GM = (G , M, F, =⇒M ) of type X as follows: for each rule (p, R, Q) ∈ P RC , R = {ri | 1 ≤ i ≤ m}, Q = (+) (+) (−) (−) {qj | 1 ≤ j ≤ n}, m, n ≥ 0, we take the matrix r1 , . . . , rm , q1 , . . . , qn , p
into M . In that way we obtain G = (O, OT , w, P , =⇒G ) where P = P ∪ r(+) , q (−) | r ∈ R, q ∈ Q for some (p, R, Q) ∈ PRC and F = q (−) | q ∈ Q for some (p, R, Q) ∈ PRC . As X is a type with unit rules and trap rules, all the elements of GM are well defined. Obviously, for all x, y ∈ O we have x =⇒(p,R,Q) y if and only if x =⇒ r (+) ,...,r(+) ,q(−) ,...,q(−) ,p y, which implies i
L (GM ) = L (GRC ).
m
1
n
Omitting the forbidden rules and appearance checking, respectively, from the (proof of the) preceding theorem we immediately obtain the following result: Corollary 1. For any arbitrary type X with unit rules, L (X-pC) ⊆ L (X-M AT ) . Summarizing the main results of this paper obtained so far, we get the following relations between the specific regulating mechanisms, most of them even for arbitrary types X: Corollary 2. The following inclusions hold — for any arbitrary type X, - - for any type X with unit rules, . . . for any type X with unit rules and trap rules:
50
R. Freund, M. Kogler, and M. Oswald L(X-GCac )
((( ((((
hhhh hhh
L(X-Pac )
L(X-M ATac )
pp p "" " L(X-RC) " L(X-GC) " " " " " " L(X-P ) " L(X-M AT ) " b b L(X-f C) " " b L(X-pC) b b b
(((( L(X-O) b b
((( L(X)
Fig. 1. Hierarchy of control mechanisms for grammars of type X
Grammar Systems Theorem 5. For any strictly extended type X, L (X) = L (X-CD1 (t)). Proof. Consider a CD system GCD = (G, P, t, =⇒GCD ) with G = (O, OT , w, P, =⇒G ) being the underlying grammar of type X. As X is a strictly extended type, any derivation in G leading to a terminal object w is maximal, i.e., w ∈ L (GCD ), hence, L (G) ⊆ L (GCD ). On the other hand, as in GCD we only have one component using exactly the same rules as in G, we also have L (GCD ) ⊆ L (G), hence, we conclude L (G) = L (GCD ), and therefore L (X) = L (X-CD1 (t)). For any pure type X, the language generated by a grammar of type X at least contains the axiom, hence, ∅ ∈ / L (X). On the other hand, for a pure type X there may still exist rules applicable to any terminal object, hence, no derivation in the maximal mode t from the axiom may ever stop, i.e., ∅ ∈ L (X-CD1 (t)). Therefore the equality relation established in the preceding theorem between L (X) and L (X-CD1 (t)) need not be true for pure types, and, as the following example shows, L (X) and L (X-CD1 (t)) can even be uncomparable: Example 6. Consider grammars of the simple pure type X1 of the form
+ + + G (w, P ) = {a} , {a} , w, P, =⇒G with w ∈ {a} and P ⊆ a → a2 . Obvi m 2 ously, L (G (w,∅)) = {w}, and L = {an | n ≥ m}, hence, we G a , a→a + get L (X1 ) = {w} | w ∈ {a} ∪ {{an | n ≥ m} | m ≥ 1}. The CD1 (t) systems are of the P , t, =⇒GCD ), with L (GCD (w, P, ∅)) = {w} form GCD (w, P, P ) = (G,2 2 and L GCD w, a → a , a → a = ∅. Thus, we obtain L (X1 ) \ L (X1 -CD1 (t)) = {{an | n ≥ m} | m ≥ 1} and L (X1 -CD1 (t)) \ L (X1 ) = {∅}, i.e., L (X1 -CD1 (t)) and L (X1 ) are incomparable.
A General Framework for Regulated Rewriting Based on the Applicability of Rules
51
3.3 Special Results for Strings It is well-known that the regulating mechanisms considered in this paper cannot add any generating power to regular grammars, i.e., for any Y ∈ {O, pC, f C, RC, M AT, M ATac , P, Pac , GC, GCac }, L (REG-Y ) = L (REG), as any non-terminal string derivable from the start symbol in a regulated regular grammar contains exactly one non-terminal symbol that is able to store all necessary informations needed to guide the derivation. Yet if we allow the axiom to be an arbitrary string, then the situation changes completely: for example, take the even non-context-free language L = {an bn cn | n ≥ 0}; then L ∈ L (REG -Y ). Moreover, it is well-known [5] that L (CF -RC) = L (ARB). As CF is a type with unit rules and trap rules, according to Theorems 1 and 4 we immediately infer L (CF -Y ) = L (ARB) for Y ∈ {RC, M ATac , GCac } without needing any specific further proofs. 3.4 Special Results for Arrays In the two-dimensional case, it can be shown [7] that even matrix grammars without ac are sufficient to generate any recursively enumerable two-dimensional array language, i.e., L (2-#-CF A-M AT ) = L (2-ARBA) (the main reason for such a result is the “#-sensing” ability of the rules of type 2-#-CF A). As 2-#-CF A is a type with unit rules and trap rules, according to Lemma 2 and Theorem 1, we immediately infer L (2-#-CF A-Y ) = L (2-ARBA) for Y ∈ {M AT, M ATac , GC, GCac } without needing any specific further proofs. For arbitrary dimensions n, we know that L (n-#-CF A-O) = L (n-ARBA). Hence, according to Theorems 2, 4, and 1, we immediately infer L (n-#-CF A-Y ) = L (n-ARBA) for Y ∈ {O, f C, M ATac , GCac } without needing any specific further proofs. 3.5 Special Results for Multisets As in the case of multisets the structural information contained in the sequence of symbols cannot be used, arbitrary multiset rules are not sufficient for obtaining all sets in P s (L (ARB)). Yet we can easily show that using a partial order relation on the rules is sufficient to obtain computational completeness; in connection with the general results obtained above, we obtain the following: Theorem 6. For any Y ∈ {O, f C, M ATac , GCac }, L (mARB-Y ) = P s (L (ARB)). Proof. According to Theorems 2, 4, and 1, we only have to prove P s (L (ARB)) ⊆ L (mARB-O). Let L ∈ P s (L (ARB)) over the terminal alphabet T , T = {ai | 1 ≤ i ≤ n}, and M = (n + 2, H, p0 , ph , I) be a deterministic register machine accepting L. Then we construct the ordered multiset grammar GmO generating exactly the multisets in L as follows:
52
R. Freund, M. Kogler, and M. Oswald
GmO = (G, <, =⇒GmO ) , Gm = (N, T, pI , PI ∪ PA ∪ Ps , =⇒Gm ) , N = H ∪ {pI , F } ∪ T ∪ {¯ ai | 1 ≤ i ≤ n + 2} , PI = {pI → ai a ¯i pI | 1 ≤ i ≤ n} ∪ {pI → p0 , ph → λ} , PA = {pi → a ¯r pj | pi : (ADD (r) , pj ) ∈ I} , PS = {¯ ar pi → pj , pi → pk , a ¯r → F | pi : (SUB (r) , pj , pk ) ∈ I} , < = {(¯ ar → F, pi → pk ) | pi : (SUB (r) , pj , pk ) ∈ I} . ¯i pI we can generate any multiset x over T together with Using the rules pI → ai a its barred copy x ¯. By the rules in PA and Ps we simulate the instructions of M on x ¯ in an obvious way. Throughout the simulation of the instructions of M by using the corresponding rules in PA and PS , the number of symbols a ¯r represents the contents of register r. By the order relations a ¯r → F > pi → pk for the instructions pi : (SUB (r) , pj , pk ) ∈ I we guarantee that we can only pass from pi to pk if no a ¯r is present in the underlying multiset, i.e., if register r is empty. If M reaches the final label ph , ph → λ is applied thus yielding a multiset x over T which is accepted by M . On the other hand, the simulation of the actions of M on a multiset x¯ with x ∈ / L will never reach ph and therefore x ∈ / L (GmO ). Hence, we conclude L (GmO ) = L.
4 Conclusion We have introduced a very general model for (generating) sequential grammars and various specific control mechanisms based on the applicability of rules in the underlying grammar, and we have shown general relations between graph-controlled grammars, matrix grammars, random-context grammars, and ordered grammars using only the structural features of the sequences of applied rules, yet not taking into account the features of the underlying objects (e.g., strings, arrays, multisets). The ideas of considering such a general model can also be taken over for accepting grammars and grammars computing functions as well as for many other variants of regulating mechanisms. In that sense, this paper can be seen just as a starting point for future research on establishing general relations between regulating mechanisms based only on the applicability of rules.
Acknowledgements The authors are very grateful for many interesting and fruitful discussions with Gheorghe P˘aun, and the first author also acknowledges the discussions with J¨urgen Dassow and Henning Fernau on several specific topics related with the notions and results presented in this paper.
References 1. Cavaliere, M., Freund, R., Oswald, M., Sburlan, D.: Multiset random context grammars, checkers, and transducers. Theoretical Computer Science 372(2-3), 136–151 (2007) 2. Csuhaj–Varj´u, E., Dassow, J., Kelemen, J., P˘aun, G.: Grammar Systems: A Grammatical Approach to Distribution and Cooperation Gordon and Breach Science Publishers (1994)
A General Framework for Regulated Rewriting Based on the Applicability of Rules
53
3. Csuhaj–Varj´u, E., Kari, L., P˘aun, G.: Test tube distributed systems based on splicing. Computers and AI 15, 2–3 (1996) 4. Csuhaj–Varj´u, E., Salomaa, A.: Networks of parallel language processors. In: P˘aun, G., Salomaa, A. (eds.) New Trends in Formal Languages. LNCS, vol. 1218, pp. 299–318. Springer, Heidelberg (1997) 5. Dassow, J., P˘aun, G.: Regulated Rewriting in Formal Language Theory. Springer, Berlin (1989) 6. Dassow, J., Truthe, B.: On networks of evolutionary processors with state limited filters. In: Bordihn, H., Freund, R., Holzer, M., Kutrib, M., Otto, F. (eds.) Proceedings NCMA 2010 (2010), [email protected] 7. Freund, R.: Control mechanisms on #-context-free array grammars. In: P˘aun, G. (ed.) Mathematical Aspects of Natural and Formal Languages, pp. 97–137. World Scientific Publ., Singapore (1994) 8. Freund, R., Oswald, M.: Modelling grammar systems by tissue P systems working in the sequential mode. Fundamenta Informaticae 76(3), 305–323 (2007) 9. Freund, R., P˘aun, G.: On the number of non-terminal symbols in graph-controlled, programmed and matrix grammars. In: Margenstern, M., Rogozhin, Y. (eds.) MCU 2001. LNCS, vol. 2055, pp. 214–225. Springer, Heidelberg (2001) 10. Kudlek, M., Mart´ın-Vide, C., P˘aun, G.: Toward a formal macroset theory. In: Calude, C.S., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) Multiset Processing. LNCS, vol. 2235, pp. 123– 134. Springer, Heidelberg (2001) 11. Minsky, M.L.: Computation: Finite and Infinite Machines. Prentice-Hall, Inc., Upper Saddle River (1967) 12. Mitrana, V.: Hybrid cooperating/distributed grammar systems. Computers and Artificial Intelligence 12(1), 83–88 (1993) 13. P˘aun, G.: Membrane Computing – An Introduction. Springer, Berlin (2002) 14. P˘aun, G.: On the generative capacity of hybrid CD grammar systems. J. Inform. Process. Cybernet. EIK 30(4), 231–244 (1994) 15. P˘aun, G., Rozenberg, G., Salomaa, A. (eds.): The Oxford Handbook of Membrane Computing. Oxford University Press, Oxford (2010) 16. Rosenfeld, A.: Picture Languages. Academic Press, Reading (1979) 17. Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages. Springer, Berlin (1997) 18. Wang, P.S.-P. (ed.): Array Grammars, Patterns and Recognizers. World Scientific Series in Computer Science, vol. 18. World Scientific Publ., Singapore (1989) 19. The P Systems Web Page, http://ppage.psystems.eu
CD Grammar Systems: Competence and Confidence Erzs´ebet Csuhaj-Varj´u Computer and Automation Research Institute, Hungarian Academy of Sciences Kende utca 13–17, 1111 Budapest, Hungary [email protected]
Abstract. In this paper we introduce cooperating distributed grammar systems with confidence level indication (ciCD grammar systems). These constructs are augmented variants of CD grammar systems where the component grammars indicate their confidence level in rewriting nonterminals. We provide representations of the recursively enumerable language class in terms of ciCD grammar systems with two types of derivations based on the confidence of the components and discuss the relation of some language classes of CD grammar systems with competence-based derivations to language classes of ciCD grammar systems. We also propose topics for future research.
1 Introduction Cooperating distributed grammar systems (CD grammar systems, for short) were introduced with the aim of providing syntactic models for blackboard type problem solving systems [1,2,3]. These constructs consist of a finite set of generative grammars which cooperate in deriving words of a language. At any moment of time, there is exactly one sentential form in generation. The component grammars generate the string in turn, under some cooperation protocol, called the derivation mode. In this model the cooperating grammars represent the independent cooperating problem solving agents which jointly solve a problem by modifying the contents of a global database, called the blackboard, which is used for storing information on the problem solving process. In blackboard architectures the agents communicate with each other only through the blackboard, that is, there is no direct communication among them. The sentential form describes the actual state of the problem solving process and the derivation corresponds to the solving of the problem. The subwords rewritten by the component grammars represent subproblems or open questions to be solved (not necessarily in one step) by the agents. Although CD grammar systems may have arbitrary generative grammars as components, the most intensively studied variants consist of context-free grammars. In this paper we consider these constructs, i.e., we use terms CD grammar system and context-free CD grammar system as equivalent.
Also affiliated with: Department of Algorithms and Their Applications, Faculty of Informatics, E¨otv¨os Lor´and University, P´azm´any P´eter s´et´any 1/c, 1117 Budapest, Hungary.
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 57–69, 2011. c Springer-Verlag Berlin Heidelberg 2011
58
E. Csuhaj-Varj´u
Most of the derivation modes for CD grammar systems are based on the competence of the component grammars on the sentential forms in generation, where the competence is defined as the number of different nonterminals in the sentential form that can be rewritten by the component. It can easily be seen that this concept describes the capability of the agent in solving the actual open problems. Thus, a grammar is said to be competent on a string if it is able to rewrite at least one nonterminal occurring in this word. A well-known competence-based derivation mode for CD grammar systems is the t derivation mode (terminating mode). In this case the component is allowed to work if it is competent on the string and it has to continue the derivation as long as it has this property. It is known that CD grammar systems with t derivations are as powerful as ET0L systems. For details on competence-based derivations, the reader is referred to [4,5,7,6,8] and the summarizing articles [9,10]. Although the above notion of competence is a natural concept for describing the capability of the agent in solving the problem, it does not reflect on the fact whether or not the agent is confident in its solution. In this paper we augment the original model with a further feature, namely, we provide the agents with the option of indicating their confidence in solving the subproblems. To this aim, we introduce the notion of a cooperating distributed grammar system with confidence level indication (a ciCD grammar system, for short) where the component grammars indicate their confidence in rewriting nonterminals. For this purpose, every nonterminal in the domain of the component is associated with an integer k, 0 ≤ k ≤ m, where m is a natural number given together with the ciCD grammar system1 . The associated number k represents the confidence level of the agent in solving the given subproblem; if it is zero, then although the agent is able to contribute to solving the subproblem, its confidence is doubtful in that action. The upper bound m is the maximum of the confidence levels associated to all nonterminals in the domains of all components. The confidence of a component P on a string w with at least one nonteri minal occurrence is defined as conf (w, P ) = m·r , where i is the sum of the confidence levels (according to P ) of all nonterminals in w which belong to the domain of P , m is the maximum of the confidence levels associated to all nonterminals in the domains of all components, as said before, and r is the number of nonterminal occurrences in w. Notice that 0 ≤ conf (w, P ) ≤ 1. Based on the concept of the confidence of a component on a string, we introduce two types of derivation modes. In the first case, a component is allowed to start the generation if its confidence on the string is bounded by given constants (a lower bound or an upper bound, or both). In the second case, a component is allowed to generate the sentential form if there is no other component which has a greater confidence on that word. In both cases, after starting its work, the grammar has to perform a t-derivation on the string. In this paper, we show that ciCD grammar systems in both cases generate the family of recursively enumerable languages, even having only two confidence levels (0 and 1). Furthermore, this generative capacity still can be obtained if the number of their 1
For technical reasons, instead of the customarily used percentage, we give the confidence level as an integer.
CD Grammar Systems: Competence and Confidence
59
nonterminals is bounded a constant. We also discuss how languages of CD grammar systems with certain competence-based derivations can be described by ciCD grammar systems and propose topics for future research.
2 Basic Notions and Definitions We assume the reader to be familiar with the basics of formal language theory; for further information we refer to [12,11]. The set of non-empty words over an alphabet V is denoted by V + ; if the empty word, λ, is included, then we use the notation V ∗ . A set of words L ⊆ V ∗ is called a language over V . For a word w ∈ V ∗ and a set of symbols A ⊆ V , we denote the length of w by |w| and the number of occurrences of symbols from A in w by |w|A . The set of symbols which appear in w ∈ V ∗ is denoted by alph(w). The number of elements of a finite set I is denoted by card(I). The set of non-negative integers is denoted by N. A context-free grammar is given as G = (N, T, P, S), where N is the alphabet of nonterminals, T is the alphabet of terminals, P is the finite set of productions of the form A → α where A ∈ N , α ∈ (N ∪ T )∗ , and S ∈ N is the start symbol. The domain of P , denoted by dom(P ), is the set of nonterminals which can be rewritten by P, i.e., dom(P ) = {A | A → α ∈ P }. For two strings u, v ∈ (N ∪ T )∗ , we write u =⇒P v, if u = u1 Au2 , v = u1 αu2 , u1 , u2 ∈ (N ∪ T )∗ , and A → α ∈ P holds. The reflexive and transitive closure of =⇒P is denoted by =⇒∗P . The language L(G) generated by G is L(G) = {w ∈ T ∗ | S =⇒∗P w}. An extended tabled interactionless L system (an ET0L system, for short) is a construct G = (V, T, P, ω) where V is an alphabet, T is a subset of V , ω ∈ V + and P = {P1 , P2 , . . . , Pr }, r ≥ 1. Pi , 1 ≤ i ≤ r, is a finite subset of V × V ∗ such that for any a ∈ V there is at least one element (a, α) in Pi . As usually, we write a → α instead of (a, α). We say that x ∈ V + directly derives y ∈ V ∗ in G (written as x =⇒G y), if x = x1 x2 . . . xn , y = y1 y2 . . . yn , xi ∈ V , yi ∈ V ∗ , 1 ≤ i ≤ n, and there is a j, 1 ≤ j ≤ r, such that xi → yi ∈ Pj for 1 ≤ i ≤ n. The language L(G) generated by the ET0L system G is defined as L(G) = {z ∈ T ∗ | ω =⇒∗G z} , where =⇒∗G is the reflexive and transitive closure of =⇒G . The families of context-free languages, ET0L languages, and recursively enumerable languages are denoted by CF , ET 0L, and RE, respectively. We now briefly recall the notion of a cooperating distributed grammar system and two important derivation modes of these constructs. For more details consult [3,13,10]. A cooperating distributed grammar system (a CD grammar system, for short) is a construct Γ = (N, T, P1 , P2 , . . . , Pn , S), n ≥ 1, where N is the alphabet of nonterminals of Γ , T is the alphabet of terminals of Γ , N ∩ T = ∅, S ∈ N is the start symbol, and for 1 ≤ i ≤ n, Pi , called the ith component, is a finite set of productions of the form A → α, where A ∈ N and α ∈ (N ∪ T )∗ . A component Pi , 1 ≤ i ≤ n, is said to be competent on a sentential form w ∈ (N ∪ T )∗ if dom(Pi ) ∩ alph(w) = ∅ holds; in this case we write comp(w, Pi ) > 0. If dom(Pi ) ∩ alph(w) = ∅, then Pi is not competent on w, and this fact is denoted by comp(w, Pi ) = 0.
60
E. Csuhaj-Varj´u
We say that a derivation x =⇒∗ y, where x, y ∈ (N ∪ T )∗ , in Γ is performed in the t t derivation mode (it is a t-derivation, for short), denoted by x =⇒ y, if there is an i, ∗ 1 ≤ i ≤ n, such that x =⇒Pi y and comp(y, Pi ) = 0. Thus, a component is allowed to start a t-derivation if it is competent on the sentential form and it has to continue the derivation as long as it has an applicable production. In [10] t-derivation is denoted as [comp, ¬comp]-derivation, we may use both notations in the sequel. A derivation x =⇒∗ y, x, y ∈ (N ∪ T )∗ , in Γ is said to be performed in the [f ull,¬comp]
[full, ¬comp] derivation mode, denoted by x =⇒ y, if there is an i, 1 ≤ i ≤ n, such that (alph(w) ∩ N ) ⊆ dom(Pi ), x =⇒∗Pi y and comp(y, Pi ) = 0. In this case Pi is allowed to start the derivation if it is able to replace every nonterminal occurrence in x and then it has to perform a t-derivation. The language Ld (Γ ) generated by a CD grammar system Γ = (N, T, P1 , P2 , . . . , Pn , S), n ≥ 1, in the d derivation mode, where d ∈ {t, [full, ¬comp]}, is defined by d
d
Ld (Γ ) = {w ∈ T ∗ | S = w0 =⇒Pj1 w1 · · · wl−1 =⇒Pjl wl = w, ji ∈ {1, . . . , n}, 1 ≤ i ≤ l}. The family of languages generated by CD grammar systems with n components in the d derivation mode, where n ≥ 1, d ∈ {t, [full, ¬comp]}, is denoted by CDn CF (d). We set CD∗ CF (d) = ∪∞ n=1 CDn CF (d). It is known that CF = CD1 CF (t) = CD2 CF (t) ⊂ CDn CF (t) = CD∗ CF (t) = CD∗ CF ([full, ¬comp]) = ET 0L, for n ≥ 3 [2,3,10]. In the following we introduce an augmented variant of CD grammar systems where the component grammars indicate their confidence level in replacing nonterminals: every nonterminal in the domain of the component is associated with an integer greater than or equal to 0 and less than or equal to m, where m is a natural number. This number represents the confidence level of the agent in solving the given subproblem; if it is zero, then although the agent is competent in solving the subproblem, its confidence is doubtful in that action. Definition 1. A cooperating distributed grammar system with confidence level indication (a ciCD grammar system, for short) is a construct Γ = (N, T (m, I), (P1 , c1 ) . . . , (Pn , cn ), ω), where – N is an alphabet, the alphabet of the nonterminals of Γ, – T is an alphabet, the alphabet of the terminals of Γ , N ∩ T = ∅, – m ≥ 1 and I = {j | 0 ≤ j ≤ m, j ∈ N}, I is called the set of confidence levels of Γ, – Pi , called the ith component of Γ, 1 ≤ i ≤ n, is a finite set of productions of the form A → α, where A ∈ N , α ∈ (N ∪ T )∗ , – ci : dom(Pi ) → I is a function, called the confidence level function associated to Pi , 1 ≤ i ≤ n, such that max{cj (A) | A ∈ dom(Pj ), 1 ≤ j ≤ n} = m, – ω ∈ (N ∪ T )+ is the axiom of Γ.
CD Grammar Systems: Competence and Confidence
61
Condition max{cj (A) | 1 ≤ j ≤ n, A ∈ dom(Pj )} = m guarantees that there is at least one component which has a nonterminal with the maximum of the confidence levels. We note that the underlying CD grammar system slightly differs from the standard notion: the length of the axiom is allowed to be greater than one. Before providing the notion of a derivation step in Γ , we need some further notions and notations. We first extend ci to c¯i : (N ∪ T ) → I as follows: c¯i (X) = ci (X) for X ∈ dom(Pi ) and c¯i (Y ) = 0 for Y ∈ ((N ∪ T ) \ dom(Pi )). (We defined both ci and c¯i to indicate the difference between the case when a component is able to replace a nonterminal but not confident in this action and the case when it has no production to rewrite it.) r For w = x1 . . . xr , xj ∈ (N ∪ T ), 1 ≤ j ≤ r, we define eval(w, Pj ) = Σi=1 c¯j (xi ), and for w = λ we set eval(λ, Pj ) = 0. For a ciCD grammar system Γ = (N, T, (m, I), (P1 , c1 ) . . . , (Pn , cn ), ω), m, n ≥ 1, the confidence of Pj on w, where 1 ≤ j ≤ n, w ∈ (N ∪ T )∗ N (N ∪ T )∗ , is defined by eval(w, Pj ) conf (w, Pj ) = . m · card(|w|N ) For w ∈ T ∗ we set conf (w, Pj ) = 0. In the following we introduce two types of derivation modes for ciCD grammar systems. In the first case, a component is allowed to start the generation if its confidence on the string is bounded by given constants (a lower bound, an upper bound, or both are given). In the second case, a component is allowed to generate the sentential form if there is no other component which has a greater confidence on that word. In both cases, after starting its work the component has to perform a t-derivation on the string. Definition 2. Let Γ = (N, T, (m, I), (P1 , c1 ) . . . , (Pn , cn ), ω), m, n ≥ 1, be a ciCD grammar system and let u, v ∈ (N ∪ T )∗ . 1. Let k and l, 0 ≤ k ≤ l ≤ 1, be rational numbers. We say that Pj , 1 ≤ j ≤ n, directly derives v from u in Γ the [≥ k. ≤ l.ci.t] derivation mode, denoted by [≥k.≤l.ci.t] =⇒Pj
v, if – k ≤ conf(u, Pj ) ≤ l, – u =⇒∗Pj v and there is no z ∈ (N ∪ T )∗ such that v =⇒Pj z holds. We define the [Δk.Δ l.ci.t] derivation mode, for any Δ ∈ {≥, >} and Δ ∈ {≤, <} with the necessary modifications. 2. We say that Pj , 1 ≤ j ≤ n, directly derives v from u in Γ in the [max.ci.t] u
[max.ci.t]
derivation mode, denoted by u =⇒Pj v, if – conf(u, Pj ) ≥ conf(u, Pi ) for each i, 1 ≤ i ≤ n, and – u =⇒∗Pj v and there is no z ∈ (N ∪ T )∗ such that v =⇒Pj z holds. Let D = {[Δk.Δ l.ci.t] | 0 ≤ k ≤ l ≤ 1, Δ ∈ {≥, >}, Δ ∈ {≤, <}} ∪ {[max.ci.t]}. d
If no confusion arises, subscript Pj may be omitted from =⇒Pj , d ∈ D. We also may use notation [= k.ci.t] instead of [≥ k. ≤ k.ci.t], and [Δk.ci.t] instead of [Δk. ≤ 1.ci.t].
62
E. Csuhaj-Varj´u
Definition 3. Let Γ = (N, T, (m, I), (P1 , c1 ) . . . , (Pn , cn ), ω), m, n ≥ 1, be a ciCD grammar system. The language generated by Γ in the d derivation mode, where d ∈ D, is defined by d
d
Ld (Γ ) = {w ∈ T ∗ | ω = w0 =⇒Pj1 w1 · · · wl−1 =⇒Pjl wl = w, ji ∈ {1, . . . , n}, 1 ≤ i ≤ l}.
The family of languages generated in derivation mode d by ciCD grammar systems having n components and p confidence levels, where n ≥ 1, p ≥ 2, d ∈ D, is denoted ∞ by ciCDn,p CF (d). We set ciCD∗,pCF (d) = n=1 ciCDn,p CF (d). (Notice that p = card(I).) We close the section with an example. Example 1. Let Γ = (N, T, (1, I), (P1 , c1 ), (P2 , c2 ), (P3 , c3 ), (P4 , c4 ), S) where N = {A, A , B, B , C, C , D, D , S}, T = {a, b, c, d}, I = {0, 1}, and P1 = {S → ABCD, S → abcd, A → a, B → b, C → c, D → d}, c1 (S) = c1 (A ) = c1 (B ) = c1 (C ) = c1 (D ) = 1, P2 = {A → aA , B → B , C → cC , D → D }, c2 (A) = c2 (C) = 1, c2 (B) = c2 (D) = 0, P3 = {A → A, B → B, C → C, D → D}, c3 (A ) = c3 (B ) = c3 (C ) = c3 (D ) = 1, P4 = {A → A , B → bB , C → C , D → dD }, c4 (A) = c4 (C) = 0, c4 (B) = c4 (D) = 1. Let us consider derivation mode [≥ 12 .ci.t]. The derivation starts with the work of component P1 that rewrites S either to a terminal word abcd or to ABCD. Since conf (S, P1 ) = 1, the condition concerning the confidence of the components holds. Consider now a sentential form ui,j = ai Abj Bci Cdj D, where i, j ≥ 0. (String ABCD is of this form.) Then, the only components which are able to continue the derivation are P2 or P4 . In both cases the condition concerning the confidence of the components on the actual sentential form holds, since conf (ui,j , P2 ) = conf (ui,j , P4 ) = 12 and the other components have no rule for rewriting nonterminals A, B, C and D, i.e., conf (ui,j , P1 ) = conf (ui,j , P3 ) = 0. Suppose that the derivation of ui,j will be continued by P2 (the case when the subderivation is performed by P4 can be treated analogously). Then, the obtained sentential form is vi+1,j = ai+1 A bj B ci+1 C dj D . The next enabled component is either P3 or P1 , since conf (vi+1,j , P3 ) = conf (vi+1,j , P1 ) = 1, and neither P2 , nor P4 is able to rewrite any nonterminal in vi+1,j (conf (vi+1,j , P2 ) = conf (vi+1,j , P4 ) = 0). In the first case, after P3 finished its work, either P2 or P4 may continue the generation and then the above cycle may be repeated, while in the second case the derivation ends with a terminal word which contains an equal number of terminals a and c and an equal number of terminals b and d. The reader may notice that the components always start their work on a sentential form α where α ∈ {S} ∪ {aiAbjBci CdjD, ai+1A bjB ci+1 C djD , aiA bj+1B ci C dj+1D | i, j ≥ 0}. The above reasoning remains true if instead of derivation mode [≥ 12 .ci.t] we consider derivation mode [max.ci.t]. By the above explanations, Lx (Γ ) = {an bm cn dm | n, m ≥ 1} for x ∈ {[≥ 12 .ci.t], [max.ci.t]}, which is a well-known non-context-free language.
CD Grammar Systems: Competence and Confidence
63
3 Results In the following we show that ciCD grammar systems in certain variants of derivation modes based on the bounded confidence of the components and in the derivation mode based on the maximal confidence of the components are able to generate any recursively enumerable language. Furthermore, this generative power can be obtained with ciCD grammar systems having only two confidence levels and a number of nonterminals bounded by a constant. We first recall an auxiliary result [14]. Let T = {a1 , a2 , . . . , al } be an alphabet, l ≥ 1. An Extended Post Correspondence (an EP C) is a pair P = ({(u1 , v1 ), . . . , (uh , vh )}, (za1 , . . . , zal )), where ui , vi , zaj ∈ {0, 1}∗ for 1 ≤ i ≤ h and 1 ≤ j ≤ l. The language defined by P in T , written as L(P ), is the following set: r
L(P ) = {x1 . . . xn ∈ T ∗ | ∃(s1 , s2 , . . . , sr ) ∈ {1, 2, . . . , h} , such that r ≥ 1 and us1 us2 . . . usr = vs1 vs2 . . . vsr zx1 zx2 . . . zxn } It is known that for each recursively enumerable language L ⊆ T ∗ , there exists an Extended Post Correspondence P such that L(P ) = L [14]. We note that this statement remains true if we suppose that the words ui , vi , zaj of the EPC are defined over {1, 2} instead of {0, 1}. For technical reasons, we will consider this version of the EP C in the sequel. The words us1 us2 . . . usr and vs1 vs2 . . . vsr zx1 zx2 . . . zxn can be considered as numbers in the base three notation and therefore we can speak about their values. Thus, the above statement says that a word w = x1 . . . xn is in L if and only if there exist indices s1 , . . . , sr ∈ {1, 2, . . . , h}, such that r ≥ 1 and val(us1 us2 . . . usr ) = val(vs1 vs2 . . . vsr zx1 zx2 . . . zxn ), where val(α) denotes the value of α ∈ {1, 2}∗ in the base three notation. We can generate a word x1 . . . xn ∈ L(P ) in three phases: in the first phase a string us1 us2 . . . usr vs1 vs2 . . . vsr is generated, then, in the second phase, a string us1 us2 . . . usr x1 . . . xn vs1 vs2 . . . vsr zx1 zx2 . . . zxn is obtained. In the third phase the equality of us1 us2 . . . usr and vs2 . . . vsr zx1 zx2 . . . zxn is checked. To prove of our results, we will use the above representation of recursively enumerable languages. For simplicity, throughout the paper we consider terms value and value in the base three notation as equivalent. Theorem 1 ciCD∗,2 CF ([>
1 . < 1.ci.t]) = RE. 2
Proof. Let L ⊆ T ∗ where T = {a1 , . . . , al } be a recursively enumerable language. We show that there exists a ciCD grammar system Γ with only two confidence levels, 0 and 1, such that Γ in the [> 12 . < 1.ci.t] derivation mode generates L. Suppose that L is defined by the EPC P , given above. We construct Γ in such way that its components
64
E. Csuhaj-Varj´u
simulate the way how an arbitrary word x1 . . . xn ∈ L, xi ∈ T, n ≥ 1, is generated according to P . This will be done in three phases. By the end of the first derivation phase the work of the corresponding components of Γ will result in a sentential form representing the values (in the base three notation) of words us1 us2 . . . usr and vs1 vs2 . . . vsr , for some r ≥ 1. By the end of the second phase a sentential form of Γ will be obtained which represents the word w = x1 . . . xn , xi ∈ T, 1 ≤ i ≤ n, and the values of words us1 us2 . . . usr and vs1 vs2 . . . vsr zx1 zx2 . . . zxn . (If the empty word is generated, then this phase is skipped.) The components of Γ are defined in such way that in these phases all sentential forms representing the values of a pair in the form of (us1 us2 . . . usr , vs1 vs2 . . . vsr zx1 zx2 . . . zxn ) and the corresponding word w = x1 . . . xn can be obtained. In the third phase the corresponding components check the equality of the values of us1 us2 . . . usr and vs1 vs2 . . . vsr zx1 zx2 . . . zxn . Only those words can be generated by Γ for which there exist indices sj ∈ {1, 2, . . . , h}, 1 ≤ j ≤ r such that the value of us1 us2 . . . usr is equal to the value of vs1 vs2 . . . vsr zx1 zx2 . . . zxn , i.e., the words generated by Γ are in L(P ). The value of a number is represented as the number of occurrences of a certain letter, A or B, in the sentential form of Γ . Thus, in the first phase the corresponding components of Γ increase the number of As and Bs in the sentential form such that their work reflects the act of concatenating of pairs (uj , vj ) in the generation of the word according to P . In the second phase, the corresponding components of Γ put letters xi into the sentential form and at the same time increase the number of letters B in such way that their work reflects the act of adding pairs (xi , zxi ) in generating the word according to P . In the third phase, the equality of the number of A’s and B’s in the sentential form is checked. If the answer is positive, then all symbols but the ones representing the word w are deleted, thus the word w = x1 . . . xn is generated. Let Γ = (N, T, (1, I), P1 , (Pi,1 )1≤i≤h , P1 , P1 , P1 , (Pi,2 )1≤i≤l , P2 , P2 , P3 , P4 , ω), where (1)
(1)
(1)
N = {S1 , S2 , S3 , S1,1 , S1,1 , S1,2 , S1,2 , S2,1 , S2,1 , S1,3 , S2,2 , S2,2 , X, Y } ∪ ¯ ¯ ¯ ¯ {A, A, A , A , A , A , B, B, B , B , B , B }, (1)
(1)
(1)
I = {0, 1} and ω = S1 S2 S3 . The components of Γ are defined as follows. For the sake of the easier readability, the notations used for the confidence level functions are in accordance with the notations used for the components. Let (1) (1) (1) (1) (1) P1 = {S1 → S1,1 S1,2 S1,3 , S2 → λ, S3 → λ} with c1 (S1 ) = c1 (S2 ) = 1, (1) and c1 (S3 ) = 0. The derivation of a word in Γ starts with the work of of P1 . No other component can (1) (1) (1) work at the beginning and conf (S1 S2 S3 , P1 ) > 12 holds.
CD Grammar Systems: Competence and Confidence
65
The derivation continues with the work of some component Pj,1 , followed by P1 (or Pj,1 followed by P1 , or Pj,1 followed by P1 which cases will be discussed later) which simulate the appending of uj and vj (the pair (uj , vj )) to the corresponding parts of the string built up according to the EPC P . For 1 ≤ j ≤ h let ¯ )val(vj ) S1,2 Pj,1 = {S1,1 → (A A¯ )val(uj ) S1,1 , S1,2 → (B B , |uj |
A → (A A¯ )3
|vj |
¯ )3 , B → (B B
¯ → λ} ∪ {S1,3 → λ}, , A¯ → λ, B
¯ B, ¯ S1,3 }. with cj,1 (H) = 1 for H ∈ {S1,1 , S1,2 , A, B} and cj,1 (H ) = 0 for H ∈ {A, If the sentential form γ generated so far in Γ was of the form γ = αS1,1 βS1,2 , where the number of As in α is equal to the value of us1 . . . usk and the number of Bs in β is equal to the value of vs1 . . . vsk , k ≥ 1, then after the application of Pj,1 for some j, 1 ≤ j ≤ h, the number of A s in the new sentential form will be equal to the value of us1 . . . usk uj and the number of symbols B will be equal to the value of vs1 . . . vsk vj . Components Pj,1 for 1 ≤ j ≤ h are applicable to γ, since conf (γ, Pj,1 ) > 12 holds. (Notice that the number of non-barred letters is equal to the number of their barred versions.) The case of applying Pj,1 to the string S1,1 S1,2 S1,3 , which is obtained after the first derivation step, can be interpreted in a similar manner. After the generation performed by Pj,1 , either component P1 , or P1 , or component P1 will continue the derivation. We define ¯ B → B, B ¯ → B}, P1 = {S1,1 → S1,1 , S1,2 → S1,2 , A → A, A¯ → A, ¯ }. with c1 (H) = 1 for H ∈ {S1,1 , S1,2 , A , B } and c1 (H ) = 0 for H ∈ {A¯ , B P1 rewrites the primed letters to unprimed ones making possible to simulate the appending of a pair (uk , vk ), 1 ≤ k ≤ m, to the sentential form built up according to the EPC P . Let ¯ B → B, B ¯ → B}, P1 = {S1,1 → S2,1 , S1,2 → S2,2 , A → A, A¯ → A, ¯ }, and with c1 (H) = 1 for H ∈ {S1,1 , S1,2 , A , B } and c1 (H ) = 0 for H ∈ {A¯ , B ¯ → λ}, P1 = {S1,1 → X, S1,2 → λ, A → A , A¯ → λ, B → B , B ¯ ¯ with c 1 (H) = 1 for H ∈ {S1,1 , S1,2 , A , B } and c1 (H ) = 0 for H ∈ {A , B }. The first phase of the derivation ends either when P1 rewrites S1,1 to S2,1 and S1,2 ¯ to S2,2 or when P1 rewrites S1,1 to X, A to A , B to B and erases S1,2 , A , and ¯ . (Notice that both P and P satisfy the condition concerning the confidence of the B 1 1 components.) If the active component is P1 , then the obtained string will be of the form α S2,1 β S2,2 where the number of As in α is equal to the value of us1 . . . usr and the number of Bs in β is equal to the value of vs1 . . . vsr , for some r ≥ 1. If component P1 continues the generation, then the second derivation phase is skipped and the third phase follows. In this case, if the derivation successfully terminates, then the empty word and only that is generated. Suppose that the last acting component was P1 . Then the second phase of the derivation starts. Now terminal letters ai and string representing zai are inserted in the sentential form, simulating the act of appending pairs (ai , zai ). This is done by components
66
E. Csuhaj-Varj´u
Pi,2 followed by P2 (or by Pi,2 followed by P2 which case will be discussed later), 1 ≤ i ≤ l, similarly to the first derivation phase. Let for 1 ≤ i ≤ l, ¯ )val(zai ) S2,2 , S2,2 → (B B , Pi,2 = {S2,1 → ai S2,1 |za | i
¯ )3 B → (B B
¯ → λ}, , A → A , A¯ → A¯ , B
¯ B}. ¯ We with ci,2 (H) = 1 for H ∈ {S2,1 , S2,2 , A, B} and ci,2 (H ) = 0 for H ∈ {A, define ¯ B → B, B ¯ → B}, P2 = {S2,1 → S2,1 , S2,2 → S2,2 , A → A, A¯ → A, ¯ } and , S2,2 , A , B } and c2 (H ) = 0 for H ∈ {A¯ , B with c2 (H) = 1 for H ∈ {S2,1 ¯ → λ}, → X, S2,2 → λ, A → A , A¯ → λ, B → B , B P2 = {S2,1 ¯ }. with c2 (H) = 1 for H ∈ {S2,1 , S2,2 , A , B } and c2 (H ) = 0 for H ∈ {A¯ , B The second phase of the derivation ends with a string of the form α wXβ , where w = x1 . . . xn , xi ∈ T, 1 ≤ i ≤ n, α ∈ {A }∗ , β ∈ {B }∗ , and the number of symbols A in α is equal to the value of us1 . . . usr and the number of symbols B in β is equal to the value of vs1 . . . vsr zx1 . . . zxn . Notice that when the components started their subderivation, they satisfied the condition concerning their confidence on the current sentential form. The components which perform the third derivation phase are the following:
P3 = {X → Y, A → A , B → B } with c3 (X) = c3 (A ) = 1 and c3 (B ) = 0, and P4 = {Y → λ, A → λ, B → λ} with c4 (Y ) = c4 (B ) = 1 and c4 (A ) = 0. The derivation can only be continued with the work of P3 which component rewrites X to Y , every A to A , and every B to B . P3 is able to work only if |Xα | > |β | holds. If this inequality does not hold, then the derivation cannot successfully terminate. Suppose that P3 is able to continue the derivation. After finishing its work, the obtained sentential form is of the form α wY β , where α ∈ {A }∗ , β ∈ {B }∗ , and |α | = |α | and |β | = |β |. The only component that would be able to finish the derivation is P4 . This component can be active only in that case if |Y β | > |α | holds. (Notice that this implies that the number of symbols A and the number of symbols B are equal in the string.) Otherwise, the derivation cannot successfully terminate. Suppose that P4 can be active and it finishes the derivation. This means that α β represents either a string us1 . . . usr vs1 . . . vsr zx1 . . . zxn where us1 . . . usr = vs1 . . . vsr zx1 . . . zxn or a string us1 . . . ust vs1 . . . vst where us1 . . . ust = vs1 . . . vst holds, i.e., the conditions of EPC P are satisfied. Thus, the generated word is in L(P ). (Notice that the third phase is the only phase of the derivation where the power of the confidence mechanism is needed, namely, it is used for deciding whether two numbers are equal or not. Observing the components which act in the first two derivation phases, it can be seen that these derivation phases can be simulated by t derivations performed by components of some appropriate CD grammar systems as well.)
CD Grammar Systems: Competence and Confidence
67
The reader may easily verify that in order to obtain a terminal word, the components of Γ have to follow each other during the derivation in the order given above. It can also easily be seen that any terminal word generated in Γ is in L(P ). Hence we proved the result. Theorem 2 ciCD∗,2 CF ([max.ci.t]) = ciCD∗,2 CF ([> = ciCD∗,2 CF ([≥
1 .ci.t]) = 2
1 .ci.t]) = RE. 2
Proof. Since the statements can be obtained from the construction used in the proof of the previous theorem with slight modifications, we provide only the sketch of the proof and leave the details to the reader. First, notice that the proof of Theorem 1 remains valid if the components of Γ work in the [max.ci.t] derivation mode, thus, ciCD∗,2 CF ([max.ci.t]) = RE holds. The statement ciCD∗,2 CF ([> 12 .ci.t]) = RE can also be obtained if we modify certain components of Γ in the proof of Theorem 1 as follows: we define c1 (X) = ¯ ¯ c1 (X) = c 1 (X) = c2 (X) = c2 (X) = 1 for X ∈ {A , B }. 1 To verify ciCD∗,2 CF ([≥ 2 .ci.t]) = RE, the proof of Theorem 1 should be modified in the following way: For each component R ∈ P = {Pj,1 | 1 ≤ j ≤ h} ∪ {Pi,2 | ¯ = R ∪ R , 1 ≤ i ≤ l} ∪ {P1 , P1 , P1 , P2 , P2 } of Γ , we define a new component R where R = {X → F | X ∈ (N \ dom(R))} and F ∈ / N is a new nonterminal. We set cR¯ (X) = 1 for X ∈ N ∪ {F }. Furthermore, we change S2,1 → X in P1 and in P2 to S2,1 → λ in P¯1 and in P¯2 and we set P¯3 = {A → A , B → B } with c¯3 (A ) = 1 and c¯3 (B ) = 0 and P¯4 = {A → λ, B → λ} with c¯4 (B ) = 1 and c¯4 (A ) = 0. To obtain a terminal word, the modified components in the derivations should follow each other in the same order as it is done by the original components of Γ . Otherwise, ¯ given above, rewrites a string with an occurrence of X ∈ (N \ if a component R, dom(R)), i.e., it is used in some other order that is given in the proof of Theorem 1, then no terminal word can be generated. Components P¯3 and P¯4 check the equality of the number of symbols A and the number of symbols B in the string. The reader may notice that the number of nonterminals of any ciCD grammar system in the proofs of Theorem 1 and Theorem 2 is bounded by some constant. This fact arises from the way of generating strings according to an arbitrary EPC P . Let us denote by ciCDn,q,p CF (d) the class of languages generated in the derivation mode d by ciCD grammar systems with n components, q nonterminals, and p confidence levels, where n, q ≥ 1, p ≥ 2, d ∈ D; and let ciCD∗,q,p CF (d) = ∞ ciCD n,q,p CF (d). n=1 Corollary 1 1 . < 1.ci.t]) = ciCD∗,26,2 CF ([max.ci.t]) = 2 1 1 = ciCD∗,26,2 CF ([> .ci.t]) = ciCD∗,25,2 CF ([≥ .ci.t]) = RE. 2 2 ciCD∗,26,2 CF ([>
68
E. Csuhaj-Varj´u
Obviously, it is an open question whether or not these numbers are sharp bounds to obtain the computational completeness.
4 Further Remarks In the previous section we presented representations of the recursively enumerable language class in terms of ciCD grammar systems. Since these constructs are augmented variants of CD grammar systems, they provide descriptions of languages of standard CD grammar systems as well. For example, it is known that the family of languages generated by CD grammar systems in the t derivation mode (denoted also as (comp, ¬comp) derivation mode) is equal to the class of ET0L languages. The same language class is obtained by CD grammar systems with (full, ¬comp)-derivations. ET0L languages can be represented by ciCD grammar systems in a similar manner. It is easy to see for any CD grammar system Γ working with the t derivation mode a ciCD grammar system Γ can be constructed such that Γ in the [> 0.ci.t] derivation mode generates the same language as Γ . Γ is obtained from Γ by adding an arbitrary I and choosing the confidence function c for any component P in such way that c(X) ≥ 1 holds for every X ∈ dom(P ). Similarly, it can easily be seen that any ciCD grammar system Γ with only two confidence levels and working in the [= 1.ci.t] derivation mode determines an ET0L language. These systems correspond to CD grammar systems working in the (full, ¬comp) derivation mode, since to start with the generation Γ have to be able to replace any nonterminal in the sentential form. Based on these and similar examples, systematic comparisons of language classes of CD grammar systems with competence-based derivations and language classes of ciCD grammar systems would be an interesting topic for future research. Further challenging problems are to find descriptions of some other well-known language classes in terms of ciCD grammar systems, as for example, descriptions of classes of regulated ET0L languages, indian parallel languages, programmed languages, etc. The model introduced in this paper can be developed in several directions. For example, instead of associating the confidence levels to the nonterminals, we may associate such numbers to the productions of the components, to distinguish between the different solutions of a given subproblem. We may change the notion of the confidence of a component on a string, and we may impose other, static or dynamic conditions on the confidence the grammars have to satisfy during the derivation. We plan to study these and similar problems in the near future.
Acknowledgements The author thanks for the useful comments and suggestions to the anonymous referee.
References 1. Csuhaj–Varj´u, E., Kelemen, J.: Cooperating grammar systems: A syntactical framework for blackboard model of problem solving. In: Proc. AIICSR 1989, pp. 121–127. Elsevier Publishing Company, Amsterdam (1989)
CD Grammar Systems: Competence and Confidence
69
2. Csuhaj–Varj´u, E., Dassow, J.: On Cooperating Distributed Grammar Systems. Journal of Information Processing and Cybernetics EIK 26, 49–63 (1990) 3. Csuhaj–Varj´u, E., Dassow, J., Kelemen, J., P˘aun, G.: Grammar Systems: A Grammatical Approach to Distribution and Cooperation. Topics in Computer Mathematics, vol. 5. Gordon & Breach, London (1994) 4. Bordihn, H., Csuhaj–Varj´u, E.: On Competence and Completeness in CD Grammar Systems. Acta Cybernetica 12, 347–361 (1996) 5. ter Beek, M.H., Csuhaj–Varj´u, E., Holzer, M., Vaszil, G.: On Competence in CD Grammar Systems. In: Calude, C.S., Calude, E., Dinneen, M.J. (eds.) DLT 2004. LNCS, vol. 3340, pp. 76–88. Springer, Heidelberg (2004) 6. Csuhaj–Varj´u, E., Dassow, J., Holzer, M.: CD Grammar Systems with Competence Based Entry Conditions in their Cooperation Protocols. International Journal of Computer Mathematics 83, 159–169 (2006) 7. ter Beek, M.H., Csuhaj–Varj´u, E., Holzer, M., Vaszil, G.: On Competence in CD Grammar Systems with Parallel Rewriting. International Journal of Foundations of Computer Science 18, 1425–1439 (2007) 8. Csuhaj-Varj´u, E., Dassow, J., Vaszil, G.: Some New Modes of Competence-Based Derivations in CD Grammar Systems. In: Ito, M., Toyama, M. (eds.) DLT 2008. LNCS, vol. 5257, pp. 228–239. Springer, Heidelberg (2008) 9. Csuhaj–Varj´u, E.: Grammar Systems. In: Mart´ın-Vide, C., Mitrana, V., P˘aun, G. (eds.) Formal Languages and Applications. Studies in Fuzziness and Soft Computing, vol. 148, pp. 275–310. Springer, Heidelberg (2004) 10. Dassow, J.: On cooperating distributed grammar systems with competence based start and stop conditions. Fundamenta Informaticae 76, 293–304 (2007) 11. Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages, vol. 1–3. Springer, Berlin (1997) 12. Salomaa, A.: Formal Languages. Academic Press, New York (1973) 13. Dassow, J., P˘aun, G., Rozenberg, G.: Grammar systems. In: [11], vol. II, ch. 4, pp. 155–213. Springer, Heidelberg (1997) 14. Geffert, V.: Context-free-like forms for phrase-structure grammars. In: Koubek, V., Janiga, L., Chytil, M.P. (eds.) MFCS 1988. LNCS, vol. 324, pp. 309–317. Springer, Heidelberg (1988)
Cooperating Distributed Grammar Systems: Components with Nonincreasing Competence Maurice H. ter Beek1 , Erzs´ebet Csuhaj-Varj´u2, , Markus Holzer3, , and Gy¨orgy Vaszil4 1
Istituto di Scienza e Tecnologie dell’Informazione ‘A. Faedo’, Consiglio Nazionale delle Ricerche, Via G. Moruzzi 1, 56124 Pisa, Italy [email protected] 2 Computer and Automation Research Institute Hungarian Academy of Sciences, Kende utca 13–17, 1111 Budapest, Hungary [email protected] 3 Institut f¨ur Informatik, Universit¨at Giessen Arndtstraße 2, 35392 Giessen, Germany [email protected] 4 Computer and Automation Research Institute Hungarian Academy of Sciences, Kende utca 13–17, 1111 Budapest, Hungary [email protected]
Abstract. We study the generative power of CD grammar systems (CDGSs) that use a cooperation protocol based on the level of competence on a sentential form — and the competence of their components does not increase during rewriting. A component of a CDGS is k-competent on a sentential form if it can rewrite exactly k different nonterminals appearing in that string. A CDGS with components that are nonincreasing in competence works in =k-competence mode of derivation if no k-competent component can ever become -competent, for some > k. We introduce a static and a dynamic definition to impose this restriction, and we relate the generative power of such CDGSs working either in a sequential or in a parallel manner and according to the aforementioned cooperation protocol, for various k, with that of context-free forbidding random context grammars, (random context) ET0L systems, and context-free programmed grammars with appearance checking.
1 Introduction A grammar system is a set of grammars that under a specific cooperation protocol generate one language. The idea to consider — contrary to the classical paradigm “one
Also affiliated with: Department of Algorithms and Their Applications, Faculty of Informatics, E¨otv¨os Lor´and University, P´azm´any P´eter s´et´any 1/c, 1117 Budapest, Hungary. Part of the work was done while the author was at Institut f¨ur Informatik, Technische Universit¨at M¨unchen, Boltzmannstraße 3, 85748 Garching bei M¨unchen, Germany. J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 70–89, 2011. c Springer-Verlag Berlin Heidelberg 2011
CD Grammar Systems: Nonincreasing Competence
71
grammar generating one language” — a set of cooperating grammars generating one language first appeared in [1]. An intensive exploration of the potential of grammar systems was not undertaken until [2] established a link between cooperating distributed grammar systems (CDGSs) and blackboard systems as known from artificial intelligence. Such a system consists of autonomous agents, a blackboard, and a control mechanism. The latter dictates rules which the agents must respect during their joint effort to solve a problem stated on the blackboard. The only way for the agents to communicate is via the blackboard, which represents the current state of problem solving. If the problem solving is successful, the solution appears on the blackboard. CDGSs form a language-theoretic framework for modelling blackboard systems. Agents are represented by grammars, the blackboard is represented by the sentential form, control is regulated by a cooperation protocol of the grammars, and the solution is represented by a terminal word. By now, grammar systems form a well-established and well-recognized area in the theory of formal languages [3,4]. In this paper, we introduce two variants of cooperation protocols for CDGSs, based on the level of competence that a component has on a sentential form during a derivation. We consider cooperation protocols that allow a component to start rewriting when a competence condition is satisfied, and that require it to do so as long as the grammar satisfies this condition. Intuitively, a component is k-competent on a sentential form if it can rewrite exactly k different nonterminals appearing in the sentential form. This particular cooperation protocol is called the =k-comp.-mode of derivation. The more different nonterminals of a sentential form a component is able to rewrite, the higher its (level of) competence on that sentential form. Restricting in this way the rewriting of the sentential form to components that have a certain (level of) competence, provides a formal interpretation of the requirement that agents must be competent enough before being able to participate in the problem solving taking place on the blackboard. Competence-based cooperation protocols have already been studied extensively in the literature, see, e.g., [1,2,5,6,7,8]. The variants we introduce here examine the consequences of imposing that no k-competent component can ever become -competent, for some > k, by rewriting the sentential form. We introduce both a static and a dynamic definition of CDGSs whose components’ competence is nonincreasing during a derivation, thus providing a formal interpretation of the assumption that the competence of agents does not increase while participating in the problem solving on the blackboard. In the first case we impose restrictions on the productions of the CDGSs, while in the second case we introduce a further restriction on the used competence-based derivation mode. We show that such CDGSs, working in =k-comp.-mode of derivation and contextfree rewriting either sequentially or in parallel, are very powerful, by relating them to context-free forbidding random context languages, (random context) ET0L languages [9], and languages generated by context-free programmed grammars with appearance checking. More precisely, we prove that CDGSs with nonincreasing competence in the static or in the dynamic sense working in =1-comp.-mode of derivation, rewriting in parallel, characterize the family of languages generated by ET0L systems. We prove that the same holds for CDGSs with nonincreasing competence in the static sense working in =1-comp.-mode of derivation, rewriting sequentially, while CDGSs
72
M.H. ter Beek et al.
with nonincreasing competence in the dynamic sense working in =1-comp.-mode of derivation are strictly more powerful: their generative power equals that of context-free forbidding random context grammars. We moreover prove that CDGSs with nonincreasing competence in the static or in the dynamic sense working in =k-comp.-mode of derivation, with k ≥ 2, rewriting in parallel, characterize the family of languages generated by context-free recurrent programmed grammars with appearance checking or — equivalently — that of random context ET0L languages. Finally, we show that CDGSs with nonincreasing competence in the static sense working in =k-comp.-mode of derivation, with k ≥ 2, rewriting sequentially, are at least as powerful as random context ET0L languages, but their exact generative power is an open problem, while CDGSs with nonincreasing competence in the dynamic sense working in =2-comp.mode of derivation, rewriting sequentially, can generate all recursively enumerable languages. In Section 6 we will provide a table that summarizes all results. We thus provide yet another characterization of the family of languages generated by random context ET0L systems, which was shown to be related to CDGSs with nonstandard derivation modes, see, e.g., [6,7,10]. This language family is of particular interest as it coincides with that of context-free recurrent programmed languages and as such forms an intermediate class between the families of context-free random context languages and context-free programmed languages generated by grammars without appearance checking [11]. In fact, since we show that quite simple component grammars suffice to simulate random context ET0L systems, we demonstrate that it is indeed the cooperation protocol that is very powerful. We hope our results can help to gain more insight in a longstanding open problem in the theory of regulated rewriting: are contextfree programmed grammars more powerful than context-free recurrent programmed grammars?
2 Preliminaries We assume familiarity with basic formal language theory (see, e.g., [12,13]). We denote set difference by \, set inclusion by ⊆, strict set inclusion by ⊂, cardinality of a finite set M by |M |, and the empty word by λ. We consider two languages L1 and L2 equal, and write L1 = L2 , iff L1 \ {λ} = L2 \ {λ}. An ET0L system is a quadruple G = (Σ, H, ω, Δ), with alphabet Σ, finite set of complete tables H, axiom ω ∈ Σ + , and terminal alphabet Δ ⊆ Σ. A complete table is a finite set of context-free rules, i.e., elements of Σ × Σ ∗ , which includes a rule for every a ∈ Σ. For x, y ∈ Σ ∗ , we write x ⇒h y iff x = a1 . . . an , y = z1 . . . zn , and for all 1 ≤ i ≤ n, ai → zi ∈ h for some h ∈ H. The language generated by G is defined as L(G) = { w ∈ Δ∗ | ω ⇒hi1 w1 ⇒hi2 . . . ⇒him wm = w, for m ≥ 1 and hij ∈ H with 1 ≤ j ≤ m }. The language family generated by ET0L systems is denoted by L(ET0L). A context-free random context grammar is a quadruple G = (N, T, P, S), with N and T its sets of nonterminals and terminals, S ∈ N its start symbol, and P its finite set of context-free random context rules, i.e., triples of the form (A → z, Q, R), where
CD Grammar Systems: Nonincreasing Competence
73
A → z is a context-free production with A ∈ N and z ∈ (N ∪ T )∗ , and Q, R ⊆ N are its permitting and forbidding random context. For x, y ∈ (N ∪ T )∗ , we write x ⇒ y iff x = x1 Ax2 , y = x1 zx2 , all symbols of Q appear in x1 x2 , and no symbol of R appears in x1 x2 . If either Q and/or R is empty, then the corresponding context check is omitted. The language generated by G is defined as L(G) = { w ∈ T ∗ | S ⇒∗ w }, where ⇒∗ is the reflexive transitive closure of ⇒. If all permitting random contexts are empty, then G is called a context-free forbidding random context grammar and the corresponding family of languages is denoted by L(fRC, CF). It is known (see, e.g., [12,13]) that L(ET0L) ⊂ L(fRC, CF) ⊂ L(RE), where L(RE) denotes the family of recursively enumerable languages. A context-free programmed grammar is a 7-tuple G = (N,T, P, S, Λ, σ, φ) with finite set of nonterminals N , finite set T of terminals, axiom S ∈ N , finite set P of contextfree productions α → β, with α ∈ N and β ∈ (N ∪ T )∗ , and finite set Λ of labels (for the productions in P ). Set Λ is a function that given a label outputs a production; σ and φ are functions from Λ into 2Λ . For (x, r1 ), (y, r2 ) ∈ (N ∪T )∗ ×Λ and Λ(r1 ) = (α → β), we write (x, r1 ) ⇒ (y, r2 ) iff either x = x1 αx2 , y = x1 βx2 , with x1 , x2 ∈ (N ∪ T )∗ , and r2 ∈ σ(r1 ), or x = y, rule α → β is not applicable to x, and r2 ∈ φ(r1 ). In the latter case, the derivation step is in appearance checking mode. Set σ(r1 ) is called the success field and set φ(r1 ) the failure field of r1 . The language generated by G is defined as ∗
L(G) = { w ∈ T ∗ | (S, r1 ) ⇒ (w, r2 ) for some r1 , r2 ∈ Λ }, ∗
in which ⇒ denotes the reflexive transitive closure of ⇒. Grammar G is a contextfree recurrent programmed grammar if for every p ∈ Λ, p ∈ σ(p), and if φ(p) = ∅, then σ(p) = φ(p). The family of languages generated by context-free [recurrent] programmed grammars with appearance checking is denoted by L([r]PR, CF, ac). The family of languages generated by random context ET0L systems [9] is denoted by L(RC, ET0L). It is known (see, e.g., [12,13]) that L(ET0L) ⊂ L(RC, ET0L) = L(rPR, CF, ac) ⊆ L(PR, CF, ac) = L(RE).
3 Competence in CD Grammar Systems A cooperating distributed grammar system (CDGS) of degree n ≥ 1 is an (n + 3)tuple G = (N, T, α, P1 , . . . , Pn ), with disjoint alphabets N of nonterminals and T of terminals, axiom α ∈ (N ∪ T )∗ , and components P1 , . . . , Pn that are finite sets of context-free productions, i.e., productions of the form A → z, for A ∈ N and z ∈ (N ∪T )∗ . This definition of CDGSs differs from the usual one by allowing arbitrary words from (N ∪ T )∗ as axioms. In this paper, we consider both sequential and parallel context-free rewriting. Let 1 ≤ i ≤ n, let dom(Pi ) = { A ∈ N | A → z ∈ Pi } be the domain of Pi , and let x, y ∈ (N ∪ T )∗ . Then we define a single sequential rewriting step as x ⇒i y iff x = x1 Ax2 and y = x1 zx2 , for some A → z ∈ Pi . To facilitate parallel rewriting, we first associate to each component Pi a finite substitution hi defined as hi (A) = { z | A → z ∈ Pi } if A ∈ dom(Pi ) and hi (A) = {A} if A ∈ (N ∪T )\dom(Pi ). Then
74
M.H. ter Beek et al.
we define a parallel rewriting step as x ⇒i y iff y ∈ hi (x). In both types of rewriting paradigms, subscript i thus refers to the component being used. Recall from [8] the notion of competence that components of a CDGS have on a sentential form. Component Pi , with 1 ≤ i ≤ n, is called k-competent on a sentential form x in (N ∪ T )∗ iff |alphN (x) ∩ dom(Pi )| = k, where alphN (x) = { A ∈ N | x ∈ (N ∪ T )∗ A(N ∪ T )∗ }, i.e., it denotes the set of all nonterminals occurring in x. We abbreviate the (level of) competence of component Pi on x by clevi (x), i.e., clevi (x) = |alphN (x) ∩ dom(Pi )|. Based on the (level of) competence, we now recall from [6] the =k-competencebased cooperation protocol for CDGSs.1 Let k ≥ 1. Then -comp. y iff there is a derivation x ⇒=k i x = x0 ⇒i x1 ⇒i · · · ⇒i xm−1 ⇒i xm = y for some m ≥ 1 and it satisfies (1) clevi (xj ) = k for 0 ≤ j < m and clevi (xm ) = k, or (2) clevi (x0 ) = k, clevi (xj ) ≤ k for 1 ≤ j ≤ m, and y ∈ T ∗ . -comp. for some i, with 1 ≤ i ≤ n. The reflexive transitive Let ⇒=k-comp. denote ⇒=k i ∗ closure of ⇒=k-comp. is denoted by ⇒=k-comp.. The language generated by G in the =k-comp.-mode of derivation is ∗
L=k-comp.(G) = { w ∈ T ∗ | α ⇒=k-comp. w }. The family of languages generated by CDGSs working in the =k-comp.-mode of derivation is denoted by L(CD, CF, =k-comp.) for sequential rewriting and by L(CD, parCF, =k-comp.) for parallel rewriting. Example 1. Let G = (N, T, α, P1 , . . . , P8 ) be a CDGS with nonterminals N = {A, A , B, B , C, D}, terminals T = {a, b, c}, axiom AB and components P1 = {A → aA b, B → B , C → C}, P2 = {A → A, B → B c, C → C}, P3 = {A → A, B → B, C → C}, P4 = {A → A , B → B, C → C},
P5 = {A → C, B → B}, P6 = {A → A, A → A , B → D}, P7 = {B → B , C → λ}, and P8 = {D → λ}.
When working in the =1-comp.-mode of derivation, G generates the language L=1-comp. (G) = { an bn cn | n ≥ 1}, independently of whether it rewrites in a sequential or parallel manner. This can be seen as follows. Each of the components P1 , P3 , P5 and P6 is 1-competent on the axiom. However, all but P1 are unable to alter the axiom, and these components thus remain 1-competent forever. In those cases, the derivation enters a loop. Given the axiom, the only two-step -comp. aA bB ⇒=1-comp. aA bB c. derivation that does not loop is AB ⇒=1 1 2 -comp. Now a choice must be made. Either we apply P5 to derive aA bB c ⇒=1 5 =1-comp. aCbB c ⇒6 aCbDc, after which the derivation can be finished by 1
In [6,7], we investigated also the ≤k- and ≥k-competence-based cooperation protocols.
CD Grammar Systems: Nonincreasing Competence
75
aCbDc ⇒7=1-comp. abDc ⇒8=1-comp. abc (or, instead, by applying P8 before P7 ). -comp. aAbB c ⇒=1-comp. aAbBc, Otherwise we apply P3 to derive aA bB c ⇒=1 3 4 after which this sequence of applications of P1 , P2 , P3 and P4 can be repeated n − 1 times, for some n ≥ 1, to obtain an Abn Bcn , from which we can de-comp. an A bn B cn ⇒=1-comp. rive an Abn Bcn ⇒1=1-comp. an A bn Bcn ⇒=1 2 5 =1 comp. =1 comp. an Cbn B cn ⇒6 an Cbn Dcn ⇒7 an bn Dcn ⇒8=1-comp. an bn cn (or, instead, by applying P8 before P7 ). Clearly indeed the language L=1-comp. (G) = { an bn cn | n ≥ 1 } is generated. We studied the generative power of CDGSs working in the =k-comp.-mode of derivation and rewriting sequentially (in [6]) or in parallel (in [7]), and obtained the inclusion chains L(ET0L) ⊆ L(CD, parCF, =1-comp.) ⊆ L(CD, parCF, f -comp.) = L(rPR, CF, ac) and L(ET0L) ⊂ L(fRC, CF) ⊆ L(CD, CF, =1-comp.) ⊆ L(CD, CF, f -comp.) = L(RE), for f ∈ { =k | k ≥ 2 }.
4 CD Grammar Systems with Nonincreasing Competence In CDGSs working in =k-comp.-mode of derivation, a component may start rewriting a sentential form provided it is k-competent on the string, and it must rewrite as long as it remains k-competent: only when it is no longer k-competent, another (k-competent) component may start. The moment a component is forced to quit rewriting, it is either j-competent, for some j < k, or -competent, for some > k. In this paper, we introduce CDGSs in which the latter case simply cannot occur: no k-competent component can ever become -competent, for some > k, by rewriting the sentential form, i.e., a component’s competence is nonincreasing during rewriting. We consider two ways of imposing this: a static and a dynamic one. A CDGS G = (N, T, α, P1 , . . . , Pn ) is with statically nonincreasing competence, denoted by sni-CDGS, iff for all 1 ≤ i ≤ n and for all A → z in Pi , (alphN (z) \ {A}) ∩ dom(Pi ) = ∅. In an sni-CDGS, no production with left-hand side A in a component Pi , with 1 ≤ i ≤ n, is thus allowed to have any nonterminals other than A from dom(Pi ) in its righthand side. This definition is strict: it does not take into account the nonterminals that are actually present in the sentential form. Assume a CDGS G with a component P = {A → aB, B → Cb}. Clearly G is not an sni-CDGS. However, P is 1-competent on a sentential form AC and cannot increase its competence by rewriting. On the contrary, while P is also 1-competent on a sentential form AAC, in this case applying P would increase its competence. This calls for a dynamic definition to formalize the intuitive notion of forbidding competence-increasing rewriting steps. A CDGS G = (N, T, α, P1 , . . . , Pn ) works in dynamically nonincreasing competence-based fashion iff it works according to the dynamically nonincreasing =k-competence-based derivation mode, denoted by =k-comp.dni, defined as follows. Let k ≥ 1. Then x ⇒i=k-comp.dni y iff there is a derivation x = x0 ⇒i x1 ⇒i · · · ⇒i xm−1 ⇒i xm = y, for some m ≥ 1, and it satisfies:
76
M.H. ter Beek et al.
(1) clevi (xj ) = k for 0 ≤ j < m and clevi (xm ) < k, or (2) clevi (x0 ) = k, clevi (xj ) ≤ k for 1 ≤ j ≤ m, and y ∈ T ∗ . As usual, ⇒=k-comp.dni denotes ⇒i=k-comp.dni for some i, with 1 ≤ i ≤ n, and the ∗ reflexive transitive closure of ⇒=k-comp.dni is denoted by ⇒=k-comp.dni . The language generated by G in the =k-comp.dni-mode of derivation is ∗
L=k-comp.dni (G) = { w ∈ T ∗ | α ⇒=k-comp.dni w }. The family of languages generated by sni-CDGSs working in =k-comp.-mode of derivation is denoted by L(sni-CD, CF, =k-comp.) if rewriting sequentially and by L(sni-CD, parCF, =k-comp.) if rewriting in parallel. Likewise, the family of languages generated by CDGSs working in =k-comp.dni-mode of derivation is denoted by L(CD, CF, =k-comp.dni) if rewriting sequentially, and by L(CD, parCF, =k-comp.dni) if rewriting in parallel. It is not difficult to see in Example 1 that G is an sni-CDGS and (thus) working in a dynamically nonincreasing competence-based fashion.
5 The Generative Power of Nonincreasing Competence CDGSs working in =1-comp.-mode and rewriting in parallel, independently of whether they are sni-CDGSs or work in a dynamically nonincreasing competence-based fashion, characterize the class of ET0L languages. Theorem 1 L(sni-CD, parCF,=1-comp.) = L(CD, parCF,=1-comp.dni) = L(ET0L). Proof. The statement is proved once we prove the three inclusions L(ET0L) ⊆ L(sni-CD, parCF, =1-comp.) ⊆ L(CD, parCF, =1-comp.dni) ⊆ L(ET0L). As the second inclusion is trivial, we prove the first and the last. [L(ET0L) ⊆ L(sni-CD, parCF, =1-comp.)] Let G = (Σ, H, ω, Δ) be an ET0L system with H = {h1 , . . . , hk }. Without loss of generality, we assume ω equals S ∈ Σ. We define a CDGS G with the disjoint union N = { X (i) | X ∈ Σ, 0 ≤ i ≤ k + 2 } ∪ {F } as nonterminals, set of terminals Δ disjoint from N , axiom S (0) and the components defined below. Simulating the application of one table of H consists of 3 phases: simulating the selected table by encoding the sentential form, applying the table, and decoding the sentential form. The coding is done by the components Pencode,i,X = {X (0) → X (i) } ∪ { Y () → F | Y ∈ Σ, ∈ {1, . . . , k + 2} \ {i} }, for all 1 ≤ i ≤ k + 2 and X ∈ Σ. An application of hi ∈ H is simulated by Papply,i,X = { X (i) → w(k+1) | X → w ∈ hi } ∪ { Y () → F | Y ∈ Σ, ∈ {0, . . . , k + 2} \ {i, k + 1} }, for all 1 ≤ i ≤ k and X ∈ Σ, where for w = x1 · · · xt , with xj ∈ Σ and 1 ≤ j ≤ t, (k+1) (k+1) (k+1) w(k+1) = x1 · · · xt , with xj ∈ N . Decoding is simulated by
CD Grammar Systems: Nonincreasing Competence
77
Pdecode,X = {X (k+1) → X (0) } ∪ {Y () → F | Y ∈ Σ, ∈ {1, . . . , k + 2} \ {k + 1}}, for all X ∈ Σ. After encoding the sentential form to code (k + 2) with components Pencode,k+2,X , the derivation can be finished, for all X ∈ Σ, by Pfinish,X = { X (k+2) → X | X ∈ Δ } ∪ { X (k+2) → F | X ∈ Σ \ Δ } ∪ { Y () → F | Y ∈ Σ, ∈ {0, . . . , k + 1} }, Now G can simulate G. Take a sentential form x = x1 · · ·xt , with xj ∈ Σ and 1 ≤ j ≤ t. Assume that applying hi ∈ H of G leads to y = y1 · · ·yr , with yj ∈ Σ and 1 ≤ j ≤ r. (0) (0) (0) Starting from x(0) = x1 · · ·xt , with xj ∈ N and 1 ≤ j ≤ t, G derives y (0) = (0)
(0)
(0)
y1 · · ·yr , with yj ∈ N and 1 ≤ j ≤ r, as follows. First components Pencode,i,X rewrite each X (0) ∈ alphN (x(0) ) to X (i) . Their 1competence ensures using the same i for each symbol. Next components Papply,i,X (k+1) (k+1) apply a rule of hi for each symbol, producing y (k+1) = y1 · · · yr , with y as above. The components are 1-competent on the sentential form, so each symbol must be rewritten before applying the decoding components. The latter components rewrite each X (k+1) ∈ alphN (y (k+1) ) to X (0) and another table may be simulated. To obtain a terminal word the components must be applied in this order. (0) (0) (0) From the description of G we see that if x1 · · · xt , with xj ∈ N and 1 ≤ j ≤ t, is a sentential form of G , then so is x1 · · · xt , with xj ∈ Σ and 1 ≤ j ≤ t. Hence, starting from axiom S (0) and considering that using Pencode,k+2,X and Pfinish,X , with X ∈ Σ, may produce x1 · · · xt , with xj ∈ Σ and 1 ≤ j ≤ t, from the sentential form (0) (0) (0) x1 · · · xt , with xj ∈ N and 1 ≤ j ≤ t, then we see that G correctly simulates G. [L(CD, parCF, =1-comp.dni) ⊆ L(ET0L)] Let G = (N, T, α, P1 , . . . , Pn ) be a CDGS working in =1-comp.dni-mode, rewriting in parallel. To simulate G, we construct an ET0L system G = (Σ, H, S, T ), with Σ = M ∪ N ∪ T ∪ {S, F }, with M = { pi,A | A ∈ dom(Pi ), 1 ≤ i ≤ n } such that S, F and all symbols in M (called labels from now on) are new symbols not appearing in N ∪ T , and the set H of tables defined below. By definition, all unspecified symbols in a table are rewritten identically. Assume a derivation in G starts by applying Pi , for some 1 ≤ i ≤ n, to α. As G works in =1-comp.dni-mode, only one nonterminal from dom(Pi ) occurs in α. The simulation starts by applying hstart = { S → pα | p ∈ M }. This results in a sentential form pi,A α, for some A ∈ dom(Pi ) and 1 ≤ i ≤ n, in which pi,A is a label from M . Symbol pi,A indicates that Pi (1-competent due to the presence of A) is simulated. As G works in dynamically nonincreasing competence-based fashion, Pi only stops rewriting α if all occurrences of A in α (possibly introduced by successive applications) are replaced. However, Pi may contain more productions with left-hand side A and, as G works in dynamically nonincreasing competence-based fashion, Pi may rewrite occurrences of certain B ∈ dom(Pi ) introduced meanwhile. Note that two distinct nonterminals from dom(Pi ) may never occur in a sentential form. To simulate the components of G, we construct the tables
78
M.H. ter Beek et al.
happly,i,A = { A → z | A → z ∈ Pi } ∪ { pi,A → pi,A , pi,A → pi,B , B → F | B ∈ dom(Pi ), B = A } ∪ { p → F | p ∈ M \ {pi,A } }, for all A ∈ dom(Pi ) and 1 ≤ i ≤ n. Table happly,i,A , for some A ∈ dom(Pi ) and 1 ≤ i ≤ n, is applied to the sentential form pi,A α until it has rewritten all occurrences of A in α (also those introduced by successive applications). As an F (which can never be rewritten) is introduced in case A is not the only nonterminal from dom(Pi ) appearing in α, in any successful derivation of G this table is only applied if Pi could be applied to α in a derivation of G. Moreover, the productions replacing all labels p = pi,A by F guarantee that this table is only applied if label pi,A is present in the sentential form. Note that this table can rewrite label pi,A by pi,B , for some B ∈ dom(Pi ), to faithfully mimic the fact that G works in dynamically nonincreasing competence-based fashion. It remains to guarantee that this table is indeed applied to sentential form pi,A α until it has rewritten all occurrences of A in α (possibly introduced earlier). Therefore, we construct the tables htest,i,A = { pi,A → p | pi,A , p ∈ M, p = pi,A } ∪ { B → F | B ∈ dom(Pi ) }, for all A ∈ dom(Pi ) and 1 ≤ i ≤ n. By applying one of these tables, G can start simulating the application of another component from G (indicated by label p). However, clearly no successful derivation exists in case not all occurrences of A in the sentential form are replaced. The simulation described so far is repeated for all components that are applied in a successful derivation in G. To successfully finish the simulation, we construct table hfinish = { p → λ | p ∈ M } ∪ { A → F | A ∈ Σ \ (M ∪ T ) }. Clearly no successful derivation exists if this table is applied before the only nonterminal symbol remaining in the sentential form is a label from M . The situation is quite different for CDGSs working in =1-comp.-mode and rewriting sequentially: the two definitions of nonincreasing competence lead to different language classes. While sni-CDGSs working in =1-comp.-mode and rewriting sequentially still characterize the class of ET0L languages, CDGSs working in =1-comp.dni-mode and rewriting sequentially characterize the strictly more powerful class of languages generated by context-free forbidding random context grammars. To prove this, we need a normal-form result for context-free forbidding random context grammars [14]; for the reader’s convenience we include the proof of the next lemma. Lemma 1. Any context-free forbidding random context language L can be generated by a context-free forbidding random context grammar (N, T, P, S) whose productions (A → z, ∅, R) ∈ P satisfy z ∈ / (N ∪ T )∗ R(N ∪ T )∗ , i.e., the forbidding contexts of productions do not appear in their right-hand sides. Proof. Let G = (N, T, P, S) be a context-free forbidding random context grammar so that L(G) = L. We construct a context-free forbidding random context grammar
CD Grammar Systems: Nonincreasing Competence
79
G = (N ∪ N , T, P , S) in normal form, with N = { A | A ∈ N }, N = { A | A ∈ N } (N , N , and N are pairwise disjoint), and P = { (A → A , ∅, N ), (A → g(z), ∅, R ∪ N ) | (A → z, ∅, R) ∈ P } ∪ { (A → A, ∅, N ) | A ∈ N }, with the homomorphism g : (N ∪ T )∗ → (N ∪ T )∗ defined by g(a) = a if a ∈ N and g(a) = a if a ∈ T . Consider a production p = (A → z, ∅, R) and a sentential form with occurrences of A and no nonterminal from R (otherwise no successful derivation exists for this p). The application of p in G is simulated as follows in G . First an A is primed (the derivation will block if another nonterminal is primed), then A is replaced by g(z) (blocking the priming of nonterminals). To continue successfully, all (if any) doubly primed nonterminals are unprimed. This results in a sentential form without (doubly) primed nonterminals, and another production from P can be simulated. We are now ready for the next theorem. Theorem 2 L(ET0L) = L(sni-CD, CF, =1-comp.) ⊂ L(fRC, CF) = L(CD, CF, =1-comp.dni). Proof. Recall that L(ET0L) ⊂ L(fRC, CF). We first prove the two inclusions that together prove the first equality in the statement of this theorem, in both cases using the same ideas that we used to prove Theorem 1. [L(ET0L) ⊆ L(sni-CD, CF, =1-comp.)] We simulate an ET0L system G = (Σ, H, ω, Δ) with the CDGS G that we defined in the proof of Theorem 1 to prove the inclusion L(ET0L) ⊆ L(sni-CD, parCF, =1-comp.). This CDGS simulates the application of some table hi ∈ H in three phases: simulating h by encoding the sentential form, applying h, and decoding the sentential form. The reader may verify that G is indeed an sni-CDGS and that the simulation of G still works if G rewrites sequentially. [L(sni-CD, CF, =1-comp.) ⊆ L(ET0L)] Let G = (N, T, α, P1 , . . . , Pn ) be an sni-CDGS working in =1-comp.-mode and rewriting sequentially. To simulate G, we construct an ET0L system G = (Σ, H, S, T ), where Σ = M ∪ N ∪ T ∪ {S, F }, with M = { pi,A | A ∈ dom(Pi ), 1 ≤ i ≤ n } and S, F and all symbols in M (called labels from now on) are new symbols not appearing in N ∪T , and H contains the tables defined below. As usual, all unspecified symbols in a table are rewritten identically. Let G start a derivation from α by applying Pi , for some 1 ≤ i ≤ n. Working in =1-comp.-mode, α contains only one occurrence of A ∈ dom(Pi ). The simulation thus starts by applying hstart = { S → pα | p ∈ M }. This results in a sentential form pi,A α, for some A ∈ dom(Pi ) and 1 ≤ i ≤ n, in which pi,A is a label from M indicating the simulation of Pi (1-competent due to the presence of A). As G is an sni-CDGS, component Pi only stops rewriting when all occurrences of A in α (also those introduced by successive applications of Pi along the way) are replaced. Component Pi may however contain more productions with left-hand side A. We thus construct tables apply
hi,A = {(A → z) ∈ Pi } ∪ {B → F, p → F | B = A, B ∈ dom(Pi ), p ∈ M \ {pi,A }}
80
M.H. ter Beek et al. apply
for all A ∈ dom(Pi ) and 1 ≤ i ≤ n. The idea is to apply hi,A , for some A ∈ dom(Pi ) and 1 ≤ i ≤ n, to the sentential form pi,A α until all occurrences of A in α are rewritten (also those introduced by its successive applications). Symbol F (that cannot be rewritten) is introduced in case A is not the only nonterminal from dom(Pi ) in α, guaranteeing that in a successful derivation of G this table is only applied if Pi could be applied to α according to G. The productions replacing all labels p = pi,A by F guarantee that this table is only applied if label pi,A is present in the sentential form. It remains to guarantee that this table is indeed applied to the sentential form pi,A α until it has rewritten all occurrences of A in α (including those introduced by earlier applications). To this aim, we construct the tables htest i,A = { pi,A → p | pi,A , p ∈ M, p = pi,A } ∪ { B → F | B ∈ dom(Pi ) }, for all A ∈ dom(Pi ) and 1 ≤ i ≤ n. By applying one of these tables, G can start simulating the application of another component from G (indicated by label p). However, clearly no successful derivation exists if not yet all occurrences of A in the sentential form have been replaced. The above simulation is repeated for all components applied in a successful derivation in G. To successfully finish simulating a derivation in G we apply table hfinish = { p → λ | p ∈ M } ∪ { A → F | A ∈ Σ \ (M ∪ T ) }. No successful derivation exists if hfinish is applied before the only nonterminal symbol remaining is a label from M . This proves the inclusion. We now prove the second equality in the statement of this theorem. [L(fRC, CF) ⊆ L(CD, CF, =1-comp.dni)] Let G = (N, T, P, S) be a forbidding random context grammar such that every random context rule (A → z, ∅, R) in P satisfies z ∈ (N ∪ T )∗ R(N ∪ T )∗ . Note that A ∈ R is possible. Without loss of generality, let each random context rule have a unique label p (the set of all labels is Λ). To simulate G we construct G , with disjoint union of sets of nonterminals N = N ∪ {F } ∪ {A | A ∈ N } ∪ {Ap | A ∈ N, p ∈ Λ}, terminals T , axiom S and the components defined below. A simulation of the application of a random context rule (A → z, ∅, R) has two phases: Simulating it by marking all nonterminals A in the sentential form and applying it at appropriate places. The marking is as follows: (1) In case A ∈ R we introduce the component Pmark,p = {A → Ap } ∪ { B → F | B ∈ R } ∪ { Bq → F | B ∈ N, q ∈ Λ, Bq = Ap }. (2) In case A ∈ R we introduce the component Pmark,p = {A → A , A → Ap } ∪ { B → F | B ∈ R } ∪ { Bq → F | B ∈ N, q ∈ Λ, Bq = Ap }. Finally, after the marking, the derivation may continue by the component Papply,p = {Ap → A, Ap → z} ∪ { Bq → F | B ∈ N, q ∈ Λ }. This completes the description of the CDGS G . Next we explain how G can be used to simulate the forbidding random context grammar G.
CD Grammar Systems: Nonincreasing Competence
81
Consider applying the random context rule (A → z, ∅, R) labelled p to a sentential form α with at least one occurrence of A and no symbol from R. Recall z ∈ (N ∪ T )∗ R(N ∪ T )∗ . The sentential form α is thus α = α1 Aα2 Aα3 . . . αn−1 Aαn , where n ≥ 2 and αi ∈ ((N \ {A}) ∪ T )∗ , for 1 ≤ i ≤ n. Then we consider two cases, according to whether A ∈ R or A ∈ R. In the former case the random context rule can be applied several times to α, obtaining a sentential form α = α1 β1 α2 β2 α3 . . . αn−1 βn−1 αn , where βi , for 1 ≤ i ≤ n, is either A or z. These derivations can be mimicked by applying the 1-competent component Pmark,p , which verifies that no symbol from R is present and replaces every A by Ap , followed by an application of Papply,p , which is also 1-competent. During this application, all Ap are replaced by either A or z — note that if all Ap are replaced by A, we get the original sentential form α. This shows G can generate the sentential form α . Note how shortcuts are circumvented by rules introducing F . Finally, in the latter case, i.e., if A ∈ R, we observe that whenever random context rule p can be applied to α (assumed to contain no symbol from R) it must satisfy α = α1 Aα2 , where αi ∈ ((N \ {A}) ∪ T )∗ , for 1 ≤ i ≤ 2, leading to α = α1 zα2 . This derivation can again be mimicked by Pmark,p followed by Papply,p , where the dynamically nonincreasing feature comes into play. Observe that if α contains at least two occurrences of A and no symbol from R, then Pmark,p is 1-competent at the start. Hence rewriting one A by A results in an increase in competence. Since this is not allowed if the CDGS G works in =1-comp.dni-mode, the derivation blocks. Thus, the only way to successfully apply Pmark,p on α requires α = α1 Aα2 with αi ∈ ((N \{A})∪T )∗ , for 1 ≤ i ≤ 2. Then it is easy to see that the sentential form α = α1 zα2 can be generated by G , proving the inclusion. [L(CD, CF, =1-comp.dni) ⊆ L(fRC, CF)] Let G = (N, T, α, P1 , . . . , Pn ) be a CDGS working in =1-comp.dni-mode and rewriting sequentially. To simulate G we construct a context-free forbidding random context grammar G = (N , T, P, S ) with N = N ∪ {S } ∪ { pi | 1 ≤ i ≤ n } and S and all pi , for 1 ≤ i ≤ n, symbols not appearing in N . Assume G starts a derivation by applying Pi , for some 1 ≤ i ≤ n, to α. As G works in =1-comp.dni-mode, only one nonterminal from dom(Pi ) occurs in α. The simulation starts by applying a random context rule (S → pi α, ∅, ∅), for 1 ≤ i ≤ n, leading to sentential form pi α showing Pi is simulated next. As G works in =1-comp.dni-mode, Pi only stops rewriting if all occurrences of some nonterminal A in α are replaced (also those introduced by successive applications). However, as Pi may have several productions with left-hand side A it might also rewrite occurrences of certain B ∈ dom(Pi ). No two distinct nonterminals from dom(Pi ) may ever occur both in the sentential form. To simulate Pi , for 1 ≤ i ≤ n, we construct the random context rules (A → z, ∅, { pj | 1 ≤ j ≤ n, i = j } ∪ (dom(Pi ) \ {A})), for every A → z ∈ Pi . The random context rules can only be applied to a sentential form pi α and only one nonterminal from dom(Pi ) can occur. Rewriting continues until
82
M.H. ter Beek et al.
all occurrences of nonterminal A from dom(Pi ) in α are rewritten (including those introduced by successive applications). Then another component Pj , for 1 ≤ j ≤ n, of G may continue the derivation. We therefore introduce for every i and j with 1 ≤ i, j ≤ n and i = j, the random context rules (pi → pj , ∅, dom(Pi )), ensuring that the label is changed from pi to pj iff no nonterminal from dom(Pi ) occurs. Hence, component Pi has become zero-competent on the current sentential form. The simulation described above is now repeated for all components that are applied by G in a successful derivation. Finally, to successfully finish simulating a derivation by G, we apply the rule (pi → λ, ∅, N ), for 1 ≤ i ≤ n. It is clear that none of these rules can be applied as long as one nonterminal is present. This proves the inclusion. We now turn our attention to CDGSs working in =k-comp.-mode, for some k ≥ 2, and rewriting in parallel. Independently of whether the CDGSs are sni-CDGSs or work in a dynamically nonincreasing competence-based fashion, for k ≥ 2 the family of languages generated by context-free recurrent programmed grammars with appearance checking is characterized. Theorem 3 L(sni-CD, parCF,=k-comp.) = L(CD, parCF,=k-comp.dni) = L(rPR, CF, ac), for k ≥ 2. Proof. Once we show L(rPR, CF, ac) ⊆ L(sni-CD, parCF, =k-comp.) ⊆ L(CD, parCF, =k-comp.dni) ⊆ L(rPR, CF, ac), for k ≥ 2, the statement is proved. Since the second inclusion is trivial, we only prove the other two. [L(rPR, CF, ac) ⊆ L(CD, parCF, =k-comp., sni)] Let k = 2. Generalizing the proof to the case k > 2 is straightforward and left to the reader. Let G = (N, T, P, S, Λ, σ, φ) be a recurrent programmed grammar with appearance checking. We assume productions of the form p : (A → z, σ(p), φ(p)), with success field σ(p) and failure field φ(p). As G is a recurrent programmed grammar with appearance checking, each production p ∈ Λ is such that p ∈ σ(p), and either φ(p) = ∅ or φ(p) = σ(p). Without loss of generality, assume only p1 is able to rewrite S. To simulate G, we construct an sni-CDGS G with disjoint union N = N ∪ { p, p | p ∈ Λ } ∪ {F, Z} of nonterminals, terminals T disjoint from N , axiom Sp1 Z and the components defined next. For each production p : (A → z, σ(p), φ(p)) such that q ∈ σ(p) with q = p, we construct the components Pp,q,present = {A → zq, A → A, p → p } ∪ { r → F | r ∈ Λ \ {q, p} }, Pp,q,clean = {p → λ, q → q} and Pp,q,clean = {p → λ, q → q}, and in case φ(p) = ∅, with φ(p) = σ(p), the additional components Pp,q,absent = {A → F, p → q, Z → Z}. Note that at any time, two types of markers are present in the sentential form. A general marker Z, sometimes used to guarantee that components are 2-competent, and a specific marker p (or its primed version), which is the label of the context-free production being simulated.
CD Grammar Systems: Nonincreasing Competence
83
First assume p : (A → z, σ(p), φ(p)) is such that φ(p) = ∅. Also assume a sentential form with one or more occurences of A. Then each Pp,q,present , with q ∈ σ(p), with q = p, is 2-competent. Note that the moment Pp,q,present replaces p by its primed version, it is no longer 2-competent. No successful derivation exists if p → p is applied before A → zq introduced q. After one occurrence of A is replaced by zq, then either another occurrence of A is replaced by zq or p is primed. In the latter case, only Pp,q,clean is 2-competent and its application deletes p . In the former case, both Pp,q,clean and Pq,p,clean = {q → λ, p → p} are 2-competent. Applying Pp,q,clean leads to deleting p, while Pq,p,clean leads to deleting q. In both cases, we thus obtain a sentential form ready to simulate a new context-free production, labelled with either q or p. Note that productions r → F , for all r ∈ Λ \ {q, p}, in Pp,q,present guarantee that only occurrences of q or p occur in a sentential form before the production q or p, respectively, is simulated. Note that in G, the application of A → z can be repeated as long as there are occurrences of A in the sentential form, since by definition p ∈ σ(p). The fact that G must be an sni-CDGS, however, forces us to require that q = p in Pp,q,present , which thus indicates that the context-free production q from the success field of p must be applied next. Nevertheless, we have seen that several occurrences of A can be replaced, thus simulating p ∈ σ(p). Hence q indicates that eventually this context-free production from the success field of p must be applied, but not necessarily immediately. Now assume p : (A → z, σ(p), φ(p)) is such that σ(p) = φ(p) = ∅, and a sentential form without any A. If it contains label p, then for each q ∈ φ(p) we have a 2-competent Pp,q,absent . After a Pp,q,absent replaced p by q, it is no longer 2-competent and we get a sentential form ready to simulate the production labelled q, thus simulating the “failed” application of p. Finally, a derivation can finish only when no more nonterminals other than Z or p, for some p ∈ Λ, appear in the sentential form, in which case Pfinish = { p → λ | p ∈ Λ } ∪ {Z → λ} is 2-competent and it removes all remaining nonterminals from the sentential form until a terminal word is obtained. Note that an earlier application of component Pfinish (i.e., when the sentential form still contains nonterminals other than those from { p | p ∈ Λ } ∪ {Z}) blocks a successful derivation. This is because such an application would remove either p ∈ Λ or Z, but not both. If p ∈ Λ is removed too early, then the only possible 2-competent component is Pabsent but in that case it would introduce an F and block a successful derivation. If Z is removed too early, then a successful derivation is blocked due to the fact that Pfinish can no longer become 2-competent and the sentential form thus always contains some p ∈ Λ. We described the sni-CDGS G . The reader can verify that if productions are applied in a different order, no successful derivation exists. Working in =2-comp.-mode and rewriting in parallel, G simulates the recurrent programmed grammar G with appearance checking and generates L(G). [L(CD, parCF, =k-comp.dni) ⊆ L(rPR, CF, ac)] We consider a CDGS G = (N, T, α, P1 , . . . , Pn ) working in =k-comp.dni-mode and rewriting in parallel. To simulate G, we construct the recurrent programmed grammar G = (N , T, P, S, Λ, σ, φ)
84
M.H. ter Beek et al.
with appearance checking. In G , the nonterminals N = N ∪ { A | A ∈ N } ∪ {S, F } are such that S and F are new symbols not appearing in N ∪ T , while P , Λ, σ and φ are as defined below. For all Pi , with 1 ≤ i ≤ n, and all X ⊆ dom(Pi ), with |X| = k, we construct the set present apply absent test decode test ∪ Pi,X ∪ Pi,X ∪ Pi,X ∪ Pi,X ∪ Pi,X as below. For all Y ⊆ of productions Pi,X check check dom(Pi ), with |Y | < k, we construct as follows the set of productions Pi,Y ∪ Pi,Y . present test the presence of the symbols in X in the sentential form, while those Those in Pi,X absent in Pi,X test the absence of all symbols in dom(Pi ) \ X. By alternating productions from the other components, some productions from Pi with left-hand sides in X are applied (using a coding to prime nonterminals) and in between we test if Pi is still kcheck competent. In detail, productions in Pi,Y test the presence of the symbols in Y in the check sentential form, while those in Pi,Y test the absence of all symbols in dom(Pi ) \ Y . For notational convenience, we identify rules and their labels, and rule sets and sets of labels of rules. present Let X = {A1 , . . . , Ak } and let dom(Pi ) \ X = {C1 , . . . , Cm }. Then Pi,X contains the following k productions, with 1 ≤ j ≤ k − 1: present present present : (Aj → Aj , {ri,X,A , ri,X,A }, ∅) and ri,X,A j j j+1 present present absent ri,X,A : (Ak → Ak , {ri,X,A } ∪ {ri,X,C }, ∅). 1 k k
In case of a successful derivation, these productions check the presence of all symabsent is to be applied next. bols Aj , with 1 ≤ j ≤ k, after which eventually production ri,X,C 1 absent This production is part of Pi,X , which contains the following m = |dom(Pi ) \ X| productions, with 1 ≤ ≤ m − 1: absent absent absent absent absent : (C → F, {ri,X,C , ri,X,C }, {ri,X,C , ri,X,C }) and ri,X,C +1 +1 apply apply absent absent absent : (Cm → F, {ri,X,C } ∪ Pi,X , {ri,X,C } ∪ Pi,X ). ri,X,C m m m
Let F be a failure symbol (that cannot be rewritten): no successful derivation exists if F is introduced in the sentential form. In case of a successful derivation, we thus checked the absence of all symbols from dom(Pi ) \ X and eventually one of the productions apply from Pi,X is to be applied next. apply
Productions in Pi,X simulate the applications of those productions in Pi that have Aj , with 1 ≤ j ≤ k, as their left-hand side (recall that X = {A1 , . . . , Ak }). However, as G works in =k-comp.dni-mode, we need to prime nonterminals to distinguish those occurrences present in the sentential form before rewriting the Aj from those indecode troduced by rewriting the Aj . The unpriming is later done by productions from Pi,X . As G rewrites in parallel, we also need to test that all occurrences of Aj are primed, test test and Pi,X , respectively. and eventually unprimed. This is done by productions from Pi,X Finally, after each application of a production that rewrites Aj , we need to test if Pi is check check and Pi,X do so in the way described above. still k-competent. Productions from Pi,X apply Note that we use the fact that directly after the first production from Pi,X with Aj as its left-hand side has been applied, we know the symbols from X \{Aj } are still present present in the sentential form — as this was tested earlier by Pi,X .
CD Grammar Systems: Nonincreasing Competence
85
apply apply The set Pi,X is the union Aj ∈X Pi,X,Aj of the following sets constructed for each symbol in X, with 1 ≤ j ≤ k: test test }, Pi,X ∪ {ri,X,A }) | (Aj → z) ∈ Pi }, Pi,X,Aj = {(Aj → z , Pi,X ∪ {ri,X,A 1 1 apply
apply
apply
where z is obtained from z by priming all (and only) its nonterminals. test Rule set Pi,X contains the following k productions, with 1 ≤ j ≤ k − 1: test test test test test : (Aj → F, {ri,X,A , ri,X,A }, {ri,X,A , ri,X,A }) and ri,X,A j j j+1 j j+1 test test decode test decode ri,X,A : (Ak → F, {ri,X,A } ∪ Pi,X , {ri,X,A } ∪ Pi,X ). k k k decode Let Pi,X , used for unpriming the sentential form, be the set of rules
decode decode test decode test Pi,X = { (Y → Y, Pi,X ∪ {ri,X,A ∪ {ri,X,A }, Pi,X }) | Y ∈ N }. 1 1
test contains the Let A1 , . . . , Ap be primed versions of all nonterminals in N . Then Pi,X following |N | productions, with 1 ≤ j ≤ p − 1:
test test test test test : (Aj → F, {ri,X,A , ri,X,A }, {ri,X,A , ri,X,A }) and ri,X,A j j j+1 j j+1 present test test : (Ap → F, {ri,X,A } ∪ { ri,X ri,X,A ,B | X = {B1 , . . . , Bk } ⊆ dom(Pi ) } p p 1 check ∪ { ri,Y,B | Y = {B1 , . . . , Bj } ⊆ dom(Pi ), |Y | < k }, 1
present test {ri,X,A } ∪ { ri,X ,B1 | X = {B1 , . . . , Bk } ⊆ dom(Pi ) } ∪ p check | Y = {B1 , . . . , Bj } ⊆ dom(Pi ), |Y | < k }). { ri,Y,B 1
In case of a sucessful derivation, it is possible to continue the derivation with component i using some set X ⊂ dom(Pi ) of nonterminals of size k for the k-competent derivation, or to drop the derivation of the ith component. In the latter case, we must verify that the level of competence has not increased and dropped to some subset Y ⊆ dom(Pi ) of size strictly less than k. Therefore, let Y = {B1 , . . . , Bj }, with check j < k, and let dom(Pi )\Y = {D1 , . . . , Dq }. Then Pi,Y contains these j productions, with 1 ≤ h ≤ j − 1: check check check : (Bh → Bh , {ri,Y,B , ri,Y,B }, ∅) and ri,Y,B h h h+1
check check check ri,Y,B : (Bj → Bj , {ri,Y,B } ∪ {ri,Y,D }, ∅). j j 1
In case of a successful derivation, these productions check the presence of all symcheck is to be applied bols Bh , with 1 ≤ h ≤ j, after which eventually production ri,Y,D 1 check next. This production is part of Pi,Y , which contains the following q = |dom(Pi )\Y | productions, with 1 ≤ ≤ q − 1:
check check check check check : (D → F, {ri,Y,D , ri,Y,D }, {ri,Y,D , ri,Y,D }) and ri,Y,D +1 +1 present check check : (Dq → F, {ri,Y,D } ∪ {rj,X,A | j = i, X = {A1 , . . . , Ak } ⊆ dom(Pj )}, ri,Y,D q q 1
present check {ri,Y,D } ∪ {rj,X,A1 | j = i, X = {A1 , . . . , Ak } ⊆ dom(Pj )}). q
86
M.H. ter Beek et al.
Another competent enough component can be chosen for further rewriting. Finally, note that G has a word α as axiom, whereas G has a symbol S as axiom. Therefore G moreover contains the following production: present | 1 ≤ i ≤ n, X = {A1 , . . . , Ak } ⊆ dom(Pi ) }, ∅). s : (S → α, {s} ∪ { ri,X,A 1
Given axiom S, the application of this production s results in the sentential form α, after which the simulation of applying a k-competent component Pi , with 1 ≤ i ≤ n, present present from Pi,X , for a subset X of the domain is started by applying a production ri,X,A 1 of Pi with cardinality k. We described the recurrent programmed grammar G with appearance checking. The reader can verify that no successful derivation exists if productions are applied in different orders. This is ensured by productions guaranteeing, when needed, the introduction of failure symbol F that cannot be rewritten. The recurrent programmed grammar G with appearance checking simulates the CDGS G working in =k-comp.dni-mode and rewriting in parallel, and generates L(G). This proves the inclusion. In contrast, for CDGSs working in =k-comp.-mode, for some k ≥ 2, and rewriting sequentially, we do not know whether the two definitions of nonincreasing competence lead to different language classes. What we do know is that, for k ≥ 2, sni-CDGSs working in =k-comp.-mode and rewriting sequentially can generate all languages that can be generated by context-free recurrent programmed grammars with appearance checking, while CDGSs working in =k-comp.dni-mode and rewriting sequentially can generate all languages that can be generated by context-free programmed grammars with appearance checking. Theorem 4. L(rPR, CF, ac) ⊆ L(sni-CD, CF,=k-comp.) = L(CD, CF, =k-comp.dni), for k ≥ 2.
⊆
L(PR, CF, ac)
Proof. We prove the first inclusion (the second is trivial) and the equality, both for k = 2. The generalizations of the proofs to the cases that k > 2 are rather straightforward and left to the reader. Hence, let k = 2. [L(rPR, CF, ac) ⊆ L(sni-CD, CF, =k-comp.)] This follows directly from the proof of the inclusion L(rPR, CF, ac) ⊆ L(sni-CD, parCF, =k-comp.) in Theorem 3. It is easy to see that the exact same construction suffices. Now consider the equality in the statement above. We only prove the inclusion from left to right, as the reverse direction is obvious. [L(PR, CF, ac) ⊆ L(CD, CF, =k-comp.dni)] Let G = (N, T, P, S, Λ, σ, φ) be a programmed grammar with appearance checking. We assume its productions are of the form p : (A → z, σ(p), φ(p)), with success field σ(p) and failure field φ(p) so that p ∈ σ(p) ∪ φ(p). Without loss of generality, assume p1 is its only production able to rewrite S. To simulate G, we construct a CDGS G with the disjoint union of sets of nonterminals N = N ∪ {F, Z} ∪ { p, p | p ∈ Λ } ∪ Np , with Np = { Ap , Ap , A˜p | A ∈ N }, p∈Λ
CD Grammar Systems: Nonincreasing Competence
87
terminals T disjoint from N , axiom Sp1 Z and the components defined next. For each production p : (A → z, σ(p), φ(p)), we construct the components Pp,code = {A → Ap , A → Ap } ∪ {p → p} and Pp,uncode = {Ap → A} ∪ {p → p}. Now a successful application of production p is simulated by the components Pp,present = {Ap → A˜p , A˜p → A˜p } ∪ {p → p }, Pp,apply = {A˜p → z} ∪ {p → p } and Pp,finish = { B → F | B ∈ Np } ∪ {Z → Z} ∪ { p → q | q ∈ σ(p), q = p }, while a “failed” application of production p is simulated by the component Pp,absent = {B → F | B ∈ Nq , q ∈ Λ} ∪ {A → F, Z → Z} ∪ {p → q | q ∈ φ(p), q = p}. Two types of markers are present in any sentential form: A general one (Z) to guarantee that components are 2-competent and a specific one (p, or its primed version) to indicate the context-free production being simulated. Let p : (A → z, σ(p), φ(p)) be the production to be applied to the current sentential form, which we assume to contain one or more occurrences of A. The only 2-competent component which does not introduce a trap symbol F is Pp,code . The moment Pp,code replaces the last nonterminal A, it is no longer 2-competent. All nonterminals A are then replaced by Ap or AP , respectively. Now Pp,uncode is 2-competent if in the previous step nonterminals Ap were introduced. In this case, all these nonterminals are rewritten to A. There may thus be nonterminals Ap left in the sentential form — if there is no Ap present, we are left with the sentential form we started with. Now assume that the current sentential form has at least one Ap . Then Pp,present is 2-competent on this sentential form; other components that may be competent under certain further assumptions, like Pp,finish or Pp,absent , do not lead to a successful derivation. Also, no successful derivation exists if p → p is applied before Ap → A˜p by Pp,present . If one occurrence of Ap is replaced by A˜p , then either Pp,present becomes 3competent, in case another nonterminal Ap is present in the sentential form, or it remains 2-competent and production p → p is applied, while the level of competence drops to 1. Thus Pp,present is applicable iff exactly one occurrence of nonterminal Ap is present in the sentential form under consideration, which is then replaced by A˜p (and p by p ). Here the dynamically nonincreasing feature is used to ensure that the sentential from contains exactly one nonterminal Ap for rewriting. The derivation continues with Pp,apply followed by Pp,finish , leading to a sentential form in which the former A˜p is replaced by z and the label is changed to q ∈ σ(p). Note that a production Z → Z is used to force the 2-competence of Pp,finish , and that it blocks shortcuts whenever p and A˜p are present simultaneously, in case Pp,apply was not applied after Pp,present . This shows how to successfully apply production p of G. Now assume no A occurs in the sentential form. Then Pp,absent is 2-competent on this sentential form. If Pp,absent replaces p by q, for q ∈ φ(p), it is no longer 2-competent and the sentential form can simulate the production labelled q, thus simulating the “failed” application of p.
88
M.H. ter Beek et al.
Finally, a derivation can only finish when no more nonterminals other than Z or p, for some p ∈ Λ, appear in the sentential form, in which case Pp,terminate = {Z → λ, p → λ} ∪ { B → F | B ∈ N } is 2-competent and it removes all remaining nonterminals from the sentential form until a terminal word is obtained. An earlier application of component Pp,terminate is not possible, even in case a primed label appears, as then also a nonterminal A˜p occurs and Pp,terminate is at least 3-competent. If, on the other hand, nonterminal p is removed and the derivation of Pp,terminate is stopped because it became 1-competent, then a successful derivation is blocked because no other component can become 2-competent anymore. A similar reasoning can be applied if nonterminal Z is removed first. Whenever Pp,terminate is applied, it thus has to remove both nonterminals p and Z. We described the CDGS G working in =2-comp.dni-mode and rewriting sequentially. The reader can verify that no successful derivation exists if productions are applied in a different order. G thus simulates the programmed grammar G with appearance checking, and generates L(G).
6 Conclusion In this paper, we introduced and examined both a static and a dynamic definition of nonincreasing competence in CDGSs working in =k-comp.-mode of derivation, for some k ≥ 1, and rewriting in a context-free sequential or parallel manner. We obtained the following chain of inclusions, with k ≥ 2: L(ET0L) = L(sni-CD, parCF, =1-comp.) = L(CD, parCF, =1-comp.dni) = L(sni-CD, CF, =1-comp.) ⊂ L(CD, CF, =1-comp.dni) = L(fRC, CF) ⊆ L(sni-CD,parCF,=k-comp.) = L(CD,parCF,=k-comp.dni) = L(RC,ET0L) ⊆ L(sni-CD, CF, =k-comp.) ⊆ L(CD, CF, =k-comp.dni) = L(RE). Our results might help solve a longstanding open problem in regulated rewriting: is L(RC, ET0L) = L(rPR, CF, ac) ⊆ L(PR, CF, ac) = L(RE) strict? In Table 1 we compare the results we obtained in this paper with the results we obtained in [6,7]. This table should be read as follows: the entry at the intersection of the ith row, marked by a mode f , and the jth column, is either a language family L which coincides with the family X at the top of the column having components working in the appropriate mode or an expression of the form L1 ⊂ · = L2 , which means that L1 ⊂ X = L2 holds. For instance, for L(CD, CF, =1-comp.dni) we have L(ET0L) ⊂ · = L(fRC), which means L(ET0L) ⊂ L(CD, CF, =1-comp.dni) = L(fRC). This table shows some interesting open problems. It would, e.g., be interesting to know the generative power of CDGSs working in the ordinary =1-comp.-mode of derivation and rewriting sequentially. All we know is this: L(ET0L) = L(sni-CD, CF, =1-comp.) ⊂ L(CD, CF, =1-comp.dni) = L(fRC, CF) ⊆ L(CD, CF, =1-comp.) ⊆ L(CD, CF, =2-comp.) = L(RE).
CD Grammar Systems: Nonincreasing Competence
89
Table 1. Generative power CDGS in (static/dynamic nonincreasing) =k-comp.-mode
Acknowledgements We thank an anonymous referee of [7] for suggesting to consider also a dynamic definition of nonincreasing competence-based derivation.
References 1. Meersman, R., Rozenberg, G.: Cooperating Grammar Systems. In: Winkowski, J. (ed.) MFCS 1978. LNCS, vol. 64, pp. 364–374. Springer, Heidelberg (1978) 2. Csuhaj–Varj´u, E., Dassow, J.: On Cooperating Distributed Grammar Systems. Journal of Information Processing and Cybernetics EIK 26, 49–63 (1990) 3. Csuhaj–Varj´u, E., Dassow, J., Kelemen, J., P˘aun, G.: Grammar Systems: A Grammatical Approach to Distribution and Cooperation. Topics in Computer Mathematics, vol. 5. Gordon and Breach, London (1994) 4. Dassow, J., P˘aun, G., Rozenberg, G.: Grammar Systems. In: [13], vol. 2, ch. 4, pp. 155–213 (1997) 5. Bordihn, H., Csuhaj–Varj´u, E.: On Competence and Completeness in CD Grammar Systems. Acta Cybernetica 12, 347–361 (1996) 6. ter Beek, M.H., Csuhaj–Varj´u, E., Holzer, M., Vaszil, G.: On Competence in CD Grammar Systems. In: Calude, C.S., Calude, E., Dinneen, M.J. (eds.) DLT 2004. LNCS, vol. 3340, pp. 76–88. Springer, Heidelberg (2004) 7. ter Beek, M.H., Csuhaj–Varj´u, E., Holzer, M., Vaszil, G.: On Competence in CD Grammar Systems with Parallel Rewriting. International Journal of Foundations of Computer Science 18, 1425–1439 (2007) 8. Csuhaj–Varj´u, E., Dassow, J., Holzer, M.: CD Grammar Systems with Competence Based Entry Conditions in their Cooperation Protocols. International Journal of Computer Mathematics 83, 159–169 (2006) 9. von Solms, S.H.: Some Notes on ET0L-languages. International Journal of Computer Mathematics 5, 285–296 (1975) 10. Bordihn, H., Holzer, M.: Grammar Systems with Negated Conditions in their Cooperation Protocols. Journal of Universal Computer Science 6, 1165–1184 (2000) 11. Fernau, H., W¨atjen, D.: Remarks on Regulated Limited ET0L Systems and Regulated Context-Free Grammars. Theoretical Computer Science 194, 35–55 (1998) 12. Dassow, J., P˘aun, G.: Regulated Rewriting in Formal Language Theory. EATCS Monographs in Theoretical Computer Science, vol. 18. Springer, Berlin (1989) 13. Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages, vol. 1-3. Springer, Berlin (1997) 14. Bordihn, H., Holzer, M.: Personal communication
On the Expressive Power of Valences in Cooperating Distributed Grammar Systems Henning Fernau1 and Ralf Stiebe2 1
2
Fachbereich IV, Abteilung Informatik, Universit¨at Trier, D–54286 Trier, Germany [email protected] Fakult¨at f¨ur Informatik, Otto-von-Guericke-Universit¨at Magdeburg PF-4120, D-39016 Magdeburg, Germany [email protected]
Abstract. This paper introduces three different ways of combining valences into CD grammar systems. We focus on characterizing and comparing the obtained language families. Interestingly, the underlying concepts had some anniversaries this year: Valence grammars were introduced 30 years ago, and the first paper that combined valences and CD grammar systems was published 20 years ago.
1 Introduction The idea of a valence grammar, as introduced by Gheorghe P˘aun [1] in 1980, is to provide the rules of a grammar with a value from a given monoid, called its valence. During a derivation the monoid product of the valences of the applied rules is computed in a register, but not used to control the derivation. A derivation of a terminal word is valid if in the end the register contains the neutral element of the monoid. Some years later, cooperating distributed (CD) grammar systems were introduced by Erzs´ebet Csuhaj–Varj´u and J¨urgen Dassow [2] as a grammatical model for the blackboard model of problem solving known from Artificial Intelligence. The picture one has in mind is that of several “agents” (mostly represented by classical context-free grammars called components in the theory of CD grammar systems) working on a common “blackboard” (represented by a sentential form). Some component takes this sentential form, works on it, i.e., it performs some derivation steps, and then returns it to the blackboard such that another component may continue the work. There are several ways to formalize this collaboration. In particular, “how long” is a component allowed to work on a sentential form until maybe another component can contribute to this work? In other words, how is the agent reading its script? The following basic (derivation) modes have been thoroughly investigated in the literature: ⇒≤ k , ⇒= k , ⇒≥ k , ⇒∗ , and ⇒t , where k ≥ 1 is an integer. For example, when enabled, a component working in mode ⇒≥ k must perform at least k derivation steps. In (classical) CD grammar systems, all components work according to the same mode. The classical results of this area of formal languages are comprised in the monograph [3], where again Gheorghe P˘aun had his particular share. The investigation of CD grammar systems with valences was first started by J¨urgen Dassow and Gheorghe P˘aun in 1990 [4] and continued in a sequel of papers by Sorina J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 90–106, 2011. c Springer-Verlag Berlin Heidelberg 2011
Expressive Power of Valences in Cooperating Distributed Grammar Systems
91
Vicolov-Dumitrescu [5,6,7]. In all these papers, the rules in the CD grammar systems were equipped with valences, and a change of the component was allowed iff the product of the valences gave the neutral element. Stated differently, the *-mode was used as operational mode of the CDGS, and the valences were used “internally” within the components.1 We propose here some further approaches to CD grammar systems (CDGS) with valences. Firstly, we will combine the other derivation modes known from the theory of CDGS and internal valences. Secondly, we will define two other usages of valences: “external valences” where the product of the valences is only checked in the very end of the derivation and not when switching components, and “component valences” where valences are attached to the components instead of the rules. Similar considerations regarding Lindenmayer system with valences can be found in [8].
2 Definitions The sets of integers, non-negative integers and positive rational numbers are denoted by Z, N and Q+ . We refrain from giving notions that can be found in any textbook on formal languages but rather restrict ourselves, formally defining only the the two key notions of our paper: CD grammar systems and valences. More specifically, for other notions, in particular regarding regulated rewriting, we refer to the classical monograph of J¨urgen Dassow and Gheorghe P˘aun [9]. In particular, L(MAT, CF) (L(MAT, CF, ac), resp.) denotes the class of matrix languages with context-free, possibly erasing, core rules without (and with, resp.) appearance checking. It is well-known that L(MAT, CF, ac) = L(RE), the class of recursively enumerable languages. Firstly, let us recall the classical definition of a cooperating distributed grammar system. A cooperating distributed grammar system (a CDGS for short) of degree n, with n ≥ 1, is a (n + 3)-tuple G = (N, T, S, P1 , . . . , Pn ), where N , T are disjoint alphabets of nonterminal and terminal symbols, respectively, S ∈ N is the axiom, and P1 , . . . , Pn are finite sets of rewriting rules over N ∪ T , called the components of G. Throughout this paper, we consider only regular and context-free rewriting rules. For x, y ∈ (N ∪ T )∗ and 1 ≤ i ≤ n, we write x ⇒i y iff x = x1 Ax2 , y = x1 zx2 for some A → z ∈ Pi . Hence, subscript i refers to the production set to ≥k ∗ be used. In addition, we denote by ⇒=k (⇒≤k i i , ⇒i , ⇒i , respectively) a derivation consisting of exactly k steps (at most k steps, at least k steps, an arbitrary number of steps, respectively) as above. Moreover, we write x ⇒ti y 1
iff x ⇒∗i y and there is no z such that y ⇒i z.
In a variant discussed in these papers, there were two registers: the first had to be neutral when changing the component and received the value of the second when starting with a new component. It could be shown that these CDGS can generate the family of recursively enumerable languages [7]. We will not discuss this variant here.
92
H. Fernau and R. Stiebe
Let D := { ∗, t } ∪ { ≤ k, = k, ≥ k | k ∈ N }. The language generated in the f -mode, f ∈ D, by a CDGS G is defined as: Lf (G) := { w ∈ T ∗ | S ⇒fi1 α1 ⇒fi2 . . . ⇒fim−1 αm−1 ⇒fim αm = w, with m ≥ 1, 1 ≤ ij ≤ n, 1 ≤ j ≤ m }. If f ∈ D and X ∈ {REG, CF}, then the families of languages generated in f -mode by CDGS using rules of type X are denoted by L(CD, X, f ). In this paper, we consider CDGS with valence rules. We therefore define now what we mean by valence rules. Let M = (M, ◦, e) be a monoid. Important examples of monoids considered in the following are (Z, +, 0) and more generally, (Zn , +, 0), as well as (Q+ , ·, 1). To these monoids, we will also refer by simply giving the underlying set. p = (A → α, m) is called a valence rule, where the context-free rule A → α is called the core rule of p and m ∈ M is called the valence of p. The yield relation ⇒ over (N ∪ T )∗ × M is defined as: (w, m) ⇒ (w , m ) iff there is a rule (A → α, m) ¯ such that w = w1 Aw2 , w = w1 αw2 and m = m ◦ m. ¯ Now, consider a CDGS with valence rules, also called a valence CDGS for short. We denote by ⇒=k i ≥k ∗ (⇒≤k , ⇒ , ⇒ , respectively) a derivation using valence rules from the ith component i i i consisting of exactly k steps (at most k steps, at least k steps, an arbitrary number of steps, respectively). More specifically, if f is a mode, then we write (α, m) ⇒fi (β, m ) if there is a derivation (α = α1 , e = m) ⇒i (α2 , m2 ) ⇒i . . . ⇒i (αj , mj = m ) such that α1 ⇒i α2 ⇒i . . . ⇒i αj is a valid (non-valence) derivation of the ith component (considering only the core rules) obeying the chosen derivation mode f . L(CD, X, f ) denotes the class of language generated by CDGS with rules of type X, working in the f -mode. We will differentiate between three ways of associating valences to CD grammar systems: – With intermediate tests, it is required that the valence product equals the neutral element e of the monoid after each complete application of a component. – With external tests, only at the very end of the derivation it is tested if the derivation evaluates to the neutral element e of the monoid. – Finally, component valences are associated to whole components, not single rules as defined above, and it (again) required that their product evaluates to the neutral element e of the monoid. The motivation for considering these three ways of dealing with valences in CDGS was drawn by the analogous study of valences within (limited) Lindenmayer systems, see [8]. Let us define these three ways of integrating valences into the derivation process of CDGS more formally in the following.
Expressive Power of Valences in Cooperating Distributed Grammar Systems
93
Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS, i.e., all the components Pi contain valence rules. The language generated by G in the f -mode, f ∈ D, with intermediate test valences is defined as: f f f f ∗ Lint f (G) := { w ∈ T | (S, e) ⇒i1 (α1 , e) ⇒i2 . . . ⇒im−1 (αm−1 , e) ⇒im (αm , e)
with m ≥ 1, 1 ≤ ij ≤ n, 1 ≤ j ≤ m, αm = w }. Lint (CD, X, f, M) is the class of languages generatable by CDGS with intermediate test valences with rules of type X, working in the f -mode, with valences from the monoid M. Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS, i.e., all the components Pi contain valence rules. The language generated by G in the f -mode, f ∈ D, with external tests is defined as: f f f f ∗ Lext f (G) := { w ∈ T | (S, e)⇒i1 (α1 , x1 ) ⇒i2 . . . ⇒im−1 (αm−1 , xm−1 ) ⇒im
(αm = w, xm = e) with m ≥ 1, 1 ≤ ij ≤ n, xj ∈ M, 1 ≤ j ≤ m }. Lext (CD, X, f, M) is the class of languages generated by CDGS with external tests with rules of type X, working in the f -mode, having valences from the monoid M = (M, ◦, e). For example, consider the system G = ({S, A, B}, {a, b, c}, {P1 , P2 , P3 , P4 }), where P1 = {(S → S, +1), (S → AcB, −1)}, P2 = {(A → aAa, +1), (B → aBa, −1)}, P3 = {(A → bAb, +1), (B → bBb, −1)}, and P4 = {(A → c, +1), (B → c, −1)}. This system obeys: R R ∗ Lint =2 (G) = {wcw cwcw | w ∈ {a, b} }.
Considered as being in external test mode, the generated language becomes much larger. For example, we might first apply the first, then the second component (only to A), followed by the third component application (only to B) and finalize with the last component, yielding: =2 (S, 0) ⇒=2 1 (AcB, 0) ⇒2 (aaAaacB, 2) =2 ⇒=2 3 (aaAaacbbBbb, 0) ⇒4 (aacaacbbcbb, 0).
Notice that for valence CDGS with only one component, the difference between intermediate and external tests do not matter for the ∗-mode. In fact, this situation is exactly the same as in classical valence grammars, whose corresponding language families are denoted by L(X, M).
94
H. Fernau and R. Stiebe
A CDGS with component valences (also called table valences due to the analogy to Lindenmayer systems, see [8]) formally looks a bit different: Such a system G is specified as G = (N, T, S, P1 , . . . , Pn , ϕ), where the components Pi all contain “normal” rules (without valences), and ϕ maps {1, . . . , n} to the underlying monoid set M . f f f f ∗ Ltab f (G) := { w ∈ T | S ⇒i1 α1 ⇒i2 . . . ⇒im−1 αm−1 ⇒im αm = w
with m ≥ 1, 1 ≤ ij ≤ n, 1 ≤ j ≤ m, ϕ(i1 ) ◦ · · · ◦ ϕ(im ) = e }. The class of languages generated by CDGS with rules of type X, working in the f mode, with table valences from the monoid M is denoted by Ltab (CD, X, f, M). We conclude this section by presenting an easy relation among the ≥ k- and the ∗-modes that hold for all models. Lemma 1. For X ∈ {REG, CF}, Y ∈ {int, ext, tab}, k ∈ N and arbitrary monoids M = (M, ◦, e), we find: LY (CD, X, ∗, M) ⊆ LY (CD, X, ≥ k, M). Proof. We first consider the case of intermediate or external tests. Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS over M with X-rules. We construct the CDGS G = (N , T, S, P1 , . . . , Pn ) over M with X-rules where Pi = Pi ∪ {(A → A, e) | A ∈ N } Any derivation (α, m) ⇒∗Pi (β, m ) in G in ∗-mode, where α contains some nonterminal symbol A, can be simulated in G in ≥ k-mode by first applying k times the valence rule (A → A, e), thus retaining the pair (α, m), and thereafter the original (possibly empty) derivation sequence. Conversely, any derivation (α, m) ⇒≥k Pi (β, m ) in G in ≥ k-mode is transformed into a derivation (α, m) ⇒∗Pi (β, m ) in G in ∗-mode by omitting derivation steps using valence rules of the form (A → A, e). In the case of component valences, one adds the set of rules {A → A | A ∈ N } to each component and uses a similar argument to show the equivalence.
3 CDGS with Intermediate Test Valences In contrast to the other variants we introduced above, the regular case offers some interesting facts, so that we dedicate its own subsection to that case. 3.1 The Regular Case Regular CDGS with intermediate test valences have been studied by Sorina Vicolov(-Dumitrescu) [5] (called CDGS with registers in that paper). There, it was shown that Lint (CD, REG, ∗, M) is the closure of L(REG, M) under union, concatenation and Kleene-star. Regarding that, for any finitely generated monoid M, the family Lint (REG, M) is the full trio generated by the identity language with respect to any finite generating set of M, we can state more precisely:
Expressive Power of Valences in Cooperating Distributed Grammar Systems
95
Theorem 1 – For any finitely generated monoid M, Lint (CD, REG, ∗, M) is the full AFL generated by the identity language with respect to any finite generating set of M. – For any monoid M, Lint (CD, REG, ∗, M) is a full AFL. Considering some specific monoids, Theorem 1 provides the following consequences: Corollary 1 – For any finite monoid M, Lint (CD, REG, ∗, M) = L(REG). – Lint (CD, REG, ∗, Zn ) is the full AFL generated by Ln = {w ∈ {a1 , . . . , an , b1 . . . , bn }∗ | |w|ai = |w|bi , 1 ≤ i ≤ n}. In particular, Lint (CD, REG, ∗, Z) is a proper subset of the family of one-counter languages [10]. – For the free group Fk with k ≥ 2 generators, Lint (CD, REG, ∗, Fk ) = L(REG, Fk ) = L(CF) [11]. It is known that the intersection of two regular valence languages over the monoids M1 and M2 is a regular valence language over M1 × M2 ; in particular, L(REG, Q+ ) is closed under intersection. A similar result does not hold for the case of regular valence CDGS. Theorem 2. Lint (CD, REG, ∗, Q+ ) is not closed under intersection. Proof. Let L = {an+1 ban b | n ≥ 0}. Obviously, L is in L(REG, Z). Hence, L1 = L∗ and L2 = a∗ bL∗ b are both in L(CD, REG, ∗, Z). It is easy to see that L1 ∩ L2 = {an ban−1 b · · · abb | n ≥ 1}. The length set of L1 ∩ L2 is { n(n+1) | n ≥ 1}, which is 2 not semilinear. Hence, L1 ∩ L2 cannot belong to Lint (CD, REG, ∗, Q+ ). Let us now study regular valence CDGS with respect to the other modes. Lemma 2. For each f ∈ {t, ≥ k} and each monoid M = (M, ◦, e), we find the equality Lint (CD, REG, f, M) = Lint (CD, REG, ∗, M). Proof. We will prove the equalities by providing constructions of equivalent valence CDGS. For convenience, we first fix a notation. For a nonterminal set N , a terminal set T and a number i, let hN,T,i : (N ∪ T )∗ → (N × {i} ∪ T )∗ be the homomorphism mapping A ∈ N to (A, i) and a ∈ T to a. As usual, if A appears as the left-hand side of a rule from Pi , we write A ∈ lhs(Pi ). 1. Lint (CD, REG, ∗, M) ⊆ Lint (CD, REG, t, M). Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS over M with regular rules. We construct the regular valence CDGS G = (N , T, S, P1 , . . . , Pn ) over M where N = N × {1, . . . , n} ∪ {S} Pi = {((A, i) → hN,T,i (α), m) | (A → α, m) ∈ Pi } ∪ {((A, i) → (A, j), e) | A ∈ N, 1 ≤ j ≤ n} ∪ {(S → (S, i), e)}.
96
H. Fernau and R. Stiebe
Except for the start rule (S → (S, i), e), the rules of Pi have on their left sides only symbols from N × {i}. In a successful derivation in the t-mode, the application of a ∗ component Pi corresponds to a derivation of one of the forms (v(A, i), e) ⇒Pi (vw, e) ∗ or (v(A, i), e) ⇒Pi (vw(B, i), e) ⇒Pi (vw(B, j), e), with A, B ∈ N , 1 ≤ i, j ≤ n, v, w ∈ T ∗ . By definition of Pi , these derivations are possible iff G in ∗-mode allows ∗ ∗ for the derivations (vA, e) ⇒Pi (vw, e) or (vA, e) ⇒Pi (vwB, e), respectively. For the remaining inclusions, we give only the construction. The correctness arguments are similar to the above and left to the reader. 2. Lint (CD, REG, t, M) ⊆ Lint (CD, REG, ∗, M). Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS over M with regular rules. We construct the regular valence CDGS G = (N , T, S, P1 , . . . , Pn ) over M where N = N × {1, . . . , n} ∪ {S} Pi = {((A, i) → hN,T,i(α), m) | (A → α, m) ∈ Pi } ∪ {((A, i) → (A, j), e) | A ∈ / lhs(Pi ), 1 ≤ j ≤ n} ∪ {(S → (S, i), e)}. 3. For Lint (CD, REG, ∗, M) ⊆ Lint (CD, REG, ≥ k, M), we refer to Lemma 1. 4. Lint (CD, REG, ≥ k, M) ⊆ Lint (CD, REG, ∗, M). Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS over M with regular rules. We construct the regular valence CDGS G = (N , T, S, P1 , . . . , Pn ) over M where N = N × {1, . . . , n} ∪ N Pi = {(A → hN,T,i (α), m) | (A, e) ⇒kPi (α, m)} ∪ {((A, i) → hN,T,i (α), m) | (A → α, m) ∈ Pi } ∪ {((A, i) → A, e) | A ∈ N, 1 ≤ j ≤ n}. Lemma 3. For each f ∈ {= k, ≤ k} and each monoid M = (M, ◦, e), we find Lint (CD, REG, f, M) = L(REG). Proof. Let G = (N, T, S, P1 , . . . , Pn ) be a valence CDGS over M with regular rules. For any component Pi , define the (finite) set of right-linear rules ∗ f
Ri = {A → α | (A, e) ⇒i (α, e)}. n The regular grammar G = (N, T, S, i=1 Ri ) simulates in one step with a rule from Ri an application of table Pi in f -mode. Hence, Lint f (G) = L(G ). 3.2 The Context-Free Case From [4, Lemma 14], we know that Lint (CD, CF, ∗, Z) ⊇ L(MAT, CF). The properness of this inclusion as well as of the inclusions Lint (CD, CF, ∗, Zn ) ⊆ Lint (CD, CF, ∗, Zn+1 )
Expressive Power of Valences in Cooperating Distributed Grammar Systems
97
remains an open problem which we will not be able to solve here, either. However, we hope that the study of the other CDGS derivation modes stimulates some renewed interest in this 20-year-old question. We will first establish relations between the ∗-mode and the ≥ k-mode. Lemma 4. For any monoid M, any k ≥ 2 and any n ≥ 1, Lint (CD, CF, ∗, M) ⊆ Lint (CD, CF, ≥ k, M) ⊆ Lint (CD, CF, ∗, M × Z). Proof. Let M = (M, ◦, e). The first inclusion follows with Lemma 1. To prove the second inclusion, let G = (N, T, S, P1 , . . . , Pk ) be a valence CDGS over M. Construct G = (N , T, S , P0 , P1 , . . . , Pk ) over M × Z with N = N ∪ {S , X1 , . . . , Xk }, P0 = {(S → SXi , (e, 0)) | 1 ≤ i ≤ k}, Pi = {(A → α, (m, 1)) | (A → α, m) ∈ Pi } ∪ {(Xi → Xj , (e, −k)) | 1 ≤ j ≤ k ∧ i = j}, ∪ {(Xi → Xi , (e, −1)), (Xi → λ, (e, −k))}, for 1 ≤ i ≤ k. After the first derivation step (S , 0) ⇒ (SXj , 0), G can produce only sentential forms αXi and α with α ∈ (N ∪ T )∗ , 1 ≤ i ≤ k. We study a successful application of some Pi , 1 ≤ i ≤ k, which is not followed by another application of Pi (in that case we merge the two applications into one). In order to obtain the neutral valence (e, 0) we must start with a sentential form αXi . The substring Xi can yield in the end of the application all pairs (λ, (e, −y)), (Xj , (e, −y)) with i = j and y ≥ k. On the other hand α can derive (β, (m, z)) iff (β, m) can be derived from α in Pi in exactly z steps, z ≥ 0. Hence, (β, (e, 0)) or (βXj , (e, 0)) can be reached from αXi in Pi exactly when (β, e) can be reached from α in P in at least k steps. Corollary 2. For k ≥ 2, Lint (CD, CF, ≥ k, Z) ⊇ L(MAT, CF). As with the ∗-mode (which somehow corresponds to the ≥ 1-mode), it remains unclear if the inclusion is strict or not. The problem lies in the fact that a simulating matrix grammar would have to cope with the valences, as well, but there is no obvious bound on the number of ways how these valences sum up to zero (as this is possible in the following theorem), and there is also no obvious way to make these valences explicit in the sentential form (by abusing nonterminals as counters), since testing the absence of nonterminals is not possible without appearance checking. For the ≤ k- and the = k-modes, we can show equivalence with matrix grammars without appearance checking. Theorem 3. For k ≥ 2 and f ∈ {≤ k, = k}, Lint (CD, CF, f, Z) = L(MAT, CF). Proof. The inclusion Lint (CD, CF, f, Z) ⊆ L(MAT, CF) is easily shown. For any component P of a valence CDGS G, construct the set of all matrices (p1 , p2 , . . . , pj ) such that j ≤ k, if G is in ≤ k-mode, j = k, if G is in = k-mode, p1 , p2 , . . . , pj ∈ P , and
98
H. Fernau and R. Stiebe
v(p1 ) + v(p2 +) · · · + v(pj ) = 0. Then, an application of P in f -mode corresponds to the application of one of the tables, and vice versa. To show L(MAT, CF) ⊆ Lint (CD, CF, f, Z), we can assume a matrix grammar in 2-normal form, i.e., G = (N, T, M, S) with N = {S} ∪ N1 ∪ N2 , N1 ∩ N2 = ∅, S∈ / N1 ∪ N2 , and matrices of the forms – (S → AB), A ∈ N1 , B ∈ N2 , – (A → α, B → C), A ∈ N1 , α ∈ (N1 ∪ T )∗ , B, C ∈ N2 , B = C, – (A → α, B → λ), A ∈ N1 , α ∈ (N1 ∪ T )∗ , B ∈ N2 . L(G) can be generated in f -mode by the valence CDGS G , where G = (N , T, S, P1 , . . . , Pn ), with the nonterminal set N = N1 ∪ N2 × {1, . . . , k − 1} ∪ {S}, containing for each matrix in G one table, more specifically: – {(S → S, 0), (S → A(B, 1), 0)}, for the matrix (S → AB), A ∈ N1 , B ∈ N2 , – {(A → α, 1), ((B, k − 1) → (C, 1), −1)} ∪ {((B, i) → (B, i + 1), 0) | 1 ≤ i < k − 1}, for the matrix (A → α, B → C), A ∈ N1 , α ∈ (N1 ∪ T )∗ , B, C ∈ N2 , – {(A → α, 1), ((B, k − 1) → λ, −1)} ∪ {((B, i) → (B, i + 1), 0) | 1 ≤ i < k − 1}, for the matrix (A → α, B → C), A ∈ N1 , α ∈ (N1 ∪ T )∗ , B ∈ N2 . Consider the application of a component of the second type in f -mode, f ∈ {= k, ≥ k}, on a sentential form γ(B, 1) with γ ∈ (N1 ∪ T )∗ , B ∈ N2 . The only possibility for a derivation with valence 0 is to use each of the k rules exactly once (note that (C, 1) cannot be rewritten, as B = C). For components of the third type, the reasoning is analogous. From these observations, L(G) = Lint f (G ) follows. To complete the picture, we remark: Lemma 5. For any monoid M, Lint (CD, CF, = 1, M) = Lint (CD, CF, ≤ 1, M) = L(CF). Proof. The inclusion from right to left should be clear. Since a component in a valence CDGS working in mode = 1 can be applied only for one step, the according valence must immediately evaluate to the neutral element of the monoid. This means that only those rules to which the neutral element has been attached are of any interest at all. Hence, the potential power coming from the introduction of valences disappears. For the proof of the following theorem, briefly recall the notion of a valence test ET0L system [8]: in short, such systems are ET0L systems with valence rules, and only such table applications are allowed where the corresponding valences of the applied rule yield the neutral element. For clarity, we will denote a parallel derivation using table par P by ⇒par (w, e) for valence test ET0L systems P . So, it is required that (v, e) ⇒P over the monoid M = (M, ◦, e). In [8], it has been shown that such systems over the monoid Z characterize the recursively enumerable languages. Based on this result, we can show:
Expressive Power of Valences in Cooperating Distributed Grammar Systems
99
Theorem 4. Lint (CD, CF, t, Z) = L(RE). Proof. We will simulate a valence test ET0L system over the monoid Z by a valence CDGS with intermediate tests (over the same monoid), working in t-mode. As mentioned above, this suffices for the proof. Let G = (Σ, Δ, ω, P1 , . . . , Pn ) be a valence test ET0L system over Z. We construct the valence CDGS G = (N, Δ , S, P0 , P1 , . . . , Pn , Pn+1 ), where – the nonterminal alphabet is the disjoint union N = Σ ∪ Σ ∪ {S, X}, where Σ = {A | A ∈ Σ} is a copy of Σ; – the terminal alphabet is a disjoint copy of Δ: Δ = {a | a ∈ Δ}; – P0 = {(S → ω, 0)}; – Pi = {(A → h (α), z) | (A → α, z) ∈ Pi }, where h is the homomorphism mapping A ∈ Σ to its copy A ∈ Σ, for 1 ≤ i ≤ n; – Pn+1 = {(A → A, 0) | A ∈ Σ}; – Pn+2 = {(a → a , 0) | a ∈ Δ} ∪ {(A → X, 0) | A ∈ Σ \ Δ}. In the first step, G produces ω using the component P0 . When applying a component Pi , 1 ≤ i ≤ n in t-mode on a string α ∈ Σ ∗ , every symbol of α is replaced by a string over Σ using a rule from Pi . After using Pi , 1 ≤ i ≤ n, the component Pn+1 has to be applied and gives a string over Σ. It is easy to see that a parallel step (α, 0) ⇒par Pi (β, 0) of G is simulated by G in t-mode as (α, 0) ⇒tP (h (β), 0) ⇒tP (β, 0).2 Finally, i n+1 the component Pn+2 transforms a symbol a ∈ Δ to a ∈ Δ and a symbol from Σ \ Δ to the trap symbol X. After that, no further derivation steps are possible. Hence, L(G , t) = h (L(G)) where h is the alphabetic homomorphism mapping a ∈ Δ to a ∈ Δ . By exchanging in all rules the symbols from Δ and Δ with their copies (hence, making Δ the terminal alphabet again), we get a CDGS G with L(G) = Lint f (G ). Corollary 3 – For each n ≥ 1, Lint (CD, CF, t, Zn ) = L(RE). – Lint (CD, CF, t, Q+ ) = L(RE).
4 External Valences Recall that, for some choice of mode f and some selection X of core rules and a monoid M, Lext (CD, X, f, M) denotes the language family generated by CD grammar systems where the valences are understood externally. In general, CDGS with external valences are closely related to their counterparts without valences. This can be made precise with the notion of valence transduction whose formal definition can be found in [8].3 2
3
t t More precisely, even (α, x) ⇒par (β, x+y) Pi (β, x+y) iff (α, x) ⇒Pi (h (β), x+y) ⇒Pn+1 holds. Notice that the derived notion of a valence generalized sequential machine slightly differs from that given in [12].
100
H. Fernau and R. Stiebe
Theorem 5. For each mode f , every language L ∈ Lext (CD, CF, f, Zk ) is the image of some language L ∈ Lext (CD, CF, f ) under some rational Zk -valence transduction. Proof. Given a valence CDGS G with terminal alphabet T over Zk , construct a CDGS G by replacing a valence rule (A → α, z) with the (non-valence) rule A → αaz , where az is a new terminal symbol in G representing z. For some mode f , let L = Lext f (G) and L = Lf (G ). Then L = τ (L ), where τ is the valence transduction defined by the deterministic transducer with the single state q and the valence transduction function δ(q, a) = (q, a, 0), for a ∈ T , δ(q, az ) = (q, λ, z). Theorem 6. For k ≥ 2 and f ∈ {≥ k, = k}, Lext (CD, CF, f, Z) = L(MAT, CF). Proof. Similar as in the proof of Theorem 3 the correct number of applications of rules can be checked within a matrix; notice that due to the external test mode, we do not have to consider zero-tests of the register in-between. So, for the = k-mode, we first associate to each component P of the (CD, CF, f, Z)-grammar G matrices that list k applications of rules from P (for each possible combination); for the ≥ k-mode, we add such combinations for any i applications, where i ∈ {k, k + 1, . . . , 2k − 1}. We still need to keep track of the valence operations, which take the form of a counter with the monoid Z. To this end, take three more nonterminals X, Xp and Xn . At the very beginning, X is introduced by a matrix (S → SX), where S is the start symbol of the CD grammar that is to be simulated, and S is a new start symbol of the matrix grammar. Whenever a positive number p is to be added to the counter, for all non-negative numbers r, s with r + s = p, X → XXpr and (Xn → λ)s are added to the simulating matrix. Whenever a positive number p is to be subtracted from the counter, for all nonnegative numbers r, s with r + s = p, X → XXnr and (Xp → λ)s are added to the simulating matrix. Obviously, there is one way of guessing the partitions of p into r, s, such that if finally a terminal word w is derived in the CD grammar such that the counter contains zero, then a word wX can be derived by the simulating matrix grammar, which can yield w by applying the matrix (X → λ) once in the end. Conversely, since the presence of X is checked in each matrix but the start matrix and the final matrix4 , each matrix application actually simulates a component application. Now we show the other inclusion. Without loss of generality, we may assume that a language from L(MAT, CF) is described by a programmed grammar where the rules (p : A → w, σ(p)) satisfy p ∈ / σ(p) (*). We now describe a CD grammar system working in mode = 2. For each such rule, we introduce a component in the grammar system. This component contains (A → w, −1), as well as rules of the form (p → q, 1), where q ∈ σ(p). Due to (*), the only possible imbalance of rule applications in the simulating grammar is due to no application of the rule label handling (p → q, 1), causing two applications of (A → w, −1). Hence, a simulating derivation starting with (S → Sp, 0) for all p and a new start symbol S can only yield (wq, 0) for some label 4
This is also true if r = 0 is guessed in the derivation process.
Expressive Power of Valences in Cooperating Distributed Grammar Systems
101
∗
q, if (S, p) ⇒ (w, q) in the original programmed grammar. Now, rules of the form (q → λ, 0) allow for termination in the simulation. The same construction works for the ≥ 2-mode. For other = k-modes or ≤ kmodes, k ≥ 3, consider the possibility to build chains of rules of the form (p → p , 1), . . . , (p(k−3) → p(k−2) , 1), (p(k−2) → q, 1) for where q ∈ σ(p). The rule (A → w, −k) also belongs to the table. The reasoning of the preceding theorem easily generalizes as follows. Corollary 4. – For k ≥ 2, n ≥ 1 and f ∈ {≥ k, = k}, Lext (CD, CF, f, Zn ) = L(MAT, CF). – For k ≥ 2 and f ∈ {≥ k, = k}, Lext (CD, CF, f, Q+ ) = L(MAT, CF). Theorems 5 and 6 have also an interesting implication for (non-valence) CDGS in the ≥ k- and = k-modes. Up to now it is just known that these language families strictly include the context-free languages and are contained in the family of matrix languages without appearance checking. We can sharpen the latter inclusion as follows: Corollary 5. For k ≥ 2 and f ∈ {≥ k, = k}, L(MAT, CF) is the closure of L(CD, CF, f ) under Z-valence-transductions. In particular, L(CD, CF, f ) contains non-semilinear languages. Since the external valence interpretation allows for no regulation of the table applications, we immediately obtain: Theorem 7. For k ≥ 1, n ≥ 1 and f ∈ {≤ k, ∗, =1}, Lext (CD, CF, f, Zn ) characterizes the context-free valence languages with valences from Zn . Corollary 6. For k ≥ 2 and f ∈ {≤ k, ∗, =1}, Lext (CD, CF, f, Q+ ) characterizes the context-free unordered vector languages without appearance checking. For the following theorem, recall the notion of ET0L systems with valences, as introduced in [8]. In these systems, not every single table application should yield the neutral element e of the monoid, only multiplying all rules applied during a terminating derivation should yield e. Theorem 8. Lext (CD, CF, t, Z) characterizes the family of languages generated by ET0L systems with valences over Z. Proof. We will prove the two inclusions constructively. Given a valence ET0L system over Z, exactly the construction from Theorem 4 can be applied (see the footnote in the proof). Now consider a valence CDGS G = (N, T, S, P1 , . . . , Pk ) over Z. From G, we derive the morphisms hN,T,i that transfer symbols A to (A, i), where A ∈ N and A appears as the left-hand side of a rule from Pi , written A ∈ lhs(Pi ) for short, and symbols a to a, where a ∈ T ∪ (N \ lhs(Pi )). We construct the valence ET0L system
102
H. Fernau and R. Stiebe
G = (Σ, T, S, P1 , . . . , Pk , Pk+1 ) where
Σ = N ∪ T ∪ N × {1, . . . , k} ∪ {X}, Pi = {(X → X, 0)} ∪ {(a → a, 0) | a ∈ T } ∪ {(A → (A, i), 0) | A ∈ lhs(Pi )} ∪ {((A, i) → hN,T,i(α), z) | (A → α, z) ∈ Pi } ∪ {((A, i) → (A, i), 0) | A ∈ N } ∪ {((A, j) → X, 0) | 1 ≤ j ≤ k ∧ j = i}, for 1 ≤ i ≤ k, Pk+1 = {(X → X, 0)} ∪ {(a → a, 0) | a ∈ T } ∪ {(A → A, 0) | A ∈ N } ∪ k
{((A, i) → A, 0) | A ∈ / lhs(Pi )} ∪
i=1
k
{((A, i) → X, 0) | A ∈ lhs(Pi )}.
i=1
Note that G replaces symbols from T by themselves without adding to the valence. Hence, when a pair (w, x) with w ∈ T ∗ is produced, this pair will remain forever in the derivation process of G . Moreover, X is a trap symbol, which is replaced by itself. A word containing X can never generate a word in L(G ). Now consider a pair (α, x) with α ∈ (N ∪ T )∗ . A parallel step in table Pi transfers it to (hN,T,i (α), x). If α contains a symbol (A, i) with A ∈ lhs(Pi ), the table Pi has to be applied as all other tables would replace (A, i) with X. If after some applications of Pi a pair (hN,T,i (β), x + y) is produced such that the sentential form contains symbols from N ×{i}, but none from lhs(Pi )×{i}, the table Pk+1 is applicable, yielding (β, x+y) with β ∈ (N ∪T )∗ . (Table Pi is also applicable, but does not change anything.) A parallel step in Pi (except for the initial) corresponds to a derivation in Pi where some symbols are replaced. On the other hand, each single step in Pi can be simulated in a parallel step in Pi by replacing the corresponding symbol using the corresponding rule and replacing all other symbols by themselves. Hence, ∗ par
par (β, x + y) (α, x) ⇒par P (hN,T,i (α), x) ⇒Pi (hN,T,i (β), x + y) ⇒P i
k+1
holds iff (α, x) (β, x + y), which proves that G in t-mode and G are equivalent. Corollary 7. Lext (CD, CF, t, Zn ) characterizes the family of languages generated by ET0L systems with valences over Zn , for all n ≥ 1. ⇒tPi
Since finite step counting can be done within the nonterminals of a regular grammar, as well as applicability testing for the one and only nonterminal, the following is easy to see: Theorem 9. Let M = (M, ◦, e) be a monoid. For any mode f , the language family Lext (CD, REG, f, M) characterizes the regular valence languages with valences from M .
5 Component Valences Recall that with these CDGS, valences are associated to grammar components rather than to single rules. Concerning the ∗- and ≤ k-modes, there is an important difference
Expressive Power of Valences in Cooperating Distributed Grammar Systems
103
to external and internal valences: the application of a component can change the valence without altering the sentential form, by performing zero derivation steps. This has a crucial influence on the generative power. Theorem 10. For X ∈ {REG, CF} and f ∈ {∗, ≤ k}, k ≥ 1, and any monoid M on = (M, ◦, e), we find Ltab (CD, X, f, M) = L(X). Proof. It is sufficient to prove Ltab (CD, X, f, M) = L(CD, X, f ) since the equalities L(CD, X, f ) = L(X) are well-known [3]. The inclusion Ltab (CD, X, f, M) ⊇ L(CD, X, f ) is trivial. Conversely, let G = (N, T, S, P1 , . . . , Pn , ϕ) be a CDGS with component valences. Without loss of generality, we can assume that, for any i ∈ {1, . . . , n}, there are indices l1 , l2 , . . . , lj , r1 , r2 , . . . , rk ∈ {1, . . . , n} such that ϕ(Pl1 ) ◦ ϕ(Pl2 ) ◦ · · · ◦ ϕ(Plj ) ◦ ϕ(Pi ) ◦ ϕ(Pr1 ) ◦ ϕ(Pr2 ) ◦ · · · ◦ ϕ(Prk ) = e, since otherwise Pi could not be used in any successful derivation. Consider the underlying CDGS G = (N, T, S, P1 , . . . , Pn ). The inclusion L(G) ⊆ L(G ) holds by definition. On the other hand, any application of Pi in f -mode in G can be simulated in f -mode in G by using the sequence of components Pl1 , Pl2 , . . . , Plj , Pi , Pr1 , Pr2 , . . . , Prk , where all components but Pi perform zero derivation steps and Pi performs the same derivation sequence as in G. This yields the same sentential form and a neutral valence. Hence, L(G ) ⊆ L(G) is true as well, completing the proof. As regards the other derivation modes, we were able to relate the language families to the according families of valence languages in the regular case, while we found only some partial results in the context-free case. Theorem 11. Let M = (M, ◦, e) be a monoid. For any mode f ∈ {t, = k, ≥ k}, the class Ltab (CD, REG, f, M) characterizes the regular valence languages with valences from M . Proof. As already sketched in the previous cases, the simulation of the regulation mechanism posed upon regular grammars via cooperating distributed systems within the regular grammar itself can be performed with the usual constructions, also refer to [3]. Notice that within these constructions, we store within the nonterminal the grammar component which is currently simulated, so that the constructions can also properly respect the valence computations. Conversely, we can associate to a regular valence grammar G = (N, T, P, S, M) the CDGS G defined as (N , T, {({A → (A, w)}, z), ({(A, w) → w}, e) | (A → w, z) ∈ P } , S, M), with N = N ∪ {(A, w) | ∃z ∈ M ((A → w, z) ∈ P )} obeys L(G) = Ltab ∗ (G ). Namely, due to linearity, each grammar component Pi in G can be only applied in a way that the (unique) rule in Pi is applied only once. For the other modes f , only for ≥ k slightly more complicated constructions are necessary. The (easy) details are left to the reader.
104
H. Fernau and R. Stiebe
Let us now turn to the context-free case. This case turned out to be quite difficult, so that we can only present rather preliminary results here. We pose this as a quite open field of future research. We only mention one preliminary result which gives upper bounds in some particular cases: Lemma 6. Let k ∈ N, k ≥ 1. Then, Ltab (CD, CF, = k, Zn ) ⊆ L(MAT, CF). Proof. (Sketch) Basically, we follow the construction given in Theorem 6 and only sketch differences here. So, each k-sequence of rules from component Pi forms the start of a matrix, where at the end rule applications of the form Xn → λ, Xp → λ, as well as X → XXpj and X → Xnj for appropriate j simulate the register operations, where the new nonterminals X, Xn , XP have the same meaning as above. Higher dimensions can be treated alike. We tried to adapt the proof of the well-known equivalence between ET0L systems and CDGS with context-free core rules, working in the t-mode (see [3]). However, there is one subtlety here we could not overcome: Once a component P finishes its work, it might get the workpiece, i.e., the sentential form, again. Of course, it cannot change the sentential form, but it might change the valence assoiated to it. Therefore, we conjecture that Ltab (CD, CF, t, M) = L(CD, CF, t) for any monoid M. If we would require that each component must perform at least one derivation step (otherwise, it may not take the workpiece), then ET0L systems with table valences can be simulated. However, this would no longer be the classical t-mode, but rather the (internally) hybrid (t ∧ ≥ 1)-mode introduced in [13]. We will not start a study on valences in hybrid CDGS, but this would be also a natural venue to continue. We conjecture that Ltab (CD, CF, (t ∧ ≥ 1), M) can be characterized by table valence ET0L systems with valences from M for any monoid M = (M, ◦, e). The latter systems have been investigated in [8].
6 Conclusions We initiated a study on CD grammar systems endowed with valences. Many issues are left to be investigated. We only mention a few: 1. The power of component valences is not yet fully understood. 2. Also in the case of intermediate valence tests, the modes ≥ k (including ∗) are not fully classified. 3. There are quite a few natural measures of descriptional complexity that can be associated to CDGS. None of these issues have been studied in the context of CDGS with valences. 4. One might also want to study further other types of core rules, like linear rules or context-free rules disallowing erasing rules. 5. Other properties than hierarchy questions (like closure properties, decidability etc.) have not yet been touched at all. 6. It might be interesting to study valences also within hybrid CDGS, both working with internal and with external hybridization, see [13,14,15].
Expressive Power of Valences in Cooperating Distributed Grammar Systems
105
Also, in the related area of ET0L systems with valences, many of the questions raised above remain open, so that this paper might also renew interest in these language families. In our paper [8], we are quite specific about numerous further open questions in the area. We will conclude this paper by summarizing the known relationships among the language families introduced in this paper, focusing on the context-free case, as well as on the case of Z-valences. Theorem 12. For any k, k , k , k ≥ 2, L(CF) = Lint (CD, CF, = 1, Z) Lext (CD, CF, = 1, Z) = Lext (CD, CF, ≤ k, Z) L(MAT, CF) = Lint (CD, CF, ≤ k , Z) = Lext (CD, CF, ≥ k , Z) ⊆ Lint (CD, CF, ≤ k , Z) ⊆ Lint (CD, CF, t, Z) = L(RE). We actually conjecture the last inclusion relation to be strict, based on Petri-net type arguments, as have been used in [16].
References 1. P˘aun, G.: A new generative device: valence grammars. Rev. Roumaine Math. Pures Appl. XXV(6), 911–924 (1980) 2. Csuhaj–Varj´u, E., Dassow, J.: On cooperating/distributed grammar systems. J. Inf. Process. Cybern. EIK (formerly Elektron. Inf. verarb. Kybern.) 26(1/2), 49–63 (1990) 3. Csuhaj–Varj´u, E., Dassow, J., Kelemen, J., P˘aun, G.: Grammar Systems: A Grammatical Approach to Distribution and Cooperation. Gordon and Breach, London (1994) 4. Dassow, J., P˘aun, G.: Cooperating/distributed grammar systems with registers. Foundations of Control Engineering 15(1), 1–38 (1990) 5. Vicolov, S.: Cooperating/distributed grammar systems with registers: the regular case. Computers and Artificial Intelligence 12(1), 89–98 (1993) 6. Vicolov-Dumitrescu, S.: Grammars, grammar systems, and gsm mappings with valences. In: P˘aun, G. (ed.) Mathematical Aspects of Natural and Formal Languages. World Scientific Series in Computer Science, vol. 43, pp. 473–491. World Scientific, Singapore (1994) 7. Dumitrescu, S.: Characterizing of RE using CD grammar systems with two registers and RL rules. In: P˘aun, G., Salomaa, A. (eds.) New Trends in Formal Languages. LNCS, vol. 1218, pp. 167–177. Springer, Heidelberg (1997) 8. Fernau, H., Stiebe, R.: Valences in Lindenmayer systems. Fundamenta Informaticae 45, 329– 358 (2001) 9. Dassow, J., P˘aun, G.: Regulated Rewriting in Formal Language Theory. EATCS Monographs in Theoretical Computer Science, vol. 18. Springer, Heidelberg (1989) 10. Boasson, L.: An iteration theorem for one-counter languages. In: STOC, pp. 116–120. ACM, New York (1971) 11. Mitrana, V., Stiebe, R.: Extended finite automata over groups. Discrete Applied Mathematics 108, 287–300 (2001) 12. Marcus, M., P˘aun, G.: Valence gsm-mappings, Bull. Math. Soc. Sci. Math. Roumanie. 31(3), 219–229 (1987)
106
H. Fernau and R. Stiebe
13. Fernau, H., Freund, R., Holzer, M.: Hybrid modes in cooperating distributed grammar systems: internal versus external hybridization. Theoretical Computer Science 259(1-2), 405– 426 (2001) 14. Fernau, H., Holzer, M., Freund, R.: Hybrid modes in cooperating distributed grammar systems: combining the t-mode with the modes ≤ k and = k. Theoretical Computer Science 299, 633–662 (2003) 15. Mitrana, V.: Hybrid cooperating/distributed grammar systems. Computers and Artificial Intelligence 12(1), 83–88 (1993) 16. Hauschildt, D., Jantzen, M.: Petri net algorithms in the theory of matrix grammars. Acta Informatica 31, 719–728 (1994)
Generative Power of Eco-Colonies ˇ arka Vavreˇckov´a1 Alica Kelemenov´a1,2, and S´ 1
Institute of Computer Science, Faculty of Philosophy and Science Silesian University in Opava, Czech Republic {alica.kelemenova,sarka.vavreckova}@fpf.slu.cz 2 Department of Computer Science, Faculty of Education Catholic University, Ruˇzomberok, Slovakia
Abstract. Eco-colonies are grammar systems with very simple grammars called agents. Every agent generates its own finite language, all agents cooperate in a shared environment which is represented by a string. The environment is developing not only by the actions of the agents, but also as L systems using its developmental rules. In this chapter we deal with eco-colonies working in the weakly parallel derivation mode. We compare the generative power of weakly parallel eco-colonies with colonies and programmed grammars. Keywords: Eco-colony; 0L eco-colony; E0L eco-colony; colony; agent; component; eco-grammar system.
1 Introduction Colonies were introduced in [1] as collections of simple grammars (called components) working on a common environment. Each component is specified by its start symbol and by its finite language. This language determines actions to do with the start symbol, the component substitutes its start symbol by some of the words of this language. The environment of the colony which is represented by a string is itself static, only the components can modify it. Several variants of colonies with various types of derivation modes were introduced and studied. The original model is sequential (one component rewrites one position of its start symbol in one derivation step), the other type of derivation is called terminal: it is a sequential derivation with respect to the active components, but the chosen component works parallely on all occurrences of its start symbol. Parallel colonies were introduced in [2], the parallel behavior of a colony means working all the components that can work (the components whose start symbols occur in the environment and no other component is occupying this symbol for the actual derivation step), one component processes one occurrence of its start symbol. In the present chapter we will study eco-colonies. Eco-colonies were first introduced in [3], their E0L form in [4].
Research supported in part by Slovak Scientific Research Fund VEGA grant No 1/0692/08 and by the project SGS/5/2010 of the Silesian University in Opava.
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 107–121, 2011. c Springer-Verlag Berlin Heidelberg 2011
108
ˇ Vavreˇckov´a A. Kelemenov´a and S.
Eco-colonies are colonies with developing environment which is specified by a 0L scheme or E0L scheme. Every symbol of the environment not processed by some agent (component) is rewritten by some of the developmental rules of this scheme. The concept of a developing environment is inspired by eco-grammar systems ([5]), a more complex type of grammar systems with a more sophisticated behavior of the components then we have in eco-colonies. Programmed grammars ([6,7]) are an extension of Chomsky grammars with regulated sequential derivation. Each rule is equipped by two sets of labels of rules: the first one with the labels of the rules to continue if the present rule was applicable in the previous derivation step (the success field of such rule), the second set with the labels of the rules to continue if the present rule was not applicable (its failure field). In this chapter we compare the generative power of eco-colonies, colonies and programmed grammars. Some necessary definitions about colonies, eco-colonies and programmed grammars can be found in Section 2. The next section is devoted to the comparison of the given systems.
2 Preliminaries In this section we define colonies, eco-colonies and programmed grammars with the necessary types of derivation modes, and we present lemmas and propositions used in the next sections. For further prerequisites from the theory of formal languages and grammars we refer to [8], related information about the theory of grammar systems can be found in [9]. For more on L-systems, 0L-, E0L-, ET0L- and T0L-systems we refer to [10]. We use the following notation: – |w|S for the number of occurrences of a symbol S in a word w, – alph(w) for a word w means the set of the letters occurring in w, – min(x, y) gives the value of the smaller number of x and y. 2.1 Colonies Definition 1. A colony is an (n+3)-tuple C = (V, T, A1 , . . . An , w0 ), where – V is the total (finite and non-empty) alphabet of the colony, – T is the non-empty terminal alphabet of the colony, T ⊆ V, – Ai = (Si , Fi ), 1 ≤ i ≤ n, is a component of the colony, where • Si ∈ V is the start symbol of the component, • Fi ⊆ (V − {Si })∗ , Fi is the finite language of this component, – w0 ∈ V ∗ is the axiom of the colony. Several derivation modes for colonies were introduced. We will discuss only one of them – the wp mode. If the weakly parallel (wp) mode is used in a colony, every component which can work must work in the following sense: each component rewrites at most one occurrence of its start symbol and a component is active if its start symbol is in the environment and no other component with the same start symbol occupies this occurrence of the symbol.
Generative Power of Eco-Colonies
109
Definition 2. We define a derivation step in the weakly parallel mode (wp mode) in a wp colony C = (V, T, A1 , . . . , An , w0 ) as the relation =⇒. We say that α directly derives wp β in the wp mode (written as α =⇒ β) if – α = v0 Si1 v1 Si2 v2 . . . vk−1 Sik vk , – β = v0 fi1 v1 fi2 v2 . . . vk−1 fik vk , ∗ where vm ∈ V ∗, 0 ≤ m ≤ k, Sij ∈ V, fij ∈ V − {Sij } , 1 ≤ j ≤ k, – there exist components (Sij , Fij ) in C with fij ∈ Fij , 1 ≤ j ≤ k, – {i1 , . . . , ik } ⊆ {1, . . . , n}, it = is for all t = s, 1 ≤ t, s ≤ k (one component can rewrite at most one occurrence of its start symbol), – for every S ∈ V, if the number of agents with the start symbol S is denoted by tS , then k Eval(Sij = S) = min (|α|S , tS ) (1) j=1
where the function Eval() returns 1 iff Sij = S is true, and the sum on the left side of the equation represents the number of the occurrences of S rewritten in this derivation step (all components which can work – their start symbol is in the environment and some of the occurrences of this symbol is not occupied by any other agent – they must work). wp wp For the relation =⇒ we denote by =⇒* the reflexive and transitive closure.
Definition 3. Let C = (V, T, A1 , . . . An , w0 ) be a colony. The language generated by C using the derivation mode wp is wp L(C, wp) = w ∈ T ∗ : w0 =⇒* w . The length set of the language L is the set {|w| : w ∈ L} of lengths of all words in L. We use L(COL, wp) for the class of languages generated by colonies with the wp mode of derivation, and L(COL, wp, T ) for the class of languages generated by colonies with T = V and the wp mode of derivation. 2.2 Languages of Colonies We point out results and properties of colonies used in the next parts of the chapter. For more information about languages of colonies see [13]. Evidently L(COL, wp, T ) ⊆ L(COL, wp). Let C be a colony, C = (V, T, A1 , . . . An , w0 ), with n components. Denote by m = max {|u| : u ∈ Fi , Ai = (Si , Fi ), 1 ≤ i ≤ n} the length of the longest word in the languages of all components. Lemma 1 (Length set lemma, [11]). Let L be an infinite language generated by a colony C with wp derivation mode. Then the length set of L contains infinite linearly dependent subsets, i.e. for some natural numbers a, b > 0 is {a · t + b : t ≥ 0} ⊆ {|w| : w ∈ L}.
110
ˇ Vavreˇckov´a A. Kelemenov´a and S.
Proof. Let C = (V, T, A1 , . . . An , w0 ) be a colony with wp derivation mode and L(C, wp) = L, where L is infinite. Let m be the length of the longest word in the languages of components A1 , . . . , An , as denoted above. Let us choose some w in L, |w| ≥ |w0 | + m · n · 2n and consider a derivation D of w in C. The derivation D consists of at least 2n steps, since in each derivation step wp wi =⇒ wi+1 we have |wi+1 | ≤ m · n + |wi |. wp By Tk we denote the set of active components in the derivation step wk =⇒ wk+1 , k ≥ 0 in D. Then there are indices i, j, i < j, such that the same set of components wp wp is active in the derivation steps wi =⇒ wi+1 and wj =⇒ wj+1 (T = Ti = Tj ) and wp each symbol of wi which is rewritten in the subderivation wi =⇒ * wj has a copy in wj , which was produced during this subderivation. We split the derivation D of w to the parts wp wp wp w0 =⇒* wi =⇒* wj =⇒* wr = w. (2) Then also derivations of the form wp wp wp wp wp w0 =⇒* wi = wj0 =⇒* wj1 =⇒* . . . =⇒* wjt =⇒* wt wp wp w0 =⇒* wi = wj0 =⇒* w0 (for t = 0)
(3)
produce terminal words in C, where the sequence (Ti , . . . , Tj−1 ) specified above is wp used in the derivations wjk =⇒ * wjk+1 , 0 ≤ k < t and the sequence (Tj , . . . , Tr−1 ) wp specified above is used in wjt =⇒* wt , for all t ≥ 0. Denote by si the number of symbols in wi in the derivation (2) which are not rewritwp ∗ ten during wi =⇒ w and by sj the number of symbols in wj which are not rewritten wp during wj =⇒* w. The numbers si and sj are constant for the derivation (2) with the specified splitting. Let n0 = si , n1 = sj − si , n2 = |w| − sj . Then for the length set of words derived in (3) we have |wt | = t · n1 + n0 + n2 which completes the proof. 2.3 Eco-Colonies In this section we define eco-colonies and then we specify the weakly parallel derivation mode in eco-colonies. Definition 4. An E0L eco-colony of degree n, n ≥ 1, is an (n + 2)-tuple Σ = (E, A1 , A2 , . . . , An , w0 ), where – E = (V, T, P ) is an E0L scheme, where V is an alphabet, T is a terminal alphabet, T ⊆ V, P ⊆ V × V ∗ is a finite set of E0L rewriting rules over V, – Ai = (Si , Fi ), 1 ≤ i ≤ n, is the ith agent, where Si ∈ V is the start symbol of the agent, Fi ⊆ (V − {Si })∗ is a finite set of action rules of the agent (the language of the agent), – w0 is the axiom. An 0L eco-colony is an E0L eco-colony with T = V. To describe the environment of the 0L eco-colony we use a pair E = (V, P ), where P is a finite set of 0L rewriting rules over V .
Generative Power of Eco-Colonies
111
The only difference to colonies as defined before is in the possibility of self-developing of the environment. We again only deal with the wp mode. In every derivation step each agent (S, F ) looks for its start symbol S. If it finds some occurrence of this symbol not occupied by any other agent, the agent becomes active, occupies this symbol and rewrites it by some word of its language F . The rest of symbols is rewritten by the environment. Definition 5. A derivation step in weakly competitive parallel mode of an eco-colony wp Σ = (E, A1 , A2 , . . . , An , w0 ) is the relation =⇒: wp α directly derives β in wp mode of derivation (written as α =⇒ β) if – – – –
α = v0 Si1 v1 Si2 v2 . . . vr−1 Sir vr , r > 0, vi ∈ V ∗ , 0 ≤ i ≤ r, β = v0 fi1 v1 fi2 v2 . . . vr−1 fir vr , for Aik = (Sik , Fik ), fik ∈ Fik , 1 ≤ k ≤ r, {i1 , . . . , ir } ⊆ {1, . . . , n}, ik = im for all k = m, 1 ≤ k, m ≤ r, for every S ∈ V, if the number of agents with the start symbol S is denoted by tS , then r Eval(Sij = S) = min (|α|S , tS ) (4) j=1
where the function Eval() returns 1 iff Sij = S is true, and the sum on the left side of the equation represents the number of the occurrences of S rewritten in this derivation step (all agents which can work must work), E – vk =⇒ vk , vk ∈ V ∗, 0 ≤ k ≤ r, is a derivation step of the scheme E, where each letter of vk is rewritten in totally parallel way using the rules of P in the E0L scheme E. wp
wp
For the relation =⇒ we define the reflexive and transitive closure =⇒* . Definition 6. Let ΣE = (E, A1 , . . . , An , w0 ) be an E0L eco-colony, E = (V, T, P ). The language of ΣE generated in the wp mode is wp L(ΣE , wp) = {w ∈ T ∗ : w0 =⇒* w}.
Let Σ0 = (E, A1 , A2 , . . . , An , w0 ) be a 0L eco-colony, E = (V, P ). The language of Σ0 generated in the wp mode wp L(Σ0 , wp) = {w ∈ V ∗ : w0 =⇒* w}.
We use L(0EC, wp) for the class of languages generated by 0L eco-colonies with the wp mode of derivation, L(EEC, wp) for the class of languages generated by E0L ecocolonies with the wp mode of derivation. Example 1. Let Σ = (E, A1 , A2 , AbB) be an E0L eco-colony, where E = ({A, B, a, b}, {a, b}, {a → a, b → bb, A → A, B → B}), A1 = (A, {aB, λ}), A2 = (B, {aA, λ}) One possible derivation in Σ is the following: wp
wp
wp
wp
wp
AbB =⇒ aBb2 aA =⇒ a2 Ab4 a2 B =⇒ a2 b8 a3 A =⇒ a2 b16 a4 B =⇒ . . . The wp derivation allows the resting of non-active agents. The generated language is n L(Σ, wp) = ai b2 aj : 0 ≤ i, j < n, n ≥ 0 .
112
ˇ Vavreˇckov´a A. Kelemenov´a and S.
2.4 Programmed Grammars Definition 7. A system G = (N, T, P, S) is a (context-free) programmed grammar where N, T, S are as in a Chomsky grammar, and the set P is a finite set of triples (r : A → β, σ(r), ϕ(r)) where A → β is a rewriting rule, r is the label of the rule and σ(r) and ϕ(r) are sets of labels of rules in P . Denote by Lab(P ) = {r : r : A → β, σ(r), ϕ(r) ∈ P } the set of labels of all rules in P . Definition 8. A derivation step in a programmed grammar G = (N, T, P, S) is the p p relation =⇒ on (N ∪ T )∗ × Lab(P ) such that (x, r1 ) =⇒ (y, r2 ) if a) x = x1 Ax2 , y = x1 βx2 , r1 : A → β, σ(r1 ), ϕ(r1 ) ∈ P, and r2 ∈ σ(r1 ), or b) x = y, the rule r1 : A → β for some r1 : A → β, σ(r1 ), ϕ(r1 ) ∈ P is not applicable to x and r2 ∈ ϕ(r1 ). With respect to the items a) and b), the set σ(r) is called the success field of r and the set ϕ(r) the failure field of r. Definition 9. The language generated by the programmed grammar G = (N, T, P, S) is p L(G) = w : w ∈ T ∗ , (S, r1 ) =⇒* (w, r2 ) for some r1 , r2 ∈ Lab(P ) p p where =⇒* is the reflexive and transitive closure of =⇒.
Definition 10. The programmed grammar G = (N, T, P, S) is without appearance checking, if the failure fields ϕ(r) of all the rules r ∈ P are empty. Otherwise it works in the appearance checking mode. The set of all languages generated by programmed grammars with appearance checking is denoted by L(P ROG, ac), the set of all languages generated by programmed grammars without appearance checking is denoted by L(P ROG). Proposition 1 ([6], p. 39). L(P ROG, ac) = L(RE) Example 2. We present a programmed grammar for the language L1 = {am bn am : 1 ≤ m ≤ n}. G = ({S, M, N, P }, {a, b}, PG , S) with the rules in PG : (s : S → M P N, {m1 , m2 }, ∅) (n1 : N → aN, {p1 , p2 , m1 , m2 }, ∅) ∅) (n2 : N → a, {p1 , p2 }, ∅) (m1 : M → aM b, {n1 }, (m2 : M → ab, {n2 }, ∅) (p1 : P → bP, {p1 , p2 , m1 , m2 }, ∅) (p2 : P → λ, {m1 , m2 }, ∅) The derivation of the word a2 b3 a2 : p p p p (S, s) =⇒ (M P N, m1 ) =⇒ (aM bP N, n1 ) =⇒ (aM bP aN, p1 ) =⇒ p p p p =⇒ (aM bbP aN, m2 ) =⇒ (aabbbP aN, n2 ) =⇒ (aabbbP aa, p2) =⇒ aabbbaa
Generative Power of Eco-Colonies
113
Proposition 2 ([10], p. 268). L1 ∈ / L(E0L). Example 3. We construct a programmed grammar for the language L2 = wk : w ∈ L1 , k ≥ 1 = (am bn am )k : 1 ≤ m ≤ n, k ≥ 1 . G = ({S, M, N, P, T, V, R}, {a, b}, PG , S) with the rules in PG : (s1 : S → M P N S, {s1 , s2 }, ∅) (s2 : S → M P N, {m1 , m2 }, ∅) (m1 : M → aT b, (t : T → M, (m2 : M → ab, (n1 : N → aV, (v : (n2 : (p1 : (r : (p2 :
V → N, N → a, P → bR, R → P, P → λ,
{m1 }, {t}, {m2 }, {n1 },
{t}) {n1 }) {n2 }) {v})
{v}, {n2 }, {p1 }, {r}, {p2 },
{p1 , p2 , m1 , m2 }) {p1 , p2 }) {r}) {p1 , p2 , m1 , m2 }) {m1 , m2 })
The rules s1 and s2 produce a string (M P N )k . Then the rules m1 or m2 and n1 or n2 (recursively through the rules t and v using the symbols T and V) rewrite all the symbols M and N . The same rule (m1 or m2 ) is used for all the symbols M in one throughput, the same rule (n1 or n2 ) for all the symbols N . The rules p1 , p2 and r allow to increase the count of b-s (the index n). The derivation is sequential, but it simulates the parallel synchronized derivation of all subwords am bn am with the identical indices m and n in all these subwords.
3 Generative Power of Eco-Colonies Theorem 1 ([11]). L(0EC, wp) ⊂ L(EEC, wp) Proof. The relation L(0EC, wp) ⊆ L(EEC, wp) is trivial, 0L eco-colonies are a special type of E0L eco-colonies with the terminal alphabet T = V . We prove that language i i L3 = {a2 : i ≥ 0} ∪ {b3 : i ≥ 0} is in L(EEC, wp) − L(0EC, wp). The language L3 is generated by the E0L eco-colony Σ = (E, A, S) with wp derivation mode, where E = ({S, a, b}, {a, b}, {a → aa, b → bbb, S → S}), A = (S, {a, b}) (this agent is active only in the first derivation step) Assume that some 0L eco-colony Σ0 = (E, A1 , A2 , . . . , An , w0 ) with E = (V, P ), generates the language L3 . Every state in the environment including the axiom is one of the elements of the language of Σ0 . P is deterministic. Otherwise there is a constant d and an infinite set of pairs u, v of words in the language generated by the 0L eco-colony Σ0 with |u| − |v| = d but L3 does not possess such a property.
114
ˇ Vavreˇckov´a A. Kelemenov´a and S.
The agents in Σ0 are of the form (a, F ), F ⊆ b∗, or (b, F ), F ⊆ a∗, and moreover F is a singleton, i.e. A = (b, {ak }) or A = (a, {bk } for some k ≥ 0. Otherwise there is a constant d and an infinite set of pairs u, v of words in the language generated by the 0L eco-colony Σ0 with |u| − |v| = d. We will discuss two cases 1) a → ai for some i, or 2) a → bj for some j is the only rule in P rewriting a. wp
1) Assume that a → ai for some i is the only rule in P rewriting a and ar =⇒ as in Σ0 for some r ≥ n + 1. Then all agents with the start symbol a produce only the empty word. Therefore no word over {b} can be derived from any word over {a}. So, the wp axiom w0 of Σ0 is in b+ and moreover bj =⇒ as in Σ0 for some j and s. Together with the determinism of P this gives that there is no infinite set of words over b produced by Σ0 . 2) Assume that a → bm ∈ P for some m > 1 is the only rule for a in P . Let wp s ≥ n + 1. Then as =⇒ bm(s−r)+v for some v, v ≥ 0, 0 ≤ r ≤ n (r agents work in this step). Moreover, for any t and s = 2t, there is t such that m · (2t − r) + v = 3t . Obviously this is possible for no constants m, r, v. So the 0L eco-colony Σ0 produces L3 in neither variant of P and therefore L3 ∈ / L(0EC, wp). 3.1 Eco-Colonies vs. Colonies Theorem 2 ([11]). L(COL, wp) ⊂ L(EEC, wp) Proof. The relation L(COL, wp) ⊆ L(EEC, wp) is trivial, colonies with wp derivation can be taken as a special type of E0L eco-colonies with a static environment (with the rules a → a for every letter from V ). To prove n the proper inclusion we use the language L 4 = a2 : n ≥ 0 . The language L4 is generated by the eco-colony Σ = (E, A, b), where E = ({a, b}, {a}, {a → aa, b → b}), A = (b, {a}). The language L4 does not include infinite subsets of words with linearly dependent length so according to Lemma 1 there is no colony C with wp derivation which generates the language L4 . Theorem 3 ([11]). The classes of languages L(0EC, wp) and L(COL, wp) are incomparable. Proof. We prove that 2n
2n
2n+1
2n+1
a) L5 = {cda2 b2 : n ≥ 0} ∪ {dca2 b2 : n ≥ 0} ∈ L(0EC, wp) − L(COL, wp) b) L6 = a, a3 , a5 ∈ L(COL, wp) − L(0EC, wp). The language L5 can be generated by the eco-colony Σ0 = (E, A1 , A2 , cdab), where E = ({a, b, c, d}, {a → aa, b → bb, c → c, d → d}), A1 = (c, {d}), A2 = (d, {c}), both agents are active for all words.
Generative Power of Eco-Colonies
115
This derivation is possible: wp
wp
wp
wp
wp
cdab =⇒ dca2 b2 =⇒ cda4 b4 =⇒ dca8 b8 =⇒ cda16 b16 =⇒ . . . The length of the words in L5 grows exponentially so L5 ∈ / L(COL, wp) according to Lemma 1. The language L6 is finite, so L6 ∈ L(COL, wp). Assume that there exists a 0L eco-colony Σ0 = (E, A1 , . . . , An , w0 ) with wp derivation generating L6 . V = {a}, so the start symbol of each active agent (able to work) is a. Agents generate a finite language over V −{a}, so we have A = (a, {λ}) for each agent in Σ0 . Such a 0L eco-colony produces λ from the string a, but λ ∈ / a, a3 , a5 . Therefore Σ0 does not contain active components. All words of L6 have to be produced by the underlying 0L system E specifying the environment. But L6 is not a 0L language. It implies L6 ∈ / L(0EC, wp). Corollary 1 L(COL, wp, T ) ⊂ L(0EC, wp)
(5)
Proof. Colonies generating the languages in L(COL, wp, T ) are a special type of ecocolonies generating the languages in L(0EC, wp) with a static environment (only rules of type a → a), so L(COL, wp, T ) ⊆ L(0EC, wp). The inclusion L(COL, wp, T ) ⊆ L(COL, wp) holds , and we proved that L5 ∈ L(0EC, wp) − L(COL, wp) (Theorem 3), so L5 ∈ L(0EC, wp) − L(COL, wp, T ). It implies the inclusion (5). 3.2 Eco-Colonies vs. Programmed Grammars Theorem 4. L(P ROG) ⊂ L(EEC, wp) ⊆ L(P ROG, ac) Proof. The inclusion L(EEC, wp) ⊆ L(P ROG, ac) follows from the fact that the class L(P ROG, ac) is equal to L(RE) (Proposition 1). Let G = (N, T, PG , S) be a programmed grammar without appearance checking. Assume that there is only one rule in PG rewriting the start symbol. (Otherwise we transform G to satisfy this condition by adding one rule and a new start symbol). We create an E0L eco-colony Σ with the wp derivation such that L(Σ, wp) = L(G). The string w0 = S · R · Cont(Lab(PG )) will be the axiom of Σ, where R is the label of the only rule rewriting the start symbol S of G and Cont({B1 , B2 , . . . , Bm }) = B1 · B2 · · · Bm for some m > 0. The E0L eco-colony Σ consists of the following agents: 1. The agent AB for each B ∈ N : AB = (B, {B NB } ∪ {BR R : (R : B → α, σ(R), ∅) ∈ PG }) By BR R the agent chooses rule R which will be used to rewrite B or it can use B NB (useful in the case when there is no rule to rewrite B.) 2. The agent AR = (BR , {α}) for each rule (R : B → α, σ(R), ∅) ∈ PG . This agent realizes part B → α of the production R. 3. The agent AR¯ for each rule (R : B → α, σ(R), ∅) ∈ PG : AR¯ = (R, {XR NB } · Cont(Lab(PG ) − {R})). The agent replaces R with the control string XR NB followed by string of all labels excluding R.
116
ˇ Vavreˇckov´a A. Kelemenov´a and S.
4. The agent AXR for each rule (R : B → α, σ(R), ∅): AXR = (XR , {X} ∪ {S · Cont(Lab(PG )) : S ∈ σ(R)}) 5. Pairs of agents for each rule R ∈ Lab(PG ) and for each NB , B ∈ N : (R, {λ}), (R, {E}) (NB , {λ}), (NB , {E}) and the blocking agents (E, {E }), (E , {E}) The agents test the single occurrence of symbols R or NB for some B ∈ N in the string. Double occurrence of any of the symbols R or NB leads to no terminal string. 6. The agent AX controls the termination of the derivation: AX = (X, Cont(Lab(PG )) · Cont({NB : B ∈ N }) The environment E = (V, T, P ) of the E0L eco-colony Σ rewrites all symbols in N ∪T and all ‘agent identifying’ symbols: P = {b → b : b ∈ T } ∪ {B → B , B → B : B ∈ N } ∪ ∪ {NB → NB : B ∈ N } ∪ {X → X} ∪ ∪ {BR → BR , R → R, R → R : (R : B → α, σ(R), ∅) ∈ PG }. The terminal alphabet T is identical with that of G. To prove the language equivalence of Σ and G we prove both inclusions. a) First we prove that L(G) ⊆ L(Σ, wp): p p p Let S = α0 =⇒ α1 =⇒ . . . =⇒ αn = w be a derivation of a word w in G, and p αi =⇒ αi+1 , 1 ≤ i ≤ n − 2 be the ith derivation step. Assume that αi = βAγ, αi+1 = βηγ and the step is provided over the rule (R : A → η, {K, . . . }, ∅) and the rule K has to be used in the next derivation step. We create the equivalent couple of steps in the eco-colony Σ. The derivation starts with the axiom SR·Cont(Lab(PG )). The corresponding couple of steps in the eco-colony simulating the ith derivation step of G is wp
wp
βAγR · Cont(Lab(PG )) =⇒ β AR Rγ XR NA Cont(Lab(PG ) − {R}) =⇒ wp =⇒ βηγK · Cont(Lab(PG )). In the first step the agent AA from (1) rewrites A, all other nonterminals from N in β, γ are rewritten to B NB from (1) or by rules of the environment. The terminals in the substrings β, γ, β and γ are processed by the rules of the environment. In the control part we use an agent from (3) to rewrite R, and Cont(Lab(PG )) produce λ using agents from (5). In the second step an agent from (2) is active, agent from (4) produces the control string and all symbols from Cont(Lab(PG ) − {R}) and all symbols NB produce λ using agents from (5). The derivation in Σ is terminated as follows: if αn−1 = βAγ and the used rule is (R : A → η, {K, . . . }, ∅), then wp
wp
βAγ · R · Cont(Lab(PG )) =⇒ β AR Rγ XR NA · Cont(Lab(PG ) − {R}) =⇒ wp wp wp =⇒ βηγX =⇒ β ηγ Cont(Lab(PG ))Cont({NB : B ∈ N }) =⇒ βηγ = w b) Secondly we prove L(Σ, wp) ⊆ L(G): Let w ∈ L(Σ, wp) be a word generated in the derivation
Generative Power of Eco-Colonies wp
wp
117
wp
SR · Cont(Lab(PG )) = α0 =⇒ α1 =⇒ . . . =⇒ αn = w. Let αi , 0 ≤ i ≤ n − 4, be one of the odd words in the derivation sequence. The form of this word is αi = βAγ · Rk · Cont(Lab(PG )), β, γ ∈ V ∗ . Note that the axiom of Σ has this form. The following agents have to work in the derivation step rewriting αi : (i) the agent rewriting Rk : there is only one possibility to rewrite Rk (in (3))– this symbol is replaced by the string XRk NA · R0 · · · Rk−1 Rk+1 · · · Rt . (ii) the agents rewriting the symbols R ∈ Lab(PG ): there is only one occurrence of each symbol R in Cont(Lab(PG )), so all these symbols are rewritten to λ. Otherwise R produces E by an agent from (5) and derivation does not produce terminal word. (iii) the agents rewriting nonterminals B ∈ N contained in βAγ: there is the unique agent for each nonterminal A ∈ N , therefore only one of each nonterminal can be rewritten by the corresponding agent. The other symbols B ∈ N are processed by the environment (and rewritten to B ). Nonterminals processed by agents can be rewritten by strings B NB or BR R for each B ∈ N . Exactly one of the nonterminals is rewritten by BR R. Otherwise, – either BR R and CR R are substrings of αi+1 which together with the substring produced by agent from (i) gives two occurrences of the same production label. And in this case derivation produces letter E and no terminal word; – or all active agents for A ∈ N generates strings A NA . Then there are two symbols NA in αi+1 , the second one is generated from Rk . So the agent (NA , {E}) works and no terminal word is derived. This gives αi+1 = β AR Rγ XR NA Cont(Lab(PG ) − {R}) for the strings derived in even steps. In the word αi+1 the following agents have to work: (i) the agent rewriting AR : there is only one word in the language of the agent processing AR . (ii) all the agents rewriting the symbols R ∈ Lab(PG ) and the agents rewriting symbols NA : all these symbols appear once in the environment. The agents rewriting them to λ are used in the derivation, otherwise no terminal word is generated (E or E is in the environment). (iii) the agent rewriting the symbol XR : the agent processing XR can generate a string S · Cont(Lab(PG )) for some label S ∈ σ(Rk ) or the symbol X. In the first case, αi+2 are in the required form βAγ · Rk · Cont(Lab(PG )). The strings S · Cont(Lab(PG )) determine the simulated rule of the programmed grammar (with the label S) for the next step, it means choosing one of the possible derivations of the programmed grammar. If the symbol X is generated (in αi+2 ), there are all R ∈ Lab(PG ) and NB for all B ∈ N added to αi+3 by the agent processing X and at least one of these symbols is generated by some other symbol (some C ∈ N which is going to be processed in the programmed grammar in the next step to simulate here). So some of the agents generating E are used and no terminal word is derived. The symbols not processed by agents are rewritten by the rules of the environment. They are of the form B , B ∈ N , so they are rewritten to B.
118
ˇ Vavreˇckov´a A. Kelemenov´a and S.
The correctness of the derivation sequence is proved up to the word αn−3 . Suppose that there is only one symbol AR for some A ∈ N and R ∈ Lab(PG ) in the word αn−3 and the simulated rule R of the programmed grammar is terminal. These agents can work on the word αn−3 : (i) the agents rewriting AR : there is only one rule for the agent rewriting AR , only terminal symbols are generated. (ii) the agents rewriting the symbols S ∈ Lab(PG ) and the symbol NA : all the symbols are in one occurrence in the environment, so we use the agents rewriting these symbols to λ (otherwise E is in the environment and no terminal word is generated). (iii) the agent rewriting XR : the symbol XR may be rewritten to X or one of the strings S · Cont(Lab(PG )) for some S ∈ σ(R). So we can suppose that the symbol X is produced from XR without the cycles described in the above paragraph. The symbol X is the single symbol in αn−2 which is not terminal. This symbol can be rewritten only to the string Cont(Lab(PG )) · Cont( B∈N NB ). Each of the symbols is in one occurrence in αn−1 , so it is rewritten to λ (or to E without generating any terminal word). The word αn is terminal. Its derivation in Σ is equivalent to the derivation in G (of the length (n − 1)/2), so w ∈ L(Σ, wp). n The language L4 = a2 : n ≥ 0 is in L(P ROG, ac) − L(P ROG) ([12]) and the E0L eco-colony with wp derivation mode generating this language can be found in the proof of Theorem 2, so L4 ∈ L(EEC, wp) − L(P ROG) and the proper inclusion is proved. We use the next example in order to illustrate the construction of the E0L eco-colony equivalent to the programmed grammar. Example 4. Let G = (N, T, PG , S) be a programmed grammar where N = {S, A, B}, T = {a, b}, there are the following rules in PG : (R0 : S → AB, {R1 , R2 }, ∅) (R3 : B → AA, {R2 , R4 }, ∅) (R1 : A → aBb, {R1 , R2 , R3 }, ∅) (R4 : B → ba, {R3 , R4 }, ∅) (R2 : A → ab, {R2 , R3 , R4 }, ∅) This derivation is possible: p p p p (S, R0 ) =⇒ (AB, R1 ) =⇒ (aBbB, R3 ) =⇒ (aAAbB, R2 ) =⇒ p p p =⇒ (aabAbB, R2 ) =⇒ (aababbB, R4 ) =⇒ aababbba Let us give an equivalent E0L eco-colony ΣE with wp derivation. The axiom is of the form SR0 R0 R1 R2 R3 R4 . Each derivation step of the programmed grammar is simulated by a couple of steps in the eco-colony: the simulated rule of the programmed grammar is performed in the first one, and the second step is intended to pick the simulated rule for the next couple of steps. 1. These agents generate the control symbols to determine the simulated rule for the next derivation step: (S, {SR0 R0 , S NS }) (A, {AR1 R1 , AR2 R2 , A NA }) (B, {BR3 R3 , BR4 R4 , B NB })
Generative Power of Eco-Colonies
119
Symbol NX (for some symbol X) is generated, when the symbol X is not rewritten in the simulated derivation step of the programmed grammar. If a symbol Ri (for the ith rule of the programmed grammar) is generated, it means that the next derivation step is intended to simulate the ith rule of the programmed grammar. 2. The equivalents of rules in the programmed grammar (these agents generate the right sides of the rules of the programmed grammar): (SR0 , {AB})
(AR1 , {aBb})
(AR2 , {ab})
(BR3 , {AA})
(BR4 , {ba})
3. The purpose of the symbols generated by the following agents is to avoid simulation of more than one rule of the programmed grammar in one derivation step, or use of rule not responding to the member of sequence specified in σ(Ri ) of a rule Ri . (R0 , {XR0 NS R1 R2 R3 R4 }) (R1 , {XR1 NA R0 R2 R3 R4 }) (R2 , {XR2 NA R0 R1 R3 R4 })
(R3 , {XR3 NB R0 R1 R2 R4 }) (R4 , {XR4 NB R0 R1 R2 R3 })
The word of such agents with the start symbol Ri does not contain the symbol Ri , this symbol is generated in the same derivation step by another agent. 4. The rule for the next step is chosen, the simulation of the rules of the programmed grammar is excluded in the odd derivation steps in the eco-colony. (XR0 , {R1 R0 . . . R4 , (XR1 , {R1 R0 . . . R4 , (XR2 , {R2 R0 . . . R4 , (XR3 , {R2 R0 . . . R4 , (XR4 , {R3 R0 . . . R4 ,
R 2 R 0 . . . R4 , R 2 R 0 . . . R4 , R 3 R 0 . . . R4 , R 4 R 0 . . . R4 , R 4 R 0 . . . R4 ,
X}) R3 R0 . . . R4 , X}) R4 R0 . . . R4 , X}) X}) X})
5. The control symbols are removed in each derivation step. If there is more than one occurrence of some symbol, only one occurrence is removed, the others are rewritten to the symbol E and no terminal word is derived. (R0 , {λ}) (R1 , {λ}) (R2 , {λ}) (R3 , {λ}) (R4 , {λ}) (R0 , {E}) (R1 , {E}) (R2 , {E}) (R3 , {E}) (R4 , {E}) (NS , {λ}) (NA , {λ}) (NB , {λ}) (E, {E }) (NS , {E}) (NA , {E}) (NB , {E}) (E , {E}) 6. Insurance of the correct termination of the derivation. If some nonterminals were not rewritten then the symbol E appears in the next step. (X, {R0 . . . R4 NS NA NB }) The rules in the environment of the eco-colony: PE = {S → S , A → A , B → B , S → S, A → A, B → B, a → a, b → b R0 → R0 , . . . R4 → R4 , NS → NS , NA → NA , NB → NB } We create these rules in order to synchronize the work of the agents to the odd and even derivation steps. The following derivation in the eco-colony is equivalent to the derivation in G listed above:
120
ˇ Vavreˇckov´a A. Kelemenov´a and S. wp
wp
SR0 R0 R1 R2 R3 R4 =⇒ SR0 R0 XR0 NS R1 R2 R3 R4 =⇒ wp wp wp wp =⇒ ABR1 R0 R1 R2 R3 R4 =⇒ AR1 R1 B NB XR1 NA R0 R2 R3 R4 =⇒ . . . =⇒ wp wp wp =⇒ aababbBR4 R0 R1 R2 R3 R4 =⇒ aababbBR4 R4 XR4 NB R0 R1 R2 R3 =⇒ wp wp wp =⇒ aababbbaX =⇒ aababbbaR0R1 R2 R3 R4 NS NA NB =⇒ aababbba
4 Conclusions In this chapter we studied the generative power of the eco-colonies. Figure 1 demonstrates main results presented in the chapter. The inclusions illustrated by the arrows are proper. L(P ROG, ac) = RE L(EEC, wp) L(COL, wp)
×
L(0EC, wp)
L(P ROG)
L(COL, wp, T ) Fig. 1. Main relations
Our conjencture is that k L2 = wk : w ∈ L1 , k ≥ 1 = (am bn am ) : 1 ≤ m ≤ n, k ≥ 1 ∈ / L(EEC, wp) and therefore the proper inclusion L(EEC, wp) ⊂ L(P ROG, ac) holds.
References 1. Kelemen, J., Kelemenov´a, A.: A Grammar-theoretic Treatment of Multiagent Systems. Cybernetics and Systems 23, 621–633 (1992) 2. Dassow, J., Kelemen, J., P˘aun, G.: On Parallelism in Colonies. Cybernetics and Systems 24, 37–49 (1993) ˇ Eko-kolonie. In: Kelemen, J., Kvasniˇcka, V., Posp´ıchal, J. (eds.) Kognice a 3. Vavreˇckov´a, S.: umˇel´y zˇ ivot V, pp. 601–612. Silesian University, Opava (2005) ˇ Properties of Eco-colonies. In: Kelemenov´a, A., Kol´aˇr, D., Meduna, A., 4. Vavreˇckov´a, S.: Zendulka, J. (eds.) Workshop on Formal Models 2007, pp. 235–242. Silesian University, Opava (2007) 5. Csuhaj–Varj´u, E., Kelemen, J., Kelemenov´a, A., P˘aun, G.: Eco-grammar Systems, Grammatical Framework for Studying Lifelike Interactions. Artificial Life 3, 1–28 (1997) 6. Dasow, J., P˘aun, G.: Regulated Rewriting in Formal Language Theory. Akademie-Verlag, Berlin (1989)
Generative Power of Eco-Colonies
121
7. Fernau, H.: Programmed Grammars with Rule Queues. International Journal of Foundations of Computer Science 18(5), 1209–1213 (2007) 8. Salomaa, A.: Formal Languages. Academic Press, New York (1973) 9. Csuhaj–Varj´u, E., Dassow, J., Kelemen, J., P˘aun, G.: Grammar Systems. A Grammatical Approach to Distribution and Cooperation. Gordon & Beach, London (1994) 10. Kari, L., Rozenberg, G., Salomaa, A.: L Systems. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 1. Springer, Berlin (1997) ˇ Kelemenov´a, A.: Properties of Eco-Colonies. In: Vaszil, G. (ed.) Proc. Au11. Vavreˇckov´a, S., tomata for Cellular and Molecular Computing, pp. 129–143. MTA SZTAKI, Budapest (2007) 12. Hauschildt, D., Jantzen, M.: Petri net algorithms in the theory of matrix grammars. Acta Informatica 31(8), 719–728 (1994) 13. Kelemenov´a, A., Csuhaj–Varj´u, E.: Languages of Colonies. Theoretical Computer Science 134, 119–130 (1994)
Selected Topics in Computational Complexity of Membrane Systems Petr Sos´ık Institute of Computer Science, Faculty of Philosophy and Science Silesian University in Opava, 74601 Opava, Czech Republic [email protected]
Abstract. Membrane system (P system) is a bio-inspired computational model using a variety of abstracted bio-operations, from regulated transport of molecules through membranes to membrane division, membrane dissolution, information processing through neural spiking signals etc. We compare various combinations of these operations to study how they influence the computational potential of the system. We give a comparative overview of recent known results for P systems with active membranes, P systems with proteins on membranes and spiking neural P systems. Trade-off between various operations and the role of diversity, regulation and structure in the system is demonstrated.
1 Introduction The study of biological systems from the point of view of information processing attracts still growing interest of biologists and computer scientists. A sequence of more or less abstract biological models have been studied to illustrate information processes and regulation in cells, organisms, swarms and ecosystems. Among them, the model of membrane system (or P system) was developed in 1998 as a representative of so-called biocomputing models, i.e., models of computing devices on the organic base. The key property of P system is a selectively permeable membrane which lets pass only certain objects (molecules), only in certain directions or only under some conditions. The membranes can be embedded, hence the name “membrane system.” Molecules can also react and produce other molecules. Gradually, many variants of membrane system have been proposed, enriched with further operations as membrane division, membrane dissolution, membrane polarization, tissue P systems, membrane with regulating proteins etc. The model of spiking neural P system became popular in the last few years. In this paper we focus on the study of the mutual relation of several abstract operations as those mentioned above: membrane division, membrane dissolution, membrane polarization, the presence of regulating proteins etc. Various combinations of these operations yield various levels of computational potential of the system. Our main aim here is to give a comprehensive survey of the known results arranged in a comparative way. Where possible, we omit technical details and refer the reader to more technical results with mathematical description and exact proofs of given statements. Instead, we step towards more general conclusions on the importance of information aspects of various types of operations in living cells and their systems. J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 125–137, 2011. c Springer-Verlag Berlin Heidelberg 2011
126
P. Sos´ık
Certain complexity classes play important role in the rest of the paper. The classes P, NP, co-NP and PSPACE are essential in the computational complexity theory. We denote by AC0 the class of problems solvable by uniform families of acyclic logic circuits with constant depth and a polynomial size. Let furthermore P/poly denote the class of problems solvable by Turing machines with polynomially bounded advice function. We refer the reader to, e.g., [31] for more details.
2 P Systems with Active Membranes A P system with active membranes [25], abbreviated here as AM system, is a construct Π = (V, H, μ, w1 , . . . , wm , R), where: m ≥ 1; V is an alphabet; H is a finite set of labels for membranes; μ is a membrane structure, consisting of m membranes described by a string of parentheses, labelled (not necessarily in a one-to-one manner) with elements of H; all membranes in μ are supposed to be neutral; (v) w1 , . . . , wm are strings over V , describing the multisets of objects placed in the regions of μ; (vi) R is a finite set of developmental rules.
(i) (ii) (iii) (iv)
The rules adopt the following forms: α
(a) [ h a → v] h , for h ∈ H, α ∈ {+, −, 0}, a ∈ V, v ∈ V ∗ (object evolution rules, associated with membranes and depending on the label and the charge of the membranes, but not directly involving the membranes, in the sense that the membranes are neither taking part to the application of these rules nor are they modified by them); α2 1 (b) a[ h ] α h → [ h b] h , for h ∈ H, α1 , α2 ∈ {+, −, 0}, a, b ∈ V (communication rules; an object is introduced into the membrane, maybe modified during this process; also, the polarization of the membrane can be modified, but not its label); α α (c) [ h a ] h 1 → [ h ] h 2 b, for h ∈ H, α1 , α2 ∈ {+, −, 0}, a, b ∈ V (communication rules; an object is sent out of the membrane, maybe modified during this process; also, the polarization of the membrane can be modified, but not its label); α (d) [ h a ] h → b, for h ∈ H, α ∈ {+, −, 0}, a, b ∈ V (dissolving rules; in reaction with an object, a membrane can be dissolved, leaving all its objects in the surrounding region, while the object specified in the rule can be modified);
Selected Topics in Computational Complexity of Membrane Systems α
α
127
α
(e) [ h a ] h 1 → [ h b ] h 2 [ h c ] h 3 , for h ∈ H, α1 , α2 , α3 ∈ {+, −, 0}, a, b, c ∈ V (division rules for elementary membranes; in reaction with an object, the membrane is divided into two membranes with the same label, maybe of different polarizations; the object specified in the rule is replaced in the two new membranes by possibly new objects; all the other objects are copied into both resulting membranes); + − − α2 (f) [ h0 [ h1 ] + h1 . . . [ hk ] hk [ hk+1 ] hk+1 . . . [ hn ] hn ] h0 α
α
α
α
α
α
4 → [ h0 [ h1 ] h13 . . . [ hk ] hk3 ] h05 [ h0 [ hk+1 ] hk+1 . . . [ hn ] hn4 ] h06 ,
for n > k ≥ 1, hi ∈ H, 0 ≤ i ≤ n, and α2 , . . . , α6 ∈ {+, −, 0}; (division of non-elementary membranes; this is possible only if a membrane contains two immediately lower membranes of opposite polarization, + and −; the membranes of opposite polarizations are separated in the two new membranes, but their polarization can change; all membranes of opposite polarizations are always separated by applying this rule. All the above rules are applied in parallel, but at one step, an object a can be subject to only one rule of type (a)–(e) and a membrane h can be subject to only one rule of type (b)–(f). In the case of type (f) rules, this means that none of the membranes h0 , . . . , hn listed in the rule can be simultaneously subject to another rule of type (b)–(f). However, this restriction do not apply to membranes with neutral charge contained in h0 . We refer to [25] for more details. The system Π starts its computation in the initial configuration (μ, w1 , . . . , wm ). The computation stops when there is no rule which can be applied to objects and membranes in the last configuration. In this paper we study the accepting (or recognizer) variant of P systems. A recognizer P system solving a decision problem has a specific input membrane which initially contains a multiset of objects encoding an instance of the problem. Alternatively, if the system solves only one instance, the instance may be encoded within the structure of the system; then we speak about P systems without input membrane. A recognizer P system must furthermore comply with the following requirements: (a) the working alphabet contains two distinguished elements yes and no; (b) all computations halt; and (c) exactly one of the object yes (accepting computation) or no (rejecting computation) must be sent to the output region of the system, and only at the last step of each computation. In our case of systems with active membranes, the outer environment of the system is taken as the output region. 2.1 Families of Membrane Systems Consider a decision problem X = (IX , θX ) where elements of IX are called instances and θX is a total boolean function over IX . In a family of recognizer systems without input membrane, denoted by Π = {Π(w) : w ∈ IX }, an instance w of a problem X is encoded into the structure of a P system Π(w). The system Π(w) is supposed to solve the instance w. If we use recognizer P systems with input membrane, then such a family is denoted by Π = {Π(n) : n ∈ N}. A member Π(n) of the family solves all
128
P. Sos´ık
the instances of the problem X of size n, properly encoded as its input. (Let us denote by |w| the size of an instance w ∈ IX .) Definition 1 ([21]). A family of recognizer membrane systems is polynomially uniform by Turing machines if there exists a deterministic Turing machine which constructs each member Π of the family in polynomial time with respect to the size of the instance(s) solved by Π. In the sequel we will for short denote such a family just as uniform. Formally, [21] defines the conditions of soundness and completeness of Π with respect to X. A conjunction of these two conditions ensures that for every w ∈ IX , if θX (w) = 1, then every computation of Π(w) is accepting, and if θX (w) = 0, then every computation of Π(w) is rejecting. Note that the system Π(w) can be generally nondeterministic, i.e, it may have different possible computations, but with the same result. Such a P system is also called confluent. Definition 2 ([21]). A decision problem X is solvable in polynomial time by a family Π = {Π(w) : w ∈ IX } of recognizer P systems without input membrane if the following holds: – The family Π is polynomially uniform by Turing machines. – The family Π is polynomially bounded; that is, there exists a polynomial p such that for each instance w ∈ IX , every computation of Π(w) performs at most p(|w|) steps. – The family Π is sound and complete with respect to X. The family Π is said to provide a semi-uniform solution to the problem X. Analogously one could define a family Π = {Π(n) : n ∈ N} of recognizer P systems with input membrane which provide a uniform solution to the problem X. We refer to [21] for more details. 2.2 AM Systems without Polarization It turns out that the possibility to regulate the behavior of rules in a membrane is crucial for the computational power of the system. We give results for three variants of AM systems without polarization, denoted by AM0 systems, i.e., such that all membranes are polarized neutrally. In such a case the condition that the membranes h1 , . . . , hk and hk+1 , . . . , hn in rules of type (f) have opposite polarization must be canceled. The first result is rather surprising: if we furthermore remove also the operation of membrane dissolution, the system looses almost all its computational power. Theorem 1 ([18]). Each AM0 system without dissolution rules of type (d) can be replaced by a computationally equivalent AM0 system with a single membrane and with evolution rules only, which immediately transform certain input objects to yes and others to no. Furthermore, this replacement can be done in constant parallel time FAC0 .
Selected Topics in Computational Complexity of Membrane Systems
129
In other words, the behavior of such a system is trivial and easily predictable. It is interesting that even the non-elementary membrane division does not increase the power of these systems. The situation is different whenever the membrane dissolution is allowed. Whenever the objects from a dissolved membrane are released to the surrounding membrane, they enter a different environment with possibly different rules than in the original membrane. The resulting computational power corresponds to that of conventional computers. Theorem 2 ([18]). Uniform families of AM0 systems with rules of type (a) (evolution rules) and (d) (dissolving rules) solve in polynomial time exactly the class of problems P. One can argue that, since each AM0 system – a member of the family – is constructed in polynomial time, then it can also contain encoded solution(s) to the instance(s) it solves and do not need to solve it itself. However, this result is valid also for AC0 - uniform families of AM0 systems. Therefore, the solution to an instance is found by the system itself. Theorem 3 ([19]). The result of Theorem 2 remains valid even if we augment AM0 systems with communication rules of type (b) a (c), and also division rules (e) restricted to the form [ h a ] h → [ h b ] h [ h b ] h (symmetric division of elementary membranes). It is interesting that the same problem in the case of asymmetric division of elementary membranes remains open for 10 years. However, if a non-elementary membrane division rules (f) are allowed, the power of AM0 systems jump to the level of the second class computer, i.e., a machine able to solve PSPACE-complete problems in polynomial time, as the alternating Turing machine or PRAM. Theorem 4 ([2]). (Semi-)uniform families of AM0 systems solve in polynomial time exactly the class of problems PSPACE. If the non-elementary membrane division is allowed but the evolution rules (a) and communication rules (b), (c) are prohibited, the computational power of the system is probably diminished but we do not know its exact characterization: Theorem 5 ([33]). Semi-uniform families of AM0 systems without rules of types (a),(b), (c) solve in polynomial time at least the class of problems NP. If AM0 systems described in Theorem 5 are augmented with regulation of division of non-elementary membranes such that rules of type (f) will adopt the form [ h0 [ h1 ] h1 [ h2 ] h2 [ p ] p ] h0 → [ h0 [ h1 ] h1 [ p ] p ] h0 [ h0 [ h2 ] h2 [ p ] p ] h0 , the computational potential of the second class computer is restored [13]. 2.3 AM Systems with Polarization If the polarization of membranes is allowed, the importance of the membrane dissolution operation demonstrated in Section 2.2 vanishes. This fact indicates that the membrane polarization and the dissolution rules are two abstract regulation mechanisms which can be mutually substituted from the computational point of view. Indeed, both allow to switch the set of rules applicable to the objects in a membrane.
130
P. Sos´ık
Table 1. An overview of computational power of recognizer AM systems without polarization. X denotes used operations, the symbol ? denotes operations which do not affect the computational power. Evolution rules (a) X Communication rules (b),(c) X Membrane dissolution (d) Symmetric division of elem. membranes (es ) X Division of elementary membranes (e) X Division of non-elementary membranes (f) X Class of problems solved ⊆ in polynomial time AC0
X X ? X X X X ? ? ? X X X X = ⊇ = P NP PSPACE
Theorem 6 ([30]). Semi-uniform families of AM systems with the only permitted types of rules (b), (c) (communication rules) can simulate a Turing machine in polynomial time (and space). As a consequence, they can solve in polynomial time the class of problems P. The proof of this statement demonstrates that the simulation is not pre-computed in the phase of construction of the AM system but is performed by the AM system itself. When further types of rules (a) (evolution rules) and (d) (dissolution rules) are added, the power of the system does not change [32]. One can, however, switch to uniform solutions instead of semi-uniform ones. The situation changes when the membrane division is allowed. Theorem 7 ([22]). Uniform families of AM systems with operations of types (a), (b), (c) and (e) (evolution rules, communication rules, elementary membrane division) can solve in polynomial time at least all the problems in NP ∪ co-NP. If the dissolution of membranes is added, the power of the system does not change. However, it is possible that some of the types of operations (a), (b), (c) could be restricted without loss of computational power. Finally, the addition of non-elementary membrane division guarantee the power of the second class computer. Theorem 8 ([1,29]). (Semi-)uniform families of AM systems solve in polynomial time exactly the class of problems PSPACE. The result holds regardless to the use of the operation of membrane dissolution. The results presented in this section can be presented in the form of Table 2 which summarizes the influence of various combinations of operations on the computational power of AM systems. 2.4 P Systems with Proteins on Membranes In this section we discuss a variant similar to AM systems: the P systems with proteins on membranes [23]. Their construction and motivation is similar to that of AM systems but, instead of membrane polarization, there are specific membrane proteins which let
Selected Topics in Computational Complexity of Membrane Systems
131
Table 2. An overview of computational power of recognizer AM systems with polarization. X denotes used operations, the symbol ? denotes operations which do not affect the computational power. Polarization Evolution rules (a) Communication rules (b),(c) Membrane dissolution (d) Symmetric division of elem. membranes (es ) Division of elementary membranes (e) Division of non-elementary membranes (f) Class of problems solved in polynomial time
X ? X ?
X X X ? ? X
X X X ? ? ? X = ⊇ NP = P ∪ co-NP PSPACE
only certain types of molecules pass through membranes in certain directions. The proteins also control the non-elementary membrane division. Proteins may be eventually changed during certain operations. The computational potential of P systems with proteins on membranes is similar to that of AM systems. These systems are computationally universal even without the use of membrane division but recent results proving their universality exploit operations which change membrane proteins. It is likely that universality would be preserved even without the use of membrane proteins change since some rules use antiport – a simultaneous transport of two objects through a membrane. This operation has been proven powerful in other types of membrane systems (symport-antiport systems). A recent result [28] dealing with P systems with proteins on membranes states that, when membrane division is allowed, their computational power is again equal to that of a second class computer and, hence, they can solve in polynomial time exactly the class of problems PSPACE.
3 Spiking Neural P Systems Information in neural systems of living organism is transferred in the form of electric pulses of, more or less, uniform type and amplitude [15]. Frequency of these pulses defines the intensity of a neural signal. Spiking Neural P Systems (abbreviated as SN P systems) represent a fully discrete model of computation inspired by these principles. The discrete nature of the model reflects the uniformity of pulses in natural neural systems, on one hand. On the other hand, it is not clear yet whether their variable frequency can be modeled by natural numbers without loss of important features of the model. Furthermore, some important aspects of living neural systems as their ability to learn and adapt have not been incorporated into the theory of SN P systems yet. However, SN P systems were not designed as a biologically plausible model of neural processes but rather an abstract computing model allowing to study certain principles of neural computing and their interaction from the information processing point of view.
132
P. Sos´ık
SN P system is topologically described by a directed graph whose nodes correspond to neurons and arcs to synapses. A neuron emits pulses (spikes) simultaneously to all neurons to which it is connected with directed arcs. Spikes are accumulated in neurons (like potentials in living neural cells) and their number triggers firing rules which control spiking of neurons. Rules adopt the form E/ac → a; d, where the symbol a represents one spike, E is a regular expression over the alphabet {a}, c ∈ N+ is a number of accumulated spikes consumed by an application of the rule, d ∈ N is a delay period between the rule application and emission of a spike. A SN P system operates in discrete time steps. A rule E/ac → a; d can be used whenever the number of spikes accumulated in a neuron is “covered” by the regular expression E, in the sense that an ∈ L(E), where L(E) is the formal language defined by E. The neuron is closed during the relaxation period d after the rule application and it cannot receive further spikes. After d step the neuron emits a spike and gets open again. There can be also forgetting rules of the form as → λ which can be applied if the neuron contains exactly s spikes. Such a rules empties the neuron (setting the number of spikes to zero) without emitting a spike. Each neuron can contain more rules which can be chosen non-deterministically, for example, if there are two rules E1 /ac1 → a; d1 and E2 /ac2 → a; d2 such that L(E1 ) ∩ L(E2 ) = ∅. However, if a neuron contains a forgetting rule(s) of the form as → λ, then the string as must not be contained in L(E), for any rule E/ac → a; d in the same neuron. Hence, the non-determinism is possible only between spiking rules. The system starts its computation in a pre-defined initial distribution of spikes in neurons and rules are applied in discrete time steps. All neurons operate synchronously (although asynchronous variants were studied, too). The computation continues until there are any spikes circulating in the system (i.e., if no neuron spikes for dmax steps, where dmax is the maximum delay in any rule in any neuron, the computation is finished). Input and output is represented as a sequence of binary numbers (spike = 1, no spike = 0) received/emitted by pre-defined neurons. Some authors also consider unaryinput and output – as a length of interval between two spikes, or as a number of spikes accumulated in a designated neuron. Regular expressions controlling spiking of neurons in constant time represent very strong formalism. We recall the definition of a regular expression for the sake of completeness. Definition 3. Let V be a finite alphabet of symbols. Then (i) the empty string λ and each symbol a ∈ V are regular expressions, (ii) if E1 , E2 are regular expressions, then also (E1 ) ∪ (E2 ), (E1 )(E2 ), and (E1 )∗ are regular expressions, (iii) nothing else is a regular expression over V . The catenation operator · and abundant parentheses are frequently omitted. Each regular expression E represents a set of strings over V denoted by L(E). For example, the expression (a ∪ aa)(aaa)∗ represents all strings composed of symbols a whose length modulo 3 gives 1 or 2. Two regular expressions E1 and E2 are equivalent if and only if L(E1 ) = L(E2 ).
Selected Topics in Computational Complexity of Membrane Systems
133
Already the initial paper [11] presented results showing the computational universality (in Turing sense) of SN P systems. This result was further strengthened as follows: Theorem 9 ([10,8]). The universal computing power of SN P systems remain unchanged even if any two of the following three features are removed: – regular expressions (except the simplest ones: a∗ and an , n ≥ 1); – forgetting rules; – delay period in neurons. It is interesting to note that, for the regular expressions removal, the “memory” of systems had to be realized in the form of pulses circulating in closed circuits which resembles the principles of biological short term memory. It is also probable that the system looses the computational universality when all three operations are removed. A deeper analysis of the computational power of SN P systems is started with seemingly contraintuitive result: Theorem 10 ([20]). No SN P system with a fixed amount of neurons can simulate Turing machine with less than exponential time (and space) overhead. Why is this result contra-intuitive? Neurons in P systems can easily implement in constant time any logical function like AND, OR, NOT (or XOR) [14]. Since these operations are sufficient for construction of any logical circuit and also conventional computers, one could expect the same computational effectiveness. The key difference, however, is in the memory operations. Turing machines operate unlimited memory which is of a binary (or k-ary, for a fixed k ≥ 1) nature. However, the unlimited memory in SN P systems has unary character – it is represented by spikes accumulated in neurons, hence its operation are exponentially slower. To reach the effectiveness of classical (so-called first class) computers like Turing machine, one must again switch to (semi-)uniform families of SN P systems. 3.1 Families of Spiking Neural P Systems We start with uniform families of recognizer SN P systems. Their description corresponds to that of uniform families of AM systems, with certain differences related to the representation of information and descriptional complexity [27]. The size of description of the system is important for definition of uniform families. Each member of the family must be constructed in time (and space) polynomial to the size of input(s) it would process. The size of other types of P systems is measured in terms of number of membranes and objects they contain, as this corresponds to their eventual physical realization. In SN P systems (and their biological inspiration) one deals with spikes which are no physical objects but rather electric potentials. Therefore, we consider a number of bits log n of an amount n of spikes accumulated in neuron as the size of its description. This is actually no advantage when compared with P systems with objects: a membrane which can potentially contain k different objects can encode by their (non-)presence 2k different values. Theorem 11 ([14,26]). The class NP is contained in the class of problems solvable by uniform families of recognizer SN P systems in polynomial time.
134
P. Sos´ık
This result seems to be surprising when compared with Theorem 10. The explanation is very simple – the computational power in the above theorem is provided by regular expressions, or, more specifically, the ability of SN P systems to evaluate their membership problem in constant time. When dealing with regular expressions in succinct form over a singleton alphabet, their membership problem can be easily shown equivalent to some NP-complete problems, e.g., S UBSET S UM. Consequently, regular expressions seem to be too strong a formalism for SN P systems and their restriction is desirable. Definition 4 ([3]). A regular expression E = E1 ∪ · · · ∪ En , where each Ei contains only operators · and ∗, is in single star normal form (SSNF), if ∀i ∈ {1, . . . , n}, Ei contains at most one occurrence of ∗. Lemma 1 ([3]). Each regular expression can be transformed into an equivalent one in the single star normal form, but possibly with exponential space overhead. The single star normal form can prevent the transfer of a substantial part of the computation into regular expression, as shown in the following result: Theorem 12 ([26]). Uniform families of recognizer SN P systems with all regular expressions in single star normal form characterize by their polynomial time-bounded computations the class P. In previous sections we mention uniform families of P systems which can solve in polynomial time even more difficult problems, namely those characterizing the class PSPACE. These results were allowed by the exponential growth of membrane structure of the system. Similar results can be reached also in the case of SN P systems, provided that an activation of exponential number of neurons in polynomial time is allowed. These neurons can form some simple regular pre-computed structure as in [12]. The last variant of a computing machinery mentioned in this section are non-uniform families of SN P systems. Therefore, any member of the family can be prepared with the use of an unlimited time and space, not excluding even super-Turing computational means. If there were no further limits imposed on resulting P systems, then such a family could obviously solve in constant time any problem including undecidable ones. Therefore, we consider only families producing uniform solutions, i.e., each member Π(n) of the family can solve all instances of size n of a given problem. Furthermore, we restrict also the size of Π(n) which must be polynomial to n. Theorem 13 ([26]). Non-uniform families of recognizer SN P systems of polynomial size with all regular expressions in single star normal form characterize by their polynomial time-bounded computations the class P/poly.
4 Conclusion In this paper we gave an overview of results concerning computational potential of several classes of P systems. We focused on the comparison of several basic operations and properties in these P systems, and how they influence the overall computational power. In the case of P systems with objects, the context-free nature of evolution and
Selected Topics in Computational Complexity of Membrane Systems
135
communication rules was also essential. These results can be summarized in the case of P systems with objects as follows: Regulation mechanism allowing some objects to control an application of rules to other objects is of essential importance. Such a mechanism can be provided by catalytic or context-sensitive rules. Alternatively, in the case of AM systems, some objects are allowed to change the environment in the membrane which controls the applicability of rules. This can be done either by a change of polarization or by a membrane dissolution. In the case of P systems with proteins of membranes, the antiport rules or the “change protein” rules would play this role. Many other mechanisms fulfilling this role exist in real cells. Without such a mechanism the system can perform only trivial computation. Exponential growth and diversity of computing elements, possibly very simple, allow to solve at least problems from NP∪co-NP. It is essential that this growth must allow for many different variants of membranes which try various solutions to the problem. (One nice parallel might be fast mutation of bacteria seeking to survive under new antibiotic treatment.) Hence the role of diversity is very important. If the offspring elements are identical, the computing power of the systems remains low. Deeper structure of the system increases its power to the level of the class PSPACE. All the results showing families of P systems equivalent to second class computers use structure whose depth is proportional to the size of the problem. Such a structure allows to trace many parallel lines of computation and collect their result in a logical way. It seems that amorphous systems with many membranes freely flowing within one common environment are computationally less powerful. One can still collect exponentially many different pieces of information but it cannot be traced which sub-membrane produces which. Such systems were proven to solve “only” the problems in NP ∪ co-NP. Hence the internal structure of living organisms seems to be a crucial advantage over an amorphous computing. Finally, when thinking about spiking neural P systems, it is interesting that even if they can simulate logical circuits in constant time, they are exponentially less efficient than Turing-style computers. The key lies in unary unlimited memory of SN P systems, when compared with binary (or k-ary) in computers or Turing machines. However, it would be interesting to learn more about how brain treats and represents numbers. Families of SN P systems must be used to overcome the mentioned exponential overhead. How is this related to means we use when dealing with algorithmic tasks which are beyond our intuitive capacity? We hope that these thoughts (which are supported by exact mathematical results, although based on a highly abstract bio-inspired model) could prove interesting for experts in other fields as the synthetic biology, computational neuroscince and similar.
References 1. Alhazov, A., Mart´ın-Vide, C., Pan, L.: Solving a PSPACE-complete problem by P systems with restricted active membranes. Fundamenta Informaticae 58(2), 67 (2003) 2. Alhazov, A., P´erez-Jim´enez, M.J.: Uniform solution of QSAT using polarizationless active membranes. In: Durand-Lose, J., Margenstern, M. (eds.) [6], pp. 122–133
136
P. Sos´ık
3. Andrei, S., Cavadini, S.V., Chin, W.-N.: A new algorithm for regularizing one-letter contextfree grammars. Theoretical Computer Science 306, 113–122 (2003) 4. Antoniou, I., Calude, C., Dinneen, M.J. (eds.): Proceedings of the Second International Conference on Unconventional Models of Computation, UMC’2K. Springer, Heidelberg (2001) 5. Calude, C.S., Costa, J.F., Freund, R., Oswald, M., Rozenberg, G. (eds.): UC 2008. LNCS, vol. 5204. Springer, Heidelberg (2008) 6. Durand-Lose, J.O., Margenstern, M. (eds.): MCU 2007. LNCS, vol. 4664. Springer, Heidelberg (2007) 7. Eleftherakis, G., Kefalas, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.): WMC 2007. LNCS, vol. 4860, pp. 77–96. Springer, Heidelberg (2007) 8. Garc´ıa-Arnau, M., P´erez, D., Rodr´ıguez-Pat´on, A., Sos´ık, P.: Spiking neural P systems: Stronger normal forms. Intern. J. of Unconventional Computing 5(5), 411–425 (2009) 9. Guti´errez-Naranjo, M.A., P˘aun, G., Romero-Jim´enez, A., Riscos-N´unez, A. (eds.): Fifth Brainstorming Week on Membrane Computing. Fenix Editora, Sevilla (2007) 10. Ibarra, O.H., P˘aun, A., P˘aun, G., Rodr´ıguez-Pat´on, A., Sos´ık, P., Woodworth, S.: Normal forms for spiking neural P systems. Theoretical Computer Science 372(2-3), 196–217 (2007) 11. Ionescu, M., P˘aun, G., Yokomori, T.: Spiking neural P systems. Fundamenta Informaticae 71(2–3), 279–308 (2006) 12. Ishdorj, T.-O., Leporati, A., Pan, L., Zeng, X., Zhang, X.: Deterministic solutions to QSAT and Q3SAT by spiking neural P systems with pre-computed resources. In: Mart´ınez-delAmor, et al. (eds.) [16], vol. 2, pp. 1–27 13. Leporati, A., Ferretti, C., Mauri, G., P´erez-Jim´enez, M.J., Zandron, C.: Complexity aspects of polarizationless membrane systems. Natural Computing 8(4), 703–717 (2009) 14. Leporati, A., Zandron, C., Ferretti, C., Mauri, G.: On the computational power of spiking neural P systems. In: Guti´errez-Naranjo, et al. (eds.) [9], pp. 227–245 15. Maass, W., Bishop, C. (eds.): Pulsed Neural Networks. MIT Press, Cambridge (1999) 16. Mart´ınez-del-Amor, M.A., Orejuela-Pinedo, E.F., P˘aun, G., Hurtado de Mendoza, I.P., Riscos-N´unez, A. (eds.): Seventh Brainstorming Week on Membrane Computing. Fenix Editora, Sevilla (2009) 17. Mart´ınez-del-Amor, M.A., P˘aun, G., Hurtado de Mendoza, I.P., Riscos-N´unez, A. (eds.): Eigth Brainstorming Week on Membrane Computing. Fenix Editora, Sevilla (2010) 18. Murphy, N.: Uniformity Conditions for Membrane Systems: Uncovering Complexity Below P. National University of Ireland, Maynooth, PhD thesis (2010) 19. Murphy, N., Woods, D.: Active membrane systems without charges and using only symmetric elementary division characterise P. In: Eleftherakis, et al. (eds.) [7], pp. 367–384 20. Neary, T.: On the computational complexity of spiking neural P systems. In: Calude, et al. (eds.) [5], pp. 189–205 21. P´erez-Jim´enez, M.J.: A computational complexity theory in membrane computing. In: P˘aun et al. (eds.) [24], pp. 125–148 22. P´erez-Jim´enez, M.J., Romero-Jim´enez, A., Sancho-Caparrini, F.: Complexity classes in models of cellular computing with membranes. Natural Computing 2, 265–285 (2003) 23. P˘aun, A., Popa, B.: P systems with proteins on membranes. Fundamenta Informaticae 72(4), 467–483 (2006) 24. P˘aun, G., P´erez-Jim´enez, M.J., Riscos-N´unez, A., Rozenberg, G., Salomaa, A. (eds.): WMC 2009. LNCS, vol. 5957. Springer, Heidelberg (2010) 25. P˘aun, G.: P systems with active membranes: attacking NP-complete problems. J. Automata, Languages and Combinatorics 6(1), 75–90 (2001) 26. Rodr´ıguez-Pat´on, A.: Sos´ık, P., Cienciala, L.: On complexity classes of spiking neural P systems. In: Mart´ınez-del-Amor, et al. (eds.) [17], pp. 267–282
Selected Topics in Computational Complexity of Membrane Systems
137
27. Rodr´ıguez-Pat´on, A., Sos´ık, P., Ciencialov´a, L.: Polynomial complexity classes in spiking neural P systems. In: Gheorghe, M., Hinze, T., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) CMC 2010. LNCS, vol. 6501, pp. 348–360. Springer, Heidelberg (2010) 28. Sos´ık, P., P˘aun, A., Rodr´ıguez-Pat´on, A., P´erez, D.: On the power of computing with proteins on membranes. In: P˘aun, et al. (eds.) [24], pp. 448–460 29. Sos´ık, P., Rodr´ıguez-Pat´on, A.: Membrane computing and complexity theory: A characterization of PSPACE. J. Comput. System Sci. 73(1), 137–152 (2007) 30. Valsecchi, A., Porreca, A.E., Leporati, A., Mauri, G., Zandron, C.: An efficient simulation of polynomial-space turing machines by P systems with active membranes. In: P˘aun, et al. (eds.) [24], pp. 461–478 31. van Leeuwen, J. (ed.): Handbook of Theoretical Computer Science. Algorithms and Complexity, vol. A. Elsevier, Amsterdam (1990) 32. Zandron, C., Ferretti, C., Mauri, G.: Solving NP-complete problems using P systems with active membranes. In: Antoniou, et al. (eds.) [4], pp. 289–301 33. Zandron, C., Leporati, A., Ferretti, C., Mauri, G., P´erez-Jim´enez, M.J.: On the computational efficiency of polarizationless recognizer P systems with strong division and dissolution. Fundam. Inform. 87(1), 79–91 (2008)
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface Bogdan Aman and Gabriel Ciobanu Institute of Computer Science, Romanian Academy, Ias¸i, Romania “A.I.Cuza” University, Blvd. Carol I no.11, 700506 Ias¸i, Romania [email protected], [email protected]
Abstract. Systems of mutual mobile membranes with objects on surface evolve by applying endocytosis and exocytosis rules. These rules are applicable only if both involved membranes agree on the movement by means of objects and co-objects placed on their surfaces: if a membrane has an object (e.g., a) on its surface, then the other membrane involved in a movement rule should have the corresponding co-object (e.g., a) on its surface. Temporal logic of actions TLA is a logic for specifying and reasoning about concurrent systems, developed mainly for verification. We specify the systems of mutual mobile membranes with objects on surface in temporal logic of actions, and provide some results with respect to such a specification. We give an implementation in TLA+ which could be used for verification of certain properties of the systems of mutual mobile membranes with objects on surface, and illustrate the whole process by a simple specification and its execution.
1 Introduction Membrane systems (also called P systems) have been inspired from the living cells. These systems are models of distributed, parallel and nondeterministic systems. Several variants of membrane systems are inspired by different aspects of cell biology (symport and antiport-based communication through membranes, catalytic objects, membrane charge, etc.). Membrane systems are presented together with many variants and examples in [1]. Several applications of these systems are presented in [2]. An updated bibliography can be found at the P systems web page http://ppage.psystems.eu. Systems of mobile membranes represent a rule-based parallel and nondeterministic computing model inspired by cells and their movements. The mobility is provided by consumption and rewriting of objects in specific endocytosis and exocytosis rules; in terms of computation, we are working with membrane configurations. Systems of mutual mobile membranes with objects on surface are introduced in [3]. The low-density lipoprotein (LDL) degradation pathway and other biological systems can be described by using systems of mutual mobile membranes with objects on surface [4]. Therefore it would be useful to verify the behaviour of these biological systems. Some behavioural properties as the problem of reaching a configuration from another configuration in systems of mobile membranes was treated in a rather theoretical way in [5]; a more practical approach is presented in this paper. J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 138–150, 2011. c Springer-Verlag Berlin Heidelberg 2011
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
139
Formal verification of complex systems as systems of mobile membranes is a difficult task. In this paper we use the temporal logic of actions to describe systems of mutual mobile membranes with objects on their surfaces, and use the existing software tools to verify correctness (this includes checking for liveness and safety properties). Complex systems including distributed, parallel and nondeterministic systems can be specified and verified by using the temporal logic introduced by Lamport in [6], and called TLA. A TLA specification defines in fact a state machine. A TLA verification consist in taking two specifications: one describing a more detailed machine (the “implementation”), and another describing a simpler machine (the “specification”), and prove that the implementation (machine) simulates the specification (machine). Systems of mobile membranes can be adequately described by their behaviours, namely their possible sequences of movements. We consider systems specified by a TLA formula describing a set of permitted behaviours, where a behaviour is represented by a sequence of states. The behaviours permitted by a specification can be described as the set of sequences satisfying either a safety property (asserting that something bad does not happen), or a liveness property (asserting that something good does eventually happen) [7]. In specifying a system of mobile membranes, a safety property might assert that a movement can take place only if some preconditions are fulfilled, while a liveness property might assert that a movement eventually takes place if its preconditions are fulfilled. In what follows we are concerned with specifications in which the safety property is described by an “abstract” nondeterministic program. In this way we can express that a behaviour satisfies the safety property if it can be generated by the program. Liveness properties can be described in two ways: either directly by writing some axioms, or indirectly by placing fairness constraints on the “abstract” program. In the specification of a system of mobile membranes, the program describes the sequences of actions by which such a system of mobile membranes is modified. To describe formally the specifications, we represent a program by a state machine that can have an infinite set of states, together with additional fairness constraints. The structure of the paper is as follows. Section 2 presents briefly the temporal logic TLA and its semantics. Section 3 gives a description of the systems of mutual mobile membranes with objects on surface. A specification of systems of mobile membranes by using TLA is presented in Section 4, followed by an example and an implementation in TLA+ (in Section 5). Conclusion and references end the paper.
2 The Temporal Logic of Actions The temporal logic TLA is built on both a logic of actions and a logic for reasoning about actions. A logic of actions is a language used for writing predicates (boolean expressions containing constants and variables), state functions (non-boolean expressions containing constants and variables) and actions (boolean expressions containing constants, variables, and primed variables). The syntax and semantics of TLA, along with additional notations used to write TLA formulas are summarized in what follows. More details are presented in [6].
140
B. Aman and G. Ciobanu
Syntax f ormula predicate | [action]state f unction | f ormula ∧ f ormula | ¬f ormula | f ormula action boolean-valued expression containing constant symbols, variables and primed variables predicate action with no primed variables | Enabledaction state f unction non-boolean expressions containing constant symbols and variables
An action represents a relation between old and new states, where the unprimed variables refer to the old state and the primed variables to the new state. The temporal logic operator (usually read “always”) is defined as follows: if σ is a behaviour s0 , s1 , . . ., then σi denotes the ith state si and σ +i denotes the behaviour σi , σi+1 , . . . obtained by cutting off the first i states of the sequence σ. The formula F asserts that F holds now and always in the future. For any formula F and behaviour σ, by [[F ]](σ) ∀i ≥ 0 : [[F ]](σ +i ) is denoted the fact that the formula F holds at a certain time if and only if F holds for an infinite behaviour starting at that time. We denote the state functions by f , variables by v, and use (∀v : . . . /v) to denote a substitution for every variable v. St represents the set of states, and actions are denoted by A. F and G are formulas, and p is either a state function or a predicate. For a state function f , the mapping from the collection St of states to the collection Val of values is denoted by [[f ]] : St → Val. If s[[f ]] denotes the value that [[f ]] assigns to state s, then the values obtained from f by substituting s[[v]] for all variables v are obtained using f (∀v : s[[v]]/v). For an action A, the mapping from a pair of states to boolean values is denoted by [[A]]. If s is the old state and t is the new state, then s[[A]]t is obtained from A by replacing each unprimed variable v by s[[v]] and each primed variable v by t[[v]]. An action A is valid (|= A) if and only if every step is an A step. By σ[[F ]] we denote the boolean value that the formula F assigns to behaviour σ. Since a formula is built up from elementary formulas is easy to write σ[[F ]] in terms of elementary formulas obtained from F . A formula F is valid (|= F ) if and only if it is satisfied by all possible behaviours. Semantics s[[f ]]
f (∀v : s[[v]]/v)
σ[[F ∧ G]] σ[[F ]] ∧ σ[[G]]
s[[A]]t A(∀v : s[[v]]/v, t[[v]]/v )
σ[[¬F ]]
¬σ[[F ]]
|= A
|= F
∀σ ∈ St∞ : σ[[F ]]
∀s, t ∈ St : s[[A]]t s[[Enabled A]]
∃t ∈ St; s[[A]]t
s0 , s1 , . . .[[A]]
s0 [[A]]s1
s0 , s1 , . . .[[A]] ∀n ∈
; s
n , sn+1 , . . .[[A]]
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
141
Additional notation p
p(∀v : v /v)
[A]f
A ∨ (f = f ) F G (F ⇒ G)
Af
A ∧ (f = f ) W Ff (A) Af ∨ ¬Enabled Af
U nchanged f f = f
F
¬¬F
SFf (A) Af ∨ ¬Enabled Af
Enabled A is a predicate that is true for a state if and only if it is possible to take a step A starting in that state. The meaning of s0 , s1 , . . .[[A]] is that [[A]] is true for a behaviour if and only if the first pair of states in the behaviour is an A step; s0 , s1 , . . .[[A]] denotes the fact that a behaviour satisfies A if and only if every step of the behaviour is an A step. The formula ♦F asserts that F holds now or eventually in the future. W Ff (A) (weak fairness of A) is satisfied by a behaviour if and only if A ∧ (f = f ) is not enabled for an infinite number of steps, or infinitely many A ∧ (f = f ) steps occur. SFf (A) (strong fairness of A) is satisfied by a behaviour if and only if A ∧ (f = f ) is only enabled for a finite number of steps, or infinitely many A ∧ (f = f ) steps occur. F G states that whenever F is true, G will eventually become true. A program is a temporal logic formula defined by
Init ∧ [N ] ∧ L ,
where
– a state predicate Init specifying the initial state; – an action N specifying the state transitions allowed by the program ; N is the disjunction of the actions which represent the program’s atomic operations; – a temporal formula L specifies the program’s progress condition; the program action N specifies what the program may do (but it does not require it to do anything), while the progress condition L describes what the program eventually must do. Viewed as an assertion about a behaviour σ, the first conjunct in states that Init should hold in the initial state σ0 , the second conjunct states that every step of σ is a stuttering step or a transition allowed by N , and the third conjunct states that σ satisfies the progress condition. A progress condition is usually expressed in terms of fairness conditions for actions. The weakest progress condition which occurs in practice asserts that the program never halts if some step is possible; this condition is expressed by the formula W F (N ).
3 Mutual Mobile Membranes with Objects on Surface
Let be a set of positive integers, and consider a finite alphabet V of symbols. A multiset over V is a mapping u : V → . The empty multiset is represented by λ. We use the string representation of multisets that is widely used in membrane systems community. An example is given by u = aabca, where u(a) = 3, u(b) = 1, u(c) = 1. Using such a representation, the operations over multisets are defined as operations over strings. Given two multisets u, v over V , for any a ∈ V , we have (u v)
142
B. Aman and G. Ciobanu
(a) = u(a) + v(a) as the multiset union, and (u\v)(a) = max{0, u(a) − v(a)} as the multiset difference. For an alphabet V = {a1 , . . . , an }, we denote by V ∗ the set of all strings over V . ∗ V is a monoid with λ as its empty string, and V + = V ∗ \{λ}. For a string u ∈ V ∗ , |u|a denotes the number of occurrences of symbol a in u. The systems of mutual mobile membranes with objects on surface are defined in [3]; here we use a version with rules of endocytosis and exocytosis defined in such a way that the objects on the do not mix up during execution. Definition 1. A system of n mutual mobile membranes with objects on surface is a construct Π = (V, μ, u1 , . . . , un , R), where 1. V = Vendo ∪ Vexo is a finite (non-empty) alphabet of objects corresponding to proteins, where the sets Vendo and Vexo are mutually disjoint; 2. μ is a membrane structure with n ≥ 2 membranes; 3. u1 , . . . , un are multisets of proteins (represented by strings over V ) bounded to the n membranes of μ at the beginning of the computation (one assumes that the membranes in μ have a precise identification, e.g., by means of labels from a set H, or other “names”, in order to have the marking by means of u1 , . . . , un precisely defined; the labels play no other role than specifying this initial marking of the membranes); the skin membrane is labelled with 1 and u1 = λ; 4. R is a finite set of types of rules of the following forms: • [ ]a [ ]a → [[ ]u ]v , for a, a ∈ Vendo , u, v ∈ V ∗ endo An object a ∈ Vendo together with its complementary object a ∈ Vendo model a membrane (the one with a on its surface) entering another membrane (the one with a on its surface). The objects a and a may be modified during this evolution to the multisets u and v, respectively. • [[ ]a ]a → [ ]u [ ]v , for a, a ∈ Vexo , u, v ∈ V ∗ exo An object a ∈ Vexo together with a complementary object a ∈ Vexo model a membrane (the one with a on its surface) exiting another membrane (the one with a on its surface). The objects a and a may be modified during this evolution to the multisets u and v, respectively. A computation is performed in the following way: starting from an initial configuration (membrane structure and multisets of proteins), the evolution takes place by applying the rules in a nondeterministic and maximally parallel manner. A rule is applicable when all the involved objects and membranes appearing in its left hand side are available. In each step a membrane may be used in at most one rule. The maximally parallel way of using the rules means that in each step we apply a maximal multiset of rules, namely a multiset of rules such that no further rule can be added to the multiset. A halting configuration is reached when no rule is applicable.
4 Expressing Mutual Mobile Membrane in TLA A specific feature of membrane systems is that a system Π has a spatial tree-like structure. In this way, the membranes of Π are acted upon by the spatial structure of μ. We
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
143
Table 1. Configurations of Mobile Membranes with Objects on Surface Systems M ultisets Labels
M, N :: = [ ]hu | [M ]hu | M N | u, v :: = λ | a | a | uv h ∈ H
membrane configurations multisets of objects where a, a ∈ V unique identifiers for membranes
denote by M the set of membrane configurations in systems of mutual mobile membranes with objects on surface from Definition 1. The membrane configurations (ranged by M, N, . . .) are defined formally in the Table 1. We abbreviate λu as u. We describe in Table 2 the structural congruence relation ≡ for systems of mutual mobile membranes with objects on surface. The structural congruence relation is a way of rearranging the configurations such that the interacting parts can come closer. Table 2. Structural Congruence of Membranes with Objects on Surface M N ≡N M M (N P ) ≡ (M N ) P M ≡ N implies M P ≡ N P M ≡ N and u ≡ v implies [M ]hu ≡ [N]hv
uv ≡ vu u(vw) ≡ (uv)w λu ≡ u u ≡ v implies uw ≡ vw
The rules of Table 3 describe how the rules of Definition 1 can be applied to membrane configurations such that a maximal multiset of rules is applied in a step of evolution. These rules represent a formal description of the way a computation is performed in membrane systems. Table 3. Reductions of Mobile Membranes with Objects on Surface P → Q implies P R → Q R P → Q implies [P ]hu → [Q]hu P ≡ P and P → Q and Q ≡ Q implies P → Q
Par Mem Struct
We denote by →∗ the reflexive and transitive closure of the binary relation →. In order to write specifications in TLA for systems of mobile membranes, we first have to describe a way in which the systems of mobile membranes can be treated as a program and represented in the M emory of a computer. We denote such a representation by memory, and it consists of a matrix with a number of lines equal with the number of membranes and the number of objects multiplied by the number of objects from V used in the specification of the systems of mobile membranes. The specification is influenced by work presented in [8] where, in order to embed a fragment of mobile ambients into a fragment of π-calculus, the capabilities and ambients are represented by tuples of elements. Following that approach, we represent membranes in the memory of a computer as a tuple (label, “mem”, parent label) where:
144
B. Aman and G. Ciobanu
– label is the (unique) name of the membrane; – “mem” is a tag indicating that the tuple represents a membrane; – parent label is the parent membrane (unique) label (in a tree representation). An object of V is represented in the memory of a computer as a tuple (obj, “obj”, surf ace label, multiplicity, type) where: – obj is the symbol of the object; – “obj” is a tag indicating that this tuple represents an object; – surf ace label indicates the (unique) label of the membrane on which the object is placed; – multiplicity represents the number of objects obj placed on membrane surf ace label; – type indicates either Vendo or Vexo to which the object obj belongs. We have parent membrane = environment for the skin membrane. The idea of the specification is that the tree representation of a membrane coincides with the tree representation derived from a memory representation. Using this common memory representation, we can translate automatically a system of mobile membranes into a M emory using a translation function T : M × H → M emory defined by ⎧ (h, “mem”, parent label)+ ⎪ ⎪ ⎪ ⎪ ⎪ a ∈ V (a, “obj”, h, u(a), Vx )+T (N, h) ⎪ ⎨ if M = [N ]hu and T (M, parent label) = a ∈ Vx , for x ∈ {endo, exo} ⎪ ⎪ ⎪ ⎪ ⎪ T (M1 , parent label)+ T (M2 , parent label) ⎪ ⎩ if M = M1 M2
where – M is a system of mutual mobile membranes with objects on surface; – parent label is the label of the membrane in which M is placed; – + adds a new entry in the mem matrix. We consider a simple example to illustrate how this translation works. For a system Π of three mutual mobile membranes with objects on surface Π = ({a, a, b, b}, [[ ]2 [ ]3 ]1 , ab, ab, a, R). with Vendo = {a, a}, Vexo = {b, b}, we consider the initial configuration M = [[ ]2ab [ ]3a ]1ab . By applying the translation function T for the configuration M having as parent environment, we get memory = T (M , environment) = T ([[ ]2ab [ ]3a ]1ab , environment) = (1, “mem”, environment) + (a, “obj”, 1, 0, Vendo ) + (a, “obj”, 1, 1, Vendo ) + (b, “obj”, 1, 0, Vexo ) + (b, “obj”, 1, 1, Vexo ) + T ([ ]2ab [ ]3a , 1),
where: T ([ ]2ab [ ]3a , 1) = T ([ ]2ab , 1) +T ([ ]3a , 1) = (2, “mem”, 1) + (a, “obj”, 2, 1, Vendo ) + (a, “obj”, 2, 0, Vendo ) + (b, “obj”, 2, 1, Vexo ) + (b, “obj”, 2, 0, Vexo ) + (3, “mem”, 1) + (a, “obj”, 3, 0, Vendo ) + (a, “obj”, 3, 1, Vendo ) + (b, “obj”, 3, 0, Vexo ) + (b, “obj”, 3, 0, Vexo ).
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
145
Let us see how we could simulate the evolution of systems of mobile membranes by using this representation. We use two operations over the memory representation of the configurations, namely “Read”, l which reads a location l, and “W rite”, l, v which sets a location l to v. The memory responds to a read request with “OK”, v, where v is the current value of location l, while it responds to a write request with “OK”. We use Send(v)mem to send a request v to mem and Receive(v)mem to receive a response v from mem. Locs is the set of all possible memory locations, and V al is the set of all memory values. In order to select nondeterministically an object placed on the surface of a membrane, we define ProcAction GetObj(x) ( l∈Locs (Send(“Read”, l[2])memory ; (Receive(memory[l][2])memory ∧ (“obj” = memory[l][2]) ∧ (x = memory[l]) ↑)∗
The procedure above describes the following process: we search the memory until we find a location l where the element l[2] is equal to “obj”, and save this entry in x. The right hand side of a ProcAction statement is an expression combining TLA formed by actions with the following additional operators: ; ⊕ (. . .)∗ ↑ . These additional operators have the following (intuitive) interpretation: A; B – do A, then B; A ⊕ B – do A or B, nondeterministically; v∈S A(v) – do A(v) for some v ∈ S; (A)∗ – keep doing A actions forever, or until the loop is exited; A ↑ – do A, then exit from the innermost containing (. . .)∗ . In a similar manner, we can choose nondeterministically a membrane: ProcAction GetM em(y) ( l∈Locs (Send(“Read”, l[2])memory ; (Receive(memory[l][2])memory ∧ (“mem” = memory[l][2]) ∧ (y = memory[l]) ↑)∗ .
We study two cases in order to describe the evolution for a system of mutual mobile membranes with objects on surface, one for each type of movement: endocytosis and exocytosis. We assume that after using GetObj(x1 ) and GetObj(x2 ) we have two objects selected in the variables x1 and x2 ; similarly, using GetM em(y1 ) and GetM em(y2 ) we have two membranes in the variables y1 and y2 . We represent here the evolution when an endo rule [ ]a [ ]a → [[ ]u ]v is applied. If we consider the configuration: [ ]1au1 [M ]2av1 , then, in one step, we reach the configuration [[ ]1uu1 M ]2vv1 . The conditions which should be satisfied in order to apply an endo rule are: – x1 [1] = “a”, x1 [4] > 0 and x1 [5] = Vendo ; – x2 [1] = “a”, x2 [4] > 0 and x2 [5] = Vendo ; – x1 [3] = y1 [1] (the object x1 is placed on y1 );
146
B. Aman and G. Ciobanu
– x2 [3] = y2 [1] (the object x2 is placed on y2 ); – y1 [3] = y2 [3] (the membranes have the same parent). These can be expressed in TLA as ProcAction Endo(x1 , x2 , y1 , y2 , z1 , z2 ) (GetObj(x1 ) ∧ GetObj(x2 ) ∧ GetM em(y1 ) ∧ GetM em(y2 ) ∧(x1 [1] = “a”) ∧ (x1 [4] > 0) ∧ (x1 [5] = Vendo ) ∧(x2 [1] = “a”) ∧ (x2 [4] > 0) ∧ (x2 [5] = Vendo ) ∧(x1 [3] = y1 [1]) ∧ (x2 [3] = y2 [1]) ∧ (y1 [3] = y2 [3]) ↑)∗ ∧(y 1 [3] = y2 [1]) ∧ (x1 [4] = x1 [4] − 1) ∧ (x2 [4] = x2 [4] − 1) ∧( l∈Locs (Send(“Read”, l[3])memory ; (Receive(memory[l][3])memory ∧ (l[1] = “obj”) ∧((l[3] = y1 [1]) ∨ (l[3] = y2 [1])) ∧ ((l[1] ∈ z1 ) ∨ (l[1] ∈ z2 )) ∧(memory = [memory EXCEP T ![l][4] = l[4] + 1])) We explain here what is the effect of the above procedure: 1. we select nondeterministically two objects (GetObj(x1 ) ∧ GetObj(x2 )), and two membranes (GetM em(y1 ) ∧ GetM em(y2 )); 2. we check if the conditions to apply an endo rule are satisfied, namely (x1 [1] = “a”) ∧ (x1 [4] > 0) ∧ (x1 [5] = Vendo ) ∧ (x2 [1] = “a”) ∧ (x2 [4] > 0) ∧ (x2 [5] = Vendo ) ∧ (x1 [3] = y1 [1]) ∧ (x2 [3] = y2 [1]) ∧ (y1 [3] = y2 [3]); 3. if the step (2) is satisfied, then go to step (4); if not, then go to step (1) and search a new pair of four elements (two objects and two membranes); 4. we read all the memory entries ( l∈Locs ) searching for the entries containing objects placed on membranes y1 and y2 : (l[1] = “obj”) ∧ ((l[3] = y1 [1]) ∨ (l[3] = y2 [1])) such that these objects belong to the multisets z1 and z2 created by the endo rule on the membranes y1 and y2 : ((l[1] ∈ z1 )∨(l[1] ∈ z2 )). If we find such entries, then we change the multiplicity of these objects (l[4] = l[4] + 1). The rest of the memory remains the same (memory = [memory EXCEP T ![l][4] = l[4] + 1]). We use a TLA notation in which [x EXCEP T ![i] = u] is the array x that is the same as x except x [i] = u. Based on this description, we can prove the following result. Proposition 1. If memory = T (M, . . .) and it evolves into memory after executing Endo(. . .), then there exists a membrane configuration N corresponding to memory such that M → N . We illustrate this result with an example in Section 5. We represent now the evolution when an exo rule [[ ]a ]a → [ ]u [ ]v is applied. If we consider the configuration: [[ ]1au1 M ]2av1 , then we reach in one step the configuration [ ]1uu1 [M ]2vv1 .
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
147
The conditions which should be satisfied in order to apply an exo rule are: – – – – –
x1 [1] = “a”, x1 [4] > 0 and x1 [5] = Vexo ; x2 [1] = “a”, x2 [4] > 0 and x2 [5] = Vexo ; x1 [3] = y1 [1] (the object x1 is placed on y1 ); x2 [3] = y2 [1] (the object x2 is placed on y2 ); y1 [3] = y2 [1] (the membranes 1 is placed inside membrane 2).
These can be specified in TLA as ProcAction Exo(x1 , x2 , y1 , y2 , z1 , z2 ) (GetObj(x1 ) ∧ GetObj(x2 ) ∧ GetM em(y1 ) ∧ GetM em(y2 ) ∧(x1 [1] = “a”) ∧ (x1 [4] > 0) ∧ (x1 [5] = Vexo ) ∧(x2 [1] = “a”) ∧ (x2 [4] > 0) ∧ (x2 [5] = Vexo ) ∧(x1 [3] = y1 [1]) ∧ (x2 [3] = y2 [1]) ∧ (y1 [3] = y2 [1]) ↑)∗ ∧(y 1 [3] = y2 [1]) ∧ (x1 [4] = x1 [4] − 1) ∧ (x2 [4] = x2 [4] − 1) ∧( l∈Locs (Send(“Read”, l[3])memory ; (Receive(memory[l][3])memory ∧ (l[1] = “obj”) ∧((l[3] = y1 [1]) ∨ (l[3] = y2 [1])) ∧ ((l[1] ∈ z1 ) ∨ (l[1] ∈ z2 )) ∧(memory = [memory EXCEP T ![l][4] = l[4] + 1])) Based on this evolution, we can prove the following result. Proposition 2. If memory = T (M, . . .) and memory evolves into memory after executing Exo(. . .), then there exists a membrane configuration N corresponding to memory such that M → N . After defining the operations Endo(x1 , x2 , y1 , y2 , z1 , z2 ) and Exo(x1 , x2 , y1 , y2 , z1 , z2 ) which simulates the application of endo and exo rules in systems of mobile membranes, we could define the specification for any system of mobile membranes as follows: Init memory ; N Endo(x1 , x2 , y1 , y2 , z1 , z2 ) ∨ Exo(x1 , x2 , y1 , y2 , z1 , z2 ) L W F (Endo(x1 , x2 , y1 , y2 , z1 , z2 )) ∧ W F (Exo(x1 , x2 , y1 , y2 , z1 , z2 )) where – Init represents the initial configuration of the memory; – N specifies the possible operations corresponding to endo and exo rules; – L represents a temporal formula describing the weak fairness condition for each rule. Init ∧ [N ] ∧ L represents a uniform description of the systems of mobile membranes. Executing starting from a membrane configuration M which is translated into memory, we reach a memory configuration which corresponds to a membrane configuration N such that M →∗ N . Theorem 1. If memory = T (M, . . .) and memory evolves into memory after ex- ecuting , then there exists a membrane configuration N corresponding to memory such that M →∗ N .
148
B. Aman and G. Ciobanu
5 Example We consider the membrane configuration [ ]2ab [[ ]4a ]3a b of a system of mutual mobile membranes with objects on surface which evolves after applying twice the rule [ ]a [ ]a → [[ ]a ]b to a membrane configuration [[[ ]2a3 b ]4b ]3b b . This means that in memory we have a number of corresponding changes. The evolution and these changes can be expressed by the next module written in TLA+, where for an object a we use oa when representing it in memory. MODULE SimpleEx EXTENDS Naturals, TLC, Sequences
The configuration of the membrane system is kept in the variable memory. VARIABLES memory
Initially the variable memory contains the initial configuration of the membrane system, namely [ ]2ab [[ ]4a ]3a b . Init == memory \in { “2”, “mem”, “1”, “a”, “obj”, “2”, 1, “V endo”, “oa”, “obj”, “2”, 0, “V endo”, “b”, “obj”, “2”, 1, “V exo”, “ob”, “obj”, “2”, 0, “V exo”, “3”, “mem”, “1”, “a”, “obj”, “3”, 0, “V endo”, “oa”, “obj”, “3”, 1, “V endo”, “b”, “obj”, “3”, 0, “V exo”, “ob”, “obj”, “3”, 1, “V exo”, “4”, “mem”, “3”, “a”, “obj”, “3”, 0, “V endo”, “oa”, “obj”, “3”, 1, “V endo”, “b”, “obj”, “3”, 0, “V exo”, “ob”, “obj”, “3”, 0, “V exo” }
In order to apply the rule [ ]a [ ]a → [[ ]a ]b the conditions for performing an endo step should be verified as described before Proposition 1. EndoTest(x1,x2,y1,y2,z1,z2) == Init /\ x1 \in 1..15 /\ x2 \in 1..15 /\ y1 \in 1..15 /\ y2 \in 1..15 /\ z1 \in 1..15 /\ z2 \in 1..15 /\ memory [x1][2]=“obj” /\ memory [x2][2]=“obj” /\ memory [y1][2]=“mem” /\ memory [y2][2]=“mem” /\ memory [x1][1]=“a” /\ memory [x1][4]>0 /\ memory [x1][5]=“Vendo” /\ memory [x2][1]=“oa” /\ memory [x2][4]>0 /\ memory [x2][5]=“Vendo” /\ memory [x1][3]=memory [y1][1] /\ memory [x2][3]=memory [y2][1] /\ memory [y1][3]=memory [y2][3] /\ memory [z1][1]=“a” /\ memory [z1][3]=memory [y1][1] /\ memory [z2][1]=“b” /\ memory [z2][3]=memory [y2][1]
If the above preconditions are satisfied for some objects and membranes, then the endo rule is simulated and the memory rewritten. If x1 and z1 are the same then the memory in this entry remains unchanged since the object consumed is created again. The same reasoning for x2 and z2. EndoNext == /\ \E x1 \in 1..11, x2 \in 1..11, y1 \in 1..11, y2 \in 1..11, z1 \in 1..11, z2 \in 1..11: EndoTest(x1,x2,y1,y2,z1,z2) /\ IF (x1=z1) THEN memory’ = [memory EXCEPT ![y1]=[@ EXCEPT ![3]=memory[y2][1]], ![x2]=[@ EXCEPT ![4]= memory[x2][4]-1],
A Temporal Logic for Mutual Mobile Membranes with Objects on Surface
149
![z2]=[@ EXCEPT ![4]= memory[z2][4]+1]] ELSE IF (x2=z2) THEN memory’ = [memory EXCEPT ![y1]=[@ EXCEPT ![3]=memory[y2][1]], ![x1]=[@ EXCEPT ![4]= memory[x1][4]-1], ![z1]=[@ EXCEPT ![4]= memory[z1][4]+1]] ELSE memory’ = [memory EXCEPT ![y1]=[@ EXCEPT ![3]=memory[y2][1]], ![x1]=[@ EXCEPT ![4]= memory[x1][4]-1], ![x2]=[@ EXCEPT ![4]= memory[x2][4]-1], ![z1]=[@ EXCEPT ![4]= memory[z1][4]+1], ![z2]=[@ EXCEPT ![4]= memory[z2][4]+1]] Endo == Init /\ [][EndoNext]_memory /\ WF_memory(EndoNext)
We test if sometime in the future the membrane labelled 2 is inside the membrane labelled 4. Test == (memory[1][3] = memory[11][1]) THEOREM Endo => Test
The execution generates three states corresponding to the three membrane configurations reached during execution, namely [ ]2ab [[ ]4a ]3a b , [[ ]2ab [ ]4a ]3b b , [[[ ]2ab ]4b ]3b b . This means that the execution outputs all reachable states and checks if membrane 2 ever enters membrane 4 by checking if the parent of membrane 2 is ever going to be membrane 4 (memory[1][3] = memory[11][1]).
6 Conclusion In this paper we use the temporal logic of actions as a formal basis to specify the behaviour of systems of mutual mobile membranes with objects on their surfaces. TLA is well suited to specify and reason about distributed, parallel and nondeterministic systems. TLA possesses a language called TLA+ able to specify the behaviour of very complex systems, to analyze these systems, and to verify several properties. In previous work [9,10,11] we have used rewriting logic to write specification for membrane systems using Maude. Maude is used mainly for specifying and validating (sequential) rewriting systems. We have used Maude model-checker to verify some properties expressed in linear temporal logic [9]. Here we use temporal logic of actions, a more complex temporal logic that combines features of both linear temporal logic and logic of actions. Being interested in providing verification based on existing software tools, we use TLA and TLA+ to specify and verify systems of mutual mobile membranes with objects on their surfaces. The results represent an encouraging step towards a software verification of mobile membranes with objects on their surfaces and of the biological systems described by using systems of mobile membranes. As related work we can mention [12] where it is introduced a spatio-temporal logic called MTLA whose temporal part is based on TLA. In addition to the temporal operators, some spatial modalities are used to describe the structure of the system and its modifications. Despite the fact that we were attracted by such an approach (from a
150
B. Aman and G. Ciobanu
theoretical point of view), we do not use MTLA since the existing TLA tools were not extended to incorporate this spatial extension of TLA.
Acknowledgements This work was partially supported by CNCSIS projects IDEI 402/2007 and POSDRU/89/1.5/S/49944.
References 1. P˘aun, G.: Membrane Computing. An Introduction. Springer, Berlin (2002) 2. Ciobanu, G., P˘aun, G., P´erez-Jim´enez, M. (eds.): Application of Membrane Computing. Springer, Heidelberg (2006) 3. Aman, B., Ciobanu, G.: Membrane systems with surface objects. In: Proc. of the International Workshop on Computing with Biomolecules (CBM), Wien, Austria, pp. 17–29 (2008) 4. Aman, B., Ciobanu, G.: Formalizing the Behavior of Biological Processes with Mobility. In: Calude, C.S., Hagiya, M., Morita, K., Rozenberg, G., Timmis, J. (eds.) Unconventional Computation. LNCS, vol. 6079, pp. 187–187. Springer, Heidelberg (2010) 5. Aman, B., Ciobanu, G.: On the Reachability Problem in P Systems with Mobile Membranes. In: Eleftherakis, G., Kefalas, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2007. LNCS, vol. 4860, pp. 113–123. Springer, Heidelberg (2007) 6. Lamport, L.: The Temporal Logic of Actions. ACM Transactions on Programming Languages and Systems 16, 872–923 (1994) 7. Alpern, B., Schneider, F.: Recognizing safety and liveness. Computing Science Technical Report TR86-727, Department of Computer Science, Cornell University (1986) 8. Ciobanu, G., Zakharov, V.A.: Encoding Mobile Ambients into the π-Calculus. In: Virbitskaite, I., Voronkov, A. (eds.) PSI 2006. LNCS, vol. 4378, pp. 148–165. Springer, Heidelberg (2007) 9. Andrei, O., Ciobanu, G., Lucanu, D.: Executable Specifications of P Systems. In: Mauri, G., P˘aun, G., Jes´us P´erez-J´ımenez, M., Rozenberg, G., Salomaa, A. (eds.) WMC 2004. LNCS, vol. 3365, pp. 126–145. Springer, Heidelberg (2005) 10. Andrei, O., Ciobanu, G., Lucanu, D.: Operational Semantics and Rewriting Logic in Membrane Computing. Electronic Notes of Theoretical Computer Science 156, 57–78 (2006) 11. Andrei, O., Ciobanu, G., Lucanu, D.: A Rewriting Logic Framework for Operational Semantics of Membrane Systems. Theoretical Computer Science 373, 163–181 (2007) 12. Zappe, J.: Towards a Mobile Temporal Logic of Actions. PhD thesis, Ludwig-MaximiliansUniversit¨at M¨unchen, Munich, Germany (September 2005)
Computing the Maximum Bisimulation with Spiking Neural P Systems Rodica Ceterchi1 and Alexandru I. Tomescu1,2 1 2
Faculty of Mathematics and Computer Science, University of Bucharest, Str. Academiei, 14, 010014 Bucharest, Romania Dipartimento di Matematica e Informatica, Universit`a di Udine, Via delle Scienze, 206, 33100 Udine, Italy [email protected], [email protected]
Abstract. We use spiking neural P systems to produce in linear time a partition of the nodes of a graph, which is coarser than the maximum bisimulation.
1 Introduction The notion of bisimulation plays an important role in many fields, among which we mention Modal Logic [1], Concurrency Theory, [2], Set Theory [3], Formal Verification [4]. Given a set V and a relation E over V , the problem of computing the maximum bisimulation on V is the same as determining the coarsest partition of V , stable w.r.t. E (see, e.g., [5]). Moreover, the problem of minimizing the number of states in a deterministic finite automaton is equivalent to that of finding the coarsest partition of a set stable w.r.t. a finite set of functions. Ever since Hopcroft’s [6] celebrated O(|V | log |V |) algorithm for this latter problem, the quest for efficient partition refinement methods has inspired much research in algorithmics. When, in particular, the input to the coarsest partition problem consists of a single function, Paige and Tarjan [7] showed that it can be solved in time O(|V |). They later [8] solved the problem for the general case, with an algorithm that runs in time O(|E| log |V |). Recently, [9] put forth an efficient algorithm that achieves a complexity of O(|E|) when the relation E is well-founded (i.e., when the graph G = (V, E) is acyclic). As opposed to the so-called ‘negative strategy’ of Hopcroft’s method, in which the starting partition consists of the entire input set which subsequently gets refined, the algorithm of Dovier, Piazza and Policriti uses a ‘positive strategy’, by starting from a partition on V by the set-theoretic notion of rank, computed in time O(|E|). This partition, coarser than the maximum bisimulation, is subsequently refined, employing [7,8] as subroutines, until it becomes stable. Among other recent algorithmic advances for this problem, we mention the parallel algorithm of [10] that runs in time O(|V | log |V |) using |E|/|V | CREW PRAM processors. Also, in the case of a graph which changes frequently, [11] proposed an algorithm for quickly updating the maximum bisimulation, instead of re-computing it from scratch. J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 151–157, 2011. c Springer-Verlag Berlin Heidelberg 2011
152
R. Ceterchi and A.I. Tomescu
During the last decade, P systems have emerged as bio-inspired models of computation, which allow to solve in polynomial time many NP-complete problems (see, e.g., [12]). P systems were also employed to simulate Boolean circuits [13,14], parallel architectures [15], the parallel bitonic sorting algorithm [16], or, more generally, sorting networks [17]. We will show in this paper how to employ a spiking neural P system [18] to compute, in time O(|V |), an over-approximation of the maximum bisimulation on a graph G = (V, E). This partition of V is finer than the initial rank-based partition of [9], and can replace it in a ‘positive’ method such as the one proposed in [9].
2 Preliminaries We briefly revisit here the notion of bisimulation and its connection with the coarsest partition problem, and present the formal definition of a spiking neural P system. Definition 1. Given a directed graph G = (V, E), a bisimulation on G is a relation ⊆ V × V such that for all u v, it holds that (i) ∀u ∈ V such that (u, u ) ∈ E, ∃v ∈ V such that (v, v ) ∈ E and u v ; (ii) ∀v ∈ V such that (v, v ) ∈ E, ∃u ∈ V such that (u, u ) ∈ E and u v . We note that the maximum bisimulation on G always exists, is unique, and is an equivalence relation on V ; we will denote it as ∼G . If u ∼G v, we will say that u, v ∈ V are bisimilar. Note that, in particular, any two sinks of G are bisimilar. Moreover, we will henceforth assume that there exists a node of G which is a sink, since otherwise it is easy to check that all nodes are bisimilar to one another, i.e., ∼G = V × V . Definition 2. Given a graph G = (V, E), let E −1 stand for the inverse of E, and let P be a partition of V . We say that P is stable w.r.t. E if for each pair B1 , B2 ∈ P , either B1 ⊆ E −1 (B2 ) or B1 ∩ E −1 (B2 ) = ∅. Definition 3. We say that a partition P refines a partition Q if each class of P is contained in a class of Q; conversely, Q is said to be coarser than P . As mentioned in Section 1, the problem of determining the maximum bisimulation on G = (V, E) is equivalent to the problem of finding the coarsest partition of V stable w.r.t. E. For a proof of this fact, see, for instance, [5]. The algorithm of [9] computes, in time O(|E|), a function rank : V → N, which, in the case of an acyclic graph, represents simply the length of the longest simple path from every node to one of the sinks of G. This function has the property that whenever u ∼G v, it holds that rank(u) = rank(v) (but the converse does not hold). It then takes {v ∈ V | rank(v) = i} : i ∈ N as the initial partition, coarser than ∼G , to be later refined. In what follows, we show how to compute, by means of a spiking neural P system [18] and in time O(|V |), a similar function, which we call trace, with the property that
Computing the Maximum Bisimulation with Spiking Neural P Systems
153
it induces an initial partition on V , coarser than ∼G . This partition is finer than the one by rank, but not yet stable, so it is used as input for the algorithm of Paige and Tarjan [8]. A spiking neural P system1 is a tuple Π = (O, σ0 , . . . , σm−1 , syn, out) where: 1. O = {a} is the singleton alphabet (a is called a spike); 2. σ0 , . . . , σm−1 are neurons, of the form σi = (ni , Ri ), 0 i m − 1, where: (a) ni 0 is the initial number of spikes contained by σi ; (b) Ri is a finite set of rules, of the following two forms: (1) E/ac → ap ; d, where c, p 1, d 0, and E is a regular expression over O; (2) as → λ, for some s 1, with the restriction that as ∈ / L(E), for all rules of type (1) from Ri ; 3. syn ⊆ {0, . . . , m − 1} × {0, . . . , m − 1}, for all 1 i m; a pair (i, j) ∈ syn is called a synapse; 4. the set out ⊆ {0, . . . , m − 1} indicates the output neurons. The rules of type (1) are (extended) firing rules, while those of type (2) are forgetting rules. The first ones are applied as follows: if a neuron σi contains l spikes, al ∈ L(E) and l c, then the rule E/ac → ap ; d ∈ Ri can be applied, removing c spikes from σi . If d = 0, p spikes are emitted immediately and go to all neurons σj such that (i, j) ∈ syn. Otherwise, if the rule is used in time instant k, then in steps k, k + 1, . . . , k + d − 1 the neuron is closed so that it cannot receive new spikes, and cannot apply new rules. At time k + d the neuron fires the p spikes, and becomes open again. A global clock is assumed, marking the time for the whole system, hence the functioning of the system is synchronized. The forgetting rules are applied as follows: if the neuron contains exactly s spikes, then the rule as → λ can be used, and this means that all s spikes are removed from the neuron. In each time unit, in each neuron which can use a rule we have to use a rule, either a firing or a forgetting one. Because two firing rules E1 /ac1 → ap1 ; d1 and E2 /ac2 → ap2 ; d2 can have L(E1 ) ∩ L(E2 ) = ∅, it is possible that two or more rules can be applied in a neuron, and then one of them is chosen non-deterministically. Note however that we cannot interchange a firing rule with a forgetting rule. We will omit explicitly mentioning E when L(E) = O∗ . The initial configuration of the system is described by n0 , . . . , nm−1 . Starting from the initial configuration and applying the rules, we can define transitions among configurations. Any sequence of transitions starting in the initial configuration is called a computation. A computation halts if it reaches a configuration where no rule can be used. 1
We have adopted here the formalism of extended spiking neural P systems discussed in [19], with the slight modification that we allow the presence of synapses of the form (i, i), 0 i m − 1.
154
R. Ceterchi and A.I. Tomescu
3 A Spiking Neural P System for Computing an Initial Partition of the Nodes Given a graph G = (V = {v0 , . . . , vn−1 }, E) as input to the maximum bisimulation problem, we will construct the following spiking neural P system, ΠG : – to each node vi ∈ V , we associate a neuron σi with • Ri = ac /ac → a; 0 | c ∈ {1, . . . , n} , for all i ∈ {0, . . . , n − 1}; • if vi is a sink in G, then we put ni = 1, otherwise, ni = 0; – to each arc (vi , vj ) ∈ E, we put a synapse (j, i). At time instant 0, only the neurons corresponding to sinks of G contain spikes; at each time instant, each neuron σi consumes all its spikes (at most n) and immediately sends one spike to its neighbors, by applying exactly one rule of Ri . The system ΠG is left functioning for n time instants. Let trace : V → {0, 1}n be a function having as range the set of all strings of length n over {0, 1}. We will denote by tracek (v) the k-th binary character of trace(v). Given the system ΠG , we define, for all 0 k, i n − 1, tracek (vi ) =
1 0
if neuron σi contains at least one spike at time instant k, otherwise.
It is easy to see that, actually, tracek (v) = 1 iff there exists in G a directed path (not necessarily simple) of length k from v to one of the sinks of G. Lemma 1. Given a graph G = (V, E), and the function trace : V → {0, 1}n defined as above, if u ∼G v then trace(u) = trace(v). Proof. Suppose that the set X = {(u, v) ∈∼G | trace(u) = trace(v)} is not empty. Given a pair (u, v) ∈ X we let π(u, v) = min{k : 0 k n − 1 | tracek (u) = tracek (v)}. Consider now a pair (u∗ , v∗ ) ∈ X with π(u∗ , v∗ ) = j 0 minimum and assume without loss of generality that 1 = tracej (u∗ ) = tracej (v∗ ) = 0. First note that j > 0, since at time instant 0 all neurons corresponding to sinks of G contain spikes, while all other neurons do not contain spikes. Note thus that u∗ is not a sink, since all sinks w of G have tracek (w) = 0, for all k > 0. Therefore, there exists an u∗ ∈ V with (u∗ , u∗ ) ∈ E and such that tracej−1 (u∗ ) = 1 (i.e., u∗ is one of the culprits for the fact that the neuron corresponding to u∗ has a spike at time instant j). Since u∗ and v∗ are bisimilar, there exists a v∗ ∈ V such that (v∗ , v∗ ) ∈ E and u∗ ∼G v∗ . From the minimality of j, we have that tracej−1 (u∗ ) = tracej−1 (v∗ ), and hence tracej−1 (v∗ ) = 1. This contradicts the fact that tracej (v∗ ) = 0, because according to the functioning of ΠG , at time instant j the neuron corresponding to v∗ sends a spike to the neuron corresponding to v∗ .
Computing the Maximum Bisimulation with Spiking Neural P Systems
155
Corollary 1. Given a graph G = (V, E) and starting with the partition {v ∈ V | trace(v) = w} : w ∈ {0, 1}n , the ‘positive’ strategy of subsequently refining this partition by means of [7,8] correctly computes the maximum bisimulation on G. In Figure 1 we give an example of a graph and its trace function. The example in Figure 2 shows that the converse of Lemma 1 does not hold. b
c
b
c
a
d
time instant trace(a) trace(b) trace(b ) trace(c) trace(c ) trace(d)
0 1 0 0 0 0 0
1 0 1 1 0 0 0
2 0 0 0 1 1 0
3 0 1 1 0 0 0
4 0 0 0 1 1 0
5 0 1 1 0 0 0
Fig. 1. A graph G with ∼G = {{a}, {d}, {b, b }, {c, c }} and the computation of its trace function; note that trace(b) = trace(b ) and that trace(c) = trace(c )
f
e
d
a
b
c
time instant trace(a) trace(b) trace(c) trace(d) trace(e) trace(f )
0 1 0 0 0 0 0
1 0 1 0 1 0 0
2 0 0 1 1 1 1
3 0 0 0 0 1 1
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Fig. 2. A graph without distinct bisimilar nodes; we have trace(e) = trace(f ), but e G f
We describe now how to encode the function trace inside the spiking neural P system. Since trace(vi ) can be seen as the binary representation of a number ti , we will employ a spiking neural P system introduced in [19] in order to convert ti into unary, inside a neuron σiout (i.e., after n + 1 steps of the computation, neuron σiout will contain ti spikes). Consider thus the spiking neural P system depicted in Figure 3, where rules are applied in a maximally parallel way. We assume that the integer t 0 is fed to neuron σi0 during n consecutive time steps, in the following way: the presence of a spike at a moment 0 k < n stands for a 1 on the k-th position in the binary representation of t, while the absence of a spike stands for a 0. Moreover, at time instance 0, neuron sti contains a spike, which is sent to neuron σiout . Here, at time instance 1, the rule a → a; n − 1 is applied, closing neuron σiout for the next n − 1 steps, so that it does not receive intermediate values which are being computed in the neurons σij , 0 j n−1. At time instance n, neuron σiout will contain t spikes (see [19] for further details).
156
R. Ceterchi and A.I. Tomescu σi0 input spikes
a → a2 ; 0
a → a2 ; 0 sti
a a → a; 0
σin−1
σi1
a → a2 ; 0
σiout
a → a; n − 1
εi
Fig. 3. A spiking neural P system for converting a binary encoded positive integer into unary
We can enrich ΠG with a copy of this system for each neuron σi , such that each σi has a synapse towards neuron σi0 of each such module. In this extended system, out the output neurons are now σ0out , . . . , σn−1 . Since actually neurons σi0 start receiving spikes at time instant 1 (instead of 0, as assumed above), we have to increase the time neurons σiout stay closed, by setting the delay of their firing rule to n. Note that if a neuron σi contains a spike at time instant k, neuron σi0 will contain a spike only at time instant k + 1. Consequently, only at time instant n + 1 neuron σiout contains ti spikes, where ti is the number having trace(vi ) as its binary representation, for all 0 i < n.
4 Conclusions We have designed a very simple spiking neural P system for every input graph, by means of which we compute an auxiliary function, trace, which assigns to each node a binary sequence. We have shown that the partition induced on the nodes of the graph by the function trace is coarser than the maximum bisimulation on the given graph. This means that our method can be used as a pre-processing step in computing the maximum bisimulation using Paige and Tarjan’s algorithm [8]. This pre-processing step takes O(|V |) time. The function trace can be used to prove other properties of the initial graph. For instance, the existence of a directed path of length k between a node u and a sink can be determined by inspecting column k and line u in the table of traces. Furthermore, we have shown how to use a spiking neural P system devised in [19], to encode in unary the values of trace.
References 1. van Benthem, J.: Model correspondence theory. PhD thesis, Universiteit van Amsterdam, Instituut voor Logica en Grondslagenonderzo ek van Exacte Wetenschappen (1976) 2. Milner, R.: Operational and Algebraic Semantics of Concurrent Processes. In: Handbook of Theoretical Computer Science, vol. B, Formal Models and Sematics (B), pp. 1201–1242 (1990) 3. Aczel, P.: Non-Well-Founded Sets. CSLI Lecture Notes, vol. 14. CSLI, Stanford (1988) 4. Clarke, E., Grumberg, O., Peled, D.: Model Checking. The MIT Press, Cambridge (1999) 5. Kanellakis, P.C., Smolka, S.A.: CCS expressions, finite state processes, and three problems of equivalence. Information and Computation 86(1), 43–68 (1990)
Computing the Maximum Bisimulation with Spiking Neural P Systems
157
6. Hopcroft, J.E.: An n log n algorithm for minimizing states in a finite automaton. In: Kohavi, Z., Paz, A. (eds.) Theory of Machines and Computations, pp. 189–196. Academic Press, New York (1971) 7. Paige, R., Tarjan, R.E., Bonic, R.: A linear time solution to the single function coarsest partition problem. Theoretic. Comput. Sci. 40, 67–84 (1985) 8. Paige, R., Tarjan, R.E.: Three partition refinement algorithms. SIAM J. Comput. 16(6), 973– 989 (1987) 9. Dovier, A., Piazza, C., Policriti, A.: An efficient algorithm for computing bisimulation equivalence. Theor. Comput. Sci. 311(1-3), 221–256 (2004) 10. Rajasekaran, S., Lee, I.: Parallel Algorithms for Relational Coarsest Partition Problems. IEEE Trans. Parallel Distrib. Syst. 9(7), 687–699 (1998) 11. Saha, D.: An Incremental Bisimulation Algorithm. In: Arvind, V., Prasad, S. (eds.) FSTTCS 2007. LNCS, vol. 4855, pp. 204–215. Springer, Heidelberg (2007) 12. The P Systems Webpage, http://ppage.psystems.eu/ 13. Ceterchi, R., Sburlan, D.: Simulating boolean circuits with P systems. In: Mart´ın-Vide, C., Mauri, G., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2003. LNCS, vol. 2933, pp. 104–122. Springer, Heidelberg (2004) 14. Ionescu, M., Sburlan, D.: Some applications of spiking neural P systems. Computing and Informatics 27(3+), 515–528 (2008) 15. Ceterchi, R., P´erez-Jim´enez, M.J.: On simulating a class of parallel architectures. Int. J. Found. Comput. Sci. 17(1), 91–110 (2006) 16. Ceterchi, R., P´erez-Jim´enez, M.J., Tomescu, A.I.: Simulating the bitonic sort using P systems. In: Eleftherakis, G., Kefalas, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2007. LNCS, vol. 4860, pp. 172–192. Springer, Heidelberg (2007) 17. Ceterchi, R., Tomescu, A.I.: Implementing Sorting Networks with Spiking Neural P Systems. Fundam. Inform. 87(1), 35–48 (2008) 18. Ionescu, M., P˘aun, G., Yokomori, T.: Spiking Neural P Systems. Fundam. Inform. 71(2-3), 279–308 (2006) 19. Leporati, A., Zandron, C., Ferretti, C., Mauri, G.: Solving numerical NP-complete problems with spiking neural P systems. In: Eleftherakis, G., Kefalas, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2007. LNCS, vol. 4860, pp. 336–352. Springer, Heidelberg (2007)
P Colonies and Their Extensions Ludˇek Cienciala and Lucie Ciencialov´a Institute of Computer Science, Silesian Univerzity in Opava, Bezruˇcovo n´amˇest´ı 13, 746 01 Opava [email protected]
Abstract. P colonies are one of the variants of computational devices based on independent membrane agents, which are evolved and acting in a shared environment. P colonies belong to the family of models of membrane computing called P systems. We show that P colonies with capacity three and two agents using homogeneous programs without checking rules are computationally complete as well as eco-P colonies with two agents and a passive environment and PCol automata working in init mode.
1 Introduction P colonies were introduced in the paper [11] as formal models of a computing device inspired by membrane systems and formal grammars called colonies. This model is inspired by structure and functioning of a community of living organisms in a shared environment. The independent organisms living in a P colony are called agents or cells. Each agent is represented by a collection of objects embedded in a membrane. The number of objects inside each agent is the same and constant during computation. The environment contains several copies of the basic environmental object denoted by e. The number of the copies of e in the environment is sufficient. With each agent is associated a set of programs. The program determines the activity of the agent. The program is very simple and depends on content of the agent and on multiset of objects placed in the environment. Agent can change content of the environment by programs and through the environment agent can affect the behavior of other agents. This influence between agents is a key factor in functioning of P colony. In every moment each object inside the agent is affected by executing the program. For more information about P systems see [14] or [15].
2 Preliminaries The reader is assumed to be familiar with the basics of language theory. We use N RE to denote the family of the recursively enumerable sets of natural numbers. Let Σ be an alphabet. Let Σ ∗ be a set of all words over Σ (including the empty
This work has been supported partially by the Grant Agency of Czech Republic grants No. 201/06/0567, SGS/5/2010 and SGS/4/2010.
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 158–169, 2011. c Springer-Verlag Berlin Heidelberg 2011
P Colonies and Their Extensions
159
word ε). We denote the length of the word w ∈ Σ ∗ by |w| and the number of occurrences of the symbol a ∈ Σ in w by |w|a . A multiset of objects M is a pair M (V, f ), where V is an arbitrary (not necessarily finite) set of objects and f is a mapping f : V → N ; f assigns to each object in V its multiplicity in M . The set of all multisets with the set of objects V is denoted by V ◦ . The set V is called the support of M and it is denoted by supp(M ) if for all x ∈ V f (x) = 0. The cardinality of M , denoted by card(M ), is defined by card(M ) = a∈V f (a). Any multiset of objects M with the set of objects V = {ai , . . . an } can be represented as a string w over alphabet V with |w|ai = f (ai ); 1 ≤ i ≤ n. Obviously, all words obtained from w by permuting the letters can also represent M , and ε represents the empty multiset. A register machine[13] is the construct M = (m, H, l0 , lh , P ) where m is a number of registers, H is a set of instruction labels, l0 is an initial/start label, lh is the final label, P is a finite set of instructions injectively labeled with the elements from the given set H. The instructions of the register machine are of the following forms: l1 :
(ADD(r), l2 , l3 ) Add 1 to the contents of the register r and proceed to the instruction (labeled with) l2 or l3 .
l1 :
(SU B(r), l2 , l3 ) If the register r is not empty, then subtract 1 from its contents and go to instruction l2 , otherwise proceed to instruction l3 .
lh :
HALT Stop the machine. The final label lh is only assigned to this instruction.
We use N RM to denote the family of sets of natural numbers computed by register machines. In [13] it is shown that N RM = N RE.
3 P Colonies — Basic Model We recall definition of P colony. Definition 1. The P colony of the capacity k is a construct Π = (A, e, f, VE , B1 , . . . , Bn ), where – – – – –
A is an alphabet of the colony, its elements are called objects, e ∈ A is the basic (environmental) object of the colony, f ∈ A is the final object of the colony, VE is multiset over A − {e}, it is the initial content of the environment, Bi , 1 ≤ i ≤ n, are agents, each agent is a construct Bi = (Oi , Pi ), where • Oi is a multiset over A, it determines the initial state (content) of the agent, |Oi | = k, • Pi = {pi,1 , . . . , pi,ki } is a finite set of programs, where each program contains exactly k rules, which are in one of the following forms: ∗ a → b, these rules are called evolution rules, ∗ c ↔ d, these rules are called communication rules, ∗ c ↔ d/c ↔ d , which are called checking rules.
160
L. Cienciala and L. Ciencialov´a
Programs. With each agent is associated its own set of programs. There are two kinds of rules in programs. The first type called evolution is in the form a → b. It means that object a inside of agent is rewritten (evolved) to object b. The second type of rules can be called communication and the rules are in the form c ↔ d. When this rule is performed, the object c inside and the object d outside of the agent change their places, so d is now inside and c is outside of the agent. The ability of agents is extended by checking programs in [11]. They give the opportunity to the agents to opt between two possibilities. These rules are in the form c ↔ d/c ↔ d . If the checking rule is performed, then the communication rule c ↔ d has higher priority to be executed than the rule c ↔ d . It means that the agent checks the possibility of using the rule c ↔ d (it tries to find object c inside of itself and the object d in the environment). If this rule can be executed, the agent must use it. If the first rule cannot be applied, then the agent uses the second one c ↔ d . Homogeneous programs. are programs formed from rules of one kind. So what we obtain is special types of programs. We can call them evolution, communication or checking programs if they consist from evolution, communication or checking rules. What we can do more is to simplify notation of such programs. For example for a1 → b1 , . . . ak → bk , where k is capacity of P colony, we can write a1 . . . ak → b1 . . . bk . Configuration. Formally, the configuration of P colony Π is (n+1)-tuple (w1 , . . . , wn , wE ), where |wi | = k, 1 ≤ i ≤ n, wi represents all the objects placed inside the i-th agent and wE ∈ (A − {e})∗ represents all the objects in the environment different from e. An initial configuration of the P colony is (n + 1)–tuple of strings of objects present in the P colony at the beginning of the computation, it is given by Oi for 1 ≤ i ≤ n and VE . Computation. There are three different ways of defining beginning of computation. (1) At the beginning of computation the environment and all agents contain only copies of object e. (2) All agents can contain various objects at the beginning of computation — the agents are in different initial states. (3) The initial state of the environment is nonempty — the environment contains initial “parameters” for future computation. There are two different ways in which the computation can be done: in a parallel and in a sequential way. At each step of the parallel computation each agent tries to find one program to use. If the number of applicable programs is higher than one, the agent nondeterministically chooses one of them. At one step of computation the maximal number of agents works. If the P colony computes in sequential way only one agent can use its program. By using the programs P colony goes from one configuration to another. The sequence of configurations makes up a computation. The computation ends in halting configuration when no agent can accomplish any of its program. With a halting computation we can associate a result of the computation. It is the number of copies of the special symbol f present in the environment at the end of computation. The set of numbers computed by the P colony Π we denote by N (Π).
P Colonies and Their Extensions
161
Consider P colony Π = (A, e, f, VE , B1 , . . . , Bn ). The maximal number of programs associated with the agents in P colony Π is called the height of P colony Π. The degree of P colony Π is the number of agents in P colony. The third parameter characterizing P colony is the capacity of P colony Π; it is describing the number of the objects inside each agent. Let us use the following notations: N P COLx (k, n, h) — the family of all sets of numbers N (Π) computed by P colonies with the capacity k, degree at most n and height at most h, without using checking rules and with x ∈ {par, seq} for parallel or sequential way of computation. If each program in the sets of programs of all agents consists of rules of the same kind we can speak about homogeneous P colony and this fact we denote by adding H to the notation of class of P colony. If we add K it means that P colony can use checking programs and finally if there is an R in the notation the P colony, then the P colony is restricted. For many combinations of these parameters we can obtain results related to the computational power of classes of P colonies. Some interesting results can reader find in [8] where authors show computational completeness for classes of P colonies with bounded height and degree at the same time. We focus to the P colonies with capacity one, two or three. If one of parameters is unbounded we replace it with ∗. Table 1. Computational complete classes of P colonies n. mode of comp. 1. par 2. par 3. par 4. par 5. seq 6. par 7. par 8. par 9. seq/par 10. par 11. seq/par 12. par 13. par 14. par 15. par 16. par 17. par 18. par 19. seq/par
capacity degree height checking rules / restricted programs / homogeneous programs 1 ∗ 7 K in [2] 1 ∗ 6 K H in [3] 1 4 ∗ K in [2] 1 6 ∗ in [6] 2 ∗ 5 K R in [10] 2 ∗ 5 R in [10] 2 ∗ 4 K in [9] 2 ∗ 4 K H in [3] 2 1 ∗ K R in [10] 2 2 ∗ R in [2] 2 1 ∗ K H in [3] 2 23 5 K R in [8] 2 22 6 K R in [8] 2 22 5 K in [8] 2 1 142 K R in [8] 2 35 8 in [8] 2 57 8 R in [8] 3 35 7 in [8] 3 ∗ 3 K in [9] and [11]
From the data from the table 1 one can conclude how restrictions (restricted or homogeneous programs) and extension (checking rules) affect size (number of agents or maximal number of programs) of P colony to reach the computational completeness.
162
L. Cienciala and L. Ciencialov´a
Theorem 1. N P COLpar (3, 2, ∗)H = N RE. Proof. Let us consider a register machine M with m registers. We construct a P colony Π = (A, f, e, B1 , B2 ) simulating a computation of register machine M with: – A = {e, D, V, M }∪{li, li , li , li , li , li , Li , Oi , Oi | 0 ≥ i ≥ |H|}∪{ar , Nr , Pr | 1 ≤ r ≤ m}, – f = a1 , – B1 = (l0 De, P1 ), – B2 = (eee, P2 ). At the beginning of computation the agent B1 contains the object l0 (the label of starting instruction of M ) and one copy of the object D. The agent puts object D to the environment and it starts to simulate instruction labeled l0 . The set of programs is as follows: 1. For initializing of the simulation: P1 : 1 : l0 De ↔ eee 2 : eee ↔ l0 ee The agent B1 is prepared to simulate instruction labeled by li . The initialization is done by following sequence of steps: configuration of Π
step
B1
B2
1. 2. 3.
l0 De eee l0 ee
eee eee eee
Env
Dl0 D
labels of applicable programs P1
P2
1 2
2. For every ADD-instruction l1 : (ADD(r), l2 , l3 ) we add to the set P1 following programs: P1 : 3 : l1 ee → l2 ar e 5 : l2 ar e ↔ eeD 7 : eeD ↔ l2 ee 9 : l2 ee → l2 ee 4 : l1 ee → l3 ar e 6 : l3 ar e ↔ eeD 8 : eeD ↔ l3 ee 10 : l3 ee → l3 ee When the agent contains objects l1 , it rewrites it to one copy of ar and the object l2 or l3 . The next sequence of steps finishes by generating of l2 or l3 . The object D is to note that in the next step the agent B1 need to exchange its content with object l2 or l3 . There can be at most one object with prime present in the environment. configuration of Π
step
B1
B2
Env
1. 2. 3. 4. 5.
l1 ee l2 ar e eeD l2 ee l2 ee
eee eee eee eee eee
D D l2 ar ar D ar D
labels of applicable programs P1
P2
3 or 4 5 7 9
3. For every SU B-instruction l1 : (SU B(r), l2 , l3 ) there is a subset of programs:
P Colonies and Their Extensions
P1 :
13 : eeD ↔ l1 ee 15 : l1 O1 e → l1 O1 e 14 : l1 ee → l1 O1 e 16 : l1 O1 e ↔ eeD
11 : l1 ee → l1 Nr O1 12 : l1 Nr O1 ↔ eeD P1 : 17 : eeD ↔ l1 ee 18 : l1 ee → l1 ee
19 : l1 ee ↔ L2 ee
21 : l1 ee ↔ L3 ee
20 : L2 ee → l2 ee
22 : L3 ee → l3 ee
P2 : 23 : eee ↔ Nr ee 25 : Pr ee ↔ O1 ar e
28 : O1 Pr e → M ee 29 : M ee ↔ l1 ee 30 : l1 ee → eee
26 : O1 ar e → L2 ee
O1 O1 e
24 : Nr ee → Pr ee
27 : O1 L2 e →
163
31 : Pr ee ↔
32 : O1 O1 e → L3 ee 33 : L3 ee ↔ Pr De 34 : Pr De → M De 35 : M De ↔ l1 ee
O1 Pr e
The agent B1 asks the agent B2 for the answer if there is any copy of ar in the environment (if register r is nonempty). In the positive case it brings L2 from the environment, in the negative case L3 enters the agent B1 . The computation in the case when the register r is not empty: step
B1
1.
l1 ee
configuration of Π
labels of applicable programs
B2
Env
P1
eee
ar D
11
P2
2. l1 Nr O1 3. eeD
eee eee
ar D ar l1 Nr O1 D
12 13
23
4. l1 ee 5. l1 O1 e
Nr ee Pr ee
ar O1 D ar Pr O1 D
14 15
24 25
6. l1 O1 e O1 ar e
Pr D
16
26
7.
17
27 28
eeD
L2 ee
l1 O1
8.
l1 ee
O1 Pr e
L2 D
18
9.
l1 ee
M ee
L2 D
19
10. L2 ee
M ee
l1 D
20
29
11.
l1 ee
DM
???
30
l2 ee
At 11. step the program for the simulation of next instruction with label l2 is chosen. The program 30 “cleans” the content of agent B2 .
164
L. Cienciala and L. Ciencialov´a
The computation in the case when the register r is empty: configuration of Π
step
B1
1.
l1 ee
B2
labels of applicable programs
Env
P1
P2
eee
D
11
2. l1 Nr O1 3. eeD
eee eee
D l1 Nr O1 D
12 13
4. l1 ee 5. l1 O1 e
Nr ee Pr ee
O1 D Pr O1 D
14 15
Pr ee
O1 D
16
eeD
Pr ee
l1 O1 O1
17
31
l1 ee
O1 O1 e
Pr D
18
32
9. l1 ee 10. l1 ee 11. L3 ee
L3 ee Pr De M De
Pr D L3 l1
21 22
33 34 35
l1 ee
MD
??
30
6. l1 O1 e 7. 8.
12.
l3 ee
23 24
4. There is program neither in P1 nor in P2 for the halting instruction lh . P colony Π correctly simulates any computation of the register machine M and the number contained in the first register of M corresponds to the number of copies of the object a1 presented in the environment of Π.
4 Eco-P Colonies In [5] were introduced new types of programs for P colonies with two objects inside each agent. The first of them is deletion program — ain ; bc → d , using this program agent consumes one object (a) from the environment and transforms two objects (b, c) inside agent into new one (d). The second type of programs is insertion type, the insertion program is in the form aout ; b → cd . By executing it agent sends to the environment one object (a) and from the second object (b) agent generates new two objects (c, d). The environment is statics in the basic model, it can be changed only by activity of agents. Eco-P colonies are constructed as an natural extension of P colonies with dynamically evolving environment independently from agents. The mechanism of evolution in the environment is based on 0L scheme. 0L scheme is a pair (Σ, P ), where Σ is the alphabet of 0L scheme and P is the set of context free rules, it fulfills following condition ∀a ∈ Σ ∃α ∈ Σ ∗ such that (a → α) ∈ P . For w1 , w2 ∈ Σ ∗ we write w1 ⇒ w2 if w1 = a1 a1 . . . an , w2 = α2 α2 . . . αn , for ai → αi ∈ P, 1 ≤ i ≤ n. The computation of eco-P colonies is parallel. We denote N EP COLx,y,z (n, h) the family of the sets computing by eco-P colonies such that: – x
can be formed by two symbols: s, c. s — if there is agent sender in eco-P colony, c — if there is agent consumer in eco-P colony,
P Colonies and Their Extensions
165
– y = passive if the rules of 0L scheme are of type a → a only, – y = active
if the set of rules of 0L scheme disposes of at least one rule of another type than a → a, – z = ini if the environment or agents contain objects different from e, otherwise we eliminate this notation, – the degree of eco-P colony is at most n and – the height is at most h. In [5] authors show that eco-P colonies with three agents (senders and consumers) with passive environment (0L scheme contains the rule of type a → a only) are computationally complete. N EP COLsc,passive (3, ∗) = N RE If there is active environment eco-P colony can be computationally complete with two agents consumers and initial content of environment different from e (in [4]). N EP COLc,active,ini (2, ∗) = N RE In addition it is easy to see that agent sender in a P colony can generate a Parikh vector of a regular language L and agent consumer in a P colony can accept a Parikh vector of a regular language L. Theorem 2. N EP COLsc,passive (2, ∗) = N RE. Proof. Consider register machine M = (m, H, l0 , lh , P ). All labels from the set H are objects in eco-P colony. The content of register r is represented by the number of copies of objects ar placed in the environment. To simulate computation of machine M there are two agents in Π - one agent sender and one agent consumer. We construct eco-P colony Π = (A, e, f, VE , DE , B1 , B2 ) with: – alphabet A = {li , li , li , li , li , Li | for each li ∈ H} ∪ {ar | 1 ≤ r ≤ m} ∪ {e} ∪ {nir | 1 ≤ r ≤ m, 1 ≤ i ≤ |H|}, – final object f = a1 , – initial content of the environment VE = l0 D, 0L scheme DE = (A, PE ), – set of rules of the environment PE = {ai → ai 1 ≤ i ≤ m} ∪ {e → e}, – and the agents B1 = (ee, P1 ), B2 = (ee, P2 ), the sets of programs will be described subsequently. 1. For initializing of the simulation there is one program to the set P1 : P1 : 1 : e → l0 e; e out 2. The instruction l1 = (ADD(r), l2 , l3 ) will be realized by rules: P1 : 2 : l1 → l2 ar ; e out 4 : l2 → l2 e; ar out 3 : l1 → l3 ; e out 5 : l3 → l3 e; ar out
166
L. Cienciala and L. Ciencialov´a
The agent sender executes adding one to the content of register r (generate one copy of object ar — the program number 2 and 3 and places it to the environment — programs 4 and 5) and generating of the objects l2 and l3 , labels of all instructions which will be possibly executed in the next steps of computation of the register machine M (programs 2 – 5). 3. In the eco-P colony the instruction l1 : (SU B(r), l2 , l3 ) is realized by following programs: P1 : 6 : l1 → l2 n1r ; e out 10 : l2 → L2 e; l2 out 7 : l1 → l3 n1r ; e out 11 : l3 → L3 e; l3 out 8 : l2 → l2 l2 ; n1r out 12 : L2 → l2 e; e out 9 : l3 → l3 l3 ; n1r out 13 : L3 → l3 ; e out The agent sender puts object n1r to the environment and decides which instruction will be executed after instruction l1 . This choice is given without feed-back from the environment (Was subtraction successful?). But the agent give to the environment mark (object l2 or l3 ) about following instruction. The agent consumer “controls” computation. If the decision was not correct, it start to execute one program in a cycle. P2 : 14 : ee → e; n1r in 18 : n1r e → O; l3 in 15 : n1r e → n1r ; ar in 19 : n1r e → K; l2 in 16 : ar n1r → O; l2 in 20 : Ke → K; e in 17 : ar n1r → K; l3 in 21 : Oe → e; e in 4. There is program neither in P1 nor in P2 for the halting instruction lh . Eco-P colony starts its computation with generating object l0 in agent B1 and simulation of instruction labeled l0 . By the programs it places and deletes from the environment the objects ar and halts its computation when object lh appears in the environment. If the computation goes the wrong way the agent P2 starts cycling and computation never ends. The result of computation is the number of copies of object a1 placed in the environment at the end of computation. No other halting computation can be executed in eco-P colony. So the computation in the eco-P colony Π correctly simulates computation in register machine.
5 PCol Automata In reference to finite automaton we extend P colony by an input tape and change the generating device to the accepting one. The agents of the P colony are working according to actually read symbol from the input tape. To do this they have rules which can “read” the input tape, we call them tape or T -rules. The other rules are called non-tape or N -rules. The input symbol is said to be read if at least one agent follow it (use corresponding T -rule).
P Colonies and Their Extensions
167
The programs are formed from k rules of following types: T
T
– tape rules of the form a → b, or a ↔ b, called rewriting tape rules and communication tape rules, respectively; or – nontape rules of the form a → b, or c ↔ d, called rewriting (nontape) rules and communication (nontape) rules, respectively. For each i, 1 ≤ i ≤ n, the set of tape programs (shortly T -programs) is denoted by PiT , they are formed from one tape rule and k − 1 nontape rules, the set of nontape programs (shortly N -programs) which contain only nontape rules, is denoted by PiN , thus, Pi = PiT ∪ PiN , PiT ∩ PiN = ∅. The computation starts in the initial configuration with the input word placed on the input tape. For configuration (wE , w1 , . . . , wn ) and input symbol a we can construct the sets of applicable programs P. To pass from one configuration to another we define following transitions: – t-transition ⇒at : If exists at least one set of applicable programs P ∈ P such that T T every p ∈ P is T -program with T -rule in the form x → a or x ↔ a, x ∈ A and the set P is maximal. – n-transition ⇒n : If exists at least one set of applicable program P ∈ P such that every pi ∈ P is N -program and the set P is maximal. – tmin-transition ⇒atmin : If exists at least one set of applicable program P ∈ P such T
T
that there is at least one T -program in P and it is in a form x → a or x ↔ a, x ∈ A, it can contain N -programs too and the set P is maximal. – tmax-transition ⇒atmax : If exists at least one set of applicable program P ∈ P such T T that P contain as many T -programs (they are in a form x → a or x ↔ a, x ∈ A ) as it is possible, P can contain N -programs too, and the set P is maximal. PCol automaton works in t (tmax, tmin) mode of computation if it uses only t- (tmax-, tmin-) transitions. It works in nt (ntmax or ntmin) mode if it uses t- (tmax- or tmin-) transitions and if there isn’t any set of applicable programs formed from T -programs it can use n-transition. PCol automaton works in init mode if it does only t-transitions and after reading all the input symbols it uses n-transitions. If PCol automaton works in t, tmax or tmin mode, it reads one input symbol in every step of computation. Consequently, the length of computation equals to the length of the input string. Computation ends by reaching final state computation is terminated after reading the last input symbol if it does not halt before. It is successful if the whole input tape is read and PCol automaton reaches configuration in F . Let us designate M = {t, nt, tmax, ntmax, tmin, ntmin, init}. The language accepted by a PCol automaton Π as above is defined as the set of strings which can be read during a successful computation: L(Π, mode) = { w ∈ V ∗ |(w; wE , w1 , . . . , wn ) can be transformed by Π into (ε; vE , v1 , . . . , vn ) ∈ F with a computation in mode mode ∈ M }.
168
L. Cienciala and L. Ciencialov´a
Let L(P ColA, mode) denote the class of languages accepted by PCol automata in the computational mode mode ∈ M , and let RE denote the class of recursively enumerable languages. For every regular language L there exists PCol automaton working in t-mode having only 1 agent accepting all words from L(in [7]. There is context-free language, which can be accepted by PCol automaton with only 1 agent and working in t-mode. The family of languages accepted by PCol automata with one agent working in t-mode is subset of context-sensitive languages. It is open question if the subset is proper. Unlike other variants of P colonies this model working in t-mode is not computationally complete. In [7] the authors showed that class of languages accepted by PCol automata working in nt, ntmin or ntmax mode equals to the class of recursively enumerable languages. L(P ColA, nt) = RE, L(P ColA, ntmin) = RE, L(P ColA, ntmax) = RE Theorem 3. L(P ColA, init) = N RE. Proof. To prove this, we use notion of accepting variant of register machine working in such way: the input number is stored in the first register at the beginning of computation, The instructions are the same as in generating variant. The computation end by halting (by executing instruction HALT). It was successful iff all the registers are empty at the end of computation. It easy to see that PCol automaton working in init mode having input number n in a form an stored in the input tape can copy it to the environment in the first part of computation (formed from t-transitions) and then continue computing at the same way as P colony without using checking rules. In the final configuration there is no object in the content of environment corresponding to the content of registers.
6 Conclusion We recalled idea and functioning of basic model of P colonies. This model was introduced in [11] in 2005. Since this time many papers and studies about the model and its variations were written. Almost all the reports are focused on determination of computational power of more or less restricted variants of P colonies. We showed some results determining the boundaries of computationally complete classes of P colonies and their extended or restricted models.
References 1. Ciencialov´a, L., Cienciala, L.: Variations on the theme: P Colonies. In: Kol´arˇ, D., Meduna, A. (eds.) Proceedings of 1s t International Workshop WFM 2006, Ostrava, Czech Republic, pp. 27–34 (2006) 2. Cienciala, L., Ciencialov´a, L., Kelemenov´a, A.: On the number of agents in P colonies. In: Eleftherakis, G., Kefalas, P., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2007. LNCS, vol. 4860, pp. 193–208. Springer, Heidelberg (2007) 3. Cienciala, L., Ciencialov´a, L., Kelemenov´a, A.: Homogeneous P colonies. Computing and informatics 27, 481–496 (2008)
P Colonies and Their Extensions
169
4. Cienciala, L., Ciencialov´a, L.: Eco-P colonies. In: P˘aun, G., P´erez-Jim´enez, M.J., RiscosN´un˜ ez, A., Rozenberg, G., Salomaa, A. (eds.) WMC 2009. LNCS, vol. 5957, pp. 201–209. Springer, Heidelberg (2010) 5. Ciencialov´a, L., Csuhaj–Varj´u, E., Kelemenov´a, A., Vaszil, G.: On Very Simple P Colonies. In: Proceeding of The Seventh Brainstorming Week on Membrane Computing, Sevilla, Spain, vol. I, pp. 97–108 (2009) 6. Ciencialov´a, L., Csuhaj–Varj´u, E., Kelemenov´a, A., Vaszil, G.: Variants of P Colonies with Very Simple Cell Structure. Int. J. of Computers, Communications & Control IV(3), 224–233 (2009) 7. Ciencialov´a, L., Cienciala, L., Csuhaj–Varj´u, E., Vaszil, G.: PCol Automata: Recognizing Strings with P Colonies. In: Report of Eight Brainstorming Week on Membrane Computing, Sevilla, Spain (2010) 8. Csuhaj-Varj´u, E., Margenstern, M., Vaszil, G.: P colonies with a bounded number of cells and programs. In: Hoogeboom, H.J., P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) WMC 2006. LNCS, vol. 4361, pp. 352–366. Springer, Heidelberg (2006) 9. Csuhaj–Varj´u, E., Kelemen, J., Kelemenov´a, A., P˘aun, G., Vaszil, G.: Computing with cells in environment: P colonies. Journal of Multi-Valued Logic and Soft Computing 12, 201–215 (2006) 10. Freund, R., Oswald, M.: P colonies working in the maximally parallel and in the sequential mode. In: Ciobanu, G., P˘aun, G. (eds.) Pre-Proceedings of the 1st International Workshop on Theory and Application of P Systems, Timisoara, Romania, pp. 49–56 (2005) 11. Kelemen, J., Kelemenov´a, A.: On P colonies, a biochemically inspired model of computation. In: Proc. of the 6th International Symposium of Hungarian Researchers on Computational Intelligence, Budapest TECH, Hungary, pp. 40–56 (2005) 12. Kelemen, J., Kelemenov´a, A., P˘aun, G.: Preview of P colonies: A Biochemically Inspired Computing Model. In: Bedau, M., et al. (eds.) Workshop and Tutorial Proceedings, Ninth International Conference on the Simulation and Synthesis of Living Systems, ALIFE IX, Boston, Mass, pp. 82–86 (2004) 13. Minsky, M.L.: Computation: Finite and Infinite Machines. Prentice Hall, Upper Saddle River (1967) 14. P˘aun, G., Rozenberg, G., Salomaa, A.: The Oxford Handbook of Membrane Computing. Oxford University Press, Oxford (2009) 15. P systems web page, http://ppage.psystems.eu
On the Parallelizability of Languages Accepted by P Automata Gy¨orgy Vaszil Computer and Automation Research Institute Hungarian Academy of Sciences Kende utca 13-17, 1111 Budapest, Hungary [email protected]
Abstract. We continue the study of the efficiency of distributed P automata initialized in (Gh. P˘aun, and M. J. P´erez-Jim´enez, Solving problems in a distributed way in membrane computing: dP systems, International Journal of Computing, Communication and Control. V(2), 238–250, (2010)). A language accepted by a P automaton is efficiently parallelizable if there exists a distributed P automaton which accepts the same language and its computations only take some fraction of the computing time of the non-distributed variant. We examine how one of the features of P automata, namely the choice of the mapping which maps the sequence of multisets imported by the system to the symbols of the alphabet of the accepted language, influences the efficient parallelizability of the accepted languages.
1 Introduction In the following we study the efficiency of distributed P automata, P automata consisting of several components, each reading different parts of a string and communicating with the others in order to perform a joint computation. Even though P systems, or membrane systems, see [1,2], are distributed parallel computing devices themselves, their computational efficiency is mostly due to their ability to produce and explore an exponential amount of workspace in polynomial time, see [3] for an overview. A different approach to computing with P systems in a distributed way was proposed in [4] where the notion of a distributed P scheme, and that of a distributed P automaton, or dP automaton in short, was introduced. Such a distributed P system consists of components which process an input that is split into several parts, the different parts being simultaneously introduced into the different components of the system which might work on their own or communicate with the others in order to provide the result of the computation. Although distributed P systems might consist of any type of systems as components, the authors of [4] examine distributed P automata in more detail, that is, they study the case when the components of the distributed system are P automata. P automata are accepting P systems which use antiport rules and accept string languages by converting
Research supported in part by the Hungarian Scientific Research Fund, “OTKA”, grant no. K75952.
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 170–178, 2011. c Springer-Verlag Berlin Heidelberg 2011
On the Parallelizability of Languages Accepted by P Automata
171
the multiset sequence entering the system from the environment into a string, a sequence of symbols over some alphabet. They use a mapping for this conversion, one that maps multisets of objects to strings of letters in some way which is preferably simple, see [5] for more information. The authors of [4] study a P automaton variant which uses a class of mappings that map a multiset of objects to a string of the same objects written in any order, that is, a multiset is mapped to any string from the set of permutations of its elements. It is shown that with respect to this kind of mappings, there are regular, context-free, and context-sensitive languages which are efficiently parallelizable, that is, which can be accepted by a distributed P automaton in a time that is some fraction of the time which it takes to accept the same language with a non-distributed P automaton. In the following, we continue this line of investigations by studying the influence of the choice of the mapping that the P automata components use on the parallelizability of their accepted languages. We show that if we slightly extend the class of mappings, we obtain a situation which is different from the one studied in [4], namely, with respect to this different class of mappings, there are no efficiently parallelizable regular languages.
2 Preliminaries and Definitions The reader is assumed to be familiar with the basics of formal language theory and membrane computing, in the following we only list the notions we will use in the subsequent part of the paper, for more details see [6,1,2]. Let V be an alphabet, let V ∗ be the set of all words over V where ε denotes the empty word, let |w| denote the length, the number of symbols of V in w ∈ V ∗ , and let |w|a denote the number of occurrences of the letter a ∈ V in w. The set of nonnegative integers is denoted by N. A multiset is a mapping M : V → N where V is a set of objects and M assigns to each object its multiplicity. The support of M is the set supp(M ) = {a ∈ V | M (a) ≥ 1}. If V is a finite set, then M is called a finite multiset. The numberof objects in a finite multiset M , the cardinality of M, is defined by card(M ) = a∈V M (a). We say that a ∈ M if a ∈ supp(M ); M1 ⊆ M2 if supp(M1 ) ⊆ supp(M2 ) and for all a ∈ supp(M1 ), M1 (a) ≤ M2 (a); the union of two multisets is defined as (M1 ∪ M2 ) where for all a ∈ supp(M1 ) ∪ supp(M2 ), M (a) = M1 (a) + M2 (a). A multiset over V can be represented as any string w ∈ V ∗ where |w|a = M (a) for all a ∈ V . Note that all permutations of a given string represent the same multiset. In the following we use this string representation for multisets, thus, |w| also denotes the cardinality of the represented multiset, and V ∗ also denotes the set of all finite multisets over V . A P system is a structure of hierarchically embedded membranes, each having a label and enclosing a region containing a multiset of objects and possibly other membranes. The out-most membrane is called the skin membrane. The evolution of the contents of the regions of a P system is described by rules associated to the regions. Applying the rules synchronously in each region, the system performs a computation by passing from one configuration to another one.
172
G. Vaszil
An antiport rule is of the form (u, in; v, out), u, v ∈ V ∗ . If such a rule is applied in a region, then the objects of u enter from the parent region and in the same step, objects of v leave to the parent region. In this paper, if an antiport rule is applied in the skin region, then the requested multiset is always able to enter the system from the environment, that is, from the parent region of the skin membrane. A P automaton, introduced in [7], is defined as an accepting membrane system Π = (V, μ, P1 , . . . , Pn , c0 , F ) with object alphabet V , membrane structure μ, sets of antiport rules Pi , 1 ≤ i ≤ n, initial configuration c0 = (w1 , . . . , wn ) where wi ∈ V ∗ , 1 ≤ i ≤ n, is the initial contents of the ith region, and set of accepting configurations F of the form (v1 , . . . , vn ), vi ∈ V ∗ , 1 ≤ i ≤ n, where F is given as E1 × . . . × En , Ei ⊆ V ∗ , such that Ei is either finite, or Ei = V ∗ , 1 ≤ i ≤ n. The configurations of the P automaton we consider in this paper are changed by applying the rules in the maximal parallel manner, that is, as many rules are applied in each region as possible. This way, there is a sequence of multisets which enter the system from the environment during the steps of its computations. If the computation is accepting, that is, it ends in a final configuration from F , then this multiset sequence is called an accepted multiset sequence. ∗ Let Π be a P automaton as above, and let f be a mapping f : V ∗ → 2T for some finite alphabet T . The language over T accepted by Π with respect to f is defined as L(Π, f ) = {f (v1 ) . . . f (vs ) | v1 , . . . , vs is an accepted multiset sequence of Π}. Note how the choice of f in the definition above influences the computational power of P automata. It is desirable that the power of the model lies in the underlying P system and not in the mapping f , therefore the mapping should be as simple as possible. Generally, with very simple and non-erasing f , it is possible to characterize the class of context-sensitive languages, see [8,5], thus, as long as we choose f as non-erasing and not more complex than linear space computable, we can be sure that the power of the mapping does not exceed the power of the underlying P system mechanism. Now we recall some notions defined in [4]. A dP scheme is a construct Δ = (V, Π1 , . . . , Πn , R) for some n ≥ 1, where – V is an alphabet of objects; – Πi , 1 ≤ i ≤ n, are P systems with object alphabet V , and with skin membranes labeled with si , they are called the components of the scheme; and – R is a finite set of rules of the form (si , u/v, sj ) where 1 ≤ i, j ≤ n, with i = j, and u, v ∈ V ∗ , they are the inter-component communication rules of the scheme. Depending on the types of systems we use as components, we obtain different kinds of distributed P systems (dP systems). Each of these systems, however, is functioning in such a way that (1) the components process their own input as separate P systems, but they are synchronized with a “global clock”; (2) they communicates with the others using the inter-component communication rules of R; and (3) they finish the computation when they reach a final configuration which also represents the result computed by the system. When analyzing such a distributed computation, it is important to estimate the cost of communication. This is done in [4] as follows. Let D = c0 ⇒ c1 ⇒ . . . ⇒ cm
On the Parallelizability of Languages Accepted by P Automata
173
be a computation of a dP system based on a scheme Δ as above with c0 and cm being its initial and one of its final configurations, respectively, and ci ⇒ ci+1 denoting a computational step, the transition of the system from ci to ci+1 , 0 ≤ i ≤ m − 1. For each computational step as above, we have ⎧ ⎨ 1, if any inter-component communication rule is used, – ComN (ci ⇒ ci+1 ) = ⎩ 0, otherwise; – ComR(ci ⇒ ci+1 ) = k where k ∈ N is the number of inter-component communication rules used in this transition; – ComW (ci ⇒ ci+1 ) = l where l ∈ N is the total weight of the inter-component communication rules used in this transition, that is, the total number of objects transferred between the components. Now, for any ComX ∈ {ComN, ComR, ComW }, and a computation D as above, let m−1 – ComX(D) = Σi=0 ComX(ci ⇒ ci+1 ), that is, ComX(D) is the sum of the appropriate measures for all transitions of the computation D.
We will apply these notions to calculate the communication cost of computations of distributed P automata in the next section.
3 Distributed P Automata In the following we recall the definition of distributed P automata from [4]. For more information on P automata, see [5]. A distributed P automaton, or dP automaton, is a dP scheme dΠ = (V, Π1 , . . . , Πn , R) where the components are P automata Πi = (V, μi , Pi,1 , . . . , Pi,mi , ci,0 , Fi ), 1 ≤ i ≤ n, 1 ≤ mi , as defined above, with skin membranes labeled by (i, 1), thus, the rules of R are of the form ((i, 1), u/v, (j, 1)) with u, v ∈ V ∗ , 1 ≤ i, j ≤ n. The initial configuration of the dP automaton is c0 = (c1,0 , . . . , cn,0 ). The language L ⊆ T ∗ accepted by a dP automaton consists of words of the form w1 w2 . . . wn where wi ∈ T ∗ are strings accepted by the component Πi , 1 ≤ i ≤ n, during a successful computation, that is, one that starts in c0 and ends in one of the final configurations of F = (F1 , . . . , Fn ). ∗ More formally, let f = (f1 , . . . , fn ) be a mapping f : (V ∗ )n → (2T )n with ∗ fi : V ∗ → 2T , 1 ≤ i ≤ n, and let L(dΠ, f ) = {w1 . . . wn ∈ T ∗ | wi = fi (vi,1 ) . . . fi (vi,si ), 1 ≤ i ≤ n, where vi,1 , . . . , vi,si is an accepted multiset sequence of the component Πi }. It is clear that the choice of fi essentially influences the power of the components, and thus, the power of the whole dP automaton. In [4] the authors consider dP automata
174
G. Vaszil ∗
with f = (f , . . . , f ) where f : V ∗ → 2V is defined in such a way that a multiset over V is mapped by f to a string consisting of a sequence of symbols which is one of the permutations of the elements of the multiset. Here we aim to have a more general setting, therefore we extend the communication measures defined above based on [4] for languages of strings accepted by dP automata as follows. For ComX ∈ {ComN, ComR, ComW }, we define ComX(w, dΠ, f ) = minD {ComX(D) | D is a computation of dΠ which accepts w ∈ L(dΠ, f )}, and ComX(dΠ, f ) = maxw {ComX(w, dΠ, f ) | w ∈ L(dΠ, f )}. To extend these communication measure to languages, we recall the notion of a balanced computation. A computation accepting a string w ∈ T ∗ by a dP automaton as above with components Πi , 1 ≤ i ≤ n, is balanced, if w = w1 . . . wn for wi ∈ L(Πi , fi ), such that −1 ≤ |wj | − |wk | ≤ 1 for any 1 ≤ j, k ≤ n, where L(Πi , fi ) denotes the set of words read by the component Πi during a successful computation of the dP automaton dΠ, 1 ≤ i ≤ n. We say that a language L is n-parallelizable for some n > 1, if L = L(dΠ, f ) for some dΠ and f , such that dΠ has n components and executes balanced computations on all w ∈ L. Now let for some n-parallelizable language L and a class of mappings F , ComXF (L, n) = mindΠ,f ∈F {ComX(dΠ, f ) | L = L(dΠ, f ) such that dΠ has n components and executes balanced computations on all w ∈ L}. Now we recall from [4] the notions of weak and of efficient parallelizability. We say that a language L is (n, m)-weakly ComX parallelizable for some n > 1, m ≥ 1, if L is n-parallelizable, and there is a dP automaton dΠ with some mapping f , such that L = L(dΠ, f ) and ComX(dΠ, f ) ≤ m. This definition requires that the communication complexity of L is bounded by a constant, but it does not say anything about the length of the computation. A language L is (n, m, k)-efficiently ComX parallelizable with respect to a class of mappings F , for some n, k > 1, m ≥ 1, if L is (n, m)-weakly parallelizable, and there is a dP automaton dΠ with n components, such that L = L(dΠ, f ) for some f ∈ F with ComX(dΠ, f ) ≤ m, and moreover, for all P automata Π and f ∈ F such that L = L(Π, f ), timeΠ (x) limx∈L,|x|→∞ ≥k timedΠ (x) where timeX (x) denotes the number of computational steps that a device X needs to accept the string x. We say that a language L is weakly (or efficiently) ComX parallelizable (with respect to a class of mappings F ), if it is (n, m)-weakly parallelizable (or (n, m, k)efficiently parallelizable with respect to F ) for some n, k > 1, m ≥ 1.
On the Parallelizability of Languages Accepted by P Automata
175
4 The Parallelizability of Regular Languages Now we present an example to help the understanding of the above defined notions and to demonstrate the influence that the class of mappings considered for mapping the input multisets to the words of the terminal alphabet has on the parallelizability of the accepted languages. First we define two classes of mappings that we will consider in the remaining part ∗ of the paper. Let f : V ∗ → 2T , for some alphabets V and T , and let the classes of mappings P ERM and T RAN S be defined as follows: – f ∈ P ERM if and only if V = T and for all v ∈ V ∗ , we have f (v) = {a1 a2 . . . as | ai ∈ V, 1 ≤ i ≤ s, and a1 a2 . . . as is a permutation of the elements of v}; – f ∈ T RAN S if and only if for all v ∈ V ∗ , f (v) = w ∈ T ∗ is unique, and it is obtained by applying a finite transducer to the string representation of the multiset v, (the transducer is constructed in such a way that all representations of v as input, result in the same w as output). Example 1. Let dΠ = (V, Π1 , Π2 , R) be a dP automaton with V = {A0 , A, B, C0 , C, D}, R = {((1, 1), B/D, (2, 1))}, and components defined as Πi = (V, [ ](i,1) , P(i,1) , ci,0 , Fi ) where the sets of rules are P(1,1) = {(A, in; A0 , out), (B, in; A, out), (A, in; B, out)}, P(2,1) = {(C, in; C0 , out), (D, in; C, out), (C, in; D, out)}. The initial configurations are c1,0 = (A0 ), c2,0 = (C0 ), and the sets of final configurations are F1 = {(D)}, F2 = {(B)}. It is not difficult to see that Π1 reads a sequence of singleton multisets A, B, A, B, . . ., while Π2 reads C, D, C, D, . . .. The reading process ends when they decide to apply their inter-component communication rule ((1, 1), B/D, (2, 1)) which exchanges the B and D symbols transferring the system to a final configuration. If we have f = (f1 , f2 ) with f1 (A) = a, f1 (B) = b, f2 (C) = c, f2 (D) = d, then we obtain the language L(dΠ, f ) = L = {(ab)n (cd)n | n ≥ 1}. Since L is accepted by dΠ with balanced computations of two components and one inter-component communication of weight 2, we have that L is (2, m)-weakly ComX parallelizable for (m, ComX) ∈ {(1, ComR), (1, ComN ), (2, ComW )}, as already shown in [4]. What can we say about the efficient parallelizability of L? If we consider the class of mappings P ERM , then the argument of [4] is as follows. If a P automaton recognizes a word of the form (ab)n (cd)n , then no two adjacent symbols can be imported into the system in the same computational step since no two adjacent symbols can be exchanged in the word. This means, that any P automaton needs at least 4n steps to accept a word of the form (ab)n (cd)n . Therefore, the dP automaton dΠ above is at least two times as fast as any P automaton can be, thus, L is also (2, m, 2)-efficiently ComX parallelizable with respect to the class of mappings P ERM where (m, ComX) is as above. Let us consider now the class of mappings T RAN S. Is L also efficiently parallelizable with respect to this class? The answer is negative, and this can be seen as follows.
176
G. Vaszil
Consider the P automaton Π = (V , [ [ ]2 ]1 , P1 , P2 , c0 , F) with V = {A1 , A, B1 , B, X0 , X1 , X, Y, Z}, P1 = {(X1 A1 , in; X0 , out), (X1 A, in; X1 , out), (XA, in; X0 , out), (XA, in; X, out), (Y B1 , in; X1 , out), (Y B, in; X, out), (Y B, in; Y, out)}, P2 = {(Y, in; Z, out), (ZA1 B1 , in; Z, out), (ZAB, in; Z, out)}, initial configuration c0 = (X0 , ZZ), and set of final configurations F = {(Z, w) | for any w ∈ V ∗ }. During a successful computation, this P automaton imports multiset sequences XA, XA, . . . , Y B, Y B, . . . or X1 A1 , X1 A, . . . , Y B1 , Y B, . . . with an equal number of A and B symbols. Thus, if we have f ∈ T RAN S defined as f (XA) = f (X1 A1 ) = f (X1 A) = ab, f (YB) = f (YB1 ) = cd, then we have L(Π, f ) = L = {(ab)n (cd)n }, and this P automaton executes the same number of computational steps as the dP automaton dΠ with two components above. Moreover, if we take f ∈ T RAN S where f (X1A1 ) = ab, f (XA) = f (X1A) = abab, f (YB1 ) = cd, and f (YB) = cdcd, then we also have L(Π, f ) = L, but this time the number of computational steps of Π is even less, about the half of the number of steps of the dP automaton dΠ. It is not difficult to see that generalizing the idea of the construction of Π, we can construct P automata which are c times faster as the dP automaton dΠ for any c ∈ N. (Of course, we can also speed up the distributed variant similarly.) Therefore, it is clear that the language L is not efficiently ComX parallelizable with respect to T RAN S for any ComX ∈ {ComN, ComR, ComW }. Based on the above demonstrated ideas, we can formulate the following theorem. Theorem 1. For any regular language L and P automaton Π with L = L(Π, f ) for some f ∈ T RAN S, we can construct a P automaton Π for any k ∈ N, such that L = L(Π , f ), f ∈ T RAN S, and it holds that limx∈L,|x|→∞
timeΠ (x) ≥ k. timeΠ (x)
Proof. We present the idea of the proof, to elaborate the details is left to the reader. Let M = (T, Q, q0 , δ, F ) be a finite automaton accepting L with input alphabet T , set of internal states Q, initial state q0 ∈ Q, transition relation δ : Q × T → 2Q , and set of final states F ⊆ Q. Let us construct a P automaton Π = (Q ∪ T, [ [ ]2 ]1 , P1 , P2 , c0 , F ) where P1 = {(q a, in; q, out) | q ∈ δ(q, a)}, P2 = {(a, in) | a ∈ T }, the initial configuration is c0 = (q0 , ε) and the final configurations are F = {(q, w) | for q ∈ F, and any w ∈ (Q ∪ T )∗ }. If we have f (qa) = a for any q ∈ Q and a ∈ T , then it is not difficult to see that L = L(M ) = L(Π, f ).
On the Parallelizability of Languages Accepted by P Automata
177
Now, similarly to the ideas presented in the example above, we can construct a P automaton Π = (Q ∪ T ∪ T , [ [ ]2 ]1 , P1 , P2 , c0 , F ) with a new alphabet T = {ab | a, b ∈ T } and rule sets P1 = {(q ab, in; q, out) | q ∈ δ(q , b) for some q ∈ δ(q, a)} ∪ P2
{(q a, in; q, out) | q ∈ δ(q, a), q ∈ F }, = {(a, in) | a ∈ T ∪ T }.
If we have f (qa) = a and f (qab) = ab for any q ∈ Q, a ∈ T , and ab ∈ T , then L = L(Π, f ) = L(Π , f ) and the computations of Π are about two times as fast as the computations of Π. It is clear that we can generalize this construction for any factor instead of 2, that is, given a P automaton accepting a regular language using any number of computational steps which is linear in the length of the accepted word, we can construct a P automaton which works k times faster for any k ∈ N, thus, the statement of the theorem holds. It is shown in [4] that for any ComX ∈ {ComN, ComR, ComW }, all regular languages are weakly ComX parallelizable, and that there exist efficiently ComX parallelizable regular languages with respect to the class of mappings P ERM . In contrast to these results, as a consequence of the above theorem, we have the following. Corollary 1. There are no efficiently ComX parallelizable regular languages with respect to the class of mappings T RAN S, for any ComX ∈ {ComN, ComR, ComW }.
5 Conclusions and Topics Further Research As we have seen above, one of the features of P automata, namely the choice of the mapping which maps the input multiset sequences to words over the alphabet of the accepted language, has a great influence on the efficient parallelizability of the accepted languages. If we consider the class of mappings P ERM , the mappings which map a multiset to a string which is a permutation of its elements, then, as shown in [4], there are efficiently parallelizable regular languages, that is, there are regular languages which can be accepted faster by a distributed P automaton than by a P automaton alone. In contrast to this, if we consider the class of mappings T RAN S, those which can be realized by finite transducers, than the computation of certain P automata, for example those which accept regular languages, can be made faster, k times faster for any k ∈ N, which means that there are no efficiently parallelizable regular languages with respect to the class of mappings T RAN S. We have not shown that such a speedup is always possible for any P automaton, but it would not be a surprising result, as it is also true, for example, for Turing machines. If the computations of P automata (with mappings from the class T RAN S) can always be made k times faster for any k ∈ N, then in order for a language L to be efficiently parallelizable with respect to T RAN S, it has to be possible to accept the half of the strings of L (or the nth part if we have n components) faster than the whole string by more than a constant factor. It might be possible to construct such distributed P automata, if L is complicated, exponential time computable, for example. In the case of
178
G. Vaszil
such complex languages, it might also make sense to relax the requirement of having a constant amount of communication. All these topics are open for further investigations.
References 1. P˘aun, G.: Membrane Computing. An Introduction. Springer, Berlin (2002) 2. P˘aun, G., Rozenberg, G., Salomaa, A. (eds.): The Oxford Handbook of Membrane Computing. Oxford University Press, Oxford (2010) 3. P´erez–Jim´enez, M.J.: A computational complexity theory in membrane computing. In: P˘aun, G., P´erez-Jim´enez, M.J., Riscos-N´un˜ ez, A., Rozenberg, G., Salomaa, A. (eds.) WMC 2009. LNCS, vol. 5957, pp. 125–148. Springer, Heidelberg (2010) 4. P˘aun, G., P´erez-Jim´enez, M.J.: Solving problems in a distributed way in membrane computing: dP systems. International Journal of Computing, Communication and Control V(2), 238–250 (2010) 5. Csuhaj–Varj´u, E., Oswald, M., Vaszil, G.: P automata. In: P˘aun, G., Rozenberg, G., Salomaa, A. (eds.) The Oxford Handbook of Membrane Computing, ch. 6, pp. 144–167. Oxford University Press, Oxford (2010) 6. Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages. Springer, Berlin (1997) 7. Csuhaj–Varj´u, E., Vaszil, G.: P automata or purely communicating accepting P systems. In: P˘aun, G., Rozenberg, G., Salomaa, A., Zandron, C. (eds.) WMC 2002. LNCS, vol. 2597, pp. 219–233. Springer, Heidelberg (2003) 8. Csuhaj-Varj´u, E., Ibarra, O.H., Vaszil, G.: On the Computational Complexity of P Automata. In: Ferretti, C., Mauri, G., Zandron, C. (eds.) DNA 2004. LNCS, vol. 3384, pp. 76–89. Springer, Heidelberg (2005)
On Some Biologically Motivated Control Devices for Parallel Rewriting Arto Salomaa Turku Centre for Computer Science, Joukahaisenkatu 3–5 B, 20520 Turku, Finland [email protected]
Abstract. The paper investigates Watson-Crick D0L systems, mainly over the four-letter DNA alphabet. Results are obtained concerning stability versus Fibonacci numbers, as well as classes of growth functions that are not Z-rational. Keywords: regulated rewriting, iterated morphisms, Watson-Crick complementarity, Z-rational functions, Fibonacci sequence.
1 Introduction: Restrictions on Derivations A great variety of restrictions have been applied to rewriting rules (productions) in the past, see for instance [10,4,9]. Not everything derivable by the rules is accepted, also the restrictions have to be satisfied. The general idea is to achieve using simple rules something, be it in the realm of natural, programming or general formal languages, not achievable otherwise. For instance, starting from a and applying the “Fibonacci productions” a → ab, b → a unrestrictedly, one gets words of every positive length, in particular all words of the form ai , i ≥ 1. But if the rewriting is required to be parallel, that is, every letter must be rewritten at each step, then we get the set of Fibonacci numbers as word lengths. Besides parallelism, the following control devices were studied already in the early days of formal languages. An application of a production determines which productions are applicable at the next step (this used to be called a programmed grammar), or some productions cannot be applied if some others are applicable (an ordered grammar) or one has to apply only certain previously specified strings of productions (a matrix grammar or generally a grammar with a control language), or at the ith step of a derivation only a subset P (i) of the whole production set is applicable (a time-varying grammar). It was an early observation that the resulting system is simple in principle and easy to deal with. However, in most cases the control device remarkably increases the generative capacity. Appearance checking, [10], is a control device that has been used in many forms. The continuation of a derivation depends on the appearance, or non-appearance, of specific letters, words or sets of them in the string currently scanned. The checking may be extended to concern the total count of the letters, as will be the case later in this article. The control device considered in this article is biologically motivated and based on Watson-Crick complementarity. It can be used in connection with any rewriting systems J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 181–190, 2011. c Springer-Verlag Berlin Heidelberg 2011
182
A. Salomaa
but it is most natural in connection with parallel rewriting. The control is based on appearance checking. We assume that the reader is familiar with the basics of formal languages. If necessary, [10,9] can be consulted. We use customary language-theoretic notation. In particular, the length of the word w is denoted by |w|. For a subset F of the alphabet, the notation |w|F stands for the total number of occurrences of letters of F in w. Since a D0L system, [8], is a basic notion underlying our subsequent investigations, the following definition is given for the sake of completeness. Definition 1. A D0L system is a triple H = (Σ, g, w0 ), where Σ is an alphabet, w0 ∈ Σ ∗ (the axiom) and g is an endomorphism of Σ ∗ . (In the sequel g is often defined in terms of productions, indicating the image of each letter.) A D0L system defines the sequence of words wi , i ≥ 0, where wi+1 = g(wi ), for all i ≥ 0. It defines also the language, consisting of all words in the sequence, the length sequence |wi |, i ≥ 0, as well as the growth function f (i) = |wi |. In view of Definition 1, it should be clear what is meant by the various equivalence problems for D0L systems, such as sequence equivalence, language equivalence and growth equivalence. In connection with growth, Z-rational sequences, [14,8,9], play an important role. There are many equivalent ways to define a Z-rational sequence. The following way is perhaps most straightforward. Definition 2. A sequence of integers ni , i = 1, 2, . . ., is Z-rational if there is a square matrix M with integer entries such that, for each i, the upper right-hand corner entry in the power M i equals ni . The following problem has been very significant in considerations about length sequences. Problem Zpos . Decide whether or not a negative number appears in a given Z-rational sequence of integers. The decidability status of Zpos is open, although the problem is generally believed to be decidable. The input is of course assumed to be given by some effective means. Discussion about this problem and its different representations can be found in [14,8,9]. A brief outline about the contents of this article follows. In the next section we review the basics of D0L systems, augmented with a Watson-Crick control device. Section 3 restricts the attention to the four-letter DNA-alphabet. In particular, we investigate stability and present some open problems. The last section is devoted to a class of systems with very peculiar growth functions.
2 A Mechanism Based on Watson-Crick Complementarity The phenomenon known as Watson-Crick complementarity is a basic tool in DNA computing, [7]. It has also made possible surprising theoretical constructions. In particular, a simple language-theoretic mechanism may gain enormously in generative capacity when augmented with a possibility of replacing a string with its complementary one,
On Some Biologically Motivated Control Devices for Parallel Rewriting
183
under certain circumstances. The purpose behind such a replacement can also be viewed as the removal of “bad” strings obtained through a generative process. The four DNA bases are customarily denoted by A, G, T, C. A DNA strand can be viewed as a word over the DNA alphabet ΣDN A = {A, G, T, C}. The bases A and T are complementary, and so are the bases C and G. Bonding occurs only if the bases in the corresponding positions in the two strands are complementary. Consider the letter∗ to-letter endomorphism hW of ΣDN A defined by hW (A) = T, hW (T ) = A, hW (G) = C, hW (C) = G. The morphism hW will be referred to as the Watson-Crick morphism. The bases A, G (resp. T, C) are referred to as purines (resp. pyrimidines). (The chemical significance is irrelevant for us here.) One can also considers more general DNA-like alphabets Σn = {a1 , . . . , an , a1 , . . . , an } (n ≥ 1) and refer to the letters ai and ai , i = 1, . . . , n, as complementary. The endomorphism hW of Σn∗ defined by hW (ai ) = ai , hW (ai ) = ai , i = 1, . . . , n, is also now referred to as the Watson-Crick morphism. We also call the nonbarred (resp. barred) letters as purines (resp. pyrimidines). The association of letters with the DNA is understood as follows: a1 = A, a2 = G, a1 = T, a2 = C. This conforms with the two definitions of the Watson-Crick morphism, as well as with the definition of purines and pyrimidines. In what follows, we consider the language P Y R, consisting of words where the pyrimidines form a majority. Thus P Y R consists of words over the alphabet Σn , where the number of occurrences of barred letters exceeds that of non-barred letters. If we are dealing with the DNA alphabet, P Y R consists of words w satisfying |w|{T,C} > |w|{A,G} . (Words containing equally many purines and pyrimidines are not in P Y R.) It is important to notice that if w ∈ P Y R, then hW (w) ∈ Σ ∗ − P Y R. Clearly, P Y R is a context-free non-regular language. We now come to our central definitions. Definition 3. A Watson-Crick D0L system is a construct HW = (G, T R), where G = (Σn , g, w0 ) is a D0L system, T R is a recursive subset of Σ ∗ (trigger) and w0 ∈ Σn∗ − T R. The sequence S(HW ), consisting of words wi , i = 0, 1, . . ., is defined by the condition hW (g(wi )) if g(wi ) ∈ T R, wi+1 = g(wi ) otherwise, for all i ≥ 0. The language, length sequence and growth function of HW are defined as for D0L systems. Given a Watson-Crick D0L system HW , an infinite word t1 t2 . . . over the alphabet {0, 1}, referred to as the Watson-Crick road or briefly road of HW , is defined as follows. Let wi , i = 0, 1, . . . , be the sequence of HW . Then, for all j ≥ 1, tj = 0 (resp. tj = 1) if wj = g(wj−1 ) (resp. wj = hW (g(wj−1 ))).
184
A. Salomaa
Thus, the road of HW indicates the positions in the sequence, where complementarity transitions take place. If the road equals 0ω , then no complementarity transitions take place and the system is referred to as stable. It is ultimately stable if the road equals x0ω , for some word x. It is obvious that the properties of a Watson-Crick D0L system are largely determined by the trigger. Clearly, the trigger should not be too complicated. In a regular WatsonCrick D0L system the trigger is a regular language. A Watson-Crick D0L system is standard if the language P Y R is its trigger. Note that if words in the language P Y R are considered “bad”, then no word in the language of a standard Watson-Crick D0L system is bad. As regards equivalence problems, the same ones can be formulated for Watson-Crick D0L systems as for ordinary D0L systems and, in addition, the problem of road equivalence: decide of two given systems whether or not they have the same road. The following theorem summarizes some typical results. If ρ is a recursive function mapping the set of positive integers into {0, 1}, we denote by tρ the infinite binary word whose ith letter equals 1 exactly in case ρ(i) = 1, for all i ≥ 1. Theorem 1. For every recursive function ρ, a Watson-Crick D0L system whose WatsonCrick road equals tρ can be effectively constructed. Every ultimately periodic infinite binary word can be expressed as the road of a system with a finite trigger. The stability problem is decidable for Watson-Crick D0L systems with a regular trigger but undecidable for systems with a context-sensitive trigger. The stability problem for standard Watson-Crick D0L systems is algorithmically equivalent to the problem Zpos . The road, growth, sequence and language equivalence problems are all undecidable for WatsonCrick D0L systems with context-sensitive triggers. Any algorithm for solving the road, growth, sequence or language equivalence problem for standard Watson-Crick D0L systems can be converted into an algorithm for solving the problem Zpos . More information and details are given in [5,6,11,12,15]. Networks are considered in [1], universality aspects in [2,16], and an interconnection with P systems in [3]. Of special interest are the uni-directional systems, where in each sequence at most one complementarity transition takes place. After that only the morphism is applied, no matter what the word under scan is. This means that the system is always ultimately stable. In spite of their simplicity, uni-directional systems have amazing computing powers. Many of their decision problems are equivalent among themselves and equivalent to Zpos .
3 {A, T, C, G} as Operational Alphabet. Stability and Fibonacci Sequences We begin with the following basic definition Definition 4. A Watson-Crick D0L system over the DNA alphabet {A, G, T, C} is referred to as a DNA system. A DNA system whose trigger is a regular language (resp. the language P Y R) is called regular (resp. standard).
On Some Biologically Motivated Control Devices for Parallel Rewriting
185
Since DNA systems are a special case of Watson-Crick D0L systems, the definitions of the sequence, language, length sequence and growth function of the system, as well as the definitions of road and stability, carry immediately over to DNA systems. In general, problems are decidable for regular DNA systems. Decision problems are largely open for standard DNA systems. One has not been able to show interconnections with the problem Zpos , as has been done for general DNA-like alphabets. The decidability of the stability problem is also open for DNA systems. Of course, in many particular instances, stability is easy to verify. A DNA system is stable if the right side w of every production satisfies |w|A,G ≥ |w|T,C . This is clearly not a necessary condition for stability. The purpose of this section is to present a stable standard DNA system having peculiar interconnections with Fibonacci numbers. The growth sequence of each of the four letters constitutes a subsequence of the Fibonacci sequence, or the sum of two such sequences. We use the following indexing of the Fibonacci numbers ϕi : ϕ0 = ϕ1 = 1, ϕ2 = 2, ϕ3 = 3, ϕ4 = 5, ϕ5 = 8, ϕ6 = 13, ϕ7 = 21, ϕ8 = 34, ϕ9 = 55, ϕ10 = 89, ϕ11 = 144, ϕ12 = 233, ϕ13 = 377, . . . Consider the DNA system HF ib defined by the axiom AGT C and productions A → T C 2 , G → C, T → G, C → G2 A. The first three words in the sequence of HF ib are AGT C, T C 3 G3 A, G3 AG2 AG2 AC 3 T C 2 . Ignoring the order of letters, we get the following beginning of the sequence: AGT C, AG3 T C 3 , A3 G7 T C 5 , A5 G11 T 3 C 13 , A13 G29 T 5 C 21 , A21 G47 T 13 C 55 , . . . No complementarity transition occurs in these words although, for instance, in the last word the number of purines equals the number of pyrimidines. Denoting by αi , γi , τi , κi the number of the occurrences of the letters A, G, T, C, respectively, in the ith word in the sequence, i ≥ 1, we get the table i αi γi τi κi
1 2 3 4 5 6 7 8 9 10 1 1 3 5 13 21 55 89 233 377 1 3 7 11 29 47 123 199 521 843 1 1 1 3 5 13 21 55 89 233 1 3 5 13 21 55 89 233 377 987
From the table we see that stability prevails at the beginning of the sequence. We now prove than this is the case in general and, moreover, establish the connection with the Fibonacci sequence. Theorem 2. Let w be a word, different from the axiom, in the sequence of HF ib , and let α, γ, τ, κ be the numbers of occurrences of the letters A, G, T, C, respectively, in w. Then, for some j, either α = ϕj , γ = ϕj−1 + ϕj+1 , τ = ϕj−1 , κ = ϕj+2 ,
186
A. Salomaa
or else, α = ϕj , γ = ϕj−1 + ϕj+1 , τ = ϕj−2 , κ = ϕj+1 . Hence, HF ib is stable. Proof. Stability follows from the equations because, in the first case, α + γ = ϕj + ϕj−1 + ϕj+1 = ϕj−1 + ϕj+2 = τ + κ and, in the second case, α + γ = ϕj + ϕj−1 + ϕj+1 > ϕj−2 + ϕj+1 = τ + κ. We prove the equations inductively. The first alternative prevails for the second word in the sequence, as seen by choosing j = 1. We assume inductively that some word in the sequence satisfies one of the alternatives, and consider the numbers αnext , γnext , τnext , κnext , associated to the next word in the sequence. The productions of HF ib yield immediately the following relations: αnext = κ, γnext = τ + 2κ, τnext = α, κnext = γ + 2α. Assume that α, γ, τ, κ satisfy the first alternative. Then αnext = ϕj+2 , γnext = ϕj−1 + 2ϕj+2 = ϕj−1 + ϕj+1 + ϕj + ϕj+2 = ϕj+1 + ϕj+3 , τnext = ϕj , κnext = ϕj−1 + ϕj+1 + 2ϕj = ϕj−1 + ϕj+2 + ϕj = ϕj+1 + ϕj+2 = ϕj+3 . which shows that the second alternative is satisfied for the index j + 2. Assume, finally, that α, γ, τ, κ satisfy the second alternative. Then αnext = ϕj+1 , γnext = ϕj−2 + 2ϕj+1 = ϕj−2 + ϕj−1 + ϕj + ϕj+1 = ϕj + ϕj+2 , τnext = ϕj , κnext = ϕj−1 + ϕj+1 + 2ϕj = ϕj−1 + ϕj+2 + ϕj = ϕj+1 + ϕj+2 = ϕj+3 . implying that the first alternative is satisfied for the index j + 1. This completes the induction, and the theorem follows. The proof shows also that the two alternatives occur by turns in the sequence. The index of the Fibonacci number grows by 2 or by 1, depending on whether we go from the first alternative to the second, or vice versa.
4 Systems with Weird Growth The class of Z-rational functions is very general. In particular, the growth functions of variations of D0L systems are almost always special cases of Z-rational functions. Therefore, it is natural to call a (growth) function “weird” if it not Z-rational. It is possible to construct standard Watson-Crick D0L systems whose growth function is weird. Such a system was given already in [6], and [13] gave an example of a
On Some Biologically Motivated Control Devices for Parallel Rewriting
187
DNA system with this property. Thus, Watson-Crick complementarity associated with D0L systems gives rise to constructions not possible in other variations of D0L systems. This can also be viewed as an illustration of the rich theoretical possibilities in DNA computing, [7,11]. We now extend and sharpen the approach in [13] and present a very general class of D0L systems with weird growth functions. Definition 5. A standard DNA system H is in the class WEIRD if, for some relatively prime m ≥ 2 and n > m, the productions of H are A → A, G → G, T → T m , C → C n , and T G is the axiom of H. Remark 1. The following theorem remains valid for many kinds of generalizations of the class WEIRD, both as regards the axiom and the form of the productions. We prefer the given simple definition. Apart from notational complications, the constructions in the proof remain the same also for more general versions. To get an idea of the sequence of H, we consider first the explicit example, m = 4 and n = 9. Then the beginning of the sequence is T G, A4 C, T 4 G9 , A16 C 9 , T 16 G81 , T 64 G81 , A256 C 81 , T 256 G729 , A1024 C 729 , T 1024 G6561 , T 4096 G6561 , A16384 C 6561 , T 16384 G59049 , A65536 C 59049 , T 65536 G531441 , T 262144 G531441 , A1048576 C 531441 , T 1048576 G4782969 , T 4194304 G4782969 , . . . Here complementarity transitions can be seen from changes in the alphabet: if the alphabet remains the same, no complementarity transition has taken place. Thus, the beginning of the road is 111101111011110110 . . . We listed sufficiently many words from the beginning of the sequence to show the irregularity in the road. Theorem 3. If H ∈ WEIRD, then the growth function of H is not Z-rational. Proof. We fix m and n and consider the system H as given in Definition 5. Let pi , i = 1, 2, . . . be the sequence of positive powers of m and n, arranged in the increasing order of magnitude. Thus, p1 = m, and for i ≥ 1, pi+1 is the smallest number of the form mj or nj that exceeds pi . Our assumption concerning m and n guarantees that no power of m equals a power of n. Let qi , i = 1, 2, . . . , be the infinite sequence consisting of 0 s and 1’s such that qi = 0 exactly when pi is a power of m. We begin with an easy number-theoretic fact. Lemma 1. The sequence qi , i = 1, 2, . . . , is not ultimately periodic. Proof. Since m < n, there cannot be two consecutive 1’s in the sequence of qi ’s. The assumption of the sequence being of the form x(10k 10k )ω , for some word x and integer k, leads into contradiction. Indeed, this assumption would contradict the obvious fact limj→∞ (m/n)j = 0.
188
A. Salomaa
Lemma 2. The road of H is not ultimately periodic. Proof. The claim follows from Lemma 1 because, for any i ≥ 2, the ith bit ri in the road equals 1 exactly in case the bits qi−1 and qi are different. It is clear that the growth function f (i) of H can be written in the form f (i) = mα(i) + nβ(i) , i ≥ 0, where the functions α and β satisfy α(0) = β(0) = β(1) = 0, α(1) = β(2) = α(2) = 1. When the value of the argument i is increased by 1, one of the function values α(i) and β(i) is increased by 1, while the other remains unchanged. By considering the bits ri of the road of H, we can express which one of the function values is increased. If ri = 0, i ≥ 1, then α(i + 1) = α(i − 1) + 2, β(i + 1) = β(i − 1). Indeed, the equation ri = 0 shows that no complementarity transition occurs when the word wi in the sequence w0 , w1 , . . . , of H is obtained from the word wi−1 . Hence α(i) = α(i − 1) + 1, since increase in the value of β always causes a complementarity transition. Consequently, β(i) = β(i − 1). We infer also that mα(i) < nβ(i) , which means that α(i + 1) = α(i) + 1 and β(i + 1) = β(i). On the other hand, if ri = 1, then α(i + 1) = α(i − 1) + 1, β(i + 1) = β(i − 1) + 1. Now the step wi−1 → wi produces a complementarity transition. If it is caused by an increase in the value of α (resp. β), then in the next step the value of β (resp. α) must be increased. To complete the proof of Theorem 3, we consider the auxiliary function F defined by F (i) = f (i + 1) − (m + 1)f (i) + mf (i − 1), i ≥ 1. Lemma 3. For all i ≥ 3, we have F (i) = 0 if and only if the ith bit ri in the road of H satisfies ri = 0. Proof. Fix the value i ≥ 3, and assume that f (i − 1) = mμ + nν . Then μ, ν ≥ 1. Assume first that ri = 0. Then f (i) = mμ+1 + nν , f (i + 1) = mμ+2 + nν . Consequently, F (i) = mμ+2 + nν − (m + 1)(mμ+1 + nν ) + m(mμ + nν ) = 0.
On Some Biologically Motivated Control Devices for Parallel Rewriting
189
Assume, secondly, that ri = 1. Then f (i + 1) = mμ+1 + nν+1 and either f (i) = mμ + nν+1 , or else f (i) = mμ+1 + nν . In case of the first alternative, we obtain F (i) = mμ+1 + nν+1 − (m + 1)(mμ + nν+1 ) + m(mμ + nν ) = m(mμ − mμ−1 + nν − nν+1 ). We conclude that F (i) = 0 because, otherwise, mμ−1 /nν = (n − 1)/(m − 1), which is not possible for relatively prime m and n. In case of the second alternative for f (i) we obtain F (i) = mμ+1 + nν+1 − (m + 1)(mμ+1 + nν ) + m(mμ + nν ) = mμ+1 − mμ+2 + nν+1 − nν . Now the assumption F (i) = 0 leads to the impossible equation mμ+1 /nν = (n − 1)/(m − 1). Thus, F (i) = 0, and Lemma 3 follows. To conclude the proof of Theorem 3, we now assume the contrary: the function f (i) is Z-rational. Then also the function F (i) is Z-rational, [14]. By the Skolem-Mahler-Lech Theorem (Lemma 9.10 in [14]), the number 0 occurs in an ultimately periodic fashion in the sequence F (i), i = 1, 2, . . . However, this contradicts Lemmas 2 and 3. In spite of the generality of the class WEIRD, there are entirely different kinds of DNA systems whose growth function is not Z-rational. The decidability of the following problem is open: Is the growth function of a given DNA system Z-rational? As in the case of general Watson-Crick D0L systems, this problem is probably connected with the problem ZP os. However, the same constructions do not carry over to the DNA alphabet. Dedication. This article is dedicated to Gheorghe (George) P˘aun on the occasion of his 60th birthday. George was one of the early pioneers in regulated rewriting (see [4] and the references given there). The topic of this paper reflects this aspect of his remarkable career. George was with me in Turku for long periods in the 90’s. He was an ideal collaborator, innovative, enthusiastic, hard-working. Let me mention one example. We visited a university in eastern Finland. George preferred to stay in the hotel when all others went to a dinner party. In the morning he had ready a beautiful paper about splicing, some ideas about which we had discussed on the road. On the birthday I wish George Many Happy Returns, as well as continuing success in science.
References 1. Csuhaj–Varj´u, E., Salomaa, A.: Networks of Watson-Crick D0L systems. In: Ito, M., Imaoka, T. (eds.) Words, Languages and Combinatorics III, pp. 134–150. World Scientific Publ. Co., Singapore (2003)
190
A. Salomaa
2. Csima, J., Csuhaj–Varj´u, E., Salomaa, A.: Power and size of extended Watson-Crick L systems. Theoretical Computer Science 290, 1665–1678 (2003) 3. Csuhaj–Varj´u, E., Martin-Vide, C., P˘aun, G., Salomaa, A.: From Watson-Crick L systems to Darwinian P systems. Natural Computing 2, 299–318 (2003) 4. Dassow, J., P˘aun, G.: Regulated Rewriting in Formal Language Theory. Springer, Berlin (1989) 5. Honkala, J., Salomaa, A.: Watson-Crick D0L systems with regular triggers. Theoretical Computer Science 259, 689–698 (2001) 6. Mihalache, V., Salomaa, A.: Language-theoretic aspects of DNA complementarity. Theoretical Computer Science 250, 163–178 (2001) 7. P˘aun, G., Rozenberg, G., Salomaa, A.: DNA Computing — New Computing Paradigms. Springer, Heidelberg (1998) 8. Rozenberg, G., Salomaa, A.: The Mathematical Theory of L Systems. Academic Press, New York (1980) 9. Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages, vol. 1-3. Springer, Heidelberg (1997) 10. Salomaa, A.: Formal Languages. Academic Press, New York (1973) 11. Salomaa, A.: Turing, Watson-Crick and Lindenmayer. Aspects of DNA complementarity. In: Calude, C., Casti, J., Dinneen, M. (eds.) Unconventional Models of Computation, pp. 94–107. Springer, Singapore (1998) 12. Salomaa, A.: Watson-Crick walks and roads on D0L graphs. Acta Cybernetica 14, 179–192 (1999) 13. Salomaa, A.: Iterated morphisms with complementarity on the DNA alphabet. In: Ito, M., P˘aun, G., Yu, S. (eds.) Words, Semigroups, Transductions, pp. 405–420. World Scientific Publ. Co., Singapore (2001) 14. Salomaa, A., Soittola, M.: Automata-Theoretic Aspects of Formal Power Series. Springer, Heidelberg (1978) 15. Salomaa, A., Sos`ık, P.: Watson-Crick D0L systems: the power of one transition. Theoretical Computer Science 301, 187–200 (2003) 16. Sos´ık, P.: D0L Systems + Watson-Crick Complement = Universal Computation. In: Margenstern, M., Rogozhin, Y. (eds.) MCU 2001. LNCS, vol. 2055, pp. 308–320. Springer, Heidelberg (2001)
Reaction Systems with Duration Robert Brijder1 , Andrzej Ehrenfeucht2, and Grzegorz Rozenberg1,2 1
Leiden Institute of Advanced Computer Science, Leiden Center for Natural Computing, Leiden University, The Netherlands 2 Department of Computer Science, University of Colorado at Boulder, USA
Abstract. A reaction system is essentially a finite set of reactions, where each reaction consists of a finite set of reactants (needed for the reaction to take place), a finite set of inhibitors (each of which inhibits the reaction from taking place), and a finite set of products produced when the reaction takes place. A crucial feature of a reaction system is that (unless introduced from outside the system) an element (entity) from a current state will belong also to the successor state only if it is in the product set of a reaction that took place in the current state. In other words, an entity vanishes unless it is sustained by a reaction — a sort of “immediate decay” property. In this paper we relax this property, by providing each entity x with its duration d(x), which guarantees that x will last through at least d(x) consecutive states. Such reaction systems with duration are investigated in this paper. Among others we demonstrate that duration/decay is a result of an interaction with a “structured environment”, and we also investigate fundamental properties of state sequences of reaction systems with duration.
1 Introduction One of the research strands of natural computing (see [1]) is the investigation of processes taking place in nature from the point of view of information processing, and the computational nature of biochemical reactions is one of the popular research topics. Reaction systems are a formal model of interactions between biochemical reactions (see, e.g., [2,3,4,5]). The underlying idea is that such interactions as well as the functioning of single reactions are based on the mechanisms of facilitation and inhibition. In this way a reaction is formalized as a triplet a = (Ra , Ia , Pa ), where Ra is the set of needed reactants, Ia is the set of inhibitors each of which forbids a from taking place, and Pa is the set of products produced by a when it takes place. For a to take place in a given state W (set of entities present in the current “molecular soup”), all of the reactants from Ra must be present in W , and none of the inhibitors from Ia may be present in W — we say then that a is enabled by W . The result of applying a to W equals Pa if a is enabled by W , and the empty set otherwise. A finite set A of reactions is enabled by W if any of the reactions in A is enabled by W . The result of applying A to W is cumulative, i.e., it is the union of the results of application of all the individual reactions from A. Finally, a reaction system is essentially a finite set of reactions. It follows then that the result of applying all enabled reactions (from a given reaction system) to the current state W will contain an entity x from W only if x is produced J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 191–202, 2011. c Springer-Verlag Berlin Heidelberg 2011
192
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
by one of the reactions enabled by W . In other words x “vanishes” unless it is produced (sustained) by one of the applied reactions. Hence there is no permanency of elements/entities: an entity disappears unless it is sustained by a suitable reaction — this corresponds to an “immediate decay” of an entity. In this paper we relax the “immediate decay” property by providing a reaction system with a duration function d, which to each entity assigns its duration (its life time): an entity x will be sustained for d(x) state transitions from (and including) the state where x gets introduced. We refer to the so enriched reaction systems as reaction systems with duration, which are investigated in this paper. We provide here two kinds of results. First of all, we demonstrate that duration/decay can be explained as a result of a reaction system A interacting with its environment A , where A is a larger reaction system containing A. Then we also investigate dynamic processes in reaction systems with duration. The essential feature of reaction systems is their determinism, meaning that if in a state sequence τ (which is not influenced by an environment) two consecutive states are equal, then from then on all other states are also equal. This is not true in reaction systems with duration: one may have a segment of τ where all states are equal (called a constant segment) which is followed by a state different from those in the segment. We prove various properties of such constant segments.
2 Preliminaries In order to fix notation and terminology we recall in this section some basic notions concerning sets and sequences. As usual, Z+ is the set of positive integers. For a finite nonempty set Q ⊆ Z+ , we denote the least common multiple of the integers in Q by lcm(Q). A function f : F → R, where F is a family of sets closed under union, is additive if for all disjoint Z1 , Z2 ∈ F, f (Z1 ∪ Z2 ) = f (Z1 ) ∪ f (Z2 ). Also, Z1 ⊕ Z2 denotes the symmetric difference of sets Z1 and Z2 . Let τ = W0 , W1 , . . . , Wn be a sequence of sets. We denote the length n + 1 of τ by |τ |. We say that τ is constant if Wi = Wj for all i, j ∈ {0, . . . , n}. A segment τ of τ is a sequence of consecutive elements of τ , i.e., τ = Wi , Wi+1 , . . . , Wj for some i, j ∈ {0, . . . , n} with i ≤ j. We say that τ is terminal in τ if j = n, otherwise τ is nonterminal in τ . Also, τ is maximally constant in τ if τ is a constant segment of τ and it cannot be extended to a larger constant segment of τ (i.e., either i = 0 or Wi−1 = Wi , and either j = n or Wj = Wj+1 ). For a set Q, the Q-projection of τ is the sequence of sets projQ (τ ) = W0 ∩ Q, W1 ∩ Q, . . . , Wn ∩ Q.
3 Reactions and Reaction Systems In this and in the following section we recall the basic notions related to reaction systems (see, e.g., [4]). Definition 1. A reaction is a triplet a = (R, I, P ), where R, I, P are finite nonempty sets. If S is a set such that R, I, P ⊆ S, then a is a reaction in S.
Reaction Systems with Duration
193
The sets R, I, P are also denoted by Ra , Ia , Pa , and called the reactant set of a, the inhibitor set of a, and the product set of a, respectively. Also, Ma = Ra ∪ Ia is the set of resources of a, and rac(S) denotes the set of all reactions in S. We also say that a is a (|Ra |, |Ia |, |Pa |)-reaction. Thus, (1, 1, 1)-reactions are the “simplest” reactions. Example 1. Let S = {s1 , s2 , s3 , s4 } and a = ({s1 }, {s3 }, {s2 , s3 }). Then a ∈ rac(S) and, e.g., Ma = {s1 , s3 }. Definition 2. Let T be a finite set. 1. Let a be a reaction. Then a is enabled by T , denoted by a en T , if Ra ⊆ T and Ia ∩ T = ∅. The result of a on T , denoted by resa (T ), is defined by: resa (T ) = Pa if a en T , and resa (T ) = ∅ otherwise. 2. Let A be a finite set ofreactions. The result of A on T , denoted by resA (T ), is defined by: resA (T ) = a∈A resa (T ). Thus the result of a set of reactions A on T is cumulative, i.e., it isthe union of results of all individual reactions from A. Also, note that resA (T ) = {resa (T ) | a ∈ A, a en T }. Note that when A is applied to T , then all elements of T − resA (T ) vanish. Thus an element of T , even if it does not belong to the reactant set of any reaction in A, vanishes unless it is sustained by a reaction in A (i.e., unless it is in the product set of a reaction in A). Example 2. Consider again S and a as in Example 1. Let T1 = {s1 , s2 } and T2 = {s1 , s3 }. Since a en T1 , we have res{a} (T1 ) = Pa = {s2 , s3 }. On the other hand, a is not enabled on T2 , and so res{a} (T2 ) = ∅. We are ready now to recall the notion of reaction system. Definition 3. A reaction system, abbreviated rs, is an ordered pair A = (S, A) such that S is a finite set, and A ⊆ rac(S). The set S is called the background set of A, its elements are called entities, and A is called the set of reactions of A — note that since S is finite, so it A. Reaction systems where each reaction is a (1, 1, 1)-reaction are called (1, 1, 1)-reaction systems. The dynamic behaviour of a rs is formalized through the notion of an interactive process. Definition 4. Let A = (S, A) be a rs. An interactive process in A is a pair π = (γ, δ) of finite sequences such that, for some n ≥ 1, γ = C0 , . . . , Cn , δ = D0 , . . . , Dn , where C0 , . . . , Cn , D0 , . . . , Dn ⊆ S, D0 = ∅, and Di = resA (Di−1 ∪ Ci−1 ) for all i ∈ {1, . . . , n}. The sequence γ is the context sequence of π, and the sequence δ is the result sequence of π. Then the sequence τ = W0 , W1 , . . . , Wn defined by Wi = Ci ∪ Di for all i ∈ {0, . . . , n} is the state sequence of π, with W0 = C0 called the initial state of π (and of τ ). If Ci ⊆ Di for all i ∈ {1, . . . , n}, then we say that π (and τ ) are contextindependent. Note that a context-independent state sequence depends only on the initial
194
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
state W0 and its length n+1. The set of all state sequences of A (i.e., all state sequences of all interactive processes in A) is denoted by ST S(A), and the set of all contextindependent state sequences of A is denoted by CIST S(A). The context sequence formalizes the intuition that, in general, a rs is not a closed system, and so its behaviour is influenced by the “rest of the world”. This influence can be as “wild” as possible (there is no restriction on the context sets). Example 3. Let A = (S, A) be a rs with S = {s1 , s2 , s3 } and A = {a1 , a2 } with a1 = ({s1 }, {s3 }, {s2 , s3 }) and a2 = ({s2 }, {s1 }, {s1 }). Then the context-independent state sequence τ with the initial state W0 = {s1 } and length 4 is τ = W0 , W1 , W2 , W3 where W1 = {s2 , s3 }, W2 = {s1 }, and W3 = {s2 , s3 }. We say that sets A1 , A2 ⊆ rac(S) are equivalent, denoted by A1 ∼S A2 , if for all T ⊆ S, resA1 (T ) = resA2 (T ). Note that if a is a reaction, then {a} ∼S {(Ra , Ia , {p}) | p ∈ Pa }. In this way, a reaction system may, in a equivalent manner, be described in the singleton product normal form, where for each reaction a we have |Pa | = 1. This normal form will be quite useful in this paper.
4 Reaction Systems with Duration As noted already, there is no permanency of entities in a reaction system, i.e., an entity present in the current state will vanish (i.e., it will not be present in the successor state, within a given interactive process) unless either it is produced by one of the reactions enabled in the current state or it is introduced by the context of the successor state. This vanish is then quite immediate: the vanishing element does not survive even one transition step. In organic chemistry, entities have a decay time, i.e., they disappear/vanish within a certain time period. To take this into account we introduce now reaction systems with duration. Definition 5. A reaction system with duration, abbreviated rsd, is a triplet A = (S, A, d), where (S, A) is a rs, and d : S → Z+ . We refer to (S, A) as the underlying rs of A, denoted by und(A), and to d as the duration function of A. For x ∈ S, d(x) is the duration of x (in A). Example 4. Let A = (S, A) be the rs of Example 3. Then A = (S, A, d) with d(s1 ) = d(s2 ) = 2 and d(s3 ) = 4 is a reaction system with duration. The dynamic behaviour of reaction systems is again formalized through interactive processes, however the notion of an interactive process has to be modified so that the durations of entities are taken into account. Definition 6. Let A = (S, A, d) be a rsd. An interactive process in A is a triplet π = (γ, δ, ρ) of finite sequences such that, for some n > 1, γ = C0 , C1 , · · · , Cn , δ = D0 , · · · , Dn , ρ = G0 , · · · , Gn where for all i ∈ {0, · · · , n}, Ci , Di , Gi ⊆ S, Gi = {x ∈ S | d(x) ≥ 2 and x ∈ Dj , for some j ∈ {i − (d(x) − 1), · · · , i − 1}}, D0 = ∅, and Di = resA (Di−1 ∪ Ci−1 ∪ Gi−1 ) for i > 0.
Reaction Systems with Duration
195
The terminology and notation of reaction systems carry over to reaction systems with duration, and so, e.g., γ and δ are the context and the result sequence of π, respectively. The sequence ρ is the duration sequence of π. Then the sequence τ = W0 , W1 , . . . , Wn defined by Wi = Ci ∪ Di ∪ Gi for all i ∈ {0, . . . , n} is the state sequence of π (and W0 is the initial state of π and of τ ). Again, ST S(A) and CIST S(A) denote the set of all state sequences of A and the set of all context-independent state sequences of A, respectively. Note that in reaction systems with duration, for i > 0, the state Wi is equal to Ci ∪ resA (Wi−1 ) ∪ Gi . Therefore, Wi depends not only on the result of A on Wi−1 and the context Ci , but also on the entities from Gi . Note also that a reaction system with duration such that d(x) = 1, for all x ∈ S, corresponds to a reaction system (without duration). Example 5. Let A = (S, A, d) be the rsd of Example 4. Then the context-independent state sequence τ = W0 , . . . , W5 with initial state W0 = {s1 } and length 6 of A is {s1 }, {s2 , s3 }, {s1 , s2 , s3 }, {s1 , s3 }, {s3 }, ∅. Note that, e.g., W2 = D2 ∪ G2 = {s1 } ∪ {s2 , s3 } as s2 “lives” d(s2 ) = 2 time steps. Notice that τ begins in the same initial state as τ in Example 3, but due to the existence of duration, τ turns out to be very different from τ . Note that for a rsd A we have ST S(A) ⊆ ST S(und(A)), i.e., the introduction of the duration function does not provide new state sequences. The reason is that the effect of the duration function can be achieved/simulated by contexts. The difference really lies in context-independent state sequences, viz., in general, context-independent state sequences of A are not context-independent in und(A). Hence it is not true that CIST S(A) ⊆ CIST S(und(A)). Finally, it is important to notice that while ST S(A) ⊆ ST S(und(A)), in general it is not true that ST S(und(A)) ⊆ ST S(A).
5 Duration through Interactions with a Larger System It is well-known that, from a biological perspective, the functioning of an organism in an environment is a two-way interaction: the functioning of an organism is influenced by its environment, and dually the environment is influenced by the functioning of the organism. Also, the decay of molecules can be seen as an interaction with an environment: e.g., the decay may be much faster in high temperatures than it is in low temperatures. This is the intuition for the considerations of this section where we demonstrate that the phenomenon of duration/decay can be explained as an interaction between a reaction system and its environment. Here the informal term “environment” refers to a context that is more structured (more restricted) than an arbitrary/wild context. A natural candidate for such a more structured context is a reaction system, i.e., when we analyze a reaction system as an open system, we consider it to be a part of a larger reaction system. Thus the context becomes a reaction system, and to such a context we informally refer as an environment.
196
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
Theorem 1. For every rsd system A = (S, A, d) there exists a rs A = (S , A ) such that S ⊆ S , A ⊆ A , and projS (CIST S(A )) = CIST S(A). Proof. Let S = S ∪ {xi | x ∈ S and i ∈ {1, . . . , d(i)}} ∪ {u}, where all three component sets of this union are pairwise disjoint. Let A = A ∪ A1 ∪ A2 ∪ A3 , where A1 = {(R, I, {x1 }) | (R, I, {x}) ∈ A}, A2 = {({xi }, {u}, {xi+1}) | x ∈ S and i < d(x)}, and A3 = {({xi }, {u}, {x}) | x ∈ S and i < d(x)}. Note that u is used only as an inhibitor (each reaction must have a nonempty inhibitor set). The set A1 ∪ A2 ∪ A3 is triggered when a reaction from A is applied — if its product is {x}, then also the corresponding reaction from A1 is applied producing x1 . Here the subscript 1 of x1 means that x was just introduced (in A) and so its current age is 1. Then reactions from A2 are updating the age of x — in each consecutive step the age of x increases by 1 (and so we get x1 , x2 , x3 , . . .) until it reaches the age equal to d(x). Since there are no reactions for xd(x) , this particular chain x1 , x2 , x3 , . . . , xd(x) ends (dies) here. Reactions from A3 make sure that if x with a subscript is in a current state, then x itself (without subscript) is present (introduced) in the successor state. Thus the interplay of reactions from A with reactions from A1 ∪ A2 ∪ A3 ensures that if a reaction from A produces x ∈ S, then x will be produced by A for another d(x) − 1 consecutive steps — in this way the total duration of x equals d(x). By taking the Sprojection of context-independent state sequences of A we hide the details of applying reactions from A1 ∪ A2 ∪ A3 , obtaining in this way the context-independent sequences of A. Note that all productions in A1 ∪ A2 ∪ A3 are (1, 1, 1)-productions, and so Theorem 1 explains the phenomenon of duration as an interaction with a very simple environment. Reaction systems provide a qualitative rather than a quantitative model of interactions between biochemical reactions. For example, the result of applying a set of reactions A to a state W is cumulative: it is the union of results of application of all individual reactions from A. Hence, even if A contains reactions a1 and a2 enabled by W with Ra1 ∩ Ra2 = ∅, there is no conflict between a1 and a2 — both are applied to W . One assumes here a “threshold supply” of entities: either an entity is present and there is “enough” of it, or an entity is not present. Thus we do not have counting here. Clearly, there are situations, also in the real world, where one needs to assign quantitative parameters to states. Our “philosophy” here is that a numerical value can be assigned to a state W if there is a measurement of W yielding this value. Measurements are then formalized as functions assigning reals to potential states of a given reaction system; moreover these functions must be additive. We get in this way reaction systems with measurements defined as follows. A reaction system A with measurements, see [5], is a triplet (S, A, F ) such that (S, A) is a reaction system, and F is a finite set of additive functions f ∈ F , with f : 2S → R, called measurement functions. In the following example we demonstrate how to add measurement functions to a reaction system in order to measure concentrations of entities in states of the system.
Reaction Systems with Duration x x1
x x1 x2
x x1 x2 x3
x x1 x2 x3 x4
x x1 x2 x3 x4 x5
x2 x3 x4 x5
x3 x4 x5
x4 x5
197
x5
τ = Wi Wi+1 Wi+2 Wi+3 Wi+4 Wi+5 Wi+6 Wi+7 Wi+8
Fig. 1. Segment τ of Example 6
Example 6. Consider the rsd system A = (S, A, d) with x ∈ S and d(x) = n for some n. Now let ρ be a context-independent state sequence of A where x is produced (i.e., it is in the result of applying reactions of A to the previous state) for precisely m consecutive states Wi , . . . , Wi+m−1 — we assume, for didactic reasons, that x is produced in ρ for the first time in Wi , and x is not produced in the following n − 1 states. We let τ = Wi , . . . , Wi+m+n−2 be the corresponding segment of ρ. As in the proof of Theorem 1 we may interpret the duration in A as an interaction within a larger reaction system A (without duration). Recall that A contains for x the entities x1 , . . . , xn which are introduced in this order when x is produced. Figure 1 illustrates segment τ in A corresponding to τ in A for the case n = m = 5, where the occurrences of x produced by indexed entities xi , as well as possible occurrences of other entities, are ignored. A possible interpretation of the indexed entities xi is that x1 , . . . , xn represents a “decay chain”, where the concentrations of x become weaker and weaker, up to xn , and finally not detectable anymore. Hence, we can formally compute concentrations of x in states of a state sequence using measurement function cx . This concentration function 1 is defined as follows: cx (xi ) = 2i−1 for i ∈ {1, . . . , n} and cx (z) = 0 otherwise. cx (xi−1 ) Equivalently, cx (xi ) = for i ≥ 2 with cx (x1 ) = 1. We have chosen here for 2 1 “halving” the concentration ( 2i−1 ), but in general one can choose arbitrary q, rather 1 than q = 2 getting qi−1 . In this way, we obtain the reaction system with measurements A = (S , A , {cx }) with A = (S , A ). The concentration values corresponding to the consecutive states of τ are depicted in Figure 2 for the case n = m — this figure shows the saturation phase followed by exponential decay. Clearly, if m > n, then the figure would contain an “equilibrium phase” in between the saturation phase and the exponential decay. Note that the fact that we ignored in Figure 2 the occurrences of x produced by indexed entities of xi , as well as possible occurrences of other entities, does not matter in our consideration, because cx assigns value 0 to all these occurrences.
6 Constant Segments Reaction systems (without duration) are deterministic, meaning that whenever Wi−1 = Wi for two consecutive states in a context-independent state sequence, then, from then on until the sequence ends, every next state Wj (j > i) is equal to Wi , i.e., Wi = Wj . However, in general, this does not hold for reaction systems with duration. One can
198
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
2 concentration
1
0 i−1
i+m−1
time
Fig. 2. An illustration of the state sequence τ of Example 6 with the corresponding concentration values
have a context-independent state sequence of a rsd which has a segment of equal states Wi , . . . , Wj (with Wi = . . . = Wj ) such that the next state Wj+1 is different from Wj — this is an important feature of behaviour of reaction systems with duration. We investigate such constant segments in this section. It may be instructive to notice here that (in the above) the reason for Wj+1 = Wj is that Wj+1 Wj , because the “survival by duration” of one or more entities expired in Wj . Definition 7. Let A be a rsd, and let τ = W0 , W1 , . . . , Wn ∈ ST S(A). For i ∈ {1, . . . , n}, Wi is locally constant if Wi = Wi−1 . Example 7. Consider again Example 5. Note that W4 = {s1 , s3 } is locally constant in τ , but W5 = ∅ is not locally constant in τ . Theorem 2. Let A = (S, A, d) be a rsd, and let t0 = min{d(x) | x ∈ S}. Let τ = W0 , W1 , . . . , Wn ∈ CIST S(A), and let ρ = Wi , Wi+1 , . . . , Wi+t0 −1 be a segment of τ such that i ≥ 1. If t0 > 2|S|, then there exists a state in ρ which is locally constant. Proof. We begin with the following claim which describes consequences of an entity x ∈ S “appearing” or “disappearing” in ρ. Claim. Let x ∈ Wl for some l ∈ {i, . . . , i + t0 − 1}. (1) If x ∈ Wl−1 , then x ∈ Wq for all q ∈ {l, . . . , i + t0 − 1}. (2) If x ∈ Wq for some q ∈ {l + 1, . . . , i + t0 − 1}, then x ∈ Wk for all k ∈ {i, . . . , l}. Proof (1) Since x ∈ Wl and x ∈ Wl−1 , we must have x ∈ resA (Wl−1 ). Since t0 = min{d(x) | x ∈ S}, this implies that x ∈ Wq for all q ∈ {l, . . . , i + t0 − 1}. (2) Since x ∈ Wq and t0 = min{d(x) | x ∈ S}, x ∈ resA (Wr ) for all r ∈ {i − 1, . . . , q − 1}. Since x ∈ Wl , x ∈ resA (Wh ) for some h ∈ {0, . . . , l − t0 }. Therefore x ∈ Wk for all k ∈ {i, . . . , l}. Intuitively, statement (1) of the claim says that if an arbitrary x ∈ S appear in a state Wl of ρ, then it will remain present in all consecutive states of ρ, and statement (2) of the
Reaction Systems with Duration
199
claim says that if an arbitrary x ∈ S disappears in a state of ρ, then it had to be present in all previous states of ρ. Therefore, statement (1) forbids a situation where x appears in ρ, and then later in ρ it disappears. However, the statements of the claim do not forbid a situation when x disappears in ρ and then appears again. Hence there are at most two distinct r1 , r2 ∈ {i, . . . , i + t0 − 2} with x ∈ Wr1 ⊕ Wr1 +1 and x ∈ Wr2 ⊕ Wr2 +1 . As there are |S| entities x ∈ S, we have at most 2|S| not locally constant states in ρ. Since t0 > 2|S|, this implies that ρ contains a state which is locally constant. Hence the theorem holds. It may be useful to point out here (in the context of Theorem 2) that the ratio of the decay time to the production time can be quite huge in the real world of biology. For example, the production time for a protein may typically take milliseconds while the decay time may take seconds, minutes or even hours. Using Theorem 2 we will give now a lower bound on the average length of maximal constant segments in context-independent state sequences of reaction systems with duration. This lower bound depends on the minimal duration among the entities in S. Corollary 1. Let A = (S, A, d) be a rsd, and let t0 = min{d(x) | x ∈ S}. If t0 ≥ 2|S|, then the average length of maximal constant segments in context-independent state 0 −2|S| sequences of A longer than t0 is at least t2|S|+1 . Proof. Let τ ∈ ST S(A) be such that |τ | > t0 . Let ρ be an arbitrary segment of τ of length t0 . Since t0 ≥ 2|S| and by the proof Theorem 2, ρ contains at most 2|S| not locally stable states, and so at least t0 − 2|S| locally stable states. If none of the not locally stable states are consecutive, then we have at most 2|S| + 1 segments of locally stable states in ρ. Therefore the average length of maximal constant segments of ρ (and 0 −2|S| hence of τ ) is at least t2|S|+1 . We will demonstrate now that nonterminal maximal constant segments may be bounded from above by the maximal duration among the entities in S. Theorem 3. Let A = (S, A, d) be a rsd, and let t1 = max{d(x) | x ∈ S}. For every τ ∈ CIST S(A), if σ is a nonterminal maximal constant segment of τ , then |σ| ≤ t1 . Proof. Let τ = W0 , W1 , . . . , Wn . Assume to the contrary that σ = Wi , Wi+1 , . . . , Wi+t1 +m for some m > 0 is a nonterminal maximal constant segment of τ with |σ| > t1 . As t1 = max{d(x) | x ∈ S}, for each x ∈ Wi+t1 +m , there exists j ∈ {i, . . . , i + t1 + m − 1} such that x ∈ resA (Wj ). Since all states in σ are equal, we have x ∈ resA (Wi+t1 +m ). Hence Wi+t1 +m ⊆ resA (Wi+t1 +m ). On the other hand resA (Wi+t1 +m ) = resA (Wi+t1 +m−1 ) ⊆ Wi+t1 +m , and we obtain Wi+t1 +m = resA (Wi+t1 +m ). As σ is a nonterminal segment of τ , Wi+t1 +m+1 is a state of τ . As Wi+t1 +m = resA (Wi+t1 +m ), we have Wi+t1 +m+1 = Wi+t1 +m . This contradicts the fact that σ is a maximal constant segment of τ . Consequently, if σ is a nonterminal maximal constant segment of τ , then |σ| ≤ t1 .
200
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
7 Blips and Periodicities When, in a rsd A = (S, A, d) an entity x ∈ S is introduced in a state Wi of a contextindependent state sequence τ , then, because of its duration, x will be also be present in Wi+1 , . . . , Wi+d(x)−1 (providing that τ is long enough). However, it may be also present in states Wi+d(x) , Wi+d(x)+1 , . . . , Wi+d(x)+k for some k ≥ 0, because it may be produced in the “intermediate” states by reactions from A. Therefore, in general, we can only say that (from the moment that it was produced in Wi ) x will be present in at least d(x) consecutive states. However, there are situations where we can say that x will be present in exactly d(x) consecutive states. We will discuss such a situation in this section. In this section we consider reaction systems in singleton product normal form. Definition 8. Let A = (S, A) be a rs, and let p ∈ S. We say that p is a blip (in A) if for each a ∈ A, if Pa = {p}, then p ∈ Ia . Since A is in singleton normal form, whenever p is produced, it is right away “blocked” (it is a sort of opposite of an entity that propagates itself). Therefore, in reaction systems without duration a blip does not exist longer than one step, unless introduced by context. In reaction systems with duration blips provide a way of exact counting of the number of transition steps. More specifically, in a context-independent state sequence τ of a rsd A = (S, A, d), each occurrence of a blip x lasts exactly d(x) times in τ (unless it hits the end of the state sequence). Lemma 1. Let A = (S, A, d) be a rsd, x ∈ S be a blip, and let τ = W0 , W1 , . . . , Wn ∈ CIST S(A). For i, j ∈ {0, . . . , n} with i < j, if x ∈ Wi , x ∈ Wj+1 , and x ∈ Wk for k ∈ {i + 1, . . . , j}, then j = i + d(x). Proof. We have Wi+1 = resA (Wi ), so x is introduced in Wi+1 , and therefore x ∈ Wk for k ∈ {i + 1, . . . , i + d(x)}. Since x is a blip, x ∈ Wi+d(x)+1 . Thus by Lemma 1 duration d(x) of a blip determines “exact duration” of x in contextindependent state sequences. This turns out to be very useful in generating periodicities, as illustrated below. Consider the rsd system A = (S, A, d). Let S = {x1 , . . . , xl , x0 }, and let A = {({xi }, {xj }, {xj }) | i, j ∈ {1, . . . , l}, i = j} ∪ {({x0 }, {xj }, {xj }) | j ∈ {1, . . . , l}} Note that A consists of (1, 1, 1)-reactions only, and that x1 , . . . , xl (and also x0 , since x0 is never produced) are blips. Lemma 2. Let A be the rsd system described above. Let τ = W0 , W1 , . . . , Wn ∈ CIST S(A), where W0 = {x0 } and Wi = ∅ for all i ∈ {0, . . . , n}. Let z = lcm({d(xj ) + 1 | j ∈ {1, . . . , l}}). Then n < z, and moreover there exists a τ as above with n = z − 1.
Reaction Systems with Duration
201
Proof. Since W0 = {x0 }, we have W1 = {x1 , . . . , xl }. Consider arbitrary xj for j ∈ {1, . . . , l}. By Lemma 1, it will be present in exactly d(xj ) consecutive states; hence xj ∈ Wkj for kj ∈ {1, . . . , d(xj )} and xj ∈ Wd(xj )+1 . If Wd(xj )+1 is nonempty, then (by the definition of A) xj appears again in the next state Wd(xj )+2 , and will be again present in d(xj ) consecutive states. Consequently, if n ≥ z, then we have Wz = ∅ — a contradiction, as all states Wi with i ≤ z are nonempty. Hence there exists such a τ with n = z − 1. As a consequence of various blips propagating each other (as in the proof of Lemma 2), one may obtain long state sequences using blips with modest duration values — these sequences die when, synchronously, blips stop to propagate each other. This is illustrated in the next example. x0 − −
x1 x2
x1 x2
x1 −
− x2
x1 x2
x1 −
x1 x2
− x2
x1 −
x1 x2
x1 x2
− −
τ = {x0 }, {x1 , x2 }, {x1 , x2 }, {x1 }, {x2 }, {x1 , x2 }, {x1 }, {x1 , x2 }, {x2 }, {x1 }, {x1 , x2 }, {x1 , x2 }, ∅
Fig. 3. State sequence τ of Example 8
Example 8. Consider now the rsd system A described just before Lemma 2 with l = 2, d(x1 ) = 3 and d(x2 ) = 2. Hence z = lcm({4, 3}) = 12. We have the contextindependent state sequence τ = {x0 }, {x1 , x2 }, {x1 , x2 }, {x1 }, {x2 }, {x1 , x2 }, {x1 }, {x1 , x2 }, {x2 }, {x1 }, {x1 , x2 }, {x1 , x2 }, ∅ of A. The entities of x1 and x2 propagate each other, but in state Wz they are both not present, and so the state sequence “dies”. This interaction of x1 and x2 is illustrated in Figure 3. We end this section by considering a normal form involving blips. Lemma 3. Let a = (Ra , Ia , {p}) be reaction with p ∈ Ma . Then B1 = {a} is equivalent with B2 = {a1 , a2 }, where a1 = (Ra ∪{p}, Ia , {p}) and a2 = (Ra , Ia ∪{p}, {p}). Proof. Let T ⊆ S and T = ∅. We first show that resB1 (T ) ⊆ resB2 (T ). If a in not enabled by T , then resB1 = ∅ and we are done. Assume now that a is enabled by T . Hence resa (T ) = {p}. If p ∈ T , then a1 is enabled by T and a2 is not enabled by T . Hence resB2 = res{a1 } = {p}. If on the other hand p ∈ T , then a2 is enabled by T and a1 is not enabled by T and we have similarly, resB2 = res{a2 } = {p}. We now show that resB2 (T ) ⊆ resB1 (T ). We have Ra ⊆ Ra1 , Ra ⊆ Ra2 , Ia ⊆ Ia1 , and Ia ⊆ Ia1 . Therefore, if either a1 or a2 is enabled in T , then a is enabled in T . Therefore, we have resB1 (T ) = resB2 (T ), and so B1 ∼S B2 . By Lemma 3, for a reaction system A in singleton product normal form, we may assume that, for each reaction a of A with Pa = {p}, we have p ∈ Ma (i.e., either p ∈ Ra or p ∈ Ia ). We call this (more restricted) normal form the produce resource normal form. In produce resource normal form, whenever p is created/produced, then it is already in the resource of a producing reaction. As a matter of fact in a rs in the produce resource
202
R. Brijder, A. Ehrenfeucht, and G. Rozenberg
normal form, each reaction either produces an element from its reactant set (hence sustains this element in the successor state) or it produces a new element that is not present in the current state but belongs to its inhibitor set (this new element will then inhibit this reaction to be applied in the successor state). Thus, if an entity p is produced only by the latter type of reactions (“new element” reaction), then p is a blip. Acknowledgements. The authors are indebted to Hendrik Jan Hoogeboom for useful comments on the first version of this paper.
References 1. Kari, L., Rozenberg, G.: The many facets of natural computing. Communications of the ACM 51(10), 72–83 (2008) 2. Ehrenfeucht, A., Main, M.G., Rozenberg, G.: Combinatorics of life and death for reaction systems. International Journal of Foundations of Computer Science 21(3), 345–356 (2010) 3. Ehrenfeucht, A., Rozenberg, G.: Events and modules in reaction systems. Theoretical Computer Science 376(1-2), 3–16 (2007) 4. Ehrenfeucht, A., Rozenberg, G.: Reaction systems. Fundamenta Informaticae 75(1-4), 263– 280 (2007) 5. Ehrenfeucht, A., Rozenberg, G.: Introducing time in reaction systems. Theoretical Computer Science 410(4-5), 310–322 (2009)
Nanomachine Computing by Quorum Sensing Jiˇr´ı Wiedermann Institute of Computer Science, Academy of Sciences of the Czech Republic, Pod Vod´arenskou vˇezˇ ´ı 2, 182 07 Prague 8, Czech Republic [email protected]
Abstract. A biologically motivated computational model of wirelessly communicating self-reproducing mobile embodied automata — nanomachines — is defined. Their wireless communication mechanism is inspired by molecular communication. Thus, the automata are augmented by an input/output mechanism modelling sensation/production of the signal molecules and by a mechanism measuring their concentration. The communication, reproductive, concentration measuring, and time measuring “organs” of the automata represent their embodiment. The embodiment description is not a part of the model — its existence is merely postulated. The computational part of nanomachines is modelled by finite state automata. Orchestration of their actions is done via quorum sensing. That means that collective decisions are based on measuring the concentration of signal molecules produced and sensed by individual machines. The main result claims that in a closed environment with a high concentration of uniformly distributed signal molecules a system of such nanomachines can simulate any counter automaton with arbitrary small probability of error. By equipping the machines with an additional memory organ, the finite state control can be substituted by circuits of constant depth. In a real world such computational systems could be realized by genetically engineered bacteria or by artificial nanomachines produced by self-assembly.
1 Introduction 1.1 Motivation What is the simplest computational model possessing a universal computing power? A Turing machine, or a counter machine (also known as Minsky machine [8])? In fact, there exists a plethora of universal computational devices and it is a matter of taste to select the simplest one among those models. As a rule, they are represented by the devices with a fixed rigid architecture that enables them to enter configurations from a potentially infinite set of configurations: they are, in fact, infinite automata. None finite device (finite even in a physical meaning of this word) can subsequently enter an unbounded number of configurations. Unavoidably, the size of the device must grow with the number of reachable configurations. This is also the case of the cellular automata also possessing a universal computing power. Note that for each input the corresponding cellular automaton is finite; however, the number of its elements grows with the input size.
This research was carried out within the institutional research plan AV0Z10300504 and parˇ grant No. P202/10/1333. tially supported by the GA CR
J. Kelemen and A. Kelemenov´a (Eds.): Pˇaun Festschrift, LNCS 6610, pp. 203–215, 2011. c Springer-Verlag Berlin Heidelberg 2011
204
J. Wiedermann
The next (in)appreciable property of the known universal computational systems is their “non-homogeneity” — they cannot be disassembled into smaller, in some sense elementary identical computational parts that could be reassembled in an arbitrary manner so as to give rise to a universal computing system. A partial departure from this rule is given by cellular automata that almost satisfy our requirement of homogeneity. Clearly, a cellular automaton can be disassembled into individual finite automata. It is obvious that finite automata are a simpler computational device than, e.g., Turing machines — they only accept regular languages and, therefore, are not universal. Nevertheless, upon a reassemblage into a cellular automaton they must respect the original topology of the underlying network although the individual automata need not be returned to their original positions — they can be interchanged at wish. Then a universal computing power “emerges” again. Note that in the latter case the universal computer power will not emerge from among any (multi)set of arbitrarily connected finite automata — the condition for that to happen is that the the communication links among the automata must follow a certain regular pattern. The last consideration brings us to the following reformulation of our introductory question: does there exist a simple computational device whose multisets possess universal computational power even when there is no fixed topology of communication links among their individual elements? 1.2 Our Solution We show an amorphous computing system consisting of so-called nanomachines that could present a possible answer to the lastly mentioned question. Nanomachines are wirelessly communicating self-reproducing embodied nanosized automata. Their prospective fabrication makes use of molecular self-assembly or of modifications of real bacteria via genetical engineering. Their wireless information exchange mechanism is be based on molecular communication. For that purpose each machine is equipped by an input/output mechanism consisting of sensors detecting the presence of signal molecules, and of emitters enabling secreting of signal molecules. Further, there are timers, a random bit generator, a self-reproducing apparatus, and a computational mechanism. With the exception of the computational mechanism all lastly mentioned parts represent an automaton’s embodiment which, however, is not a part of our modelling — the existence of these components and their functionality is merely postulated. The finite-state unit represents the computational part of a nanomachine. The nanomachines float in a confined space in a solution saturated by various types of molecules that can be detected and produced by the nanomachines, or can be externally supplied to the solution. Orchestration of the automata’s actions is done via quorum sensing, i.e., by making collective decisions based on the density of automata population. This density is inferred from the concentration of signal molecules produced and sensed by individual automata (cf. [17]). We show that by making a repeated use of quorum sensing the populations of nanomachines can simulate arbitrary counter automata with a high probability, i.e., such populations possess universal computing power. It is irrelevant whether the automata are mobile
Nanomachine Computing by Quorum Sensing
205
or not. The resulting efficiency of such a system is low since the system computes using a unary number system. 1.3 Related Research Our paper builds on the recent research in computational and complexity aspects of amorphous computing (cf. [9], [14], [16]). In the latter mentioned papers amorphous computing systems consisting of identical simple asynchronous computational processors (typically RAMs with a small number of registers), with no identifiers, equipped by a single channel radio communicators with a limited range and by a random number generator, were considered. Such processors were randomly placed in a closed area or volume, and the task was to design randomized communication protocols leading to a self-organization of a communication network that would enable, with a high probability, to perform universal computations. For the static, non-movable processors this task was solved in [14] and [16]. Later on, in [15] it was shown that similar protocols also work on the level of molecular communication; the corresponding processors take a form of mobile nanomachines capable of performing simple tasks, such as actuation and sensing (cf. [5]). From a computational viewpoint, the nanomachines were modelled as timed probabilistic finite state automata. A solution suitable for movable processors communicating via radio was later found in a doctoral thesis [9]. The present paper returns to the environment in which molecular communication is possible. In comparison with the earlier paper [15], the current paper takes advantage of the embodiment and presents an improvement both on algorithmic and “technological” level. A new communication protocol is based on quorum sensing. This protocol is simpler than the previously used broadcast protocol and in the context of embodiment leads to a simplification of the computational parts of the processors up to the level that no finite state mechanism is needed. This, of course, is important when technological (or evolutionary) and complexity aspects are considered: stateless mechanisms are much simpler than those using states. For the first time a computational modeling of bacterium quorum sensing used as a communication mechanism has probably been investigated within the theory of P-systems. In a series of papers [2], [10], and [11] the authors have shown that P-systems can capture certain aspects of quorum sensing providing thus new insights into both biological and computational backgrounds of coordinating mechanisms of simple distributed agents. The authors have also shown a computational universality of a certain type of P-systems [2]. Doing so, no effort was taken in order to minimize the computational resources within the cells and environments that represent the basic computational units of P-systems. In fact, in the model it has been necessary to keep the count of signal molecules currently present inside the cell or inside the environment. Thus, neither cells nor environments can be seen as finite state mechanisms. Contrary to that, our modeling via nanomachines strives for minimization of computational resources: in the first approach, finite-state automata are used as the computational part of our nanomachines. In a further effort we show that the automata can even be replaced by constant depth circuits. This will be enabled by storing the states in a special memory organ.
206
J. Wiedermann
The research on stateless automata in P-systems has recently been initiated by Yang, Dang and Ibarra [18]. The transitions of a stateless automaton do not depend on internal states but solely on the symbols currently scanned by its heads accessing the input. This will also be the case of our circuits — their outputs will solely depend on the molecules scanned by their input receptors and signals from other sensors and from the memory organ. Populations of nanomachines prove that, indeed, universal computational devices can be constructed from communicating computational components that are relatively simple and need not preserve any definitive space arrangements: no fixed architecture of the resulting machine is needed. At the same time it holds that the individual components of the systems do not possess universal computing power while the system as a whole does. Consequently, we believe that by our design we have entered the class of universal amorphous computational systems whose elementary components are minimized to a maximal possible extent as far as their computation power is concerned. Depending on the embodiment, other variants of basic components might be possible but their computational part, i.e., constant depth circuits with a bounded fan-in, could hardly be simplified. 1.4 Contents The structure of the paper is as follows. In Section 2 the model of molecularly communicating self-reproducing nanomachines is introduced. In Section 3 a simulation of a counter automaton by our model is sketched. In Section 4 we indicate how, using additional memory organ, the computational part of nanomachines can be replaced by constant depth circuits with bounded fan-in. Open problems are described in Section 5 and conclusions in the closing Section 6. Here we also hint at super-Turing computing power of potentially infinite sequences of finite families of nanomachine populations of growing size. The results mentioned in this paper are of a preliminary nature. This is due to a relative complexity of the model whose correct behavior depends on tuning the properties of its several cooperating parts (nanomachines and their timers, properties of signal molecules and those of the environment). Therefore, our results can be seen as a first exploration of possibilities offered by our approach.
2 Nanomachines: The Model of Embodied Self-reproducing Automata In the sequel we will focus on a scenario in which nanomachines form an autonomous system operating in a closed liquid environment without external control (a similar scenario has also been considered in [5]). The system consists of a finite number of nanomachines freely floating in their environment which is full of molecules of finite number of types. The nanomachines interact via molecular communication creating thus a kind of ad-hoc network. The machines can move in their environment either passively, due to the external forces (e.g., in a bloodstream), or actively, like some bacteria. The population of machines develops from a single machine that, thanks to its
Nanomachine Computing by Quorum Sensing
207
self-reproducing ability, multiplies until a sufficient number of machines is reached in a given volume. The number of machines is inferred from the density of signal molecules emitted by the machines that is measured by special sensors possessed by each machines. Once a sufficient density of machines is reached they start to communicate via a mechanism of quorum sensing, making use of various types of signal molecules. In this way the machines can perform coordinate actions such as, e.g., probabilistic simulation of computations of counter automata. Next we describe our model. Although its design has been inspired by existing phenomenon of bacterium quorum sensing in details the model certainly deviates substantially from biological reality. Namely, our aim has been investigation of conditions under which such a minimalist design as ours could work, exploiting similar principles as bacterium quorum sensing. Doing so, we in fact investigate the boundaries of what is possible providing thus, in a sense, a proof of principle, i.e., a confirmation that the proposed concept is vital and can serve as the first approach towards realization of such devices in the future. A creation of a self-replicating cell controlled by chemically synthesized genome has recently been reported by the renowned biologist V. Craig (cf.[3]). It appears that in order to make our model operate not only nanomachines, but also the properties of signal molecules, those of the entire environment and, in some cases, even those of its confines must be considered. Each nanomachine consists of two main components: there is its embodiment — the body, and its computational part. The embodiment of any nanomachine consists of a set of receptors and emitters (pores), internal sensors, a set of timers, a self-reproducing mechanism, random bit generator and possibly of other devices depending on the type of embodiment (e.g., locomotive organs in the form of flagella, cilia, etc.). Each receptor is specialized for detection of a specific type of molecules. These molecules find themselves in the environment surrounding the machine where they move chaotically obeying the Brownian motion. A molecule gets recognized only in the case when it enters into contact with the respective receptor. It is important for our further considerations to realize that the size of a real bacteria is of the order of a few micrometers (i.e., of thousandths of millimeter, 10−6 m) while the size of a molecule is of the order of nanometers (i.e., 10−9 m). Thus, a nanomachine is about 1000 times bigger than a molecule, and its surface and volume is still larger by a few orders of magnitude. Taking into account that a receptor is about of the same size as a molecule that has to be detected, then the probability that a signal molecule randomly contacts one of the corresponding sensors is large only in the case when the nanomachine readily floats in a sea of the respective molecules. Such a model of signal molecule detection is called stochastic contact model. For each type of molecules each nanomachine has at its disposal several tens of receptors; their exact number is irrelevant. Timers are internal mechanisms without any external input. Each timer is preset for a fixed time. Each timer returns either 0 or 1. A timer can be reset to 0 by the machine’s finite state control. Upon expiration of time for which the timer has been initially set the timer returns 1. Values to which the timers are preset depend on the type of
208
J. Wiedermann
a timer as well as on the properties of the environment (especially on its volume, but also on the properties of some molecules detected by the sensors — e.g., on the degradation time of the molecules). Timers of the same type are the same in all nanomachines. The self-reproducing mechanism is triggered by automaton entering a special reproducing state. In such a case the nanomachine splits into two identical copies of itself, with their finite control entering the initial state. The random bit generator is an “organ” that upon each activation returns either 0 or 1 with the same probability. The computational part of each nanomachine is created by a finite-state (Mealy) automaton whose actions are controlled by a transition function. In a single move each automaton reads its inputs obtained from its receptors and from other sensors or organs. Depending on these inputs and on its current state, the automaton issues instructions for the machine’s organs concerning their next actions: releasing the molecules from the receptors (or perhaps absorbing them for a further processing inside the body), secreting certain molecules via the pores (output ports), resetting the timers, and instructing its locomotive organs. Last but not least, the control enters a new (possibly a reproduction) state. A biomolecular realization of a finite state automaton has been described, e.g., in [1]. In molecular biology, there is a vast body of research dealing with biological oscillators and clocks controlling various biological processes in living bodies, and it is quite plausible that there also exists a realization of timing mechanisms. The nanomachines communicate with the help of various types of signal molecules in phases in which the environment is flooded by signal molecules of the same type. The end of one communication phase is determined by performing a successful quorum sensing measurement by each machine, meaning that all machines have accepted the same signal carried by signal molecules. Afterwards, the environment has to be cleared from the current signal molecules in order to enable its flooding by signal molecules of a different type. The clearance can be achieved in several ways. For instance, the machines can emit molecules that react with the original signal molecules and decompose them into non-signal molecules. The next possibility is to consider a cooperating envelope of the environment absorbing the useless signal molecules and recycling them into different molecules that can be useful for the machines (this is how kidneys or liver work). Yet another possibility is to consider signal molecules that decompose by themselves after a certain time. For definitiveness, in the sequel we will assume that the clearance mechanism is based on the disintegration property of signal molecules. The nanomachines work asynchronously but the speed of their internal working cycles is roughly the same. In order to synchronize the work of nanomachines on a global level a quorum sensing mechanism will be used. A multiset of identical nanomachines in an environment will be called a population of nanomachines.
3 Distributed Computing in Populations of Nanomachines In order to realize a distributed computation by means of nanomachines we will assume the following two phase scenario. In the first phase, a population of nanomachines will
Nanomachine Computing by Quorum Sensing
209
be raised from a single nanomachine. In the second phase, the population will simulate a computation of a counter automaton. 3.1 Raising a Population Initially, there exists but a single nanomachine in a closed environment of volume N called the leader. A nanomachine that is a leader keeps this information in its states. None of the offsprings of a leader can become a leader — in any population there is exactly one leader. Each nanomachine measures concentration of signal molecules in the environment. As long as concentration is too low, i.e., not all receptors report the presence of signal molecules of a given type, the machine releases the molecules from its receptors. Thereafter, it starts emitting a certain number of signal molecules of the same type. Denoting the volume of a nanomachine as V and the volume of a signal molecule as v, then the nanomachine at hand must produce a certain number of signal molecules that would approximatively fit into the nanomachine itself, i.e., approximatively V /v signal molecules (the reason for that will become clear in the sequel). The machine does not count the number of emitted molecules, it merely switches on a timer counting down as long as it is necessary for the machine to prepare and secret the necessary number of molecules. Afterwards the machine self-reproduces by fission into two identical machines and the entire process repeats itself. After a certain time the environment is flooded by signal molecules and their concentration is close to the maximum — the environment is saturated by signal molecules. Now in our stochastic contact model the probability that all receptors of each nanomachine detect a presence of signal molecules is close to one. If a measurement for a maximal concentration is successful then the respective machine stops reproducing itself and terminates further production of signal molecules. The remaining machines continue their reproduction and signal molecules secreting until all of them, after a successful concentration measurement, also stop — the quorum has been achieved. Assuming that the concentration of signal molecules is the same in any part of the environment the quorum is sensed by all machines almost simultaneously, or, to be more precise, within a certain short time period. Then the population growth will terminate — let us say, after g generations. Let n = N/V be the number of nanomachines at that time. Obviously, then there will be approximatively N/v signal molecules in the environment. During the growth of a population the machines in g generations produce about 2g V /v = N/v signals molecules; hence g = log n must hold. Theorem 1. Let N be the volume of a closed environment, let V be a volume of a nanomachine, let v be a volume of a signal molecule and let n = N/V. Then, with a great probability, the process of raising a population of nanomachines in a given environment will terminate in about g = log n generations. At that time there will be about n nanomachines and about N/v signal molecules in the environment. Note that a further multiplication of nanomachines under conditions as described above is not even possible, because the concentration of machines and signal molecules has approached its maximal possible value, and hence there is no longer room either for further machines, or for further signal molecules in the environment.
210
J. Wiedermann
3.2 Simulating a Counter Automaton As soon as the population reaches its maximal size the simulation can begin with the machines communicating via quorum sensing in a similar way as before. The details are as follows. The simulation proceeds in steps. Each step consists of two sub-phases. The first sub-phase is designated for clearing the environment of the previously generated signal molecules. In order to do so it is enough for the machines to wait for a sufficient time during which the signal molecules disintegrate. The necessary time is measured by a specialized timer in each machine. During this period the machines are idle. This waiting period must be long enough to cover the period in which the probability that all machines have sensed a quorum is close to one and also the necessary disintegration time. After that time, the machines “wake-up” again and start to react to the incoming signal molecules again. In the second sub-phase the leader starts broadcasting new signal molecules carrying the next signal for the machines. These signal molecules spread around similarly as in the previous case. The difference is that this time the machines do not multiply. Upon detecting a signal molecule each machine produces about V /v signal molecules of the same type as was the type of the detected signal molecule. Each machine does so until it senses a quorum. Such a machine stops producing further signal molecules and realizes the instruction corresponding to the type of the current signal molecules. The type of the signal molecules together with the state stored in the machine’s finite control determines uniquely one state transition. For instance, the machines enter a new state or read a random bit. Similarly as before, the quorum is sensed by all machines almost simultaneously, within a short period of time. Afterwards, the whole two-phase process repeats itself. The new signal is broadcast either by the leader or by the nanomachines sending a return signal to the leader. Now, for the sake of a counter automaton simulation, let us assume that each machine gets its input from the domain {0, 1} through its sensors; this input can be used in the subsequent collective data processing. Since we are working with the unary coding, only machines holding “1” are of interest. All other machines (holding “0”) are considered as holding an empty symbol. If the outputs from the machines are also restricted to the domain {0, 1}, then the respective population can be seen as a device computing functions with their inputs and outputs represented in unary. We show that a population of size O(n) can simulate a counter automaton with a constant number of counters each of size O(n), with a high probability. In order to simulate a counter automaton we need two things: (i) representation of its counters, and (ii) implementation of operations over those counters. Counters in a counter automaton represent natural numbers written in unary notation. In a population of nanomachines a counter C of size s is represented by exactly s nanomachines remembering in their states that they represent counter C. Basic operations over counters are testing a counter for zero (i.e., whether a counter is empty) and increasing or decreasing a counter by one. The latter operation can only be performed over non-empty counters.
Nanomachine Computing by Quorum Sensing
211
Testing a counter C for zero is realized as follows. The leader sends a signal asking whether there are nanomachines representing counter C in the population. In the positive case, in the second round the leader gets an answer from the respective machines. If there are no such machines no answer is obtained and, therefore, the counter is empty. Adding one to a counter is a two-phase operation. In the first phase, the leader chooses from the set of all “free” nanomachines (that do not represent any counter) one nanomachine, a so-called singleton. In the second phase, the state of the singleton is changed so as it becomes the member of the set of machines representing counter C. In the case of subtracting one from a counter we proceed in a similar way. The difference is that now the singleton is being sought in the set of machines representing C. Finding such a singleton its state is made different from the states of all other counters. For finding a singleton in set C a classical randomized algorithm known in the theory of distributed algorithms for selection of a single distinguished processor (i.e., a singleton) within a set of otherwise equal processors is used. The principle is as follows. The leader asks all the machines in set C to generate a random bit. Then it asks whether there exist machines having generated 1 and the machines having generated 0. In the positive case, when both subsets of machines are non-empty, the leader chooses randomly one of the two subsets, and the entire process is repeated with that subset. However, if the partition into two subsets has not succeeded, then there is a reasonable probability that the subset at hand already is a singleton set. This probability can be amplified be repeating the splitting attempts. The whole procedure is described in more details in [15]. Once a singleton has been selected the required operation over a counter can be realized. Theorem 2. A counter automaton with unary input of length n and with the total length S(n) ≥ n of its counters can be simulated by a nanomachine population of size O(S(n)) with an arbitrarily small probability of failure. The error probability of individual simulation steps can be controlled by changing the values of timers controlling the quorum sensing periods and disintegration times of signal molecules within the broadcasting algorithm. The longer the simulation the smaller the failure probability of individual steps must be chosen since the error probability of the entire simulation accumulates over the entire sequence of instructions. Note that counter machines are universal computing devices and hence the last claim states that a population of nanomachines can perform universal computations with a high probability. In practice, nobody would probably consider performing a universal computation by populations of nanomachines. Nevertheless, our result shows that such populations can, in principle, perform whatever computational task arising in a practical application.
4 Controlling Nanomachines via Circuits The transition function of a finite-state automaton controlling a nanomachine is of the form Σ a × Q → Σ b × Q, where Σ is a finite alphabet of (input and output) symbols and Q is a finite set of states. If this is the case, the automaton receives from it sensors,
212
J. Wiedermann
timers and other organs an a-tuple of signals and depending on its current state the automaton generates a new b-tuple of control signals for its effectors and enters a new state. The idea of getting rid of internal states is simple and in fact it copies the standard way of hardware realization of any finite state control. We add a read/write “memory organ” to each nanomachine in which the current state will be stored. The necessary information — current state — will be read from it similarly as it is the case with other organs. The other way round, a signal requesting to remember a new state can be sent to this organ. Thus, the respective signal will become a part of the control signals sent to the effectors. A memory organ can be realized in many ways, within the framework of biological nanomachines most probably in a biochemical manner. Formally, the act of getting rid of the states can be seen as if we would have added the set of states to the alphabet of input and output symbols. If Σ ∩ Q = ∅ and |Q| = c, then the resulting circuit should realize a mapping Σ a+c → Σ b+c . Such a circuit can be realized by constant depth circuits with the bounded fan-in and fan-out, i.e., within the class of NC0 circuits. A similar outsourcing technique, i.e., remembering internal states via positions of the input head on an additional input tape, has also been used in [6] in case of multihead automata. In that case, the role of the memory organ has been played by an additional input tape.
5 Open Problems The goal of our efforts has been to verify whether it is, at least in principle, possible that populations of nanomachines could possess a universal computing power, and under what conditions this can happen. The universality requirement is a very strong claim, asking, among other things, a flawless realization of a sequence of operations for the success of which it is of utmost importance to reach each member of the population. This leads to the assumption of the maximal concentration of signal molecules or to the necessity of exploiting probabilistic amplification techniques in order to diminish the probability of failure. It is important to realize that the repeated production of maximal amount of signal molecules is very demanding from the energy point of view. Namely, from that viewpoint, producing an amount of molecules whose volume equals the volume of a nanomachine is comparable to the energy consumption necessary for a machine to self-reproduce. It is also a time- consuming process, although perhaps not too slow as one might expect. For instance, Escherichia coli bacteria divide once in 20 minutes [4]. The previous considerations suggest then one should perhaps look for more energy– and time–efficient strategies for synchronizing behavior of populations of nanomachines. The quorum sensing described in the cell biology speaks about reaching a certain threshold concentration of signal molecules that can trigger collective response. However, it seems that reaching only a certain threshold concentration — not a maximal one as in our case — cannot guarantee that the signal will reach every nanomachine with a high probability. Perhaps other probabilistic algorithms exist that can perform a universal computation based on quorum sensing with a lower threshold than in our case. Investigation of such approaches is the subject of the author’s current research.
Nanomachine Computing by Quorum Sensing
213
An interesting option for increasing the probability of a receptor capturing a signal molecule is to make use of electro-static forces attracting signal molecules to a receptor. Nevertheless, the author was not able to find any reference to such properties of signal molecules in the literature on quorum sensing. In this context, it is perhaps interesting to note that the broadcast protocol described in [15] works with much lower concentrations of signal molecules than described in the present paper. This is achieved at the expense of a more complicated design of the respective broadcast protocol. It is not entirely clear whether the approach taken in the lastly mentioned paper can also be seen as an instance of quorum sensing. Another possibility how to make the quorum sensing approach more efficient is to investigate computational tasks for the fulfillment of which it is enough to work only with the majority of a population. As an example, a task of identification and destruction of an enemy population of nanomachines can serve. This is a typical task performed by immune systems. In cases like this it might suffice to destroy a majority of the populations, and this need not happen in a synchronized way as it was necessary in the case of simulating a computation. The rest of the enemy population might be no longer survival-fit. It seems that for similar purposes a partial quorum sensing, leading to a cooperation of only a majority of population, could do. Generalizing, it might be of interest to define and investigate classes of computational problems for which the previous “majority approach” will work. The approach presented in this paper is an example of a kind of non-standard computing that can perhaps be termed as embodied nanocomputing. Such kind of computing differs from the classical models of computation almost in every aspect. The individual computational units have minimal computational power, they communicate via a random ad-hoc network with a continuously changeable topology, they must be able to produce and sense the respective communication signals that are of material nature, the units must have the ability to multiply and ideally, they are independent of external energy supply. In many aspects they remind of autonomous nano-robots or, indeed, the real bacteria. Moreover, the environment in which the units work must be in a certain sense cooperative (e.g., it must provide “free” services of message delivery, such as spreading of signal molecules by advection or Brownian motion, environment clearance from certain molecules, or energy supply in the form of nutrition). Last but not least, the communication carriers — the signal molecules — are produced by the units themselves and are “tailored” to the computational needs of the units. Not only the signal molecules carry the messages, they also disintegrate after fulfilling their mission. So far we have not enough understanding of embodied nanocomputing. More research is needed in order to get more insight into the respective models and to exploit their full potential.
6 Conclusions Our main result has been the proof of probabilistic computational universality of nanomachine populations. From the viewpoint of the computational complexity theory, the underlying computational model is a non-uniform model. The reason is that in order to simulate a counter automaton some parameters of the model, especially time-setting of
214
J. Wiedermann
timers and disintegration time of molecules must be adjusted to the volume of the environment. The environment itself must be big enough to accommodate a sufficient number of nanomachines. It is interesting to observe that practically all contemporary computing systems, be it natural or artificial ones, from the Internet to amorphous computing systems, from bacteria to the brain, can be modeled as non-uniform computational systems which in principle possess super-Turing computing power (cf. [12], [13]). It appears that the population of nanomachines controlled by circuits probably presents a universal amorphous computing system whose activity is governed by the simplest computing devices. This is of importance for the future practice when similar nanomachines as we have modeled will be fabricated. Of course, the main deployment of nanomachines is expected in various single-purpose applications which, as expected by some influential thinkers, can change our future in a significant way (cf. [7]). From the robotic viewpoint, our results suggest that for the nanomachines whatever algorithmic task is, in principle, feasible.
References 1. Adar, R., Benenson, Y., Linshiz, G., Rozner, A., Tishby, N., Shapiro, E.: Stochastic computing with biomolecular automata. Proc. Natl. Acad. Sci. USA 101, 9960–9965 (2004) 2. Bernardini, F., Gheorghe, M., Krasnogor, N.: Quorum sensing P systems. Theoretical Computer Science 371(1–2), 20–33 (2007) 3. Craig, V.: First Self-Replicating Synthetic Bacterial Cell. JCVI Press Release (May 2010), http://www.jcvi.org 4. Fussenegger, M.: Synchronized Bacterial Clocks. Nature 463, 301–302 (2010) 5. Hiyama, S., Moritani, Y., Suda, T., Egashira, R., Enomoto, A., Moore, M., Nakano, T.: Molecular Communication. In: Proc. of the 2005 NSTI Nanotechnology Conference (2005) 6. Ibarra, O.H., Karhum¨aki, J., Okhotin, A.: On stateless multihead automata: Hierarchies and the emptiness problem. Theor. Comput. Sci. 411(3), 581–593 (2010) 7. Kurzweil, R.: The Singularity is Near, p. 652. Viking Books (2005) 8. Minsky, M.: Computation: Finite and Infinite Machines. Prentice-Hall, Englewood Cliffs (1967) 9. Petr˚u, L.: Universality in Amorphous Computing. PhD Dissertation Thesis, Dept. of Math. and Physics, Charles University, Prague (2009) 10. Romero-Campero, F.J., Prez-Jimnez, M.J.: A model of the quorum sensing system in Vibrio fischeri using P-systems. Artificial Life 14(1), 95–109 (2008) 11. Terrazas, G., Krasnogor, N., Gheorghe, M., Bernardini, F., Diggle, S., C´amara, M.: An environment aware P-system model of quorum sensing. In: Cooper, S.B., L¨owe, B., Torenvliet, L. (eds.) CiE 2005. LNCS, vol. 3526, pp. 479–485. Springer, Heidelberg (2005) 12. van Leeuwen, J., Wiedermann, J.: The Turing machine paradigm in contemporary computing. In: Enquist, B., Schmidt, W. (eds.) Mathematics Unlimited — 2001 and Beyond, pp. 1139–1155. Springer, Berlin (2001) 13. Wiedermann, J., van Leeuwen, J.: How We Think of Computing Today (Invited Talk). In: Beckmann, A., Dimitracopoulos, C., L¨owe, B. (eds.) CiE 2008. LNCS, vol. 5028, pp. 579– 593. Springer, Heidelberg (2008) 14. Wiedermann, J., Petr˚u, L.: Computability in Amorphous Structures. In: Cooper, S.B., L¨owe, B., Sorbi, A. (eds.) CiE 2007. LNCS, vol. 4497, pp. 781–790. Springer, Heidelberg (2007)
Nanomachine Computing by Quorum Sensing
215
15. Wiedermann, J., Petr˚u, L.: Communicating Mobile Nano-Machines and Their Computational Power. In: Cheng, M. (ed.) NanoNet 2008. Lecture Notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering, vol. 3, pp. 123–130. Springer, Heidelberg (2009) 16. Wiedermann, J., Petr˚u, L.: On the Universal Computing Power of Amorphous Computing Systems. Theory of Computing Systems 46(4), 995–1010 (2009), http://www.springerlink.com/content/k2x6266k78274m05/ fulltext.pdf 17. Wiley-Blackwell: Bacterial Quorum Sensing: A Matter Of Density, Not Quantity. ScienceDaily (July 21, 2009), http://www.sciencedaily.com/releases/2009/07/090710101452.htm 18. Yang, L., Dang, Z., Ibarra, O.H.: On stateless automata and P systems. International Journal of Foundations of Computer Science 19(4), 1259–1276 (2008)
Author Index
Aman, Bogdan
138
Labella, Anna
B¨ ockenhauer, Hans-Joachim Bottoni, Paolo 24 Brijder, Robert 191
7
Ceterchi, Rodica 151 Cienciala, Ludˇek 158 Ciencialov´ a, Lucie 158 Ciobanu, Gabriel 138 Csuhaj-Varj´ u, Erzs´ebet 57, 70 Ehrenfeucht, Andrzej
191
Fernau, Henning 90 Freund, Rudolf 35 Gramatovici, Radu
24
Holzer, Markus 70 Hromkoviˇc, Juraj 7 Kelemenov´ a, Alica 107 Kogler, Marian 35
24
Manca, Vincenzo 16 Manea, Florin 24 Marcus, Solomon 1 Mitrana, Victor 24 Oswald, Marion
35
Rozenberg, Grzegorz
191
Salomaa, Arto 181 Sos´ık, Petr 125 Sprock, Andreas 7 Stiebe, Ralf 90 ter Beek, Maurice H. 70 Tomescu, Alexandru I. 151 Vaszil, Gy¨ orgy 70, 170 ˇ arka 107 Vavreˇckov´ a, S´ Wiedermann, Jiˇr´ı
203