Lecture Notes in Computer Science Edited by G. Goos, J. Hartmanis, and J. van Leeuwen
2747
3
Berlin Heidelberg New York Hong Kong London Milan Paris Tokyo
Branislav Rovan
Peter Vojt´asˇ (Eds.)
Mathematical Foundations of Computer Science 2003 28th International Symposium, MFCS 2003 Bratislava, Slovakia, August 25-29, 2003 Proceedings
13
Series Editors Gerhard Goos, Karlsruhe University, Germany Juris Hartmanis, Cornell University, NY, USA Jan van Leeuwen, Utrecht University, The Netherlands Volume Editors Branislav Rovan Comenius University Department of Computer Science 84248 Bratislava, Slovakia E-mail:
[email protected] Peter Vojt´asˇ ˇ arik University P.J. Saf´ Department of Computer Science, Faculty of Science Jesenn´a 5, 04154 Koˇsice, Slovakia E-mail:
[email protected]
Cataloging-in-Publication Data applied for A catalog record for this book is available from the Library of Congress Bibliographic information published by Die Deutsche Bibliothek Die Deutsche Bibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data is available in the Internet at
.
CR Subject Classification (1998): F., G.2, D.3, I.3, E.1 ISSN 0302-9743 ISBN 3-540-40671-9 Springer-Verlag Berlin Heidelberg New York 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-Verlag. Violations are liable for prosecution under the German Copyright Law. Springer-Verlag Berlin Heidelberg New York a member of BertelsmannSpringer Science+Business Media GmbH http://www.springer.de © Springer-Verlag Berlin Heidelberg 2003 Printed in Germany Typesetting: Camera-ready by author, data conversion by Olgun Computergrafik Printed on acid-free paper SPIN 10929285 06/3142 543210
Preface
This volume contains papers selected for presentation at the 28th Symposium on Mathematical Foundations of Computer Science – MFCS 2003, held in Bratislava, Slovakia, August 25–29, 2003. MFCS 2003 was organized by the Slovak Society for Computer Science and the Comenius University in Bratislava, in cooperation with other institutions in Slovakia. It was supported by the European Association for Theoretical Computer Science and the Slovak Research Consortium for Informatics and Mathematics. The series of MFCS symposia, organized alternately in the Czech Republic, Poland and Slovakia since 1972, has a well-established tradition. The MFCS symposia encourage high-quality research in all branches of theoretical computer science. Their broad scope provides an opportunity to bring together specialists who do not usually meet at specialized conferences. The previous meetings took place ˇ in Jablonna, 1972; Strbsk´ e Pleso, 1973; Jadwisin, 1974; Mari´ ansk´e L´aznˇe, 1975; Gda` nsk, 1976; Tatransk´ a Lomnica, 1977; Zakopane, 1978; Olomouc, 1979; Ryˇ dzina, 1980; Strbsk´ e Pleso, 1981; Prague, 1984; Bratislava, 1986; Carlsbad, 1988; Por¸abka-Kozubnik, 1989; Bansk´ a Bystrica, 1990; Kazimierz Dolny, 1991; Prague, 1992; Gda` nsk, 1993, Koˇsice, 1994; Prague, 1995; Krak´ow, 1996; Bratislava, 1997; Brno, 1998; Szklarska Por¸eba, 1999; Bratislava, 2000; Mari´ansk´e L´aznˇe, 2001; and Warsaw-Otwock, 2002. The MFCS 2003 Proceedings consists of 7 invited papers and 55 contributed papers. The latter were selected by the Program Committee from a total of 137 submitted papers. The following program committee members took part in the evaluation and selection of submitted papers (those denoted by ∗ took part in the selection meeting in Bratislava on May 10, 2003): Julian Bradfield∗ (Edinburgh), J´ anos Csirik (Szeged), Pierpaolo Degano (Pisa), Mariangiola Dezani-Ciancaglini∗ (Torino), Krzysztof Diks (Warsaw), Juhani Karhum¨ aki∗ (Turku), Marek Karpinski (Bonn), Mojm´ır Kˇret´ınsk´ y∗ (Brno), Werner Kuich (Vienna), Jan van Leeuwen (Utrecht), Christoph Meinel (Trier), Leszek Pacholski (Wroclaw), David Peleg∗ (Rehovot), Jos´e D.P. Rolim (Geneˇıma∗ va), Branislav Rovan∗ (Bratislava, Chair ), Jan Rutten (Amsterdam), Jiˇr´ı S´ (Prague), Paul Spirakis∗ (Patras), Ulrich Ultes-Nitsche (Fribourg), Peter Vojt´ aˇs∗ (Koˇsice, Vice-chair ), and Igor Walukiewicz (Bordeaux). We would like to thank all Program Committee members for their meritorious work in evaluating the submitted papers, as well as the following referees who assisted the Program Committee members: F. Ablayev, L. Aceto, C.J. van Alten, A. Ambainis, G. Andrejkov´ a, M. Andreou, F. Arbab, V. Auletta, S. Bala, F. Bartels, M. Bellia, Y. Benenson, L. Bertossi, B. Blanchet, N. Blum, H.L. Bodlaender, F.S. de Boer, M. Bojanczyk, M.M. Bonsangue, M. Boreale, A. Bucciarelli, H. Buhrman, C. Busch, ˇ ˇ R. Cada, O. Carton, I. Cern´ a, B. Chlebus, P. Chrzastowski-Wachtel, K. Ciebiera,
VI
Preface
A. Condon, F. Corradini, B. Courcelle, P. Crescenzi, M. Crochemore, A. Czumaj, C. Damm, J. Dassow, A. Di Pierro, V. Diekert, S. Dziembowski, P. Eli´ aˇs, L. Epstein, K. Etessami, E. Fachini, S. Fedin, M. Fellows, P. Flajolet, L. Fortnow, D. Fotakis, F. Franˇek, M.P. Frank, R. Freund, S. Fr¨ oschle, S. Fujita, Z. F¨ ul¨ op, F. Gadducci, G. Galbiati, A. Gambin, V. Geffert, R. Gennaro, M. GhasemZadeh, K. Golab, R. Govindan, G. Gramlich, S. Gruner, K. Grygiel, V. Halava, T. Harju, T. Hartman, M. Hauptmann, L.A. Hemaspaandra, M. Hermann, P. Hertling, E.A. Hirsch, M. Hirvensalo, J. Honkala, C.S. Iliopoulos, S. Irani, R. Irving, G.F. Italiano, P. Janˇcar, K. Jansen, G. Jir´ askov´a, J. Kari, D. Kavvadias, C. Kenyon, L. Kirousis, V. Klotz, G. Kortsarz, V. Koubek, O. Koval, L . Kowalik, D. Kowalski, S. Krajˇci, J. Kratochv´ıl, M. Krause, V. Kreinovich, A. Kuˇcera (Brno), A. Kuˇcera (Prague), M. Kufleitner, A. Kulikov, M. Kunc, C. Kupke, P. K˚ urka, M. Kurowski, S. Lasota, R. Lencses, M. Lenisa, S. Leonardi, M. Lewenstein, C. Lhoussaine, U. de’Liguoro, L. Liquori, M. Li´skiewicz, J. Longley, M. Loreti, Z. Lotker, A. de Luca, B. Luttik, M. Maidl, Ch. Makris, A. Malinowski, A. Marchetti-Spaccamela, B. Martin, J. Matouˇsek, G. Mauri, M. Mavronicolas, F. Mera, F. Meyer auf der Heide, M. Mlotkowski, B. Monien, F. de Montgolfier, K. Morita, Ph. Moser, F. Mr´ az, M. Mucha, R. Neruda, R. Niedermeier, S. Nikoletseas, D. Niwinski, D. Nowotka, D. Oddoux, D. von Oheimb, V. van Oostrom, B. Palano, A. Panholzer, V. Papadopoulou, L. Parida, R. Paturi, G. Paun, R. Pel´ anek, A. Pelc, J. Pelik´ an, P. Penna, E. Petre, J.ˇ Porubsk´ E. Pin, W. Plandowski, M. Ploˇsˇcica, E. Porat, S. y, O. Powell, J. Power, ˇ ak, M. Repick´ M. Przybylski, P. Pudl´ ak, F. van Raamsdonk, V. Reh´ y, P. Rychlikowski, W. Rytter, P. Sankowski, V. Sassone, P. Savick´ y, Ch. Scheideler, V. Schillings, U. Sch¨ oning, N. Schweikardt, G. Semaniˇsin, M. Serna, J. Sgall, ˇ R. Silvestri, L. Skarvada, R. Solis-Oba, D. Sonowska, P. Sos´ık, D. Spielman, ˇ edr´ S. St James, I. Stark, A. Stˇ y, C. Stirling, J. Strejˇcek, T. Suel, G. Sutre, L . Sznuk, L. Tendera, Sh.-H. Teng, P. Tesson, D. Th´erien, W. Thomas, L. Trevisan, E. Tronci, T. Truderung, U. Vaccaro, M.Y. Vardi, F.-J. de Vries, T. Wale´ n, D. Walukiewicz-Chrzaszcz, I. Wegener, P. Weil, D. West, M. Westermann, ˇ ak, P. Widmayer, Th. Wilke, Th. Worsch, InSeon Yoo, Sh. Yu, R. Yuster, S. Z´ M. Zawadowski, H. Zhang, T. Zwissig. EATCS offered a Best Student Paper Award for the best paper submitted to MFCS and authored solely by students. The Program Committee decided to give this award in 2003 to Gregor Gramlich (Institut f¨ ur Informatik, Johann Wolfgang G¨ othe-Universit¨ at, Frankfurt) for his paper “Probabilistic and Nondeterministic Unary Automata.” As the editors of these proceedings, we are much indebted to all contributors to the scientific program of the symposium, especially to the authors of papers. Special thanks go to those authors who prepared the manuscripts according to the instructions and made life easier for us. We would also like to thank those who responded promptly to our requests for minor modifications and corrections in their manuscript. The database and electronic support system for the Program Committee was designed by Miroslav Chladn´ y who, together with Miroslav Zervan, made everything run smoothly. Our special thanks go to Miroslav Chladn´ y
Preface
VII
for most of the hard technical work in preparing this volume. We are also thankful to the members of the Organizing Committee who made sure that the conference ran smoothly in a pleasant environment. Last, but not least, we want to thank Springer-Verlag for excellent co-operation in the publication of this volume.
Bratislava, June 2003
Branislav Rovan Peter Vojt´ aˇs
VIII
Preface
Organized by Slovak Society for Computer Science Faculty of Mathematics, Physics and Informatics, Comenius University, Bratislava
Supported by European Association for Theoretical Computer Science Slovak Research Consortium for Informatics and Mathematics
Program Committee
Julian Bradfield (Edinburgh), J´ anos Csirik (Szeged), Pierpaolo Degano (Pisa), Mariangiola Dezani-Ciancaglini (Torino), Krzysztof Diks (Warsaw), Juhani Karhum¨ aki (Turku), Marek Karpinski (Bonn), Mojm´ır Kˇret´ınsk´ y (Brno), Werner Kuich (Vienna), Jan van Leeuwen (Utrecht), Christoph Meinel (Trier), Leszek Pacholski (Wroclaw), David Peleg (Rehovot), Jos´e D.P. Rolim (Geneva), ˇıma Branislav Rovan (Bratislava, Chair ), Jan Rutten (Amsterdam), Jiˇr´ı S´ (Prague), Paul Spirakis (Patras), Ulrich Ultes-Nitsche (Fribourg), Peter Vojt´ aˇs (Koˇsice, Vice-chair ), and Igor Walukiewicz (Bordeaux)
Organizing Committee Miroslav Chladn´ y, Vanda Hamb´ alkov´ a, Rastislav Kr´ aloviˇc, Zuzana Kubincov´ a, Marek Nagy, Martin Neh´ez, Dana Pardubsk´ a (Chair ), Edita Riˇc´anyov´ a, Branislav Rovan, Miroslav Zervan
Table of Contents
Invited Talks Distributed Quantum Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Harry Buhrman and Hein R¨ ohrig
1
Selfish Routing in Non-cooperative Networks: A Survey . . . . . . . . . . . . . . . . 21 R. Feldmann, M. Gairing, Thomas L¨ ucking, Burkhard Monien, and Manuel Rode Process Algebraic Frameworks for the Specification and Analysis of Cryptographic Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Roberto Gorrieri and Fabio Martinelli Semantic and Syntactic Approaches to Simulation Relations . . . . . . . . . . . . . 68 Jo Hannay, Shin-ya Katsumata, and Donald Sannella On the Computational Complexity of Conservative Computing . . . . . . . . . . 92 Giancarlo Mauri and Alberto Leporati Constructing Infinite Graphs with a Decidable MSO-Theory . . . . . . . . . . . . . 113 Wolfgang Thomas Towards a Theory of Randomized Search Heuristics . . . . . . . . . . . . . . . . . . . . 125 Ingo Wegener
Contributed Papers Adversarial Models for Priority-Based Networks . . . . . . . . . . . . . . . . . . . . . . . 142 ` C. Alvarez, M. Blesa, J. D´ıaz, A. Fern´ andez, and M. Serna On Optimal Merging Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Kazuyuki Amano and Akira Maruoka Problems which Cannot Be Reduced to Any Proper Subproblems . . . . . . . . 162 Klaus Ambos-Spies ACID-Unification Is NEXPTIME-Decidable . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch Completeness in Differential Approximation Classes . . . . . . . . . . . . . . . . . . . . 179 G. Ausiello, C. Bazgan, M. Demange, and V. Th. Paschos On the Length of the Minimum Solution of Word Equations in One Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Kensuke Baba, Satoshi Tsuruta, Ayumi Shinohara, and Masayuki Takeda
X
Table of Contents
Smoothed Analysis of Three Combinatorial Problems . . . . . . . . . . . . . . . . . . . 198 Cyril Banderier, Ren´e Beier, and Kurt Mehlhorn Inferring Strings from Graphs and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Hideo Bannai, Shunsuke Inenaga, Ayumi Shinohara, and Masayuki Takeda Faster Algorithms for k-Medians in Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Robert Benkoczi, Binay Bhattacharya, Marek Chrobak, Lawrence L. Larmore, and Wojciech Rytter Periodicity and Transitivity for Cellular Automata in Besicovitch Topologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 F. Blanchard, J. Cervelle, and E. Formenti Starting with Nondeterminism: The Systematic Derivation of Linear-Time Graph Layout Algorithms . . . . 239 Hans L. Bodlaender, Michael R. Fellows, and Dimitrios M. Thilikos Error-Bounded Probabilistic Computations between MA and AM . . . . . . . . 249 Elmar B¨ ohler, Christian Glaßer, and Daniel Meister A Faster FPT Algorithm for Finding Spanning Trees with Many Leaves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Paul S. Bonsma, Tobias Brueggemann, and Gerhard J. Woeginger Symbolic Analysis of Crypto-Protocols Based on Modular Exponentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Michele Boreale and Maria Grazia Buscemi Denotational Testing Semantics in Coinductive Form . . . . . . . . . . . . . . . . . . . 279 Michele Boreale and Fabio Gadducci Lower Bounds for General Graph–Driven Read–Once Parity Branching Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Henrik Brosenne, Matthias Homeister, and Stephan Waack The Minimal Graph Model of Lambda Calculus . . . . . . . . . . . . . . . . . . . . . . . . 300 Antonio Bucciarelli and Antonino Salibra Unambiguous Automata on Bi-infinite Words . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Olivier Carton Relating Hierarchy of Temporal Properties to Model Checking . . . . . . . . . . . 318 ˇ a and Radek Pel´ Ivana Cern´ anek Arithmetic Constant-Depth Circuit Complexity Classes . . . . . . . . . . . . . . . . . 328 Hubie Chen
Table of Contents
XI
Inverse NP Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Hubie Chen A Linear-Time Algorithm for 7-Coloring 1-Planar Graphs . . . . . . . . . . . . . . . 348 Zhi-Zhong Chen and Mitsuharu Kouno Generalized Satisfiability with Limited Occurrences per Variable: A Study through Delta-Matroid Parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Victor Dalmau and Daniel K. Ford Randomized Algorithms for Determining the Majority on Graphs . . . . . . . . 368 Gianluca De Marco and Andrzej Pelc Using Transitive–Closure Logic for Deciding Linear Properties of Monoids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 Christian Delhomm´e, Teodor Knapik, and D. Gnanaraj Thomas Linear-Time Computation of Local Periods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 Jean-Pierre Duval, Roman Kolpakov, Gregory Kucherov, Thierry Lecroq, and Arnaud Lefebvre Two Dimensional Packing: The Power of Rotation . . . . . . . . . . . . . . . . . . . . . 398 Leah Epstein Approximation Schemes for the Min-Max Starting Time Problem . . . . . . . . 408 Leah Epstein and Tamir Tassa Quantum Testers for Hidden Group Properties . . . . . . . . . . . . . . . . . . . . . . . . 419 Katalin Friedl, Fr´ed´eric Magniez, Miklos Santha, and Pranab Sen Local LTL with Past Constants Is Expressively Complete for Mazurkiewicz Traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 Paul Gastin, Madhavan Mukund, and K. Narayan Kumar LTL with Past and Two-Way Very-Weak Alternating Automata . . . . . . . . . 439 Paul Gastin and Denis Oddoux Match-Bounded String Rewriting Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Alfons Geser, Dieter Hofbauer, and Johannes Waldmann Probabilistic and Nondeterministic Unary Automata . . . . . . . . . . . . . . . . . . . 460 Gregor Gramlich On Matroid Properties Definable in the MSO Logic . . . . . . . . . . . . . . . . . . . . 470 Petr Hlinˇen´y Characterizations of Catalytic Membrane Computing Systems . . . . . . . . . . . 480 Oscar H. Ibarra, Zhe Dang, Omer Egecioglu, and Gaurav Saxena
XII
Table of Contents
Augmenting Local Edge-Connectivity between Vertices and Vertex Subsets in Undirected Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Toshimasa Ishii and Masayuki Hagiwara Scheduling and Traffic Allocation for Tasks with Bounded Splittability . . . . 500 Piotr Krysta, Peter Sanders, and Berthold V¨ ocking Computing Average Value in Ad Hoc Networks . . . . . . . . . . . . . . . . . . . . . . . . 511 Miroslaw Kutylowski and Daniel Letkiewicz A Polynomial-Time Algorithm for Deciding True Concurrency Equivalences of Basic Parallel Processes . . . 521 Slawomir Lasota Solving the Sabotage Game Is PSPACE-Hard . . . . . . . . . . . . . . . . . . . . . . . . . 531 Christof L¨ oding and Philipp Rohde The Approximate Well-Founded Semantics for Logic Programs with Uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 Yann Loyer and Umberto Straccia Which Is the Worst-Case Nash Equilibrium? . . . . . . . . . . . . . . . . . . . . . . . . . . 551 Thomas L¨ ucking, Marios Mavronicolas, Burkhard Monien, Manuel Rode, Paul Spirakis, and Imrich Vrto A Unique Decomposition Theorem for Ordered Monoids with Applications in Process Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562 Bas Luttik Generic Algorithms for the Generation of Combinatorial Objects . . . . . . . . . 572 Conrado Mart´ınez and Xavier Molinero On the Complexity of Some Problems in Interval Arithmetic . . . . . . . . . . . . 582 K. Meer An Abduction-Based Method for Index Relaxation in Taxonomy-Based Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 Carlo Meghini, Yannis Tzitzikas, and Nicolas Spyratos On Selection Functions that Do Not Preserve Normality . . . . . . . . . . . . . . . . 602 Wolfgang Merkle and Jan Reimann On Converting CNF to DNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 Peter Bro Miltersen, Jaikumar Radhakrishnan, and Ingo Wegener A Basis of Tiling Motifs for Generating Repeated Patterns and Its Complexity for Higher Quorum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 N. Pisanti, M. Crochemore, R. Grossi, and M.-F. Sagot
Table of Contents
XIII
On the Complexity of Some Equivalence Problems for Propositional Calculi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 Steffen Reith Quantified Mu-Calculus for Control Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . 642 St´ephane Riedweg and Sophie Pinchinat On Probabilistic Quantified Satisfiability Games . . . . . . . . . . . . . . . . . . . . . . . 652 Marcin Rychlik A Completeness Property of Wilke’s Tree Algebras . . . . . . . . . . . . . . . . . . . . . 662 Saeed Salehi Symbolic Topological Sorting with OBDDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 Philipp Woelfel Ershov’s Hierarchy of Real Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 Xizhong Zheng, Robert Rettinger, and Romain Gengler
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Distributed Quantum Computing Harry Buhrman and Hein R¨ ohrig Centrum voor Wiskunde en Informatica (CWI) P.O. Box 94079, 1090 GB Amsterdam, The Netherlands [email protected], [email protected]
Abstract. Quantum computing combines the framework of quantum mechanics with that of computer science. In this paper we give a short introduction to quantum computing and survey the results in the area of distributed quantum computing and its applications to physics.
1
Introduction
Computing is a physical process and therefore the theory of computing should incorporate the laws of physics. Quantum mechanics, developed during the last century, is to date the most accurate description of nature. Quantum computing is the area that combines the laws of quantum mechanics with computer science. In this paper we give a short introduction to quantum computing and its formalism; for a more detailed treatment of this we refer the reader to the excellent textbook of Nielsen and Chuang [46]. Quantum bits or “qubits” are the basic building blocks for quantum computers. As was shown already in the seventies by Holevo [30], qubits cannot be used to compress messages better than with bits. In general, a k-bit message needs also k qubits to be stored or sent over a channel. Qubits can, however, reduce the communication of certain distributed computational tasks, as was first demonstrated in [22] and subsequent papers, among them [17,23,21,48,7]. We survey some of these results here. The first result of a cheaper quantum than classical communication protocol [22] was inspired by nonlocality experiments constructed by physicist in order to test the strange and nonlocal behavior of entanglement. In 1935, Einstein, Podolsky, and Rosen devised a thought experiment that sought to show how quantum mechanics is incomplete because it would allow for some form of faster-than-light communication. Much later, in 1964, Bell [10] came up with an experimental way of testing the nonlocal behavior of quantum mechanics. These tests and the so-called Bell inequalities lead to experiments [9], that seem to demonstrate the nonlocality of quantum mechanics. However, these tests suffered from the drawback that implementations in the lab are error prone and sometimes do not give the right outcome or none at all. When the classical local theory is also allowed to make such errors, it can be shown that the nonlocality tests can also be explained by classical
Supported in part by the EU fifth framework project RESQ, IST-2001-37559, and NWO grant 612.055.001.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 1–20, 2003. c Springer-Verlag Berlin Heidelberg 2003
2
Harry Buhrman and Hein R¨ ohrig
physics, and do not demonstrate the nonlocal behavior of quantum mechanics at all! In this paper we survey how the results obtained in quantum communication complexity can be used to propose nonlocality experiments that are robust against errors and would for the first time demonstrate conclusively nonlocality. The paper is organized as follows. In Sect. 2 we give a short introduction to quantum mechanics and the notation used in this paper. In Sect. 3 we describe the quantum analogue of the black-box model of computation and describe one of the first quantum algorithms, due to Deutsch and Jozsa. Section 4 surveys some of the results in distributed computing.
2
Quantum Mechanics and Computing
One of the main and very counterintuitive features of quantum mechanics is the superposition principle. A physical system may be in a superposition of two or more different states at the same time. Quantum mechanics prescribes that when we observe such a system we see one of these states with a certain probability resulting in a collapse of the system into the state that we observed. 2.1
Qubits, Superposition, and Measurement
Let us concentrate now to computation. Classically a bit can be in any of two states: 0 or 1. Quantum mechanically a quantum bit or qubit may be in a superposition of both 0 and 1. It is useful to describe such systems as vectors in a finite-dimensional Hilbert space, in this case a two-dimensional one. We 1 will identify the vector with the symbol |0 to denote the classical bit 0 0 0 and vector with the symbol |1 denoting the classical bit 1. This notation 1 is called Dirac or “ket” notation, from “bra-ket.” The “bra” is | and a|b denotes the inner product between a and b. Quantum mechanics now allows for a superposition of these two classical states: α α|0 + β|1 = , (1) β where α and β, called amplitudes, are complex numbers with the property that |α|2 + |β|2 = 1 .
(2)
Next, observing or measuring a qubit α|0 + β|1 will yield outcome 0 with probability |α|2 and 1 with probability |β|2 . Moreover, after this measurement the qubit is either in the classical state |0 if we measured a 0, and in |1 if we measured a 1. Note that equation (2) guarantees that a qubit, when measured, indeed induces a probability distribution over 0 and 1. Let us try to plug in some values for α and β: 1 1 √ |0 + √ |1 2 2
(3)
Distributed Quantum Computing
3
Observing this qubit will result with probability 0.5 in seeing a 0 and with probability 0.5 in a 1. In general, our system will consist of more than just one qubit. Equations (1) and (2) generalize in the obvious way. Suppose we want to model k qubits. Classically k bits can be in any of 2k different configurations: 1 . . . 2k . This means that k qubits can be in a superposition of all (or part) of these 2k basis states: k
k
α1 |00 . . . 0 + . . . + α2k |11 . . . 1 =
αi |i
(4)
i∈{0,1}k
with the additional requirement that
|αi |2 = 1 .
(5)
i∈{0,1}k
When observing these k qubits we will see i with probability |αi |2 . If we have two qubits |x = α0 |0+α1 |1 and |y = β0 |0+β1 |1 then |x⊗|y are the two qubits in a four-dimensional Hilbert space. This construction is called the tensor or Kronecker product: |x ⊗ |y = (α0 |0 + α1 |1) ⊗ (β0 |0 + β1 |1) = α0 β0 |00 + α0 β1 |01 + α1 β0 |10 + α1 β1 |11. By convention, |0 ⊗ |0, |0|0, and |00 denote the same thing. In general not all the two-qubit states that satisfy (4) and (5) are obtained as the tensor of two qubits. We will see an important example, the EPR pair, in Subsect. 2.3. Such states are called entangled. 2.2
Unitary Operations
Next we would like to model operations on qubits. Quantum mechanics tells us that these operation have to be modeled as linear operations with the additional constraint that these operations preserve the probability interpretation, i.e., the squares of the amplitudes sum up to 1 (see (2) and (5)). Such transformations are called unitary; they are the square matrices U that satisfy UU∗ = I , where U ∗ is the complex conjugate transpose of U and I is the identity matrix. In terms of computation, the unitarity constraint implies that the computation is reversible. The following transformation on a single qubit is important and very useful. It is called the Hadamard transform. 1 1 1 H=√ (6) 2 1 −1 It is a unitary operation since:
4
Harry Buhrman and Hein R¨ ohrig
1 1 1 1 1 1 10 √ ·√ = 01 2 1 −1 2 1 −1 Now let us do a Hadamard operation on a qubit that is in the classical state |0: 1 1 1 1 1 1 √ · =√ 0 2 1 −1 2 1 This is in ket notation √12 |0 + √12 |1, which is the random qubit from (3). When we apply the Hadamard transform again on this qubit, 1 1 1 1 1 1 1 1 + √ , (7) ·√ = 21 21 = 0 1 −1 1 − 2 2 2 2 we get the |0 again. The important point is the minus sign in the Hadamard transform. Its effect is illustrated in (7) above. The minus sign caused the 12 − 12 in the lower half of the vector to cancel out, or interfere destructively, while both terms in the upper half interfered constructively. It is the superposition principle together with this interference behavior that gives quantum computing its power. The tensor product is also defined on linear operations. If we have an m × n matrix A and an m × n matrix B then A ⊗ B is a (m · m ) × (n · n ) matrix defined as: a1,1 · B a1,2 · B . . . a1,n · B a2,1 · B a2,2 · B . . . a2,n · B .. .. . . .. . . . . am,1 · B am,2 · B . . . am,n · B 2.3
Einstein-Podolsky-Rosen Paradox
In Sect. 2.1 we have seen that any set of k qubits is admissible if it satisfies (4) and (5). Bearing this in mind let us examine the following state consisting out of 2 qubits: 1 1 √ |00 + √ |11 (8) 2 2 Note that the first 0 and the first 1 form the first qubit and the second 0 and the second 1 form the second qubit. This state is called the “EPR state” after its inventors Einstein, Podolsky, and Rosen [25]. The purpose of this state was to devise a thought experiment to show the incompleteness of quantum mechanics. Imagine that we have this EPR state and that Alice has the first qubit somewhere on Mars and that Bob has the second, say, here on earth. If Alice measures her qubit she will see a 0 or a 1 with equal probability and the state will have collapsed to either |00, if she saw a 0 or |11 in case it was a 1. The same is true for Bob. This leads to the following situation. Suppose that the first qubit, on Mars, was measured first and that Alice saw a 1. This now means that when Bob measures his qubit he will also measure a 1. It appears that some information, i.e., the outcome of Alice’s measurement, has somehow traveled to
Distributed Quantum Computing
5
earth instantaneously. Since nothing can travel faster than the speed of light something must be wrong. It turns out that EPR pairs cannot be used for communication: straightforward arithmetic shows that the probabilities of Bob obtaining a certain measurement outcome are not changed no matter what Alice does. However, they can be used to reduce communication complexity as we are going to see in Sect. 4.2. Classical bits can be copied. Qubits on the other hand can not be copied. Theorem 1. [24,52] Qubits cannot be copied The reason for this is that the copy-qubit operation is not linear and, hence, not unitary. Suppose we had a linear operation Uc that would copy a qubit. This means on state (α|0 + β|1) ⊗ |0 it would do the following: Uc [(α|0 + β|1) ⊗ |0] = (α|0 + β|1) ⊗ (α|0 + β|1)
(9)
= α |00 + αβ|01 + αβ|10 + β |11 2
2
(10)
On the other hand, since Uc is linear and because (α|0 + β|1) ⊗ |0 = α|00 + β|10: Uc [α|00 + β|10] = α|00 + β|11 (11) It is clear that (10) and (11) are the same if and only if α = 1 and β = 0 or α = 0 and β = 1. This is precisely the case if we have a classical 0 or 1. Hence, there cannot be a linear operation that copies an arbitrary unknown qubit. Now imagine that Alice has an unknown qubit |x = α|0 + β|1 that she wants to send to Bob and that she furthermore can only communicate using classical bits. Is it in this case possible for Alice to communicate |x to Bob? In the light of the no-cloning Theorem 1 it certainly is impossible to do this since whenever she measures x she will destroy/collapse it to a classical bit and she cannot copy it first. But suppose that Alice and Bob in addition each share one half of an EPR pair (8). The surprising observation is that there is a scheme that allows Alice to send or “teleport” |x to Bob using only 2 classical bits [11]. In operational terms, the scheme works as follows. Let φ+ be the first part of an EPR pair and φ− the other half. That is, φ+ is the first bit of √12 [|00 + |11] and φ− the second bit. Alice has φ+ and Bob has φ− . At some point Alice gets the unknown qubit |x = α|0 + β|1. She now does a unitary operation1 on the two qubits, i.e., φ+ and x. Then she measures these two qubits, obtaining two bits: 00, 01, 10, or 11. Next she send these two bits to Bob, who depending on the two bits, does one of four unitary operations on his φ− . It turns out that this last unitary operation changes2 φ− into the unknown qubit |x. After the protocol, the EPR pair is destroyed, so in order to repeat this procedure a fresh EPR pair is needed. 1 2
The unitary operation is a controlled-not of x on φ+ , followed by a Hadamard on x. In fact after the controlled-not and the Hadamard transform of Alice, it follows that their joint state is: |00(α|0+β|1)+|01(α|1+β|0)+|10(α|0−β|1)+|11(α|1− β|0). This means that after Alice does her measurement, the third bit, i.e., φ− , is the unknown qubit x up to a possible bit flip and/or phase shift depending on the outcome of Alice’s measurement.
6
Harry Buhrman and Hein R¨ ohrig
The important point for communication complexity is that this teleportation scheme is a way to simulate a qubit channel between Alice and Bob with a classical channel, at the cost of two bits per qubit, whenever Alice and Bob share EPR pairs. Theorem 2. [11] When Alice and Bob share EPR pairs, they can simulate a qubit channel with a classical bit channel at the cost of two classical bits per qubit.
3
Quantum Black-Box Computation
Perhaps the simplest form of a computational task is the following. Suppose we have n Boolean variables X0 , . . . , Xn−1 , and we want to compute a property P (X0 , . . . , Xn−1 ). The goal is to compute P looking at as few variables as possible. For example, suppose P (X0 , . . . , Xn−1 ) = 1 iff there exists an i such that Xi = 1. That is, we want to compute the OR(X0 , . . . , Xn−1 ). How many variables do we have to query? It is not too hard to see that we have to look at all the variables. A similar kind of reasoning shows that also in the randomized setting the bound is Ω(n). It has been shown by Grover [29] that a quantum √ algorithm can solve the OR with only O( n) quantum queries. Next we will turn our attention to another problem that allows even an exponential speedup. Define the following promise on the variables. We are guaranteed that they are either constant (i.e., all the Xi are either all 0 or all 1) or they are balanced: exactly half the Xi are 0 and the other half is 1. The problem is to find out whether the variables are constant or balanced. It is easy to see that classically this problem requires n/2 + 1 queries to the variables. One of the first quantum algorithms, by Deutsch and Jozsa [33], establishes that this problem can be solved with just a single quantum query! Before we explain this algorithm we first have to explain how we model a quantum query. Quantum Query. We have to model a quantum query in such a way that it is a unitary operation. We define a quantum query to variable Xi as follows. The state |i, 0 becomes after the query |i, Xi and |i, 1 becomes |i, 1 − Xi . That is, for 1 ≤ i ≤ n and b ∈ {0, 1} : |i, b → |i, b ⊕ Xi Since this describes what a query does on basis states, because of linearity it also works on states that are in superposition: αi,b |i, b → αi,b |i, b ⊕ Xi . (12) i∈{0,1}log(n) ,b∈{0,1}
i∈{0,1}log(n) ,b∈{0,1}
It can be easily checked that this operation is unitary.
Distributed Quantum Computing
7
The Deutsch-Jozsa Algorithm. Suppose n is a power of 2 and l = log n. We start in a state with l 0s followed by a 1: |0l 1 Remember the Hadamard transform H on one qubit from (6). We do a Hadamard transform on all the qubits of the state, i.e., the following operation l+1
H ⊗ H ⊗ . . . ⊗ H = H ⊗l+1 . This will result in the following state: 1 √ n
1 |i √ (|0 − |1) 2 i∈{0,1}l
(13)
Then we perform the only quantum query. This will affect our state according to (12) as follows: 1 1 √ (−1)Xi |i √ (|0 − |1) (14) n 2 l i∈{0,1}
To see that this is correct, first observe that we perform the quantum query with the target qubit in superposition (|0 − |1) This means that |i √12 (|0 − |1) after the query becomes |i √12 (|0 ⊕ Xi − |1 ⊕ Xi ). Furthermore, if Xi is 0 then this is simply |i √12 (|0 − |1); on the other hand if Xi = 1 then it becomes |i √12 (|1 − |0), which is the same as (−1)|i √12 (|0 − |1). Hence, we get a factor of −1 iff Xi = 1. Next we apply again H ⊗l+1 to the state and obtain the following messy-looking expression: 1 √ n
i∈{0,1}l
1 √ n
(−1)Xi ⊕(i,j) |j|1 ,
(15)
j∈{0,1}l
where (i, j) is the inner-product between i and j modulo 2. Let us take a closer look at the part of this sum where j = 0l : 1 n
(−1)Xi |0l |1
(16)
i∈{0,1}l
Suppose that all the X i = 0 and we are in the case “variables constant 0.” Then (16) boils down to: n1 i∈{0,1}l |0l |1 = |0l 1. For the “constant 1” case we will end up in (−1)|0l 1. This means that when we observe the final state in (15), we will see 0l 1 with probability 1. On the other hand, if half of the Xi = 1 and the other half are 0, then half of the terms in (16) are 1 and the other half are −1 and cancel each other out. The result of this is that |0l 1 has amplitude 0 and will be seen with probability 0. So by observing state (15) we can conclude that if we observe 0l 1 we are in the constant case and if we observe anything else we are in the balanced case.
8
4 4.1
Harry Buhrman and Hein R¨ ohrig
Applications in Distributed Computing Communication
One of the main themes in quantum information processing is to extend classical communication and communication schemes with quantum ones. Here we will consider three models of quantum communication and compare them with classical communication. 1. Communication is done with qubits. 2. Both parties share EPR pairs but communication is done via a classical-bit channel. 3. Both parties share EPR pairs and communication is done with qubits. The most simple form of communication is where Alice wants to send a message m of say k bits to Bob. We know that classically in general Alice needs to send k bits to Bob. Is this still true in the setting 1, 2, and 3? It follows from a theorem of Holevo [30] that when only qubits are used for communication Alice still needs to send k qubits. Moreover Cleve et al. [23] show that the same is true when both parties share EPR-pairs and classical communication is used. For the third variant, where both EPR pairs and qubits are used, things are slightly different. Bennett and Wiesner [12] show that in this case there is a kind of a reverse of Theorem 2. This is a scheme, called super-dense coding, that allows Alice to send two classical bits with one qubit to Bob provided they share an EPR pair. It can be shown that, like Holevo’s theorem, this is optimal. 4.2
Communication Complexity
Communication Complexity was introduced by Yao and Abelson [2,53]. Alice has an n-bit string x and Bob has an n-bit string y and their goal is to compute some function f : {0, 1}n × {0, 1}n → {0, 1}, minimizing the number of bits they communicate to each other. The area of communication complexity is well studied, see for example the books by Kushilevitz and Nisan [37] and Hromkoviˇc [32]. The question we want to address here is: how does the communication complexity of certain problems vary when different models of quantum communication are used. We will denote C(f ) to denote the classical communication complexity of f . That is the number of bits the optimal protocol uses on the worst-case input. The model where only qubits can be used for communication (model 1, Sect. 4.1) was introduced by Yao [54]. We will use Q(f ) for the quantum communication complexity in the model where only qubits are used for communication. The first results in that model were lower bounds or impossibility results due to Yao and Kremer [36] and we will discuss them in Sect. 3. The model where the communication is classical but both parties share entanglement, model 2, was introduced by Cleve and Buhrman [22]. We will denote the communication complexity in this model with C ∗ (f ), the model which uses both EPR pairs and qubits will be Q∗ (f ). Cleve and Buhrman were the first to show that communication complexity can be reduced contrary to what one might
Distributed Quantum Computing
9
believe considering Holevo’s theorem. Their setting differed slightly from the models we discuss here. In this setting they exhibit an example of a three party communication problem where the three parties share an entangled state, like an EPR pair but then for three parties. It is shown that when the parties share this entangled state the communication problem can be solved with two bits of communication whereas without such a prior shared state three bits are necessary. That is, there is a function f such that C ∗ (f ) = 2 whereas C(f ) ≥ 3. Better separations in the multiparty setting were found in [15] and [21]. The latter paper exhibits a function f for k parties such that C ∗ (f ) = k and C(f ) = Ω(k log(k)). Next we will turn our attention to the qubit communication model Q(f ). However, keep in mind that protocols for this model can be translated to the model where both parties share EPR pairs and communicate classically, since via teleportation, Theorem 2 gives us: C ∗ (f ) ≤ 2Q(f ). Deutsch-Jozsa Communication Problem. The first gap for two-party qubit communication complexity was demonstrated by Buhrman, Cleve, and Wigderson [17]. They showed for a promise version of the equality problem3 , EQ , that Q(EQ ) = O(log(n)) and that also C(EQ ) = Ω(n). This exhibits an exponential gap between classical and quantum communication complexity. The quantum protocol is inspired by the Deutsch-Jozsa algorithm from Sect. 3 and the classical bound stems from a deep and surprising combinatorial theorem from Frankl and R¨ odl [27]. EQ (x, y) = 1 iff x = y but with the extra promise that it will always be the case that the Hamming distance ∆(x, y) = 0 or n/2. The Hamming distance between two strings x and y, ∆(x, y), is the total number of bits where x and y are different. We will see that EQ can be solved with just log(n) + 1 qubits of communication from Bob to Alice. Note that under the Hamming distance promise, Alice and Bob have to figure out whether x1 ⊕ y1 . . . xn ⊕ yn is constant or balanced, since in the constant 0 case x = y and in the balanced x = y. So if we set Xi = xi ⊕ yi then we have the Deutsch-Jozsa problem back. If Alice could obtain the final state from equation (15), 1 √ n
i∈{0,1}l
1 √ n
(−1)Xi ⊕(i,j) |j|1 ,
j∈{0,1}l
she would do a final measurement and know the answer. To this end Bob prepares the following state: 1 √ n 3
1 |i √ (|0 ⊕ yi − |1 ⊕ yi ) 2 i∈{0,1}l
EQ(x, y) = 1 if x = y and 0 otherwise. EQ requires n bits of communication. A promise version of a problem means that Alice and Bob are only required to compute the answer correctly on certain instances that fall within the promise and it doesn’t matter what they compute on the other instances that don’t satisfy the promise.
10
Harry Buhrman and Hein R¨ ohrig
and sends these log(n) + 1 qubits to Alice. Alice then performs the unitary transformation that changes state |i|b to |i|b ⊕ xi resulting in state: 1 √ n
1 |i √ (|0 ⊕ yi ⊕ xi − |1 ⊕ yi ⊕ xi ) 2 i∈{0,1}l
which is after we rewrite it precisely the state from (14): 1 √ n
1 (−1)Xi |i √ (|0 − |1) 2 i∈{0,1}l
Next Alice proceeds as in the Deutsch-Josza algorithm and applies H ⊗ log(n)+1 and measures the final state. The general idea is to use a quantum black-box algorithm in a distributed setting. Whenever the black-box algorithm wants to make a query, Alice and Bob exchange a round of log(n) + 1 qubits and Alice continues the black-box algorithm. This allows one in general to use any black-box algorithm as a communication protocol. In this way it can be shown that, by using √ Grover’s algorithm [29] the Disjointness problem can be solved with O( n log(n)) many qubits [17]. Bounded-Error Protocols. All the above (quantum) protocols don’t make errors and compute the outcome exactly. When studying randomized versions of communication complexity, however, it is unavoidable to introduce errors. A classical randomized protocol for f , R2 (f ), is a protocol where both Alice and Bob can use random bits. They are required to compute the correct outcome with probability at least 2/3. The distinction between private and public random bits can be made, where in the public bit/coin model Alice and Bob see the same random bits and in the private they each have a different random source. Newman [45] has shown that up to an additive logarithmic term the models are the same. Rabin and Yao show for EQ that there exists a classical randomized protocol that only needs O(log(n)) bits: R2 (EQ) = O(log(n)). This implies that the promise problem EQ also has a O(log(n)) randomized classical bit protocol that is correct with probability at least 2/3. Note, however, that the quantum protocol never makes an error. The disjointness problem DISJ is defined as follows. Alice and Bob each have a subset A and B of {0, 1}n , they have to decide whether A ∩ B = ∅. Kalyanasundaram and Schnitger [34] show that this problem also has high communication complexity in the randomized setting: R2 (DISJ) = Ω(n). Buhrman et al. in the same paper show that when we allow the quantum protocol to compute the answer with probability at least 2/3, we denote this by Q2 (f ), that √ √ Q2 (DISJ) = O( n log(n)). This bound was improved by [31] and a O( n) protocol was recently constructed by Aaronson and Ambainis [1]. Razborov has shown, using some variant of the polynomial method, that this bound is tight [49]
Distributed Quantum Computing
11
The disjointness problem demonstrates a quadratic gap between classical randomized and quantum communication complexity. Moreover this is an example of a gap known where the function f is not a promise problem. The only other known total problem that allows for a more efficient quantum protocol is that of the equality problem in the simultaneous message passing model [16]. The main ingredients to the protocol are a quantum fingerprinting scheme and a test to distinguish orthogonal states from parallel ones. In the simultaneous message passing model Alice and Bob don’t send messages to each other but send one message to a third party, called the referee. The referee only sees the messages from Alice and Bob and has to output f (x, y). The biggest gap between the randomized and the quantum two party communication complexity model was obtained by Raz [48]. He showed that √ there is a promise problem f such that Q(f ) = O(log(n)) but R2 (f ) = Ω( n). Ambainis et al. [7] also exhibit an exponential gap between quantum protocols and classical protocols for a different form of communication problem called sampling which we shall not discuss here further. Summarizing for promise problems there exist exponential gaps between classical and quantum communication complexity. For total problems the best known gap is only quadratic. In turn this sheds some light on the EPR paradox. Holevo’s theorem proves that EPR pairs cannot be used to reduce communication. Since all the protocols in this section work for the model where the parties share EPR pairs and communicate classically it follows that EPR pairs can reduce the communication complexity of certain problems. This situation seems contradictory but notice that the actual amount of information that needs to be communicated between Alice and Bob is only 1 bit, namely the outcome of f . Lower Bounds. In the previous section we showed that quantum communication protocols are sometimes superior to classical protocols. In this section we examine the converse and turn our attention to lower bounds for quantum communication complexity. Classically for deterministic communication complexity there is a general technique for proving lower bounds. For any function f : {0, 1}n × {0, 1}n → {0, 1} one can define the boolean 2n × 2n communication matrix Mf (x, y) = f (x, y). Mehlhorn and Schmidt [44] related the rank of this matrix to the communication complexity. They show that log(rank(Mf )) ≤ C(f ). This is a very useful tool. Take for example the equality problem. The communication complexity matrix for EQ is the 2n × 2n identity matrix which has only 1’s on the diagonal and is 0 on off-diagonal entries. Since this matrix has rank 2n it follows that C(f ) ≥ n. A similar statement is true in the quantum setting: Theorem 3. For any communication problem f : 1. log(rank(Mf ))/2 ≤ Q(f ) [36]. 2. log(rank(Mf )) ≤ C ∗ (f ) [18]. 3. log(rank(Mf ))/2 ≤ Q∗ (f ) [18].
12
Harry Buhrman and Hein R¨ ohrig
A natural and long standing open problem is whether the communication complexity is also a lower bound for the log-rank. That is, whether the log-rank characterizes the communication complexity. The biggest known gap between the log-rank and the communication complexity is almost quadratic [47]. The log-rank conjecture states that for every total f , log(rank(f )) and C(f ) are all polynomially related. It follows from Theorem 3 that if the log-rank conjecture is true then for total f : Q(f ), C ∗ (f ), Q∗ (f ), and C(f ) are polynomially related. The log rank lower bound method only works well for errorless protocols. For bounded error models there is another bound called discrepancy. Kremer [36] and Yao show that the discrepancy bound also works for the bounded error qubit communication model Q2 . This enables them to show a linear lower bound in this model for a problem called inner product modulo 2, IP . Here IP (x, y) = x1 · y1 + · · · + xn · yn mod 2. Ambainis et al. [7] extend this bound to also yield a Ω(n) bound even when Alice and Bob are allowed to make an error which is very close to 1/2. For the model where both parties share EPR pairs, Cleve et al. [23] were the first to show a linear lower bound for IP . They came up with a new technique that is essentially quantum mechanical in nature. It can be seen as a quantum adversary argument. This enabled them to show that any (quantum) protocol for IP can be (ab)used, when run in superposition, to communicate n bits from Alice to Bob. Let Q∗2 (f ) denote the communication complexity of f where Alice and Bob compute f correctly with probability 2/3, they share EPR pairs and the communication is with qubits. Theorem 3 yields a lower bound of Ω(n) for DISJ in the errorless models since the MDISJ has rank 2n . In the bounded error model √ recently Razborov showed, in a very nice paper, that the DISJ needs Ω( n) qubits of communication even in the presence of shared EPR pairs. Summarizing we have the following theorem: (IP ) = Ω(n) [36,23]. Theorem 4. 1. Q∗2√ 2. Q∗2 (DISJ) = Ω( n) [49] 4.3
Loopholes in Nonlocality Experiments
Tools and results from the study of quantum communication complexity have been applied fruitfully to tune parameters in physical experiments that test the “quantumness” of our world. The EPR paradox has been and still is a subject of dispute. Much progress was made when Bell [10] came up with a test that would, in case quantum mechanics was correct, show correlations that could not be explained with just classical reasoning. Such nonlocality experiments have been performed in the lab and non-classical correlations have been observed [9]. However, experimental realizations of the nonlocality tests are hampered by noise and imperfections in the physical apparatus. In particular, measurement devices for individual quantum systems (e.g., single-photon detectors) tend to fail on most runs of the experiment, allowing local classical explanations of the data by means of local classical theories that are allowed to make the same kind
Distributed Quantum Computing
13
of errors and this opens the so-called “detection loophole.” Ideas from quantum communication complexity have been used by Brassard et al. [14], Massar [40], and Buhrman et al. [19] to propose new nonlocality experiments and to bound the maximum detector efficiency, minimum noise, and hidden communication using which the results can be explained by means of a classical local model. The goal is to construct an experiment that demonstrates the nonlocal character of quantum mechanics even when the experiments are faulty and make errors. An experiment is modeled as two (or more) parties Alice and Bob that each have an input of length n. However, contrary to the communication complexity model, Alice and Bob are not allowed to communicate with each other. In the classical setting Alice and Bob share a common source of random bits, and in the quantum scenario Alice and Bob share EPR pairs or more generally an entangled state. Alice now will depending on her input and her random bits (or some operation on her part of the EPR pairs) output some string a of m bits. Bob follows some protocol to also output m bits b. This way they produce correlation distributions Pr[a, b | x, y]. The goal now is to come up with a set of correlation distributions and show that there is a quantum protocol that generates these distributions whereas every classical protocol fails to do so even if it is allowed to make small errors or sometimes not produce an output at all. Deutsch-Josza Correlations. To demonstrate these ideas, we return once more to the Deutsch-Josza problem, following Brassard et al. [14] and Massar [40]. This time, Alice and Bob cannot communicate, but they start out sharing a quantum state, receive classical bit strings x, y ∈ {0, 1}n , respectively; both Alice and Bob produce outputs, a, b ∈ {0, 1}l , respectively, and we are interested in the correlations between these outputs, namely the probability distributions Pr[a, b | x, y] of Alice outputting a and Bob outputting b given that Alice got input x and Bob input y. Recall that the “trick” in turning the Deutsch-Josza algorithm into a communication protocol was to let Bob perform the first steps of the algorithm and then send the quantum state to Alice who completed the steps with her input. Now, since Alice and Bob cannot communicate, we replace the quantum channel by EPR pairs. Alice and Bob start out with the following state comprised of l = log(n) EPR pairs and two auxiliary qubits:
1 √
2 n
|i (|0 − |1) |i (|0 − |1)
i∈{0,1}l
Here, Alice has the first l+1 qubits and Bob the remaining l+1 qubits. Now they pretend that each on her/his side are in the Deutsch-Jozsa algorithm before the oracle query, as given in (13). Accordingly, they perform the operation |i|b → |i|b ⊕ yi on their part of the state, resulting in the following global state: 1 √
2 n
(−1)xi +yi |i (|0 − |1) |i (|0 − |1)
i∈{0,1}l
Then they apply the Hadamard operation on their l +1 qubits, yielding the state
14
Harry Buhrman and Hein R¨ ohrig
1 √ n n
i∈{0,1}l
(−1)xi +yi
(−1)(i,a) |a |1
a∈{0,1}l
1 = √ n n
a,b∈{0,1}l
b∈{0,1}l
(−1)(i,b) |b |1
(−1)xi +yi +(i,a⊕b) |a|1|b|1
i∈{0,1}l
Now they both measure and output their measurement. By the laws of quantum mechanics, the probability for Alice to observe |a|1 and Bob |b|1 is 2 1 Pr[a, b | x, y] = 3 (−1)xi +yi +(i,a⊕b) n l i∈{0,1}
If x = y, then
Pr[a, b | x, y] =
1 n
0
if a = b if a = b
whereas for ∆(x, y) = n/2 and a = b we have Pr[a, b | x, y] = 0. Hence, the outputs are correlated in that whenever x = y, we always see a = b and whenever ∆(x, y) = n/2, we never see a = b. Can these correlations be realized by a classical protocol with shared randomness and no communication? No, since then Bob could send his output to Alice, solving the communication problem with O(log n) bits, which is ruled out by the lower bound of Ω(n). Then, how closely can they be realized approximately, i.e., how precise does an experiment need to be? For the “detection loophole,” it is assumed that any measurement succeeds with probability at least η and if it fails, there will be no output. Then η 2 is the probability that both Alice’s and Bob’s measurements succeed. If the world is classical, then we have an adversary who is trying to reproduce the correlations without communication using the possibility not to produce an output on a η 2 fraction of the runs of the experiment. By the Yao principle there will be for any distribution on the inputs a classical local deterministic strategy which produces a (correct) output for an η 2 fraction of the inputs. Consider the input distribution where x ∈ {0, 1}n is chosen uniformly and random and y = x; fix the best deterministic strategy. Let Za = {x : Alice and Bob output a}, then η 2 2n ≤ |Za | a∈{0,1}l
Moreover, for each a ∈ {0, 1}l , Za ⊆ {0, 1}n must not contain x, y with ∆(x, y) = n/2, therefore, by a deep theorem odl [27], |Za | ≤ 20.993n . This √ by Frankl and R¨ 2 n 0.993n −0.007n implies η 2 ≤ n2 or η ≤ n2 . Hence, with growing n, the detector efficiency at which there still exists a classical local model decreases exponentially. So if the quality of the measurement equipment does not decrease too fast with growing n, the detection loophole can be “closed” with an experiment for the Deutsch-Jozsa correlations.
Distributed Quantum Computing
15
There are several issues with this approach. In a nonlocality experiment, the input distribution should a product distribution so that it can be implemented locally in the lab. Furthermore, there are very efficient classical bounded-error protocols for equality, implying that the quantum correlations above can be very well simulated classically if the experiment is subject to noise. And finally, an asymptotic analysis is often too coarse since the region where the bounds kick in may be out of reach experimentally. Concerning the bounded-error case, a multiparty nonlocality experiment has been constructed, building again on an earlier multiparty quantum communication protocol [21]. This family of experiments has η ≤ 1/k 1/6 and tolerates error 1/2 − 1/ o(k 1/6 ), where k is the number of parties [20]. 4.4
Coin Tossing
Research into quantum cryptography is motivated by two observations about quantum mechanics: 1. Nonorthogonal quantum states cannot be distinguished perfectly and parts of certain orthogonal quantum states cannot be distinguished if the remaining parts are inaccessible; 2. Measurement disturbs the quantum state. This is the so-called “collapse of the wave function.” The second observation hints at the possibility of detecting eavesdroppers or other types of cheaters, whereas the first property appears to allow hiding data, both unhampered by unproven computational assumptions. Indeed, for the task of cooperatively establishing a random bit string between two parties in the presence of eavesdroppers, quantum key distribution [13,41,39] achieves security against the most general attack by an adversary that has unbounded computational power but has to obey the laws of quantum mechanics. Initially, it was thought that these properties would admit protocols for the cryptographic primitive “bit commitment.” In bit commitment, there are two parties Alice and Bob; in the initial phase of the protocol, Alice has a bit b and communicates with Bob to “commit” to the value of b without revealing it. At a later time, Alice “unveils” her bit, allowing Bob to perform checks against the information obtained in the initial phase. The properties sought of bit-commitment protocols are that they are “concealing” (Bob does not learn anything about b in the initial phase) and “binding” (Bob will catch Alice trying to unveil 1 − b instead of b). Unfortunately, Mayers [42] and Lo and Chau [38] proved that perfect quantum bit commitment is impossible. Their impossibility result extends to “coin tossing” [43,38], a weaker cryptographic primitive where the two parties want to agree on a random bit whose value cannot be influenced by either of them. Moreover, the impossibility extends even to the case of “weak coin tossing” [4], where outcome b = 0 is favorable for Alice and outcome b = 1 favorable for Bob, thus ruling out perfect quantum protocols for leader election. However, what
16
Harry Buhrman and Hein R¨ ohrig
turned out to be possible are coin-tossing protocols, where there are guarantees on how much a cheater can bias the outcome. Consider k parties out of which at most k < k are dishonest; which players are dishonest is fixed in advance but unknown to the honest players. The players can communicate over broadcast channels. Initially they do not share randomness, but they can privately flip coins; the probabilities below are with respect to the private random coins. A coin-flipping protocol establishes among the honest players a bit b such that – if all players are honest, Pr[b = 0] = Pr[b = 1] = 1/2 – if up to k players are dishonest, then Pr[b = 0], Pr[b = 1] ≤ 1/2 + is called the bias; a small bias implies that colluding dishonest players cannot strongly influence the outcome of the protocol. Players may abort the protocol. Classically, if a (weak) majority of the players is bad then no bias < 1/2 can be achieved and hence no meaningful protocols exist [50]. For example, if we only have two players and one of them is dishonest, then no protocols with bias < 1/2 exist. (For a minority of bad players, quite nontrivial protocols exist; see [26].) Allowing quantum bits (qubits) to be sent instead of classical bits changes the situation dramatically. Surprisingly, in the two-party case coin flipping with bias < 1/2 is possible, as was first shown in [3]. The best known bias is 1/4 and this is optimal for a special class of three-round protocols [4]; for a bias of at least Ω(log log(1/)) rounds of communication are necessary [4]. Recently, Kitaev (unpublished, see [35,6]) showed that in the two-party case no bias smaller than √ 1/ 2 − 1/2 is possible. In the weak version of the coin-flipping problem, we know in advance that outcome 0 benefits Alice and outcome 1 benefits Bob. In this case, we only need to bound the probabilities of a dishonest Alice convincing Bob that the outcome is 0 and a dishonest Bob convincing Alice that the outcome is 1. In the classical setting, a standard argument shows that even weak coin flipping with a bias < 1/2 is impossible when a majority of the players is dishonest. In the quantum setting, this scenario was first studied for two parties under the name quantum gambling [28]. Subsequently, Spekkens and Rudolph √ [51] gave a quantum protocol for two-party weak coin flipping with bias 1/ 2 − 1/2 √ (i.e., no party can achieve the desired outcome with probability greater than 1/ 2). Notice that this is a better bias than in the best strong coin flipping protocol of [4]. Kitaev’s lower bound for strong coin flipping does not apply to weak coin flipping. Thus, weak protocols with arbitrarily small > 0 may be possible. The only known lower bounds for weak coin flipping are that the protocol of [51] is optimal for a restricted class of protocols [5] and that a protocol must use at least Ω(log log(1/)) rounds of communication to achieve bias (shown in [4] for strong coin flipping but the proof also applies to weak coin flipping). Quantum coin flipping and leader election for more than two parties were investigated by Ambainis et al. [6]: Even if there is only a single honest party among k players, bias 1/2 − c/k 1.78 can still be achieved by a quantum protocol (for some c > 0) and there is a lower bound that for some c > 0, 1/2 − c /k cannot be achieved. Both bounds can be generalized to the situation where at
Distributed Quantum Computing
17
most (1 − )k of the players are bad, for > 0; in this case, bias δ < 1/2 − c 1.78 is achievable independent of the number of players and achieving constant bias δ < 1/2 − c is impossible, for constants c , c > 0.
5
Conclusion and Open Problems
We have surveyed some of the results in quantum distributed computing. Many problems however remain. What is the relationship between the various models, Q, C ∗ , Q∗ both in the errorless and in the bounded error setting? For the errorless models, a positive answer to the log-rank conjecture shows that they are all polynomially related but also this is at the moment still wide open. We have seen that exponential gaps between classical and quantum communication complexity problems are possible, however, all of these examples entailed promise problems. Can there also be exponential gaps for total problems in the bounded error setting? Techniques and protocols from quantum and classical communication complexity can help to construct nonlocality experiments. It remains an open question what the best bounds for two and more parties are for the error of the experiment and the detector efficiency. A question that is sheds some light on the relationship between Q, C ∗ , and ∗ Q is the following. Given a correlation game with two parties that each get inputs of size n and produce outputs of size m, and use an entangled state of a finite amount of qubits. Is there a protocol that uses only an O log(n + m)) qubit entangled state that can be used to approximate, say in terms of small total variation distance, the correlations from the original protocol? Such a statement is true in the classical scenario with respect to the number of shared random bits and has a very similar prove of the fact that for any communication complexity protocol only O(log(n)) shared random bits are needed [45]. Note that if it can be shown that O(log(n)) entangled qubits are enough to simulate an arbitrary communication complexity protocol on inputs of length n then C2∗ , Q∗2 , and Q2 are all related with an additional overhead of O(log(n)) qubits of communication. In the simultaneous message passing model there exists a O(log n) protocol that solves the equality problem. The equality problem is equivalent to the problem of deciding whether x ⊕ y = 0, where x ⊕ y is the bitwise XOR of x and y. No such protocol is known for the three party problem to decide whether x ⊕ y ⊕ z = 0.√The best known quantum protocol is due to Ambainis and Shi [8] who need O( n) qubits to solve this problem. However, the best √ known lower bound for this three party problem in the classical setting is Ω( n) and the best known classical upper bound is O(n2/3 ) Quantum bit commitment and perfect coin tossing have been shown to be impossible, but there are protocols for coin tossing with constant bias. The best known impossibility bound for strong coin tossing matches the bias of the best known protocol for weak coin tossing – it is not clear whether this is a coincidence. Tight bounds on the achievable bias are not known in both cases; we even do not know whether there exists a protocol with a finite number of rounds and qubits that guarantees the optimal bias, or whether there are more and more complex protocols whose biases converge.
18
Harry Buhrman and Hein R¨ ohrig
References 1. S. Aaronson and A. Ambainis. Quantum search of spatial regions. quant-ph/0303041, 2003. 2. H. Abelson. Lower bounds on information transfer in distributed computations. J. Assoc. Comput. Mach., 27(2):384–392, 1980. Earlier version in FOCS’78. 3. D. Aharonov, A. Ta-Shma, U. Vazirani, and A. Yao. Quantum bit escrow. In Proceedings of STOC’00, pages 705–714, 2000. 4. A. Ambainis. A new protocol and lower bounds for quantum coin flipping. In Proceedings of 33rd ACM STOC, pages 134–142, 2001. 5. A. Ambainis. Lower bound for a class of weak quantum coin flipping protocols. quant-ph/0204063, 2002. 6. A. Ambainis, H. Buhrman, Y. Dodis, and H. R¨ ohrig. Multiparty quantum coin flipping. Submitted, 2003. 7. A. Ambainis, L. Schulman, A. Ta-Shma, U. Vazirani, and A. Wigderson. The quantum communication complexity of sampling. In 39th IEEE Symposium on Foundations of Computer Science, pages 342–351, 1998. 8. A. Ambainis and Y. Shi. Distributed construction of quantum fingerprints. quantph/0305022, 2003. 9. A. Aspect, J. Dalibard, and G. Roger. Experimental test of Bell’s inequalities using time-varying analyzers. Phys. Rev. Lett., 49(25):1804, 1982. 10. J. S. Bell. On the Einstein-Podolsky-Rosen paradox. Physics, 1, 1964. 11. C. Bennett, G. Brassard, C. Cr´epeau, R. Jozsa, A. Peres, and W. Wootters. Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels. Physiscal Review Letters, 70:1895–1899, 1993. 12. C. Bennett and S. Wiesner. Communication via one- and two-particle operators on Einstein-Podolsky-Rosen states. Physiscal Review Letters, 69:2881–2884, 1992. 13. C. H. Bennett and G. Brassard. Quantum cryptography: Public key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computers, Systems and Signal Processing, pages 175–179, 1984. 14. G. Brassard, R. Cleve, and A. Tapp. The cost of exactly simulating quantum entanglement with classical communication. Physical Review Letters, 83(9):1874– 1877, 1999. 15. H. Buhrman, R. Cleve, and W. van Dam. Quantum entanglement and communication complexity. SIAM Journal on Computing, 30(8):1829–1841, 2001. quantph/9705033. 16. H. Buhrman, R. Cleve, J. Watrous, and R. de Wolf. Quantum fingerprinting. Physical Review Letters, 87(16), September 26, 2001. 17. H. Buhrman, R. Cleve, and A. Wigderson. Quantum vs. classical communication and computation. In 30th Annual ACM Symposium on Theory of Computing, 1998. quant-ph/9702040. 18. H. Buhrman and R. de Wolf. Communication complexity lower bounds by polynomials. In 16th IEEE Annual Conference on Computational Complexity (CCC’01), pages 120–130, 2001. cs.CC/9910010. 19. H. Buhrman, P. Høyer, S. Massar, and H. R¨ ohrig. Combinatorics and quantum nonlocality. Accepted for publication in Physical Review Letters, 2002. 20. H. Buhrman, P. Høyer, S. Massar, and H. R¨ ohrig. Resistance of quantum nonlocality to imperfections. Manuscript, 2003. 21. Harry Buhrman, Wim van Dam, Peter Høyer, and Alain Tapp. Multiparty quantum communication complexity. Physical Review A, 60(4):2737 – 2741, October 1999.
Distributed Quantum Computing
19
22. R. Cleve and H. Buhrman. Substituting quantum entanglement for communication complexity. Physical Review A, 56(2):1201–1204, august 1997. 23. R. Cleve, W. van Dam, M. Nielsen, and A. Tapp. Quantum entanglement and the communication complexity of the inner product function. In Springer-Verlag, editor, Proceedings of the 1st NASA International Conference on Quantum Computing and Quantum Communications, 1998. 24. D. Dieks. Communication by EPR devices. Phys. Lett. A, 92(6):271–272, 1982. 25. A. Einstein, B. Podolsky, and N. Rosen. Can quantum-mechanical description of physical reality be considered complete? Phys. Rev., 47:777, 1935. 26. U. Feige. Noncryptographic selection protocols. In Proceedings of 40th IEEE FOCS, pages 142–152, 1999. 27. P. Frankl and V. R¨ odl. Forbidden intersections. Trans. Amer. Math. Soc., 300(1):259–286, 1987. 28. L. Goldenberg, L. Vaidman, and S. Wiesner. Quantum gambling. Physical Review Letters, 88:3356–3359, 1999. 29. L. Grover. A fast quantum mechenical algorithm for database search. In 28th ACM Symposium on Theory of Computing, pages 212–218, 1996. 30. A. S. Holevo. Bounds for the quantity of information transmitted by a quantum communication channel. Problemy Peredachi Informatsii, 9(3):3–11, 1973. English translation in Problems of Information Transmission, 9:177–183, 1973. 31. P. Høyer and R. de Wolf. Improved quantum communication complexity bounds for disjointness and equality. In Proceedings of 19th Annual Symposium on Theoretical Aspects of Computer Science (STACS’2002), volume 2285 of Lecture Notes in Computer Science, pages 299–310. Springer, 2002. quant-ph/0109068. 32. J. Hromkoviˇc. Communication Complexity and Parallel Computing. EATCS series: Texts in Theoretical Computer Science. Springer, 1997. 33. D. Deutsch R. Josza. Rapid solutions of problems by quantum computation. Proc. Roy. Soc. London Se. A, 439:553–558, 1992. 34. B. Kalyanasundaram and G. Schnitger. The probabilistic communication complexity of set intersection. SIAM J. Discrete Mathematics, 5(4):545–557, 1992. 35. A. Yu. Kitaev. Quantum coin-flipping. Talk at QIP 2003 (slides and video at MSRI), December 2002. 36. I. Kremer. Quantum communication. Master’s thesis, Computer Science Department, The Hebrew University, 1995. 37. E. Kushilevitz and N. Nisan. Communication Complexity. Cambridge University Press, 1997. 38. H. K. Lo and H. F. Chau. Why quantum bit commitment and ideal quantum coin tossing are impossible. Physica D, 120:177–187, 1998. 39. H-K. Lo and H. F. Chau. Unconditional security of quantum key distribution over arbitrarily long distances. quant-ph/9803006, 3 Mar 1998. 40. S. Massar. Nonlocality, closing the detection loophole, and communication complexity. Physical Review A, 65:032121, 2002. 41. D. Mayers. Unconditional security in quantum cryptography. quant-ph/9802025, 10 Feb 1998. 42. D. Mayers. Unconditionally secure quantum bit commitment is impossible. Physical Review Letters, 78:3414–3417, 1997. 43. D. Mayers, L. Salvail, and Y. Chiba-Kohno. Unconditionally secure quantum coin tossing. quant-ph/9904078, 22 Apr 1999.
20
Harry Buhrman and Hein R¨ ohrig
44. K. Mehlhorn and E. M. Schmidt. Las Vegas is better than determinism in VLSI and distributed computing (extended abstract). In Proceedings of the Fourteenth Annual ACM Symposium on Theory of Computing, pages 330–337, San Francisco, California, 5–7 May 1982. 45. I. Newman. Private vs. common random bits in communication complexity. Information Processing Letters, 39(2):67–71, July 1991. 46. M. A. Nielsen and I. L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 2000. 47. N. Nisan and A. Wigderson. On rank vs. communication complexity. Combinatorica, 15:557–566, 1995. Earlier version in FOCS’94. 48. R. Raz. Exponential separation of quantum and classical communication complexity. In Proceedings of 31th STOC, pages 358–367, 1999. 49. A. A. Razborov. Quantum communication complexity of symmetric predicates. Izv. Math., 67(1):145–159, 2003. 50. M. Saks. A robust noncryptographic protocol for collective coin flipping. SIAM J. Discrete Math., 2(2):240–244, 1989. 51. R. Spekkens and T. Rudolph. A quantum protocol for cheat-sensitive weak coin flipping. quant-ph/0202118, 2002. 52. W. K. Wootters and W. H. Zurek. A single quantum cannot be cloned. Nature, 299(5886):802–803, 1982. 53. A. C-C. Yao. Some complexity questions related to distributive computing. In Proceedings of 11th STOC, pages 209–213, 1979. 54. A. C-C. Yao. Quantum circuit complexity. In Proceedings of 34th FOCS, pages 352–360, 1993.
Selfish Routing in Non-cooperative Networks: A Survey R. Feldmann, M. Gairing, Thomas L¨ ucking, Burkhard Monien, and Manuel Rode Department of Computer Science, Electrical Engineering and Mathematics University of Paderborn, F¨ urstenallee 11, 33102 Paderborn, Germany {obelix,gairing,luck,bm,rode}@uni-paderborn.de
Abstract. We study the problem of n users selfishly routing traffics through a shared network. Users route their traffics by choosing a path from their source to their destination of the traffic with the aim of minimizing their private latency. In such an environment Nash equilibria represent stable states of the system: no user can improve its private latency by unilaterally changing its strategy. In the first model the network consists only of a single source and a single destination which are connected by m parallel links. Traffics are unsplittable. Users may route their traffics according to a probability distribution over the links. The social optimum minimizes the maximum load of a link. In the second model the network is arbitrary, but traffics are splittable among several paths leading from their source to their destination. The goal is to minimize the sum of the edge latencies. Many interesting problems arise in such environments: A first one is the problem of analyzing the loss of efficiency due to the lack of central regulation, expressed in terms of the coordination ratio. A second problem is the Nashification problem, i.e. the problem of converting any given non-equilibrium routing into a Nash equilibrium without increasing the social cost. The Fully Mixed Nash Equilibrium Conjecture (FMNE Conjecture) states that a Nash equilibrium, in which every user routes along every possible edge with probability greater than zero, is a worst Nash equilibrium with respect to social cost. A third problem is to exactly specify the sub-models in which the FMNE Conjecture is valid. The wellknown Braess’s Paradox shows that there exist networks, such that strict sub-networks perform better when users are selfish. A natural question is the following network design problem: Given a network, which edges should be removed to obtain the best possible Nash equilibrium. We present complexity results for various problems in this setting, upper and lower bounds for the coordination ratio, and algorithms solving the problem of Nashification. We survey results on the validity of the FMNE Conjecture in the model of unsplittable flows, and for the model of splittable flows we survey results for the network design problem.
Partly supported by the DFG-SFB 376 and by the IST Program of the EU under contract numbers IST-1999-14186 (ALCOM-FT), and IST-2001-33116 (FLAGS). International Graduate School of Dynamic Intelligent Systems
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 21–45, 2003. c Springer-Verlag Berlin Heidelberg 2003
22
1
R. Feldmann et al.
Introduction
Motivation-Framework. Large-scale traffic and communication networks, like e.g. the internet, telephone networks, or road traffic systems often lack a central regulation for several reasons: The size of the network may be too large, the networks may be dynamically evolving over time, or the users of the network may be free to act according to their private interest, without regard to the overall performance of the system. Besides the lack of central regulation even cooperation of the users among themselves may be impossible due to the fact that the users may not even know each other. Networks with non-cooperative users have already been studied in the early 1950s in the context of road traffic systems [41,3]. Recently, this kind of networks has become increasingly important in computer science. Modern computational artifacts, like e.g. the internet, are modeled as communication networks with non-cooperative users. We survey routing problems in communication networks where n sources of traffic, called users, are going to route their traffics through a shared network. Traffics are routed through links of the network at a certain rate depending on the link, and different users may have different objectives, e.g. speed, quality of service, etc. The users choose routing strategies in order to minimize their private costs in terms of their private objectives without cooperating with other users. Such networks are called non-cooperative networks [22]. A famous example of such a network is the internet. Motivated by non-cooperative systems like the internet, combining ideas from game theory and computer science has become increasingly important [12,21,30,31,34]. Such an environment, which lacks a central control unit due to its size or operational mode, can be modeled as a non-cooperative game [32]. Users selfishly choose their private strategies, which in our environment correspond to paths (or probability distributions over the paths) from their sources to their destinations. When routing their traffics according to the strategies chosen, the users will experience an expected latency caused by the traffics of all users sharing edges. Each user tries to minimize its private cost, expressed in terms of its expected individual latency. This often contradicts the goal of optimizing the social cost which measures the global performance of the whole network. The degradation of the global performance due to the selfish behavior of its users is often termed price of anarchy [34,38] and measured in terms of the coordination ratio. The theory of Nash equilibria [29] provides us with an important solution concept for environments of this kind: a Nash equilibrium is a state of the system such that no user can decrease its individual cost by unilaterally changing its strategy. It has been shown by Nash that a Nash equilibrium exists under fairly broad circumstances. The concept of Nash equilibria has become an important mathematical tool in analyzing the behavior of selfish users in non-cooperative systems [34]. Many algorithms have been developed to compute a Nash equilibrium in a general game (see [27] for an overview). Although the theorem of Nash [29] guarantees the existence of a Nash equilibrium the computational complexity of computing a Nash equilibrium in general games is open even if only n = 2 users are
Selfish Routing in Non-cooperative Networks: A Survey
23
involved. Papadimitriou [34] states that due to the guaranteed existence of a solution the problem is unlikely to be N P-hard. The problem becomes even more challenging when global objective functions have to be optimized over the set of all Nash equilibria. In this work we survey results for two different models of non-cooperative communication networks. In the first model, the network consists of a single source and a single destination which are connected by m parallel links of capacities c1 , . . . , cm . Users 1, . . . , n are going to selfishly route their traffics w1 , . . . , wn from the source to the destination. Traffics are unsplittable. Users may choose mixed strategies to route their traffics. This model has been introduced by Koutsoupias and Papadimitriou [23]. We denote it as the KP-model. The individual cost of a user is defined as the maximum expected latency over all links it has chosen with positive probability. Depending on how the latency of a link is defined we distinguish between three variations of the model: In the identical link model all links have equal capacity. In the model of related links the latency for a link j is defined to be the quotient of the sum of the traffics through j and the capacity cj . In the general case of unrelated links traffic i induces load wij on link j. In all these models the social cost is defined to be the maximum expected latency on a link, where the expectation is taken over all random choices of the users. The second model, which we denote by Wardrop-model, has already been studied in the 1950’s [41,3] in the context of road traffic systems. It allows to split traffics into arbitrary pieces. Wardrop [41] introduced the concept of equilibrium to describe user behavior in this kind of traffic networks. For a survey of the early work on this model see [1]. In this environment unregulated traffic is modeled as network flow. Given an arbitrary network with edge latency functions, equilibrium flows have been classified as flows with all flow paths used between a given source-destination pair having equal latency. Equilibrium flows are optimal solutions to a convex program, if the edge latencies are given by convex functions. A lot of subsequent work (see [36, Sec. 1.2] for a brief survey) on this model has been motivated by Braess’s Paradox [4]. An equilibrium in this model can be interpreted as a Nash equilibrium in a game with infinitely many users, each carrying an infinitesimal amount of traffic from a source to a destination. The individual cost of a user is defined to be the sum of the edge latencies on a path from the user’s source to its destination, the social cost is defined to be the sum over all edge latencies in the network. Inspired by the new interest in the coordination ratio, Roughgarden and Tardos [36,37,38] reinvestigated the Wardrop-model. We survey some of their results in section 6. The practical relevance of the Wardrop-model is underpinned by its use by traffic engineers, who utilized equilibria in route-guidance systems to prescribe user behavior. Recent analyses of this framework have been done by Schulz and Stier Moses [39] for capacitated networks; algorithms and experimental benchmarking on real world problems are given by Jahn et al. [20]. The two models differ in terms of their definition of social cost. Routing in the KP-model is equivalent to scheduling n jobs on m parallel machines [15]. The maximum expected latency is then equivalent to the expected makespan of
24
R. Feldmann et al.
a schedule. The Wardrop-model has its origins in the definition of road traffic systems. Here the total network load expressed in terms of the sum of edge loads is a natural measure for the network performance. In the KP-model there may be Nash equilibria with different social costs, while in the Wardrop-model the costs of Nash equilibria are equal. It is well known that in non-cooperative networks, due to the lack of coordination, the users may get to a solution, i.e. a Nash equilibrium, that is sub-optimal in terms of the social cost. Koutsoupias and Papadimitriou [23] defined the coordination ratio as the ratio of the social cost of a worst Nash equilibrium and the social cost of the global optimal solution. The coordination ratio is a measure for the price of anarchy. The well known Braess’s Paradox [4] shows that there exist networks, such that strict sub-networks perform better when users are selfish. If the goal is to construct a network in such a way that the coordination ratio of the network is small, an interesting network design problem arises: Given a network and the corresponding routing tasks, determine a set of edges which should be removed from the network to obtain a best possible routing at Nash equilibrium. Such network design problems arise e.g. in the routing of road traffic, when traffic engineers want to determine roads that should be closed, or changed to one-way roads, in order to obtain an optimal traffic flow. In the case that the users are allowed to randomize their strategies, the set of solutions of the routing problem equals the set of all mixed Nash equilibria. A special class of mixed equilibria is the class of Fully Mixed Nash equilibria. A Nash equilibrium is fully mixed, if every user plays each of its pure strategies with positive probability. Gairing et al. [15] conjecture that, if a fully mixed Nash equilibrium exists, it is the worst equilibrium with respect to the social cost in the KP-model with related links. In the case that the users are not allowed to randomize their strategies, the set of solutions of the routing problem consists of all pure Nash equilibria. In this environment the problem of Nashification becomes important. The problem of Nashification is to compute an equilibrium routing from a given non-equilibrium one without increasing the social cost. The intention to centrally nashify a nonequilibrium solution is to provide a routing from which no user has an incentive to deviate. One way to nashify an assignment is to perform a sequence of greedy selfish steps. A greedy selfish step is a user’s change of its current pure strategy to its best pure strategy with respect to the current strategies of all other users. Any sequence of greedy selfish steps leads to a pure Nash equilibrium. However, the length of such a sequence may be exponential in n. We present polynomial time algorithms for the problem of Nashification. Overview. In section 2 we review basic notations. Then, in section 3 we focus on the sub-model of identical links. In section 4 we turn to the more general model of related links. The most general sub-model of the KP-model is considered in section 5. Finally, in section 6 we review results for the Wardrop-model.
Selfish Routing in Non-cooperative Networks: A Survey
2
25
Basic Notations
Mathematical Preliminaries. For an integer i ≥ 1, denote [i] = {1, . . . , i}. Denote Γ the Gamma function; that is, for any natural ∞number i, Γ (i + 1) = i!, while for any arbitrary real number x > 0, Γ (x) = 0 tx−1 e−t dt. We use the fact that Γ (x + 1) = x · Γ (x). The Gamma function is invertible; both Γ and its inverse Γ −1 are increasing. Game Theoretic Framework. We consider a non-cooperative network game in which each network user i ∈ [n], or user for short, wishes to route a particular amount of traffic along (non-fixed) paths from source si to destination ti . Denote Pi as the set of all distinct simple paths from si to ti . Then, a pure strategy for user i ∈ [n] is a path in Pi . A mixed strategy for user i is a probability distribution over pure strategies. Each user i wants to minimize its private cost, which depends on the latency of the shared edges used by user i to route its traffic. A Nash equilibrium is then a setting where no user can decrease its private cost by unilaterally changing its strategy. The performance of the total network is measured in terms of social cost. In this paper we consider two models which are different with respect to the following aspects: 1. The structure of the network. 2. Traffics may be splittable or unsplittable. 3. The definition of the private and social cost functions. 2.1
KP-Model
We first consider a model introduced by Koutsoupias and Papadimitriou [23], called KP-model. Here, the network consists only of a single source node and a single destination node connected by m parallel links. Traffics are unsplittable, that is, a pure strategy of a user is some specific link, and a mixed strategy is a probability distribution over the set of links. The private cost of user i is defined to be the maximum expected latency on a link used by user i. The social cost is the expected maximum latency of a link. General. Due to the simplicity of the network, a pure strategy profile L is represented by an n-tuple l1 , l2 , . . . , ln ∈ [m]n ; a mixed strategy profile P is represented by an n × m probability matrix of nm probabilities pij , i ∈ [n] and j ∈ [m], where pij is the probability that user i chooses link j. A mixed strategy profile F is fully mixed if for all users i ∈ [n] and all links j ∈ [m], pij > 0. The support of the mixed strategy for user i ∈ [n], denoted support(i), is the set of those pure strategies (links) to which i assigns positive probability; so, support(i) = {j ∈ [m] | pij > 0}. For pure strategies we denote link(i) = li . System, Models and Cost Measures. Denote wi the traffic of user i ∈ [n]. Define the n × 1 traffic vector w in the natural way. Assume, without loss of n generality, that w1 ≥ w2 ≥ . . . ≥ wn , and denote W = i=1 wi the total traffic. Denote cj > 0 the capacity of link j ∈ [m], representing the rate at which the link processes traffic. In the model of identical links, all link capacities are equal.
26
R. Feldmann et al.
Link capacities may vary arbitrarily in the model of links. Without loss of related m generality assume c1 ≥ . . . ≥ cm , and denote C = j=1 cj the total capacity. So, the latency for traffic wi through link j equals wcji . In the model of unrelated links, there exists neither an ordering on the traffics nor on the capacities. We denote wij the traffic of user i ∈ [n] on link j ∈ [m]. Link capacities are not necessary as a problem input when links are unrelated. However, to obtain common expressions in the following definitions we assume that the link capacities are all equal to 1. Let P be an arbitrary mixed strategy profile. The expected latency of user i on link j is wij + k∈[n],k=i pkj wkj . λij = cj Denote IC(w, P) the maximum expected individual latency by IC(w, P) = max
max
i∈[n] j∈[m] | pij >0
λij .
The minimum expected latency of user i is λi = minj∈[m] λij . The expected load Λj on link j is the ratio between the expected traffic on link j and the capacity of link j. Thus, i∈[n] pij wij . Λj = cj The maximum expected load Λ = maxj∈[m] Λj is the maximum (over all links) of the expected load Λj on a link j. Associated with a traffic vector w and a mixed strategy profile P is the social cost [23, Section 2], denoted SC(w, P), which is the expected maximum latency on a link, where the expectation is taken over all random choices of the users. Thus, n k:lk =j wkj SC(w, P) = . pklk · max cj j∈[m] n l1 ,l2 ,...,ln ∈[m]
k=1
Note that SC(w, P) reduces to the maximum latency through a link in the case of pure strategies. Moreover, by definition of the social cost, there always exists a pure strategy profile with minimum social cost. So, the social optimum [23, Section 2] associated with a traffic vector w, denoted OPT(w), is the least possible maximum (over all links) latency through a link, that is, k:lk =j wkj OPT(w) = min max . cj l1 ,l2 ,...,ln ∈[m]n j∈[m] Nash Equilibria and Coordination Ratio. Say that a user i ∈ [n] is satisfied for the probability matrix P if λij = λi for all links j ∈ support(i), and λij ≥ λi for all j ∈ support(i). Otherwise, user i is unsatisfied. Thus, a satisfied user has no incentive to unilaterally deviate from its mixed strategy. P is a Nash equilibrium [29] iff all users i ∈ [n] are satisfied for P. Fix any traffic vector w. A best (worst) Nash equilibrium is a Nash equilibrium that minimizes (maximizes) SC(w, P). The best social cost is the social cost
Selfish Routing in Non-cooperative Networks: A Survey
27
of a best Nash equilibrium. The worst social cost is the social cost of a worst Nash equilibrium and is denoted by WC(w). Gairing et.al. [15] conjecture that in case of its existence the fully mixed Nash equilibrium, which is unique, is the worst Nash equilibrium. Fully Mixed Nash Equilibrium Conjecture [15]. Consider the model of arbitrary traffics and related links. Then, for any traffic vector w such that the fully mixed Nash equilibrium F exists, and for any Nash equilibrium P, SC(w, P) ≤ SC(w, F). The coordination ratio [23] is the maximum of WC(w)/OPT(w), over all traffic vectors w. Correspondingly, we denote the maximum of IC(w, P)/OPT(w) the individual coordination ratio. Though a mixed Nash equilibrium always exists, as implied by the fundamental theorem of Nash [29], this is not the case for pure Nash equilibria in general settings. However, for the model under consideration, there is always some pure strategy profile, which fulfills the Nash equilibrium condition. A proof can be given with the help of sequences of greedy selfish steps. In a selfish step, exactly one unsatisfied user is allowed to change its pure strategy. A selfish step is a greedy selfish step if the user chooses its best strategy. Selfish steps do not increase the social cost of the initial pure strategy profile. Starting with any pure strategy profile, every sequence of (greedy) selfish steps eventually ends in a pure Nash equilibrium. Moreover, starting with any pure strategy profile with minimum social cost, this also shows that there always exists a pure Nash equilibrium L with social cost SC(w, L) = OPT(w). Theorem 1 ([11], Theorem 1). There exists a pure Nash equilibrium. Algorithmic Problems. We list a few algorithmic problems related to Nash equilibria that we consider in this work. The definitions are given in the style of Garey and Johnson [14]. A problem instance is a tuple (n, m, w, c), where n is the number of users (traffics), m is the number of links, w = (wi,j ) is a n × m matrix of traffics and c = (cj ) is a vector of m link capacities. Π1 : BEST NASH EQUILIBRIUM SUPPORTS INSTANCE: A problem instance (n, m, w, c). OUTPUT: A best Nash equilibrium P. Π2 : WORST NASH EQUILIBRIUM SUPPORTS INSTANCE: A problem instance (n, m, w, c). OUTPUT: A worst Nash equilibrium P. The corresponding problem to compute a worst pure Nash equilibrium is denoted as WORST PURE NASH EQUILIBRIUM SUPPORTS. If, additionally, m is constant the problem is denoted as m-WORST PURE NASH EQUILIBRIUM SUPPORTS.
28
R. Feldmann et al.
Π3 : NASH EQUILIBRIUM SOCIAL COST INSTANCE: A problem instance (n, m, w, c); a Nash equilibrium P for (n, m, w, c). OUTPUT: The social cost of the Nash equilibrium P. Π4 : NASHIFY INSTANCE: A problem instance (n, m, w, c); a pure strategy profile L for the system of the users; an integer k > 0. QUESTION: Is there a sequence of at most k selfish steps that transforms L to a (pure) Nash equilibrium? If k is a constant and not part of the input the corresponding decision problem is denoted as k-NASHIFY. 2.2
Wardrop-Model
In the Wardrop-model traffics are splittable into infinitesimally small pieces. Each of these infinitely many pieces may be viewed as the traffic of a single user who chooses a path from its source to its destination. The problem of routing splittable traffic in a congested network has already been studied since the 1950’s [41,3]. Given a network, rates of traffic between pairs of nodes, and a latency function for each edge, the objective is to route traffic such that the sum of all latencies is minimized. More formally, the model is defined as follows: General. An instance (G, r, l) for the routing problem consists of a network G = (V, E), a set r = {(ri , si , ti ) ∈ IR>0 × V × V | i ∈ [k]} of routing tasks, and a set l = {le | e ∈ E} of edge latency functions. A triple (ri , si , ti ) ∈ r defines the task to route a traffic k of rate ri from si to ti . Traffics are to be routed via : P → IR≥0 . For paths in Pi . Let P = i=1 Pi . A traffic flow then is a function f a fixed flow f the flow fe along edge e ∈ E is defined as fe = P ∈P:e∈P fP . f is a feasible solution for the routing problem instance (G, r, l) iff P ∈Pi fP = ri for all i ∈ [k]. System, Models and Cost Measures. The latency of an edge e is given by a non-negative, differentiable and non-decreasing function le : IR≥0 → IR≥0 . For a fixed flow f the latency of an edge e ∈ E is defined as ce (fe ) = le (fe )fe , the product of e s latency when routing traffic fe times the traffic fe itself. The latency cP (f ) = e∈P ce (fe ) of a path P is defined to be the sum of the edge latencies on P . The social cost C(f ) of a flow f is defined as the sum of the edge latencies C(f ) = ce (fe ) = lP (f )fP , where lP (f ) =
e∈E
P ∈P
e∈P le (fe ).
Nash Equilibria and Coordination Ratio. By definition, a flow f is a Nash equilibrium, if any arbitrarily small amount of flow routed from, say, si to ti via
Selfish Routing in Non-cooperative Networks: A Survey
29
a path P1 ∈ Pi cannot improve the latency experienced on P1 by switching to a path P2 ∈ Pi . More formally, from [7] we obtain the following definition: A flow f in G is a Nash equilibrium, occasionally called a Wardrop equilibrium [7], if for all P1 , P2 ∈ P and all δ ∈ [0, fP1 ], we have lP1 (f ) ≤ lP2 (f˜), where fP − δ if P = P1 f˜P = fP + δ if P = P2 fP if P ∈ {P1 , P2 }. In contrast to the notion of mixed Nash equilibria in the KP-model, here flows may be split among different paths. Consequently the social cost C(f ) of a flow as defined above is not a measure of expected cost. Nash equilibria in this model are pure, however, there are infinitely many users, each carrying an infinitesimal amount of the overall traffic. As for the KP-model, the coordination ratio is defined by the ratio of the social cost of the worst Nash equilibrium and the minimum possible total latency.
3
Routing in the KP-Model with Identical Links
In this section we consider a simple model for our routing game, namely the KP-model where all links have the same capacity. We distinguish between pure Nash equilibria, where each user chooses a single link as its strategy, and mixed Nash equilibria. Here the strategy of a user is a probability distribution over the links. 3.1
Pure Nash Equilibria
Fotakis et al. [11, Theorem 3] show that computing a pure Nash equilibrium with minimum social cost is N P-hard even in the model of identical links. Since this problem can be formulated as an integer program, it follows that it is N Pcomplete. However, computing some pure Nash equilibrium L can be done with help of the LPT-algorithm introduced by Graham [16], using polynomial time and yielding 4 1 OPT(w). SC(w, L) ≤ − 3 3m Another way to compute a pure Nash equilibrium is, starting from any pure strategy profile, to allow the users to perform greedy selfish steps. Every sequence of greedy selfish steps eventually yields a pure Nash equilibrium. We now give bounds on the maximum length of a sequence of greedy selfish steps, that show that such a sequence may be of exponential length. Theorem 2 ([8]). There exists an instance of n users on m identical links for which the maximum length of a sequence of greedy selfish steps is at least
m−1 n m−1
2(m − 1)!
.
An upper bound on the number of greedy selfish steps is given by
30
R. Feldmann et al.
Theorem 3 ([9]). For any instance with n users on identical links, the length of any sequence of greedy selfish steps is at most 2n − 1. Instead of the maximum length one may ask about the minimum length of a sequence of greedy selfish step. In particular one may consider whether a given pure strategy profile can be transformed into a pure Nash equilibrium with at most k selfish steps. This problem is called NASHIFY and was shown to be N P-complete. Theorem 4 ([15]). NASHIFY is N P-complete on identical links even if m = 2. The proof relies on a reduction from PARTITION. This reduction implies that NASHIFY is N P-complete in the strong sense (cf. [14, Section 4.2]) if m is part of the input. Thus, there is no pseudo-polynomial-time algorithm for NASHIFY (unless P = N P). In contrast, there is a natural pseudo-polynomial-time algorithm for k-NASHIFY, which exhaustively searches all sequences of k selfish steps; since a selfish step involves a (unsatisfied) user and a link for a total of mn choices, the running time of such an algorithm is Θ((mn)k ). In order to compute a Nash equilibrium by using sequences of greedy selfish steps, we can use two types of sequences of polynomial length introduced by Even-Dar et al. [8]. Theorem 5 ([8]). For FIFO and Random strategy, the length of a sequence of greedy selfish steps is at most n(n + 1)/2 before reaching a Nash equilibrium. We continue to present algorithm NashifyIdentical that solves NASHIFY when n selfish steps are allowed. A crucial observation is Lemma 1 ([15,8]). A greedy selfish step of an unsatisfied user i with traffic wi makes no user k with traffic wk ≥ wi unsatisfied. NashifyIdentical sorts the user traffics in non-increasing order so that w1 ≥ . . . ≥ wn . Then for each user i := 1 to n, it removes user i from the link it is currently assigned to, it finds the link j with the minimum latency, and it reassigns user i to the link j. We prove: Theorem 6 ([15,8]). Let L = l1 , . . . , ln be a pure strategy profile for n users with traffics w1 , ..., wn on m identical links with social cost SC(w, L). Then algorithm NashifyIdentical computes a Nash equilibrium from L with social cost ≤ SC(w, L) using O(n log n) time. The proof relies on Lemma 1 and the usage of appropriate data structures. Running the PTAS of Hochbaum and Shmoys [18] for scheduling n jobs on m identical machines yields a pure strategy profile L such that SC(w, L) ≤ (1 + ε)OPT(w). On the other hand, applying NashifyIdentical to L yields a Nash equilibrium L such that SC(w, L ) ≤ SC(w, L). Thus, SC(w, L ) ≤ (1 + ε)OPT(w). Since also OPT(w) ≤ SC(w, L ), it follows that:
Selfish Routing in Non-cooperative Networks: A Survey
31
Theorem 7 ([15]). There exists a PTAS for BEST PURE NASH EQUILIBRIUM for the model of identical links. After studying best pure Nash equilibria we now turn our attention to worst pure Nash equilibria. We first show: Theorem 8 ([40,15]). Fix any traffic vector w and pure Nash equilibrium L. Then, 2 SC(w, L) ≤2− . OPT(w) m+1 Furthermore, this upper bound is tight. Theorem 8 shows that the social cost of any Nash equilibrium is at most 2 the factor 2 − m+1 away from the social cost of an optimal Nash equilibrium. This also implies, that every Nash equilibrium approximates the social cost of the worst Nash equilibrium within this factor. We now establish, that approximating a worst Nash equilibrium with a better guaranty is N P-hard. Theorem 9 ([15]). It is N P-hard to find a Nash equilibrium L with 2 WC(w) <2− −ε SC(w, L)) m+1
for any ε > 0.
It is N P-hard in the strong sense if the number of links m is part of the input. The proof of Theorem 9 is based on a reduction from PARTITION. Since WORST CASE PURE NASH EQUILIBRIUM is N P-hard in the strong sense [11], there exists no pseudo-polynomial algorithm to solve WORST CASE PURE NASH EQUILIBRIUM. However, for a constant number of links m such an algorithm exists [15]. 3.2
Mixed Nash Equilibria
For a mixed Nash equilibrium it is hard even to compute its social cost. Theorem 10 ([11]). NASH EQUILIBRIUM SOCIAL COST is #P-complete even in the model of identical links. However, Fotakis et al. [11] show that there exists a fully polynomial, randomized approximation scheme for NASH EQUILIBRIUM SOCIAL COST. The coordination ratio was introduced by Koutsoupias and Papadimitriou [23]. They provided a lower bound of Ω(log m/ log log m). This result can be tightened as follows: Theorem 11 ([24,6]). For m identical links the worst-case coordination ratio is at most log m · (1 + o(1)). Γ −1 (m) + Θ(1) = log log m
32
R. Feldmann et al.
Together with the lower bound from [23], this bound is tight up to an additive constant. In the remainder of this section, we consider fully mixed Nash equilibria. Mavronicolas and Spirakis [28] showed that in the model of identical links there always exists a unique fully mixed Nash equilibrium. Lemma 2 ([28]). There is a unique fully mixed Nash equilibrium P with pij = 1 m for any user i ∈ [n] and link j ∈ [m]. Since we know that in our model the fully mixed Nash equilibrium always exists, we can compare it to a worst Nash equilibrium. The following theorem provides evidence for the Fully Mixed Nash Equilibrium Conjecture. Theorem 12 ([25]). Consider the model of identical traffics and identical links, and assume that m = 2 and n is even. Then, the FMNE Conjecture is valid.
4
Routing in the KP-Model with Related Links
In this section we are engaged in the two node routing network with related links. Often the term uniform links is used to refer to this model in literature. Subsection 4.1 deals with pure Nash equilibria only, whereas the results quoted in subsection 4.2 hold for general (i.e. mixed) Nash equilibria. Subsection 4.3 concentrates on the fully mixed Nash equilibrium. 4.1
Pure Nash Equilibria
In [11] it was shown that the LPT algorithm, which was first explored by Graham [16], can be used to compute some pure Nash equilibrium. Its coordination ratio lies between 1.52 and 1.67 [13]. Keep in mind, that the exact computation of the best Nash equilibrium is N P-complete in the strong sense (see section 3). We now describe another approach to approximate the best Nash equilibrium with arbitrary but constant precision. A Polynomial Time Algorithm for Nashification. We call the process of converting a given pure strategy profile for related links into a Nash equilibrium without increasing the social cost Nashification. A simple Nashification approach is to perform a greedy selfish step for any user which can improve by this as long as such a user exists. Unfortunately, this can lead to an exponential number of steps, even on identical links (see section 3). In Figure 1 we present the algorithm NashifyRelated which nashifies any pure routing by a polynomial number of (not necessarily selfish) moves without increasing the maximum latency. A crucial observation for proving the correctness of the algorithm is stated in Lemma 3, which is a generalization of Lemma 1. It shows that greedy-moving a user from its current link to a non-slower link can only make users of smaller size unsatisfied.
Selfish Routing in Non-cooperative Networks: A Survey
33
NashifyRelated Input: n users with traffics w1 ≥ · · · ≥ wn m links with capacities c1 ≥ · · · ≥ cm Assignment of users to links Output: Assignment of users to links with less or equal maximum latency, which is a NE { // phase 1: i := n; S := {n}; while i ≥ 1 { move user i to link with highest possible index without increasing overall maximum latency; if i was moved or i ∈ S or link(i) ≤ link(i + 1) then S := S ∪ {i}; i := i − 1; else { move user i to link with smallest possible index without increasing overall maximum latency; if i was moved then S := S ∪ {i}; i := n; else break; } } // phase 2: while ∃i ∈ S { make greedy selfish step for user i = min(S); S := S\{i}; } }
Fig. 1. NashifyRelated: Converts any assignment into a Nash equilibrium
Lemma 3 ([9]). If user i with traffic wi performs a greedy selfish step from link j to link k with cj ≤ ck , then no user s with traffic ws ≥ wi becomes unsatisfied. NashifyRelated works in two phases. At every time link(i) denotes the link user i is currently assigned to. The main idea is to fill up slow links with users with small traffics as close to the maximum latency as possible in the first phase (but without increasing the maximum latency) and to perform greedy selfish steps for unsatisfied users in the second phase. During the first phase, set S is used to collect all users that have already been considered by the algorithm. No user is deleted from S in this phase. Throughout the whole algorithm, each user in S is located on a link with non-greater index than any smaller user in S. In other words, the smaller the traffic of a user in S, the slower the link it is assigned to. We may start with S = {n}, because the above property is trivially fulfilled if S contains only one user. When no further user can be added to S, the first phase terminates. In the second phase we successively perform
34
R. Feldmann et al.
greedy selfish steps for all unsatisfied users, starting with the largest one. That is, we move each user, who can improve by changing its link, to its best link with respect to the current situation. Because of the special conditions that have been established by phase 1, and by Lemma 3, these greedy selfish steps do not cause other users with larger traffics to become unsatisfied. Note that during phase 1 the algorithm does not necessarily perform selfish steps. The social cost, however, cannot be increased due to the constraints of the move commands in phase 1. The following lemma formalizes the above mentioned conditions which are established by phase 1. Lemma 4 ([9]). After phase 1 the following holds: (1) All unsatisfied users are in S. (2) S = {n, (n − 1), . . . , (n + 1 − |S|)}, that is, S contains the |S| users with smallest traffics. (3) i, i + 1 ∈ S ⇒ link(i) ≤ link(i + 1). (4) Every user i ∈ S can only improve by moving to a link with smaller index. Each of the properties in Lemma 4 also holds after each run of the loop in phase 2 ([9]). In particular, S contains all unsatisfied users (property (1)). But, as S is empty when the algorithm terminates, this implies, that there are no unsatisfied users, i.e., the new assignment, defined by link(·), is a Nash equilibrium. Implementing the algorithm in a proper way yields a running time as stated in the following theorem. Theorem 13 ([9]). Given any pure strategy profile for the model of related links, algorithm NashifyRelated computes a Nash equilibrium with non-increased social cost, performing at most (m + 1)n moves in sequential running time O(m2 n). Combining any approximation algorithm for the computation of good routings with the algorithm NashifyRelated yields a method for approximating the best Nash equilibrium. Particularly, using the PTAS for the Scheduling Problem from Hochbaum and Shmoys [19], we get: Corollary 1. There is a PTAS for approximating a best pure Nash equilibrium. We cannot expect to find an FPTAS for this problem, since the exact computation of the best Nash equilibrium is N P-complete in the strong sense [11]. Coordination Ratio. Theorem 14 ([6]). The coordination ratio for pure Nash equilibria on m related links with capacities c1 ≥ · · · ≥ cm is bounded from above by c1 log m −1 (1 + o(1)) as well as O log . Γ (m) + 1 = log log m cm
Selfish Routing in Non-cooperative Networks: A Survey
35
The upper bound in Theorem 14 can be improved to Γ −1 (m) [9]. The following Example shows that this improved bound is asymptotically tight. Example 1 ([9]) Let k ∈ N, and consider the following instance with k different classes of users: – Class U1 : |U1 | = k users with traffics 2k−1 – Class Ui : |Ui | = 2i−1 · (k − 1) j=1,...,i−1 (k − j) users with traffics 2k−i for all 2 ≤ i ≤ k. In the same way we define k + 1 different classes of links: – Class P0 : One link with capacity 2k−1 . – Class P1 : |P1 | = |U1 | − 1 links with capacity 2k−1 . – Class Pi : |Pi | = |Ui | links with capacity 2k−i for all 2 ≤ i ≤ k. Consider the following assignment: – Class P0 : All users in U1 are assigned to this link. – Class Pi : On each link in Pi there are 2(k−i) users from Ui+1 , respectively, for all 1 ≤ i ≤ k − 1. – Class Pk : The links from Pk remain empty. The above assignment is a pure Nash equilibrium L with social cost SC(w, L) = k and OPT(w) = 1. Lemma 5 ([9]). For each k ∈ N there exists an instance with a pure Nash equilibrium L with k= 4.2
SC(w, L) ≥ Γ −1 (m) · (1 + o(1)). OPT(w)
Mixed Nash Equilibria
In this subsection we state upper bounds on the coordination ratio and on the individual coordination ratio for mixed Nash equilibria on related links. Theorem 15 ([6]). The coordination ratio for m related parallel links is log m log m .
Θ min , log m log log log m log log c1 /cm
Whereas the above theorem bounds the coordination ratio depending only on the number of links m and the relation between the fastest and slowest link, we now introduce a structural parameter p, which can yield better bounds on the individual coordination ratio (and the coordination ratio for pure Nash equilibria). We denote M1 = {j ∈ [m] | w1 ≤ cj · OPT(w)} and p = j∈M1 cj /C. In other words, p is the ratio between the sum of link capacities of links to which the largest traffic can be assigned causing latency at most OPT(w) and the sum of all link capacities. With the help of p we are able to prove an upper bound on the individual coordination ratio.
36
R. Feldmann et al.
Theorem 16 ([9]). For any mixed Nash equilibrium P the ratio between the maximum expected individual latency IC(w, P) = maxi∈[n] λi and OPT(w) for the model of related links is bounded by 3 1 3 + if 13 ≤ p ≤ 1, 2 p − 4 IC(w, P) 1 < 2 + 3 p1 − 2 if 37 ≤ p < 13 , OPT(w)
1 if p < 37 . Γ −1 p1 1 Since wc11 ≤ OPT(w), we have p ≥ cC1 ≥ m . Furthermore, IC(w, P) ≥ Λ holds for every assignment. Thus, from Theorem 16 we can derive an upper bound of Γ −1 (m)OPT(w) on both the maximum expected load and the maximum expected individual latency. This leads to an improvement of the upper bound on the coordination ratio for pure Nash equilibria [6]. From Example 1 the following lower bound on the coordination ratio subject to p can be obtained.
Lemma 6 ([9]). For each k ∈ N there exists an instance with a pure Nash equilibrium L with 1 SC(w, L) −1 ≥Γ . k= OPT(w) 3p We can also prove k ≥ Γ −1 ( p1 ) − 1. This shows that the generalized upper bound is tight up to an additive constant for all m whereas Lemma 5 shows tightness of Γ −1 (m) up to an additive constant only for large m. We conclude this section by giving another upper bound on the maximal expected individual latency of a mixed Nash equilibrium, which only depends on the number of links m. The same bound also applies to the social cost of a pure Nash equilibrium. Theorem 17 ([9]). For any mixed Nash equilibrium P on m related links, the maximum expected individual cost is bounded by √ 1 + 4m − 3 OPT(w). IC(w, P) ≤ 2 This bound is tight if and only if m ≤ 5. Only if m ≤ 3, there is a pure Nash equilibrium matching the bound. For m ≥ 2, there is no fully mixed Nash equilibrium matching the bound. √
That 1+ 4m−3 is an upper bound on the coordination ratio for pure Nash 2 equilibria, which is an implication of Theorem 17, can also be obtained from Cho and Sahni [5] and Schuurman and Vredeveld [40], where jump optimal schedules are considered. A schedule is said to be jump optimal if no user on a link with maximum load can improve by moving to another processor. Obviously, the set of pure Nash equilibria is √ a subset of the set of jump optimal schedules. Thus, the strict upper bound of 1+ 4m−3 on the ratio between best and worst makespan 2 of jump optimal schedules [5,40] also holds for pure Nash equilibria. This bound is not asymptotically tight, but for small numbers of links (m ≤ 19) better than the asymptotically tight bound Γ −1 (m).
Selfish Routing in Non-cooperative Networks: A Survey
4.3
37
Fully Mixed Nash Equilibria
A fully mixed Nash equilibrium is a special Nash equilibrium, where all probabilities pij for a user i to choose link j are strictly positive. Such a Nash equilibrium does not always exist, but if it exists, it is unique and can be efficiently computed. Theorem 18 ([28]). For the model of related links there is a fully mixed Nash equilibrium F for a traffic vector w if and only if
W cj mcj · 1− ∈ (0, 1) + 1− C (n − 1)wi C
∀i ∈ [n], j ∈ [m].
If F exists, F is unique and has associated Nash probabilities W cj mcj · 1− + , pij = 1 − C (n − 1)wi C
for any user i ∈ [n] and link j ∈ [m]. Gairing et al. [15] conjecture that a fully mixed Nash equilibrium (FMNE ) is the worst-case Nash equilibrium (the one with highest social cost) among all Nash equilibria for the same instance. So far, this conjecture is proved to hold in special cases (Theorem 20) and to hold up to a constant multiplicative factor in the general related links case (Theorem 19). Theorem 19 ([11]). Consider an instance with identical traffics for the model of related links for which the fully mixed Nash equilibrium exists. Then the social cost of the worst mixed Nash equilibrium is at most 49.02 times the social cost of any fully mixed Nash equilibrium.
Theorem 20 ([25]). For the model of related links and two identical traffics the FMNE Conjecture holds. In contrast to the yet unproved claim of the FMNE Conjecture (that the fully mixed Nash equilibrium has the worst social cost), Lemma 7 shows, that each user indeed experiences the worst individual cost in the fully mixed Nash equilibrium. This implies, that the social cost of a pure Nash equilibrium is bounded from above by the social cost of the fully mixed Nash equilibrium. Lemma 7 ([15]). Fix any traffic vector w, mixed Nash equilibrium P and user i. Then, λi (w, P) ≤ λi (w, F). Theorem 21 ([15]). Fix any traffic vector w and pure Nash equilibrium L. Then, SC(w, L) ≤ SC(w, F).
38
5
R. Feldmann et al.
Routing in the KP-Model with Unrelated Links
Up to now only little attention has been payed to Nash equilibria in the model of unrelated links. Similar to the model of identical links, a pure Nash equilibrium in the model of unrelated links can be computed by performing sequences of (greedy) selfish steps. However, up to now it is unknown whether, starting with any pure strategy profile, there always exists a sequence of polynomial length ending in a pure Nash equilibrium. A trivial upper bound on the number of selfish steps before reaching a pure Nash equilibrium is mn . Starting with a pure strategy profile with minimal social cost, the convergence of any sequence of (greedy) selfish steps implies that there always exists a pure Nash equilibrium with optimal social cost. However, we can not hope to approximate a best pure Nash equilibrium within factor 32 since Minimum Multiprocessor Scheduling on unrelated processors is not approximable within a factor 32 − ε for any ε > 0 [26]. Consider the case n ≤ m, that is, there are at most as many users as links. Then, the minimum expected latency of any user i in a pure Nash equilibrium L is smaller than the minimum expected latency of user i in the fully mixed Nash equilibrium F. Proposition 1 ([25]). For the model of unrelated links, let w = (wij ) be a traffic matrix such that a fully mixed Nash equilibrium F exists, and let L be a pure Nash equilibrium. Let n ≤ m. Then, for every user i, λi (L) < λi (F). Clearly, the social cost of any pure Nash equilibrium L is equal to the maximum of the expected latencies, while the social cost of a fully mixed Nash equilibrium F is at least the expected latency of any user. Hence, Proposition 1 implies that for n ≤ m the social cost of every pure Nash equilibrium L is at most the social cost of the fully mixed Nash equilibrium F. Theorem 22 ([25]). For the model of unrelated links, let w = (wij ) be a traffic matrix such that a fully mixed Nash equilibrium F exists, and let L be a pure Nash equilibrium. Let n ≤ m. Then, SC(w, L) ≤ SC(w, F). In case of n = 2, the minimum expected latency of user i ∈ [2] in any mixed Nash equilibrium P is also bounded by its minimum expected latency in the fully mixed Nash equilibrium F. Proposition 2 ([25]). For the model of unrelated links, let w = (wij ) be a traffic matrix such that a fully mixed Nash equilibrium F exists, and let P be a Nash equilibrium. If n = 2 then λi (P) ≤ λi (F) for every user i ∈ [2]. This implies that the FMNE Conjecture holds for n = m = 2. However, for the case n = 3 and m = 2 there exist instances for which the FMNE Conjecture does not hold. Theorem 23 ([25]). For the model of unrelated links, if n = 2 and m = 2, then the FMNE Conjecture holds. If n = 3 and m = 2, then the FMNE Conjecture does not hold.
Selfish Routing in Non-cooperative Networks: A Survey
6
39
Routing in the Wardrop-Model
The problem of routing splittable traffics in a congested network has already been studied since the 1950’s [41,3]. In contrast to the notion of mixed Nash equilibria in the previous sections, here flows may be split among different paths. The model can be interpreted as a game with infinitely many users each carrying an infinitesimally small amount of traffic. A Nash equilibrium is defined to be a state in which no such user has an incentive to unilaterally deviate from its chosen path. In the Wardrop-model the following characterization of a Nash equilibrium, occasionally called a Wardrop equilibrium, can be obtained: Theorem 24 ([41]). A flow f is a Nash equilibrium iff for every i ∈ [k] and P1 , P2 ∈ Pi with fP1 > 0 we have lP1 (f ) ≤ lP2 (f ). Thus, in a Nash equilibrium all paths nP ∈ Pi which are used by user i have equal latency, say Li (f ). Then C(f ) = i=1 Li (f )ri . The main differences to the KP-model are the following: a) The social cost of a flow is defined to be the sum of the edge latencies, as opposed to the maximum of the edge latencies in the KP-model. b) Traffic rates and flows may be split arbitrarily. Equivalently, the Wardropmodel can be viewed as a system of infinitely many users, each controlling an infinitesimally small amount of traffic. In the Wardrop-model the fact that flows are splittable into arbitrarily small pieces guarantees the existence of a Nash equilibrium. c) Edge latencies are defined by using quite general, but not arbitrary, edge latency functions, giving the latency on an edge per unit of flow. If all edge latency functions le (fe ) are of the form le (fe ) = ae fe , the definition of latency coincides with the definition of latency in the KP-model with related links. d) Due to the differences in the definition of latencies (a) and due to the fact that all Nash equilibria in the Wardrop-model are pure (b), the semantic of the coordination ratios is different in the two models. In the Wardrop-model optimal flows can be computed as a solution of the non-linear program. N LP : min e∈E ce (fe ) s.t. P ∈Pi
fe =
fP = ri
P ∈P:e∈P
fP ≥ 0
fP
∀i ∈ [k] ∀e ∈ E ∀P ∈ P
From this non-linear program the following necessary and sufficient condition for a flow of being optimal can be derived [3] in the case of convex edge latencies ce (fe ): Theorem 25 ([3]). Let ce (fe ) be convex for all e ∈ E. A flow f is optimal iff for every i ∈ [k] and P1 , P2 ∈ Pi with fP1 > 0 we have cP1 (f ) ≤ cP2 (f ), where d cP (f ) denotes the derivative of cP (f ). cP (f ) = dx
40
R. Feldmann et al.
Note that from the two characterizations of Nash equilibria and optimal flows an optimal flow f for a problem instance (G, r, l) with convex edge latencies ce (fe ) = le (fe )fe can be regarded as a flow at Nash equilibrium with respect to the edge latencies ce (fe ) = le (fe ) + le (fe )fe . From this it follows that there always exists a Nash equilibrium in the Wardrop-model, and that, if f, f˜ are Nash equilibria then C(f ) = C(f˜). Roughgarden and Tardos proved the following bicriteria bound for the coordination ratio: Theorem 26 ([36]). Let the edge latency functions le (fe ) be continuous and nondecreasing for all e ∈ E. If f is a flow at Nash equilibrium for (G, r, l) and f ∗ is a feasible flow for (G, (1 + δ)r, l), then C(f ) ≤ 1δ C(f ∗ ). In particular (δ = 1), the cost of a flow at Nash equilibrium never increases the cost of a feasible flow for the problem instance obtained from doubling the traffic rates.
xp s
x t
s
1 0
1
t x
1 Fig. 2. Pigou’s example (left) and Braess’s Paradox (right)
Pigou’s example [35,3] (see Figure 2) can be used to show that the bound of theorem 26 is tight: In the graph G with two nodes s, t and two edges from s to t with edge latency functions le1 = 1 and le2 = xp the optimal solution to route 1 a total of one unit of flow from s to t is to route a fraction of (p + 1)− p units 1 along e2 and a flow of 1 − (p + 1)− p along edge e1 . The social cost of the optimal solution tends to zero when p tends to infinity. The unique Nash equilibrium in Pigou’s example is to route all flow along edge e2 with social cost 1. For a fixed δ > 0 and any ε ∈ [0, δ[, p can be chosen large enough such that C(f ∗ ) < δ for an optimal flow f ∗ of (G, (1 + δ − ε), l) and such that C(f ∗∗ ) is arbitrarily close to δ for an optimal flow f ∗∗ of (G, (1 + δ), l). Then 1δ · C(f ∗∗ ) is arbitrarily close to C(f ) = 1. In the Wardrop-model the coordination ratio cannot be bounded from above by a constant, when arbitrary edge latency functions are allowed. However, when the edge latency functions le are restricted to be linear ones, le (fe ) = ae fe + be for some ae , be ≥ 0, the coordination ratio is bounded from above by 43 :
Selfish Routing in Non-cooperative Networks: A Survey
41
Theorem 27 ([36]). If (G, r, l) has linear edge latency functions le (fe ) = ae fe + be then 4 WC(G, r, l) ≤ OPT(G, r, l) 3 A problem instance based on Braess’s Paradox [4] (see Figure 2) is used to show that the bound from the above theorem is tight. Suppose one unit of flow is to be routed from s to t. The globally optimal solution is to route 12 along the upper path and 12 along the lower path, resulting in an overall social cost of 3 2 . The unique Nash equilibrium in this environment is obtained when the total traffic is routed via the edge connecting the two intermediate nodes, resulting in a social cost of 2. The coordination ratio in this example is 43 . The interesting fact justifying the title “Paradox” is that after removing the edge with latency 0 the globally optimal solution does not change and the unique Nash equilibrium coincides with the global optimal solution. The network performs better after deletion of an edge. Motivated by Braess’s Paradox Roughgarden [37] studied a natural network design problem: NETWORK DESIGN INSTANCE: (G, r, l) with a network G = (V, E), rates r and latencies l. OUTPUT: A subgraph H = (V, EH ) ⊂ G such that a flow f at Nash equilibrium for (H, r, l) has minimum social cost over all possible subgraphs H. In the right graph of figure 2 deleting the edge with latency zero leads to a flow at Nash equilibrium which equals the globally optimal solution. For linear latency functions it follows from Theorem 27 that the trivial algorithm, which does not remove any edge, is a 43 -approximation. Roughgarden proved the following Theorem 28 ([37]). If (G, r, l) has linear edge latency functions le (fe ) = ae fe + be then for any ε > 0, there is no ( 43 − ε)-approximation algorithm for NETWORK DESIGN unless P = N P. For a more general class of latency functions Roughgarden proved Theorem 29 ([37]). If (G, r, l) with G = (V, E) and |V | = n has continuous, nonnegative and nondecreasing edge latency functions then, for any ε > 0, there is no ( n2 − ε)-approximation algorithm for NETWORK DESIGN unless P = N P. Moreover, Roughgarden showed that the approximation quality of the trivial algorithm, which returns the entire graph G, is upper bounded by n2 and that there are instances (generalizations of the Braess graph), for which the trivial algorithm returns an n2 -approximation. Recently, Roughgarden [38] proved that the worst coordination ratio, that may occur for a network, is equal to the coordination ratio of some simple 2-node
42
R. Feldmann et al.
2-edge network. In the example of Pigou the flow at Nash equilibrium incurs 1 unit of social cost, whereas the optimal flow has social cost that tend to zero at a rate of Θ( logp p ). Thus, as the latency function xp gets “steeper”, the coordination ratio for Pigou’s example grows to infinity. The main result of Roughgarden [38] bounds the coordination ratio of problem instance (G, r, l) by a measure of the steepness of the latency functions allowed. This bound is independent of the network topology of G. A class of nonnegative, differentiable and nondecreasing latency functions L is called standard, if it contains a non-zero function and if for each l ∈ L, the function cl (x) = x · l(x) is convex on [0, ∞[. For a non-zero latency function l d d such that cl (x) = x · l(x) is convex on [0, ∞[ let cl (x) = dx cl (x) = dx (x · l(x)) and define the anarchy value α(l) of l as α(l) =
1 r>0:l(r)>0 λµ + (1 − λ) sup
where λ ∈]0, 1[ satisfies cl (λr) = l(r) and µ ∈ [0, 1] is defined as µ = l(λr)/l(r). Given the anarchy values of single latency functions, the anarchy value α(L) of a standard class of latency functions L is defined as α(L) = sup0=l∈L α(l). Let ρ(G, r, l) denote the ratio between the social cost of a Nash equilibrium and the social cost of an optimal flow for (G, r, l) Since in the Wardrop-model all Nash equilibria have equal social cost, ρ(G, r, l) is well defined and expresses the coordination ratio of the problem instance (G, r, l). That α(L) is always an upper bound on the coordination ratio is stated in the following Theorem 30 ([38]). Let L be a standard class of latency functions with anarchy value α(L). Let (G, r, l) be a problem instance with latency functions drawn from L. Then ρ(G, r, l) ≤ α(L). Based on Pigou’s example Roughgarden constructed instances of the routing problem such that their coordination ratio approaches the anarchy value: Lemma 8 ([38]). Given a standard class L of latency functions containing the constant functions, there are instances (G, r, l), where G is a network of two nodes and two links and latency functions l ∈ L such that ρ(G, r, l) is arbitrarily close (from below) to α(L). Lemma 8 and Theorem 30 can be combined to achieve Theorem 31 ([38]). Let G2 denote the graph with one source node, one sink node, and two edges directed from source to sink. Let L be a standard class of latency functions containing the constant functions. Let I denote the set of all instances (G, r, l) with latency functions in L and I2 ⊆ I the instances with underlying network G2 , then sup (G2 ,r,l)∈I2
ρ(G2 , r, l) = α(L) =
sup (G,r,l)∈I
ρ(G, r, l)
Selfish Routing in Non-cooperative Networks: A Survey
43
An application of this theory to the set of polynomials taken as a standard class of latency functions results in the following Theorem 32 ([38]). Let Lp be the set of polynomials, let Ip be the set of instances with latency functions in Lp . Then sup (G,r,l)∈Ip
ρ(G, r, l) =
1 1−
p (p+1)
= Θ( p+1 p
p ) log p
Roughgarden generalized the above mentioned results on the coordination ratio for sets of latency functions that do not contain all constant functions and found similar results based on graphs with one source, one sink, and m parallel edges from the source to the sink.
References 1. M.J. Beckmann. On the theory of traffic flow in networks. Traffic Quart, 21:109– 116, 1967. 2. P. Brucker, J. Hurink, and F. Werner. Improving local search heuristics for some scheduling problems. part ii. Discrete Applied Mathematics, 72:47–69, 1997. 3. M. Beckmann, C.B. McGuire, and C.B. Winsten. Studies in the Economics of Transportation. Yale University Press, 1956. ¨ 4. D. Braess. Uber ein Paradoxon der Verkehrsplanung. Unternehmensforschung, 12:258–268, 1968. 5. Y. Cho and S. Sahni. Bounds for list schedules on uniform processors. SIAM Journal on Computing, 9(1):91–103, 1980. 6. A. Czumaj and B. V¨ ocking. Tight bounds for worst-case equilibria. In Proc. of the 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’02), pages 413–420, 2002. 7. S.C. Dafermos and F.T. Sparrow. The traffic assignment problem for a general network. Journal of Research of the National Bureau of Standards, Series B, Vol. 73B, No. 2, pages 91–118, 1969. 8. E. Even-Dar, A. Kesselmann, and Y. Mansour. Convergence time to nash equilibria. In Proc. of the 30th International Colloquium on Automata, Languages, and Programming (ICALP’03), 2003. 9. R. Feldmann, M. Gairing, T. L¨ ucking, B. Monien, and M. Rode. Nashification and the coordination ratio for a selfish routing game. In Proc. of the 30th International Colloquium on Automata, Languages, and Programming (ICALP’03), 2003. 10. G. Finn and E. Horowitz. A linear time approximation algorithm for multiprocessor scheduling. BIT, 19:312–320, 1979. 11. D. Fotakis, S. Kontogiannis, E. Koutsoupias, M. Mavronicolas, and P. Spirakis. The structure and complexity of nash equilibria for a selfish routing game. In Proc. of the 29th International Colloquium on Automata, Languages, and Programming (ICALP’02), pages 123–134, 2002. 12. J. Feigenbaum, C. Papdimitriou, and S. Shenker. Sharing the cost of multicast transmissions. In Proc. of the 32nd Annual ACM Symposium on the Theory of Computing, pages 218–227, 2000. 13. D.K. Friesen. Tighter bounds for lpt scheduling on uniform processors. SIAM Journal on Computing, 16(3):554–560, 1987.
44
R. Feldmann et al.
14. M.R. Garey and D.S. Johnson. Computers and intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, 1979. 15. M. Gairing, T. L¨ ucking, M. Mavronicolas, B. Monien, and P. Spirakis. Extreme nash equilibria. Technical report, FLAGS-TR-03-10, University of Paderborn, 2002. 16. R:L. Graham. Bounds on multiprocessing timing anomalies. SIAM Journal of Applied Mathematics, 17(2):416–429, 1969. 17. A. Haurie and P. Marcotte. On the relatonship between nash-cournot and wardrop equilibria. Networks, 15:295–308, 1985. 18. D.S. Hochbaum and D. Shmoys. Using dual approximation algorithms for scheduling problems: Theoretical and practical results. Journal of the ACM, 34(1):144– 162, 1987. 19. D.S. Hochbaum and D. Shmoys. A polynomial approximation scheme for scheduling on uniform processors: using the dual approximation approach. SIAM Journal on Computing, 17(3):539–551, 1988. 20. O. Jahn, R.H. M¨ ohring, A.S. Schulz, N.E. Stier Moses. System-Optimal Routing of Traffic Flows With User Constraints in Networks With Congestion. MIT Sloan School of Management Working Paper No. 4394-02, 2002. 21. K. Jain and V. Vazirani. Applications of approximation algorithms to cooperative games. In Proc. of the 33rd Annual ACM Symposium on Theory of Computing (STOC’01), pages 364–372, 2001. 22. Y.A. Korilis, A.A. Lazar, and A. Orda. Architecting noncooperative networks. IEEE Journal on Selected Areas in Communications, 13(7):1241–1251, 1995. 23. E. Koutsoupias and C. Papadimitriou. Worst-case equilibria. In Proc. of the 16th International Symposium on Theoretical Aspects of Computer Science (STACS’99), pages 404–413, 1999. 24. E. Koutsoupias, M. Mavronicolas, and P. Spirakis. Approximate Equilibria and Ball Fusion In Proc. of the 9th International Colloquium on Structural Information and Communication Complexity (SIROCCO’02), 2002, (accepted for TOCS). 25. T. L¨ ucking, M. Mavronicolas, B. Monien, M. Rode, P. Spirakis, and I. Vrto. Which is the worst-case nash equilibrium? In Proc. of the 28th International Symposium on Mathematical Foundations of Computer Science (MFCS’03), 2003. 26. J.K. Lenstra, D.B. Shmoys, and E. Tardos. Approximation algorithms for scheduling unrelated parallel machines. In Proc. of the 28th Annual Symposium on Foundations of Computer Science (FOCS’87), pages 217–224, 1987. 27. R.D. McKelvey and A. McLennan. Computation of equilibria in finite games. In H. Amman, D. Kendrick, and J. Rust, editors, Handbook of Computational Economics, 1996. 28. M. Mavronicolas and P. Spirakis. The price of selfish routing. In Proc. of the 33rd Annual ACM Symposium on Theory of Computing (STOC’01), pages 510–519, 2001. 29. J. Nash. Non-cooperative games. Annals of Mathematics, 54(2):286–295, 1951. 30. N. Nisan. Algorithms for selfish agents. In Proc. of the 16th International Symposium on Theoretical Aspects of Computer Science (STACS’99), pages 1–15, 1999. 31. N. Nisan and A. Ronen. Algorithmic mechanism design. In Proc. of the 31st ACM Symposium on Theory of Computing (STOC’99), pages 129–140, 1999. 32. M.J. Osborne and A. Rubinstein. A Course in Game Theory. The MIT Press, 1994. 33. C.H. Papadimitriou. On the complexity of the parity argument and other inefficient proofs of existence. Journal of Computer and System Science, 48(3):498–532, 1994.
Selfish Routing in Non-cooperative Networks: A Survey
45
34. C.H. Papadimitriou. Algorithms, games, and the internet. In Proc. of the 33rd Annual ACM Symposium on Theory of Computing (STOC’01), pages 749–753, 2001. 35. A.C. Pigou. The economics of welfare. Macmillan, 1920. 36. T. Roughgarden and E. Tardos. How bad is selfish routing? Journal of the ACM, 49(2):236–259, 2002. 37. T. Roughgarden. Designing Networks for Selfish Users is Hard. In Proc. of the 42nd Annual ACM Symposium on Foundations of Computer Science (FOCS’01), pages 472–481, 2001. 38. T. Roughgarden. The Price of Anarchy is Independent of the Network Topology. In Proc. of the 34th Annual ACM Symposium on Theory of Computing (STOC’02), pages 428–437, 2002. 39. A.S. Schulz and N.E. Stier Moses. On The Performance of User Equilibria in Traffic Networks. MIT Sloan School of Management Working Paper No. 4274-02, 2002. 40. P. Schuurman and T. Vredeveld. Performance guarantees of load search for multiprocessor scheduling. In Proc. of the 8th Conference on Integer Programming and Combinatorial Optimization (IPCO’01), pages 370–382, 2001. 41. J.G. Wardrop. Some theoretical aspects of road traffic research. In Proc. of the Institute of Civil Engineers, Pt. II, Vol. 1, pages 325–378, 1952.
Process Algebraic Frameworks for the Specification and Analysis of Cryptographic Protocols Roberto Gorrieri1 and Fabio Martinelli2 1
Dipartimento di Scienze dell’Informazione, Universit` a di Bologna, Italy 2 Istituto di Informatica e Telematica C.N.R., Pisa, Italy
Abstract. Two process algebraic approaches for the analysis of cryptographic protocols, namely the spi calculus by Abadi and Gordon and CryptoSPA by Focardi, Gorrieri and Martinelli, are surveyed and compared. We show that the two process algebras have comparable expressive power, by providing an encoding of the former into the latter. We also discuss the relationships among some security properties, i.e., authenticity and secrecy, that have different definitions in the two approaches.
1
Introduction
Security protocols are those protocols that accomplish security goals such as preserving the secrecy of a piece of information during a protocol or establishing the integrity of the transmitted information. Cryptographic protocols are those security protocols running over a public network that use cryptographic primitives (e.g., encryption and digital signatures) to achieve their security goals. In the analysis of cryptographic protocols, one has to cope with the insecurity of the network. So, it is assumed that one attacker (sometimes called enemy or intruder) of the protocol has complete control over the communication medium. On the other hand, to make analysis less intricate, it is also usually assumed perfect cryptography, i.e., such an enemy is not able to perform cryptanalytic attacks: an encrypted message can be decrypted by the enemy only if he knows (or is able to learn) the relevant decryption key. Such an analysis scenario is often referred to as the Dolev-Yao approach [10]. Because of the above, cryptographic protocols are difficult to be analysed and to be proved correct. Indeed, a lot of them have flaws or inaccuracies. As a well-known example, we mention that Lowe [22] pointed out one inaccuracy in an authentication protocol by Needham and Schroeder [31]. Hence, the need of a formal approach to the analysis of cryptographic protocols. The spi calculus [3], proposed by Abadi and Gordon, and CryptoSPA
Work partially supported by MURST Progetto “Metodi Formali per la Sicurezza” (MEFISTO); IST-FET project “Design Environments for Global ApplicationS (DEGAS)”; Microsoft Research Europe; by CNR project “Tecniche e Strumenti Software per l’analisi della sicurezza delle comunicazioni in applicazioni telematiche di interesse economico e sociale” and by a CSP grant for the project “SeTAPS II”.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 46–67, 2003. c Springer-Verlag Berlin Heidelberg 2003
Process Algebraic Frameworks
47
[17,16], proposed by the authors in joint work with R. Focardi, are two wellknown possible answers. The goal of this paper is to show similarities and differencies of these two approaches from the point of view of both modeling and analysis. A small running example is used throughout the paper in order to illustrate the basic features of the two approaches. The basic idea is that, in order to analyse a protocol, one has to begin by modeling it as a program of the calculus. At first sight, there are some differencies in the spi model and in the CryptoSPA one. In particular, the spi calculus, being based on the π calculus, is apparently more expressive as it handles mobility (of channels) as a first class primitive of the language. On the other hand we show that it is possible to define an encoding from the spi calculus to CryptoSPA that preserves a rather strong notion of equivalence. The core idea of the encoding is that name generation of spi can be simulated by means of a suitable process in CryptoSPA that uses the inference system hidden inside the language. Moreover, the spi calculus offers the possibility to describe secret pieces of information inside the syntax, by means of the restriction operator. On the contrary, in CryptoSPA these secrets are to be specified separately as limitations on the knowedge of the enemy that tries to attack the protocol. A major difference between the two approaches can be summarised by the motto: Contextual equivalence vs Equivalence of contexts. In the spi calculus the properties of secrecy and message authenticity are expressed as the equivalence of systems, where the used notion of equivalence is may testing: it is based on the idea that two systems are equivalent if they cannot be distinguished by an external observer. According to the spi calculus approach, the tester is playing at the same time the role of observer and attacker of the protocol; hence, elegantly, spi includes the notion of external enemy inside the definition of the semantics of the calculus by using a contextual equivalence. Indeed, the two processes must exhibit the same observable behavior w.r.t. any context (the observer). On the contrary, in CryptoSPA the properties of secrecy and authenticity (or integrity) are formulated as instances of the following general form: ∀X ∈ ECφI
(S | X) \ C ∼ α(S)
where X is any process in the set ECφI of admissible enemies, C is the set of communication channels, ∼ is a behavioural semantics (actually, trace semantics for our purpose) and α(S) is the correct specification of S when run in isolation. The equation above amounts to say that the behaviour of system S when exposed to any enemy X is the same as the correct behaviour of S. Hence, such properties are expressed as a form of equivalence of contexts: a closed system, i.e. α(S), is compared with an open system (S | •) \ C and the comparison takes the form of an infinity of checks between closed systems, for each possible enemy X. (Actually, nothing prevents ∼ from being itself a contextual equivalence, though trace equivalence is the usual relation used in the CryptoSPA approach.) We will show that the latter approach is more flexible, by providing an example of an attack scenario where there are several enemies with different capabilities that can be naturally treated in the CryptoSPA approach. On the contrary,
48
Roberto Gorrieri and Fabio Martinelli
the spi approach is appropriate for modeling a scenario where there is one single enemy, as in the Dolev-Yao approach. The final part of the paper is devoted to show similarities and differences among secrecy and authenticity as defined in the two approaches. We show that, in spite of the many technical differencies, the notion of spi authenticity is the same as the notion of integrity in CryptoSPA. On the contrary, the two notions of secrecy are quite different. A short summary of other process algebraic approaches to the analysis of cryptographic protocols concludes the paper.
2
The Spi Calculus
The spi calculus [3] is a version of the π calculus [30] equipped with abstract cryptographic primitives, e.g. primitives for perfect encryption and decryption. Names represent encryption keys as well as communication channels. Here we give a short overview of the main features of the calculus, by presenting a simple version with asynchronous communication and shared-key cryptography. The interested reader can find more details in [3] and [20] (a tutorial on the subject that has inspired the current short survey). 2.1
Syntax and Reduction Semantics
In this section we briefly recall some basic concepts about the asynchronous spi calculus with shared-key cryptography. The choice of the asynchronous version is inessential for the results of the paper and is only taken for simplicity. The restriction to shared-key cryptography only is for the sake of simplicity too. Given a countable set of names N (ranged over by a, b, . . . , n, m, . . .) and a countable set of variables V (ranged over by x, y, . . . ,), the set of terms is defined by the grammar: M, N ::= m | x | (M, N ) | {M }N with the proviso that in (M, N ) and {M }N the term M (and similarly N ) can be either a ground term (i.e., without variable occurrences) or simply a variable. The set of spi calculus processes is defined by the BN F -like grammar: P, Q ::= 0 | M N | M (x).P | (νn) P | P | Q | [M = N ]P else Q | AM1 , . . . , Mn | let (x, y) = M in P else Q | case M of {x}N in P else Q The name n is bound in the term (νn)P . In M (x).P the variable x is bound in P . In let (x, y) = M in P else Q the variables x and y are bound in P . In case M of {x}N in P else Q the variable x is bound in P . The set f n(P ) of free names of P is defined as usual. We give an intuitive explanation of the operators of the calculus:
Process Algebraic Frameworks
49
– 0 is the stuck process that does nothing. – M N is the output construct. It denotes a communication on the channel M of the term N . – M (x).P is the input construct. A name is received on the channel M and its value is substituted for the free occurrences of x in P (written P [M/x]). – (νn)P is the process that makes a new, private name n, for P , and then behaves as P . – P | Q is the parallel composition of two processes P and Q. Each may interact with the other on channels known to both, or with the outside world, independently of the other. – [M = N ]P else Q is the match construct. The process behaves as P when M = N , otherwise it behaves as Q. – Ax1 , . . . , xn is a process constant. We assume that constants are equipped . by a constant definition like Ax1 , . . . , xn = P , where the free variables of P are contained in {x1 , . . . , xn }. – let (x, y) = M in P else Q is the pair splitting process. If the term M is of the form (N, L), then it behaves as P [N/x][L/y]; otherwise, it behaves as Q. – case M of {x}N in P else Q is the decryption process. If M is of the form {L}N , then the process behaves as P [L/x]; otherwise, it behaves as Q. We also define the structural congruence as follows. Let ≡ be the least congruence relation over processes closed under the following rules: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.
P ≡ Q, if P is obtained through α–conversion from Q P |0 ≡ P P |Q ≡ Q|P P |(Q | R) ≡ (P | Q) | R (νn)0 ≡ 0 (νn)(νm)P ≡ (νm)(νn)P (νn)(νn)P ≡ (νn)P / f n(M ) ∪ f n(N ) (νn)M N ≡ M N , if n ∈ (νn)M (x).P ≡ M (x).(νn)P , if n ∈ / sort(M ) (νn)(P | Q) ≡ P |(νn)Q if n ∈ / f n(P ) [M = M ]P else Q ≡ P , if M = M [M = M ]P else Q ≡ Q, if M = M and M, M are ground let (x, y) = ( M, N ) in P else Q ≡ P [M/x][N/y] /V let (x, y) = M in P else Q ≡ Q, if M = (N, N1 ), for some N, N1 and M ∈ case {M }N of {x}N in P else Q ≡ P [M/x] /V case M of {x}N in P else Q ≡ Q, if M = {N }N , for some N and M ∈ . AM1 , . . . , Mn ≡ P [M1 /x1 , . . . , M1 /x1 ], when Ax1 , . . . , xn = P .
We give the reduction semantics for the asynchronous spi calculus. Processes communicate among them by exchanging messages. An internal communication (or reduction) of the process P is denoted by P −→ P . We have the following rules for calculating the reduction relation between processes: P ≡ Q, Q −→ Q , Q ≡ P mN | m(x).P −→ P [N/x] P −→ P P −→ P P −→ P νn(P ) −→ νn(P ) P | Q −→ P | Q
50
Roberto Gorrieri and Fabio Martinelli
2.2
May Testing Semantics
May testing equivalence [9] is the equivalence notion that is used in the spi calculus to define the security properties. In order to define this equivalence, we first define a predicate that describes the channels on which a process can communicate. We let a barb β be an output channel. For a closed process P , we define the predicate P exhibits barb β, written P ↓ β, by the following rules: P ↓β mN ↓ m P |Q ↓ β P ↓ β β ∈ {m, m} P ≡ Q Q ↓ β P ↓β (νm)P ↓ β Intuitively, P ↓ β holds if P may output immediately along β. The convergence predicate P ⇓ β holds if P exhibits β after some reactions. P ↓ β P −→ Q Q ⇓ β P ⇓β P ⇓β A test consists of any closed process R and any barb β. A closed process P passes the test if and only if (P | R) ⇓ β. May testing equivalence is then defined on the set of closed processes as follows: P ≈may Q ⇐⇒ for any test (R, β), (P | R) ⇓ β if and only if (Q | R) ⇓ β May-testing has been chosen because it corresponds to partial correctness (or safety), and security properties are often safety properties. Moreover, a test neatly formalises the idea of a generic experiment or observation another process (such as an attacker) might perform on a process. So testing equivalence captures the concept of equivalence in an arbitrary environment; as a matter of fact, maytesting equivalence is a contextual equivalence.
3
CryptoSPA
Cryptographic Security Process Algebra (CryptoSP A for short) is a slight modification of CCS process algebra [29], adopted for the description of cryptographic protocols. It makes use of cryptographic-oriented modeling constructs and can deal with confidential values [15,17,26]. The CryptoSPA model consists of a set of sequential agents able to communicate by exchanging messages. The data handling part of the language consists of a set of inference rules used to deduce messages from other messages. We consider a set of relations among closed messages as: r ⊆ P f in (M) × M, where r is the name of the rule. Given a set R of inference rules, we consider the deduction relation DR ⊆ P f in (M)×M. Given a finite set of closed messages, say φ, then (φ, M ) ∈ DR if M can be derived by iteratively applying the rules in R. For the sake of simplicity, we assume that r (for each r ∈ R) and DR ⊆ P f in (M) × M are decidable.
Process Algebraic Frameworks
3.1
51
The Language Syntax
CryptoSP A syntax is based on the following elements: – A set Ch of channels, partitioned into a set I of input channels (ranged over by c) and a set O of output channels (ranged over by c, the output corresponding to the input c); – A set V ar of variables, ranged over by x; – A set M of messages, defined as above for the spi calculus, ranged over by M, N (and by m, n, with abuse of notation, to denote closed messages). The set L of CryptoSPA terms (or processes) is defined as follows: P, Q ::= 0| c(x).P | cM.P | τ.P | P | Q | P \L | A(M1 , . . . , Mn ) | [M1 , . . . , Mr rule x]P ; Q where M, M , M1 , . . . , Mr are messages or variables and L is a set of channels. Both the operators c(x).P and [M1 . . . Mr rule x]P ; Q bind variable x in P . We assume the usual conditions about closed and guarded processes, as in [29]. We call P the set of all the CryptoSP A closed and guarded terms. The set of actions is Act = {c(M ) | c ∈ I}∪{cM | c ∈ O}∪{τ } (τ is the internal, invisible action), ranged over by a. We define sort(P ) to be the set of all the channels syntactically occurring in the term P . Moreover, for the sake of readability, we always omit the termination 0 at the end of process specifications, e.g. we write a in place of a.0. We give an informal overview of CryptoSP A operators: – 0 is a process that does nothing. – c(x).P represents the process that can get an input M on channel c behaving like P [M/x]). – cm.P is the process that can send m on channel c, and then behaves like P . – τ.P is the process that executes the invisible τ and then behaves like P . – P1 | P2 (parallel) is the parallel composition of processes that can proceed in an asynchronous way but they must synchronize on complementary actions to make a communication, represented by a τ . – P \L is the process that cannot send and receive messages on channels in L; for all the other channels, it behaves exactly like P ; – A(M1 , . . . , Mn ) behaves like the respective defining term P where all the variables x1 , . . . , xn are replaced by the messages M1 , . . . , Mn ; – [M1 , . . . , Mr rule x]P ; Q is the process used to model message manipulation as cryptographic operations. Indeed, the process [M1 , . . . , Mr rule x]P ; Q tries to deduce an information z from the tuple M1 , . . . , Mr through the application of rule rule ; if it succeeds then it behaves like P [z/x], otherwise it behaves as Q. The set of rules that can be applied is defined through an inference system (e.g., see Figure 1 for an instance).
52
Roberto Gorrieri and Fabio Martinelli m m (pair ) (m, m )
(m, m ) (f st ) m
m k (enc ) {m}k
{m}k m
(m, m ) (snd ) m k
(dec )
Fig. 1. An example inference system for shared key cryptography
3.2
The Operational Semantics of CryptoSPA
In order to model message handling and cryptography we use a set of inference rules. Note that CryptoSP A syntax, its semantics and the results obtained are completely parametric with respect to the inference system used. We present in Figure 1 an instance inference system, with rules: to combine two messages obtaining a pair (rule pair ); to extract one message from a pair (rules f st and snd ); to encrypt a message m with a key k obtaining {m}k and, finally, to decrypt a message of the form {m}k only if it has the same key k (rules enc and dec , respectively). In a similar way, inference systems can contain rules for handling the basic arithmetic operations and boolean relations among numbers, so that the valuepassing CCS if-then-else construct can be obtained via the rule operator. Example 1. Natural numbers may be encoded by assuming a single value 0 and a function S(y), with the following rule: x inc. Similarly, we can define sumS(x) mations and other operations on natural numbers. Example 2. We do not explicitly define equality check among messages in the syntax. However, this can be implemented through the usage of the inference x x construct. E.g., consider rule equal. Then [m = m ]A (with the Equal(x, x) expected semantics) may be equivalently expressed as [m m equal y]A where y does not occur in A. Similarly, we can define inequalities, e.g., ≤, among natural numbers. More interestingly, this form of inference constructs of CryptoSPA is also useful to model common access control mechanisms in distributed systems. Example 3. Indeed, consider a set of credentials, i.e. (signed) messages containing information about access rights. Assume that {A, ob1 , +}pr(C) means that the user C (via the signature with its private key pr(C)) asserts A has the right to access the object ob1 and may grant this access to other users (this is denoted through the symbol +). A rule like: {A, ob1 , +}pr(C)
pr(C) {grant {B, ob1 , +}pr(C)
B, ob1 }pr(A)
(accC )
Process Algebraic Frameworks
(input)
m∈M
c(m)
(\L)
(output)
c(m)
c(x).P −→ P [m/x]
P −→ P
c ∈ L
c(m)
P \L −→ P \L
c(x)
a
(| ) 1
P1 −→ P1 a
P1 | P2 −→
P1
(| )
| P2
P [m1 /x1 , . . . , mn /xn ] −→ P
(D1 )
τ
τ.P −→ P cm
τ
P2 −→ P2
P1 | P2 −→
P1
| P2
.
a
A(x1 , . . . , xn ) = P
A(m1 , . . . , mn ) −→ P (D)
P1 −→ P1
2
a
(Def )
(internal)
cm
cm.P −→ P
53
a
P [m/x] −→ P
m1 , . . . , mr rule m
a
[m1 , . . . , mr rule x]P ; Q −→ P
∃m s.t. m1 , . . . , mr rule m
a
Q −→ Q
a
[m1 , . . . , mr rule x]P ; Q −→ Q
Fig. 2. Structured Operational Semantics for CryptoSPA (symmetric rules for |1 , |2 and \L are omitted)
may be used by the controller C to issue other access right credentials, after receiving an indication by A, i.e. the signed message {grant B, ob1 }pr(A) . Thus, we may also consider the inference rules as an abstract mechanism to express security policies usually defined using other mathematical models and logics (e.g., see [21,34]). The operational semantics of a CryptoSP A term is described by means of the a a labelled transition system (lts, for short) P, Act, {−→}a∈Act , where {−→}a∈Act is the least relation between CryptoSP A processes induced by the axioms and inference rules of Figure 2. As a notation we also use P =⇒ P for denoting γ τ that P and P belong to the reflexive and transitive closure of −→; P =⇒ P a1 τ if γ is a finite sequence of actions ai , 1 ≤ i ≤ n s.t. ai = τ and P =⇒−→=⇒ an τ . . . =⇒−→ =⇒ P . γ Let T r(P ) denote the set {γ ∈ (Act \ {τ })∗ |P =⇒ P } of executable observable traces. We define the trace preorder, ≤trace , as follows: P ≤trace Q if T r(P ) ⊆ T r(Q). We say that P and Q are trace equivalent, denoted P ∼tr Q, iff T r(P ) = T r(Q).
4
Comparison in Expressiveness
We compare the two languages by providing an encoding from the spi calculus to CryptoSPA (actually a sublanguage). Basically, the encoding [ ], preserves the equality of terms, i.e. assume that ≈1 (≈2 ) is an equivalence relation on spi calculus (CryptoSPA), then P ≈1 Q
⇐⇒
[P ] ≈2 [Q]
The technical machinery in [35] about barbed equivalences will be of help, as ≈i , with i = 1, 2, will be weak barbed equivalences. Barbed equivalences are based
54
Roberto Gorrieri and Fabio Martinelli
on a minimal notion of observable, i.e. the barb. This makes them very suitable to provide natural equivalence notions in different languages in a uniform way. It is worthwhile noticing that these forms of equivalence are finer than may-testing (in their respective languages). Barbed Equivalences. Given the predicate P exhibits a barb β, P ↓ β, it is possible to define in a standard way a set of useful process equivalences. We say that a symmetric relation R among processes is a barbed bisimulation, if (P, Q) ∈ R then: – For all β, it holds P ↓ β iff Q ↓ β; – if P −→ P then ∃ Q s.t. Q −→ Q and (P , Q ) ∈ R. The union of all barbed bisimulations, denoted by ∼, is a barbed bisimulation. There exists also a form of weak barbed bisimulation where in the previous statements, the observable predicate is replaced by the weak one, i.e. P ⇓ β and Q −→ Q by Q =⇒ Q . We say that a symmetric relation R among processes is a barbed equivalence whenever, if (P, Q) ∈ R then for each static (cf [35]) context C[·], it holds that C[P ] ∼ C[Q]. Our encoding works in two steps: – The spi calculus will be encoded, up to weak barbed equivalence, into a sublanguage, called spires -calculus. In this sublanguage, the input operator is replaced by a new one: a process can receive only pairs on a public channel, i.e. net, that cannot be restricted. After receiving a pair, a process is obliged to check the first element of the pair with a given message. Only if the match is successful the process proceeds, otherwise it has to reproduce the message in the net and to try with another pair. – Then, the spires -calculus is encoded into CryptoSPAres , a similar variant of spires but on CryptoSPA. Basically, we encode the decryption, splitting and matching constructs through inference rules. Moreover, the new name generation is simulated as the receiving action of a fresh message generated by a special process, called Gen. 4.1
An Encoding of Spi Calculus into spires -Calculus
The encoding [P ]1 acts as an homomorphism on spi calculus process, except for MN.P and M(x).P . In particular, we have the homomorphic [(νc)P ]1 = (νc)[P ]1 ; moreover, [M N ]1 = net(M, N ), where net is a special channel name that cannot be restricted, and [M (x).P ]1 = A where the defining equation for A is . A = net(x).let (z1 , z2 ) = x in ([M = z1 ][P [z2 /x]]1 else net(z1 , z2 ) | A) else netx | A The encoding works as follows. Sent messages are encoded as pairs: the first element denotes the channel, and the second one the message itself. When a process wishes to receive a message on a certain channel, say M , it has to get
Process Algebraic Frameworks
55
a pair from the network, and then it is obliged to check if the first element of the pair is the channel; if so, the process proceeds as before (provided that the derivative is encoded), otherwise the pair that has been captured from the network is inserted again. Note that we cannot avoid that a communication happens within the channel net, however, in the case that the channel is not the expected one then the system returns to the original configuration. Consider the following example of a communication on a restricted channel. Example 4. Suppose P = νc(cn | c(x).xx). Then, [P ]1 is νc(net(c, n) | A) where A is defined as .
A = net(x).let (z1 , z2 ) = x in ([c = z1 ](net(z2 , z2 )) else net(z1 , z2 ) | A) else netx | A Now, P −→ νc(nn) and similarly [P ]1 −→ νc(net(n, n)). Consider now the process Q = c1 n. Then, [P | Q]1 = [P ]1 |[Q]1 = νc(net(c, n) | A) | netc1 , n. Note that [P | Q]1 −→ T , by means of a synchronization of net and T ≡ [P | Q]1 : [P | Q]1 = νc(net(c, n) | A) | net(c1 , n) ≡ νc(net(c, n) | A | net(c1 , n)) −→ νc(net(c, n) |([c = c1 ](net(n, n)) else net(c1 , n) | A)) ≡ νc(net(c, n) | A | net(c1 , n)) Indeed, the encoded process may perform useless communications on the channel net; the crucial point is that such communications do not significantly change the status of the process. Thus, we may define a form of weak barbed equivalence among processes in spi and the ones obtained through [ ]1 , i.e. spires . The idea is that whenever P exhibits an output on a barb c, say P ↓ c, then [P ]1 exhibits an output on a barb net of c, say [P ]1 ↓ netc, ∗, and conversely. Moreover, if P performs a reduction then also [P ]1 must perform it, on the contrary if [P ]1 performs a reduction P may also choose to stay blocked. This encoding is clearly not satisfactory for the point of view of implementation, as it introduces divergence. However, it is useful when we are simply interested in verifying security properties that usually depends on may testing equivalence. Indeed, weak barbed equivalence implies may testing equivalence. 4.2
Encoding spires into CryptoSPAres
We may encode the spires calculus into CryptoSPAres . For most operators, the [ ]2 function works as a homomorphism, e.g., [P | Q]2 = [P ]2 |[Q]2 . However, we must face two relevant problems: (i) the different forms of cryptography handling;(ii) the different treatment of new name generation. We deal first with the simpler one that is the treatment of cryptography. In CryptoSPA cryptographic primitives are modeled by means of the inference system. Hence, we can map the decryption construct of spi as follows: [case M of {x}N in P else Q]2 = [M N dec x][P ]2 ; [Q]2
56
Roberto Gorrieri and Fabio Martinelli
and similarly for the splitting construct and the matching one. For the second problem, we have to consider the restriction operator (new name generation). The restriction operator of the spi calculus is used to denote “secret” values known locally by the process. The treatment of such secret values is very elegant in the pi/spi calculus. Ultimately, the operator (νn)P defines a new fresh name n in P , that no one else should be ever able to create/guess. We encode these features through the usage of a specific process that creates new names. This process is the unique one allowed to generate such messages and it creates them iteratively. A CryptoSPA specification for such a process could be the following: Gen(x) = [x nonce y].geny.Gen(y) where the (omitted) rule for nonce creation could be as inc in Example 1. The encoding [ ]2 may map each νn(P ) construct to a receiving action, i.e. [νn(P )]2 = gen(x).[P ]2 This second encoding [ ]∗ will be actually the following [P ]∗ = [P ]2 | Gen(0), because we need one single instance of the name generator process. Note that restricted names are mapped to new names that are unguessable by the enemy because we assume that only process Gen can send along gen, hence ensuring that an enemy cannot eavesdrop new names sent from Gen. The encoding [ ]∗ is sound as we consider as observable the first component in a pair which is an output over net, taking care not to consider in CryptoSPAres the new (nonce) names (which correspond to restricted channels in spires ). We show a complete example of encoding from spi to CryptoSPAres . Example 5. Consider P = νc(cn). Then, [P ]∗ = gen(c).net(c, n) | Gen(0). Note that although [P ]∗ may perform a communication step, that cannot be matched by P , the observable behaviour is the same since the output of nonce values cannot be observed.
5 5.1
Comparison of the Two Approaches Protocol Analysis in the Spi Calculus
We show a very basic example. We have two principals A and B that use a public (hence insecure) channel, cAB , for communication; in order to achieve privacy, messages are encrypted with a shared key KAB . The protocol is simply that A sends along cAB a single message M to B, encrypted with KAB . A → B : {M }KAB on public cAB The spi calculus specification is as follows: A(M ) = cAB {M }KAB B = cAB (x).case x of {y}KAB in F (y) P (M ) = (νKAB )(A(M ) | B) where F (y) is the continuation of B. The fact that the channel cAB is public is witnessed by the fact that it is not restricted. On the other hand, KAB is
Process Algebraic Frameworks
57
restricted to model that it is a secret known only by A and B. When B receives {M }KAB on cAB , B attempts to decrypt it using KAB ; if this decryption succeeds, B applies F to the result. Two important properties hold for this protocol: – Authenticity (or integrity): B always applies F to the message M that A sends; an enemy cannot cause B to apply F to some other message M . – Secrecy: No information on the message M can be inferred by an observer while M is in transit from A to B: if F does not reveal M , then the whole protocol does not reveal M . Intuitively, the secrecy property should establish that if F (M ) is indistinguishable from F (M ), then the protocol with message M is indistinguishable from the protocol with message M . This intuition can be formulated in terms of equivalences as follows: if F (M ) ≈may F (M ), for any M , M , then P (M ) ≈may P (M ). Also integrity can be formalized in terms of an equivalence. This equivalence compares the protocol with another version of the protocol which is secure by construction. For this example, the required specification is: A(M ) = cAB {M }KAB Bspec (M ) = cAB (x).case x of {y}KAB in F (M ) Pspec (M ) = (νKAB )(A(M ) | Bspec (M )) The principal B is replaced with a variant Bspec (M ) that receives an input from A and then acts like B when B receives M . Bspec (M ) is a sort of “magical” version of B that knows the message M sent by A, hence ensuring integrity by construction. Therefore, we take the following equivalence as our integrity property: P (M ) ≈may Pspec (M ), for any M . 5.2
Protocol Analysis in CryptoSPA
In this section we want to show how to use CryptoSPA for the analysis of cryptographic protocols. The following subsections are devoted (i) to illustrate how security properties can be specified by decorating suitably protocol specification, then (ii) to discuss the actual definition of admissible attackers and, finally, (iii) to show how secrecy and integrity can be modeled in this framework. Noninterference for Cryptographic Protocols Analysis. Noninterference essentially says that a system P is secure if its low behaviour in isolation is the same as its low behaviour when exposed to the interaction with any high level process Π. Analogously, we may think that a protocol P is secure if its (low) behaviour is the same as its (low) behaviour when exposed to the possible attacks of any intruder X. To set up the correspondence, this analogy forces to consider the enemies as the high processes. Since the enemy has complete control over the communication medium, the CryptoSPA public channels in set C (i.e., the names used for
58
Roberto Gorrieri and Fabio Martinelli
message exchange) are the high level actions while the private channels in set (I ∪O)\C are the low level ones. As a protocol specification is usually completely given by message exchanges, it may be not obvious what are the low level actions. In our approach, they are extra observable actions that are included into the protocol specification to observe properties of the protocol. Of course, the choice of these extra actions (and the place into the specification where they are to be inserted) is property dependent. Considering the example A → B : {M }KAB on public cAB the basic integrity property that we want to model can be obtained by enriching the protocol specification with a (low) extra action received(M ) that B performs when receiving the message M . Hence, the protocol specification is: A(M ) = cAB {M }KAB B = cAB (x).[{M }KAB , KAB dec y].receivedy P (M ) = A(M ) | B where cAB {M }KAB is a shorthand for [M, KAB enc x]cAB x and where the received message is sent along the private channel received. Hence, we can state that integrity holds if the following equation holds for the protocol enriched with the event received: P (M ) satisfies integrity of M if for all (admissible) enemies X we have P (M ) \ {cAB } ∼tr (P (M ) | X) \ {cAB } This noninterference-based definition seems intuitively quite strong; it is of the form of equivalence of contexts: the closed term defining the security property, i.e. P (M ) \ {cAB } ∼tr {received(M )}, is checked for (trace) equivalence with the open system (P (M ) | •) \ {cAB }; such a comparison takes the form of an infinity of equivalence checks for all possible enemies X closing the term. Admissible Enemies. Intuitively, an enemy X can be thought of as a process which tries to attack a protocol by stealing and faking the information which is transmitted on the CryptoSPA public channels in set C. However, we are to be sure that X is not a too powerful attacker. Indeed, a peculiar feature of the enemies is that they should not be allowed to know secret information in advance: as we assume perfect cryptography, the initial knowledge of an enemy must be limited to include only publicly available pieces of information, such as names of entities and public keys, and its own private data (e.g., enemy’s private key). If we do not impose such a limitation, the attacker would be able to “guess” every secret piece of information. Considering the example above, if the enemy knows the key kAB that should be known only by A and B, the protocol would be easily attacked by the instance of the enemy def X(m, k) = cAB {m}k
Process Algebraic Frameworks
59
where m = MX and k = KAB . The problem of guessing secret values can be solved by imposing some constraints on the initial data known by the enemies. Given a process P , we call ID(P ) the set of messages that occur syntactically in P . Now, let φI ⊆ M be the finite, initial knowledge that we would like to give to the enemies, i.e., the public information such as the names of the entities and the public keys, plus some possible private data of the intruders (e.g., their private keys or nonces). For a certain intruder X, we want that all the messages in ID(X) are deducible from φI . Formally, given a finite set φI ⊆ M, called the initial knowledge, we define the set ECφI of admissible enemies as ECφI = {X ∈ P | sort(X) ⊆ C and ID(X) ⊆ D(φI )}. To see how ECφI prevents the problem presented in the running example, to indicate that KAB is secret, we can now require that KAB ∈ D(φI ). Since ID(X(MX , KAB )) = {MX , KAB }, we finally have that X(MX , KAB ) ∈ ECφI . Integrity. In order to specify integrity (or authenticity), one has simply to decorate the protocol specification P with an action of type received in correspondence of the relevant point of the protocol specification, obtaining a decorated protocol P . Once this has been done, the integrity equation reads as follows: P (M ) satisfies integrity of M if ∀X ∈ ECφI (P (M ) | X) \ C ∼tr P (M ) \ C where C is the set of public channels. The intuition is that P (M ) \ C represents the protocol P running in isolation (because of the restriction on public channels), while (P (M ) | X) \ C represents the protocol under the attack of an admissible (i.e., that does not know too much) enemy X. The equality imposes that the enemy X is not able to violate the integrity property specification that is represented by the correct (low) trace received(M ). The property above is very similar to a property known in the literature as Non Deducibility on Compositions [13,14] (NDC for short) and, as we will show in the next subsection is valid also for analysing secrecy. NDC for CryptoSPA is defined as follows (see [17]): A process S is NDC iff ∀X ∈ ECφI (S | X) \ C ∼tr S \ C. In other words S is NDC if every possible enemy X which has an initial knowledge limited by φI is not able to significantly change the behaviour of the system. This definition can be generalized to the scheme GNDC [15,17] as follows: α iff ∀X ∈ ECφI : (S | X) \ C ≈ α(S) S is GN DC≈ where α(S) denotes the secure specification of the system, which is then compared with the open term (S | •)\C. GNDC is a very general scheme under which many security properties for cryptographic protocols can be defined as suitable instances. See, e.g., [16] for some examples about authentication properties. Secrecy. Also secrecy can be defined via a variation of the NDC equation above, or better as an instance of the GNDC scheme. Consider a protocol P (M ) and assume that we want to verify if P (M ) preserves the secrecy of message M .
60
Roberto Gorrieri and Fabio Martinelli
This can be done by proving that every enemy which does not know message M , cannot learn it by interacting with P (M ). Thus, we need a mechanism that notifies whenever an enemy is learning M . We implement it through a simple process called knowledge notifier which reads from a public channel ck ∈ C \ sort(P (M )) not used in P (M ) and executes a learntM action if the read value is exactly equal to M . For a generic message m, it can be defined as follows: def
KN (m) = ck (y).[m = y]learntm We assume that learnt is a special channel that is never used by protocols def and is not public, i.e., learnt ∈ sort(P ) ∪ C. We now consider P (M ) = P (M ) | KN (M ), i.e., a modified protocol where the learning of M is now notified. A very intuitive definition of secrecy can be thus given as follows: P (M ) preserves the secrecy of M iff for all secrets N ∈ M \ D(φI ) ∀X ∈ ECφI
P (N ) \ C ∼tr (P (N ) | X) \ C
In other words, we require that for every secret M and for every admissible enemy X, process (P (M ) | X) \ C never executes a learntM action, as P (N ) \ C is not able to do so. Most Powerful Enemy. A serious obstacle to the widespread use of these GNDC -like properties is the universal quantification over all admissible enemies. While the proof that a protocol is not NDC can be naturally given by exhibiting an enemy that breaks the semantic equality, much harder is the proof that a protocol is indeed NDC, as it requires an infinity of equivalence checks, one for each admissible enemy. One reasonable way out could be to study if there is an attacker that is more powerful than all the others, so that one can reduce the infinity of checks to just one, albeit huge, check with respect to such most powerful enemy. Indeed, it is easy to prove that if is a pre-congruence1 and if there exists a process T op ∈ ECφI such that for every process X ∈ ECφI we have X T op, then: P ∈ N DC
iff
(P | T op) \ C P \ C
If the hypotheses of the proposition above hold, then it is sufficient to check that P \ C is equivalent to (P | T op) \ C. Given the pre-congruence , let ≈= ∩ −1 . If there exist two processes Bot, T op ∈ ECφI such that for every process X ∈ ECφI we have Bot X T op then P ∈ N DC≈ iff (P | Bot) \ C ≈ (P | T op) \ C ≈ P \ C Given these very general results, one may wonder if they are instanciable to some of the semantics we have described so far. Indeed, this is the case, at least for the trace preorder ≤trace , which is a pre-congruence. 1
A preorder is a pre-congruence (w.r.t. the operators | and \C) if for every P, Q, R ∈ P if Q R then P | Q P | R and Q \ C R \ C.
Process Algebraic Frameworks
61
The easy part is to identify the minimal element Bot in ECφI w.r.t. ≤trace : the minimum set of traces is the emptyset, that is generated, e.g., by process 0. Let us now try to identify the top element T op in ECφI w.r.t. ≤trace . The “most powerful enemy” can be defined by using a family of processes T opC,φ trace each representing the instance of the enemy with knowledge φ: C,φ∪{m} T opC,φ c(m).T optrace + cm.T opC,φ trace = trace c∈C m ∈ Msg(c)
c∈C m ∈ D(φ) ∩ Msg(c)
I The “initial element” of the family is T opC,φ trace as φI is the initial knowledge. Note that it may accept any input message, to be bound to the variable x which is then added to the knowledge set φ∪{x}, and may output only messages that can transit on the channel c and that are deducible from the current knowledge set I φ via the deduction function D. It is easy to see that T opC,φ trace is the top element of the trace preorder. As a consequence of the fact that the trace preorder is a C,φI pre-congruence and that T optrace is the top element for that preorder, we have that the single check against the top element is enough to ensure NDC. Formally: φI I P ∈ N DCC iff (P | T opC,φ trace ) \ C ∼tr P \ C.
The Example. The example studied for the spi calculus can be easily modeled in CryptoSPA: A(M ) = cAB {M }KAB B = cAB (x).[{M }KAB , KAB dec y]0 P (M ) = A(M ) | B
In order to study if integrity and secrecy hold, we have to define a suitably decorated version P of the protocol P : A(M ) = cAB {M }KAB B = cAB (x).[{M }KAB , KAB dec y]receivedy
P (M ) = A(M ) | B | KN (M )
where we have inserted the extra event received for integrity analysis purpose and the knowledge notifier for secrecy analysis purpose. In the single session described above, both secrecy and integrity holds, that is (P (M ) | X) \ C can never show up a low trace that is not possible for P (M ) \ C. 5.3
Comparing the Analysis Scenarios
In the spi calculus, the analysis scenario is rather delicate: a tester is at the same time the enemy that tries to influence the behaviour of the system and the observer that should keep track of the behaviour of the system. On the contrary, in CryptoSPA the two roles are separate: on the one hand we explicitly introduce
62
Roberto Gorrieri and Fabio Martinelli
the enemy X inside the scope of restriction, on the other hand we use trace equivalence to compare the two behaviours. In essence, we can say that in spi we use a contextual equivalence, while in CryptoSPA we use and equivalence of contexts. We argue that the elegance of the spi approach is paid in terms of lack of flexibility in modeling enemies; for instance, it is not straightforward to model passive attackers (less powerful enemies) or situations in which different parties of the protocol are subject to different enemies (more holes in the context). Both cases can be easily represented in the CryptoSPA approach by choosing either suitable ECφI or by including more enemies inside the GNDC-like equations. Example 6. Consider a system with three components, say A, B and C. The components A and B can communicate on a private channel c and share a secret b, while the components B and C through the private channel c1 and shares a secret d. Assume that both A and C are malicious; this means to regard them as enemies. Considering a generic specification for A (resp. C), as XA (resp. XC ), then a possible context to be analyzed is νcνb(XA | νc1 νd(B | XC )), with b, c ∈ / f n(XC ) 2 . As an extension of the spi-calculus approach, we may define a suitable class of contexts w.r.t. one performs certain observations. Thus the previous analysis problem could be instantiated as a contextual equivalence problem. However, techniques for dealing with such generic contexts are currently not well developed. On the contrary, within the GNDC approach, a simple generalization to having more “holes” (unknown components as remarked in [25,26]), makes it possible to model and analyze it in the case of trace equivalence by resorting to the use of the most general enemies3 . As a matter of fact, assume that EcφA (resp. Ecφ1C ) denotes the possible behaviours of enemies with the knowledge of φA (resp. φC ). Then, the GNDC specification could be ((XA ) | B |(XC )) \ {c, c1 } ∼tr α(B) Note that α(B) could also take into account the description of A and C. Using the most general intruder approach the verification is equal to just one check. As a matter of fact we may simply check that: ((T opφc A ) | B |(T opφc1C )) \ {c, c1 } ∼tr α(B) A main difference, w.r.t. the two approaches may be noted in the treatment of integrity. In the spi-calculus approach we must find the magical correct implementation to be used as reference w.r.t. the system under investigation. (We use the term implementation because it is very close to the description of the system). On the contrary, in the GNDC approach, we simply specify the intended observable behavior, indeed, that the messages are correctly delivered through a control action. Thus, the correct specification is indeed rather more abstract 2
3
Due to the limitations of using a spi term for expressing the system, it seems difficult to specify such a case study without imposing some side conditions on the processes XA and XC . In several cases, to have more enemies that have the possibility to directly communicate with each other is equivalent to consider just one enemy (see [26]).
Process Algebraic Frameworks
63
than the system. Recently Gordon and Jeffrey (e.g., see [19]) developed type systems for a spi-calculus variant that embodies a form of control (correspondence) actions. Using that type systems they were able to check authentication properties as agreement ([33]). In that framework, authenticity is exactly specified as control actions, following the Woo-Lam approach (see [36]). Another difference is that in spi it is necessary to perform two different analyses in order to prove the two security properties of secrecy and authenticity. On the contrary, in CryptoSPA one single NDC check is enough for both, as both properties are in the NDC form. As a matter of fact, it is enough to consider the decorated specification which includes the control action for integrity and the knowledge notifier. Then, we can use this single, combined specification for a single check against the most powerful enemy. This idea of combined analysis can be generalized to many different properties and has shown its usefulness (higher probability to find unexplored attacks) in some concrete cases [12]. Finally, the way secrets are handled is quite different. In spi this is achieved elegantly by means of the restriction operator, while in CryptoSPA we have explicitly to manage the set of pieces of information that are given to the enemies.
5.4
Comparing the Security Properties
One may wonder if the properties of secrecy and integrity defined in the two different process algebraic frameworks are somehow related. In spite of the technical differences, integrity is indeed the same property. The actual definition of integrity asks to check that the system meets its magical specification for each continuation F (y), provided F (y) does not reveal information on the message y. In [16], it has been shown that it is enough to consider the simple continuation F (x) = receivedx to establish whether a protocol enjoys integrity. On the contrary, the two notions of secrecy are clearly different: the spi one is based on the idea of indistinguishablility, while the CryptoSPA one is based on the idea of possession, i.e. the so-called Dolev-Yao (see also [1]). To see the main point we must note that secret parameter x, in the process S(x), must be a public value, i.e. a non-restricted one. Thus, among the possible tests we may found at least one that “knows” it, i.e. it has it as a free name. While, on the usual CryptoSPA approach the secret values are never “known” by the enemies; in fact, when an enemy is able to discover it we say that there is a secrecy attack. Consider the process P (x) = (νn)M n. Note that x does not occur in the term of P . Thus, P necessarily preserves the secrecy of the public messages M, M , . . ., indeed, P (M ) = P (M ) = P . However, from another point of view, P reveals one of its (declared) “secrets”, i.e. the private name n, since it communicates n on the public channel M . In the usual CryptoSPA approach for secrecy, we would be interested in studying the secrecy of the restricted names, rather than the public ones. The notion of secrecy developed in the spi approach is rather a form of information flow, i.e. non-interference. As a matter of fact, it can be formulated in the GNDC schema as follows:
64
Roberto Gorrieri and Fabio Martinelli S(M )
– S(x) preserves the secrecy of x iff c(x).S(x) enjoys N DC≈may (with M public) w.r.t. all the enemies whose sort is {c} that output at least one message on the channel c and c ∈ / Sort(S). Thus, simply by considering other assumptions on the set of possible intruders it is possible to code secrecy in the spi as a GNDC property. Moreover, it is possible P to show that if S(x) preserves the secrecy of x and S(M ) enjoys GN DCmay then P also S(M ) enjoys GN DCmay . This holds because may testing may be defined in CryptoSPA and it is a congruence w.r.t. restriction and parallel composition (under certain assumptions, e.g. see [16]).
6
Other Frameworks
Very shortly we mention also other well-known process algebraic approaches that have been proposed in recent years. The oldest and most widely deployed approach is the one based on CSP, which is well-illustrated in the book [33]. It shares similarities with CryptoSPA, as also in this approach security properties are modeled as observable events decorating the protocol, even if the idea of explicitly applying non-interference is not used. This approach has been mechanized, by using a compiler (called Casper [23] that translates protocol specifications into CSP code) and the FDR model checker; it has been enhanced to deal with symbolic reasoning (data independence) in [32]. Similarly, we have a compiler, called CVS [11] that translates specifications in a pre-dialect of CryptoSPA into SPA (i.e., CCS) code, and the Concurrency Workbench model checker. These analyses are approximated by considering an enemy that has limited memory and capability of generating new messages. More advanced symbolic semantics have been studied for CryptoSPA in [24]. In [25,26], the usage of contexts (open systems) to describe the security analysis scenarios has been advocated. The language used is similar to CryptoSPA. However, differently from the GNDC approach, the correct specification is given through logical formulas and the treatment of the admissible enemies is done by reducing the verification problem to a validity one in the logic. Recently, the approach has been extended with symbolic techniques (see [27]). For a symbolic semantics of a spi-like language see, for instance, [6]. As spi is an extension of the π calculus with cryptographic primitive, similarly sjoin [2] extends the join calculus with constructs for encryption and decryption and with names that can be used as keys, nonces or other tags. The applied pi calculus (see [18]) deals with the variety of different cryptosystems by adopting a general term algebra with an equality relation. This process calculus permits to describe cryptographic protocols using different cryptosystems. Thus, both applied pi and CryptoSPA recognize the necessity to manage uniformly different kind of cryptography that may be present in a complex protocol. The former exploits term algebras plus equality while the latter exploits a generic inference system. A more recent approach is LySa [8], which is a very close relative of spi and pi-calculus. LySa mainly differs in two respects: (i) absence of channels
Process Algebraic Frameworks
65
(one global communication medium) and (ii) tests on values being received in communications as well as values being decrypted are directly embedded inside inputs and decryptions. A static analysis technology, based on Control Flow Analysis, has been applied to security protocols, expressed in LySa, providing a fully automatic and efficient tool. The same technology has been successfully used to analyse secrecy for pi [4] and spi [5]. Other process algebraic approaches not strictly related to the analysis of cryptographic protocols include the ambient calculus and the security pi calculus. The ambient calculus [7] is concerned with mobility of ambients (abstract collection of processes and objects that functions both as a unit of mobility and a unit of security). Communication takes place only inside an ambient, hence the hierarchy of nested ambients regulates who can communicate with who. Differently from spi, the security pi calculus [28] extends the π calculus with a new construct [P ]σ denoting that process P is running at security level σ. This calculus is not very suited to talk about cryptographic protocols but is tailored for access control policies.
Acknowledgements We would like to thank Nadia Busi and Marinella Petrocchi for helpful comments.
References 1. M. Abadi. Security protocols and specifications. In Proc. Foundations of Software Science and Computation Structures, volume 1578 of LNCS, pages 1–13, 1999. 2. M. Abadi, C. Fournet, and G. Gonthier. Secure implementation of channel abstractions. Information and Computation, 174(1):37–83, 2002. 3. M. Abadi and A. D. Gordon. A calculus for cryptographic protocols: The spi calculus. Information and Computation, 148(1):1–70, 1999. 4. C. Bodei, P. Degano, F. Nielson, and H. R. Nielson. Static analysis for the picalculus with applications to security. Information and Computation, 168:68–92, 2001. 5. C. Bodei, P. Degano, F. Nielson, and H. R. Nielson. Flow logic for dolev-yao secrecy in cryptographic processes. Future Generation Computer Systems, 18(6):747–756, 2002. 6. M. Boreale. Symbolic trace analysis of cryptographic protocols. In Automata, Languages and Programming, LNCS, pages 667–681, 2001. 7. L. Cardelli and A. Gordon. Mobile ambients. Theoretical Computer Science, 240(1):177–213, 2000. 8. C.Bodei, M. Buchholtz, P.Degano, F. Nielson, and H. R. Nielson. Automatic validation of protocol narration. In Proceedings of The 16th Computer Security Foundations Workshop. IEEE Computer Society Press, 2003. 9. R. De Nicola and M. C. B. Hennessy. Testing equivalences for processes. Theoretical Computer Science, 34(1-2):83–133, 1984. 10. D. Dolev and A. Yao. On the security of public key protocols. IEEE Transactions on Information Theory, 29(12):198–208, 1983.
66
Roberto Gorrieri and Fabio Martinelli
11. A. Durante, R. Focardi, and R. Gorrieri. A compiler for analysing cryptographic protocols using non-interference. ACM Transactions on Software Engineering and Methodology, 9(4):489–530, 2000. 12. A. Durante, R. Focardi, and R. Gorrieri. Cvs at work: A report on new failures upon some cryptographic protocols. In Workshop on Mathematical Methods, Models and Architectures for Computer Networks Security, LNCS 2052, 2001. 13. R. Focardi and R. Gorrieri. A classification of security properties. Journal of Computer Security, 3(1):5–33, 1995. 14. R. Focardi and R. Gorrieri. Classification of security properties (part i: Information flow). In Foundations of Security Analysis and Design, volume 2171 of LNCS, pages 331–396, 2001. 15. R. Focardi, R. Gorrieri, and F. Martinelli. Non interference for the analysis of cryptographic protocols. In Proceedings of 27th International Colloquium in Automata, Languages and Programming, volume 1853 of LNCS, pages 354–372, 2000. 16. R. Focardi, R. Gorrieri, and F. Martinelli. A comparison of three authentication properties. Theoretical Computer Science, 291(3):285–327, 2003. 17. R. Focardi and F. Martinelli. A uniform approach for the definition of security properties. In Proceedings of World Congress on Formal Methods (FM’99), volume 1708 of LNCS, pages 794–813, 1999. 18. C. Fournet and M. Abadi. Mobile values, new names, and secure communication. In Proceedings of the 28th ACM Symposium on Principles of Programming Languages (POPL’01), pages 104–115, 2001. 19. A. Gordon and A. Jeffrey. Authenticity by typing in security protocols. In Proceedings of The 14th Computer Security Foundations Workshop. IEEE Computer Society Press, 2001. 20. A. D. Gordon. Notes on nominal calculi for security and mobility. In Foundations of Security Analysis and Design, volume 2171 of LNCS, pages 262–330, 2001. 21. J. Halpern and R. van der Meyden. A logic for SDSI’s linked local name spaces. In PCSFW: Proceedings of The 12th Computer Security Foundations Workshop. IEEE Computer Society Press, 1999. 22. G. Lowe. Breaking and fixing the Needham Schroeder public-key protocol using FDR. In Proceedings of Tools and Algorithms for the Construction and the Analisys of Systems, volume 1055 of LNCS, pages 147–166. Springer Verlag, 1996. 23. G. Lowe. Casper: A compiler for the analysis of security protocols. Journal of Computer Security, 6:53–84, 1998. 24. F. Martinelli. Symbolic semantics and analysis for crypto-ccs with (almost) generic inference systems. In Proceedings of the 27th international Symposium in Mathematical Foundations of Computer Sciences(MFCS’02), volume 2420 of LNCS, pages 519–531. 25. F. Martinelli. Formal Methods for the Analysis of Open Systems with Applications to Security Properties. PhD thesis, University of Siena, Dec. 1998. 26. F. Martinelli. Analysis of security protocols as open systems. Theoretical Computer Science, 290(1):1057–1106, 2003. 27. F. Martinelli. Symbolic partial model checking for security analysis. In Workshop on Mathematical Methods, Models and Architectures for Computer Networks Security, LNCS, 2003. To appear. 28. J. Rieley and Matthew Hennessy. Information flow vs. resource access in the asynchronous pi-calculus. ACM Trans. on Progr. Lang. and Systems (TOPLAS), 24(5):566–591, 2002. 29. R. Milner. Communication and Concurrency. International Series in Computer Science. Prentice Hall, 1989.
Process Algebraic Frameworks
67
30. R. Milner, J. Parrow, and D. Walker. A calculus of mobile processes. Information and Computation, 100(1):1–77, 1992. 31. R. M. Needham and M. D. Schroder. Using encryption for authentication in large networks of computers. Communications of the ACM, 21(12):993–999, 1978. 32. A. Roscoe and P. Broadfoot. Proving security protocols with model checkers by data independence techniques. Journal of Computer Security, 7(2-3):147–190, 1999. 33. P. Ryan, S. Schneider, M. Goldsmith, G. Lowe, and B. Roscoe. The Modelling and Analysis of Security Protocols: the CSP Approach. Addison-Wesley, 2001. 34. P. Samarati and S. D. C. di Vimercati. Access control: Policies, models, and mechanisms. In R. Focardi and R. Gorrieri, editors, Foundations of Security Analysis and Design, LNCS 2171. Springer-Verlag, 2001. 35. D. Sangiorgi. Expressing Mobility in Process Algebras: First-Order and HigherOrder Paradigms. CST–99–93, Department of Computer Science, University of Edinburgh, 1992. Also published as ECS–LFCS–93–266. 36. T. Woo and S. Lam. A semantic model for authentication protocols. In IEEE Computer Society Symposium on Research in Security and Privacy, pages 178– 194, 1993.
Semantic and Syntactic Approaches to Simulation Relations Jo Hannay1 , Shin-ya Katsumata2 , and Donald Sannella2 1
2
Department of Software Engineering, Simula Research Laboratory Laboratory for Foundations of Computer Science, University of Edinburgh
Abstract. Simulation relations are tools for establishing the correctness of data refinement steps. In the simply-typed lambda calculus, logical relations are the standard choice for simulation relations, but they suffer from certain shortcomings; these are resolved by use of the weaker notion of pre-logical relations instead. Developed from a syntactic setting, abstraction barrier-observing simulation relations serve the same purpose, and also handle polymorphic operations. Meanwhile, second-order prelogical relations directly generalise pre-logical relations to polymorphic lambda calculus (System F). We compile the main refinement-pertinent results of these various notions of simulation relation, and try to raise some issues for aiding their comparison and reconciliation.
1
Introduction
One of the central activities involved in stepwise development of programs is the transformation of “abstract programs” involving types of data that are not normally available as primitive in programming languages (graphs, sets, etc.) into “concrete programs” in which a representation of these in terms of simpler types of data (integers, arrays, etc.) is provided. Apart from the change to data representation, such data refinement should have no effect on the results computed by the program: the concrete program should be equivalent to the abstract program in the sense that all computational observations should return the same results in both cases. The usual way of establishing this property, known as observational equivalence, is by exhibiting a simulation relation that gives a correspondence between the data values involved in the two programs that is respected by the functions they implement. The details depend on the nature of the language in which the programs are written. In the simple case of a language with only first-order functions, it is usually enough to use an invariant on the domain of concrete values together with a function mapping concrete values (that satisfy the invariant) to abstract values [Hoa72], but a strictly more general method is to use a homomorphic relation [Mil71], [Sch90], [ST97]. If non-determinism is present in the language then some kind of bisimulation relation is required.
This research was partly supported by the MRG project (IST-2001-33149) which is funded by the EC under the FET proactive initiative on Global Computing. SK was supported by an LFCS studentship.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 68–91, 2003. c Springer-Verlag Berlin Heidelberg 2003
Semantic and Syntactic Approaches to Simulation Relations
69
When the language in question is the simply-typed lambda calculus, the standard choice of simulation relation – which originates with Reynolds in [Rey81, Rey83] but is described most clearly in [Ten94], cf. [Mit96] – is to use a logical relation, a type-indexed family of relations that respects not just function application (like homomorphisms) but also lambda abstraction. Logical relations are used extensively in the study of typed lambda calculus and have applications outside lambda calculus. A problem with the use of logical relations, in connection with data refinement and other applications, is the fact that they lack some convenient algebraic properties; in particular, the composition of two logical relations is not in general a logical relation. This calls into question their application to data refinement at least, where one might expect composition to account for the correctness of stepwise refinement. An alternative is to use instead a pre-logical relation [HS02], a weaker form of logical relations that nevertheless has many of the features that make logical relations so useful as well as being composable. This yields a proof method for establishing observational equivalence that is not just sound, as with logical relations, but is also complete. The use of pre-logical relations in data refinement is studied in [HLST00]. The situation is more complicated when we consider polymorphically typed lambda calculi such as System F [Gir71,Rey74]. Pre-logical relations can be extended to this context, see [Lei01], but then they do not compose in general although they remain sound and complete for observational equivalence. At the same time, the power of System F opens the possibility of taking a syntactic approach, placing the concept of simulation relation in a logical setting and using existential type quantification for data abstraction [MP88]. This line of development has been investigated in a string of papers on abstraction barrierobserving simulation relations by Hannay [Han99,Han00,Han01,Han03] based on a logic for parametric polymorphism due to Plotkin and Abadi [PA93]. A clear advantage of such an approach is that it is amenable to computer-aided reasoning but there are certain compromises forced by the syntactic nature of the framework. We present this background in Sects. 2–4 and then make a number of remarks aiming at some kind of reconciliation in Sect. 5. There are more questions than answers but some possible lines of enquiry are suggested.
2
Pre-logical Relations
Our journey begins with λ→ , the simply-typed lambda calculus having → as its only type constructor. Definition 2.1. The set of types over a set B of base types (or type constants) is given by the grammar σ ::= b | σ → σ where b ranges over B. A signature Σ consists of a set B of type constants and a collection C of typed term constants c : σ. Types → (Σ) denotes the set of types over B. Σ-terms are given by the grammar M ::= x | c | λx:σ.M | M M where x ranges over variables and c over term constants. The usual typing rules associate
70
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
each well-formed term M in a Σ-context Γ = x1 :σ1 , . . . , xn :σn with a type σ ∈ Types → (Σ), written Γ M : σ. If Γ is empty then we write simply M : σ. Definition 2.2. A Σ-combinatory algebra A consists of: – – – –
a carrier set [[σ]]A for each σ ∈ Types → (Σ); → A A A a function App σ,τ A : [[σ → τ ]] → [[σ]] → [[τ ]] for each σ, τ ∈ Types (Σ); A A an element [[c]] ∈ [[σ]] for each term constant c : σ in Σ; and σ,τ ρ,σ,τ ∈ [[σ → (τ → σ)]]A and SA ∈ [[(ρ → σ → τ ) → (ρ → combinators KA → A σ) → ρ → τ ]] for each ρ, σ, τ ∈ Types (Σ)
σ,τ σ,τ →σ σ,τ ρ,σ,τ such that KA x y = x (i.e. App τ,σ KA x) y = x) and SA xyz = A (App A (x z)(y z) (ditto).
A Γ -environment η on a combinatory algebra A assigns elements of A to variables, with η(x) ∈ [[σ]]A for x : σ in Γ . A Σ-term Γ M : σ is interpreted in A under a Γ -environment η in the usual way with λ-abstraction interpreted via translation to combinators, written [[Γ M : σ]]A η , and this is an element of [[σ]]A . If M is closed then we write simply [[M : σ]]A . A signature Σ models the interface (type names and function names) of a functional program, with Σ-combinatory algebras modelling programs that match interface Σ. Observational equivalence of two Σ-combinatory algebras is then fundamental to the notion of data refinement. Definition 2.3. Let A and B be Σ-combinatory algebras and let OBS , the observable types, be a subset of Types → (Σ). Then A is observationally equivalent to B with respect to OBS , written A ≡OBS B, if for any two closed Σ-terms M, N : σ for σ ∈ OBS , [[M : σ]]A = [[N : σ]]A iff [[M : σ]]B = [[N : σ]]B . It is usual to take OBS to be the “built-in” types for which equality is decidable, for instance bool and/or nat. Then A and B are observationally equivalent iff it is not possible to distinguish between them by performing computational experiments. Note that OBS ⊆ OBS implies ≡OBS ⊇ ≡OBS . Logical relations are structure-preserving relations on combinatory algebras. Definition 2.4. A logical relation R over Σ-combinatory algebras A and B is a family of relations {Rσ ⊆ [[σ]]A × [[σ]]B }σ∈Types → (Σ) such that: – Rσ→τ (f, g) iff ∀a ∈ [[σ]]A .∀b ∈ [[σ]]B .Rσ (a, b) ⇒ Rτ (App A f a, App B g b). – Rσ ([[c]]A , [[c]]B ) for every term constant c : σ in Σ. For OBS = {nat}, the connection between logical refinement and observational equivalence is given by Mitchell’s representation independence theorem. Theorem 2.5 (Representation Independence [Mit96]). Let Σ be a signature that includes a type constant nat, and let A and B be Σ-combinatory algebras1 with [[nat]]A = [[nat]]B = N. If there is a logical relation R over A and 1
Actually Henkin models, which are extensional combinatory algebras; however extensionality is not a necessary condition for this theorem.
Semantic and Syntactic Approaches to Simulation Relations
71
B with Rnat the identity relation on natural numbers, then A ≡{nat} B. Conversely, if A ≡{nat} B, Σ provides a closed term for each element of N, and Σ contains only first-order term constants, then there is a logical relation R over A and B with Rnat the identity relation. 2 This theorem corresponds directly to the following method for establishing the correctness of data refinement steps. Proof Method ([Ten94]). Let A and B be Σ-combinatory algebras and let OBS ⊆ Types → (Σ). To show that B is a refinement of A, find a logical relation R over A and B such that Rσ is the identity relation for each σ ∈ OBS . We R then say that B is a logical refinement of A and write A B, or A B when we want to make R explicit. A well-known problem with logical relations is the fact that they are not R closed under composition. It follows that, given logical refinements A B and S B C, the composition S ◦ R cannot in general be used as a witness for the composed refinement A C. (In fact, the problem is more serious than it appears at first: sometimes there is no witness for A C at all.) This is at odds with the stepwise nature of refinement, and the transitivity of the underlying notion of observational equivalence. It is one source of examples demonstrating the incompleteness of the above proof method; there are other examples that do not involve composition of refinement steps, see [HLST00]. The restriction to signatures with first-order term constants in the second part of Theorem 2.5 is necessary, and this is the key to the incompleteness of logical refinements as a proof method and the problem with composability of logical refinements. If A B C then A ≡OBS B ≡OBS C, and so A ≡OBS C since ≡OBS is an equivalence relation. But then it follows that A C only for signatures without higher-order term constants. In [HS02], a weakening of the notion of logical relations called pre-logical relations was studied; see [PPST00] for a categorical formulation. Definition 2.6 ([HS02]). An algebraic relation R over Σ-combinatory algebras A, B is a family of relations {Rσ ⊆ [[σ]]A × [[σ]]B }σ∈Types → (Σ) such that: – If Rσ→τ (f, g) then ∀a ∈ [[σ]]A .∀b ∈ [[σ]]B .Rσ (a, b) ⇒ Rτ (App A f a, App B g b). – Rσ ([[c]]A , [[c]]B ) for every term constant c : σ in Σ. A pre-logical relation R is an algebraic relation such that: ρ,σ,τ σ,τ – R(SA , SBρ,σ,τ ) and R(KA , KBσ,τ ) for all ρ, σ, τ ∈ Types → (Σ).
The idea of this definition is to replace the reverse implication in the definition of logical relations with a requirement that the relation contains the S and K combinators. Since these suffice to express all lambda terms, this amounts to requiring the reverse implication to hold only for pairs of functions that are expressible by the same lambda term. It is easy to see that any logical relation is a pre-logical relation.
72
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
Example 2.7. A Σ-homomorphism h : A → B is a type-indexed family of functions {hσ : [[σ]]A → [[σ]]B }σ∈Types → (Σ) such that for any term constant σ,τ σ→τ c : σ in Σ, hσ ([[c]]A ) = [[c]]B , hτ (App σ,τ (f ) hσ (a) and A f a) = App B h σ→τ A ([[Γ λx:σ.M : σ → τ ]]ηA ) = [[Γ λx:σ.M : σ → τ ]]B h h◦ηA . Any Σhomomorphism is a pre-logical relation but is not in general a logical relation. The binary case of pre-logical relations over A and B is derived from the unary case of pre-logical predicates for the product structure A × B. Similarly for n-ary relations for n > 2. Definition 2.8 ([HS02]). A pre-logical predicate P over a Σ-combinatory algebra A is a family of predicates {P σ ⊆ [[σ]]A }σ∈Types → (Σ) such that: – If P σ→τ (f ) then ∀a ∈ [[σ]]A .P σ (a) ⇒ P τ (App A f a). – P σ ([[c]]A ) for every term constant c : σ in Σ. ρ,σ,τ σ,τ – P (SA ) and R(KA ) for all ρ, σ, τ ∈ Types → (Σ). Example 2.9. For any signature Σ and combinatory algebra A, the family P σ (v) ⇔ v is the value of a closed Σ-term M : σ is a pre-logical predicate over A. (In fact, P is the least such – see Prop. 2.17 below.) Now, consider the signature Σ containing the type constant nat and term constants 0 : nat and succ : nat → nat and let A be the combinatory algebra over N where 0 and succ have their usual interpretations and [[σ → τ ]]A = [[σ]]A → [[τ ]]A for every σ, τ ∈ Types → (Σ) with App σ,τ A f x = f (x). Then P is not a logical predicate over A: any function f ∈ [[nat → nat]]A , including functions that are not lambda definable, takes values in P to values in P and so must itself be in P . An improved version of Theorem 2.5, without the restriction to first-order signatures, holds if pre-logical relations are used in place of logical relations. Theorem 2.10 (Representation Independence for Pre-Logical Relations [HS02]). Let A and B be Σ-combinatory algebras and let OBS ⊆ Types → (Σ). Then A ≡OBS B iff there exists a pre-logical relation over A and B which is a partial injection on OBS . 2 This suggests the following. (We switch to a notation that makes the set of observable types explicit.) Definition 2.11 ([HLST00]). Let A and B be Σ-combinatory algebras and OBS > B, OBS ⊆ Types → (Σ). Then B is a pre-logical refinement of A, written A ∼ ∼∼∼∼ σ if there is a pre-logical relation R over A and B such that R is a partial injection for each σ ∈ OBS . We phrase this as a definition, rather than as a proof method for the underlying notion of data refinement, in contrast to logical refinements. As a proof method it is sound and complete, and therefore equivalent to this underlying notion. Pre-logical relations compose – in fact, for extensional models they are the minimal weakening of logical relations with this property (see [HS02] for details).
Semantic and Syntactic Approaches to Simulation Relations
73
Proposition 2.12 ([HS02]). The composition S ◦ R of pre-logical relations R over A, B and S over B, C is a pre-logical relation over A, C. 2 So pre-logical refinements compose, and this explains why stepwise refinement OBS OBS >B ∼ >C ⇒ ∼∼∼∼ ∼∼∼∼ is sound. Another explanation goes via Theorem 2.10: A ∼ OBS > C. The set of observable types A ≡OBS B ≡OBS C ⇒ A ≡OBS C ⇒ A ∼∼∼∼∼ need not be the same in both steps, as the following result spells out.
OBS OBS OBS >B ∼ > C and OBS ⊆ OBS then A ∼ > C. ∼∼∼∼ ∼∼∼∼ ∼∼∼∼ Proposition 2.13. If A ∼ 2
The key to many of the applications of logical relations, including Theorem 2.5, is the Basic Lemma, which says that any logical relation over A and B relates the interpretation of each lambda term in A to its interpretation in B. Lemma 2.14 (Basic Lemma for Logical Relations). Let R be a logical relation over A and B. Then for all Γ -environments ηA , ηB such that RΓ (ηA , ηB ) B and every term Γ M : σ, Rσ ([[Γ M : σ]]A 2 ηA , [[Γ M : σ]]ηB ). (Here, RΓ (ηA , ηB ) refers to the obvious extension of R to environments.) For pre-logical relations, we get a two-way implication. This says that pre-logical relations are the most liberal weakening of logical relations that give the Basic Lemma. (The reverse implication fails for logical relations.) Lemma 2.15 (Basic Lemma for Pre-Logical Relations [HS02]). Let R = {Rσ ⊆ [[σ]]A × [[σ]]B }σ∈Types → (Σ) be a family of relations over A and B. Then R is a pre-logical relation iff for all Γ -environments ηA , ηB such that RΓ (ηA , ηB ) B 2 and every Σ-term Γ M : σ, Rσ ([[Γ M : σ]]A ηA , [[Γ M : σ]]ηB ). Composability of pre-logical relations (Prop. 2.12) is an easy consequence of this. Pre-logical relations enjoy a number of useful algebraic properties apart from closure under composition. For instance: Proposition 2.16 ([HS02]). Pre-logical relations are closed under intersection, product, projection, permutation and ∀. Logical relations are closed under product, permutation and ∀ but not under intersection or projection. 2 A consequence of closure under intersection is that given a property P of relations that is preserved under intersection, there is always a least pre-logical relation satisfying P . We then have the following lambda-definability result (recall Example 2.9 above): Proposition 2.17 ([HS02]). The least pre-logical predicate over a given combinatory algebra contains exactly those elements that are the values of closed Σ-terms. 2 In a signature with no term constants, a logical relation may be constructed by defining a relation R on base types and using the definition to “lift” R inductively to higher types. The situation is different for pre-logical relations: there are in general many pre-logical liftings of a given R, one being of course
74
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
its lifting to a logical relation. But since the property of lifting a given R is preserved under intersection, the least pre-logical lifting of R is also a well-defined relation. Similarly, the least pre-logical extension of a given family of relations is well-defined for any signature. Lifting R to a logical relation is not possible in general for signatures containing higher-order term constants. Extension is also problematic: the cartesian product A × A is a logical relation that trivially extends any binary relation on A, but this is uninteresting.
3
Pre-logical Relations for System F
The simply-typed lambda calculus λ→ considered in the last section is a very simple language. Extending it with other type constructors, for example sum and product types, is unproblematic, see [HS02]. Much more challenging is the addition of parametric polymorphism as found in functional programming languages, which yields System F [Gir71,Rey74]. A hint of the power this adds, apart from the obvious ability to define functions that work uniformly over a family of types, is the fact that it is possible to encode inductive types, including the natural numbers, booleans, lists and products, in pure System F [BB85]. Our interest is in data refinement over System F viewed as a programming language, as a means of applying the ideas in the previous section to languages like Standard ML. The key concept underlying data refinement, as we have seen, is that of observational equivalence, and thus understanding the notion of observational equivalence between models of System F is the main theme. Towards this goal, we extend the semantic approach described in Sect. 2 to System F. This involves extending pre-logical relations to System F, and characterising observational equivalence by pre-logical relations. Leiß [Lei01] has developed a formulation of pre-logical relations and studied their properties in Fω , the extension of System F by type constructors. In the context of this paper we restrict attention to plain System F, even though the further extension to Fω presents no additional difficulties. Definition 3.1. The set of types for System F over a set B of base types is given by the grammar σ ::= b | α | σ → σ | ∀α . σ, where α ranges over type variables. A signature Σ consists of a set B of type constants and a collection C of typed term constants c : σ where σ is closed. Types →∀ (Σ) denotes the set of types over B. The set of Σ-terms for System F is given by the grammar M ::= x | c | λx : σ . M | M M | Λα . M | M σ. For simplicity, we obey Barendregt’s variable convention: bound variables are chosen to differ in name from free variables in any type or term. A Σ-type context (ranged over by ∆) is a list of distinct type variables. A Σ-context (ranged over by Γ ) is a list of pairs of variables and types in Types →∀ (Σ), where variables are distinct from each other. We often omit Σ if it is clear from the context. For the type system and representation of data types, see e.g. [GTL90]. By ∆ τ, ∆ Γ
Semantic and Syntactic Approaches to Simulation Relations
75
and ∆ | Γ M : τ we mean to declare a type, a context and a term which are well-formed. First we introduce the underlying model theory of System F in the style of Bruce, Mitchell and Meyer [BMM90]. Definition 3.2. A Σ-BMM interpretation (abbreviated BMMI) A consists of n n – a set TA and a family [TA → TA ] ⊆ TA → TA for each n ∈ N satisfying 2 certain conditions , – an element [[b]]A ∈ TA for each b ∈ B of Σ, – functions ⇒A : TA × TA → TA and ∀A : [TA → TA ] → TA , – a TA -indexed family of sets A, : At⇒A u → (At → Au ) for each t, u ∈ TA , – a function Appt⇒u A ∀f – a function AppA : A∀A f → t∈A Af (t) for each f ∈ [TA → TA ].
Here we introduce two terminologies. A ∆-environment is a mapping from type ∆ variables in ∆ to TA . We write TA for the set of ∆-environments. For a context ∆ Γ , a Γ -environment is a mapping which maps a variable in Γ to an element A A in A[[Γ (x)]]χ , where χ is a ∆-environment. We write A[[Γ ]]χ for Γ -environments. We continue the definition: ∆ – a meaning function for types [[−]]A , which maps a type ∆ σ and χ ∈ TA A to [[σ]]χ ∈ TA (for details, see [Has91]), A
– an element [[c]]A ∈ A[[σ]] for each c : σ in Σ, – a meaning function for terms [[−]]A (we use the same symbol), which maps A ∆ a term ∆ | Γ M : σ and environments χ ∈ TA , η ∈ R[[Γ ]]χ to a value [[σ]]A χ (for details, see [Has91]). [[M ]]A χ;η ∈ R Given Σ-BMMIs A and B, we can define the product Σ-BMMI A × B in the obvious componentwise fashion. Definition 3.3. Let A be a Σ-BMMI. A predicate R over A (written R ⊆ A) consists of a subset TR ⊆ TA and TR -indexed family of subsets Rt ⊆ At . For t, u ∈ TA and f ∈ [TA → TA ] such that f (t) ∈ TR for any t ∈ TR , we define u Rt → Ru = {x ∈ At⇒A u | ∀y ∈ Rt . Appt⇒u A (x)(y) ∈ R }
f (t) } ∀x ∈ TR . Rf = {x ∈ A∀A f | ∀t ∈ TR . πt (App∀f A (x)) ∈ R
Binary relations for Σ-BMMIs are just predicates over product interpretations. Now a predicate R ⊆ A is – pre-logical for types if it satisfies the following: • [[b]]A ∈ TR , • t, u ∈ TR implies t ⇒A u ∈ TR , 2
n [TA → TA ] includes projections and is closed under composition, ⇒A and ∀A . See [Has91] for a detailed account.
76
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
∆ • for all types ∆, α σ with χ ∈ TR , if [[σ]]A χ{α→t} ∈ TR holds for all t ∈ TR , then [[∀α . σ]]A ∈ T , R χ – algebraic if it is pre-logical for types and A • [[c]]A ∈ R[[σ]] for all c : σ in Σ, • for all t, u ∈ TR , Rt⇒A u ⊆ Rt → Ru , ∆ • for all types ∆, α σ with χ ∈ TR , R∀A f ⊆ ∀x ∈ TR . Rf holds, where A 3 f (t) = [[σ]]χ{α→t} , – pre-logical if it is algebraic and A ∆ • for all terms ∆ | Γ, x : σ M : σ with χ ∈ TR and η ∈ R[[Γ ]]χ , if A [[σ ]]A χ holds for all v ∈ R[[σ]]χ , then [[λx : σ . M ]]A [[M ]]A χ;η ∈ χ;η{x→v} ∈ R A
A
R[[σ]]χ ⇒A [[σ ]]χ , A ∆ • for all terms ∆, α | Γ M : σ with χ ∈ TR and η ∈ R[[Γ ]]χ , if ft ∀A f [[M ]]A holds for all t ∈ TR , then [[Λα . M ]]A , χ;η ∈ R χ{α→t};η ∈ R A where f (t) = [[σ]]χ{α→t} . – logical if it is pre-logical for types and conditions of algebraic relations hold by equality. Alternatively, we can extend the definition of pre-logical relations (Definition 2.6) in terms of algebraic relations relating additional combinators for System F [BMM90]. We have the following main theorem of pre-logical predicates: Theorem 3.4 (Basic Lemma for Pre-Logical Predicates [Lei01]). Let A be a Σ-BMMI and R ⊆ A be a predicate. ∆ 1. R is pre-logical for types iff for all types ∆ σ with χ ∈ TR , [[σ]]A χ ∈ TR holds. A ∆ 2. R is pre-logical iff for all terms ∆ | Γ M : σ with χ ∈ TR and η ∈ R[[Γ ]]χ , A [[σ]]χ [[M ]]A holds.
χ;η ∈ R
Corollary 3.5 ([Lei01]). Logical predicates over Σ-BMMIs are pre-logical.
Proposition 3.6 ([Lei01]). Let A be a Σ-BMMI. We define the definability A predicate D by TD = {[[∅ σ]]A } and D[[∅σ]] = {[[∅ | ∅ M : σ]]A }. Then D is the least pre-logical predicate over A.
It is easy to see that pre-logical predicates for System F are closed under product, permutation and arbitrary intersection. On the other hand, they are not closed under composition (nor under projection). This is pointed out by Leiß in the setting of F ω [Lei01]. The composition R◦S of two relations R ⊆ A×B, S ⊆ B×C is given as follows: TR◦S = TR ◦ TS , 3
R ◦ S t,u = {Rt,r ◦ S r,u | ∃r.(t, r) ∈ TR , (r, s) ∈ TS }
At this point we know that f (t) ∈ TR for any t ∈ TR by the first part of Theorem 3.4. Thus ∀x ∈ TR . Rf is defined.
Semantic and Syntactic Approaches to Simulation Relations
77
Proposition 3.7. Binary pre-logical relations between Σ-BMMIs do not compose in general. Proof. Let Σc = ({b}, {c : b}) be a signature and A be a Σc -BMMI where [[b]]A contains at least two elements, namely {, ⊥}. Any non-trivial BMMI for the empty signature can be used for this purpose. We interpret the constant by [[b]]A ⇒A [[b]]A . [[c]]A = . We use λx . ⊥ as shorthand for [[λx : b . y]]A ∅;{y→⊥} ∈ A Let θ = [b/α] and θ = [b ⇒ b/α] be type substitutions. We define relation TR by TR = {([[σθ]]A , [[σθ ]]B ) | α σ}. It is easy to show that this is pre-logical A B ∆ by induction: for types. Next we define R[[σθ]]χ ,[[σθ ]]χ for all ∆, α σ and χ ∈ TR A
B
R[[bθ]]χ ,[[bθ ]]χ = {(, )} A
B
A
B
R[[αθ]]χ ,[[αθ ]]χ = {(⊥, λx . ⊥)} R[[βθ]]χ ,[[βθ ]]χ = Rχ(β) A A B B A B R[[(σ⇒σ )θ]]χ ,[[(σ⇒σ )θ ]]χ = R[[σθ]]χ ,[[σθ ]]χ → R[[σ θ]]χ ,[[σ θ ]]χ A
B
R[[(∀β.σ)θ]]χ ,[[(∀β.σ)θ ]]χ = ∀x ∈ TR . Rf
B (f (t, u) = ([[σθ]]A χ{β→t} , [[σθ ]]χ{β→u} ))
We can show that R = (TR , R) is pre-logical. However the relation R−1 ◦ R relates (λx . ⊥, λx . ⊥) but not (⊥, ⊥). This contradicts algebraicity.
One natural question is when the composition of two pre-logical relations is pre-logical, and Leiß showed a sufficient condition [Lei01]. We give a characterisation of observational equivalence by pre-logical relations, as in Theorem 2.10. We can reuse Definition 2.3 for observational equivalence between Σ-BMMIs with respect to closed observable types. Theorem 3.8 ([Lei01]). Let A and B be Σ-BMMIs and let OBS be a set of closed types of System F. Then A ≡OBS B iff there exists a pre-logical relation over A and B which is a partial injection on OBS .
4
Expressing Simulation Relations Syntactically
Our journey now moves into the syntactic realm, placing the concepts of simulation relation and representation independence in a logical setting. The main incentive is that computer-aided reasoning requires syntactic expressibility. One reasonable choice for syntactic formalism is the polymorphic lambda calculus, together with a second-order logic, with the lambda calculus being the object programming language. The decision in this section to make use of polymorphism is motivated primarily by expressibility, since semantic notions may then be internalised in syntax. At the outset, we use this expressive power to express the simply-typed notions of Sect. 2. However, in Sect. 4.4, polymorphism in data types is also handled. Nevertheless, in Sect. 4.6 we suggest that the appropriate setting for describing polymorphic data types is actually F3 . Our choice here of formalism influences the way we regard the failure of standard simulation relations, i.e., logical relations, at higher order. It turns out that a natural trail of development gives a solution that is conceptually
78
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
different from that of pre-logical relations, although it should be evident that the concepts are strongly related. The syntactic approach here is developed directly from syntactic abstraction barriers inherent in polymorphic types. This gives a notion of abstraction barrier-observing (abo) simulation relation. 4.1
Internalisation into Syntax
To start, we consider System F, cf. Sect. 3. Here we wish to be formalistic, so we use pure System F without constants. Self-iterating inductive types can be def def encoded [BB85], e.g., nat = ∀α.α → (α → α) → α, bool = ∀α.α → α → α, and def list σ = ∀α.α → (σ → α → α) → α, with programmable constructors, destrucdef tors and conditionals. Products encode as σ × τ = ∀α.(σ → τ → α) → α with constructor pair σ,τ and destructors proj 1σ,τ and proj 2σ,τ . We use the logic for parametric polymorphism due to [PA93], a second-order logic over System F augmented with relation symbols, relation definition, and the axiomatic assertion of relational parametricity. See also [Mai91,Tak98]. Formulae now include relational statements as basic predicates and quantifiables, φ ::= (M =σ N ) | M ξ N | · · · | ∀ξ ⊂ σ×τ . φ | ∃ξ ⊂ σ×τ . φ where ξ ranges over relation variables. Relation definition is given by the syntax Γ (x : σ, y : τ ) . φ ⊂ σ×τ def
where φ is a formula. For example eq σ = (x : σ, y : σ) . (x =σ y). We write U [X] to indicate possible occurrences of variable X in type, term or formula U , and write U [A] for the capture-correct substitution U [A/X]. Complex relations may be built from simpler ones. We get the arrow-type relation R → R ⊂ (σ → σ )×(τ → τ ) from R ⊂ σ×τ and R ⊂ σ ×τ by (R → R ) = (f : σ → σ , g : τ → τ ) . (∀x : σ.∀y : τ . (x R y ⇒ (f x) R (gy))) def
The universal-type relation ∀(α, β, ξ ⊂ α × β)R[ξ] ⊂ (∀α.σ[α]) × (∀β.τ [β]) is defined from R[ξ] ⊂ σ[α] × τ [β], where α, β and ξ ⊂ α × β are free, by def
∀(α, β, ξ ⊂ α×β)R[ξ] = (y : ∀α.σ[α], z : ∀β.τ [β]) . (∀α.∀β.∀ξ . (yα)R[ξ](zβ)) For n-ary α, σ, τ , R, where Ri ⊂ σi ×τi , we get ρ[R] ⊂ ρ[σ]×ρ[τ ], the action of type ρ[α] on R, by substituting relations for type variables: ρ[α] = αi : ρ[R] = Ri ρ[α] = ρ [α] → ρ [α] : ρ[R] = ρ [R] → ρ [R] ρ[α] = ∀α .ρ [α, α ] : ρ[R] = ∀(β, γ, ξ ⊂ β ×γ)ρ [R, ξ] Here, R may be seen as base relations from which one uniquely defines relations according to type construction. This is logical lifting and gives the mechanism for logical relations in our syntactic setting. The proof system is intuitionistic natural deduction, augmented with inference rules for relation symbols in the obvious way. There are standard axioms for equational reasoning implying extensionality for arrow and universal types.
Semantic and Syntactic Approaches to Simulation Relations
79
Parametric polymorphism requires all instances of a polymorphic functional to exhibit a uniform behaviour [Str67,BFSS90,Rey83]. We adopt relational parametricity [Rey83,MR91]: A polymorphic functional instantiated at two related domains should give related instances. This is asserted by the schema Param : ∀γ.∀f : (∀α.σ[α, γ]) . f (∀α.σ[α, eq γ ]) f The logic with Param is sound; we have, e.g., the parametric per -model of [BFSS90] and the syntactic models of [Has91]. In order to prove the existence of a model, one has to show that Param holds for all closed f . If one then expands the statement, one obtains a syntactic analogue of the Basic Lemma for logical relations, but here involving universal types. Lemma 4.1 (Basic Lemma Param [PA93]). For all closed f : ∀α.σ[α], we derive without Param, f (∀α.σ[α]) f . 2 Constructs such as products, sums, initial and final (co-)algebras are encodable in System F. With Param, these become provably universal constructions. Relational parametricity also yields the fundamental Lemma 4.2 (Identity Extension Param [PA93]). With Param, we derive ∀γ.∀u, v : σ[γ] . (u σ[eq γ ] v ⇔ (u =σ[γ] v))
2
For data types, we use the following notation: A data type over a signature T consists of a data representation A and an implementation of a set of operations a : T [A]. Encapsulation is provided in the style of [MP88] by the following encoding of existential (abstract) types and pack and unpack combinators: def
∃α.T [α] = ∀β.(∀α.(T [α] → β) → β),
β not free in σ
def
pack T (A)(a) = Λβ.λf : ∀α.(T [α] → β).f (A)(a) def unpack T (package)(τ )(f ) = package(τ )(f ) Operationally, pack packages a data representation and an implementation of operations on that data representation to give a data type of the existential type. The resulting package is a polymorphic functional, that given a client computation and its result domain, instantiates the client with the particular elements of the package. The unpack combinator is merely the application operator for pack . An abstract type for stacks of natural numbers could be ∃α.(α × (nat → α → α) × (α → α) × (α → nat)) A data type of this type is, e.g., (pack list nat l), where (proj 1 l) = nil , (proj 2 l) = cons, (proj 3 l) = λl : list nat . (cond list nat (isnil l) nil (cdr l)), (proj 4 l) = λl : list nat . (cond nat (isnil l) 0 (car l)). For convenience we use a labelled product notation,
80
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
∃α.TStack nat [α] def
where TStack nat [α] = (empty : α, push : nat → α → α, pop : α → α, top : α → nat). Each fi : Ti [α] is a profile in T [α]. The analogy to Sect. 2 is that fi is a term constant in the signature T , and models are internalised as packages (pack Aa). Consider now the issue of when two packages are interchangeable in a program. To each refinement stage, a set OBS of observable types is associated, assumed to contain closed inductive types, such as bool or nat, and also any parameters. Two data types are interchangeable if their observable properties are the same, i.e., packages should be observationally equivalent if it makes no difference which one is used in computations with observable result types. Thus: Definition 4.3 (Observational Equivalence). Observational equivalence of (pack Aa), (pack Bb) with respect to OBS is expressed by ∀f : ∀α.(T [α] → ι).(f A a) =ι (f B b) ι∈OBS
For example, an observable computation on natural-number stacks could be Λα.λx : TStack nat [α] . x.top(x.push n x.empty). Observational equivalence is the conceptual description of interchangeability, and simulation relations is a means for showing observational equivalence. In the logic one uses the action of types on relations to define logical relations. Two data types are related by a simulation relation if there exists a relation on their data representations that is preserved by their corresponding operations. Definition 4.4 (Simulation Relation). The existence of a simulation relation between (pack Aa) and (pack Bb) is expressed by ∃ξ ⊂ A×B . a(T [ξ, eq γ ])b. We want the two notions to be equivalent. For data types with first-order operations, this equivalence is a fact under relational parametricity. At higher-order this is not the case. Also, the composability of simulation relations fails at higher order, compromising the constructive composition of refinement steps. Consider the assumption that T [α] has only first-order function profiles: T : Every profile Ti [α] = Ti1 [α] → · · · → Tni [α] → Tci [α] of T [α] is first FDT OBS order, and such that Tci [α] is either α or some ι ∈ OBS . T Theorem 4.5 (Composability [Han99]). Assuming FDTOBS , with Param we get
∀A, B, C, ξ ⊂ A×B, ζ ⊂ B ×C, a : T [A], b : T [B], c : T [C]. a T [ξ, eq γ ] b ∧ b T [ζ, eq γ ] c ⇒ a T [ξ ◦ ζ, eq γ ] c 2 Theorem 4.6 (Representation Independence [Han99]). Assuming T , we get with Param, for A, B, a : T [A], b : T [B] and OBS , FDTOBS ∀f : ∀α.(T [α] → ι) . (f A a) =ι (f B b) ∃ξ ⊂ A×B . a T [ξ, eq γ ] b ⇔ ι∈OBS
2
Semantic and Syntactic Approaches to Simulation Relations
81
For Theorem 4.6, consider how to derive ⇒. In Sect. 2, we would use the Basic Lemma in this situation. Here, we apply Param; f (∀α.T [α, eq γ ] → ι) f . As mentioned before, Param for closed f is essentially the Basic Lemma for logical relations. In the semantic setting one can talk about closed terms. This is not immediately possible syntactically, and note that the definition of observational equivalence here says nothing about f being closed. To compensate for this, we use a extended ‘Basic Lemma’, namely relational parametricity. For the opposite direction, one must construct a relation ξ. Analogous to the case in the semantic setting, we use definability, but since closedness is intangible def for us, we can only exhibit ξ = (a : A, b : B) . (Dfnbl (a, b)), where def
Dfnbl = (x : A, y : B) . (∃fα : ∀α.T [α] → α . fα Aa = x ∧ fα Bb = y) This works since observational equivalence is defined ‘open’ as well. For example, if there is a profile g : α → α in T , then we show a.g (Dfnbl → Dfnbl ) b.g which def follows easily by giving f = Λα.λx : α.x.g(fα αx), where fα is postulated by the antecedentary Dfnbl . If g : α → ι, then f : ∀α.T [α] → ι, and by observational equivalence we have f Aa =ι f Bb, which gives f Aa ι f Bb by Param. This particular proof fails if T [α] has higher-order profiles. Consider def
T [α] = (p : (α → α) → nat, s : α → α) We must derive ∀x : A → A, y : B → B . x(Dfnbl → Dfnbl )y ⇒ a.px =nat b.py. However, x(Dfnbl → Dfnbl )y does not give us an fα→α : ∀α.T [α] → (α → α) such that fα→α Aa = x ∧ fα→α Bb = y, so we cannot construct our f : ∀α.T [α] → nat to complete the proof. This negative result involving Dfnbl generalises. At higher order, there might not exist any simulation relation in the presence of observational equivalence [Han01]. To exemplify with T [α] above, any candidate R ⊂ A × B has to satisfy ∀x : A → A, y : B → B . x (R → R) y ⇒ a.px =nat b.py, and this includes x and y that do not belong to, or are not expressible by, operations in the respective data types. This, one might argue, is unreasonable. In fact, it is. Consider a computation f = Λα.λx : T [α].M [α, x]. A crucial observation is now embodied in the following obvious statement. Abs-Bar : A computation Λα.λx : T [α].M [α, x] cannot have free variables of types involving the virtual data representation α. This has a direct bearing on how data type operations may be used. For example, x : A → A and y : B → B above cannot be arbitrary, but must be expressible by respective data type operations; in this case, the only possible candidate for x is a.g, and b.g for y. 4.2
abo-Simulation Relations with Special Parametricity
An obvious solution is now to define a notion of simulation relation where arrowtype relations are weakened by definability clauses for arguments [Han00,Han01]. def For example, write a.s (R → R) גb.s, for = גA, Ba, b, meaning ∀x : A, y : B . x R y ∧ Dfnbl גα (x, y) ⇒ a.sx R b.sy
82
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
where Dfnbl גα (x, y) = (x : A, y : B) . (∃fα : ∀α.T [α] → α . fα Aa = x ∧ fα Bb = y). In general, definability clauses are inserted recursively in arrow types, bottoming def out at base relations, i.e., R = גR. The full definition is in [Han01], and includes the formulation at universal type as well. With a slight abuse of notation, def
Definition 4.7 (abo-Simulation Relation). For any A, B and R ⊂ A × B, T [R, eq γ ]( = גa : T [A, γ], b : T [B, γ]) . (∧1≤i≤k a.gi (Ti [R, eq γ ] ) גb.gi ) def
Observable types such as nat are universal types and appear in ג-variants inside T [ξ]. Therefore, it is important that nat גis eq nat . This holds for closed inductive types using Param. However, we do not get desired relational properties at product type, hence the formulation in Definition 4.7. We are still working under the assumption of relational parametricity. However, notice that we cannot apply Param, e.g., when using T [ξ, eq γ ] ג. One can recover the needed proof power by asserting the missing piece of relational parametricity. Write f (∀α.T [α, eq γ ]ε → σ[α, eq γ ]ε ) f , meaning ∀A, B, ξ ⊂ A×B.∀a : T [A, γ], b : T [B, γ] . a(T [ξ, eq γ ]) גb ⇒ (f A a)(σ[ξ, eq γ ]() גf B b) where = גA, B, a, b. We assume the following: T HDT OBS : Every profile Ti [α] = Ti1 [α] → · · · → Tni [α] → Tci [α] of T [α] is such that Tij [α] has no occurrences of universal types other than those in OBS , and Tci [α] is either α or some ι ∈ OBS . T Definition 4.8 (Special abo-Parametricity (SpParam)). For HDTOBS , for σ[α, γ] having no occurrences of universal types other than those in OBS , and whose only free variables are among α and γ,
SpParam: ∀f : ∀α.(T [α, γ] → σ[α, γ]) . f (∀α.T [α, eq γ ]ε → σ[α, eq γ ]ε ) f T Lemma 4.9 (Basic Lemma SpParam [Han01]). For HDTOBS , for σ[α] having no occurrences of universal types other than those in OBS , and for closed f : ∀α.(T [α] → σ[α]), we derive f (∀α.T [α]ε → σ[α]ε ) f . 2 Lemma 4.9 entails soundness for the logic with Param and SpParam with respect to the closed type and term model and the parametric minimal model due to [Has91]. T Theorem 4.10 (Composability [Han00]). Assuming HDTOBS , we get using SpParam, for = גA, Ba, b, = גB, Cb, c, and = גA, Ca, c,
∀A, B, C, ξ ⊂ A×B, ζ ⊂ B ×C, a : T [A], b : T [B], c : T [C]. a T [ξ, eq γ ] גb ∧ b T [ζ, eq γ ] גc ⇒ a T [ζ ◦ ξ, eq γ ] גc 2 Theorem 4.11 (Representation Independence [Han00]). With the T assumption HDTOBS , we get with SpParam, for A, B, a : T [A], b : T [B], OBS , and = גA, Ba, b, ∃ξ ⊂ A×B . a T [ξ, eq γ ] גb ⇔ ∀f : ∀α.(T [α] → ι) . (f A a) =ι (f B b) ι∈OBS
2
Semantic and Syntactic Approaches to Simulation Relations
4.3
83
abo-Simulation Relations with Closed Special Parametricity
If we can express closedness in the logic, then we can relate to non-syntactic models as well. Closedness is inherently intractable, but we can approximate to a certain degree. We add a basic predicate Closed to the syntax together with a pre-defined semantics. The effect of this is, for example, that the interpretation in any model of ∀f : ∀α.(T [α, γ] → ι) . Closed OBS (f ) ⇒ φ(f ) restricts attention in φ to those interpretations of all f : ∀α.(T [α] → ι) that are denotable by terms whose only free variables are of types in OBS . The semantics for the predicate Closed is not stable under term formation, so we cannot make axioms for Closed in order to derive the closedness of a term from its subterms. We can however add a second symbol ClosedS with a pre-defined semantics that does allow the derivation of closedness, but ClosedS will then not satisfy substitutivity. This is resolved by giving a separate nonsubstitutive calculus for deriving closedness, together with rules for importing the needed results into the main logic. Details are in [Han01]. We now get: Definition 4.12 (Observational Equivalence by Closed Computation). Observational equivalence by closed computation of (pack Aa) and (pack Bb) with respect to OBS is expressed as ∀f : ∀α.(T [α] → ι) . Closed OBS (f ) ⇒ (f A a) =ι (f B b) ι∈OBS def
Also we write for example, a.s (R → R)גC b.s, for = גA, Ba, b, meaning ∀x : A, y : B . x R y ∧ Dfnbl Cα( גx, y) ⇒ a.sx R b.sy def
where Dfnbl Cα( גx, y) = (x : A, y : B) . (∃fα : ∀α.T [α] → α . Closed OBS (f ) ∧ fα Aa = x ∧ fα Bb = y) Again, with a slight abuse of notation: Definition 4.13 (abo-Simulation Relation by Closed Computation). For any A, B and R ⊂ A × B, T [R, eq γ ]גC = (a : T [A, γ], b : T [B, γ]) . (∧1≤i≤k a.gi (Ti [R, eq γ ]גC ) b.gi ) def
Definition 4.14 (Special Closed abo-Parametricity (spParamC)). For T , for σ[α, γ] having no occurrences of universal types other than those in HDTOBS OBS , and whose only free variables are among α and γ, spParamC: ∀f : ∀α.(T [α, γ] → σ[α, γ]) . Closed OBS (f ) ⇒ f (∀α.T [α, eq γ ]εC → σ[α, eq γ ]εC ) f Using this, we get analogous results to the previous section. The corresponding Basic Lemma entails the soundness of the logic with Param and spParamC with respect to any relational parametric model.
84
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
4.4
abo-Relational Parametricity
The previous two subsections augmented relational parametricity with special instances of what one could call abo-relational parametricity. Now we replace relational parametricity altogether with full-fledged abo-relational parametricity. This gives a much simpler treatment than the previous approaches, but at a price: we now need infinite conjunctions in the logic. These are however well-behaved in the sense that proofs only need pointwise treatment. Moreover, refinement proofs need not be concerned with infinite conjunctions. Abs-Bar says that function arguments in computations are bounded by fordef mal parameters, e.g., in the computation f = Λα.λx : α.λs : α → α.t[x, s], s will only be applied to arguments built from formal parameters x and s. This transfers to instances f σ and f τ . So even at the basic level of universal types, one could for R ⊂ σ×τ say that e.g., sσ (R → R) sτ should reflect this, in that only those x, y are considered for the antecedent x R y that are admissible in the computations. Thence, f (∀α.α → (α → α) → α)abo g is the relation given by ∀γ, δ, ξ ⊂ γ × δ . ∀a : γ, b : δ, s : γ → γ, s : δ → δ . a ξ b ⇒ s (ξ → ξ) s ⇒ f γas ξ gδbs where s (ξ → ξ) s for = γ, δa, bs, s is ∀x : γ, y : δ . x ξ y ∧ Dfnbl γ (x, y) ⇒ sx ξ s y where Dfnbl γ (x, y) = (x : γ, y : δ) . (∃fα : ∀α.T [α] → α . fα γas = x ∧ fα γbs = y). In general, Dfnbl clauses are inserted recursively in arrow types, bottoming out at base relations. The notion of abo-relation in [Han03] formalises the idea. Universal types play two rˆ oles. Consider (∀α.α → (α → α) → (∀β.(α → β) → β) → α)abo , and a term of this type, e.g., Λα.λx : α, s : α → α, p : ∀β.(α → β) → β . s(pαs). The abo-relation treats the outer universal type as the type of a computation, and sets up the Dfnbl clauses according to formal parameters x, s, p. Then, the inner universal type must be treated as a polymorphic parameter, and it is necessary to capture that instances pσ may only vary in α. This is where infinite conjunctions enters the scene, but this discernability for universal types is what enable abo-simulation relations to handle polymorphism in data types, see below. The abstraction barrier-observing formulation of relational parametricity is now given by the following axiom schema. def
Definition 4.15 (abo-Parametricity). abo-Param : ∀γ.∀f : (∀α.σ[α, γ]) . f (∀α.σ[α, eq γ ])abo f The abo-version of the identity extension lemma does not follow from aboParam, because we can no longer use extensionality. Nevertheless, in the spirit of observing abstraction barriers, we argue that in virtual computations, it suffices to consider extensionality only with respect to function arguments that will actually occur. The simplest way to capture this is in fact by asserting identity extension.
Semantic and Syntactic Approaches to Simulation Relations
85
Definition 4.16 (abo-Identity Extension for Universal Types). abo-Iel : ∀γ.∀u, v : (∀α.σ[α, γ]) . u (∀α.σ[α, eq γ ])abo v ⇔ u = v Both abo-Param and abo-Iel hold in the abo-parametric per -model [Han03]. We can also formulate a basic lemma for abo-Param, if we allow infinite derivations. Regular parametricity, Param, will not hold in this model; in fact any logic containing both Param and abo-Param is inconsistent. Note that abo-Iel implies abo-Param. Nevertheless, we choose to display both. With abo-Param and abo-Iel, we regain universal properties, for example for products: ∀σ, τ.∀z : σ×τ . pair (proj 1 z)(proj 2 z) = z ∀u, v : σ × τ . u (σ[eq γ ]×τ [eq γ ])abo v ⇔ (proj 1 u) σ[eq γ ]abo (proj 1 v) ∧ (proj 2 u) τ [eq γ ]abo (proj 2 v) Theorem 4.17 (Representation Independence [Han03]). Under the asT sumption HDTOBS , we get with abo-Param and abo-Iel, ∀A, B.∀a : T [A], b : T [B] . ∃ξ ⊂ A×B . a T [ξ, eq γ ] A,B a,b b 2 ⇔ ι∈OBS ∀f : ∀α.(T [α] → ι) . (f A a) =ι (f B b) T , we get with Theorem 4.18 (Composability [Han03]). Assuming HDTOBS abo-Param and abo-Iel,
∀A, B, C, ξ ⊂ A×B, ζ ⊂ B ×C, a : T [A], b : T [B], c : T [C]. a(T [ξ, eq γ ] A,B a,b )b ∧ b(T [ζ, eq γ ] B,C b,c )c ⇒ a(T [ζ ◦ ξ, eq γ ] A,C a,c )c 2 If we allow infinite derivations, we get representation independence and composability for data types with polymorphic operations, under one requirement: In the sense of Sects. 2 and 3, all type constants must either be observable or hidden, if they are the result type of any operation. Here, type constants correspond to closed types, and since we have polymorphism, type instantiation requires added caution. For example, if OBS = {bool }, then T [α] may not have a profile g : α → (∀β.β → β), since ∀β.β → β is not observable, nor any profile g : α → (∀β.α → β), since gx can then be instantiated by a non-observable closed type yielding a derived profile gx(∀β.β → β) : α → (∀β.β → β). Thus, the requirement takes the form T DT OBS : Every profile Ti [α] = Ti1 [α] → · · · → Tni [α] → Tci [α] of T [α] is such that if Tci [α] has a deepest rightmost universal type ∀β.V , then this subtype is not closed, nor is the deepest rightmost subtype of ∀β.V the quantified β. T Then, Theorem 4.17 and Theorem 4.18 hold under DT OBS . T In closing, we mention that for this section, HDT OBS can in any case be relaxed by dropping the restriction on Tij .
86
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
4.5
pl -Relational Parametricity
It is possible to define algebraic relations in the logic. We do this from basic principles, just as we do for abo-relations. Consider again for example the universal type ∀α.α → (α → α) → α. In a sense, universal types determine signatures with function profiles. This inductive type has a profile for ‘zero’, and a profile for ‘successor’. Relative to the ‘signature’ consisting of these profiles, one can then define algebraic relations in a finite way. Here this can be done for any σ and τ , by giving a relation Rα ⊂ σ × τ , taking the rˆ ole of a base type relation, and then giving a relation Rα→α ⊂ (σ → σ) × (τ → τ ) that we insist satisfies algebraicity: Rα→α (s, s ) ⇒ s (Rα → Rα ) s . In this manner, the universal type induces a family of relations, namely Rα and Rα→α , over the ‘signature’ of the universal type. Thus, we write e.g., f (∀α.α → (α → α) → α)pl g for the relation ∀γ, δ, ξα ⊂ γ × δ, ξα→α ⊂ γ → γ × δ → δ . pl α→α (ξα→α ; ξα ) ⇒ ∀a : γ, b : δ, s : γ → γ, s : δ → δ . Rα (a, b) ∧ Rα→α (s, s ) ⇒ Rα (f γas, gδbs ) where pl α→α (ξα→α ; ξα ) asserts algebraicity of ξα→α relative to ξα . In general, one completes the finite family of relations with all so-called free subtypes, in order to ensure well-definedness of the algebraicity conditions. Also, the full definition of algebraic relations in this manner must reflect the two levels of polymorphism mentioned in the previous section. To get pre-logical relations (pl -relations), one must additionally ensure closure over abstraction. This spoils finiteness, since for a combinatorial approach, we must assert relatedness of an infinite set of combinators. Again this infinite conjunction is well-behaved, since it ranges over all types only varying over the data representations. We may soundly assert pl -relational parametricity and using this, we get similar results to those in the previous section. It might be possible to get away with a finite number of combinators. The rationale behind this is that one may proceed with only a finite family of algebraic relations. If relations of higher order than those in the family are needed, then these can be constructed by logical lifting. This is relevant for polymorphic instantiation. Based on this, it may suffice to have an upper bound on the type complexity of combinators needed. This is under investigation. 4.6
Polymorphic Data Types in F3
Polymorphism within data types is dealt with in a somewhat general manner in the two previous sections. However, it is hard to find natural examples of data types with polymorphic operations that are expressible in System F. Instead, F3 is appropriate, and then one could give e.g., polymorphic stacks as follows. ∃X : ∗ → ∗.TpolyStack [X], TpolyStack [X] = (empty : ∀γ . Xγ, push : ∀γ . γ → Xγ → Xγ, pop : ∀γ . Xγ → Xγ, top : ∀γ . Xγ → γ → γ, map : ∀γ, γ . (γ → γ ) → Xγ → Xγ )
Semantic and Syntactic Approaches to Simulation Relations
87
This provides polymorphic stack operations. The data representation is a type constructor X to be instantiated by the relevant stack element type. One can treat this kind of shallow polymorphism in a pointwise fashion in F2 [Han01], so that one essentially reduces the problem to non-polymorphic signatures. Then it is not necessary that F2 technology deals with polymorphic signatures, neither in one way or another. Alternatively, one could devise appropriate notions of relational parametricity for F3 .
5
Reconciliation
In comparison with the neat and tidy story of pre-logical relations in the simplytyped lambda calculus told in Sect. 2, both the semantic account of pre-logical relations in System F in Sect. 3 and the syntactic approach of abstraction barrier-observing simulation relations in Sect. 4 exhibit certain shortcomings. Our present feeling is that true enlightenment on this subject will require some bridge between the two. The following subsections suggest some possible lines of enquiry that seem promising to us. 5.1 Internalisation of Semantic Notions into Syntax Sects. 2 and 3 deal with semantic simulation relations between models for lambda calculi. Sect. 4, on the other hand, internalises models and simulation relations into syntax. Models (data types) then become terms of an existential type of the def form ∃α.T [α] = ∀β.(∀β.T [α] → β) → β, for some ‘signature’ T [α], and computations or programs using data types are f : ∀α.T [α] → σ. Thus, polymorphism is used to internalise semantic notions. This use of polymorphism is at a level external to data types (models); as in the outermost universal type in computations f : ∀α.T [α] → σ, in contrast to polymorphism within models arising from any polymorphic profiles in T [α]. Relationally, this two-leveled aspect gives rise to certain difficulties. For logical relations it suffices to give a uniform relational definition for universal types, but for abo-relations which use definability relative to data type signatures, it is necessary to reflect the two levels in the relational definitions. This gives a nonuniform relational treatment at universal type. Note that the semantic approach in Sect. 3 does not work on internalised structures in the syntax, and the notion of relational parametricity is there cleaner. Internalising models as, e.g., inhabitants of existential type, gives syntactic control, especially in the context of refining abstract specifications to executable programs. However, we think that the benefits of this to mechanised reasoning should be weighed against a possible scenario without internalisation, but perhaps with sound derived proofs rules for data refinement. This would be a more domain-specific calculus, but might provide a simpler formalism, perhaps more in style with semantic reasoning. 5.2 Equivalence of Models versus Equivalence of Values in a Model As a consequence of the internalisation of semantic notions discussed above, the term “observational equivalence” has been applied at two different levels to
88
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
achieve similar aims. In Sects. 2 and 3, observational equivalence is a relation between two models over the same signature, representing programs. In Sect. 4, it is a relation on encapsulated data types within a single model; such a relation is sometimes referred to as indistinguishability, written ≈. In both of the latter two sections, the power of System F would allow the opposite approach to be taken. Then the question of the relationship between the resulting definitions arises. This question has been investigated in a number of simpler frameworks in [BHW95,HS96,Kat03], where the connection is given by a factorisability result of the form A ≡ B iff A/≈ ∼ = B/≈. It is likely that the same applies in the context of System F, and this might in turn help to shed light on the relationship between the semantic and syntactic worlds. 5.3
Finiteness
Pre-logical relations are defined in terms of definable elements. In logic it is hard to deal with definability in a term-specific way. In Sect. 4.3 we approximated by introducing a new predicate Closed , and in Sect. 4.2 we explicitly related to syntactic models. In both Sect. 4.4 and Sect. 4.5, we basically end up with infinitary logic, albeit in a tractable manner. It may also be feasible to combine elements, for example to use the Closed predicate together with pl -relations. From a purist point of view, all these approaches are slightly unsatisfactory, although for practical purposes they provide methods for proving refinement, since the infinitary issues are basic and of no concern when doing refinement proofs. In fact this is true a fortiori for abo-simulation relations, since these are in fact finite, unlike pre-logical relations. 5.4
Pre-logical Relations and abo-Relations
Both pre-logical relations (pl -relations in the logic) and abo-relations solve the same problems for refinement. The question is then what else they have in common. To make a comparison easier, one can do two things. First, one can transpose the syntactic idea of abo-relation into the semantic setting around e.g., combinatory algebras. It is then probably natural to interpret the Dfnbl clauses as term-definability. In that case when considering data types, it is evident that abo-simulation relations specialise to a finitary version of the minimal pre-logical relation, which is not surprising. The general relationship is however unclear. Conversely, one might transpose the idea of pre-logical relation into syntax with internalised data types. This is mentioned in Sect. 4.5. Then, the connection is not so clear, since the Dfnbl clause says nothing about term-definability, unless we use the Closed predicate of Sect. 4.3. Any comparison would probably depend on the model of choice for the logic. Furthermore, at a more fundamental level, one gets various concepts of relational parametricity. We have the ones in the syntactic setting where data types are internalised, but we also have the external semantic concept in connection to the scenario in Sect. 3. Characterising these in terms of one another is left as an interesting challenge, the start of which is described in the next section.
Semantic and Syntactic Approaches to Simulation Relations
5.5
89
Connection with Pre-logical Relations and Relational Interpretation of System F
We can regard a binary relation over a BMM interpretation as an interpretation of types by relations. The origin of this viewpoint, the relational interpretation of System F, goes back to Reynolds [Rey83] in his attempt to obtain a set-theoretic model of System F. This relational viewpoint enables him to capture the nature of polymorphism in terms of relational parametricity. A semantic account of this viewpoint is given in [MR91,Has91,RR94,BAC95]. Roughly speaking, a relational interpretation of System F consists of two components: a reflexive graph (a graph with an identity edge at each node), which gives a skeleton of binary relations; and an underlying interpretation of System F together with binary relations over it. The interpretation ties nodes and edges of the reflexive graph to the carrier sets of the underlying interpretation and binary relations. This mapping respects identity, i.e. identity edges are mapped to identity relations. We can find a correspondence between pre-logical relations and the relational interpretation of System F. Reflexive graphs are a generalisation of reflexive relations. Thus a pair consisting of a BMM interpretation A and a relation R ⊆ A×A such that TR is reflexive and Rt,t = idAt form a relational interpretation of System F. Conversely, any relational interpretation whose reflexive graph is just a reflexive relation can be regarded as a relation over its underlying interpretation of System F. Moreover we often assume that the mapping from edges to relations respects the interpretation of types. This situation is called natural in [Has91], and under the above correspondence, this means that the corresponding relation is logical. This correspondence suggests that we can bring back our notion of pre-logical relations to consider a class of relational interpretations of System F. We expect that this new class includes interpretations which satisfy Reynolds’ abstraction theorem. The question is how do we understand the notion of relational parametricity in this new class. Parametricity states that relations at universal types include identity relations, but the identity relation itself is a logical notion (in extensional models). One negative consequence of this mismatch is that the Identity Extension Lemma does not hold. On the other hand, modifying parametricity is a good idea for achieving a finer characterisation of observational equivalence. This is exactly achieved on the syntactic side in Sect. 4. We expect that this modification and relevant results developed in the syntactic approach will provide interesting feedback to the relational interpretation of System F.
References BFSS90. BAC95.
E. Bainbridge, P. Freyd, A. Scedrov, and P. Scott. Functorial polymorphism. Theoretical Computer Science 70:35–64 (1990). R. Bellucci, M. Abadi, and P.-L. Curien. A model for formal parametric polymorphism: a PER interpretation for system R. Proc. 2nd Intl. Conf. on Typed Lambda Calculi and Applications, TLCA’95, Edinburgh. Springer LNCS 902, 32–46 (1995).
90 BHW95.
Jo Hannay, Shin-ya Katsumata, and Donald Sannella
M. Bidoit, R. Hennicker and M. Wirsing. Behavioural and abstractor specifications. Science of Computer and Programming, 25:149–186 (1995). BB85. C. B¨ ohm and A. Berarducci. Automatic synthesis of typed λ-programs on term algebras. Theoretical Computer Science 39:135–154 (1985). BMM90. K. Bruce, A. Meyer, and J. Mitchell. The semantics of the second-order lambda calculus. Information and Computation 85(1):76–134 (1990). Gir71. J.-Y. Girard. Une extension de l’interpr´etation de G¨ odel ` a l’analyse, et son application ` a l’´elimination des coupures dans l’analyse et la th´eorie des types. Proc. 2nd Scandinavian Logic Symp., Oslo. Studies in Logic and the Foundations of Mathematics, Vol. 63, 63–92. North-Holland (1971). GTL90. J.-Y. Girard, P. Taylor, and Y. Lafont. Proofs and Types. Cambridge University Press (1990). Han99. J. Hannay. Specification refinement with System F. Proc. 13th Intl. Workshop on Computer Science Logic, CSL’99, Madrid. Springer LNCS 1683, 530–545 (1999). Han00. J. Hannay. A higher-order simulation relation for System F. Proc. 3rd Intl. Conf. on Foundations of Software Science and Computation Structures. ETAPS 2000, Berlin. Springer LNCS 1784, 130–145 (2000). Han01. J. Hannay. Abstraction Barriers and Refinement in the Polymorphic Lambda Calculus. PhD thesis, Laboratory for Foundations of Computer Science (LFCS), University of Edinburgh (2001). Han03. J. Hannay. Abstraction barrier-observing relational parametricity. Proc. 6th Intl. Conf. on Typed Lambda Calculi and Applications, TLCA 2003, Valencia. Springer LNCS 2701 (2003). Has91. R. Hasegawa. Parametricity of extensionally collapsed term models of polymorphism and their categorical properties. Proc. Intl. Conf. on Theoretical Aspects of Computer Software, TACS’91, Sendai. Springer LNCS 526, 495– 512 (1991). Hoa72. C.A.R. Hoare. Proof of correctness of data representations. Acta Informatica 1:271–281 (1972). HS96. M. Hofmann and D. Sannella. On behavioural abstraction and behavioural satisfaction in higher-order logic. Theoretical Computer Science 167:3–45 (1996). HLST00. F. Honsell, J. Longley, D. Sannella and A. Tarlecki. Constructive data refinement in typed lambda calculus. Proc. 3rd Intl. Conf. on Foundations of Software Science and Computation Structures. ETAPS 2000, Berlin. Springer LNCS 1784, 161–176 (2000). HS02. F. Honsell and D. Sannella. Prelogical relations. Information and Computation 178:23–43 (2002). Short version in Proc. Computer Science Logic, CSL’99, Madrid. Springer LNCS 1683, 546–561 (1999). Kat03. S. Katsumata. Behavioural equivalence and indistinguishability in higherorder typed languages. Selected papers from the 16th Intl. Workshop on Algebraic Development Techniques, Frauenchiemsee. Springer LNCS, to appear (2003). Lei01. H. Leiß. Second-order pre-logical relations and representation independence. Proc. 5th Intl. Conf. on Typed Lambda Calculi and Applications, TLCA’01, Cracow. Springer LNCS 2044, 298–314 (2001). MR91. Q. Ma and J. Reynolds. Types, abstraction and parametric polymorphism, part 2. Proc. 7th Intl. Conf. on Mathematical Foundations of Programming Semantics, MFPS, Pittsburgh. Springer LNCS 598, 1–40 (1991).
Semantic and Syntactic Approaches to Simulation Relations Mai91.
91
H. Mairson. Outline of a proof theory of parametricity. Proc. 5th ACM Conf. on Functional Programming and Computer Architecture, Cambridge, MA. Springer LNCS 523, 313–327 (1991). Mil71. R. Milner. An algebraic definition of simulation between programs. Proc. 2nd Intl. Joint Conf. on Artificial Intelligence. British Computer Society, 481–489 (1971). Mit96. J. Mitchell. Foundations for Programming Languages. MIT Press (1996). MP88. J. Mitchell and G. Plotkin. Abstract types have existential type. ACM Trans. on Programming Languages and Systems 10(3):470–502 (1988). PA93. G. Plotkin and M. Abadi. A logic for parametric polymorphism. Proc. Intl. Conf. Typed Lambda Calculi and Applications, TLCA’93, Utrecht. Springer LNCS 664, 361–375 (1993). PPST00. G. Plotkin, J. Power, D. Sannella and R. Tennent. Lax logical relations. Proc. 27th Int. Colloq. on Automata, Languages and Programming, Geneva. Springer LNCS 1853, 85–102 (2000). Rey74. J. Reynolds. Towards a theory of type structures. Programming Symposium (Colloque sur la Programmation), Paris, Springer LNCS 19, 408–425 (1974). Rey81. J. Reynolds. The Craft of Programming. Prentice Hall (1981). Rey83. J. Reynolds. Types, abstraction and parametric polymorphism. Proc. 9th IFIP World Computer Congress, Paris. North Holland, 513–523 (1983). RR94. E. Robinson and G. Rosolini. Reflexive graphs and parametric polymorphism. Proc., Ninth Annual IEEE Symposium on Logic in Computer Science, Paris, 364–371. IEEE Computer Society Press (1994). ST97. D. Sannella and A. Tarlecki. Essential concepts of algebraic specification and program development. Formal Aspects of Computing 9:229–269 (1997). Sch90. O. Schoett. Behavioural correctness of data representations. Science of Computer Programming 14:43–57 (1990). Str67. C. Strachey. Fundamental concepts in programming languages. Lecture notes from the Intl. Summer School in Programming Languages, Copenhagen (1967). Ten94. R. Tennent. Correctness of data representations in Algol-like languages. In: A Classical Mind: Essays in Honour of C.A.R. Hoare. Prentice Hall (1994). Tak98. I. Takeuti. An axiomatic system of parametricity. Fundamenta Informaticae, 33(4):397–432 (1998).
On the Computational Complexity of Conservative Computing Giancarlo Mauri and Alberto Leporati Dipartimento di Informatica, Sistemistica e Comunicazione Universit` a degli Studi di Milano – Bicocca Via Bicocca degli Arcimboldi 8, 20126 Milano, Italy [email protected], [email protected]
Abstract. In a seminal paper published in 1982, Fredkin and Toffoli have introduced conservative logic, a mathematical model that allows one to describe computations which reflect some properties of microdynamical laws of Physics, such as reversibility and conservation of the internal energy of the physical system used to perform the computations. In particular, conservativeness is defined as a mathematical property whose goal is to model the conservation of the energy associated to the data which are manipulated during the computation of a logic gate. Extending such notion to generic gates whose input and output lines may assume a finite number d of truth values, we define conservative computations and we show that they naturally induce a new NP–complete decision problem and an associated NP–hard optimization problem. Moreover, we briefly describe the results of five computer experiments performed to study the behavior of some polynomial time heuristics which give approximate solutions to such optimization problem. Since the computational primitive underlying conservative logic is the Fredkin gate, we advocate the study of the computational power of Fredkin circuits, that is circuits composed by Fredkin gates. Accordingly, we give some first basic results about the classes of Boolean functions which can be computed through polynomial–size constant–depth Fredkin circuits.
1
Introduction
The possibility to perform computations with zero internal energy dissipation has been extensively explored in the past few decades. Considerations of thermodynamics of computing started in the early fifties of the twentieth century. As shown in [11], erasing a bit necessarily dissipates kT ln 2 Joule in a computer operating at temperature T , and generates a corresponding amount of entropy. Here k is Boltzmann’s constant and T the absolute temperature in degrees Kelvin, so that kT ≈ 3 × 10−21 Joule at room temperature. However, in [11] Landauer also demonstrated that only logically irreversible operations necessarily dissipate energy when performed by a physical computer. (An operation
This work has been supported by MIUR project 60% “Teoria degli automi”
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 92–112, 2003. c Springer-Verlag Berlin Heidelberg 2003
On the Computational Complexity of Conservative Computing
93
is logically reversible if its inputs can always be deduced from its outputs.) This result gave substance to the idea that logically reversible computations could be performed with zero internal energy dissipation. Indeed, since the appearance of [11] many authors have concentrated their attention on reversible computations. The importance of reversibility has grown further with the development of quantum computing, where the dynamical behavior of quantum systems is usually described by means of unitary operators, which are inherently logically reversible. Let us note, however, that computing in a logically reversible way says nothing about whether or not the computation dissipates energy: it merely means that the laws of physics do not require that such a dissipation occurs. Of the many papers on reversible computation which have appeared in the literature, the most famous are certainly the work of Bennett on universal reversible Turing machines [3], and the work of Fredkin and Toffoli on conservative logic [6]. In particular, conservative logic has been introduced as a mathematical model that allows one to describe computations which reflect some properties of microdynamical laws of Physics, such as reversibility and conservation of the internal energy of the physical system used to perform the computations. The model is based upon the so called Fredkin gate (see section 6), a three– input/three–output Boolean gate originally introduced by Petri in [14]. In this model conservative computations are realized through circuits which are composed of Fredkin gates. According to [6], conservativeness is usually modeled by the property that the output patterns of the involved Boolean gates are always a permutation of the corresponding input patterns. Besides being conservative, the Fredkin gate is also reversible, that is, it computes a one–to–one map on {0, 1}3 . Notice that conservativeness and reversibility are two independent notions: a gate can satisfy both properties, only one of them, or none. Since every conservative gate produces permutations of its input patterns, it must have the same number of input and output lines. On the other hand, a necessary condition for a gate to be reversible is that the number of output lines be greater than or equal to the number of input lines. Following [4], in this paper we extend the notion of conservativeness to generic gates whose input and output lines may assume a finite number d of truth values, and we derive some properties which are satisfied by conservative gates. By associating equispaced energy levels to the truth values, we show that our notion of conservativeness corresponds to the energy conservation principle applied to the data which are manipulated during the computation. Let us stress that conservativeness is here considered from a strictly mathematical point of view, as in [6]; that is, we are not requiring that the entire energy used to perform the computation is preserved, or that the computing device be a conservative physical system (an ideal but unrealistic situation). In particular, we do not consider the energy needed to actually perform the computation, that is, to apply the operators that transform input values into output values. Successively we introduce the notion of conservative computation, under the reasonable assumption that a gate may store, or accumulate, some energy in its
94
Giancarlo Mauri and Alberto Leporati
internal machinery. Following again [4] we show that conservative computations naturally induce an interesting optimization problem, that we have named Min Storage. By proving that its decision version is NP–complete we show that such problem is NP–hard. Since it is generally believed that no deterministic polynomial time algorithm exists that always gives the correct solution to an NP–hard optimization problem, we present some polynomial time heuristics that give approximate solutions to Min Storage, and we report the results of five computer experiments which have been performed to study the behavior of such heuristics on uniformly randomly chosen instances. Finally, since the computational primitive underlying conservative logic is the Fredkin gate, we advocate the study of the computational power of Fredkin circuits, that is, circuits composed by Fredkin gates. Accordingly, we give some first basic results about the classes of Boolean functions which can be computed by polynomial–size constant–depth Fredkin circuits. Precisely, we show that all Boolean functions which are computed by this kind of circuits can also be computed by depth–two polynomial–size threshold circuits. However, Fredkin circuits can also be regarded as computational devices which generate finite sets of permutations. Since the generated set depends upon the topology of the circuit, we believe that it should be interesting to investigate the relationships between the topology of Fredkin circuits, the computational complexity of the Boolean functions computed by them, and the structure of the corresponding sets of permutations. We conclude the paper by giving some directions towards the study of these relationships.
2
Conservativeness
Our notion of conservativeness is based upon many–valued logics. These are extensions of the classical Boolean logic which have known a great diffusion due to their ability to manage incomplete and/or uncertain knowledge. Different approaches to many–valued logics have been considered in the literature (for an overview, see [16,17]). However, here we are not interested into the study of syntactical or algebraic aspects of many–valued logics; we just use some gates whose input and output lines may assume “intermediate” truth values, such as the gates defined in [5]. 1 2 For every integer d ≥ 2, we consider the finite set Ld = {0, d−1 , d−1 , . . ., d−2 , 1} of truth values; 0 and 1 denote falsity and truth, respectively, whereas the d−1 other values of Ld indicate different degrees of indefiniteness. As usually found in literature, we will use Ld both as a set of truth values and as a numerical set equipped with the standard order relation on rational numbers. An n–input/m–output d–valued function (also called an (n, m, d)–function for short) is a map f : Lnd → Lm d . Analogously, an (n, m, d)–gate and an (n, m, d)– circuit are devices that compute (n, m, d)–functions. A gate is considered as a primitive operation, that is, it is assumed that a gate cannot be decomposed into simpler parts. On the other hand, a circuit is composed by layers of gates: for a precise definition see, for example, [21].
On the Computational Complexity of Conservative Computing
95
Our notion of conservativeness is based upon the conservation of some additive quantities associated with the truth values of Ld . Let us consider the set 1 , ε 2 , . . . , ε d−2 , ε1 ⊆ IR of real values; for exposition conveEd = ε0 , ε d−1 d−1 d−1 nience we can think to such quantities as energy values. To each truth value v ∈ Ld we associate the energy level εv ; moreover, let us assume that the values of Ed are all positive, equispaced, and ordered according to the corresponding 1 truth values: 0 < ε0 < ε d−1 < · · · < ε d−2 < ε1 . If we denote by δ the gap d−1 between two adjacent energy levels then the following linear relation holds: εv = ε0 + δ (d − 1) v
∀ v ∈ Ld
(1)
Notice that it is not required that ε0 = δ. Now, let x = (x1 , . . . , xn ) ∈ Lnd be an input pattern for nan (n, m, d)–gate. We define the amount of energy associated to x as En (x) = i=1 εxi , where εxi ∈ Ed is the amount of energy associated to the i–th element xi of the input pattern. Let us remark that the map En : Lnd → IR+ is indeed a family of mappings parameterized by n, the size of the input. Analogously, for an output m pattern y ∈ Lm d we define the associated amount of energy as Em (y) = i=1 εyi . We can now define a conservative gate as follows. Definition 1. An (n, m, d)–gate, described by the function G : Lnd → Lm d , is conservative if the following condition holds: ∀ x ∈ Lnd
En (x) = Em (G(x))
(2)
Notice that it is not required that the gate has the same number of input and output lines, as it happens with the reversible and conservative gates considered in [6,5]. Using relation (1), equation (2) can also be written as: n m ε0 m ε0 n xi = yj + + δ(d − 1) i=1 δ(d − 1) j=1 Hence, when n = m conservativeness reduces to the conservation of the sum of truth values given in input; in [5] this property is called “weak conservativeness”. A trivial observation is that conservativeness and weak conservativeness coincide in the Boolean case. As for the d–valued case, with d ≥ 3, it is easy to see that conservativeness implies weak conservativeness, whereas the converse is not true: for example, a weakly conservative (3, 3, 3)–gate may transform the input pattern (1, 0, 0) into the output pattern ( 12 , 21 , 0). Also notice that in the Boolean case conservativeness is equivalent to requiring that the number of 1’s given in input is preserved, as originally stated in [6]. An interesting remark is that conservativeness entails an upper and a lower bound to the ratio m n of the number of output lines versus the number of input lines of a gate (or circuit). In fact, maximum amount of energy that can be the n associated to an input pattern is i=1 ε1 = n ε1 , whereas minimum amount the m of energy that can be associated to an output pattern is i=1 ε0 = m ε0 . Clearly if n ε1 < m ε0 then the gate cannot produce any output pattern in a conservative
96
Giancarlo Mauri and Alberto Leporati
ε1 way. As a consequence it must hold m n ≤ ε0 . Analogously, if we consider the minimum amount of energy n ε0 that can be associated to an input pattern x and the maximum amount of energy m ε1 that can be associated to an output ε0 pattern y, it clearly must hold n ε0 ≤ m ε1 , that is m n ≥ ε1 . Summarizing, we have the bounds: ε0 m ε1 ≤ ≤ ε1 n ε0
that is, for a conservative gate (or circuit) the number m of output lines is constrained to grow linearly with respect to the number n of input lines. A natural question is whether we can compute all (n, m, d)–functions in a conservative way. Let us consider the Boolean case. Let f : {0, 1}n → {0, 1}m be a non necessarily conservative function, and let us define the following quantities: Of = max 0, max n {Em (f (x)) − En (x)} x∈{0,1} Zf = max 0, max n {En (x) − Em (f (x))} x∈{0,1}
Practically speaking, Of (resp., Zf ) is the maximum number of 1’s (resp., 0’s) in the output pattern that should be converted to 0 (resp., 1) in order to make the computation conservative. This means that if we use a gate Gf with n + Of + Zf input lines and m+Of +Zf output lines then we can compute f in a conservative way as follows: Gf (x, 1Of , 0Zf ) = (f (x), 1w(x) , 0z(x) ) where 1k (resp., 0k ) is the k–tuple consisting of all 1’s (resp., 0’s), and the pair (1w(x) , 0z(x) ) ∈ {0, 1}Of +Zf is such that w(x) = Of + En (x) − Em (f (x)) and z(x) = Zf − En (x) +Em (f (x)). As we can see, we use some additional input (resp., output) lines in order to provide (resp., remove) the required (resp., exceeding) energy that allows Gf to compute f in a conservative way. It is easily seen that the same trick can be applied to generic d–valued functions f : Lnd → Lm d ; instead of the number of missing or exceeding 1’s, we just compute the missing or exceeding number of energy units, and we provide an appropriate number of additional input and output lines.
3
Conservative Computations
Let us introduce now the notion of conservative computation. We have seen that conservativeness amounts to the requirement that the energy En (x) associated to the input pattern is equal to the energy Em (y) associated to the corresponding output pattern. We can weaken this requirement as follows. Let G : Lnd → Lm d be the function computed by an (n, m, d)–gate. Moreover, let Sin = x1 , x2 , . . ., xk be a sequence of elements from Lnd to be used as input patterns for the gate, and let Sout = G(x1 ), G(x2 ), . . . , G(xk ) be the corresponding sequence of output patterns from Lm d . Let us consider the quantities ei = En (xi )−Em (G(xi )) for all
On the Computational Complexity of Conservative Computing
97
i ∈ {1, 2, . . . , k}; note that, without loss of generality, by an appropriate rescaling we may assume that all ei ’s are integer values. We say that the computation of Sout , obtained starting from Sin , is conservative if the following condition holds: k i=1
ei =
k
En (xi ) −
i=1
k
Em (G(xi )) = 0
i=1
This condition formalizes the requirement that the total energy provided by all input patterns of Sin is used to build all output patterns of Sout . Of course it may happen that ei > 0 or ei < 0 for some i ∈ {1, 2, . . . , k}. In the former case the gate has an excess of energy that should be dissipated into the environment after the production of the value G(xi ), whereas in the latter case the gate does not have enough energy to produce the desired output pattern. Since we want to avoid these situations, we assume to perform computations through gates which are equipped with an internal accumulator (also storage unit) which is able to store a maximum amount C of energy units. We call C the capacity of the gate. The amount of energy contained into the internal storage unit at a given time can be used during the next computation if the output pattern energy is greater than the energy of the corresponding input pattern. If the output patterns G(x1 ), G(x2 ), . . . , G(xk ) of Sout are computed exactly in this order then, assuming that the computation starts with no energy stored into the gate, it is easily seen that st1 := e1 , st2 := e1 + e2 , . . . , stk := e1 + e2 + . . . + ek is the sequence of the amounts of energy stored into the gate during the computation of Sout . Notice that stk = 0 for conservative computations. This condition is equivalent to the requirement that the amount of energy stored into the gate at the end of the computation be equal to the amount of energy stored at the beginning (i.e., zero as assumed here; in section 5 we will also consider the more general case where the initial energy can be greater than zero). In some cases the order with which the output patterns of Sout are computed does not matter. We can thus introduce the following problem: Given an (n, m, d)–gate that computes the map G : Lnd → Lm d , an input sequence x1 , . . . , xk and the corresponding output sequence G(x1 ), . . . , G(xk ), is there a permutation π ∈ Sk (the symmetrical group of order k) such that the computation of G(xπ(1) ), G(xπ(2) ), . . . , G(xπ(k) ) can be performed by a gate having a predefined capacity C? This is a decision problem, whose formal statement follows. (Note that we do not actually need to know the values of x1 , . . . , xk and G(x1 ), . . . , G(xk ): all we need are the values ei = En (xi ) − Em (G(xi )), for i ∈ {1, 2, . . . , k}.) Let E = e1 , e2 , . . . , ek be a finite sequence of integer numbers, defined as i above. For a fixed i ∈ {1, 2, . . . , k}, the i–th prefix sum of E is the value j=1 ej . Let C be a positive integer; we say that E is C–feasible if for each i ∈ {1, 2, . . . , k} the i–th prefix sum of E is in the closed interval [0, C]. Problem 1. Name: ConsComp. – Instance: a set E = {e1 , e2 , . . . , ek } of integer numbers such that e1 + e2 + . . . + ek = 0, and an integer number C > 0.
98
Giancarlo Mauri and Alberto Leporati
– Question: is there a permutation π ∈ Sk (the symmetric group of order k)
such that the sequence eπ(1) , eπ(2) , . . . , eπ(k) is C–feasible? The fact that the resulting sequence eπ(1) , eπ(2) , . . . , eπ(k) is C–feasible can be explicitly written as: 0≤
i
eπ(j) ≤ C
∀ i ∈ {1, 2, . . . , k}
(3)
j=1
The ConsComp problem can be obviously solved by trying every possible permutation π from Sk . However, this procedure requires an exponential time with respect to k, the length of the computation. A natural question is whether it is possible to give the correct answer in polynomial time. With the following theorem we show that the ConsComp problem is NP–complete, and hence it is very unlikely that a polynomial time algorithm exists that solves it. The proof of this theorem was originally published in [4]. Theorem 1. ConsComp is NP–complete. Proof. ConsComp is clearly in NP, since a permutation π ∈ Sk has linear length and verifying if π is a solution can be done in polynomial time. Let us show a polynomial reduction from Partition, which is notoriously an NP–complete problem ([7], page 47). First of all we restate Partition in the following form: – Instance: a set R = {r1 , r2 , . . . , rk } of rational numbers from the interval [0, 1]. – Question: is there a partition (R1 , R2 ) of R such that r= r? r∈R1
r∈R2
The equivalence of this formulation with the one contained in [7] is trivial to prove. Moreover, without loss of generality we can assume that if (R1 , R2 ) is a solution of Partition then it holds r∈R1 r = r∈R2 r = 1: in fact, given a generic instance R = {r1 , r2 , . . . , rk } of Partition it suffices to compute m = k m i=1 ri and divide each element of R by 2 ; as a consequence, it holds r∈R r = 2. Now we consider a generic instance of Partition and we build a corresponding instance of ConsComp such that a solution of the latter can be transformed in polynomial time into a solution of the former. The instance of ConsComp is built as follows: let C = 1, and E = {e1 , e2 , . . . , ek , ek+1 , ek+2 } such that ei = −ri for i ∈ {1, 2, . . . , k} and ek+1 = ek+2 = 1. It is immediate to see that this transformation can be computed in polynomial time. When we solve ConsComp on the instance we have just built, since inequalities stated in (3) must hold, the first element of E which has to be selected to build the permutation π is necessarily a 1. For the same reason we have to choose the next elements from the set {e1 , e2 , . . . , ek } ⊆ E. For each choice, the sum of the elements which have been selected up to that point decreases; the remaining 1 can be chosen if and only if such sum becomes exactly zero. When
On the Computational Complexity of Conservative Computing
99
this situation occurs, the negative elements of E selected up to that point sum up to −1, and thus their opposites constitute one of the two sets of the partition of R in the instance of Partition we started from. In other words, we can place the second 1 in the solution of ConsComp (thus solving the problem) if and only if we can solve the instance of Partition we started from.
The ConsComp problem naturally leads to the formulation of the following optimization problem. Problem 2. Name: Min Storage. – Instance: a set {e1 , e2 , . . . , ek } of integer numbers such that e1 + e2 + . . . + ek = 0. i – Solution: a permutation π ∈ Sk such that j=1 eπ(j) ≥ 0 for each i ∈ {1, 2, . . . , k}. i – Measure: max j=1 eπ(j) .
1≤i≤k
Informally, the output of Min Storage is the minimum value of C for which there exists a permutation π ∈ Sk such that the sequence eπ(1) , eπ(2) , . . . , eπ(k) k is C–feasible. Observe that a trivial upper bound for the value of C is i=1 |ei |, while a trivial lower bound is max1≤i≤k |ei |. It is immediate to see that Min Storage is in the class NPO. In fact, checking whether some given integers e1 , e2 , . . . , ek sum up to zero can be trivially done in polynomial time; each feasible solution has linear length and besides it can be verified in polynomial time whether a given permutation π ∈ Sk is a feasible solution; finally, the measure function can be computed in polynomial time. Since the underlying decision problem ConsComp is NP–complete, we can immediately conclude that Min Storage is NP–hard ([1], page 30). As with the ConsComp decision problem, this means that it is very unlikely that a polynomial time algorithm exists that gives the correct solution to every instance of Min Storage. A trivial exponential time algorithm for solving Min Storage is the following: for each permutation π ∈ Sk we compute: st1 = eπ(1) ,
st2 = eπ(1) + eπ(2) ,
...,
stk = eπ(1) + eπ(2) + . . . + eπ(k)
(notice that stk is always zero by definition of the problem). If there exists an i ∈ {1, 2, . . . , k} such that sti < 0 then we discard the permutation, otherwise we compute stmax = max{st1 , st2 , . . . , stk }. The solution is the minimum value of stmax over all the permutations which have not been discarded. Some optimization is actually possible: if, for a given permutation π and i ∈ {1, 2, . . . , k} it holds sti < 0, then we can immediately discard all permutations π such that π (j) = π(j) for all j ∈ {1, 2, . . . , i}. Analogously, we can discard the same permutations if sti is greater than the best solution obtained so far. Of course, also with these tricks the execution time of this algorithm remains in general exponential with respect to k: a computer implementation has shown no relevant
100
Giancarlo Mauri and Alberto Leporati
advantage with respect to the brute force algorithm which tries all permutations π ∈ Sk , but for artificial instances built on purpose. Another computer experiment has shown that also discarding the permutation under examination whenever sti is found greater than a parameter given in input gives no particular advantage, at least under the reasonable assumption that the input parameter is greater than or equal to the optimal solution of the given instance. In the next section we present some polynomial time heuristics which give approximate solutions to this problem. Successively we report the results of five computer experiments which have been performed to study the behavior of such heuristics on uniformly randomly chosen instances.
4
Polynomial Time Heuristics for Min Storage
Let us first recall the notion of coefficient of approximation. Let cA (I) be the value which is returned as a solution by a heuristic A for the instance I of the Min Storage problem, and let opt(I) be the optimal solution, that is the value returned by the brute force algorithm described above. Then, the coefficient of approximation of algorithm A over the instance I is the value appA (I), where appA (I) =
|cA (I)| opt(I)
Note that appA (I) is always greater than or equal to 1, and that the closer it is to 1, the better the approximate solution is. We say that algorithm A has the guaranteed coefficient of approximation c if appA (I) ≤ c, for every instance I. Notice that in this paper we do not show any guaranteed value for the coefficient of approximation of the proposed algorithms. Indeed, finding an approximation algorithm for Min Storage with a guaranteed coefficient of approximation is still an open problem. In order to evaluate the time complexity of the proposed algorithms we make the following assumptions. First of all we assume that all lists are implemented as arrays. By associating a Boolean flag to each element of the lists, indicating whether the element has to be considered as deleted or not, we can assume that the removal of a generic element L[i] from a list L takes a constant time. As for sorting operations, we assume to use some comparisons–based optimal algorithm such as QuickSort or MergeSort, which take Θ(k log k) time steps to sort k elements. 4.1
The Greedy Algorithm
The first heuristic we propose is the greedy algorithm. This algorithm maintains a list L of elements to be considered. At the beginning of the execution L contains all the elements {e1 , e2 , . . . , ek } of the instance. An integer variable st, initially set to 0, indicates the amount of energy currently stored into the gate. The algorithm repeats the following operations until L becomes empty: first it finds the minimum positive value of st + , with ∈ L, then it updates the value of st with st + , and finally it removes from L. An integer variable stmax
On the Computational Complexity of Conservative Computing
101
records the maximum value reached by st; the value of stmax at the end of the execution is the result returned by the greedy algorithm. It is easily seen that this algorithm can also be implemented as follows: Greedy(I) L ← Sort(I)
// L initially contains the elements of I in increasing // order
st ← 0 stmax ← 0 while Length(L) > 0 do i←1 while st + L[i] < 0 do i←i+1 endwhile st ← st + L[i] stmax ← max{st, stmax} remove L[i] from L endwhile return stmax From the inspection of the pseudocode it is clear that, under the assumptions made above, the execution time of the whole algorithm is Θ(k 2 ). 4.2
Some Θ(k log k) Algorithms
Let us consider the following algorithm: Min(I) Ln ← negative values of I Lp ← I \ Ln sort Lp and Ln in increasing order st ← 0 stmax ← 0 while Length(Lp ) > 0 do st ← st + min(Lp ) stmax ← max{st, stmax} remove min(Lp ) from Lp while Length(Ln ) > 0 and st + max(Ln ) ≥ 0 do st ← st + max(Ln ) remove max(Ln ) from Ln endwhile endwhile return stmax As we can see, at each iteration of the outer while loop the minimum of the remaining positive elements is chosen. For each considered positive element,
102
Giancarlo Mauri and Alberto Leporati
the inner while loop takes as many negative elements as possible, choosing the maximum of them (that is, the one with minimum absolute value) at each iteration. After an initial sorting, each element is considered only once during the execution of the two while loops; hence, the total execution time of the algorithm is Θ(k log k). We can also consider a dual algorithm, which we have called Max, where at each iteration of the outer loop the maximum of the remaining positive elements is chosen, whereas at each iteration of the inner loop the minimum of the remaining negative values is chosen. Another variation is the MaxMinMax algorithm, where at each iteration of the outer while loop the maximum of the remaining positive values is chosen, as in Max. This time, however, there are two subsequent inner while loops: in the former we remove (as much as possible) the minimum negative elements, that is those with highest absolute value, while in the latter we remove the maximum elements as much as possible. Also in this case there exists a dual algorithm, called MinMaxMin, where at each iteration of the outer loop we remove the minimum of the remaining positive elements, and in the two inner loops we remove first the maximum and then the minimum of the remaining negative elements. A further variation is given by algorithms MinMaxMinMax and MaxMinMaxMin. In the outer loop of these algorithms the maximum or the minimum of the remaining positive elements is alternately chosen; in particular, in the former algorithm the first element chosen from the instance is the minimum of positive elements, whereas in the latter algorithm the maximum element of the instance is chosen first. The two inner loops are just like those of MaxMinMax and MinMaxMin; in particular, if the minimum of positive values has been chosen in the outer loop then we first remove the maximum negative elements and then the minimum ones, whereas we do the opposite if the maximum of positive elements was chosen. It is immediately seen that all the variations just exposed are uninfluent to the asymptotic execution time, that remains equal to Θ(k log k). 4.3
The Best Fit Algorithm
Another approach to solve Min Storage is given by the following algorithm: Best Fit(I) Ln ← negative values of I Lp ← I \ Ln sort Lp and Ln in increasing order est ← max{max(Lp ), − min(Ln )} st ← 0 while Length(Lp ) > 0 do if st + min(Lp ) > est then est ← st + min(Lp ) st ← st + min(Lp ) remove min(Lp ) from Lp
// est ← max1≤i≤k |ei |
On the Computational Complexity of Conservative Computing
103
else for i ← Length(Lp ) downto 1 do if st + Lp [i] ≤ est then st ← st + Lp [i] remove Lp [i] from Lp endif endfor endif for i ← 1 to Length(Ln ) do if st + Ln [i] ≥ 0 then st ← st + Ln [i] remove Ln [i] from Ln endif endfor endwhile return est The Best Fit algorithm assumes as a first estimate for the capacity of the gate the value max1≤i≤k |ei |. This initial estimate follows from the observation that the capacity cannot be less than this value since the corresponding element has to be added or removed from the internal storage of the gate in one step. During the execution of the algorithm the estimate for the capacity is adjusted, that is, increased; of course, each time the value of the estimate is increased of the smallest possible amount. Let est be the estimate for the capacity of the gate. At each iteration of the outer while loop we first add to the internal storage some positive values from the instance, and then we add some negative values. Positive values of the instance are scanned from the maximum down to the minimum; each of them is added to the internal storage (and removed from the instance), unless the resulting value exceeds est. Analogously, negative values are scanned from the minimum to the maximum; each of them is added to the internal storage (and removed from the instance), unless the resulting value becomes negative. If at some point no positive value can be added — that is, if st + min(Lp ) > est, where st is the energy currently stored into the gate — then we adjust the value of est by putting est = st + min(Lp ). Now we can add min(Lp ), the minimum of the remaining positive elements, to the internal storage and then try to add some negative elements. The result returned by the algorithm is the value of est at the end of the execution, that is, after all the elements of the instance have been considered. A direct inspection of the pseudocode allows us to see that the execution time of Best Fit is Θ(k 2 ).
5
Experimental Analysis
All the algorithms here exposed have been implemented in the C language and tested over uniformly randomly chosen instances of Min Storage. For each
104
Giancarlo Mauri and Alberto Leporati
heuristic the average coefficient of approximation and the corresponding variance have been computed. In all we have executed five computer experiments, that we now briefly expose. For a detailed report we refer the reader to [12]. In the first experiment we have generated 100 instances, each one containing 12 elements. The elements were chosen from the interval [−106 , 106 ] of integers. The small number and length of instances have been chosen in order to allow the computation of optimal solutions through the “brute force” algorithm that examines all permutations π in Sk . Of the proposed algorithms, Best Fit has obtained both the best coefficient of approximation, about 1.0202729, and the smallest variance. In particular, this means that Best Fit frequently finds a good solution. In the second experiment we have generated 100000 instances of 100 elements. Each element was taken from the interval [−106 , 106 ] of integers. Due to the length of instances, during this experiment (as well as during the next three) we were not able to compute the optimal solutions by means of the “brute force” algorithm; hence, in order to compute the coefficients of approximation we have used the theoretical lower bound max1≤i≤k |ei | as the optimal solution, thus obtaining upper bounds to the real coefficients. Indeed, the first experiment was conceived to compare these upper bounds with the real coefficients of approximation, although computed over very small instances. Once again the winner has been Best Fit, having both the smallest average coefficient of approximation and the smallest variance. We have also considered a variant of the Min Storage problem, where we have relaxed the requirement that the amount of energy stored into the gate at the beginning of the computation is zero. This corresponds to a natural extension of the notion of conservative computation, obtained by letting the gate to have a positive amount ε of energy stored at the beginning of the computation, and requiring that exactly the same amount ε of energy is stored into the gate at the end of the computation. When this situation occurs, we say that the computation is ε–conservative. Clearly also the variant of Min Storage concerning ε–conservative computations (with ε ≥ 0) is NP–hard. The third and fourth experiments have been conceived to study the behavior of the proposed heuristics on this variant of the problem. Setting up these experiments required some minor and trivial modifications to the algorithms. In the third experiment we generated 100 instances, each one composed by 100 elements taken from the interval [−106 , 106 ] of integers. For each instance we ran the proposed algorithms, varying the initial energy ε from 0 to max1≤i≤k |ei |, with steps of 100. As with the previous experiments, we computed the average coefficients of approximation and the corresponding variances. Surprisingly, Best Fit gives no more the best results: instead, MinMaxMinMax has both the lowest average coefficient of approximation (equal to 1.1470192, versus 1.1619727 of Best Fit) and the lowest variance (0.0042202 versus 0.0219509). It is our opinion that Best Fit does not perform better than MinMaxMinMax under this setting because the former algorithm starts by considering the elements of the instance from the greatest positive to the smallest positive element, each
On the Computational Complexity of Conservative Computing
105
time taking the element if there is enough free storage into the gate; negative elements are considered only later. Of course this may not be the optimal strategy, especially when the initial energy stored into the gate is high with respect to gate capacity. The latter algorithm alternately chooses the minimum and the maximum of the positive elements remaining into the instance, and then it immediately considers negative elements: as a consequence, it has more chances to make the right choices. Some modifications to the Best Fit algorithm in order to perform better when there is a positive initial amount of energy into the gate are currently under consideration. The fourth experiment is very similar to the third, the only difference being that the initial energy ε is now varied from 0 to 1.1·max1≤i≤k |ei |. Hence, for some instances we assume that the initial energy is greater than the maximum element of the instance, and thus the only reasonable choice is to start by choosing negative elements. The results obtained during this experiment are similar to the ones obtained during the third experiment. Finally, we conjectured that the variant of Min Storage concerning ε– conservative computations could be harder to solve when ε = 12 · max1≤i≤k |ei |, since in this case we have the smallest number of possible choices for the first element to be chosen from the instance. The fifth experiment was performed to test this conjecture. We generated 10000 instances of 100 elements, where each element was taken from the interval [−106 , 106 ] of integers. However, the results we have obtained are similar to those obtained for previous experiments, and hence it seems that our conjecture is false.
6
Conservative Computing and Small Constant Depth Circuits
As stated above, the computational primitive underlying conservative logic is the Fredkin gate. Indeed, in [6] it is understood that conservative computations are performed by circuits composed of such gates. Hence we believe that it is important to give a characterization of the classes of Boolean functions which can be computed by different topologies of circuits composed by Fredkin gates. Here we give a first step towards this direction: precisely, we show that all Boolean functions which can be computed by constant–depth polynomial–size Fredkin circuits can also be computed by depth-2 polynomial–size threshold circuits with polynomially bounded integer weights. A threshold gate T is a (n, 1, 2)–gate whose computation is uniquely determined by a real vector w = [w1 , w2 , . . . , wn ] ∈ IRn , called the weights vector, and a real value w0 called the threshold. If we denote by x1 , x2 , . . . , xn the input values of T , then the gate computes the following Boolean function: n n 1 if i=1 wi xi ≥ w0 fT (x1 , x2 , . . . , xn ) = step (4) wi xi − w0 = 0 otherwise i=1
It is widely known (see for example [13]) that a Boolean function can be expressed in the form (4) if and only if it is linearly separable, and that integer weights (and
106
Giancarlo Mauri and Alberto Leporati
threshold) are sufficient to a threshold gate to compute every linearly separable function. Trivial examples of linearly separable functions are and, or and not. Putting together threshold gates we can build threshold circuits, that is acyclic and connected directed graphs made up of layers of threshold gates. (For a precise and formal definition of circuits see, for example, [21].) Evaluating a threshold circuit in topological order (i.e. layer by layer, starting from the layer directly connected to the input lines) we can define the Boolean function computed by the circuit as the composition of the functions computed by the single threshold gates. As usually done in the literature, we assume that we can feed to a threshold circuit not only the input values x1 , x2 , . . . , xn , but also their negated counterparts x1 , x2 , . . . , xn ; without loss of generality, we also assume to have two input wires which supply the constant values 0 and 1 respectively. As it is easily demonstrated, both these modifications do not alter the computational power of threshold circuits. In evaluating the resources used by a threshold circuit to compute a Boolean function we consider the size, the depth and the weight of the circuit, respectively defined as the number of threshold gates, the number of layers and the maximum of the absolute values of the weights over all the threshold gates of the circuit. We will also consider the fan–in of gates and circuits. The fan–in of a gate is the number of its input lines, while the fan–in of a circuit is defined as the maximum fan–in of the gates contained into the circuit. From now on we will refer to (n, m, 2)–functions with unspecified values of n and m as multi–output Boolean functions. Of course a Boolean function can be considered as a special case of multi–output Boolean function. When we will state a property for a multi–output Boolean function, it will be understood that each of the m Boolean functions that compose it has the property. We are particularly interested in computing multi–output Boolean functions using threshold circuits of constant depth, polynomial size, polynomial weight and unbounded fan–in, so we give the following definition. Definition 2. Using the established notation given in [19], for any integer d ≥ 1 d the class of Boolean functions computed by depth-d, polynomial we denote by LT size, polynomial–weight and unbounded fan–in threshold circuits. Small–depth polynomial–size threshold circuits with polynomial weights have proven to be a very powerful model of computation: in fact, it has been shown that several arithmetic and Boolean operations of practical interest have surprisingly efficient realizations by threshold circuits of depth smaller than 4 [20,18,22,2]. A Boolean function f (x1 , x2 , . . . , xn ) is symmetric if its value is invariant with respect to permutations over the input variables; it is not difficult to see that this property holds n if and only if the value of f depends uniquely on the value of the quantity i=1 xi . A proposition in [9] states that every sym 2 . From this proposition it follows immediately metric function is in the class LT the well known fact that the Parity function: Parity(x1 , x2 , . . . , xn ) = x1 ⊕ x2 ⊕ . . . ⊕ xn
On the Computational Complexity of Conservative Computing
107
1 and LT 2 , since it is symmetric but not linearly sepaseparates the classes LT rable. Again in [9], Hajnal, Maass, Pudl´ ak, Szegedy and Tur´ an have given the first proof that the Inner Product mod 2 function (ip): ip(x1 , x2 , . . . , xn , y1 , y2 , . . . , yn ) = (x1 ∧ y1 ) ⊕ (x2 ∧ y2 ) ⊕ . . . ⊕ (xn ∧ yn ) 2 and LT 3 . Hence: separates the classes LT 2 ⊂ LT 3
1 ⊂ LT LT Unfortunately, no one knows whether the subsequent classes in the hierarchy are separated or not. Indeed, many simple questions about the capabilities of the corresponding circuits remain unanswered: for example, the best we can do for depth-3 threshold circuits is to show some strong lower bounds for some restricted types of circuits, such as bounded fan-in circuits [10] and circuits with and gates at the bottom [15]. To the best knowledge of the authors, no superpolynomial lower bound is known for general threshold circuits with a depth greater than or equal to 3; indeed, in principle it is even possible (although not very plausible) that depth-3 threshold circuits can compute every Boolean function in NP. In spite of this, it is generally believed that constant–depth threshold circuits are not powerful enough to compute all functions in the class NC1 , that is those computable by logarithmic–depth and/or/not circuits with fan–in equal to 2. We can now introduce Fredkin circuits. A Fredkin gate is a (3, 3, 2)–gate whose input/output map FG : {0, 1}3 → {0, 1}3 associates any input triple (x1 , x2 , x3 ) with its corresponding output triple (y1 , y2 , y3 ) as follows: y1 = x1 y2 = (¬x1 ∧ x2 ) ∨ (x1 ∧ x3 ) y3 = (x1 ∧ x2 ) ∨ (¬x1 ∧ x3 )
(5)
The Fredkin gate is functionally complete for Boolean logic: in fact, by fixing x3 = 0 we get y3 = x1 ∧ x2 , whereas by fixing x2 = 1 and x3 = 0 we get y2 = ¬x1 . A useful point of view is that the Fredkin gate behaves as a conditional switch: that is, FG(1, x2 , x3 ) = (1, x3 , x2 ) and FG(0, x2 , x3 ) = (0, x2 , x3 ) for every x2 , x3 ∈ {0, 1}. In other words, x1 can be considered as a control input whose value determines whether the input values x2 and x3 have to be exchanged or not. Here we just mention the fact that every permutation can be written in a unique way (up to the order of factors) as a composition of exchanges, that is, cycles of length two. This means not only that the Fredkin gate can be used to build an appropriate circuit to perform any given conservative computation (and thus it is universal also in this sense with respect to conservative computations), but also that it is the most elementary conceivable operation that can be used to describe conservative computations. A Fredkin circuit is a circuit composed by Fredkin gates. As with threshold circuits, the size and the depth of a Fredkin circuit are defined as the number of gates and the number of layers in the circuit, respectively; the notion of weight
108
Giancarlo Mauri and Alberto Leporati
has no meaning for Fredkin circuits. Also in this case we assume to be able to feed a gate both with variables and with their negated counterparts, and to have two input wires which supply the constant values 0 and 1. Definition 3. For any integer d ≥ 1, let us denote by F Cd the class of multi– output Boolean functions which can be computed by depth-d polynomial–size Fredkin circuits. As a first result, we show that the function FG cannot be computed by a depth-1 threshold circuit. 1. Proposition 1. FG ∈ LT Proof. Let FG2 : {0, 1}3 → {0, 1} be the Boolean function computed by a Fredkin gate on its second output line, y2 . We show that assuming the existence of a threshold gate T that computes FG2 yields to a contradiction. Let w1 , w2 , w3 be the weights associated to input lines x1 , x2 and x3 of T , respectively, and let τ be the threshold value. T computes FG2 if and only if: 1 if w1 x1 + w2 x2 + w3 x3 ≥ τ FG2 (x1 , x2 , x3 ) = 0 otherwise By definition of FG it must hold FG2 (0, 0, 1) = 0 and FG2 (0, 1, 0) = 1, that is w3 < τ and w2 ≥ τ , from which w3 < w2 . Similarly, it should be FG2 (1, 0, 1) = 1 and FG2 (1, 1, 0) = 0, that is w1 + w3 ≥ τ and w1 + w2 < τ . From these inequalities immediately follows w2 < w3 , which contradicts what we have previously obtained.
2 , since every On the other hand, by (5) it is immediately seen that FG ∈ LT and, or and not gate can be realized by an appropriate threshold gate. By substituting every Fredkin gate in a Fredkin circuit with an equivalent depth-2 d are closed under Boolean threshold circuit, and recalling that the classes LT negation, we obtain F Cd ⊆ LT 2d for every integer d ≥ 1. However, we are indeed 2 for every integer d ≥ 1. Let able to show a stronger result: that is, F Cd ⊆ LT us first give the following two definitions. Definition 4. A set G of Boolean functions is said to be closed under constant– degree functions if, for every fixed integer c ≥ 1, every choice of functions g1 , g2 , . . . , gc from G and every c–ary Boolean function h, the Boolean function f (x) = h g1 (x), g2 (x), . . . , gc (x) is in G. Definition 5. Let G be a set of n–ary Boolean functions. A function f : {0, 1}n → IR is G–approximable if for any k > 0 there exists a polynomial number of functions g1 , g2 , . . . , gp(n) ∈ G such that: p(n)
f (x) =
j=1
aj gj (x) ± O(n−k )
∀ x ∈ {0, 1}n
On the Computational Complexity of Conservative Computing
where a1 , a2 , . . . , ap(n) are real numbers such that
max 1≤j≤p(n)
109
|aj | is polynomially
bounded. For our purposes we obtain the most interesting case of G–approximability d ; in this case, instead of LT d –approximability we when we choose G = LT will simply call it d–approximability. Since threshold circuits can only compute (multi–output) Boolean functions, let us consider the following important subclass of d–approximable functions. Definition 6. For any integer d ≥ 1, let us denote by AP Pd the class of all Boolean d–approximable functions. d form the following In [18] it is easily proved that the classes AP Pd and LT intertwined hierarchy: d ⊆ AP Pd ⊆ LT d+1 LT
∀d ≥ 1
Moreover, the following theorem is also proved. Theorem 2 ([18], page 52). For every integer d ≥ 1, the class AP Pd is closed under constant–degree functions. We are now ready to state our result. Let f ∈ F Cd , for some fixed integer d ≥ 1. By definition, there exists a depth-d polynomial–size Fredkin circuit F that computes f . First of all we build an and/or/not circuit that computes f , by replacing each Fredkin gate in F with an equivalent and/or/not circuit, as indicated in (5). Then, using de Morgan laws we move all negations to the first layer of the circuit, and we eliminate them by picking input values or their negations. As a result we obtain a depth-2d and/or circuit, that we denote by C. Since every gate of the first layer of C can be replaced by an equivalent threshold gate, such layer computes a multi–output Boolean function whose components 1 , and hence in AP P1 . The fact that AP P1 is closed under constant– are in LT degree functions implies that the multi–output Boolean function computed by the first two layers of C is in AP P1 too, and so on. This proves that the multi– output Boolean function computed by the first 2d layers of C, that is f , is 2 , f can be computed by a depth-2 polynomial– in AP P1 . Since AP P1 ⊆ LT size polynomial–weight threshold circuit. We have thus proved the following proposition. 2. Proposition 2. For every integer d ≥ 1, F Cd ⊆ LT Actually this proposition can also be proved in a more direct way, without involving the class AP P1 . Let us consider the depth-2d and/or circuit C defined above. Note that such circuit has the maximum number of gates when each output is computed by a subcircuit which is a complete binary tree. This means that the value of each output line of C depends upon at most 22d variables, which 2d is a constant number. Such variables may assume 22 different configurations, which is also a constant number. Hence if we write f in Disjunctive Normal Form (DNF), as a disjunction of all configurations for which f = 1, we obtain a
110
Giancarlo Mauri and Alberto Leporati
depth-2 constant–size and/or circuit. By replacing each gate of this circuit by 2 . Notice that if we allow an equivalent threshold gate we conclude that f ∈ LT the use of only input variables x1 , x2 , . . . , xn instead of both input variables and their negations, then by writing f in DNF we obtain a depth-3 and/or/not circuit whose negations are all located in the first layer. However it is not difficult to see that also in this case we can replace each and and each or gate by an appropriate threshold gate, and embed all negations in the first layer of threshold gates, thus obtaining a depth-2 constant–size threshold circuit. A different approach to the study of the computational capability of Fredkin circuits is obtained by considering the sets of permutations they generate. If we do not allow the duplication of a signal by splitting the corresponding wire (equivalently, if we impose that each input and output value of the gates can be used just once) then it is easily seen that in a Fredkin circuit the number of input and output lines are the same, and that the circuit is conservative with respect to the notion given in [6]. In particular, the circuit applies a permutation to every possible input pattern. The applied permutation depends upon both the topology of the circuit and the input pattern. In the literature, this kind of permutations are usually named data dependent permutations. Hence if we fix a Fredkin circuit we can associate a set of permutations to the set of all possible input patterns. Here we advocate the use of conditional permutations to study the set of permutations realized by Fredkin circuits. Generally, a conditional permutation can be written as: f (x1 , x2 , . . . , xn ) · π(x1 , x2 , . . . , xn )
(6)
where f : {0, 1}n → {0, 1} is a Boolean function, and π ∈ Sn is a permutation. If f = 1 then (6) behaves as π, otherwise it behaves as the identity. As an example, the Fredkin gate (5) can be expressed as x1 · (x2 x3 ). Clearly every Fredkin circuit can be expressed as a composition of conditional exchanges. Hence the set of permutations realized by a Fredkin circuit is obtained by considering all possible truth assignments to the Boolean formulas which express the conditions in conditional exchanges. Future work will be devoted to study the properties of the sets of permutations generated by Fredkin circuits, as well as the relationships between such properties and the complexity of the corresponding Boolean functions computed by the same circuits.
7
Conclusions and Directions for Future Work
In this paper we have proposed the first steps towards a theory of conservative computations, where the amount of energy associated to the data manipulated during the computations is preserved. We have shown that conservative computations induce ConsComp, a new NP–complete decision problem, and Min Storage, its naturally associated optimization problem. Since it is commonly believed that no polynomial time algorithm exists that always gives the optimal solution to any NP–hard optimization
On the Computational Complexity of Conservative Computing
111
problem, we have presented some polynomial time heuristics that give approximate solutions to the instances of Min Storage. A study of their behavior, performed through some computer experiments, suggests that Min Storage seems to be easy to solve on uniformly randomly chosen instances. In particular one of the proposed heuristics, namely Best Fit, seems to perform very well when the initial energy stored into the gate is zero. Interestingly, the same heuristic is no more the best when the initial energy is positive. Hence a first open problem is to try to modify Best Fit in order to perform better with a positive initial energy. A more important open problem is to devise an approximation algorithm for Min Storage. Of course perfect conservation of energy is possible only in theory. Hence, a further possibility for future work could be the relaxation of the conservativeness constraint (2), by allowing that the amount of energy dissipated during a computation step be no greater than a fixed value. Analogously, we can suppose that if we try to store an amount of energy that exceeds the capacity of the gate then the energy which cannot be stored is dissipated. In such a case it should be interesting to study trade-offs between the amount of energy dissipated and the hardness of the corresponding modified ConsComp and Min Storage problems. In this paper we have also started to study the complexity of Boolean functions computed by Fredkin circuits. However, only constant–depth circuits have been here considered, and only very basic results have been exposed. We believe that logarithmic–depth Fredkin circuits should be far more interesting from this point of view. Notice that the proof of Proposition 2 cannot be replicated for 2 , contrary to the fact this kind of circuits, otherwise we could infer NC1 ⊆ LT 1 that the Inner Product mod 2 function is in NC \ LT 2 . Besides the study of permutations generated by Fredkin circuits, it should be interesting to study the computational complexity of many–valued extensions of Fredkin circuits, such as circuits composed by the gates defined in [5]. Finally, it remains to study how to theoretically model circuits whose gates are equipped with an internal storage unit. It is our opinion that it seems appropriate to consider this kind of gates as finite state automata, by viewing the energy levels of the storage unit as their states.
References 1. G. Ausiello, P. Crescenzi, G. Gambosi, V. Kann, A. Marchetti–Spaccamela, M. Protasi. Complexity and Approximation. Combinatorial Optimization Problems and Their Approximability Properties. Springer–Verlag, 1999. 2. R. Beigel, J. Tarui. On ACC. In Proceedings of the 32nd IEEE Symposium on Foundations of Computer Science, 1991, pp. 783–792. 3. C. H. Bennett. Logical reversibility of computation. IBM Journal of Research and Development, 17, November 1973, pp. 525–532. 4. G. Cattaneo, G. Della Vedova, A. Leporati, R. Leporini. Towards a Theory of Conservative Computing. Submitted for publication, 2002. e-print available at: http://arxiv.org/quant-ph/abs/0211085
112
Giancarlo Mauri and Alberto Leporati
5. G. Cattaneo, A. Leporati, R. Leporini. Fredkin Gates for Finite–valued Reversible and Conservative Logics. Journal of Physics A: Mathematical and General, 35, 2002, pp. 9755–9785. 6. E. Fredkin, T. Toffoli. Conservative Logic. International Journal of Theoretical Physics, 21, Nos. 3/4, 1982, pp. 219–253. 7. M. R. Garey, D. S. Johnson. Computers and Intractability. A Guide to the Theory on NP–Completeness. W. H. Freeman and Company, 1979. 8. M. Goldmann, J. H˚ astad, A. Razborov. Majority Gates vs. general weighted Threshold Gates. Computational Complexity, Vol. 2, No. 4, 1992, pp. 277–300. 9. A. Hajnal, W. Maass, P. Pudl´ ak, M. Szegedy, G. Tur´ an. Threshold Circuits of Bounded Depth. Journal of Computer and System Sciences, Vol. 46, No. 2, 1993, pp. 129–154. 10. J. H˚ astad, M. Goldmann. On the power of small–depth threshold circuits. Computational Complexity I, Vol. 2, 1991, pp. 113–129. 11. R. Landauer. Irreversibility and heat generation in the computing process. IBM Journal of Research and Development, 3, 1961, pp. 183–191. 12. A. Leporati, G. Della Vedova, G. Mauri. An Experimental Study of some Heuristics for Min Storage. Submitted for publication, 2003. 13. S. Muroga. Threshold Logic and its Applications. Wiley–Interscience, 1971. 14. C. A. Petri. Gr¨ undsatzliches zur Beschreibung diskreter Prozesse. In Proceedings of the 3 rd Colloquium u ¨ber Automatentheorie (Hannover, 1965), Birkh¨ auser Verlag, Basel, 1967, pp. 121–140. English translation: Fundamentals of the Representation of Discrete Processes, ISF Report 82.04, 1982. 15. A. Razborov, A. Widgerson. nΩ(log n) lower bounds on the size of depth–3 threshold circuits with AND gates at the bottom. Information Processing Letters, Vol. 45, No. 6, 1993, pp. 303–307. 16. N. Rescher. Many–valued logics. McGraw–Hill, 1969. 17. J. B. Rosser, A. R. Turquette. Many–valued logics. North Holland, 1952. 18. V. P. Roychowdhury, K. Y. Siu, A. Orlitsky. Theoretical Advances in Neural Computation and Learning. Kluwer Academic, 1994. 19. K. Y. Siu, J. Bruck. On the Power of Threshold Circuits with Small Weights. SIAM Journal on Discrete Mathematics, Vol. 4, No. 3, 1991, pp. 423–435. 20. K. Y. Siu, V. P. Roychowdhury. On Optimal Depth Threshold Circuits for Multiplication and Related Problems. SIAM Journal on Discrete Mathematics, Vol. 7, No. 2, 1994, pp. 284–292. 21. H. Vollmer. Introduction to Circuit Complexity: A Uniform Approach. Springer– Verlag, 1999. 22. A. C. Yao. On ACC and Threshold Circuits. In Proceedings of the 31st IEEE Symposium on Foundations of Computer Science, 1990, pp. 619–628.
Constructing Infinite Graphs with a Decidable MSO-Theory Wolfgang Thomas RWTH Aachen, Lehrstuhl f¨ ur Informatik VII D-52056 Aachen, Germany [email protected]
Abstract. This introductory paper reports on recent progress in the search for classes of infinite graphs where interesting model-checking problems are decidable. We consider properties expressible in monadic second-order logic (MSO-logic), a formalism which encompasses standard temporal logics and the modal µ-calculus. We discuss a class of infinite graphs proposed by D. Caucal (in MFCS 2002) which can be generated from the infinite binary tree by applying the two processes of MSO-interpretation and of unfolding. The main purpose of the paper is to give a feeling for the rich landscape of infinite structures in this class and to point to some questions which deserve further study.
1
Introduction
A fundamental decidability result which appears in hundreds of applications in theoretical computer science is Rabin’s Tree Theorem [23]. The theorem says that the monadic second-order theory (MSO-theory) of the infinite binary tree is decidable. The system of monadic second-order logic arises from first-order logic by adjunction of variables for sets (of tree nodes) and quantifiers ranging over sets. In this language one can express many interesting properties, among them reachability conditions (existence of finite paths between elements) and recurrence conditions (existence of infinite paths with infinitely many points of a given property). Already in Rabin’s paper [23] the main theorem is used to infer a great number of further decidability results. The technique for the transfer of decidability is the method of interpretation: It is based on the idea of describing a structure A, using MSO-formulas, within the structure T2 of the binary tree. The decidability of the MSO-theory of A can then be deduced from the fact that the MSO-theory of T2 is decidable. Rabin considered mainly structures of interest to mathematical logic. For example, he showed that the monadic second-order theory of the rational number ordering (Q, <) is decidable. In theoretical computer science, the interest shifted to models like transition systems (for example, Kripke structures) and their unfoldings in the form of labelled trees. Also the terminology has changed a little: Rather than speaking of a structure with a decidable MSO-theory one says that the model-checking problem for this structure is decidable with respect to MSO-properties. Thus the search for infinite B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 113–124, 2003. c Springer-Verlag Berlin Heidelberg 2003
114
Wolfgang Thomas
structures of this kind is tied to one of the fundamental questions in verification, namely to determine the range of structures where the model-checking problem (in our case with respect to MSO-logic) can be solved by automatic procedures. In this research, the first key result is the Muller-Schupp Theorem [22], stating that the transition graph of a pushdown automaton has a decidable MSO-theory. In [4], Caucal showed that the same holds for the more extended class of prefix-recognizable graphs. In both cases, the proof works by MSOinterpretations in the binary tree T2 . Proof sketches are provided in Section 2 below. Nearly 20 years ago, in MFCS 1984, A. Semenov [24] presented a decidability result of Muchnik which opened a new track for extending Rabin’s Tree Theorem. Muchnik’s Theorem says that for a structure whose MSO-theory is decidable also its “tree iteration” has a decidable MSO-theory. This provides another powerful method for the transfer of decidability results. When referring to graphs as structures, a variant of tree iteration is of central importance: the unfolding of a graph as a tree. A short discussion is given in Section 3. Again in MFCS, one year ago, D. Caucal proposed in [5] to use both transfer techniques (of MSO-interpretation and of unfolding) together, starting with the finite trees and graphs. (Equivalently one can start with the infinite binary tree.) It turns out that by applying MSO-interpretations and unfoldings in alternation, a very rich hierarchy of models can be generated, each of them having a decidable MSO-theory. The main purpose of this paper is to provide (in Section 4 below) an intuitive introduction to this Caucal hierarchy. We explain that it provides a comprehensive framework for decidability results on MSO-theories. In this paper, we pursue a purely model-theoretic view. One should mention that at least two other views are also possible but not taken up here in any depth: First, the tree structures which arise as unfoldings in the hierarchy have been studied already decades ago in the investigation of higher-order recursion schemes (cf. [12]); recent results in the field are due to Knapik, Niwi´ nski, and Urzyczyn [17,18]. In connection with the evaluation of these recursion schemes, the computational model of “iterated pushdown automaton” was introduced. The (global) transition graphs of iterated pushdown automata coincide with the graphs of the Caucal hierarchy (see [5,6]). Thus, the graphs of the Caucal hierarchy constitute also an interesting chapter of “infinite automata theory” ([25]), where infinite graphs are viewed and used as acceptors of non-regular languages.
2 2.1
Interpretations General Framework
We consider relational structures A = (A, R1A , . . . , RkA ), where A is at most countable. The RiA are relations of possibly different arities, say RiA of arity ni . The corresponding signature is given by the relation symbols R1 , . . . , Rk . The first-order language over this signature is built up from variables x, y, . . ., atomic formulas x = y and Ri (x1 , . . . , xni ), where x, y, x1 , . . . are first-order variables,
Constructing Infinite Graphs with a Decidable MSO-Theory
115
using the standard propositional connectives ¬, ∧, ∨, →, ↔ and the quantifiers ∃, ∀. The corresponding monadic second-order language (MSO-language) is obtained by adjoining variables X, Y, . . . for sets of elements (of the universe of a structure) and atomic formulas X(y), meaning that the element y is in the set X. We use the standard notations; e.g. A |= ϕ[a] indicates that the structure A satisfies the formula ϕ(x) with the element a as interpretation of x. Given a formula ϕ(x1 , . . . , xn ), the relation defined by it in A is ϕA = {(a1 , . . . , an ) ∈ An | A |= ϕ[a1 , . . . , an ]} The structures considered in this paper are edge- and vertex-labelled graphs of the form G = (V, (Ei )i∈I , (Pj )j∈J ); here V is the set of vertices, I the alphabet of edge labels, Ei ⊆ V × V is the set of i-labelled edges, and Pj ⊆ V the set of vertices labelled j. We set E = i∈I Ei . The binary tree is the structure T2 = ({0, 1}∗ , S0 , S1 ) where Si = {(w, wi) | n w ∈ {0, 1}∗ }. Analogously Tn = ({0, . . . , n − 1}∗ , S0n , . . . , Sn−1 ) is the n-ary infinite tree. Theorem 1 (Tree Theorem, [23]). The MSO-theory of T2 is decidable. Let us illustrate the idea of MSO-interpretation by showing that the result holds also for the structures Tn for n > 2. As typical example consider T3 = ({0, 1, 2}∗ , S03 , S13 , S23 ). We obtain a copy of T3 in T2 by considering only the T2 -vertices in the set T = (10 + 110 + 1110)∗ . A word in this set has the form 1i1 0 . . . 1im 0 with i1 , . . . , im ∈ {1, 2, 3}; and we take it as a representation of the element (i1 − 1) . . . (im − 1) of T3 . The following MSO-formula ϕ(x) (written in abbreviated suggestive form) defines the set T in T2 : ∀Y [Y (x) ∧ ∀y((Y (y10) ∨ Y (y110) ∨ Y (y1110)) → Y (y)) → Y ()] It says that x is in the closure of under 10-, 110-, and 1110-successors. The relation {(w, w10)|w ∈ {0, 1}∗ } is defined by the following formula: ψ0 (x, y) := ∃z(S1 (x, z) ∧ S0 (z, y)) With the analogous formulas ψ1 , ψ2 for the other successor relations, we see that the structure with universe ϕT2 and the relations ψiT2 restricted to ϕT2 is isomorphic to T3 . In general, an MSO-interpretation of a structure A in a structure B is given by a “domain formula” ϕ(x) and, for each relation RA of A, say of arity m, an MSO-formula ψ(x1 , . . . , xm ) such that A with the relations RA is isomorphic to the structure with universe ϕB and the relations ψ B restricted to ϕB . Then for an MSO-sentence χ (in the signature of A) one can construct a sentence χ (in the signature of B) such that A |= χ iff B |= χ . In order to obtain χ from χ, one has to replace every atomic formula R(x1 , . . . , xm ) by the corresponding formula ψ(x1 , . . . , xm ) and to relativize all quantifications to ϕ(x) (for details see e.g. [13]). As a consequence, we note the following:
116
Wolfgang Thomas
Proposition 1. If A is MSO-interpretable in B and the MSO-theory of B is decidable, then so is the MSO-theory of A. In the literature a more general type of interpretation is also used, called MSO-transduction (see [8]), where the universe B is represented in a k-fold copy of A rather than in A itself. For the results treated below it suffices to use the simple case mentioned above. 2.2
Pushdown Graphs and Prefix Recognizable Graphs
A graph G = (V, (Ea )a∈A ) is called pushdown graph (over the label alphabet A) if it is the transition graph of the reachable global states of an -free pushdown automaton. Here a pushdown automaton is of the form P = (Q, A, Γ, q0 , Z0 , ∆), where Q is the finite set of control states, A the input alphabet, Γ the stack alphabet, q0 the initial control state, Z0 ∈ Γ the initial stack symbol, and ∆ ⊆ Q × A × Γ × Γ ∗ × Q the transition relation. A global state (configuration) of the automaton is given by a control state and a stack content, i.e., by a word from QΓ ∗ . The graph G = (V, (Ea )a∈A ) is now specified as follows: – V is the set of configurations from QΓ ∗ which are reachable (via finitely many applications of transitions of ∆) from the initial global state q0 Z0 . – Ea is the set of all pairs (pγw, qvw) from V 2 for which there is a transition (p, a, γ, v, q) in ∆. A more general class of graphs, which includes the case of vertices of infinite degree, has been introduced by Caucal [4]. These graphs are introduced in terms of prefix-rewriting systems in which “control states” (as they occur in pushdown automata) are no longer used and where a word on the top of the stack (rather than a single letter) may be rewritten. Thus, a rewriting step can be specified by a triple (u1 , a, u2 ), describing a transition from a word u1 w via letter a to the word u2 w. The feature of infinite degree is introduced by allowing generalized rewriting rules of the form U1 →a U2 with regular sets U1 , U2 of words. Such a rule leads to the (in general infinite) set of rewrite triples (u1 , a, u2 ) with u1 ∈ U1 and u2 ∈ U2 . A graph G = (V, (Ea )a∈A ) is called prefix-recognizable if for some finite system S of such generalized prefix rewriting rules U1 →a U2 over an alphabet Γ , we have – V ⊆ Γ ∗ is a regular set, – Ea consists of the pairs (u1 w, u2 w) where u1 ∈ U1 , u2 ∈ U2 for some rule U1 →a U2 from S, and w ∈ Γ ∗ . Theorem 2 (Muller-Schupp [22], Caucal [4]). The MSO-theory of a pushdown graph is decidable; so is the MSO-theory of a prefix-recognizable graph. First we present the proof for pushdown graphs. Let G = (V, (Ea )a∈A ) be generated by the pushdown automaton P = (Q, A, Γ, q0 , Z0 , ∆). Each configuration is a word over the alphabet Q ∪ Γ . Taking m = |Q| + |Γ | we can represent
Constructing Infinite Graphs with a Decidable MSO-Theory
117
a configuration by a node of the tree Tm . For technical convenience we write the configurations in reverse order, i.e. as words in Γ + Q. We give an MSOinterpretation of G in Tm . The formula ψa (x, y) which defines Ea in Tm has to say the following: “there is a stack content w such that x = (pγw)R and y = (qvw)R for a rule (p, a, γ, v, q) of ∆.” This is easily formalized (even with a first-order formula), using the successor relations in Tm to capture the prolongation of w by γ, p, q and by the letters of v. Now it is easy to write down also the desired domain formula ϕ(x) which defines the configurations reachable from q0 Z0 . We refer to (q0 Z0 )R as definable element of the tree Tm and to the union E of the relations Ea , defined by a∈A ψa (x, y). The formula ϕ(x) says that “each set X which contains (q0 Z0 )R and is closed under taking Esuccessors also contains x.” For prefix-recognizable graphs, a slight generalization of the previous proof is needed. Let G be a prefix-recognizable graph with a regular set V ⊆ Γ ∗ of vertices. We describe an MSO-interpretation of G in the tree Tm where m is the size of Γ . We start with a formula ψ(x, y) which defines the edge relation induced by a single rule U1 →a U2 with regular U1 , U2 . The formula expresses for x, y that there is a word (= tree node) w such that x = u1 w, y = u2 w with u1 ∈ U1 , u2 ∈ U2 . If A1 , A2 are finite automata recognizing U1 , U2 respectively, this can be phrased as follows: “there is a node w such that A1 accepts the path segment from x to w and A2 the path segment from y to w.” Acceptance of a path segment is expressed by requiring a corresponding automaton run. Its existence can be coded by a tuple of subsets over the considered path segment (for an automaton with 2k states a k-tuple of sets suffices). The disjunction of such formulas taken for all a-rules gives the desired formula defining the edge relation Ea . The domain formula ϕ(x) is provided in the same way, now referring to the path segment from node x back to the root. Using the interpretation of Tm in T2 , the decidability claims follow from Rabin’s Tree Theorem. It is interesting to note that the prefix-recognizable graphs in fact coincide with the graphs which are MSO-interpretable in T2 ([2]).
3
Unfoldings
Let G = (V, (Ei )i∈I , (Pj )j∈J ) be a graph and v0 a designated vertex of V . The unfolding of G from v0 is a structure of the form t(G, v0 ) = (V , (Ei )i∈I , (Pj )j∈J ). Its domain V is the set of all paths from v0 ; here a path from v0 is a sequence v0 i1 v1 . . . ik vk where for h ≤ k we have (vh−1 , vh ) ∈ Eih . A pair (p, q) of paths is in Ei iff q is an extension of p by an edge from Ei , and we have p ∈ Pj iff the last element of p is in Pj .
118
Wolfgang Thomas
As an example consider the singleton graph G0 with vertex v0 and two edge relations E0 , E1 , both of which contain the edge (v0 , v0 ). The unfolding of G0 is (isomorphic to) the binary tree T2 . This example illustrates the power of the unfolding operation: Starting from the trivial singleton graph (which of course has a decidable MSO-theory), we obtain the binary tree T2 where decidability of the MSO-theory is a deep result. The unfolding operation takes sequences of edges (as elements of the unfolded structure). A related construction, called tree iteration, refers to sequences of elements instead. It has the advantage that it covers arbitrary relational structures without extra conventions. To spare notation we define it only over graphs, as considered above. The tree iteration of a graph G = (V, (Ei )i∈I , (Pj )j∈J ) is the structure G∗ = ∗ (V , S, C, (Ei∗ )i∈I , (Pj∗ )j∈J ) where S = {(w, wv) | w ∈ V ∗ , v ∈ V } (“successor”), C = {(wv, wvv) | w ∈ V ∗ , v ∈ V } (“clone relation”), Ei∗ = {(wu, wv) | w ∈ V ∗ , (u, v) ∈ Ei }, and Pj∗ = {wv | w ∈ V ∗ , v ∈ Pj }. From the singleton graph mentioned above one obtains by tree iteration a copy of the natural number ordering rather than of the binary tree. However, the structure T2 can be generated by tree iteration from the two element structure ({0, 1}, P0 , P1 ) using the two predicates P0 = {0} and P1 = {1}. The unfolding t(G, v0 ) can be obtained by a monadic transduction from G∗ , more precisely by an MSO-interpretation in a twofold copy of G. Both operations preserve the decidability of the MSO-theory. Again we state this only for graphs: Theorem 3 (Muchnik, Walukiewicz, Courcelle (cf. [24]), [26], [11])). If a graph has a decidable MSO-theory, then its unfolding from a definable vertex and its tree iteration also have decidable MSO-theories. Extending earlier work of Shelah and Stupp, the theorem was shown for tree iterations by A. Muchnik (see [24]). A full proof is given by Walukiewicz in [26]; for a very readable account we recommend [1]. For the unfolding operation see the papers [9,11] by Courcelle and Walukiewicz. As a small application of the theorem we show a result (of which we do not know a reference) on structures (N, Succ, P ), the successor structure of the natural numbers with an extra unary predicate P . Consider the binary tree T2 expanded by the predicate P = {w ∈ {0, 1}∗ | |w| ∈ P }, the “level predicate” for P . Now the MSO-theory of (N, Succ, P ) is decidable iff the MSO-theory of (N, Succ0 , Succ1 , P ) is decidable where Succ0 = Succ1 = Succ. The unfolding of the latter structure is the binary tree expanded by the level predicate for P . Hence we obtain: Proposition 2. If the MSO-theory of (N, Succ, P ) is decidable, then so is the MSO-theory of the binary tree expanded by the level predicate for P .
4
Caucal’s Hierarchy
In [5], Caucal introduced the following hierarchy (Gn ) of graphs, together with a hierarchy (Tn ) of trees:
Constructing Infinite Graphs with a Decidable MSO-Theory
119
– T0 = the class of finite trees – Gn = the class of graphs which are MSO-interpretable in a tree of Tn – Tn+1 = the class of unfoldings of graphs in Gn By the results of the preceding sections (and the fact that a finite structure has a decidable MSO-theory), each structure in the Caucal hierarchy has a decidable MSO-theory. By a hierarchy result of Damm [12] on higher-order recursion schemes, the hierarchy is strictly increasing. In Caucal’s paper [5], a different formalism of interpretation (via “inverse rational substitutions”) is used instead of MSO-interpretations. We work with the latter to keep the presentation more uniform; the equivalence between the two approaches has been established by Carayol and W¨ ohrle [10]. Let us take a look at some structures which occur in this hierarchy. It is clear that G0 is the class of finite graphs, while T1 contains the so-called regular trees (alternatively defined as the infinite trees which have only finitely many non-isomorphic subtrees). Figure 1 (upper half) shows a finite graph and its unfolding as a regular tree: a
•
a
c
b
•
a
•
•
• •
a
a
•
d
c
b
•
a
•
d
c
e
a
•
d
c
e
c
•
•
•
a
•
d
•
a
···
c
•
c
e
a
•
c
•
•
a
•
c
•
•
a
•
c
b
•
a
•
•
•
a
···
•
d
···
···
c
e
e
Fig. 1. A graph, its unfolding, and a pushdown graph
By an MSO-interpretation we can obtain the pushdown graph of Figure 1 in the class G1 ; the domain formula and the formulas defining Ea , Eb , Ec are trivial, while ψd (x, y) = ψe (x, y) = ∃z∃z (Ea (z, z ) ∧ Ec (z, y) ∧ Ec (z , x)) Let us apply the unfolding operation again, from the only vertex without incoming edges. We obtain the “algebraic tree” of Figure 2, belonging to T2 (where for the moment one should ignore the dashed line). As a next step, let us apply an MSO-interpretation to this tree which will produce a graph (V, E, P ) in the class G2 (where E is the edge relation and P a unary predicate). Referring to Figure 2, V is the set of vertices which are located along the dashed line, E contains the pairs which are successive vertices along the dashed line, and P contains the special vertices drawn as non-filled circles. This structure is isomorphic to the structure (N, Succ, P2 ) with the successor relation Succ and predicate P2 containing the powers of 2.
120
Wolfgang Thomas •
a
•
a
c
b
•
a
• c
◦ ◦
• •
• e
• d
◦
d
• e
•
···
c
d
e
a
•
c
• d
a
•
d
•
e
• e
e
d
•
• d
◦
• •
e
•
d
•
e
•
···
Fig. 2. Unfolding of the pushdown graph of Figure 1
To prepare a corresponding MSO-interpretation, we use formulas such as Ed∗ (x, y) which expresses “all sets which contain x and are closed under taking Ed -successors contain y, and y has no Ed -successor” As domain formula we use ϕ(x) = ∃z(Eb (z, x) ∨ ∃y(Ec (z, y) ∧ Ed∗ (y, x))). The required edge relation E is defined by ψ(x, y) = ∃z∃z (ψ1 (x, y) ∨ ψ2 (x, y) ∨ ψ3 (x, y)) where – ψ1 (x, y) = Ea (z, z ) ∧ Eb (z, x) ∧ Ec (z , y) – ψ2 (x, y) = Ea (z, z ) ∧ Ece∗ (z, x) ∧ Ecd∗ (z , y) – ψ3 (x, y) = Ede∗ (z, x) ∧ Eed∗ (z, y) Finally we define P by the formula χ(x) = ∃z∃z (Ec (z, z ) ∧ Ed∗ (z , x)). We infer that the MSO-theory of (N, Succ, P2 ) is decidable, a result first proved by Elgot and Rabin [14] with a different approach. The idea of [14], later applied to many other expansions of the successor structure by unary predicates, is to transform first a given MSO-sentence ϕ to an equivalent Bchi automaton Bϕ , so that (N, Succ, P2 ) |= ϕ iff Bϕ accepts the characteristic 0-1-sequence αP2 (with αP2 (i) = 1 iff i ∈ P2 ). By contracting the 0-segments between the letters 1, one can modify αP2 to an ultimately periodic sequence β such that Bϕ accepts αP iff Bϕ accepts β. Whether Bϕ accepts such a “regular model” β is decidable. Note that this reduction to a regular model depends on the sentence ϕ under consideration. The generation of (N, Succ, P2 ) as a model in G2 provides a uniform decidability proof. In [7], the contraction method was adapted to cover all morphic predicates P (coded by morphic 0-1-words). Fratani and S´enizergues [15] have shown that the models (N, Succ, P ) for morphic P also occur in the Caucal hierarchy. In the
Constructing Infinite Graphs with a Decidable MSO-Theory
121
present paper we discuss another structure treated already in [14]: the structure (N, Succ, Fac) where Fac is the set of factorial numbers. We start from a simpler pushdown graph than the one used above and consider its unfolding, which is the comb structure indicated by the thick arrows of the lower part of the figure. •
a
•
c
b
•
a
•
c
b
• b
a
•
c
b
• b
•
•
b
c
···
•
c
···
• b
• c
•
a
b
•
•
•
•
···
c
•
• c
c
•
• c
• Fig. 3. Preparing for the factorial predicate
We number the vertices of the horizontal line by 0, 1, 2 . . . and call the vertices below them to be of “level 0”, “level 1”, “level 2” etc. Now we use the simple MSO-interpretation which takes all tree nodes as domain and introduces for n ≥ 0 a new edge from any vertex of level n + 1 to the first vertex of level n. This introduces the thin lines in Figure 3 as new edges (assumed to point backwards). The reader will be able to write down a defining MSO-formula. Note that the top vertex of each level plays a special role since it is the target of an edge labelled b, while the remaining ones are targets of edges labelled c. Consider the tree obtained from this graph by unfolding. It has subtrees consisting of a single branch off level 0, 2 branches off level 1, 2 · 3 branches off level 2, and generally (n + 1)! branches off level n. Referring to the c-labelled edges these branches are arranged in a natural (and MSO-definable) order. To capture the structure (N, Succ, Fac), we apply an interpretation which (for n ≥ 1) cancels the branches starting at the b-edge target of level n (and leaves only the branches off the targets of c-edges). As a result, (n + 1)! − n! branches off level n remain for n ≥ 1, while there is one branch off level 0. Numbering these remaining branches, the n!-th branch appears as first branch off level n. Note that we traverse this first branch off a given level by disallowing c-edges after the first c-edge. So a global picture like Figure 2 emerges, now representing the factorial predicate. Summing up, we have generated the structure (N, Succ, Fac) as a graph in G3 .
122
Wolfgang Thomas
•
•
•
•
•
0
1
10
11
100
•
• 110
•
• 1000
•
• 1010
•
•
•
1100
Fig. 4. Graph of flip function
So far we have considered expansions of the successor structure of the natural numbers by unary predicates. We now discuss the expansion by an interesting unary function (here identified with its graph, a binary relation). It is the flip function, introduced in [21] in the study of a hierarchical time structure (involving different time granularities). The function flip associates 0 to 0 and for each nonzero n that number which arises from the binary expansion of n by modifying the least significant 1-bit to 0. An illustration of the graph Flip of this function is given in Figure 4. It is easy to see that the structure (N, Succ, Flip) can be obtained from the algebraic tree of Figure 2 by an MSO-interpretation. A Flip-edge will connect vertex u to the last leaf vertex v which is reachable by a d∗ -path from an ancestor of u; if such a path does not exist, an edge to the target of the b-edge (representing number 0) is taken. Other parts of arithmetic can also be captured by suitable structures of the Caucal hierarchy. For example, it can be shown that a semilinear relation (a relation definable in Presburger arithmetic) can be represented by a suitable graph. As the simplest example consider the relation x + y = z. It can be represented in a comb structure like Figure 3 where each vertical branch is infinite and for each edge a corresponding back-edge (with dual label) is introduced. In the unfolding of this infinite comb structure, a vertex on column x and row y allows a path precisely of length x + y via the back-edges to the origin. In this way, graphs can be generated which (as acceptors of languages) are equivalent to the Parikh automata of [19].
5
Outlook
The examples treated above should convince the reader that the Caucal Hierarchy supplies a large reservoir of interesting models where the MSO-theory is decidable. Many problems are open in this field. We mention some of them. 1. Studying and extending the range of the Caucal Hierarchy: We do not know much about the graphs on levels ≥ 3 of the Caucal hierarchy. Which structures of arithmetic (with domain N and some relations over N) occur there? How to decide on which level a given structure occurs? Is it possible to obtain a still richer landscape of models by invoking the operation of tree iteration (possibly for structures with relations of arity > 2, as in [3])? 2. Comparison with other approaches to generate infinite graphs: There are representation results which allow to generate, for n > 0, the graphs of level n from a single tree of level n, respectively as the transition graphs of higher-level
Constructing Infinite Graphs with a Decidable MSO-Theory
123
pushdown automata (see [5,6] and the references mentioned there). There are as yet only partial results which settle the relation between the graphs of Caucal’s hierarchy and the synchronized rational (or “automatic”) graphs, the rational graphs, and the graphs generated by ground term rewriting systems (cf. e.g. [25,20] and the references mentioned there). 3. Complexity of Model-Checking: The reduction of the MSO-model-checking problem for an unfolded graph to the corresponding problem for the original graph involves a non-elementary blow-up in complexity. When using restricted logics one can avoid this. For example, Cachat [6] has shown that µ-calculus model-checking over graphs of level n is possible in n-fold exponential time.
Acknowledgments Many thanks are due to Didier Caucal for numerous fruitful discussions and to my collaborators and students Jan Altenbernd, Thierry Cachat, Christof L¨ oding, and Stefan W¨ ohrle for their help.
References 1. D. Berwanger, A. Blumensath, The monadic theory of tree-like structures, in [16], pp. 285-302. 2. A. Blumensath, Prefix-recognizable graphs and monadic second-order logic, Rep. AIB-06-2001, RWTH Aachen, 2001. 3. A. Blumensath, Axiomatising tree-interpretable structures, in: Proc. 19th STACS, Springer LNCS 2285 (2002), 596-607. 4. D. Caucal, On infinite transition graphs having a decidable monadic theory, in: Proc. 23rd ICALP (F. Meyer auf der Heide, B. Monien, Eds.), Springer LNCS 1099 (1996), 194-205 [Full version in: Theor. Comput. Sci. 290 (2003), 79-115]. 5. D. Caucal, On infinite graphs having a decidable monadic theory, in: Proc. 27th MFCS (K. Diks, W. Rytter, Eds.), Springer LNCS 2420 (2002), 165-176. 6. Th. Cachat, Higher order pushdown automata, the Caucal Hierarchy of graphs and parity games, in Proc. 30th ICALP, 2003, Springer LNCS (to appear). 7. O. Carton, W. Thomas, The monadic theory of morphic infinite words and generalizations, in: Proc. 25th MFCS (M. Nielsen, B. Rovan, Eds.), Springer LNCS 1893 (2000), 275-284. 8. B. Courcelle, Monadic second-order graph transductions: a survey, Theor. Comput. Sci. 126 (1994), 53-75. 9. B. Courcelle, The monadic second-order logic of graphs IX: machines and their behaviours, Theor. Comput. Sci. 151 (1995), 125-162. 10. A. Carayol, S. Whrle, personal communication. 11. B. Courcelle, I. Walukiewicz, Monadic second-order logic, graph coverings and unfoldings of transition systems, Ann. Pure Appl. Logic 92 (1998), 35-62. 12. W. Damm, The IO and OI hierarchies, Theor. Comput. Sci. 20 (1982), 95-208. 13. H.D. Ebbinghaus, J. Flum, W. Thomas, Mathematical Logic, Springer, BerlinHeidelberg-New York 1984. 14. C.C. Elgot, M.O. Rabin, Decidability and undecidability of extensions of second (first) order theory of (generalized) successor, J. Symb. Logic 31 (1966), 169-181.
124
Wolfgang Thomas
15. S. Fratani, G. S´enizergues, personal communication. 16. Automata, Logics, and Infinite Games (E. Grdel, W. Thomas, Th. Wilke, Eds.), Springer LNCS 2500 (2002), Springer-Verlag, Berlin-Heidelberg-New York 2002. 17. T. Knapik, D. Niwinski, P. Urzyczyn, Deciding monadic theories of hyperalgebraic trees, in: TCLA 2001 (S. Abramsky, Ed.), Springer LNCS 2044 (2001), 253-267. 18. T. Knapik, D. Niwinski, P. Urzyczyn, Higher-order pushdown trees are easy, in: Proc. 5th FoSSaCS (M. Nielsen, U. Engberg, Eds.), Springer LNCS 2303 (2002), 205-222. 19. F. Klaedtke, H. Rue, Monadic second-order logic with cardinalities, in: Proc. 30th ICALP 2003, Springer LNCS (to appear). 20. C. L¨ oding, Ground tree rewriting graphs of bounded tree width, in: Proc. 19th STACS, Springer LNCS 2285 (2002), 559-570. 21. A. Montanari, A. Peron, A. Policriti, Extending Kamp’s Theorem to model time granularity, J. Logic Computat. 12 (2002), 641-678. 22. D. Muller, P. Schupp, The theory of ends, pushdown automata, and second-order logic, Theor. Comput. Sci. 37 (1985), 51-75. 23. M.O. Rabin, Decidability of second-order theories and automata on infinite trees, Trans. Amer. Math. Soc. 141 (1969), 1-35. 24. A. Semenov, Decidability of monadic theories, in: Proc. MFCS 1984 (M.P. Chytil, V. Koubek, Eds.), Springer LNCS 176 (1984), 162-175. 25. W. Thomas, A short introduction to infinite automata. In: Proc. 5th International Conference “Developments in Language Theory”, Springer LNCS 2295 (2002), 130144. 26. I. Walukiewicz, Monadic second-order logic on tree-like structures, Theor. Comput. Sci. 275 (2002), 311-346.
Towards a Theory of Randomized Search Heuristics Ingo Wegener FB Informatik, LS 2, Univ. Dortmund, 44221 Dortmund, Germany [email protected]
Abstract. There is a well-developed theory about the algorithmic complexity of optimization problems. Complexity theory provides negative results which typically are based on assumptions like NP=P or NP=RP. Positive results are obtained by the design and analysis of clever algorithms. These algorithms are well-tuned for their specific domain. Practitioners, however, prefer simple algorithms which are easy to implement and which can be used without many changes for different types of problems. They report surprisingly good results when applying randomized search heuristics like randomized local search, tabu search, simulated annealing, and evolutionary algorithms. Here a framework for a theory of randomized search heuristics is presented. It is discussed how randomized search heuristics can be delimited from other types of algorithms. This leads to the theory of black-box optimization. Lower bounds in this scenario can be proved without any complexity-theoretical assumption. Moreover, methods how to analyze randomized search heuristics, in particular, randomized local search and evolutionary algorithms are presented.
1
Introduction
Theoretical computer science has developed powerful methods to estimate the algorithmic complexity of optimization problems. The borderline between polynomial-time solvable and NP-equivalent problems is marked out and this holds for problems and their various subproblems as well as for their approximation variants. We do not expect that randomized algorithms can pull down this border. The “best” algorithms for specific problems are those with the smallest asymptotic (w.r.t. the problem dimension) worst-case (w.r.t. the problem instance) run time. They are often well-tuned especially for this purpose. They can be complicated, difficult to implement, and not very efficient for reasonable problem dimension. This has led to the area of algorithm engineering. Nevertheless, many practitioners like another class of algorithms, namely socalled randomized search heuristics. Their characteristics are that they are
This work was supported by the Deutsche Forschungsgemeinschaft (DFG) as part of the Collaborative Research Center “Computational Intelligence” (SFB 531), the Collaborative Research Center “Complexity Reduction of Multivariate Data Structures” (SFB 475), and the GIF project “Robustness Aspects of Algorithms”.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 125–141, 2003. c Springer-Verlag Berlin Heidelberg 2003
126
Ingo Wegener
– easy to implement, – easy to design, – often fast although there is no guaranteed upper bound on the expected run time, – often producing good results although there is no guarantee that the solution is optimal or close to optimal. Classical algorithm theory is concerned with guarantees on the run time (or the expected run time for randomized algorithms) and with guarantees for the quality of the results produced by the algorithm. This has led to the situation that practitioners work with algorithms which are almost not considered in the theory of algorithms. The motivation of this paper is the following. If randomized search heuristics find many applications, then there should be a theory of this class of algorithms. The aim is to understand how these algorithms work, what they can achieve and what they cannot achieve. This should lead to the design of better heuristics, rules which algorithm is appropriate under certain restrictions, and an at least partial analysis of these algorithms on selected problems. Finally, these results can be used when teaching randomized search heuristics. The problem is that we are interested in “the best” algorithms for an optimization problem and we do not expect that a randomized search heuristic is such a best algorithm. It seems to be impossible to define precisely which algorithm is a randomized search heuristic. Our solution to this dilemma is to describe an algorithmic scenario such that all known randomized search heuristics can work in this scenario while most problem-specific algorithms are not applicable in this scenario. This black-box scenario is presented in Section 2. There it is shown that black-box algorithms can be interpreted as randomized decision trees. This allows the application of methods from classical complexity theory, in particular, lower-bound methods like Yao’s minimax principle. This new framework allows a general theory of black-box algorithms including randomized local search, tabu search, simulated annealing, and evolutionary algorithms. Theoretical results on each of these classes of randomized search heuristics were known before, e.g., Papadimitriou, Sch¨ affer, and Yannakakis (1990) for local search, Glover and Laguna (1993) for tabu search, Kirkpatrick, Gelatt, and Vecchi (1983) and Sasaki and Hajek (1998) for simulated annealing, and Rabani, Rabinovich, and Sinclair (1998), Wegener (2001), Droste, Jansen, and Wegener (2002), and Giel and Wegener (2003) for evolutionary algorithms. Lower bounds on the complexity of black-box optimization problems are presented at the end of this paper, in Section 9. Before, we investigate what can be achieved by randomized search heuristics, in particular, by randomized local search and evolutionary algorithms. The aim is to present and to apply methods to analyze randomized search heuristics on selected problems. In Section 3, we, therefore, discuss some methods which have been applied recently and, afterwards, we present examples of these applications. In Section 4, we investigate the optimization of degree-bounded polynomials which are monotone with respect to each variable. It is not known whether the polynomial is increasing or
Towards a Theory of Randomized Search Heuristics
127
decreasing with xi . Afterwards, we investigate famous problems with well-known efficient algorithms working in the classical optimization scenario. In Section 5, we investigate sorting as the maximization of sortedness. The sortedness can be measured in different ways which has influence on the optimization time of evolutionary algorithms. In Section 6, the single-source-shortest-paths problem is discussed. It turns out that this problem can be handled efficiently only in the model of multi-objective optimization. In Section 7, the maximum matching problem is investigated in order to show that evolutionary algorithms can find improvements which are not obtainable by single local operations. Evolutionary algorithms work with two search operators known as mutation and crossover. In Section 8, we discuss the first analytic results about the effectiveness of crossover. The results on the black-box complexity in Section 9 show that the considered heuristics are close to optimal — in some cases. We finish with some conclusions
2
The Scenario of Black-Box Optimization
The aim is to describe an algorithmic scenario such that the well-known randomized search heuristics can work in this scenario while it is not possible to apply “other algorithms”. What are the specific properties of randomized search heuristics? The main observation is that randomized search heuristics use the information about the considered problem instance in a highly specialized way. They do not work with the parameters of the instance. They only compute possible solutions and work with the values of these solutions. Consider, e.g., the 2-opt algorithm for the TSP. It starts with a random tour π. In general, it stores one tour π, cuts it randomly into two pieces and combines these pieces to a new tour π . The new tour π replaces π iff its cost is not larger than the cost of π. Problem-specific algorithms work in a different way. Cutting-plane techniques based on integer linear programming create new conditions based on the values of the distance matrix. Branch-and-bound algorithms use the values of the distance matrix for the computation of upper and lower bounds and for the creation of subproblems. This observation can be generalized by considering other optimization problems. Droste, Jansen, and Wegener (2003) have introduced the following scenario called black-box optimization. A problem is described as a class of functions. This unifies the areas of mathematical optimization (e.g., maximize a pseudoboolean polynomial of degree 2) and combinatorial optimization. E.g., TSP is the class of all functions fD : Σn → R+ 0 where D = (dij ) is a distance matrix, Σn is the set of permutations or tours, and fD (π) is the cost of π with respect to D. Hence, it is no restriction to consider problems as classes Fn of functions f : Sn → R. The set Sn is called search space for the problem dimension n. In our case, Sn is finite. A problem-specific algorithm knows Fn and the problem instance f ∈ Fn . Each randomized search heuristic belongs to the following class of black-box algorithms. Algorithm 1. (Black-box algorithm) 1. Choose some probability distribution p on Sn and produce a random search point x1 ∈ Sn according to p. Compute f (x1 ).
128
Ingo Wegener
2. In Step t, stop if the considered stopping criterion is fulfilled. Otherwise, depending on I(t) = (x1 , f (x1 ), . . . , xt−1 , f (xt−1 )) choose some probability distribution pI(t) on Sn and produce a random search point xt ∈ S according to pI(t) . Compute f (xt ). This can be interpreted as follows. The black-box algorithm only knows the problem Fn and has access to a black box which, given a query x ∈ Sn , answers with the correct value of f (x) where f is the considered problem instance. Hence, black-box optimization is an information-restricted scenario. It is obvious that most problem-specific algorithms cannot be applied in this scenario. We have to take into account that randomized search heuristics stop without knowing whether they have found an optimal search point. Therefore, we investigate black-box algorithms without stopping criterion as an infinite stochastic process and we define the run time as the random variable measuring the time until an optimal search point is presented as a query to the black box. This is justified since randomized search heuristics use most of their time for searching for an optimum and not for proving that it is optimal (this is different for exact algorithms like branch and bound). Since queries to the black box are the essential steps, we only charge the algorithm for queries to the black box, i.e., for collecting information. Large lower bounds in this model imply that black-box algorithms cannot solve the problem efficiently. For most optimization problems, the computation of f (x) is easy and, for most randomized search heuristics, the computation of the next query is easy. The disadvantage of the model is that we allow all black-box algorithms including those which collect information to identify the problem instance. Afterwards, they can apply any problem-specific algorithm. MAX-CLIQUE is defined as follows. For a graph G and a subset V of the vertex set V let fG (V ) = |V |, if V is a clique in G, and fG (V ) = 0 otherwise. Asking a query for each twoelement set V we get the information about the adjacency matrix of G and can compute a maximum clique without asking the black box again. Finally, we have to present the solution to the black box. The number of black-box queries of this algorithm equals n2 + 1 but the overall run time is exponential. Hence, our cost model is too generous. For upper bounds, we also have to consider the overall run time of the algorithm. Nevertheless, we may get efficient black-box algorithms which cannot be considered as randomized search heuristics, see, e.g., Giel and Wegener (2003) for the maximum matching problem. Hence, it would be nice to further restrict the scenario to rule out such algorithms. The second observation about randomized search heuristics is that they typically do not store the whole history, i.e., all previous queries and answers or, equivalently, all chosen search points and their values. Randomized local search, simulated annealing, and even some special evolutionary algorithms only store one search point (and its value). Then the next search point is computed and it is decided which of the two search points is stored. Evolutionary algorithms typically work with populations, i.e., multisets of search points. In most cases, the population size is quite small, typically not larger than the problem dimension.
Towards a Theory of Randomized Search Heuristics
129
A black-box algorithm with space restriction s(n) can store at most s(n) search points with their values. After a further search point is produced and presented to the black box, it has to be decided which search point will be forgotten. This decision can be done randomly. We can conclude that the blackbox scenario with (even small) space restrictions includes the typical randomized search heuristics and rules out several algorithms which try to identify the problem instance. Up to now, there are several lower bounds on the black-box complexity which even hold in the scenario without space restrictions (see Section 9). Lower bounds which depend strongly on the space bound are not known and are an interesting research area. We have developed the black-box scenario from the viewpoint of well-known randomized search heuristics. In order to prove lower bounds it is more appropriate to describe black-box algorithms as randomized decision trees. A deterministic black-box algorithm corresponds to a deterministic search tree. The root contains the first query and has an outgoing edge for each possible answer. In general, a path to an inner node describes the history with all previous queries and answers and contains the next query with an outgoing edge for each possible answer. A randomized decision tree is a probability distribution on the set of deterministic decision trees. Since Sn is finite and since it makes no sense to repeat queries if the whole history is known, the depth of the decision trees can be bounded by |Sn |. It is easy to see that both definitions of black-box algorithms are equivalent. The study of randomized decision trees has a long history (e.g., Hajnal (1991), Lov´ asz, Naor, Newman, and Wigderson (1991), Heiman and Wigderson (1991), Heiman, Newman, and Wigderson (1993)). Usually, parts of the unknown input x can be queried and one is interested in computing f (x). Here we can query search points x and get the answer f (x). Usually, the search stops at a leaf of the decision tree and we know the answer to the problem. Here the search stops at the first node (not necessarily a leaf) where the query concerns an optimal search point. Although our scenario differs in details from the traditional investigation of randomized decision trees, we can apply lower-bound techniques known from the theory on decision trees. It is not clear how to improve such lower bounds in the case of space restrictions.
3
Methods for the Analysis of Randomized Search Heuristics
We are interested in the worst-case (w.r.t. the problem instance) expected (w.r.t. the random bits used by the algorithm) run time of randomized search heuristics. If the computation of queries (or search points) and the evaluation of f (often called fitness function) are algorithmically simple, it is sufficient to count the number of queries. First of all, randomized search heuristics are randomized algorithms and many methods used for the analysis of problem-specific randomized algorithms can be applied also for the analysis of randomized search heuristics. The main
130
Ingo Wegener
difference is that many problem-specific randomized heuristics implement an idea how to solve the problem and they work in a specific direction. Randomized search heuristics try to find good search directions by experiments, i.e., they try search regions which are known to be bad if one knows the problem instance. Nevertheless, when analyzing a randomized search heuristic, we can develop an intuition how the search heuristic will approach the optimum. More precisely, we define a typical run of the heuristic with certain subgoals which should be reached within certain time periods. If a subgoal is not reached within the considered time period, this can be considered as a failure. The aim is to estimate the failure probabilities and often it is sufficient to estimate the total failure probability by the sum of the single failure probabilities. If the heuristic works with a finite storage and the analysis is independent from the initialization of the storage, then a failure can be interpreted as the start of a new trial. This general approach is often successful. The main idea is easy but we need a good intuition how the heuristic works. If the analysis is not independent of the contents of the storage, the heuristic can get stuck in local optima. If the success probability within polynomially many steps is not too small (at least 1/p(n) for a polynomial p), a restart or a multistart strategy can guarantee a polynomial expected optimization time. It is useful to analyze search heuristics together with their variants defined by restarts or many independent parallel runs. The question is how we can estimate the failure probabilities. The most often applied tool is Chernoff’s inequality. It can be used to ensure that a (not too short) sequence of random experiments with results 1 (success) and 0 (no success) has a behavior which is very close to the expected behavior with overwhelming probability. A typical situation is that one needs n steps with special properties in order to reach the optimum. If the success probability of a step equals p, it is very likely that we need Θ(n/p) steps to have n successes. All other tail inequalities, e.g., Markoff’s inequality and Tschebyscheff’s inequality, are also useful. We also need a kind of inverse of Chernoff’s inequality. During N Bernoulli trials with success probability 1/2 it is not unlikely (more precisely, there is a positive constant c > 0 such that the probability is at least c) to have at least N/2 + N 1/2 successes, i.e., the binomial distribution is not too concentrated. If a heuristic tries two directions with equal probability and the goal lies in one direction, the heuristic may find it. E.g., the expected number of steps of a random walk on {0, . . . , n} with p(0, 1) = p(n, n−1) = 1 and p(i, i−1) = p(i, i + 1) = 1/2, otherwise, until it reaches n is bounded by O(n2 ). A directed search starting in 0 needs n steps. This shows that a directed search is considerably better but a randomized search is not too bad (for an application of these ideas see Jansen and Wegener (2001b)). If the random walk is not fair and the probability to go to the right equals p, we may be interested in the probability of reaching the good point n before the bad point 0 if we start at a. This is equivalent to the gambler’s ruin problem. Let t := (1 − p)/p. Then the success probability equals (1 − ta )/(1 − tn ).
Towards a Theory of Randomized Search Heuristics
131
There is an another result with a nice description which has many applications. If a randomized search heuristic flips a random bit of a search point x ∈ {0, 1}n , we are interested in the expected time until each position has been flipped at least once. This is the scenario of the coupon collector’s theorem. The expected time equals Θ(n log n) and large deviations from the expected value are extremely unlikely. This result has the following consequences. If the global optimum is unique, randomized search heuristics without problem-specific modules need Ω(n log n) steps on the average. In many cases, one needs more complicated arguments to estimate the failure probability. Ranade (1991) was the first to apply an argument now known as delay-sequence argument. The idea is to characterize those runs which are delayed by events which have to have happened. Afterwards, the probability of these events is estimated. This method has found many applications since its first presentation, for the only application to the analysis of an evolutionary algorithm see Dietzfelbinger, Naudts, van Hoyweghen, and Wegener (2002). Typical runs of a search heuristic are characterized by subgoals. In the case of maximization, this can be the first point of time when a query x where f (x) ≥ b is presented to the black box. Different fitness levels (all x where f (x) = a) can be combined to fitness layers (all x where a1 ≤ f (x) ≤ a2 ). Then it is necessary to estimate the time until a search point from a better layer is found if one has seen a point from a worse layer. The fitness alone does not provide the information that “controls” or “directs” the search. As in the case of classical algorithms, we can use a potential function g : Sn → R (also called pseudo-fitness). The black box still answers the query x with the value of f (x) but our analysis of the algorithm is based on the values of g(x). Even if a randomized search heuristic with space restriction 1 does not accept search points whose fitness is worse, the g-value of the search point stored in the memory may decrease. We may hope that it is sufficient that the expected change of the g-value is positive. This is not true in a strict sense. A careful drift analysis is necessary in order to guarantee “enough” progress in a “short” time interval (see, e.g., Hajek (1982), He and Yao (2001), Droste, Jansen, and Wegener (2002)). Altogether, the powerful tools from the analysis of randomized algorithms have to be combined with some intuition about the algorithm and the problem. Results obtained in this way are reported in the following sections.
4
The Optimization of Monotone Polynomials
Each pseudo-boolean function f : {0, 1}n → R can be written uniquely as a polynomial f (x) = wA xi . A⊆{1,...,n}
i∈A
Its degree d(f ) is the maximal |A| where wA = 0 and its size s(f ) the number of sets A where wA = 0. Already the maximization of polynomials of degree 2 is NP-hard. The polynomial is called monotone increasing if wA ≥ 0 for all A. The maximization of monotone increasing polynomials is trivial since the input
132
Ingo Wegener
1n is optimal. Here we investigate the maximization of monotone polynomials of degree d, i.e., polynomials which are monotone increasing with respect to some z1 , . . . , zn where zi = xi or zi = 1 − xi . This class of functions is interesting because of its general character and because of the following properties. For each input a and each global optimum a∗ there is a path a0 = a, . . . , am = a∗ such that ai+1 is a Hamming neighbor of ai and f (ai+1 ) ≥ f (ai ), i.e., we can find the optimum by local steps which do not create points with a worse fitness. Nevertheless, there are non-optimal points where no search point in the Hamming ball with radius d − 1 is better. We investigate search heuristics with space restriction 1. They use a random search operator (also called mutation operator) which produces the new query a from the current search point a. The new search point a is stored instead of a if f (a ) ≥ f (a). The first mutation operator RLS (randomized local search) chooses i uniformly at random and flips ai , i.e., ai = 1 − ai and aj = aj for all j = i. The second operator EA (evolutionary algorithm) flips each bit independently from the others with probability 1/n. Finally, we consider a class of operators RLSp , 0 ≤ p ≤ 1/n, which choose uniformly at random some i. Then ai is flipped with probability 1 and each aj , j = i, is flipped independently from the others with probability p. Obviously RLS0 = RLS. Moreover, RLS1/n is close to EA if the steps without flipping bit are omitted. For all these heuristics, we have to investigate how they find improvements. In general, the analysis of RLS is easier. The number of bits which have a correct (optimal) value and influence the fitness value essentially is never decreased. This is different for RLSp , p > 0, and EA. If one bit gets the correct value, several other bits can be changed from correct into incorrect. Nevertheless, it is possible that a replaces a. Wegener and Witt (2003) have obtained the following results. All heuristics need an expected time of Θ((n/d) · 2d ) to optimize monotone polynomials of size 1 and degree d, i.e., monomials. This is not too difficult to prove. One has to find the unique correct assignment to d variables, i.e., one has to choose among 2d possibilities, and the probability that one of the d important bits is flipped in one step equals Θ(d/n). In general, RLS performs a kind of parallel search on all monomials. Its expected optimization time is bounded by O((n/d) · log(n/d + 1) · 2d ). It can be conjectured that the same bounds hold for RLSp and EA. The best known result is a bound of O((n2 /d) · 2d ) for RLSp , d(f ) ≤ c log n, and p small enough, more precisely p ≤ 1/(3dn) and p ≤ α/(nc/2 log n) for some constant α > 0. The proof is a drift analysis on the pseudo-fitness counting the correct bits with essential influence on the fitness value. Moreover, the behavior of the underlying Markoff chain is estimated by comparing it with a simpler Markoff chain. It can be shown that the true Markoff chain is only by a constant factor slower than the simple one. Similar ideas are applied to analyze the mutation operator EA. This is essentially the case of RLS1/n , i.e., there are often several flipping bits. The best bound for degree d ≤ 2 log n − 2 log log n − a for some constant a depends on the size s and equals O(s · (n/d) · 2d ).
Towards a Theory of Randomized Search Heuristics
133
For all mutation operators, the expected optimization time equals Θ((n/d) · log(n/d + 1) · 2d ) for the following function called royal road function in the community of evolutionary algorithms. This function consists of n/d monomials of degree d, their weights equal 1 and they are defined on disjoint sets of variables. These functions are the most difficult monotone polynomials for RLS and the conjecture is that this holds also for RLSp and EA. The conjecture implies that overlapping monomials simplify the optimization of monotone polynomials. Our analysis of three simple randomized search heuristics on the simple class of degree-bounded monotone polynomials shows already the difficulties of such analyses.
5
The Maximization of the Sortedness of a Sequence
Polynomials of bounded degree are a class of functions defined by structural properties. Here and in the following sections, we want to discuss typical algorithmic problems. Sorting can be understood as the maximization of the sortedness of the sequence. Measures of sortedness have been developed in the theory of adaptive sorting algorithms. Scharnow, Tinnefeld, and Wegener (2002) have investigated five scenarios defined as minimization problems with respect to fitness functions defined as distances dπ∗ (π) of the considered sequence (or permutation) π on {1, . . . , n} from the optimal sequence π ∗ . Because of symmetry it is sufficient to describe the definitions only for the case that π ∗ = id is the identity: – INV(π) counts the number of inversions, i.e., pairs (i, j) with i < j and π(i) > π(j), – EXC(π) counts the minimal number of exchanges of two objects to sort the sequence, – REM(π) counts the minimal number of removals of objects in order to obtain a sorted subsequence, this is also the minimal number of jumps (an object jumps from its current position to another position) to sort the sequence, – HAM(π) counts the number of objects which are at incorrect positions, and – RUN(π) counts the number of runs, i.e., the number of sorted blocks of maximal length. The search space is the set of permutations and the function to be minimized is one of the functions dπ∗ . We want to investigate randomized search heuristics related to RLSp and EA in the last section. Again we have a space restriction of 1 and consider the same selection procedure to decide which search point is stored. There are two local search operators, the exchange of two objects and the jump of one object to a new position. RLS performs one local operation chosen uniformly at random. For EA the number of randomly chosen local operations equals X + 1 where X is Poisson distributed with parameter λ = 1. It is quite easy to prove O(n2 log n) bounds for the expected run times of RLS and EA and the fitness functions INV, EXC, REM, and HAM. It is sufficient to consider the different fitness levels and to estimate the probability of increasing
134
Ingo Wegener
the fitness within one step. A lower bound of Ω(n2 ) holds for all five fitness functions. Scharnow, Tinnefeld, and Wegener (2002) describe also some Θ(n2 log n) bounds which hold if we restrict the search heuristics to one of the search operators, namely jumps or exchanges. E.g., in the case of HAM, exchanges seem to be the essential operations and the expected optimization time of RLS and EA using exchanges only is Θ(n2 log n). An exchange can increase the HAM value by at most 2. One does not expect that jumps are useful in this scenario. This is true in most situations but there are exceptions. I.e., HAM(n, 1, . . . , n − 1) = n and a jump of object n to position n creates the optimum. An interesting scenario is described by RUN. The number of runs is essential for adaptive mergesort. In the black-box scenario with small space bounds, RUN seems to give not enough information for an efficient optimization. Experiments prove that RLS and EA are rather inefficient. This has not been proven rigorously. Here we discuss why RUN establishes a difficult problem for typical randomized search heuristics. Let RUN(π) = 2 and let the shorter run have length l. An accepted exchange of two objects usually does neither change the number of runs nor their lengths. Each object has a good jump destination in the other run. This may change l by 1. However, there are only l jumps decreasing l but n − l jumps increasing l. Applying the results on the gambler’s ruin problem it is easy to see that it will take exponential time until l drops from a value of at least n/4 to a value of at most n/8. A rigorous analysis is difficult. At the beginning, there are many short runs and it is difficult to control the lengths of the runs when applying RLS or EA. Moreover, there is another event which has to be controlled. If run r2 follows r1 and the last object of r1 jumps away, it can happen that r1 and r2 melt together since all objects of r2 are larger than the remaining objects of r1 . It seems to be unlikely that long runs melt together. Under this assumption one can prove that RLS and EA need on the average exponential time on RUN.
6
Shortest-Paths Problems
The computation of shortest paths from a source s to all other places is one of the classical optimization problems. The problem instance is described by a distance matrix D = (dij ) where dij ∈ R+ ∪ {∞} describes the length of the direct connection from i to j. The search space consists of all trees T rooted at T s := n. Each tree can be described by the vector vT = (v1T , . . . , vn−1 ) where viT is the number of the direct predecessor of i in T . The fitness of T can be defined in different ways. Let dT (i) be the length of the s-i-path in T . Then – fT (v) = dT (1) + · · · + dT (n − 1) leads to a minimization problem with a single objective and – gT (v) = (dT (1), . . . , dT (n − 1)) leads to a minimization problem with n − 1 objectives. In the case of multi-objective optimization we are interested in Pareto optimal solutions, i.e., search points v where gT (v) is minimal with respect to the partial
Towards a Theory of Randomized Search Heuristics
135
order “≤” on (R ∪ {∞})n−1 . Here (a1 , . . . , an−1 ) ≤ (b1 , . . . , bn−1 ) iff aj ≤ bj for all j. In the case of the shortest-paths problem there is exactly one Pareto optimal fitness vector which corresponds to all trees containing shortest s-i-paths for all i. Hence, in both cases optimal search points correspond to solutions of the considered problem. Nevertheless, the problems are of different complexity when considered as black-box optimization problems. The single-objective problem has very hard instances. All instances where only the connections of a specific tree T have finite length lead in black-box optimization to the same situation. All but one search points have the fitness ∞ and the other search point is optimal. This implies an exponential black-box complexity (see Section 9). The situation is different for the multi-objective problem. A local operator is to replace viT by some w ∈ / {i, viT }. This may lead to a graph with cycles and, therefore, an illegal search point. We may assume that illegal search points are marked or that dT (i) = ∞ for all i without an s-i-path. Again, we can consider the operator RLS performing a single local operation (uniformly chosen at random) and the operator EA performing X + 1 local operations (X Poisson distributed with λ = 1). Scharnow, Tinnefeld, and Wegener (2002) have analyzed these algorithms by estimating the expected time until the algorithm stores a search point whose fitness vector has more optimal components. The worst-case expected run time can be estimated by O(n3 ) and by O(n2 d log n) if the depth (number of edges on a path) of an optimal tree equals d. This result proves the importance of the choice of an appropriate problem modeling when applying randomized search heuristics.
7
Maximum Matchings
The maximum matching problem is a classical optimization problem. In order to obtain a polynomial-time algorithm one needs the non-trivial idea of augmenting paths. This raises the question what can be achieved by randomized search heuristics that do not employ the idea of augmenting paths. Such a study can give insight how an undirected search can find a goal. The problem instance of a maximum matching problem is described by an undirected graph G = (V, E). A candidate solution is some edge set E ⊆ E. The search space equals {0, 1}m for graphs with m edges and each bit position describes whether the corresponding edge is chosen. Finally, fG (E ) = |E |, if the edges of E are a G-matching, and fG (E ) = 0 otherwise. A search heuristic can start with the empty matching. We investigate three randomized search heuristics. Randomized local search RLS flips a coin in order to decide whether it flips one or two bits uniformly at random. It is obvious that an RLS flipping only one bit per step can get stuck in local optima. Flipping two bits in a step, an augmenting path can be shortened by two edges within one step. If the augmenting path has length 1, the matching can be enlarged by flipping the edge on this path. The mutation operator EA flips each bit independently with probability 1/m. This allows to flip all bits of an augmenting path simultaneously. The analysis of EA is much more difficult than the analysis of RLS since more global
136
Ingo Wegener edges
h
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
s
Kh,h
Fig. 1. The graph Gh, and an augmenting path.
changes are possible. Finally, SA is some standard form of simulated annealing whose details are not described here (see Sasaki and Hajek (1988)). Practitioners do not ask for optimal solutions, they are satisfied with (1 + ε)optimal solutions, in particular, if they can choose the accuracy parameter ε > 0. It is sufficient to find a (1 + ε)-optimal solution in expected polynomial time and to obtain a probability of 3/4 of finding a (1 + ε)-optimal solution within a polynomial number of steps. Algorithms with the second property are called PRAS (polynomial-time randomized approximation scheme). Giel and Wegener (2003) have shown that RLS and EA have the desired properties and the expected run time is bounded by O(m21/ε ). This question has not been investigated for SA. The observation is that small matchings imply the existence of short augmenting paths. For RLS the probability of a sequence of steps shortening a path to an augmenting edge is estimated. For EA it is sufficient to estimate the probability of flipping exactly all the edges of a short augmenting path. These results are easy to prove and show that randomized search heuristics perform quite well for all graphs. The run time grows exponentially with 1/ε. This is necessary as the following example shows (see Figure 1). The graph Gh, has h · ( + 1) nodes arranged as h × ( + 1)-grid. All “horizontal” edges exist. Moreover, the columns 2i and 2i + 1 are connected by all possible edges. The graph has a unique perfect matching consisting of all edges ((i, 2j − 1), (i, 2j)). Figure 1 shows an almost perfect matching (solid edges). In such a situation there is a unique augmenting path which goes from left to right perhaps changing the row, in our example (2, 5), (2, 6), (2, 7), (2, 8), (1, 9), (1, 10). The crucial observation is that the free node (2, 5) (similarly for (1, 10)) is connected to h + 1 free edges whose other endpoints are connected to a unique matching edge each. There are h + 1 2-bitflips changing the augmenting path at (2, 5), h of them increase the length of the augmenting path and only one decreases the length. If h ≥ 2, this is an unfair game and we may conjecture that Gh, , h ≥ 2, is difficult for randomized search heuristics. This is indeed the case. Sasaki and Hajek (1988) have proved for SA that the expected optimization time grows exponentially if h = . Giel and Wegener (2003) have proved a bound of 2Ω() on the expected optimization time for each h ≥ 2 and RLS and EA. The proof for RLS follows the ideas discussed above.
Towards a Theory of Randomized Search Heuristics
137
One has to be careful since the arguments do not hold if an endpoint of the augmenting path is in the first or last column. Moreover, we have to control which matchings are created during the search process. Many of the methods discussed in Section 3 are applied, namely typical runs analyzed with appropriate potential functions (length of the shortest augmenting path), drift analysis, gambler’s ruin problem, and Chernoff bounds. The analysis of EA is even more difficult. It is likely that there are some steps where more than two bits flip and the resulting bit string describes a matching of the same size. Such a step may change the augmenting paths significantly. Hence, a quite simple, bipartite graph where the degree of each node is bounded above by 3 is a difficult problem instance for typical search heuristics. Our arguments do not hold in the case h = 1, i.e., in the case that the graph is a path of odd length. In this case, RLS and EA find the perfect matching in an expected number of O(m4 ) steps (Giel and Wegener (2003)). One may wonder why the heuristics are not more efficient. Consider the situation of one augmenting path of length Θ() = Θ(m). Only four different 2-bit-flips are accepted (two at each endpoint of the augmenting path). Hence, on the average only one out of Θ(m2 ) steps changes the situation. The length of the augmenting path has to be decreased by Θ(m). The “inverse” of Chernoff’s bound (see Section 3) implies that we need on the average Θ(m2 ) essential steps. The reason is that we cannot decrease the length of the augmenting path deterministically. We play a coin tossing game and have to wait until we have won Θ(m) euros. We cannot lose too much since the length of the augmenting path is bounded above by m. The considerations show that randomized search heuristics “work” at free nodes v. The pairs ((v, w), (w, u)) of a free and a matching edge cannot be distinguished by black-box heuristics with small space bounds. Some of them will decrease and some of them will increase the length of augmenting paths. If this game is fair “on the average”, we can hope to find a better matching in expected polynomial time. Which graphs are fair in this imprecise sense? There is a new result of Giel and Wegener showing that RLS finds an optimal matching in trees with n nodes in an expected number of O(n6 ) steps. One can construct situations which look quite unfair. Then nodes have a large degree. Trees with many nodes of large degree have a small diameter and/or many leaves. A leaf, however, is unfair but in favor of RLS. If a leaf is free, a good 2-bit-flip at this free node can only decrease the length of each augmenting path containing the leaf. The analysis shows that the bad unfair inner nodes and the good unfair leaves together make the game fair or even unfair in favor of the algorithm.
8
Population-Based Search Heuristics and Search with Crossover
We have seen that randomized local search RLS is often efficient. RLS is not able to escape from local optima. This can be achieved with the same search operator if we accept sometimes worsenings. This idea leads to the Metropolis
138
Ingo Wegener
algorithm or simulated annealing. Another idea is the mutation operator EA from evolutionary algorithms. It can perform non-local changes but it prefers local and almost local changes. In any case, these algorithms work with a space restriction of 1. One of the main ideas of evolutionary algorithms is to work with more search points in the storage, typically called population-based search. Such a population can help only if the algorithm maintains some diversity in the population, i.e., it contains search points which are not close together. It is not necessary to define these notions rigorously here. It should be obvious nevertheless that it is more difficult to analyze population-based search heuristics (with the exception of multi-start variants of simple heuristics). Moreover, the crossover operator needs a population. We remember that crossover creates a new search point z from two search points x and y. In the case of Sn = {0, 1}n , one-point crossover chooses i ∈ {1, . . . , n − 1} uniformly at random and z = (x1 , . . . , xi , yi+1 , . . . , yn ). Uniform crossover decides with independent coin tosses whether zi = xi or zi = yi . Evolutionary algorithms where crossover plays an important role are called genetic algorithms. There is only a small number of papers with a rigorous analysis of population-based evolutionary algorithms and, in particular, genetic algorithms. The difficulties can be described by the following example. Assume a population consisting of n search points all having k ones where k > n/2. The optimal search point consists of ones only, all search points with k ones are of equal fitness, and all other search points are much worse. If k is not very close to n, it is quite unlikely to create 1n with mutation. A genetic algorithm will sometimes choose one search point for mutation and sometimes choose two search points x and y for uniform crossover and the resulting search point z is mutated to obtain the new search point z ∗ . Uniform crossover can create 1n only if there is no position i where xi = yi = 0. Hence, the diversity in the population should be large. Mutation creates a new search point close to the given one. If both stay in the population, this can decrease the diversity. Uniform crossover creates a search point z between x and y. This implies that the search operators do not support the creation of a large diversity. Crossover is even useless if all search points of the population are identical. In the case of a very small diversity, mutation tends to increase the diversity. The evolution of the population and its diversity is a difficult stochastic process. It cannot be analyzed completely with the known methods (including rapidly mixing Markoff chains). Jansen and Wegener (2002) have analyzed this situation. In the case of k = n − Θ(log n) they could prove that a genetic algorithm reaches the goal in expected polynomial time. This genetic algorithm uses standard parameters with the only exception that the probability of performing crossover is very small, namely 1/(cn log n) for some constant c. This assumption is necessary for the proof that we obtain a population with quite different search points. Since many practitioners believe that crossover is essential, theoreticians are interested in proving this, i.e., in proving that a genetic algorithm is efficient in situations where all mutation- and population-based algorithms fail. The most
Towards a Theory of Randomized Search Heuristics
139
modest aim is to prove such a result for at least one instance of one perhaps even very artificial problem. No such result was known for a long time. The royal road functions (see Section 4) were candidates for such a result. We have seen that randomized local search and simple evolutionary algorithms solve these problems in expected time O((n/d) · log(n/d + 1) · 2d ) and the black-box complexity of these problem is Ω(2d ) (see Section 9). Hence, there can be no superpolynomial trade-off for these functions. The first superpolynomial trade-off has been proved by Jansen and Wegener (2002, the conference version has been published 1999) based on the results discussed above. Later, Jansen and Wegener (2001a) have designed artificial functions and have proved exponential trade-offs for both types of crossover.
9
Results on the Black-Box Complexity of Specific Problems
We have seen that all typical randomized search heuristics work in the blackbox scenario and they indeed work with a small storage. Droste, Jansen, and Wegener (2003) have proved several lower bounds on the black-box complexity of specific problems. The lower-bound proofs apply Yao’s minimax principle (Yao (1977)). Yao considers the zero-sum game between Alice choosing a problem instance and Bob choosing an algorithm (a decision tree). Bob has to pay for each query asked by his decision tree when confronted with the problem instance chosen by Alice. Both players can use randomized strategies. If the number of problem instances and the number of decision trees are finite, lower bounds on the black-box complexity can be obtained by proving lower bounds for deterministic algorithms for randomly chosen problem instances. We are free to choose the probability distribution on the problem instances. The following application of this technique is trivial. Let Sn be the search space and let fa , a ∈ Sn , be the problem instance where fa (a) = 1 and fa (b) = 0 for b = a. The aim is maximization. We choose the uniform distribution on all fa , a ∈ Sn . A deterministic decision tree is essentially a decision list. If a query leads to the answer 1, the search is stopped successfully. Hence, the expected depth is always at least (|Sn | + 1)/2 and this bound can be achieved if we query all a ∈ Sn in random order. This example seems to be too artificial to have applications. The shortestpaths problem (see Section 6) with a single objective contains this problem where the search space consists of all trees rooted at s. Hence, we know that this problem is hard in black-box optimization. In the case of the maximization of monotone polynomials we have the subproblem of the maximization of all z1 · · · zd where zi ∈ {xi , 1 − xi }. The bits at the positions d + 1, . . . , n have no influence on the answers to queries. Hence, we get the lower bound (2d + 1)/2 for the maximization of polynomials (or monomials) of degree d. This bound is not far from the upper bound shown in Section 4. For several problems, we need lower bounds which hold only in a spacerestricted scenario since there are small upper bounds in the unrestricted scenario:
140
Ingo Wegener
– O(n) for sorting and the distance measure INV, – O(n log n) for sorting and the distance measures HAM and RUN, – O(n) for shortest paths as multi-objective optimization problem (a simulation of Dijkstra’s algorithm), – O(m2 ) for the maximum matching problem. Finally, we discuss a non-trivial lower bound in black-box optimization. A function is unimodal on {0, 1}n if each non-optimal search point has a better Hamming neighbor. It is easy to prove that RLS and EA can optimize unimodal functions with at most b different function values in an expected number of O(nb) steps. This bound is close to optimal. A lower bound of Ω(b/nε ) has been proved by Droste, Jansen, and Wegener (2003) if (1 + δ)n ≤ b = 2o(n) (an exponential lower bound for deterministic algorithms has been proven earlier by Llewellyn, Tovey, and Trick (1989)). Here the idea is to consider the following stochastic process to create a unimodal function. Set p0 = 1n , let pi+1 be a random Hamming neighbor of pi , 1 ≤ i ≤ b − n. Then delete the circles on p0 , p1 , . . . to obtain a simple path q0 , q1 , . . .. Finally, let f (qi ) = n + i and f (a) = a1 + · · · + an for all a outside the simple path. Then it can be shown that a randomized search heuristic cannot do essentially better than to follow the path.
10
Conclusion
Randomized search heuristics find many applications but the theory of these heuristics is not well developed. The black-box scenario allows the proof of lower bounds for all randomized search heuristics – without complexity theoretical assumption. The reason is that the scenario restricts the information about the problem instance. Moreover, methods to analyze typical heuristics on optimization problems have been presented. Altogether, the idea of a theory of randomized search heuristics developed as well as the theory of classical algorithms is still a vision but steps to approach this vision have been described
References 1. Dietzfelbinger, M., Naudts, B., van Hoyweghen, C., and Wegener, I. (2002). The analysis of a recombinative hill-climber on H-IFF. Submitted for publication in IEEE Trans. on Evolutionary Computation. 2. Droste, S., Jansen, T., and Wegener, I. (2003). Upper and lower bounds for randomized search heuristics in black-box optimization. Tech. Rep. Univ. Dortmund. 3. Droste, S., Jansen, T., and Wegener, I. (2002). On the analysis of the (1+1) evolutionary algorithm. Theoretical Computer Science 276, 51–81. 4. Giel, O. and Wegener, I. (2003). Evolutionary algorithms and the maximum matching problem. Proc. of 20th Symp. on Theoretical Aspects of Computer Science (STACS), LNCS 2607, 415–426. 5. Glover, F. and Laguna, M. (1993). Tabu search. In C.R. Reeves (Ed.): Modern Heuristic Techniques for Combinatorial Problems, 70–150, Blackwell, Oxford.
Towards a Theory of Randomized Search Heuristics
141
6. Hajek, B. (1982). Hitting-time and occupation-time bounds implied by drift analysis with applications. Advances in Applied Probability 14, 502–525. 7. He, J. and Yao, X. (2001). Drift analysis and average time complexity of evolutionary algorithms. Artificial Intelligence 127, 57–85. 8. Jansen, T. and Wegener, I. (2001a). Real royal road functions — where crossover provably is essential. Proc. of 3rd Genetic and Evolutionary Computation Conf. (GECCO), 375–382. 9. Jansen, T. and Wegener, I. (2001b). Evolutionary algorithms — how to cope with plateaus of constant fitness and when to reject strings of the same fitness. IEEE Trans. on Evolutionary Computation 5, 589–599. 10. Jansen, T. and Wegener, I. (2002). The analysis of evolutionary algorithms — a proof that crossover really can help. Algorithmica 34, 47–66. 11. Kirkpatrick, S., Gelatt, C.D., and Vecchi, M.P. (1983). Optimization by simulated annealing. Science 220, 671–680. 12. Llewellyn, D.C., Tovey, C., and Trick, M. (1989). Local optimization on graphs. Discrete Applied Mathematics 23, 157–178. 13. Lov´ asz, L., Naor, M., Newman, I., and Wigderson, A. (1991). Search problems in the decision tree model. Proc. of 32nd IEEE Symp. on Foundations of Computer Science (FOCS), 576–585. 14. Papadimitriou, C.H., Sch¨ affer, A.A., and Yannakakis, M. (1990). On the complexity of local search. Proc. of 22nd ACM Symp. on Theory of Computing (STOC), 438– 445. 15. Rabani, Y., Rabinovich, Y., and Sinclair, A. (1998). A computational view of population genetics. Random Structures and Algorithms 12, 314–330. 16. Ranade, A.G. (1991). How to emulate shared memory. Journal of Computer and System Sciences 42, 307–326. 17. Sasaki, G. and Hajek, B. (1988). The time complexity of maximum matching by simulated annealing. Journal of the ACM 35, 387–403, 1988. 18. Scharnow, J., Tinnefeld, K., and Wegener, I. (2002). Fitness landscapes based on sorting and shortest paths problems. Proc. of 7th Conf. on Parallel Problem Solving from Nature (PPSN–VII), LNCS 2439, 54–63. 19. Wegener, I. (2001). Theoretical aspects of evolutionary algorithms. Proc. of 28th Int. Colloquium on Automata, Languages and Programming (ICALP), LNCS 2076, 64–78. 20. Wegener, I. and Witt, C. (2003). On the optimization of monotone polynomials by simple randomized search heuristics. Combinatorics, Probability and Computing, to appear. 21. Yao, A.C. (1977). Probabilistic computations: Towards a unified measure of complexity. Proc. of 17th IEEE Symp. on Foundations of Computer Science (FOCS), 222–227.
Adversarial Models for Priority-Based Networks 1 ` C. Alvarez , M. Blesa1 , J. D´ıaz1 , A. Fern´ andez2 , and M. Serna1 1
Dept. de Llenguatges i Sistemes Inform` atics, Universitat Polit`ecnica de Catalunya Jordi Girona 1–3, 08034 Barcelona {alvarez,mjblesa,diaz,mjserna}@lsi.upc.es 2 Dept. Ciencias Experimentales e Ingenier´ıa, Universidad Rey Juan Carlos Tulip´ an s/n, Campus de M´ ostoles, 28933 Madrid [email protected]
Abstract. We propose several variations of the adversarial queueing model to cope with packets that can have different priorities, the priority and variable priority models, and link failures, the failure and reliable models. We address stability issues in the proposed adversarial models. We show that the set of universally stable networks in the adversarial model remains the same in the four introduced models. From the point of view of queueing policies we show that several queueing policies that are universally stable in the adversarial model remain so in the priority, failure and reliable models. However, we show that lis, a universally stable queueing policy in the adversarial model, is not universally stable in any of the other models, and that no greedy queueing policy is universally stable in the variable priority model. Finally we analyze the problem of deciding stability of a given network under a fixed protocol. We provide a characterization of the networks that are stable under fifo and lis in the failure model. This characterization allows us to show that deciding network stability under fifo and lis in the proposed models can be solved in polynomial time.
1
Introduction
The model of Adversarial Queueing Theory (aqt) proposed by Borodin et al. [10] considers the time evolution of a packet-routing network as a game between an adversary and a queueing policy. At each time step the adversary may inject a set of packets to some of the nodes. For each packet the adversary specifies the sequence of edges that it must traverse, after which the packet will be absorbed. If more than one packet try to cross an edge e at the same time step, then the queueing policy chooses one of these packets to be sent across e. The remaining
Work partially supported by the FET Programme of the EU under contract number IST-2001-33116 (FLAGS), and by the Spanish CICYT project TIC-2001-4917-E. The second author was also supported by the Catalan government with the predoctoral grant 2001FI-00659.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 142–151, 2003. c Springer-Verlag Berlin Heidelberg 2003
Adversarial Models for Priority-Based Networks
143
packets wait in the queue. This game then advances to the next time step. The main goal of the model is to study stability issues of the network, under different greedy queueing policies. Stability is the property of deciding whether at any time the maximum number of packets present in the system is bounded by a constant that may depend on system parameters. Recall that a protocol is greedy if whenever there is at least one packet waiting to use an edge, the protocol advances a packet through the edge. In the adversarial model the adversary is restricted by a pair (r, b) where b ≥ 0 is the burstiness, and 0 < r < 1 is the injection rate. The adversary must obey the following rule Ne (I) ≤ r|I| + b, where Ne (I) denotes the number of packets injected by the adversary during a time interval I that have paths containing the edge e1 [10,5]. In this paper we consider a generalization of the adversarial model which takes into account the possibility that packets may have different priorities and we explore some dynamic network settings. Priority Models. Considering priorities is a natural approach to model nowadays’ networks. Today’s networked applications, such as data mining, e-commerce and multimedia, are bandwidth hungry and time sensitive. These applications need networks that accommodate to these requirements and guarantee some Quality of Service (QoS). Classifying and prioritizing network traffic flow are basic tasks. We are interested in analyzing the power of an adversary that can prioritize the packets. We will consider two settings, in the first one each packet have a fixed priority and in the second one the adversary is allowed to modify the priority of a packet at any time step. Consequently, we define two new models for adversarial queueing theory, the priority and the variable priority. When packets have priorities, each edge has a queue associated to every possible priority. If at a certain time, more than one packet tries to cross the same edge e, the queueing policy chooses one of these packets to send across e, from the non-empty queue with highest priority. The limitations on the adversary are the same as in the adversarial model. Models for Dynamic Networks. Inspired by the priority models and by the growing importance of wireless mobile networks where some connections between nodes may fail or change quickly and unpredictably, we also consider some variations of the adversarial model for dynamic networks, in which edges can appear and disappear arbitrarily. Note that in the priority model, we can simulate the failure of an edge e by injecting a packet of length 1 in e with a priority higher than any other packet in the queue of e. Once this packet has been injected none of the remaining packets of the queue can be served until the next time step. It seems natural to introduce models for dynamic networks in which the adversary controls not only the packet arrivals, but also the edge failures. The constraints of an adversary are defined obeying the rule: the number of packets introduced by the adversary during interval I, which have paths containing e, can not be 1
Recall that in [10] the model is defined over windows of fixed size w and the equation Ne (I) ≤ r|I|, for |I| = w. It is known that both models are equivalent [16].
144
` C. Alvarez et al.
greater than a fraction of the number of times that e is alive in this interval. Furthermore, as packets must follow a pre-specified path, the adversary should not be able to make an edge fail perpetually. We assume that a packet cannot cross a failed link, and that during an edge failure the packets that arrive wait queued at the head of the edge. Let Fe (I) be the number of steps during time interval I for which the edge e is down. In order to guarantee that we keep a bound on the maximum number of failures of an edge e in any time interval, we propose the failure model, in which the adversary is controlled by a common bound on both the injection and the edge failures, according to the restriction Ne (I) + Fe (I) ≤ r|I| + b.
(1)
Observe than in this case, during a given interval, the injection rate limits the maximum number of failures and the maximum number of packet injections per edge. With the aim of allowing a higher amount of edge failures, we define a new dynamic model. To do so, we introduce an additional parameter α. The adversary is characterized by (r, b, α) , where r, b are defined as before and r ≤ α ≤ 1. For any edge e and any interval I, the adversary must obey the constraint Ne (I) + αFe (I) ≤ r|I| + b.
(2)
In the model defined by equation (2), we can consider two extreme cases: For α = 1 we obtain the constraint (1) defining the failure model. For α ≤ r we get a model in which an edge can be down all the time. Notice that in the case r < α ≤ 1, if the adversary produces a failure of an edge, then it is forced to recover the edge after b/(α − r) steps, otherwise it will violate inequality (2). We are interested in the latter property and will use the term reliable model to denote an adversary with parameters (r, b, α) where 0 < r < 1, b > 1, and r < α ≤ 1 and constrained by inequality (2). Greedy Protocols. Through this paper the term network will refer to digraphs which may have multiple edges but no loops. As in [10,5] we will only consider greedy protocols which apply their policies to the queues at the edges according to some local or global criteria. The systems acts synchronously. The main queueing protocols we consider are: fifo (First In First Out), lifo (Last In First Out), sis (Shortest In System), lis (Longest In System), ntg (Nearest To Go), ftg (Furthest To Go), nfs (Nearest From Source), ffs (Farthest From Source) and ntg-lis, which works as ntg, but resolving ties using the lis protocol. It is known that ftg, nts, sis and lis are universally stable in the adversarial model while fifo, lifo, ntg and ffs are not [5]. Related Work. Two adversarial models for dynamic networks have been proposed in [7] and [6]. In both models the injected packets are defined by specifying only source and destination, and thus they are not forced to follow a pre-specified path. The dynamic models proposed in this paper consider the case in which the injected packets are defined specifying the sequence of edges that they must
Adversarial Models for Priority-Based Networks
145
traverse. Our models and the dynamic models proposed in [7] and in [6] have the common characteristic that, for every interval I, the adversary can not inject to any edge e (or to any set S of nodes for the model in [6]), more packets than the number of packets that e can absorb (or the edges with only one extreme in S). An interpretation of system failure as a slowdown in the transmission or link capacity, instead of link failure was studied in [9], in both models packets are injected with a pre-specified path. In the dynamic slowdown model, a packet p suffers slowdown se (t) while crossing edge e at time t, that means that it p starts to traverse the link at time t and arrives to the tail of e at time t + se (t). During this transfer time the packets that want to cross e wait in the queue of e. In the static case every link e has a fixed slowdown se . This situation has some similarities with the failure model as the slowdown s incurred by a packet traversing a link e can be interpreted as “link e fails during s − 1 steps”. However, there is a difference, in the slowdown model p is delayed after leaving e’s queue, while in the failure model p waits in e’s queue. This means that when e is recovered, the next packet to be served might not be p. In the capacity model every edge e in a network has capacity ce (t) at time step t. They also consider a static case in which the capacity does not depend on time. In step t a link is able to transmit simultaneously up to ce (t) packets. The main results in the paper are that every universally stable network remains universally stable in the slowdown and the capacity models, even in the dynamic case. That sis, nts and ftg remain universally stable in all the models. The situation is different for lis since it is universally stable in the static slowdown model but it is not in the dynamic slowdown and capacity models. Even though we can interpret that a link fails at any time step with ce (t) = 0 the proof that lis is not universally in the dynamic capacity model uses two non zero capacities (see Theorem 3.1 [9]). Our Contributions. We address stability issues in the proposed adversarial models. Let us recall that a network is stable under a protocol and an adversary if the number of packets in the system at any time step remains bounded. Our first results concern with universal stability of networks. First we show that the property that a network is stable under any adversary and queueing policy remains the same in the adversarial, priority, variable priority, failure and reliable models. From the point of view of queueing policies, we show that nfs, sis and ftg, that are universally stable in the adversarial model [5], remain so in the failure, reliable, and priority models. However, we show that lis, a universally stable queueing policy in the adversarial model [5], is not universally stable in the failure, reliable and priority models. Moreover, we show that no greedy protocol is universally stable in the variable priority model. Finally we analyze the problem of deciding stability of a given network under a fixed protocol. We provide a characterization of the networks that are stable under fifo and lis in the failure model. This characterization is the same as the one given in [3] in the adversarial model for universal stability and for stability
146
` C. Alvarez et al.
under ntg-lis. Thus, our results show that for fifo and lis the stability problem in the failure model can be solved in polynomial time. Let us observe that the characterization of fifo stability in the adversarial model remains an open problem [4]. Due to the lack of space we will omit all the proofs they can be found in the full version [1].
2
Universal Stability of Networks
A communication system is formed by three main components: A network G, a scheduling protocol P and a traffic pattern A which is represented by an adversary. The concept of universal stability applies either to networks or protocols. Let M denote a model in the set {adversarial, reliable, failure, priority, variable priority } as defined in the previous section. Given a network G, a queuing policy P and a model M, we say that for a given adversary A following the restrictions of M, the system S = (G, A, P) is stable in the model M if, at any time step, the maximum number of packets in the system is bounded by a fixed value that may depend on system parameters. The pair (G, P) is stable in the model M if, for any adversary A following the restrictions of M, the system S = (G, A, P) is stable in M. A network G is universally stable in the model M if, for any greedy queuing policy P, the pair (G, P) is stable in M. A greedy protocol P is universally stable in the model M if, for any digraph G, the pair (G, P) is stable in M. In order to compare the power of adversaries in different adversarial models, we introduce the concept of simulation. We say that an adversary A in model M simulates an adversary A in model M when for any network G and any protocol P if (G, A, P) is stable in M, then (G, A , P) is stable in M . Lemma 1. Any (r, b)-adversary in the adversarial model can be simulated by an (r, b)-adversary in the failure model. Any (r, b)-adversary in the failure model is an (r, b, 1)-adversary in the reliable model. Any (r, b)-adversary in the failure model can be simulated by an (r, b)-adversary in the priority model using two priorities. Any (r, b, α)-adversary in the reliable model can be simulated by an (r + 1 − α, b)-adversary in the failure model. Observe that the failure and reliable models are equivalent. So any stability or instability result for one model applies to the other as well. We will consider in the following only the failure and priority models. Now we can state our main result in this section. Theorem 1. Given a digraph 1. G is universally stable 2. G is universally stable 3. G is universally stable 4. G is universally stable
G, the following properties are equivalent in the adversarial model, in the failure model, in the priority model, and in the variable priority model.
Adversarial Models for Priority-Based Networks
3
147
Universal Stability of Protocols
In this section we address the universal stability property in the failure and priority models, from the point of view of the queuing policy. We will consider the six basic protocols presented in the introduction. Recall that ftg, nts, sis and lis are universally stable in the adversarial model while fifo, lifo, ntg, and ffs are not [5]. Since any adversary in the adversarial model can be seen as an adversary in the other models, fifo, lifo, ntg, and ffs are not universally stable in the failure and priority models. First we show how the behavior of any (r, b)-adversary for network G in the priority model can be simulated by an (r , b )-adversary for a network G in the adversarial model, under the same protocol P in the case that P ∈ {ftg, ntg, nfs, ffs}. Let G be a directed graph and Aπ an adversary in the priority model, assigning at most π priorities and with injection rate (r, b), where b ≥ 0 and 0 < r < 1. Every injected packet p has a priority πp in the ordered interval [1, . . . , π], being one the lowest priority. Lemma 2. For any system S = (G, Aπ , P) in the priority model, for P ∈ {ftg, ntg}, there is a system S = (G , A , P) in the adversarial model such that, G is a subgraph of G , A has injection rate (r, b), if a packet p is injected in S at time t with route r, a packet p is injected in S at time t with a route r obtained by concatenating r and a path of edges not in G, and if p crosses edge e at time t in S, p crosses e at time t in S . To get a similar result for nfs and ffs we have to relate two different networks. Lemma 3. For any system S = (G, Aπ , P) in the priority model, for P ∈ {nfs, ffs}, there is a system S = (G , A , P) in the adversarial model such that, G is a subgraph of G , A has injection rate (r, b ), where b = r(π − 1)d + b, if a packet p is injected in S with route r, a packet p is injected in S with a route r obtained by concatenating and a path of edges not in G and r, and if p crosses edge e at time t in S, p crosses e at time t in S . As a consequence of the previous lemmas, and the results in [5] we get, Theorem 2. ftg and nfs are universally stable in the priority, failure and reliable models. We can show the universal stability of sis in the priority model by following similar arguments to that of Lemma 2.2 in [5] for showing the universal stability of sis in the adversarial model and induction on the number of priorities. Theorem 3. sis is universally stable in the priority, failure and reliable models. The next result states the non universal stability of lis in the failure model, and therefore in all the other models. We show that the graph U 1 of Figure 1 is not stable under lis in the failure model. Putting this result together with Lemma 1 we get,
148
` C. Alvarez et al.
ͽ
;
Í ½
Í ¾
Fig. 1. The two subgraphs characterizing universal stability in the adversarial model (see [3]), and their extensions replacing an edge by a path
Theorem 4. lis is not universally stable in the failure, reliable and priority models. Finally, we consider universal stability of protocols in the variable priority model. We show that the graph U 1 of Figure 1 is not stable under any greedy protocol in the variable priority model. Theorem 5. There is no greedy protocol universally stable in the variable priority model
4
Stability under a Protocol
In this section we analyze the complexity of the problem of deciding whether a given network G is stable under a fixed protocol. Few results are known for this problem. Before formally stating our results, we need to introduce some graph theoretical definitions. We will consider the following subdivision operations over digraphs: – The subdivision of an arc (u, v) in a digraph G consists in the addition of a new vertex w and the replacement of (u, v) by the two arcs (u, w) and (w, v). – The subdivision of a 2-cycle (u, v), (v, u) in a digraph G consists in the addition of a new vertex w and the replacement of (u, v), (v, u) by the arcs (u, w), (w, u), (v, w) and (w, v). Given a digraph G, E (G) denotes the family of digraphs formed by G and all the digraphs obtained from G by successive arc or 2-cycle subdivisions. Given a family of digraphs F, S(F) denotes the family of digraphs that contain a graph in F as a subgraph. Figure 1 provides the two basic graphs needed to characterize universal stability, and the shape of the extensions of those graphs. This basic family provides the characterization of the stability properties. It is known that a digraph is universally stable in the adversarial model if and only if G ∈ / S(E(U 1 ) ∪ E(U 2 )) [3] . The same property characterizes network stability under ntg-lis [3] and ffs [2]. It is also known that, for a given digraph G, checking whether G ∈ / S(E(U 1 ) ∪ E(U 2 )) can be done in polynomial time [3]. Further results for undirected graphs and other variations can be found in [5] and [4]. Nothing is known about the complexity of deciding stability in the adversarial model for any other queueing policy. In the following we will provide a similar characterization of stability in the failure model under fifo and lis.
Adversarial Models for Priority-Based Networks
4.1
149
FIFO Stability under the Failure Model
Much effort have been devoted to study stability and instability properties of fifo recently. The fifo protocol was shown not to be universally stable [5]. A network-dependent absolute constant is provided in [12] such that fifo is stable against any adversary with smaller injection rate. A lower bound of 0.749 for the instability is calculated in [13]. This bound was decreased to 0.5 [15]. In [11] it is shown that fifo is stable if the injection rate is smaller than 1/(d − 1). Recently, it has been proved that fifo can become unstable at arbitrarily low injections rates [8,14]. We show that the two basic graphs given in Figure 1, as well as their extensions, are not stable under fifo in the failure model. As a more general result, for network U 2 we can show instability in the adversarial model. Lemma 4. Any graph in S(E(U 1 ) ∪ E(U 2 )) is not stable under fifo in the failure model. As we have pointed out before, all networks G ∈ / S(E(U 1 ) ∪ E(U 2 )) are universally stable in the adversarial model. Taking into account that if a network has an unstable subnetwork it is also unstable we get the following result. Theorem 6. Let G be a digraph, the pair (G, fifo) is stable in the failure model if and only if G is universally stable in the adversarial model. A corollary of this result is the equivalence between fifo stability in the failure model and universal stability in the adversarial model. Furthermore, as instability in the failure model implies instability in the priority and reliable models, the characterization of fifo stability remains the same in the priority and reliable models. Observe also that stability under fifo can be checked in polynomial time for the failure, priority and reliable models. 4.2
LIS Stability under the Failure Model
The lis protocol gives priority to the packet that was longer in the system, i.e., that joined the network earlier. In [5], the lis protocol was shown to be universally stable in the adversarial model, with O(b/(1 − r)d ) queue size per edge and delay of the packets in the order O(b/(1 − r)d ). However, as we have shown the protocol is not universally stable in the failure model. We proceed as in the case of fifo by showing, respectively, the instability of the basic graphs given in Figure 1 and their extensions. Lemma 5. Any graph in S(E(U 1 )∪E(U 2 )) is not stable under lis in the failure model. Therefore, as in the case of fifo, we have Theorem 7. A digraph G is stable under lis in the failure model if and only if G is universally stable in the adversarial model.
150
4.3
` C. Alvarez et al.
The Variable Priority Model
For the variable priority model the situation is simpler. It is easy to adapt the lis instability proofs for U 1 , U 2 and their extensions. This together with Theorem 1 gives the following result. Theorem 8. Let P be any greedy protocol. A digraph G is stable under P in the failure model if and only if G is universally stable in the adversarial model.
5
Conclusions and Open Problems
We have proposed several variations on the adversarial model to cope with packet priorities and link failures. We have studied universal stability from the point of view of both, the network and the queueing policy. We have also addressed the complexity of deciding stability under a fixed protocol. We have shown that in the adversarial, failure, reliable, priority and variable priority models, the set of networks that are universally stable remains the same. The models present a different behavior with respect to the universal stability of protocols, since lis is universally stable in the adversarial model, but it is not universally stable in the other models. In contrast, we have shown that there are no universally stable protocols for the variable priority model. We have proposed a new and natural way to model the behavior of queueing systems in dynamic networks. Our results compared to the slowdown models introduced in [9] show that the power of an adversary in the failure and in the dynamic slowdown model is quite similar. In both cases the lis protocol is not universally stable. However the static slowdown model is less powerful than the failure model as lis remains universally stable [9]. The argument used in the proof of Theorem 4.1 in [9] can be used to show how to construct an adversary in the variable priority model that simulates an adversary in the dynamic slowdown model. It would be of interest to find constructions, similar to those given in Lemmas 2 and 3 to relate the power of the slowdown and failure models without changing the protocol. Regarding the dynamic capacity model, the authors frequently use the trick of injecting c − ce (t) dummy packets which only need to traverse link e. This can be done without violating the load condition for a network with static capacity c provided that ce (t) > 0 (see Theorems 3.3 and 3.4 [9]). It will be of interest to analyze the case with zero capacities. It remains as an open problem to show the existence of a protocol that is universally stable in the failure model but it is not in the priority model. All the already known characterizations of stability under a protocol are equivalent to universal stability in the adversarial model, even in the variable priority model. It is an interesting open question to know whether there is any protocol P, not universally stable, for which there are networks that are not universally stable but that are stable under P. Finally let us point that deciding stability under FIFO in the adversarial model is open, and that also nothing is known about characterizations of stability under lifo.
Adversarial Models for Priority-Based Networks
151
References ` 1. C. Alvarez, M. Blesa, J. D´ıaz, A. Fern´ andez and M. Serna. Adversarial models for priority-based networks. Technical Report LSI-03-25-R, Software department, Universitat Polit`ecnica de Catalunya, 2003. ` 2. C. Alvarez, M. Blesa, J. D´ıaz, A. Fern´ andez and M. Serna. The complexity of deciding stability under ffs in the adversarial model. Technical Report LSI-03-16R, Software department, Universitat Polit`ecnica de Catalunya, 2003. ` 3. C. Alvarez, M. Blesa, and M. Serna. A characterization of universal stability in the adversarial queueing model. Technical Report LSI-03-27-R, Software department, Universitat Polit`ecnica de Catalunya, 2003. ` 4. C. Alvarez, M. Blesa, and M. Serna. Universal stability of undirected graphs in the adversarial queueing model. In 14th ACM Symposium on Parallel Algorithms and Architectures (SPAA’02), pages 183–197, Winnipeg, Canada, August 2002. ACM Press New York, USA. 5. M. Andrews, B. Awerbuch, A. Fern´ andez, J. Kleinberg, T. Leighton, and Z. Liu. Universal stability results for greedy contention–resolution protocols. Journal of the ACM, 48(1):39–69, 2001. 6. E. Anshelevich, D. Kempe, and J. Kleinberg. Stability of load balancing algorithms in dynamic adversarial systems. In 34th. ACM Symposium on Theory of Computing (STOC’02), pages 399–406, 2002. 7. B. Awerbuch, P. Berenbrink, A. Brinkmann, and C. Scheideler. Simple routing strategies for adversarial systems. In 42th. IEEE Symposium on Foundations of Computer Science (FOCS’01), pages 158–167, 2001. 8. R. Bhattacharjee and A. Goel. Instability of FIFO at arbitrarily low rates in the adversarial queueing model. Technical Report 02-776, Department of Computer Science, University of Southern California, Los Angeles, USA, 2002. 9. A. Borodin, R. Ostrovsky, Y. Rabani. Stability Preserving Transformations: Packet Routing Networks with Edge Capacities and Speeds. In ACM-SIAM Symposium on Discrete Algorithms (SODA’01), pages 601–610, 2001. 10. A. Borodin, J. Kleinberg, P. Raghavan, M. Sudan, and D. Williamson. Adversarial queueing theory. Journal of the ACM, 48(1):13–38, 2001. 11. Charny, A. and Le Boudec, J.-Y. Delay Bounds in a Network With Aggregate Scheduling In Proc. First International Workshop on Quality of future Internet Services. Berlin, Germany, 2000. 12. J. Diaz, D. Koukopoulos, S. Nikoletseas, M. Serna, P. Spirakis, and D. Thilik´ os. Stability and non-Stability of the FIFO Protocol. In 13th annual ACM Symposium on Parallel Algorithms and Architectures (SPAA’01), pages 48–52, 2001. 13. D. Koukopoulos, M. Mavronicolas, S. Nikoletseas, and P. Spirakis. On the stability of compositions of universally stable, greedy contention-resolution protocols. In D. Malkhi, editor, Distributed Computing, 16th International Conference, volume 2508 of Lecture Notes in Computer Science, pages 88–102, Springer. 2002. 14. D. Koukopoulos, M. Mavronicolas and P. Spirakis. FIFO is unstable at arbitrarily low rates. ECCC, TR-03-16, 2003. 15. Z. Lotker, B. Patt-Shamir, and A. Ros´en. New stability results for adversarial queuing. In 14th ACM Symposium on Parallel Algorithms and Architectures (SPAA’02), pages 175–182, Winnipeg, Canada, 2002. 16. A. Ros´en. A note on models for non-probabilistic analysis of packet switching networks. Information Processing Letters, 84:237–240, 2002.
On Optimal Merging Networks Kazuyuki Amano and Akira Maruoka Graduate School of Information Sciences, Tohoku University Aoba 05, Aramaki, Sendai 980-8579, Japan {ama,maruoka}@ecei.tohoku.ac.jp
Abstract. We prove that Batcher’s odd-even (m, n)-merging networks are exactly optimal for (m, n) = (3, 4k + 2) and (4, 4k + 2) for k ≥ 0 in terms of the number of comparators used. For other cases where m ≤ 4, the optimality of Batcher’s (m, n)-merging networks has been proved. So we can conclude that Batcher’s odd-even merge yields optimal (m, n)merging networks for every m ≤ 4 and for every n. The crucial part of the proof is characterizing the structure of optimal (2, n)-merging networks.
1
Introduction
A comparator network, which consists of comparators, has been widely investigated as a model of oblivious comparison-based algorithm. A comparator is a 2-input 2-output gate, where one output computes the minimum of the two inputs and the other output computes the maximum (see Fig. 1). x1
1 0 0 1 0 1
x2 y1
x
1 0 0 1
min{ x , y }
1 0 1 0
y2 y3
0 1 1 0 0 1
y4
y
1 0 0 1
max{ x , y }
x3
z1 0 1 1 0 0 1
1 0 0 1 0 1
1 0 1 0 1 0 0 1
00 11 11 00 00 11 11 00 11 00
11 00 11 00 00 11 00 11 0 1 00 11 0 1 00 11 0 1 00 11 00 11 00 00 11 11 00 11 00 11 00 11 00 11 00 11 00 11
z2 z3 z4 z5 z6 z7
Fig. 1. Left: a comparator, Right: a (3, 4)-merging network
An (m, n)-merging network is a comparator network that merges m elements x1 ≤ · · · ≤ xm with n elements y1 ≤ · · · ≤ yn to form the sorted sequence z1 ≤ · · · ≤ zm+n . A merging network is usually drawn as in Fig. 1. Batcher [2] proposed odd-even merge, which gives an (m, n)-merging network with the least number of comparators used known up to the present. Let C(m, n) be the number of comparators used in the odd-even merge for m and n. The function C(m, n) is given(see [4, p.224]) by mn, if mn ≤ 1; C(m, n) = C(m/2, n/2) + C(m/2, n/2) + (m + n − 1)/2, if mn > 1. Let M (m, n) denote the minimum number of comparators in an (m, n)merging network. At present no merging networks have been discovered that B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 152–161, 2003. c Springer-Verlag Berlin Heidelberg 2003
On Optimal Merging Networks
153
are superior to the odd-even merge, and the problem of proving or disproving M (m, n) = C(m, n) for every m and n remains unsolved for over 30 years (see [8] or [4, Exercise 43, p. 241]). We call an (m, n)-merging network that uses M (m, n) comparators as the optimal merging network. There has been considerable effort to determine the exact values of M (m, n). It is clear that M (1, n) = C(1, n) = n. Yao and Yao [8] proved that M (2, n) = C(2, n) = 3n/2. Aigner and Schwarzkopf [1] showed that M (3, n) = C(3, n) = (7n + 3)/4 for n ≡ 0, 1, 3 mod 4. In the same paper, they also stated that M (3, n) = C(3, n) for n ≡ 2 mod 4 but without a detailed proof. Recently, Iwata [3] proved that M (m1 + m2 , n) ≥ M (m1 , n) + M (m2 , n) + m1 + m2 + n − 2)/2,
(1)
for every m1 , m2 ≥ 1 and for every n ≥ 1. As a corollary of this inequality, they showed that M (m, n) = C(m, n) for m = 3, 4 and for n ≡ 0, 1, 3 mod 4. Unfortunately, for n ≡ 2 mod 4, the best lower bounds obtained by Eq. (1) is M (m, n) ≥ C(m, n) − 1 for m = 3, 4. Somewhat interestingly, the case n ≡ 2 mod 4 seems to be the hardest one in determining the exact values of M (m, n) for m = 3, 4. The exact values of M (n, n) for n ≤ 9 have been known [1,7], and the asymptotic behavior of M (m, n) has been also investigated in, e.g., [3,5,6,8]. The main result of the present paper is to show that Batcher’s odd-even merge yields optimal (m, n)-merging networks for every m ≤ 4 and for every n. This is achieved by proving M (3, 4k + 2) = C(3, 4k + 2) (in Section 3), and M (4, 4k + 2) = C(4, 4k + 2) (in Section 4). The crucial part of the proofs of the above results is characterizing the structure of optimal (2, n)-merging networks(Theorem 1), which we describe in Section 2. In addition, our arguments can also be used to determine M (m, n) for certain (m, n)’s with m > 4 such as (m, n) = (5, 8k + 6). This will be discussed in Section 5. In what follows, we call a horizontal line of input element xi (yj ) of an (m, n)merging network line xi (line yj ) for 1 ≤ i ≤ m (1 ≤ j ≤ n, respectively). The line xi is always placed above the line xi+1 for every 1 ≤ i < m, and similarly for yj . We can place lines x1 , x2 , . . . , xm of an (m, n)-merging network interspersed within lines y1 , y2 , . . . , yn in arbitrarily order since, for any two differently interspersed input lines, there is a transformation from an (m, n)-merging network with interspersed input lines into a network with another intersperse lines that preserves the number of comparators used [4, Exercise 16, p.238]. A comparator connecting a line i to a line j is denoted by [i : j]. A comparator is said to be of the form [i : ∗] if it is a comparator [i : j] for some j. Comparator of the form [∗ : j] is defined similarly. A subnetwork of a merging network N consists of a set K of adjacent lines in N with the set of all comparators that connect two lines in K. We sometimes identify a merging network with the set of comparators contained in the network. For a set A, |A| denotes the cardinality of A.
154
2
Kazuyuki Amano and Akira Maruoka
Structure of Optimal (2, n)-Merging Networks
In this section, we characterize the structure of optimal (2, n)-merging networks for even n. This is the key to the proofs of the lower bounds for M (m, n) with m = 3, 4 and we believe that it is interesting in its own right. Put n = 2k. Let A be an optimal (2, n)-merging network consisting of input lines x1 , x2 , y1 , y2 , . . . , yn from top to bottom. The network A contains M (2, n) = 3n/2 = 3k comparators. Consider the behavior of the network A for two input sequences a0 = 0, n + 1, 1, 2, . . . , n and a1 = n + 1, n + 2, 1, 2 . . . , n . Note that the network A sorts a0 and a1 . We also note that if a network sorts a0 and a1 , then it is a (2, n)-merging network (this can be proved by using the zero-one principle [4, p. 224] or see [1, Lemma 1]). Now we divide the set of comparators A into three subsets A0 , A1 and A01 as follows: A0 : the set of comparators that change the content of a0 , but not of a1 , A1 : the set of comparators that change the content of a1 , but not of a0 , A01 : the set of comparators that change the contents of a0 and a1 . x1 x2 y1 y2 y3 y4 y5 y6
1
1 0 0 1 0 1 0 1 0 0 1 01 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 11 00 1 0 0 1 1 0 11 00 1 0 01 0 0 1 00 11 0 1 0 1 00 11 0 1 0 1 0 1 00 11 0 1 0 1 0 1 1 00 11 0 1 0 1 0 1 00 11 0 1 0 1 0 1 00 11 0 1 0 1 0 1 0 1 011 0 0 1 00 11 00 11 0 1111111111111111 0000000000000000 0 1 0 00 1 11 0 1 00 11 00 11 0 1 0 1 0 1 0 1 0 1 0 00 1 0 1 0 1 01 1 1111111111111111 0000000000000000 11 0 0 1 0 1 0 1 0 1 0 1 01 1 0 1 0 0 1 1111111111111111 0000000000000000 11 00 11 00 0 1 11 00
(a)
x1 x2 y1 y2 y3 y4 y5 y6
1
1
11 00 00 11 0 1 00 11 00 11 0 1 0 0 1 01 1 0 1 0 1 0 1 0 1 0 1 0 1 11 00 0 1 11 00 0 1 0 1 0 1 0 1 0 1 0 1 00 11 0 1 00 11 0 1 00 11
011 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 0 011 00 01 00 11 0 0 1 0 1 1 011 1 00 11 00 11 0 1 0 1 0 1 0 00 00 0 11 1 0 1 0 1 00 11 1 0 11 1 0 1 00 0 1 0 11 1 0 1 00 0 1 0 1 0 1 0 1 0 1 00 11 0 1 1111111111111111 0000000000000000 11 00 0 1 00 11 0 1 0 1 1 0 0 1 1111111111111111 0000000000000000 11 00 0 1 0 1 0 1 0 1 1 0 1111111111111111 0000000000000000 11 00 1 0 1 0
(b)
Fig. 2. (a) Batcher’s (2, 6)-merging network; (b) a (2, 6)-merging network that uses the same number of comparators as Batcher’s network. A comparator labeled “0” (“1” and “01”) is a member of A0 (“A1 ” and “A01 ”, respectively)
Note that A0 , A1 and A01 are mutually disjoint, and A0 ∪ A1 ∪ A01 = A since A is optimal. In both networks shown in Fig. 2, the three sets A0 , A1 and A01 have the same size (,i.e., |A0 | = |A1 | = |A01 | = 3). Moreover, we can notice that every comparator in A0 has odd “length” and every comparator in A1 ∪ A01 has even “length”. Formally, the length of a comparator c = [i : j] is defined to be (j − i) where we label the input lines with 0, 1, 2, . . . , from top to bottom. Note that in the network A, a comparator [yi : yj ] has length (j − i) and [xi : yj ] has length j + (2 − i). In the following, we prove that these conditions are satisfied by any optimal (2, 2k)-merging network. The statements (iv) and (v) of Theorem 1 are crucial to the proofs of all our lower bounds. Theorem 1. For every k ≥ 1 and for every optimal (2, 2k)-merging network A, which consists of lines x1 , x2 , y1 , . . . , y2k , the following are true: (i) |A0 | = |A1 | = |A01 | = k. (ii) For every 1 ≤ i ≤ 2k, there is a unique comparator in A0 ∪ A01 which is of the form [∗ : yi ]. (iii) For every 1 ≤ i ≤ 2k, there is a unique comparator in A1 ∪ A01 which is of the form [∗ : yi ].
On Optimal Merging Networks
155
(iv) Every comparator in A01 ∪ A1 has even length. (v) Every comparator in A0 has odd length. Proof (of (i), (ii) and (iii), Theorem 1). Recall that n = 2k. Let A be an optimal (2, 2k)-merging network. Obviously, a network consisting of the set of comparators A0 ∪ A01 sorts a0 . For any network sorting a0 , there are precisely n comparators that change the content of a0 and there is a unique comparator which is of the form [∗ : yj ] for every 1 ≤ j ≤ n. (This was observed by Aigner and Schwarzkopf [1, Section 3], and a similar observation was made by Yao and Yao [8, Lemma 1].) This implies (ii) of Theorem 1, and |A0 | + |A01 | = n = 2k. Hence we have |A1 | = 3k − 2k = k. Let (a0 )j ((a1 )j ) be the content of the line j after the h-th comparison in A when a0 (a1 , respectively) is given to A as input. Let us say that a line j is split after the h-th comparison if (a0 )j = (a1 )j holds. We define dh to be the number of split lines after the h-th comparison. Thus, at the input d0 = 2, and at the end d3k = n + 2, and hence d3k − d0 = n. Since every comparator raises the value of dh at most 1 and a comparator in A01 does not change the value of dh , we have |A0 | + |A1 | ≥ n = 2k. This implies |A0 | ≥ k, since |A1 | = k. Here we show that, for every comparator c of the form [∗ : yj ] in A0 , there is another comparator of the form [∗ : yj ] in A1 that lies to the left of c. If this is proven, then k = |A1 | ≥ |A0 | ≥ k, and hence k = |A1 | = |A0 | = |A01 | (that is, (i) of Theorem 1.). Moreover, this and (i) and (ii) of Theorem 1 imply (iii) of the theorem. Suppose that a comparator c = [i : yj ] is in A0 . It is easy to check that we must have (a0 )yj < (a0 )i ≤ (a1 )i < (a1 )yj at the input of c. Thus, the line yj must be split before encountering the comparator c. Since the initial content of the line yj is (j, j), the line yj must have been part of a previous comparator. Since the content of yj is greater than or equal to j at any stage, the first comparator changing the content (j, j) is of the form [∗ : yj ]. Moreover this comparator must be in the set A1 since c is in A0 and (ii) of Theorem 1. This completes the proof of (iii) of the theorem.
Proof (of (iv), Theorem 1). Let us focus on the content of a1 in the network A. We label the lines with 1, 2, . . . , n + 2 from top to bottom. For any stage in A, the differential of line j, denoted by ej , is defined to be (a1 )j − j and the differential sequence is defined to be e1 , e2 , . . . , en+2 . Note that the differential sequence is n, n, −2, . . . , −2 at the input and is 0, 0, . . . , 0 at the output. If there is a comparator of odd length in A01 ∪ A1 , then there must be a line whose differential is an odd. (This is proved by focusing on the outputs of the first such comparator.) So to prove (iv), it is sufficient to show that there are no lines whose differential d is odd in the network A. We shall prove this by induction on t where d = 2t + 1. Let c = [i : j] ∈ A01 ∪ A1 be a comparator whose length is l. Suppose that (ei , ej ) is equal to (α, β) at the input of c. By (iii) of Theorem 1 and the first comparator changing the content of line j is of the form [∗ : yj ], we have β = −2. Since the comparator c swaps the two inputs, we have i + α > −2 + j, and this implies α + 2 > j − i = l ≥ 1. Hence α ≥ 0. So every comparator in A01 ∪ A1
156
Kazuyuki Amano and Akira Maruoka
decreases the number of negative entries in a differential sequence by at most 1. Because it contains precisely n = |A01 ∪ A1 | negative entries at the input, every comparator in A01 ∪ A1 must decrease the number of negative entries in a sequence by 1. The differential (ei , ej ) is changed from (α, −2) to (−2 + l, α − l) by the comparator c. Hence, for every comparator c = [i : j] ∈ A01 ∪ A1 , the differential (ei , ej ) = (α, −2) before c must satisfy α ≥ l ≥ 2. This proves the base case (t = 0). For the induction step, suppose that (ei , ej ) = (2t + 1, −2) at the input of some comparator c = [i : j] ∈ A01 ∪ A1 whose length is l. The differentials of the outputs of c are −2 + l and 2t + 1 − l. Since 2 ≤ l ≤ 2t + 1, one of them is odd and is smaller than or equal to 2(t − 1) + 1. This contradicts the induction hypothesis. (End of the proof of (iv) of Theorem 1.)
Proof (of (v), Theorem 1). To prove (v) of Theorem 1, we will show that the number of comparators having odd length is greater than or equal to that having even length for any network of size n that sorts a0 . This implies (v) of Theorem 1 because (a) A0 ∪ A01 sorts a0 , (b) |A0 | = |A01 | = n/2 (Theorem 1, (i)) and (c) every comparator in A01 has even length(Theorem 1, (iv)). To show this, we analyze an arbitrary network with n comparisons sorting a = n + 1, 1, 2, . . . , n , which consists of the lines 1, 2, . . . , n + 1. Aigner and Schwarzkopf [1] observed that, for every such network, the content a1 , . . . , an+1 after the r-th comparison can be described as follows: The set of lines {1, 2, . . . , n + 1} is uniquely divided into groups F1 |F2 | · · · |Fr+1 from top to bottom such that (i) i ∈ Fk , j ∈ Fl , k < l ⇒ ai < aj , and (ii) if Fk = {fk , fk + 1, . . . , fk+1 − 1} then afk +1 < · · · < afk+1 −1 < afk . In other words, within each group the top element is the largest, with the others appearing in their natural order. A comparator [i : j] changes the content of a if and only if i and j are in a certain group Fk with i = fk < j ≤ fk+1 − 1. By this comparator the set Fk splits into two groups Fku = {fk , fk + 1, . . . , j − 1} and Fkl = {j, j + 1, . . . , fk+1 − 1} satisfying (i) and (ii) when we replace Fk by Fku and Fkl . For a network M , let o(M ) (e(M )) be the number of comparators having odd length (even length, respectively) in M . Let T (k) be the minimum value of o(Ak ) − e(Ak ) where Ak ranges over all networks with input lines 1, 2, . . . , k + 1 consists of k comparators that sorts a sequence a1 , a2 , . . . , ak+1 with a2 < a3 < · · · < ak+1 < a1 . Then T (k) can be expressed recursively as follows: T (k) = min {(−1)i−1 + T (i − 1) + T (k − i)}. 1≤i≤k
(2)
We are going to show T (k) = 0 for every even k and T (k) = 1 for every odd k by the induction on k. The base cases T (0) = 0 and T (1) = 1 are obvious. If k is even, then by Eq. (2) and the induction hypothesis we have T (k) = min −1 + min {T (k1 )} + min {T (k2 )}, k1 :k1
k2 :k2
= min{−1 + 1 + 0, 1 + 0 + 1} = 0.
On Optimal Merging Networks
Similarly, if k is odd, then we have T (k) = min −1 + min
{T (k1 )} +
k1 :k1
1+
min
{T (k1 )} +
k1 :k1
157
{T (k2 )}, {T (k2 )}
min
k2 :k2
min
k2 :k2
= min{−1 + 1 + 1, 1 + 0 + 0} = 1. This proves the induction step and completes the proof of (v) of the theorem.
3
Lower Bounds for M (3, n)
In this section, we give a detailed proof for M (3, n) = C(3, n) for every n ≡ 2 mod 4 based on the results described in the previous section. Note that the optimality of Batcher’s odd-even merge has been proved for n ≡ 2 mod 4 [1,3]. Theorem 2. For every k ≥ 0, M (3, 4k + 2) = C(3, 4k + 2) = 7k + 5. Put n = 4k + 2. It was shown that 7k + 4 ≤ M (3, n) ≤ C(3, n) = 7k + 5. Throughout this section, suppose for a contradiction that there exists an optimal (3, 4k + 2)-merging network consisting of 7k + 4 comparators with input lines x1 , x2 , y1 , . . . , y4k+2 , x3 . First we show that optimal (2, n)- and (1, n)-merging networks must be “embedded” into the network N . To prove this, we shall need some notations and lemmas introduced by Iwata [3]. For a line z and a comparator c that is connected to line z, if there is not any comparator positioned to the left of c as far as line z is concerned, then we say that c is the leftmost comparator w.r.t. line z. If line z is an upper endline (a lower endline) of c then we call c by downward leftmost (upward leftmost, respectively) w.r.t. line z. For example in Fig. 1, the comparator [y2 : y4 ] is the upward leftmost comparator w.r.t. line y4 , the comparator [x2 : y2 ] is the downward leftmost comparator w.r.t. line x2 and is also the upward leftmost comparator w.r.t. line y2 . Consider a subnetwork NA of N consisting of the top three lines x1 , x2 , y1 . Obviously, NA is a (2, 1)-merging network and |NA | ≥ 2. Similarly, a subnetwork NB consisting of the bottom two lines yn , x3 is a (1, 1)-merging network and |NB | ≥ 1. Let NU (ND ) be the set of upward (downward, respectively) leftmost comparators w.r.t. line yi for some i ∈ {2, . . . , n − 1}. By the optimality of N , NU and ND are disjoint. Let A be a network after deletion of the comparators from N that belong to NB and to ND . Similarly let B be a network constructed from N after deletion of the comparators of NA and of NU . The following lemma is proved by Iwata [3]. Lemma 3 (Lemma 2.2 in [3]). The network A acts as a (2, n)-merging network, which consists of lines x1 , x2 , y1 , y2 , . . . , yn and |A| ≥ M (2, n). Similarly, the network B acts as a (n, 1)-merging network, which consists of lines y1 , y2 , . . . , yn , x3 and |B| ≥ M (1, n).
158
Kazuyuki Amano and Akira Maruoka
The next lemma says that the networks A and B are in fact optimal. This easily follows from Lemma 3 and we omit the proof due to space limitations. Lemma 4. Both of the networks A and B is optimal, i.e., |A| = M (2, n) = 6k + 3 and |B| = M (1, n) = 4k + 2. Moreover, |NA | = 2, |NB | = 1, |NU | = 3k, |ND | = k and |A ∩ B| = 3k + 1, and every comparator of N belongs to exactly one of NA , NB , NU , ND or of A ∩ B.
Since the network A is an optimal (2, n)-merging network, we can apply Theorem 1 to A. Let A0 , A1 and A01 be subsets of A defined as in Section 2. Since a network consisting of the set of comparators A0 ∪ A01 (B) acts as an optimal (1, n)-merging networks on lines x2 , y1 , . . . , yn (y1 , . . . , yn , x3 , respectively), the following fact is obvious. Fact 5. For every 1 ≤ i ≤ n, the following are true: (i) There is a path from x2 to yi in A0 ∪ A01 , (ii) There is a unique comparator in A0 ∪ A01 which is of the form [∗ : yi ], (iii) There is a path from x3 to yi in B, and (iv) There is a unique comparator in B which is of the form [yi : ∗].
From this fact we can easily prove the following: Lemma 6. For every 1 ≤ i ≤ n, there is at most one comparator in (A0 ∪A01 )∩ B that connects to line yi . Proof. Suppose for a contradiction that there exist two comparators in (A0 ∪ A01 )∩B that connect to line yi for some i. By (ii) and (iv) in Fact 5, one of them is [yk : yi ] for some k < i and the other is [yi : yj ] for some i < j. Without loss of generality, we can assume that the comparator [yk : yi ] is left to the comparator [yi : yj ]. Since (iv) of Fact 5, there exist no paths from x3 to yk in B, which contradicts (iii) of Fact 5.
Proof (of Theorem 2). First we claim that |A0 ∩ B| = 2k and |A01 ∩ B| = 1. By similar arguments as in the proof of (iii) of Theorem 1, every comparator in A0 is not leftmost upward, hence A0 ∩ NU = φ. Since |A0 | = 2k + 1 ((i) of Theorem 1), |A0 ∩ NA | ≤ 1 and B = N \(NA ∪ NU ), we have |A0 ∩ B| ≥ 2k. It is easy to check that a comparator of the form [∗ : yn ] in A0 ∪ A01 must be in A01 , and this comparator is also in B since it cannot belong to NA and to NU . Therefore |A01 ∩ B| ≥ 1. On the other hand, Lemma 6 implies |(A0 ∪ A01 ) ∩ B| ≤ n/2 = 2k + 1, and this implies the claim. For a set of comparator M , let C(M ) be the set of indices i such that there is a comparator of the form [∗ : yi ] or of the form [yi : ∗] in M . By the above claim and Lemma 6, for every 1 ≤ i ≤ 4k + 2, there is a unique comparator which is of the form [yi : ∗] or [∗ : yi ] in (A0 ∪A01 )∩B, i.e., C((A0 ∪A01 )∩B) = {1, 2, . . . , 4k+2}. On the other hand, since every comparator in A0 has odd length ((v) of Theorem 1), the numbers of even and odd numbers in C(A0 ∩ B) are equal to 2k. Since every comparator in A01 has even length ((iv) of Theorem 1), C(A01 ∩B) consists of two even numbers or of two odd numbers. Therefore C((A0 ∪A01 )∩B) consists of 2k even and 2k + 2 odd numbers or of 2k + 2 even and 2k odd numbers. This contradicts C((A0 ∪A01 )∩B) = {1, 2, . . . , 4k +2} since {1, 2, . . . , 4k +2} consists of 2k + 1 even and 2k + 1 odd numbers. This completes the proof.
On Optimal Merging Networks
4
159
Lower Bounds for M (4, n)
Batcher’s (4, n)-merging networks use 2n + 1 comparators for n ≡ 0 mod 4 and 2n + 2 comparators for n ≡ 0 mod 4. In this section, we completes the proof that Batcher’s (4, n)-merging networks are “exactly” optimal for every n ≥ 1 by showing: Theorem 7. For every k ≥ 0, M (4, 4k + 2) = C(4, 4k + 2) = 8k + 6. The outline of the proof is similar to that of the proof for the case M (3, 4k+2): Suppose for a contradiction that there exists an optimal (4, 4k + 2)-merging network N consisting of C(4, 4k + 2) − 1 = 8k + 5 comparators with input lines x1 , x2 , y1 , . . . , y4k+2 , x3 , x4 . First we show that two optimal (2, 4k + 2)-merging networks must be “embedded” into the network N , and then we show that this is impossible by the structure of optimal (2, 4k + 2)-merging networks. Put n = 4k + 2. As in the previous section, let NA (NB ) be a subnetwork of N consisting of the top three lines x1 , x2 , y1 (the bottom three lines yn , x3 , x4 , respectively). Let NU (ND ) be the set of leftmost upward (downward, respectively) comparators in N w.r.t. line yi for some i ∈ {2, . . . , n − 1}. Let A (B) be a network constructed from N after deletion of the comparators both in NB and in ND (both in NA and in NU , respectively). By similar arguments to the proof of the lower bound for M (3, n), we can prove that both of the networks A and B acts as an optimal (2, n)-merging network. The proof of Lemma 8 is similar to that of Lemma 4 and is omitted due to space constraints. Lemma 8. Both of the network A and B behaves like an optimal (2, 4k + 2)merging network, i.e., |A| = |B| = M (2, 4k + 2) = 6k + 3. Moreover, |NA | = |NB | = 2, |NU | = |ND | = 2k and |A ∩ B| = 4k + 1, and every comparator of N belongs to exactly one of NA , NB , NU , ND or of A ∩ B.
Since the networks A and B are shown to be optimal (2, n)-merging networks, we can apply Theorem 1 to both networks. Lemma 9. NA consists of the two comparators [x1 : y1 ] ∈ A1 and [x2 : y1 ] ∈ A0 . Proof. By Lemma 8, NA behaves like an optimal (2, 1)-merging network consisting of lines x1 , x2 , y1 . There are two different (2, 1)-merging networks that use 2 comparators (Fig. 3). If we assume that NA is the network shown in Fig. 3 (b), then the comparator [x1 : x2 ] must be in A1 and this contradicts (ii) of Theorem 1. Hence NA must be the network shown in Fig. 3 (a) and the lemma follows easily.
We divide the set of comparators A ∩ B into two subsets (A ∩ B)E and (A ∩ B)O where (A ∩ B)E ((A ∩ B)O ) consists of all comparators having even length (odd length, respectively). Lemma 10. For the network A, the following are true: (i) A0 consists of a comparator [x2 : y1 ] in NA and 2k comparators in (A ∩ B)O , (ii) A01 ∪ A1
160
Kazuyuki Amano and Akira Maruoka x1
00 11 11 00 00 11
0 1 1 0 0 1
x1
x2
11 00 00 11 00 11
x2
1 0 0 1 0 1
y1
11 00 11 00 11 00 00 11
y1
1 0 1 0
(a)
1 0 0 1 0 1
(b)
Fig. 3. (2, 1)-merging networks using 2 comparators
consists of a comparator [x1 : y1 ] in NA , 2k comparators in NU and 2k + 1 comparators in (A ∩ B)E , and (iii) For every 1 ≤ j ≤ 4k + 2, there is a unique comparator in A01 ∪ A1 which is of the form [∗ : yj ]. Proof. By similar arguments used in the proof of (iii) of Theorem 1, every comparator in A0 is not a member of NU , and hence NU ⊆ A01 ∪ A1 . Since A = (A ∩ B) ∪ NA ∪ NU , the statements (i) and (ii) of Lemma 10 follow from Theorem 1 and Lemma 9. The statement (iii) is identical to (iii) of Theorem 1.
By applying all arguments for the network A “upside down”, we can obtain a similar result to Lemma 10 for the network B. Let b0 = 1, 2, . . . , n, 0, n + 1 and b1 = 1, 2, . . . , n, −1, 0 . We divide the set of comparators B into three subsets B0 , B1 and B01 as follows: B0 : the set of comparators that change the content of b0 , but not of b1 , B1 : the set of comparators that change the content of b1 , but not of b0 , B01 : the set of comparators that change the contents of b0 and b1 . The next lemma is proved by symmetry. Lemma 11. For the network B, the following are true: (i) B0 consists of a comparator [y4k+2 : x3 ] in NB and 2k comparators in (A ∩ B)O , (ii) B01 ∪ B1 consists of a comparator [y4k+2 : x4 ] in NB , 2k comparators in ND and 2k + 1 comparators in (A ∩ B)E , (iii) For every 1 ≤ j ≤ 4k + 2, there is a unique comparator in B01 ∪ B1 which is of the form [yj : ∗].
Proof (of Theorem 7). By Lemmas 10 and 11, we have (A01 ∪ A1 )\(NA ∪ NU ) = (A ∩ B)E = (B01 ∪ B1 )\(NB ∪ ND ).
(3)
For a set of comparators M , let L(M ) (U (M )) be the set of indices i such that there is a comparator of the form [∗ : yi ] ([yi : ∗], respectively) in M . By Eq. (3) and Lemma 10, we have L((A ∩ B)E ) = {2, . . . , 4k + 2}\L(NU ), and by Eq. (3) and Lemma 11, we have U ((A ∩ B)E ) = {1, . . . , 4k + 1}\U (ND ). By the definition of leftmost comparator and Lemma 8, we have |L(NU )| = |U (ND )| = 2k, L(NU ) ∩ U (ND ) = ∅ and L(NU ) ∪ U (ND ) = {2, . . . , 4k + 1}. Suppose that L(NU ) contains d even numbers. Then U (ND ) contains 2k − d even numbers, L((A ∩ B)E ) contains 2k + 1 − d even numbers and U ((A ∩ B)E ) contains 2k − (2k − d) = d even numbers. On the other hand, since every comparator in (A∩B)E has even length, the numbers of even numbers in L((A∩ B)E ) and that in U ((A ∩ B)E ) must be the same. This contradicts the fact that 2k + 1 − d = d for every integer d.
On Optimal Merging Networks
5
161
Some More Results and Concluding Remarks
Our theorem on the structure of optimal (2, n)-merging networks described in Section 2 can also be used to determine M (m, n) for some m > 4 such as (m, n) = (5, 8k + 6). Note that Iwata [3] has shown that M (5, n) = C(5, n) for n ≡ 0, 1, 5 mod 8 and M (m, n) = C(m, n) for m = 6, 7, 8 and n ≡ m mod 8. Theorem 12. For every k ≥ 0, M (5, 8k + 6) = C(5, 8k + 6) = 17k + 16. Proof (sketch). Suppose for a contradiction that there is a (5, 8k + 6)-merging network N consisting of lines x1 , x2 , y1 , . . . , y8k+6 , x3 , x4 , x5 that uses 17k + 15 comparators. Let NA (NB ) be a subnetwork of N of the top three lines x1 , x2 , y1 (the bottom four lines y8k+6 , x3 , x4 , x5 . Let NU (ND ) be the set of upward (downward, respectively) leftmost comparators w.r.t line yi for some i ∈ {2, . . . , 8k+5}. By similar calculations in the proof of Lemma 4, we have |A| = M (2, 8k + 6), |B| = M (3, 8k + 6), |NA | = 2 and |NB | = 3. This implies that every comparator of N belongs to exactly one of NA , NB , NU , ND or of A ∩ B. Now we consider a subnetwork NB of N consisting of the bottom five lines y8k+5 , y8k+6 , x3 , x4 , x5 . Since NB forms (2, 3)-merging network, we have |NB | ≥ 5. This implies that there are at least two comparators in NB of the form [y8k+5 : ∗]. Since every comparator of N belongs to exactly one of the sets NA , NB , NU , ND or of A ∩ B, there must be a comparator [y8k+5 , y8k+6 ] in A ∩ B. (One possible comparator of the form [y8k+5 : ∗] in NB may be in ND for line y8k+5 .) By Theorem 1, this must be in A0 and there is another comparator of the form [∗ : y8k+6 ] in A1 . On the other hand, since M (2, 8k + 6) = M (2, 8k + 5) + 1, there is exactly one comparator of the form [∗ : y8k+6 ] in A, a contradiction. Finally, we remark that the arguments described in Section 4 can also be used to characterize the structure of optimal (4, 4k)-merging networks.We believe that this would help to determine M (m, n) for higher values of m and n.
References 1. M. Aigner, O. Schwarzkopf, “Bounds of the Size of Merging Networks”, Discrete Applied Mathematics 61 (1995) 187–194. 2. K.E. Batcher, “Sorting Networks and Their Applications”, Proc. AFIPS 1968 SJCC 32 (1968) 307–314. 3. S. Iwata, “Lower Bounds for Merging Networks”, Information and Computation 168 (2001) 187–205. 4. D.E. Knuth, The Art of Computer Programming Vol. 3: Sorting and Searching, 2nd ed., Addison-Wesley (1998). 5. T. Leighton, Y. Ma, T. Suel, “On Probabilistic Networks for Selection, Merging, and Sorting”, Proc. 7th Symp. Parallel Algorithms and Architectures (1995) 106–118. 6. P.B. Miltersen, M. Paterson, J. Tarui, “The Asymptotic Complexity of Merging Networks”, J. Assoc. Comput. Mach. 43 (1996) 147–165. 7. K. Yamazaki, H. Mizuno, K. Masuda, S. Iwata, “Minimum Number of Comparators in (6,6)-merging Network”, IEICE Trans. Inform. Syst. E83-D (2000) 137–141. 8. A.C. Yao and F.F. Yao, “Lower Bounds of Merging Networks”, J. Assoc. Comput. Mach. 23 (1976) 566–571.
Problems which Cannot Be Reduced to Any Proper Subproblems Klaus Ambos-Spies Ruprecht-Karls-Universit¨ at Heidelberg Department of Mathematics and Computer Science Im Neuenheimer Feld 294, D-69120 Heidelberg, Germany [email protected]
Abstract. For any reducibility ≤r , an infinite set A is called introimmune under r-reducibility if any subset B of A to which A can be rreduced is a finite variant of A. We show that there is a recursive – in fact exponential-time computable – set which is introimmune under polynomial-time bounded Turing reducibility. More generally, there are recursive introimmune sets for all recursively presentable reducibilities. This answers some questions of Cintioli and Silvestri.
1
Introduction
Soare [6] has shown that there is a set A which is not Turing reducible to any of its proper subsets, i.e., for any subset B of A such that A is Turing reducible to B, B is a finite variant of A. Following Cintioli and Silvestri [2] we call such a set introimmune under Turing reducibility or T-introimmune for short. Jockusch [3] has shown that T-introimmune sets are very complicated: Every Tintroimmune set is Turing hard for the class of arithmetical sets. So, in particular, no T-introimmune set can be defined in first order arithmetic. Simpson [5] has improved this observation by showing that T-introimmune sets are even Turing hard for the larger class of the hyperarithmetical sets. Cintioli and Silvestri [2] started the investigation of introimmunity under strong and subrecursive reducibilities. They have shown that for some strong reducibilities, namely for (nondeterministic) many-one reducibility and for conjunctive reducibility there are arithmetical (but necessarily nonrecursive) sets which are introimmune under these reducibilities and they raised the question whether there are recursive (or at least recursively enumerable) sets which are introimmune under some of the common subrecursive reducibilities. In particular they have asked whether there is a recursive set which is introimmune under polynomial-time bounded Turing reducibility (p-T-reducibility for short). Here we answer these questions affirmatively. We show that there is a recursive – in fact exponential time computable – set A which is p-T-introimmune. Furthermore, straightforward modifications of our construction yield recursive sets which are introimmune under any given standard subrecursive reducibility and recursively approximable sets which are introimmune under truth-table reducibility. B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 162–168, 2003. c Springer-Verlag Berlin Heidelberg 2003
Problems which Cannot Be Reduced to Any Proper Subproblems
163
We conclude this introductory section by formally stating the definition of introimmunity and by reviewing some basic facts on this notion. In Section 2 we prove our main theorem, in Section 3 we summarize our further results. We assume the reader to be familiar with the basic concepts of computability and computational complexity theory. Our notation is standard. For unexplained concepts or notation see e.g. Odifreddi [4] and Balcazar et al. [1]. Definition 1 (Cintioli and Silvestri [2]). Let ≤r be any reducibility. A set A is ≤r -introimmune if A is infinite and ∀B ⊆ A
∗
(A ≤r B ⇒ A = B),
(1)
∗
where A = B denotes that the symmetric difference of A and B is finite. For comparing introimmunity for different reducibilities we need the following well known notion. We say that a reducibility ≤r is weaker than a reducibilty ≤r (or that ≤r is stronger than ≤r ) if ∀A, B
(A ≤r B ⇒ A ≤r B)
holds. Then the following is immediate by definition. Proposition 2. Let ≤r and ≤r be reducibilities such that ≤r is weaker than ≤r . Then every ≤r -introimmune set is ≤r -introimmune too. Note that for any unbounded reducibility ≤r which is weaker than manyone reducibility no ≤r -introimmune set is recursive. This follows from the fact that every infinite recursive set A is many-one reducible to any nonempty finite subset B of A. Similarly, for any polynomial-time bounded reducibility ≤pr which is weaker than polynomial-time bounded many-one reducibility, no ≤pr introimmune set is in P. For a more general statement of these observations and some more basic facts on introimmune sets see Cintioli and Silvestri [2].
2
The Main Theorem
Theorem 3. There is a ≤pT -introimmune set A in EXPTIME. Proof. Let {Me : e ≥ 0} be an enumeration of the polynomial-time-bounded deterministic oracle Turing machines such that MeX (x) runs in time ≤ 2|x| for all strings x of length ≥ e (for all e, X). Then it suffices to construct an exponentialtime computable set A satisfying the requirements Pe (= R2e ) : ||A|| ≥ e ∗
Ne (= R2e+1 ) : ∀B (B ⊆ A & A = MeB ⇒ A = B) for all numbers e ≥ 0. Note that the P -requirements ensure that A is infinite while the N -requirements ensure that (1) holds for ≤pT in place of ≤r . So a set A meeting the above requirements is ≤pT - introimmune.
164
Klaus Ambos-Spies
For the sake of our strategy for meeting the N -requirements we ensure that the set A is very sparse: We will ensure that A is contained in the set D = {0δ(n) : n ≥ 0} where δ is the iterated exponential function defined by δ(0) = 0 and δ(n + 1) = 2δ(n) . Note that, by polynomial-time honesty of δ, the set D is in P. In fact, given a string x, in poly(|x|) steps we can do both, decide whether x is an element of D and – if so – compute the unique number n such that x = 0δ(n) . The fact that A is contained in D will be used as follows. Note that, by choice of Me , for s ≥ e the length of any query in the computation MeB (0δ(s) ) is bounded by 2δ(s) , whence, by definition of δ, no string 0δ(s ) with s > s can be queried in this computation. For a subset B of A, i.e., for B ⊆ A ⊆ D, this implies that the computation of MeB (0δ(s) ) only depends on the values of B on strings less than or equal to the input, i.e., more precisely on B ∩ {0δ(0) , . . . , 0δ(s−1) } and on B(0δ(s) ). Now, the set A is defined in stages where A(0δ(s) ) is specified at stage s. The part A ∩ {0δ(0) , . . . , 0δ(s−1) } of A specified prior to stage s is denoted by As (A0 = ∅). At stage s of the construction we take action towards meeting the highest priority requirement which has not been satisfied before and which can be succesfully attacked at stage s. (Here requirement Re has higher priority than requirement Re if e < e .) The strategies for meeting the individual requirements will be finitary whence we will be able to argue that all requirements are eventually met. The strategy for meeting a P -requirement is straightforward: We say that requirement Pe is satisfied at stage s if ||As || ≥ e. Requirement Pe requires attention at stage s if Pe is not satisfied at this stage. If Pe is the highest priority requirement requiring attention at stage s then we put 0δ(s) into A. Obviously, e of these actions suffice to meet Pe . So the strategy for meeting a P -requirement is finitary and positive (i.e. forces strings into A). In order to explain the strategy for meeting an N -requirement, fix e and assume that Ne fails. Then there is a subset B of A such that A = MeB but ∗
A = B. So there must be infinitely many stages s such that B(0δ(s) ) = 0 and A(0δ(s) ) = MeB (0δ(s) ) = 1.
(2)
Fix such an s ≥ e. Then, as observed above, no string 0δ(s ) with s > s can be queried in the computation MeB (0δ(s) ). Hence, by B ⊆ A ⊆ D, the computation of MeB (0δ(s) ) only depends on B ∩ {0δ(0) , . . . , 0δ(s−1) } and on B(0δ(s) ). It follows that at stage s of the construction we can check whether there is the risk that (2) may hold for some subset B of A by checking whether there is any subset B of As = A ∩ {0δ(0) , . . . , 0δ(s−1) } such that MeB correctly computes A on δ(0) δ(s−1) B δ(s) {0 , . . . , 0 } and Me (0 ) = 1. If this is the case we can prevent (2) from happening by letting A(0δ(s) ) = 0 thereby ensuring that A(0δ(s) ) = MeB (0δ(s) ). Note that this action is negative (i.e. restrains strings from A). By K¨ onig’s Lemma we will argue that, for given e, we have to take this action at at most finitely many stages whence the N -strategies will be finitary too.
Problems which Cannot Be Reduced to Any Proper Subproblems
165
For the formal description of the strategy for meeting requirement Ne we use the following notation. For a string α we let Meα (0δ(s) ) denote the computation MeSα (0δ(s) ) where Sα = {0δ(n) : n < |α| & α(n) = 1}. Then Ne requires attention via α at stage s if s ≥ e and α is a string of length s such that ∀m < |α| (α(m) ≤ A(0δ(m) )) δ(m)
∀m < |α| (A(0 Meα0 (0δ(|α|) )
)=
Meα (0δ(m) ))
=1
(3) (4) (5)
hold; and Ne requires attention at stage s if Ne requires attention via some α at stage s. Note that, for a string α such that Ne requires attention via α at stage s, condition (3) ensures that the set Sα corresponding to α is a subset of the part As of A defined prior to stage s while conditions (4) and (5) imply that machine Me with oracle Sα correctly computes As and predicts the value 1 for A(0δ(s+1) ), respectively (i.e., Sα corresponds to the set B in the informal discussion of the Ne strategy above). Based on these definitions, stage s of the construction of A at which A(0δ(s) ) is specified is as follows. Stage s.
Fix n minimal such that Rn requires attention. If n is even let A(0δ(s) ) = 1, otherwise let A(0δ(s) ) = 0. In any case say that Rn is active at stage s.
As one can easily check, the first s stages of the construction can be carried out in 2O(δ(s)) steps. Hence the constructed set A is in EXPTIME. It remains to show that the constructed set satisfies the requirements Pe and Ne for all e ≥ 0. This is done by proving the following two claims. Claim 1. Every requirement Rn requires attention at at most finitely many stages. Proof. The proof is by induction on n. Fix n and, by inductive hypothesis, choose s0 such that s0 > n and no requirement Rm with m < n requires attention at any stage s ≥ s0 . Then Rn becomes active at any stage s ≥ s0 at which it requires attention. Now, for a contradiction, assume that Rn requires attention infinitely often. Distinguish the following two cases according to the type of the requirement Rn . Case 1: Rn is a P -requirement, say Rn = Pe . By assumption, we may fix a stage s1 > s0 such that Pe required attention – hence became active – at e stages t with s0 ≤ t < s1 . So 0δ(t) ∈ A for at least e numbers t less than s1 . It follows that ||As || ≥ e for all s ≥ s1 whence Pe does not to require attention after stage s1 contrary to assumption. Case 2: Rn is an N -requirement, say Rn = Ne . Let S be the set of strings α0 such that Ne requires attention via α at some stage s ≥ s0 , and let T be the binary tree obtained from S by closure under prefixes. Since any string α such that Ne requires attention via α at stage s has length s and since, by assumption, Ne requires attention at infinitely many stages, the set S – hence the tree T – is
166
Klaus Ambos-Spies
infinite. So, by K¨ onig’s Lemma, the tree T possesses an infinite path. Since T is the downward closure of S, it follows that there are strings β1 and β2 in S such that β2 properly extends β1 . We will show that this is impossible which will give the desired contradiction. By definition of S, for the strings β1 and β2 as above there are strings α1 and α2 such that β1 = α1 0 and β2 = α2 0,
(6)
and stages s1 and s2 such that s0 ≤ s1 < s2
(7)
Ne requires attention via αi at stage si (i = 1, 2).
(8)
and Since β2 is a proper extension of β1 it follows from (6) that α2 extends α1 0. Since Ne requires attention via α1 at stage s1 this implies by clause (5) in the definition of requiring attention that Meα2 (0δ(|α1 |) ) = Meα1 0 (0δ(|α1 |) ) = 1.
(9)
On the other hand, since, by s0 ≤ s1 , Ne receives attention at stage s1 , A(0δ(|α1 |) ) = 0.
(10)
But (9) and (10) imply that (4) fails for α2 in place of α whence Ne does not require attention via α2 at stage s2 contrary to (8). This completes the proof of Claim 1. Claim 2. Every requirement Rn is met. Proof. Fix n and for a contradiction assume that Rn is not met. We will show that Rn will require attention infinitely often contrary to Claim 1. If Rn is a P requirement then this is immediate. So, for the remainder of the proof, assume that Rn is an N -requirement, say Rn = Ne . By failure of Ne there is a subset B of A such that A = MeB and B(0δ(s) ) < A(0δ(s) ) for infinitely many numbers s. We will show that, for any such s with s ≥ e, Ne requires attention at stage s. So fix s ≥ e with B(0δ(s) ) = 0 and A(0δ(s) ) = 1 and let α be the string of length s defined by α(m) = B(0δ(m) ) for m < s. Then, by B ⊆ A, (3) holds and, by A = MeB , (4) holds. Finally, by A = MeB and by choice of s, Meα0 (0δ(s) ) = MeB (0δ(s) ) = A(0δ(s) ) = 1, whence (5) holds too. So Ne requires attention via α at stage s. This completes the proof of Claim 2. As observed above, Claim 2 implies that the constructed set A is ≤pT -introimmune. This completes the proof of the theorem. The complexity bound in Theorem 3 is not optimal. By applying standard techniques (like using a slow enumeration MeX (x) of the p-T-reductions and delaying the first stage at which a requirement may become active) the proof of Theorem 3 can be modified to yield a ≤pT -introimmune set A in any given smooth hyperpolynomial time class, i.e., in any time class DTIME(f (n)) where f is a nondecreasing time-constructible function majorizing all polynomials.
Problems which Cannot Be Reduced to Any Proper Subproblems
3
167
Further Results
Since polynomial-time Turing reducibility is the weakest of the (deterministic) polynomial-time reducibilities, it follows from Proposition 2 that Theorem 3 establishes the existence of introimmune sets in EXPTIME for all of these reducibilities. Moreover, the proof of Theorem 3 can be easily modified to obtain recursive introimmune sets under any of the common subrecursive reducibilities. Since the standard subrecursive reducibilities are recursively presentable (or can be weakend to recursively presentable reducibilities) this is achieved as follows. We first recall the definition of presentability we will use. Definition 4. Let the reducibility ≤r be defined by ∀A, B (A ≤r B ⇔ ∃e (A = MeB ) )
(11)
where {Me : e ≥ 0} is a (recursive) enumeration of total oracle Turing machines. Then the reducibility ≤r is (recursively) presentable, and {Me : e ≥ 0} is a (recursive) presentation of ≤r . Here an oracle machine M is called total if M X (x) is defined for all oracles X and inputs x. (So total oracle Turing machines are just total recursive operators.) Note that, by K¨ onig’s Lemma, the computation tree T (x) of a total oracle machine M on input x is finite. So, more formally, a presentation {Me : e ≥ 0} can be defined by the set {(e, x, Te (x)) : e ≥ 0 & x ∈ 2ω }, where Te (x) is the computation tree of Me on input x. Then the complexity of a presentation can be identified with the complexity of this corresponding set. It is well known that there is no weakest recursively presentable reducibility whereas truth-table reducibility is the weakest presentable reducibility. So, in particular, Turing reducibility is not presentable. Furthermore, truth-table reducibility has a ∆02 presentation. Theorem 5. Let ≤r be a presentable reducibility and let {Me : e ≥ 0} be a presentation of ≤r . There is an ≤r -introimmune set A which is recursive in the presentation {Me : e ≥ 0}. In particular, if ≤r is recursively presentable then there is a recursive ≤r -introimmune set A. Proof. (Idea) It suffices to make the following two changes in the proof of Theorem 3. First {Me : e ≥ 0} is now the given presentation of the reducibility ≤r . Second, the iterated exponential function δ has to be replaced by the function δ inductively defined by δ(0) = 0 and δ(n + 1) = t(δ(n)) where the function t is such that t(n) is a strict upper bound on the depth of the computation trees Te (x) of the oracle machines Me on input x for e ≤ n and |x| ≤ n. The definition of the function t ensures that for s ≥ e the length of any query in the computation MeX (0δ(s) ) (for any oracle X) is less than t(δ(s)), whence, by the modified definition of δ, no string 0δ(s ) with s > s can be queried in this computation. We leave it to the reader to check that these changes suffice to make the proof work in the more general setting.
168
Klaus Ambos-Spies
Theorem 5 does not only completely settle the question of the existence of recursive introimmune sets for the standard subrecursive reducibilities but it also yields introimmune sets of low arithmetical complexity for some of the most common unbounded reducibilities, namely for all reducibilities of truthtable type. By Proposition 2, this follows from the above mentioned fact that truth-table reducibility has a ∆02 presentation. Corollary 6. There is a ≤tt -introimmune set in ∆02 . Cintioli and Silvestri [2] have shown that there is a set in the fourth level ∆04 of the arithmetical hierarchy which is introimmune under conjunctive reductions. The above corollary improves this result in two directions, first by extending the class of conjunctive reductions to the class of general truth-table reductions and second by decreasing the complexity bound from ∆04 to ∆02 . Note that the class ∆02 consists of the sets which are recursive in the halting problem or, equivalently, which are recursively approximable. The complexity bound in Corollary 6 is optimal in the sense that we cannot replace ∆02 by the class of recursively enumerable (r.e.) sets. This follows from the fact that any infinite r. e. set A contains an infinite recursive set B whence any nonrecursive r. e. set A is reducible to a proper subset A − B of A.
References 1. J. L. Balcazar, J. Diaz and J. Gabarro. Structural Complexity Theory, vol. I. Springer-Verlag, Berlin, 1988. 2. P. Cintioli and R. Silvestri. Polynomial time introreducibility. Theory Comput. Systems 36 (2003) 1-15. 3. C. G. Jockusch, Jr. Upward closure and cohesive degrees. Israel J. Math. 1973 (15) 332-335. 4. P. Odifreddi. Classical Recursion Theory. North-Holland, Amsterdam, 1989. 5. S. G. Simpson. Sets which do not have subsets of every higher degree. J. Symbolic Logic 43 (1978) 135-138. 6. R. I. Soare. Sets with no subsets of higher degree. J. Symbolic Logic 34 (1969) 53-56.
ACID-Unification Is NEXPTIME-Decidable Siva Anantharaman1 , Paliath Narendran2, , and Michael Rusinowitch3 2
1 LIFO - Orl´eans, France University at Albany–SUNY, USA 3 LORIA - Nancy, France
Abstract. We consider the unification problem for the equational theory AC(U )ID obtained by adjoining a binary ‘∗’ which is distributive over an associative-commutative idempotent operator ‘+’, possibly admitting a unit element U . We formulate the problem as a particular class of set constraints, and propose a method for solving it by using the dag automata introduced by W. Charatonik, that we enrich with labels for our purposes. AC(U )ID-unification is thus shown to be in NEXPTIME. Keywords: E-Unification, Complexity, Set constraints, Tree automata, Dag automata.
1
Introduction
The unification problems for the theories AC (“Associativity-Commutativity”) and ACU (“AC plus Unit element”) have been studied in great detail in the past, and admit many applications ([5]). Natural extensions are the theories that one obtains by adjoining a binary symbol ‘∗’ which is ‘multiplication-like’ over the basic AC(U )-symbol ‘+’; if this ‘∗’ is assumed 2-sided distributive over ‘+’, the unification problem is undecidable by Hilbert’s tenth problem, cf. loc. cit.. The objective of this paper is to show that, when we assume in addition that the AC(U )-symbol is idempotent, unification actually becomes decidable. The theories that we get under such assumptions on ‘+’ and ‘∗’ are useful in program specification based on set constraints; we denote them by AC(U )ID. Due to the idempotence of ‘+’, an ACU ID-unification problem can itself be formulated as one of solving a particular class of set constraints in terms of finite sets; and under such a vision, ACID-unification – where no unit element is assumed for ‘+’ – reduces to solving the same set constraints problem in terms of finite and non-empty sets. In the current paper, we first address the problem for the theory ACID, and show that solving the set constraints deduced from a given ACID-unification problem P, amounts to showing the non-emptiness of the language of a labeled dag automaton constructed naturally from P. We conclude therefrom that ACID-unification is NEXPTIME-decidable; it then follows that the same upper bound holds also for ACU ID-unification. A DEXPTIME lower bound has been established for both the problems in [3].
Supported in part by NSF grant CCR-9712396and ONR grant N00014-01-1-0430.
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 169–178, 2003. c Springer-Verlag Berlin Heidelberg 2003
170
Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch
This paper is arranged as follows. We first consider ACID-unification, and formulate the problem in terms of set constraints, then do some pre-processing based on Occur-Check (referred to as ‘pruning’ subsequently), meant to eliminate syntactically some unsolvable cases; this constitutes section 2. Generalities on dag automata and their languages are given section 3, where we also introduce the notions of labeled term dag, and of labeled term dag automaton. We proceed then to associate a labeled term dag automaton to any ACID-unification problem given in a ‘standard’ form, with the objective that solving the latter is equivalent to showing that the former has a non-empty language. Section 4 is devoted to the construction of this automaton. The automaton constructed serves our purposes only indirectly: a solution to the ACID-unification problem is not always the sets of terms deduced from the labels at the various nodes of an accepted labeled term dag; but one can build naturally a grammar from any accepting run (cf. section 5) and from this grammar a solution to the ACID-unification problem can be derived as finite non-empty sets of terms over the constants (cf. [4] for illustrative examples). Our thanks to Hubert Comon who pointed out that reasoning with boolean vectors alone at the states of our automaton would lead to incorrect conclusions; and to Sophie Tison and Witold Charatonik for useful discussions.
2
From ACID-Unification to Set Constraints
We consider the unification problem w.r.t. the following theory, that we shall denote ACID: x + x ≈ x, x ∗ (y + z) ≈ (x ∗ y) + (x ∗ z), (u + v) ∗ w ≈ (u ∗ w) + (v ∗ w) plus the AC-axioms for ‘+’. This set of equations can be converted to a convergent rewrite system (modulo ACI); any ground term over given free ground constants, in normal form w.r.t. this system, can then be viewed as a set of terms over ‘∗’ and the constants: indeed ‘+’ can be viewed as set union. An ACIDunification problem with free constants is that of solving, modulo this equational theory, a family of equations of the form: {s1 = t1 , . . . , sk = tk }, where the terms in the equations and/or the solutions can involve the given free constants. We shall be assuming henceforth that our ACID-unification problem (after normalization and decomposition steps) is in a standard form, i.e. every equation in our problem has one of the following forms (respectively referred to as of type ‘product’, ‘sum’, or ‘constant’): x = y ∗ z, u = v + w, u = c , where u, v, w, x, y, z are variables and c is any constant. A given ACID-unification problem can be reduced to a standard form in more than one manner. Since ‘+’ is idempotent and ‘∗’ distributes left and right over ‘+’, we may view this ACID-unification problem as a set constraints problem; e.g. if y and z are interpreted as sets of terms over ∗ and the constants, then y ∗ z = {s ∗ t | s ∈ y, t ∈ z}. The problem of satisfiability of set constraints allowing arbitrary sets in the solutions, has been studied intensively over the past decade, in particular in [1,2,6,10,12,7,8,9,13]. Very few results seem to be known however, for solvability with finite sets. The only result we actually know of is very general, based on
ACID-Unification Is NEXPTIME-Decidable
171
the GTSA’s of Gilleron, Tison and Tommasi (cf. proposition 14, [12]); based on that, we may formulate our next result (but with no complexity estimate): Proposition 1. The ACID-unification problem is decidable. We show in this paper that this problem is NEXPTIME-decidable via an approach based on the formalism of dag automata ([7]), that we enrich with labels at its nodes in order to serve our purposes. We first “pre-process” our unification problem, to eliminate syntactically some of the unsolvable cases. 2.1
Pre-processing an ACID-Unification Problem
Pre-processing our ACID-unification problem P (given in standard form) is based on a dependency graph associated to P; The nodes of this graph will be the variables {x, y, z, . . .} appearing in P; its edges are directed and labeled by one of the two symbols ‘{∗, ⊃}’ as follows: For any two variables u, v, (u, v) is an edge labeled with ‘∗’ (resp. ⊃) iff there is an equation of the form u = v ∗ w (resp. u = v + w) in our ACID-problem. The arcs of this graph will be called dependency arcs. A variable from which there is no outgoing edge is called an end-variable of P. If u, v are two variables in the problem P, then we write u v iff there is a directed path from u to v; and we write u ∗ v iff there is a directed path from u to v with at least one edge along the path labeled with ‘∗’. By preprocessing P we mean carrying out the following three operations on P and/or its associated dependency graph. Occur-Check-1: Return ‘Fail’ if there is a variable u such that u ∗ u; or, if u ∗ v for some v, and u = a is in P, where a is a ground constant. Next, if the problem P admits a solution then for every ‘sum’-equation Z = X + Y in P, terms of maximal height in Z have to be in X or in Y . This gives: Occur-Check-2: Return ‘Fail’ if there is a ‘sum’-equation Z = X + Y in P, such that: Z ∗ X and Z ∗ Y . The final pre-processing step consists in ‘locating’ the variable(s) to the right of every ‘sum’-equation Z = X + Y in P, which can contribute terms of maximal ‘∗’-height to Z in a finite, non-empty solution for P. For doing that, we consider all possible equivalence relations ∼ between the set variables such that: for every ‘sum’-equation Z = X + Y in P, either Z ∼ X or Z ∼ Y non exclusively; these will be referred to as height relations. Occur-Check-3. If for every height relation ∼ there are two variables in P such that X ∼ Y and X ∗ Y then return ‘Fail’. We say that pre-processing fails on P iff ‘Fail’ is the value returned by one of the three Occur-Checks. The problem P is said to be in pruned form otherwise; in such a case, we introduce additional (height equivalence) arcs on the dependency graph of P, as follows. For every Z = X + Y in P, if we have X ∼ Z (resp. Y ∼ Z) for some height relation for which Occur-Check-3 does not ‘Fail’, then we introduce a ∼-arc from X (resp. Y ) to Z. Proposition 2. i) Pre-processing any ACID-unification problem P can be performed in time NP; ii) The dependency graph of a pruned problem P is ‘∗’-loop free: that is to say, there is no node u such that u ∗ u.
172
Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch
Example 1. The problem: V = X + Z, V = W + U W = X ∗ Y is in pruned form: V ∼ Z in the first ‘sum’-equation, and V ∼ W or V ∼ U in the second; and the dependency graph satisfies the ‘∗’-loop free condition. This problem is actually solvable (cf. Example 2 below). We propose to show that solving an ACID-unification problem P in pruned form, amounts to showing the non-emptiness of the language of a labeled dag automaton associated with P. proposition 2, ii) will be used for that purpose.
3
Labeled Term Dags and Labeled Dag Automata
We first recall the notions of term dags and of dag automata as developed in [7]. A term dag (or t-dag) over a ranked alphabet Σ is a rooted dag where each node has a symbol from Σ such that: (i) the out degree of the node is the same as the rank of the symbol, (ii) edges going out of a node are ordered, and (iii) no two distinct subgraphs are isomorphic. Every node represents a unique term in a t-dag, so we often treat “node” and “term” as synonymous on a t-dag. Definition 1. A t-dag automaton (or dag automaton, “DA” for short) over a ranked alphabet Σ is a tuple (Σ, Q, F, ∆), where Q is a finite set of states, F ⊂ Q is the set of accepting states, and ∆ is a set of transition rules of the form: f (q1 , q2 , ..., qn ) → q, where f ∈ Σ is of arity of n, and q, qi ∈ Q, 1 ≤ i ≤ n. A run r of a DA A = (Σ, Q, F, δ) on a t-dag t is a mapping from the set of nodes of t to the set of states Q of DA, that respects the transition relation δ, i.e., for every node u, if the symbol at u is f of arity k, then f (r(u1 ), . . . , r(uk )) → r(u) must be a transition in δ, where u1 , . . ., uk are the successor-nodes of u given in order. A run r is accepting on t if and only if r(t) ∈ F , i.e, it maps the root node to an accepting state. A t-dag t is accepted by a DA iff there is an accepting run on t. (Note that our runs are defined bottom-up.) The ‘language’ of a DA is the set of all t-dags that it accepts. It is easy to show that the class of t-dag automata is stable under union and intersection, but emptiness is hard to decide; that emptiness of a DA is N P -decidable is proved in [7]. A labeled term dag, or lt-dag in short, is a term dag equipped additionally with a mapping from the nodes of the dag to a given set of labels E. A motivation for adding labels is the fact that a labeled term dag can be used to specify finite sets of terms, when the labels are boolean, cf. the following section. A labeled dag automaton (or LDA in short) is a quintuple (Σ, Q, F, ∆, E), where the first four components form a DA, E is a finite set of labels, and the l transition relation ∆ consists of labeled rewrite rules of the form: f (q1 , . . . , qk ) → q, where k is the arity of f , and l is a label from E, and the qi , q are in Q. A run r of an LDA (Σ, Q, F, ∆, E) on an lt-dag t with label E is a mapping from the nodes of t to Q that respects the labels and the transition relation ∆: • for every node u on t, if the symbol at u is f of arity k, and the label of t at u is l, then transitions are possible via rules in ∆ of the form l f (r(u1 ), . . . , r(uk )) −→ r(u), where u1 , . . ., uk are the successor-nodes of u on t given in order.
ACID-Unification Is NEXPTIME-Decidable
173
We shall paraphrase this condition as: “the label on an LDA-transition must tally with the one at the node reached ”. A run r is said to be pseudo-accepting on t iff r(t) ∈ F , i.e, it maps the root node to an accepting state. An lt-dag t is said to be pseudo-accepted by an LDA iff there is a pseudo-accepting run on t. The ‘language’ of an LDA is the set of all lt-dags that it pseudo-accepts. That its emptiness is N P -decidable for any given LDA is a direct consequence of the N P -decidability of emptiness of the language for any given DA. This is a key result on which our approach is based.
4
The LDA Associated to an ACID-Unification Problem
We suppose given a (pruned) ACID-unification problem P, and denote by {Xi }i=1..n the set of its variables. The lt-dags on which we shall consider runs of our LDA’s (to be defined), are term dags over the symbol ‘∗’ and the given ground constants, labeled with n-bit vectors at their various nodes. These labels will in general be denoted by (m1 , m2 , . . . , mn ), mi ∈ {0, 1}, i = 1..n. They have the semantics that mi = 1 iff the subterm of the lt-dag at the current node is an element of the set Xi . The term label will denote any n-bit vector. For any lt-dag t, the subterm of the dag at a node w will be denoted by tw ; the underlying term at the root node will be denoted t. The label of t at node w will be denoted by lw ; and for any i, the i-th entry of this label is denoted by liw . Definition 2. i) A label m = (m1 , m2 , . . . , mn ) is said to be a permitted label iff : mk = 0 for any k for which there is an equation of the form Xk = Xi ∗ Xj in the problem P. ii) A label m is said to be a initial w.r.t. a ground constant a iff m is a permitted label, and : mi = 1 for every i ∈ 1..n for which Xi = a is in P; mj = 0 for any j ∈ 1..n for which P contains an equation Xj = b with b = a. iii) For any i = 1..n, the set value deduced for Xi from the labels of an lt-dag t, is the set of ground terms: {tw | w node on t such that: liw = 1}. The above definition is coherent: if there is an equation of the form Xk = a in P, then Xk cannot be the lhs of a ‘product’-equation (note: it is assumed that the problem P is pruned). Remark 1. If the set values deduced from the labels of an lt-dag t satisfy the ACID-problem P, then t must satisfy the following condition: If two nodes u, v on an lt-dag t are such that liu = 1 = ljv and if there is a ‘product’-equation Xk = Xi ∗ Xj in P, then there must be a node w on the dag t such that lkw = 1 with subterm tu ∗tv . We shall refer to this condition as the ‘closure property’; an lt-dag having this closure property is said to be a closed lt-dag. It seems unlikely that such a ‘global’ condition can be checked under an automaton-based approach; thus, for the notion of acceptance that we propose below, the solution to the ACID-problem derived from an accepted lt-dag t is not in general the set values deduced from the labels of t.
174
4.1
Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch
The States of the LDA with Their Defect Sets
Recall that n denotes the number of set variables of the given ACID-problem. Let S be the set of all 2n-bit vectors of the form {..., li , ...; ..., hi , ...} such that li ≤ hi for all i ∈ 1..n; the elements of S will be referred to as pstates (‘p’ stands for ‘preliminary’); we shall denote them by barred capital letters such as A, B, . . .. For any pstate A ∈ S, we shall denote by A.l (resp. A.h) its first- or lower- half (resp. second- or upper- half) n-bit vector. Any state A of our LDA will have two components: its first component is a pstate, i.e. a 2n-bit vector, that we denote A; this corresponds to two sets of boolean valuations on the set expressions {Xi }i=1..n ; the ‘lower i-th bit’ A.li of the state A on the LDA will signify (when 1) that the term at the current node on an lt-dag mapped to A under a given run r is accepted as element of Xi ; the ‘upper i-th bit’ A.hi is meant to signify (when 1) that some subterm below the current node has been accepted in Xi by the run; this explains why we only consider pstates A with A.l ≤ A.h. An accepting state on the LDA will then be in particular such that A.hi = 1 for all i = 1..n; but as we shall see below, this is not a sufficient condition for acceptance: many of the ‘product’-equations of P may still remain unsatisfied. To circumvent this, we add as a second component to any state A of the LDA a set of equalities formed from new symbols, giving information on the ‘products of terms accepted below the current node, that still have to be covered’. This second component at A will be referred as the defect set at A; for defining it formally, we need a few preliminaries. A triple (k, i, j) of indices in 1..n is said to be conjugate w.r.t. the ACIDproblem P iff there is an equation of the form Xk = Xi ∗ Xj in the problem P; a pair of indices (i, j) is said to be conjugate iff they are the second and third components of some conjugate triple. A label l is said to be conjugate to a label m w.r.t. an equation Xk = Xi ∗ Xj of the ACID-problem P if and only if: li = 1 = mj . We shall agree to refer to any pstate A as ‘unmarked’ iff the following holds: whenever there is an equation Xk = Xi ∗ Xj in the problem P we have A.li = 0 = A.lj . i Next we introduce new symbols XA for every i = 1..n, and every pstate A ∈ S; and also an additional new symbol T (signifying ‘to be covered’); these symbols will be referred to as dsymbols (the ‘d’ stands for ‘discriminating’). j i Two dsymbols XA , XB are said to be conjugate iff the pair of indices (i, j) is conjugate. A defect equality over the dsymbols is, by definition, an equality having one of the two following forms: j j i i XCk = XA XB , T = XA XB
where A, B, C ∈ S, and (k, i, j) is a conjugate triple. Equalities of the first type are said to be ‘closed’, and those of the second type ‘open’. Note that the number of all such equalities is polynomial in the size of S. Definition 3. (i) A defect set is any finite (possibly empty) set M containing dsymbols and defect equalities. Such a set M is said to be closed iff: M contains j i no open defect equalities, and for any two dsymbols XA , XB in M which are
ACID-Unification Is NEXPTIME-Decidable
175
j i conjugate, there is a closed equality in M with XA XB as its rhs. The empty defect set is closed, by definition. (ii) A state A of the LDA is a pair (A, MA ) such that A is a pstate, and MA is a defect set; A is called the first component of A, and the defect set MA its second. A state (A, MA ) is said to be closed iff: the pstate A is unmarked, A.hi = 1 for all i, and the defect set MA is closed in the sense defined above.
To any label m = (m1 , ..., mn ) we associate a state (C m , Mm ), where: - C m is the pstate such that: C m .l = C m .h = m; - the defect set Mm contains all the dsymbols XCp
m
for indices p such that
C m .lp = 1, and all the open defect equalities T = XCi XCj m
gate pair of indices (i, j) such that C m .li = 1 = C m .lj .
m
for any conju-
For example, let Z = X ∗ Y be the given ACID-problem, and {X, Y, Z} its variable list. If m = (110) is a given label, then the associated state is such that: C m = C = (110; 110) and Mm is the defect set {XC , YC , T = XC YC }. This state is not closed. States associated to labels will be those reached under initialization by the runs of the LDA associated with the ACID-problem. 4.2
The Construction of the LDA Associated
As previously, P denotes the ACID-unification problem given in standard, pruned form. In the following definition, for any defect set M we shall denote by M(s) (resp. by M(e) ) the set of all dsymbols (resp. defect equalities) which are elements of M; M is thus the disjoint union of its subsets M(s) and M(e) . Definition 4. The LDA associated to P is the quintuple (Σ, Q, F, ∆, L), where: Σ is the signature of the problem P, and the set of states Q is the set of all pairs A = (A, MA ) of pstates and defect sets such that for any A the following condition holds: • A.li ≤ A.hi for all i; and A.lk = A.li ∨ A.lj for every sum-equation Xk = Xi + Xj in the problem P; The set F of accepting states is the set of all closed states in Q (in the sense of the definition above). The set of labels L for the LDA is the set of all n-bit vectors (l1 , l2 , . . . , ln ); • (initialization) For any a ∈ Σ and any label m initial w.r.t. a, there m are transitions in ∆ of the form: a −→ (C m , Mm ) (cf. definition above). • (progression) For any A, B, C ∈ Q and label m = (m1 , m2 , . . . , mn ), m there is a transition rule in ∆ with label m of the form A ∗ B −→ C, iff: (1) Conditions on the pstates at A, B, C: • m = C.l (‘label on the transition must tally with the one at the node reached’); and for every equation in P of the form Xk = Xi + Xj , we have mk = mi ∨ mj ;
176
Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch
• for all i, C.hi = C.li ∨ (A.hi ∨ B.hi ); and for every equation in P of the form Xk = Xi ∗ Xj , we have: C.lk = A.li ∧ B.lj . (2) Conditions on the defect sets MA , MB , MC : • MC = MA ∪ MB ∪ {X jC | C.lj = 1}; (s)
(s)
(s)
• Let TC be the set of all open defect equalities T = X iA X jB whose rhs (s)
are conjugate dsymbols from MC ; and let CC,A,B be the set of all closed equalities – whose rhs contains no dsymbols indexed by C – and which come from MA or MB , or are of the form X kC = X iA X jB for conjugate (e)
triples (k, i, j) such that A.li = B.lj = 1 = C.lk ; then MC is the set obtained from TC by replacing each open equality T = X iA X jB in TC by all the closed equalities with the same rhs in CC,A,B , if they exist.
Remarks 2. i) If the defect set MT at state T contains a dsymbol X iA , the semantics is that some node at or below the current node got mapped to a state whose pstate is A, and the subterm there got accepted in the set Xi . A more detailed explanation on the progression conditions can be found in [4]. ii) It is important to note that our LDA is deterministic: Given two states A and B and a label m, there is a unique transition with label m from A, B to a state C. (This will be needed in proving the completeness of our approach.) A run of the LDA on an lt-dag is defined as in the case of DA’s, subject to the above initialization and progression conditions. In addition, we shall assume (as we may) that our runs are all coherent in the sense that: for any node w on t, if r(w) = C, then C.l = lw . Example 2. The ACID-unification problem: X + Z = X ∗ Y + U may be transformed into the following standard (pruned) form: V = X + Z, V = W + U, W = X ∗ Y Let us arrange the set variables into an ordered list, say as {X, Y, Z, U, V, W }; the states on the LDA are thus 12-bit vectors. Let a be any constant. Then the lt-dag rooted at ‘a∗a’, with label (110110) at its leaf-node ‘a’, and label (001011) at ‘a ∗ a’ is accepted by the LDA; cf. [4] for the details. In Example 2, the set values deduced from the labels of the pseudo-accepted lt-dag is a solution to the unification problem. (This may not be true in general; cf. Example 3.) It happened to be true above only because the lt-dag was itself closed. Our next result throws some light in this connection: if r is an LDA-run on a closed lt-dag t, then at the state r(t) the defect set must be closed; this fact will be used in proving the completeness of our LDA approach. Proposition 3. Let r be a run on an lt-dag, and u any node on t such that the state r(u) on the LDA associated to P is not closed, i.e. to say contains an open defect equality of the form X iA X jB . Then there exist two nodes u , v on t (at or) below u, satisfying the following conditions: i) the labels at u , v are non-null and conjugate, and (r(u ), r(v )) = (A , B ); ii) no node (at or) below u has as subterm the product term tu ∗ tv .
ACID-Unification Is NEXPTIME-Decidable
177
Proof. By induction on the height of the node u (cf. [4] for the details). We now show that an lt-dag pseudo-accepted by the LDA may not always be a closed lt-dag, i.e. may not have the closure property. Example 3. Consider the ACID-problem: Z =? X ∗ Y , and the solution set X = {a, c}, Y = {b, d}. The following run is pseudo-accepting on the lt-dag rooted at the term (a∗b)∗(c∗d), with nodes at the subterms a, b, c, d, (a∗b), (c∗d) labeled (100), (010), (100), (010), (001), (001) respectively, but which has no node with (c ∗ b) or (a ∗ d) as subterm; this lt-dag is not closed: 100
100
a −−−−−−→ A = (100; 100; {XA }),
c −−−−−−→ A = (100; 100; {XA }),
b −−−−−−→ B = (010; 010; {YB }),
d −−−−−−→ B = (010; 010; {YB }),
010
001
010
A ∗ B −−−−−−→ C = (001; 111; {XA , YB , ZC , ZC = XA YB }), 000
C ∗ C −−−−−−→ D = (000; 111; MD = MC })
5
The LDA-Approach Is Sound and Complete
Throughout this section, r is a given run of the LDA associated to the given ACID-problem P, on a given lt-dag t, mapping t to an accepting state. From the run r we build a grammar G = G(r) that will allow us to derive a solution to our unification problem. The non-terminals of G are the pstate symbols of the LDA; and its terminals are the ground constants appearing in P. Definition 5. Let w be any node of t such that its image r(w) = E is accepting. i) For every (closed) defect equality in ME of the form X kC = X iA X jB , add a production rule C −→ A ∗ B to G. ii) For every state B reached under initialization of r, and every ground constant b such that r(b) = B, add a production rule B −→ b to G. iii) For any i ∈ 1..n, the contribution Ci (w) of the run r to any set variable Xi , at the node w, is the set of all terms over the ground constants, that are frontiers of derivation trees from non-terminals C in G, for which X iC ∈ ME , i.e. such that C.li = 1. One then proves successively, that: (i) the sets Ci (w), i = 1..n, are all nonempty, (ii) the assignments Xi = Ci (w) satisfy the set constraints problem associated to P; and (iii) the Ci (w), i = 1..n, are all finite sets. The proof details – which use the fact that ‘∗ ’ is a strict ordering on the variables of P (cf. Proposition 2) – are to be found in [4]. Theorem 1. Let P be any ACID-unification problem P in pruned form, and let A be the LDA associated. i) The LDA-approach is sound: if there is an lt-dag pseudo-accepted by A, then P is solvable. ii) The LDA-approach is complete: Suppose P is solvable, and assume given a solution to P as (finite, non-empty) sets of terms over the ground constants
178
Siva Anantharaman, Paliath Narendran, and Michael Rusinowitch
and ‘∗’. Then we can construct a closed lt-dag t pseudo-accepted by A, such that the given solution is exactly the set values deduced from the labels of t. Proof. The soundness of the LDA-approach follows by putting together the above three properties. The proof of the completeness uses the fact that our LDA is deterministic, and also Proposition 3; cf. [4] for the details. Theorem 2. AC(U )ID-unification is NEXPTIME-decidable. Proof. For ACID the assertion follows because the LDA associated is of size exponential w.r.t. the number of variables in the problem; and finding an lt-dag pseudo-accepted by this LDA is NP-decidable. That of ACU ID-unification can then be deduced as follows: Choose non-deterministically the set of variables which are assigned the value U = 0; and solve for the others using the ACIDalgorithm just described.
References 1. A. Aiken, E. Wimmers. Solving Systems of Set Constraints. In Proc. of the 7th IEEE Symposium on Logic in Computer Science, 1992 (LICS’92), pp. 329 – 340. 2. A. Aiken, D. Kozen, M. Vardi, E. Wimmers. The Complexity of Set Constraints. In Proc. Conf. CSL’93, EACSL, September 1993, pp. 1–18. 3. S. Anantharaman, P. Narendran, M. Rusinowitch, Unification over ACUI plus Distributivity/Homomorphisms, To appear in Proc. of CADE-19, 2003 (cf. also the long version: ftp://ftp-lifo.univ-orleans.fr/pub/Users/siva/RR2002-11.ps) 4. S. Anantharaman, P. Narendran, M. Rusinowitch, AC(U)ID-Unification is NEXPTIME-Decidable, Research Report RR-2003-02, LIFO, Universit´e d’Orleans (Fr.), (ftp://ftp-lifo.univ-orleans.fr/pub/Users/siva/RR2003-02.ps) 5. F. Baader, W. Snyder. Unification Theory. In: J.A. Robinson and A. Voronkov, editors, Handbook of Automated Reasoning. Elsevier Science Publishers, 2001. 6. L. Bachmair, H. Ganzinger, U. Waldmann. Set Constraints are the Monadic Class. In Proceedings of the 8th IEEE Symp. on Logic in Computer Science, 1993 (LICS’93), pp. 75 – 83. 7. W. Charatonik. Automata on DAG representations of finite trees. Technical Report MPI-I-99-2-001, Max-Planck-Institut f¨ ur Informatik, Saarbr¨ ucken, Germany. 8. W. Charatonik, L. Pacholski. Set constraints with projections are in NEXPTIME. In. Proc. IEEE Symp. on Foundations of Computer Science, 1994, pp. 642–653. 9. W. Charatonik, A. Podelski. Set Constraints with Intersection. In Proc. of the 12th IEEE Symposium on Logic in Computer Science, Warsaw 1997 (LICS’97), pp. 362–372. (To appear in: Information and Computation). 10. H. Comon, M. Dauchet, R. Gilleron, F. Jacquemard, D. Lugiez, S. Tison, M. Tommasi. Tree Automata Techniques and Applications. http://www.grappa.univ-lille3.fr/tata/ 11. R. Gilleron, S. Tison, M. Tommasi. Solving Systems of Set Constraints using Tree Automata. In Proc. STACS’93, Springer-Verlag, LNCS 665, 505–514. 12. R. Gilleron, S. Tison, M. Tommasi. Set Constraints and Tree Automata Information and Computation 149, pp. 1–41, 1999. 13. J.-M. Talbot, Ph. Devienne, S. Tison. Generalized Definite Set Constraints. In CONSTRAINTS: an International Journal 5(1-2):161–202, 2000.
Completeness in Differential Approximation Classes (Extended Abstract) G. Ausiello1 , C. Bazgan2 , M. Demange3 , and V. Th. Paschos2
3
1 Dipartimento di Informatica e Sistemistica Universit` a degli Studi di Roma “La Sapienza” [email protected] 2 LAMSADE, Universit´e Paris-Dauphine {bazgan,paschos}@lamsade.dauphine.fr Department of Decision and Information Systems, ESSEC [email protected]
Abstract. We study completeness in differential approximability classes. In differential approximation, the quality of an approximation algorithm is the measure of both how far is the solution computed from a worst one and how close is it to an optimal one. The main classes considered are DAPX, the differential counterpart of APX, including the NP optimization problems approximable in polynomial time within constant differential approximation ratio and the DGLO, the differential counterpart of GLO, including problems for which their local optima guarantee constant differential approximation ratio. We define natural approximation preserving reductions and prove completeness results for the class of the NP optimization problems (class NPO), as well as for DAPX and for a natural subclass of DGLO. We also define class 0-APX of the NPO problems that are not differentially approximable within any ratio strictly greater than 0 unless P = NP. This class is very natural for differential approximation, although has no sense for the standard one. Finally, we prove the existence of hard problems for a subclass of DPTAS, the differential counterpart of PTAS, the class of NPO problems solvable by polynomial time differential approximation schemata.
1
Preliminaries
An NP optimization problem Π is defined as a four-tuple (I, sol, m, opt) such that: I is the set of instances of Π and it can be recognized in polynomial time; given x ∈ I, sol(x) denotes the set of feasible solutions of x; for every y ∈ sol(x), |y| is polynomial in |x|; given any x and any y polynomial in |x|, one can decide in polynomial time if y ∈ sol(x); given x ∈ I and y ∈ sol(x), m(x, y) denotes the value of y for x; m is polynomially computable and is commonly called feasible value, or objective value; finally, opt ∈ {max, min}. The set of NP optimization problems forms the class NPO. An NPO problem Π is said to be polynomially bounded, if, for any instance x of Π, the value of the optimum B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 179–188, 2003. c Springer-Verlag Berlin Heidelberg 2003
180
G. Ausiello et al.
solution of x is bounded by a polynomial in |x|. The set of polynomially bounded problems of NPO forms the class NPO-PB. In what follows, given an instance x of Π and a feasible solution y for x, we denote by opt(x) the value of an optimal solution of x and by ω(x) the value of a worst solution of x; ω(x) is the value of the optimum solution for x with respect to the NPO problem Π = (I, sol, m, opt ) where opt = max, if opt = min and opt = min, if opt = max. Polynomial approximation deals with polynomial computation of “good”, with respect to a predefined criterion, feasible solutions for hard NPO problems. Two main such criteria have been used until now: the standard approximation ratio and the differential approximation ratio. For an approximation algorithm A computing a feasible solution y for x with value mA (x, y), its standard approxA (x, y) = mA (x, y)/ opt(x) and its differential one imation ratio is defined as γΠ A as δΠ (x, y) = |ω(x) − mA (x, y)|/|ω(x) − opt(x)|. In what follows, whenever it is understood, reference to problem Π will be dropped. Finally note that, for any A problem Π and for any algorithm A, 0 δΠ 1. An approximation measure µ is called cost-respecting ([1]) if given two solutions y1 and y2 for an instance x of an optimization problem Π, the fact that y1 is worse than y2 implies that µ(y1 ) is worse than µ(y2 ). Obviously, both standard and differential approximation ratios are cost-respecting measures. Regarding the type of approximation results, NPO problems can be classified with respect to the approximation ratios known for them. The main approximability classes are: APX (DAPX), the class of NPO problems polynomially approximable within constant standard (differential) approximation ratio; PTAS (DPTAS), the class of problems polynomially approximable by standard (differential) polynomial time approximation schemata, i.e., within standard (differential) ratios arbitrarily close to 1; FPTAS (DFPTAS), the class of problems approximable by standard (differential) fully polynomial time approximation schemata, i.e., within ratios arbitrarily close to 1 in time polynomial in both the size of their instances and in 1/. Since the beginning of the 80’s, researchers have been highly interested in providing a structure in standard approximation by defining suitable approximation preserving reductions in order to study completeness in approximability classes. Pioneering works in this direction, used in this paper, are, among others, the ones in [2,1,3]. In [1] several natural minimization problems have been shown to be NPO-complete under an approximation preserving reduction called strictreduction, dealing with any cost-respecting approximation measure r. Throughout the paper, for any reduction R, we will denote by Π ≤R Π the fact that Π R-reduces to Π . In [3], the subclass MAX-SNP of APX has been introduced and complete problems have been provided for it, under L-reduction. In [2], a polynomial time approximation schema preserving reduction, called P-reduction there, has been introduced and the existence of APX-complete problems has been shown. In what follows, we borrow the term PTAS from [4,5] and we will use it instead of P. Furthermore, another reduction called F has been defined in [2] by means of which PTAS-complete problems have been provided. Surprisingly enough, differential approximation, although introduced in [6] since 1977, has not been systematically used until the mid-90’s when a formal
Completeness in Differential Approximation Classes
181
framework for it and a more systematic use started to be drawn ([7]). In any case, no structural approach to the study of differential approximability has been developed until now. This is the main objective of this paper. In Section 2, we show the existence of NPO-complete problems in the framework of the differential approximation. We then introduce a subclass of NPO, called 0-DAPX, for the problems of which no polynomial time algorithm can guarantee that any solution computed will be even slightly far from a worst one, unless P = NP; in other words, the differential ratio of any polynomial time algorithm is equal to 0. We prove that under the strict-reduction NPO-complete = 0-DAPX-complete ⊆ 0-DAPX ⊆ NPO. In Section 3, we tackle the question of the existence of complete problems for DAPX. We define a suitable reduction, called DPTAS-reduction and show that under it many natural NPO problems are DAPX-complete. In section 4, we devise an appropriate reduction and show the existence of hard problems for a natural subclass of DPTAS. Besides PTAS, the two most notable classes of APX in the literature are MAX-SNP and GLO. The first one, introduced, as we have already mentioned in [3], is defined in logical terms and, furthermore, independently on any approximability property of its members; henceforth, MAX-SNP is notorious for differential approximation also without need of defining any differential counterpart for it. The latter one, GLO, is, roughly speaking, the class of the NPO-PB problems whose all locally optimal solutions (with respect to a suitable neighborhood) guarantee constant standard approximation ratio. It is introduced in [8] where a local optima preserving (LOP) reduction, which is a special case of L-reduction provided with some suitable local optimality properties, is also defined. In Section 5, we devise a local optima preserving reduction strongly inspired from the LOP-reduction of [8] and, under this new reduction we prove the existence of natural complete problems for a natural subclass of DGLO (the differential counterpart of GLO). The definitions of the NPO problems mentioned and/or discussed in this paper can be found in [9]. Also, results are given without detailed proofs which can be found in [10].
2
Differential NPO-Completeness
We study in this section NPO-completeness with respect to differential approximation. Based upon the generic strict-reduction of [1], we define a particular strict-reduction, called D-reduction, which we use in the sequel for proving NPO-completeness. Definition 1. A D-reduction is a strict-reduction dealing with differential ratio. Two optimization problems Π and Π are D-equivalent if Π D-reduces to Π and Π D-reduces to Π. Theorem 1. max wsat and min wsat are D-equivalent. As usually, ([11,1]), we denote by Max NPO and Min NPO, the classes of maximization and minimization NPO problems, respectively.
182
G. Ausiello et al.
Theorem 2. max wsat is Max NPO-complete and min wsat is Min NPOcomplete under ≤D . Max NPO-hard and Min NPO-hard (under ≤D ) coincide and form the class of NPO-hard problems. In a completely analogous way, one can prove the D-equivalence of min {0,1} integer programming and max {0,1} integer programming. In other words min {0,1} integer programming and max {0,1} integer programming are NPO-complete, under ≤D . We note here that, the result of [1] about the Min NPO-completeness of min tsp (Theorem 3.3) can be erroneously seen as in “glaring contradiction” to a result of [12,13] where it is proved that min tsp on graphs with polynomially bounded edge-distances is in DAPX. In fact, there is no contradiction at all. Solution triv for min tsp adopted in [1], is considered as a tour containing exclusively edges of maximum distance. But such a solution is not always feasible for any instance of min tsp (the worst-value solution for this problem is an optimal solution of max tsp); hence the strict reduction of Theorem 3.3 in [1] is not a D-one. We now introduce an approximation class, called 0-DAPX in what follows, that seems very natural for differential approximation while has no sense in the standard case. Definition 2. 0-DAPX is the class of NPO problems Π for which approximation within any differential approximation ratio δ > 0 would entail P = NP. A problem Π is said to be 0-DAPX-hard, if approximation of Π within any strictly positive differential approximation ratio would imply approximation of any other 0-DAPX problem within strictly positive approximation ratios. Remark that inclusion in 0-DAPX is rather a negative than a positive approximation result. This seems quite natural since 0-approximability represents the worst intractability level for an NPO problem in the differential approach. In [14] it is proved that if P = NP, then, for any decreasing δ : N → (0, 1), min independent dominating set is not differential δ-approximable in polynomial time. By analogous reductions, it is proved in [15] that for any k > 3, polynomially bounded max wk-sat-B as well as the general minimization and maximization versions of integer-linear programming are in 0-DAPX. Theorem 3. Under ≤D , NPO-complete = 0-DAPX-complete ⊆ 0-DAPX. A natural question rising from the above is: what is the relation between NPOcomplete and 0-DAPX? Taking into consideration the fact that 0-DAPX is the hardest differential approximability class in NPO, one might guess that NPO-complete ≡ 0-DAPX, but in order to prove it we need a stronger reducibility. We show in [10] that defining a special a kind of Turing-reduction, one can prove that NPO-complete = 0-DAPX-complete = 0-DAPX.
3
Differential APX-Completeness
Let us now address the problem of completeness in the class DAPX. Note first that a careful reading of the proof of the standard APX-completeness of max
Completeness in Differential Approximation Classes
183
wsat-B given in [2] establishes also the following proposition which will be used in what follows. Proposition 1. Let Π ∈ APX. There exist 3 polynomially computable functions f , g and cρ :]0, 1[∩Q →]0, 1[∩Q such that ∀x ∈ IΠ , ∀z ∈ solΠ (x), ∀ρ ∈ ]0, 1[: (1) f (x, z, ρ) = (φx,z,ρ , Wx,z,ρ , wx,z,ρ ) with (φx,z,ρ , wx,z,ρ ) ∈ Imax wsat ; (2) ∀y ∈ solmax wsat (f (x, z, ρ)), g(x, z, ρ, y) ∈ solΠ (x); (3) if γΠ (x, z) ρ, then f (x, z, ρ) is an instance of max wsat-B and, for any solution y of f (x, z, ρ), if γmax wsat-B (f (x, z, ρ), y) 1 − cρ (), then γΠ (x, g(x, z, ρ, y)) 1 − . We now define a notion of polynomial time differential approximation schemata preserving reducibility, called DPTAS-reduction in what follows. Definition 3. Let Π, Π ∈ NPO. Then, Π ≤DPTAS Π if there exist two functions f , g and a function c :]0, 1[∩Q →]0, 1[∩Q, all computable in polynomial time, such that: (i) ∀x ∈ IΠ , ∀ ∈]0, 1[∩Q, f (x, ) ∈ IΠ ; f is possibly multivalued; (ii) ∀x ∈ IΠ , ∀ ∈]0, 1[∩Q, ∀y ∈ solΠ (f (x, )), g(x, y, ) ∈ solΠ (x); (iii) ∀x ∈ IΠ , ∀ ∈]0, 1[∩Q, ∀y ∈ solΠ (f (x, )), δΠ (f (x, ), y) 1 − c() ⇒ δΠ (x, g(x, y, )) 1 − ; if f is multi-valued, i.e., f = (f1 , . . . , fi ), for some i polynomial in |x|, then, the former implication becomes: ∀x ∈ IΠ , ∀ ∈]0, 1[∩Q, ∀y ∈ solΠ ((f1 , . . . , fi )(x, )), ∃j i such that δΠ (fj (x, ), y) 1 − c() ⇒ δΠ (x, g(x, y, )) 1 − . It is easy to see that given two NPO problems Π and Π , if Π ≤DPTAS Π and Π ∈ DAPX, then Π ∈ DAPX. Let Π ∈ DAPX and let T be a differential ρ-approximation algorithm for Π, with ρ ∈]0, 1[. There exists a polynomial p such that ∀x ∈ IΠ , |ω(x) − opt(x)| 2p(|x|) . An instance x ∈ IΠ can be written in terms of an integer linear program as: x : opt v(y) subject to y ∈ Cx , where Cx is the constraint-set of x. For any i ∈ {0, . . . , p(|x|)} and for any l ∈ N, we define xi,l by: xi,l : max[vi,l (y) = v(y)/2i − l] subject to y ∈ Cx , if Π is a maximization problem, or xi,l : min[vi,l (y) = l − v(y)/2i ] subject to y ∈ Cx , if Π is a minimization problem. Any xi,l can be considered as an instance of an NPO problem denoted by Πi,l . Then, the following proposition holds. Proposition 2. Let < min{ρ, 1/2}, x ∈ IΠ and (i, l) ∈ {1, . . . , p(|x|)} × N be such that 2i | opt(x) − ω(x)| 2i+1 and set l = ω(x)/2i . Then, for any y ∈ solΠ (x) = solΠi,l (xi,l ): (1) δΠi,l (xi,l , y) (1 − ) =⇒ δΠ (x, y) 1 − 3; (2) δΠ (x, y) ρ =⇒ δΠi,l (xi,l , y) (ρ − )/(1 + ). The proof of the existence of a DAPX-complete problem is performed along the following schema. We first prove that any DAPX problem Π is reducible to max wsat-B by a reduction transforming a PTAS for max wsat-B into a DPTAS for Π; we denote it by ≤D S . Next, we consider a particular APXcomplete problem Π , say max independent set-B; max wsat-B that is in APX is PTAS-reducible to max independent set-B. max independent set-B is both in APX and in DAPX and, moreover, standard and differential approximation ratios coincide for it; this coincidence draws a trivial reduction
184
G. Ausiello et al.
called ID-reduction; it trivially transforms a differential polynomial time approximation schema into a standard polynomial time approximation schema. In other words, we prove that Π ≤D S max wsat-B ≤PTAS max independent set-B ≤ID max independent set-B The composition of the three reductions, i.e., the one from Π to max wsat-B, the one from max wsat-B to max independent set-B and the ID-reduction, is a DPTAS reduction transforming a differential polynomial time approximation schema for max independent set-B into a differential polynomial time approximation schema for Π, i.e., max independent set-B ∈ DAPX-complete. Theorem 4. max independent set-B is DAPX-complete. Proof. We sketch here the part ∀Π ∈ DAPX, Π ≤D S max wsat-B (we assume integer valued problems; extension to the case of rational values is immediate). Remark that given a formula φ, a variable-weight system w and a constant B, one can decide in polynomial time if (φ, B, w) ∈ Imax wsat-B . Since Π is in DAPX, let T be a polynomial algorithm that guarantees differential ratio ρ ∈]0, 1[. Let < min{ρ, 1/2}. For any ζ > 0, we denote by Oζ an oracle that, for any instance x of max wsat-B, computes a feasible solution Oζ (x) ∈ solmax wsat-B guaranteeing γmax wsat-B (x, Oζ ) 1 − ζ. We construct an algorithm A (this is the component of ≤D S transforming solutions for max wsat-B into solutions for Π) using this oracle such that: A guarantees differential approximation ratio 1 − for Π and, in the case where Oζ is polynomial (in other words, Oζ can be seen as a polynomial time approximation schema), A is also polynomial. The ≤D S -reduction claimed is based upon the construction of a family F of instances xi,l : F = {xi,l : (i, l) ∈ F }, where F is of polynomial size and contains a pair (io , lo ) such that: either i0 = 0, 2i0 | opt(x) − ω(x)| 2i0 +1 and l0 = ω(x)/2i0 , or i0 = 0, | opt(x) − ω(x)| 2 and l0 = ω(x). For instance xi0 ,l0 the worst value is 0; henceforth standard and differential ratios coincide. In other words, δΠi0 ,l0 (xi0 ,l0 , z) = γΠi0 ,l0 (xi0 ,l0 , z), for all feasible z. Moreover, for i0 = 0, δΠ (x, z) = δΠ0,ω(x) (x0,ω(x) , z) = γΠ0,ω(x) (x0,ω(x) , z). We first suppose that F can be constructed in polynomial time. For each (i, l) ∈ F , we consider the three functions gi,l , fi,l and ci,l (Proposition 1) for the instance xi,l . We set = min{(ci,l )ρ (), (ci,l )(ρ−)/(1+) (/3) : (i, l) ∈ F } and define, for (i, l) ∈ F , η = ρ if i = 0; otherwise, η = (ρ−)/(1+). Let z = T(x); then, for any (i, l) ∈ F , we set zi,l = gi,l (xi,l , z, η, O (fi,l (xi,l , z, η))), if fi,l (xi,l , z, η) is an instance of max wsat-B; otherwise we set zi,l = z. Remark that zi,l is a feasible solution for xi,l and, consequently, for x. In all, A constructs zi,l for each (i, l) ∈ F and selects the best among them as solution for x. Next, we prove that A achieves differential approximation ratio 1 − . Using Propositions 1 and 2, we can show that δΠ (x, zi0 ,l0 ) 1 − . Since (i0 , l0 ) ∈ F , A has already computed the solution zi0 ,l0 . By taking into account that the solution finally returned by A is the best among the computed ones, we immediately
Completeness in Differential Approximation Classes
185
conclude that it is at least as good as zi0 ,l0 . Therefore, it guarantees ratio 1 − . Finally, we prove that F can be constructed in polynomial time. Steps sketched just above show that ∀Π ∈ DAPX, Π ≤D S max wsat-B. Theorem 5. min vertex cover-B, max set packing-B, min set coverB, are DAPX-complete under DPTAS-reductions. Furthermore, max independent set, min vertex cover, max set packing, min set cover, max clique and max -colorable induced subgraph, are DAPX-hard under DPTAS-reductions.
4
Differential PTAS-Hardness
In this section, we will take into consideration the class DPTAS and we will address the problem of completeness in such class. Consider the following reduction preserving fully polynomial time differential approximation schemata, denoted by DFPTAS-reduction in what follows. Definition 4. Assume two NPO problems Π and Π . Then, Π ≤DFPTAS Π , if there exist three functions f , g and c such that: (i) f and g are as for PTASreduction (Section 1; (ii) c : (]0, 1[∩Q) × IΠ →]0, 1[∩Q; its time complexity and its value are polynomial in both |x| and 1/; (iii) ∀x ∈ IΠ , ∀ ∈]0, 1[∩Q, ∀y ∈ solΠ (f (x, )), δΠ (f (x, ), y) 1 − c(, x) ⇒ δΠ (x, g(x, y, )) 1 − . Obviously, given two NPO problems Π and Π , if Π ≤DFPTAS Π and Π ∈ DPTAS, then Π ∈ DPTAS. In the following we study completeness not for the whole class DPTAS but for a subclass DPTASp mainly consisting of the maximization problems of PTAS the worst-value of which is computable in polynomial time (this class includes, in particular, maximization problems with worst value 0). Recall that, the first problem proved PTAS-complete (under FPTAS reduction) is max linear wsat-B ([2]). Consider two problems Π ∈ DPTASp and Π , instances of which x ∈ IΠ and x ∈ IΠ , respectively, are expressed, in terms of an integer linear programs as: x : opt v(y) subject to y ∈ Cx , x : opt v(y ) − ω(x) subject to: y ∈ Cx and Cx ≡ Cx . Obviously, δΠ (x, y) = δΠ (x , y ) = γΠ (x , y ) and, moreover, Π and Π belong to DPTASp ; also, Π ∈ PTAS and Π ≤FPTAS max linear wsat-B. So, for any Π ∈ DPTASp , Π ≡D Π ≤FPTAS max linear wsat-B; reduction ≡D ◦ ≤FPTAS is a DFPTAS-reduction. AF of DPTASp under affine transforConsider now the closure DPTASp mations of objective functions of its problems. min vertex cover in planar AF graphs is in DPTASp \ DPTASp . AF
and Π its “affine mate” in DPTASp . Then, Let any Π ∈ DPTASp Π ≤AF Π ≡D Π ≤FPTAS max linear wsat-B and since, obviously, the reduction ≤AF ◦ ≡D ◦ ≤FPTAS is a DFPTAS-one, the following proposition holds. Proposition 3. max linear wsat-B is DPTASp
AF
-hard, under ≤DFPTAS .
186
5
G. Ausiello et al.
MAX-SNP and Differential GLO
In the theory of approximability of optimization problems based upon the standard approximation ratio interesting results have been obtained by studying the behavior of local search heuristics and the degree of approximation that such heuristics can achieve. In particular, in [8,16], the class GLO is defined as the class of NPO-PB problems whose local optima have a guaranteed quality with respect to the global optima. Of course, the differential counterpart of GLO, called DGLO in what follows, can be defined analogously. In [17] it is shown that max cut, min dominating set-B, max independent set-B, min vertex cover-B, max set packing-B, min coloring, min set cover-B min set w(K)cover-B, min feedback edge set, min feedback vertex set-B and min multiprocessor scheduling, are included in DGLO. Furthermore in [18] it is proved that both min and max tsp on graphs with polynomially bounded edge-distances are also included in DGLO. Let us now consider the relationship of DGLO with respect to the differenDPTAS tial approximability class DAPX. Let DGLO be the closure of DGLO PTAS under ≤DPTAS . Analogously GLO is defined in [16] where it is also proved PTAS = APX. It is easy to show that the same holds for differential that GLO approximation. DPTAS
Proposition 4. DAPX = DGLO
.
Among other interesting properties of the class GLO, in [8] it is proved that max 3-sat is complete in GLO ∩ MAX-SNP with respect to LOP-reduction. A related result in [19] shows that MAX-SNP ⊆ Non-Oblivious GLO, a variant of the class GLO defined by means of local search algorithms that are allowed to use more general kinds of objective functions, rather than the natural objective function of the given problem, for improving the quality of the solution. In what follows, we show the existence of complete problems for a large, natural subclass of DGLO. As one can see from the definition of LOP-reduction in Section 1, the local optimality preserving properties do not depend on the approximation measure adopted. Hence, in an analogous way, we define here a reduction called DLOP which is a DPTAS-one with the same local optimality preserving properties as the ones of a LOP-reduction (Section 1). Definition 5. A DLOP-reduction is a DPTAS-reduction with the same surjectivity, partial monotonicity, locality and dominance properties as an LOPreduction. Obviously, given two NPO problems Π and Π , if Π ≤DLOP Π and Π ∈ DGLO, then Π ∈ DGLO. Let DGLO0 be the class of MAX-SNP maximization problems that belong to DGLO and for which the worst value 0 is feasible for any instance (max independent set-B, for example, is such a problem). Note that for the problems of DGLO0 , the standard and differential approximation ratios coincide. Now
Completeness in Differential Approximation Classes
187
let us consider the closure of DGLO0 under affine transformations. This leads to the following definition. Definition 6. Let Π be a polynomially bounded NPO problem. Then, Π ∈ DGLO if (i) it belongs to DGLO0 , or (ii) it can be transformed into a problem in DGLO0 by means of an affine transformation; in other words, DGLO = AF DGLO0 . Theorem 6. ∀Π ∈ DGLO , Π ≤DLOP max independent set-B. Proof. Assume Π ∈ DGLO . We then have the following two cases: (i) Π ∈ DGLO0 or (ii) Π can be transformed into a problem in DGLO0 by means of an affine transformation. Dealing with case (i), note that for DGLO0 , an LOP-reduction is also a DLOP-one and that the L-reduction of any π ∈ GLO (hence in DGLO0 ) is an LOP-reduction ([8]). We can show that both L-reductions in [3] from max 3-sat to max 3-sat-B and from max 3-sat-B to max independent set-B are also LOP-ones. So, the result follows. Dealing with case (ii), since an affine transformation is a DLOP-reduction, Π ≤DLOP Π and by case (i), Π ≤DLOP max independent set-B. Proposition 5. max cut, min vertex cover-B, max set packing-B, min set cover-B are DGLO -complete, under DLOP-reductions. Note that min multiprocessor scheduling, or even min and max tsp on graphs with polynomially bounded edge-distances belong to DGLO ([17,18]) but neither to GLO, nor to DGLO . On the other hand, min vertex coverB belongs to DGLO but not to MAX-SNP.
References 1. Orponen, P., Mannila, H.: On approximation preserving reductions: complete problems and robust measures. Technical Report C-1987-28, Dept. of Computer Science, University of Helsinki, Finland (1987) 2. Crescenzi, P., Panconesi, A.: Completeness in approximation classes. Inform. and Comput. 93 (1991) 241–262 3. Papadimitriou, C.H., Yannakakis, M.: Optimization, approximation and complexity classes. J. Comput. System Sci. 43 (1991) 425–440 4. Ausiello, G., Crescenzi, P., Protasi, M.: Approximate solutions of NP optimization problems. Theoret. Comput. Sci. 150 (1995) 1–55 5. Crescenzi, P., Trevisan, L.: On approximation scheme preserving reducibility and its applications. In: Foundations of Software Technology and Theoretical Computer Science, FCT-TCS. Number 880 in Lecture Notes in Computer Science, SpringerVerlag (1994) 330–341 6. Ausiello, G., D’Atri, A., Protasi, M.: On the structure of combinatorial problems and structure preserving reductions. In: Proc. ICALP’77. Lecture Notes in Computer Science, Springer-Verlag (1977)
188
G. Ausiello et al.
7. Demange, M., Paschos, V.T.: On an approximation measure founded on the links between optimization and polynomial approximation theory. Theoret. Comput. Sci. 158 (1996) 117–141 8. Ausiello, G., Protasi, M.: NP optimization problems and local optima graph theory. In Alavi, Y., Schwenk, A., eds.: Combinatorics and applications. Proc. 7th Quadriennal International Conference on the Theory and Applications of Graphs. Volume 2. (1995) 957–975 9. Ausiello, G., Crescenzi, P., Gambosi, G., Kann, V., Marchetti-Spaccamela, A., Protasi, M.: Complexity and approximation. Combinatorial optimization problems and their approximability properties. Springer, Berlin (1999) 10. Ausiello, G., Bazgan, C., Demange, M., Paschos, V.T.: Completeness in differential approximation classes. Cahier du LAMSADE 204, LAMSADE, Universit´e ParisDauphine (2003) Available on http://www.lamsade.dauphine.fr/cahiers.html. 11. Crescenzi, P., Kann, V., Silvestri, R., Trevisan, L.: Structure in approximation classes. SIAM J. Comput. 28 (1999) 1759–1782 12. Monnot, J.: Differential approximation results for the traveling salesman and related problems. Inform. Process. Lett. 82 (2002) 229–235 13. Hassin, R., Khuller, S.: z-approximations. J. Algorithms 41 (2001) 429–442 14. Bazgan, C., Paschos, V.T.: Differential approximation for optimal satisfiability and related problems. European J. Oper. Res. 147 (2003) 397–404 15. Toulouse, S.: Approximation polynomiale: optima locaux et rapport diff´erentiel. PhD thesis, LAMSADE, Universit´e Paris-Dauphine (2001). 16. Ausiello, G., Protasi, M.: Local search, reducibility and approximability of NPoptimization problems. Inform. Process. Lett. 54 (1995) 73–79 17. Monnot, J., Paschos, V.T., Toulouse, S.: Optima locaux garantis pour l’approximation diff´erentielle. Technical Report 203, LAMSADE, Universit´e Paris-Dauphine (2002). Available on http://www.lamsade.dauphine.fr/cahdoc.html#cahiers. 18. Monnot, J., Paschos, V.T., Toulouse, S.: Approximation algorithms for the traveling salesman problem. Mathematical Methods of Operations Research 57 (2003) 387–405 19. Khanna, S., Motwani, R., Sudan, M., Vazirani, U.: On syntactic versus computational views of approximability. SIAM J. Comput. 28 (1998) 164–191
On the Length of the Minimum Solution of Word Equations in One Variable Kensuke Baba1 , Satoshi Tsuruta2 , Ayumi Shinohara1,2 , and Masayuki Takeda1,2 1
2
PRESTO, Japan Science and Technology Corporation (JST) Department of Informatics, Kyushu University 33, Fukuoka 812-8581, Japan {baba,s-tsuru,ayumi,takeda}@i.kyushu-u.ac.jp
Abstract. We show the tight upperbound of the length of the minimum solution of a word equation L = R in one variable, in terms of the differences between the positions of corresponding variable occurrences in L and R. By introducing the notion of difference, the proof is obtained from Fine and Wilf’s theorem. As a corollary, it implies that the length of the minimum solution is less than N = |L| + |R|.
1
Introduction
Word equations can be used to describe several features of strings, for example, they generalize pattern matching problem [3,4] with variables. Fig. 1 shows an example of word equations. The fundamental work in word equations is Makanin’s algorithm [10] which decides whether a word equation has a solution (see for a survey on this topic [9]). Plandowski [11] introduced a PSPACE algorithm which gives the best upperbound so far known. On the other hand, the problem is known to be NP-hard [1]. An approach to the problem is to analyze word equations with a restricted number of variables. Charatonik and Pacholski [2], and Ilie and Plandowski [7] introduced a polynomial time algorithm for word equations in two variables. As to word equations in one variable, there is an efficient algorithm by Obono et al. [6] which solves a word equation L = R in O(N log N ) time in terms of N = |L| + |R|. D¸abrowski and Plandowski [5] presented an algorithm of O(N + x log N ) time complexity for the number x of occurrences of the variable x. However, the upperbound of the length of the minimum solution of word equations is not exactly understood even for one-variable version. Let χ be the upperbound, that is, a word equation has a solution if and only if there exists a solution A of length |A| ≤ χ. For any word equation in one variable, we can choose a single candidate for the solution of a length, therefore we have only to check for the χ candidates at most to decide whether a word equation has a solution. Indeed no χ leads a better result for the complexity as long as it is proportional to N , but from a practical viewpoint, χ is quite important. In [6], χ is taken to be equal to 4N without precise proof. Hence, we need to reduce χ as small as possible and prove it formally. B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 189–197, 2003. c Springer-Verlag Berlin Heidelberg 2003
190
Kensuke Baba et al.
Let a, b be characters and x be a variable. The word equation xxbaababa = ababaxabx has a solution
x = ababaababa
Fig. 1. An example of word equation in one variable
In this paper, we show the tight upperbound of the minimum solution for one variable word equations, by introducing a new measure in terms of the positions of variable occurrences. The bound reveals that χ is less than N . We now explain the basic idea briefly. A word equation in one variable is nontrivial only if both side of the equation have the same number of occurrences of the variable: Otherwise, the length of a possible solution is exactly determined by an integer equation on both the length of instance and the number of variable occurrences. Let m be the number of occurrences. We focus on the fact that, for a word equation L = R, the “gap” between the k-th occurrence of the variable x in L and the k-th occurrence in R is preserved for any substitution of a string A, as the gap between the corresponding occurrences of A in L[A/x] and R[A/x]. We denote the gaps by dk (1 ≤ k ≤ m). In the example in Fig. 1, d1 = 5 and d2 = 7. By utilizing this notion, the proof of the upperbound is essentially reducible to one for a word equation which has only one occurrence of x in both side respectively. If A is a solution and is longer than dk , then the k-th pair of occurrences of A overlap each other, that is, dk is a period of A. Therefore, by Fine and Wilf’s theorem [9], the upperbound is max1≤k≤m {dk + p−gcd(dk , p)}−1 for a period p of A. Since the minimum length of p is not larger than min1≤k≤m,dk =0 dk , the tight upperbound will be given as max1≤k≤m dk + min1≤k≤m,dk =0 dk −2. Obviously, min1≤k≤m,dk =0 dk ≤ max1≤k≤m dk < |L|. Thus χ is less than N = 2|L|.
2
Preliminaries
Let Σ be an alphabet and x ∈ / Σ be a variable. The empty word is denoted by ε. The length of a word w is denoted by |w|, where |ε| = 0 and |x| = 1. The i-th element of a word w is denoted by w[i] for 1 ≤ i ≤ |w|. The word w[i]w[i+1] · · · w[j] is called a subword of w, and denoted by w[i : j]. In particular, it is called a prefix if i = 1 and a suffix if j = |w|. For convenience, let w[i : j] = ε for j < i. A period of a non-empty word w is defined as an integer 0 < p ≤ |w|, such that w[i] = w[i + p] for any 1 ≤ i ≤ |w| − p. Note that the |w| is always a period of w. Proposition 1 (Fine and Wilf ). Let p, q be periods of a word w. If |w| ≥ p + q − gcd(p, q), then gcd(p, q) is also a period of w.
On the Length of the Minimum Solution of Word Equations in One Variable
191
A word equation (in one variable) is a pair of words over Σ ∪ {x} and is usually written by connecting two words with “=”. A solution of a word equation L = R is a homomorphism σ : (Σ ∪ {x})∗ → Σ ∗ leaving the letters of Σ invariant and such that σ(L) = σ(R). Since the solution is uniquely decided by a mapping of x into Σ ∗ , in this paper we define a solution as a word A ∈ Σ ∗ such that A = σ(x). Therefore, we can rewrite the condition that σ(L) = σ(R) by L[A/x] = R[A/x], where the result w[A/x] of the substitution of A to x in a word w is defined inductively as: if w = ε, w[A/x] = ε; if w = a ∈ Σ, w[A/x] = a; if w = x, w[A/x] = A; if w = w1 w2 , w[A/x] = w1 [A/x]w2 [A/x]. If two words L and R have the same prefix M , the solution of a word equation L = R is obtained by solving the word equation L = R where L = M L and R = M R . Therefore, we can assume without loss of generality that any word equation is of the form xL1 = BxR1 for a non-empty word B which has no variable and words L1 , R1 . This form implies that any solution A is a prefix of the word B k for a natural number k. By a similar argument for suffix, we can assume that either L1 or R1 ends with x. In particular, if L and R have exactly one occurrence of x respectively, the word equation L = R can be reduced to the form xC = Bx for non-empty words B, C which have no variable. We denote by x (w) the number of occurrences of the variable x in a word w. If a word equation L = R has a solution A, the length of L[A/x] is same as the length of R[A/x]. Hence we have |L| + x (L) · (|A| − 1) = |R| + x (R) · (|A| − 1), |L|−|R| and therefore |A| = x (R)− +1. If x (L) = x (R), the length of the solution is x (L) determined uniquely to the word equation and its upperbound is | |L|−|R| |+1 ≤ max(|L|, |R|). If x (L) = x (R), we have |L| = |R|. Proposition 2 ([6]). Let L = R be a word equation. (i) If x (L) = x (R), the length of the solution is determined uniquely with respect to L = R and is at most max(|L|, |R|). (ii) If x (L) = x (R), L = R has a solution only if |L| = |R|.
3
Solutions
We show the upperbound of the length of the minimum solution of word equations in one variable. By Proposition 2, we have only to consider the word equation L = R in the situation that x (L) = x (R) and |L| = |R|. Let x m = x (L) = x (R) and n = |L| = |R|. We denote by x1 , · · · , xm and r1x , · · · , rm the positions of occurrences of x in L and R, respectively in increasing order. A We define A k and rk for a word A and 1 ≤ k ≤ m as x A k = k + (k − 1)(|A| − 1), rkA = rkx + (k − 1)(|A| − 1).
192
Kensuke Baba et al.
L: R:
x1 x
A 1
L[A/x]:
A
-
r1x x
r2x x
A
-
A 2 A
r1A R[A/x]:
x2 x
A
r2A
A
A
-
A Fig. 2. The difference xk − rkx is equal to the difference A k − rk for any A
A k is, intuitively, the position in L[A/x] of a occurrence of A substituted to the kth occurrence of x in L (which is not always the k-th occurrence).Therefore, A k − rkA is the difference between it and the position of the corresponding occurrence of A in R[A/x]. The difference does not depend on the length of A, see Fig. 2. Proposition 3. For any word A, any word equation L = R, and integer 1 ≤ k ≤ m, A x x (i) A k − rk = k − rk , A A (ii) L[A/x][k : k + |A| − 1] = R[A/x][rkA : rkA + |A| − 1] = A. Proof. (i) Trivial by the definition. (ii) We prove for L. By the definition of substitution, L[A/x] is represented as L[A/x] = L[1 : x1 − 1]AL[x1 + 1 : x2 − 1] · · · L[xk−1 + 1 : xk − 1]AL[xk + 1 : xk+1 − 1] · · · L[xm−1 + 1 : xm − 1]AL[xm + 1 : n].
(1)
The length of the prefix of L[A/x] which ends L[xk−1 + 1 : xk − 1] equals to k (x1 −1)+ i=2 {(xi −1)−(xi−1 +1)+1}+(k −1)|A| = xk −k +(k −1)|A| = A k −1 for any 1 ≤ k ≤ m. Thus A k is the position of the occurrence of A which is the next to L[xk−1 + 1 : xk − 1] in the right side of Eq. (1). We denote by dk the absolute value of the difference, that is, dk = |xk − rkx | for 1 ≤ k ≤ m. Then we have the following lemma. Lemma 1. Let A be a solution of a word equation L = R. For 1 ≤ k ≤ m and dk = 0, if |A| ≥ dk then A has a period dk .
On the Length of the Minimum Solution of Word Equations in One Variable
193
Proof. We can assume rkx < xk without loss of generality. If |A| = dk , by the A x x definition, dk is a period of A. If |A| > dk , by Proposition 3 (i), A k = rk +k −rk = A A rk + dk < rk + |A|. Since A is a solution of L = R, we consider subwords of A A A L[A/x] and R[A/x], then L[A/x][A k : rk + |A| − 1] = R[A/x][k : rk + |A| − 1]. A A A By Proposition 3 (ii), L[A/x][k : rk + |A| − 1] = A[1 : |A| − (k − rkA )] and A A A R[A/x][A k : rk + |A| − 1] = A[1 + (k − rk ) : |A|]. Thus, by Proposition 3 (i), x x x x A[1 : |A| − (k − rk )] = A[1 + (k − rk ) : |A|] which implies that xk − rkx is a period of A. Lemma 2. Let A be a solution of a word equation L = R and p be a period of A. If |A| ≥ max dk + p − 1, 1≤k≤m
then the prefix A[1 : |A| − p] of A is also a solution of L = R. Proof. We prove by induction on the number m = x (L) = x (R). (Base step) By the argument in Section 2, we can assume L = xC and R = Bx with B, C ∈ Σ + . By Lemma 1, d1 = |B| is a period of A. By Proposition 1, gcd(d1 , p) is a period of A, moreover it is also a period of AC and BA. Since A[1 + gcd(d1 , p) : |A|] = A[1 : |A| − gcd(d1 , p)], we have A[1 : |A| − k gcd(d1 , p)]C = (AC)[1 + k gcd(d1 , p) : |A|] = (BA)[1 + k gcd(d1 , p) : |A|] = BA[1 : |A| − k gcd(d1 , p)] for a natural number k such that k gcd(d1 , p) ≤ |A|. (Induction step) We can assume L = L xC and R = R xBx with L , R ∈ (Σ ∪ {x})+ and B, C ∈ Σ + . Then we have dm = |C| and L [A/x]AC = R [A/x]ABA. If |C| ≤ |B|, the result is obviously obtained by induction for two equations L = R xB[1 : |B| − |C|] and xC = B[|B| − |C| + 1 : |B|]x. If |C| > |B|, we have |ABA| > |AC| > |BA| by the assumption |A| ≥ max1≤k≤m dk + p − 1. Hence the occurrence of A starting at A m in L[A/x] and the occurrence of A starting at A rm−1 in R[A/x] have a non-trivial overlapping Q. (This situation is illustrated in Fig. 3.) Now we consider two equations L Q = R x and xC = QBx. The assumption L [A/x]AC = R [A/x]ABA implies L [A/x]Q = R [A/x]A and AC = QBA, that is, A is a solution of the equations. Then, by induction hypothesis, we have L [A /x]Q = R [A /x]A and A C = QBA where A = A[1 : |A| − p]. Thus, we have L[A /x] = L [A /x]A C = L [A /x]QBA = R [A /x]A BA = R[A /x]. Theorem 1 (Tight upperbound). For any word equation L = R such that x (L) = x (R), the length of the minimum solution is at most max dk +
1≤k≤m
The bound is tight.
min
1≤k≤m,dk =0
dk − 2.
194
Kensuke Baba et al. L: R:
L[A/x]: R[A/x]:
L
xm x
R
C
x rm−1
x rm x B x
A m Q
L [A/x]
R [A/x]
A rm−1
A
Q
C
A B
A rm
A
Fig. 3. If |C| > |B| and |A| ≥ dm = |C|, then |ABA| > |AC| > |BA| and two A occurrences of A starting at A m and rm−1 have a overlap Q
Proof. Assume a word equation has a solution A such that |A| ≥ max1≤k≤m dk + min1≤k≤m,dk =0 dk − 1. By Lemma 1, A has a period p ≤ min1≤k≤m,dk =0 dk . Hence, by Lemma 2, A[1 : |A| − p] is also a solution of the word equation. Therefore A is not the minimum solution. To see that the bound is tight, let us consider the following word equation: xxbaababa = ababaxabx. We can verify that the solution of length 10 x = ababaababa. is in fact the minimum solution. Since d1 = 5 and d2 = 7, we have max1≤k≤2 dk = 7 and min1≤k≤2 dk = 5. Thus max1≤k≤2 dk + min1≤k≤2 dk − 2 = 10, which shows the bound is tight. In case of binary alphabet, the minimum solution which length is the upper bound is central which is defined as: A word is central if and only if it is in the set 0∗ ∪ 1∗ ∪ (P ∩ P 10P ) where P is the set of palindrome words. It is obtained by the proof of Lemma 2 and the fact that: a word w is central if and only if it has two periods p and q such that gcd(p, q) = 1 and |w| = p+q−2 [9, pp. 69–70]. We also have the following relaxed upperbound, since min1≤k≤m,dk =0 dk ≤ max1≤k≤m dk < |L|. Corollary 1. For any word equation L = R such that x (L) = x (R), the length of the minimum solution is at most N − 4 = |L| + |R| − 4. Consequently, we have the following upperbound by Proposition 2. Corollary 2. For any word equation L = R, the length of the minimum solution is at most N − 1.
On the Length of the Minimum Solution of Word Equations in One Variable
195
Table 1. The numbers of solvable word equations in one variable in E, classified by the lengths of their minimum solutions
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
4
3 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0
4 32 20 12 0 0 0 0 0 0 0 0 0 0 0 0
5 220 104 56 24 0 0 0 0 0 0 0 0 0 0 0
6 1388 548 252 140 60 0 0 0 0 0 0 0 0 0 0
length of L (and R) 7 8 9 10 8364 49120 284204 1630124 2868 14856 76236 388212 1208 5844 28268 136536 564 2488 11304 53008 260 1148 4764 20784 116 580 2052 8592 8 264 1152 4368 0 8 504 2148 0 0 24 1084 0 0 8 48 0 0 8 36 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0
11 9303292 1964612 657868 250296 95868 36076 16152 7532 4404 2120 136 24 0 8 8
String Statistics Problem
We are developing a system whose aim is to experimentally analyze the combinatorial property and structures of word equations. As a first step, we are recording all solvable word equations (up to a moderate length) in one variable together with their minimum solutions. By the fact that: for any word w, there exists a binary word w which has the same set of periods as w [9, pp. 275–279], we have only to consider a binary alphabet to find out the relation between the length of an equation and the length of its solutions. For a fixed alphabet Σ = {a, b} and a specified length n, we enumerate the set E of all word equations L = R such that (1) both a and b appear either L or R, (2) |L| = |R| = n, (3) L and R contains the same number of variables, and (4) the pairs (L[1], R[1]) and (L[n], R[n]) must be taken from {(x, a), (x, b), (a, x), (b, x)}. Then for each word equation in E, we try to find the minimum solution by checking each prefix of B k (where B is a constant prefix of either L or R) in increasing order up to 2n − 4. If a solution is found, we logged it and turn to the next equation. Otherwise, we can conclude that the word equation has no solution, thanks to the upperbound we have shown (Corollary 1). For interested readers, Table 1 shows the numbers of the solvable word equations in E, classified by the lengths of their minimum solutions. At i-th row and column labeled n = |L| of the table T , we fill the number of word equations in E of length |L| = |R| = n whose minimum solution is of length i. Remark that some equations may be equivalent each other, by either replacing a with b, exchanging left-side with right-side, or reversing the formulae. We did not exclude these duplications. For example, T (0, 3) = 4 corresponds to the number of equations {abx = xab, bax = xba, xab = abx, xba = bax}, where the
196
Kensuke Baba et al.
empty string is a solution to them. They are equivalent each other. Moreover, T (1, 3) = 4 corresponds to {abx = xba, bax = xab, xab = bax, xba = abx}, whose minimum solutions are of length 1. They are essentially the same. Let us pick up some interesting pairs of equation and its minimum solution. – xxbaababa = ababaxabx, ababaababa, from T (10, 9) = 8, which was used to prove the tightness of the upperbound. This is a unique instance in T (10, 9) = 8, since the other 7 instances are all equivalent to it. – xxbaabababa = abababaxabx, abababaabababa, from T (14, 11) = 8, which also matches the upperbound. This is a unique instance in T (14, 11) = 8, since the other 7 instances are all equivalent to it. – xabxbaaaaaa = aaaaaabaxbx, aaaaaabaaaaaa). This is a unique instance in T (13, 11) = 8.
5
Conclusion
We showed the tight upperbound of the length of minimum solution of word equations in one variable. The upperbound is easily computed from a given word equation. Moreover, we showed concrete examples which match the bound. As a corollary, we also have a more relaxed upperbound which is easier applicable: the length of the minimum solution is less than the size of the total length of a word equation. Khmelevski˘ı [8, pp. 12] proved that if a word equation C0 xC1 · · · xCu = xB1 · · · xBv is solvable, it has a solution of length smaller than M 2 + 3M where M = maxi,j {u, v, |Ci |, |Bj |}. When we consider the upperbound in terms of the length N of a given word equation, the order of this value comes up to N 2 since M ≤ N − 1. Even for the original expression, we can show that the value M 2 + 3M − 1 never be less than the upperbound of our result for a non-trivial word equation. Let ν = u = v and λ = maxi,j {|Ci |, |Bj |}. Then M = max{ν, λ}. By the definition of dk , we have mink,dk =0 dk ≤ |C0 | ≤ λ and maxk dk ≤ ν k−1 max{ i=0 |Ci |, i=k |Ci |} ≤ νλ. Therefore, maxk dk + mink,dk =0 dk − 2 ≤ νλ + λ − 2 ≤ M 2 + 2M − 2 ≤ M 2 + 3M − 1. Thanks to the bound, we could perform a comprehensive analysis of word equations in one variable up to a moderate size the equations, by enumerating all word equations and solving them one by one. We showed some statistics of the lengths of minimum solutions.
Acknowledgements We thank Yoshihito Tanaka for useful discussions. The relation between the two upperbound in Section 5 was obtained by his idea. We also thank the anonymous referees for their helpful comments to improve this work, in particular the proof of Lemma 2 became clear.
On the Length of the Minimum Solution of Word Equations in One Variable
197
References 1. Angluin, D.: Finding Patterns Common to a Set of Strings. J. Comput. Sys. Sci., Vol. 21 (1980) 46–62 2. Charatonik, W. and Pacholski, L.: Word Equations in Two Variables. Proc. IWWERT’91, LNCS, Vol. 677 (1991) 43–57 3. Crochemore, M. and Rytter, W.: Text Algorithms. Oxford University Press, New York (1994) 4. Crochemore, M. and Rytter, W.: Jewels of Stringology. World Scientific (2003) 5. D¸abrowski, R. and Plandowski, W.: On Word Equations in One Variable. Proc. MFCS2002, LNCS Vol. 2420 (2002) 212–220 6. Eyono Obono, S., Goralcik, P., and Maksimenko, M.: Efficient Solving of the Word Equations in One Variable. Proc. MFCS’94, LNCS Vol. 841 (1994) 336–341 7. Ilie, L. and Plandowski, W.: Two-Variable Word Equations. Proc. STACS2000, LNCS Vol. 1770 (2000) 122–132 8. Khmelevski˘ı, Yu.I.: Equations in Free Semigroups. Proc. Steklov Inst. of Mathematics 107, AMS (1976) 9. Lothaire, M.: Algebraic Combinatorics on Words. Cambridge University Press (2002) 10. Makanin, G.S.: The Problem of Solvability of Equations in a Free Semigroup. Mat. Sb. Vol. 103, No. 2, 147–236. In Russian; English translation in: Math. USSR Sbornik, Vol. 32 (1977) 129–198 11. Plandowski, W.: Satisfiability of Word Equations with Constants is in PSPACE. Proc. FOCS’99, IEEE Computer Society Press (1999) 495–500
Smoothed Analysis of Three Combinatorial Problems Cyril Banderier1 , Ren´e Beier2 , and Kurt Mehlhorn2 1
Laboratoire d’Informatique de Paris Nord Institut Galil´ee, Universit´e Paris 13 99, avenue Jean-Baptiste Cl´ement, 93430 Villetaneuse, France [email protected] 2 Max-Planck-Institut f¨ ur Informatik Stuhlsatzenhausweg 85, 66123 Saarbr¨ ucken, Germany {rbeier,mehlhorn}@mpi-sb.mpg.de
Abstract. Smoothed analysis combines elements over worst-case and average case analysis. For an instance x, the smoothed complexity is the average complexity of an instance obtained from x by a perturbation. The smoothed complexity of a problem is the worst smoothed complexity of any instance. Spielman and Teng introduced this notion for continuous problems. We apply the concept to combinatorial problems and study the smoothed complexity of three classical discrete problems: quicksort, left-to-right maxima counting, and shortest paths.
1
Introduction
Recently, Spielman and Teng [13] introduced smoothed analysis, which is intermediate between average case analysis and worst case analysis. The smoothed complexity of an algorithm is max Ey∈U (x) C(y) , x
where x ranges over all inputs, y is a random instance in a neighborhood of x (whose size depends on the smoothing parameter ), E denotes expectation, and C(y) is the cost of the algorithm on input y. In other words, worst-case complexity is smoothed by considering the expected running time in a neighborhood of an instance instead of the running time at the instance. If U (x) is the entire input space, smoothed analysis becomes average case analysis, and if U (x) = {x} for all , smoothed analysis becomes worst case analysis. Smoothed analysis gives information whether instance space contains dense regions of hard instances, see Figure 1. The smoothed complexity of an algorithm is low if worst-case instances are “isolated events” in instance space. In other words, if the smoothed complexity is low, worst case instances are not robust under small changes; most small changes to the instance destroy the property of being worst-case; a small random perturbation destroys the property of being worst-case.
This work was partially supported by the Future and Emerging Technologies programme of the EU under contract number IST-1999-14186 (ALCOM-FT).
B. Rovan and P. Vojt´ aˇ s (Eds.): MFCS 2003, LNCS 2747, pp. 198–207, 2003. c Springer-Verlag Berlin Heidelberg 2003
Smoothed Analysis of Three Combinatorial Problems
199
Fig. 1. The graphs show conceivable dependency of running time on input instance. We assume a one-dimensional input space; the running time on an instance is shown as the y-value of the graph. The neighborhood of an instance is simply an interval around the instance. In the situation on the left, the smoothed complexity will be equal to the worst case complexity (for all small enough ), and in the situation on the right, the smoothed complexity decreases sharply as a function of
In most sciences, one attempts to develop a theory that explains and predicts observed phenomena. Smoothed Analysis is one attempt to push the analysis of algorithms in this direction. To develop a mathematically rigorous theory of the behavior of algorithms, one must make mathematically rigorous assumptions about their inputs. Smoothed analysis makes the assumption that inputs are subject to noise, circumstance, or randomness. This is an assumption that is valid in most practical problem domains. While it is unreasonable to assume that one can develop a model of inputs subject to noise that precisely models practice, one can try to come close and then reason by analogy. Spielman and Teng [13] showed that the smoothed complexity of the simplex algorithm (with the shadow-vertex pivot rule) for linear programming is polynomial. Linear programming is a continuous problem. The input is a sequence of real numbers (a cost vector, a constraint matrix, a right-hand side). The smoothing operation adds Gaussian noise with parameter σ to each number in the input. The expected running time of the simplex algorithm for such a perturbed instance is polynomial in 1/σ and the number of input variables. The other papers on smoothed analysis [3,5] also discuss continuous problems. Our paper is the first to apply the concept of smoothed analysis to discrete problems. We define natural models of perturbation for sequences and natural numbers and analyze the smoothed complexity of quicksort, left-to-right maxima and the shortest path problem. Partial Permutations: Our first model applies to problems defined on sequences. It is parameterized by a real parameter p with 0 ≤ p ≤ 1 and is defined as follows. Given a sequence s1 , s2 , . . . , sn , each element is selected (independently) with probability p. Let m be the number of selected elements (on average m = pn). Choose one of the m! permutations of m elements (uniformly at random) and let it act on the selected elements. E.g., for p = 1/2 and n = 7, one might select m = 3 elements (namely, s2 , s4 , and s7 ) out of an input sequence (s1 , s2 , s3 , s4 , s5 , s6 , s7 ). Applying the permutation (312) to the selected elements yields (s1 , s7 , s3 , s2 , s5 , s6 , s4 ). The probability to obtain this sequence in this way is p3 (1 − p)4 /3!.
200
Cyril Banderier, Ren´e Beier, and Kurt Mehlhorn
We show that the smoothed complexity of a deterministic variant of quicksort is O((n/p) ln p) (Section 2). However, it is not true that every fixed element takes part in O((1/p) ln n)) comparisons on average. The maximum recursion depth is Ω( n/p) (Section 3). Partial Bit Randomization: Our second model applies to problems involving natural numbers and is parameterized by an integer k ≥ 0. For each integer of the input, the last k bits are randomly modified. This model is a discrete analogue of the model considered by Spielman and Teng. Notice, that in our model of perturbation the expectation of the resulting distribution is not necessarily equal to the unperturbed value. We show that the smoothed running time of the shortest path algorithm of Meyer [10] and Goldberg [6] on a graph with n nodes and m edges is O(m + n(K − k)) when the edge lengths are K bit integers, the last k of which are randomized. In [2] our model is used to analyze clairvoyant scheduling.
2
Quicksort
We analyze a deterministic variant of quicksort under partial permutations. We assume that quicksort takes the first element of the list as the pivot and splits the input list with respect to the pivot into two parts: the elements smaller than the pivot and the elements larger than the pivot. We assume that the order of elements in the resulting two sublist is unchanged. Theorem 1 (Quicksort under Limited Randomness). The expected running time (i.e., number of comparisons) of quicksort on a partial permutation of n elements is O((n/p) ln n). Proof: We utilize a proof, based on randomized incremental constructions [11]. Let C denote the number of comparisons performed by the algorithm. Assume that we have a permutation of the numbers 1 to n. Let Xij be the indicator variable which is 1 iff i and j are compared in a run of quicksort with i being the pivot. Clearly C = i,j Xij . Then Xij = 1 if and only if i occurs before all other elements with value between i and j in the sequence. Thus, for a random permutation, prob(Xij = 1) = |1/(j − i + 1)| and hence E[C] =
i=j
1 1 ≤ 2n ≤ 2n ln n . |j − i + 1| k 2≤k≤n
Next we estimate prob(Xij = 1) for partial permutations. Let s1 , . . . , sn be our initial permutation and let L = (8/p) ln n. If i is among s1 , . . . , sL or |j − i| ≤ L, we estimate prob(Xij = 1) for a total contribution of O( np ln n). Next assume that there are at least L elements preceding i in the initial permutation and that |i − j| > L. We split our estimate for prob(Xij = 1) into two parts. First assume that i is selected. Let l = |i − j|. The probability that at most lp/2 elements between i (exclusive) and j (inclusive) are selected is less than
Smoothed Analysis of Three Combinatorial Problems
201
exp(−lp/8). If more than lp/2 elements are selected, Xij = 1 implies that i is first in the permutation of the selected elements which happens with probability at most 2/(lp). Together we obtain prob(Xij = 1) ≤ exp(−lp/8) + 2/(lp) and hence n ln n . exp(−lp/8) + 2/(lp) = O p LL
Assume next that i is not selected and let i be the ki -th element in the initial sequence. The probability that less than pki /2 elements before i are chosen or less than pl/2 elements between i and j or more than 2pn elements are chosen altogether is less than exp(−pki /8)+exp(−pl/8)+exp(−pn/2). The contribution of these rare events to the E[C] is only O(1/p) since for the first term we have exp(−pki /8) = n exp(−pL/8) exp(−p/8)m = O(1/p) . ki ≥L
j
m≥0
The same bound can be shown for the other two terms. So assume that the required number of elements are chosen. If i occurs before all elements i + 1, . . . , j in the partial permutation, it must be the case that none of the pl/2 selected elements between i and j is inserted before i which happens with probability at most
2pn − ki p/2 2pn
lp/2 ≤ exp(−ki lp/(8n)).
Next observe that n n k=1 l=1
exp(−klp/(8n)) ≤
n k=1
n
16n 1 16n ln n ≤ ≤ ; 1 − exp(−kp/(8n)) kp p k=1
since 1 − e−x ≥ x/2 for 0 ≤ x ≤ 1 and hence 1/(1 − e−x ) ≤ 2/x.
Remark: When we consider partial permutations of a sorted sequence (the worstcase instance without permutations) we are able to get closed form formulae for the Xij ’s. We distinguish 10 subcases, most of them involving 7 nested sums. From these sums (involving binomials), it is possible to get the differential equation satisfied by their generating functions, and then the Frobenius method allows to get the full asymptotic scale which gives a p2 n ln n complexity. We refer the reader to the full paper for details. Pitfalls: The expected running time of quicksort on random permutations can be analyzed in many different ways. Many of them rely on the fact that the subproblems generated by recursive calls are again random permutations. This is not true for partial permutations1 as the following example demonstrates. Consider an input 1, 2, 3, 4 and define q := 1 − p. Assume that 2 is the pivot element and hence the second subproblem consists of the numbers 3, 4. If 2 is 1
In the first version of this paper, we fell into this pitfall.
202
Cyril Banderier, Ren´e Beier, and Kurt Mehlhorn
the pivot (first element after permutation), at least the numbers 1 and 2 are selected. Conditioned on the fact that 1 and 2 are selected and 2 is made the first element we obtain subproblem (3, 4) – – – –
always, when neither 3 or 4 is selected (probability q 2 ), always2 , when 3 is selected, but 4 is not (probability pq) in one out of two cases3 , when 4 is selected but 3 is not (probability pq/2) in one out of two cases, when 3 and 4 are selected (probability p2 /2).
Thus prob((3, 4)) = q 2 + 32 pq + 12 p2 . Consequently, prob((4, 3)) = 12 pq + 12 p2 . On the other hand, applying partial permutations on input sequence 3, 4 gives prob((3, 4)) = q 2 + 2pq + 12 p2 and prob((4, 3)) = 12 p2 . We also point out that the content of the first position, even if it is selected, is not a random element of the sequence. It is more likely to be the original element than any other element. The other elements are equally likely. This unbalance results from the fact that if only one element is selected, the permutation of the selected elements has very little freedom. The expected maximum recursion depth of quicksort on random permutations is O(ln n). For partial permutations the expected maximum recursion depth is Ω( n/p). This is a consequence of the result in the next section. We will show that the number of left-to-right-maxima in a partial permutation might be as large as Ω( n/p). The number of left-to-right-maxima is the number of times the largest element is compared to a pivot element. Thus some elements may take part in as many as Ω( n/p) recursive calls which disproves the conjecture that every element takes part in O((1/p) ln n) calls with high probability. In the full version of this paper we show that the worst-case instances (sorted sequence, increasing or decreasing) also exibit the highest smoothed complexity. The complexity landscape for quicksort has two dominant peaks with a rather sharp transition (cf. Figure 1). We will see in the next section that is not always the case.
3
Left-to-Right Maxima
The simplest strategy to determine the largest element in a sequence is to scan the sequence from left to right and to keep track of the largest element seen. The number of changes to the current maximum is called the number of left-toright maxima in the sequence. The sequence 1, . . . , n has n left-to-right maxima and the expected number of left-to-right maxima in a random permutation of n elements is Hn = 1 + 1/2 + · · · + 1/n. Surprisingly, the worst case instance for the classical analysis is not the worst case under smoothing. Theorem 2 (Left-to-Right Maxima). Under the model, partial permutation the smoothed number of left-to-right maxima is Ω( n/p) and O( (n/p) log n), whereas the smoothed complexity for the sequence (1, . . . , n) is 2 3
The relevant partial permutations of the input are (2, 1, 3, 4) and (2, 3, 1, 4). The relevant partial permutations are (2, 1, 3, 4) and (2, 4, 1, 3). The former generates the subproblem (3, 4).
Smoothed Analysis of Three Combinatorial Problems
1−p + ln(pn) + γ + 2 p
1 2 (1 − p) + 2 p2
203
1 1 + O( 2 ) , n n
where γ ≈ .5772 is Euler’s constant. Proof: Due to space limitations we provide a proof only for the two first asymptotic terms of the smoothed complexity of the sorted sequence (see full version of the paper for a generating function proof which gives the full asymptotics). The sequence 1, . . . , n has n left-to-right maxima. Smoothing decreases the number to about ln(pn) + 2/p as we show next. Let Xi be the probability that the i-th position is not selected and is a maximum and let Yi be the probability that the i-th position is selected and is a maximum. Consider first a selected position. It contains a maximum if and only if it is a maximum among the selected elements. In this case its value is at least i and hence it is also a maximum considering all elements. Thus i Yi is simply the number of maxima among the selected elements. The number of selected elements concentrates around pn and hence E[ i Yi ] ≈ log(pn). Assume next that i is not selected. We start with the observation that Xi and Xn+1−i have the same distribution. Consider i < n/2. Position i stays a maximum if non of the preceding i − 1 elements move to a position larger than i. Analogously, position n + 1 − i stays a maximum if non of the succeeding i − 1 elements move to a position smaller than i + 1 − i. We therefore concentrate on i ≤ n/2. If k1 elements among the first i − 1 and k2 elements among the last n − i are selected, the probability that i stays a maximum is f (k1 , k2 ) =
k1 ! · k2 ! . (k1 + k2 )!
The expression for f (k1 , k2 ) is decreasing in both arguments. Namely, k1 ! · (k2 + 1)! · (k1 + k2 )! k2 + 1 f (k1 , k2 + 1) = = ≤1. f (k1 , k2 ) (k1 + k2 + 1)! · k1 ! · k2 ! k1 + k2 + 1 We want to compute E[ i≤n/2 Xi ]. Define L = (16/p) log n. We split the sum into two parts: i ≤ L and i > L. For the second part, i > L, we expect to select about pi ≥ pL elements less than i and about p(n − i) ≥ pn/2 elements larger than i. The probability that we select less than half the stated number in either part is less than exp(−(16/8) log n) = O(n−2 ) by Chernoff bounds. If at least pL/2 = 8 log n elements smaller than i are selected and at least pn/4 elements larger than i are selected the probability that i is a maximum is less than f (8 log n, pn/4) = O(n−2 ). Taking into account that i in not selected, we get prob(Xi = 1) = O((1 − p)n−2 ) for L ≤ i ≤ n/2. We turn to the i’s with i < L. If none of the first i − 1 elements is selected i stays a maximum. If at least one of the first i − 1 elements is chosen, the probability that i stays a maximum is at most e−pn/16 + 4/pn. The first term accounts for the fact that less than pn/4 elements larger i are selected and the
204
Cyril Banderier, Ren´e Beier, and Kurt Mehlhorn
second term accounts for the fact that at least pn/4 elements larger i are selected and none of them is moved to a position before i. Thus for i < L prob(Xi = 1) ≤ (1 − p) (1 − p)i−1 + e−pn/16 + 4/pn and hence L−1
E[
i=1
Xi ] ≤
1−p 1−p + (1 − p)L(e−pn/16 + 4/pn) = (1 + o(1)), p p
for constant p. Taking into account all i ≥ n/2, we conclude 2(1 − p) E[ (Xi + Yi )] ≤ log(pn) + + o(1) . p i In fact, constant p is not required. The argument remains valid as long as log n/(p2 n) = o(1), i.e., for p log n/n. We now come to the first assertion of the theorem: the complexity of the worst case among all perturbations. We show that, for p < 1/2, the smoothed number of left-to-right maxima in a permutation of n elements may be Ω( n/p). Consider the sequence n − k, n − k + 1, . . . , n, 1, 2, . . . , n − k − 1 (where k = n/p) . The first part of the sequence consists of the first k elements. Let a ≈ pk and b ≈ p(n − k) be the number of selected elements in the first and second part of the sequence respectively. For large n, the probability that a > 2pk or b < pn/2 is exponentially small by Chernoff bounds. So assume a ≤ 2pk and b ≥ pn/2. The probability that all elements selected in the first part are put into the second part by the random permutation of the selected elements is at least q :=
b−1 b−a+1 b · ··· . a+b a+b−1 b+1
In this case all elements not selected in the first part are left-to-right maxima. We have a a 4a2 2a 2a b−a ≥ exp − . = 1− = exp a ln 1 − q≥ a+b a+b a+b a+b since ln(1 − x) ≥ −2x for 0 ≤ x ≤ 3/4. Using a ≤ 2pk and b ≥ pn/2 we get 4(2p)2 n/p 4a2 ≥ exp − ≥ e−32 . q ≥ exp − a+b pn/2 We conclude that with constant probability the number of left-to-right maxima in the perturbed sequence is at least k − a ≥ k(1 − 2p) = Ω( n/p) for p < 1/2.
Smoothed Analysis of Three Combinatorial Problems
205
We next show an almost matching upper bound. Let s1 , . . . , sn be an arbitrary permutation of the numbers 1 to n, let k = 8(n/p) log n, and let I be the set of indices such that i ≥ k and si ≤ n − k. Basically, I ignores the first k and the largest k elements of the permutation. We estimate how many si with i ∈ I are left-to-right maxima in the perturbed sequence. Then the total number of maxima is at most 2k larger. Consider a fixed si with i ∈ I. If si is selected and is a maximum in the partial permutation, it must be a maximum among the selected elements. The expected number of left-to-right maxima among the selected elements is ln pn. So assume that si is not selected. With high probability there are at least kp/2 elements preceding si among the selected elements, there are at least kp/2 elements larger than si among the selected elements, and there are at most 2np selected elements. Therefore, the probability that si is a maximum in the perturbed sequence is bounded by kp/2 kp/2 2np − kp/2 k 1 ≤ 1− ≤ exp(−k 2 p/(8n)) = 2np 4n n and hence the expected number of left-to-right maxima in the perturbed se quence is O( (n/p) log n) .
4
Single Source Shortest Path Problems
We consider the single source shortest path problem with nonnegative integer edge weights. As usual, let n and m denote the number of nodes and edges respectively. We assume our edge weights to be in [0, 2K −1], i.e., edge weights are K bit integers. Meyer [10] has shown that the average complexity of the problem is linear O(n + m). He assumes edge weights to be random K bit integers and that a certain set of primitive operations on such integers can be performed in constant time (addition, finding the first bit where two integers differ, . . . ). The algorithm can be used for arbitrary graphs. An alternative algorithm was later given by Goldberg [6] and his work is the starting point for this section. The worst case complexity of his algorithm is O(m + nK). Algorithms with better worst case behavior are known [1,4,12,8]. Theorem 3 (Shortest Paths under Limited Randomness). Let G be an arbitrary graph, let c : E → [0, . . . , 2K − 1] be an arbitrary cost function, and let k be such that 0 ≤ k ≤ K. Let c be obtained from c by making the last k bits of each edge cost random. Then the single source shortest path problem can be solved in expected time O(m + n(K − k)). With full randomness the expected running time is O(m + n), with no randomness the running time is O(m + nK). Limited randomness interpolates linearly between the extremes. Proof: Goldberg has shown that the running time of his algorithm is (K − log min in cost(v) + 1), O(n + m + v
206
Cyril Banderier, Ren´e Beier, and Kurt Mehlhorn
where min in cost(v) denotes the minimal cost of an (directed) edge with target node v. Next observe that min in cost(v) is the minimum of indeg(v) numbers of which the last k bits are random; here indeg(v) denotes the indegree of v. For an edge e, let r(e) be the number of leading zeroes in the random part of e. Then E[r(e)] ≤ 2 and K − log min in cost(v) ≤ K − k + max{r(e) ; e ∈ inedges(v)} ≤K −k+ {r(e) ; e ∈ inedges(v)} Thus E[K − log min in cost(v)] ≤ K − k + O(indeg(v)) and the time bound follows. In our model of perturbation, the last k bits of each weight are set randomly. Alternatively, one might select bits with probability p and set selected bits to random values. With this definition, the smoothed complexity becomes O(m/p). For an edge e, let r(e) be the number of leading zeroes in the weight of e. Then E[r(e)] ≤ 2/p and K − log min in cost(v) ≤ max{r(e) ; e ∈ inedges(v)} ≤ {r(e) ; e ∈ inedges(v)} Therefore, E[K − log min in cost(v)] ≤ O(indeg(v)/p) and the time bound follows.
5
Conclusion
We have analyzed the smoothed complexity of three combinatorial problems. Smoothed complexity gives additional information about the distribution of hard instances in instance space. We believe, that the analysis of further discrete problems is a worthwhile task. Beccetti et al. [2] have recently analyzed NonClairvoyant scheduling under the partial bit randomization model. From a more theoretical viewpoint, it is natural to raise the question “Is there any relevant notion of smoothed complexity completeness?”. Such a notion would have to extend the notion of average case completeness which was introduced by Levin [9,7]. In conclusion, we believe that smoothed complexity is a key concept to get a better understanding of the behavior of algorithms in practice.
References 1. R. K. Ahuja, K. Mehlhorn, J. B. Orlin, and R. E. Tarjan. Faster algorithms for the shortest path problem. J. Assoc. Comput. Mach., 37(2):213–223, 1990. 2. L. Becchetti, S. Leonardi, A. Marchetti-Spaccamela, G. Sch¨ afer, and T. Vredeveld. Smoothening helps: A probabilistic analysis of the Multi-Level Feedback algorithm. submitted, 2003.
Smoothed Analysis of Three Combinatorial Problems
207
3. A. Blum and J.D. Dunagan. Smoothed analysis of the perceptron algorithm for linear programming. In Proceedings of the 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA-02), pages 905–914. ACM Press, 2002. 4. Boris V. Cherkassky, Andrew V. Goldberg, and Craig Silverstein. Buckets, heaps, lists, and monotone priority queues. SIAM J. Comput., 28(4):1326–1346 (elec