Lecture Notes in Computer Science Edited by G. Goos, J. Hartmanis and J. van Leeuwen
1450
Lubog Brim Jozef Gruska Jifi Zlatugka (Eds.)
Mathematical Foundations of Computer Science 1998 23rd International Symposium, MFCS'98 Brno, Czech Republic, August 24-28, 1998 Proceedings
@Springer
Series Editors Gerhard Goos, Karlsruhe University, Germany Juris Hartmanis, Cornell University, NY, USA Jan van Leeuwen, Utrecht University, The Netherlands Volume Editors Lubog Brim Jozef Gruska Ji~i Zlatu~ka Masaryk University, Faculty of Informatics Botanickfi 68a, 602 00 Brno, Czech Republic E-mail: {brim, gruska, zlatuska} @fi.muni.cz Cataloging-in-Publication data applied for
Die Deutsche Bibliothek - CIP-Einheitsaufnahme
Mathematical foundations of computer science 1998 : 23rd international symposium ; proceedings / MFCS '98, Brno, Cz~ech Republic, August 24 - 28, 1998. Lubog Brim ... (ed.). - Berlin ; Heidelberg, New York ; Barcelona ; Budapest ; Hong Kong ; London ; Milan ; Paris ; Singapore ; Tokyo : Springer, 1998 (Lecture notes in computer science ; Vol. 1450) ISBN 3-540-64827-5
CR Subject Classification (1991): F, C.2, G.2 ISSN 0302-9743 ISBN 3-540-64827-5 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, m its current version, and permission for use must always be obtained from Springer-Verlag.Violations are liable for prosecution under the German Copyright Law. 9 Springer-Verlag Berlin Heidelberg 1998 Printed in Germany Typesetting: Camera-ready by author SPIN 10638164 06/3142 - 5 4 3 2 1 0
Printed on acid-free paper
Foreword
The 23rd International Symposium on the Mathematical Foundations of Computer Science (MFCS'98) was held in Brno, Czech Republic, during August 24-28, 1998. It was organized at Masaryk University in Brno by the Faculty of Informatics in co-operation with universities in Aachen, Haagen, Linz, Metz, Pisa, Szeged, Vienna, and other institutions. MFCS'98 formed one part of a federated conferences event, the other part being CSL'98, the annual conference of the European Association of Computer Science Logic. This federated conferences event consisted of common plenary sessions, invited talks, several parallel technical programme tracks, a dozen satellite workshops organised in parallel with MFCS'98, and tutorials. MFCS'98 was the 23rd in a series of conferences organized on a rotating basis between the Czech Republic, Poland, and Slovakia, aiming at bringing together specialists in various fields of theoretical computer science and stimulating mathematical research in relevant areas. Previous meetings of the series took place in Jabtonna, 1972; Strbsk@ Pleso, 1973; Jadwisin, 1974; MariAnsk~ L~zn~, 1975; Gdafisk, 1976, Tatransl~ Lomnica, 1977; Zakopane, 1978; Oloq mouc, 1979; Rydzyna, 1980; Strbsk@ Pleso, 1981; Prague, 1984; Bratislava, 1986; Carlsbad, 1988; Por~bka-Kozubnik, 1989; Bansk~ Bystrica, 1990; Kazimierz Dolny, 1991; Prague, 1992; Gdafisk, 1993; Ko~ice, 1994; Prague, 1995; KrakSw, 1996; and Bratislava, 1997. MFCS'98 marked the 25th anniversary of the first MFCS meeting which took place in Czechoslovakia at Strbsk@ pleso. MFCS'73 is remembered for taking a very broad, advanced, and stimulating view of the theoretical foundations of computing, and for the high scientific and organizational standard. Preparation of MFCS'98 and its satellite events was undertaken with the intention of continuing in this honorable tradition. There were 168 submissions sent to the program committee in response to the call for papers, which was distributed primarily electronically to major computer science departments, individual researchers, and electronic mailing lists. All but one submissions were received electronically over the Internet. Every paper was assigned to three program committee members for review and referee reports were collected electronically using e-mail or WWW-based forms from the individual referees over the period March 25 - May 11, 1998. Program committee meetings were organized in a distributed way, based on a very efficient combination of electronic, telephone, and physical meetings and break-away discussions devoted to borderline or unclear cases. Clear timelines were maintained for individual steps of the process and these were used both by program committee members meeting physically and by those joining the selection meeting electronically.
VI
Foreword
Electronic pre-meeting discussions started on May 12, 1998 based on an electronic-mailing-list-enabled discussion of paper evaluations and and on completion of the reviews so that every paper had been reviewed by at least three separate referees. The fully-electronic part of the meeting concluded on May 15. During the weekend of May 15 and 16, five program committee members (denoted by an asterisk in the program committee members listing) met at the Faculty of Informatics in Brno. They were provided with Internet access using several computers, telephone and fax lines, and conducted a very careful selection of 72 papers eventually selected for conference presentation. The selection process concluded on May 16 at 15:00 after having passed through most stages of the selection procedure using almost entirely electronic contact with nearly all members of the program committee. These were continuously provided with information concerning the actual state of the selection process, and they returned their reactions and opinions using e-mail, telephone, and fax, as the basis for the ultimate decisions. Based on the information already known at the date of writing this, the Federated CSL/MFCS'98 Conferences event consisted of more than two hundred talks presented within up to eight parallel technical tracks including 34 invited talks for four plenary CSL/MFCS sessions, more than 10 invited talks for MFCS, five for CSL, and still others for the satellite workshops (taking typically 2-3 days each). Out of these, 10 invited and 71 submitted MFCS talks are presented in this volume. Last but not least, four tutorials were organized in the two days preceding and following the symposium: Abstract state machines by E. BSrger (Pisa) and Yu. Gurevich (Ann Arbor), The Theorema system: An introduction with demonstrations by B. Buchberger (RISC-Linz) and T. Jebelan (RISC-Linz), Approximation algorithms by P. L. Crescenzi (Florence), J. Diaz (Rome), and A. Marchetti-Spaccamela (Rome), and Quantum computing and quantum logic by C. H. Bennett (IBM T. Watson Center, Yorktown Heights) and K. Svozil (Vienna). The main organizer of the Federated CSL/MFCS'98 Conferences was the Faculty of Informatics of Masaryk University, the very first specialized faculty of its kind established in the Czech Republic four years ago. The Organizing Committee was chaired by Jan Staudek. Special thanks go to Antonin Ku~era as the program committee secretary and to Vladimiro Sassone who supplied the WWW-based system which was used to conduct most of the work in an electronic environment. Without these, the program committee's task of formulating a really outstanding program (given the volume of high-quality submissions) would have been immensely more complicated. Lubo~ Brim as co-editor has performed the principal editing work needed in connection with collecting the final versions of the papers and tidying things up for the final appearance of the MFCS'98 proceedings as a Springer LNCS volume using LNCS I~TEX style. Last but not least, we would like to express our thanks to the invited speakers, the authors of contributed papers, tutorial presenters and also to the workshop
Foreword
VII
speakers and organizers for contributing significantly and setting new bounds for the scope and size of MFCS'98.
Jozef Gruska and Ji~i Zlatugka
Brno, June 1998
MFCS'98
Program
Committee
S. Abramsky (Edinburgh) J. Diaz (Barcelona) J. Gruska, co-chair (Brno)* T. Henzinger (Berkeley) G. Mirkowska (Pau) U. Montanari (Pisa) M. Paterson (Warwick) J. Sgall (Prague)* J. Tiuryn (Warsaw) P. VitAnyi (Amsterdam) M. Wirsing (Munich)*
MFCS'98
Organizing
M. Brandejs L. Brim T. Duda~ko J. Foukalovgt I. Hollanovh D. Janou~kovA A. K@era L. Moty~kovA
B. Buchberger (Linz) V. Diekert (Stuttgart) I. Guessarian (Paris) R. J. Lipton (Princenton) F. Moller (Uppsala) J. Ne~etfil (Prague) G. P~tun (Bucharest) W. Thomas (Kiel) U. Vaccaro (Salerno)* P. Voda (Bratislava) J. Zlatu~ka, co-chair (Brno)*
Committee J. Obdr~hlek M. Povoln:~ P. Smr~ P. Sojka J. Srba J. Staudek, chair P. Star:~ Z. Walletzk~
Referees
S. Abramsky L. de Alfaro J-P. Allouche N. Alon Th. Altenkirch R. Alur C. Alvarez E. Asarin V. Auletta R. Backofen J. Balcazar R. Banach M. Bauderon B. Bauer D. Beauquier B. Berard J. Berstel C. Blundo L. Boasson M. Bonet F. Brandenburg L. Brim V. Bruyere B. Buchberger H. Buhrman G. Buntrock D. Caucal P. Cegielski P. Cenciarelli B. Chlebus C. Choffrut E. Contejean B. Courcelle P. Cousot K. (~ulfk J. Dassow P. Degano A. Degtyarev J. Desel M. Dezani J. Diaz
V. Diekert W. Drabent M. Droste B. Durand $. Edwards F. Esposito C. De Felice H. Fernau M. Fisher R. Freivalds C. Frougny J. Gabarro L. Gargano P. Gastin R. Gavalda D. Giammarresi P. Di Gianantonio R. Gilleron S. Gilmore F. Gire R. van Glabbeek V. Glasn~k S. Gnesi W. Goerigk P. Goldberg E. Graedel S. Grigorieff J.-F. Groote D. P. Gruska J. Gruska I. Guessarian D. Guijarro D. Guller R. Hennicker T. Henzinger U. Hertrampf J. Hromkovi~ P. Indyk P. Jan~ar K. Jansen M. Jantzen
T. Jebelean S. Kalvala J. Karhum~iki J. Kaxi B. Kirsig R. Klasing E. P. Klement A. Knapp I. Korec P. Kosiuczenko J. Krajf~ek H. Kreowski M. K[etinsk:~ D. Krizanc A. Ku~era M. Kudlek W. Kuich M. Kunde O. Kupferman A. Kurz Ch. Lueth K.-J. Lange E. Laporte S. Lasota V. Laurent J. van Leeuwen G. Lenzi S. Leonardi B. Leoniuk R. Lipton M. Lohrey A. Lopes A. de Luca C. Lfith G. Manzini G. De Marco L. Margara M. Marin B. Martin C. Martinez A. Masini
X
Referees
O. Matz G. Mauri J. Mazoyer P.-A. Mellies S. Merz B. Meyer P. Michel G. Mirkowsk~ F. Moiler U. Montanari A. Muscholl M. Napoli Ph. Narbel J. Ne~et~il R. De Nicola D. Niwinski M. Novotny S.-O. NystrSm P. Olveczky C.-H. L. Ong A. Osterloh L. Pacholski J. Padberg D. Pardubs!~ M. Parente M. Paterson D. Pattinson P. Pau G. P~un G. Persiano H. Petersen G. Pighizzini R. Pinzani M. Pl~tek A. Podelski L. Pol~k M. Prasad R. De Prisco
P. Pudl~k S. K. Rajamani J. Rehof K. Reinhardt A. Restivo B. Reus J. M. Robson H. Rolletschek L. Rosaz
J. Rosick:~ M. de Rougemont P. Rozi~re W. Rytter C. Sahinalp J. Sakarovitch A. Salwicki A. De Santis P. Savicky V. Scarano J. Schicho I. Schiering Ph. Schnoebelen A. Schoenegge W. Schreiner A. Schubert J. Sefr~nek S. Seibert G. S@nizergues M. Serna J. Sgall P. Sgall R. Silvestri L. Skarvada K. Skodinis P. Sosik P. Spirakis B. Sprick L. Staiger
M. Stan~k J. Steinbach M. Steinby P. Stevens C. Stirling H. Stoerrle J. Sturc W. Thomas S. Tiga S. Tison J. Tiuryn E. Tomuta J. Tromp J. Tyszkiewicz U. Vaccaro E. Valkema D. Vasaru M. Veanes B. Victor P. Vitanyi P. Voda H. Vogler I. Walukiewicz A. Weiermann J. Wiedermann Th. Wilke M. Wirsing A. Woods Th. Worsch H. Yassine Sheng Yu J-B. Yunes S. 7,~k M. Zawadowski Li Zhang K. Zikan J. Zlatu~ka A. Zvonkine
Table of Contents
Invited Papers H y p e r g r a p h Traversal Revisited: Cost Measures and Dynamic A l g o r i t h m s .
1
G. Ausiello, G. F. Italiano, and U. Nanni Defining the J a v a Virtual Machine as Platform for Provably Correct Java Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
E. B6rger, W. Schulte Towards a Theory of Recursive Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
D. Harel Modularization and Abstraction: The Keys to Practical Formal Verification 54
Y. Kesten, A. Pnueli On the Role of Time and Space in Neural C o m p u t a t i o n . . . . . . . . . . . . . . . . .
72
W. Maass From Algorithms to Working Programs: On the Use of P r o g r a m Checking in LEDA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
K. Mehlhorn, S. Ndher Computationally-Sound Checkers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
S. Micali Reasoning About the Past . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
117
M. Nielsen Satisfiability - Algorithms and Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
129
P. Pudldk The Joys of Bisimulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
142
C. Stifling Towards Algorithmic Explanation of Mind Evolution and Functioning . . . . 152
J. Wiedermann
Contributed Papers Complexity of Hard Problems Combinatorial Hardness Proofs for Polynomial Evaluation . . . . . . . . . . . . . .
M. Aldaz, J. Heintz, G. Matera, J. L. Monta~a, and L. M. Pardo
167
XII
Table of Contents
Minimum Propositional Proof Length is NP-Hard to Linearly Approximate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
176
M. Alekhnovich, S. Buss, S. Moran, and T. Pitassi Reconstructing Polyatomic Structures from Discrete X-Rays: NP-Completeness Proof for Three Atoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
185
M. Chrobak, Ch. Diirr Locally Explicit Construction of R6dl's Asymptotically Good Packings . . . 194
N. Kuzjurin Logic - Semantics
- Automata
Proof Theory of Fuzzy Logics: Urquhart's C and Related Logics . . . . . . . . .
203
M. Baaz, A. Ciabattoni, Ch. Fermiiller, and H. Veith Nonstochastic Languages as Projections of 2-Tape Quasideterministic Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
213
R. Bonnet, R. Freivalds, J. Lapi~, and A. Lukjanska Flow Logic for Imperative Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
220
F. Nielson, H. R. Nielson Expressive Completeness of Temporal Logic of Action . . . . . . . . . . . . . . . . . .
229
A. Rabinovich Rewriting Reducing AC-Termination to Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
239
M. C. F. Ferreira, D. Kesner, and L. Puel On One-Pass Term Rewriting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
248
Z. FiilSp, E. Jurvanen, M. Steinby, and S. VdgvSlgyi On the Word, Subsumption, and Complement Problem for Recurrent Term Schematizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
257
M. Hermann, G. Salzer Encoding the Hydra Battle as a Rewrite System . . . . . . . . . . . . . . . . . . . . . . .
267
H. Touzet Automata
and Transducers
Computing e-Free NFA from Regular Expressions in O(n log2(n)) Time . . . 277
Ch. Hagenah, A. Muscholl Iterated Length-Preserving Rational Transductions . . . . . . . . . . . . . . . . . . . . .
M. Latteux, D. Simplot, and A. Terlutte
286
Table of Contents The Head Hierarchy for Oblivious Finite A u t o m a t a with Polynomial Advice Collapses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XIII
296
H. Petersen T h e Equivalence Problem for Deterministic Pushdown Transducers into Abelian Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
305
G. Sdnizergues Typing The Semi-Full Closure of Pure T y p e Systems . . . . . . . . . . . . . . . . . . . . . . . . . .
316
G. Barthe Predicative Polymorphic Subtyping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
326
M. Benke A Computational Interpretation of the A/z-Calculus . . . . . . . . . . . . . . . . . . . .
336
G. M. Bierman Polymorphic Subtyping Without Distributivity . . . . . . . . . . . . . . . . . . . . . . . .
346
J. Chrzqszcz Concurrency
- Semantics
-
Logic
A (Non-elementary) Modular Decision Procedure for LTrL . . . . . . . . . . . . . .
356
P. Gastin, R. Meyer, and A. Petit Complete Abstract Interpretations Made Constructive . . . . . . . . . . . . . . . . . .
366
R. Giacobazzi, F. Ranzato, and F. Scozzari Timed Bisimulation and Open Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
378
Th. Hune, M. Nielsen Deadlocking States in Context-Free Process Algebra . . . . . . . . . . . . . . . . . . . .
388
J. Srba
Circuit Complexity A Superpolynomial Lower Bound for a Circuit Computing the Clique Function with At Most (1/6)log log n Negation Gates . . . . . . . . . . . . . . . . . . .
399
K. Amano, A. Maruoka On Counting A C ~ Circuits with Negative Constants . . . . . . . . . . . . . . . . . . . .
409
A. Ambainis, D. M. Barrington, and H. L$Thanh A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice's Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L. A. Hemaspaandra, J. Rothe
418
XIV
Table of Contents
Programming Model Checking Real-Time Properties of Symmetric Systems . . . . . . . . . . . .
427
E. A. Emerson, R. J. Trefler Locality of Order-Invariant First-Order Formulas . . . . . . . . . . . . . . . . . . . . . .
437
M. Grohe, T. Schwentick Probabilistic Concurrent Constraint Programming: Towards a Fully Abstract Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
446
A. Di Pierro, H. Wiklicky Lazy Functional Algorithms for Exact Real Functionals . . . . . . . . . . . . . . . . .
456
A. K. Simpson
Structural Complexity Randomness vs. Completeness: On the Diagonalization Strength of Resource-Bounded R a n d o m Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
465
K. Ambos-Spies, S. Lempp, and G. Mainhardt Positive Turing and Truth-Table Completeness for N E X P Are Incomparable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
474
L. Bentzien Tally NP Sets and Easy Census Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
483
J. Goldsmith, M. Ogihara, and J. Rothe Average-Case Intractability vs. Worst-Case Intractability . . . . . . . . . . . . . . . .
493
J. KSbler, R. Schuler
Formal Languages Shuffle on Trajectories: The Schfitzenberger Product and Related Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
503
T. Harju, A. Mateescu, and A. Salomaa Gaugian Elimination and a Characterization of Algebraic Power Series . . . . 512
W. Kuich DOL-Systems and Surface Automorphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
522
L.-M. Lopez, P. Narbel About Synchronization Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L Ryl, Y. Roos, and M. Clerbout
533
Table of Contents
XV
Graphs and Hypergraphs When Can an Equational Simple Graph Be Generated by Hyperedge Replacement ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
543
K. Barthelmann Spatial and Temporal Refinement of Typed Graph Transformation Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
553
M. Gro~e-Rhode, F. Parisi-Presicce, and M. Simeoni Approximating Maximum Independent Sets in Uniform Hypergraphs . . . . . 562
Th. Hofmeister, H. Lefmann Representing Hyper-Graphs by Regular Languages . . . . . . . . . . . . . . . . . . . . .
571
S. La Torre, M. Napoli
Turing Complexity and Logic Improved Time and Space Hierarchies of One-Tape Off-Line TMs . . . . . . . .
580
K. Iwama, Ch. Iwamoto Tarskian Set Constraints Are in NEXPTIME . . . . . . . . . . . . . . . . . . . . . . . . . .
589
P. Mielniczuk, L. Pacholski V3*-Equational Theory of Context Unification i s / / ~
...............
597
S. Vorobyov Speeding-Up Nondeterministic Single-Tape Off-Line Computations by One Alternation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
J. Wiedermann
Binary Decision Diagrams Facial Circuits of Planar Graphs and Context-Free Languages . . . . . . . . . . .
616
B. Courcelle, D. Lapoire Optimizing OBDDs Is Still Intractable for Monotone Functions . . . . . . . . . .
625
K. Iwama, M. Nozoe, and S. Yajima Blockwise Variable Orderings for Shared BDDs . . . . . . . . . . . . . . . . . . . . . . . .
636
H. Preu~, A. Srivastav On the Composition Problem for OBDDs with Multiple Variable Orders .. 645
A. Slobodovd
Combinatorics on Words Equations in Transfinite Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ch. Choffrut, S. Horvath
656
XVI
Table of Contents
Minimal Forbidden Words and Factor A u t o m a t a . . . . . . . . . . . . . . . . . . . . . . .
665
M. Crochemore, F. Mignosi, and A. Restivo On Defect Effect of Bi-Infinite Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
674
J. Karhumiiki, J. Mailuch, and W. Plandowski On Repetition-Free Binary Words of Minimal Density . . . . . . . . . . . . . . . . . .
683
R. Kolpakov, G. Kucherov, and Y. Tarannikov
Trees and Embeddings Embedding of Hypercubes into Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
693
S. L. Bezrukov, J. D. Chavez, L. H. Harper, M. R5ttger, and U.-P. Schroeder Tree Decompositions of Small Diameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
702
H. L. Bodlaender, T. Hage~up Degree-Preserving Forests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
713
H. Broersma, A. Huck, T. Kloks, O. Koppius, D.Kratsch, H. Miiller, and H. Tuinstra A Parallelization of Dijkstra's Shortest P a t h Algorithm . . . . . . . . . . . . . . . . .
722
A. Crauser, K. Mehlhorn, U. Meyer, and P. Sanders
P i c t u r e Languages - Function S y s t e m s / C o m p l e x i t y Comparison Between the Complexity of a Function and the Complexity of Its Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
732
B. Durand, S. Porrot IFS and Control Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
740
H. Fernau, L. Staiger One Quantifier Will Do in Existential Monadic Second-Order Logic over Pictures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
751
O. Matz On Some Recognizable Picture-Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
760
K. Reinhardt
C o m m u n i c a t i o n - Computable Real N u m b e r s On the Complexity of Wavelength Converters . . . . . . . . . . . . . . . . . . . . . . . . .
771
V. Auletta, I. Caragiannis, Ch. Kaklamanis, and P. Persiano On Boolean vs. Modular Arithmetic for Circuits and Communication Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C. Damm
780
Table of Contents Communication Complexity and Lower Bounds on Multilective Computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XVII
789
J. Hromkovig A Finite Hierarchy of the Recursively Enumerable Real Numbers . . . . . . . .
798
K. Weihrauch, X. Zheng Cellular
Automata
One Guess One-Way Cellular Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
807
Th. Buchholz, A. Klein, and M. Kutrib Topological Definitions of Chaos Applied to Cellular Automata Dynamics. 816
G. Cattaneo, L. Margara Characterization of Sensitive Linear Cellular Automata with Respect to the Counting Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
825
G. Manzini Additive Cellular Automata over Z~p and the Bottom of (CA,_ 1 ; sin leton source sets: S M = S S t
Hypergrap Traversal Revisited
3
The size s, that is the overall len th of the description of the hyper raph (also denoted as H ). If we represent a directed hyper raph by means of adjacency lists we have that H s = n + a0 + h. In the special case where a directed hyper raph is a directed raph, the number of vertices is equal to the number of nodes n, and the number of ed es is m = h. Furthermore, a = n, a0 = 0, and s = n + m. De nition 2. Let H = N H be a directed hyper raph. A hyper raph H0 = H 0, S N 0, N 0 H 0 such that (a) N 0 N , (b) H 0 H, and, for each S t 0 H Furthermore, let is called a subhyper raph of H. We denote this by H H 0 H be a set of hyperarcs in H. Let N 0 N be the union of source sets and tar et nodes of hyperarcs in H 0 . The hyper raph H0 = N 0 H 0 is said to be the subhyper raph of H induced by H 0 . Fi ure 1 shows an example of hyper raph and subhyper raph.
E E
B A H
B H
F
C
G
C
F
D a)
b)
Fi . 1. (a) A directed hyper raph H and (b) a subhyper raph H0 induced by the set of hyperarcs C F F B BF E H E .
We now de ne the notion of hyperpath in directed hyper raphs. Before, we recall some terminolo y on directed raphs. A path in a directed raph is a seek and vertices v0 v1 vk , such that e = (v −1 v ), quence of ed es e1 e2 1 i k. A path is simple if no vertex is repeated twice. It is a cycle if v0 = vk . If v = vj for some i = j, then the path contains a cycle as a subpath. Given a path from x to y, we can describe in di erent ways. One simple-minded description of a path is to ive the sequence of all the ed es in , as traversed while oin from x to y. Notice that this description may contain the same ed e more than once and may not even be bounded, since may contain a cycle which is traversed an unbounded number of times. We refer to this description of a path as unfolded. An alternative description may be the sub raph of G containin exactly the ed es of (note that each ed e is considered only once). If the raph G is nite, this description is always bounded, and the path is referred to as folded. We now turn to directed hyper raphs, and show that there is an even deeper di erence between folded and unfolded hyperpaths.
4
Giorgio Ausiello et al.
De nition 3. Let H = N H be a directed hyper raph, X N be a non-empty subset of nodes, and y be a node in N . There is a hyperpath from X to y in H if either (a) y X (extended reflexivity); or (b) there is a hyperarc Z y H Z (extended transitivity). and hyperpaths from X to each node z The recursive de nition of a hyperpath is naturally described by a tree labeled on the nodes, referred to as the hyperpath tree, and de ned as follows. De nition 4. Let H = N H be a directed hyper raph, X N be a non-empty subset of nodes, and y be a node in N such that there is a hyperpath from X to y. A hyperpath tree from X to y is a tree tX y de ned as follows: (a) if H y X (extended reflexivity) tX y is empty; (b) if there is a hyperarc Z y Z (extended transitivity), then tX y and hyperpaths from X to each node z consists of a root labeled with hyperarc Z y havin as subtrees the hyperpath Z. trees tX z for each node z Note that the hyperpath tree tX y is such that its root has the tar et node y in its label. Furthermore, if S t is the label of a leaf in the hyperpath tree, the source set S is contained in X. We refer to the hyperpath tree as the unfolded representation of a hyperpath. As in the case of a path in a directed raph, this representation describes explicitly the sequence of hyperarcs, as traversed while oin from X to y. Once a ain, the same hyperarc may appear more than once in the hyperpath tree. In what follows, we will use interchan eably the terms unfolded hyperpath and hyperpath tree. As in the case of paths on raphs, also for hyperpaths there is an alternative and more concise description: De nition 5. Let H = N H be a directed hyper raph. Let X N be a nonempty subset of nodes of H, and y N be a node such that there is a hyperpath from X to y in H. A folded hyperpath hX y from X to y is iven by the subhyper raph of H induced by the hyperarcs in the unfolded hyperpath tX y . Throu hout this paper, we refer to a folded hyperpath more simply as a hyperpath. As a consequence of De nition 5, either hX y is the empty hyper raph Z, there exists a or there is a hyperarc Z y in hX y and, for each node z hyperpath hX z from X to z which is a subhyper raph of hX y . Fi ure 2 shows an unfolded and a folded hyperpath of the hyper raph iven in Fi ure 1. De nition 6. Let H = N H be a directed hyper raph. Let X N be a nonempty subset of nodes of H, and let x be a node in X. If there is a nonempty hyperpath hX x in H consistin of at least one hyperarc, then hX x is a hypercycle. A hyperpath is cyclic if it contains at least one hypercycle as a subhyper raph, and is acyclic otherwise. We remark that the unfolded representation of a cyclic hyperpath may use several times the same hyperarc. As in the case of directed raphs, this implies that the unfolded representation of a hyperpath can be much lar er than its folded representation. However, di erently from the case of directed raphs, this is not the only case in which this can happen: indeed, there may be even acyclic
Hypergrap Traversal Revisited
5
B H
F
C
G
D
a)
b)
Fi . 2. (a) Unfolded and (b) folded hyperpath from C to H in the hyper raph H of Fi ure 1(a). hyperpaths whose unfolded representation is exponentially lar er than the size of their folded representation. Let G be a directed raph, where each ed e has associated a cost. Then the cost of a path is simply iven by the sum of the costs of all its ed es. Di erently from the case of paths in directed raphs, hyperpaths in directed hyper raphs have a much more complex structure: this yields di erent ways of measurin the cost of the same hyperpath. We start with few natural de nitions. De nition 7. The number of hyperarcs of a hyperpath hX y = Nh Hh is de ned to be the cardinality of the set of hyperarcs: n(hX y ) = Hh . De nition 8. The size of a (folded) hyperpath hX y = Nh Hh is the sum of the number of hyperarcs and source area: s(hX y ) = Hh +
S S 2S (hX y )
where S(hX y ) is the set of all the source sets in hX y . De nition 9. A wei hted hyper raph H is a triple N H w where N H is a directed hyper raph and w is a measure function, which assi ns a real wei ht to all hyperarcs of N H . De nition 10. The cost c(hX y ) of a hyperpath hX y = Nh Hh is the sum of the costs of its hyperarcs: c(hX y ) = S t 2Hh w S t . Note that the size of a hyperpath ives the overall len th of the description of hX y , and that De nition 10 includes as a special case De nition 7 whenever w S t = 1 for each hyperarc S t . Theorem 1. [11] Let H = N H be a directed hyper raph, x and y be two nodes in N , and k be an inte er. The followin problems are NP-complete.
6
Giorgio Ausiello et al.
(P1 ) Find a hyperpath hx y with k hyperarcs or less. (P2 ) Find a hyperpath hx y of cost k or less. (P3 ) Find a hyperpath hx y of size k or less. Findin hyperpaths with minimum source area or minimum number of source sets are easily shown to be NP-hard problems as well. We now de ne a eneral notion of measure function on hyperpaths, and next specialize it to some of the most intuitive measures that ive rise to polynomially solvable optimization problems. De nition 11. Given a directed hyper raph H = N H , the correspondin functional hyper raph HF = N H; F is de ned as follows. Each hyperarc X y H is associated to a triple F X y = (w X y X y f X y ), where: wX y is the wei ht of the hyperarc; X y is a function from X -tuples of reals to reals: X y : f X y is a function from a pair of reals to reals: f X y : 2
jXj
;
.
Let hS t be a hyperpath from a set of nodes S to a sin le node t, and let Z t z k : hS t = hS z 1 hS z 2 be the last hyperarc in hS t , with Z = z1 z2 Z t . Then we use function w() to take into account the cost of the hS zk hyperarc Z t , and () to take into account the costs of the hyperpaths hS z . We nally use function f () to combine these two costs. This is formalized in the followin de nition. is a De nition 12. Given a functional directed hyper raph HF = N H; F functional measure on hyperpaths (or measure function) if there exists a constant then o such that for each hyperpath hS t the followin is true: (a) if hS t = hS z k Z t , then (hS t ) = (hS t ) = o ; and (b) if hS t = hS z1 hS z2 (hS zk ))). f Z t (w Z t Z t ( (hS z1 ) (hS z2 ) In the followin we assume that all the wei hts of hyperarcs are positive, and the value of the measure functions are non-ne ative. We now de ne some of the most intuitive cost measures of hyperpaths, and see how they can be obtained by specializin this de nition. Consider a functional hyper raph HF = N H; F , and let hX y be a hyperpath in HF . In De nition 10 we de ned the cost of a (folded) hyperpath as the sum of the costs of its hyperarcs. In the case of unfolded hyperpaths we de ne the traversal cost as the cost of the root plus the cost of all its subtrees. In other words if a hyperarc is traversed more than once, its cost is repeatedly taken into account. De nition 13. The traversal cost ct (tX y ) of an unfolded hyperpath tX y is inductively de ned as follows:
Hypergrap Traversal Revisited
7
a) if tX y is empty (i.e. y X) then: ct (tX y ) = 0; b) if the unfolded hyperpath tX y has root Z y with subtrees tX zk , then: t X z 1 tX z 2 ct (tX y ) = w Z y +
ct (tX z ) z 2Z
Note that the traversal cost can be obtained with the followin choices: k xk ) = f (x y) = x + y and (x1 x2 =1 x . De nition 14. The rank r(hX y ) of an acyclic hyperpath hX y is recursively de ned as follows: a) if hX y is an empty hyper raph then r(hX y ) = 0; b) if hX y has one hyperarc Z y enterin y, with Z = z1 z2 hX y , then: r(hX y ) = w Z y + maxz 2Z r(hX z ) . hX z
zk
and
Note that the rank is obtained with the followin choices: f (x y) = x+ y and xk ) = max1 k x . If we consider the unfolded hyperpath tX y (x1 x2 de ned in De nition 4, we can recursively de ne the rank rt (tX y ) of the unfolded hyperpath as the sum of the cost of the root plus the maximum rank amon its children. For acyclic hyperpaths, we have that the two possible de nitions of ranks (for folded and unfolded hyperpaths) actually coincide: r(hX y ) = rt (tX y ). We remark that this is not necessarily true, if we try to de ne a rank for cyclic hyperpaths as well. Note that the rank corresponds to the maximum cost path from the root to a leaf in the hyperpath tree. Several other measures are of interest in some applications. For instance, xk ) = min1 k x , we obfor the choice f (x y) = x + y and (x1 x2 xk ) = tain the ap of a hyperpath; for f (x y) = min x y and (x1 x2 min1 k x we obtain the bottleneck of a hyperpath; and for f (x y) = max x y xk ) = max1 k x we obtain the threshold of a hyperpath. and (x1 x2 Intuitively, the bottleneck of a hyperpath hX y corresponds to the minimum wei ht of a hyperarc in hX y , and similarly, the threshold would correspond to the maximum wei ht of a hyperarc in hX y . In the special case where a directed hyper raph is a directed raph, the cost, traversal cost, rank and ap collapse to the usual de nition of len th of a (wei hted) path. Furthermore, the size is twice the numbers of ed es (due to the source area), the bottleneck coincides with the bottleneck capacity of the path (i.e., the ed e with minimum capacity of the path), and the threshold is the maximum cost in the path.
3
Classes of Measure Functions
In his de nition of rammar problems [12], Knuth introduces the concept of superior function for context-free rammars. xk ) from ( + )k into + is a supeDe nition 15. [12] A function (x1 rior function (SUP) if it is monotone nondecreasin in each variable and if: xk ) max(x1 xk ). (x1
8
Giorgio Ausiello et al.
Examples of superior functions are max1 k x , and k=1 x . In a superior Xk ) context-free rammar all the productions are of the form: Y − (X1 where the capital letters are nonterminal symbols, and is a superior function (possibly di erent for each production). For any nonterminal symbol Y of such be a rammar with terminal symbols T , let L(Y ) = T and Y − the set of terminal strin s derivable from Y . If each terminal symbol is iven a constant value in + , it is possible to de ne a function val as a composition + which, iven any strin T , of superior functions, that is val : T provides a correspondin value val ( ). The Grammar Problem consists of ndin the smallest value that can be associated with a nonterminal symbol Y , namely: m(Y ) = min 2L(Y ) val ( ) . By analo y with superior functions, it is possible to introduce a dual notion. xk ) from ( + )k into + is an inferior funcDe nition 16. A function (x1 xk ) tion (INF) if it is monotone nondecreasin in each variable and if: (x1 xk ). min(x1 x restricted Examples of inferior functions are: min x , and the product 1, i = 1 k. to the case 0 x Ramalin am and Reps in [15] introduced a sli ht eneralization of superior functions. xk ) from ( + )k into + is a weakly De nition 17. [15] A function (x1 superior function (WSUP) if it is monotone nondecreasin in each variable and xk ) < x (x1 x xk ) if, for 1 i k, (x1 xk ). = (x1 If a function is SUP, then it is WSUP; examples of weakly superior functions 2, and any constant that are not superior are min1 k x , min1 k x function. A ain, it is possible to introduce a dual de nition. xk ) from ( + )k into + is a weakly infeDe nition 18. A function (x1 rior function (WINF) if it is monotone nondecreasin in each variable and if, for xk ) > x (x1 x xk ) = (x1 xk ). 1 i k, (x1 Also in this case we have that the class WINF contains the class INF. Examples of weakly inferior functions that are not inferior functions are: max x , max x 2, and any constant function. In the followin we investi ate the relationship amon SUP, INF, WSUP, and WINF, as well as their compositions. As a strai htforward consequence of the above de nitions, we have that: SUP WSUP and INF WINF . The followin lemma, summarizes the properties holdin in the case of a eneric composition of functions. Lemma 1. If we are iven the functions f 1 2 h then their composition )) is such that if f 1 2 SUP (resp. INF, f ( 1( ) 2( ) h( h SUP (resp. INF, WSUP, WINF). WSUP, WINF), then f ( 1 2 h)
Hypergrap Traversal Revisited
9
We now relate these properties to our de nition of hyper raphs. Recall that in a functional hyper raph, each hyperarc X y H is associated to a triple (w X y f ). The measure of any hyperpath hS y havin (X y) X y X y as the last hyperarc is iven by (hS y ) = f X y (w X y
X y ( (hS x1 )
(hS x2 )
(hS xk )))
If all the functions f X y , X y (for all X y H) of a functional hyperraph HF are, say, superior functions, then the overall measure function is a superior function as well. Analo ous considerations apply to any combination described in Lemma 1. As a special case, we will consider in many cases functional hyper raphs where all X y , with X y H, are uniform, as well as all f X y . In many applications (such as those mentioned in Section 1) we are exactly in this situation. Both Knuth [12] and Ramalin am and Reps [15] considered also the class of strict (weakly) superior functions, that are characterized by a strict monotonicity between the value the function at hand and each of its ar uments: this leads to the classes SSUP, SWSUP, and may be further eneralized to SINF, and SWINF. In this cases we have the followin results. Lemma 2. If we compose a function f with functions 1 2 h , the followin properties hold: SUP for all i (or vice versa) then f ( 1 2 1. If f SSUP, and h) SSUP; INF for all i (or vice versa) then f ( 1 2 2. If f SINF , and h) SINF ; WSUP for all i (or vice versa) then f ( 1 2 3. If f SWSUP, and h) SWSUP; WINF for all i (or vice versa) then f ( 1 2 4. If f SWINF , and h) SWINF .
4
Hyperpath Optimization Problems on Directed Hyper raphs
An optimization problem P on hyperpaths is characterized by an optimization criterion opt min max , and a measure function on hyperpaths. In the followin we will make use of the notion of the unfolded representation of a hyperpath. We recall that this is a tree whose nodes are the hyperarcs that are used to build up the hyperpath, and that may appear themselves several times, if the hyperpath is cyclic. De nition 19. An optimization problem P = (opt ) is k-cycle-conver ent (CY-CONV) for some k 0 if for each optimal hyperpath hS t between a source set S and a tar et node t there exists a subhyperpath hkS t hS t whose unfolded representation contains each node at most (k+1) times as a tar et, and such that
10
Giorgio Ausiello et al.
(hkS t ) = (hS t ). An optimization problem that is 0-cycle-conver ent is said to be cycle-invariant. In other words, if we are iven a k-cycle-conver ent measure function on hyperpaths for k > 0, an optimal hyperpath may be cyclic. In the remainder of this paper, we will always consider the case k = 0 1. De nition 20. An optimization problem P = (opt ) is cycle-unbounded (CYUNBOUND) if there exist optimal hyperpaths whose unfolded representation contains the same node as a tar et an unbounded number of times. As in the case of di raphs, ndin an optimal (acyclic) solution in the presence of cycles often leads to NP-hard optimization problems. The followin theorem states some properties that characterize optimization problems on hyperpaths. Theorem 2. Let P = (opt ) be an optimization problem on hyper raphs. Then the followin properties hold: a) the minimization of a superior function is cycle-invariant; b) the maximization of an inferior function is cycle-invariant; c) the minimization of a weakly superior function is 1-cycle-conver ent; d) the maximization of a weakly inferior function is 1-cycle-conver ent. Proof. To prove (a), consider an optimization problem where is a superior function, and let hS t be a cyclic optimal hyperpath between a source set S and a tar et node t. Given a hyperpath h, let T (h) be the correspondin unfolded representation. Consider the unfolded hyperpath T (hS t), whose nodes are hyperarcs of the hyperpath: if hS t is cyclic, there must be a branch in such tree containin two nodes (Y1 z), and (Y2 z) with the same tar et node z. Without loss of enerality, suppose that the subtree T1 rooted at (Y1 z) contains the subtree T2 rooted at (Y2 z). By cuttin away from T (h) the whole subtree T2 we still obtain a folded hyperpath with tar et node z whose measure can not be lar er than (hS t ), due to the inequality induced by the concept of superior function between the value of a function and each of its ar uments. We can repeatedly delete subtrees of the initial tree T (hS t) until no cycles are in the tree, (hS t ). Analo ous obtainin an acyclic subhyperpath haS t such that (haS t ) considerations can be used to prove (b). To prove case (c), consider the cyclic hyperpath hS t = =1 k hS z zk . For 1 i k, de ne = (hS z ). If the Z t , where Z = z1 measure function is weakly superior, there is no loss of enerality in assumin that we can split the nodes in the set Z into two subsets ZR and ZI , respectively called the relevant and the irrelevant items of Z, de ned as follows: ZR = z 1 zd , then (hS t ) . 1. If z ZR (a set that mi ht be empty, in case of a conFor each relevant node z stant function), the value of (hS t ) is monotone nondecreasin with respect = (hS z ); to the values
Hypergrap Traversal Revisited
2. If zj
ZI = zd+1
zk , then (hS t ) = (hS t )
11
j =1
Note that the value of (hS t ) does not depend on the values j = (hS zj ), for j d+1 k . Consider the unfolded hyperpath T (hS t) with root Z t havin children 1 d d+1 k . In the iven hypotheses, consider the two S z , for i families of subtrees rooted at the children of Z t : z1 zd , the value of (hS t ) does depend on 1. For the relevant nodes z the content of the unfolded hyperpaths T (hS z ): call relevant the ed es conz1 zd ; nectin the root Z t and the relevant children S z , with z zd+1 zk , (hS t ) does not depend on 2. For the irrelevant nodes zj the actual value of (hS zj ): the role of these irrelevant subhyperpaths is to propa ate the reachability from the root, re ardless their measure. Hence we can replace the eneric hyperpath hS z with an acyclic hyperpath haS z (note that this hyperpath may have to contain node t as a possible tar et in some intermediate node) without increasin the value of the measure (hS t ). We can recursively proceed on the subtrees T (hS z ) until all relevant ed es have been found, and the irrelevant subtrees have been replaced by acyclic subhyperpaths. It is easy to check that the subtree T (hR S t ) induced by the relevant ed es has the same property that we have exploited in case (a): if a tar et node x appears twice in a branch of T (hR S t ), say (Y1 x), and (Y2 x) with the former node above the latter, we can cut away the whole subtree T2 rooted at (Y2 x) and still obtain a folded hyperpath with tar et node z whose measure can not be lar er than (hS t ). Case (d) can be proved similarly. The followin theorem can be proved similarly. Theorem 3. Consider an optimization problem on hyper raphs. The followin properties hold: a) The maximization of a strict superior function is cycle-unbounded; b) The minimization of a strict inferior function is cycle-unbounded.
5
Some Examples of Measure Functions
Usin the results developed in the previous sections, we can characterize in a eneral and uni ed framework several optimization problems on hyper raphs, as summarized in the table of Fi ure 3. In this table we de ne some uniform measure functions in terms of the constituent functions f (w ) and ( 1 k ). The resultin properties of and the properties of the optimization problems are derived directly from the ar uments iven in Sections 3 and 4 (mainly Lemmas 1 and 2 and Theorems 2 and 3). We also provide a characterization of the closure problem as an optimization problem: in this case we can use the min function with uniform hyperarcs
12
Giorgio Ausiello et al.
measure resulting MIN MAX function f (w ) ( 1 problem problem k ) properties rank + max w>0 SSUP SUP,WINF SSUP CY-INV CY-UNBOUND ap + min w>0 SSUP WSUP,INF SWSUP 1-CY-CONV CY-UNBOUND bottleneck min min w>0 WSUP,INF WSUP,INF WSUP,INF 1-CY-CONV CY-INV threshold max max w>0 SUP,WINF SUP,WINF SUP,WINF CY-INV 1-CY-CONV traversal cost + w>0 SSUP SSUP SSUP CY-INV CY-UNBOUND closure min min w=1 WSUP,INF WSUP,INF WSUP,INF 1-CY-CONV CY-INV
Fi . 3. Characterization of measure functions on hyper raphs.
wei hts equal to 1. Of course, the minimum closure corresponds to the traditional transitive closure over hyper raphs, investi ated in [6,7]. We conclude this section by mentionin that the problems of ndin a hyperpath of rank, or ap, or traversal cost of k or more are all NP-complete. As shown in the table of Fi ure 3, all the related optimization problems are cycle-unbounded. In the next sections, we will present e cient al orithms for k-cycle-conver ent (k = 0 1, thus includin cycle-invariant) optimization problems.
6
Al orithms for Optimization Problems
Several authors have proposed al orithms that can be used to nd optimal hyperpaths. With a di erent formalism, Knuth [12] proposed a eneralization of Dijkstra’s al orithm to solve the rammar problem described in Section 3. This al orithm can be easily adapted to nd the optimal hyperpaths from a sin le source node (the axiom of the rammar), to all other nodes in a functional hyperpath H = N H with n = N nodes, h = H hyperarcs, and a total size s = H . Knuth’s al orithm requires O(h lo n + s) worst case time. The runnin time can be reduced to O(n lo n + s) by usin Fibonacci heaps [8]. The al orithm is based on Dijkstra’s shortest path al orithm, and uses a priority queue. A eneric node x is enqueued when the distance of a nei hbor from the source has been computed. The priority of x in the queue may decrease if further nei hbors provide better connection from the source. When a node is dequeued, its distance from the source is computed. We will refer to this al orithm as Sort-by-Priority. The dynamic maintenance of hyperpaths has been studied by several authors [4,6,7,11,13,15]. Here we only consider the incremental sin le source problem. This problem consists of maintainin the optimal hyperpaths from a sin le
Hypergrap Traversal Revisited
13
source node to every other node, while performin insertions of hyperarcs (insert operations), or wei ht decreases (decrease operations). Ramalin am and Reps provide in [15] a dynamic solution of this problem. Their solution is more eneral and applies also to a whole set of hyperarc operations of various kinds. Their al orithm, which we refer to as RR, can be considered as a dynamic version of Sort-by-Priority. The main idea behind the al orithm is to use a priority queue: only those nodes whose distance from the root has to be chan ed are inserted in the priority queue. Let be the set of nodes that chan e their distance from the source. The time complexity of RR is iven in terms of output complexity, i.e., as a function of a parameter , which represents the cardinality of the set plus all the hyperarcs incident to . Namely RR requires O( lo ) worst-case time to update the optimal hyperpaths from a sin le source after a hyperarc insertion or a wei ht decrease. Note that in the worst case = ( H ). With the terminolo y proposed in this paper, the time bound of RR depends on both the measure function and the type of update. Namely, if the function is SSUP or SINF, RR processes a hyperarc insertion or a wei ht decrease with the followin costs: (i) each node z in the set is enqueued exactly once, and (ii) all the hyperarcs X y whose source set X contains z are scanned as soon as node z is dequeued. The same situation holds even in case of a wei ht decrease operation and when the measure function is SWSUP or SWINF (such as for ap). In case of an insert operation and a SWSUP or SWINF function, instead, it seems possible that each node z in the set mi ht be enqueued once for each hyperarc X z H. Another approach can be used to nd optimal hyperpaths, as described in [11]. The al orithm to handle the insertion of a hyperarc X y , which we will refer to as Sort-by-Structure, can be described as follows: Insert(X y; w) 1. Compute the nodes that become reachable from the source set with the insertion of the new hyperarc. Collect those nodes (to ether with node y) in a simple queue Q; 2. Extract a node z from Q and compute the optimal path from the source to z. Next, scan all the hyperarcs S t whose source set S contains z, possibly insertin node t in queue Q if a better path from the source to node t has been found (where the notion of better clearly depends on the optimization criterion); 3. Repeat the previous step until Q becomes empty. Step 1 consists of computin the set of nodes reachable from S: a dynamic solution of this problem was proposed in [7]. In case of a wei ht decrease operation this step is skipped, and queue Q is initialized with node y alone. Sort-byStructure can be used with small chan es also in case of the static problem as an alternative to Knuth’s al orithm. Furthermore Sort-by-Structure can be easily adapted to handle acyclic hyper raphs in O(s) total time in any incremental sequence of updates.
14
Giorgio Ausiello et al.
This solution does not make use of priorities, but the nodes whose optimal from the source is to be improved are enqueued in a simple queue Q. A ain, each node may be enqueued several times. If we consider an incremental sequence of operations, consistin in both insertion of new hyperarcs and wei ht decreases, each node can be enqueued is O(W ) times to process the whole sequence of updates, where W denotes the codomain of function , i.e., the number of possible values that the measure of a hyperpath may assume. The function f X z (w X z X z ( )) associated to each hyperarc X z is (re)computed at most once for each improvement of nodes in the set X. This leads to an overall bound of O(W s) total time in any incremental sequence of updates, in the hypothesis that the (re)computation of each function associated to hyperarcs requires constant time. As an example, in arti cial intelli ence, reasonin with uncertainty leads to the use of fuzzy lo ic. In this application ndin optimal hyperpaths corresponds to the hi hest de ree of con dence supportin a iven conclusion [4]; this is a natural situation where a small value of W has to be used. We remark that Sort-by-Structure and Sort-by-Priority can be combined by usin a priority queue in Step 2: this actually provides the best bound for the eneral case, since each node is enqueued at most once in each call to the update procedure, also in case of the WSUP and WINF measure functions. We will refer to this version of the al orithm as Improved Sort-by-Priority. The previous considerations lead to the followin theorems, whose proofs are omitted here. Theorem 4. Let P = (opt ) be an optimization problem on a functional hyper raphs HF = N H; F , with n = N , h = H , and s = H . If W is the cardinality of the codomain of function , then the followin bounds hold: a) if P is cycle-invariant, then Sort-by-Priority nds a solution in O(s + n lo n) time; Sort-by-Structure nds a solution in O(W s) time; b) if P is 1-cycle-conver ent, then Sort-by-Priority nds a solution in O(W (s + n lo n)) time; Sort-by-Structure nds a solution in O(W s) time. In the special case that the functional hyper raph is acyclic, then Sort-by-Structure nds a solution in O(s) time. Note that in case of acyclic hyper raphs the classes of cycle-invariant and k-cycle-conver ent measure functions collapse to the same class. Theorem 5. Let P = (opt ) be an optimization problem on a functional hyper raphs HF = N H; F . The problem of maintainin optimal hyperpaths from a source set S to every other node z N under a sequence of both hyperarc insertions and wei ht decreases can be solved with the followin time bounds: a) if P is cycle-invariant, then Sort-by-Structure can process the sequence of updates in O(W s) total time;
Hypergrap Traversal Revisited
15
b) if P is 1-cycle-conver ent, then Improved Sort-by-Priority can process the sequence of updates in O(W (s + n lo n)) total time; c) if the functional hyper raph is acyclic, then Sort-by-Structure can process the sequence of updates in O(s) total time. For all the al orithms mentioned in this section the space required is O(s) and the solution is computed in explicit form, i.e., queries about the optimal path from the source to any other node in the hyper raph can be answered in constant time. Finally, we mention that in the hypothesis that the F is the maximum cost of (re)computin any of the functions associated to hyperarcs of the functional hyper raph, then all the time bounds have to multiplied by a factor of F .
Acknowled ments We are rateful to Roberto Giaccio for many discussions throu hout this work.
References 1. P. Alimonti, E. Feuerstein, and U. Nanni. Linear time algorit ms for liveness and boundedness in conflict-free petri nets. In 1st Latin American Theoretical Informatics, volume 583, pages 1 14. Lecture Notes in Computer Science, SpringerVerlag, 1992. 2. G. Ausiello, A. D’Atri, and D. Sacca. Grap algorit ms for functional dependency manipulation. Journal of the ACM, 30:752 766, 1983. 3. G. Ausiello, A. D’Atri, and D. Sacca. Minimal representation of directed ypergrap s. SIAM Journal on Computin , 15:418 431, 1986. 4. G. Ausiello, R. Giaccio. On-line algorit ms for satis ability formulae wit uncertainty. Theoretical Computer Science 171:3 24, 1997. 5. G. Ausiello, R. Giaccio, G. F. Italiano, and U. Nanni. Optimal traversal of directed ypergrap s. Manuscript, 1997. 6. G. Ausiello and G. F. Italiano. Online algorit ms for polynomially solvable satisability problems. Journal of Lo ic Pro rammin , 10:69 90, 1991. 7. G. Ausiello, G. F. Italiano, and U. Nanni. Dynamic maintenance of directed ypergrap s. Theoretical Computer Science, 72(2-3):97 117, 1990. 8. M. L. Fredman and R. E. Tarjan. Fibonacci eaps and t eir uses in improved network optimization algorit ms. Journal of the ACM, 34:596 615, 1987. 9. G. Gallo, G. Longo, S. Nguyen, and S. Pallottino. Directed ypergrap s and applications. Discrete Applied Mat ematics 42 (1993) 177-201. 10. G. Gallo and G. Rago. A ypergrap approac to logical inference for Datalog formulae. Tec nical Report 28/90, Dip. di Informatica, Univ. of Pisa, Italy, 1990. 11. G. F. Italiano and U. Nanni. On line maintenance of minimal directed ypergrap s. In 3rd Italian Conf. on Theoretical Computer Science, pages 335 349. World Scienti c Co., 1989. 12. D. E. Knut . A generalization of Dijkstra’s algorit m. Information Processin Letters, 6(1):1 5, 1977. 13. P. B. Miltersen. On-line reevaluation of functions. Tec nical Report DAIMI PB380, Comp. Sci. Dept., Aar us University, January 1992.
16
Giorgio Ausiello et al.
14. S. Nguyen and S. Pallottino. Hyperpat s and s ortest yperpat s. Combinatorial Optimization, 1403:258 271, 1989. 15. G. Ramalingam and T. Reps, An Incremental Algorit m for a Generalization of t e S ortest Pat Problem, Journal of Al orithms, 21:267 305, 1996.
De nin the Java Virtual Machine as Platform for Provably Correct Java Compilation E on B¨or er1 and Wolfram Schulte2 1
Universita di Pisa, Dipartimento di Informatica, I-56125 Pisa, Italy boer
[email protected] 2 Universit¨ at Ulm, Fakult¨ at f¨ ur Informatik, D-89069 Ulm, Germany
[email protected] Abstract. We provide concise abstract code for runnin the Java Virtual Machine (JVM) to execute compiled Java pro rams, and de ne a eneral compilation scheme of Java pro rams to JVM code. These definitions, to ether with the de nition of an abstract interpreter of Java pro rams iven in our previous work [3], allow us to prove that any compiler that satis es the conditions stated in this paper compiles Java code correctly. In addition we have validated our JVM and compiler speci cation throu h experimentation. The modularity of our de nitions for Java, the JVM and the compilation scheme exhibit ortho onal lan ua e, machine and compiler components, which t to ether and provide the basis for a stepwise and provably correct desi n for reuse. As a by-product we provide a challen in realistic case study for mechanical veri cation of a compiler correctness proof.
1
Introduction
Every justi cation showin that a proposed compiler behaves well is relative to a de nition of the semantics of source and tar et lan ua e. In our previous work [3] we have developed a platform independent, ri orous yet easily mana eable de nition for an interpreter of Java pro rams, which captures the intuitive understandin Java pro rammers have of the semantics of their code. In this paper we provide a mathematical (read: ri orous and platform independent) yet practical model of an interpreter for the Java Virtual Machine, which formalizes the concepts presented in the JVM speci cation [6], as far as they are needed for the compilation of Java pro rams. We also extract from the JVM speci cation the de nition of a scheme for the compilation of Java to JVM code and prove its correctness. Main Theorem. Every compiler that satis es the conditions listed in this paper compiles Java pro rams correctly into JVM code. We split the JVM and the compilation function into an incremental sequence of four machines and functions whose structure corresponds to the conservative extension relation amon the modular components we exhibited for Java [3] and de ne the JVM at two levels of abstraction: a round model with an abstract Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 17 35, 1998. c Sprin er-Verla Berlin Heidelber 1998
18
E on B¨ or er and Wolfram Schulte
class le and abstract instructions, and a re ned model where the abstract instructions are implemented by concrete JVM instructions. The structure of our Java machine is carried over mutatis mutandis to the basic structure of the abstract interpreter we are de nin here for the JVM as tar et machine for Java compilation. In sections 2 to 5 we de ne the sequence of successively extended JVM machines JVMI , JVMC , JVMO and JVME for the compilation of pro rams from the imperative core JavaI of Java and its extensions JavaC (by classes, e . procedures), JavaO (by object-oriented features, e . class instances) and JavaE (by exceptions). We discuss here only the sin le threaded JVM, althou h our approach could easily include also multiple threads (see our multi-a ent Java model with threads in [3]). We skip those lan ua e constructs which can be reduced by standard pro ram transformation techniques to the core constructs dealt with explicitly in our Java models. We still do not consider Java packa es, compilation units, visibility of names, strin s, arrays, input/output, loadin , linkin and arba e collection. These features are the object of further re nements of the JVM model presented here. For proof details, the instruction re nement, an extensive biblio raphy and the discussion of related work we refer the interested reader to an extended version of this paper [1].
2
JVMI and the Compilation of JavaI Pro rams
For the speci cation of Java, the JVM and the proof machinery, we use Abstract State Machines (ASMs). ASM speci cations have a simple mathematical foundation [5], which justi es their intuitive understandin as pseudo code over abstract data. We de ne the basic JVM, called JVMI , which is used as the tar et for compilin Java’s statements and expressions over primitive types. We prove that JVMI executes the compilation of JavaI pro rams correctly. The followin rammars recall the syntax of JavaI [3] and introduce the correspondin instruction set JVMI : Exp ::= Lit Uop Exp Exp Bop Exp Var Var = Exp Exp? Exp : Exp : Stm ::= ; Exp; Lab : Stm break Lab; continue Lab; if (Exp) Stm else Stm while (Exp) Stm Stm
Instr
::= const (Lit) uapply (Uop) bapply (Bop) load (Varnum Typ) store (Varnum Typ) dup (Typ) pop (Typ) ifZero (Lab) oto (Lab) label (Lab)
Varnum == Nat Code == Instr
De nin the Java Virtual Machine
19
The JVMI instruction set bears a close resemblence to a traditional stack machine like the P-machine. JVMI provides instructions to load constants, to apply various unary and binary operators, to load and store a variable, to duplicate and to remove values, and to jump unconditionally or conditionally to a label. Variable locations in the JVM are represented by natural numbers. A JVMI pro ram is a sequence of instructions. The universes Lit Uop Bop Var Typ Lab contain Java literals, unary and binary operators, variables, primitive types and labels, respectively. With the exception of Var , these universes are also used in the JVMI . 2.1
The Machine JVMI for Imperative Code
The JVM is a typed word-oriented stack-machine runnin the iven bytecode code : Code. As a consequence the central dynamic part of a JVMI state consists of a pro ram counter pc, a local variable environment loc and an operand stack opd . The followin declarations show their formalization: the rst column de nes the used types, the second column de nes the state, and the third column denes the condition on the initial state. (We consider sequences as isomorphic to functions havin an interval of natural numbers startin at 0 as their domain.) Pc == Nat Loc == Varnum Opd == Word
Word
pc : Pc loc : Loc opd : Opd
pc = nextunlab (0 code) loc = opd =
The close analo y between the abstract and concrete pro ram counters in JavaI and JVMI , the memories for local variables and for intermediate values, and their initializations reflects the re nement process, which applied to the machine JavaI yields JVMI . This correspondence will uide the justi cation of the correctness of this rst step towards an implementation of Java on the JVM. Local variables and the operand stack store values of the abstract universe Word . Word s are supposed to hold at least 32-bit quantities. Java’s values, which occupy at most 32-bits, are represented on the level of the JVM as sin le Word s. Java’s 64-bit values are mapped to multiple consecutive locations in the local environment and on the operand stack in an implementation dependent way. We de ne JVM values (Val ) as sequences of Words, i.e. Val == Word . A valid word sequence has len th one (32-bit) or two (64-bit). The JVM implements values and operations on Java datatypes as follows. Booleans are represented as inte ers: 0 is used for false, and 1 for true. Operations workin on boolean, byte, short or char are not supported by the JVM. Instead, upon retrievin the value of a boolean, byte, char or short, it is automatically cast into an int. When writin a value to a boolean, byte, char or short variable, an int is passed and the JVM truncates it to the relevant size. For the JVMI we use two static code traversin functions next and jump, which yield the next statement to be executed and the next statement after the iven labeled statement, respectively. Both functions are de ned usin an aux-
20
E on B¨ or er and Wolfram Schulte
iliary function nextunlab that skips label instructions. (The expression x p(x ) denotes the uniquely determined object x that satis es p(x ).) next(pc code) = nextunlab (pc + 1 code) jump(l code) = nextunlab ( pc code(pc) = label (l )) nextunlab (pc code) = min pc pc pc l code(pc ) = label (l )
We also use the followin JVMI macros, where the homonymy with JavaI macros reflects the re nement relations on which our correctness proof is based. proceed == pc := next(pc code) oto(l ) == pc := jump(l code) pc is instr == code(pc) = instr
The followin rules de ne the semantics of the JVMI instructions. f pc is const (lit) then e opd opd := lit proceed f pc is uapply ( ) (v opd ) = split(A( ) opd ) then opd := e v opd proceed f pc is bapply (⊗) (v2 v1 opd ) = split(A(⊗) opd ) (⊗ DivMods) (v2 = 0) then e v2 opd opd := v1 ⊗ proceed f pc is dup (t) (v opd ) = split(t opd ) then opd := v v opd proceed f pc is pop (t) (v opd ) = split(t opd ) then opd := opd proceed
f pc is load (x t) then f sizeof (t) = 1 then opd := loc(x ) opd else f sizeof (t) = 2 then opd := loc(x ) loc(x + 1) opd proceed f pc is store (x t) (v opd ) = split(t opd ) then opd := opd f sizeof (t) = 1 then loc(x ) := v (0) else f sizeof (t) = 2 then loc(x + 1) := v (1) loc(x ) := v (0) proceed f pc is oto (l ) then oto(l ) f pc is ifZero (l ) w opd = opd then opd := opd f w = 0 then oto(l ) else proceed
e (one or two words) on the operand A const instruction pushes the JVM value lit stack. An unary (binary) operator chan es the value(s) on top of the operand stack. The unary (binary) operators are assumed to have the same meanin as in e Java (i.e. e (⊗)), althou h they may operate on extended domains. In order to abstract from the di erent value sizes, we use the function split : (Typ Opd ) (Val Opd ), which iven a sequence of n types and the operand stack, takes the top n values from the operand stack, such that the ith value has the size
De nin the Java Virtual Machine
21
of the ith type. The function A(op) returns the ar ument types of op. The instructions dup and pop duplicate and remove the top stack value, respectively. A load instruction loads the value stored under the location x on top of the stack. If the type of x is a double or lon , the next two locations are pushed on top of the stack. A store instruction stores the top (two) word(s) of the operand stack in the local environment at o set x (and x + 1). A oto instruction causes execution to jump to the next instruction determined by the label. The ifzero instruction is a conditional oto. If the value on top of the operand stack is 0, execution continues at the next instruction determined by the label, otherwise execution proceeds. The abstract nature of the JVMI instructions is reflected in their parameterization by types and operators. It allows us to restrict our attention to a small set of JVM instructions (or better instruction classes) without losin the enerality of our model with respect to the JVM speci cation [6]. The extended version of this paper [1] shows how to re ne these parameterized instruction to JVM’s real ones.
2.2
Compilation of JavaI Pro rams to JVMI Code
This section de nes the compilin function from JavaI to JVMI code. More e cient compilation schemes can be introduced but we leave optimizations for further re nement steps. The compilation E : Exp Code of (occurrences of) JavaI expressions to JVMI instructions is standard. The resultin sequence of instructions has the e ect of storin the value of the expression on top of the operand stack. To improve readability, we use the followin conventions for the presentation of the compilation: We suppress the routine machinery for a consistent assi nment of (occurrences of) Java variables x to JVM variable numbers x . Similarly, we suppress the trivial machinery for label eneration. Label providin funcNat , are de ned on occurrences of expressions and statements, tions lab , i are supposed to be injective and to have disjoint ran es. Functions T de ned on occurrences of variables and expressions return their type. We abbreviate: ‘Let e be an occurrence of exp in E(e) = ’ by ‘E(e as exp) = ’. E (lit) E ( e) E (e1 ⊗ e1 ) E (x ) E (x = e) E (e as e1 ? e2 : e3 :)
= = = = = =
const (lit) E e uapply ( ) E e1 E e2 bapply (⊗) load (x T (x )) E e dup (T (e)) store (x T (x )) E e1 ifZero (lab1 (e)) E e2 oto (lab2 (e)) label (lab1 (e)) E e3 label (lab2 (e))
Also the compilation : Stm Code of JavaI statements to JVMI instructions is standard. The compilation of break lab; and continue lab; uses the auxiliary function tar et : Stm Lab Stm. This function provides for occur-
22
E on B¨ or er and Wolfram Schulte
rences of statements and labels the occurrence of the enclosin labeled statement in the iven pro ram. S(; ) S(e; ) S( s1
sm
= = E e pop (T (e)) ) = Ss1 Ssm
S(s as if (e) s1 else s2 ) = E e ifZero (lab1 (s)) Ss1 oto(lab2 (s)) label(lab1 (s)) Ss2 label(lab2 (s)) S(s as while (e) s1 ) = label (lab1 (s)) E e ifZero (lab2 (s)) Ss1 oto (lab1 (s)) label (lab2 (s)) S(s as lab : s1 ) = label (lab1 (s)) Ss1 label (lab2 (s)) S(s as continue lab; ) = oto (lab1 (tar et(s lab))) S(s as break lab; ) = oto (lab2 (tar et(s lab)))
Correctness Theorem for JavaI /JVMI . Via the re nement relation and under the assumptions stated above, the result of executin any JavaI pro ram in the machine JavaI is equivalent to the result of executin the compiled pro ram on the machine JVMI .
3
JVMC and the Compilation of Class Code
In this section we extend the basic JVMI machine to the machine JVMC , which handles class (also called static) elds, class methods and class initializers. JVMC thus stands for a machine that supports modules, module-local variables and procedures. We add the clauses for compilin class eld access, class eld assi nment, class method calls and return statements to the de nition of the JavaI compilation function. The followin rammar shows the extension of the syntax of JavaI to the syntax of JavaC . Furthermore, we de ne the correspondin JVMC instructions: Exp ::=
Instr FieldSpec FieldSpec = Exp MethSpec(Exp )
Stm ::= return; return Exp; Init ::= static Stm
::= etstatic ( FieldSpec Typ) putstatic ( FieldSpec Typ) invokestatic (MethSpec) return (Typ)
Fcty == (Typ FieldSpec == (Class MethSpec == (Class
Typ) Field ) Meth Fcty)
JVMC provides instructions to load and store class elds, and to call and to return from class methods. Both rammars are based on the same abstract de nition of eld and method speci cations. Field speci cations consist of a class and a eld name, because Java and the JVM allow elds in di erent classes to have the same name. Method speci cations additionally have a functionality (a
De nin the Java Virtual Machine
23
sequence of ar ument types and a result type, which can be void), because Java and the JVM support classes with methods havin the same name but takin di erent parameter types. Field and method speci cations use the abstract universes Class, Field and Method . Class is assumed to stand for fully quali ed Java class names, Field and Method for identi ers. 3.1
The Machine JVMC for Class Code
JVM and Java pro rams are structured into classes, which establish the proram’s execution environment. For a eneral, hi h-level de nition of a provably correct compilation scheme from Java to JVM Code, we can abstract from many data structure speci cs of the particular JVM class format. This format is called class le in the JVM speci cation [6]. Our abstract class le re nes in a natural way the class environment of JavaC , providin for every class its kind (whether it is a class or an interface), its superclass (if there is any), a list of the interfaces the class implements, and a table for elds and methods. Class les do not include de nitions for elds or methods provided by any superclass. Env == Class ClassDec ClassKind ::= AClass AnInterface ClassDec == ( kind : ClassKind super : [Class] ifaces : Class fTab : Field FieldDec mTab : (Meth Fcty)
MethDec)
In JVMC elds and methods can only be static. Fields have a type and optionally a constant value. If a method is implemented in the class, the method body de nes its code. FieldDec == (fKind : MemberKind fTyp : Typ fConstVal : [Val ]) MethDec == (mKind : MemberKind mBody : [Code]) MemberKind ::= Static
In JVMC we have a xed environment env : Env , de ned by the iven proram. The followin functions operate on this environment. The function mCode retrieves for a iven method speci cation the method’s code to be executed. The function fInitVal yields for a iven eld speci cation the eld’s constant value, provided it is available; otherwise, the function returns the default value of the eld’s type (where default : Typ Val ). mCode(c m f ) = mBody(mTab(env (c))(m f )) fInitVal (c f ) = case fTab(env (c))(f ) of ( val ) : val ( fTyp []) : default(fTyp)
The function supers calculates the transitive closure of super . The function c elds returns the set of all elds declared by the class. supers : Class c elds : Class
Class P FieldSpec
24
E on B¨ or er and Wolfram Schulte
For these functions the homonymy to JavaC functions shows the data re nement relation in oin from JavaC to JVMC . Due to the presence of method calls in JVMC we have to embed the one sin le JVMI frame (pc loc opd ) into the JVMC frame stack frames, enriched by a fourth component which always holds the dynamic chain of method speci cations. This embeddin de nes the re nement relation between JVMI and JVMC . We re ne the static function code, so that it always denotes the code stored in the environment under the current method speci cation mspec. The current class, method and functionality are denoted by cclass cmeth and cfcty, respectively, where mspec = (cclass cmeth cfcty). pcs locs opds mspecs frames
: : : : ==
Pc Loc Opd MethSpec (pcs locs opds mspecs)
pc loc opd mspec code
== top(pcs) == top(locs) == top(opds) == top(mspecs) == mCode(mspec)
Before a class can be used its class initializers must be executed. At the JVM level class initializers appear as class methods with the special name clinit>. Initialization must be done lazily, i.e. when a class is rst used in Java, and when a reference is resolved in the JVM. Resolution is the process of checkin symbolic references from the current class to other classes and interfaces. Since Java’s notion of class initialization does not correspond to the related class resolution notion of the JVM, we name the initialization related functions and sets di erently. A class can be in one of three states. We introduce a dynamic function res, which records the current resolution state. A class is resolved , if resolution for this class is in pro ress or done. res : Class ResolvedState ResolvedState ::= Unresolved Resolved InPro ress resolved (state) = state InPro ress Resolved
The JVM speci cation [6] uses symbolic references, namely eld and method speci cations, to support binary compatibility, cf. [4]. As a consequence, the calculation of eld o sets and of method o sets is implementation dependent. Therefore, we keep the class eld access abstract and de ne the stora e function for class elds to be the same in JavaC and JVMC , namely lo : FieldSpec
Val
The runs of JVMC start with callin the class method main of a distin uished class Main bein part of the environment. However, before main is executed, its class Main has to be initialized. Therefore, the frame stack initially has two entries: the main method at the bottom and the clinit> method on the top. All classes are initially unresolved and all elds are set to their initial values. This initialization also re nes the correspondin conditions imposed on JavaC : pcs locs opds mspecs
= start(clinit ) start(main ) = = = clinit main
res = (c Unresolved ) c dom(env ) lo = (fs fInitVal (fs)) c dom(env ) fs c elds(c)
De nin the Java Virtual Machine
25
The method speci cations clinit 0 and main 0 denote the class methods clinit> and main of class Main. The macro start returns the rst instruction of the code of the iven method speci cation. clinit == proc(Main clinit>) main == proc(Main main)
start(ms) == nextunlab (0 mCode(ms)) proc(c m) == (c m ( void))
The followin rules for JVMC de ne the semantics of the new JVM instructions, provided the class of the eld or method speci cation is already resolved. A etstatic instruction loads the value (one or two words), stored under the eld speci cation in the lobal environment, on top of the operand stack. A putstatic instruction stores the top (two) word(s) of the operand stack in the lobal environment at the iven eld speci cation. An invokestatic instruction pops the ar uments from the stack and sets pc to the next instruction. The ar uments of the invoked method are placed in the local variables of the new stack frame, and execution continues at the rst instruction of the new method. A return instruction is ‘inverse’ to invokestatic. It pops a value from the top of the stack and pushes it onto the operand stack of the invoker. All other items in the current stack are discarded. (If the return type is void, split returns the empty sequence as its value.) f pc is etstatic ((c f ) t) resolved (res(c)) then opd := lo(c f ) opd proceed f pc is putstatic ((c f ) t) resolved (res(c)) (v opd ) = split(t opd ) then opd := opd lo(c f ) := v proceed
f pc is invokestatic (c m (ts t)) tn ) = ts resolved (res(c)) (t1 (vn v1 opd ) = split(tn t1 opd ) then call ( next(pc code) v1 vn opd (c m (ts t))) f pc is return (t) (v opd ) = split(t opd ) then return(v )
The macros call and return update the frames as follows: call (pc loc opd mspec) == let pc0 pcs = pcs opd0 opds = opds n pcs := start(mspec) pc pcs locs := loc locs opds := opd opds mspecs := mspec mspecs
return(v ) == f len(pcs) = 1 then pcs(0) := undef else let opd0 opd1 opds = opds n pcs := pop(pcs) locs := pop(locs) opds := (v opd1 ) opds mspecs := pop(mspecs)
Execution starts in a state in which no class is resolved. A class is resolved, when it is rst referenced. Before a class is resolved, its superclass is resolved (if any). Interfaces are not resolved at this time, althou h this is not speci ed in Java’s lan ua e reference manual [4]. On the level of the JVM resolution leads to three rules. First, resolutions starts, i.e. the class method clinit> is implicitely called, when the class referred to in a et-, put- or invokestatic
26
E on B¨ or er and Wolfram Schulte
instruction is not resolved. Second, the class initializer records the fact that class initialization is in pro ress and calls the superclass initializer recursively. Third, after havin executed the class initializer, it is recorded that the class is resolved. f (pc is putstatic ((c ) ) pc is etstatic ((c ) ) pc is invokestatic (c )) resolved (res(c)) then call (pc opd proc(c clinit>))
f res(cclass) = Unresolved then res(cclass) := InPro ress f supers(cclass) = resolved (res(super (cclass)) then call (pc opd proc(super (cclass) clinit>)) f pc is return (t) cmeth = clinit> then res(cclass) := Resolved
Firin the second rule depends on the condition that the current class is Unresolved this is the reason why we called the initializer in the rst rule. To suppress the simultaneous rin of other rules we stren then the macro ‘is’: pc is instr == code(pc) = instr
resolved (res(cclass))
This uarantees that an instruction can only be executed, if the current class is resolved. Opposite to the second rule, the third rule res simultaneously with the previously presented rule for the return instruction. 3.2
Compilation of JavaC Pro rams to JVMC Code
The compilation of JavaI expressions is extended by de nin the compilation of class eld access, class eld assi nment, and by the compilation of calls of class methods. E (fspec) E (fspec = e) E (mspec(e1
= etstatic (fspec T (fspec)) = E e dup (T (e)) putstatic (fspec T (fspec)) en )) = E e1 E en invokestatic (mspec)
We add the clause for return statements to the JavaI compilation. S(return e; ) = E e return (T (e)) S(return;) = return (void)
To compile a class initializer (the Init phrase) means to compile its statement as the body of the static clinit> method. The extension of JavaI /JVMI to JavaC /JVMC is conservative, i.e. purely incremental. For the proof of the Correctness Theorem for JavaC /JVMC it therfore su ces to extend the theorem from JavaI /JVMI to the new expressions and statements occurrin in JavaC /JVMC .
De nin the Java Virtual Machine
4
27
JVMO and the Compilation of JavaO Pro rams
In this section we extend the machine JVMC to JVMO . This machine handles the object-oriented features of Java pro rams, namely instances, instance creation, instance eld access, instance method calls with late bindin , type casts and null pointers. We add the correspondin new phrases to the de nition of the compilation function. We recall the rammar for the new expressions of JavaO and de ne the correspondin JVMO instructions: Exp ::=
Instr ::= this new (Class) new ConstrSpec (Exp ) etfield (FieldSpec Typ) ConstrSpec (Exp ) putfield (FieldSpec Typ) Exp FieldSpec dup (Typ ) Exp FieldSpec = Exp invokeinstance ( MethSpec Exp MethSpec CallKind (Exp ) CallKind ) instanceof (Class) Exp instanceof Class checkcast (Class) (Class) Exp CallKind ::= Constr Nonvirtual ConstrSpec == (Class Typ ) Virtual Super
JavaO uses constructor speci cations to uniquely denote overloaded instance constructors. JVMO provides instructions to allocate a new instance, to access or assi n its elds, to duplicate values, to invoke instance methods and to check instance types. JavaO and JVMO use the universe CallKind , to distin uish the particular way in which instance methods are called. 4.1
The Machine JVMO for Object-Oriented Code
JVMO uses the same abstract class le as JVMC . However, instance elds and instance methods in opposite to class elds and class methods are not static but dynamic. So we extend the universe MemberKind as follows: MemberKind ::=
Dynamic
The JVM speci cation [6] xes the class le. However, the speci cation does not explain how instances are stored or instance methods are accessed. So we extend the si nature of JVMC in JVMO in the same way as the si nature of JavaC is extended in JavaO . We introduce the followin static functions (homonymy with JavaO functions) that look up information in the lobal environment: d elds : Class dlookup : Class compatible : Class
P FieldSpec MethSpec Class Class Bool
The function d elds determines the instance elds of a class and of all its superclasses (if any). The function dlookup returns the rst (super) class for the iven method speci cation, which implements this method. The expression
28
E on B¨ or er and Wolfram Schulte
compatible(myType tarType) returns true if myType is assi nment compatible with tarType [4]. Note that at the JVM level, there is no special lookup function for constructors. Instead, Java’s constructors appear in the JVM as instance initialization methods with the special name init>. JVMO and JavaO have the same dynamic functions for memorizin the class and the instance eld values of a reference. In both machines they are initially empty. References can be obtained from the abstract universe Ref , which is assumed to be a subset of Word . (Likewise, we also assume that null is an element of Word .) classOf : Ref dyn : Ref
Class FieldSpec
Val
classOf = dyn =
The followin rules de ne the semantics of the new instructions of JVMO , provided that the involved class is resolved. f pc is new (c) resolved (res(c)) then extend Ref by r classOf (r ) := c vary fs over d elds(c) dyn(r fs) := fInitVal (fs) opd := r opd proceed f pc is etfield ((c f ) t) resolved (res(c)) r opd = opd r = null then opd := dyn(r (c f )) opd proceed f pc is putfield ((c f ) t) resolved (res(c)) (v r opd ) = split(t c opd ) r = null then opd := opd dyn(r (c f )) := v proceed f pc is dup (t1 t2 ) (v2 v1 opd ) = split(t2 t1 opd ) then opd := v2 v1 v2 opd proceed
f pc is invokeinstance ((c m (ts t)) k ) tn ) = ts resolved (res(c)) (t1 (vn v1 r opd ) = split(tn t1 c) opd ) r = null then call ( next(pc code) r v1 vn opd (c m (ts t)) where c = case k of Constr :c Nonvirtual : cclass Virtual : dlookup( classOf (r ) m (ts t)) Super : dlookup( super (cclass) m (ts t)) f pc is instanceof (c) resolved (res(c)) r opd = opd then opd := (r = null compatible(classOf (r ) c) opd proceed f pc is checkcast (c) resolved (res(c)) r opd = opd (r = null compatible(classOf (r ) c)) then proceed
A new instruction allocates a fresh reference usin the domain extension update of ASMs. The classOf the reference is set to the iven class, the class instance elds are set to default values, and the new reference is pushed on the operand stack. A etfield instruction pops the tar et reference from the stack, retrieves
De nin the Java Virtual Machine
29
the value of the eld identi ed by the iven eld speci cation from the dynamic store and pushes one or two words on the operand stack. A putfield instruction pops a value and the tar et reference from the stack and sets the dynamic store at the point of the tar et reference and the iven eld speci cation to the popped value. A dup_ instruction duplicates the top value and inserts the duplicate below the top value on the stack. An invokeinstance instruction pops the ar uments and the tar et reference (which denotes the instance whose method is bein called) from the stack and sets pc to the next instruction. The method’s implementin class is bein located. If the call kind is Constr , the method speci cation denotes a constructor; its code is located in the iven class. (The iven method m must be init>.) Nonvirtual , the method speci cation denotes a private method; its code is located in the current class. (The iven class c must be cclass.) Virtual , the implementin class is looked up dynamically, startin at the class of the tar et reference. Super , the method is looked up dynamically, startin at the superclass of the current class. (The iven class c must be super (cclass).) Once a method has been located, invoke calls the method: The ar uments for the invoked method are placed in the local variables of the new stack frame, placin the tar et reference r (denotin this in Java) in loc(0). Execution continues at the rst instruction of the new method. An instanceof instruction pops a reference from the operand stack. If the reference is not null and assi nment compatible with the required class, the inte er 1 is pushed on the operand stack, otherwise 0 is pushed. A checkcast instruction checks that the top value on the stack is an instance of the iven class. If the class c of a eld or method speci cation or if the explicitly iven class c of a new, an instanceof or a checkcast instruction is not resolved, the JVM rst resolves c, i.e. calls c’s clinit> method, before the instruction is executed. f (pc is new (c) pc is putfield ((c ) ) pc is etfield ((c ) ) pc is invokeinstance ((c ) ) pc is instanceof (c) pc is checkcast (c)) resolved (res(c)) then call (pc opd proc(c clinit>))
4.2
Compilation of JavaO Pro rams to JVMO Code
Since there are no new statements in JavaO , only the compilation of JavaC expressions has to be extended to the new JavaO expressions. The reference this is implemented as the distin uished local variable number 0.
30
E on B¨ or er and Wolfram Schulte E (this) E (new (c ts) (e1
= load (0 T (this)) en )) = new (c) dup (c) E e1 E en invokeinstance ((c init> (ts void)) Constr ) E ((c ts) (e1 en )) = load (0 T (this)) E e1 E en invokeinstance ((c init> (ts void)) Constr ) E (e fspec) = E e etfield (fspec T (fspec)) E (e1 fspec = e2 ) = E e1 E e2 dup (T (e1 ) T (e2 )) putfield (fspec T (fspec)) E (e mspec k (e1 en )) = E e E e1 E en invokeinstance (mspec k ) E (e instanceof c) = E e instanceof (c) E ((c) e) = E e checkcast (c)
Due to the conservativity of the extension of JavaC /JVMC to JavaO /JVMO , for the proof of the Correctness Theorem for JavaO /JVMO it su ces to extend the theorem from JavaC /JVMC to the new expressions occurrin in JavaO /JVMO . The de nitions of class initialization for JavaO in [4] and resolution for JVMO in [6] do not match because instanceof and class cast expressions in Java do not call the initialization of classes. In opposite, the JVM e ect is to execute the initialization of the related class if it is not initialized yet. Under the assumption that also in Java these instructions tri er class initialization, these instructions preserve the theorem for JavaO /JVMO .
5
JVME and the Compilation of Exception Treatment
In this section we extend JVMO to JVME that handles exceptions. We add the compilation of the new JavaE statements and re ne the compilation of jump and return statements. The followin rammars list the new statements of JavaE and the new JVME instructions. JVME provides instructions to raise an exception, to jump to and to return from subroutines embedded in methods. Stm ::=
Instr ::= throw Exp; try Stm catch (Typ Var Stm) try Stm finally Stm
5.1
athrow jsr (Lab) ret (Varnum)
The JVME Machine for Executin Exceptions
The JVM supports try/catch or try/finally by exception tables that list the exceptions of a method. When an exception is raised this table is searched for the handler. Exception tables re ne the notion of method body as follows: MethDec == (mKind : MemberKind mBody : [Code Exception ]) Exception == (from to handle : Lab catchTyp : [Class])
The labels from and to de ne the ran e of the protected code; handle starts the exception handler for the optional type catchTyp. If no catchTyp is iven
De nin the Java Virtual Machine
31
(as is the case for finally statements), any exception is cau ht. We re ne the function mCode from JVMC and introduce a new function mExcs, which returns the exceptions of the iven method speci cation. mCode(c m f ) = fst(mBody(mTab(env (c))(m f ))) mExcs(c m f ) = snd (mBody(mTab(env (c))(m f )))
If a class initializer raised an exception, which is not handled within the method, Java and therefore the JVM require that the method’s class must be labeled as erroneous. So we extend the domain of ResolvedState in the same way as we did for Java: ResolvedState ::=
Error
If the thrown exception is not an Error or one of its subclasses, then JavaE and JVME throw an ExceptionInInitializerError. If a class should be resolved but is marked as erroneous, Java and therefore implicitely the JVM require that a NoClassDefFoundError is reported. We formalize the run-time system search for a handler of an exception by a recursively de ned function catch. This function rst searches the active method usin catch 0 . If no handler is found (the exception handler list is empty), the current method frame is discarded, the invoker frame is reinstated and catch is called recursively. A handler is found if the pc is protected by some brackets from and to, and the thrown exception is compatible with the catchType. In this case the operand stack is reduced to the exception and execution continues at the address of the exception handler. When catch 0 returns from a clinit> method, the method has thrown an uncau ht exception; accordin to the strate y presented above the method’s class must be labeled as erroneous. catch(r ((pc pcs loc locs opd opds mspec mspecs) res)) = catch (mExcs(mspec)) where catch ( ) = f pcs = then ((undef pcs loc locs opd opds mspec mspecs) res) else let (c m ) = mspec res = f m = clinit> then res (c Error ) else res n catch(r ((pcs locs opds mspecs) res ) catch ((from to handle catchTyp) excs) = f jump(from mCode(mspec)) pc jump(to mCode(mspec)) (catchTyp = [] compatible(classOf (r ) catchTyp)) then ((jump(handle mCode(mspec)) pcs loc locs r opds mspec mspecs) res) else catch (excs)
The followin rules de ne the semantics of JVME instructions. The athrow instruction pops a reference from the stack and throws the exception represented by that reference. The jsr instruction is used to implement Java’s finally clause. This instruction pushes the address of the next instruction on the operand stack and jumps to the iven label. This requires that the universe Pc (called
32
E on B¨ or er and Wolfram Schulte
ReturnAddress in the JVM speci cation) is embedded in Word . The address, which is put on top of the stack, is used by ret to return from the subroutine, wherefore the return address rst has to be stored in a local variable. f pc is athrow r opd = opd r = null then (frames res) := catch(r (frames res))
f pc is jsr (lab) then opd := next(pc code) opd pc := oto(lab)
f pc is ret (x ) then pc := loc(x )
f res(cclass) = Error then fail (NoClassDefFoundError)
If the current class is erroneous, the last rule throws a NoClassDefFoundError usin the macro fail (c). This macro replaces the followin instruction sequence: new (c) dup invokeinstance ((c
init> ( void)) Constr ) athrow
Whether or not the constructor is called is semantically irrelevant, as lon as the constructors only call superclass constructors. We re ne in the obvious way rules that raise run-time exceptions. A typical representative of this rule kind is the re nement of bapply . It throws an ArithmeticException, if the operator is an inte er or lon division or remainder operator and the ri ht operand is 0. f pc is bapply (⊗) (0 v1 opd ) = split(A(⊗) opd ) then fail (ArithmeticException)
(⊗
DivMods)
JVME throws a NullPointerException if the tar et reference of a etfield , putfield or invokeinstance instruction is null , or if the reference of the athrow instruction is null . The machine throws a ClassCastException, if the reference on top of stack is neither null nor assi nment compatible with the required type. 5.2
Compilation of JavaE Statements to JVME Instructions
Since there are no new expression in JavaE , only the compilation of JavaO statements has to be extended to the compilation of the new JavaE statements. For try/catch statements, the compiled try clause is followed by a jump to the end of the compiled statement. Next the handlers are enerated. Each handler stores the exception into the ‘catch’ parameter, followed by the code of the catch clause and a jump to the end of the compiled statement. For try/finally statements s, the try clause is compiled followed by a call to the embedded subroutine, which is enerated for the finally clause. The subroutine rst stores the return address into a fresh variable ret(s), and nally calls ret (ret(s)). The handler for exceptions that are thrown in the try clause starts at lab3 (s). The handler saves an exception of class Throwable, which is left on the operand stack, into the fresh local variable exc(s), calls the subroutine, and rethrows the
De nin the Java Virtual Machine
33
exception. Variable providin functions exc, ret and also val that is used below, return for occurences of statements fresh variable numbers. This means that any returned variable number must be unused when the exception, return address or return value is stored, and this variable de nition must reach its correspondin use.
S(throw e; ) = E e athrow S(s as try s0 catch (c1 x1 s1 ) (cm xm sm )) = label (lab1 (s)) Ss0 oto (lab3 (s)) label (lab2 (s)) label (lab3+1 ) store (x1 c1 ) Ss1 oto (lab3 (s)) label (lab3+m ) store (xm cm ) Ssm oto (lab3 (s)) label (lab3 (s)) S(s as try s1 finally s2 ) = label (lab1 (s)) Ss1 jsr (lab2 (s)) oto (lab4 (s)) label (lab2 (s)) store (ret (s) ReturnAddress) Ss2 ret (ret (s)) label (lab3 (s)) store (exc(s) Throwable) jsr (lab2 (s)) load (exc(s) Throwable) athrow label (lab4 (s))
If a jump statement is nested inside a try clause of a try/finally statement and its correspondin tar et statement contains try/finally statements, then all finally clauses between the jump statement and the tar et have to be executed in innermost order. The compilation uses the function takeFinallyUntilTar et : Stm Lab Stm , which iven an occurrence of a statement and a label, returns in innermost order all occurrences of try/finally statements up to the tar et statement. For return e the compiler stores the result of the compiled expression e in a fresh temporary variable val . The compiler then enerates code to jump to all outer finally statements in this method usin the static function takeFinally : Stm Stm . Thereafter, the local variable val is pushed back onto the operand stack and the intended return instruction is executed.
S(s as break lab; ) = let (s1 sm ) = takeFinallyUntilTar et(s lab) n jsr (lab2 (s1 )) jsr (lab2 (sm )) oto (lab2 (tar et(s lab))) S(s as continue lab; ) = let (s1 sm ) = takeFinallyUntilTar et(s lab) n jsr (lab2 (s1 )) jsr (lab2 (sm )) oto (lab1 (tar et(lab s))) S(s as return e; ) = let (s1 sm ) = takeFinally(s) n E e store (val(s) T (e)) jsr (lab2 (s1 )) jsr (lab2 (sm )) load (val (s) T (e)) return (T (e)) S(s as return;) = let (s1 sm ) = takeFinally(s) n jsr (lab2 (s1 )) jsr (lab2 (sm )) return (void)
In the eneration of an exception table inner try phrases are concatenated before the outer ones. This uarantees that exceptions are searched in innermost order.
34
E on B¨ or er and Wolfram Schulte X (s as try s0 catch (c1 x1 s1 ) (cm xm sm )) = X s0 (lab1 (s) lab2 (s) lab3+1 c1 ) X s1 (lab1 (s) lab2 (s) lab3+m cm ) X sm X (s as try s1 finally s2 ) = X s1 (lab1 (s) lab2 (s) lab3 (s) []) X s2 X ( s1 sn ) = X s1 X sn X (if (e) s1 else s2 ) = X s1 X s2 X (while (e) s) = Xs X (lab : s) = Xs X( ) =
If durin execution of a class initializer an exception is thrown and this is not an Error or one of its subclasses, then JavaE and JVME throw an ExceptionInInitializerError. We re ne the compilation of the phrase Init as follows: S(static s) = S(try s catch (Exception x throw new (ExceptionInInitializerError ( void)) (); ))
Due to the conservativity of the extension of JavaO /JVMO to JavaE /JVME , for the proof of the Correctness Theorem for JavaE /JVME it su ces to extend the theorem from JavaO /JVMO to expression and statement execution in nally and error handlin code, and to prove the followin Exception Lemma. The execution of code in JavaE and the execution of the correspondin compiled code in JVME produce exceptions at correspondin values of the pro ram counters in JavaE and JVME , for the same reasons, with the same failure classes (if any) and tri er the same exception handlin .
6
Conclusion
We have presented implementation independent, ri orous yet easy to understand abstract code for the JVM as tar et machine for compilation of Java pro rams. Our de nition captures faithfully the correspondin explanations of the Java Virtual Machine speci cation [6] and provides a practical basis for the mathematical analysis and comparison of di erent implementations of the machine. In particular it allowed us to prove the correctness of a eneral scheme for compilin Java pro rams into JVM code. Additionally, we have validated our work by a successful implementation in the functional pro rammin lan ua e Haskell. The extended version of this paper [1] includes the proof details, the instruction re nement, an extensive biblio raphy and the discussion of related work. In an accompanyin study [2] we re ne the present JVM model to a defensive JVM, where we also isolate the bytecode veri er and the resolution component (includin dynamic loadin ) of the JVM. This JVM can be used to execute compiled Java code as well as any bytecode that is loaded from the net.
De nin the Java Virtual Machine
35
Acknowled ment. We thank Ton Vullin hs for comments on this work. The rst author thanks the IRIN (Institut de Recherche en Informatique de Nantes, Universite de Nantes & Ecole Centrale), in particular the Equipe Genie lo iciel, Methodes et Speci cations formelles for the ood workin environment o ered durin the last sta e of the work on this paper.
References [1] E. B¨ or er and W. Schulte. De nin the Java Virtual Machine as platform for provably correct Java compilation. Technical report, Universit¨ at Ulm, Fakult¨ at f¨ ur Informatik. Ulm, Germany, 1998. [2] E. B¨ or er and W. Schulte. A modular desi n for the Java VM architecture. In E. B¨ or er, editor, Architecture Desi n and Validation Methods. Sprin er LNCS, to appear, 1998. [3] E. B¨ or er and W. Schulte. A pro rammer friendly modular de nition of the semantics of Java. In J. Alves-Foss, editor, Formal Syntax and Semantics of Java(tm), Sprin er LNCS, to appear. 1998. [4] J. Goslin , B. Joy, and G. Steele. The Java(tm) Lan ua e Speci cation. Addison Wesley, 1996. [5] Y. Gurevich. Evolvin al ebras 1993: Lipari uide. In E. B¨ or er, editor, Speci cation and Validation Methods. Oxford University Press, 1995. [6] T. Lindholm and F. Yellin. The Java(tm) Virtual Machine Speci cation. Addison Wesley, 1996.
Towards a Theory of Recursive Structures? David Harel Dept. of Applied Mathematics and Computer Science The Weizmann Institute of Science, Rehovot, Israel harel@w sdom.we zmann.ac. l
Abstract. In computer science, one is interested mainly in nite objects. Insofar as in nite objects are of interest, they must be computable, i.e., recursive, thus admittin an e ective nite representation. This leads to the notion of a recursive raph, or, more enerally, a recursive structure, model or data base. This paper summarizes recent work on recursive structures and data bases, includin (i) the hi h undecidability of many problems on recursive raphs and structures, (ii) a method for deducin results on the descriptive complexity of nitary NP optimization problems from results on the computational complexity (i.e., the de ree of undecidability) of their in nitary analo ues, (iii) completeness results for query lan ua es on recursive data bases, (iv) correspondences between descriptive and computational complexity over recursive structures, and (v) zero-one laws for recursive structures.
1
Introduction
This paper provides a summary of work mos of i join wi h Tirza Hirs on in ni e recursive (i.e., compu able) s ruc ures and da a bases, and a emp s o pu i in perspec ive. The work i self is con ained in four papers [H,HH1,HH2,HH3], which are summarized, respec ively, in Sec ions 2, 3, 4 and 5. When compu er scien is s become in eres ed in an in ni e objec , hey require i o be compu able, i.e., recursive, so ha i possesses an e ec ive ni e represen a ion. Given he prominence of ni e graphs in compu er science, and he many resul s and open ques ions surrounding hem, i is very na ural o inves iga e recursive graphs oo. Moreover, insigh in o ni e objec s can of en be gleaned from resul s abou in ni e recursive varian s hereof. An in ni e recursive graph can be hough of simply as a recursive binary rela ion over he na ural numbers. Recursive graphs can be represen ed by he ( ni e) algori hms, or Turing machines, ha recognize heir edge se s, so ha i makes sense o inves iga e he complexi y of problems concerning hem. Preliminary versions of this paper appeared in STACS ’94, Proc. 11th Ann. Symp. on Theoretical Aspects of Computer Science, Lecture Notes in Computer Science, Vol. 775, Sprin er-Verla , Berlin, 1994, pp. 633 645, and in Computer Science Today, Lecture Notes in Computer Science, Vol. 1000, Sprin er-Verla , 1995, pp. 374 391. Incumbent of the William Sussman Chair of Mathematics. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 36 53, 1998. c Sprin er-Verla Berlin Heidelber 1998
Towards a Theory of Recursive Structures
37
Indeed, a signi can amoun of work has been carried ou in recen years regarding he complexi y of problems on recursive graphs. Some of he rs papers were wri en in he 1970s by Manas er and Rosens ein [MR] and Bean [B1,B2]. Following ha , a varie y of problems were considered, including ones ha are NP-comple e for ni e graphs, such as k-colorabili y and Hamil onici y [B1,B2,BG2,Bu,GL,MR] and ones ha are in P in he ni e case, such as Eulerian pa hs [B2,BG1] In mos cases (including he above examples) he problems urned ou o be undecidable. This is rue even for highly recursive graphs [B1], i.e., ones for which node degree is ni e and he se of neighbors of a node is compu able. Beigel and Gasarch [BG1] and Gasarch and Lockwood [GL] invesiga ed he precise level of undecidabili y of many such problems, and showed ha hey reside on low levels of he ari hme ical hierarchy. For example, de ec ing he exis ence of an Eulerian pa h is 30 -comple e for recursive graphs and 0 2 -comple e for highly recursive graphs [BG1]. The case of Hamil onian pa hs seemed o be more elusive. In 1976, Bean [B2] had shown ha he problem is undecidable (even for planar graphs), bu he precise charac eriza ion was no known. In response o his ques ion, posed by R. Beigel and B. Gasarch, he au hor was able o show ha Hamil onici y is in fac hi hly undecidable, viz, 11 -comple e. The resul , proved in [H] and summarized in Sec ion 2, holds even for highly recursive graphs wi h degree bounded by 3. (I ac ually holds for planar graphs oo.) Hamil onici y is hus an example of an in eres ing graph problem ha becomes highly undecidable in he in ni e case.1 The ques ion hen arises as o wha makes some NP-comple e problems highly undecidable in he in ni e case, while o hers (e.g., k-colorabili y) remain on low levels of he ari hme ical hierarchy. This was he s ar ing poin of he join work wi h T. Hirs . In [HH1], summarized in Sec ion 3, we provide a general de ni ion of in ni e recursive versions of NP op imiza ion problems, in such a way ha Max Clique, for example, becomes he ques ion of whe her a recursive graph con ains an in ni e clique. Two main resul s are proved in [HH1], one enables using knowledge abou he in ni e case o yield implica ions o he ni e case, and he o her enables implica ions in he o her direc ion. The resul s es ablish a connec ion be ween he descrip ive complexi y of ( ni ary) NP op imiza ion problems, par icularly he syn ac ic class Max NP, and he compu a ional complexi y of heir in ni e versions, par icularly he class 11 . Taken oge her, he wo resul s yield many new problems whose in ni e versions are highly undecidable and whose ni e versions are ou side Max NP. Examples include Max Clique, Max Independent Set, Max Sub raph, and Max Tilin . The nex paper, [HH2], summarized in Sec ion 4, pu s forward he idea of in ni e recursive rela ional da a bases. Such a da a base can be de ned simply as a ni e uple of recursive rela ions (no necessarily binary) over some coun able domain. We hus ob ain a na ural generaliza ion of he no ion of a ni e rela ional da a base. This is no an en irely wild idea: ables of rigonome ric 1
Independent work in [AMS] showed that perfect matchin is another such problem.
38
David Harel
func ions, for example, can be viewed as a recursive da a base, since we migh be in eres ed in he sines or cosines of in ni ely many angles. Ins ead of keeping hem all in a able, which is impossible, we keep rules for compu ing he values from he angles, and vice versa, which is really jus o say ha we have an effec ive way of elling whe her an edge is presen be ween nodes i and j in an in ni e graph, and his is precisely he no ion of a recursive graph. In [HH2], we inves iga e he class of compu able queries over recursive da a bases, he mo iva ion being borrowed from [CH1]. Since he se of compu able queries on such da a bases is no closed under even simple rela ional opera ions, one mus ei her make do wi h a very humble class of queries or considerably res ric he class of allowed da a bases. The main par s of [HH2] are concerned wi h he comple eness of wo query languages, one for each of hese possibili ies. The rs is quan i er-free rs -order logic, which is shown o be comple e for he non-res ric ed case. The second is an appropria ely modi ed version of he comple e language QL of [CH1], which is proved comple e for he case of highly symme ric da a bases. These have he proper y ha heir se of au omorphisms is of ni e index for each uple-wid h. While he previous opic involves languages for computable queries, our nal paper, [HH3], summarized in Sec ion 5, deals wi h languages ha express non-compu able queries. In he spiri of resul s for ni e s ruc ures by Fagin, Immerman and o hers, we sough o connec he compu a ional complexi y of proper ies of recursive s ruc ures wi h heir descrip ive complexi y, i.e, o capure levels of undecidabili y syn ac ically as he proper ies expressible in various logical formalisms. We consider several formalisms, such as rs -order logic, second-order logic and xpoin logic. One of our resul s is analogous o ha of Fagin [F1]; i s a es ha , for any k 2, he proper ies of recursive s ruc ures expressible by k1 formulas are exac ly he generic proper ies in he complexi y class k1 of he analy ical hierarchy. [HH3] also deals wi h zero-one laws. I is no oo di cul o see ha many of he classical heorems of logic ha hold for general s ruc ures (e.g., compac ness and comple eness) fail no only for ni e models bu for recursive ones oo. O hers, such as Ehrenfeuch Fraisse games, hold for ni e and recursive s ruc ures oo. Zero-one laws, o he e ec ha cer ain proper ies (such as hose expressible in rs -order logic) are ei her almos surely rue or almos surely false, are considered unique o ni e model heory, since hey require coun ing he number of s ruc ures of a given ni e size. We in roduce a way of ex ending he de ni ion of hese laws o recursive s ruc ures, and prove ha hey hold for rs -order 1 1 o show non-expressibili y logic, s ric 1 and s ric 1 . We hen use his fac of cer ain proper ies of recursive s ruc ures in hese logics. While recursive s ruc ures and models have been inves iga ed qui e widely by logicians (see, e.g., [NR]), he kind of issues ha compu er scien is s are in eres ed in have no been addressed prior o he work men ioned above. We feel ha ha his is a fer ile area for research, and raises heore ical and prac ical ques ions concerning he compu abili y and complexi y of proper ies of recursive s ruc ures, and he heory of queries and upda e opera ions over recursive da a
Towards a Theory of Recursive Structures
bases. We hope ha hese opics.
2
39
he work summarized here will s imula e more research on
Hamiltonicity in Recursive Graphs
A recursive directed raph is a pair G = (V E), where V is recursively isomorphic o he se of na ural numbers N , and E V V is recursive. G is undirected if E is symme ric. A hi hly recursive raph is a recursive graph for which here is a recursive func ion H from V o ni e subse s of V , such ha H(v) = u v u E . A one-way (respec ively, two-way) Hamiltonian path in G is a 1-1 mapping p of N (respec ively, Z) on o V , such ha p(x) p(x + 1) E for all x. Bean [B2] showed ha de ermining Hamil onici y in highly recursive graphs is undecidable. His reduc ion is from non-well-foundedness of recursive rees wi h ni e degree, which can be viewed simply as he hal ing problem for (nonde erminis ic) Turing machines. Given such a ree T , he proof in [B2] cons ruc s a graph G, such ha in ni e pa hs in T map o Hamil onian pa hs in G. The idea is o make he nodes of G correspond o hose of T , bu wi h all nodes ha are on he same level being connec ed in a cyclic fashion. In his way, a Hamil onian pa h in G simula es moving down an in ni e pa h in T , bu a each level i also cycles hrough all nodes on ha level. A fac ha is crucial o his cons ruc ion is he ni eness of T ’s degree, so ha he proof does no generalize o rees wi h in ni e degree, Thus, Bean’s proof only es ablishes ha Hamil onici y is hard for 10 , or co-r.e. In [H] we have been able o show ha he problem is ac ually 11 -comple e. Hardness is proved by a reduc ion ( ha is elemen ary bu no s raigh forward) from he non-well-foundedness of recursive rees wi h possibly in nite degree, which is well-known o be a 11 -comple e problem [R]: Theorem: Detectin (one-way or two-way) Hamiltonicity in a (directed or undirected) hi hly recursive raph is 11 -complete, even for raphs with H(v) 3 for all v. Proof sketch: In 11 is easy: Wi h he f quan ifying over o al func ions from N o N , we wri e f x y z ( f (x) f (x + 1)
E
(x = y
f (x) = f (y))
f (z) = x)
This covers he case of one-way pa hs. The wo-way case is similar. We now show 11 -hardness for undirec ed recursive graphs wi h one-way pa hs. (The o her cases require more work, especially in removing he in ni e branching from he graphs we cons ruc in order o ob ain he resul for highly recursive graphs. The de ails can be found in [H].) Assume a recursive ree T is given, wi h nodes N = 0 1 2 3 , and roo 0, and whose parent-of func ion is recursive. T can be of in ni e degree. We cons ruc an undirec ed graph G, which has a one-way Hamil onian pa h i T has an in ni e pa h.
40
David Harel
n
S(n)
Figure 1 For each elemen n N , G has a clus er of ve in ernal nodes, nu nd nr nl and nur , s anding, respec ively, for up, down, ri ht, left and up-ri ht. For each such clus er, G has ve in ernal edges: nd
nl
nu
nur
nr
nl
For each edge n − m of he ree T , nd mu is an edge of G. For each node n in T , le S(n) be n’s dis ance from he roo in T (i s level ). Since S(n) N , we may view S(n) as a node in T . In fac , in G we will hink of S(n) as being n’s shadow node, and he wo are connec ed as follows (see Fig. 1):2 nr
S(n)r
and S(n)l
nl
To comple e he cons ruc ion, here is one addi ional roo node edge 0u .
in G, wi h an
Since T is a recursive ree and S, as a func ion, is recursive in T , i is easy o see ha G is a recursive graph. To comple e he proof, we show ha T has an in ni e pa h from 0 i G has a Hamil onian pa h. (Only-if ) Suppose T has an in ni e pa h p. A Hamil onian pa h p0 in G s ar s a he roo , and moves down G’s versions of he nodes in p, aking de ours o he righ o visi n’s shadow node S(n) whenever S(n) p. The way his is done can be seen in Fig. 2. Since p is in ni e, we will even ually reach a node of any desired level in T , so ha any n p will even ually show up as a shadow of some node along p and will be visi ed in due ime. I is hen easy o see ha p0 is Hamil onian.
2
Clearly, iven T , the function : N N is not necessarily one-one. In fact, Fi . 1 is somewhat misleadin , since there may be in nitely many nodes with the same shadow, so that the de ree of both up-nodes and down-nodes can be in nite. Moreover, (n) itself is a node somewhere else in the tree, and hence has its own T -ed es, perhaps in nitely many of them.
Towards a Theory of Recursive Structures
41
n0
n
S(n 1 )
1
n2
S(n 2 )
n3
n4
S(n 4 )
n5
Figure 2 (If ) Suppose G has a Hamil onian pa h p. I helps o view he pa h p as con aining no only he nodes, bu also he edges connec ing hem. Thus, wi h he excep ion of he roo , each node in G mus con ribu e o p exac ly wo inciden edges, one incoming and one ou going. We now claim ha for any n, if p con ains he T -edge inciden o he up-node nu , or, when n = 0, if i con ains he edge be ween and 0u , hen i mus also con ain a T -edge inciden o he down node nd . To see why his is rue, assume p con ains he T -edge inciden o nu ( his is he edge leading upwards a he op lef of Fig. 1). Consider nur ( he small black node in he gure). I has exac ly wo inciden edges, bo h of which mus herefore be in p. Bu since one of hem connec s i o nu , we already have in p he wo required edges for nu , so ha he one be ween nu and nd canno be in p. Now, he only remaining edges inciden o nd are he in ernal one connec ing
42
David Harel
i o nl , and i s T -edges, if any. However, since p mus con ain exac ly wo edges inciden o nd , one of hem mus be one of he T -edges. 1 1 -comple
In fac , Hamil onici y is
3
rom the
e even for planar graphs [HH1].
inite to the In nite and Back
Our approach o op imiza ion problems focuses on heir descrip ive complexi y, an idea ha s ar ed wi h Fagin’s [F1] charac eriza ion of NP in erms of denabili y in exis en ial second-order logic on ni e s ruc ures. Fagin’s heorem asser s ha a collec ion C of ni e s ruc ures is NP-compu able if and only if here is a quan i er-free formula (x y S), such ha for any ni e s ruc ure A: A
A = ( S)( x)( y) (x y S)
C
Papadimi riou and Yannakakis [PY] in roduced he class Max NP of maximiza ion problems ha can be de ned by max x: A = ( y) (x y S) S
for quan i er-free . Max Sat is he canonical example of a problem in Max NP. The au hors of [PY] also considered he subclass Max SNP of Max NP, consis ing of hose maximiza ion problems in which he exis en ial quan i er above is no needed. (Ac ually, he classes Max NP and Max SNP of [PY] con ain also heir closures under L-reduc ions, which preserve polynomial- ime approxima ion schemes. To avoid confusion, we use he names Max 0 and Max 1 , in roduced in [KT], ra her han Max SNP and Max NP, for he ‘pure’ syn acic classes.) Kolai is and Thakur [KT] hen examined he class of all maximiza ion problems whose op imum is de nable using rs -order formulas, i.e., by max w: A = (w S) S
where (w S) is an arbi rary rs -order formula. They rs showed ha his class coincides wi h he collec ion of polynomially-bounded NP-maximiza ion problems on ni e s ruc ures, i.e., hose problems whose op imum value is bounded by a polynomial in he inpu size. They hen proved ha hese problems form a proper hierarchy, wi h exac ly four levels: Max
0
Max
1
Max
1
Max
2
=
Max 2
Here, Max 1 is de ned jus like Max 1 (i.e., Max NP), bu wi h a universal quan i er, and Max 2 uses a universal followed by an exis en ial quan i er, and corresponds o Fagin’s general resul s a ed above. The hree con ainmen s are known o be s ric . For example, Max Clique is in Max 1 bu no in Max 1 .
Towards a Theory of Recursive Structures
43
We now de ne a li le more precisely he class of op imiza ion problems we deal wi h3 : De nition: (See [PR]) An Npm problem is a uple F = (IF SF mF ), where IF , he se of input instances, consis s of ni e s ruc ures over some vocabulary , and is recognizable in polynomial ime. SF (I) is he space of feasible solutions on inpu I IF . The only requiremen on SF is ha here exis s a polynomial q and a polynomial ime compu able predica e p, bo h depending only on F , such ha I IF , q( I ) p(I S) . SF (I) = S: S N , he objective function, is a polynomial ime compu able mF : IF func ion. mF (I S) is de ned only when S SF (I). The following decision problem is required o be in NP: Given I IF and an in eger k, is here a feasible solu ion S SF (I), such ha mF (I S) k? This de ni ion (wi h an addi ional echnical res ric ion ha we omi here; see [HH1]) is broad enough o encompass mos known op imiza ion problems arising in he heory of NP-comple eness. We now de ne in ni ary versions of Npm problems, by evalua ing hem over in ni e recursive s ruc ures and asking abou he exis ence of an in ni e solu ion: De nition: For an Npm problem F = (IF SF mF ), le F 1 = (IF1 SF1 m1 F ) be de ned as follows: IF1 is he se of input instances, which are in ni e recursive s ruc ures over he vocabulary . SF1 (I 1 ) is he se of feasible solutions on inpu I 1 IF1 . 1 SF N is he objective function, sa isfying m1 F : I I1
IF1
1 SF1 (I 1 ) (m1 S) = F (I
S
x:
F (I
1
S x) )
IF1 , does here exis S The decision problem is: Given I 1 1 1 such ha mF (I S) = ? Pu ano her way: F 1 (I 1 ) = true
i
S( x:
F (I
1
S x)
=
Due o he condi ions on Npm problems, F 1 can be shown no he 2 -formula represen ing mF . This is impor an , since, if some F could be de ned by wo di eren formulas 1 and 2 ha sa isfy bu yield di eren in ni e problems, we could cons ruc a ni e which 1 and 2 de ermine di eren solu ions. Here is he rs main resul of [HH1]: Theorem: If F 3
Max
1
hen F 1
SF1 (I 1 ),
) o depend on ni e problem he condi ion s ruc ure for
0 2.
We concentrate here on maximization problems, thou h the results can be proved for appropriate minimization ones too.
44
David Harel
A special case of his is: Corollary: For any Npm problem F , if F 1 is
1 1 -hard
hen F is no in Max
1.
1 1 -comple
e and I follows ha since he in ni e version of Hamil onici y is hus comple ely ou side he ari hme ical hierarchy, an appropria ely de ned niary version canno be in Max 1 . Obviously, he corollary is valid no only for such problems bu for all problems ha are above 20 in he ari hme ical hierarchy. For example, since de ec ing he exis ence of an Eulerian pa h in a recursive graph is 30 -comple e [BG1], i s ni e varian canno be in Max 1 ei her. In order o be able o s a e he second main resul of [HH1], we de ne a special kind of monotonic reduc ion be ween ni ary Npm problems, an M-reduction: De nition: Le A and B be se s of s ruc ures. A func ion f : A B is monotonic if A B A (A B f (A) f (B)). (Here, deno es he subs ruc ure rela ion.) Given wo Npm problems: F = (IF SF mF ) and G = (IG SG mG ), an M-reduction from F o G is a uple = (t1 t2 t3 ), such ha : IG t2 : IF SF SG and t3 : IG SG SF , are all mono onic, t1 : IF polynomial ime compu able func ions.. mF and mG grow mono onically wi h respec o t1 t2 and t3 (see [HH1] for a more precise formula ion ). We deno e he exis ence of an M -reduc ion from F o G by F second main resul of [HH1] shows ha M -reduc ions preserve he of he corresponding in ni ary problems: Theorem: Le F and G be wo Npm problems, wi h F hen G1 is 11 -hard oo.
M
M G. The 1 1 -hardness
G. If F 1 is
1 1 -hard,
The nal par of [HH1] applies hese wo resul s o many examples of Npm problems, some of which we now lis wi h heir in ni ary versions. I is shown in [HH1] ha for each of hese he in ni ary version is 11 -comple e. Mos ly, his is done by es ablishing mono onic reduc ions on he ni e level, and applying he second heorem above. From he rs heorem i hen follows ha he ni ary versions mus be ou side Max 1 . Here are some of he examples: 1. Max Clique: I is an undirec ed graph, G = (V E). S(G) = Y : Y m(G Y ) = Y
V
y z
Y y=z
(y z)
E
The maximiza ion version is: max x: x
Y V
Y
y z
Y y=z
(y z)
E
Max Clique1 : I 1 is a recursive graph G. Does G con ain an in ni e clique?
Towards a Theory of Recursive Structures
45
2. Max Ind Set: I is an undirec ed graph G = (V E). S(G) = Y : Y
V
y z
Y (y z)
E
m(G Y ) = Y max x: x
Y
Y V
y z
Y (y z)
E
Max Ind Set1 : I 1 is a recursive graph G. Does G con ain an in ni e independen se ? 3. Max Set Packin : I is a collec ion C of ni e se s, represen ed by pairs (i j), where he se i con ains j. S(C) = Y
C:
A B
Y A=B
A
B=
m(C Y ) = Y Max Set Packin 1 : I 1 is a recursive collec ion of in ni e se s C. Does C con ains in ni ely many disjoin se s? 4. Max Sub raph: I is a pair of graphs, G = (V1 E1 ) and H = (V2 E2 ), vn . wi h V2 = v1 S(G H) = Y : Y V1 V2 v=y (u x)
(u v) (x y) (v y) E1
Y u=x E2
vk appear in Y m((G H) Y ) = k i v1 bu vk+1 does no appear in Y Max Sub raph1 : I 1 is a pair of recursive graphs, H and G. Is H a subgraph of G? 5. Max Tilin : I is a grid D of size n n, and a se of iles T = t1 (We assume he reader is familiar wi h he rules of iling problems.)
tm .
S(D T ) = Y : Y is a legal iling of some por ion of Dwi h iles m( D T
from T Y ) = k i Y con ains a iling of a full k
k subgrid of D
Max Tilin 1 : I 1 is a recursive se of iles T . Q: Can T ile he posi ive quadran of he in ni e in eger grid? We hus es ablish closely rela ed fac s abou he level of undecidabili y of many in ni ary problems and he descrip ive complexi y of heir ni ary counerpar s. More examples appear in [HH1]. Two addi ional graph problems of in eres are men ioned in [HH1], planari y and graph isomorphism. The problem of de ec ing whe her a recursive graph is planar can be shown o be co-r.e. De ermining whe her wo recursive graphs
46
David Harel
are isomorphic is ari hme ical for graphs ha have ni e degree and con ain only ni ely many connec ed componen s. More precisely, his problem is in 10 for highly recursive rees; in 30 for recursive rees wi h ni e degree; in 20 for highly recursive graphs; and in 40 for recursive graphs wi h ni e degree. As o he isomorphism problem for general recursive graphs, Morozov [Mo] has recen ly proved, using di eren echniques, ha he problem is 11 -comple e.
4
Completeness for Recursive Data Bases
I is easy o see ha recursive rela ions are no closed under some of he simples accep ed rela ional opera ors. For example, if R(x y z) means ha he y h Turing machine hal s on inpu z af er x s eps (a primi ive-recursive rela ion), hen he projec ion of R on columns 2 and 3 is he nonrecursive hal ing predica e. This means ha even very simple queries, when applied o general recursive rela ions, do no preserve compu abili y. Thus, a naive de ni ion of a recursive da a base as a ni e se of recursive rela ions will cause many ex remely simple queries o be non-compu able. This di cul y can be overcome in essen ially wo ways (and possibly o her in ermedia e ways ha we haven’ inves iga ed). The rs is o accep he si uaion as is; ha is, o resign ourselves o he fac ha on recursive da a bases he class of compu able queries will necessarily be very humble, and hen o ry o cap ure ha class in a (correspondingly humble) comple e query language. The second is o res ric he da a bases, so ha he s andard kinds of queries will preserve compu abili y, and hen o ry o es ablish a reasonable comple eness resul for hese res ric ed inpu s. The rs case will give rise o a rich class of da a bases bu a poor class of queries, and he second o a rich class of queries bu a poor class of da a bases. In bo h cases, of course, in addi ion o being Turing compu able, he queries will also have o sa isfy he consis ency cri erion of [CH1], more recen ly ermed enericity, whereby queries mus preserve isomorphisms. The rs resul of [HH2] shows ha he class of compu able queries on recursive da a bases is indeed ex remely poor. Firs we need some prepara ion. Rk for k > 0, be rela ions, De nition: Le D be a coun able se , and le R1 Dai . B = (D R1 Rk ) is a recursive such ha for all 1 i k, R ak ), if each R , relational data base (or an r-db for shor ) of type a = (a1 considered as a se of uples, is recursive. Rk ) and B2 = (D2 R10 Rk0 ) be wo rDe nition: Le B1 = (D1 R1 n n db’s of he same ype, and le u D1 and v D2 , for some n. Then (B1 u) and (B2 v) are isomorphic, wri en (B1 u) = (B2 v), if here is an isomorphism be ween B1 and B2 aking u o v. (B1 u) and (B2 v) are locally isomorphic, wri en (B1 u) =l (B2 v), if he res ric ion of B1 o he elemen s of u and he res ric ion of B2 o he elemen s of v are isomorphic. De nition: An r-query Q (i.e., a par ial func ion yielding, for each r-db B of ype a, an ou pu (if any) which is a recursive rela ion over D(B)) is eneric,
Towards a Theory of Recursive Structures
47
if i preserves isomorphisms; i.e. for all B1 B2 u v, if (B1 u) = (B2 v) hen u Q(B1 ) i v Q(B2 ). I is locally eneric if i preserves local isomorphisms; i.e., for all B1 B2 u v, if (B1 u) =l (B2 v) hen u Q(B1 ) i v Q(B2 ). The following is a key lemma in he rs resul : Lemma: If Q is a recursive r-query, hen Q is generic i Q is locally generic. De nition: A query language is r-complete if i expresses precisely he class of recursive generic r-queries. Theorem: The language of rs -order logic wi hou quan i ers is r-comple e. We now prepare for he second resul of [HH2], which insis s on he full se of compu able queries of [CH1], bu dras ically reduces he allowed da a bases in order o achieve comple eness. Rk ) be a xed r-db. For each u v Dn , u and De nition: Le B = (D R1 v are equivalent, wri en u =B v, if (B u) = (B v). B is hi hly symmetric if for each n > 0, he rela ion =B induces only a ni e number of equivalence classes of rank n. Highly symme ric graphs consis of a ni e or in ni e number of connec ed componen s, where each componen is highly symme ric, and here are only ni ely many pairwise non-isomorphic componen s. In a highly symme ric graph, he ni e degrees, he dis ances be ween poin s and he leng hs of he induced pa hs are bounded. A grid or an in ni e s raigh line, for ins ance, are no highly symme ric, bu he full in ni e clique is highly symme ric. Fig. 3 shows an example of ano her highly symme ric graph.
...
...
...
.. .
.. .
...
Figure 3 A characteristic tree for B is de ned as follows. I s roo is , and he res of he ver ices are labeled wi h elemen s from D, such ha he labels along each pa h from he roo form a uple ha is a represen a ive of an equivalence class of =B . The whole ree covers represen a ives of all such classes. No wo pa hs are allowed o form represen a ives of he same class. We represen a highly symme ric da a base B by a uple CB = (TB =B C1
Ck )
where TB is some charac eris ic ree for B, and each C is a ni e se of represen a ives of he equivalence classes cons i u ing he rela ion R . We also require ha =B be recursive, and ha TB be highly recursive (in he sense of Sec ion 2).
48
David Harel
We say ha a query Q on a highly symme ric da a base is recursive if he following version of i , which is applied o he represen a ion CB ra her han o he da a base B i self, is par ial recursive: whenever Q(CB ) is de ned, i yields a ni e se of represen a ives of he equivalence classes represen ing he rela ion Q(B). We now describe he query language QLs . I s syn ax is like ha of he QL language of Chandra and Harel [CH1], wi h he following addi ion: he es in a while loop can be for whe her a rela ion has a single represen a ive, and no only for a rela ion’s emp iness. The seman ics of QLs is he same as he seman ics of QL, excep for some minor echnical adap a ions ha are omi ed here. As in [CH1], he resul of applying a program P o CB is unde ned if P does no hal ; o herwise i is he con en s of some xed variable, say X1 . De nition: A query language is hs-r-complete if i expresses precisely he class of recursive generic queries over highly symme ric recursive da a bases. Theorem: QLs is hs-r-comple e. The proof follows four main s eps, which are analogous o hose given in he comple eness proof for QL in [CH1]. The de ails, however, are more in rica e. In [HH2] a number of addi ional issues are considered, including he res ricion of recursive da a bases o ni e/co- ni e recursive rela ions, comple eness of he generic machines of [AV], and BP-comple eness.
5
Expressibility vs. Complexity, and Zero-One Laws
One par of [HH3] proves resul s ha rela e he expressive power of various logics over recursive s ruc ures o he compu a ional complexi y (i.e., he level of undecidabili y) of he proper ies expressible herein. We summarize some of hese, wi hou providing all of he relevan de ni ions. In he previous sec ion, we men ioned he resul from [HH2] o he e ec ha he very res ric ed language of quan i er-free rs -order rela ional calculus is r-comple e; i.e., i expresses precisely he recursive and generic r-queries. Here we deal wi h languages ha have s ronger expressive power, and hence express also non-recursive queries. There are many resul s over nite s ruc ures ha charac erize complexi y classes in erms of logic. One of he mos impor an of hese is Fagin’s heorem [F1], men ioned in sec ion 2 above, which es ablishes ha he proper ies of ni e s ruc ures expressible by 11 formulas are exac ly he ones ha are in NP. This kind of correspondence also holds be ween each level of he quan i er hierarchy of second-order logic and he proper ies compu able in he corresponding level of he polynomial- ime hierarchy. In order o alk abou recursive s ruc ures i is convenien o use he following de ni ion, which we adap o recursive s ruc ures from Vardi [V] De nition: The data complexity of a language L is he level of di cul y of Q(B) for an expression e in L, compu ing he se s Gr(Qe ) = (B u) u where Qe is he query expressed by e, and B deno es a recursive da a base
Towards a Theory of Recursive Structures
49
(i.e., s ruc ure). A language L is data-complete (or D-complete for shor ) for a compu a ional class C if for every expression e in L, Gr(Qe ) is in C, and here is an expression e0 in L such ha Gr(Qe0 ) is hard for C. Here we res ric ourselves o he consis en , or generic, queries, which are he ones ha preserve isomorphisms. In fac , we require ha hey preserve he isomorphisms of all s ruc ures, no only recursive ones, under he assump ion ha here exis oracles for heir rela ions. Tha is, Q is consiedered here o be generic if for all B1 B2 , if B1 = B2 hen Q(B1 ) = Q(B2 ), where Q(B) is he resul of applying Q o oracles for he rela ions in B. We now provide a very brief descrip ion of he main resul s of his par of [HH3]: 1. Firs -order logic expresses generic queries from he en ire ari hme ical hierarchy, bu i does no express all of hem. For example, he connec ivi y of recursive graphs is ari hme ical, bu is no expressible by a rs -order formula. 2. The logical formalism E- 11 , which consis s of exis en ial second-order formulas, is D-comple e for he complexi y class 11 of he analy ical hierarchy, bu here are queries, even ari hme ical ones, ha are no expressible in E- 11 . However, over ordered s ruc ures ( ha is, if a buil -in o al order is added o he vocabulary), all 11 proper ies are expressible in E- 11 . 3. For k 2, a s ronger resul is proved, analogous o Fagin’s resul for ni e s ruc ures: he logical formalism E- k1 expresses precisely he generic proper ies of he complexi y class k1 . This means ha every generic query over some vocabulary ha is expressible by a k1 formula over in erpre ed recursive predica es, is also expressible by an unin erpre ed E- k1 formula over .4 4. Monadic E- 11 , where he second-order quan i ers are res ric ed o range over unary rela ions (se s), is D-comple e for 11 , and s ric E- 11 is Dcomple e for 20 . 5. Consider xpoin logic, which is ob ained by adding leas xpoin opera ors o rs -order formulas [CH2, I, Mos]. Deno e by FP1 posi ive xpoin logic, in which he leas xpoin opera or is res ric ed o posi ive formulas, and by FP he hierarchy ob ained by al erna ing he leas xpoin opera or wi h he rs -order cons ruc s. In ni e s ruc ures, he FP hierarchy collapses, and a single xpoin opera or su ces [I]. In con ras , for recursive s ruc ures FP1 is D-comple e for 11 , and hence FP1 (nega ions of formulas in FP1 ) is Dcomple e for 11 . The da a complexi y of FP is exac ly 12 , and an example is shown of a query expressible in FP ha is hard for bo h 11 and 11 . 4
In the direction oin from expressibility in E- k1 to computability in k1 , the secondorder quanti ers are used to de ne a total order and predicates + and , which, in turn, are used to de ne the needed elementary arithmetic expression. Each subset of elements must contain a minimum in the de ned order, which requires for its de nition a universal second-order quanti er. This explains why the result requires k 2.
50
David Harel
The second par of [HH3] deals wi h 0 1 laws on recursive s ruc ures. If C is a class of ni e s ruc ures over some vocabulary and if P is a proper y of some s ruc ures in C, hen he asymptotic probability (P ) on C is he limi as n of he frac ion of he s ruc ures in C wi h n elemen s ha sa isfy P , provided ha he limi exis s. Fagin [F2] and Glebskii e al. [GKLT] were he rs o discover he connec ion be ween logical de nabili y and asymp o ic probabili ies. They showed ha if C is he class of all ni e s ruc ures over some rela ional vocabulary, and if P is any proper y expressible in rs -order logic, hen (P ) exis s and is ei her 0 or 1. This resul , known as he 0 1 law for rst-order lo ic, became he s ar ing poin of a series of inves iga ions aimed a discovering he rela ionship be ween expressibili y in a logic and asymp o ic probabili ies. Several addi ional logics, such as xpoin logic, i era ive logic and s ric E- 11, have been shown by various au hors o sa isfy he 0 1 law oo. A s andard me hod for es ablishing 0 1 laws on ni e s ruc ures, origina ing in Fagin [F2], is o prove ha he following transfer theorem holds: here is an in ni e s ruc ure A over such ha for any proper y P expressible in L: A =P i
(P ) = 1 on C
I urns ou ha here is a single coun able s ruc ure A ha sa is es his equivalence for all he logics men ioned above. Moreover, A is charac erized by an in ni e se of extension axioms, which, in ui ively, asser ha every ype can be ex ended o any o her possible ype. More speci cally, for each ni e se X of poin s, and each possible way ha a new poin y X could rela e o X in erms of a omic formulas over he appropria e vocabulary, here is an ex ension axiom ha asser s ha here is indeed such a poin . For example, here is an ex ension axiom over a vocabulary con aining one binary rela ion symbol R: x1 x2
x1 = x2
R
(x1 y)
(y x1 )
y (y = x1 R
(y x2 )
y = x2 R
(x2 y)
R)
Fagin realized ha he ex ension axioms are relevan o he s udy of probabili ies on ni e s ruc ures and proved ha on he class C of all ni e s ruc ures of vocabulary , ( ) = 1 for any ex ension axiom . The heory of all ex ension axioms, deno ed T , is known o be -ca egorical ( ha is, every wo coun able models are isomorphic), so ha A, which is a model for T , is unique up o isomorphism. This unique s ruc ure is called he random countable structure, since i is genera ed, wi h probabili y 1, by a random process in which each possible uple appears wi h probabili y 1/2, independen ly of he o her uples. The random graph was s udied by Rado [Ra], and is some imes called he Rado raph. Now, since all coun able s ruc ures are isomorphic o A wi h probabili y 1, he asymp o ic probabili y of each (generic) proper y P on coun able s ruc ures is rivially 0 or 1, since his depends only on whe her A sa is es P or no . Hence, he subjec of 0 1 laws over he class of all coun able s ruc ures is no in eres ing.
Towards a Theory of Recursive Structures
51
As o recursive s ruc ures, which are wha we are in eres ed in here, one is faced wi h he di cul y of de ning asymp o ic probabili ies, since s ruc ure size is no longer applicable. The hear of his par of [HH3] is a proposal for a de ni ion of 0 1 laws for recursive s ruc ures. De nition: Le F = F 1 =1 be a sequence of recursive s ruc ures over some vocabulary, and le P be a proper y de ned over he s ruc ures in F . Then he asymptotic probability F (P ) is de ned o be F (P )
= lim
n!1
F 1
i
n F =P n
De nition: Le F = F 1 =1 be a sequence of recursive s ruc ures over some vocabulary . We say ha F is a T -sequence if F ( ) = 1 for every ex ension axiom over . As an example, a sequence of graphs ha are all isomorphic o he coun able random graph A is a T -sequence. We shall use U o deno e one such sequence. Here is ano her example of a T -sequence: ake F = Fn 1 n=1 , where each Fn is a graph sa isfying all he n-ex ension axioms and is buil in s ages. Firs ake n dis inc and disconnec ed poin s. Then, a each s age add a new poin z for every xn from previous s ages and for every possible ex ension axiom for se x1 i , and connec z accordingly. De nition: Le P be a proper y of recursive s ruc ures. We say ha he 0 1 law holds for P if for every T -sequence F he limi F (P ) exis s and is equal o 0 or 1. The 0 1 law holds for a lo ic L on recursive structures if i holds for every proper y expressible in L. Here are some of he resul s proved in [HH3] for his de ni ion of 0 1 laws over recursive s ruc ures. Theorem: The 0 1 law holds for all proper ies of recursive s ruc ures de nable in rs -order logic, s ric E- 11 and s ric E- 11 . Moreover, if A is he coun able random s ruc ure, P is such a proper y and F is a T -sequence, hen A = P i F (P ) = 1 However, he proper y of a graph having an in ni e clique, for example, is shown no o sa isfy he 0 1 law, so ha he law does no hold in general for E- 11 -proper ies. As a resul of he heorem, a proper y for which he 0 1 law does no hold is no expressible in rs -order logic, s ric E- 11 or s ric E- 11 . In fac , we have he following: Theorem: Every proper y on recursive s ruc ures ha is rue in A, bu does no have probabili y 1 on some T -sequence, is no expressible by an E- 11 sen ence or by a s ric E- 11 sen ence. In way of applying he echniques, we show in [HH3] ha he following proper ies are no expressible by an E- 11 sen ence or by a s ric E- 11 sen ence:
52
David Harel
a recursive graph having an in ni e clique, a recursive graph having an in ni e independen se , a recursive graph sa isfying all he ex ension axioms, and a pair of recursive graphs being isomorphic. Acknowled ements: I would like o hank Richard Beigel, who by asking he ques ion addressed in Sec ion 2, in roduced me o his area. His work wi h Bill Gasarch has been a grea inspira ion. Very special hanks go o Tirza Hirs , wi hou whom his paper couldn’ have been wri en. Apar from Sec ion 2, he resul s are all join wi h her, and form her ou s anding PhD hesis.
References S. Abiteboul and V. Vianu, Generic Computation and Its Complexity , Proc. 23rd Ann. ACM Symp. on Theory of Computin , pp. 209 219, ACM Press, New York, 1991. AMS. R. Aharoni, M. Ma idor and R. A. Shore, On the Stren th of K¨ oni ’s Duality Theorem , J. of Combinatorial Theory (Series B) 54:2 (1992), 257 290. B1. D.R. Bean, E ective Coloration , J. Sym. Lo ic 41 (1976), 469 480. B2. D.R. Bean, Recursive Euler and Hamiltonian Paths , Proc. Amer. Math. Soc. 55 (1976), 385 394. BG1. R. Bei el and W. I. Gasarch, unpublished results, 1986-1990. BG2. R. Bei el and W. I. Gasarch, On the Complexity of Findin the Chromatic Number of a Recursive Graph , Parts I & II, Ann. Pure and Appl. Lo ic 45 (1989), 1 38, 227 247. Bu. S. A. Burr, Some Undecidable Problems Involvin the Ed e-Colorin and Vertex Colorin of Graphs , Disc. Math. 50 (1984), 171 177. CH1. A. K. Chandra and D. Harel, Computable Queries for Relational Data Bases , J. Comp. Syst. Sci. 21, (1980), 156 178. CH2. A.K. Chandra and D. Harel, Structure and Complexity of Relational Queries , J. Comput. Syst. Sci. 25 (1982), 99 128. F1. R. Fa in, Generalized First-Order Spectra and Polynomial-Time Reco nizable Sets , In Complexity of Computations (R. Karp, ed.), SIAM-AMS Proceedin s, Vol. 7, 1974, pp. 43 73. F2. R. Fa in, Probabilities on Finite Models , J. of Symbolic Lo ic, 41, (1976), 50 58. GL. W. I. Gasarch and M. Lockwood, The Existence of Matchin s for Recursive and Hi hly Recursive Bipartite Graphs , Technical Report 2029, Univ. of Maryland, May 1988. GKLT. Y. V. Glebskii, D. I. Ko an, M. I. Lio onki and V. A. Talanov, Ran e and De ree of Realizability of Formulas in the Restricted Predicate Calculus , Cybernetics 5, (1969), 142 154. H. D. Harel, Hamiltonian Paths in In nite Graphs , Israel J. Math. 76:3 (1991), 317 336. (Also, Proc. 23rd Ann. ACM Symp. on Theory of Computin , New Orleans, pp. 220 229, 1991.) HH1. T. Hirst and D. Harel, Takin it to the Limit: On In nite Variants of NPComplete Problems , J. Comput. Syst. Sci., to appear. (Also, Proc. 8th IEEE Conf. on Structure in Complexity Theory, IEEE Press, New York, 1993, pp. 292 304.)
AV.
Towards a Theory of Recursive Structures
53
HH2. T. Hirst and D. Harel, Completeness Results for Recursive Data Bases , J. Comput. Syst. Sci., to appear. (Also, 12th ACM Ann. Symp. on Principles of Database Systems, ACM Press, New York, 1993, 244 252.) HH3. T. Hirst and D. Harel, More about Recursive Structures: Zero-One Laws and Expressibility vs. Complexity , in preparation. I. N. Immerman, Relational Queries Computable in Polynomial Time , Inf. and Cont. 68 (1986), 86 104. KT. P. G. Kolaitis and M. N. Thakur, Lo ical de nability of NP optimization problems , 6th IEEE Conf. on Structure in Complexity Theory, pp. 353 366, 1991. MR. A. Manaster and J. Rosenstein, E ective Matchmakin (Recursion Theoretic Aspects of a Theorem of Philip Hall) , Proc. London Math. Soc. (1972), 615 654. Mo. A. S. Morozov, Functional Trees and Automorphisms of Models , Al ebra and Lo ic 2 (1993), 28 38. Mos. Y. N. Moschovakis, Elementary Induction on Abstract Structures, North Holland, 1974. NR. A. Nerode and J. Remmel, A Survey of Lattices of R. E. Substructures , In Recursion Theory, Proc. Symp. in Pure Math. Vol. 42 (A. Nerode and R. A. Shore, eds.), Amer. Math. Soc., Providence, R. I., 1985, pp. 323 375. PR. A. Panconesi and D. Ranjan, Quanti ers and Approximation , Theor. Comp. Sci. 107 (1993), 145 163. PY. C. H. Papadimitriou and M. Yannakakis, Optimization, Approximation, and Complexity Classes , J. Comp. Syst. Sci. 4 , (1991), 425 440. Ra. R. Rado, Universal Graphs and Universal Functions , Acta Arith., 9, (1964), 331 340. R. H. Ro ers, Theory of Recursive Functions and E ective Computability, McGrawHill, New York, 1967. V. M. Y. Vardi, The Complexity of Relational Query Lan ua es , Proc. 14th ACM Ann. Symp. on Theory of Computin , 1982, pp. 137 146.
Modularization and Abstraction: The Keys to Practical Formal Veri cation? Yonit Kesten1 and Amir Pnueli2 1
2
Ben Gurion University, ykesten@b umail.b u.ac.il, Weizmann Institute of Science,
[email protected] Abstract. In spite of the impressive pro ress in the development of the two main methods for formal veri cation of reactive systems Model Checkin (in particular symbolic) and Deductive Veri cation, they are still limited in their ability to handle lar e systems. It is enerally reco nized that the only way these methods can ever scale up is by the extensive use of abstraction and modularization, which breaks the task of verifyin a lar e system into several smaller tasks of verifyin simpler systems. In this methodolo ical paper, we review the two main tools of compositionality and abstraction in the framework of linear temporal lo ic. We illustrate the application of these two methods for the reduction of an in nite-state system into a nite-state system that can then be veri ed usin model checkin . The modest technical contributions contained in this paper are a full formulation of abstraction when applied to a system with both weak and stron fairness requirements and to a eneral temporal formula, and a presentation of a compositional framework for shared variables and its application for formin network invariants.
1
Introduction
In spite of the impressive pro ress in the development of the two main methods for formal veri cation of reactive systems Model Checkin (in particular symbolic) and Deductive Veri cation, they are still limited in their ability to handle lar e systems. It is enerally reco nized that the only way these methods can ever scale up to handle industrial-size desi ns is by the extensive use of abstraction and modularization, which break the task of verifyin a lar e system into several smaller tasks of verifyin simpler systems. In this methodolo ical paper, we review the two main tools of compositionality and abstraction in the framework of linear temporal lo ic. We illustrate the application of these two methods for the reduction of an in nite-state system into a nite-state system that can then be veri ed usin model checkin . This research was supported in part by a ift from Intel, a rant from the U.S.-Israel bi-national science foundation, and an Infrastructure rant from the Israeli Ministry of Science and the Arts. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 54 71, 1998. c Sprin er-Verla Berlin Heidelber 1998
Modularization and Abstraction: The Keys to Practical Formal Veri cation
55
To simplify matters, we have considered two special classes of in nite-state systems for which the combination of compositionality and abstraction can effectively simplify the systems into nite-state ones. The rst class is where the unboundedness of the system results from its structure. These are parameterized desi ns consistin of a parallel composition of nite-state processes, whose number is a varyin parameter. For such systems, the source of complexity is the control or the architectural structure. We describe the techniques useful for such systems as control abstraction, since it is the control component that we try to simplify. Another source for state complexity is havin data variables which ran e over in nite domains such as the inte ers. We refer to the techniques appropriate for simplifyin such systems as data abstraction. Many methods have been proposed for the uniform veri cation of parameterized systems, which is the subject of our control abstraction. These include explicit induction ([EN95], [SG92]) network invariants, which can be viewed as implicit induction ([KM95], [WL89], [HLR92], [LHR97]), methods that can be viewed as abstraction and approximation of network invariants ([BCG86], [SG89], [CGJ95]), and other methods that can be viewed as based on abstraction ([ID96], [EN96]). The approach described here is based on the idea of network invariants as introduced in [WL89], and elaborated in [KM95] into a workin method. There has been extensive study of the use of data abstraction techniques, mostly based on the notions of abstract interpretation ([CC77], [CH78]). Most of the previous work was done in a branchin context which complicates the problem if one wishes to preserve both existential and universal properties. On the other hand, if we restrict ourselves to a universal fra ment of the lo ic, e. . actl , then the conclusions reached are similar to our main result for the restricted case that the property contains ne ations only within assertions. The paper [CGL94] obtains a similar result for the fra ment actl . However, instead of startin with a concrete property and abstractin it into an , they start with an abstract actl formula Ψ evaluated over the appropriate abstract system K and show how to translate (concretize) it into a concrete formula = C(Ψ ). The concretization is such that M8 ( ) = Ψ . The survey in [CGL96] considers an even simpler case in which the abstraction does not concern the variables on which the property depends. Conse= . quently, this is the case in which A more elaborate study in [DGG97] considers a more complex speci cation lan ua e L , which is a positive version of the -calculus. None of these three articles considers explicitly the question of fairness requirements and how they are a ected by the abstraction process. Approaches based on simulation and studies of the properties they preserve are considered in [BBLS92] and [GL93]. A linear-time application of abstract interpretation is proposed in [BBM95], applyin the abstractions directly to the computational model of fair transition systems which is very close to the fks model considered here. However, the
56
Yonit Kesten and Amir Pnueli
method is only applied for the veri cation of safety properties. Liveness, and therefore fairness, are not considered.
2
A Computational Model: Fair Kripke Structure
As a computational model for reactive systems, we take the model of fair kripke structure (fks) [KPR98], which is a sli ht variation on the model of fair transition system [MP95]. Such a system K : V W O J C consists of the followin components. un : A nite set of typed system variables, containin data and V = u1 control variables. The set of states (interpretation) over V is denoted by . wn V : A nite set of owned variables. These are the W = w1 variables that only the system itself can modify. All other variables can also be modi ed by the environment. A system is said to be closed if W = V . on V : A nite set of observable variables. These are the O = o1 variables whose values (and identities) must be preserved in some of the abstractions we will consider. It is required that V = W O, i.e., for every system variable u V , u is either owned , observable, or both. : The initial condition an assertion ( rst-order state formula) characterizin the initial states. : A transition relation an assertion (V V 0 ), relatin the values V of the . variables in state s to the values V 0 in a K-successor state s0 J = J1 Jk : A set of justice requirements (also called weak fairness requirements). The justice requirement J J is an assertion, intended to uarantee that every computation contains in nitely many J-state (states satisfyin J). pn qn : A set of compassion requirements (also called C = p1 q1 stron fairness requirements). The compassion requirement p q C is a pair of assertions, intended to uarantee that every computation containin in nitely many p-states also contains in nitely many q-states. We require that every state s has at least one K-successor. This is often ensured by includin in the idlin disjunct V = V 0 (also called the stutterin step). In such cases, every state s is its own K-successor. be an in nite sequence of states, be an assertion, and Let : s0 s1 s2 let j 0 be a natural number. We say that j is a -position of if sj is a -state. Let K be an fks for which the above components have been identi ed. We de ne a computation of K to be an in nite sequence of states : s0 s1 s2 satisfyin the followin requirements: Initiality: Consecution: Justice:
s0 is initial, i.e., s0 = . For each j = 0 1 , the state sj+1 is a K-successor of the state sj . For each J J , contains in nitely many J-positions
Modularization and Abstraction: The Keys to Practical Formal Veri cation
57
For each p q C, if contains in nitely many p-positions, it must also contain in nitely many q-positions.
Compassion:
For an fks K, we denote by Comp(K) the set of all computations of K. An fks K is called feasible if Comp(K) = , namely, if K has at least one computation. The feasibility of an fks can be checked al orithmically, usin symbolic model checkin methods, as presented in [KPR98]. All our concrete examples are iven in spl (Simple Pro rammin Lan ua e), which is used to represent concurrent pro rams (e. ., [MP95], [MAB+ 94]). Every spl pro ram can be compiled into an fks in a strai htforward manner. In particular, every statement in an spl pro ram contributes a disjunct to the transition relation. For example, the assi nment statement 0
: y := x + 1;
1
:
can be executed when control is at location 0 . When executed, it assi ns x+1 to y while control moves from 0 to 1 . This statement contributes to the disjunct 0
:
at−
0
at−
0 1
y0 = x + 1
x0 = x
The predicates at− 0 and at− 01 stand, respectively, for the assertions = 0 and 0 = 1, where is the control variable denotin the current location within the process to which the statement belon s.
3
Operations on fks’s
There are several important operations, one may wish to apply to fks’s. The rst useful set of operations on pro rams and systems is formin their parallel composition, implyin that the two systems execute concurrently. Consider the two fair Kripke structures K1 = V1 W1 O1 1 1 J1 C 1 and K2 = V2 W2 O2 2 2 J2 C 2 . There are several ways of formin their parallel composition. 3.1
Asynchronous Parallel Composition
The systems K1 and K2 are said to be compatible if W1 W2 = and V1 V2 O1 O2 . The rst condition requires that a variable can only be owned by one of the systems. The second condition requires that variables known to both systems must be observable in both. For compatible systems K1 and K2 , we de ne their asynchronous parallel J C , composition, denoted by K1 K2 , to be the system K = V W O where W = W1 W2 O = O1 O2 V = V1 V2 = 1 J = J1 J2 C = C1 C2 2 = ( 1 pres((V2 − V1 ) W2 )) ( 2 pres((V1 − V2 ) W1 )) For a set of variables U V , the predicate pres(U ) stands for the assertion U 0 = U , implyin that all the variables in U are preserved by the transition.
58
Yonit Kesten and Amir Pnueli
Obviously, the basic actions of the composed system K are chosen from the basic actions of its components, i.e., K1 and K2 . Thus, we can view the execution of K as the interleaved execution of K1 and K2 . As seen from the de nition, K1 and K2 may have disjoint as well as common system variables, and the variables of K are the union of all of these variables. The initial condition of K is the conjunction of the initial conditions of K1 and K2 . The transition relation of K states that at any step, we may choose to perform a step of K1 or a step of K2 . However, when we select one of the two systems, we should also take care to preserve the private variables of the other system. For example, choosin to execute a step of K1 , we should preserve all variables in V2 − V1 and all the variables owned by K2 . The justice and compassion sets of K are formed as the respective unions of the justice and compassion sets of the component systems. Asynchronous parallel composition corresponds to the spl parallel operator constructin a pro ram out of concurrent processes. 3.2
Synchronous Parallel Composition
We de ne the synchronous parallel composition of K1 and K2 , denotes by K1 K2 , to be the system K = V W O J C , where, W = W1 W2 O = O1 O2 V = V1 V2 = 1 J = J1 J2 C = C1 C2 2 = 1 2 As implied by the de nition, each of the basic actions of system K consists of the joint execution of an action of K1 and an action of K2 . Thus, we can view the execution of K as the joint execution of K1 and K2 . As will be shown in the next section, the main use of the synchronous parallel composition is for couplin a system with a tester which tests for the satisfaction of a temporal formula, and then checkin the feasibility of the combined system. 3.3
Modularization of an fks
Let P be an spl pro ram and K its correspondin fks. The standard compilation of a pro ram into an fks views the pro ram as a closed system which has no interaction with its environment. In the context of compositional veri cation, we need an open system view of an fks, which takes into account not only actions performed by the system but also actions (in particular, variable chan es) performed by the environment. Let K : V W O JK C K be an fks, such that s V . The modular version of K, is iven by KM : VM WM OM M M JM C M , where, VM = V = M = ( M
s s0 )
WM = W JM = J (W 0 = W s0 )
OM = O CM = C
s
That is, KM the modular version of K allows as an additional action a transition which preserves the values of all variables owned by K but allows all other
Modularization and Abstraction: The Keys to Practical Formal Veri cation
59
shared variables to chan e in an arbitrary way. This provides the most eneral representation of an environment action. The schedulin variable s is used to ensure interleavin between the module and its environment. We refer to a system obtained as the modularization of another fks as a Fair Kripke Module (fkm). We de ne a modular computation of K to be any computation of KM . A property is said to be modularly valid over fks K, denoted K =M , if is KM -valid. 3.4
Modular Composition
We de ne the modular composition of the compatible fkm’s K1 and K2 , denoted by K1 M K2 , to be the fkm KM : VM WM OM M M JM C M , where, WM = W1 W2 VM = V1 V2 = JM = J1 J2 1 2 M = s s : boolean (s = s1 s2 ) 1 2 M
OM = O1 O2 CM = C1 C2 (s1 s2 ) s1 ] 1 [s
2 [s
s2 ]
A step in the execution of KM is either a step of system K1 where s = s1 = 1 and s2 = 0, or a step of system K2 where s = s2 = 1 and s1 = 0, or an environment step where s = s1 = s2 = 0. A step of K1 (similarly K2 ) is overned by the s1 ], which is the assertion 1 in which all references transition relation 1 [s to s and s0 are replaced by references to s1 and s01 , respectively. For closed-system K1 and K2 which are composed in parallel, we can rst modularize each of the systems individually and then form their modular composition. Alternately, we can form rst the asynchronous parallel composition of the two systems and then modularize the combined system. It can be seen that both processes yield the same fkm, which is expressible by the equivalence (K1 K2 )M (K1 )M M (K2 )M 3.5
Sealin O
an Open System
Assume we have an fkm, consistin of a modular composition of several fkm’s: KM = K1
M
M
KK
System KM is still an open system, admittin arbitrary interference by the environment. Once we know that all the processes in the system have been included (possibly includin a process that represents the environment) and no further interaction with the external world is expected, way may seal o the system, formally excludin any further external communication. This is done by declarin all variables to be owned by the system, and eliminatin the schedulin variable s. J C be an fkm representin an open system. The Let KM : V W O result of sealin o KM is an fks KC : VC WC OC C C JC C C , where VC = V − s = C = [s true] C
WC = V JC = J
OC = O − s CC = C
60
Yonit Kesten and Amir Pnueli
Note that sealin o an fkm is the inverse operation to modularizin an fks, and therefore takin the asynchronous composition of two closed systems is equivalent to the fks obtained by sealin o the modular composition of their modular versions, as stated by the followin equivalences: ([K]M )C
4
K
([K1 ]M
M
[K2 ]M )C
K1 K2
Requirement Speci cation Lan ua e: Temporal Lo ic
As a requirement speci cation lan ua e for reactive systems we take temporal loic (tl) [MP91]. For simplicity, we consider only the future fra ment of tl. We assume an underlyin assertion lan ua e L which contains the predicate calculus and interpreted symbols for expressin the standard operations and relations over some concrete domains. A temporal formula is constructed out of state formulas (assertions) to which we apply the boolean operators and (the other boolean operators can be de ned from these), and the basic temporal operators 2 (next) and U (until). A model for a temporal formula p is an in nite sequence of states : s0 s1 where each state sj provides an interpretation for the variables mentioned in p. Given a model , we present an inductive de nition for the notion of a temporal formula p holdin at a position j 0 in , denoted by ( j) = p. For a state formula p, ( j) = p sj = p That is, we evaluate p locally, usin the interpretation iven by sj . ( j) = p ( j) = p ( j) = p q ( j) = p or ( j) = q ( j + 1) = p ( j) = 2 p ( j) = p U q for some k j ( k) = q and for every i such that j i k ( i) = p Additional temporal operators can be de ned by 1 p = true U p (eventually) p (henceforth). and 0 p = 1 For a temporal formula p and a position j 0 such that ( j) = p, we say that j is a p-position (in ). If ( 0) = p, we say that p holds on , and denote it by = p. A formula p is called satis able if it holds on some model. A formula p is called valid, denoted by = p, if it holds on all models. Given an fks K and a temporal formula p, we say that p is K-valid, denoted by K = p, if p holds on all models which are computations of K. An al orithm for model checkin whether a temporal formula p is valid over a nite-state fks K is presented in [KPR98]. The paper presents a version of the al orithm usin explicit state enumeration methods as well as a symbolic version. Based on the ideas developed in [LPS81] and [CGH94], the approach calls for the construction of a tester for the ne ation of p. This is an fks K:p whose computations are all the sequences which satisfy the ne ated formula p. Then we form the synchronous parallel composition Kcomb = K K:p and check for feasibility. If Kcomb is found to be feasible, this implies that K has a computation which violates p and therefore p is not valid over K. If Kcomb is found to be infeasible, we can conclude that p is K-valid.
Modularization and Abstraction: The Keys to Practical Formal Veri cation
5
61
Control Abstraction
Let : s0 s1 be an in nite sequence of V -states, and let U V be a subset is a U -preservin of V . We say that the in nite state sequence : s0 s1 variant of if s and s a ree on the interpretation of the variables in U , for to be an observation of the fks every i = 0 1 . We de ne : s0 s 1 K= V W O J C if is a O-preservin variant of a computation of K. Let Obs(K) denote the set of all observations of system K. The fks KA = VA WA OA A A JA C A is de ned to be observation compatible with K = V W O J C if OA = O. The fks K is an abstraction Obs(KA ). of the observation compatible K, denoted by K KA , if Obs(K) We refer to K and KA as the concrete and abstract systems, respectively. It can be shown that all the fks operations de ned in Section 3 are monotonic with respect to the abstraction relation. In particular, if K KA then KA . Furthermore, if p is a temporal formula (K M K2 ) (KA M K2 ) and KM whose free variables belon to O = OA , then implies K = p. KA = p This indicates how we propose to use abstraction in order to simplify the verication task. Namely, iven a property p to be veri ed over a complex system K, we use abstraction in order to derive a simpler system KA and then verify that p is KA -valid. Note that the implication is still in one direction. Namely, validity over the abstract system implies concrete validity but not, necessarily vice versa. The most strikin applications of this strate y are when K is an in nite-state system, while its abstraction KA is nite-state and thus amenable to model checkin . In this section, we concentrate on cases in which the system is a parallel Pn , where each P is a nite-state system. The uncomposition P (n): P1 bounded number of states for system P (n) comes from the fact that we consider an in nite family of systems, and yet wish to verify uniformly (i.e., for every value of n) that the property p is valid. The method and one of the examples presented in this section are taken from [KM95]. The main di erences between the two presentations are that, while [KM95] considers processes communicatin by synchronous messa e passin we have reformulated the framework to communication by shared variables. D For simplicity, assume that the property p only refers to the observable variPn are identical (up to renamin ). The ables of P1 and that processes P2 strate y we propose can be summarized as follows: 1. Generate fkm K , representin the modular behavior of process P , for i = 1 k. 2. Derive a network invariant I, which is an fkm intended to form an abKn for any value of straction for the modular composition K2 M M n. 3. Con rm that I is indeed a network invariant, by model checkin that P2 I I. and that (I M I) 4. Model check K = p, where K is the closed system (P1 M I)C .
62
Yonit Kesten and Amir Pnueli
It can be proven that this strate y is sound [KM95]. Namely, if K = p then P (n) = p for every n > 0. Step 2 in this strate y is the only one requirin in enuity and which cannot be fully mechanized. However, while presentin the examples, we will provide some explanations for the choices we made. 5.1
Mutual Exclusion by Semaphores
As our rst runnin example, we use a pro ram that mana es mutual exclusion by semaphores. The pro ram consists of n processes. Each process P [i] cycles
y: natural where y = 0 n
P [i] i=1
loop forever do Ni : NonCritical Ti : request y Ci : Critical; release y
Fi . 1. Pro ram mux-sem. throu h three possible locations: N , T , and C . Location N represents the non-critical activity which the process can perform without coordination with the other processes. Location T , is the tryin location, at which a process decides it needs to access its critical location. At the tryin location, the process waits for the semaphore variable y to become 1. On enterin the critical section C , the process sets y to 0. Finally, C is the critical location which should be reachable only exclusively by one process at a time. On exit from the critical section, variable y is reset to 1. In Fi . 2, we present the fkm correspondin to one of the (identical) processes of pro ram mux-sem. In this dia rammatic representation, nodes correspond to sets of states. For example, the node labeled by (N 1) corresponds to the two states N y : 1 s : 1 and N y : 1 s : 0 . To simplify the presentation, we used a sin le node to represent these two states which only di er in the interpretation of s. All ed es connectin a node to itself have been eliminated. A solid ed e in the dia ram represents a step of the module itself, while a dotted ed e represents a step of the environment. Thus, while only the process can decide to move from control state N to control state C, only the environment can chan e y from 1 to 0 (and vice versa) while control is still at N . The fairness requirements associated with this fkm are the justice requirement C ensurin that the system will not stay forever at control location C, and the compassion requirement (T y = 1 C) uaranteein that if the process is waitin at T and y equals 1 in nitely many times, then control will eventually proceed to C. A rst abstraction we can apply to K1 is to observe that as far as the sequences of values of the observable variables are concerned, there is no need to distin uish between the control locations N and T . This leads to the fkm K2 presented in Fi . 3.
Modularization and Abstraction: The Keys to Practical Formal Veri cation
N 0
T 0
N 1
63
C 0
T 1
J: C C: (T y = 1 C)
C 1
Fi . 2. The fkm K1 correspondin to process P [1] of pro ram mux-sem.
N 0
C 0 J:
N 1
C
C 1
Fi . 3. The fkm K2 abstractin fkm K1 . Note that the compassion requirement has been eliminated. This implies that the system can tolerate a behavior in which it never sets y to 0 beyond a certain point. However, such a behavior was allowed also in fkm K1 by remainin forever at control location N beyond a certain point. A useful heuristic that often leads to the eneration of network invariants is and formin the sequence of fkm’s I 1 = K2 , I 2 = K2 M K2 , I 3 = I 2 M K2 comparin every successive I ’s, hopin that the sequence will conver e. Tryin this approach with the fkm K2 fails. Comparin I 2 : K2 M K2 with I 1 : K2 , we nd that I 2 can enerate the observation (displayin the values of y and s) 1 1
0 1
1 0
0 1
0 1 in this behavior correwhich cannot be enerated by K1 . A step 1 − sponds to the module settin y to 0, which corresponds to an entry to the critical section. A step 0 − 1 0 corresponds to a step in which the environment chan es y from 0 to 1. Thus, this behavior displays a situation in which I 2 enters twice the critical section before exitin even once, provided the environment raises the value of y, while one of the components of I 2 was still in the critical section. In a similar way, we nd that I 3 can enter its critical sections three times in succession, if the environment cooperates, which cannot be done by I 2 . will never conver e. This shows that the sequence I 1 I 2 Lookin closer at this example, we realize that the factor that di erentiates between I 1 and I 2 and between I 2 and I 3 is their response to a behavior of the environment which will never be realized in the closed system, namely raisin
64
Yonit Kesten and Amir Pnueli
the semaphore variable to 1 while one of the processes is in its critical section. This leads us to the next abstraction K3 , presented in Fi . 4.
N 0
C 0 y := 1
N 1
J:
C
Chaos
Fi . 4. The fkm I = K3 with chaos. The system K3 behaves as K2 as lon as the environment behaves properly. However, once it detects that the environment raised the value of y from 0 to 1 while the system was in the critical section, it oes into a chaos control state in which anythin oes . That is, all arbitrary sequences of values for the observable variables will be accepted from this point on. It is obvious that K3 is an abstraction of K2 because it di ers from K2 in all the additional behaviors it is ready to enerate once it reached the chaos state. It is not di cult to verify that I = K3 is a network invariant. We model checked that K2 K3 and that (K3 M K3 ) K3 . It only remains to perform step 4 in the abstraction strate y presented in the be innin of the section. We form the closed-system fks K = (K1 M I)M and use model checkin to verify the liveness property K = 0 (N1 1 C1 ). This has been done and established that process P [1] of pro ram mux-sem has the property of accessibility for any number of processes. 5.2
The Dinin Philosophers Problem
As a more advanced example, we applied the technique described above to the problem of the dinin philosophers. As ori inally described by Dijkstra, n philosophers are seated at a round table. Each philosopher alternates between a thinkin phase and a phase in which he becomes hun ry and wishes to eat. There are n chop-sticks placed around the table, one chop-stick between every two philosophers. in order to eat, each philosopher needs to acquire the chopsticks on both sides. A chop-stick can be possessed by only one philosopher at a time. An solution to the dinin philosophers problem, usin semaphores, is presented by pro ram d ne-contr of Fi . 5. In this pro ram, philosophers P [2] P [n] reach rst for the fork on their left (represented by semaphore variable c[j] for philosopher j), and then for their ri ht fork (semaphore c[j n 1]). Philosopher P [1] behaves di erently, reachin rst for his ri ht fork (c[2]) and only later for his left fork (c[1]). We wish to prove the liveness property of accessibility for each of the philosophers.
Modularization and Abstraction: The Keys to Practical Formal Veri cation
65
in n : inte er where n 2 local c : array [1 n] where c = 1 0 n
P [j] :: j=2
: loop forever do 1 : NonCritical 2 : request c[j] 3 : request c[j n 1] 4 : Critical 5 : release c[j] 6 : release c[j n 1]
0
P [1] ::
: loop forever do 1 : NonCritical 2 : request c[2] 3 : request c[1] 4 : Critical 5 : release c[2] 6 : release c[1]
Fi . 5. Pro ram d ne-contr: solution with one contrary philosopher. Proceedin throu h a sequence of abstraction steps similar to the previous example, we nally wind up with the fkm I contr presented in Fi . 6.
Chaos L := 1 N
C
L
R := 1 L
Cr
R
N L
Nr
R
Nr R J:
Nr
C:
(R N )
Fi . 6. The fkm I contr , the network invariant for pro ram d ne-contr. The dia ram of Fi . 6 consists of two components that operate in parallel, one takin care of the left semaphore L and the other handlin the ri ht semaphore R. Whenever an environment fault is detected, i.e. the environment raises a semaphore that has been lowered by the system, both components escape to the chaos state after which all behaviors are possible. It is strai htforward to verify (usin model checkin ) that I contr abstracts any of the processes P [2] P [n] I contr . It follows that I contr is a network and that (I contr M I contr ) invariant for any sequence of re ular philosophers. We can combine I contr with P [1] to establish the accessibility properties of the contrary philosopher P [1]. We can also verify the accessibility property for all ordinary philosophers.
66
6
Yonit Kesten and Amir Pnueli
Data Abstraction
In this section, we present a eneral methodolo y for data abstraction, stron ly inspired by the notion of abstract interpretation [CC77]. Consider an fks K = V W O J C , and let denote the set of states of K, the concrete state. be a mappin of concrete states into abstract states. The Let : A strate y of veri cation by data abstraction can be summarized as follows: Strate y 1 (Veri cation by Data Abstraction) De ne an abstraction mappin abstract fks KA . Abstract the temporal property . Verify KA = Infer K = .
to abstract the concrete fks K into an .
into an abstract property
The main question is how to de ne the abstractions KA and implies K = .
such that KA =
Example 1. Consider pro ram any-y of Fi . 7, for which we wish to establish the invariance property : 0 (y 0).
x y: inte er where x = y = 0 0
: while x = 0 do
P1 ::
1 2
:
: y := y + 1
P2 ::
m0 : x := 1 m1 :
Fi . 7. Pro ram any-y: A simple concurrent pro ram. Pro ram any-y is an in nite-state system since the inte er variable y can assume arbitrarily hi h values. To reduce the complexity of this system, we may consider an abstract variable Y , ran in over the nite (abstract) domain ne zero pos . The abstraction function maps the domain of y into the domain of Y as follows: (y):
if y
0 then neg else-if y = 0 then zero else pos
With this mappin , we can obtain the abstract version of any-y, called any-y , and presented in Fi . 8. A correspondin -abstraction of the property to be veri ed is iven by : 0 (Y zero pos ). Since pro ram any-y is a nite-state pro ram, we can . Followin the veri cationuse model checkin in order to verify any-y = by-data-abstraction strate y, we can infer any-y = 0 (y 0).
Modularization and Abstraction: The Keys to Practical Formal Veri cation
67
x: inte er where x = 0 Y : ne zero pos where Y = zero 0
P1 :: 2
: while x = 0 do if Y = ne then ne zero 1 : Y := else pos :
P2 ::
m0 : x := 1 m1 :
Fi . 8. Pro ram any-y : Abstracted version of any-y. 6.1
Safe Abstraction of Temporal Formulas and Systems
To provide a syntactic representation of the abstraction mappin , we assume a set of abstract variables VA and a set of expressions E , such that the equal. Thus, for ity VA = E (V ) syntactically represents the semantic mappin Example 1, the expressions E 1 , E 2 , E x , and E Y are iven by 1 , 2 , x, and if y 0 then neg else-if y = 0 then zero else pos, respectively. Let p be an assertion (state formula). We de ne two abstraction operators over p. M8 (p):
V (VA = E (V )
p(V ))
and M9 (p):
V (VA = E (V )
p(V ))
i the assertion p holds The assertion M8 (p) holds for an abstract state S A −1 (S), i.e., all states s such that for all concrete states s such that s p S = (s). This can also be expressed by the inclusion −1 ( M8 (p) ) where p and M8 (p) represent the sets of states which satisfy the assertions, respectively. i the assertion p The assertion M9 (p) holds for an abstract state S A −1 (S), i.e., some state s such holds for some concrete state s such that s −1 ( M9 (p) ) that S = (s). This can also be expressed by the inclusion p We respectively refer to M8 (p) and M9 (p) as the universal and existential abstraction of the formula p. An assertion p which is a sub-formula of the temporal formula is called a maximal state sub-formula of if p is not properly contained in any other state sub-formula of . Sub-formula p is said to have a positive polarity in if it is contained under an even number of ne ations. Otherwise, p is said to have a ne ative polarity. , the -induced abstraction of the temporal formula to be a We de ne formula obtained by replacin every p a maximal state sub-formula of positive polarity by M8 (p) and every q a maximal state sub-formula of ne ative polarity by M9 (p) 2) Example 2. Consider, for example, the temporal formula : ( 0 (y 0 (y −1)). Applyin the abstraction presented in Example 1 yields the formula
68
Yonit Kesten and Amir Pnueli
= ( 0 (M9 (y
2)) 0 (M (y −1))) = 8 0 (Y zero pos )) ( 0 (Y = pos)
is valid, we can safely conclude that so is
Since
.
Next, we consider the abstraction of an fks K into K such that K = implies K = . J C We de ne the -abstracted version of K to be the fks K = VA where J
= M9 ( ) = M9 (J) J
= M9 ( ) C = (M8 (p) M9 (q)) (p q)
J
,
C
Example 3. Let us show how the de nition of K leads to the construction of pro ram any-y , the abstracted version of pro ram any-y, as presented in Example 1. The initial condition refers to y only throu h the conjunct y = 0. The correspondin abstraction is iven by M9 (y = 0) = y (Y = if y
0 then neg else-if y = 0 then zero else pos) (y = 0) (Y = zero)
The transition relation refers to y only throu h the part of a disjunct iven by y 0 = y + 1. The correspondin abstraction is M9 (y 0 = y + 1) = Y = if y Y 0 = if y 0 y y0 y0 = y + 1
0 then neg else-if y = 0 then zero else pos 0 then neg else-if y 0 = 0 then zero else pos
Y 0 = (if Y = neg then neg zero else pos ) and , we obtain Reconstructin a pro ram from the abstracted components pro ram any-y presented in Fi . 8. The followin claim uarantees the safety of the abstractions jointly applied to the system and the property we wish to verify. Claim. If the abstracted formula M8 ( ) is valid over the abstracted fks K , then is valid over K. That is, K = M8 ( ) 6.2
implies
K = .
Determination of the Abstract Domain
The theory presented above assumed that the abstract domain, represented by are the abstract variables VA and their types, and the abstraction mappin already iven. In this subsection, we consider some recommendations for the choice of an appropriate mappin , iven an fks K and a temporal property .
Modularization and Abstraction: The Keys to Practical Formal Veri cation
69
local y1 y2 : natural where y1 = y2 = 0 0
: loop forever do 1 : NonCritical 2 : y1 := y2 + 1 y1 3 : await y2 = 0 4 : Critical 5 : y1 := 0
y2
m0 : loop forever do m1 : NonCritical m2 : y2 := y1 + 1 m3 : await y1 = 0 m4 : Critical m5 : y2 := 0
− P1 −
y2
y1
− P2 −
Fi . 9. Pro ram bakery-2: the Bakery al orithm for two processes. pk Assumin that the fks K is derived from a pro ram P , let p1 p2 be the set of all atomic formulas referrin to the data (non-control) variables appearin within conditions in the pro ram P and within the temporal formula . As a runnin example, we use pro ram bakery-2, presented in Fi . 9. Pro ram bakery-2 is obviously an in nite-state system, since the variables y1 and y2 can assume arbitrarily lar e values. The temporal properties we wish to establish for pro ram bakery-2 are iven by exc
:
0
(at−
4
at− m4 )
cc
:
0
(at−
2
1
at− 4 )
The property exc requires mutual exclusion, while cc requires accessibility for process P1 . For pro ram bakery-2, the atomic data formulas are y1 = 0, y2 = 0, and y1 y2 . Note that the formula y2 y1 is equivalent to the ne ation of y1 y2 and needs not be included as an independent atomic formula. Proceedin with the eneral case, the abstract system variables consist of the concrete control variables, which are left unchan ed, and a set of abstract boolean Bpk , one for each atomic data formula. The abstraction variables Bp1 Bp2 mappin is de ned by :
Bp1 = p1 Bp2 = p2
Bpk = pk
That is, the boolean variable Bpi has the value true in the abstract state i the assertion p holds at the correspondin concrete state. It is strai htforward to compute the -induced abstractions of the initial and the transition relation . In Fi . 10, we present pro ram condition Bakery-2(with a capital B), which is obtained by the abstraction as described in the precedin subsections. Since the properties we wish to verify refer only to the control variables (throu h the at− and at− m expressions), they are not a ected by the abstraction. Pro ram Bakery-2 is a nite-state pro ram, and we can apply model checkin to verify that it satis es the two properties of mutual exclusion and accessibility. By Claim 6.1, we can infer that the ori inal pro ram bakery-2 also satis es these two temporal properties.
70
Yonit Kesten and Amir Pnueli local By1 =0 By2 =0 By1 0
y2
: loop forever do 1 : NonCritical 2 : (By1 =0 By1 y2 ) := (0 By1 3 : await By2 =0 4 : Critical 5 : By1 =0 := 1 − P1 −
: boolean where By1 =0 = By2 =0 = 1 By1
By2 =0 ) y2
y2
=0
m0 : loop forever do m1 : NonCritical m2 : (By2 =0 By1 y2 ) := (0 0) m3 : await By1 =0 By1 y2 m4 : Critical m5 : By2 =0 := 1 − P2 −
Fi . 10. Pro ram Bakery-2: the Bakery al orithm for two processes.
References [BBLS92] [BBM95]
[BCG86] [CC77]
[CGH94] [CGJ95] [CGL94] [CGL96]
[CH78] [DGG97] [EN95] [EN96] [GL93] [HLR92]
[ID96]
S. Bensalem, A. Bouajjani, C. Loiseaux, and J. Sifakis. Properties preservin simulations. CAV’92, vol. 663 of LNCS, pp 251 263, 1992. N. Bj rner, I.A. Browne, and Z. Manna. Automatic eneration of invariants and intermediate assertions. 1st Intl. Conf. on Principles and Practice of Constraint Pro rammin , vol. 976 of LNCS, pp 589 623, 1995. M.C. Browne, E.M. Clarke, and O. Grumber . Reasonin about networks with many nite state processes. PODC’86, pp 240 248, 1986. P. Cousot and R. Cousot. Abstract interpretation: A uni ed lattice model for static analysis of pro rams by construction or approximation of xpoints. POPL’77, 1977. E.M. Clarke, O. Grumber , and K. Hama uchi. Another look at ltl model checkin . CAV’94, vol. 818 of LNCS, pp 415 427, 1994. E.M. Clarke, O. Grumber , and S. Jha. Verifyin parametrized networks usin abstraction and re ular lan ua es. CONCUR’95, pp 395 407, 1995. E.M. Clarke, O. Grumber , and D.E. Lon . Model checkin and abstraction. ACM Trans. Pro . Lan . Sys., 16(5):1512 1542, 1994. E.M. Clarke, O. Grumber , and D.E. Lon . Model checkin . Model Checkin , Abstraction and Composition, vol. 152 of Nato ASI Series F, pa es 477 498. Sprin er-Verla , 1996. P. Cousot and N. Halbwachs. Automatic discovery of linear restraints amon variables of a pro ram. POPL’78, pp 84 96, 1978. D. Dams, R. Gerth, and O. Grumber . Abstract interpretation of reactive systems. ACM Trans. Pro . Lan . Sys., 19(2), 1997. E. A. Emerson and K. S. Namjoshi. Reasonin about rin s. POPL’95, 1995. E.A. Emerson and K.S. Namjoshi. Automatic veri cation of parameterized synchronous systems. CAV’96, LNCS, 1996. S. Graf and C. Loiseaux. A tool for symbolic pro ram veri cation and abstraction. CAV’93, vol. 697 of LNCS, pp 71 84, 1993. N. Halbwachs, F. La nier, and C. Ratel. An experience in provin re ular networks of processes by modular model checkin . Acta Informatica, 29(6/7):523 543, 1992. C.N. Ip and D. Dill. Verifyin systems with replicated components in Mur . CAV’96, LNCS, 1996.
Modularization and Abstraction: The Keys to Practical Formal Veri cation [KM95]
71
R.P. Kurshan and K.L. McMillan. A structural induction theorem for processes. Information and Computation, 117:1 11, 1995. [KPR98] Y. Kesten, A. Pnueli, and L. Raviv. Al orithmic veri cation of linear temporal lo ic speci cations. ICALP’98, LNCS, 1998. [Lam77] L. Lamport. Provin the correctness of multiprocess pro rams. IEEE Trans. Software En in., 3:125 143, 1977. [LHR97] D. Lesens, N. Halbwachs, and P. Raymond. Automatic veri cation of parameterized linear networks of processes. POPL’97, 1997. [LPS81] D. Lehmann, A. Pnueli, and J. Stavi. Impartiality, justice and fairness: The ethics of concurrent termination. ICALP’81, vol. 115 of LNCS, pp 264 277, 1981. [MAB+ 94] Z. Manna, A. Anuchitanukul, N. Bj rner, A. Browne, E. Chan , M. Colon, L. De Alfaro, H. Devarajan, H. Sipma, and T.E. Uribe. STeP: The Stanford Temporal Prover. Technical Report STAN-CS-TR-94-1518, Dept. of Comp. Sci., Stanford University, Stanford, California, 1994. [MP91] Z. Manna and A. Pnueli. The Temporal Lo ic of Reactive and Concurrent Systems: Speci cation. Sprin er-Verla , New York, 1991. [MP95] Z. Manna and A. Pnueli. Temporal Veri cation of Reactive Systems: Safety. Sprin er-Verla , New York, 1995. [SG89] Z. Shtadler and O. Grumber . Network rammars, communication behaviors and automatic veri cation. CAV’89, vol. 407 of LNCS, pp 151 165, 1989. [SG92] A.P. Sistla and S.M. German. Reasonin about systems with many processes. J. ACM, 39:675 735, 1992. [WL89] P. Wolper and V. Lovinfosse. Verifyin properties of lar e sets of processes with network invariants. CAV’89, vol. 407 of LNCS, pp 68 80, 1989.
On the Role of Time and Space in Neural Computation Wolfgang Maass Institute for Theoretical Computer Science Technische Universit¨ at Graz Klosterwies asse 32/2 A-8010 Graz, Austria maass@i i.tu- raz.ac.at
Abs rac . We discuss structural di erences between models for computation in biolo ical neural systems and computational models in theoretical computer science.
1
Introduction
One of he mos in eres ing scien i c developmen s during he nex wo decades will be he unraveling of he s ruc ure of compu a ion in living organisms. Since he informa ion processing capabili ies of living organisms are in many aspec s superior o hose of our curren ar i cial compu ing machinery, his is likely o have signi can consequences for he way in which compu ers and robo s will be designed in he year 2020. Tradi ionally heore ical compu er science has played he role of a scou ha explores novel approaches owards compu ing well in advance of o her sciences. Curiously enough, his did no happen so far in he case of compu a ion in living organisms, and i may be wor hwhile o ponder for a momen abou he possible reasons for ha . One obs acle may resul from he fac ha heore ical compu er science has become o a large ex en echnique-driven , i.e., one ypically looks for new problems ha can be solved by varia ions and ex ensions of a body of fascina ing ma hema ical ools ha one has come o like, and ha form he hear of curren heore ical compu er science. In con ras , o have a serious impac on heore ical research in neural compu a ion, a heore ical researcher has o be o a larger ex en problem-driven , i.e., he/she has o employ and develop hose ma hema ical concep s and ools ha are mos adequa e for he problem a hand. On he posi ive side, I would like o men ion a success s ory regarding an earlier very frui ful in erac ion be ween he areas which are nowadays called compua ional neuroscience and heore ical compu er science. McCulloch and Pi s [McCulloch and Pi s, 1943] developed an abs rac ma hema ical model for compu a ion in living organisms: circui s of McCulloch-Pitts neurons or threshold ates, as hey are now called in heore ical compu er science. Kleene [Kleene, 1956] proved ha hey were equivalen o his no ion of a nite automaton. Thus his orically ni e au oma a were rs used o model neuron ne s Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 72 83, 1998. c Sprin er-Verla Berlin Heidelber 1998
On the Role of Time and Space in Neural Computation
73
[Hopcrof and Ullman, 1979]. As we can all see, bo h models urned ou o be a very frui ful for he subsequen developmen of bo h elds involved. Wi hin he scien i c discipline of neuroscience a new sub eld has emerged during he 90’s ha is called computational neuroscience. However a look a any recen issue of leading journals (e.g. Neural Compu a ion, Ne work: Compu a ion in Neural Sys ems, Compu a ional Neuroscience) or conference proceedings in his new area (e.g. of he Annual Conference on Compu a ional Neuroscience) may have a sobering e ec on a heore ical compu er scien is who is ready o develop adequa e compu a ional heories for compu a ional neuroscience: There exis s a large amoun of in erdisciplinary work in compu a ional neuroscience and a fair number of heore ical work has already been done in his area. Bu so far he heore ical work in compu a ional neuroscience has been domina ed by approaches from heore ical physics, informa ion heory, and s a is ics.1 One of he main obs acles for a heore ical compu er scien is who is ready o ackle heore ical problems abou compu ing in biological neural sys ems is he diversi y of models for neural compu a ion ha are proposed by neuroscienis s, and he diversi y of opinions among leading neuroscien is s regarding he righ way o unders and compu a ions in he brain. This has he e ec ha i is hardly possible o iden ify abs rac models and heore ical problems in compua ional neuroscien is s ha are of undispu ed signi cance. In fac , i is hard o iden ify solid empirical fac s regarding compu a ion in biological neural sys ems on which mos researchers and labora ories agree.2 This concerns especially he rs ques ions ha a heore ical compu er scien is is likely o ask: How is informa ion encoded in biological neural sys ems? Wha are he compu a ional uni s of biological neural sys ems, and wha func ions can hey compu e? How are biological compu a ions organized and programmed? Which maps from inpu s o ou pu s are compu ed by speci c neural sys ems? We will focus in his shor ar icle on one issue on which mos neuroscien is s seem o be able o agree, and which may poin o a frui ful area for fu ure con ribu ions from heore ical compu er science o his eld: ha ime and space appear o play a di eren role for compu a ions in biological neural sys ems han for compu a ions in curren ly exis ing compu a ional models in heore ical compu er science. This may provide some food for hough for he developmen of new models ha are bo h of in eres from he poin of view of heore ical 1
2
For a theoretical computer scientist from Europe a survey of the current state of computational neuroscience may have an additional soberin e ect: most leadin journals and conferences are based in the USA. This is a consequence of the fact that most of the basic questions about computations in livin or anisms cannot be answered directly throu h suitable experiments. Hence the available answers are typically based on indirect empirical evidence, that often varies with details of the experimental setup, the speci c neural system and species that is studied, and the methods for data-analysis that are employed. Bad ton ues say that the answers also depend on the theoretical hypothesis that the researcher wants to support throu h the experiment.
74
Wolf an Maass
compu er science, and which also provide frui ful new hypo heses regarding he organiza ion of compu a ions in living organisms. In he remainder of his ar icle I will illus ra e in a few examples speci c direc ions in o which curren ly exis ing compu a ional models from heore ical compu er science need o be evolved in order o ake in o accoun he di eren role ha ime and space play in biological neural sys ems. In view of he space cons rain s for his ar icle we canno give here a survey of relevan resul s and heories. Bu we will give in he las sec ion some poin ers o up- o-da e survey ar icles and books.
2
On the Role of Time in Neural Computation
The mos biology-like compu a ional model ha we radi ionally consider in heore ical compu er science are circui s consis ing of hreshold ga es or sigmoidal ga es. These ga es compu e func ions from Rn in o R of he form n
x1
xn
wi xi + w0 )
(
(1)
i=1
for some xed ac iva ion func ion : R R (e.g., (y) = sign (y) in he case of a hreshold ga e, or (y) = 1 (1 + e−y ) in he case of a sigmoidal ga e) wn R. A compu a ion in such circui is deand sui able parame ers w0 ned wi h he help of some inpu -dependen schedule, which decides which ga es carry ou heir compu a ional opera ion (1) a which discre e ime s ep. This compu a ion schedule is par icularly obvious in he case of a layered feedforward circui , where all ga es on level carry ou heir compu a ional opera ion a ime s ep . In con ras , he output of a biological neuron consis s of ac ion po en ials or spikes (see Fig. 1). In o her words: a biolo ical neuron does no ou pu any number or bi , ins ead i simply marks points in time. The input o a biological
Fig. 1. a) Typical ac ion po en ial (spike). b) A ypical spike rain produced by a neuron (each ring ime marked by a bar) neuron v consis s of rains of pulses, socalled exci a ory pos synap ic po en ials (EPSP’s) or inhibi ory pos synap ic po en ials (IPSP’s) of a shape as indica ed
On the Role of Time and Space in Neural Computation
a)
75
EPSP
ε vu(s) s
b)
s ε vu(s) IPSP
Fig. 2. a) Typical ime course of an exci a ory pos synap ic po en ial (EPSP). b) Typical ime course of an inhibi ory pos synap ic po en ial (IPSP). The ver ical axis indica es he membrane vol age of he neuron v in Fig. 2. More precisely: Abou 1000 o 10000 o her neurons u are each connec ed o v by a synapse. The synapse from neuron u o neuron v ransforms he ou pu spike rain of neuron u (which is of a ype as illus ra ed in Fig. 1 b)) in o a rain of EPSP’s or IPSP’s in neuron v. One usually assumes ha neuron u only causes EPSP’s or only causes IPSP’s in o her neurons v. According o he spike response model (see [Gers ner and van Hemmen, 1994] and [Gers ner, 1998] one can model he response of he membrane po en ial of neuron v a ime t o a spike rain wi h from a presynap ic neuron u by a func ion of he form spikes a imes t1 t2 wvu (t)
responsevu (t) :=
vu (t
− ti )
i
One assumes in his model ha neuron v res and hereby emi s a spike a ime t whenever he resul ing o al membrane po en ial hv (t) :=
responsevu (t) u has a synapse o v
a neuron v reaches he rin threshold v (t) of neuron v. One refers o his model as a leaky inte rate-and- re neuron or spikin neuron. Le us rs assume for simplici y ha he synap ic weigh s wvu (t) and he ring hreshold v (t) do no depend on he ime t. Then he spiking neuron v can in principle simula e a hreshold ga e, provided ha all presynap ic neurons u ha represen an inpu variable wi h value 1 re a a common ime Tinput , and all presynap ic neurons u ha represen an inpu variable wi h value 0 do no re a all during a cer ain ime in erval; see Fig. 3. To be precise, one also has o make an assump ion abou he shapes of he response func ions, for example ha
76
Wolf an Maass
. wv1
.
wv2
.
wv3
. Tinput
time
neuron v time
wv4 wv5
.
P
neuron v res if
rin times of presynaptic neurons u
res at time Tinput
wvu
vu
Fig. 3. Simula ion of a hreshold ga e by a spiking neuron. he response func ions vu (s) for di eren u are iden ical excep for heir sign. On he o her hand empirical da a show ha an inpu of he ype indica ed in Fig. 4 is more ypical. In order o illus ra e ha in such asynchronous mode a spiking
. .
wv1 wv2
. wv . .
3
neuron v
? time
wv4 wv5
firing times of presynaptic neurons u
Fig. 4. Typical inpu for a biological spiking neuron v, where i s ou pu canno be easily described in erms of conven ional compu a ional uni s.
neuron can carry ou compu a ional opera ions ha are no a all reflec ed in he model of a hreshold ga e or sigmoidal ga e (1), we consider for some arbi rary 0 1 : xed parame ers 0 c1 c2 he following func ion EDn : Rn EDn (x1
xn ) =
1 if here are j = j 0 so ha 0 if xj − xj 0
xj − xj 0
c2 for all j = j
0
c1
On the Role of Time and Space in Neural Computation
77
No e ha his func ion EDn (x1 xn ) (where ED s ands for elemen dis inc ness ) is in fac a par ial func ion, which may ou pu arbi rary values in c2 . Therefore hair- rigger case ha c1 min xj − xj 0 : j = j 0 and j j 0 γi si ua ions can be avoided, and a single spiking neuron can compu e his func ion EDn even if here is a small amoun of noise on i s membrane po en ial hv (t). xn o he spiking neuron v are given We assume here ha he inpu s x1 xn of n presynap ic neurons. On he o her hand hrough he ring imes x1
∆
∆
∆
∆
∆
∆
∆
∆
Fig. 5. a) Typical ime course of he membrane po en ial hv (t) if ED4 (x1 x2 x3 x4 ) = 0. b) Time course of hv (t) in he case where c1 . ED4 (x1 x2 x3 x4 ) = 1 because x3 − x2 he following resul s show ha he same par ial func ion EDn requires a subs an ial number of ga es if compu ed by circui s consis ing of McCulloch-Pi s neurons ( hreshold ga es) or sigmoidal ga es. Theorem 1. Any layered threshold circuit that computes EDn needs to have at least log(n!) n2 log n threshold ates on its rst layer. The proof of Theorem 1 relies on a geome rical argumen , see [Maass, 1997].
78
Wolf an Maass
Theorem 2. Any feedforward circuit consistin of arbitrary si moidal ates in order to compute EDn . needs to have at least n−4 2
ates
The proof of Theorem 2 is more di cul , since sigmoidal ga es ou pu analo numbers ra her han bits. Therefore a mul ilayer circui consis ing of sigmoidal ga es can have larger compu a ional power han a circui consis ing of hreshold ga es (see [Maass e al., 1991,DasGup a and Schni ger, 1996]). The proof procedes in an indirec fashion by showing ha any sigmoidal neural ne wi h m ga es ha compu es EDn can be ransformed in o ano her sigmoidal neural ne ha sha ers every se of n − 1 di eren inpu s wi h he help of m + 1 programmable parame ers. According o [Son ag, 1997] his implies ha n − 1 2(m + 1) + 1. We refer o [Maass, 1997] for fur her de ails. Remark 1. This is he larges lower bound for any concre e func ion in P ha has been achieved o da e for he size of circui s consis ing of sigmoidal ga es. So far we have assumed ha he ring hreshold v (t) and he synap ic weigh s wvu (t) are independen of he ime t. This is cer ainly no he case for a biological neuron. In a rs approxima ion one may assume ha v (t) shoo s up o an ex remely high value for a few ms af er each ring of v and hen re urns o a res ing value . This hreshold dynamics enforces an upper bound on he maximal ring ra e of a neuron, which usually is in he range of a few hundred Hz (al hough typical ring ra es in he cor ex are well below 100 Hz). The dependence of synap ic weigh s wvu (t) on he ime t is subs an ially more complex. I has been shown ha di eren synapses exhibi qui e he erogeneous dependencies on he preceding ring imes of he presynap ic neurons [Dobrunz and S evens, 1997]. Therefore one has o view synapses as ano her ype of active computational units in neural compu a ion. They canno really be viewed as passive regis ers ha s ore a single parame er he synap ic ha remains xed during a compu a ion. Tradi ionally one views weigh wvu he synap ic weigh s wvu as parame ers ha collec ively con ain he program of a compu a ion in a neural circui . Hence he fac ha in biological neurons he values wvu (t) of hese parame ers are highly dynamic has dras ic consequences: I is no larger clear which parame ers store he program of a neural compu a ion. Obviously ha makes i even less clear how learnin al orithms (i.e., algori hms ha adjus he parame ers ha s ore he program of a neural compu a ion) opera e in biological neural sys ems. These issues lead us o ano her signi can s ruc ural di erence be ween compu a ions in biological neural sys ems and hose compu a ions ha are usually s udied in heore ical compu er science. The inpu s and ou pu s of compu a ions in biological neural sys ems are ypically vec ors of time-series, ra her han vecors of numbers. The processing of he t- h inpu x(t) may depend on he prex(t − 1). In ha respec biological neural compu a ion ceding inpu s x(1) corresponds o compu a ions carried ou by ni e s a e ransducers (Mealy- or Moore-machines) or lters (as considered in signal processing and sys ems heory), ra her han o compu a ion carried ou by feedforward circui s or Turing
On the Role of Time and Space in Neural Computation
79
machines. For analyzing he compu a ional power of neural circui s for compua ions on ime series i is essen ial for he model ha in reali y he hresholds v (t) and weigh s wvu (t) are func ions of ime ha may depend on he preceding his ory of he compu a ion. The following example [Maass and Zador, 1998b] illus ra es ha even on he abs rac level of hreshold circui s one can observe an increase in compu a ional power resul ing from his ory-dependen weigh s in connec ion wi h a sequen ial inpu presen a ion Consider a hreshold ga e wi h n inpu s, ha receives an inpu xy of 2n bi s in wo subsequen ba ches x and y of n bi s each. We assume ha he n weigh s wn of his ga e are ini ially se o 1, and ha he hreshold of he ga e w1 is se o 1. We adop he following very simple rule for changing hese weigh s be ween he presen a ions of he wo par s x and y of he inpu : he value of wi is changed o 0 during he presen a ion of he second par y of he inpu if he i- h componen xi of he rs inpu par x was non-zero. If we consider he ou pu bi of his hreshold ga e af er he presen a ion of he second par y of he inpu as he ou pu of he whole compu a ion, his hreshold ga e wi h dynamic 0 1 de ned by synapses compu es he boolean func ion Fn : 0 1 2n i 1 n (yi = 1 and xi = 0). One migh associa e his Fn (x y) = 1 func ion Fn wi h some novel y de ec ion ask since i de ec s whe her an inpu bi has changed from 0 o 1 in he wo inpu ba ches x and y. I urns ou ha his func ion canno be compu ed by a small circui consis ing of hreshold ga es of he usual ype, ha receives all 2n inpu bi s xy as one ba ch. In fac , one can prove ha any feedforward circui consis ing of he usual ype of s a ic hreshold ga es, which may have arbi rary weigh s, n ga es in order hresholds and connec ivi y, needs o consis of a leas lo (n+1) o compu e Fn . This lower bound can easily be derived from he lower bound from [Maass, 1997] for ano her boolean func ion CDn (x y) from 0 1 2n in o 1 n , 0 1 which gives ou pu 1 if and only if xi + yi 2 for some i since CDn (x y) = Fn (1 − x y). The ar icle [Maass and Zador, 1998a] surveys empirical da a on he emporal dynamics of synapses and heore ical inves iga ions of heir possible compu aional role. One fundamen al open problem for he heory of neural compu a ion is he ques ion how informa ion is encoded in spike rains. There appears o be no unique answer. Ra her, he neural code seems o vary from sys em o sys em, and even he same neural sys em may apply di eren neural codes for di eren compu a ional asks (see [Rieke e al., 1997] and [Recce, 1998]). I is shown in Fig. 6 ha ypical in erspike in ervals are rela ively long in comparison wi h he o al compu a ion ime of some neural sys ems. Fur hermore in erspike in ervals end o be highly irregular. Hence i is ra her di cul for a biological neuron o nd ou wi hin he given compu a ion ime he curren ring ra es of presynap ic neurons (especially in view of he rela ively shor ime dura ion of mos EPSP’s). Therefore he popular assump ion ha informa ion is primarily communica ed be ween neurons hrough heir ring ra es is somewha dubious.
80
Wolf an Maass
Fig. 6. Simul aneous recordings (over 4 seconds) of he ring imes of 30 neurons from monkey s ria e cor ex by Kr¨ uger and Aiple [Kr¨ uger and Aiple, 1988]. Each ring is deno ed by a ver ical bar, wi h a separa e row for each neuron. For comparison we have shaded an in erval of 150 msec. This ime span is known o su ce for he comple ion of some complex mul ilayer cor ical compu a ions.
One comple ely di eren neural code ha has been sugges ed as being relevan is he socalled correlation code (see [Recce, 1998] and [Maass, 1998b] for references). This code appears o be of par icular in eres from he poin of view of computer science lo ic, since i hypo hesizes ha informa ion is no ransmi ed be ween neurons in he form of numbers, bu in he form of second order objects: (graded) relations or sets: Neurons whose ring ime is s a is ically correla ed during a neural compu a ion communica e o o her neurons he fac ha hey curren ly belong o he same se . A neuron can de ec whe her a cri ical number of presynap ic neurons belong o he same set because i can de ec coinciden ring imes (as in our preceding discussion of he func ion EDn , bu
On the Role of Time and Space in Neural Computation
now possibly wi h a higher ring hreshold ha requires coinciden of more han wo presynap ic neurons).
81
ring imes
On the Role of Space in Neural Computation In he preceding sec ion we had discussed examples for he di eren role ha time plays in biological neural compu a ion. In his sec ion we will briefly discuss he role of ano her resource for neural compu a ion: space, or more precisely he geome rical layou of neural circui s. The number of neurons o which a biological neuron has synap ic connec ions is by several orders of magni ude smaller han he number of neurons ha par icipa e in a ypical compu a ion. Hence edges or wires are a sparse resource in biological neural compu a ion. This is no reflec ed in curren ly exis ing inves iga ions of compu a ional complexi y issues for hreshold circui s in heore ical compu er science. There one ypically wan s o minimize he number of layers and he number of ga es, wi h no charge for wires be ween adjacen layers. In addi ion in biological neural sys ems a large number of synapses connec neurons ha are loca ed qui e close o each o her. Obviously such archi ec ure ends o keep total wire len th small. This resource has also no ye been inves iga ed in he con ex of hreshold circui s in heore ical compu er science. I s inves iga ion appears o be of in eres also from he poin of view of rela ed elec ronic hardware (for example cellular neural ne works, see [Roska, 1997]). We refer o [Maass, 1998a] for some resul s in his direc ion. [Valian , 1994] addresses ano her impor an problem regarding he role of he spa ial layou of neural circui s: Which local algori hms enable he compu a ional uni s o carry ou reliable informa ion processing in a circui whose layou is given by a random graph hence no by a precise op-down design?
4
Outlook
Concurren ly wi h he inves iga ion of neural compu a ion in living organisms one has s ar ed o design elec ronic hardware ha cap ures paricular aspec s of he special role ha ime and space play in biological neural compu a ion (see [Mead, 1989] and [Murray, 1998]). Examples are ar i cial re inas [Mead, 1989] schemes for low power analog communica ion be ween chips via pulses (address-even -represen a ion, see [Douglas and Wha ley, 1998,Mor ara and Venier, 1998]) and programmable analog l ers ha employ pulses in a mix of analog and digi al circui echniques (see [Hamil on and Papa hanasiou, 1998]) and cellular neural ne works [Roska, 1997]. This approach is some imes referred o as Neuromorphic En ineerin (see [Smi h, 1998] for he Proceedings of he rs European Workshop on his opic). Obviously his area is s ill a a very early s age, and one migh hope ha heore ical compu er science will play a role in i s fu ure developmen .
82
Wolf an Maass
In principle heore ical compu er science migh be useful in modelling essen ial aspec s of biological neural sys ems in a simpli ed ma hema ical framework, hereby providing a pla form for ex rac ing por able compu a ional mechanisms and principles ha can po en ially be ranspor ed o novel arti cial compu ing machinery. Unfor una ely up o now, heore ically compu er science has con ribu ed very li le in his direc ion (noable expec ions are for example [von Neumann, 1958] and [Valian , 1994]). Perhaps one obs acle has been he di cul y for a non-exper o ge an overview of he curren s a e of he ar in neurophysiology and neuromorphic engineering. This si ua ion is now improving since a number of books wi h qui e accessible surveys of mos relevan opics have recen ly appeared (or will appear shor ly): [Churchland and Sejnowski, 1992,Arbib, 1995] [Rieke e al., 1997,Ballard, 1997,Maass and Bishop, 1998,Koch, 1998]. De ails o some of he speci c models and resul s discussed in his ar icle are available from h p://www.cis. u-graz.ac.a /igi/maass/ .
References Arbib, 1995. Arbib, M. A., editor (1995). The Handbook of Brain Theory and Neural Networks. MIT Press, Cambrid e. Ballard, 1997. Ballard, D. H. (1997). An Introduction to Natural Computation. MITPress. Churchland and Sejnowski, 1992. Churchland, P. and Sejnowski, T. (1992). The Computational Brain. MIT Press, Cambrid e. DasGupta and Schnit er, 1996. DasGupta, B. and Schnit er, G. (1996). Analo versus discrete neural networks. Neural Computation, 8(4):805 818. Dobrunz and Stevens, 1997. Dobrunz, L. and Stevens, C. (1997). Hetero enous release probabilities in hippocampal neurons. Neuron, 18:995 1008. Dou las and Whatley, 1998. Dou las, R. J. and Whatley, A. M. (1998). A pulse-coded communications infrastructure for neuromorphic systems. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Gerstner, 1998. Gerstner, W. (1998). Spikin neurons. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Gerstner and van Hemmen, 1994. Gerstner, W. and van Hemmen, L. (1994). How to describe neuronal activity: spikes, rates or assemblies? In Advances in Neural Information Processin Systems, volume 6, pa es 463 470. Mor an Kaufmann. Hamilton and Papathanasiou, 1998. Hamilton, A. and Papathanasiou, K. (1998). Preprocessin for pulsed VLSI systems. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Hopcroft and Ullman, 1979. Hopcroft, J. E. and Ullman, J. D. (1979). Introduction to automata theory, lan ua es and computation. Addison-Wesley, Readin Mas. Kleene, 1956. Kleene, S. C. (1956). Representation of events in nerve nets and nite automata. In Automata Studies, pa es 3 42. Princeton University Press, Princeton N.J. Koch, 1998. Koch, C. (1998). Biophysics of Computation: Information Processin in Sin le Neurons. Oxford University Press, Oxford. Kr¨ u er and Aiple, 1988. Kr¨ u er, J. and Aiple, F. (1988). Multielectrode investi ation of monkey stritate cortex: Spike train correlations in the infra ranular layers. Neurophysiolo y, 60:798 828.
On the Role of Time and Space in Neural Computation
83
Maass, 1997. Maass, W. (1997). Networks of spikin neurons: The third eneration of neural network models. Neural Networks, 10:1659 1671. Maass, 1998a. Maass, W. (1998a). A model for universal analo computation in neural circuits with local connectivity. in preparation. Maass, 1998b. Maass, W. (1998b). A simple model for neural computation with rin rates and rin correlations. submitted for publication. Maass and Bishop, 1998. Maass, W. and Bishop, C., editors (1998). Pulsed Neural Networks. MIT-Press, Cambrid e. Maass et al., 1991. Maass, W., Schnit er, G., and Sonta , E. (1991). On the computational power of si moid versus boolean threshold circuits. In Proc. of the 32nd Annual IEEE Symposium on Foundations of Computer Science 1991, pa es 767 776. Maass and Zador, 1998a. Maass, W. and Zador, A. (1998a). Computin and learnin with dynamic synapses. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Maass and Zador, 1998b. Maass, W. and Zador, A. M. (1998b). Dynamic stochastic synapses as computational units. In Advances in Neural Processin Systems, volume 10. MIT Press, Cambrid e (to appear). McCulloch and Pitts, 1943. McCulloch, W. S. and Pitts, W. (1943). A lo ical calculus of the ideas immanent in nervous activity. Bull. Math. Biophysics, 5:115 133. Mead, 1989. Mead, C. (1989). Analo VLSI and Neural Systems. Addison-Wesley (Readin ). Mortara and Venier, 1998. Mortara, A. and Venier, P. (1998). Analo VLSI pulsed networks for perceptive processin . In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Murray, 1998. Murray, A. F. (1998). Pulse-based computation in VLSI neural networks. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Recce, 1998. Recce, M. (1998). Encodin information in neuronal activity. In Maass, W. and Bishop, C., editors, Pulsed Neural Networks. MIT-Press, Cambrid e. Rieke et al., 1997. Rieke, F., Warland, D., Bialek, W., and de Ruyter van Steveninck, R. (1997). SPIKES: Explorin the Neural Code. MIT-Press, Cambrid e. Roska, 1997. Roska, T. (1997). Implementation of cnn computin technolo y. In W. Gerstner, A. Germond, M. H. and Nicoud, J.-D., editors, Proc. of ICANN 1997, pa es 1151 1155. Sprin er Verla , Berlin. Smith, 1998. Smith, L. (1998). Neuromorphic Systems: En ineerin Silicon from Neurobiolo y. World Scienti c. Sonta , 1997. Sonta , E. D. (1997). Shatterin all sets of ’k’ points in eneral position requires (k-1)/2 parameters. Neural Computation, 9(2):337 348. Valiant, 1994. Valiant, L. G. (1994). Circuits of the Mind. Oxford University Press, Oxford. von Neumann, 1958. von Neumann, J. (1958). The Computer and the Brain. Yale University Press, New Haven.
From Al orithms to Workin Pro rams: On the Use of Pro ram Checkin in LEDA Kurt Mehlhorn1 and Stefan N¨ aher2 1
Max-Planck-Insi u f¨ ur Informa ik, Im S ad wald, D-66123 Saarbr¨ ucken, Germany (
[email protected] .de) 2 Mar in-Lu her-Universi ¨ a Halle-Wi enberg, FB Ma hema ik und Informa ik, Kur -Mo hes-S r. 1, D-06099 Halle (Saale), Germany (
[email protected])
Abs rac . We repor on he use of program checking in he LEDA library of e cien da a ypes and algori hms.
1
Introduction
LEDA [MN95, MNU97, MN98] is a collection of implementations of data structures and combinatorial al orithms. In the almost ten years of the project we translated hundreds of al orithms into pro rams. For the purpose of this paper an al orithm is the description of a problem solvin method intended for a human reader and a pro ram is a description intended for machine execution. Clearly, al orithms and pro rams are quite di erent animals; al orithms are formulated in natural lan ua e and are published in papers and books, and pro rams are written in computer lan ua es and are executed on machines. We expected the process of implementation to be tedious and time-consumin , indeed, it was, but not intellectually challen in . We now believe that the implementation process is very di cult and challen in . We encountered the followin di culties. We and our co-workers are not perfect pro rammers. We make mistakes. We use pro ram checkin [BK89, SM90, WB97] to cope with the possibility of error. Geometric al orithms are usually desi ned for a hypothetical machine, the so-called Real RAM, which is equipped with arithmetic over the real numbers. The e cient realization of the Real RAM is non-trivial. The primary oal for al orithm desi n is asymptotic runnin time, the secondary desi n oal is ele ance (remember that al orithms are intended for human readers). Actual runnin time is usually not a desi n oal. The actual runnin time of al orithms with the same asymptotic behavior may di er widely. In this paper we concentrate on the rst item. For the other two items we refer the reader to [MN98] and the references therein.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 84 93, 1998. c Sprin er-Verla Berlin Heidelber 1998
From Algori hms o Working Programs
2
85
Pro ram Checkin
We start with an example and then eneralize. 2.1
Planarity Testin
A raph is planar if it can be drawn in the plane without ed e crossin s. A planarity tester bool Is Planar(const
raph& G)
takes a raph G and returns true if G is planar and returns false if G is nonplanar1 . The planarity test played a crucial role in the development of LEDA. There are several linear time al orithms for planarity testin [HT74, LEC67, BL76]. An implementation of the Hopcroft and Tarjan al orithm was added to LEDA in 91. The implementation had been tested on a small number of raphs. In 93 we were sent a raph to ether with a planar drawin of it. However, our pro ram declared the raph non-planar. It took us some days to discover the bu . More importantly, we realized that a complex question of the form is this raph planar deserves more than a yes-no answer. We adopted the thesis that a pro ram should justify (prove) its answers in a way that is easily checked by the user of the pro ram. What does this mean for the planarity test? If a raph is declared planar, a proof should be iven in the form of a combinatorial embeddin or a planar drawin . If a raph is declared non-planar, a proof should be iven in the form of a Kuratowski sub raph2 . Linear time al orithms for computin planar embeddin s are described in [CNAO85, NC88, MM95] and linear al orithms for the computation of Kuratowski sub raphs are iven in [Wil84, Kar90, HMN96]. The function bool Is Planar( raph& G, list<ed e>& K)
returns true if G is planar and returns false otherwise. If G is planar, it also reorders the adjacency lists of G such that G becomes a plane map3 . If G is non-planar, a set of ed es formin a Kuratowski sub raph is returned in K. The function runs in linear time O(n + m), where n and m are the number of nodes and ed es of G, respectively. Its implementation is discussed in the chapter on 1 2
3
We use he syn ax of C++ in our examples. All func ions men ioned in he paper are available in LEDA. Kura owski [Kur30] has shown ha every non-planar graph con ains a subdivision of ei her K5 , he comple e graph on ve nodes, or K3 3 , he comple e bipar i e graph wi h hree nodes on ei her side. A map is an undirec ed graph in which a cyclic order is imposed on he edges inciden o any node. A map is plane if here is a planar embedding preserving he cyclic orders. We use plane map and combina orial embedding as synonyms.
86
Kur Mehlhorn and S efan N¨ aher
embedded raphs of [MN98]. If LEDA is installed on your computer system, you may want to exercise the planarity test demo before proceedin . int GENUS(const raph& G) { if ( !Is_Map(G) ) error_handler(1,"Genus only applies to maps"); int n = G.number_of_nodes(); if ( n == 0 ) return 0; int nz = 0; node v; forall_nodes(v,G) if ( outde (v) == 0 ) nz++; int m = G.number_of_ed es(); node_array cnum(G); int c = COMPONENTS(G,cnum); ed e_array considered(G,false); int fc = 0; ed e e; forall_ed es(e,G) { if ( !considered[e] ) { // trace the face to the left of e ed e e1 = e; do { considered[e1] = true; e1 = G.face_cycle_succ(e1); } while (e1 != e); fc++; } } return (m/2 - n - nz - fc + 2*c)/2; }
Fi . 1. A map is plane if and only if its enus is zero. The enus of a map is computed accordin to Euler’s formula: one half of the number of undirected ed es minus the number of nodes minus the number of isolated nodes minus the number of face cycles plus twice the number of connected components. The face cycle successor of an ed e e is the next ed e out of the tar et of e in the cyclic order of the ed es around the tar et of e. In the LEDA representation of maps every undirected ed e is represented by a pair of directed ed es. The crucial observation is now that the justi cations, which Is Planar ives for its answers, are easily checked. It is well-known that a connected map is plane if it satis es the so-called Euler-relation f − m + n − 2 = 0, where f is the number of face cycles. It is also well-known that a raph is non-planar if it contains a Kuratowski sub raph. The functions int GENUS(const raph& G) bool CHECK KURATOWSKI(const
raph& G, const list<ed e>& K)
From Algori hms o Working Programs
87
compute the enus of a map G and check whether K is a Kuratowski sub raph of G, respectively. The implementation of the former function is shown in Fi ure 1, the implementation of the latter function is equally simple.
BL PLANAR HT PLANAR G T T + E or K C TT+E P 0.25 0.52 0.53 0.08 0.84 1.32 0.52 1.05 1.09 0.16 1.74 2.69 1.07 2.13 2.22 0.33 3.59 5.77 P + K3 3 0.309999 0.379999 1.77 0.0600014 0.83 0.529999 0.640001 2.68 0.129997 1.7 1.12 1.27 5.44 0.23 3.45 P + K5 0.32 0.369999 1.82 0.0600014 0.869999 0.549999 0.530003 2.57 0.119999 1.68 1.1 1.3 7.09 0.229996 3.56001 MP 0.269997 0.720001 0.720001 0.110001 1.21 1.91 0.459999 1.46 1.45 0.220001 2.50999 4.01 0.93 2.94 2.92 0.440002 5.06 8.3 MP + e 0.269997 0.550003 2.05 0.0699997 0.330002 0.449997 1.07001 3.81 0.139999 0.659996 0.93 2.47 8.55 0.289993 1.35 Table 1. The runnin times of functions related to planarity: The rst column shows the type of the input raph, the second column shows the time for the call BL PLANAR(G), the third column shows the time for the call BL PLANAR(G K), the fourth column shows the time required to check the result of the computation in the third column, i.e, the time for the call Genus(G) == 0, if G is planar, and the call CHECK KURATOWSKI (G K) if G is non-planar, the fth column shows the time for the call HT PLANAR(G), and the last column shows the time for the call HT PLANAR(G K). The last call is only made when G is planar, since there there is no e cient Kuratowski nder implemented for the Hopcroft-Tarjan planarity test. The meanin of the rst column is as follows: P stands for a random planar map with n nodes and m ued es, P + K3 3 stands for a random planar map with n nodes and m ued es plus a K3 3 on six randomly chosen nodes, P + K5 stands for a random planar mao with n nodes and m ued es plus a K5 on ve randomly chosen nodes, MP stands for a maximal planar map with n nodes, and MP + e stands for a maximal planar raph plus one additional ed e between two random nodes that are not connected in G. In all cases the ed es of the raph were permuted before the tests were started. For each type of raph we used n = 2 1000, m = 2 2000 for = 0, 1, and 2.
88
Kur Mehlhorn and S efan N¨ aher
Table 1 shows the runnin times of several functions related to planarity. In this table BL PLANAR stands for the planarity test of Lempel, Even, and Cederbaum with PQ-tree data structure of Booth and Luecker, the embeddin al orithm of Chiba et al., and the Kuratowski nder of Hundack et al., and HT PLANAR stands for the planarity test of Hopcroft and Tarjan and the embeddin al orithm of Mehlhorn and Mutzel. 2.2
General Remarks
What have we achieved? Veri cation for every Problem Instance: When a raph is declared planar, the resultin plane map is checked by testin whether its enus is zero, and if a raph is declared non-planar, the sub raph K is checked by CHECK KURATOWSKI. In this way, the correctness of Is Planar is established for each problem instance. Trust with Minimal Investment: A user of Is Planar does not have to understand the intricacies of the planarity test. It su ces to understand the functions GENUS and CHECK KURATOWSKI. The implementation of either function is less than a pa e lon and the underlyin mathematics is simple compared to the mathematics underlyin the planarity test. Observe that one only needs to understand that maps of enus zero are plane (about a two pa e proof) and that the existence of a Kuratowski sub raph implies non-planarity (a ain about a two pa e proof). There is, however, no need to understand why every nonplanar raph contains a Kuratowski sub raph. The implementation proves this fact for every problem instance. In this way checkers allow to develop trust in an implementation with only minimal intellectual investment. It is even conceivable that checkers can be formally veri ed by means of automatic pro ram veri cation. [BSM97] is a rst example. Pro ram Libraries: Pro ram libraries contain implemented al orithms. The implementor of a library may want to hide his code (after all, the source code of the pro rams constitutes his intellectual capital), but he may also want to make a convincin case that his code is correct. Pro ram checkers resolve the conflict. We use the followin uidelines for the speci cation and implementation of functions. (1) De ne the problem to be solved and what constitutes a justi cation for an answer. (2) Prove that the su ested justi cation indeed proves correctness for any particular instance. (3) De ne the interface of the function. (4) De ne the interface of the checker and ive its implementation. (5) Give the implementation of the function. There is no need to make the implementation public.
From Algori hms o Working Programs
89
A matchin in a graph G is a subse M of he edges of G such ha no wo share an endpoin . An odd-se cover OSC of G is a labeling of he nodes of G wi h non-nega ive in egers such ha every edge of G (which is no a self-loop) is ei her inciden o a node labeled 1 or connec s wo nodes labeled wi h he same , 2. Le n be he number of nodes labeled and consider any ma ching N . For , 2, le N be he edges in N ha connec wo nodes labeled . Le N1 be he remaining edges in N . Then N n 2 and N1 n1 and hence N
n1 +
X
n 2
≥2
for any ma ching N and any odd-se cover OSC . I can be shown ha for a maximum cardinali y ma ching M here is always an odd-se cover OSC wi h X M = n1 + n 2 ≥2
hus proving he op imali y of M . In such a cover all n wi h name.
2 are odd, hence he
list<ed e> MAX CARD MATCHING( raph G node array & OSC int heur = 0) compu es a maximum cardinali y ma ching M in G and re urns i as a lis of edges. The algori hm ([Edm65, Gab76]) has running ime O(nm (n m)). Wi h heur = 1 he algori hm uses a greedy heuris ic o nd an ini ial ma ching. This seems o have li le e ec on he running ime of he algori hm. An odd-se cover ha proves he maximali y of M is re urned in OSC .
bool
CHECK MAX CARD MATCHING( raph G list<ed e> M node array OSC ) checks whe her M is a maximum cardinali y ma ching in G and OSC is a proof of op imali y. Abor s if his is no he case.
Fi . 2. The manual pa e for maximum cardinality matchin . The rst para raph de nes the problem, the second para raph de nes the notion of proof and the third and fourth para raph establish that an odd-set cover constitutes a proof of optimality. Observe, that is is not necessary to understand why odd-set covers provin optimality exist.
Fi ures 2 and 3 illustrate items (1) to (4) for the case of maximum cardinality matchin s in eneral raphs.
90
Kur Mehlhorn and S efan N¨ aher
Debu in : Pro ram checkin amounts to a complete check of the post-condition of a pro ram. It allows to assume that potentially incorrect pro rams are correct. static bool False(strin s) { cerr K) K = OSC[v]; } int S = count[1]; for (int i = 2; i 1) return False("M is not a matchin "); forall_ed es(e,G) { node v = G.source(e); node if ( v == w || OSC[v] == 1 ( OSC[v] == OSC[w] return False("OSC is not a } return true;
w = G.tar et(e); || OSC[w] == 1 || && OSC[v] >= 2) ) continue; cover");
}
Fi . 3. The checker for maximum cardinality matchin s.
If a pro ram operates correctly on a particular instance, ne, and if it operates incorrectly, it is cau ht by the checker. Thus, if all subroutines of a function f are checked, no checker of a subroutine res, and an error occurs durin the
From Algori hms o Working Programs
91
execution of f , the error must be in f . This feature of pro ram checkin is extremely useful durin the debu in phase of pro ram development. Testin : Pro ram checkin supports testin . Traditionally, testin is restricted to problem instances for which the solution is known by other means. Pro ram checkin allows to test on any instance. For example, we use the followin proram (amon others) to check the matchin al orithm. for (int n = 0; n < 100; n++) for (int m = 0; m < 100; m++) { random raph(G,n,m); // random raph with n nodes and m ed es list<ed e> M = MAX CARD MATCHING(G,OSC); CHECK MAX CARD MATCHING(G,M,OSC); }
Hidden Assumptions: A checker can only be written if the problem at hand is ri orously de ned. We noticed that some of our speci cations contained hidden assumptions which were revealed durin the desi n of the checker. For example, an early version of our biconnected components al orithm assumed that the raph contains no isolated nodes.
3
Conclusion
At the time of this writin LEDA contains checkers for most network al orithms (mostly based on linear pro rammin duality), for planarity testin , for priority queues, and for the basic eometric al orithms (convex hulls, Delaunay dia rams, and Voronoi dia rams). Pro ram checkin has reatly increased our con dence in the correctness of our implementations. For further readin on pro ram checkin we refer the reader to [SM90, BS94, SM91, BSM97, BS95, BSM95, SWM95, BK89, BLR90, BW96, WB97], [MN98, AL94, OLPT97, MNS+ 96].
References [AL94]
[BK89] [BL76]
[BLR90]
N.M. Ama o and M.C. Loui. Checking linked da a s ruc ures. In Proceedin s of the 24th Annual International Symposium on Fault-Tolerant Computin , pages 164 173, 1994. M. Blum and S. Kannan. Programs Tha Check Their Work. In Proc. of the 21th Annual ACM Symp. on Theory of Computin , 1989. K.S. Boo h and G.S. Luecker. Tes ing for he Consecu ive Ones Proper y, In erval Graphs, and Graph Planari y Using P Q- ree Algori hms. Journal of Comp. and Sys. Sciences, 13:335 379, 1976. M. Blum, M. Luby, and R. Rubinfeld. Self- es ing/correc ing wi h applicaions o numerical problems. In Proc. 22nd Annual ACM Symp. on Theory of Computin , pages 73 83, 1990.
92 [BS94]
Kur Mehlhorn and S efan N¨ aher
J. D. Brigh and G. F. Sullivan. Checking mergeable priori y queues. In Proceedin s of the 24th Annual International Symposium on Fault-Tolerant Computin , pages 144 153, Los Alami os, CA, USA, June 1994. IEEE Compu er Socie y Press. [BS95] J. D. Brigh and G. F. Sullivan. On-line error moni oring for several da a s ruc ures. In FTCS-25: 25th International Symposium on Fault Tolerant Computin Di est of Papers, pages 392 401, Pasadena, California, 1995. [BSM95] J. D. Brigh , G. F. Sullivan, and G. M. Masson. Checking he in egri y of rees. In FTCS-25: 25th International Symposium on Fault Tolerant Computin Di est of Papers, pages 402 413, Pasadena, California, 1995. [BSM97] J.D. Brigh , G. F. Sullivan, and G. M. Masson. A formally veri ed sor ing cer i er. IEEE Transactions on Computers, 46(12):1304 1312, 1997. [BW96] M. Blum and H. Wasserman. Reflec ions on he pen ium division bug. IEEE Trans. Comput., 45(4):385 393, April 1996. [CNAO85] Norishige Chiba, Takao Nishizeki, Shigenobu Abe, and Takao Ozawa. A linear algori hm for embedding planar graphs using PQ- rees. Journal of Computer and System Sciences, 30(1):54 76, February 1985. [Edm65] J. Edmonds. Maximum ma ching and a polyhedron wi h 0,1 - ver ices. Journal of Research of the National Bureau of Standards, 69B:125 130, 1965. [Gab76] H.N. Gabow. An e cien implemen a ion of Edmond’s algori hm for maximum ma ching on graphs. JACM, 23:221 234, 1976. [HMN96] C. Hundack, K. Mehlhorn, and S. N¨ aher. A Simple Linear Time Algori hm for Iden ifying Kura owski Subgraphs of Non-Planar Graphs. Manuscrip , 1996. [HT74] J.E. Hopcrof and R.E. Tarjan. E cien planari y es ing. Journal of the ACM, 21:549 568, 1974. [Kar90] A. Karabeg. Classi ca ion and de e ec ion of obs ruc ions o planari y. Linear and Multilinear Al ebra, 26:15 38, 1990. [Kur30] C. Kura woski. Sur le probleme he courbes guaches en opologie. Fundamenta Mathematicae, 15:271 283, 1930. [LEC67] A. Lempel, S. Even, and I. Cederbaum. An Algori hm for Planari y Tes ing of Graphs. In P. Rosens iehl, edi or, Theory of Graphs, International Symposium, Rome, pages 215 232, 1967. [MM95] K. Mehlhorn and P. Mu zel. On he Embedding Phase of he Hopcrof and Tarjan Planari y Tes ing Algori hm. Al orithmica, 16(2):233 242, 1995. [MN95] K. Mehlhorn and S. N¨ aher. LEDA, a pla form for combina orial and geome ric compu ing. Communications of the ACM, 38:96 102, 1995. [MN98] K. Mehlhorn and S. N¨ aher. The LEDA Platform for Combinatorial and Geometric Computin . Cambridge Universi y Press, 1998. Draf versions of some chap ers are available a http://www.mpi-sb.mp .de/~mehlhorn. [MNS+ 96] K. Mehlhorn, S. N¨ aher, T. Schilz, S. Schirra, M. Seel, R. Seidel, and Ch. Uhrig. Checking Geome ric Programs or Veri ca ion of Geome ric S rucures. In Proc. of the 12th Annual Symposium on Computational Geometry, pages 159 165, 1996. [MNU97] Kur Mehlhorn, S. N¨ aher, and Ch. Uhrig. The LEDA User Manual (Version R 3.5). Technical repor , Max-Planck-Ins i u f¨ ur Informa ik, 1997. h p://www.mpi-sb.mpg.de/LEDA/leda.h ml. [NC88] T. Nishizeki and N. Chiba. Planar Graphs: Theory and Al orithms. Annals of Discre e Ma hema ics (32). Nor h-Holland Ma hema ics S udies, 1988.
From Algori hms o Working Programs [OLPT97]
[SM90]
[SM91]
[SWM95] [WB97] [Wil84]
93
O.Devillers, G. Lio a, F.P. Prepara a, and R. Tamassia. Checking he convexi y of poly opes and he planari y of subdivisions. Technical repor , Cen er for Geome ric Compu ing, Depar men of Compu er Science, Brown Universi y, 1997. G. F. Sullivan and G. M. Masson. Using cer i ca ion rails o achieve sof ware faul olerance. In Brian Randell, edi or, Proceedin s of the 20th International Symposium on Fault-Tolerant Computin (FTCS ’90), pages 423 433, Newcas le upon Tyne, UK, June 1990. IEEE Compu er Socie y Press. G. F. Sullivan and G. M. Masson. Cer i ca ion rails for da a s ruc ures. In Proceedin s of the 21st International Symposium on Fault-Tolerant Computin , pages 240 247, 1991. G.F. Sullivan, D.S. Wilson, and G.M. Masson. Cer i ca ion of compu aional resul s. IEEE Transactions on Computers, 44(7):833 847, 1995. Hal Wasserman and Manuel Blum. Sof ware reliabili y via run- ime resul checking. Journal of the ACM, 44(6):826 849, November 1997. S.G. Williamson. Dep h-Firs Search and Kura owski Subgraphs. JACM, 31(4):681 693, 1984.
Computationally-Sound Checkers Silvio Micali Labora ory for Compu er Science, MIT, Cambridge, MA 02139
Abs rac . We show ha CS proofs have impor an implica ions for valida ing one-sided heuris ics for N P. Namely, generalizing a prior noion of Blum’s, we pu forward he no ion of a CS checker and show ha special- ype of CS proofs imply CS checkers for N P-comple e languages.
1
Introduction
Le us s a e he general problem of heuris ic valida ion we wan o solve, explain why prior no ions of checkers may be inadequa e for solving i , and discuss he novel proper ies we wan from a checker. 1.1
The Problem of Validatin One-Sided Heuristics for N P
A eneral Problem. N P-comple e languages con ains very impor an and useful problems ha we would love o solve. Unfor una ely, i is ex ensively believed ha P = N P and N P = Co-N P, and hus ha our abili y of successfully handling N P-comple e problems is severely limi ed. Indeed, if P = N P, hen no e cien (i.e., polynomial- ime) algori hm may decide membership in an N Pcomple e language wi hou making any errors. Moreover, if N P = Co-N P, hen no e cien algori hm may, in general, prove non-membership in an N P-comple e language by means of shor and easy o verify s rings. In ligh of he above belief, he bes na ural al erna ive o deciding e cien ly N P-comple e languages and conveying e cien ly o o hers he resul s of our de ermina ions, consis s of ackling N P-comple e languages by means of e cien heuristics ha are one-sided. Here by heuris ic we mean a program (emphasizing ha no claim is made abou i s correc ness) and by one-sided we mean ha such a program, on inpu a s ring x, ou pu s ei her (1) a proper N P-wi ness, hereby provin ha x is in he language, or (2) he symbol NO, hereby claimin (wi hou proof) ha x is no in he language. Bu for an e cien one-sided heuris ic o be really useful for ackling N Pcomple e problems we should know when it is ri ht. Of course, when such an heuris ic ou pu s an N P-wi ness, we can be con den of i s correc ness on he given inpu . However, when i ou pu s NO, skep icism is manda ory: even if he heuris ic came wi h an a priori guaran ee of re urning he correc answer on mos inpu s, we migh no know whe her he inpu a hand is among hose. Thus, in ligh of he impor ance of N P-comple e languages and in ligh of he many e cien one-sided heuris ics sugges ed for hese languages, a fundamen al problem na urally arises: Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 94 116, 1998. c Sprin er-Verla Berlin Heidelber 1998
Compu a ionally-Sound Checkers
95
Given an e cient one-sided heuristic H for an N P-complete lan ua e, is there a meanin ful and e cient way of usin H so as to validate some of its NO-outputs? Interpretin the problem. The solvabili y of he above general problem cri ically depends on i s speci c in erpre a ion. One such in erpre a ion was proposed by Manuel Blum when, a few years ago, he in roduced he no ion of a checker [3]1 , and asked whe her N P-comple e languages are checkable. His speci c formula ion of he general problem (which provided he mo iva ion for our presen work) is s ill open. By con ras , in his paper we propose a new in erpre a ion of he general problem and, under a complexi y conjec ure, provide i s rs (and posi ive) solu ion. Thus, our resul does no address Blum’s open ques ion, bu a generaliza ion of i . We shall immedia ely argue, however, ha , wi hou generalizing i , his original ques ion may no possess a posi ive answer, nor enjoy some new bu o us desirable proper ies. 1.2
Blum Checkers and Their Limitations
The notion of a Blum checker. In ui ively, a Blum checker for a given func ion f is an algori hm ha ei her (a) de ermines wi h arbi rarily high probabili y ha a given program, run on a given inpu , correc ly re urns he value of f a ha inpu , or (b) de ermines ha he program does no compu e f correc ly (possibly, a some o her inpu ). Le us quickly recall Blum’s de ni ion. Informal De nition: Le f be a func ion and C a probabilis ic oraclecalling algori hm running in expec ed polynomial- ime. Then, we say ha C is a Blum checker for f if, on inpu an elemen x in f ’s domain and oracle access o any program P (allegedly compu ing f ), he following wo proper ies hold: 1. If P (y) = f (y) for all y (i.e., if P correc ly compu es f for every inpu ), hen C P (x) ou pu s YES wi h probabili y 1; and 2. If P (x) = f (x) (i.e., if P does no compu e f correc ly on he given inpu x) , hen C P (x) ou pu s YES wi h probabili y 1 2. The probabili ies above are aken solely over he coin osses of C whenever P is de erminis ic, or over he coin esses of bo h algori hms o herwise. The above no ion of a Blum checker sligh ly di ers from he original one.2 In par icular, according o our reformula ion any correc program for compu ing f 1 2
We shall call his no ion a Blum checker o highligh i s di erence wi h ours. Disregarding minor issues, Blum’s original formula ion imposes an addi ional condi ion: roughly, ha C run asymp o ically fas er han he fas es known algori hm for compu ing f or asymp o ically fas er han P when checking P . This addi ional
96
Silvio Micali
immedia ely yields a checker for f , hough no necessarily a useful one (because such a checker may be oo slow, or because i s correc ness may be oo hard o es ablish).3 Despi e heir s ringen requiremen s, Blum checkers have been cons ruc ed for a varie y of speci c func ions (see, in par icular, he works of Blum, Luby, and Rubinfeld [4] and Lip on [18]). No e ha he no ion of a checker is immedia ely ex ended o languages: an algori hm C is a Blum checker for a language L if i is a Blum checker for L’s charac eris ic func ion. Indeed, he in erac ive proof-sys ems of [23] and [25] yield Blum checkers for, respec ively, any #P- or P SP ACE-comple e language.4 Blum checkers vs. efficient heristics for N P-complete problems. We believe ha he ques ion of whe her Blum checkers for N P-comple e languages exis should be in erpre ed more broadly han originally in ended. We in fac argue ha , even if hey exis ed, Blum checkers for N P-comple e languages migh less relevan han desirable. (Informal) De nition: We say ha a Blum checker C for a func ion f is irrelevant if, for all e cien heuris ic H for f , and for all x in f ’s domain, C H (x) = N O wi hou ever calling H on inpu x. No e ha , if P = N P, hen no e cien heuris ic for an N P-comple e language is correc on all inpu s. Thus, i is qui e legi ima e for a Blum checker for a N P-comple e language o ou pu NO whenever i s oracle is an e cien heuris ic, wi hou ever calling i on he speci c inpu a hand: a NO-ou pu simply indica es ha he e cien heuris ic is incorrec on some inpu s (possibly di eren from he one a hand). However, cons ruc ing an irrelevan Blum checker for SAT’s charac eris ic func ion under he assump ion ha P = N P is no rivial. The di cul y lies in he fac ha a checker does no know whe her
3
4
cons rain aims a rebu ng a na ural objec ion: who checks he checker? The condi ion is in fac an a emp o guaran ee, in prac ical erms, ha C is su cien ly di eren from (and hus independen of) P , so ha he probabili y ha bo h C and P make an error in a given execu ion is smaller han he probabili y ha jus P makes an error. Thus, running a checker C (as de ned by us) wi h a program P may be useful only if C is much fas er han P , or if C’s correc ness is much easier o prove or believe han ha of P . In fac , he de ni ion of a Blum checker for a language L is analogous o a res ric ed kind of in erac ive proof for L: one whose Prover is a probabilis ic polynomial- ime algori hm wi h access o an oracle for membership in L. Indeed, whenever a language L possesses such a kind of in erac ive proof-sys em, a checker C for L is cons ruc ed as follows. On inpu s P (a program allegedly deciding membership in L) and x, he checker C simply runs bo h Prover and Veri er on inpu x, giving he Prover oracle access o program P . C ou pu s YES if he Veri er accep s, and rejec s o herwise.
Compu a ionally-Sound Checkers
97
i is accessing a polynomial- ime program (in which case, if P = N P, i could always ou pu NO), or an exponen ial- ime program ha is correc on all inpu s (in which case i should always ou pu YES). We can, however, cons ruc such an irrelevan Blum checker under he assump ion ha one-way func ions exis . This assump ion appears o be s ronger han P = N P, bu is widely believed and provides he basis of all modern cryp ography. (Informal) De nition. We say ha a func ion f mapping binary s rings o binary s rings is one-way if i is leng h-preserving, polynomial- ime compu able, bu no polynomial- ime inver ible in he following sense: for any polynomialime algori hm A, if one genera es a random a su cien ly long inpu z and compu es y = f (z), hen he probabili y ha A(y) is a coun er-image of f is negligible. (Informal) Theorem 1: If one-way func ions and Blum checkers for N Pcomple e languages exis , hen here exis irrelevan Blum checkers for N Pcomple e languages. (Informal) Proof: Le SAT be he N P-comple e language of all sa is able formulae in conjunc ive normal form, le P be a program allegedly deciding SAT, le C be a Blum checker for SAT, le f be a one-way func ion, and le C be he following oracle-calling algori hm. On inpu an n-variable formula F in conjunc ive normal form, and oracle access o P , C works in wo s ages. In he rs s age, C randomly selec s a (su cien ly long) s ring z and compu es (in polynomial- ime) y = f (z). Af er ha , C u ilizes he comple eness of SAT o cons ruc , and feed o P , n formulae Fn , whose sa is abili y encodes a coun erin conjunc ive normal form, F1 image of y under f . (For ins ance, F1 is cons ruc ed so as o be sa is able if and only if here exis s a coun er-image of y whose rs bi is 0. The checker feeds such an F1 o P . If P ou pu s F1 is sa is able, hen C cons ruc s F2 o be a formula ha is sa is able if and only if here exis s a coun er-image of y whose 2-bi pre x is 00. If, ins ead, P responds F1 is no sa is able, hen C cons ruc s F2 o be a formula ha is sa is able if and only if here exis s a coun er-image of y whose Fn are cons ruc ed and 2-bi pre x is 10. And so on, un il all formulae F1 P (Fn ) are ob ained.) all ou pu s P (F1 ) Because s ring y is, by cons ruc ion, guaran eed o be in he range of f , a he end of his process one ei her nds (a) a coun er-image of y under f , or (b) a proof ha P is wrong (because if no f -inverse of y has been found, hen P mus have provided a wrong answer for a leas one of he formulae F ). If even (b) occurs, C hal s ou pu ing NO. Else, in a second phase, C runs Blum checker C on inpu he original formula F and oracle access o P . When C hal s so does C, ou pu ing he same YES/NO value ha C does. Le us now argue ha C is a Blum checker for SAT. Firs , i is qui e clear ha C runs in probabilis ic polynomial ime. Then, here are wo cases o consider. 1. P correctly computes SAT’s characteristic function. In his case, a coun erimage of y is found, and hus C P does no hal in he rs phase. Moreover,
98
Silvio Micali
in he second phase, C runs Blum checker C wi h he same correc program P . Therefore, by Proper y 1 of a Blum checker, C P will ou pu YES no ma er wha he original inpu formula F migh be, and, by cons ruc ion, so will C P . This shows ha C enjoys Proper y 1 of a Blum checker for SAT. 2. P (F ) provides the wron answer about the satis ability of F . In his case, ei her C P hal s in Phase 1 ou pu ing NO, or i execu es Phase 2 by running C P (F ), ha is, he original Blum checker for SAT, C, on he same inpu F and he same oracle P . Therefore, by Proper y 2 of a Blum checker, he probabili y ha C P (F ) will hal ou pu ing YES is no grea er han 1/2. By cons ruc ion, he same holds for C P (F ). This shows ha C enjoys Proper y 2 of a Blum checker for SAT. Finally, le us argue ha , for any inpu F and any e cien P (no ma er how well i may approxima e SAT’s charac eris ic func ion), almos always C P (F ) = N O, wi hou even calling P on F . In fac , because C runs in polynonial ime, whenever P is polynomial- ime, so is algori hm C P . Therefore, C P has essen ially no chance of inver ing a one-way func ion evalua ed on a random inpu . Therefore, C will ou pu NO in Phase 1, where i does no call P on F ). In sum, di eren ly from many o her con ex s, he no ion of a Blum checker may no be oo useful for handling e cien heuris ics for N P-comple e languages: ei her because no such checkers exis 5 or because hey may exis bu no be oo useful. Blum checkers are not complexity-preservin . The lesson we derive from he above ske ched proof of Theorem 1 is ha Blum’s no ion of a checker lacks a new proper y ha we name complexity preservation. In ui ively, a Blum checker for Sa is abili y, when given a no -so-di cul formula F , may ignore i al oge her and ins ead call he o-be- es ed e cien heuris ic on very special and possibly much harder inpu s, hus forcing he heuris ic o make a mis ake and jus ifying i s own ou pu ing NO (i.e., he heuris ic is wrong ). The possibili y of calling a given heuris ic H on inpu s ha are harder han he given one chills he chances of meaningfully valida ing H’s answer whenever i happens o be correc .6 Such possibili y may no ma er much if he di erence in compu a ional complexi y be ween any wo inpu s of similar leng h is somewha bounded. Bu i may ma er a lo whenever if such a di erence is enormous which may be he case of N P-comple e languages, as hey encode membership in bo h easy and hard languages. We hus wish o develop a no ion of a complexi y-preserving checker. 5
6
No ice ha his possibili y does no con radic he fac ha N P is con ained in bo h #P and P SP ACE and ha #P- and P SP ACE-comple e languages are Blum checkable! No e ha such possibili y no only is presen in he de nition of a Blum checker, bu also in all known examples of a Blum checker. Typically, in fac , a Blum checker works by calling i s given heuris ic on random inpu s, and hese may be more di cul han he speci c, original one.
Compu a ionally-Sound Checkers
1.3
99
New Checkers for New Goals
The old oal. Blum checkers are very useful o ca ch he occasional mis ake of programs believed o be correc on all inpu s. Tha is, hey are ideally sui ed o check fast pro rams for easy functions (or slow program for hard func ions). In fac , if f is an e cien ly compu able func ion, hen we know a priori ha here are e cien and correc programs for f . Therefore, if a repu able sof ware company produces a program P for f , i migh be reasonable o expec ha P is correc . In his framework, by running a Blum checker for f , wi h oracle P , on a given inpu x we have no hing o lose7 and some hing o gain. Indeed, if he checker answers YES, we have veri ed our expec a ions abou he correc ness of P a leas on inpu x (a small knowledge gain), and if he checker answers NO, we have proved our expec a ions abou P o be wrong (a big knowledge gain). The new oal. We ins ead wan o develop checkers for a rela ed, bu di eren goal: valida ing e cien heuris ics ha are known o be incorrec on some inpu s. Tha is, we wish o develop checkers sui able for handling fast pro rams for hard functions. Now, if f is a func ion hard o compu e, hen we know a priori ha no e cien program correc ly compu es i . Therefore ob aing from a checker a proof ha such an e cien program does no compu e f correc ly would be qui e redundan . We ins ead wan checkers ha , a leas occasionally, if an e cien heuris ic for f happens o be correc on some inpu x, are capable of convincing us ha his is he case. Interpretin the new oal. Several possible valid in erpre a ions of his general cons rain are possible. In his paper we focus on a single one: namely, we wan checkers ha are complexity-preservin . Le f be a func ion ha is hard o compu e (a leas in he wors case). Then, in ui ively, a complexi ypreserving checker for f will, on inpu x, call a candida e program for f only on inpu s for which evalua ing f is essen ially as di cul as for x. Our poin is ha , while a given heuris ic for sa is abili y, H, may make mis akes on some formulae, i may re urn remarkably accura e answers on some class of formulae (e.g., hose decidable in O(2cn ) ime, for some cons an c 1, by a given deciding algori hm D). In ui ively, herefore, checkers should be de ned (and buil !) so ha , if he inpu formula belongs o ha class and H happens o be correc on he inpu formula, hey call H only on addi ional formulae in ha class.
2
Back round on CS Proofs
Informally, a CS proof of a s a emen S consis s of a shor s ring, , which (1) is as easy o nd as possible, (2) is very easy o verify, and (3) o ers a s rong 7
Excep for some amoun of running ime, bu Blum checkers are of en so fas (e.g., running in ime sub-linear in ha of he algori hm hey check) ha non even his is much of a concern.
100
Silvio Micali
compu a ional guaran ee abou he veri y of S. By as easy o nd as possible we mean ha a CS proof of a true s a emen (i.e., for he purposes of his paper, derivable in a given axioma ic heory) can be compu ed in a ime essen ially comparable o ha needed o Turing-accep he s a emen . By very easy o verify we mean ha he ime necessary o inspec a CS Proof of a s a emen S is poly-logari hmic in he ime necessary o Turing-accep S. Finally, by saying ha he guaran ee o ered by a CS proof is compu a ional we mean ha false s a emen s ei her do no have any CS proofs, or such proofs are prac ically impossible o nd. Le us now see how de ne hese proof-sys ems more formally and hen discuss heir proper ies. 2.1
Common and Di erent Aspects of Various CS Proof-Systems
CS proof-sys ems consis of a pair of wo algori hms, a Prover and a Verier. However, we dis inguish various ypes of such sys ems: all sharing a basic paradigm, bu di ering in (1) heir mechanics and (2) he complexi y assumpions underlying heir implemen a ions. A common paradi m: controlled inconsistency Though CS proofs di er from zero-knowledge argumen s in impor an respec s8 , hey oo allow he exis ence of false proofs, bu ensure ha hese are compu a ionally hard o nd. Tha is, False CS proofs may exist, but they will never be found. Equivalen ly, CS proof-systems are deliberately inconsistent, but practically indistin uishable from consistent systems. Indeed, each CS proof speci es a securi y parame er, con rolling he amoun of compu ing resources necessary o chea in he proof, so ha hese resources can be made arbi rarily high. Accordingly, CS proofs are meaningful only if we believe ha he Provers who produced hem, hough more powerful han heir corresponding Veri ers, are hemselves compu a ionally bounded.9 From a prac ical poin of view, his is hardly a limi a ion. As long we res ric our a en ion o physically implemen able processes, no prover in our Universe can perform 21 000 s eps of compu a ion, a leas during he exis ence of he human race. Thus, prac ically speaking all Provers are compu a ionally bounded. Besides being prac ically reasonable, CS proofs also are heore ically appealing: mutatis mudandis, hey provide an answer o many of he oldes ques ions 8
9
As we shall see, he la er may no enjoy relative e ciency of provin , nor relative and ubiquitous e ciency of verifying, nor universality. The ransi ion from an in erac ive proof-sys em o a CS proof-sys em is analogous o he ransi ion from perfec zero-knowledge proof-sys em o a compu a ional zeroknowledge proof-sys em[22], which has proved o be a more flexible and powerful no ion [12].
Compu a ionally-Sound Checkers
101
in complexi y heory, and some new and fundamen al ones as well. (Af er all, he righ no ion is he one ha allows us o prove he righ heorem in he righ way! ) Three different resources. CS proof-sys ems di er in heir use of he following hree resources: 1. Interaction. CS proof-sys ems di er in he amoun of in erac ion hey require: informally, he number of rounds in which Prover and Veri er exchange messages un il he Veri er accep s or rejec . We call a CS proof-sys em nonin erac ive if i is 0-round. Tha is, if, on inpu he s a emen of a heorem T , he Prover ou pu s a CS proof of of T : a special s ring ha he Veri er can check for correc ness on i s own. 2. Shared randomness. In a CS proof-sys em, he Prover, P , and he Veri er, V , may be probabilis ic. We may hus dis inguish various ypes of CS proofsys ems according o he ype of randomness source P and V share wi h each o her: a random oracle (i.e., a long s ring of easily-accessable random bi s), a (polynomially-long) random s ring, or no randomness a all.10 3. Complexity assumptions. CS proof-sys ems also di er in he complexi y assump ion necessary for concre ly implemen hem. Such assump ions oo could be considered a resource ( o be used sparingly!). These resources are qui e in errela ed, and ypically one can decrease one a cos of increasing ano her.
he
Three types of CS proof-systems. In his paper we consider only hree ypes of CS proof-sys ems, briefly described below (in order of decreasing complexi y assump ion ): CS proof-systems sharin a random oracle. In hese proof-sys ems, when having a given s a emen as an inpu , bo h P and V have access o he same random oracle. A bi more precisely (given ha a random oracle can be viewed as an in ni e s ring of random bi s), P and V have oracle access o a randomly selec ed func ion mapping poly(k)-bi s rings o poly(k)-bi s rings, where k is a securi y parame er. (We show ha random oracles alone su ce for implemen ing hese CS proofsys ems. Such proof-sys em could be considered non-in erac ive.11 ) Interactive CS proof-systems. In hese sys ems Prover and Veri er exchange messages in arbi rarily many rounds. (Such sys ems can be implemen ed based on collision-free hash func ions.) 10
11
We may also consider he hybrid shared source of a hidden random s ring, ha is, he image under a polynomial- ime algori hm of a random s ring. In some sense, herefore, maximizing he second resources allows one o minimize he o her wo.
102
Silvio Micali
One-round CS proof-systems. These are a special case of in erac ive CS proofsys ems, where each of Prover and Veri er send a single message, he Veri er going rs . (Such sys ems are implemen able under (1) a concre e number- heore ic conjec ure, or (2) under a generic conjec ure. They are par icularly impor an o us because hey provide he rs CS proof-sys em implying CS checkers.) CS proof-systems with a random strin . These are a special case of oneround CS proof-sys ems, where he only message of he Veri er o he Prover consis s of a random s ring (having leng h polynomial in a securi y parame er k). (Such sys ems are implemen able based on a generic complexi y conjec ure i.e., we provide a plausibili y argumen owards heir exis ence. They can be considered non-in era ive if a common random s ring is available.) All men ioned ypes of CS proofs sys ems are designed o prove membership in a special (and ye qui e universal ) language.
2.2
The CS Lan ua e.
Preliminaries. Encodin s. Throughou his paper, we assume usage of a s andard binary encoding, and of en iden ify an objec wi h i s encoding. (In par icular, if A is an algori hm, we may meaningfully if informally give A as an inpu o ano her algori hm.) The leng h of an (encoded) objec x is deno ed by x . If q is a quadruple of binary s rings, q = (a b c d), hen our quadruple encoding is such ha , for some posi ive cons an c, 1 + a + b + c + d q c(1 + a + b + c + d ). (Steps.) If M is a Turing machine and x an inpu , we deno e by #M (x) he number of s eps ha M akes on inpu x. De nition 1: We de ne he CS lan ua e, deno ed by L, o be he se of all quadruples q = (M x y t), such ha M is ( he descrip ion of) a Turing machine, x and y are a binary s rings, and t a binary in eger such ha 1. x y t; 2. M (x) = y; and 3. #M (x) = t. No ice ha , as long as M reads each bi of i s inpu s and wri es each bi of i s ou pu s, he above Proper y 1 is no a real res ric ion. No ice oo ha , due o our encoding, if q = (M x y t) L hen t 2jqj .
Compu a ionally-Sound Checkers
2.3
103
CS Proof-Systems with a Random Oracle
The notion of a CS proof-system with a random oracle. By n-call al orithm we deno e an oracle-calling algori hm ha , in any possible execu ion, makes exac ly n calls o i s oracle. De nition 2: Le P () and V () be wo oracle-calling Turing machines, he second of which running in polynomial- ime. We say ha (P V ) is a CS proofsystem with a random oracle if here exis a sequence of 6 posi ive cons an s, c6 (refered o as he fundamental constants of he sys em), such ha he c1 following wo proper ies are sa is ed: c1
c1
k k , 1 Feasible Completeness. q = (M x y t) L, k, and f f c2 (1 1) P (q k) hal s wi hin ( q kt) compu a ional s eps, ou pu ing a binary s ring C whose leng h is ( q k)c3 , and (1 2) V f (q k C) = Y ES. 2 Computational Soundness. qe L, k such ha 2k > q c4 , and (chea ing) k c1 k c1 , de erminis ic 2c5 k -call algori hm Pe , for a random oracle
q k Pe (e q k)) = Y ES] P rob [V (e
2−c6 k
If q = (M x y t) and V f (q k C) = Y ES, we may call s ring C a random-oracle CS proof (of security k) of M (x) = y (in less than t steps). For varia ion of discourse, we may some imes refer o such a C as a CS witness or a CS certi cate. The constructability of CS proof-systems with a random oracle. Theorem 2 [24]: There exis CS proof-sys ems wi h a random oracle (wi hou any o her assump ion). 2.4
One-Round CS Proof-Systems
Recall ha a circuit of size s is a ni e func ion compu able by a mos s Boolean ga es, where each ga e is ei her a NOT-ga e (wi h one binary inpu and one binary ou pu ) or an AND-ga e (wi h wo binary inpu s and one binary ou pu ). A circui A may be aken o be de erminis ic, because i migh have wired-in any ni e lucky sequence of coin osses. (In which case he probabili y ha B is convinced in a random execu ion wi h A on inpu x solely depends on B’s coin osses. De nition 4. Le (P V ) be a pair of algori hms, he second of which running in probabilis ic polynomial ime, which, on inpu x execu es he following hree phases: (1) V compu es a message M on inpu x; (2) P compu es a s ring y on inpu s x and M ; and (3) V ou pu s YES or NO by compu ing on inpu y and he in ernal s a e i reached a he end of phase 1. Le L be he CS language. We say ha (P V ) is a one-round CS proof-system if here are four posi ive cons an s a, b, c, and d such ha he following wo proper ies are sa is ed:
104
Silvio Micali
10 Feasible Completeness. q = (M x y t) L, and unary in egers k, in every execu ion of (P V ) on inpu s q and k, (1 10 ) P hal s wi hin (nkt)a compu a ional s eps, and (1 20 ) V ou pu s YES. 0 2 Computational Soundness. qe L, k > q b , and (chea ing) circui Pe of size 2ck , in a random execu ion of Pe wi h V on inpu s qe and k, P rob[V ou pu s Y ES]
2−dk
We exhibi one-round CS proof-sys ems under ei her We exhibi one-round CS proof-sys ems under ei her 1. A concrete complexity assumption: informally, he di cul y of deciding, given a prime p and an in eger n (whose fac oriza ion is unknown), whe her p divides (n) (This assump ion has been used by Cachin, Micali, and S adler o cons ruc compu a ional priva e informa ion re rieval sys ems wi h poly-logari hmic amoun of communica ion [21]); or 2. A eneric, ad hoc conjecture: informally, he replacibili y in he CS proofsys em of Theorem 1 of he random oracle wi h a pseudo-random func ion Theorem 3 [19]: Under Assump ion 1 (properly formalized) here exis oneround CS proof-sys ems. A more formal discussion of Conjec ure 2 and why i su ces for implemen ing one-round CS proof-sys ems is presen ed in he nex subsec ion. Indeed, CS proof-sys ems sharing a random s ring are a special case of one-round CS proofsys ems. 2.5
CS Proof-Systems Sharin a Random Strin
The notion of of a CS proof-system sharin a random strin In a CS proof-sys em sharing a random s ring, Prover and Veri er are ordinary (as opposed o oracle-calling) algori hms, sharing a shor random s ring r. Tha is, whenever he securi y parame er is k, hey share a s ring r ha bo h believe o have been randomly selec ed among hose having leng h k c , where c is a posi ive cons an . If s ring r is universally known, i can be shared by all Provers and Veri ers. (CS proof-sys ems sharing a random s ring are a special case of one-round CS proof-sys ems because r could be he message sen by he Veri er o he Prover.) De nition 7: Le (P V ) be a pair of Turing machines, he second of which runs in polynomial- ime. We say ha (P V ) is a CS proof-system sharin a c6 (refered random strin if here exis s a sequence of 6 posi ive cons an s, c2 o as he fundamental constants of he sys em12 ), such ha he following wo proper ies are sa is ed: 12
The numbering of hese cons an s has been chosen o facili a e comparison wi h CS proof-sys ems wi h a random oracle.
Compu a ionally-Sound Checkers
105
100 Feasible Completeness. q = (M x y t) L, and binary s ring r, (1 100 ) On inpu s q and r, P hal s wi hin ( q r t)c2 compu a ional s eps ou pu ing a binary s ring C, whose leng h is ( q r )c3 , such ha (1 200 ) V (q r C) = Y ES. 00 2 Computational Soundness. qe L, k > q c4 , and (chea ing) circui s Pe whose size is 2c5 k , for a random k c1 -bi s ring r e = Y ES] q r) = Ce V (e q r C) P robr [Pe (e
2 c6 k
We refer o he above s rings r and C as, respec ively, a reference strin and a CS certi cate (of q L, relative to r and (P,V)). The Constructability of CS proof-systems sharin a random strin Though he safes conjec ure su cien for implying he exis ence of a new ma hema ical objec simply is ha he objec exis s , i is of en useful o prove ha possibly s ronger bu longer-s udied assump ions, such as he compu a ional di cul y of inte er factorization of ha of nding discrete lo arithms, are also su cien .13 Unfor una ely, we have no been able o prove ha some well-known complexi y assump ion su ces o imply he exis ence of CS proof sys ems wi h a random s ring, bu heir exis ence is none heless plausible. In par icular, i is guaran eed by an ad hoc assump ion: he replaceabili y, in our context, of random oracles wi h de erminis ic algori hms, possibly using shor random seeds. (Such replacemen s are advoca ed, in more general con ex s, by Bellare and Rogaway [2].) To illus ra e he de ails of such a replacemen , deno e by (P V) he CS proofsys em wi h a random oracle cons ruc ed in [24], and hen consider subs i u ing he random oracle of (P V) wi h a speci c pseudo-random func ion: he pseudorandom-oracle cons ruc ion of Goldreich, Goldwasser and Micali [10]. Informally, heir cons ruc ion consis s of a polynomial- ime program ha , on inpu a random and shor (i.e., k-bi , where k is a securi y parame er) and secret seed and a query (binary s ring of a prescribed leng h), ou pu s an answer (binary s ring of ano her prescribed leng h). Assuming ha unpredic able pseudo-random-bi genera ors exis 14 , hen no compu a ionally-bounded algori hm (even if i chooses he queries) may dis inguish he query-answer behavior of heir program from ha of a random oracle. Syn ac ically, i is herefore possible o have he random seed of heir cons ruc ion be he reference s ring of a CS proof sys em sharing a random s ring, and have heir polynomial- ime program added o he speci ca ion of (P V) so ha , whenever P or V wish o query oracle f abou a s ring x, hey jus run he 13
14
For ins ance, he assumed compu a ional di cul y of inte er factorization and ha of discrete lo arithms have been proved su cien for cons ruc ing, respec ively, digial signa ure schemes unforgeable under an adap ive chosen message a ack [11] and unpredic able pseudo-random number genera ors [5] And hus, hanks o resul of Has ad, Impagliazzo, Levin, and Luby [14], if one-way func ions exis
106
Silvio Micali
spe cied polynomial- ime cons ruc ion on inpu s he reference s ring and s ring x. No ice ha he so modi ed (P V) is qui e conceivably a CS proof-sys em wi h a random s ring, bu his is no a consequence of he discussed indis inguishableness of he pseudo-random oracle of [10] from a ruly-random oracle. In fac , such indis inguishabili y holds as long as he random seed of he pseudorandom oracle is kep secre , while iden ifying his seed wi h (P V)’s reference s ring makes i very public. And when i s seed is made public, some s a is ical proper ies of he corresponding pseudo-random oracle are des royed, while o hers are preserved.15 Le us emphasize ha random-oracle replacemen does no always work : Cane i, Goldreich and Halevi [6] have proven ha i is possible o cons ruc algori hms so ha hey behave very di eren ly when given access o a random oracle han when given access o any pseudo-random oracle wi h a public seed. In ligh of heir resul , i should be possible o cons ruc special CS proof-sys ems sharing a random oracle so ha hey canno be ransformed in o CS proofsys ems sharing a random s ring by replacing he oracle wi h a pseudo-random func ion.16 On he o her hand, i is known ha , under radi ional complexi y assumpions, here are examples in which random oracles can be successfully subs i u ed by pseudo-random ones.17
3
De nin CS Checkers
We s ar by de ning an ideal version of CS checkers, and hen show how o approxima e i in a su cien ly close manner. 3.1
The Wishful Version of a CS Checker
The spiri of a CS checker is bes conveyed wishfully assuming (for a second) ha N P equalled Co-N P. In ha case, our CS checkers would ake he following simple and appealing form. Wishful checkers. De ne a wishful checker o be a polynomial- ime algori hm C ha , on inpu a Boolean formula F , ou pu s a Boolean Formula F sa isfying he following wo proper ies: 15
16
17
Of course, for ins ance, if pseudo-random oracle P RO is indis inguishable from a random oracle when i s seed is secre , he sequence P RO(1) P RO(2) con inues o con ain roughly he same numbers of 0s and 1s af er i s seed is made public. No ice, however, ha his does no imply ha he same holds for every CS proofsys em wi h a random oracle; in par icular, for he men ioned (P V). E.g., a random oracle provides a collision-free hash func ion, bu such a func ion can be ob ained wi h a public-seed cons ruc ion under radi ional complexi y assump ions.
Compu a ionally-Sound Checkers
107
1 (Membership Reversion): F SAT i F SAT ; and 2 (Complexity Preservation): F is as hard o decide as F . How to use a wishful checker. We in erpre he above algori hm C as a kind of checker, because i immedia ely yields he following algori hm C 0 (more closely ma ching our in ui ion of a checker): C 0 : Given an e cien one-sided heuris ic for SAT, H, and an inpu formula, F , compu e F = C(F ). Then, call H so as o ob ain he wo values H(F ) and H(F ). If ei her value is di eren han NO, hen a sa isfying assignmen has been compu ed ei her proving ha F SAT or ha F SAT . Else, H(F ) = H(F ) = N O prove ha H is incorrec . No e ha , by he very de ni ion of a wishful checker, he above proof ha H is incorrec has been ob ained wi hou querying H on formulae no harder han he original inpu F . 3.2
The Informal Notion of a CS Checker
Le us now informally explain how, wi hou assuming N P = Co-N P, CS checkers may approxima e wishful ones o a su cien ly close ex en . Renouncing o achieving grea er generali y, we discuss CS checkers solely in he con ex of N Pcomple e languages, more par icularly, of SAT . CS checkers. Informally speaking, a CS checker is a polynomial- ime algori hm C ha , on inpu a formula F , ou pu s a Boolean formula F , called he co-input, sa isfying he following proper ies: 1 (Membership Semi-Reversion): 1.1 A leas one of F and F is sa is able; 1.2 If F is sa is able, hen no e cien algori hm has a non-negligible chance of nding a sa isfying assignmen for F ; and 2 (Complexity Semi-Preservation): If F SAT , hen F is as hard o decide as F . How to use a CS checker. We in erpre he above C as a checker because i immedia ely yields he following algori hm C 0 ( ha be er ma ches wha we may in ui ively expec from a checker). C 0 : Given an e cien one-sided heuris ic for SAT, H, and an inpu formula, F , compu e he co-inpu F = C(F ). Then, call H so as o ob ain H(F ). If H(F ) = N O, HALT (a proof ha F SAT has been found). Else, call H so as o ob ain H(F ) and HALT (if H(F ) = N O, hen a proof ha H is incorrec has been found; else, F can be in erpre ed o be unsa is able).
108
Silvio Micali
CS checkers are ood enou h. The compu a ion of he above C 0 resul s in ei her (1) showing a sa isfying assignmen of F , or (2) showing a sa isfying assignmen of F , or (3) showing ha H(F ) = H(F ) = N O. A ype-1 resul clearly proves ha F SAT . A ype-2 resul is in erpre able as saying ha F is unsa is able. This is so because, if F belonged o SAT, hen ei her a sa isfying assignmen of co-inpu F does no exis , or (by he very de ni ion of a cs checker) he probabili y ha i can be ob ained in polynomial ime is negligible. (No ice, in fac , ha C 0 is e cien because bo h C and H are.) A ype-3 resul proves ha H is wrong. In fac , if H(F ) = N O is correc , hen (by he very de ni ion of a cs checker) F SAT , and hus H(F ) = N O is incorrec . Moreover, if H is correct on F , our proof of H’s incorrec ness has been ob ained in a complexi y-preserving manner. We dis inguish wo cases: 1. If H is correc on F and H(F ) = N O, hen H(F ) is a (easy o verify) sa isfying assignmen of F , and hus C 0 does no call H on any co-inpu . Therefore, C vacuously does no call H on any F harder han F . 2. If H iscorrec on F and H(F ) = N O, hen F SAT , in which case (again by he de ni ion of a cs checker) F is guaran eed o have he same complexi y of F . If ins ead H is not correc abou our original inpu F , hen H(F ) = H(F ) = N O s ill is a proof of H’s incorrec ness, bu no necessarily one ob ained in a complexi y-preserving manner. No ice, however, ha lacking complexi y preserva ion in his case is of no concern: if H happens wrong abou our own original inpu , we are happy o prove ha H wrong in any manner.18 The complexity preservation of a CS Checker. To comple e our informal discussion of CS checkers we mus explain in wha sense, whenever F SAT , he complexi y of F is close o ha of F . Tha is, we mus explain (1) how we measure he complexi y of he original inpu , and (2) how he co-inpu preserves his complexi y. 1. Complexity Meters. The complexi y of he original inpu F is de ned o be he number of s eps made by a chosen deciding algori hm for SAT, D, on inpu F . Tha is, when a CS checker for SAT is given an inpu formula F , i also given as an addi ional inpu he descrip ion of his chosen D. We refer o D as the complexity meter. In fac , by specifying D, we (implici ly) pin down he complexi y of he original formula F . By insis ing ha D be a decider for SAT (i.e., ha D be correc ) we insis ha he complexi y of he original inpu be a genuine one.19 18
19
Recall ha in checking we care abou our own original inpu x more han abou H. Thus, if H(x) is correc we aim a proving his fac , and we do no wan o hrow H away by calling i on much harder inpu s. Bu if H(x) is wrong, we do no mind dismissing H in any way. Leas of all, we wan o be convinced ha H(x) is righ ! In par icular, if D were allowed o make errors, all formulae F could have cons an complexi y.
Compu a ionally-Sound Checkers
109
By properly choosing he complexi y me er, one may be able o force he complexi y of he original inpu o be small (and hus force he checker o query i s given heuris ic on a co-inpu of similarly small complexi y). Choosing D o be he algori hm ha ries all possible sa isfying assignmen s for F is cer ainly legi ima e, bu no oo meaningful. (Because any formula would have maximum complexi y rela ive o such a complexi y me er, he checker would essen ially be free o call i s given heuris ic on any possible coinpu .) Qui e di eren ly, if he original inpu F is known o belong o a class of formulae for which a given SAT algori hm performs very well (e.g., runs in sub-exponen ial ime), by specifying ha algori hm as our complexi y me er, we force he checker o call i s given heuris ic only on a co-inpu of similarly low complexi y. Le us s ress ha we do no require ha he checker, or someone choosing a complexi y me er D, know how many s eps D akes on he original inpu F . Nor do we require ha one dis inguish (somehow) for which inpu s, if any, algori hm D (slow in he wors case) may be reasonably fas . Ra her, we require ha , if F happens o belong o hose inpu s on which D is fas , hen i is his lower (and possibly unknown) complexi y ha should be preserved by a CS checker: By specifyin D one speci es implicitly the complexity of F , whatever it happens to be. For echnical reasons, however, we require ha D’s running ime be upperbounded by 22n , a bound ha essen ially poses no real res ric ions (in he sense ha , wi hin hese bounds, any algori hm for sa is abili y could alway be imed-ou and hen conver ed o an exhaus ive search for a sa isfying assignmen ). 2. Complexity Co-meters. The complexi y of a co-inpu F is de ned o be he number of s eps aken on inpu F by a decider for SAT, D, speci ed before hand. We refer o such a D as the complexity co-meter. Thus, a complexi y co-me er is independen of he chosen complexi y me er: he rs is xed once and for all (in fac , i could be made par of he very de ni ion of a CS checker), while he second is chosen afresh each ime a CS checker is run. Under hese circums ances, a rs glance, i may appear surprising ha a CS checker may succeed in keeping he complexi y of he co-inpu close o ha of he original inpu . Bu he xed co-me er D includes he code of he uniform algori hm, so ha , in a sense, he complexi y of a co-inpu is measured rela ive o a decider for SAT ha is easily cons ruc ed on inpu D . No ice ha one could conceive s a ing complexi y preserva ion by simply saying ha he number of s eps aken by a chosen D on he original inpu is polynomially close o he number of s eps aken by he same D on he co-inpu . This is in fac a simpler way of having he co-me er easily depend on he me er. However, we needed o endow CS checkers wi h a bi more room o maneuver han ha . In any case, we believe i preferable o have he me er ha is a xed componen of he CS checker o be a universal meter.
110
Silvio Micali
3.3
The Notion of a CS Checker
Preliminaries. We le CN F deno e he language of all formulae in conjunc ive normal form, and SAT he se of all sa is able formulae in CN F . If F SAT , hen we deno e by SAT (F ) he se of all sa is able assignmen s of F . For any posi ive in eger n, CN Fn and SATn will deno e, respec ively, all formulae in CN F and SAT whose binary leng h is n. By a SAT decider we mean an algori hm ha (correc ly) decides he language SAT . (Thus a SAT decider D needs no o be one-sided, and may ou pu jus YES or NO.) We say ha a SAT decider D is reasonable if, F CN F , #D(F ) 2jF j . If A is a probabilis ic algori hm, and E an even (involving execu ions of A on speci ed inpu s), by P robA [E] we deno e he probabili y of E, aken over all possible coin osses of A De nition 8: Le be a probabilis ic polynomial- ime algori hm, D a SAT decider, and Q( ) a posi ive polynomial. We say ha ( D Q) is a CS checker if, on inpu any CNF formula F , any reasonable SAT decider D, and any su cien ly long unary in eger k, ou pu s a formula F such ha he following hree proper ies hold: 1. F 2. F 3. F
F SAT ; SAT poly(k)-size circui s A, P rob [A(F ) SAT #D(F ) Q( F D k #D(F )).
If C = ( D Q) is a CS checker, we refer o and he complexity co-meter.
SAT (F )]
2k ; and
and D as, respec ively, he reducer
Remark: No e ha even Proper ies 1 and 2 alone (i.e., leaving aside Proper y 3) cons i u e an surprising s a emen abou SAT: informally, hey s a e ha from any formula F can be e cien ly ransformed o a formaul F such ha (1) a leas one of he wo is sa is able, bu (2) no e cien algori hm can nd a sa isfying assignmen for bo h. This is migh y close o saying ha N P = CoN P wi hou crossing ha line ! Bu he s a emen is even more in eres ing (and powerful) if (as expressed by proper y 3), F fur her has a complexi y close o ha of F .
4
Implementin CS Checkers for SAT
Le us recall some known proper ies of Cook’s and Levin’s N P-comple eness cons ruc ions. Key properties of Cook’s and Levin’s constructions. Given a polynomial- ime predica e A( ) and a posi ive cons an b, hese cons ruc ions consis of a polynomial- ime algori hm ha , on inpu a binary s ring
Compu a ionally-Sound Checkers
111
x, ou pu s a CNF formula ha is sa is able if and only if here is a binary s ring such ha x b and A(x ) = Y ES. We refer o such a s ring as a witness (for x). The cons ruc ion fur her enjoyes he following well-known proper ies (which are ac ually required by Levin’s de ni ion of N P-comple eness): (i) x is polynomial- ime re rievable from ; (ii) a proper wi ness for x is polynomial- ime compu able from any sa isfying assignmen for (if one exis s); and, (iii) a sa isfying assignmen for is polynomial- ime compu able from any proper wi ness for x (if one exis s). Theorem 4: If one-round CS proof-sys ems exis , hen CS checkers for SAT exis . The proof of Theorem 4 ac ually needs a more de ailed se up han we believe appropria e here. Accordingly, we shall prove i in he nal paper, and prove ins ead below a weaker version of i , having very much in he same spiri bu less de ails. Theorem 40 : If CS proof-sys ems sharing a random s ring exis , hen CS checkers for SAT exis . Proof: Le (P V ) be a CS proof-sys em sharing a random s ring wi h func6 , and consider he following algori hm. damen al cons an s c2
Al orithm Inputs:
F , a CNF formula, D, a reasonable SAT solver, and k, a unary s ring Subroutines: P and V Code: Randomly selec a k-bi (reference) s ring r for (P V ), and use Cook’s [7] or Levin’s [17] cons ruc ion o compu e a CNF formula F ha is sa is able if and only if here exis wo binary s rings t and such ha , se ing q = (F D N O t), he following hree proper ies hold: (1) t 2 F , (2) ( q k)c3 , and (3) V (q r ) = Y ES. Comment: If i exis s, is a CS cer i ca e of (D F N O t) L, rela ive o (P V ) and reference s ring r. The exis ence of such a , however, does no guaran ee ha D(F ) = N O.20 Le us now show ha here exis a SAT decider D and a posi ive polynomial Q such ha C = ( D Q) is a CS checker. 20
In fac , we expec ha exis s (and hus ha F 0 is sa is able) wi h overwhelming probabili y , even when F is sa is able.
112
Silvio Micali
To begin wi h, no ice ha , because of he polynomiali y of V and of Cook’s cons uc ion, is polynomial- ime.21 Fur her, because proper ies 1 and 2 of a CS checker only depend on i s reducer, le us show ha hey hold for our prior o de ning D and Q. Proper y 1 holds rivially if F SAT . Assume herefore ha F SAT . Then, because of he correc ness and running ime of he complexi y me er D, we have D(F ) = N O wi hin t 22n s eps. Thus, by he (feasible) comple eness of (P V ), for any possible reference s ring r here is a CS cer i ca e of q = (D F N O t) L. Thus, F SAT , proving ha Proper y 1 holds in all cases. Proper y 2 is es ablished by con rac ic ion. Assume ha here exis s an inpu formula F SAT and a poly(k)-size circui A ha , wi h non-negligible probabili y, compu es a sa ysfying assignmen of a so cons ruc ed co-inpu s F . Then, by proper y (ii) of Cook’s cons ruc ion, from such a sa isfying assignmen (if i exis s and is found) one compu es in polynomial ime bo h t and a CS cer i ca e of q = (D F N O t) L. Bu if F SAT , hen for no t is q = (D F N O t) L. Therefore, his con radic s he compu a ional soundness of (P V ). Le us nally show ha here exis a SAT decider D and a posi ive polynomial Q such ha , for all formulae F CN F , for all complexi y me ers D, and for all securi y parame ers k, if D, on inpu F , akes t ( 22jF j ) s eps o decide ha no sa isfying assignmen for F exis s, hen, given any co-inpu F of F , D nds a sa isfying assignmen for F in a mos Q( F D k t) s eps . Algori hm D works in four phases as follows: D1. Compu es F , D, and r from F . (Due o proper y (i) of Cook’s cons ruc ion, D can execu e his phase in ime polynomial in F . Thus, because F has been compu ed by C in ime polynomial in F , D and k, his phase is execu able in ime polynomial in F , D and k.) D2. Runs D on inpu F o nd he exac number of s eps, t, aken by D o ou pu NO on inpu F . (Because D can be simula ed wi h a slow-down polynomial in D , his phase akes ime polynomial in D and t.) D3. Run prover P on inpu q = (D F N O t) and reference s ring r o produce a CS cer i ca e, , of q L. (Due o he feasible comple eness of (P V ), his phase is execu able in ime polynomial in q , k and t; and hus in ime polynomial in F , D , k, and t.) D4. Use o compu e a sa isfying assignmen for F . (Due o proper y (iii) of Cook-Levin cons ruc ion, also his phase can be implemen ed in ime polynomial in F , D , and k.) 21
def
Indeed, de ne A( ) as follows: A((F D r) ( )) = V ((D F N O ) r ). No ice now ha A is polynomial- ime: in fac , V is he veri er of a CS proof sys em wi h a random s ring. No ice also ha is polynomially bounded in F , D and r : in fac q = (D F N O ), 2 F , and ( q k)c3 .
Compu a ionally-Sound Checkers
113
Because each phase is implemen able in ime polynomial in F , D , k, and t, here exis s a polynomial Q such ha D(F ) ou pu s a sa isfying assignmen of F in Q( F D k t) s eps. Finally no ice ha he above 4-phase procedure can be conver ed o a SAT decider by in erleaving wo di eren compu a ions. In he rs , an exhaus ive search is conduc ed for deciding whe her F is sa is able. In he second, F is in erpre ed as a co-inpu of F , and he above 4-phase procedure is run. The somodi ed D hal s when ei her compu a ion hal s, and ou pu s wha he hal ing compu a ion does.
4.1
Remarks
An alternative formulation. As we said, any CS checker C immedia ely yields an oracle-calling algori hm ha , on inpu a formula F (a complexi y me er D, and a securi y parame er k), and access o a one-sided e cien heuris ic H, compu es a co-inpu F and ob ains H(F ) and H(F ). Wi h his is mind, we can rephrase Theorem 40 as follows (and ob ain implici ly a de ni ion of a CS checker ha is more closely ailored o our impleme a ion). Corollary 20 : If CS proof-sys ems sharing a random s ring exis , hen here ) ha , whenever i s exis (1) a polynomial- ime oracle-calling algori hm C () ( rs inpu is a CN F formula, F , queries i s oracle a mos wice: once abou F , and possibly a second ime abou a second CNF formula F , (2) a SAT decider D, and a polynomial Q( ) such ha , one-sided heuris ics H for SAT , F CN F , reasonable SAT deciders D solving F in 22jF j s eps, su cien ly long unary in egers k, he following wo proper ies hold: 1. Individual-Complexity Preservation. If H is correc on F and C H (F D r) queries H abou a second CNF formula F , hen #D(F )
Q( F
D
r #D(F )).
2. Computational Meanin fulness. C H (F D r) produces one of he following hree ou pu s: (a) a sa isfying assignmen for F (i.e., a proof ha F is sa is able) (b) a CS proof, rela ive o (P V ) and reference s ring r, of D(F ) = N O (i.e., evidence ha F is no sa is able) (c) a formula F such ha , by cons ruc ion, ei her F or F is sa is able, and ye H(F ) = H(F ) = N O (i.e., a proof ha H is no correc ).
114
Silvio Micali
Unlike Blum checkers, he above oracle-calling algori hm C does no provide answers ha are correc wi h arbi rarily high probabili y (compu ed over i s possible coin osses). The ype-(a) and ype-(c) ou pu s of C are error-less, a leas in he sense ha any error here can be e cien ly de ec ed. Bu a ype-(b) ou pu of C, in erpre ed as a (compu a ionally) meaningful explana ion ha F is non-sa is able, may be wrong in a non-easily de ec able manner: if F is sa isable, C could ou pu a false CS proof of D(F ) = N O wi h posi ive probabili y. However, his probabili y is reasonably high only if an enormous amoun of compu a ion is performed, And in our applica ion, all compu a ion is performed by C, which is polynomial- ime, and by oracle H ha is also polynomial- ime. Therefore, he probabili y of a false ype-(b) ou pu is be absolu ely negligible. Another advanta e of one-sided heuristics. Our CS checkers only deal wi h one-sided heuris ics for SAT. As already discussed, given he one-sided na ure of N P, his is a na ural choice. On he o her hand, could we have deal wi h heuris ics jus ou pu ing YES (i.e., sa is able, bu wi h no proof ) or NO? So far, because of he self-reducibili y proper y of N P-comple e problems, choosing be ween ei her ypes of heuris ics has of en been a ma er of individual as e. Indeed, i is well known ha a decision oracle for SAT can, in polynomialime, be conver ed o a search oracle for SAT . As we explain below, however, his equivalence be ween decision and search rela ive o N P-comple e languages may cease o hold when one demands, as we do, ha our reduc ions preserve he complexi y of individual inpu s, ra her han jus ha of complexi y classes. When dealing wi h a one-sided e cien heuris ics H for SAT, assuming ha H is correc on F , we need only o ake care of complexi y preserva ion when H(F ) = N O. In fac , if H(F ) SAT (F ), hen here is no need o call H on any co-inpu F , and hus here is no complexi y o be preserved. Presumably, however, if H ou pu s jus YES and NO, we should care abou preserving F ’s complexi y also when H(F ) is correc and H(F ) = Y ES Now, o convince ourselves ha H(F ) = Y ES is correc , we could run he self-reducibili y algoFn (ob ained by xing a ri hm, calling H on a sequence of formulae F1 new variable each ime), so as o nd a sa isfying assignmen of F , or prove ha H is wrong (on ei her F or some F ). The problem is, however, ha his self-reducibili y process may no be complexi y-preserving: I may be he case ha our F is rela ively easy, while some of he F ’s are very hard. Indeed, i is conceivable ha i is he degree of freedom of he variables of he original formula F ha make i easy o decide (wi hou nding any N P-proof of i ) ha F is sa is able. However, af er su cien ly many variables of F have been xed, he di cul y of deciding sa is abili y may grow drama ically high ( hough la er on, when su cien ly many variables have been xed, i will drama ically drop). Extra complexity preservation. No ice ha , in he implemen a ion of he proof of Theorem 40 , he CS checker preserve he complexi y of he original inpu F in a much closer manner han demanded by our de ni ion. Indeed, a co-inpu
Compu a ionally-Sound Checkers
115
F in some sense, F 0 consis s of he very encoding of he compu a ion of he complexi y me er D on inpu F .22 One additional application. We believe ha complexi y preserva ion, in di eren formula ions, will be useful o o her con ex s as well. In par icular, i will enhance he meaningfulness of many reduc ions in a complexi y se ing. For ins ance, using complexi y preserva ion, [13] presen a more re ned no ion of a proof of knowledge [22] [20] [9] [1]. One open problem. Is i possible o (de ne and) cons ruc CS checkers ha , when given an heuris ic H and an inpu x, also receive a concise algori hmic represen a ion of a ( non- rivial ) se S, and call H only on x and elemen s of S? Such checkers could s ill be allowed o ou pu a proof ha he given heuris ic H is wrong.23 Bu , if H happens o be correc on S, and he given inpu happens o belong o S, hey should ou pu a valida ion for H(x) (ra her han a proof ha H is wrong).
References 1. M. Bellare and O. Goldreich. On De nin Proofs of Knowled e. Proc. CRYPTO 92, Lec ure No es in Compu er Science, Vol. 740, Springer Verlag, 1993, pp. 390-420. 2. M. Bellare and P. Rogaway. Random Oracles are Practical: a Paradi m for Desi nin E cient Protocols. 1st Conference on Compu er and Communica ions Securi y, ACM, pp. 62 73, 1993. 3. M. Blum and S. Kannan. Desi nin Pro rams that check their work. Proc. 21s Symposium on Theory of Compu ing, 1989, pp. 86-97. 4. M. Blum, M. Luby, and R. Rubinfeld. Self-Testin and Self-Correctin Pro rams, With Applications to Numerical Problems. Proc. 22nd ACM Symp. on Theory of Compu ing, 1990, pp. 73-83. 5. M. Blum and S. Micali. How to Generate Crypto raphically-Stron Sequences of Pseudo-Random Bits. SIAM J. on Comp. vol 13, 1984 6. R. Cane i, O. Goldreich, and S. Halevi. In Prepara ion. 1998 7. S. Cook. The Complexity of Theorem Provin Procedures. Proc. 3rd Annual ACM Symposium on Theory of Compu ing, 1971, pp. 151-158. 8. U. Feige, A. Fia , and A. Shamir. Zero-knowled e Proofs of Identity. Proc. of 19 h Annual Symposium on Theory of Compu ing, 1987, pp. 1987. 9. A. Fia and A. Shamir. How to Prove Yourselves: Practical Solutions of Identication and Si nature Problems. Proc. Cryp o 86, Springer- Verlag, 263, 1987, pp.186-194. 10. O. Goldreich, S. Goldwasser, and S. Micali. How To Construct Random Functions. J. of ACM 1986 11. S. Goldwasser, S. Micali, and R. Rives , A Di ital Si nature Scheme Secure A ainst Adaptive Chosen-Messa e Attacks, SIAM J. Compu ., Vol 17, No. 2, April 1988, pp. 281-308. 22
23
We wonder whe her his may yield a preferable formula ion of complexi y preserva ion. af er all, an heuris ic wrong everywhere should no be valida ed.
116
12. 13. 14.
15.
16. 17. 18.
19. 20.
21.
22.
23. 24.
25.
Silvio Micali (A preliminary version of his ar icle appeared wi h he i le A paradoxical soluion o he signa ure problem in Proc. of 25 h Annual IEEE Symposium on he Founda ions of Compu er Science, FL, November 1984, pp. 464-479.) O. Goldreich, S. Micali, and A. Wigderson. S. Halevi and S. Micali. A Stron er Notion of Proofs of Knowled e. Unpublished Manuscrip , 1997. J. Has ad, R. Impagliazzo, L.A. Levin and M. Luby. Construction of Pseudorandom Generators from any One-Way Function. To appear is SIAM J. On Comp. (This combines he works of Impagliazzo, Luby, and Levin, 21s Annual Symposium On Theory of Compu ing, 1989, and ha of Has ad, 22nd Annual Symposium On Theory of Compu ing, 1990.) R. Karp. Reducibility amon combinatorial problems. Complexi y of Compuyer Compu a ions, R. Miller and J. Tha cher eds., Plenum, New York, 1972, pp. 85103. R. Impagliazzo, J. Has ad, L. Levin, and M. Luby. Pseudo-Random Generation under uniform Assumptions. STOC 1990. L. Levin. Universal Sequential Search Problems. Problems Inform. Transmission, Vol. 9, No. 3, 1973, pp. 265-266. R. Lip on. New Directions in Testin . Dis ribu ed Compu ing and Cryp ography. (J. Feigembaum and M. Merri Ed.) Vol. 2 of Dimacs Series in Discre e Ma hema ics and Theory of Compu er Science. (Preliminary version: manuscrip 1989.) S. Micali, A Concrete Construction Of Computationally Sound Checkers. MIT-LC TM 579, 1998. M. Tompa and H. Woll. Random Self-Reducibility and Zero-knowled e Interactive Proofs of Possession of Information. Proc. 28 h Conference on Founda ions of Compu er Science, 1987, pp. 472-482. C. Cachin, S. Micali and M. S adler. Computational Private Information Retrieval Systems With Poly-Lo arithmic Amount of Communication. Manuscrip in prepara ion. 1998 S. Goldwasser and S. Micali and C. Racko . The Knowled e Complexity of Interactive Proof Systems. SIAM J. Compu ., 18, 1989, pp. 186-208. An earlier version of his resul informally in roducing he no ion of a proof of knowledge appeared in Proc. 17 h Annual Symposium on Theory of Compu ing, 1985, pp. 291-304. (Earlier ye versions include Knowledge Complexi y, submi ed o he 25 h Annual Symposium on he Founda ions of Compu er Science, 1984.) C. Lund and L. For now and H. Karlo and N. Nisan. Al ebraic Methods for Interactive Proof Systems. Proc. 22nd STOC, 1990. S. Micali. CS Proofs. Proc. 35 h Annual Symposium on Founda ions of Compu er Science, 1994, pp. (An earlier version of his paper appeared as Technical Memo MIT/LCS/TM-510. Earlier ye versions were submi ed o he 25 h Annual Symposium on Theory of Compu ing, 1993, and he 34 h Annual Symposium on Founda ions of Compu er Science, 1993.) A. Shamir. IP = PSPACE. Proc. 31s IEEE Founda ion of Compu er Science Conference, 1990, pp. 11-15.
Reasonin About the Past Mo ens Nielsen BRICS? Department of Computer Science University of Aarhus, Denmark
Abs rac . In this extended abstract, we briefly recall the abstract (cate orical) notion of bisimulation from open morphisms, as introduced by Joyal, Nielsen and Winskel. The approach is applicable across a wide ran e of models of computation, and any such bisimulation comes automatically with characteristic lo ics and ames, which in their eneral formulations treat the future and the past (of computations) on an equal footin . This raises a number of questions concernin properties of such lo ics and ames for concrete well known models from concurrency theory, in particular questions on the power of reasonin about the past.
1
Introduction
Concurrency theory is based on a number of di erent formal models of computation, e. . labelled transition systems [8], synchronization trees [12], Petri nets [18], event structures [24], and trace structures [11], just to name a few. Similarly, concurrency theory deals with an abundance of notions for behavioural equivalence, e. . bisimulation [12], trace equivalence [4], and pomset equivalence [19]. Durin the past decade, attempts have been made in order to understand the relationships between the confusin ly many di erent concepts within concurrency theory. Here, we shall recall briefly the cate orical approach of Winskel and Nielsen, with special emphasis on the abstract notion of bisimulation in terms of open morphisms [6], applicable to a wide ran e of models. Furthermore, we shall illustrate how to obtain automatically characteristic lo ics and ames for such models, followin [27]. The eneral idea is to equip a model of concurrency with morphisms, to be thou ht of as simulations between objects, so that it forms a cate ory [10]. This idea has proven to be be useful in many di erent ways, as illustrated in [25]. For instance, many operations of process calculi can be understood as universal constructions (like product and coproduct), providin a way of understandin (in terms of morphisms) how the behaviour of process relates to its components. Also, cate orical notions may be used in relatin di erent models, typically in the form of (co)reflections, statin how one model may be embedded into ?
Basic Research in Computer Science, Centre of the Danish National Research Foundation.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 117 128, 1998. c Sprin er-Verla Berlin Heidelber 1998
118
Mo ens Nielsen
another, i.e. viewed as a more abstract version , and allowin properties and constructions to be transferred between models via adjoints. The simulation morphisms studied in [25] are enerally too weak to yield useful abstract equivalences between processes. However, in [6], it is shown that the equivalences enerated by special open morphisms (rou hly speakin those morphisms which reflect as well as preserve behaviour), for eneral reasons, i.e. reasons applicable to all cate ories of models, yield notions of equivalence with a number of useful properties. The de nition of open morphisms is parameterised on a notion of computation paths for a iven model. In this extended abstract, we present just two examples of model cate ories, tree structures (an example of an interleavin model), and event structures (an example of an independence model). For interleavin models like tree structures, we follow tradition and take as computation paths (or runs) sequences of consecutive transitions, which we can think of as picked out by a morphism from a strin of action labels, with extension as standard extension of strin s of action labels. For an independence model like event structures, we take computation paths as con urations, or more enerally as a morphism from a pomset [19] to the event structure. Followin Pratt, a computation path in the form of a pomset can be extended in width (addin concurrent events) as well as hei ht (addin causally dependent events). For the examples treated here, our notions of bisimulations from open morphisms specialise to familiar concepts; in particular, on tree structures with strin s of actions as paths we obtain Park and Milner’s stron bisimulation. For eneral reasons, i.e. from the existence of co-reflections between models, these carry over to other models, e. . from tree structures to labelled transition systems, and from event structures to labelled Petri nets [16]. It should be noted that also other familiar behavioural equivalences are captured by the open morphism approach, e. . Hoare’s trace equivalence and Milner’s weak bisimulation, both of which may be obtained by sli htly chan in the notion of path extension from the one presented here [14]. Also, the open morphism approach has been applied successfully to di erent cate ories of models, e. . probabilistic systems [14], and timed systems [5]. Rather than havin our bisimulations de ned in terms of two parameters, a model and a path cate ory, it was su ested in [6] to study presheaves as models derived directly from path cate ories. In recent work by Winskel and others, these presheaf models have been used successfully in dealin with hi her-order models in concurrency [26,2]. Intuitively, a presheaf represents the e ect of luin to ether a set of computation paths to form a nondeterministic computation, and hence can be looked upon as labelled transition systems, in which the labels are morphisms of path extension. Followin [27] this yields lo ical and ame-theoretic characterisations of open morphisms and their bisimulations on presheaves. As we shall see, these operational characterisations in their eneral formulation treat the future and past of paths on an equal footin . Many models and their notion of bisimulation can be understood in a uniform way via their
Reasonin About the Past
119
representation as presheaves, and via this our characterisations can be specialised to concrete models like tree structures and event structures. The characteristic lo ics take the form of Hennessy-Milner like modal lo ics, with modalities indexed by path morphisms (path extensions, future modalities) and their inverses (path projections, past modalities). The idea of modal operators referrin to the past is certainly not new, and it has been studied extensively also in the context of concurrency durin recent years [9,23,17]. Here we focus on a few eneralisations of the characteristic lo ics with past modalities arisin form our eneral cate orical setup, and we illustrate the power of past modalities in the settin of independence models with a few undecidability results.
2
Models, Morphisms, and Computation Paths
Here we quickly describe the models and notions of computation paths we’ll use as illustratin examples. For the sake of presentation, we start out with the most eneral of our models, the (labelled) event structures of [13], and view the remainin notions as special instances of these. An event structure is to be thou ht of as describin the complete pattern of event occurrences of a nondeterministic and concurrent computation. It consists of a set of individual event occurrences, equipped with structure relatin any two events as bein either causally dependent, in conflict, or concurrent (sometimes also referred to as independent ). De nition 1. De ne an event structure to be a structure (E # L l) consistin of a set E, of events which are partially ordered by , the causal dependency relation, a binary, symmetric, irreflexive relation # E E, the conflict relation, which satisfy for all e e0 e00 E e0 e0
e is nite
e # e0
e00
e # e00
a set of labels, L, and a labellin function l : E L. Say two events e e0 0 0 0 e or e # e0 ). are concurrent, and write e co e , if (e e or e
E
The niteness assumption restricts attention to discrete processes where an event occurrence depends only on nitely many previous occurrences. The axiom on the conflict relation expresses that if two events causally depend on events in conflict then they too are in conflict. The labellin function as usual represents information about the type of individual events. Guided by our interpretation we can formulate a notion of computation state of an event structure ES = (E # L l). Takin a computation state of a process to be represented by the set of events which have occurred in the computation, we de ne the states (usually called the con urations and denoted C(ES)) to be those subsets x E satisfyin conflict-free: downwards-closed:
e e0 x (e # e0 ), and e0 x e e0 e0 e x
Morphisms on event structures are de ned in terms of a function tellin how the events of one system may be simulated in another [24].
120
Mo ens Nielsen
De nition 2. Let ES = (E # L l) and ES 0 = (E 0 0 #0 L l0 ) be event structures over a common labellin set L. A morphism from ES to ES 0 consists of a function from E to E 0 on events which respects labellin , i.e. for all e E, l(e) = l0 ( (e)), and satis es x
C(ES)
x
C(ES 0 ) & e0 e1 x (e0 ) = (e1 )
e0 = e1
Let EL denote the cate ory of event structures over labellin set L with morphisms as described above and composition as composition of functions. Notice, that con urations of an event structure can be thou ht of as pomsets in the sense of Pratt [19]. So, the subcate ory of nite pomsets naturally play the role of nite computation paths of event structures. Pomsets are special event structures with empty conflict-relations. More precisely, de ne PomL to be the full subcate ory of event structures with labels in L, and objects nite event structures with empty conflict-relation (i.e. pomsets). Morphisms between pomsets, ot by restrictin those of event structures, are injective functions which send downwards-closed sets to downwards-closed sets. Thus a morphism from pomset P to pomset Q may not just extend P by extra events but also relax the causal dependency relation; two events causally related in P may have ima es no lon er causally related in Q. Similarly, we may pick out a subcate ory of event structures as a model for sequential computations, by insistin on the co-relation bein empty. In this way any two events are either causally ordered or in conflict, i.e. may be viewed as a (labelled) tree structure (also referred to as a synchronisation tree [12]. De ne TL to be the full subcate ory of event structures with labels in L, and objects event structures with empty co-relation (i.e. tree structures). The notion of a computation (or a run) of a tree structure is traditionally its ( nite) paths, and hence we may choose naturally our notion of computation paths the subcate ory of strin s over L. De ne StrL to be the full subcate ory of tree structures with labels in L, and objects nite event structures with empty co- and conflict-relation (i.e. strin s). Morphisms between such paths, inherited from event structures, correspond to extensions of the associated strin s. So we can identify the cate ory of such paths with the (partial-order) cate ory of strin s L , where a morphism from strin s to strin t corresponds to s bein an initial pre x of t.
3
Open Morphisms and Bisimulation
Assume a cate ory of models M (as examples, think of either TL or EL from the previous section), and a subcate ory P , M of paths (as correspondin examples, think of either StrL or PomL ). De ne a path in an object X of M to be a morphism p : P X in M, where P is an object in P. A morphism f : X Y in M takes such a path p in X to the path f p : P Y in Y . The morphism f expresses the sense in which Y
Reasonin About the Past
121
simulates X; any computation path in X is matched by the computation path f p in Y . Our notion of open morphisms demand a stron er condition of a morphism f :X Y expressed in the followin path-liftin condition. For reasons which will become clear in the followin , we de ne open morphisms with respect to a subclass of morphisms P0 of P. Whenever, for m : P Q a morphism in P0 , a square p
P
X /
m
f q
Q
Y /
in M commutes, i.e. q m = f p, meanin the path f p in Y can be extended via m to a path q in Y , then there is a morphism p0 such that in the dia ram P m
Q
p /
~ ~~ ~ ~ ~~ ?
p0
q
/
X f
Y
the two trian les commute, i.e. p0 m = p and f p0 = q, meanin the path p can be extended via m to a path p0 in X which matches q. When the morphism f satis es this condition we shall say it is P0 -open. Say two objects X1 X2 of M are P0 -bisimilar i there is a span of P0 -open morphisms f1 f2 : X | BBB f f1 || BB 2 | BB || B || X1 X2 ~
Proposition 1. Two tree structures over the same labellin set L, are StrL bisimilar i they are stron ly bisimilar in the sense of Milner. Two event structures over the same labellin set L, are PomL -bisimilar i they are stron ly history preservin bisimilar in the sense of Bednarczyk. For the exact de nitions and proofs we refer here to [6,16] (and the characterisations provided in the followin ). From eneral cate orical results, Pbisimilarity is an equivalence relation for all models with pullbacks (includin TL and EL ), which is preserved by co-reflections, e. . unfoldin s from labelled transition systems into TL [6]. In checkin whether a morphism is P-open or for P-bisimulation, for a path cate ory P, it su ces to consider a restricted class of morphisms, su cient to enerate the cate ory P.
122
Mo ens Nielsen
De nition . Let P be a cate ory. Let P0 consist of a subclass of morphisms of P. Say P0 enerates P i the only subcate ory of P which includes P0 and all isomorphisms of P is P itself. Example 1. Morphisms of StrL and PomL are enerated as follows. Strin s: the cate ory StrL is enerated by the set of morphisms representin the extension of a strin by a sin le label. Pomsets: The cate ory PomL is enerated by the class of atomic morphisms of two kinds: pre x: morphisms m : P Q in PomL expressin that pomset P is a pre x of pomset Q, where Q contains one more event than P ; so m expresses that pomset Q consists of a copy of P with one additional event adjoined on top; au mentation: morphisms m : P Q in PomL expressin that pomset P is an au mentation of pomset Q, with the causal dependency relation in P containin one more pair than that of Q. Proposition 2. Suppose P is enerated by a subclass of morphisms P0 . 1. A morphism of M is P-open i it is P0 -open. 2. Objects of M are P-bisimilar i they are P0 -bisimilar. This proposition [27] allows us to limit the quanti cation over path extensions in the de nition of open morphisms, but the de nition of P-bisimilarity is still rather abstract. As we shall see in the followin , we may obtain more operational and concrete characterisations via models of presheaves over P viewed as transition systems.
4
Presheaf Models and Transition Systems
Given a path cate ory P, the cate ory P of presheaves over P [10] consists Set (where Set is the cate ory of sets with functions) as of functors Pop objects, and natural transformations between functors as morphisms. Intuitively Set can be thou ht of as specifyin for a typical path a presheaf F : Pop object P the set F (P ) of paths from P . It acts on a morphism m : P Q in P to ive a function F (m) : F (Q) F (P ) sayin how Q-paths restrict to P -paths. In the followin we assume that our path cate ories have an initial object I. This assumption is satis ed for our two examples of path cate ories, with the empty strin (pomset) as initial object in StrL (PomL ). A rooted presheaf is a presheaf F in which F (I) is a sin leton. Let us see how a model, like a tree structure or an event structure, ives rise to a rooted presheaf. Consider a cate ory of models M and a choice of path cate ory formin a subcate ory P , M. There is a canonical functor from the cate ory of models M to the cate ory of presheaves P. It takes an object X
Reasonin About the Past
123
of M to the presheaf M(− X) more intuitively, it takes the model X to the presheaf which for each path object P yields the set of paths M(P X) from P into X. The canonical functor takes a morphism f : X Y in M to the natural transformation M(− f ) : M(− X) M(− Y ) whose component at an object P of P is the function M(P X) M(P Y ) takin p to f p intuitively, a path p : P X in X is taken to a path f p:P Y in Y . In a presheaf model P we can consider the ima e of P under the Yoneda embeddin as its path cate ory, and then apply the eneral de nition of section 3, to obtain the class of P-open morphisms of the presheaf cate ory. They form a cate ory of open maps of the topos P, in the sense of Joyal and Moerdijk. For eneral reasons (basically because the embeddin s are full and dense), we et the followin from [27]. Proposition . (i) Two tree structures, over labellin set L, are StrL -bisimilar (i.e. stron bisimilar) i their correspondin presheaves, under the canonical embeddin , are related by a span of open morphisms in the full subcate ory of rooted presheaves of StrL . (ii) Two event structures, over labellin set L, are PomL -bisimilar (i.e. stron history-preservin bisimilar) i their correspondin presheaves, under the canonical embeddin , are related by a span of open morphisms in the full subcate ory of rooted presheaves of PomL . Importantly, there is a simple and intuitive way of thinkin of rooted presheaves as labelled transition systems. Formally, a transition system is a structure (S i L tran) where S is a set of states, i S the initial state, L is a set of labels, and tran S L S is the transition relation. As usual, we write s indicate that (s a s0 ) tran.
s0 to
Assume that P0 is a subclass of morphisms of P. It will be helpful to think of a rooted presheaf over P as a transition system with labels taken from morphisms of P0 : De nition 4. Let X be a rooted presheaf over P. De ne its P0 -transition system, denoted by TP0 (X) to consist of: states: (P p) where P is an object of P and p initial state: the unique member of X(I), labels: P0 , transitions: (P p) m (Q q) whenever m : P
X(P ), Q in P0 and (Xm)(q) = p.
124
Mo ens Nielsen
The construction of TP0 (X) allows us to view a rooted presheaf as a much more familiar model within computer science, a transition system. The states should be thou ht of as an abstract set of possible runs of the paths of P, and the transitions simply represent how such runs extend each other. Notice that rooted presheaves over strin s, StrL , correspond exactly to tree structures, TL , whereas PomL contains many structures not representable in EL , for details see [6].
5
Game and Lo ic Characterisations
Viewin presheaves as transition systems, we may lift existin notions of characteristic ames and lo ics of the kind discussed in [12] (for lo ic) and [21] (for ames and lo ic). Let T0 = (S0 i0 L0 tran0 ) and T1 = (S1 i1 L1 tran1 ) be two transition systems. The ame G(T0 T1 ) played by two players (I and II) is de ned as follows. The con urations of the ame consists of pairs of states (s0 S0 s1 S1 ) with (i0 i1 ) as the startin con uration. A play consists of a sequence of alternatin moves by the two players (Player I makin the rst move), where a move consists of a choice of a transition from one of the systems, accordin to the followin ame rules: At con uration (s0 s1 ) s00 , after which Player II chooses - either Player I chooses a transition s0 0 s1 , and the ame continues at con uration (s00 s01 ), a transition s1 s01 , after which Player II chooses a - or Player I chooses a transition s1 0 s0 , and the ame continues at con uration (s00 s01 ) transition s0 s0 , after which Player II chooses a - or Player I chooses a transition s00 s1 , and the ame continues at con uration (s00 s01 ) transition s01 s1 , after which Player II chooses a - or Player I chooses a transition s01 s0 , and the ame continues at con uration (s00 s01 ). transition s00 Player I wins a play if Player II ets stuck, i.e. at some point cannot match a move by Player I accordin to the rules of the ame. All other plays are won by Player II, i.e. all in nite plays and plays where Player at some point cannot make a move. A (history-free) strate y for a player is a set of rules which for each con uration tells the player how to proceed, i.e. for Player II a rule will associate to each con urations and a choice of back or forth transition in one of the systems by Player I, a set of matchin transitions in the other system. A strate y is winnin for a player, if he or she wins every play played accordin to the strate y. Intuitively, the two players have di erent oals in ame G(T0 T1 ): Player I wants to show that the two transition systems are distin uishable, Player II that they are not. Generalisin the results from [15] we et: Proposition 4. Let P0 enerate P. Two rooted presheaves in P are bisimilar i Player II has a winnin strate y in the ame de ned by their two P0 -transition systems.
Reasonin About the Past
125
Example 2. Games for synchronization trees and event structures are obtained from their canonical embeddin s in presheaf cate ories. However, usin properties of these concrete models, we may obtain even simpler ame characterisations. Tree structures: First of all, followin the ar uments of [3], in this case we can characterise bisimulation by restrictin our ames to only forwards moves, i.e. transitions labelled by extension morphisms. Secondly, we can apply Proposition 4 and further restrict the ames to allow only moves involvin extension with a sin le symbol, and nally such a morphism in the path cate ory is determined by its domain and the label of the extended sin le symbol. Hence, we have obtained the ori inal Stirlin ames characteristic for tree structures. Event structures: A ain, applyin Proposition 4 stron history-preservin bisimulation between event structures is characterised by ames with moves restricted to transitions labelled by atomic morphisms, i.e. pre x and au mentation morphisms. Furthermore, it can be shown that our ames can be even further restricted to only forwards and backwards transitions labelled by atomic pre x morphisms [6,15]. Similarly, as shown in [6], we may obtain characteristic lo ics in our eneral settin of presheaf models. De ne P0 -assertions by: A ::= m A
mA
A
Aj j2J
where m is a morphism in P0 , and J is an indexin set, possibly empty and not restricted to bein nite. The modality m is a backwards modality, while m is a forwards modality. We de ne the semantics with respect to a transition system with labellin set P0 : s = m A i s0 s m s0 and s0 = A s = m A i s0 s0 m s and s0 = A the boolean operations receive their expected meanin s. Notice that the lo ic takes the form of a kind of Hennessy-Milner lo ic, with modalities indexed by morphisms, and with a dual notion of backwards modalities. The followin eneral characterisation result was shown in [27]. Proposition 5. Let P0 enerate P. Two rooted presheaves in P are bisimilar i their P0 -transition systems satisfy the same assertions. Example 3. We determine a satisfaction relation for tree structures and event structures via their canonical embeddin s in presheaf cate ories StrL , PomL . A ain, we may use properties of our concrete models in obtainin simpli ed characteristic lo ics. Tree structures: Traditional Hennessy-Milner lo ic arises by reducin the seemin ly richer lo ic based on all extension morphisms in StrL . Firstly, as remarked
126
Mo ens Nielsen
earlier we can restrict to just the forwards modalities. Secondly applyin Proposition 5 we may restrict further to forward modal assertions of the form a A where a is a sin le label, observin that specifyin the label a to ether with either the domain of the morphism is enou h to determine the morphism in the path cate ory. Event structures: A ain it follows from the same line of reasonin as for the ame characterisations that stron history-preservin bisimulation of event structures is characterised by lo ic with forwards and backwards modalities labelled by atomic pre x morphisms. In the case where the event structures have no autoconcurrency (i.e. no concurrent events with the same label) the labels associated with the modalities can be simpli ed to sin le labels see [15]. It is important to notice, that our lo ic (and ame) characterisations for independence models like event structures depend crucially on the backwards moves and modalities, i.e. on reasonin about the past. Furthermore, satisfaction of assertions may be de ned for nite labelled transition systems via their (co-reflective) unfoldin s into tree structures, and for such systems we obtain characteristic lo ics by restrictin to binary conjunction. The same observation applies to nite independence models with co-reflective unfoldin s into event structures (e. . nite asynchronous transition systems [1,20]), with the semantic de nitions of satisfaction of assertions inherited via such unfoldin s. From an expressiveness point of view, the characteristic lo ics above are rather weak, in the sense that an assertion can only express properties of a nite part of the behaviour of a system. It is quite natural to look for extensions by includin lo ical operators quantifyin over in nite behaviours, e. . by addin xed-point operators to our lo ics, as in the -calculus [21]. Such extensions raises natural questions about expressiveness, satis ability, and model checkin , currently bein investi ated in joint work with M. Jurdzinski [7], from which we quote a few decidability results, illustratin the power of the backwards modalities in the settin of independence models. The common syntax of the characteristic lo ics for nitely enerated systems extended with a xed-point operator, has -assertions of the form A ::= a A
aA
A A0
A1 true X
XA
where a is a sin le label, X ran es over a set of variables (interpreted over sets of con urations), and X A denotes the least xed-point of the functional in X associated with the assertion A, followin standard de nitions. Example 4. Let us consider the questions of satis ability and model checkin for -assertions. Tree structures: We consider model checkin with respect to nite labelled transition systems, via their unfoldin s into trees. It can be shown that any -assertion can be constructively translated into a semantically equivalent assertion without any backwards modalities [7]. Hence the decidability of satis ability and model checkin follows from well known results for the standard -calculus.
Reasonin About the Past
127
Event structures: The correspondin model checkin problem considered here is with respect to nite asynchronous transition systems [1,20] (but our results apply equally to nite labelled elementary net systems [22], or a ran e of similar independence models with co-reflective unfoldin s into event structures). For assertions without backwards modalities, decidability results follow by reduction to the interleavin case above, since satisfaction is respected and reflected by unfoldin event structures into tree structures. In contrast, includin the backwards modalities both problems become undecidable [7].
6
Concludin Remarks
We have illustrated on a couple of examples, how notions of bisimilarity can be de ned followin a eneral pattern which automatically uarantees consistency and a number of useful properties, like characteristic ames and lo ics. We have seen how the eneral treatment of the past in such characterisations play di erent roles in concrete models. The preliminary results on the power of reasonin about the past in models with independence, opens up for a number of interestin questions, i.e. lookin for reasonable subclasses of decidable lo ics (and systems).
7
Acknowled ements
Most of the work on models, bisimulation, and presheaves presented here is based on joint work with G. Winskel, and the results reported on -assertions on joint work with M. Jurdzinski.
References 1. Bednarczyk, M., Cate ories of Asynchronous Systems. Ph.D. Thesis in Computer Science, Univ. of Sussex, Report No. 1/88, 1988. 2. Cattani, G.L., Fiore, M., Winskel,G., A Theory of Recursive Domains with Applications to Concurrency. To appear in Proceedin s of LICS’98. 3. De Nicola, R., Montanari, U., and Vaandra er, F., Back and Forth Bisimulations. Proceedin s of CONCUR’90, Sprin er Lecture Notes in Computer Science 458, pp. 152 165, 1990. 4. Hoare, C.A.R., Communicatin Sequential Processes. Prentice Hall,1985. 5. Hune, T., Nielsen, M., Timed Bisimulation and Open Maps. In this volume. 6. Joyal, A., Nielsen, M. and Winskell, G., Bisimulation from Open Maps. Information and Computation, 127, no. 2, pp. 164 185, 1996. 7. Jurdzinski, M., Nielsen, M., On the Power of Past Modalities. In preparation. 8. Keller, R.M., Formal Veri cation of Parallel Pro rams. CACM, 19(7), pp. 371 384, 1976. 9. Lichtenstein, O., Pnueli, A., and Zuck, L., The Glory of the Past. Sprin er Lecture Notes in Computer Science 193, pp. 196 218, 1985. 10. MacLane, S., and Moerdijk, I., Sheaves in eometry and lo ic: a rst introduction to topos theory, Sprin er, 1992.
128
Mo ens Nielsen
11. Mazurkiewicz, A., Basic notions of trace theory. In de Bakker, de Roever and Rozenber (eds.), Linear Time, Branchin Time and Partial Orders in Lo ics and Models for Concurrency, Sprin er Lecture Notes in Computer Science 354, pp. 285 363, 1988. 12. Milner,A.J.R.G., Communication and concurrency. Prentice Hall, 1989. 13. Nielsen, M., Plotkin, G. and Winskel, G., Petri nets, Event structures and Domains, part 1. Theoretical Computer Science 13, pp. 85 108, 1981. 14. Nielsen, M., Chen , A., Observin Behaviour Cate orically. Proc. of FST&TCS’15, Sprin er Lecture Notes in Computer Science 1026, pp. 263 278,1995. 15. Nielsen, M., and Clausen, C., Bisimulations, Games, and Lo ic. Proc. of CONCUR’94, Sprin er Lecture Notes in Computer Science 836, pp. 385 400, 1994. 16. Nielsen, M., and Winskel, G., Petri nets and bisimulations. Theoretical Computer Science, 153, pp. 211 244, 1996. 17. Penczek, W., Kuiper, R., Traces and Lo ic. In The Book of Traces, eds. Diekert, V., Rozenber , G., World Scienti c, pp. 307 390, 1994. 18. Petri, C.A. Kommunikation mit Automaten. PhD thesis, Institut f¨ ur Instrumentelle Mathematik, Bonn, Germany, 1962. 19. Pratt, V.R., Modellin concurrency with partial orders. International Journal of Parallel Pro rammin , 15(1), pp. 33 71, 1986. 20. Shields, M.W., Concurrent Machines, Comput. J., 28, pp. 449 465, 1985. 21. Stirlin , C., Games and Modal Mu-Calculus. Lecture Notes in Computer Science 1055, pp. 298 ., 1996. 22. Thia arajan, P.S., Elementary Net Systems. Sprin er Lecture Notes in Computer Science 254, pp. 26 59, 1986. 23. Vardi, M.Y., The Tamin of the Converse: Reasonin about Two-way Computations. Sprin er Lecture Notes in Computer Science 193, pp. 413 424, 1985. 24. Winskel, G., Event structures. Sprin er Lecture Notes in Computer Science 255, pp. 325 392, 1987. 25. Winskel, G., and Nielsen, M., Models for concurrency. In the Handbook of Lo ic in Computer Science, vol. IV, ed. Abramsky, Gabbay and Maibaum, Oxford University Press, pp. 1 148, 1995. 26. Winskel, G., A Presheaf Semantics of Value-Passin Processes. In the proc. of CONCUR’96, Sprin er Lecture Notes in Computer Science 1119, pp. 98 114, 1996. 27. Winskel, G., and Nielsen, M., Presheaves as Transition Systems, DIMACS Series in Discrete Mathematics and Theoretical Computer Science, 29, pp. 129 140, 1997.
Satis ability
Al orithms and Lo ic
(Extended Abstract) Pavel Pudlak Mathematical Institute Academy of Sciences Pra ue, Czech Republic
Abs rac . We present some recent results on al orithms for satis ability of k-CNF formulas: fastest probabilistic al orithms. We mention some results in proof complexity that can be used to derive lower bounds on classes of al orithms for satis ability.
1
Introduction
The sa is abili y problem is o de ermine for a given boolean formula whe her here exis s a sa isfying assignmen . In general we can consider formulas in arbirary basis, bu mos a en ion is given o CNF’s, ie., conjunc ions of disjunc ions of variables and nega ed variables. The disjunc ions are called clauses, he variables and nega ed variables are called literals. The se SAT of sa is able CNF’s was he rs se for which N P -comple eness was proved [2] and i is s ill he mos impor an N P -comple e se . Since i is an N P -comple e se we do no expec ha here can be found very e cien algori hms for i . Mos researchers believe ha here are only exponen ial algori hms for SAT , s ill we would like o know how much exponen ial hey mus be in general. This problem seems o have less s ruc ure han many o her combina orial problems. Therefore more res ric ed classes are considered, namely k-SAT, which is SAT res ric ed o conjunc ions of disjunc ions of size a mos k, also called k-CNF’s. I seems ha he bes algori hms can only achieve running ime which is a xed roo of he number of all assignmen s. In his lec ure we will describe some recen developmen s in design of algori hms for SAT . In par icular we shall men ion new probabilis ic algori hms which use much less ime han known de erminis ic ones. Then we shall consider he popular area of proof complexi y. Resul s in his area can be used o prove lower bounds for some classes of algori hms. Finally we shall men ion use of quan um compu a ions for SAT . Also we presen a new algori hm for 3-SAT which has worse running ime han previously know ones, bu i in roduces a new idea in his eld. The author was partially supported by rant A1019602 of the Academy of Sciences of the Czech Republic and by a joint rant of NSF (USA) and MSMT (Czech Rep.) INT-9600919/ME-103. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 129 141, 1998. c Sprin er-Verla Berlin Heidelber 1998
130
2
Pavel Pudlak
Deterministic Al orithms
2.1 Mos of he proposed algori hms for SAT can be viewed as ins an ia ions of he Davis Pu nam procedure.1 Davis Pu nam procedure is an algori hm which searches he ree of all assignmen s o proposi ional variables and a each s ep i checks if here is a clause which is false for he par ial assignmen so far cons ruc ed and i checks if all clauses are sa is ed. If one clause is false, he search of he branch s ops and he algori hm searches ano her branch. This is repea ed un il a sa isfying assignmen is found or all branches are excluded. When he clauses are shor (as in a k-CNF, for k cons an ) he algori hm abandons he par ial assignmen qui e of en and in his way i saves a lo of ime. The various applica ions of Davis-Pu nam procedure di er in he s ra egy by which we choose nex variable in he search process. We can also view he process as modifying he formula a each s ep when we assign new variable: we omi all clauses ha are rue and dele e all li erals ha are false in he remaining clauses. We back rack when an emp y clause appears. Eg. (x1 x2 ) ( x1 x3 x4 ), af er assigning x1 := 1, becomes x3 x4 . 2.2 The bes known such algori hm was described by Monien and Speckenmeyer [11] (see Algorithm A in he able below). The s ra egy of his algori hm is o choose he shor es clause (in some xed ordering of clauses) and he rs variable in his clause (in some xed ordering of variables). Suppose he rs xk . The following par ial assignmen s make shor es clause is C = x1 his clause rue 1, 01, 001, . . . 0 01 (wi h k − 1 zeros), while 0 00 (k zeros) makes i false. No e ha hese par ial assignmen s will be ac ually used, since af er assigning several 0’s he clause will no be sa is ed and i will s ill be he shor es one. Le Fk (n) be he number of s eps needed in he wors case. We + Fk (n − k). ge he following recurrence Fk (n) Fk (n − 1) + Fk (n − 2) + This is oo rough and can be easily improved by considering autark variables. These are variables which occur in all clauses wi h he same sign (ie. all wi hou nega ion, resp. all wi h nega ion). For such variables we know ha one of he values can be always used wha ever values we use for o her variables (posi ive, if he occurrences are posi ive and vice versa). More generally, an au ark par ial assignmen is an assignmen which makes any clause rue if he clause con ains some assigned variable. When considering assignmen s o variables o he clause C, rs we check if one of he assignmen s 1, 01, 001, . . . 0 01 is au ark ( his can be done e cien ly). If here is one, we ake i and we do no have o consider o hers. If no , hen any assignmen hi s ano her clause and does no make i rue. Such a clause is hen shor ened. Thus, excep possibly for he rs clause, 1
Apparently this procedure should rather be attributed to Davis, Lo emann and Loveland [4]. In this paper we shall use the traditional name havin in mind that it may not reflect the history quite accurately.
Satis ability
Al orithms and Lo ic
131
in each s ep we ei her have a clause of leng h a mos k − 1, or use an au ark assignmen , or we have a clause of leng h k and in he previous s ep we used an au ark assignmen . The au ark assignmen s save more ime han having clauses of shor er leng h, so we can upper bound he number of s eps by assuming ha in each s ep we consider a clause of leng h k − 1. Hence he recurrence is be er: + Fk (n − k + 1). In case of k = 3, his gives Fk (n) Fk (n − 1) + Fk (n − 2) + Fibonacci numbers. 2.3 Improvemen s have been considered mainly for he case of 3-SAT, see [16,17] (Algorithm B). The use of Davis-Pu nam procedures in all hese algori hms gives he impression ha his is he only possible way of designing a non rivial algori hm. Therefore we propose below a new algori hm for 3-SAT based on a di eren idea. Le he number of variables be n, w.l.o.g. suppose n is even and ha all clauses have leng h exac ly 3. The algori hm divides he variables in o wo equal par s (arbi rarily). For each of he par s akes he clauses which con ain variables only from his par and lis s all sa isfying assignmen s. This is done by considering all 2n 2 assignmen s one by one in each par . (We canno save much by using some sophis ica ed subrou ine here, as he number of sa isfying assignmen s can be so big.) For each of he wo par s we do he following. Take a sa isfying assignmen a for his par and look a he clauses which con ain exac ly wo variables in his par , hus having one variable in he o her par . If he clause is no sa is ed, hen he remaining variable is forced o have a par icular value. I may happen ha in his way a variable from he o her par is forced o be 0 by one clause and 1 by ano her. Then he assignmen a canno be ex ended o all variables and we discard i . O herwise we ex end i by all he forced values in he o her par . Thus we ge par ial assignmen s which assigns all variables on one par and some on he o her. Clearly, here is a sa isfying assignmen for he whole formula i here is a pair of consis en par ial assignmen one from one par he o her from he o her par . Thus he ask of nding a sa isfying assignmen reduces o he following ques ion. We have wo lis s of par ial assignmen s, each of size a mos 2n 2 . We have o nd a consis en pair consis ing of a par ial assignmen from one lis and a par ial assignmen from he o her lis . We suspec ha algori hms for such problems have been considered, bu we were no able o nd any rela ed resul . We will show ha one can solve his problem fas er han using he rivial procedure running in ime 2n . We shall use RAM as he compu a ion model. The bound ha one ge s from he algori hm ha we will ske ch below is worse han he bounds on previously considered algori hms for 3-SAT, bu very likely i can be signi can ly improved. Suppose we have wo se s of s rings of 0 1 of leng h n deno ed by A and B. In A he s rings have no ’s in he rs half and in B he s rings have no ’s in he second half. We wan o nd an a A and a b B which are consis en , ie., on each posi ion where bo h have a non- hey coincide. Le be
132
Pavel Pudlak
a sui able cons an such ha 0 1 2, he op imal value can be compu ed la er. For a b B which has less han (1 2 − )n ’s i is possible o nd a consis en s ring in A, if here is any, in abou 2(1 2− )n s eps. To his end we use a da a s ruc ure o represen A which is a binary ree of dep h n 2 wi h branchings corresponding o he rs n 2 coordina es and he leaves labelled by he remaining par s of he s rings. In he same way we can search for a consis en s ring for every a A which has less han (1 2 − )n ’s. Al oge her his will need a mos 2 2n 2 2(1 2− )n = 2n− n+1 s eps. If we do no nd a consis en pair we discard such s rings. Now each a A has a mos n 0’s and 1’s in he second half and each b B has a mos n 0’s and 1’s in he rs half. For each a A we replace he s ring a by s rings cons ruc ed as follows. Take a subse of coordina es in he rs half of size n and replace all en ries in he o her coordina es in he rs half by ’s. Do he same wi h s rings in B wi h he coordina es in he second half. Le he new se s be A resp. B . Then, clearly, here is a consis en pair (a b), a A, b B, i A B = . Finding he in ersec ion can be done e cien ly, eg., by sor ing he union of he wo lis s A and B, hence he main erm in he es ima e will be he size of he wo lis s which is n 2 2n 2+H( )n 2 2n 2 i n
where H is he binary en ropy func ion. Thus he op imal choice for is given by he equa ion 1 − 2 = H( ) and he running ime of he algori hm is O(20 83n ). There are several hings ha one may ry for ge ing an improvemen : nd a fas er algori hm for nding consis en pairs, use random par i ion in o wo se s of variables, bu he mos in eres ing would be o nd a way o i era e his divide and conquer s ra egy, as ha may lead o a subs an ial shor ening of he running ime.
3
Probabilistic Al orithms
3.1 Recen ly we proposed a simple algori hm which is essen ially he Davis-Pu nam procedure wi h es ed variables chosen in random order and assigned random independen values [12] (we shall call i Algorithm C). For 3-SAT he bes known de erminis ic algori hm Schiermeyer [17] is fas er, bu for k > 3 our algori hm bea s Monien Speckenmeyer [11], which is apparen ly he fas es algori hm for his case ha had been published. To explain he analysis of his algori hm, he bes is o s ar wi h he special case where here is an isola ed sa isfying assignmen o a k-CNF formula. This means ha in Hamming dis ance 1 here is no sa isfying assignmen . We ske ch an es ima e on he probabili y ha his assignmen is found. For a sa isfying assignmen a o a CN F formula we say ha C is a critical clause of on a, if exac ly one li eral of C is rue on a. Tha li eral and i s variable will also be called critical. I is easily seen ha for an isola ed sa isfying
Satis ability
Al orithms and Lo ic
133
assignmen each variable is cri ical in some clause. More generally, if a is an arbi rary sa isfying assignmen and here is no sa isfying assignmen which di ers from a only in he value of x , hen x is a cri ical variable of some clause for a. The cri ical clauses help us o save some bi s when searching for a sa isfying assignmen . If we assign successively values o variables and i happens ha we have so far assigned values according o some sa isfying assignmen a and i also happens ha we have assigned all variables of a cri ical clause for a excep for i s cri ical variable, hen he value of he cri ical variable is de ermined and we do no have o make choice. Fix an a and a cri ical clause C of leng h k. If we ake a random order hen wi h probabili y 1 k he cri ical variable will be he las among he variables of C. If a is isola ed, hen every variable is cri ical for some clause so we shall save in he average n k bi s. I is no di cul o urn his in ui ive argumen o a rigorous proof of an upper bound 2(1−1 k)n+o(n) for he expec ed running ime of he algori hm nding an isola ed sa isfying assignmen . For he decision problem we ge a bound of his form wi h superexponen ially small probabili y of error. In general we do no know ha here is an isola ed sa isfying assignmen . If here is no isola ed sa isfying assignmen , hen each sa isfying assignmen has a neighbour and he less i is isola ed he more neighbours i has. When here are many sa isfying assignmen s, hen we are very likely o hi one by he random choice. I urns ou ha he rade-o be ween isola ion and number of sa isfying assignmen s works well and we ge exac ly he same bound in general. This can be seen as follows. Consider some ordering of variables and an assignmen a. Le x be a variable and le a0 be he par of a before x . We shall call a variable x forced, if a0 forces he value for x , because x is he las variable of some clause which is no ye sa is ed by a0 , ie., x appears as he las variable in some cri ical clause, where x is he cri ical variable. We shall call a variable branchin , if bo h a0 0 and a0 1 can be ex ended o a sa isfying assignmen . O herwise he variable is called free. For a random order he average ra io of free variables o forced variable is a mos (k − 1) : 1. To hi a sa isfying assignmen we need o guess he free variables only. Thus he wors case is really when here is only one sa isfying assignmen . A modi ca ion of algori hm C gives apparen ly he bes bound p for polynomial size CN F ’s wi h unbounded leng hs of clauses, namely 2n− n for an > 0. Here is a ske ch of he algori hm and i s analysis. Firs choose randomly half of he variables. Then ry sys ema ically all assignmen s o hese variables. A s andard simple argumen shows ha he probabili y ha a clause of size n isp no sa is ed by a random assignmen o he chosen variables is a mos p 2−Ω( n) , i.e., here are a mos 2n 2−Ω( n) such par ial assignmen s for which here are s ill some long clauses remaining. For such par ial assignmen s we sys ema ically search assignmen s for he remaining variables. For he o hers, we are lef wi h a pn-CNF and we will nd a sa isfying assignmen in he n expec ed ime 2(1−1 n) 2 by Algori hm C.
134
Pavel Pudlak
3.2 Algori hm C is so simple ha i surely mus be possible o improve i . One possible direc ion has been considered and a subs an ial improvemen has been achieved. The idea is o consider assignmen s which are more isola ed for some d > 1 here no o her sa isfying assignmen s in Hamming dis ance d. In order o ge a be er performance i does no su ce o use he simple algori hm above. We shall use i , bu rs we have o pre-process he formula. This consis s in deriving new clauses using resolu ion. Resolu ion is in some sense a dual procedure o Davis-Pu nam, we shall say more abou i la er. Le us jus recall ha he basic rule of resolu ion produces from wo clauses having a complemen ary li eral a new clause which is he union of he wo clauses less he wo complemen ary li erals. In he preprocessing phase we derive all clauses which can be derived wi hou exceeding he clause size k d . In his way we ob ain new, sligh ly longer clauses which enhance he probabili y ha a variable is forced in he random process. In order explain he idea, le us consider only a single applica ion of he x2 x3 be a cri ical clause for he assignmen resolu ion rule. Le C1 = x1 11111 1, which we assume o be isola ed. In his clause x1 is cri ical. Then x2 mus also be cri ical for some clause, say for C2 = x2 x xj . We can resolve x3 x xj . This is again a cri ical clause in case he wo clauses and ge x1 x1 . However 1 = i j. O herwise he clause is a au ology as i con ains x1 here is no way o ensure he las condi ion, hence we have o do some hing else. If here is no sa isfying assignmen in dis ance 2, here mus be a clause C3 which is no sa is ed by 00111 1. C3 mus con ain some posi ive li erals, hence i con ains x1 and/or x2 . If i con ains x2 , we resolve C3 wi h C1 and we surely ge a cri ical clause wi h he cri ical variable x1 . If no , hen C3 is already a cri ical clause wi h he cri ical variable x1 and i is di eren from C1 . Thus we always have a new cri ical clause, herefore he value of x1 is more likely o be forced. Le us deno e he search problem o nd a sa isfying assignmen for k-CNF’s having exac ly one sa isfying assignmen by unique-k-SAT. In par icular for unique-3-SAT we ge an algori hm (Algorithm D) wi h expec ed running ime O(20 387n ), while algori hm C gives only 22n 3+o(n) . The analysis of he above algori hm is no simple and i is even much harder o analyze he algori hm for general k-CNF’s, where no isola ion is guaran eed. Un il now i was possible o ge asymp o ically he same bounds for k-SAT as for unique-k-SAT only for k > 4. For k = 3 4 he cons an s are worse han in he case of unique sa isfying assignmen s. The bes bound ob ained so far for 3SAT is O(20 446n ), never heless, already his bea s he bes previous algori hm of Schiermeyer [17]! This proof was ob ained by a compu er search, bu i is possible o bea he bes previous record wi hou a compu er search if one is sa is ed wi h only O(20 533n ). I seems likely ha he case of he unique sa isfying assignmen s is he wors one also for k = 3 4.
Satis ability
Al orithms and Lo ic
135
3.3 As usual, one would like o know if randomness is really needed. Pu o herwise, can we derandomize hese algori hms? In case of he algori hms for nding isola ed sa isfying assignmen s, i is fairly easy. A closer look a he proof reveals ha we do no need o ake he ordering comple ely randomly. For cri ical clauses of leng h k we need only ha each ordering of a subse of k variables occurs equally likely (since we use he expec a ion of he number of forced variables). If k is a cons an , here are polynomial size probabili y spaces which have his proper y and which can be cons ruc ed in polynomial ime. For general k-SAT i is a much more di cul ask. Consider only he special case when he sa isfying assignmen s have a lo of neighbours, so we can use only he fac ha here are many of hem. To derandomize his par icular case we need o cons ruc a small hittin set for such se s of assignmen s. The cons ruc ion of such se s is no known. Ins ead of derandomizing algori hm C direc ly, we can use he following idea [12], (we shall call i Algorithm E). We shall look for minimal sa isfying assignmen s, ie., hose which have he minimal number of 1’s. Then we use he following argumen : ei her here is a minimal solu ion wi h few 1’s and hen we can nd i by searching he small se of all such assignmen s, or a minimal assignmen has a lo of 1’s and hen i has large isola ion as i is isola ed a leas in he coordina es which have value 1. Unfor una ely his gives worse cons an s in he exponen han he randomized algori hm C, see he able.
4
Circuit Complexity
The probabilis ic algori hms were discovered when working on he complexi y of dep h 3 AND OR NOT circui s. Valian observed long ime ago ha proving large lower bounds on such circui s would have in eres ing consequences. In par icular a lower bound 2n o(lo lo n) on dep h 3 circui s compu ing a boolean func ion of n variables implies ha he func ion canno be compu ed by a linear size p log-dep h circui . Since 1986 [7] he bes lower bounds are only of he form 2c n for a cons an c. The progress has been achieved only in improving he cons an c. A circui of dep h 3 wi h op ga e OR is an OR of CNF’s, hus be er unders anding of CNF’s helps o improve lower bounds on such circui s. By considering isola ed (Hamming dis ance 1) sa isfying assignmen s o k-CNF’s he complexi y of he pari y func ion has been de ermined up o a mul iplica ive cons an : he p minimal size of dep h 3 circui s compu ing pari y of n bi s is of he order n1 4 2 n , see [12] (previously even p he bes cons an in he exponen was no known). In [13] a lower bound Ω(2c n ) wi h c > 1 was proved for BCH codes of small noncons an minimal dis ance. I is ra her paradoxical ha improving lower bounds on circui complexi y is connec ed wi h improving upper bounds on algori hms for SAT .
136
5
Pavel Pudlak
Lo ic of Al orithms
5.1 A big achievemen of proof complexi y is he resul ha every algori hm for 3SAT based on Davis-Pu nam procedure has wors case complexi y a leas 2c n for a posi ive cons an c. This follows from a resul of Urquhar [19] which uses ideas of Tsei in [18] and Haken [6]. I is wor hwhile o explain his resul in more de ails. The propositional resolution calculus is he sys em based on he resolu ion rule described above. Successive applica ions of he rule produce new clauses from a given se of clauses. The sys em is comple e in he sense ha for any clause C which logically follows from a given se i is possible o derive a subclause of C. The sys em is sound, which means ha i is possible o derive only clauses which logically follow from he given se . We consider also he emp y clause which has no li erals and which represen s falsehood. Thus a se of clauses is unsa is able i he emp y clause can be derived. Hence we can prove ha a CNF is unsa is able: ake he se of clauses of he formula and derive he emp y clause. Proving ha a formula is unsa is able is he same as proving ha he nega ion is sa is able by all assignmen s, ie., he nega ion is a tautolo y. The size of a resolu ion proof is he number of clauses, including he ini ial ones, ha are used in order o derive he emp y clause. Resolu ion can be used o prove ha 2-SAT is in P . The poin is ha resolu ion of wo clauses of leng h a mos 2 is a clause of leng h a mos 2 oo. The number os such clauses is bounded by a polynomial, so we can sys ema ically genera e hem all. A connec ion wi h resolu ion and Davis-Pu nam algori hms is given by he following proposi ion. Proposition 1. Suppose that a Davis-Putnam al orithm stops on an unsatis able CN F after N steps. Then there exists a resolution proof of unsatis ability of size N . Proof. Le T be he search ree on an unsa is able formula . This means ha for each leaf of T here is a clause of which is false under he par ial assignmen given by he branch leading o he leaf. We shall pick one such clause for every leaf and ex end his labelling o every ver ex of he ree as follows. Le v be he paren of u and w, wi h a clause C he label of u and a clause D he label of w. Le x be he variable according o which he ree branches a v. If x does no occur in C (resp. D) we label v by C (resp. D). If bo h con ain x , hey con ain i wi h di eren signs. Then we resolve C wi h D using x and use he resul as he label of v. This labelling has he proper y ha he clause C belonging o a ver ex v is false under he par ial assignmen given by he pa h from he roo o v. As he roo de ermines he emp y par ial assignmen , i can only be labelled by he emp y clause. Thus he labelling is a resolu ion proof of unsa is abili y of .
Satis ability
Al orithms and Lo ic
137
Now i su ces o use a lower bound on resolu ion proofs. Le us observe ha Davis-Pu nam algori hms produce resolu ion proofs in a ree form, while he lower bound on resolu ion proofs is for general proofs. Theorem 1 ([19]). There exists a sequence of tautolo ies n which are kDNF’s, contain d n variables, for some constants k d, and for some positive constant c, every resolution proof of n has size at least 2cn . I follows ha every Davis-Pu nam algori hm mus use a leas 2cn s eps before i rejec s he CN F ob ained by nega ing n . The au ologies can be cons ruc ed explici ly. They express he easy fac ha in a graph he number of ver ices of odd degree mus be even. This au ology canno be expressed by a k-DNF wi h a cons an k, herefore he s a emen is res ric ed o subgraphs of special graphs of cons an degree where we also x which ver ices have odd degree (i su ces o have exac ly one). 5.2 Ano her general framework for solving N P -problems is inte er linear pro ramin . The basic idea here is o represen he problem by linear inequali ies wi h ra ional coe cien s so ha he solu ions of he problem are encoded as inte er solu ions of he inequali ies. The fac ha solving linear inequali ies in he domain of ra ional numbers ( he linear pro ramin problem) can be done e cien ly helps in some cases, bu no always. I is necessary o use some rules which are valid only for in eger solu ions. The mos popular one among such sys ems is he cuttin plane sys em. In his sys em one can derive new inequali ies by aking posi ive linear combina ions and round down he cons an erm in he inequali y, if all coe cien s a variables are in egers. For his sys em unsolvable se s of inequali ies have been cons ruc ed which do no have subexponen ial proofs of unsolvabili y [14]. I follows ha any algori hm for k-SAT based on hese rules has wors case running ime a leas 2n , for some absolu e > 0, which can be de ermined from he lower bound on cu ing plane proofs. Of course, an 1 would be algori hm for k-SAT wi h running ime 2n wi h any cons an a sensa ional resul . Thus here is a lo of room for improving, mos likely he lower bounds. For o her sys ems for in eger linear programing i is s ill an open problem o prove non rivial lower bounds. 5.3 Ano her popular algori hm, especially in algebra, is Buchberger’s algori hm for cons ruc ing a Gr¨ obner basis of an ideal of polynomials. In logic we res ric ourselves o he domain 0 1 . In erms of polynomial equa ions his means ha we assume equa ions x2 = x for every variable x . The na ural logical framework for Buchberger’s algori hm in he domain of 0 1 is called he polynomial calculus. In his calculus we derive polynomials from a given se of polynomials by
138
Pavel Pudlak
adding polynomials ha have been derived and by mul iplying a polynomial ha have been derived by an arbi rary polynomial. A con radic ion is reached, when we derive a cons an nonzero polynomial. Exponen ial lower bounds on proofs in polynomial calculus have been recen ly ob ained [15,9], hence we can again conclude ha any direc use of he Gr¨ obner basis algori hm canno produce an algori hm for k-SAT running in subexponen ial ime. 5.4 Fix some su cien ly general class of formulas, eg. DNF’s, and le T AU T be he se of au ologies in his class. A proposi ional proof sys em is, roughly speaking, a nonde erminis ic algori hm for T AU T . More precisely i is a polynomial T AU T which is on o and polynomial ime ime compu able func ion f : compu able, and is a ni e alphabe [3]. We say ha w is a proof of f (w) in he sys em de ermined by f . In concre e sys ems no all s rings are proofs, bu we can always modify he sys em by saying ha nonsensical s rings are proofs of some defaul au ology. We have considered hree concre e proof sys ems resolu ion, cu ing planes and polynomial calculus which cover cer ain ypes of algori hms. For a general algori hms we observe: 1. Every algori hm for SAT de ermines a proof sys em. Namely, for a T AU T , he proof of is he compu a ion of he algori hm on inpu ( he compu a ion ha shows ha is no sa is able). 2. Every algori hm is based on an idea, a heory, assump ions e c., which are used o prove he soundness of he algori hm. This can be used o de ermine he logical framework, the lo ic of the al orithm, which can be urned in o a proof sys em. So far we have only one ype of pairs consis ing of an algori hm and a proof sys em: a Davis-Pu nam algori hm and he resolu ion proof sys em. If we could nd more such pairs, we could show ha o her ypes of algori hms have o run in exponen ial ime, since exponen ial lower bounds have been proved for several o her proof sys ems. In order o nd a proof sys em for an algori hm, i is always possible o apply he idea in observa ion 2. One can express he ma hema ical assump ion in a rs order heory and hen cons ruc a proposi ional proof sys em from i using well-known means (see [10]). Unfor una ely ha would resul in a very s rong proof sys em for which we are no able o prove any lower bounds. A more promising way of nding a na ural proof sys em for a given algori hm is o analyze he compu a ions and ry o urn hem in o proofs of some familiar proof sys ems. The following problems illus ra e wha I have in mind. Problem 1. Do randomized algori hm provide some proofs? In par icular, he algori hm C is jus randomized Davis-Pu nam procedure, does i provide resolu ion proofs on unsa is able formulas?
Satis ability
Al orithms and Lo ic
139
Problem 2. By derandomizing and sligh ly modifying he algori hm C, we obained he de erminis ic algori hm E. Does his algori hm provide resolu ion proofs on inpu s ha i rejec s? Maybe i gives a leas bounded dep h Frege proofs?
6
Quantum Speed-Up
I is well-known ha SAT is a self reducible problem, herefore he search problem is equally di cul as he decision problem. I is no surprising hen ha all so far proposed algori hms are based on some search procedure. Recen ly Grover [5] proved an in eres ing general resul on quan um compu a ions. He showed ha nding a unique elemen in a da abase of N elemen s can be done in expec ed ime O( N ) using quan um compu a ions. More precisely he ime is O(t N ), where t is an upper bound on he ime needed o check for an elemen if i belongs o he da abase ( hink of a da abase as a subrou ine). I follows ha some problems for which we use search, can be solved fas er. For ins ance, nding a sa isfying assignmen o a formula wi h n variables can be done on quan um compu ers in expec ed ime 2n 2+o(n) , where we can consider arbi rary polynomial size formulas, or even circui s. Le us recall ha he bes probabilis ic algori p hm ha we know for he sa is abili y of CNF’s runs in expec ed ime 2n− n for some > 0. I seems unlikely ha an N P -comple e problem would have a polynomial ime quan um algori hm. S ill quan um algori hms may be subs an ially fas er han he de erminis ic ones. An in eres ing ques ion is when we can combine a non rivial classical algori hm wi h Grover quan um search algori hm o ge a fas er algori hm. Le us analyze only he probabilis ic algori hm C for he unique-3-SAT and leave o hers o he reader. For his i is very easy o use quan um search o ge a square roo speed-up (Algorithm Q). Take a random ordering of variables. In he favourable case, which occurs su cien ly of en, 1 3 of he variables will be forced if we assign successively he values of he unique sa isfying assignmen . So we need only o nd 23 n bi s. To nd hem we search he 2 2 3 n s rings using Grover’s quan um search. Thus we ge a quan um algori hm running in expec ed ime 2n 3+o(n) .
7
Conclusions
In his shor survey we have considered only he mos popular discipline in he area of algori hms for SAT , namely he ime complexi y measured in erms of he number of variables of he formula and we have considered he wors inpu s. A lo of research has been done on random ins ances of SAT , including bounds on he leng hs of resolu ion proofs [1]. There are also resul s on algori hms for SAT where ime is measured in erms of he number clauses or in erms of he leng h of he formula [8]. There has also been a lo of experimen al work done in his area. While he experimen al work may be useful for prac ical applica ions,
140
Pavel Pudlak
say, when he inpu s can be considered random, i does no reveal very much on he behaviour of he algori hms on wors inpu s. Consider for ins ance he popular idea of assigning he value o a variable which makes more clauses con aining he variable rue. More precisely, in some process of assigning values o variables, suppose ha x = 0 will make k clauses con aining x rue and x = 1 will make l clauses con aining x rue. Then choose x = 0 i k > l. The following formula shows ha he such an algori hm would perform very badly on some ins ances. Suppose he number of variables is divisible by 3. Divide he variables in blocks of size 3 and on each block force he only sa isfying assignmen o be 111. Thus he only sa isfying assignmen of he formula will consis of all 1’s. This formula has 7n 3 clauses. Now add all clauses of size 3 which con ain exac ly one posi ive li eral. Thus mos variables will appear nega ively, hence improving he sa isfying assignmen locally wi h he above rule will lead away from he sa isfying assignmen . The mos promising and rewarding area for fu ure research seems o be he lower bounds for various classes of algori hms. As shown in Sec ion 5 several ools for such lower bounds have been developed and now we should ry o ge igh er bounds for classes of algori hms for which we do have lower bounds and de ermine more classes o which he echniques can be applied.
8
Table
The able below gives he cons an c in he upper bounds 2cn+o(n) on he expec ed running ime of some algori hms considered above for k-SAT. The number in paren heses is for unique-3-SAT. k 3 4 5
A B C D E Q .695 .582 .667 .446 (.387) .896 .334 .879 .75 .917 .375 .947 .8 .651 .931 .4
Acknowledgment I would like o hank o Oleg Verbi ski for reading he manuscrip and poin ing ou several misprin s and errors.
References 1. P. Beame, R. Karp, T. Pitassi and M. Saks, On the complexity of unsatis ability proofs for random k-CNF formulas, Proc. 30-th STOC, 1998, to appear. 2. S.A. Cook, The complexity of theorem provin procedures, Proc. 3-rd STOC, 1971, 151-158. 3. S.A. Cook and A.R. Reckhow, The relative e ciency of propositional proof systems, J. of Symbolic Lo ic 44(1), 1979, 36-50.
Satis ability
Al orithms and Lo ic
141
4. M. Davis, G. Logemann and D. Loveland, A machine pro ram for theorem provin , Communications of the ACM 5, 1962, 394-397. 5. L.K. Grover, A fast quantum mechanical al orithm for database search, Proc. 28-th STOC 1996, 212-218. 6. A. Haken, The intractability of resolution, Theor. Computer Science, 39, 1985, 297-308. 7. J. Hastad, Almost optimal lower bounds for small depth circuits, Proc. 18-th STOC, 1986, 6-20. 8. E.A. Hirsch, Two new upper bounds for AT , Proc. 9-th SODA, 1998, to appear. 9. R. Impagliazzo, P. Pudlak and J. Sgall, Lower Bounds for the Polynomial Calculus and the Groebner Basis Al orithm, to appear in Computational Complexity. 10. J. Kraj cek, Bounded arithmetic, propositional lo ic, and complexity theory, Cambrid e Univ. Press 1995. 11. B. Monien and E. Speckenmeyer, Solvin satis ability in less than 2n steps, Discrete Applied Math. 10, 1985, 287-295. 12. R. Paturi, P. Pudlak and F. Zane, Satis ability codin lemma, Proc. 38-th FOCS, 1997, 566-574. 13. R. Paturi, P. Pudlak, M.E. Saks and F. Zane, An improved exponential-time al orithm for k-SAT, preprint, 1998. 14. P. Pudlak, Lower bounds for resolution and cuttin planes proofs and monotone computations, J. of Symb. Lo ic 62(3), 1997, 981-998. 15. A. A. Razborov, Lower bounds for the polynomial calculus, to appear in Computational Complexity. 16. I. Schiermeyer, Solvin 3-Satis ability in less than 1 579n steps, CSL’92, LNCS 702, 1993, 379-394. 17. I. Schiermeyer, Pure literal look ahead: An O(1 497n ) 3-satis ability al orithm, preprint, 1996. 18. G.C. Tseitin, On the complexity of derivations in propositional calculus, Studies in mathematics and mathematical lo ic, Part II, ed. A.O. Slisenko, 1968, 115-125. 19. A. Urquhart, Hard examples for resolution, J. of ACM 34, 1987, 209-219.
The Joys of Bisimulation Colin Stirlin Department of Computer Science, University of Edinbur h, Edinbur h EH9 3JZ, UK,
[email protected]. c.uk
1
Introduction
Bisimulation is a rich concept which appears in various areas of theoretical computer science. Its ori ins lie in concurrency theory, for instance see Milner [20], and in modal lo ic, see for example van Benthem [3]. In this paper we review results about bisimulation, from both the point of view of automata and from a lo ical point of view. We also consider how bisimulation has a role in nite model theory, and we o er a new unde nability result.
2
Basics
Labelled transition systems are commonly encountered in operational semantics of pro rams and systems. They are just labelled raphs. A transition system is a a pair T = (S − : a A ) where S is a non-empty set (of states), A is a a is a binary relation on S. non-empty set (of labels) and for each a L − a a 0 0 We write s − s instead of (s s ) − . Sometimes there is extra structure in a transition system, a set of atomic colours Q, such that each colour q S (the subset of states with colour q). Bisimulations were introduced by Park [23] as a small re nement of the behavioural equivalence de ned by Hennessy and Milner in [14] between basic CCS processes (whose behaviour is a transition system). De nition 1 A binary relation R between states of a transition system is a bisimulation just in case whenever (s t) R and a A, a
a
1. if s − s0 then t − t0 for some t0 such that (s0 t0 ) a a 2. if t − t0 then s − s0 for some s0 such that (s0 t0 )
R and R.
In the case of an enriched transition system with colours there is an extra clause in the de nition of a bisimulation that it preserves colours: if (s t) R then 0 for all colours q s
q i
t
q
Simple examples of bisimulations are the identity relation and the empty relation. Two states of a transition system s and t are bisimulation equivalent (or bisimilar), written s t, if there is a bisimulation relation R with (s t) R. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 142 151, 1998. c Sprin er-Verla Berlin Heidelber 1998
The Joys of Bisimulation
143
One can also present bisimulation equivalence as a ame G(s0 t0 ), see for example [30,28], which is played by two participants, players I and II. A play of (s t ) . G(s0 t0 ) is a nite or in nite len th sequence of the form (s0 t0 ) Player I attempts to show that the initial states are di erent whereas player II wishes to establish that they are equivalent. Suppose an initial part of a play is (s0 t0 ) (sj tj ). The next pair (sj+1 tj+1 ) is determined by one of the followin two moves: a
Player I chooses a transition sj − sj+1 and then player II chooses a trana sition with the same label tj − tj+1 , a Player I chooses a transition tj − tj+1 and then player II chooses a trana sition with the same label sj − sj+1 . The play continues with further moves. Player I always chooses rst, and then player II, with full knowled e of player I’s selection, must choose a correspondin transition of the other state. A play of a ame continues until one of the players wins. In a position (s t) if one of these states has an a transition and the other doesnt then s and t are clearly distin uishable (and in the case of an enriched transition systems if one of these states has a colour which the other doesnt have then a ain they are distin uishable). Consequently any position (sn tn ) where sn and tn are distin uishable counts as a win for player I, and are called I-wins. A play is won by player I if the play reaches a I-win position. Any play that fails to reach such a position counts as a win for player II. Consequently player II wins if the play is in nite, or if the play reaches the position (sn tn ) and neither state has an available transition. Di erent plays of a ame can have di erent winners. Nevertheless for each ame one of the players is able to win any play irrespective of what moves her opponent makes. To make this precise, the notion of strate y is essential. A strate y for a player is a family of rules which tell the player how to move. However it turns out that we only need to consider history-free strate ies whose rules do not depend on what happened previously in the play. For player I a rule is therefore of the form at position (s t) choose transition x where x is a a s − s0 or t − t0 for some a. A rule for player II is at position (s t) when a a player I has chosen x choose y where x is either s − s0 or t − t0 and y is a correspondin transition of the other state. A player uses the strate y in a play if all her moves obey the rules in . The strate y is a winnin strate y if the player wins every play in which she uses . Proposition 1 For any ame G(s t) either player I or player II has a historyfree winnin strate y. Proposition 2 Player II has a winnin strate y for G(s t) i
s
t.
Transition systems are models for basic process calculi, such as CCS and CSP. Models for richer calculi capturin value passin , mobility, causality, time, probability and locations have been developed. The basic notion of bisimulation
144
Colin Stirlin
has been eneralised, often in a variety of di erent ways, to cover these extra features. Bisimulation also has a nice cate orical representation via co-al ebras due to Aczel, see for example [25], which allows a very eneral de nition. It is an interestin question whether all the di erent brands of bisimulation are instances of this cate orical account. In this paper we shall continue to examine only the very concrete notion of bisimulation on transition systems.
3
Bisimulation Closure and Invariance
It is common to identify a root of a transition system (as some special start state). Above we de ned a bisimulation on states of the same transition raph. Equally we could have de ned it between states of di erent transition systems. When transition systems are rooted we can then say that two systems are bisimilar if their roots are. A family of rooted transition raphs is said to be closed under bisimulation equivalence when the followin holds: if T
and T
T 0 then T 0
Given a rooted transition system there is a smallest transition system which is bisimilar to it: this is its canonical transition raph which is the result of rst removin any states which are not reachable from the root, and then identifyin bisimilar states (usin quotientin ). An alternative perspective on bisimulation closure is from the viewpoint of properties of transition systems. Properties whose transition systems are bisimulation closed are said to be bisimulation invariant. Over rooted transition raphs, property is bisimulation invariant provided that: if T =
and T
T 0 then T 0 =
(By T = we mean that is true of the transition raph T .) On the whole, countin properties are not bisimulation invariant, for example has 32 states or has an even number of states . In contrast temporal properties are bisimulation invariant, for instance will eventually do an a-transition or is never able to do a b-transition . Other properties such as has an Hamiltonian circuit or is 3-colourable are also not bisimulation invariant. Later we shall be interested in parameterised properties, that is properties of arbitrary arity. We xn ) on transition systems is bisimulation say that an n-ary property (x1 invariant provided that: sn ] and t1 tn are states of T 0 and if T = [s1 s for all i : 1 i n then T 0 = [t1 tn ] t sn ] we mean that is true of the states s1 sn of T ). (By T = [s1 xn is a An example of a property which is not bisimulation invariant is x1 cycle , and an example of a bisimulation invariant property is x1 is lan ua e equivalent to x2 . The notions of bismulation closure and invariance have appeared independently in a variety of contexts, see for instance [2,3,4,7,22].
The Joys of Bisimulation
4
145
Caucal’s Hierarchy
Bisimulation equivalence is a very ne equivalence between states. An interestin line of enquiry is to re-consider classical results in automata theory, replacin lan ua e equivalence with bismulation equivalence. These results concern de nability, closure properties and decidability/undecidability. Grammars can be viewed as enerators of transition systems. Let Γ be a nite family of nonterminals and assume that A is a nite set (of terminals). A a where , Γ and a A. A state is basic transition has the form − then any member of Γ , and the transition relations on states are de ned as the least relations closed under basic transitions and the followin pre x rule: PRE if
a
−
then
a
−
Given a state we can de ne its rooted transition system whose states are just the ones reachable from . In the table below is a Caucal hierarchy of transition raph descriptions accordin to how the family of basic transitions is speci ed. In each case we assume a nite family of rules. Type 3 captures nite-state raphs, Type 2 captures context-free rammars in Greibach normal form, and Type 1 12 , in fact, captures pushdown automata. For Type 0 and below this means that in each case there are nitely many basic transitions. In the other cases 1 and 2 are re ular a stands expressions over the alphabet Γ . The idea is that each rule 1 − a − : for the possibly in nite family of basic transitions 1 and a a − : 1 − 2 stands for the family 1 and 2 . For instance a a Type −1 rule of the form X Y − Y includes for each n 0 the basic transition a X nY − Y . Basic Transitions a Type −2 1 − 2 a Type −1 1 − a Type 0 − a 1 Type 1 2 − where = 2 and a Type 2 X − a a Type 3 X − Y or X −
>0
This hierarchy is implicit in Caucal’s work on understandin context-free raphs, and understandin when the monadic second-order theory of raphs is decidable [5,4,6]. With respect to lan ua e equivalence, the hierarchy collapses to just two levels, the re ular and the context free. The families between, and includin , Type 2 and Type −2 are equivalent. The standard transformation from pushdown automata to context free rammars (Type 1 21 to Type 2) does not preserve bisimulation equivalence. In fact, with respect to bisimilarity pushdown automata is a richer family than context
146
Colin Stirlin
free rammars. For instance, normed1 Type 2 transition systems are closed under canonical transition systems. Caucal and Monfort [7] show that this is not true for Type 1 21 transition systems: see [4] for further results about canonical transition raphs. Caucal showed in [5] that Type 0 transition systems coincide (up to isomorphism) with Type 1 21 . There is a strict hierarchy between Type 0 and Type −2. Therefore, with respect to bisimulation equivalence there are ve levels in the hierarchy. Baeten, Ber stra and Klop proved that bisimulation equivalence is decidable on normed Type 2 transition systems [1]. The decidability result was eneralized in [9] to encompass all Type 2 raphs. Groote and H¨ uttel proved that other standard equivalences (traces, failures, simulation, 2 3-bisimulation etc..,) on Type 2 raphs are all undecidable [13]. The most recent result is by Senizer ues [27], who shows that bisimulation equivalence is decidable on Type −1 transition systems (which eneralises his proof of decidability of lan ua e equivalence for DPDA [26]). This leaves as an open question whether it is also decidable for Type −2 systems. One can build an alternative hierarchy when a sequence Γ is viewed as a a multiset. In which case the rule PRE above is to be understood as if − a − where is multiset union. Christensen, Hirshfeld and then Moller showed that bisimulation equivalence is decidable on Type 2 raphs [8]. H¨ uttel proved that other equivalences are undecidable [16]. Type 0 raphs are Petri nets. Jancar showed undecidability of bisimilarity on Petri nets [17]. Under this commutative interpretation, Type 0 and Type 1 12 transition systems are not equivalent. Hirshfeld (utilizin Jancar’s technique) showed undecidability of bisimulation for Type 1 21 systems, for more details see the survey [21].
5
Lo ics
Bisimulations were independently introduced in the context of modal lo ic by van Benthem [2]. A variety of lo ics can be de ned over transition raphs. Let M be the followin family of modal formulas where a ran es over A: ::= tt
1
2
a
The inductive stipulation below de nes when a state s has a modal property , written s =T , however we drop the index T . s s s s 1
= tt = = Ψ = a
i i i
s= s = or s = Ψ a t s − t and t =
A state is terminal if it has no transitions. A state s is normed if for all s such w u that s − s for some w A , then there is a terminal such that s − for some u A .
The Joys of Bisimulation
147
This modal lo ic is known as Hennessy-Milner lo ic [14]. In the context of an enriched transition system one adds propositions q for each colour q Q to the lo ic, with semantic clause: s = q i s q. Bisimilar states have the same modal properties. Let s M t just in case s and t have the same modal properties. Proposition 1 If s
t then s
M
t.
The converse of Proposition 1 holds for a restricted set of transition systems. A a state s is immediately ima e- nite if for each a A the set t : s − t is nite. w And s is ima e- nite if every member of t : w A s − t is immediately ima e- nite. Proposition 2 If s and t are ima e- nite and s
M
t then s
t.
These two results are known as the modal characterisation of bisimulation equivalence, due to Hennessy and Milner [14]. (There is also an unrestricted characterisation result for in nitary modal lo ic. And there are less restrictive notions than ima e- niteness for when characterisation holds, see [12,15].) The modal lo ic M is not very expressive. For instance it cannot de ne safety or liveness properties on transition systems which have been found to be very useful when analysin the behaviour of concurrent systems. Modal mu-calculus, M, introduced by Kozen [19], has the rquired extra expressive power. The new constructs over and above those of M are: ::= Z
Z
where Z ran es over a family of propositional variables, and in the case of Z there is a restiction that all free occurrences of Z in are within the scope of an even number of ne ations (to uarantee monotonicity). The semantics of M is extended to encompass the least xed point operator Z. Because of free variables valuations, V, are used which assi n to each variable Z a subset of states in S. Let V[S Z] be the valuation V 0 which a rees with V everywhere except Z when V 0 (Z) = S. The inductive de nition of satisfaction stipulates when a process E has the property relative to V, written E =V , and the semantic clauses for the modal fra ment are as before (except for the presence of V). s =V Z s =V Z
i s V(Z) i S S if s
S then t
S t
S and t =V[S
Z]
The stipulation for the xed point follows directly from the Tarski-Knaster theorem, as a least xed point is the intersection of all pre xed points. (A ain we would add atomic formulas q if we are interested in extended transition systems.) The bisimulation characterisation result above, Propositions 1 and 2, remain true for closed formulas of M.
148
Colin Stirlin
Second-order propositional modal lo ic, 2M, is de ned as an extension of M as follows: ::= Z
2
Z
[a] : a A , and is The modality 2 is the reflexive and transitive closure of included so that 2M includes M. As with modal mu-calculus we de ne when s =V . The new clauses are: s =V 2 s =V Z
w
t w A if s − S S s =V[S Z]
i i
t then t =V
The operator Z is a set quanti er, ran in over subsets of S. There is a strai htforward translation of M into 2M. Let Tr be this translation. The important Z) Z). case is the xed point: Tr( Z ) = Z (2(Tr( ) Formulas of M and closed formulas of M are bisimulation invariant (from Proposition 1 and its eneralisation to M). This is not true in the case of 2M, for it is too rich for characterisin bisimulation: for instance, a variety of countin properties are de nable, such as has at least two di erent successors under an a transition . This means that two bisimilar states need not have the same 2M properties. Besides modal lo ics we can also consider other lo ics over transition systems. First-order lo ic, FOL, over transition systems contains binary relations Ea for each a A (and monadic predicates q(x) for each colour q if extended transition systems are under consideration). Formulas have the form: ::= xEa y
x=y
1
2
x
xn ) with at most free variables x1 xn will be true or A formula (x1 sn in the usual way. false of transition system T and states s1 Richer lo ics include rst-order lo ic with xed points, FOL, where there is the extra formulas: ::= Z(x1
xk )
Z(x1
xk )
(y1
yk )
In the case of Z( ) ( ), there is the same restriction as in M that all free occurrences of Z in lie within the scope of an even number of ne ations. An alternative extension of rst-order lo ic is monadic second-order lo ic, 2OL, with the extra formulas: ::= Z(x1 )
Z
Van Benthem’s use of bisimulation was to identify which formulas of FOL are equivalent to modal formulas (to M formulas), see the survey [3]. A formula (x) is equivalent to a modal formula 0 provided that for any T and for any state s, T = [s] i s =T 0 . Proposition 3 A FOL formula (x) over transition systems is bisimulation invariant i is equivalent to an M formula.
The Joys of Bisimulation
149
This result was eneralised by Janin and Walukiewicz [18] to 2OL and M, as follows: Proposition 4 A 2OL formula (x) over transition systems is bisimulation invariant i it is equivalent to a closed M formula. One corollary of this result is that the bisimulation invariant (closed) formulas of 2M coincides with closed formulas of M. An interestin question is if there is also a characterisation of the bisimulation invariant formulas of FOL. (See [22] for preliminary results but over nite models.)
6
Finite Model Theory
Finite model theory is concerned with relationships between complexity classes and lo ics over nite structures. It is interestin to consider bisimulation invariance in the context of nite model theory. Rosen showed that Proposition 3 of the previous section remains true with the restriction to nite transition systems [24]. It is an open question whether Proposition 4 also remains true under this restriction. Part of the interest in relationships between M and 2M or 2OL with respect to nite transition systems is that within 2M and 2OL one can de ne NPcomplete problems: examples include 3-colourability on nite connected undirected raphs. Consider such a raph. If there is an ed e between two states s a a and t let s − t and t − s. So in this case A = a , and 3-colourability is iven by: X
Y
2((X
Z (
[a] X)
[a] Y )
(Y
(Z
[a] Z)))
where , which says that every vertex has a unique colour, is
2((X
Y
Z)
(Y
Z
X)
(Z
X
Y ))
In contrast, M formulas over nite transition systems can only express PTIME properties. An interestin open question is whether there is a lo ic which captures exactly the PTIME properties of transition systems. Otto has shown that there is a lo ic for the PTIME properties that are bisimulation invariant [22]. The ri ht settin is FOL over canonical transition systems (where = is , and a linear orderin on states is thereby de nable). We now consider emaciated nite transition systems whose set A is a sinleton. That is now T = (S − ) where S is nite. We can de ne lan ua e n equivalence on emaciated transition systems. Let s − t, when n 0, if there 0 is a sequence of transitions of len th n from s to t (and by convention s − s). A state is terminal if it has no transitions. The lan ua e of state s is the set L(s) = i 0 : s − t and t is terminal . Consequently, s and s0 are lan ua e equivalent if L(s) = L(s0 ). The property x is lan ua e equivalent to y as was
150
Colin Stirlin
noted earlier is bisimulation invariant. Notice that this is an example of a dyadic invariant property. Proposition 1 Lan ua e equivalence on (canonical) nite transition raphs is co-NP complete. Hence lan ua e equivalence over nite transition systems is de nable in FOL i PTIME = NP. Dawar o ers a di erent route to this observation [10]. A classical result (due to Immermann, Gurevich and Shelah) in a sli htly normalised form is: yn ) over nite transition systems is Proposition 2 A FOL formula Ψ (y1 xm ) (y1 yn u)) where equivalent to a formula of the form u ( Z(x1 xm free. is rst-order and contains at most x1 The ar ument places in the application ( ) from n + 1 to m are all lled by the same element u. This allows for the arity of the de nin xed point m to be lar er than the arity of the FOL formula n. Consequently, if one can prove that y is lan ua e equivalent to z , Ψ (y z), is xm ) (y z u)), not de nable by a FOL formula in normal form, u ( Z(x1 then this would show that PTIME is di erent from NP. As a rst step, we have proved the followin usin tableaux: Theorem 1 Lan ua e equivalence Ψ (y z) is not de nable in FOL by a normal formula of the form u ( Z(x1 x2 x3 ) (y z u)). Acknowled ement: I would like to thank Julian Brad eld and Anuj Dawar for help in understandin nite model theory.
References 1. Baeten, J., Ber stra, J., and Klop, J. (1993). Decidability of bisimulation equivalence for processes eneratin context-free lan ua es. Journal of Association of Computin Machinery, 40, 653-682. 2. van Benthem, J. (1984). Correspondence theory. In Handbook of Philosophical Lo ic, Vol. II, ed. Gabbay, D. and Guenthner, F., 167-248, Reidel. 3. van Benthem, J. (1996). Explorin Lo ical Dynamics. CSLI Publications. 4. Burkart, O., Caucal, D., and Ste en, B. (1996). Bisimulation collapse and the process taxonomy. Lecture Notes in Computer Science, 1119, 247-262. 5. Caucal, D. (1992). On the re ular structure of pre x rewritin . Theoretical Computer Science, 106, 61-86. 6. Caucal, D. (1996). On in nite transition raphs havin a decidable monadic theory. Lecture Notes in Computer Science, 1099, 194-205. 7. Caucal, D., and Monfort, R. (1990). On the transition raphs of automata and rammars. Lecture Notes in Computer Science, 484, 311-337. 8. Christensen, S., Hirshfeld, Y., and Moller, F. (1993). Bisimulation is decidable for basic parallel processes. Lecture Notes in Computer Science, 715, 143-157. 9. Christensen, S., H¨ uttel, H., and Stirlin , C. (1995). Bisimulation equivalence is decidable for all context-free processes. Information and Computation, 121, 143148.
The Joys of Bisimulation
151
10. Dawar, A. (1997). A restricted second-order lo ic for nite structures, To appear in Information and Computation. 11. Emerson, E., and Jutla, C. (1988). The complexity of tree automata and lo ics of pro rams. Extended version from FOCS ‘88. 12. Goldblatt, R. (1995). Saturation and the Hennessy-Milner property. In Modal Lo ic and Process Al ebra, ed. Ponse, A., De Rijke, M. and Venema, Y. CSLI Publications, 107-130. 13. Groote, J., and H¨ uttel, H. (1994). Undecidable equivalences for basic process al ebra. Information and Computation, 115, 354-371. 14. Hennessy, M. and Milner, R. (1985). Al ebraic laws for nondeterminism and concurrency. Journal of Association of Computer Machinery, 32, 137-162. 15. Hollenber , M. (1995). Hennessy-Milner classes and process calculi. In Modal Lo ic and Process Al ebra, ed. Ponse, A., De Rijke, M. and Venema, Y. CSLI Publications, 187-216. 16. H¨ uttel, H. (1994). Undecidable equivalences for basic parallel processes. Lecture Notes in Computer Science, 789. 17. Jancar, P. (1994). Decidability questions for bisimilarity of Petri nets and some related problems. Lecture Notes in Computer Science, 775, 581-594. 18. Janin, D. and Walukiewicz, I (1996). On the expressive completeness of the propositional mu-calculus with respect to the monadic second order lo ic. Lecture Notes in Computer Science, 1119, 263-277. 19. Kozen, D. (1983). Results on the propositional mu-calculus. Theoretical Computer Science, 27, 333-354. 20. Milner, R. (1989). Communication and Concurrency. Prentice Hall. 21. Moller, F. (1996). In nite results. Lecture Notes in Computer Science, 1119, 195216. 22. Otto, M. (1997). Bisimulation-invariant ptime and hi her-dimensional -calculus. Preliminary report RWTH Aachen. 23. Park, D. (1981). Concurrency and automata on in nite sequences. Lecture Notes in Computer Science, 154, 561-572. 24. Rosen, E. (1995). Modal lo ic over nite structures. Tech Report, University of Amsterdam. 25. Rutten, J. (1995). A calculus of transition systems (towards universal coal ebra). In Modal Lo ic and Process Al ebra, ed. Ponse, A., De Rijke, M. and Venema, Y. CSLI Publications, 187-216. 26. Senizer ues, G. (1997). The equivalence problem for deterministic pushdown automata is decidable. Lecture Notes in Computer Science, 1256, 671-681. 27. Senizer ues, G. (1998). Γ (A) Γ (B)? Draft paper. 28. Stirlin , C. (1996). Modal and temporal lo ics for processes. Lecture Notes in Computer Science, 1043, 149-237. 29. Stirlin , C. (1996). Games and modal mu-calculus. Lecture Notes in Computer Science, 1055, 298-312. 30. Thomas, W. (1993). On the Ehrenfeucht-Fra¨sse ame in theoretical computer science. Lecture Notes in Computer Science, 668.
Towards Al orithmic Explanation of Mind Evolution and Functionin (Extended Abstract) Jir Wiedermann Institute of Computer Science Academy of Sciences of the Czech Republic Pod vodarenskou vez 2 , 182 07 Prague 8, Czech Republic e mail w eder@u vt.cas.cz
‘Any scienti c theory of the mind has to treat it as an automaton.’ (P. Johnson Laird [6], 1983, p. 477) Abs rac . The cogitoid is a computational model of cognition introduced recently by the author. In cogitoids, knowledge is represented by a lattice of concepts and associations among them. From computational point of view any cogitoid is an interactive transducer whose transitions from one con guration into the next one depend on the history of past transitions. Cogitoid’s computational mechanism makes it possible for cogitoids to perform basic cognitive tasks such as abstraction formation, associative retrieval, causality learning, retrieval by causality, similarity based behaviour, Pavlovian and operant conditioning, and reinforced learning. In addition, when a cogitoid is exposed to similar interaction as human brain during its existence, emergence of humanoid mind is to be expected. The respective development will subsequently feature emergence of various attentional mechanisms, essential living habits, development of abstract concepts, language understanding and acquisition, and, eventually, emergence of consciousness.
1
Introduction
The in eres of compu er science in answering ques ions rela ed o minds and brains da es back o Turing who already by he end of for ies came o he conclusion ha opera ion of he brain can be modeled by digi al compu ers [3]. Since hen a number of models of he brain have been considered (cf. [9], [10]). Among hem, he mos popular models are hose based on varia ions of he heme on ar i cial neurons. Wi hin his framework a number of valuable speci c problems rela ed o cogni ion has been solved (for a recen overview cf. [1]). However, i seems ha none of he respec ive approaches has lead o some ?
This research was supported by GA CR Grant No. 201/98/0717 and by an EU grant INCO COOP 96 0195 ‘ALTEC KIT’ jointly with the accompanying grant of the MSMT CR No. OK 304
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 152 166, 1998. c Sprin er-Verla Berlin Heidelber 1998
Towards Algorithmic Explanation of Mind Evolution and Functioning
153
non rivial compu a ional, or algori hmical, explana ion of mind func ioning. In his respec an excep ion seems o be he pioneering work by L. Goldschlager who in 1984 in his work ‘A Computational Theory of Hi her Brain Function’ [5] ini ia ed one possible line of a ack owards unders anding he opera ion of human mind. His novel approach, a leas wi hin compu er science, was o forge abou neuronal level ha deals wi h primi ive signals only, and ins ead o focus one’s a en ion o a higher concep ual level where more complex en i ies are deal wi h. In Goldschlager’s ‘memory surface’ model forma ion of abs rac concep s, associa ion of ideas, rain of hough s, crea ivi y, self and consciousness are explainable, a leas o some ex en . However, his compu a ional model of he brain has no been formalized o a level ha would allow a more rigorous reasoning when necessary. Also, memory surface model seems o neglec cer ain impor an mechanisms like hose enabling a nega ive reinforcemen of associaions ha seems o be a condi ion sine qua non in modeling of cer ain ypes of behaviour. A fur her s ep owards a model of he brain ha abs rac s o ally from he aspec s how real brains migh do wha hey do, and focuses on o he aspec what hey do, has been recen ly done by he presen au hor. This approach seems o be in he bes spiri of compu er science ha keeps looking for machine independen models of any informa ion processing ask. The au hor in roduced a formal abs rac model of he brain, he so called co itoid [8],[11]. The basic en i ies any cogi oid deals wi h are, similarly as wi h Goldschlager, concep s and associa ions among hem. In con ras o memory surface model he cogi oid is a precisely dened algebraical s ruc ure a la ice of concep s. In he course of compu a ion new associa ions keep developing and s reng hening among concep s. In [8] i has been shown ha cogi oids are able o realize basic behavioris ic asks. Besides behaviour elici ed by he presen a ion of speci c s imulus response pa erns (classical condi ioning), he cogi oids are also able o acquire sequences of concep s, and even be he subjec s of Pavlovian condi ioning. Since he model allows bo h for posi ively and nega ively reinforcing associa ions, operan condi ioning, and delayed operand condi ioning is wi hin he reach of cogi oids also. The respec ive s a emen s are formula ed and proved as heorems. In he subsequen paper [13] cogi oid’s po en ial w.r. . modeling of higher brain ac ivi ies has been inves iga ed. I appears ha in a su cien ly large cogi oid ha is equipped wi h similar sensors and e ec ors such as human brain is, and ha is exposed o similar in erac ion as humans during heir lives, emergence of humanoid mind can be expec ed. The presen paper repor s he work in progress as far as cogi oids are concerned. I surveys he main resul s from au hor’s works in his eld. Due o he page limi he paper concen ra es only on he mos impor an or in eres ing issues. For more de ails, see he original papers by he au hor. The s ruc ure of he paper a hand is as follows. In Sec ion 2 an informal de ni ion of a cogi oid is in roduced. In Sec ion 3 a brief accoun of basic resul s from [8] and [11] needed for he fur her explana ion is given. In Sec ion 4 he
154
Jir Wiedermann
spon aneously emerging organiza ional s ruc ure of cogi oid’s memory will be described. In Sec ion 5 he evolu ion of mind, in several phases, is ske ched. The full version of he presen paper is available as a echnical repor [13]. The book by Denne ‘Consciousness Explained’ [4] presen s a good companion reading. I o ers an in eres ing or hogonal view of many opics rea ed in he paper a hand. This view is based on he mos recen opinions and achievemen s in psychology, neurology, and philosophy.
2
The Co itoid
Any cogi oid can be seen as a cen ral par of a ni e in erac ive compu a ional device ha in erac s wi h i s environmen wi h he help of i s sensors and e ecors. The respec ive informa ion flowing from sensors in o a cogi oid and from a cogi oid o i s e ec ors is represen ed by concepts. Each concep represen s some ‘even ’ as perceived by a cogi oid. I is assumed ha here is only a ni e (bu huge) number of concep s. Over a se of concep s binary opera ions of concep join and of concep mee are de ned in such a way ha he resul ing algebraical s ruc ure forms a ( ni e) la ice. A lattice of concepts is a la ice (cf. [2]) whose elemen s are concep s. For any wo elemen s a and b of such a la ice, wi h a b we say ha a is an abstraction of b, while b is a concretization of a. Then, a supremum of any wo of i s elemen s is he smalles concre iza ion of hese elemen s, while heir in mum is he larges abs rac ion of hese elemen s. We shall say ha wo concep s are non meetin i heir larges abs rac ion is equal o he leas elemen of he respec ive la ice. Wi h he help of he above men ioned wo opera ions of concep mee and join, new concep s can be formed from exis ing ones. Especially, for any a and b a b is a concre iza ion of ei her a or b while a b is heir abs rac ion. There is a special subse of concep s ha is called a ects, or operant concepts. Posi ive a ec s correspond o posi ive feelings, or emo ions, of animals, while nega ive a ec s correspond o nega ive feelings, or emo ions. In a cogi oid, concep s may be explici ly rela ed via associa ions. Associa ions emerge among concep s ha occur in series or among similar concep s. Formally, an ordered pair of form (a b) of concep s is called an association, deno ed also as a b. We say ha a is associa ed wi h b There are wo ypes of associa ions: excitatory and inhibitory. Among any pair of concep s bo h ypes of associa ions may occur. Two concep s a and b resemble each o her in he concep c i a b = c and c = 1 . Since his is a symme ric rela ion his knowledge is represen ed as a pair of associa ions a b and b a We hen wri e a b A any ime t any concep may be ei her present or absent in a cogi oid. If presen , hen a concep may be ei her in an active or in a passive s a e. 1
Depending on the size of c we could introduce resemblance relations of a various degree of similarity; for simplicity reasons we abstain from such an idea. This is why c will not be mentioned in the sequel in the respective similarity relation.
Towards Algorithmic Explanation of Mind Evolution and Functioning
155
Also, a each ime t here are wo quan i ies assigned o each concep : i s stren th and i s quality. The s reng h of a presen concep is always a non nega ive in eger while absen concep s have he s reng h zero. The quali y of concep s can be posi ive, nega ive, or unde ned. Posi ive a ec s have always posi ive quali y, while nega ive a ec s have always nega ive quali y. The quali y of o her concep s may be arbi rary and depends on he his ory of concep forma ion or on he con ex in which a concep is invoked (ac iva ed). Similarly, he s reng h is also assigned o each exci a ory or inhibi ory associa ion. Curren ly passive concep s may be ac iva ed ei her direc ly from he environmen or by in ernal s imuli via associa ions from o her ac ive concep s. In he la er case, in order o ac iva e, concep s should be su cien ly exci ed. The concep s ge exci ed via associa ions. The s reng h of exci a ion depends on he s reng h and ype of all associa ions leading from ac ive concep s o he concep a hand. This concep is exci ed o he level ha is propor ional o he sum of s reng hs of all exci a ory associa ions from curren ly ac ive concep s decreased by he sum of s reng hs of all inhibi ory associa ions from curren ly ac ive concep s. The cogi oid C is seen as an in erac ive ransducer ha reads an in ni e sequence of inpu concep s. Each inpu concep represen s an even ha is ‘observed’ by a cogi oid by i s sensors. The compu a ion of C proceeds in rounds. A he end of each round a se of concep s is ac ive. This se presen s an ou pu of he cogi oid i s behaviour, i s ac ions, i s reac ion o he previous inpu . Le A be he se of concep s ac ive a he end of he t h compu a ional round in a cogi oid C Each round consis s of six phases: Phase 1: Producin the output and readin the input: The concep s in A are sen o he ou pu . All concep s in he se I corresponding o all abs rac ions of are ac iva ed. This models he forma ion of concep s by heir simul aneous appearance. Phase 2: Activatin new concepts by internal stimuli: Firs , a single new concep o from among all curren ly passive concep s ge s ac iva ed. This is done wi h he help of a selection mechanism which inspec s he exci a ion of all curren ly passive concep s from concep s in I A and subsequen ly ac iva es he mos exci ed concep o. Simul aneously wi h ac iva ing o he se O of all abs rac ions of o ge s ac iva ed also. Phase : Assi nin quality to concepts. The quali y of a ec s is cons an all he ime and i will de ermine, via inheri ance, he quali y of all heir curren ly ac ive abs rac ions and concre iza ions. Should some concep s ob ain in his way bo h posi ive and nega ive quali y, heir resul ing quali y remains unde ned. The concep s whose quali y canno be de ermined by he preceding rule, ge posi ive quali y. Phase 4: Updatin the Knowled e: The s reng h of all curren ly ac iva ed concep s is increased by a small amoun .
156
Jir Wiedermann
Similarly, he s reng h of associa ions be ween each concep in he se A and each in O is increased. This models he emergence of associa ions by cause and e ec . Finally, he associa ions by resemblance are upda ed by increasing he s reng h of associa ions be ween each ac ive concep in I A and each resembling presen passive concep , and vice versa. In he above men ioned process, if he associa ion o be s reng hened is beween he concep s a and b, hen if he quali y of a was posi ive or nega ive or unde ned, respec ively, hen he exci a ory or inhibi ory associa ion, or bo h associa ions, respec ively, be ween a and b are s reng hened. No e ha increasing he s reng h of associa ions in some cases means ha new associa ions are es ablished (since un il ha ime associa ions can be seen as hose wi h s reng h zero). Phase 5: Gradual for ettin : If posi ive, hen he s reng h of all concep s ha are no curren ly ac ive and he s reng h of all associa ions among hem is decreased by a small amoun . Phase 6: Deactivation: The concep s in he se A are deac iva ed and he se O becomes he se A +1 of all ac ive concep s. No e ha he sequence A 0 models he ‘ rain of hough ’ in our cogi oid. The no ion of he above described cogi oid can be formalized wi h he help of se s, mappings and cons an s ha de ermine he amoun of concep s and associa ions s reng hening.
3
Basic Results
In [9] i is shown ha for any cogi oids i is possible o perform basic cogni ive asks such as abs rac ion forma ion, associa ive re rieval, causali y learning, rerieval by causali y, and similari y based behaviour. E.g., he la er behaviour can be acquired as follows. Firs , by presen ing he cogi oid repea edly wo non mee ing concep s, a and b one af er he o her, an associa ion a b will be es ablished ( his is called classical conditionin ). Then, whenever a0 a appears a b a cogi oid’s inpu , in he nex wo s eps he chain of ac iva ions a0 will be invoked. As seen from he previous ‘de ni ion’ of a cogi oid, all he previous basic cogni ive asks belong among cogi oid’s buil in compu a ional mechanisms. The nex domain of behaviour ha can be acquired by cogi oids is ha of Pavlovian conditionin . This is a phenomenon in which an animal can be condiioned (learned) o ac iva e a concep as a response o an apparen ly unrela ed s imula ing concep (cf. [7], p. 217). For ins ance, one may rs ‘ rain’, by classical condi ioning, a cogi oid o es ablish a s rong associa ion s r Then, we may repea edly confron such a cogi oid wi h a fur her, so far unseen concep a wi h a s = ha is presen ed o i join ly wi h s as s a Af er a while we shall observe ha a alone will elici he response r Never heless, af er a few of such ‘chea ing’ from our side, he cogi oid will abs ain from elici ing r when seeing merely a (in psychology
Towards Algorithmic Explanation of Mind Evolution and Functioning
157
his is called extinction). More complica ed ins ances of Pavlovian condi ioning can be also observed in arbitrary cogi oids. The only condi ion is ha cogi oids mus be large enough o accommoda e all he necessary concep s. The respec ive proofs are no comple ely rivial. To a cri ical ex en hey depend on he se ing of cons an s ha govern he s reng hening of concep s and associa ions. In order o explain Pavlovian condi ioning no use of nega ive operan concep s and rela ed inhibi ory associa ions are necessary. Cogi oids are also able o realize so called operant behaviour. This is a behaviour acquired, shaped, and main ained by s imuli occurring after he responses ra her han before. Thus, he invoca ion of a cer ain response concep r is con rmed as a ‘good one’ (by invoking he posi ive operan concep p) or ‘bad one’ ( he nega ive operan concep n) only af er r has been invoked. I is he reward (p), or punishmen (n) ha ac o enhance he likelihood of r being re invoked under similar circums ances as before. The real problem here is hidden in he las s a emen which says ha r should be re invoked (or no re invoked) only under similar circums ances as before. Thus, inhibi ion, or exci a ion of r mus no depend on s alone: in some con ex s, r should be inhibi ed, while in o hers, exci ed. Such a con ex is called an operant context; i is represen ed by a concep ha appears invarian ly as he par of he inpu of a cogi oid during he circums ances a hand. Thanks o cogi oid learning abili ies, his operan con ex ge s ied o he respec ive operan concep (a ec ) which, la er on, causes ha all associa ions emerging from his pair will inheri he quali y of he operan concep a hand. Therefore, in he fu ure, hese associa ions will inhibi or exci e r as necessary. I appears ha by a similar mechanism ha ies a cer ain operan concep o some emporarily prevailing operan con ex one can also explain a more complica ed case of he so called delayed reinforcin when he reinforcing s imulus a punishmen or a reward does no necessarily appear immedia ely af er he s ep ha will be reinforced. All of he la er s a emen s concerning he learning abili ies of cogi oids can be formalized and rigorously proven (see he original papers [9] and [11]). In he la er paper i is also shown ha , af er a sui able raining, any cogi oid equipped wi h Turing machine apes is able o simula e any Turing machine. The purpose of he raining is o each he cogi oid he ransi ion func ion of he simula ed Turing machine.
4
The Evolution of Co itoid’s Memory
The previous resul s show ha any cogi oid has a po en ial o learn many cogni ive asks in parallel, in ermixed in ime one wi h he o hers in various ways. The key o e cien learning is rehearsal (classical condi ioning) and operan condi ioning. In order o mas er a ask he cogi oid has o be repea edly exposed o circums ances and in erac ion leading o he acquisi ion of he respec ive skills. A circums ance is charac erized by he respec ive s a ic operan con ex
158
Jir Wiedermann
in which various objec s can be used in numerous ways. Thanks o he compu a ional proper ies of any cogi oid, circums ances ge s ored in he form of s reng hening of he respec ive concep s, superimposing similar con ex s one o he o hers. In his way he basic cogi oid’s memory s ruc ures he so called clusters, evolve. A clus er is a se of such concep s b B ha share a common abs rac ion a = b2B b. Thus, any b B resembles he remaining b’s in a. The concep a is called he center of he clus er C = b2B b while he se s b’s are called he members of he clus er C. Members of a clus er are some imes called ‘episodic memories’. By he vir ue of cogi oid’s compu a ional rules, he cen er of a clus er ge s ac iva ed and s reng hened each ime when some of i s members is ac iva ed. Analogously, when he cen er a of he clus er B is ac iva ed a ime t, all b B ge exci ed. To ac iva e a speci c b, addi ional exci a ion from some o her concep s is usually needed. Namely, assume ha some concep b B is in he same ime also a member of an o her clus er D, wi h i s cen er e. Then he simul aneous ac iva ion of a and e can exci e b o such a degree ha he selec ion mechanism will ac iva e b. Thus, a simul aneous ac iva ion of wo or more cen ers of di eren clus ers may ac iva e he concep ha is a member of all clus ers a hand. This simple discriminatin mechanism presen s he basic mechanism ha keeps au oma ically evolving in cogi oids for ‘reminding’ i wha o do under no comple ely speci ed circums ances. According o previously described general principles, in any cogi oid ha in erac s wi h i s environmen clus ers and chains of associa ions keep developing au oma ically. From a s ruc ural poin of view all hese clus ers and chains look alike. Never heless, hey di er subs an ially as far as heir seman ic conen s is concerned. This is because di eren circums ance lead o he developmen of s ruc ures wi h di eren seman ics. Namely, in any cogi oid fundamen al clus ers evolve around hree fundamen al seman ic ca egories. These ca egories correspond o speci c operan con ex s in which he in erac ion akes place, o objec s ha are involved in he in erac ion a hand, and o he way hese objec s are deal wi h. Contextual clusters evolve by a superimposi ion of episodic memories ha are all per inen o frequen ly occurring similar operan con ex s, such as ‘in he fores ’, ‘on he s ree ’, ‘chris mas’, ‘win er’, e c. Their cen ers are crea ed by abs rac concep s ha correspond o objec s ha usually par icipa e in hese con ex s. In he previous examples, his could be concep s corresponding o ‘ rees’, ‘pa hs’, ‘animals’, or ‘cars’,‘houses’, ‘myself’, e c. As explained in he previous par , when a par icular con ex is ac iva ed in a cogi oid, he respecive cen ers of con ex ual clus ers ge exci ed. Thus, his mechanism presen s a kind of an attentional mechanism he cogi oid is ‘reminisced’ of (i.e., exci es concep s corresponding o) objec s ha used o play some impor an role a speci c occasions. Object clusters evolve around speci c objec s. The respec ive objec presen s he cen er of he respec ive clus er, while he members of he clus er provide he speci c con ex s, in which he objec has frequen ly found i s use in he pas .
Towards Algorithmic Explanation of Mind Evolution and Functioning
159
A speci c objec clus er will evolve e.g. around he concep ‘key’. I can be used for unlocking or locking a door, a safe, a car, e c. When some objec is ac iva ed, all he respec ive con ex s in which he objec a hand occurred frequen ly in he pas will be exci ed. I is like o ering all he possible occasions in which he objec has been manipula ed in he pas . Thus, his mechanism presen s some kind of role assi nment mechanism for objec s. To selec some concre e role, addi ional exci a ion from o her concep s is needed. The previous wo ypes of clus ers are complemen ed by functional clusters. These are formed around frequen ly performed ac ivi ies ha are represen ed by previously men ioned speci c con ex s ha are members of objec clus ers. A common abs rac ion of each of hese ac ivi ies presen s he cen er of he respec ive clus er. Thus, here may be func ional clus ers for unlocking a door, a safe, e c. The respec ive clus er members hen con ain he s ar ing operand con ex s of a chain of ‘algori hmic descrip ion’ of he respec ive ac ivi ies, inclusively he descrip ion of some elemen ary ac ion ha moves he ac ivi y owards he nex s ep in i s realiza ion. In a sense, he respec ive mechanism plays a role of he so called frames ha have been known wi hin AI for a while. No e ha while he rs wo ypes of clus ers con ex ual and objec clusers presen a kind of s a ic descrip ions ha are free of any ac ion, func ional clus ers involve already some elemen ary ac ions. To push forward he ac ions of a cogi oid, a speci c ype of i s memory organiza ion evolves along wi h he previously men ioned clus ers. This execu ive par of cogi oid’s memory is given by algori hmic descrip ions. Al orithmic descriptions or habits are sequencies of clus ers ha are chained by associa ions among heir cen ers. Each member in such sequences presen s a fur her a omic s age in he process of realizing he algori hm a hand. By realizing one s ep in such a chain, he cogi oid nds i self in a new con ex . This new con ex may ei her ac iva e he nex s ep in he algori hmic chain a hand, or can rigger an o her ac ivi y. Ini ializa ion of he respec ive chaines s ar s a he level of corresponding concre e concep s. Namely, from he compu a ional rules described in Phase 4 i follows ha whenever in a cogi oid wo concep s a and b are ac iva ed in wo subsequen s eps, an associa ion a b will emerge or s reng hened. However, since bo h a and b are ac iva ed, all heir abs rac ions ge ac iva ed as well, by vir ue of cogi oid’s compu a ional law. Thus, associa ions among all abs rac ions of a and all abs rac ions of b will also emerge, or will also be s reng hened. This concerns especially he associa ions among cen ers of corresponding clus ers o which a and b belong. If associa ions among di eren pairs of members of di eren clus ers are s reng hened, he associa ion among he respec ive cen ers is s reng hened a each such occasion. I follows ha he respec ive cen ers are associa ed s ronger han he individual pairs of members. Thus, habi s are presen very s rongly since hey are con inuously reinforced by heir repea ed execu ion under similar circums ances. Included is also some aspec of self s imula ion since cogi oids behave as if ac ively seeking for opporuni ies o make use of habi s ha are appropria e o he given occasion. This
160
Jir Wiedermann
is due o heir discrimina ion mechanism ha always selec s some habi . A hese oppor uni ies habi s are con inuously shaped and herefore are becoming increasingly general. We can conclude ha he behaviour of a cogi oid is driven bo h by he chains of acquired associa ions as well as by he curren con ex in which a cogi oid nds i self. The curren con ex ac iva es similar, more abs rac concep s ha ‘ rigger’ he respec ive behaviour as dic a ed by he chain of he respec ive associa ions. Upon similar circums ances a cogi oid wi h a su cien ly evolved clus ers and chaines of associa ions will behave similarly as in he pas . Even upon some novel circums ance chains of abs rac ion a higher levels will be found ha ‘ma ch’ he curren circums ance and will drive he cogi oid’s behaviour. Thus, in prac ice a cogi oid can never nd i self in a posi ion when i does no ‘know’ wha o do. No e ha in mos cases, cogi oid’s behaviour will unfold e or lessly, wi hou he necessi y of making use of some inference of rules.
5
Co itoid’s Mind Evolution
In order o race mind evolu ion in cogi oids hey have o be exposed o a proper raining. I is qui e di cul o describe he respec ive process ‘in general’, for arbi rary cogi oids in arbi rary environmen . The di cul y lies in he fac ha he environmen mus be coopera ive, and, in some sense, pa ien enough o rise up he necessary abili ies in he cogi oid. The corresponding ‘educa ional’ process should con inue s ep by s ep, incremen ally, from simple ma ers o more complica ed ones. Bellow we shall describe such a process for a ‘humanoid cogi oid’ since his seems o be he only case where we can rely upon some experience and in ui ion. Le us perform he following hough experimen : imagine a cogi oid being exchanged wi h one’s brain, residing wi hin he corresponding body. In such a case, we will assume ha he cogi oid receives he same signals as he brain does. The opposi e process also works: by sending he appropria e signals he cogi oid can service he same peripherals as a brain does. Then we imagine ha he resul ing cogi oid ‘lives’ in a s andard human environmen during a s andard human life span. Under such circums ances we shall concen ra e on o he evolu ion of cogioid’s memory s ruc ures men ioned in he previous sec ions. In doing his experimen , from i s very beginning here is one clear advanage of human beings over our cogi oids: here seems o be a cer ain amoun of knowledge ha is somehow presen in human, or in general, in animal mind wi hou being acquired by learning. This concerns various inheri ed, buil in, as i appears, ins inc s and reflexes, such as sucking or brea hing. The corresponding ac ivi ies are riggered in he appropria e si ua ion wi hou being ever ‘ rained’ by he respec ive animal. To make he proposed hough experimen possible, we shall assume ha cogi oids also have hese inna e abili ies acquired by a sui able preprocessing ha occurred prior o s ar ing his experimen .
Towards Algorithmic Explanation of Mind Evolution and Functioning
161
The mind evolu ion could be described as a process consis ing of several phases. In order o proceed o he nex one, he previous one should be passed (bu a sligh overlap in phases is possible). The Dawn of Mind. The shaping of cer ain par s of minds in our humanlike cogi oid seems o already s ar in he prena al s age. This is he rs oppor uni y for an evolving mind o be exposed, and o ge used and adjus ed o s imuli coming from i s evolving peripherals. Al hough he surrounding environmen does no seem o be very s imula ing, for a dawning mind, his is ra her an advan age for i has o learn he essen ial, life func ions preserving habi s. Any unrela ed in erven ion would be harmful o his process. In a prena al s age, a par of s imuli bears a con inuos charac er hey do no change over ime. Such s imuli are rela ed o various ‘sys em se ings’, such as blood pressure, body empera ure, e c. This seems o be he righ ime for adjus ing he respec ive con rol mechanisms o he correc values. The mechanism ha does he respec ive adjus men is very simple. By he unin errup ed s imula ion of he respec ive concep s hese concep s s ar o be presen very s rongly in fac heir s reng hs will never be exceeded by o her concep s. Thanks o he mechanism of crea ing new concep s by he vir ue of simul aneous occurrence he life func ion suppor ing concep s ge bound o every o her concep . Moreover, by he vir ue of successive occurrence associa ion emerge be ween hese life suppor ing concep s, and o her concep s, in bo h direc ions. Consequen ly, life suppor ing concep s presen a pillar around which he res of mind is buil . The ac iva ion of he respec ive concep s means ‘ he sys em is running OK’. Any devia ion of s andard values will cause a kind of ‘uncomfor able feeling’ when he respec ive surveilling concep s will no be aciva ed in heir en ire y. This can resul in o blocking of ac ivi ies of some o her concep s since a par of heir exci a ion will be missing. Then he cogi oid can fall in o unpredic able s a e. Ano her par of prena al s imuli bears a periodic charac er. They are indirec ly media ed by reac ions of mo her organism o periodic changes be ween days and nigh s, and in general by he corresponding periodic ac ivi ies, such as sleeping, awaking, e c. Various kinds of feelings are probably also projec ed in o dawning mind of baby cogi oids like fear, pain, sadness, pleasure, hunger, e c. A hese occasions he mind also learns he righ in ernal reac ions, simply by copying he reac ions of mo her’s organism. The mechanism responsible for he respec ive learning is he same as before he s reng hening of he respec ive concep s, and he emergence of successor associa ions. As a resul , in a prena al s age he founda ions of essen ial living habi s ‘run ime suppor ’, so o speak, in compu er science erms are es ablished in cogi oids. Shapin the Mind. This is he period of life af er he bir h, including babyhood. The main ask during his period is o learn he cogi oid o be good a in er-
162
Jir Wiedermann
pre ing i s percep ion of various ex ernal and in ernal s imuli by responding o hem wi h appropria e ac ions. This has influence on shaping all hree kinds of he cogi oid’s memory. Firs , based in i s own percep ion he cogi oid cons ruc s during his ime he basic se of concep s corresponding o objec s and space of he observable world. This is reflec ed in cogi oid’s memory by s reng hening of he respec ive concep s and along wi h i by emergence of he respec ive abs rac ions, by he vir ue of he respec ive cogi oid’s mechanisms. Es ablishing of rs episodic memories begins. Consequen ly, con ex ual, objec and func ional clus ers s ar o develop. Nex , causali y is remembered via emergence of he corresponding successor associa ions. An increasingly coordina ed linkage be ween own percep ion and own ac ion is acquired as a resul of behavioris ic or operan learning. This is reflec ed in he ongoing shaping and improvemen of he corresponding frames and roles via he forma ion of he respec ive clus ers. In he la er process, based on repea ed occurrence of own experience wi h percep ion or own ac ions in many similar con ex s he cogi oid’s abs rac ion mechanism gives also rise o speci c concep s ha correspond o he concep of self. So far his concep is largely unrecognized by he cogi oid, never heless i is here and is heavily u ilized. Namely, i is presen in numerous roles cen ered around he objec ‘self’. In addi ion, new habi s are acquired along wi h he es ablishmen of new a en ional mechanisms. A en ional mechanisms emerge simul aneously wi h es ablishmen of habi s by repea ed exposi ion of a cogi oid o periodic even s and by he au oma ic abs rac ion or generaliza ion of hem as explained in Sec ion 4. To each operan con ex a speci c, ailored o circums ances a hand, a en ional mechanism will emerge. In he case of animals, some of hese a en ional mechanisms migh be inna e, bu as seen from he above wri en he cogi oids are also able o learn o es ablish new a en ional mechanisms. A en ional mechanisms suppor concen ra ion of a cogi oid o fea ures ha are impor an in he given operan con ex . By learning from experience, by rehearsal and reward, hese fea ures are grouped in o one abs rac concep whose ac iva ion helps in iden i ca ion of he fea ures in more complex concep s. Thus, any a en ional mechanism may be viewed as a ool ha ampli es he exci a ion of he respec ive fea ures in o her concep s. In his way i implemen s some kind of a l er hrough which he curren ly unimpor an de ails are l ered ou . Any crea ure a his level of men al developmen possesses he basic abili ies o survive in he respec ive environmen . Besides ins inc s i s basic behaviour is governed by habi s acquired during i s life. Making use of hese, i is able o reac o immedia e environmen al s imuli, or o s imuli provided by some in ernal sensors (such as hunger, cold, pain, e c.). I can hardly reac o some in ernal men al s imuli (i.e., o s imuli o her han hose from sensors). I s a en ion span is limi ed o curren ly ongoing even s. I has no long erm in en ions. Lan ua e Acquisition, Understandin and Generation. When a cogi oid possesses powerful sensors and e ec ors ha enable i o in erac wi h i s environmen in
Towards Algorithmic Explanation of Mind Evolution and Functioning
163
an increasingly complex manner, and when i s memory capaci y is su cien , and when subjec ed o he righ raining, a fur her developmen of men al abili ies is o be expec ed. Namely, he increased complexi y of in erac ion leads o he developmen of an increased number of new concep s. If his is accompanied by a be er mas ering of, and ex ended sensi ivi y o, abs rac in ernal s imuli hen an advanced mind evolu ion resul s. The respec ive algori hmic explana ion is as follows. An animal has no o her han indirec means o ac iva e cer ain abs rac concep s. For ins ance, i canno ac iva e an abs rac concep ‘hunger’ wi hou being really hungry or unless seeing some food. This is because i is more or less inpu driven, as explained a he close of he previous paragraph, and here are no s imuli, excep hose men ioned, ha would ac iva e exac ly, and direc ly he abs rac concep for hunger. If here is such direc s imuli, hen he cogi oid’s mind would be able o rea hem as any o her direc s imuli. Consequen ly, habi s, along wi h he corresponding a en ional mechanisms, dealing only wi h abs rac s imuli could develop in much he same way as hey did in he case of concre e ex ernal s imuli. These addi ional inpu s ha can direc ly ac iva e so far unaccessible abs rac concep s, are provided by he language. In he mos general case a language need no be a spoken language, bu for simplici y we shall concen ra e o his par icular case. Moreover, we shall consider only he case when here is already a language ha a cogi oid has o learn, ra her han he case when a language has o be inven ed. In he former case, i appears ha he language o be learned mus be compa ible wi h cogi oid’s abili y o genera e he corresponding sounds. The genera ion of such sounds may be he subjec of a speci c raining preceeding ha of binding he sounds o some con ex s. Namely, when a cogi oid hears a spoken language along wi h perceiving respec ive visual s imuli, by he simul aneous occurrence composed concep s consis ing of words (or sounds), and of he represen a ion of heir visual coun erpar s, s ar o emerge. By hearing he respec ive word he corresponding concep s will be ac iva ed by he vir ue of resemblance. The same can be achieved by pronouncing he respec ive word by he cogi oid i self. In he course of such a self s imula ion a speci c a en ional mechanism will emerge, as a par of a habi ha may be called ‘in ernal speaking’. The e ec of his mechanism will be ha a concep can be ac iva ed wi hou ac ually hearing i s name. This in ernal ac iva ion can in urn lead o he pronuncia ion of he respec ive word, in he righ operan con ex . This seems o be he s ar ing poin of comprehending he algori hms underlying bo h language acquisi ion, unders anding, and language genera ion. In cogi oids, he hearing or u erance of each word is bound o a proper semantic operan con ex ha is shaped in he process of language acquisi ion. In fac , i is he seman ic opera ion con ex ha provides he essen ial ‘unders anding’ o cogi oids of wha i is spoken abou . In such cases seman ic operan con ex may consis s of complex abs rac concep s ha reflec he real linguis-
164
Jir Wiedermann
ic con ex . Wha o hear and wha o say in which seman ic con ex mus be acquired by rehearsal. For una ely, no every hing wha a cogi oid can ever hear, unders and, or said mus be li erally learned. Due o i s abs rac ion po en ial, along wi h seman ic operan con ex s corresponding o he curren circums ances also more abs rac , syntactic operan concep s s ar o emerge in cogi oid’s memory. Syn ac ic operan concep s are based on he syn ac ic similari y of sen ences. Namely, during he acquisi ion of a language by a cogi oid he respec ive abs rac ing mechanisms will learn ha cer ain ca egories of words play he role of nouns, while he o her ones ha of verbs, adjec ives, e c. Each word ge s associa ed wi h he corresponding syn ac ic class. Moreover, by he mechanism of learning sequencies cogi oids ‘discover’ ha in sen ences he respec ive words usually follow he same pa ern. This will give rise o syn ac ic operan con ex s ha keep rack on using he words in he proper order. Bo h seman ic and syn ac ic operan con ex s ake care of unders anding and genera ing he language. Their proper coupling and ordering is main ained by he respec ive speakin habits, along wi h corresponding semantic and syntactic attentional mechanisms. The speaking habi s rigger he respec ive speech unders anding or produc ion frames. A kind of an acoustic attentional mechanism also seems o play an impor an role in his process. Even ually, a pic ure of some complex in ernal grammar ha suppor s bo h unders anding and genera ing of a language seems o emerge. I s emergence and u iliza ion by cogi oids also explains an of en discussed problem of he pover y of he s imuli [4]. This is a phenomenon ha refers o he fac ha , during he linguis ic forma ive years, he child is no exposed o enough language o accoun for i s linguis ic abili ies. Making use of his grammar one is able o genera e and unders and words and sen ences never heard before. Emer ence of Consciousness. Language acquisi ion and genera ion seems o belong among he mos di cul men al asks. Once mas ered, i allows for increased communica ion and hus, informa ion exchange wi h o her par ners. This in urn calls for an immense developmen of he ‘self’ concep , and o her abs rac concep s rela ed o i . The self becomes an impor an subjec in various concep clus ers. Especially, he self will become a cen er in an objec clus er describing various ac ivi ies in which he self plays a cen ral role. Among hese ac ivi ies, here will be an abs rac concep ha corresponds o ‘regis ering’, or ‘observing’, in he wides sense (i.e., no necessarily visual observa ion). In he func ional clus er cen ered around ‘observing’ here will be objec s ha can be observed. Nex o more or less concre e objec s from he ou er world (such as ‘house’, or ‘dog’) here will also be abs rac objec s, like he ‘self’. A prologue o consciousness is such a s a e of mind in which he ‘self’ exci es ‘observing’ as a possible ac ivi y, and ‘observing’ exci es he ‘self’ as a subjec of observa ion. This muual exci a ion can achieve such a degree ha all he respec ive concep s will become ac ive simul aneously. Of course, in our model his corresponds o he ac iva ion of a single larger encompassing concep ha corresponds o consciousness. By a similar mechanism o her rela ed higher level men al no ions can be
Towards Algorithmic Explanation of Mind Evolution and Functioning
165
also explained. For ins ance, in rospec ion involves he self observing ( hinking abou ) (i )self while hinking. . . Once s ar ed, he feedback be ween he self and o her concep s involved in consciousness will con inuously s reng hen he respec ive associa ions among he respec ive concep s. A habi of being conscious will emerge. Since ha ime, no cogi oid ac ivi y can ake place wi hou he par icipa ion of consciousness. Of course, in real brains here are s a es in which consciousness may be ‘swi ched o ’. In addi ion, here are concep s (mos ly rela ed o basic living or sys em func ions) ha canno be included in o consciousness. All his is caused by mechanisms ha are no a par of our model. Similarly as for any su cien ly of en encoun ered opera ional con ex s, a en ional mechanism will au oma ically include consciousness in o such con ex s. Ac iva ion of he respec ive concep s corresponds o conscious concentration. Consciousness join ly wi h he concen ra ion in urn enables conscious ‘focusing of mind’ o various subjec s, among hem o abs rac concep s. In his way consciousness ac s as a kind of ‘exci a ion ampli er’ of he respec ive concep s. In his way hinking in abs rac erms is enabled. Development of Abstract Thinkin . Abs rac hinking is di eren from ha , mos ly abou he observed world: i is a hinking abou hings ha are non exis en , ha have been inven ed in he process of hinking. A ypical example of abs rac hinking is ma hema ical hinking. In order i o arise a lo more mechanisms mus develop in a cogi oid han in he case of everyday hinking. In addi ion o he he respec ive abs rac en i ies or concep s ha have o be de ned (i.e., unders and) and named in order o be able o hink abou hem, one has o develop speci c aes he ic cri eria. These are de ned in erms of posi ive or nega ive operan concep s whose ac iva ion mo iva es fur her abs rac hinking by bringing pleasurable or uncomfor able sa isfac ion from i . New rules of handling hese new concep s mus be inven ed. By heir frequen ‘men al’ applica ion new habi s mus be acquired. A speci c a en ional mechanism corresponding o concen ra ion o selec ed issues emerges. As a resul , a corresponding ‘compu a ional’ heory, wi h habi s o hink wi hin i s framework, will develop in cogi oid’s memory. In fac , he whole process of building such a heory is no unlike he process of langauge inven ion, language unders anding and language mas ering: in order o hink abou abs rac hings, one has o know heir meaning, o know how o deal wi h hem, and las bu no leas , one has o be able o speak abou hem. In his way a cogi oid can develop many di eren abs rac in ernal words. These worlds are governed by heir own rules ha may or may no correspond o he observed world. Examples of such worlds span from fairy ales, fan asy, religion up o ma hema ical heories.
6
Conclusion
The rs resul s and in ellec ual experience wi h cogi oids poin o he fac ha cogi oids, or similar devices could provide an in eres ing framework for s udy-
166
Jir Wiedermann
ing of cogni ion. This is because hey are based on general principles ha are consis en wi h heory of animal or human psychology. Building on wo basic pillars, viz. classical and operan condi ioning, cogi oids represen speci c universal learning machines. The underlying algori hm enables hem a con inuous learning in he course of heir po en ially endless in erac ion wi h he environmen . Wi hin compu er science his seems o represen a novel approach o brain and mind modeling. The resul s from [11] indica e ha as long as we are able o formalize he cogni ive ask a hand we can prove heorems describing he respec ive behaviour of cogi oids. Resul s concerning higher brain func ion such as mind developmen bear so far a specula ive charac er since we are no ye able o specify sa isfac orily corresponding cogni ive asks. Never heless, even a his level of modeling he respec ive ools and resul s o er much more concre e paradigm for s udying, discussing, and explaining such problems han i was possible un il now. There is a lo of open ends bo h in he respec ive compu a ional models and compu a ional heory of he mind. I seems ha he ime has ma ured for compu er science o in roduce he respec ive issues as i em No. 1 on i s research agenda (cf. [12]).
References 1. Arbib, M. A. (Editor): The Handbook of Brain Theory and Neural Networks. The MIT Press, Cambridge Massachusetts, London, England, 1995, 1118 p. 2. Birkho , G.: Lattice Theory. American Mathematical Society, New York, 1948 3. Davis, M.: Mathematical Logic and the Origin of Modern Computers. In: The Universal Turing Machine: A Half Century Survey, R. Herken (ed.), Springer Verlag Wien, New York, 1994, pp. 149 174 4. Dennet, D.C.: Consciousness Explained. Penguin Books, 1991, 511 p. 5. Goldschlager, L.G.: A Computational Theory of Higher Brain Function. Technical Report 233, April 1984, Basser Department of Computer Science, The University of Sydney, Australia, ISBN 0 909798 91 5 6. Johnson Laird, P.: Mental Models: Towards a Cognitive Science of Language, Inference, and Consciousness. Cambridge University Press, Cambridge, 1983 7. Valiant, L.G.: Circuits of the Mind. Oxford University Press, New York, Oxford, 1994, 237 p., ISBN 0 19 508936 X 8. Wiedermann, J.: The Cogitoid: A Computational Model of Mind. Technical Report No. V 685, September 1996, Institute of Computer Science, Prague, September 1996, 17 p. 9. Wiedermann, J.: Towards Computational Models of the Brain: Getting Started. Neural Networks World, Vol 7., No.1, 1997, p.89 120 10. Wiedermann, J.: Towards Machines That Can Think (Invited Talk). In: Proceeding of the 24 th Seminar on Current Trends in Theory and Practice of Informatics SOFSEM’97, LNCS Vol. 1338, Springer Verlag, Berlin, 1997, pp.12 141 11. Wiedermann, J.: The Cogitoid: A Computational Model of Cognitive Behaviour (Revised Version). Institute of Computer Science, Prague, Technical Report V 743, 1998 12. Wiedermann, J.: Arti cial Cognition: A Gauntlet Thrown to Computer Science. In: Proc. Cognitive Sciences, Slovak Technical University, May 1998; also as Technical Report V 742, Institute of Computer Science, Prague, 1998 13. Wiedermann, J.: Towards Algorithmic Explanation of Mind Evolution and Functioning. Full version of the present paper. Technical Report ICS AS CR, 1998, to appear
Combinatorial Hardness Proofs for Polynomial Evaluation ? (Extended Abstract) Mikel Aldaz1 , Joos Hein z2 3 , Guillermo Ma era3 4 , Jose L. Mon ana1 , and Luis M. Pardo2 1
2
Universidad Publica de Navarra, Departamento de Matematica e Informatica, 31006 Pamplona, Spain mikaldaz,
[email protected] Universidad de Cantabria, Fac. de Ciencias, Depto. de Matematicas, Est. y Comp., 39071 Santander, Spain heintz,
[email protected] 3 Universidad de Buenos Aires, FCEyN, Departamento de Matematicas, (1428) Buenos Aires, Ar entina joos,
[email protected] 4 Universidad Nacional de Gral. Sarmiento, Instituto de Desarrollo Humano, (1663) San Mi uel, Ar entina.
Abstract. We exhibit a new method for showin lower bounds for the time complexity of polynomial evaluation procedures. Time, denoted by L, is measured in terms of nonscalar arithmetic operations. The time complexity function considered in this paper is L2 . In contrast with known methods for provin lower complexity bounds, our method is purely combinatorial and does not require powerful tools from al ebraic or diophantine eometry. By means of our method we are able to verify the computational hardness of new natural families of univariate polynomials for which this was impossible up to now. By computational hardness we mean that the complexity function L2 rows linearly in the de ree of the polynomials of the family we are considerin . Our method can also be applied to classical questions of transcendence proofs in number theory and eometry. A list of (old and new) formal power series is iven whose transcendency can be shown easily by our method.
1
Back round and Results
The s udy of complexi y issues for s raigh -line programs evalua ing univaria e polynomials is a s andard subjec in Theore ical Compu er Science. One of he mos fundamen al asks in his domain is he exhibi ion of explicit families of univaria e polynomials which are hard o compu e in he given con ex . ?
Work partially supported by spanish DGCYT rant PB 96 0671 C02 02.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 167 175, 1998. c Springer-Verlag Berlin Heidelberg 1998
168
Mikel Aldaz et al.
Following Mo zkin ([1955]), Belaga ([1958]) and Pa erson-S ockmeyer ([1973]) almos all univaria e polynomials of degree d need for heir evalua ion a leas Ω(d) addi ions/sub rac ions, Ω(d) scalar mul iplica ions/divisions, and Ω( d) nonscalar mul iplica ions/divisions. A family (Fd )d2IN of univaria e polynomials Fd sa isfying he condi ion deg Fd = d is called hard to compute in a given complexi y model if here exis s a cons an c > 0 such ha any s raigh -line program evalua ing he polynomial Fd requires he execu ion of a leas Ω(dc ) ari hme ic opera ions in he given model. In he presen con ribu ion we shall res ric ourselves o he nonscalar complexi y model. This model is well sui ed for lower bound considera ions and does no represen any limi a ions for he generali y of our s a emen s. Families of speci c polynomials which are hard o compu e where rs considered by S rassen ([1974]). The me hod used in S rassen ([1974]) was la er re ned by Schnorr ([1978]) and S oss ([1989]). Hein z & Sieveking ([1980]) inroduced a considerably more adap ive me hod which allowed he exhibi ion of qui e larger classes of speci c polynomials which are hard o compu e. However in i s beginning he applica ion of his new me hod was res ric ed o polynomials wi h al ebraic coe cien s. In Hein z & Morgens ern ([1993]) he me hod of Hein z-Sieveking was adap ed o polynomials given by heir roo s and his adap ion was considerably simpli ed in Baur ([1997]). Finally he me hods of S rassen ([1974]) and Hein z & Sieveking ([1980]) were uni ed o a common approach in Aldaz e al. ([1996]). This new approach was based on e ec ive elimina ion and in ersec ion heory wi h heir implica ions for diophan ine geome ry (see e.g. Fi chas e al. ([1990]), Krick & Pardo ([1996]) and Puddu & Sabia ([1997])). This me hod allowed for he rs ime applica ions o polynomials having only in eger roo s. The resul s of he presen con ribu ion are based on a new, considerably simpli ed version of he uni ed approach men ioned before. Geome ric consideraions are replaced by simple coun ing argumen s which make our new me hod more flexible and adap ive. Our new me hod is inspired in Shoup & Smolensky ([1991]) and Baur ([1997]) and relies on a coun ing echnique developed in S rassen ([1974]) (see also Schnorr ([1978]) and S oss ([1989])). Excep for his resul (see Theorem 1) our me hod (Lemma 1) is elemen ary and requires only basic knowledge of algebra.
2
A General Lower Bound for the Nonscalar Complexity of Rational Functions
Le K be an algebraic closed eld of charac eris ic zero. By K[X] we deno e he ring of univaria e polynomials in he inde ermina e X over K and by K(X) i s frac ion eld. Le be a poin of K. By K[[X − ]] we deno e he ring of formal power series in X − wi h coe cien s in K and by O he localiza ion of K[X] by he maximal ideal genera ed by he linear polynomial X − . This means ha O is he subring of K(X) given by he ra ional func ions F := f , wi h f, K[X] and ( ) = 0.
Combinatorial Hardness Proofs for Polynomial Evaluation
169
Since K has charac eris ic zero here exis s for every K a na ural embedding i from O in o K[[X − ]] given as follows: for any F O le i (F ) be he Taylor expansion of F in he poin , namely i (F ) :=
X F (j) ( ) (X − )j j!
j2IN
Here we deno e by F (j) , j IN, he j- h deriva ive of he ra ional func ion F . Le F be an elemen of K(X), i.e. a ra ional func ion over he eld K. Le us recall he following s andard no ion of algebraic complexi y heory (see Borodin & Munro ([1975]), von zur Ga hen ([1988]), Hein z ([1989]), S oss ([1989]), S rassen ([1990]), Pardo ([1995]) and B¨ urgisser e al. ([1997]), Chap. 4). K. Le A be one of he following K-algebras: K[X], K(X) or O , where De nition 1. Let L be a natural number. A s raigh -line program of nonscalar QL ), leng h L in A is a sequence of elements of A, namely = (Q−1 Q0 satisfyin the followin conditions: Q−1 := 1. Q0 := X. 0 1 and a j , b j For any , 1 L, there exist d −1 j < , such that X X X a j Qj b j Qj + (1 − d ) b d Q := −1j
0 such that there is no polynomial time al orithm which can approximate Minimum Len th T Proof to within a factor of c log n. (c) If N P QP, then there is no polynomial time al orithm which can ap(1− ) n for any proximate Minimum Len th T Proof to within a factor of 2lo . The proof of the Hardness Theorem 3 involves giving a reduction of the Monotone Minimum (Circuit) Satisfying Assignment problem to the Minimum Length T -Proof problem. Thus any hardness results for the Monotone Minimum
182
Michael Alekhnovich et al.
Satisfying Assignment or Monotone Minimum Circuit Satisfying Assignment problem immediately also apply to the Minimum Length Frege proof problem. For space reasons, the proofs are omitted from this abstact, but they are already available in the full version of the paper.
4
Hardness Results for Lon Proofs
In the previous sections we proved that it is N P -hard to approximate the minimal propositional proof length by any constant factor, and that if N P is not in QP then minimum proof-length cannot be approximated (in polynomial time) (1− ) n factor. The tautologies used in the proofs of these results within a 2lo had short proofs (or refutations); that is, proofs whose length is polynomial in the size of the formula. However, if N P = coN P , then for any proof system S, there are tautologies whose shortest S-proof is of super-polynomial length. It is therefore interesting whether better non-approximability results can be achieved when the proof lengths are not bounded, and when the run time of the algorithm is required to be polynomial time in the length of the input formula only. The following simple intuition implies that in this case, no polynomial time algorithm can guarantee a polynomial time approximation for the shortest refutation of a given unsatis able formula, unless N P P poly: 2 Given an input formula of length n, reduce it to a formula = , such that the size of is polynomial in that of , is unsatis able, but its shortest refutation is longer than the shortest refutation of any unsatis able formula of length n by a super-polynomial factor. Then is satis able i on input , a supposed polynomially bounded approximation algorithm returns a number smaller than than the size of the shortest refutation of . This implies a polynomial time circuit for recognizing SAT. To make the above argument formal, we need few more de nitions. De nition 1. For a proof system S and an unsatis able formula , minS ( ) is the minimum len th of a refutation of in S. For an inte er n, M AXS (n) = max minS ( ) , where ran es over all unsatis able formulas of len th n. We say that a non-decreasing function f has super-polynomial rowth if for every polynomial r, f (n) > r(n) for almost all positive integers n. f has a smooth super-polynomial growth if in addition there is a constant D such that for each large enough n there is 1 d D such that f (nd ) > f d (n). [If we write e(n) , then the rst condition states that e(n) is not bounded from f (n) = n above, and the second condition states that for each n there is m, n m nD , such that e(m) > e(n).] Assume, for simplicity, that S contains the connective . Formulas and are said to be disjoint if their underlying sets of variables are disjoint. 2
We present the results in terms of ndin short refutations of unsatis able formulas, but equivalent de nitions and results are easily obtained for ndin short proofs of tautolo ies.
Minimum Propositional Proof Len th is NP-Hard to Linearly Approximate
Theorem 4 Assume that N P satis es:
183
P poly, and let S be a proof system which
1. For every pair of disjoint formulas followin holds: (a) If is unsatis able, then minS ( ( xed) polynomial r. (b) If is satis able, than minS (
and , where ) )
is unsatis able, the
minS ( ) + r(
+
) for some
minS ( );
2. M AXS (n) has a smooth super-polynomial rowth. Then for any polynomial q, there is no polynomial time q-approximation al orithm for the minimum len th proof in S. Observe that property 1 above holds trivially for all proof systems mentioned in this paper. Property 2 is known to hold for resolution, since in this case 3n for all n, and by [3], for each n there is an e 1 e 3 s.t. M AXS (n) ne e M AXS (n ) > 2 40 , thus property 2 holds for D = 3. We conjecture that this property holds for any known proof system in which the proof lengths are not polynomially bounded. Proof. We show that the existence of a polynomial time q-approximation algorithm, AL, for S, implies polynomial size circuits for solving SAT. Let j be such that q(n) nj for almost all n, and let D be the constant guaranteed by the smooth super-polynomial growth of M AXS . Since M AXS has super-polynomial growth, for all large enough n it holds that r(n + n2jD ) M AXS (n). Fix an integer n0 for which this inequality holds. Since the super-polynomial growth of M AXS is smooth, there is a number d, 2j M AXS (m), where m = n0 d . Let m be d 2jD, such that [M AXS (n0 )]d a formula of size m such that minS ( m ) = M AXS (m). An input formula of size n0 is reduced to = m , where the variables of m are disjoint from these of (note that is unsatis able and its size is polynomial in that of ). We claim that is unsatis able if and only if AL on input will output a number k M AXS (m). To see this, observe that if is unsatis able, then by property (1a) above, minS ( ) minS ( ) + r( + m ) 2M AXS (n0 ). Hence, by the assumption on AL, AL must produce an output k (2M AXS (n0 ))j M AXS (m) = minS ( m ). On the other hand, if is satis able, then, by property (1b), minS ( ) minS ( m ) = M AXS (m).
5
Acknowled ments
We are grateful to A.A. Razborov for extremely helpful discussions. We also would like to thank S. Arora for pointing out that Minimum Label Cover can be reduced to Monotone Minimum Satisfying Assignment.
184
Michael Alekhnovich et al.
References 1. S. Arora, L. Babai, J. Stern, and Z. Sweedyk, The hardness of approximate optima in lattices, codes, and systems of linear equations, Journal of Computer and System Sciences, 54 (1997), pp. 317 331. Earlier version in Proc. 34th Symp. Found. of Comp. Sci., 1993, pp.724-733. 2. S. Arora and C. Lund, Hardness of approximations, in Approximation Al orithms for NP-hard Problems, D. S. Hochbaum, ed., PWS Publishin Co., Boston, 1996, p. ??? 3. P. Beame and T. Pitassi, Simpli ed and improved resolution lower bounds, in Proceedin s, 37th Annual Symposium on Foundations of Computer Science, Los Alamitos, California, 1996, IEEE Computer Society, pp. 274 282. 4. M. Bellare, Proof checkin and approximation: Towards ti ht results, SIGACT News, 27 (1996), pp. 2 13. Revised version at http://www-cse.ucsd.edu/users/m h r. 5. M. Bellare, S. Goldwasser, C. Lund, and A. Russell, E cient probabalistically checkable proofs and applications to approximation, in Proceedin s of the Twenty-Fifth Annual ACM Symposium on Theory of Computin , Association for Computin Machinery, 1993, pp. 294 304. 6. M. L. Bonet, T. Pitassi, and R. Raz, No feasible interpolation for T C 0 -Fre e proofs, in Proceedin s of the 38th Annual Symposium on Foundations of Computer Science, Piscataway, New Jersey, 1997, IEEE Computer Society, pp. 264 263. 7. S. R. Buss, On G¨ odel’s theorems on len ths of proofs II: Lower bounds for reco nizin k symbol provability, in Feasible Mathematics II, P. Clote and J. Remmel, eds., Birkh¨ aauser-Boston, 1995, pp. 57 90. 8. M. Cle , J. Edmonds, and R. Impa liazzo, Usin the Groebner basis al orithm to nd proofs of unsatis ability, in Proceedin s of the Twenty-ei hth Annual ACM Symposium on the Theory of Computin , Association for Computin Machinery, 1996, pp. 174 183. 9. U. Fei e, A threshold of ln n for approximatin set cover, in Proceedin s of the Twenty-Ei hth Annual ACM Symposium on Theory of Computin , Association for Computin Machinery, 1996, pp. 314 318. 10. K. Iwama, Complexity of ndin short resolution proofs, in Mathematical Foundations of Computer Science 1997, I. Pr vara and P. Ruzicka, eds., Lecture Notes in Computer Science #1295, Sprin er-Verla , 1997, pp. 309 318. 11. K. Iwama and E. Miyano, Intractibility of read-once resolution, in Proceedin s of the Tenth Annual Conference on Structure in Complexity Theory, Los Alamitos, California, 1995, IEEE Computer Society, pp. 29 36. 12. S. Khanna, M. Sudan, and L. Trevisan, Constraint satisfaction: The approximability of minimization problems, in Twelfth Annual Conference on Computational Complexity, IEEE Computer Society, 1997, pp. 282 296. 13. J. Kraj cek and P. Pudlak, Some consequences of crypto raphic conjectures for 1 2 and EF , in Lo ic and Computational Complexity, D. Leivant, ed., Berlin, 1995, Sprin er-Verla , pp. 210 220. 14. C. Lund and M. Yannakakis, On the hardness of approximatin minimization problems, Journal of the Association for Computin Machinery, 41 (1994), pp. 960 981.
Reconstructin Polyatomic Structures from Discrete X-Rays: NP-Completeness Proof for Three Atoms (Extended Abstract) Marek Chrobak1 and Chris oph D¨ urr2 1
Department of Computer Science, University of California, Riverside, CA 92521-0304.
[email protected] 2 International Computer Science Institute, Berkeley, CA 94704-1198. cduerr@ cs .berkeley.edu, www. cs .berkeley.edu/ cduerr/Xray
Abstract. We address a discrete tomography problem that arises in the study of the atomic structure of crystal lattices. A polyatomic structure T can be de ned as an integer lattice in dimension D 2, whose points may be occupied by c distinct types of atoms. To analyze T , we conduct measurements that we call discrete X-rays. A discrete X-ray in direction determines the number of atoms of each type on each line parallel to . Given such non-parallel X-rays, we wish to reconstruct T . The complexity of the problem for c = 1 (one atom type) has been completely determined by Gardner, Gritzmann and Prangerberg [5], who proved that the problem is NP-complete for any dimension D 2 and 3 non-parallel X-rays, and that it can be solved in polynomial time otherwise [8]. The NP-completeness result above clearly extends to any c 2, and therefore when studying the polyatomic case we can assume that = 2. As shown in another article by the same authors, [4], this problem is also NP-complete for c 6 atoms, even for dimension D = 2 and axisparallel X-rays. The authors of [4] conjecture that the problem remains NP-complete for c = 3 4 5, although, as they point out, the proof idea in [4] does not seem to extend to c 5. We resolve the conjecture from [4] by proving that the problem is indeed NP-complete for c 3 in 2D, even for axis-parallel X-rays. Our construction relies heavily on some structure results for the realizations of 0-1 matrices with given row and column sums.
1
Introduction
The fundamen al principle of he transmission electron microscope (TEM) is very similar o he more familiar op ical microscope: i shines a focused beam of elec rons owards a specimen, and he ransmi ed beam is projec ed on o a Research supported by NSF grant CCR-9503498 and conducted when the author was visiting International Computer Science Institute. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 185 193, 1998. c Sprin er-Verla Berlin Heidelber 1998
186
Marek Chrobak and Christoph D¨ urr
phosphor screen genera ing an image. The in ensi y represen s he densi y and hickness of he specimen: denser or hicker areas of he specimen ransmi fewer elec rons and produce darker areas in he image. The developmen of he TEM in 1930’s was necessi a ed by he limi a ions of he op ical microscopes, whose magni ca ion and resolu ion were insu cien o s udy he in ernal s ruc ure of organic cells or o nd defec s in bulk ma erials. Recen ly, new advancemen s in hi h-resolution TEM (HRTEM), led o developmen of ins rumen s and echniques for s udying biological molecules and for inves iga ing he a omic s rucure of crys als. In par icular, a echnique called QUANTITEM [7,9] allows us o de ermine he number of a oms in a om columns of a crys al in cer ain direcions. Given hese numbers we wish o recons ruc he s ruc ure of he crys al. Problems of his na ure are s udied in discrete tomo raphy, he area of ma hema ics and compu er science ha deals wi h inverse problems of recons ruc ing discre e densi y func ions from a ni e se of projec ions. The size of crys als ha occur in he ma erials science applica ions is abou 106 a oms, and hus e cien recons ruc ion algori hms would be of grea in eres . The problem we address in his paper can be formula ed as follows: De ne a polyatomic structure T as an in eger la ice in dimension D 2, whose poin s may be occupied by c ypes of a oms. Each cell can be occupied by one a om or i could be emp y. To analyze T , we conduc measuremen s ha we refer o as discrete X-rays. (QANTITEM uses elec ron beams bu , following [5], we use a more familiar erm X-ray ins ead.) A discre e X-ray in direc ion de ermines he number of a oms of each ype on each line parallel o . Given such nonparallel X-rays, we wish o recons ruc T . The complexi y of he problem for c = 1 (one a om ype) has been comple ely de ermined by Gardner, Gri zmann and Prangerberg [5], who proved ha he problem is NP-hard for any dimension D 2 and 3 non-parallel X-rays, and ha i can be solved in polynomial ime o herwise [8]. The NP-hardness resul above clearly ex ends o any c 2, and herefore when s udying he polya omic case we can assume ha = 2. As shown in ano her ar icle by he same au hors, [4], his problem is also NP-hard for c 6 a oms, even for dimension D = 2 and for he axis-parallel X-rays. The au hors of [4] conjec ure ha he problem remains NP-hard for c = 3 4 5, and hey poin ou ha for hese values of c a subs an ially new echnique will be needed, a leas for he case c = 3 . We resolve he conjec ure from [4] by proving ha he problem is indeed NP-comple e for c = 3 (and hus for any larger c as well) in 2D, even for he or hogonal case, ha is, wi h he axis-parallel X-rays. In he or hogonal case, he problem can be hough of as a recons ruc ion problem for four-valued ma rices ( hree a om ypes and holes ) from given row and column sums for each a om. We will use capi al le ers A B C o deno e he hree a om ypes, and we will some imes refer o hese ypes as colors: Azure, A B C , deno e by ra (resp. saj ) he Bei e, and Cyan. For any a om ype a row-sum (resp. column-sum) of a om a, ha is, he number of a oms of ype a in row i (resp. in column j). Wi hou loss of generali y, we can concen ra e on
Reconstructing Polyatomic Structures
187
a square L L ma rices. The vec ors ra = (r1a rL ) and sa = (sa1 saL ) are referred o, respec ively, as he column-sum vector and he row-sum vector. A realization of an ins ance I = (rA sA rB sB rC sC ) is a L L ma rix T wi h elemen s in A B C 2 such ha j : T [i j] = a = ra and j : T [j i] = a = L and a A B C . We say I is consistent if i has a realizasa , for i = 1 ion. More speci cally, we prove ha he following 3-Color Consistency Problem (3CCP) is NP-comple e: Given I = (rA sA rB sB rC sC ), is I consis en ? . If we res ric ourselves fur her o jus one a om, he problem becomes equivalen o he recons ruc ion of 0-1 ma rices from he row and column sums a problem preda ing he discre e omography research. The rs e cien recons ruc ion algori hm was proposed in 1963 by Ryser [8], and a similar algori hm was la er rediscovered in 1971 by Chang [2]. In addi ion o recons ruc ion, Ryser and o hers s udied various s ruc ural proper ies of 0-1 ma rices wi h given row and column sums. Our cons ruc ion relies heavily on some resul s in his area. In eres ed readers are referred o an excellen survey by Brualdi [1] for more informa ion on his opic.
2
The General Idea of the Proof
The proof is by a reduc ion from he Ver ex Cover problem: Given an undirec ed graph G(V E), and an in eger K, is here a ver ex cover in G of size K? . Throughou his paper, we x an undirec ed graph G(V E) wi h n ver ices em , where n m > 0. The proof V = 1 n and m edges E = e1 is by cons ruc ing, in polynomial ime, an ins ance I of 3CCP, such ha I is consis en i G has a ver ex cover of size K. , we can force Suppose rs ha using some number d of a oms C 0 D0 a unique realiza ion, which has a form shown in Figure 1, ha we refer o as a frame. In he frame, he emp y en3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 D D D ries form diagonally-orien ed in ervals 3 D 1 of leng h n called mirrors. All o her enD 1 side-diagonal mirror D 1 . ries are lled wi h a oms C 0 D0 D 1 D 1 We have wo rows of mirrors: m mirD 1 rors in he upper-lef row, and m + 1 D 1 D 1 mirrors in he lower-righ row. D 1 0 Use a om B o crea e m copies of a D 1 D candida e ver ex cover U in he follow- 11 D D 1 ing way: The rs row and column B 0 D 1 sum is K and all o her B 0 -sums are 1. 1 D 0 D 1 (See Figure 1.) Then he pa ern of B s main-diagonal mirror D 1 in each lower-righ mirror is he same, 1 D and is also he same as he pa ern of 11 D D holes in he upper-lef mirrors. We associa e U wi h his pa ern: a ver ex u Fi . 1: The frame and mirrors for m = 3. is in U i he u h cell in any upper-lef mirror is a hole. We hink of U as a
188
Marek Chrobak and Christoph D¨ urr
beam projec ed on o he las n cells in he rs column, repea edly reflec ed in a double-row of mirrors, and exi ing hrough he las n cells in he rs row. Finally, we use a om A0 o verify ha U is indeed a ver ex cover. We conver he j h upper-lef mirror in o an ed e veri er for edge ej = (u v) (i may be necessary o add more rows and columns). Using appropria e sums for a om A0 , can be ex ended o a realiza ion of all a oms he realiza ion of a oms B 0 C 0 i ei her he u h cell or he v h cell in upper-lef mirrors is a hole. Thus, ei her u U or v U . (A similar approach was in [4].) The main idea behind our proof is his: De ne a par ial order on all Kelemen ver ex se s. The impor an proper y of is ha i s dep h is polyhas a unique minimum elemen Um n , nomial, namely a mos n2 . Fur her, and a unique maximum elemen Umax . Ins ead of using perfec mirrors, we use skew mirrors. These mirrors have he proper y ha he reflec ed se is never smaller, wi h respec o , han he se projec ed on o a skew mirror. These skew mirrors are also flexible we know ha hey can reflec he same or a bigger se , bu we canno con rol wha exac ly he reflec ed se will be. Now, ins ead of using m mirrors, we use n2 segmen s, each having m skew mirrors in he upper row. In each segmen , he j h skew mirror in he upper row is conver ed in o an edge veri er for edge ej . We shine Um n on o he rs mirror in he bo om-lef corner, and we make sure ha he nal se resul ing from all has dep h n2 , here has o reflec ions in he op-righ corner is Umax . Since be a segmen in which all mirrors reflec he same se U . Then he edge veri ers in his segmen will verify ha U is indeed a ver ex cover.
3
0-1 Matrices with Given Row and Column Sums
By x y z we deno e nonnega ive in eger vec ors of leng h p, for example x = xp ). We now concen ra e on he recons ruc ion problem for 0-1 ma rices (x1 wi h given row and column sums: Given x and y, is here a 0-1 ma rix T ha i j p? Again, in his has x 1’s in row i and yj 1’s in column j, for all 1 case, we call T a realization and say ha x y are consistent. The structure function. Given a p p ma rix T , and in egers 0 k l p we par i ion T in o four subma rices (which may have zero wid h or heigh ): Tk l Tk l Tk l and Tk l de ned by he in ersec ions of he rs k rows (resp. las p − k rows) and he rs l columns (resp. las p − l columns). By T 1 and T 0 we deno e he numbers of 1’s and 0’s in ma rix T . Pl Pp For a given ins ance x y, le k l = (p − k)(p − l) + j=1 yj − =k+1 x . We call he structure function. Then for any realiza ion T we have T + T + T + T − T + T = T + T (1) kl = kl 0 kl 1 kl 1 kl 1 kl 1 kl 1 kl 0 kl 1 Consistent sums. A vec or z = (z1
zp ) is monotone if z1
Lemma 1. [1] Monotone vectors x y are consistent i 1 p.
kl
zp . 0 for all k l =
Reconstructing Polyatomic Structures
189
The implica ion ( ) in Lemma 1 follows direc ly from Equa ion (1). The implica ion ( ) can be proven cons ruc ively by giving an algori hm ha produces a realiza ion T for any pair x y for which he s ruc ure func ion is non-nega ive. Decomposed realizations. We say ha T is (k l)-decomposed if Tkl consis s only of 0’s and Tk l consis s only of 1’s. The following heorem follows immedia ely from Equa ion (1), and i will play a major role in his paper. Lemma 2. [1] For any k l, decomposed.
kl
= 0 i
every realization (if any) is (k l)-
Remark 1. Lemma 2 implies ha if jus one realiza ion of x y is (k l)-decomposed, hen all realiza ions are (k l)-decomposed as well.
4
The Skew-Mirror Lemma
0-1 Vectors and minorization. We use Greek le ers for 0-1 vec ors of is = 1− for all of leng h p, say = ( 1 p ). The complement p. i=1 p, and he reverse ← is ← = p− +1 for i = 1 Pk P for all We say ha minorizes , deno ed , if k=1 =1 k=0 p. By s raigh forward veri ca ion, is a par ial order. Pp . If , are wo 0-1 vec ors The total sum of a 0-1 vec or is =1 wi h equal o al sums, hen he de ni ions above imply direc ly he following ← ← . equivalences: An impor an proper y of he minoriza ion rela ion is ha i is shallow , ha is i s dep h is only polynomial (unlike, for example, he lexicographic order). The nex lemma gives a more accura e es ima e on he dep h of . Lemma 3. Suppose that we have a strictly increasin sequence of 0-1 vectors 1 2 q with total sums t. Then q t(p − t) + 1. The 0-1 skew mirror. If T is a p p ma rix ha realizes mono one vec ors x y, we say ha T is a perfect mirror if T [i j] = 0 for i + j p and T [i j] = 1 for i + j p + 2. In a perfec -mirror ma rix he cells on he main diagonal i + j = p + 1 can be ei her 0 or 1, bu all cells above i are 0, and all cells below i are 1. From Lemma 2 we immedia ely ob ain he following corollary. Corollary 1. Let T be a realization of vectors x y. Then T is a perfect mirror p. i k p−k = 0 for k = 0 Lemma 4. Let be two 0-1 vectors of len th p with equal total sums, and and y = i − , for let x y be row and column sums de ned by x = i − i=1 p. Then ← . (a) Vectors x y are consistent i (b) Suppose that x y are consistent, and let T be any realization of x y. Then ← T is a perfect mirror i = .
190
α
Marek Chrobak and Christoph D¨ urr β
β
0 0 1 0 1 0
0 0 0 1 0 1
0 1 0 1 0 0
0 1 0 1 0 0
α
(a)
(b)
(c)
(d)
Fi . 2. Examples of (a) a perfect mirror, (b) a skew mirror. Realizations of (c) BSM(010100 000011) and (d) EV(010100 001010 (2 4)), (1 = and C = ).
5
, A =
, B =
Some Useful Gad ets
Bei e skew mirror. Given wo 0-1 vec ors of leng h n, we de ne he bei e skew mirror as a (n + 2) (n + 2) ins ance of 3CCP, BSM( ) = (xB yB ), wi h B B n, and he following beige sums: x = i − + 2, y = i − + 2, for i = 1 xB = y B = n + 2, for i = n + 1 n + 2. The azure and cyan sums are zero. Lemma 5. Let is consistent i
be two 0-1 vectors with equal total sums. Then BSM( .
←
)
Azure skew mirror. Given wo 0-1 vec ors γ of leng h n, we de ne he azure mirror as a (n+2) (n+2) ins ance of 3CCP, ASM(γ ) = (xA yA xB yB ), wi h A A n, xAn+1 = yn+1 = 0, xAn+2 = yn+2 = he azure sums: xA = y A = i for i = 1 B n, xBn+1 = yn+1 =2 K, and wi h he beige sums xB = γ , y B = , for i = 1 B = n − K + 2. The cyan sums are zero. and xBn+2 = yn+2 Lemma 6. Let γ be two 0-1 vectors of len th n with total sums equal n − K. ← γ. Then ASM(γ ) is consistent i Ed e veri er. For 0-1 vec ors γ of leng h n and o al sums equal n − K, and for an edge e = (u v) (wi h u v) de ne he ed e veri er for e, as a (n + 2) (n + 2) ins ance of 3CCP, EV(γ e) = (xA yA xB yB xC yC ), where he azure and beige sums are he same as in ASM(γ ), and he cyan sums are: C C C = 1, xCv = 1, yn−v+1 = 2, xCn+1 = 1, yn+1 = 1. xCu = 2, yn−u+1 Lemma 7. Let γ be a 0-1 vector of len th n with total sum n−K, and e = (u v) ← (with u v) be an ed e of G. Then EV(γ γ e) is consistent i γu = 0 or γv = 0. Lemma 7 has he following in erpre a ion: if we associa e wi h γ he ver ex γ e) is consis en i a leas one endpoin of se U = u : γu = 0 , hen EV(γ ← edge e belongs o U .
Reconstructing Polyatomic Structures
6
191
The Proof of NP-Completeness
The Reduction. Recall ha G K is he given ins ance of Ver ex Cover, where G = (V E), V = n and E = m. De ne J = K(n−K)+2 and L = (mJ +1)(n+ 2). We map G K, in o a L L ins ance of 3CCP I = (rA sA rB sB rC sC ), where he row and column sums are de ned as follows. (We only give he values of he non-zero sums.) We par i ion L L-ma rices in o (n + 2) (n + 2)-subma rices (blocks). A row or column is de ned by a block index a = 0 mJ and an o set i = 1 n + 2. For a = mJ he azure and beige sums are: 8 i=1 n v(B) > v(A). Since for all sequents S which are derivable odel lo ics, this concludes the proof. in HC , I(S) must be valid in all G¨ Theorem 7. BL is a proper extension of HC . To ether with previously known results, this establishes the announced result: Corollary 7. All inclusions of lo ics of the
ure in Section 2 are proper.
References 1. Adillon, R. J., Verdu, V.: On the 0 -contraction-less Intuitionistic Propositional Calculus. Draft. 1997. 2. Avron, A.: Hypersequents, Lo ical Consequence and Intermediate Lo ics for Concurrency. Annals of Mathematics and Arti cial Intelli ence Vol.4, 1991, 225-248. 3. Avron, A.: The Method of Hypersequents in Proof Theory of Propositional NonClassical Lo ics. In Lo ic: from foundations to applications. European lo ic colloquium, Keele, UK, July 20 29, 1993. Oxford, Clarendon Press, 1996, 1-32. 4. Dummett, M.: A Propositional Lo ic with Denumerable Matrix. Journal of Symbolic Lo ic Vol. 24, 1959, 96-107. 5. Dyckho , R.: Contraction-Free Sequent Calculi for Intuitionistic Lo ic. The Journal of Symbolic Lo ic, Vol. 57/3, 1992, 795-807. 6. G¨ odel, K.: Zum Intuitionistischen Aussa enkalk¨ ul. Er ebnisse eines mathematischen Kolloquiums 4, 1933, 34-38. 7. Hajek, P.: Metamathematics of Fuzzy Lo ic. Kluwer, to appear. 8. Hajek, P., Godo L., Esteva, F.: A complete many-valued lo ic with productconjunction. Archive for Math. Lo ic, Vol. 35 (1996), 191-208. 9. Lukasiewicz, J.: Za adnienia prawdy (The problems of truth). In Ksie a pamiatkowa XI zjazdu lekarzy i przyrodnikow polskich 1922, 84-85,87. 10. Lukasiewicz, J.: Philosophische Bemerkun en zu mehrwerti en Systemen der Aussa enlo ik. Comptes Rendus de la Societe des Science et de Lettres de Varsovie, cl.iii 23 (1930), 51-77. 11. Mendez, J.M., Salto, F.: Urquhart’s C with Intuitionistic Ne ation: Dummett’s LC without the Contraction Axiom. Notre Dame Journal of Formal Lo ic, Vol. 36/3, 1995, 407-413. 12. Kiriyama, E., Ono, H.: The Contraction Rule in Decision Problems for Lo ics without Structural Rules. Studia Lo ica, Vol. 50/2, 1991, 299-319. 13. Ono, H., Komori, Y.: Lo ics without the Contraction Rule. The Journal of Symbolic Lo ic, Vol. 50/1, 1985, 169-201. 14. Troelstra, A. S., Schwichtenber , H.: Basic Proof Theory. Cambrid e University Press. 1996. 15. Urquhart, A.: Many-Valued Lo ic, in Handbook of Philosophical Lo ic, Vol III, ed. by D.Gabbay and F.Guenthner, Reidel, Dordrecht, 1984. 16. Zadeh, L.A.: Fuzzy Sets, Fuzzy Lo ic, and Fuzzy Systems. Selected Papers by Lot A. Zadeh ed. by G.J. Klir and B. Yuan. World Scienti c Publishin , 1996.
Nonstochastic Lan ua es as Projections of 2-Tape Quasideterministic Lan ua es Richard Bonner1 , Rusins Freivalds2 , Janis Lapins3 , and Antra Lukjanska2 1
Department of Mathematics and Physics, M¨ alardalens University Institute of Mathematics and Computer Science, University of Latvia, Raina bulv. 29, Riga, Latvia† Department of Mathematics, University of Latvia, Zellu iela 8, Riga, Latvia 2
3
Abs rac . A language L(n) of n-tuples of words which is recognized by a n-tape rational nite-probabilistic automaton with probability 1− , for arbitrary > 0, is called quasideterministic. It is proved in [Fr 81], that each rational stochastic language is a projection of a quasideterministic language L(n) of n-tuples of words. Had projections of quasideterministic languages on one tape always been rational stochastic languages, we would have a good characterization of the class of the rational stochastic languages. However we prove the opposite in this paper. A two-tape quasideterministic language exists, the projection of which on the rst tape is a nonstochastic language.
1
Introduction
Let N denote the set of all natural numbers. Let n N . By n we denote a string consisting of n symbols . If is a set, then n stands for the set of all the n-element strings over the alphabet . A nite probabilistic automaton (FPA) = 1 2 is a system = ( S 0 M F ), where e is a nite input sm is a nite set of states, 0 = (p1 p2 pm ) alphabet, S = s1 s2 is a stochastic vector (the initial distribution of the probabilities of the states; + pm = 1), M is a system of stochastic m m-matrices M 1 , p 1 + p2 + M e (the matrices of the probabilities for the transition from one state M 2 to another under the influence of the corresponding input symbol), and F S is T a set of accepting states. Let F = ( 1 2 m ) be a column matrix de ned by j = 1 if sj F and j = 0 otherwise. We say that a language L over the alphabet is acceptable with cut-point xn in L are exactly γ (0 γ < 1) by an automaton if the words x1 x2 Mxn F > γ In other words, we represent the strings for which 0 Mx1 Mx2 a language L in FPA with cut-point γ. For an arbitrary word x of L, if starts to work on x in a random state sj distributed according to 0 then it stops in an accepting state with probability strictly larger than γ. A language L is called stochastic if it can be represented in some FPA with some cut-point †
Research supported by Grant No.96.0282 from the Latvian Council of Science
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 213 219, 1998. c Sprin er-Verla Berlin Heidelber 1998
214
Richard Bonner et al.
γ (0 γ < 1). A FPA is called rational if all the components of its initial probability distribution and all elements its transition probability matrices are rational numbers. A language L is called rational stochastic if it can be represented in a rational FPA with a rational cut-point. A FPA is called a nite deterministic automaton (FDA) if all the components of its initial distribution and all elements of its transition probability matrices are numbers from the set 0 1 . A language L represented in a FDA is called re ular. We will consider in detail the case when a language L is represented in a FPA 1 Mxn F 1 − γ for all strings with cut-point γ 0 M x1 M x2 2 and so that xn not in L In this case we say that the FPA reco nizes the language L x1 x2 with probability γ. Rabin and Scott [RS 59] introduced the concept of a multi-tape FDA, that is, a FDA that processes not words but tuples of words. Such an automaton has n tapes, over each of which a separate head can move in one direction, at most one unit at a time. Input words are written on tapes and every head observes a letter on the tape directly under it. It is presumed that the automaton can recognize the end of a word. This is provided by including in the alphabet a special symbol # which is put on every tape immediately after an input word. So, the automaton is used to recognize sets of words in the alphabet # . It is assumed that when some head reaches a symbol #, further movement of this head becomes impossible. The work of the automaton ends when all the heads have observed the symbol #. We shall consider that the automaton has accepted the given n-tuple of words, if at this moment the automaton transits to an accepting state; otherwise, we consider the automaton to have rejected the input. To formalise the de nitions, let n N denote by W (n) the set of all the subsets of the set 1 2 n and let Um denote the set of all m-dimensional stochastic vectors. A deterministic n-tape nite automaton (n-FDA) is then a system =(
S s1
F)
where = 1 2 e is a nite input alphabet containing the symbol #, sm is a nite set of states with a singled out subset F S S = s 1 s2 n S is a transition of accepting states and an initial state s1 S, : S n W (n) is a head movement function from one state to another, and : S xn ) if xi = # i = 1 n j=1 m function satisfying i (sj x1 A probabilistic n-tape nite automaton (n-FPA) is a system =(
S
0
F)
pm ) Um is an with S F de ned as above, and where 0 = (p1 p2 n Um is a state transition initial probability distribution of states, : S n U2n is a head movement function probability function, and : S prescribing probabilities of subsets of tapes (points in W (n)) whereby subsets containing a tape in state # receive probability zero.
Nonstochastic Languages
215
Let y = (y1 y2 yn ) be a n-tuple of strings over # . Denote by P (y) the probability that n-FPA operates on y with initial distribution of the states 0 and stops operation in a state from the set F . We shall say that n-FPA # with probability reco nizes a language L = L(n) of n-tuples of words over # , we have P (y) > γ if γ ( 12 γ < 1), if for any n-tuple y of strings over y L while P (y) 1 − γ if y L It was proved in [Fr 78] that there exists a language of pairs of words which cannot be recognized by any 2-tape FDA and cannot even be accepted by any 2-tape FNA; this language can however be recognized by a 2-tape FPA with probability 1 − for arbitrary > 0. It was proved in [Fr 91] that the class of languages that can be recognized by 2-tape FPA with probability 1 − for arbitrary > 0 is rather complex: in this class the emptiness problem is not decidable. In the present paper we characterize the complexity of this class in terms of projection languages. Here, the projection onto the rst tape of a language yn ) is de ned as the language L = L(n) of n-tuples of words y = (y1 y2 consisting of the words y1 as y ranges over L We call a language L of n-tuples of word quasideterministic if for arbitrary > 0 there exists an n-FPA which recognizes L with probability 1 −
2
Results
It is known [RS 59] that the projection onto one of the tapes of a language of ntuples of words that can be recognized by n-FDA, is a regular language. Indeed, more is true: the projection onto one of the tapes of an arbitrary language which is accepted by multi-tape nite nondeterministic automata is a regular language. For probabilistic automata, however, the situation is di erent. Freivalds [Fr 91] constructs a quasideterministic 3-language, the projection of which on the rst tape is a nonstochastic language. The purpose of the present paper is to extend this result to 2-languages. We begin by recording a simple fact, for reference; denotes the set of real numbers. Lemma 1. Let for t 1
1
2
c c1
max
j1 j2
be a sequence of random natural numbers. Then,
t
j 2N
max c 2
P
t
c 6=0
X
P
ci
i
=c
1it
= jt
1
= j1
t−1
= jt−1
Proof: Denote by m the right side of the inequality, and let c c1 ct = 0. Then o X X nX X ci i = c = P 1 = j1 P 1it
P
2
= j2
1
= j1
P
j1
j2
t−1
= jt−1
j
1
ct
−1
= j1
t−2
= jt−2
216
Richard Bonner et al.
( P
=
t
X j1
X j
−1
P
P
c−
)
Pt−1
i=1 ci i
1
ct 1
= j1
t−1
= jt−1
X j2 1
= j1
P
= j1
2
t−1
= j2 t−2
1
= jt−1 = j1
= jt−2
m
m
be a sequence Corollary 1. Let M be a natural number and let 1 2 t of independent random numbers uniformly distributed over the set 1 2 M o nP t 1 ct (ct = 0) Then P i=1 ci i = c M for arbitrary real numbers c c1 We consider the following 2-language in the alphabet 1 2 3 : n 2 o B (2) = (1s 11 213 215 2 212s−3 312s−1 3) s N Theorem 1. For arbitrary > 0, there exists 2-FPA reco nizin B (2) with probability 1 − . 21is −1 31is 3 j s i1 is N Let = Proof: Put C (2) = 1j 1i1 21i2 ( 1 2 ) denote a generic pair of words over the alphabet 1 2 3 written on the tapes of an automaton Observe that a 2-FPA recognizes B (2) with probability 1 − if it obeys the following rules. 1. If C (2) then rejects . 2. If C (2) then, P k s − 1 but j = sk=1 ik or i1 = 1, then (a) if ik + 2 = ik+1 for 1 rejects , (b) if i1 = 1 but ik + 2 = ik+1 for some k (1 k s − 1), then rejects with probability exceeding 1 − , Ps (c) if i1 = 1 and ik + 2 = ik+1 for 1 k s − 1 and j = k=1 ik = s2 then accepts . We now construct which obeys these rules. We present as a 2-FDA supplied with a generator of random equiprobable numbers. Fix a natural number M > 1 and let 1 2 s−1 be a sequence of independent uniformly distributed random numbers in the set 1 M Denote by j the remainder from the division of ij by M . For input = ( 1 2 ) C (2) we instruct to proceed as follows. and if 1. If the rst letter of the word 2 is 3, then if = (1 313) accept = (1 313) reject . 2. If the rst letter of the word 2 is 2, then: (a) If i1 = 1 then retain the number 1 = 1 and move the rst head by one unit. If i1 = 1 then reject .
Nonstochastic Languages
217
(b) If the second head is located on the j:th number 2 (2 j < s − 1) and the retained number is j−1 , then after moving of each M of following ij units on the second tape, move the rst head M − j−1 − j units. By the moving the last j units before (j + 1):th symbol 2 or before the rst symbol 3 compare j with j−1 . If j = j−1 + 2 move the rst head j−1 + 1 units, while if j = j−1 + 2 − M move it j + j−1 − 1 units. Retain the number j (instead of j−1 ). If j = j−1 + 2(modM ) reject . (c) If the second head is located on the rst symbol 3 and the retained number is s−1 , then after moving each M following is units on the second tape, move the rst head M − s−1 units. By going through the last s units before the second triple, compare the numbers s and s−1 . If s = s−1 + 2 move the rst head s−1 + 1 units, while if = + 2 − M move it s + s−1 − 1 units. If s = s−1 + 2(modM ) s s−1 reject . (d) If by moving the second head, the rst head has moved a distance equal to the length of 2 , then accept ; otherwise reject . For input C (2) we instruct to proceed as above until a di erence from C has been detected, and to reject then. head in 2 = 1213 215 2 212s−3 312s−1 3 Let B (2) . By moving the Psecond s−1 the rst head is moved all the k=1 (2k +1) = s2 units and outputs the correct answer B (2) with probability one. If = (1j 1213 215 2 212s−3 312s−1 3), 2 then j = s and, by the computations of the second head, the rst head can be moved s2 units. Since s2 = j, the automaton outputs the correct answer B (2) with probability one. kd = k ik + 2 = ik+1 . We have two cases: Let K = k1 k2 (2)
l K il + 2 = il+1 (mod M ). Then l + 2 = l+1 and by 2 (b),(c) the automaton outputs a correct answer B (2) with probability one. 2. l K il + 2 = il+1 (mod M ). In this case, as a result of the movement of the second head, the rst head moves a random number of units, = c0 + Pd P d c , where c (r = 0 1 d) are integers such that c = 0. r r r r r=1 r=1 The probability of a wrong answer will therefore be equal to the probability of the equality = j. It now follows by Lemma 1 that if P = j < then outputs a correct answer with probability not less than 1 − . 1.
P Theorem 2. Let P (x) = lj=0 cj xj be a polynomial of de ree l 2 with nonne ative coe cients, mappin the set of natural numbers into itself. Then the lan ua e L = 1P (s) s N is nonstochastic. Before proving Theorem 2 we recall a known fact of Diophantine approximation. Lemma 2. Let 1 1 2 t be real numbers formin a linearly independent system over the eld of the rational numbers. Let P (x) be a polynomial of positive de ree with rational coe cients. Then the set of the fractional parts of the vectors P (k) t ) k N is everywhere dense in the unit P (k)Ψ = (P (k) 1 P (k) 2 t-dimensional hypercube.
218
Richard Bonner et al.
Proof: See, for example, [Ca 57] Ch. IV, Theorems III, IV, and VI. The sequence P (k)Ψ of t-dimensional vectors is indeed uniformly distributed modulo 1 if (and only if) P so is the 1-dimensional sequence 1 P (k) 1 + 2 P (k) 2 + + t P (k) t = P (k) i i i for every non-zero vector ( 1 2 t ) of integers. Since the numare linearly independent over the rationals, the number bers 1P 1 2 t = i i i is irrational, and hence the polynomial P has irrational coe cients. However, it is known that the values Q(k) k N of a polynomial Q having at least one irrational coe cient are uniformly distributed modulo 1. Proof of Theorem 2. Assume, on the contrary, that the language L is stochastic. This means that there exist a FPA = ( 1 S 0 M1 F ) and a number γ such that k (1) x = 1k L 0 M1 F > γ s the Let s be the cardinality of S and let j = j e2 i j j = 1 2 s) be a system of lineigenvalues of the matrix M1 Let 1 1 2 t (t early independent real numbers over the eld of rational numbers such that + rtj t with ruj rational, and denote by the common j = r0j + r1j 1 + t j = 1 2 s. Let c < denominator of the numbers ruj u = 0 1 Let the bold numeral be a nonnegative integer congruent to c0 modulo 1 denote a generic column matrix consisting of 1’s only, and put M = M1 and = M1c ( F − γ 1) Since 0 M1k 1 = 1 it follows from (1) that 1
k+c
L
0M
k
>0
(2)
2 i j and let Z be a Jordan Put j = j j = ( j − roj ) and j = j e −1 normal form of the matrix M M = T ZT . The numbers j are clearly the eigenvalues of the matrix M . We have
F (k) =
0M
k
=
0T
−1
s X
k
Z T =
m
k
m=1
s−1 X
k j amj e2
i(k
m+
mj )
j=0
where amj mj are real, and, since F (k) is also real, we may forthwith replace the complex exponential by the cosine. To simplify further, partition the set J = j 1 j s of eigenvalues by their modulus: J = 1 N J , with J consisting of all the eigenvalues of equal modulus and 1 < < N Write F (k) in the form X X k k j B (k j) F (k) = j
where we have put B (k j) =
X m2J
amj cos 2 (k
m
+
mj )
Notice that the functions k B (k j) cannot all vanish identically because F itself does not; indeed, since P ( k) c0 c(mod ), we have by (2), F (Q(l)) > 0 if Q(l) =
P ( l) − c
and l
N
(3)
Nonstochastic Languages
219
P One may thus pick the largest index 0 among all for which j k j B (k j) is not identically zero as a function of k, and then pick the largest index j0 among all j for which k B 0 (k j) is not identically zero. Put for short B(k) = B 0 (k j0 ) and pick a value k = k0 for which B(k0 ) = 0 is a sequence of integers for which B(k ) B(k0 ) Notice that if kv then (4) F (k) = k0 k j0 (B(k) + o(1)) as k = k which for large forces the signs of F (k ) and B(k0 ) to coincide. By Lemma 2 we may rst pick such a sequence k of the form Q(nv ) and conclude by (3) that B(k0 ) > 0 Picking now k a second time, this time of the form Q(mv ) + 1 This implies by (2) that for we then see that F (Q(mv ) + 1) > 0 for large N or, simpli ed, all such one has (Q(mv ) + 1) + c = P (l ) for some lv P ( m )+ = P (l ) However, since P is of degree at least two and has positive coe cients, it is clear that this equation has no solution l N if mv is large enough. The assumption that L is stochastic has lead us to a contradiction. Theorem . For each positive number there exists a lan ua e of pairs of words which is reco nized by a nite probabilistic automaton with probability 1 − , but the projection of which to one of the tapes is a nonstochastic lan ua e. Proof: Consider the language B (2) . By Theorem 1, there exists a 2-FPA which recognizes this language with probability 1− . On the other hand, the projection 2 of B (2) to the rst tape is the language 1s s N , which is nonstochastic by Theorem 2.
References Fr 78. Rusins Freivalds. Reco nition of lan ua es with hi h probability by various types of automata. Dokladi AN SSSR , 1978, v. 239, No. 1, p. 60-62 (in Russian) Fr 81. Rusins Freivalds. Projections of lan ua es reco nizable by probabilistic and alternatin nite multitape automata. Information Processing Letters , 1981, v. 13, No. 4/5, p. 195-198. Fr 91. Rusins Freivalds. Complexity of probabilistic versus deterministic automata. Lecture Notes in Computer Science , Springer, 1991, v. 502, p. 565-613 RS 59. M.O. Rabin and D. Scott. Finite automata and their decision problems. J. Res. Develop. , 1959, v. 3, No. 2, p. 114-125. Mi 66. B.T. Mirkin. Towards the theory of multitape automata. Kibernetika , 1966, No 5, p. 12-18. (in Russian) Ca 57. J.W.S. Cassels. An Introduction to Diophantine Approximation. Cambridge Tracts in Mathematics and Mathematical Physics, vol. 45, 1957.
Flow Lo ic for Imperative Objects Flemmin Nielson and Hanne Riis Nielson Department of Computer Science, Aarhus University, Denmark
Abstract. We develop a control flow analysis for the Imperative Object Calculus. We prove the correctness with respect to two Structural Operational Semantics that di er in minor technical ways, and we show that the proofs deviate in major ways as re ards their use of proof techniques like coinduction and Kripke-lo ical relations.
1
Introduction
The advent of mobile computation renews the interest in static pro ram analysis aimed at uaranteein that software does not exhibit malicious or unintended behaviour. We consider here the problem in a pure form by studyin a control flow analysis aimed at determinin which software components mi ht reach what places. When studyin mobile computation one needs to be able to quickly adapt existin technolo ies for control and data flow analysis to the the variety of theoretical calculi desi ned for studyin the problem. One such calculus is the Imperative Object Calculus [1] and this will be the one we study here. The control flow analysis will be expressed as an abstract flow lo ic in verbose form; this presentation focuses on the lo ical content of the analysis as opposed to the al orithmic techniques (that can then be added afterwards [2]), and is therefore particularly suited for quickly adaptin existin technolo ies to novel calculi. We briefly review the imperative object calculus and then specify the control flow analysis (Section 2). This speci cation must be interpreted coinductively because of the ability of the imperative object calculus to code recursion (in the manner of the xed point combinator of the -calculus) and because of the abstract speci cational style employed. The theoretical existence of best solutions, as opposed to a practical al orithm, is established by means of a Moore Family (or model intersection) property. Semantic correctness of the speci cation is established by means of a subject reduction result with respect to a small-step structural operational semantics usin environments (Section 3). The semantics is a small-step version of the one in [1]. Since the semantics introduces new intermediate syntax we need to specify the analysis also for these constructs. The proof of the subject reduction result employs coinduction as well as Kripke-lo ical relations. Next we study the extent to which the structure of the correctness proof depends on the ne technical details of the operational semantics (Section 4). We do so by devisin another semantics that only deviates from the former on some ne techical points; in fact we would claim that the semantics of [1] could Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 220 228, 1998. c Sprin er-Verla Berlin Heidelber 1998
Flow Lo ic for Imperative Objects e ::= t t ::= x [m = (x ) e =1 em e1 m := (x2 ) e2 clone e let x = e1 in e2
221
an expression is a labelled term n
]
variable object (all m distinct) method invocation method udpdate object clonin local de nition
Table 1. Imperative Object Calculus: expressions and terms.
equally well have been de ned in a form resemblin the modi ed semantics. We then observe that the formulation of the subject reduction result ets more complex in that a notion of the si nature of a state seems to be needed; on the other hand, the subject reduction result can now be established without usin coinduction and Kripke-lo ical relations. We conclude by identifyin the eneral principles that are illustrated by this study (Section 5). These insi hts are likely to be crucial for the ability to quickly and correctly devise static analyses for novel calculi for computation.
2
Control Flow Analysis for Imperative Objects
The Imperative Object Calculus is de ned in Chapter 10 of [1]. It is an untyped =1 n ], but statically scoped calculus; a central term is the object, [m = (x ) e that is an ordered collection of n components, m = (x ) e , de nin a method name, m , in terms of a method, (x ) e . The binders, (x ), suspend the eval=1 n ] mj , the correuation, and when an object is invoked, as in [m = (x ) e spondin expression body, ej , is evaluated in an environment where the formal parameter, xj , is bound to the object itself, thereby permittin self-application and recursion. Method update, e m := (x0 ) e0 , rede nes an already existin method name, m, to be the new method, (x0 ) e0 , and returns the new object; this update takes place usin a store (hence the name imperative ). Clonin , clone e, produces a new object with the same method identi ers but usin fresh locations. Finally, there is a construct, let x = e1 in e2 , for local de nitions. The abstract syntax is summarised in Table 1. The main deviation from [1] is that we shall want to place labels (ran ed over by ) on all subexpressions in order to interface with the control flow analysis. To this end we formally distin uish between expressions, e, that are labelled terms, and terms, t, that are unlabelled expressions. The control flow analysis of an expression aims at determinin the sets of objects that can reach various points in the pro ram. In the analysis, the presence of an object [m = (x ) e =1 n ] will be represented by the abstract object m =1 n ; this representation is stable under evaluation because in the Imperative Object Calculus, an object update is not allowed to introduce additional method names.
222
Flemmin Nielson and Hanne Riis Nielson
(C
) =
(C
) = [m = (x ) e =1 n ] (x ) e =1 n ( m =1 n )
(C
(C (C (C
x
C( )
(x)
=1 n
m
C( )
) = ( t11 m) (C ) = t11 j m =1 n (x0 ) t00 : =1 n 0 (( m C( 1 ) mj = m (x0 ) t0 ( m =1 n ) j ) =1 n ( m (x0 ) C( 0 ) C( ) (C ) = t00 )) ) = (( m =1 ) =
n
( t11 m := (x2 ) e2 ) C( 1 ) mj = m) (clone t1 ) 1
(C
) = (let x = t1 in t2 ) (C ) = t11 (C ) = 1
(C ( m
t11 C( )
j m (x2 ) e2
C( 1 )
C( )
) = =1 n
) =
t1
1
=1 n
: ( m
=1 n
) j ))
2
t22
C( 1 )
(x)
C( 2 )
C( )
Table 2. Control Flow Analysis: the base part.
To be more precise, a proposed control flow analysis of an expression, e, is captured by the followin three entities: The abstract cache, C: here C( ) is (a superset of) the set of abstract objects that can result from the subexpression labelled . The abstract environment, : here (x) is (a superset of) the set of abstract objects that the variable x mi ht be instantiated to. The abstract store, : here ( m =1 n ) is an n-tuple of sets of methods; the jth component, ( m =1 n ) j , is (a superset of) the set of methods that mi ht implement the method mj within all objects of the form =1 n ] that are part of the pro ram or that arise durin eval[m = (x ) e uation. Clearly the relation can be used to relate sets, and this can be extended in a pointwise manner to de ne a relation that relates abstract states, and a ain in a componentwise manner to a relation for relatin triples of the form (C ); it is immediate that this turns the set of triples (of form (C )) into a complete lattice and we write for the reatest lower bound operation. To verify that a proposed analysis, (C ), is indeed an acceptable analysis of the pro ram, e, we specify a jud ement (C ) = e as shown in Table 2. The clause for variables is typical of the way the abstract value of a variable is included in the abstract value of a label. The clause for objects similarly includes the abstract object in the abstract value of the label; it also records the actual methods in the abstract store. The clause for method invocation performs a recursive call for verifyin the analysis of the object; it then inspects each abstract object that mi ht result and each possible method selected, and then takes care of the self-reference, includes the result of
Flow Lo ic for Imperative Objects
223
the method in the result of the call, and nally performs a recursive call for verifyin the analysis of the method invoked. The clauses for method update, clonin and local de nitions are less critical for understandin the basic features of the analysis. Since the clauses of Table 2 are not compositional (due to the analysis of the expression t00 in the clause for method invocation) we de ne = coinductively; we shall see below that this is more appropriate than an inductive de nition. Theorem 1. For all expressions e, the set Se = (C a Moore Family, i.e. Y S e : Y Se .
) (C
) =
e is
Proof. The proof of the theorem employs coinduction [4]. It is worth notin that the correspondin theorem (not just the proof) fails for the relation =0 that is inductively de ned by Table 2. It is a consequence of the Moore Family property (also called a model intersection property) that all expressions not only admit an acceptable analysis (take Y = ) but also a best acceptable analysis (take Y = Se ).
3
The First Approach
We now de ne our rst semantics for the Imperative Object Calculus. It is a small-step semantics [5] correspondin to the bi -step semantics of [1]. The overall (and sli htly imprecise) idea is that a semantic jud ement is of the form e
e0
0
where the typical form of the nite environment, , and the nite state, iven by (x) = [m = ( ) = (x) e
=1 n
, is
]
where ran es over a set of locations (just as x ran es over the variables). However, this description does not take account of the static scope rules in the Imperative Object Calculus. In the manner of [5] this motivates introducin two new auxiliary expressions: the expression close (x) e in that allows to encapsulate the environment at the point of de nition, and bind in e that allows to use a local environment for the evaluation of an expression e. To clarify the distinction between our ori inal expressions, e, and the au mented ones, we shall term the latter intermediate expressions, e. The precise details of the syntax of intermediate expressions follows from the de nition of the semantics in Table 3. For lack of space, and since the de nition is so close to the one in [1], we shall dispense with an explanation of the semantics. To express semantic correctness of the analysis in terms of a subject reduction result, we need to extend the analysis of Table 2 to incorporate the intermediate expression bind in e and the object denotation [m = =1 n ] . This calls for addin the two clauses in Table 4; then, for the purposes of this section, = is de ned coinductively by the Tables 2 and 4. One of the new clauses makes
224
Flemmin Nielson and Hanne Riis Nielson
x
f x
( (x)) =1 n
[m = (x ) e ] =1 n f are fresh 0
e ( e m)
0
dom( )
[m = =1 n ] 0 = [ (close (x ) e in ) 0
([m = =1 n ] 1 m) (bind f mj = m ( j ) = (close (xj ) ej in e01 ( e01
e1 ( e1 m := (x) e) n 0
in ej )
0
j)
=
j [xj
m := (x) e)
(let x = [m = =1 f 0 = [x [m = (bind
1
e2 in e2 )
(bind
1
in [m =
n
]
1
[m = ( )
0
in e) ]] e02 0 (bind
] 2)
]]
=1 n
]
0
0 0 =1 n =1 n
(bind
=1 n
=1 n
=1 n
0
1
in e02 )
0
]
]
e01 0 (let x = e01 in e2 )
e1 (let x = e1 in e2 )
[m =
0
e0 0 (clone e0 )
(clone [m = =1 n ] 1 ) =1 n 0 f 0 are fresh = [
1
0
] 1 m := (x) e) [m = = [j (close (x) e in )]
e (clone e)
]
0
e ( e0 m)
([m = =1 f mj = m
=1 n
0 0
in e)
0
[m =
=1 n
]
Table . Operational Semantics: the rst approach.
use of an auxiliary relation, R, that relates the concrete enviroment, , to the abstract environment, . The other auxiliary relation, S, is used to express the subject reduction result; since it is de ned in terms of itself we shall employ a coinductive de nition of the clause. To state the result we need the ran e of an environment, ran e( ), and the set of evaluated objects (i.e. [m = =1 n ]) in an intermediate expression, obj( e); both de nitions are strai htforward and are therefore omitted. Theorem 2. If R (C and if e e0 0 0 O = ran e( ) obj( e )).
0
e SO ( ) = then R (C
) (for O = ran e( ) obj( e)) ) = e0 0 SO0 ( ) (for
Proof. Overall the proof is by induction on the shape of e e0 0 . However, to deal with the case of bind we use a stron er induction hypothesis usin the notion of Kripke-lo ical relations [3]:
Flow Lo ic for Imperative Objects
(C
) =
(C
) = 1 R
R
([m =
=1 n
])
(bind 1 in t22 ) (C ) = t22
m
=1 n
C( 2 )
x dom( ) dom( ) : [m = (( (x) = [m = =1 n ]) ( m =1 n
SO (
) ( (x) e
[m = ( m
=1 n =1 n
] )j
225
C( )
C( ) =1 n
]: (x)))
O : j (x) e : (( ( j ) = (close (x) e in )) R Sran e( ) ( )))
Table 4. Control Flow Analysis: the extensions for the rst approach.
For all O: e SO ( ) (for O = ran e( ) obj( e) O) if R (C ) = and if e e0 0 e0 0 SO0 ( ) (for O0 = ran e( ) obj( e0 ) O). then R (C ) = Also, to deal with the case of method update we proceed by coinduction on the de nition of the auxiliary relation S.
4
The Second Approach
We now de ne our second semantics for the Imperative Object Calculus. Here the overall (and sli htly imprecise) idea is that a semantic jud ement is still of the form e e0 0 but now the typical form of the nite environment, , and the nite state, , is iven by (x) = =1 n ] ( ) = [m = (x ) e so that variables are mapped to locations that are mapped to vectors of methods (whereas before, variables were mapped to vectors of locations that were then mapped to methods). In our view this is a rather minor technical di erence that could easily have been adopted when de nin the semantics of the Imperative Object Calculus [1]. As before, this description does not take account of the static scope rules in the Imperative Object Calculus, and we therefore once more introduce two new auxiliary expressions. The resultin semantics is shown in Table 5. To express semantic correctness of the analysis in terms of a subject reduction result, we once more need to extend the analysis of Table 2 to incorporate the intermediate expression bind in e and the object denotation that now is simply . This is done in Table 6; then, for the purposes of this section, = is de ned coinductively by the Tables 2 and 6.
226
Flemmin Nielson and Hanne Riis Nielson
x
=1 n
[m = (x ) e f is fresh
0
f
dom( ) 0
]
[m = (close (x ) e in )
= [ 0
e ( e m) (
f x
( (x))
=1 n
e ( e0 m)
0
(bind 0 in ej ) mj = m ( ) = [m = (close (x ) e in
m) dom( ) 1
]]
0
e01 ( e01
e1 ( e1 m := (x) e)
)
=1 n
]
0
=
j [xj
m := (x) e)
0
( 1 m := (x) e) [ o] f dom( ) mj = m ( ) = [m = (close (x ) e in ) =1 n ] =1 o = [m = close (x ) e in mj = close (x) e in m = close (x ) e in 0
e (clone e)
( 0) = [0
0
(bind
1
(bind
1
in
2
0
( )] e01 0 (let x = e01 in e2 )
(let x = 1 in e2 ) f 0 = [x ] e2 in e2 )
]]
0
e1 (let x = e1 in e2 )
1
= n
0
e (clone e0 )
(clone 1 ) f 0 is fresh
]
0
(bind e02 0 (bind
1
0
0
in e2 )
in e02 )
0
)
Table 5. Operational Semantics: the second approach.
One of the new clauses makes use of an auxiliary relation, R , that relates the concrete enviroment, , to the abstract environment, . However, now is no lon er a piece of mysterious notation, but is actually a si nature of a state: this is a nite mappin from locations to tuples of the form m =1 n . For obtainin the si nature, si ( ), of a state, , we simply de ne si ( )( ) = m =1 n whenever =1 n ]. ( ) = [m = The other auxiliary relation, S, is used to express the subject reduction result; it no lon er needs to be de ned coinductively. Theorem . If e
0
0
then
Rsi
Rsi
(
0)
(C
( )
(C
) =si ( ) e ) =si ( 0 ) e0
S ( 0
S (
),
e
).
Proof. Overall the proof is by induction on the shape of e e0 0 and it does not employ coinduction nor Kripke-lo ical relations. It merely makes use of three facts of which the rst one is:
Flow Lo ic for Imperative Objects (C
) =
(C
) = 1 R
R
() (bind (C x
1
C( )
in t22 ) ) = t22
dom( )
227
dom( ) :
C( 2 ) ( (x))
C( ) (x)
S ( ) dom( ) : [m = (close (x ) e in ) (( ( ) = [m = (close (x ) e in ) =1 n ]) ( (x ) e =1 n ( m =1 n ) : Rsi (
=1 n
)
]:
))
Table 6. Control Flow Analysis: the extensions for the second approach.
If e e0 0 then si ( ) si ( 0 ). Here the partial orderin on si natures (which are just partial functions with a nite domain) is de ned in the standard way, and the result just says that objects are never extended with new method names. The other two facts are: R 2 . If R 1 and 1 2 then ) = 2 e. If (C ) = 1 e and 1 2 then (C These facts express a notion of si nature monotonicity .
5
Conclusion
In this paper we have proved two correctness theorems that exhibited some interestin di erences despite studyin the same analysis. We shall therefore conclude by identifyin some of the eneral insi hts that we have ained from this work. A rst observation is that: The abstract object used to identify an object in the analysis must be stable under evaluation. This should hardly be surprisin iven that the semantic correctness results are formulated as subject reduction results. But to save work it is mandatory that this consideration be applied already when de nin the analysis (and the semantics) rather than postponin it to the actual proof of semantic correctness (where =1 n ] is identi ed by the it mi ht fail). As an example, the object [m = (x ) e =1 n of method identi ers; this works because the imperative object tuple m calculus does not allow to extend an object with new method identi ers. Hence a di erent way of identifyin an object will be needed for an object calculus that allows extendin an object with new method identi ers. Let us briefly review the approach taken to specify the pro ram analysis. One way of de nin the speci cation would be in a compositional (or syntaxdirected) manner (e. . [2]), and this works well for closed systems; the approach taken in this paper was to use an abstract manner of speci cation in the sense that all method bodies are analysed when invoked rather than when de ned, and this works well for open systems. Our second observation then is that:
228
Flemmin Nielson and Hanne Riis Nielson
The speci cation must be de ned coinductively in case one takes the abstract approach, whereas it may be de ned inductively in case one takes a compositional approach. The need for coinduction shows up when establishin the Moore Family property but is not of concern when establishin the subject reduction result; also note that the coinductive and inductive de nitions actually coincide in the case of compositional de nitions. Both of the operational semantics necessitated extendin the syntax of the lan ua e with new intermediate constructs; for a subject reduction result to make sense, one then has to extend the analysis to these intermediate constructs as well. In both cases, this involved introducin an auxiliary relation, R, for relatin concrete environments to abstract environments, and an auxiliary relation, S, for expressin the subject reduction result. Our third observation then is that: Coinduction is only needed for provin the subject reduction result, if one of the auxiliary relations is de ned coinductively. In particular, even thou h the speci cation of the analysis is de ned coinductively (because we are takin an abstract approach) this in itself does not necessitate the use of coinduction for provin the subject reduction result. In some cases the auxiliary relations, R and S, are indexed by additional information; this can involve information about the state and information about the environment. Our fourth and nal observation then is: Kripke-lo ical relations are needed for the induction hypothesis in the proof of the subject reduction result, if the index to one of the auxiliary relations can increase durin the proof. This clearly explains the rule of Kripke-lo ical relations in the rst approach considered; there was no similar use of Kripke-lo ical relations in the second approach, althou h the result on si nature monotonicity expresses a result about Kripke-lo ical relations for free . Acknowled ement This research was supported in part by the DART-AROS project funded by the Danish Research Councils.
References 1. M. Abadi and L. Cardelli. A Theory of Objects. Sprin er, 1996. 2. K. L. S. Gasser, F. Nielson, and H. R. Nielson. Systematic realisation of control flow analyses for CML. In Proc. IC P ’97, pa es 38 51. ACM Press, 1997. 3. F. Nielson and H. R. Nielson. Layered predicates. In Proc. REX’92 workshop on Semantics foundations and applications, volume 666 of Lecture Notes in Computer Science, pa es 425 456. Sprin er, 1993. 4. F. Nielson and H. R. Nielson. In nitary Control Flow Analysis: a Collectin Semantics for Closure Analysis. In Proc. POPL ’97. ACM Press, 1997. 5. G. D. Plotkin. A structural approach to operational semantics. Technical Report FN-19, DAIMI, Aarhus University, Denmark, 1981.
Expressive Completeness of Temporal Lo ic of Action Alexander Rabinovich Department of Computer Science Raymond and Beverly Sackler Faculty of Exact Science Tel Aviv Univer ity , Tel Aviv 69978, I rael, e.ma l: rab
[email protected]. l
Abs rac . The paper compare the expre ive power of monadic econd order logic of order, a fundamental formali m in mathematical logic and theory of computation, with that of a fragment of Temporal Logic of Action introduced by Lamport for pecifying the behavior of concurrent y tem .
1
Introduction
The Temporal Lo ic of Actions (TLA) was introduced by Lamport [3] as a lo ic for specifyin concurrent systems and reasonin about them. One of the main di erences of TLA from other discrete time temporal lo ics is its inability to specify that one state should immediately be followed by the other state, thou h it can be speci ed that one state is followed by the other state at some later time. Lamport [2] ar ued in favor of this decision ‘The number of steps in a Pascal implementation is not a meanin ful concept when one ives an abstract, hi h level speci cation’. For example, pro rams like P r1 :: x := T rue; y := F alse and P r2 :: x := T rue; Skip; y := F alse are not distin uishable by the TLA speci cations, however, they are distin uishable in linear time temporal lo ic, one of the most popular temporal lo ics [4]. As a consequence of the decision not to distin uish between ‘doin nothin and takin a step that produces no chan es’ [3], the lan ua e of TLA contains the next time operator in a very restricted form. For the same reasons the TLA existential quanti er T LA has a semantics di erent from the standard existential quanti er. In this paper we consider the fra ment of Lamport’s Temporal Lo ic of Action where variables can only receive boolean values (BTLA). We compare the expressive power of BTLA with that of monadic second order lo ic of order. One of the consequences of TLA desi n decision is that only stutterin closed lan ua es are de nable in TLA. We will show that (1) if a stutterin closed -lan ua e is de nable in monadic second order lo ic of order then it is de nable in BTLA. Supported by a re earch grant of Tel Aviv Univer ity. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 229 238, 1998. c Sprin er-Verla Berlin Heidelber 1998
230
Alexander Rabinovich
To ether with Theorem 6 from [6] this shows that an -lan ua e is de nable in BTLA if and only if it is stutterin closed and de nable in monadic second order lo ic. In [6] we proved that there is no compositional translation from BTLA into monadic second order lo ic. The proof of (1) provides a translation from monadic lo ic into BTLA. However, this translation is also not compositional. A continuous time interpretation for TLA was su ested in [6] and it was shown there that this interpretation is more appropriate than the standard discrete time interpretation. A compositional translation from BTLA into monadic lo ic under the continuous time interpretation was iven in [6]. Here we will show that (2) there exists a compositional translation from monadic second order lo ic into BTLA under the continuous time interpretation. Hence, under the continuous time interpretation, BTLA and second order monadic lo ic can be translated one into the other in a compositional way. The paper is or anized as follows. In section 2 we x terminolo y and notations. Section 3 recalls the syntax and the semantics of monadic second order lo ic of order. Section 4 recalls the connection between automata on -strin s and monadic second order lo ic (see [9,8] for a survey). We also provide here an automata theoretical characterization of the lan ua es de nable in the lo ic under a continuous time interpretation. The syntax and the semantics of BTLA is provided in section 5. Section 6 characterizes the expressive power of BTLA.
2
Terminolo y and Notations
Notations: N is the set of natural numbers; R is the set of real numbers, R0 is the set of non ne ative reals; BOOL is the set of booleans and is a nite non-empty set. A function from N to is called an -strin over . A function h from the non-ne ative reals into a nite set is called a nitely variable si nal over if < n< there exists an unbounded increasin sequence 0 = 0 < 1 < 2 such that h is constant on every interval ( i i+1 ). Below we will use ‘si nal’ for ‘ nitely variable si nal’. We say that a si nal x is ri ht continuous at t i there is t1 > t such that x(t) = x(t0 ) for all t0 which satis es t < t0 < t1 . We say that a si nal is ri ht continuous if it is ri ht continuous at every t. A set of -strin s over is called an -lan ua e over . Similarly, a set of nitely variable (respectively, ri ht continuous) si nals over is called a nitely variable (respectively, ri ht continuous) -si nal lan ua e. and by Let be an -strin . We denote by [n 1) the -strin sn sn+1 and a letter s we denote by s the head( ) its rst letter s0 . For an -strin . -strin s s0 s1 sn is the -strin which is The collapse of an -strin = s0 s1 de ned recursively as follows: =
s0
[i 1)
if i si = s0 if si = s0 and sj = s0 for all j < i
Expre ive Completene
of Temporal Logic of Action
231
Hence, operator assi ns to each -strin the -strin obtained by replacof identical letters in by in every nite maximal subsequence si si+1 sn and 0 = s00 s01 s0n are a letter si . The -strin s = s0 s1 0 ) if = 0 . Let L be an -lan ua e. stutterin equivalent (notations We use the notation Stutt(L) for the stutterin closure of L which is de ned 0 . We say that an -lan ua e L is as : there exists 0 L such that stutterin closed if L = Stutt(L).
3 3.1
Monadic Second Order Theory of Order Syntax
The lan ua e L2 of monadic second order theory of order has individual variables, monadic second order variables, a binary predicate < , the usual propositional connectives and rst and second order quanti ers 1 and 2 . We use t v for individual variables and x y for second order variables. The atomic formulas of L2 are formulas of the form: t < v and x(t). The formulas are constructed from atomic formulas by lo ical connectives and rst and second order quanti ers. We write (x y t v) to indicate that the free variables of a formula are amon x y t v. 3.2
Semantics
A structure K = A B AC f (f (a(x y) x) y), by (2), which is not useful for our purpose since we rather need to have the inequality the other way around. Note that rpo-like AC-extensions, as for example those in [11, 18], cannot deal with this example since they do enjoy properties (1) and (2); furthermore most rpo-like AC-extensions are desi ned for round terms and their application to open terms to ether with the property of closedness under substitutions is not always easy to obtain; this example su ests that other techniques are necessary to deal with AC-function symbols. A useful approach to termination consists in usin sound transformations such that the transformed systems are somehow easier to deal with, wrt termination proofs, than the ori inal ones. Examples of this approach can be found Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 239 247, 1998. c Sprin er-Verla Berlin Heidelber 1998
240
Maria C. F. Ferreira et al.
in [1, 2, 3, 20, 21, 22, 9]. Most transformation techniques were ori inally meant for standard term rewritin , which raises the pertinent question of validity of the transformations in an equational settin . In [7], a transformation of equational TRS’s into equational TRS’s is proposed in such a way that termination of the resultin equational system implies termination of the ori inal equational system. In particular, this transformation chan es the rewritin system but leaves the equational part intact. However, provin equational termination and in particular, AC-termination is not an easy task (AC-termination is even undecidable for terminatin systems [16]), and so the technique proposed in [7] while simplifyin the problem still has the disadvanta e that we are left, after the transformation, with an equational (AC) system. In this paper, we propose a new technique that allows us to reduce ACtermination to termination, i. e., termination of a TRS S modulo an AC-theory can be inferred from termination of another TRS R with no theory involved. We use the dummy-elimination technique de ned in [7], but we completely eliminate the equational part of the system alon with the elimination of the AC-symbols; as a consequence, the proof of soundness of our transformation is not a particular case of that in [7] (we show by examples why that cannot be) so that we have to de ne a new interpretation of terms to achieve the desired results. It is also pertinent to remark that our soundness proof is just based on the existence of an AC-compatible order havin some additional properties but not on any particular de nition of such orders. Comin back to Ex. 1 we transform the AC-system R into the followin system R0 , by eliminatin the symbol a and introducin a fresh constant : R0 : f (f ( x) y) f (f ( x) y)
f ( y) f ( x)
f (f ( x) y) f (f ( x) y)
x y
Since the system R0 is terminatin (that can be proved for example by the rpo technique), then AC-termination of R will follow. For the sake of simplicity and clarity, we present our technique for systems havin just one AC-symbol. However, the technique is also applicable whenever more AC-symbols are present (see sec. 3). The rest of the paper is or anized as follows. Section 2 is devoted to explainin the transformation which allows to reduce AC-termination to termination and to provin its soundness. In sec. 3 we discuss the details concernin the application of our technique, we consider when many AC-symbols are present, the possibility of eliminatin only some AC-symbols while keepin others; we also discuss the weak and stron points of this technique, and present some conclusions. Due to space restrictions proofs are omitted, but we refer the reader to [8] for a full and detailed version of this paper.
2
The Transformation and Its Soundness
We assume the reader is familiar with the basic notion pertainin to partial orders, quasi-orders, rewritin and rewritin modulo AC-theories and, due to
Reducin AC-Termination to Termination
241
lack of space, will only present some needed notions; for more information the reader is referred to [6, 8, 13, 17]. A TRS is terminatin if it admits no in nite rewrite sequence. If EQ is an equational system and R a TRS, we say that R is E-terminatin (or that R EQ is terminatin ) if the relation R EQ is terminatin , i. e., if there are no in nite sequences of the form: s0 =EQ s00 R s1 =EQ s01 R s2 =EQ s02 R s3 , where =EQ represents the equational theory enerated by the set of equations EQ, and R represents the rewrite relation enerated by R. An equational rewrite system R EQ (TRS S) is compatible with a quasiand R order = (on T (F X )) (resp. partial order >) if =EQ (resp. R >). It is well-known that a TRS is terminatin if and only if it is compatible with a reduction (thus well-founded) order, and that an equational rewrite system is terminatin if and only if it is compatible with a reduction quasi-order. Furthermore if a TRS R is terminatin then + R is a reduction order on T (F X ). In AC-rewritin it is common to use the flattened version of terms. A term is flattened wrt an AC-function symbol f if it does not contain any nested occurrences of this symbol. Note that for a flattened term to make sense we need to admit that the AC-symbol can have any arity 2. Given a term t, we f denote its flattened version wrt an AC-function symbol f , by t or simply t. For our purposes we need the existence of an AC-compatible order havin some additional properties, namely subterm compatibility, closedness under contexts, well-foundedness when taken with respect to a well-founded precedence, and AC-compatibility. We will present our results makin use of Kapur and Sivakumar’s order [11], which enjoys these properties. In the followin , let >ac and ac denote respectively the order and compatible con ruence relation dened in [11], and let ac = >ac ac . As we mentioned before, we present our results for the case where we have only one AC-symbol. The technique is however applicable if we have a (possibly in nite) collection of AC-symbols we wish to eliminate (see sec. 3). Let a be an AC-function symbol not occurrin in si nature F ; a is the function symbol to be eliminated. Since we will work with flattened terms, we consider that the symbol a has variable arity 2. Flattenin will be done always with respect to this function symbol. Let be a constant also not occurrin in a and F . In T (Fa X ), we F . We denote by Fa and F resp. the sets F consider the relation R AC , where AC is the set of the associative and commutative equations for a. We de ne a transformation on terms that induces a transformation H on the AC-systems, and then show that termination of R AC can be inferred from termination of H(R AC) . The relevant point of this transformation is that the system H(R AC) does not contain any equation, thus we are in fact reducin AC-termination to termination. The main idea behind the term al ebra transformation is to recursively break a term t into pieces, cap(t) dec(t), that do not contain the function symbol to be eliminated; one of these blocks, namely the one above all occurrences
242
Maria C. F. Ferreira et al.
of the function symbol a , is denoted by cap(t) and treated especially. This transformation was introduced in [9], from which we take the de nition: T (F X ) and dec: T (Fa X ) De nition 1. Functions cap: T (Fa X ) P(T (F X )) are de ned inductively as follows: cap(x) = x and dec(x) = , for any x X , S )) = f ( cap(t ) ), and dec(f )) = dec(t ), cap(f ( t S( t )) = , and dec(a( t )) = ( cap(t ) dec(t )). cap(a( t For example, the term t = f (a( (a(x y) z) a(x s(x))) x h(a(x h(y)))) has cap(t) = f ( x h( )) and dec(t) = ( z) x y s(x) h(y) . We can extend both the function cap and the notion of flattenin to substitutions as follows. De nition 2. Let : X T (Fa X ) be an arbitrary substitution. The substiT (Fa X ) are de ned respectively tutions cap( ) : X T (F X ) and : X by cap( )(x) = cap( (x)), and (x) = (x), for all x X . We now de ne the transformation on TRS’s. As can be expected we will transform the lhs and rhs’s of the rules in R, creatin new rules and simultaneously ettin rid of the AC-equations. De nition . Given an AC-rewritin system R AC over T (Fa X ) such that the function symbol a is AC, H(R AC) is a TRS over T (F X ) iven by H(R AC) = cap(l)
u l
r
R and u
cap(r)
dec(r)
Note that in some cases H(R AC) may not be a TRS in the usual sense, since cap(l) may eliminate variables needed in the rhs’s of the transformed rules. From the de nition of H, we see that in eneral the TRS H(R AC) has more rules but is syntactically and furthermore semantically simpler than the ori inal one. Since in the transformed version no equations are involved, provin termination becomes an easier task provided the transformation is sound. This is exactly the ori inal characteristic of our technique which consists in reducin AC-termination to termination. In contrast with some other techniques to show termination, our transformation is not complete, i. e., there exist AC-terminatin systems R such that H(R AC) are not terminatin . To see that consider the TRS R : f (x x) f (a(x x) x), where a is an AC-symbol. R is AC-terminatin , while H(R AC) = f (x x) f ( x) f (x x) x is clearly non-terminatin : the term f ( ) reduces to itself. However, complete techniques are usually di cult or impossible to be implemented, and our aim is to provide a new tool to deal with and simplify the problem of AC-termination. We now show that the transformation H is sound, i. e., termination of H(R AC) implies AC-termination of R AC. The proof proceeds alon the followin eneral lines. To each term in T (Fa X ) we associate a term over a di erent si nature. For that we consider the set of terms T ( ) where = T (F X ),
Reducin AC-Termination to Termination
243
i. e., each term in T (F X ) is seen as a function symbol in T ( ); note that variables in X are now interpreted as constants in this new al ebra of terms. Furthermore, while in T (F X ) is de ned to be a constant and F does not contain any AC-symbol, is an AC-symbol in , the only one. If H(R AC) is terminatin , there is a well-founded order > on T (F X ) compatible with H(R AC); such an order provides a well-founded precedence on upon which we will consider ac . As a consequence >ac will be well-founded on T ( ), so we can conclude AC-termination of R AC if we show that the interpretation of the terms from T (Fa X ) in T ( ) is compatible with both the AC-theory and the rewritin relation de ned by R. In other words we only need to ensure that if s =AC u R v =AC t, with s u v t T (Fa X ), then S ac U >ac V ac T , where S U V T T ( ) are the interpretations of, respectively, s u v t. Because we want to mark the distinction between the more traditional terms and terms in T ( ), in which function symbols are themselves terms, we will use a sli htly di erent notation for the terms in T ( ). sk )), where s and Notation 4 A term in T ( ) will be denoted as s((s1 T ( ), for all 1 i k, k 0. AC = and all function symbols in s T (F X ) are of xed arity except and symbols t for which its root has varyadic arity in F . As usual, we will represent constants s(( )) simply by s. A ood start point to de ne an interpretation of terms is to use that in [7]. De nition 5. A term t T (Fa X ) is mapped to a term ree(t) T ( ), de ned inductively as: the function ree : T (Fa X ) ree(x) = x(( )), for any x X . sk )) = cap(f (s1 sk ))((t11 t1n1 ree(f (s1 tni )) for all 1 j k. ree(s ) = cap(s )((t1 sk )) = cap(a(s1 sk ))(( ree(s1 ) ree(a(s1
tk1
T ( ), by
tknk )), where
ree(sk ))).
However, the interpretation ree( ) does not allow to show soundness of our transformation H as it looses vital information about the structure of terms havin AC-symbols. The problems encountered are similar to the ones posed when one tries to extend rpo to AC-flattened terms. We illustrate those problems in an example showin that ree( ) does not work with non-flattened terms nor with flattened terms. Example 2. Consider the terms s = f (a(x a(y z))) and t = f (a(a(x y) z)), where a is AC. We have s =AC t but ree(s) = f ( )((x ((y z)))) is not ACequal to ree(t) = f ( )(( ((x y)) z)). Now consider R : a(0 1) f (0 1), where a is AC. Since s = h(a(a(0 1) 2)) R AC h(a(f (0 1) 2)) = t, one would like to show that ree(s) is in some sense reater than ree(t). Now, H(R AC) is the rule f (0 1), s = h(a(0 1 2)) and t = t so that ree(s) = h( )((0 1 2)) and ree(t) = h( )((f (0 1) 2)). Usin >ac (or RPO on flattened terms) one obtains ree(t) >ac ree(s) which is exactly the contrary of what one wants.
244
Maria C. F. Ferreira et al.
So we need a di erent interpretation and propose the followin . De nition 6. A term t T (Fa X ) is mapped to a term I(t) T ( ), de ned inductively as: function I : T (Fa X ) I(x) = x(( )), for any x X , sk )) = cap(f (s1 I(f (s1
sk ))((I(s1 )
T ( ), by the
I(sk ))), for any f
Fa .
The term f ( (a(a(0 x) y))) is interpreted by f ( ( ))(( ( )(( (( ((0 x)) y)))). Remark 7 From now on we assume that H(R AC) is well-de ned and terminatin . This means, in particular, that for any rule l r in R we must have var(r) var(cap(l)); this fact will be of use later. Since H(R AC) is terminatin , + H(R AC) is a well-founded partial order on T (F X ), which is closed under contexts and substitutions. In eneral this order will not possess the subterm property, which we will need at a later sta e, but fortunately that is not a problem since, as was noted by Kamin and Levy [10], we can easily extend such an order to another one enjoyin that property (at the expense of losin closedness under contexts). Before proceedin further, we recall this order and its properties. De nition 8. We de ne a relation t and C : s H(R AC) C[t]).
on T (F X ) as follows: s
t i (s =
Lemma 1. In the conditions of def. 8, if H(R AC) is terminatin then + well-founded partial order on T (F X ) extendin H(R AC) (i. e., H(R ), closed under substitutions and satisfyin the subterm property.
is a AC)
From now on we take (def. 8) as a precedence in T ( ) and consider the quasi-order ac associated to it. As was previously noted it is not necessary to make total since we do not require >ac to be total. We want to prove that if s R AC t then ac decreases the interpretations of these terms. However ac compares flattened terms and so some flattenin operation has to be performed either on s and t or on their interpretations. It turns out that if we flatten a term in T (Fa X ) wrt a before interpretin it, the interpretation of it in T ( ) will be in a flattened form wrt to , so we flatten terms before interpretin them. So now we prove that if s R AC t then I(s) >ac I(t), and we proceed in two I(s) ac I(t) and that s R t I(s) >ac I(t). steps showin that s =AC t De nition 9. For any terms s t sk ), t = f (t1 s = t, or s = f (s1 and some permutation , such that
T (Fa X ), s AC t if and only if either tk ), and s AC t ( ) , for all 1 i k, is the identity whenever f AC.
The relation AC is used in order to translate the equality =AC , which is de ned on the set of ordinary terms, into the set of flattened terms. It is also worth to notice that on T (Fa X ), AC ac . The followin results are strai htforward.
Reducin AC-Termination to Termination
245
Lemma 2. The relation AC is an equivalence relation on T (Fa X ); furthers AC t, and s AC t I(s) ac I(t). more, for all s t T (Fa X ), s =AC t T (Fa X ). Then s =AC t implies I(s)
Corollary 1. Let s t
ac
I(t).
We turn now to the case of inequality. Lemma . Let s T (Fa X ) X , t T (Fa X ) be terms such that var(t) var(cap(s)) and cap(s) v for all v dec(t) cap(t) ; let : X T (Fa X ) be any substitution. Then I(s ) >ac I(t ). From the de nition of H(R AC) (def. 3), and the assumption that H(R AC) is terminatin , it is easy to check that we can replace s and t in the above lemma by, respectively, l and r, for any rule l r R, so we can state that the interpretation is compatible with the rules of R AC. Corollary 2. Suppose that H(R AC) is terminatin , and let l r be any rule in R and let : X T (Fa X ) be any substitution. Then I(l ) >ac I(r ). We still have to check that if a reduction occurs within a non-trivial context, the same result holds, i. e., l r R implies I(C[l ]) >ac I(C[r ]). Theorem 1. Under the assumption that H(R AC) is terminatin , let s t T (Fa X ) such that s R t. Then I(s) >ac I(t). We can now prove our main result. Theorem 2. If H(R AC) is terminatin then R AC is AC-terminatin . Proof. Suppose that R AC does not terminate. Then we have an in nite seUsin corollary quence of the form s0 =AC s00 R s1 =AC s01 R s2 =AC s02 1 and theorem 1 this translates to the followin sequence on T ( ): I(s0 )
ac
I(s00 ) >ac I(s1 )
ac
I(s01 ) >ac I(s2 )
in T (F X ). Since >ac where >ac is taken over the well-founded precedence and ac are compatible and >ac is well-founded (the precedence is well-founded), this is a contradiction.
3
Discussion and Conclusions
For the sake of simplicity we presented our technique for AC-systems with only one AC-symbol. The technique is however valid in the presence of more (possibly in nite) AC-symbols, but its application can be done in di erent ways, namely map all AC-symbols to the same constant , or map roups of AC-symbols to di erent constants (in the extreme case each AC-symbol a is associated to a di erent constant a ). These di erent forms of applyin the transformation are not equivalent, bein the last one the ner one.
246
Maria C. F. Ferreira et al.
It may also be interestin to eliminate only some AC-symbols while keepin others (for example when the application of the previous technique is not possible); in this case the resultin system will still be an AC-system. Soundness of this transformation can be shown alon the same eneral lines; the technical details become however much more unpleasant. We would also like to point out that this technique is not always appropriate whenever the symbol we want to eliminate occurs in the lhs of rewrite rules since then all variables occurrin in the rhs must also occur in the lhs above (or parallel to) the to-be-eliminated symbol. This means that our technique can hardly cope with systems havin de ned AC-symbols, since in those cases the restriction required on the variables will usually not be ful lled. A possible way to deal with more cases where the symbol is de ned has been recently pointed out in [1], and it seems that a similar solution could be applied for AC-symbols (this is currently under investi ation). However, the interestin property of our technique is that it can be used to eliminate just some symbols of the system, treatin the rest of them with more classical techniques to prove termination. Thus, this technique is not just an alternative to other techniques to prove ACtermination, but also a complementary tool that allows to reduce AC-systems to systems without AC-symbols. The idea of extendin dummy elimination to equational rewritin had already been explored in [7], but with the restriction that the equational part of the system remained unchan ed. This is in line with most works dealin with ACtermination that either de ne new techniques or try to extend existin ones to the AC-settin , but without ever questionin the settin itself. The motivation of our work consists precisely in chan in this settin , and we do so by eliminatin the equational part of the system. This presents a totally di erent way of lookin at AC-termination and is, as far as we know, the rst technique which allows to show termination of AC-systems while i norin the AC-equations, i. e. by showin termination of some system which has no associated equations. In the future we would like to pursue this line of research by studyin the possible application of transformations de ned in the literature and/or de ne new ones. Also, we would like to investi ate what kind of equational theories are amenable to a similar treatment as the one presented here for AC.
References [1] T. Aoto and Y. Toyama. Termination transformation by tree liftin orderin . In Proc. of the 9th Int. Conf. on Rewritin Techniques and Applications - RTA 98, volume 1379 of LNCS. Sprin er, 1998. [2] T. Arts. Automatically provin termination and innermost normalisation of term rewritin systems. PhD thesis, Universiteit Utrecht, May 1997. [3] F. Belle arde and P. Lescanne. Termination by completion. Applicable Al ebra in En ineerin , Communication and Computin , 1(2):79 96, 1990. [4] C. Delor and L. Puel. Extension of the associative path orderin to a chain of associative commutative symbols. In Proc. of the 5th Int. Conf. on Rewrite Techniques and Applications (RTA), number 690 in LNCS, pa es 389 404. Sprin er, 1993.
Reducin AC-Termination to Termination
247
[5] N. Dershowitz. Orderin s for term rewritin systems. Theoretical Computer Science, 17(3):279 301, 1982. [6] N. Dershowitz and J.-P. Jouannaud. Rewrite systems. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B. Elsevier, 1990. [7] M. C. F. Ferreira. Dummy Elimination in Equational Rewritin . In Proc. of the 7th Int. Conf. on Rewritin Techniques and Applications, volume 1103 of LNCS, pa es 78 92. Sprin er, 1996. [8] M. C. F. Ferreira and D. Kesner and L. Puel. Reducin AC-Termination to Termination. Technical Report 1175, Universite Paris-Sud. 1998. [9] M. C. F. Ferreira and H. Zantema. Dummy elimination: makin termination easier. In Fundamentals of Computation Theory, 10th Int. Conference FCT’95, volume 965 of LNCS, pa es 243 252. Sprin er, 1995. [10] S. Kamin and J. J. Levy. Two eneralizations of the recursive path orderin . University of Illinois, 1980. [11] D. Kapur and G. Sivakumar. A Total, Ground Path Orderin for Provin Termination of AC-Rewrire Systems. In Proc. of the 8th Int. Conf. on Rewritin Techniques and Applications - RTA’97, volume 1232 of LNCS. Sprin er, 1997. [12] D. Kapur, G. Sivakumar, and H. Zhan . A new method for provin termination of ac-rewrite systems. In Proc. of the 10th Conf. on Foundations of Software Technolo y and Theoretical Computer Science, volume 472 of LNCS, pa es 133 148. Sprin er, 1990. [13] J. W. Klop. Term rewritin systems. In S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, editors, Handbook of Lo ic in Computer Science, volume II, pa es 1 116. Oxford University Press, 1992. [14] C. Marche. Normalized rewritin and normalized completion. In Proc. of the 9th IEEE Symposium on Lo ic in Computer Science, pa es 394 403, 1994. [15] P. Narendran and M. Rusinowitch. Any round associative-commutative theory has a nite canonical system. In Proc. of the 4th Int. Conf. on Rewritin Techniques and Applications, volume 488 of LNCS, pa es 423 434. Sprin er, 1991. [16] H. Osaki and A. Middeldorp. Type introduction for equational rewritin . In Proc. of the 4th Int. Symposium Lo ical Foundations of Computer Science - LFCS 97, volume 1234 of LNCS, pa es 283 293. Sprin er, 1997. [17] D. A. Plaisted. Equational reasonin and term rewritin systems. In D. Gabbay, C. J. Ho er, and J. A. Robinson, editors, Handbook of Lo ic in Arti cial Intelli ence and Lo ic Pro rammin , volume 1 - Lo ical Foundations, pa es 273 364. Oxford Science Publications, Clarendon Press - Oxford, 1993. [18] A. Rubio. A total AC-compatible orderin with RPO scheme, 1997. Draft. [19] A. Rubio and R. Nieuwenhuis. A precedence-based total AC-compatible orderin . Theoretical Computer Science, 142:209 227, 1995. [20] H. Xi. Towards automated termination proofs throu h freezin . In Proc. of the 9 th Int. Conf. in Rewritin Techniques and Applications - RTA 98, volume 1379 of LNCS. Sprin er, 1998. [21] H. Zantema. Termination of term rewritin : interpretation and type elimination. Journal of Symbolic Computation, 17:23 50, 1994. [22] H. Zantema. Termination of term rewritin by semantic labellin . Fundamenta Informaticae, 24:89 105, 1995.
On One-Pass Term Rewritin
?
ol yi4 Zoltan F¨ ul¨ op1 , Eija Jurvanen2 , Ma nus Steinby3 , and Sandor Va v¨ 1
Jozsef Attila University, Department of Computer Science, H-6701 Sze ed, P. O. Box 652, Hun ary,
[email protected] ed.hu 2 Turku Centre for Computer Science, DataCity, Lemmink¨ aisenkatu 14 A, FIN-20520 Turku, Finland,
[email protected] 3 Turku Centre for Computer Science, and Department of Mathematics, University of Turku, FIN-20014 Turku, Finland,
[email protected] 4 Jozsef Attila University, Department of Applied Informatics, H-6701 Sze ed, P. O. Box 652, Hun ary, va vol
[email protected] ed.hu
Reducin a term with a term rewritin system (TRS) is a hi hly nondeterministic process and usually no bound for the len ths of the possible reduction sequences can be iven in advance. Here we consider two very restrictive strateies of term rewritin , one-pass root-started rewritin and one-pass leaf-started rewritin . If the former strate y is followed, rewritin starts at the root of the iven term t and proceeds continuously towards the leaves without ever rewritin any part of the current term which has been produced in a previous rewrite step. When no more rewritin is possible, a one-pass root-started normal form of the term t has been reached. The leaf-started version is similar, but the rewritin is initiated at the leaves and proceeds towards the root. The requirement that rewritin should always concern positions immediately adjacent to parts of the term rewritten in previous steps distin uishes our rewritin strate ies from the IO and OI rewritin schemes considered in [5] or [2]. It also implies that the top-down and bottom-up cases are di erent even for a linear TRS. Let R = ( R) be a TRS over a ranked alphabet . For any -tree lanua e T , we denote the sets of one-pass root-started sentential forms, one-pass root-started normal forms, one-pass leaf-started sentential forms and one-pass leaf-started normal forms of trees in T by 1r SR (T ), 1r NR (T ), 1 SR (T ) and 1 NR (T ), respectively. We show that the followin inclusion problems, where R = ( R) is a left-linear TRS and T1 and T2 are two re ular -tree lan ua es, are decidable. The The The The
one-pass one-pass one-pass one-pass
root-started sentential form inclusion problem: root-started normal form inclusion problem: leaf-started sentential form inclusion problem: leaf-started normal form inclusion problem:
1r SR (T1 ) 1r NR (T1 ) 1 SR (T1 ) 1 NR (T1 )
T2 ? T2 ? T2 ? T2 ?
In [9] the inclusion problem for ordinary sentential forms is called the secondorder reachability problem and the problem is shown to be decidable for a TRS R which preserves reco nizability, i.e. if the set of sentential forms of the trees of ?
This research was supported by the exchan e pro ram of the University of Turku and the Jozsef Attila University, and by the rants MKM 665/96 and FKFP 0095/97.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 248 256, 1998. c Sprin er-Verla Berlin Heidelber 1998
On One-Pass Term Rewritin
249
any reco nizable tree lan ua e T is also reco nizable. In our problems the sets of normal forms or sentential forms are not necessarily re ular. Many questions concernin term rewritin systems have been studied usin tree automata; cf. [2], [4], [8], [9], [10], [11], [12], for example. We also prove the decidability of the four inclusion problems by reducin them to the emptiness problem of certain nite tree reco nizers. We thank the referees for useful comments.
1
Preliminaries
Here we introduce the basic notions used in the paper, but for more about term rewritin and tree automata, we refer the reader to [1], [3], [6] and [7]. In what follows is a ranked alphabet. For each m 0, the set of m-ary symbols in is denoted by m , and is unary if = 1 . If Y is an alphabet disjoint with , the set T (Y ) of -terms with variables in Y is the smallest tm ) U whenever m 0, f set U includin Y such that f (t1 m and tm U . If c , we write just c for c(). The set T ( ) of round t1 0 -terms is denoted by T . Terms are also called trees. Ground -terms and subsets of T are called -trees and -tree lan ua es, respectively. The hei ht Y h (t) of a tree t T (Y ) is de ned so that h (t) = 0 for t 0 , and h (tm ) + 1 for t = f (t1 tm ). The set var(t) ( Y ) h (t) = max h (t1 ) of variables appearin in t is also de ned as usual (cf. [7]). be a set of variables. For each n 0, we put Xn = Let X = x1 x2 xn and abbreviate T (Xn ) to T n . A tree t T n is linear if no x1 variable appears twice in t. The subset T n of T n is de ned so that t T n belon s to T n if and only if each of x1 xn occurs in t exactly once and 1 xn . Also, let T X = n=0 T n . If f their left-to-ri ht order is x1 m, tm T X , then f (t1 tm ) is the tree in T X obtained m 1 and t1 tm ) by renamin the variables. If t T n and : X T (X) is from f (t1 n), we write (t) = t[t1 tn ]. a substitution such that (x ) = t (i = 1 A term rewritin system (TRS) over is a system R = ( R), where R var(p) is a nite set of rewrite rules p r such that p, r T (X), var(r) and p X. A rule p r is round if p, r T . The rewrite relation R on T induced by R is de ned so that t R u if u is obtained from t by replacin tn ] by r[t1 tn ], where an occurrence of a subtree of t of the form p[t1 tn T . The reflexive, transitive closure of p r R, p, r T n and t1 R is denoted by R . Hence s R t i there exists a reduction sequence t0
R t1
R
R tn
in R such that n 0, t0 = s and tn = t. Note that we apply a TRS to round terms only. For any TRS R = ( R), let lhs(R) = p ( r) p r R . The TRS R is left-linear if every p in lhs(R) is linear, and it is then in standard form if lhs(R) T X . A tree s T is irreducible with respect to R if s R u for no u, and it is a normal form of a -tree t if it is irreducible and t R s.
250
Zoltan F¨ ul¨ op et al.
In a top-down -reco nizer A = (A P a0 ) (1) A is a ( nite) unary ranked alphabet of states such that A \ = , (2) P is a nite set of transition rules, xm )) f (a1 (x1 ) am (xm )), also written simply each of the form a(f (x1 am ), where m 0, f and a, a1 , . . . , am A, and a(f ) f (a1 m A is the initial state. We treat A as the TRS ( A P ) and the (3) a0 T [A T [A is de ned accordin ly. For each a A, rewrite relation A a(t) A t . The tree lan ua e reco nized by A is let T (A a) = t T T is reco nizable, or re ular, if the set T (A) = T (A a0 ). A tree lan ua e T T (A) = T for a top-down -reco nizer A. In a eneralized top-down -reco nizer A = (A P a0 ) the rewrite rules of xn )) t[a1 (x1 ) an (xn )], where n 0, a, a1 , P are of the form a(t(x1 . . . , an A, and t T n . The relations A , A , and the set T (A) are de ned as in a top-down -reco nizer. A bottom-up -reco nizer is a quadruple A = (A P Af ), where (1) A is a nite set of states of rank 0, \ A = , (2) P is a nite set of transition rules, am ) a with m 0, f am , a A, and of the form f (a1 m , a1 (3) Af ( A) is the set of nal states. We say that A is total deterministic if 0, a1 , . . . , am A, there is exactly one rule of the form for all f m, m am ) a. We treat A as the rewritin system ( A P ), and the tree f (a1 ( a lan ua e reco nized by it can be de ned as the set T (A) = t T Af ) t A a . For any bottom-up -reco nizer A, one can e ectively construct a total deterministic bottom-up -reco nizer B such that T (A) = T (B). In a eneralized bottom-up -reco nizer A = (A P Af ) P is a nite set an ] a, where n 0, t T n and a1 an , a A. of rewrite rules t[a1 ( a Af ) t A a . The tree lan ua e reco nized by A is T (A) = t T It is easy to see that both eneralized top-down and bottom-up -reco nizers reco nize exactly the re ular -tree lan ua es. Moreover, the emptiness problem T (A) = ? is obviously decidable for both types of automata.
2
One-Pass Term Rewritin
The rst of our two modes of one-pass rewritin may be described as follows. Let R = ( R) be a TRS and t the -tree to be rewritten. The portion of t rst rewritten should include the root. Rewritin then proceeds towards the leaves so that each rewrite step applies to a root se ment of a maximal unprocessed subtree but never involves any part of the tree produced by a previous rewrite step. For the formal de nition we associate with R a TRS in which a new special symbol forces this mode of rewritin . De nition 2.1. The one-pass root-started TRS associated with a iven TRS # R# ), where # is a new unary symbol, R = ( R) is the TRS R# = ( the separator mark, and R# is the set of all rewrite rules #(p(x1
xn ))
r[#(x1 )
#(xn )]
obtained from a rule p r in R, where p, r T n , by addin # to the root of the left-hand side and above the variables in the ri ht-hand side.
On One-Pass Term Rewritin
Example 2.1. If R = 2, g 1 , and c
f (g(x1 ) x2 ) 0 , then
R# = #(f (g(x1 ) x2 ))
f (x1 g(x2 )) g(x1 )
251
g(c) , where f
f (#(x1 ) g(#(x2 ))) #(g(x1 ))
g(c)
For any TRS R, the associated one-pass root-started TRS R# is terminatin . For recoverin the one-pass root-started reduction sequences of R from the reT duction sequences of R# , we introduce the tree homomorphism : T [f#g which just erases the separator marks. If #(t)
R#
t1
R#
t2
R#
R#
is a reduction sequence with R# startin from some t t
R
(t1 )
R
(t2 )
R
tk T , then
(tk )
R
is a one-pass root-started reduction sequence with R. The terms t, (t1 ), . . . , (tk ) are called one-pass root-started sentential forms of t in R. If tk is irreducible in R# , then (tk ) is a one-pass root-started normal form of t in R. The sets of all one-pass root-started sentential forms and normal forms of a -tree t are denoted by 1r SR (t) and 1r NR (t), respectively. This notation is extended to sets of -trees in the natural way. Note that for any TRS R = ( R) and any t T , the sets 1r SR (t) and 1r NR (t) are nite and e ectively computable but that 1r SR (T ) and 1r NR (T ) are not necessarily re ular even for a re ular -tree lan ua e T . The one-pass TRS used for de nin the one-pass leaf-started rewritin mode of a iven TRS is constructed in two sta es. De nition 2.2. Let R = ( R) be a TRS. First we extend R to the set Re of all rules yn ] r[y1 yn ] p[y1 X such that p r R with p, r T n , and for each i, 1 i n, either y yn ] T X . Now let 0 = f 0 f be a disjoint or y 0 , and p[y1 copy of such that for any f , f and f 0 have the same rank. The one-pass 0 # R# ), where leaf-started TRS associated with R is the TRS R# = ( # # is a new unary symbol, the separator mark, and R consists of all rules p[#(x1 ) where p symbol f
r
#(xn )]
#(r0 (x1
xn ))
Re , with p, r T n , and r0 is obtained from r by replacin every by the correspondin symbol f 0 in 0 .
f (x1 c) g(c) c , where = f g c , Example 2.2. Let R = f (g(x1 ) x2 ) 0 = f 0 g 0 c0 and the one-pass leaf-started f 2, g 1 , and c 0 . Then 0 # R# ) where TRS associated with R = ( R) is the TRS R# = ( # R consists of the ve rules f (g(#(x1 )) #(x2 )) f (g(#(x1 )) c)
#(f 0 (x1 c0 )) f (g(c) #(x1 ))
#(f 0 (x1 c0 )) f (g(c) c)
#(f 0 (c0 c0 ))
#(f 0 (c0 c0 )) g(c)
#(c0 )
252
Zoltan F¨ ul¨ op et al.
Clearly, Re = R . The reduction sequences of R# represent reduction sequences of R which start at the leaves of a term and proceed towards the root of it so that symbols introduced by a previous rewrite step never form a part of the left-hand side of the rule applied next. Moreover, R# passes only once over the term because the left-hand sides and the ri ht-hand sides of its rules share only the symbol #. The correspondin one-pass reduction sequence T of R is recovered by applyin the tree homomorphism : T [ 0 [f#g 0 which erases the #-marks and the primes from the symbols f 0 . Then each reduction sequence t
R#
t1
R#
t2
R#
R#
tk
with R# yields the one-pass leaf-started reduction sequence t
R
(t1 )
R
(t2 )
R
R
(tk )
with R. The terms t, (t1 ), . . . , (tk ) are called one-pass leaf-started sentential forms of t in R. If tk is irreducible in R# , then (tk ) is a one-pass leaf-started normal form of t in R. The sets of all one-pass leaf-started sentential forms and normal forms of a -tree t are denoted by 1 SR (t) and 1 NR (t), respectively. This notation is extended to sets of -trees in the natural way. Note that without the new rules of the extended TRS Re many natural one-pass leaf-started rewritin sequences of R could be missed.
3
The One-Pass Root-Started Inclusion Problems
First we consider the one-pass root-started normal form inclusion problem. It is assumed that the tree lan ua es are iven as tree reco nizers. Theorem .1. For any left-linear TRS R = ( R), the followin root-started normal form inclusion problem is decidable. Instance: Reco nizable -tree lan ua es T1 and T2 . Question: 1r NR (T1 ) T2 ?
one-pass
For provin Theorem 3.1, we need the followin auxiliary notation. For a set A of unary symbols such that A \ = and any alphabet Y , let T (A(Y )) be the least subset T of T [A (Y ) for which (1) a(y) T for all a A, y Y , and T implies f (t1 tm ) T . (2) m 0, f m , t 1 , . . . , tm Let A = (A P a0 ) be a top-down -reco nizer. For any a A, n 0 and Xn , any t T n , the set A(a t) ( T (A(Xn ))) is de ned so that (1) for x c P , and A(a c) = A(a x ) = a(x ) , (2) for c 0 , A(a c) = c if a(c) tm ), A(a t) = otherwise, and (3) for t = f (t1 f (s1 For any s of states b
sm ) s1 A(a1 t1 )
sm A(am tm ) a(f )
f (a1
am )
P
X, we denote by st(s x ) the set T (A(X)) and any variable x A such that b(x ) appears as a subterm in s.
On One-Pass Term Rewritin
253
Clearly, A(a t) = i there is a computation of A which starts in state a at the root of t, continues to the leaves of t, and if A reaches in a state b a leaf labelled by a nullary symbol c, then b(c) c is in P . Each s A(a t) represents the situation when such a successful computation has been completed so that all leaves labelled with a nullary symbol have also been processed. If t T n , then an (xn )] and for any t1 , . . . , every s A(a0 t) is of the form s = t[a1 (x1 ) tn ] of the form tn T , the tree s appears in a computation of A on t[t1 a0 (t[t1
tn ])
A
t[a1 (t1 )
an (tn )] = s[t1
tn ]
A
in which each subterm t is processed startin in the correspondin However, if t is not linear, then a variable x may appear in a term s to ether with more than one state symbol, and then the correspondin t should be accepted by a computation startin with each a st(s x
state a . A(a0 t) subterm ).
Proof (of Theorem 3.1). Consider a left-linear TRS R = ( R) and any reco P1 a0 ) and B = (B P2 b0 ) nizable -tree lan ua es T1 and T2 . Let A = (A T2 ). be top-down -reco nizers for which T (A) = T1 and T (B) = T2c (= T We construct a eneralized top-down -reco nizer C such that for any t T , t
T (C) i
t
T (A) and s
T (B) for some s
1r NR (t)
(1)
Then 1r NR (T1 ) T2 i T (C) = , and the latter condition is decidable. Let C = (C P (a0 b0 )) be the eneralized top-down -reco nizer with the state set C = (A (B)) (A (B)), where (B) is the power set of B and A = a a A is a disjoint copy of A, and the set P of transition rules is de ned as follows. The rules are of three di erent types. bk , Type 1. If p r is a rule in R and (a H) A (B), where H = b1 we include in P any rule (a H)(p(x1
xn ))
p[(a1 H1 )(x1 )
(an Hn )(xn )]
an (xn )] A(a p) and there are terms s1 B(b1 r), . . . , where p[a1 (x1 ) st(sk x ) for all i = 1 n. For sk B(bk r) such that H = st(s1 x ) = Hn = should H = (k = 0), this is interpreted to mean that H1 = hold, and if p r is a round rule (n = 0), we include (a H)(p) p in P i k. a(p) A p and b (r) B r for all i = 1 Type 2. Let NI be the set of all terms q T X such that (1) h (q) max h (p) p lhs(R) + 1, and (2) (q) = 0 (p) for all p lhs(R) and all xn ) NI and any (a H) A (B) substitutions and 0 . For each p(x1 bk , we include in P any rule with H = b1 (a H)(p(x1
xn ))
p[(a1 H1 )(x1 )
(an Hn )(xn )]
an (xn )] A(a p), and there are terms s1 B(b1 p), . . . , where p[a1 (x1 ) st(sk x ) for all i = 1 n. The sk B(bk p) such that H = st(s1 x ) cases H = and n = 0 are treated similarly as above. bk , we add to P Type 3. For each (a H) A (B), where H = b1 rules as follows.
254
Zoltan F¨ ul¨ op et al.
(i) For c 0 , we include in P the rule (a H)(c) c for every b H. P2 contains b (c) , m > 0, we add to P all rules (ii) For f m xm ))
(a H)(f (x1
c i a(c)
f ((a1 H1 )(x1 )
c is in P1 and
(am Hm )(xm ))
xm )) f (a1 (x1 ) am (xm )) is in P1 , and there are xm )) f (b 1 (x1 ) b m (xm )) (i = 1 k) in P2 such bkj for each j = 1 m.
where a(f (x1 rules b (f (x1 that Hj = b1j
We can show that C has the property described in (1). If t (a0 b0 )(t) C t and this derivation can be split into two parts (a0
b0 )(t)
C
t[(a1 H1 )(t1 )
C
(an Hn )(tn )]
t[t1
T (C), then
tn ] = t
(2)
T and (a H ) A (B). where n 0, t T n and, for every 1 i n, t an (xn )] In the rst part of (2) only Type 1 rules are used, and hence t[a1 (x1 ) A(a0 t). Moreover, for some k 0, s T k , and s1 , . . . , sk T , tn ])
#(t) = #(t[t1
R#
R#
s[#(s1 )
#(sk )] = s
where every sj is a copy of exactly one of the t . (Of course, sj may be equal n, let K(i) = j sj is a copy of t . to more than one t .) For each i = 1 st(u xj ) j K(i) for all i = 1 n. Then for some u B(b0 s), H = sk ] In the second part of (2), it is rst checked usin Type 2 rules that s[s1 1r NR (t), and the computations (a H )(t ) C t are nished usin Type T (A a ) and (b) 3 rules. That means for every i = 1 n, that (a) t T (B b) for all b H . Therefore t a0 (t)
A
t[a1 (t1 )
and there are b1 , . . . , bk b0 (s[s1
sk ])
an (tn )]
A
t[t1
tn ] = t
B such that B
s[b1 (s1 )
bk (sk )]
B
s[s1
sk ]
The converse of (1) can be proved similarly. The correspondin result for sentential forms can be proved by modifyin suitably the de nition of the reco nizer C. Theorem .2. For any left-linear TRS R = ( R), the followin root-started sentential form inclusion problem is decidable. Instance: Reco nizable -tree lan ua es T1 and T2 . Question: 1r SR (T1 ) T2 ?
4
one-pass
The One-Pass Leaf-Started Inclusion Problems
Now we consider the one-pass leaf-started sentential form inclusion problem. A ain the tree lan ua es are assumed to be iven in the form of tree reco nizers.
On One-Pass Term Rewritin
255
Theorem 4.1. For any left-linear TRS R = ( R), the followin one-pass leafstarted sentential form inclusion problem is decidable. Instance: Reco nizable -tree lan ua es T1 and T2 . Question: 1 SR (T1 ) T2 ? P2 Bf ) be bottom-up -reco Proof. Let A = (A P1 Af ) and B = (B nizers that reco nize T1 and T2 , respectively. We may assume that B is total deterministic. We construct a eneralized bottom-up -reco nizer C = (C P Cf) such that T (C) = i 1 SR (T1 ) T2 as follows. Let C = (A B) (A B), where A = a a A and B = b b B , b b (B Bf ) . The set P consists of the and let Cf = a a Af followin rules which are of three di erent types. Type 1. For every p r Re with p, r T n , n 0, and for all a1 , . . . , an , an ] A a and r[b1 bn ] B b, a A, b1 , . . . , bn , b B such that p[a1 (an bn )] (a b) let P contain the rule p[(a1 b1 ) Type 2. For all a A and b B, let (a b) (a b) be in P . 0, f (a1 am ) a P1 and f (b1 bm ) Type 3. For all f m, m (am bm )) (a b) b P2 , let P contain f ((a1 b1 ) The way C processes a -tree t can be described as follows. First C, usin rules of Type 1, follows some one-pass leaf-started rewritin sequences by R on subtrees of t computin in the rst components of its states the evaluations by A of these subtrees and in the second components the evaluations by B of the translations of the subtrees produced by these one-pass leaf-started rewritin sequences. At any time C may switch by rules of Type 2 to a mode in which it by rules of Type 3 computes in the rst components of its states the evaluation by A of t and in the second components the evaluation by B of the one-pass leaf-started sentential form of t produced by R when the rewritin sequences on the subtrees are combined. This means that for any t T , a A and b B, t
C
(a b)
i
t
A
a and s
B
b for some s
1 SR (t)
which, by recallin the de nition of Cf , implies immediately that T (C) = 1 SR (T1 ) T2 , as required.
i
Finally, we turn to one-pass leaf-started normal forms. Theorem 4.2. For any left-linear TRS R = ( R), the followin one-pass leafstarted normal form inclusion problem is decidable. Instance: Reco nizable -tree lan ua es T1 and T2 . Question: 1 NR (T1 ) T2 ? P2 Bf ) be total deterministic Proof. Let A = (A P1 Af ) and B = (B bottom-up -reco nizers such that T (A) = T1 and T (B) = T2 . We construct a eneralized bottom-up -reco nizer C = (C P Cf ) such that T (C) = i 1 NR (T1 ) T2 as follows. Let mx = max h (p) p lhs(Re ) and Tmx = t T X h (t) mx . ok )), where A = a a A and Now let C = (A B) (A B (Tmx
256
Zoltan F¨ ul¨ op et al.
B = b b B , and Cf = a a Af b b (B Bf ) (Tmx ok ). The set P consists of the followin rules of ve di erent types. T n, n 0, and any Type 1. For every rule p r Re with p, r an ] A a and states a1 , . . . , an , a A, b1 , . . . , bn , b B such that p[a1 bn ] B b, let P contain the rule p[(a1 b1 ) (an bn )] (a b) r[b1 Type 2. For all a A and b B, let (a b) (a b x1 ) be in P . 0, u1 , . . . , um , u Tmx , f (a1 am ) Type 3. For all f m, m bm ) b P2 such that u = f (u1 um ) and u a P1 and f (b1 (am bm um )) (a b u) For (Tmx lhs(Re )), let P contain f ((a1 b1 u1 ) m = 0, we et f (a b f ). 0, f (a1 am ) a P1 , f (b1 bm ) Type 4. For any f m, m um ) Tmx , let P contain b P2 and u1 , . . . , um Tmx such that f (u1 (am bm um )) (a b ok) the rule f ((a1 b1 u1 ) with m 1, a1 , . . . , a m , a A, b1 , . . . , bm , Type 5. For any f m Tmx ok such that ok y1 ym , b B, and sequence y1 , . . . , ym am ) a P1 , f (b1 bm ) b P2 , let P contain the rule f (a1 (am bm ym )) (a b ok) f ((a1 b1 y1 ) ok , It can now be shown that for any t T , a A, b B and y Tmx t
C
(a b y) i
and hence T (C) =
t
A
i 1 NR (T1 )
a and s
B
b for some s
1 NR (t)
T2 .
References 1. J. Avenhaus. Reduktionssysteme. Sprin er, 1995. 2. M. Dauchet and F. De Comite. A ap between linear and non-linear term-rewritin systems. In RTA-87, LNCS 256. Sprin er, 1987, 95 104. 3. N. Dershowitz and J.-P. Jouannaud. Rewrite Systems, volume B of Handbook of Theoretical Computer Science, chapter 6, pa es 243 320. Elsevier, 1990. 4. A. Deruyver and R. Gilleron. The reachability problem for round TRS and some extensions. In TAPSOFT’89, LNCS 351. Sprin er, 1989, 227 243. 5. J. En elfriet and E. M. Schmidt. IO and OI. Part I. J. Comput. Syst. Sci., 15(3):328 353, 1977. Part II. J. Comput. Syst. Sci., 16(1):67 99, 1978. 6. F. Gecse and M. Steinby. Tree automata. Akademiai Kiado, Budapest, 1984. 7. F. Gecse and M. Steinby. Tree Lan ua es, volume 3 of Handbook of Formal Lan ua es, chapter 1, pa es 1 68. Sprin er, 1997. 8. R. Gilleron. Decision problems for term rewritin systems and reco nizable tree lan ua es. In STACS’91, LNCS 480. Sprin er, 1991, 148 159. 9. R. Gilleron and S. Tison. Re ular tree lan ua es and rewrite systems. Fundam. Inf., 24(1,2):157 175, 1995. 10. D. Hofbauer and M. Huber. Linearizin term rewritin systems usin test sets. J. Symb. Comput., 17(1):91 129, 1994. 11. G. Kucherov and M. Tajine. Decidability of re ularity and related properties of round normal form lan ua es. Inf. Comput., 118(1):91 100, 1995. 12. S. Va v¨ ol yi and R. Gilleron. For a rewrite system it is decidable whether the set of irreducible, round terms is reco nizable. Bull. EATCS, 48:197 209, 1992.
On the Word, Subsumption, and Complement Problem for Recurrent Term Schematizations (Extended Abstract) Miki Hermann1 and Gernot Salzer2 1 2
LORIA (CNRS), BP 239, 54506 Vand uvre-les-Nancy, France.
[email protected] Technische Universit¨ at Wien, Karlsplatz 13, 1040 Wien, Austria. salzer@lo ic.at
Abs rac . We investi ate the word and the subsumption problem for recurrent term schematizations, which are a special type of constraints based on iteration. By means of uni cation, we reduce these problems to a fra ment of Presbur er arithmetic. Our approach is applicable to all recurrent term schematizations havin a nitary uni cation al orithm. Furthermore, we study a particular form of the complement problem. Given a nite set of terms, we ask whether its complement can be nitely represented by schematizations, usin only the equality predicate without ne ation. The answer is ne ative as there are round terms too complex to be represented by schematizations with limited resources.
1
Introduction
In nite sets of rst-order terms with structural similarities appear frequently in several branches of automated deduction, like lo ic pro rammin , model buildin , term rewritin , equational uni cation, or clausal theorem provin . They are usually produced by saturation-based procedures, like equational completion or hyper-resolution. A usual requirement for e ective use of such sets is the possibility to handle them by nite means. There exist several approaches to cope with this phenomenon, like lazy evaluation, set constraints, or term schematizations. Lazy evaluation usually does not combine well with uni cation or other operations. Set constraints allow to describe re ular sets of rst-order terms, usin the potential of re ular tree rammars and tree automata, and havin the ood properties of re ular tree lan ua es. Schematizations exploit the recurrin term structure in in nite sets, as produced by self-resolvin clauses or by self-overlappin rewrite rules. Several formalisms for recurrent term schematizations were introduced within the last years. They rely on the same principle, namely the iteration of rstorder contexts, but di er in the expressive power. The main concern in this ?
Full version is at http://www.loria.fr/∼hermann/publications/redelim.ps. z. This work was done while the second author was visitin LORIA and was funded by Univeriste Henri Poincare, Nancy 1.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 257 266, 1998. c Sprin er-Verla Berlin Heidelber 1998
258
Miki Hermann and Gernot Salzer
work is the decidability of uni cation and the construction of nite complete sets of uni ers. Formalisms satisfyin these requirements are -terms [CH95], Iterms [Com95], R-terms [Sal92], and primal rammars [HG97], all of them with a nitary uni cation al orithm. Set operations were studied in [AHL97]. Applications of recurrent schematizations are quite rare and mostly theoretical, like in model buildin [Pel97] or cycle uni cation [Sal94]. One reason is that there are still some open problems to be solved prior to a successful implementation. A sine qua non of automated deduction is redundancy elimination. The elementary tools in this respect are testin for equality and subsumption. In other words, we need to solve the word problem and the subsumption problem for recurrent term schematizations. Moreover, only positive set operations were studied in [AHL97] without considerin the complement. Complement buildin is interestin from the al ebraic and lo ic point of view, e. ., durin construction of counter-examples or for quanti er elimination. In the rst part of the paper, we investi ate the word and the subsumption problem for primal rammars. By means of uni cation, we reduce them to a problem in Presbur er arithmetic. Our approach is applicable to all recurrent term schematizations havin a nitary uni cation al orithm. In the second part, we study a particular form of the complement problem. Given a nite set of terms, we ask whether its complement can be represented nitely by schematizations, usin only the equality predicate without ne ation. The answer is ne ative as there are round rst-order terms too complex to be represented by primal rammars with limited resources.
2 2.1
Term Schematizations Syntax
The lan ua e of primal terms is based on four kinds of symbols: rst-order 0, and variables V, counter variables C, function symbols Fp of arities p de ned symbols Dq p of counter arities q 1 and rst-order arities p 0. Nullary function symbols are called constants. The set of all function and de ned symbols is denoted by F and D, respectively. Let N be the set of natural numbers. The set of counter expressions L is the set of linear expressions over C with coe cients in N . Two counter expressions are considered equal if they are equivalent with respect to the usual equalities of addition and multiplication. Furthermore, we drop parentheses where possible and do not distin uish between natural numbers and their symbolic representation. The set of primal terms P is de ned inductively as the smallest set satisfyin P p ; f (l; ) P the followin conditions: V P; f ( ) P if f Fp and P p . The sets of counter variables and rst-order if f Dq p , l Lq , and variables of a primal term t are denoted by CVar(t) and Var(t), respectively.
On the Word, Subsumption, and Complement Problem
2.2
259
Semantics
In the sequel, we assume that the reader is familiar with the basic notions of term rewritin . With each de ned symbol f Dq p , we associate two rewrite rules f (0 n; x)
r1f and f (m + 1 n; x)
r2f [f (m n + ; x)]A , where m n
and x are counter variables and rst-order variables, respectively; r1f and r2f are primal terms, whose variables are amon those of the left hand sides of the rules; all de ned symbols in r1f and r2f are smaller than f with respect to a iven precedence relation on the de ned symbols; A is a set of independent rst-order positions of r2f without the root position; is either the null vector or a kdimensional unit vector, i.e., all components of are zero except one which may be zero or one. The rst-order positions are those not below a de ned symbol. Two positions are independent if none is a pre x of the other. Let R be the set of all rewrite rules associated with the de ned symbols. The rewrite relation − R enerated by R is the smallest relation that contains R, and is closed under con ruence and substitution. By t R we denote the normal form of t with respect to R. Note that t R is a rst-order term if t contains no counter variables. The rst-order terms represented by a primal term t are de ned as L(t) = t R : C − N . Two primal terms s and t are equivalent, denoted by s = t, if s R = t R holds for all substitutions : C − N . 2.
Uni cation
A substitution is a mappin : (V C) − (P L), which is well-typed and whose domain is nite, i.e., (x) P for x V, (n) L for n C, and dom( ) = v (V C) (v) = v is nite. The application of to a term t is written as t ; the composition of two substitutions is written as with the understandin that t = (t ) for all terms t. We denote by the set v v v dom( ) . Normalization is extended to substitutions in the v R v dom( ) . natural way, i.e., R = v A substitution is a uni er of two primal terms s and t i for all : C − N the rst-order substitution R uni es the rst-order terms s R and t R . A set of uni ers is complete i for every counter substitution there exists , such that R is a most eneral uni er of s R and t R . Note that is a uni er of s and t i s = t , i.e., our notion of uni ability corresponds to the standard one in uni cation theory. This is not true for completeness: a uni er need not be an instance of any substitution in a iven complete set of uni ers. Uni cation of primal terms is decidable and nitary, i.e., for any pair of primal terms there exists a nite set of uni ers which is complete. Moreover, complete sets of uni ers can be e ectively computed [HG97]. 2.4
First-Order Formulas
In this paper, we use rst-order formulas to de ne the word problem in a concise way and to compare di erent notions of subsumption. Quanti ed counter
260
Miki Hermann and Gernot Salzer
variables are interpreted over the domain of natural numbers, quanti ed rstorder variables over the Herbrand universe with respect to the underlyin set of function symbols. Free variables are treated as constants. Additionally, we use vectors and notations from linear al ebra as a compact representation of similar objects. For example, x = s(k) stands for a set of equations of the form x = s(k), where x is a variable from x and s s is a term from k. Furthermore, n Ck + c represents containin variables k1 k2 the substitution replacin each variable in n by the correspondin row in the vector of linear expressions, which is obtained by multiplyin the matrix C of natural numbers by the vector k of counter variables and addin the vector c. Let s and t be primal terms containin the variables x = Var(s), y = Var(t), m = CVar(s) and n = CVar(t). A complete set of uni ers for s and t can be considered as a solved form of the equation s = t in the followin way. A t0 (k) m Ck + c n Dk + d , where k uni er = x s0 (k) y are auxiliary counter variables introduced durin uni cation, corresponds to the formula (x y m n) = k x = s0 (k) y = t0 (k) m = Ck+c n = Dk+d . Note that uni cation does not introduce auxiliary rst-order variables. However, s0 and t0 may contain variables from x and y; in this case these variables do not occur in the domain of the substitution. The formula associated with a complete set of uni ers is the disjunction of the formulas correspondin to the sin le W (x y m n) = (x y m n). Therefore the formulas s = t uni ers: 2 (x y m n) are equivalent. and 2.5
Miscellaneous Notations
If t is a primal term and A Pos(t) is a set of independent rst-order positions, then t[ ]A is called a context. If s is a context and t is a context or primal term, then the concatenation of s and t, denoted by s t, is the context or primal term s t . Concatenation is associative, hence we drop parentheses where possible. The empty context serves as unit element with respect to concatenation. Exponentiation is de ned by s0 = and s +1 = s s . The depth of a primal term t, denoted by depth(t), is recursively de ned as depth(t) = 0 for t (V F0 ), and depth(f ( )) = depth(f (l; )) = 1 + depth( ) for f Fp (p > 0) and f D. The depth of a set or vector of terms is de ned as depth( ) = max depth(t) t . The depth of the set of rewrite rules R associated with D is the depth of the set of all ri ht hand sides: depth(R) = depth( r1f r2f [f (m n + ; x)]A f
D ).
Redundancy Elimination Recurrent term schematizations are of potential use in all areas concerned with rst-order terms, mostly in automated deduction, like term rewritin with equational completion and proofs by consistency, or clausal theorem provin . An ubiquitous problem appearin there is the duplication of objects. Redundancy
On the Word, Subsumption, and Complement Problem
261
elimination plays therefore a vital role. In the simplest case, we need to maintain the set property, where no element (term, clause, literal) must occur twice. Another case of redundancy is the presence of two elements, where one is an instance of the other. In the rst case we have to solve the word problem, i.e., to determine whether two terms s and t represent the same object in the underlyin theory. The latter case is usually referred to as the subsumption problem. .1
Word Problem
De nition 1. The word problem for two primal terms s and t is the question whether the formula n (s = t) is valid in the equational theory enerated by R, where n = CVar(s) CVar(t). One possibility to solve the word problem is to reduce s and t to unique normal forms, followed by a check whether the latter are syntactically equal. This approach is described for R-strin s in [Sal91]. In this paper, we choose a di erent approach: we transform the word problem to a uni cation problem and a subsequent problem in Presbur er arithmetic. The rst method is e cient but works only if we can de ne a unique normal form. In eneral, there is no obvious way of de nin the normal form of a primal term. Our approach does not depend on a speci c syntactic representation for schematizations, but requires only the existence of a nitary and terminatin uni cation al orithm. Therefore, our method is applicable to all known recurrent schematizations, i.e., to -terms, I-terms, R-terms, and primal rammars. We proceed in three steps. 1. Elimination of rst-order variables: replace all rst-order variables by new constants. Observe that the formula n(s = t) is valid if and only if the correspondin formula n(s = t ) is valid, where the terms s t are obtained from the terms s t by replacin each rst-order variable x by a new constant cx . 2. Uni cation: solve the equation s = t . We solve the equation s = t by means of uni cation. Note that a nitary and terminatin uni cation al orithm exists for all four known recurrent schematizations. This means that the output of the uni cation al orithm is a nite disjunction of formulas k(n = N k + d ), where N and d is a matrix and a vector of non-ne ative inte ers, respectively, and k are new counter W variables introduced durin uni cation. The resultin formula (n) = k (n = N k + d ) contains only counter variables, since there are no rst-order variables in s and t . 3. Validity check: check whether the formula n (n) is valid. The formula (n) represents a complete set of uni ers, one per disjunct, of the problem s = t . To show that the universally quanti ed formula n(s = t ) is valid, we need to prove that the uni ers from (n) cover the whole Cartesian product N j nj . By correctness of the applied uni cation al orithm, the formulas n(s = t ) and n (n) are equivalent. The latter expression is a 2 -formula of Presbur er arithmetic and can be solved by usual methods [Coo72].
262
.2
Miki Hermann and Gernot Salzer
Subsumption Problem
In the rst-order case, a term s subsumes a term t if there exists a substitution , such that s = t. In the free al ebra, this is equivalent to x(s = t), where x = Var(s). An alternative de nition is that the formula y x(s = t) is valid, where x = Var(s) and y = Var(t). These two de nitions are equivalent, except for sin ular si natures, since in the empty theory (without axioms) validity in the equational theory is equivalent to validity in the inductive theory. For schematizations, there are several possibilities to de ne subsumption. Let s and t be two primal terms from a schematization G, where m = CVar(s), n = CVar(t), x = Var(s), and y = Var(t). Recall that we check the validity of formulas in the equational theory of R, i.e., the free al ebra enerated by R. The possibilities to de ne that s subsumes t are: (1) the formula m x(s = t) is valid; (2) the formula n y m x(s = t) is valid; (3) the formula n m(s = t) is valid; (4) the formula n m x(s = t) is valid. The rst two approaches are strai htforward extensions of the rst-order concept. The second approach does not meet a natural requirement for subsumption, namely independence of the underlyin si nature. Subsumption should be a local test on two terms independent of other elements. There exist two terms s, t, such that s subsumes t (accordin to the second de nition) over a si nature F , but not over an extended si nature F 0 F [AHL97, Example 14]. The same terms also show that the rst two subsumption concepts are not equivalent, since there is no substitution , such that s = t, as required by the rst concept. The problems with the second concept ori inate from quanti cation over rst-order variables. One possibility to avoid them is to quantify only the counter variables, as in the third approach. This concept is not satisfactory either, since it does not capture usual rstorder subsumption. When we extend the third concept with usual equational rst-order subsumption, we et the fourth concept. Hence, we have two suitable concepts for subsumption: the rst and the last one. Intuitively, the rst concept expresses that there is a uniform mappin , relatin the term s and t in the equational theory of the schematization. In particular, for the counter variable vectors m and n, this means that m is a linear expression of n. In contrast, the fourth concept requires this uniformity only on the rst-order level; the vectors m and n need not be related by a linear function. Clearly, the rst concept implies the fourth concept. The converse is not true. The last subsumption concept encompasses the rst one. Moreover, the last concept corresponds to the natural view that schematizations are just a nite representation of in nite sets of rst-order terms: s subsumes t if every term represented by t is subsumed by a term represented by s. Therefore we adopt the last concept of subsumption. De nition 2. Let s and t be primal terms, where m = CVar(s), n = CVar(t), and x = Var(s). The term s subsumes t if the formula n m x(s = t) is T there exists a term valid. A set S subsumes a set T if for each term t0 s0 S, such that s0 subsumes t0 .
On the Word, Subsumption, and Complement Problem
263
A primal term s subsumes a primal term t i the set L(s) subsumes the set L(t). Similar to the word problem, we want to reduce subsumption to uni cation. We proceed in four steps: we replace certain rst-order variables by new constants, apply the uni cation al orithm, simplify the resultin formula, and check its validity in Presbur er arithmetic. 1. Elimination of rst-order variables in t: replace all rst-order variables in t by new constants, producin the term t . The formula n m x(s = t) is valid i n m x(s = t ) holds by the way how we interpret free variables. orithm. 2. Uni cation: solve the equation s = t by means of a uni cation al W Its output can be written as the nite formula (m n x) = k (x = u (k) m = M k+c n = N k+d ), where k are the new counter variables introduced durin uni cation, M , N are matrices of non-ne ative inte ers, and c , d are vectors of non-ne ative inte ers. 3. Simpli cation: remove the equations x = u (k) and m = M k + c from 0 (n). Note that m x (m n x) is the formula (m n x), producin 0 equivalent to (n), since the variables m and x are existentially quanti ed and appear only once and separated on the left-hand sideW of equations. 4. Validity check: check if n 0 (n) is valid. The result n k (n = N k + d ) belon s to the 2 -fra ment of Presbur er arithmetic. .
Complexity Issues
Both the word problem and the subsumption problem reduce in the last step to a 2 -formula in Presbur er arithmetic. While the complexity of full Presbur er arithmetic is at least doubly exponential and Cooper presents in [Coo72] an al orithm of triple exponential complexity, the 2 -fra ment is only coNP-complete, as it was proved by Gr¨ adel [Gr¨ a88] and Sch¨ onin [Sch97]. Our formulas are quite W simple and do not cover the whole 2 -fra ment: they are of the form n k (n = N k + d ), i.e., the formula is in disjunctive normal form and the variables n appear only once separated on the left-hand side. Therefore we can ask whether our special problems are still coNP-complete. The lower bound reductions used by Gr¨ adel and Sch¨ onin require more complex formulas. However, followin an idea in [Sch97], due to Gr¨ adel, we can prove the coNP-hardness of our problems by a reduction from simultaneous incon ruences [GJ79]. This (ap bp ) of NP-complete problem is de ned as follows: iven a set (a1 b1 ) b , the problem asks whether there is ordered pairs of positive inte ers, with a an inte er n such that n a ( mod b ) holds for all i. We use the dual problem to + a ), we obtain show coNP-hardness. Wp Encodin n a (modb ) as k(n = b k W the disjunction k =1 (n = b k+a ). The nal formula is n k (n = b k+a ), which is of the same type as the formulas obtained from word and subsumption problems. Note that in both cases only the problem solved in the last step is coNP-complete. The overall complexity of our al orithms is determined by the complexity of uni cation. In particular, the cardinality of a minimal complete set of uni ers can be at least exponential [Sal91]; and we have to compute all solutions to obtain the formula. Hence, the formula in the last step can be exponentially lon er than the input of the ori inal problem.
264
4
Miki Hermann and Gernot Salzer
Complement Problem
If t is a rst-order term, its Herbrand universe is H(t) = t : X − T (F ) , the set of the round instances of t with respect to the underlyin si nature F . Similarly, if T is a set of rst-order terms, its Herbrand universe H(T ) is the union of the Herbrand universes H(t) for each t T . For a primal term t, its Herbrand universe is the set H(L(t)), i.e., the Herbrand universe of the schematized set. Finally, the Herbrand universe of a set of primal terms T is obtained as the union of the Herbrand universes H(t) for each t T . Given a set of rst-order or primal terms T , its complement is the set T c = T (F ) H(T ). A class C is a collection of sets of terms satisfyin a common property. For a iven class C , the complement problem is the question whether for each nite set of terms T C there exists a nite set of terms T 0 C , such that H(T 0 ) = T c holds. The set T 0 is called a nite complement representation. For rst-order terms, Lassez and Marriott proved that nite sets of linear terms always have a nite complement representation [LM87]. On the other hand, they showed that this is not true for arbitrary nite sets of rst-order terms. Since schematizations were introduced to increase the expressive power of rst-order terms, we mi ht expect to be able to represent the complements of non-linear terms by a nite set of primal terms. However, as we show in the sequel, already the very simple non-linear term f (x x) has no nite complement representation by primal terms. The potential of primal terms resides in the possibility to enerate arbitrarily deep terms by iteratin contexts. The expressive power of iteration is limited by the fact that the number of contexts must be nite. The maximal number of consecutive iterations durin a reduction of a primal term is measured by the iteration depth. Each iteration terminates with the application of the base rule f (0 ) r1f for some de ned symbol f . Therefore we can determine the iteration depth by countin the occasions when a variable ets decremented to 0. The iteration depth of a primal term is then the maximum over all reductions. Inspection of the rewrite system R reveals that there is a correspondence between the application of base rules and the number of counter positions present in the primal term: each iteration consumes a counter position. De nition . The terat on depth of a primal term is the function recursively as follows:
de ned
(x) = (a) = 0 for a rst-order variable x and a constant a, tn )) = max (t ) i = 1 n for an n-ary function symbol f , (f (t1 tn )) = c + max (t ) i = 1 n for a de ned symbol f . (f (c; t1 The iteration depth naturally extends to a set of primal terms T , de ned by (T ) = max (t) t T . This de nition emphasizes the static aspect by lookin at the primal term only. The operational aspect, namely countin the occasions when a variable is
On the Word, Subsumption, and Complement Problem
decremented to 0, is expressed by the equalities (f (0 (r2f
265
) ) = 1 + (r1f ) and
) for each de ned symbol f and substitution . (f (n + 1 ) )= Iteration of contexts consumes resources of the primal term. On one hand, a sin le iteration can produce an arbitrarily deep term. On the other hand, there are round rst-order terms that require a certain iteration depth. We use two di erent contexts, f ( a) and f (a ), to force a consumption of resources. Consider the round term s = f ( a)m a. If the value of m is su ciently lar e, then a primal term t representin s must contain a de ned symbol throu h which we iterate the context f ( a), and the iteration depth of t must be at least 1. If we simply concatenate two blocks of the same context, like in f ( a)m f ( a)m a, we do not necessarily need to increase the iteration depth of the primal term. However, if we insert the context f (a ) between the two blocks, producin the term s = f ( a)m f (a ) f ( a)m a, we force a primal term t representin s to have an iteration depth of at least 2. Repeatin the step, this idea leads to an upper bound on the number of context blocks f ( a)m f (a ) that can be represented by a iven primal term t. Lemma 1. Let t be a primal term without rst-order variables and let s = w (f ( a)m f (a ))n a be a round rst-order term, where w is a proper subcontext of f ( a)m f (a ). If s L(t) and m > (t) depth(R) + depth(t) then n (t). The lemma indicates that if we choose the value of n in the term s lar er than the iteration depth (t) of the primal term t, then we cannot represent s by t usin iteration only. Therefore, the term t must contain variables. Corollary 1. If s = (f ( a)m f (a ))n a is an instance of a primal term t with (t) < n and m > (t) depth(R) + depth(t), then t must end with a variable. We show by contradiction that the complement of the rst-order term f (x x) has no nite representation. The underlyin idea is to choose a round term s = f (s1 s2 ) from the complement, such that both s1 and s2 are too complex to be produced by iteration alone, and s2 is twice as deep as s1 . Therefore a term representin s must be of the form f (u v), where both u and v end with variables y and z, respectively. If y = z then the terms f (u v) and f (x x) are uni able, contradictin the assumption that f (u v) represents (part of) the complement of f (x x). If y = z, then there is no substitution , such that u R = s1 and v R = s2 hold. Theorem 1. The complement of a nite set of rst-order terms cannot be represented in eneral by a nite set of primal terms.
5
Conclusion
We presented eneral al orithms for solvin the word and the subsumption problem for primal terms that also work for -terms, I-terms, and R-terms. The al orithms require a nitary uni cation al orithm for the schematization formalisms,
266
Miki Hermann and Gernot Salzer
as well as a solver for the 2 -fra ment of Presbur er arithmetic. Still, there are some problems left, especially concernin e ciency. For the word problem, it would be interestin to have an al orithm that computes rst a suitable normal form of primal terms, followed by a syntactic comparison. Al ebraically, this amounts to axiomatizin the theory of primal terms. We also showed that equations and primal terms are not su cient for describin in eneral the complement of rst-order terms. This result trivially extends to recurrent term schematizations, since rst-order terms are just a special case. On the other hand, the complement problem is easily solvable if we extend the lan ua e by ne ation and quanti cation. Then the complement can be expressed by a formula in the rst-order theory of term schematizations. In this context, we are interested in decidin the validity of formulas and in obtainin solved forms, e. ., by quanti er elimination. Peltier showed in [Pel97] that the rstorder theory of R-terms is decidable by quanti er elimination. The decidability of the rst-order theory of primal terms is still an open problem.
References AHL97. A. Amaniss, M. Hermann, and D. Lu iez. Set operations for recurrent term schematizations. In M. Bidoit and M. Dauchet, editors, Proc. 7th TAPSOFT Conference, Lille (France), LNCS 1214, pa es 333 344. Sprin er, 1997. CH95. H. Chen and J. Hsian . Recurrence domains: Their uni cation and application to lo ic pro rammin . Information and Computation, 122:45 69, 1995. Com95. H. Comon. On uni cation of terms with inte er exponents. Mathematical Systems Theory, 28(1):67 88, 1995. Coo72. D.C. Cooper. Theorem provin in arithmetic without multiplication. In B. Meltzer and D. Mitchie, editors, Machine Intelli ence, volume 7, pa es 91 99. Edinbur h University Press, 1972. GJ79. M.R. Garey and D.S. Johnson. Computers and intractability: A uide to the theory of NP-completeness. W.H. Freeman and Co, 1979. Gr¨ a88. E. Gr¨ adel. Subclasses of Prebur er arithmetic and the polynomial-time hierarchy. Theoretical Computer Science, 56(3):289 301, 1988. HG97. M. Hermann and R. Galbavy. Uni cation of in nite sets of terms schematized by primal rammars. Theoretical Computer Science, 176(1-2):111 158, 1997. LM87. J.-L. Lassez and K. Marriott. Explicit representation of terms de ned by counter examples. J. Automated Reasonin , 3(3):301 317, 1987. Pel97. N. Peltier. Increasin model buildin capabilities by constraint solvin on terms with inte er exponents. J. Symbolic Computation, 24(1):59 101, 1997. Sal91. G. Salzer. Deductive eneralization and meta-reasonin , or how to formalize ¨ Genesis. In Osterreichische Ta un f¨ ur K¨ unstliche Intelli enz, InformatikFachberichte 287, pa es 103 115. Sprin er, 1991. Sal92. G. Salzer. The uni cation of in nite sets of terms and its applications. In A. Voronkov, editor, Proc. 3rd LPAR Conference, St. Petersbur (Russia), LNCS (LNAI) 624, pa es 409 420. Sprin er, 1992. Sal94. G. Salzer. Primal rammars and uni cation modulo a binary clause. In A. Bundy, editor, Proc. 12th CADE Conference, Nancy (France), LNCS (LNAI) 814, pa es 282 295. Sprin er, 1994. Sch97. U. Sch¨ onin . Complexity of Presbur er arithmetic with xed quanti er dimension. Theory of Computin Systems, 30(4):423 428, 1997.
Encodin the Hydra Battle as a Rewrite System Helene Touze Loria Universite Nancy 2 BP 239, 54506 Vand uvre-les-Nancy, France touzet@lor a.fr
Abs rac . In rewritin theory, termination of a rewrite system by Kruskal’s theorem implies a theoretical upper bound on the complexity of the system. This bound is, however, far from havin been reached by known examples of rewrite systems. All known orderin s used to establish termination by Kruskal’s theorem yield a multiply recursive bound. Furthermore, the study of the order types of such orderin s su ests that the class of multiple recursive functions constitutes the least upper bound. Contradictin this intuition, we construct here a rewrite system which reduces by Kruskal’s theorem and whose complexity is not multiply recursive. This system is even totally terminatin . This leads to a new lower bound for the complexity of totally terminatin rewrite systems and rewrite systems which reduce by Kruskal’s theorem. Our construction relies on the Hydra battle usin classical tools from ordinal theory and subrecursive functions.
Introduction One of he main ques ions in rewri ing heory is ha of ermina ion, which has long been known o be undecidable. Mos of he ermina ion proof echniques developed in erm rewri ing heory ake advan age of a powerful combina orial resul , Kruskal’s ree heorem. Kruskal’s heorem furnishes a su cien syn ac ic condi ion for ermina ion: every rewri e sys em which is compa ible wi h he homeomorphic embedding rela ion is ermina ing. This heorem has given rise o he de ni ion of several proof me hods, such as he mul ise pa h ordering, he lexicographic pa h ordering, he Knu h-Bendix orderings, polynomial in erpre aions. All hese me hods yield he exis ence of a o al s ric ly mono one ordering compa ible wi h he homeomorphic embedding rela ion. This corresponds o he concep of total termination, in roduced by Ferreira and Zan ema in [4]. I seems ha any reasonable e ec ive me hod used o es ablish ermina ion by Kruskal’s heorem implies o al ermina ion. For prac ical purposes, ermina ion is no enough. I is wor h knowing he complexi y of a given rewri e sys em, by measuring he number of rewri e s eps necessary o reach a normal form. We call his he derivation len th. The complexi y of he o al ermina ion orderings men ioned above has been characerised: ermina ion under he mul ise pa h ordering implies primi ive recursive deriva ion leng h (Hofbauer [5]), ermina ion under he Knu h-Bendix ordering LuboVs Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 267 276, 1998. c Sprin er-Verla Berlin Heidelber 1998
268
Helene Touzet
implies mul iply recursive deriva ion leng h (Hofbauer [6]), and ermina ion under he lexicographic pa h ordering implies mul iply recursive deriva ion leng h (Weiermann [11]). Wha is known in he general case of o al ermina ion ? More generally, wha is he expressivi y of Kruskal’s heorem when applied o ni e rewri e sys ems ? Weiermann has produced a heore ical upper bound for he complexi y of ermina ing rewri e sys ems by Kruskal’s heorem, using he Hardy hierarchy: he leng h of a deriva ion is domina ed by he Hardy func ion (0) , where Ω (0) is an ordinal no a ion from Bachmann’s sys em for (s ) Ω he small Veblen ordinal. To give a proof heore ic in ui ion abou his measure, primi ive recursion corresponds o he provably o al func ions of he 01 − Ind fragmen of Peano ari hme ic and mul iple recursion corresponds o he 02 −Ind (0) fragmen . However (s ) Ω is no even provably o al in AT R0 . So here is a huge gap be ween he upper bound formula ed by Weiermann and he observed complexi y of common rewri e sys ems. Weiermann concluded his ar icle by emphasising ha i is an open problem o prove or disprove ha here are always mul iply recursive bounds on he deriva ion leng hs of a ni e rewri e sys em R over a ni e signa ure, for which he rewri e rela ion R is con ained in a simpli ca ion ordering ( ). In addi ion o he prac ical in eres of knowing he expressivi y of o al ermina ion orderings, here is a heore ical issue. The s udy of known o al ermina ion orderings ells us ha i is possible o classify he deriva ion leng hs wi h he order ype of he ordering. More precisely, he deriva ion leng h is connec ed o he order ype hrough he so called slow-growing hierarchy. Can his resul ex end o all o ally ermina ing rewri e sys ems, or even o all sysems reducing by Kruskal’s heorem, as sugges ed by Cichon in [2] ? For he homeomorphic embedding of Kruskal’s heorem, he maximal order ype was s udied by Schmid [9]: i corresponds o he mul iply recursive func ions in he slow-growing hierarchy. The purpose of his ar icle is o presen a nega ive resul . We produce an example of a o ally ermina ing ni e rewri e sys em, which goes above mul iple recursion. So his furnishes a new lower bound for he complexi y of o ally ermina ing rewri e sys ems and for rewri e sys ems ha reduces by Kruskal’s heorem. This con radic s Cichon’s conjec ure oo. Our cons ruc ion relies on he famous combina orial game of he Hydra battle [7], which can be seen as a geome rical represen a ion of he Hardy hierarchy. The paper is organised as follows: in he rs sec ion, we recall s andard no ions of erm rewri ing heory and ermina ion. The second sec ion is devo ed o he presen a ion of he Hydra ba le and he hird sec ion o he cons ruc ion he rewri e sys em H which encodes he Hydra ba le. The proof of o al ermina ion for H is based on a new charac erisa ion of o al ermina ion.
1
Rewritin Back round
This ar icle assumes some familiari y wi h erm rewri ing heory. We recall here some useful basic no ions. A comprehensive survey is o be found in Dershowi zJouannaud [3].
Encodin the Hydra Battle as a Rewrite System
269
Le F be a ni e signa ure whose func ion symbols have xed ari y. Given a se of variables V, T (F V) deno es he erm algebra buil up from V and F , and T (F ) he se of closed erms of T (F V). For a rewri e sys em R, we wri e + + R for he associa ed rewri e rela ion. R terminates if R is Noe herian. The complexi y of a ermina ing rewri e sys em is measured by he derivation len th func ion DlR , which is he longes deriva ion allowed by he rewri e sys em. De nition 1 (Derivation len th). Let T (F V) be a term al ebra and R a terminatin rewrite system over T (F V). De ne the deriva ion leng h functions dlR and DlR : IN dlR : T (F ) t max dlR (u) t DlR : IN m
IN max n
R
IN
u +1 T (F ) dlR (t) = n
t
|
t|
m
where | t | is the hei ht of t. Given a well-ordered se (A ), an interpretation for a rewri e sys em R on A is a morphism [ ] : T (F ) A such ha T (F ) u
u v Since (A
+
R
v
[u]
[v]
) is well-founded, he in erpre a ion ensures ermina ion.
De nition 2. Let T (F V) be a term al ebra and (A For any morphism [ ] of T (F ) A, we say that tn
[ ] is s ric ly mono one if for all u v t1 [u]
[v]
u
[f (t1
tn
[ ] is mono one if for all u v t1 [u]
[v]
[f (t1
tn )]
u
where is the reflexive closure of . [ ] has he sub erm proper y if for all u1 i1
i
n [ui ]
) be a well-ordered set.
T (F ), for all f [f (t1
v
T (F ), for all f tn )]
un [f (u1
[f (t1
F
tn ] F
v
tn ]
T (F ), for all f
F
un )]
Mos of he ime, in erpre a ions are de ned in a composi ional way: each symbol of he signa ure is assigned a func ion on A of he same ari y. In his case, he in erpre a ion is mono one if each func ion is increasing, s ric ly mono one if each func ion is s ric ly increasing and i has he sub erm proper y if he resul of each func ion is s ric ly grea er han each of i s argumen s. We now come o he de ni ion of o al ermina ion, due o Ferreira and Zan ema [4].
270
Helene Touzet
De nition 3 (Total termination). A rewrite system is o ally ermina ing if there exists a well-ordered al ebra (A ) and a strictly monotone interpretation for R on (A ). In o her words, if here exis s a well-ordered algebra (A one morphism [ ] : T (F ) A such ha l
r
R
:V
T (F ) [l ]
) and a s ric ly mono[r ]
hen R is o ally ermina ing. I is a well-known resul ha any o ally ermina ing rewri e sys em on a ni e signa ure wi h xed ari y is compa ible wi h he homeomorphic embedding rela ion of Kruskal’s heorem (see [4] for ins ance). We now give ano her charac erisa ion of o al ermina ion, which requires only mono onici y, ins ead of s ric mono onici y. Proposition 1. Let T (F V) be a term al ebra and let R be a rewrite system on T (F V). If there exists a well-ordered al ebra (A ) and a morphism [ ] : T (F ) A such that (i) for all l r in R, for all substitutions : V T (F ), [l ] [r ], (ii) [ ] has the subterm property, (iii) [ ] is monotone, then R is totally terminatin . Proof. We cons ruc a s ric ly mono one in erpre a ion I for R on he wellordered algebra (mul(A) mul( )) (we wri e mul(A) o mean he se of ni e deno e mul ise s on A and mul( ) he mul ise ex ension of on mul(A)). Le he union of mul ise s. For each erm u in T (F ), de ne I(u) as he mul ise of mul(A) con aining he in erpre a ions of u and i s sub erms: I(c) = [c] whenever c is a cons an symbol tn )) = [f (t1 tn )] I(t1 ) I(tn )
I(f (t1
I is compa ible wi h R: le l r in R and : V T (F ), a subs i u ion. By (i), [l ] [r ], which wi h (ii) implies [l ] mul( )I(r ). Hence I(l )mul( )I(r ). I is s ric ly mono one: le u v T (F ) such ha I(u)mul( )I(v) and le tn T (F ), we have f F of ari y n + 1. For all t1 I(f (t1 I(f (t1
u v
tn )) = [f (t1 tn )) = [f (t1
u v
tn )] tn )]
I(u) I(v)
I(t1 ) I(t1 )
I(tn ) I(tn )
By hypo hesis, we have I(u)mul( )I(v), which implies I(u)
I(t1 )
I(tn ) mul( ) I(v)
I(t1 )
I(tn )
u tn )] [f (t1 u tn )]. Suppose So i remains o show ha [f (t1 [u] [v]. By hypo hesis (ii) on [ ], his would imply [u] mul( )I(v), which con radic s he hypo hesis I(u)mul( )I(v). So [u] [v], which wi h (iii) ensures u tn )] [f (t1 v tn )]. This concludes he proof. [f (t1
Encodin the Hydra Battle as a Rewrite System
2
271
The Hydra Battle
The rewri e sys em we presen is based on he Battle of Hercules and the Hydra of [7]. Le us recall he general principle. A Hydra is a ni e ree, each leaf corresponding o a head. A each s ep of he game, Hercules chops o one of he heads of he Hydra and he mons er grows in urn: if he cu leaf has a grandparen in he ree, hen he branch issued from his grandparen is mul iplied. The number of copy equals he rank of he s ep in he game. This implies ha he mul iplica ion ra e of he Hydra is increasing during he game. Hercules wins when he Hydra is reduced o he emp y ree. A ba le may easily be in erpre ed by a decreasing sequence of ordinals. hn1 ihni i where Associa e o each node n in he ree he ordinal n = ni are he children of n and deno es he ordinal na ural sum. The n1 rn , where r1 rn are he children whole ree is in erpre ed by r1 of he roo . Here is an example of ba le, wi h he associa ed ordinal labelling. So every s ra egy is a winning s ra egy for Hercules.
s ep 2 :
2
+1
+1
s ep 3 :
2
+1
s ep 4 :
2
3
We now concen ra e on a par icular s ra egy, which we call s andard . We describe i from he ordinal poin of view. Le CN F( 0 ) deno e he se of no a ions in Can or Normal Form for ordinals below 0 . Given a limi ordinal , a fundamental sequence ( n )n2IN for is simply a s ric ly increasing sequence whose supremum is . A canonical assignmen of fundamen al sequences for CN F( 0 ) is de ned recursively as follows: n = n ( + )n = + ( +1 )n = n ( )n = n
n
De nition 4 (The standard Hydra battle). For all n in IN, de ne the funcCN F( 0 ) by tion hn : CN F ( 0 ) hn (0) = 0 hn ( + 1) = hn ( ) = n if
is a limit ordinal.
Given an initial ordinal 0 , the battle is a sequence ( n n)n2IN of CN F ( 0 ) IN such that for all n in IN n+1 = hn ( n ) In a pair ( n n), the ordinal n is the Hydra. The second element n is the rank of the step in the ame.
272
Helene Touzet
For any ini ial con gura ion, he s andard ba le is ni e. This fac is however no provable in Peano ari hme ic. Indeed, given an ini ial con gura ion , he leng h of his ba le is grea er han s (0), he h elemen of he Hardy hierarchy applied o 0. This can be es ablished using s andard ools of number heore ic func ions. We do no go in o echnical de ails here and we invi e he in eres ed reader o consul some classical ex s, such as Cichon [1] and Wainer [10]. The only resul we need for our cons ruc ion is he following proposi ion. Proposition 2. The function of IN IN which associates to each inte er n the n) with standard strate y is not len th of the Hydra Battle startin from ( multiply recursive. Proof. The Hardy func ion s
is no mul iply recursive (Robbin [8]).
I follows ha any rewri e sys em R encoding he Hydra Ba le for rees of , admi s a deriva ion leng h func ion which heigh 4, ha is ordinals below n n) reduces in ( n + 1) is no mul iply recursive. For each n in IN, ( and for each m IN, R encodes he ba le in one s ep. For each wi h ini ial con gura ion ( m). In par icular, i encodes he ba le wi h ini ial n n + 1). con gura ion (
3 3.1
Encodin the Hydra Battle as a Rewrite System Construction of the Rewrite System H
We now model he process of he Hydra ba le by he rewri e sys em H. A rs sys em for he Hydra ba le appears in [3], bu i s ermina ion canno be es ablished by Kruskal’s heorem. The version we presen here is o ally ermina ing. The underlying idea for he ranscrip ion is very di eren . The in ui ion is as in Can or Normal Form are in erpre ed by erms follows. The ordinals of buil up from he cons an 0 and he binary func ion symbol H. For his, de ne O by T (0 H) O: 0 0 H(O( ) 0) H(O( ) O( )) + To deal wi h he rank of he s ep in a ba le, we in roduce wo unary func ion symbols, 8 and . Each s ep ( n) of he ba le will be encoded by he erm 8n O( ). For each ordinal in , he sys em H should hen allow us o derive 8n O( ) + H 8n+1 O(hn ( )) Le ’s have a closer look on he de ni ion of he ordinal func ion hn . Given an , we dis inguish hree cases for he compu a ion of hn ( ): ordinal in Case 1 : if Case 2 : if Case 3 : if
is a successor ordinal of he form s( ), hen hn ( ) = , is a limi ordinal of he form γ + s( ) , hen hn ( ) = γ + is a limi ordinal of he form γ +
+
s( )
, hn ( ) = γ +
n. +
n
.
Encodin the Hydra Battle as a Rewrite System
273
So if we wri e t = O( ), u = O(γ) and v = O(a), H should allow us o derive Case 1 : Case 2 : t), Case 3 : of t).
8n H(0 t) H 8n+1 t, 8n H(H(0 t) u) H 8n+1 H(t H(t +
+
8n H(H(H(0 t) u) v)
+
H
H(t u)
8n+1 H(H(t
H(t u)
)) (n occurrences of ) v) (n occurrences
The rs case can be handled direc ly by a single rewri e rule. For he wo las cases, we need o in roduce hree in ermedia e func ion symbols: , c1 (for case 8 0 H c1 c2 , 2) and c2 (for case 3). Consider nally he signa ure F = where 0 is a cons an symbol, , , 8 are unary func ion symbols, H, c1 are of ari y 2 and c2 is of ari y 3. H is de ned on T (F V) by x
H
H(0 H(H(0 y) H(H(H(0 x) y) c1 (x 2 c (x y c1 (y 2 c (x y
8
3.2
8x 8 x) z) z) y) z) z) z) x x
8x
x
x c1 (y z) c2 (x y z) c1 (x H(x y)) c2 (x H(x y) z) z H(y z) 8x x
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
Complexity of H
We verify ha H simula es he Hydra ba le. Lemma 1. Let
. For all n
1,
8n O(
)
+
H
8n+1 O(hn (
))
Proof. We consider he hree cases men ioned above. Case 1 : 8n H(0 t) + H 8n H(0 t) (11) + n t (3) H 8 + n (10)n H 8 t + n+1 t (1) H 8 Case 2 :
8n H(H(0 t) u)
+ + + + + + +
8n 2 H(H(0 t) u) n n+1 H(H(0 t) u) H 8 n n 1 c (t u) H 8 n 1 H(t u) ))) H 8 c (t H(t H(t n 8 H(t H(t H(t u) )) H n H(t u) )) H 8 H(t H(t n+1 H(t H(t H(t u) )) H 8 H
n
(2)n (11) (4) n (6) (8) n (10) (1)
274
Helene Touzet
Case 3 :
8n H(H(H(0 t) u) v)
+ + + + + + +
8n 2 H(H(H(0 t) u) v) n n+1 H(H(H(0 t) u) v) H 8 n n 2 c (t u v) H 8 n 2 H(t u) ) v) H 8 c (t H(t n 8 H(H(t H(t u) ) v) H n H(t u) ) v) H 8 H(H(t n+1 8 H(H(t H(t u) ) v) H n
H
n
(2) (11) (5) n (7) (9) n (10) (1)
Corollary 1. DlH is not multiply recursive. Proof. Consequence of proposi ion 2.
3.3
H Is Totally Terminatin
The proof of o al ermina ion is based on proposi ion 1: we associa e o each func ion symbol appearing in H a mono one func ion which enjoys he sub erm proper y. Our s ar ing poin is he in en ional meaning of he symbols 0 and H: each erm t buil up from 0 and H may simply be in erpre ed by he ordinal O−1 (t). For c1 and c2 , we shall use he func ion f , de ned by CN F( 0 ) (x y)
f : CN F ( 0 )
CN F( 0 ) y + x+1
No e ha he de ni ion of f uses he ordinal sum +, which is no s ric ly monoonic. For ins ance, f (2 2 3 + + 7) = 3 + + 7. Lemma 2. For all (i) (ii) (iii) (iv)
,
in CN F( 0 )
) = f ( ), f( , f( ) f( ) > and f ( )> , f is an increasin function.
Proof. S raigh forward. For he symbols ,
and 8, consider he sub-sys em
8
x
8x
x
8x
8x 8
x
This admi s an in erpre a ion on : in erpre by (m n) (2m + 3 n), 8 by (m n) (2m + 2 n) and by (m n) (m n + m + 1). Combining he
Encodin the Hydra Battle as a Rewrite System
275
in erpre a ions for 0, H, c1 and c2 on CN F ( 0 ) and he in erpre a ions for 8, as follows: and on , we nally de ne [ ] on CN F ( 0 ) [0] = (0 0 0) [H] = ( m n) ( [c1 ] = ( m n) ( [c2 ] = ( [ ]=( [ ]=( [ 8] = ( CN F ( 0 ) and ( Lemma (i) (ii) (iii)
m m m m
m0 n 0 ) m0 n 0 )
( (f (
0 0) ) 0 0)
(γ
n) ( m0 n0 ) (γ m00 n00 ) n) ( m n + m + 1) n) ( 2m + 3 n) n) ( 2m + 2 n)
f(
)
0 0)
is ordered by he lexicographic combina ion of (CN F ( 0 ) ). We wri e for his ordering.
3. [ ] has the subterm property, [ ] is monotone, for all l r H, for all substitutions
:V
)
T (F ), [l ] > [r ]
Proof. (i) and (ii) are direc , using lemma 2 for f . For (iii), we examine each rule: (1) (2) (3) (4) (5) (6) (7)
H(0 t) t : ( + 1 0 0) > ( 2m + 3 n) 1 v : (f ( γ) 0 0) > (γ 2m00 + 3 n00 ) c (u v) 2 H(u v) : (γ f ( ) 0 0) > (γ 3 0) c (t u v) 8 t : ( 2m + 3 n) > ( 2m + 2 n + 2m + 3) t 8 t 8 t: ( 2m + 2 n + 2m + 3) > ( 2m + 2 n + 2m + 2) 8 t 8 t : ( 4m + 8 n) > ( 4m + 7 n) H(H(0 u) v) c1 (u v) : (γ +1 0 1) > (f ( γ) 0 0)
0 1) > (γ (8) H(H(H(0 t) u) v) c2 (t u v) : (γ + 1 1 c (t H(t u)) : (f ( ) 0 1) > (f ( ) 0 0) (9) c (t u) 2 2 f( ) c (t H(t u) v): (γ 0 1) > (γ f ( (10) c (t u v) (11) t t: ( m n + n + 1) > ( m n). +1
(t, u, v are erms of T (F ) whose in erpre a ions are ( (γ m00 n00 ) respec ively).
m n), (
f(
)
)
0 0)
0 0)
m0 n0 ) and
Proposition 3. H is totally terminatin . Proof. Consequence of lemma 3 and proposi ion 1. 3.4
Extension of H
The rewri e sys em H models a res rained version of Hydra ba le wi h ordinals . I may easily be ex ended o deal wi h higher ordinals, below 0 . below , one adds a 4-ary func ion symbol c3 and so on. In his way one To reach exhaus s he provably o al func ions of Peano ari hme ic.
276
Helene Touzet
Perspectives We have exhibi ed a o ally ermina ing rewri e sys em which depar s from muliple recursion. Wha s ill remains open is wha complexi y can be achieved via o al ermina ion or ermina ion by Kruskal’s heorem. Moreover, our example rekindles he deba e on he rela ionship be ween order ype and leng h of derivaion for a rewri e sys em. Our cons ruc ion is in eres ing from a proof- heore ical poin of view. We have shown ha i is possible o encode he Hardy hierarchy by a ni e rewri e sys em. So i can be direc ly connec ed wi h he work of Weiermann in [12], which uses he Hardy hierarchy oo. Unfor una ely, our cons ruc ion is res rained o ordinals below 0 . Is i possible o describe higher ordinals and reach Ω (0), he maximal order ype of homeomorphic embedding of Kruskal’s heorem ? This hen would imply ha he bound formula ed by Weiermann is, surprisingly, a leas upper bound.
References 1. E.A. Cichon, A short proof of two recently discovered independence results usin recursion theoretic methods. Proceedin s of the American Mathematical Society, vol 97 (1983), p.704-706. 2. E.A. Cichon, Termination proofs and complexity characterisations. Proof theory, P. Aczel, H. Simmons and S. Wainer Eds, Cambrid e university press (1992), p.173-193. 3. N. Dershowitz and J.P. Jouannaud, Rewrite systems. Handbook of Theoretical Computer Science, J. Van Leeuwen Ed., north-Holland 1990, p.243-320. 4. M.C.F. Ferreira and H. Zantema, Total termination of term rewritin . Proceedin s of RTA-93, Lecture Notes in Computer Science 690, p. 213-227. 5. D. Hofbauer, Termination proofs with multiset path orderin s imply primitive recursive derivation len ths. Theoretical Computer Science 105-1 (1992), p.129-140. 6. D. Hofbauer, Termination proofs and derivation len ths in term rewritin systems Dissertation, Technische Universit¨ at Berlin, 1991 (also available as Technical Report: TU Berlin, Forschun sberichte des Fachbereichs Informatik 92-46, 1992). 7. L. Kirby and J. Paris, Accessible independence results for Peano arithmetic. Bull. London Math. Soc. 14 (1982), p.285-225. 8. J.W. Robbin, Subrecursive Hierarchies. Ph.D. Princeton 9. D. Schmidt, Well-partial orderin s and their maximal order types. Habilitationsschrift, Fakult¨ at f¨ ur Mathematik der Ruprecht-Karl-Universit¨ at, Heidelber (1977). 10. S.S. Wainer, Ordinal recursion, and a re nement of the extented Grze orczyk hierarchy. Journal of Symbolic Lo ic 37-2 (1972), p.281-292. 11. A. Weiermann, Termination proofs by lexico raphic path orderin s yield multiply recursive derivation len ths. Theoretical Computer Science 139 (1995), p.355-362. 12. A. Weiermann, Complexity bounds for some nite forms of Kruskal’s theorem. Journal of Symbolic Computation 18 (1994), p.463-488.
Computin -Free NFA from Re ular Expressions in O(n lo 2 (n)) Time Christian Ha enah and Anca Muscholl Institut f¨ ur Informatik, Universit¨ at Stutt art, Breitwiesenstr. 20-22, 70565 Stutt art, Germany
Abs rac . The standard procedure to transform a re ular expression to an -free NFA yields a quadratic blow-up of the number of transitions. For a lon time this was viewed as an unavoidable fact. Recently Hromkovic et.al. [5] exhibited a construction yieldin -free NFA with O(n lo 2 (n)) transitions. A rou h estimation of the time needed for their construction shows a cubic time bound. The known lower bound is Ω(n lo (n)). In this paper we present a sequential al orithm for the construction described in [5] which works in time O(n lo (n) + size of the output). On a CREW PRAM the construction is possible in time O(lo (n)) usin O(n + (size of the output) lo (n)) processors.
1
Introduction
Amon various descriptions of re ular lan ua es re ular expressions are especially interestin because of their succinctness. On the other hand, the hi h de ree of expressiveness leads to al orithmically hard problems, for example testin equivalence is PSPACE-complete. Given a re ular expression we are often interested in computin an equivalent nondeterministic nite automaton without -transitions (NFA). This conversion is of interest due to some operations which can be easily performed on NFA, as for example intersection. In this paper we present e cient sequential and parallel al orithms for convertin re ular expressions into small NFA. For a re ular expression E we take the number of letters as the size of E, whereas the size of an NFA is measured as the number of transitions. It is known that the translation from NFA to re ular expressions can yield an exponential blow-up, [3]. The other direction however can be achieved in polynomial time. One classical method for constructin NFA from re ular expressions is based on position automata. This construction yields NFA of quadratic size, see e. . [1,2]. A substantial improvement on this construction was achieved in [5], where a re nement of position automata was shown to yield NFA with O(n lo 2 (n)) transitions. This is optimal up to a possible lo (n) factor, as shown in [5] by provin a O(n lo (n)) lower bound. However, the precise complexity of the conversion proposed in [5] was not investi ated. A trivial estimation of the construction of [5] leads to a cubic al orithm. Research was partly supported by the French-German project PROCOPE. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 277 285, 1998. c Sprin er-Verla Berlin Heidelber 1998
278
Christian Ha enah and Anca Muscholl
Performin the conversion form re ular expressions to NFA e ciently is important from a practical viewpoint. The best one can hope for is to perform the construction in time proportional to the output size. In the present paper we propose e cient sequential and parallel al orithms for convertin re ular expressions to NFA. Our approach is based on the construction proposed in [5], but usin a sli htly di erent presentation. This allows us to obtain an alorithm which works in time O(n lo (n) + size of the output). Therefore, our al orithm has worst-case complexity of O(n lo 2 (n)). In the parallel settin we are able to perform the construction on a CREW PRAM in O(lo (n)) time by usin O(n) processors for computin the description of the states of the NFA, resp. O(n lo (n)) processors in the worst-case for the output NFA. Previously known was an O(lo (n)) time al orithm usin O(n lo (n)) processors, which computes an NFA with -transitions, see [4]. The paper is or anized as follows. The sequential al orithm is presented in Sect. 4. Basic notions on position automata are recalled in Sect. 2, whereas Sect. 3 deals with the common follow sets construction of [5].
2
Preliminaries
Let A denote a nite alphabet. We consider non-empty re ular expressions over A, i.e. (bracketed) expressions E built from and the letters in A, usin concatenation , union + and Kleene star . The re ular lan ua e de ned by a re ular expression E is denoted L(E). Finite automata are denoted as usual as Q A Q as transition relation, A = (Q A q0 F ), with Q as set of states, q0 as initial state and F as set of nal states. The lan ua e reco nized by A is denoted L(A). For al orithmic purposes a re ular expression E over A is iven by some syntax tree tE . The syntax tree tE has leaves labelled by or a A, and the inner nodes are either binary and labelled by + or , or they are unary and labelled by . The inner nodes of a syntax tree will be named F G and we will denote them as subexpressions of E. For two subexpressions F G of E we write F G (F G, resp.) if F is an ancestor (a proper ancestor, resp.) of G. For a subexpression F let rststar(F ) denote the lar est subexpression G with G F such that G is the parent node of G. A subtree t of tE is a connected sub raph (i.e. a tree) of tE . A subtree t is called full subtree if it contains all descendants of its root. This means that a full subtree of tE corresponds to a subexpression of E. We may suppose without loss of enerality that the leaves of tE are labelled with pairwise distinct letters. This allows to identify the leaves of tE labelled by A uniquely by their labellin . For example, for E = (a + b) ab we replace A by a1 a2 b1 b2 and E by (a1 + b1 ) a2 b2 .
3
Position Automata
In this section we recall some basic notions related to the construction of position automata from re ular expressions. We follow the de nitions from [2,5].
Computin
3.1
-Free NFA from Re ular Expressions in O(n lo 2 (n)) Time
279
Positions and Sets of Positions
Given a re ular expression E, the set pos(E) comprises all positions of E which are labelled by letters from A. Accordin to our convention, pos(E) A. Positions of E will be named x y . Lemma 1. Let E be a regular expression, n = pos(E) . Then we can compute in linear time an equivalent expression E 0 , L(E) = L(E 0 ), such that E 0 has length O(n). The size E of the expression E is de ned as pos(E) . Moreover, pos(t) and t are de ned analo ously for a subtree t of tE . Throu hout the paper we denote by n the size E of E. The lemma above says that we may assume that the size O(n) = O( pos(tE ) ). of the syntax tree tE satis es tE For a re ular expression E we consider two distin uished subsets of positions, rst(E) and last(E). The set rst(E) pos(E) contains all positions which can occur as rst letter in some word in L(E). Similarly, last(E) contains all positions which can occur as last letter in some word in L(E). Formally: rst(E) = x last(E) = x
pos(E) xA \ L(E) = pos(E) A x \ L(E) =
The sets rst(E) last(E) can be computed inductively by notin that e. . rst(F+ G) = rst(F ) rst(G), rst(F ) = rst(F ) and rst(F G) = rst(F ) if L(F ), resp. rst(F G) = rst(F ) rst(G) if L(F ). For a iven position x pos(E) let follow(x) pos(E) contain all positions y which are immediate successors of x in some word of L(E): follow(x) = y
pos(E) A xyA \ L(E) =
As above, follow(x) can be de ned recursively by means of follow(x F ) = follow(x) \ pos(F ). We omit the de nition here, since anyway we will not compute the sets follow(x) lobally. 3.2
Automata
First, last and follow sets are the basic components of an NFA AE reco nizin L(E), called position automaton in [5]. Let AE = (Q A q0 F ) be de ned by Q = pos(E) q0 rst(E) (x y y) y = (q0 x x) x last(E) if L(E) F = last(E) q0 otherwise Recall for the above de nition that pos(E) easy to check:
follow(x)
A. The followin equivalence is
Proposition 2. For every regular expression E we have L(AE ) = L(E).
280
Christian Ha enah and Anca Muscholl
The construction above yields -free automata with n + 1 states and O(n2 ) transitions. In [5] a re ned construction was presented, based on the idea of a system of common follow sets (CFS system), which is de ned as follows: De nition 3 ([5]). Let E be a regular expression. A CFS system S for E is given as S = (dec(x))x2pos(E) , where dec(x) P(pos(E)) is a decomposition of follow(x): C
follow(x) = C2dec(x)
rst(E) Let CS = x2pos(E) dec(x). The CFS automaton AS associated with S is de ned as AS = (Q A q0 F ) where 0 1 Q = CS ( rst(E) 1) if L(E) q0 = ( rst(E) 0) otherwise = (C f ) x (C 0 f 0 )) x 1 F = CS
C C0
dec(x) and f 0 = 1
x
last(E)
Lemma 4. Let E be a regular expression and let S be a CFS system for E. Then the CFS automaton AS recognizes L(E). It is shown in [5] how to obtain a CFS system S for a iven re ular expression O(n), C2CS C O(n lo n) and dec(x) O(lo n) for E such that CS all x pos(E). This yields a CFS automaton with O(n) states and O(n lo 2 (n)) transitions.
4 4.1
Computin a Common Follow Sets System Properties of Follow Sets
The runnin time of our al orithm relies heavily on some structural properties of follow sets which are discussed in the followin . Lemma 5. Let E be a regular expression and let F G be subexpressions with E F G. Then we have: 1. rst(F ) \ rst(G) = implies rst(G) rst(F ). 2. F H G and = rst(G) rst(F ) implies rst(F ). 3. x pos(G) rst(G) implies x rst(F ).
rst(G)
rst(H)
The proof of the lemma is a strai htforward application of the inductive de nition. An analo ous lemma can be also stated for last sets. The next lemma deals with the relation between follow sets and a decomposition of the syntax tree, which will be used recursively in the de nition of the CFS system. For simplifyin the notation we will denote for x pos(E), E F , the set follow(x) \ pos(F ) by followF (x). Analo ously, followt (x) denotes the set follow(x) \ pos(t) for a subtree t.
Computin
-Free NFA from Re ular Expressions in O(n lo 2 (n)) Time
281
Lemma 6. Given a regular expression E, a syntax tree tE and subexpressions F G with E F G. Let t t0 be subtrees of tE such that pos(t) pos(F ) pos(G) and pos(t0 ) pos(G). Then we have for all x x0 y pos(E): 1. followF (x) = for all x pos(t0 ) last(G); 2. followF (x) = followF (x0 ) for all x x0 pos(t0 ) \ last(G); 3. followt0 (y) = rst(G) \ pos(t0 ) for all y pos(t) with followt0 (y) = . 4.2
Recursive De nition of CFS Systems
The CFS system de ned in [5] is based on a divide-and-conquer construction. pos(t). If Consider a subtree t of tE and let F denote the root of t. Let x t = 1 then we de ne C0 = followt (x) = follow(x) \ x
dec(x t) = C0
t1 Suppose now that t > 1. Then let t1 be a subtree of t such that 1 3 t 2 3 t and let t2 = t t1 . Let F1 denote the root of t1 . Clearly, for every position x pos(t) we have followt (x) = followt1 (x) followt2 (x). We distin uish two cases, dependin on x pos(t1 ) or x pos(t2 ). last(F1 ) then by Lem. 6 we have followt2 (x) = . i) Let x pos(t1 ). If x Otherwise, for x last(F1 ) then a ain by Lem. 6 we have followt2 (x) = followt2 (x0 ) for all x0 last(F1 ) \ pos(t1 ). Let C1 = followt2 (x0 ) for some x0 pos(t1 ) \ last(F1 ) and de ne dec(x t) as dec(x t) =
dec(x t1 ) dec(x t1 )
C1
if x last(F1 ) otherwise
ii) Let x pos(t2 ). If followt1 (x) = then we have followt1 (x) = pos(t1 ) by Lem. 6. Let C2 = rst(F1 ) \ pos(t1 ) and de ne dec(x t) as dec(x t) =
dec(x t2 ) dec(x t2 )
C2
rst(F1 ) \
if followt1 (x) = otherwise
It can be easily veri ed that dec(x t) is a decomposition1 of followt (x), i.e. followt (x) = C2dec(x t) C. Hence, we obtain a CFS system C(t) restricted to t, where C(t) =
dec(x t) x
pos(t) = C C
dec(x t) for some x
pos(t)
3 t − 2. Similarly, Note that C(t) C(t1 ) + C(t2 ) + 2. This yields C(t) the followin estimations can be easily veri ed (see also Lem. 4 of [5]): C2C(t)
dec(x t) 1
C
2 t lo ( t ) + 1 and 2 lo ( t ) + 1 for all x
S
pos(t)
In [5] the correspondin set C∈dec(x ) C is just a subset of follow (x). Havin equality here simpli es the recursive de nition and the correctness proof of the decomposition.
282
5
Christian Ha enah and Anca Muscholl
A Sequential O(n lo (n)) Al orithm for Computin a Common Follow Sets System
We consider now the computation of the sets de ned in the previous section. For C0 = follow(x) \ x we can determine whether x follow(x) by checkin whether x last(S) \ rst(S) for S = rststar(x). For the recursion step we have to determine C1 C2 with C1 = followt2 (x)
C2 = rst(F1 ) \ pos(t1 )
and
We want to compute both C1 C2 and the positions x pos(t) to which C1 or C2 is added in linear time, i.e. in time O( t ). As shown below, the computation of C1 reduces to computin a union of rst sets restricted to pos(t2 ). This yields two problems: First we need an e cient way to compute intersections of rst sets with a iven set of positions. Second, the union of restricted rst sets has to be disjoint. The solution to both problems will rely on a suitable data structure for rst sets. Before discussin the data structure let us consider the set C1 in more detail2 . De nition 7. Let E as
F be regular expressions. We de ne fnext(F )
fnext(F ) =
pos(E)
rst(G) if F G is the parent node of F rst(F ) if F is the parent node of F otherwise
Analogously, lprev(F ) is de ned by replacing rst by last and by requiring that G F is the parent node of F . Usin the fnext operator we are able to express follow sets as unions of rst sets. Compared with Lem. 3 in [5] we need for expressin followt2 (x) at most one rst set which is not contained in F . Of course, this is necessary in order to be able to determine C1 in time O( t ): Proposition 8. Let E be a regular expression with E F F1 and let tE be a syntax tree of E. Let t2 be a subtree with root F and pos(t2 ) \ pos(F1 ) = and consider a position x last(F1 ). Then we have (fnext(G) \ pos(t2 ))
followt2 (x) = G2G
where the union is taken over G = G last(G) 2
last(F1 ) and (F
G
F1 or G = rststar(F ))
In the de nition below fnext(F ) corresponds to rst(fnext(F )) in [5].
Computin
-Free NFA from Re ular Expressions in O(n lo 2 (n)) Time
283
Proof: Note that for every G F1 with last(F1 ) last(G) we have fnext(G) \ pos(t2 ) followt2 (x). Conversely, consider a position y followt2 (x) last(G). Hence, there with y fnext(G), for all F G F1 with last(F1 ) last(G). exists some node G, E G F , with y fnext(G) and last(F1 ) Clearly, the parent node of G is G (otherwise, fnext(G) \ pos(t2 ) = ), thus y rst(G) \ pos(t2 ). If G = rststar(F ) then we are done. Otherwise G H = rststar(F ). In this case it is not di cult to verify usin Lem. 5 that for all G H with rst(G) \ pos(t2 ) = we also have rst(G) \ pos(t2 ) = rst(H) \ pos(t2 ). 2 Therefore, y rst(H) \ pos(t2 ). Our al orithm is based on a suitable order on positions of E, which allows manipulatin rst sets e ciently. We use an array called rstdata such that for each subexpression F of E the set rst(F ) is a subinterval of rstdata.The crucial point is the order of positions within rstdata. Consider a xed syntax tree tE of E. We rst de ne a forest F by deletin all ed es from nodes labelled F G Tk be the forest to the child labelled G, whenever L(F ). Let F = T1 thus obtained, then we denote the trees T as rst-trees. Note that each rst(F ) is the union of all rst(F 0 ) with F F 0 where F 0 belon s to the same rst-tree as F . Tj We de ne a total order on F as follows. For 1 i = j k let T whenever the roots F Fj of T , resp. Tj satisfy either Fj F , i.e. Fj is an ancestor of F , or F and Fj are incomparable w.r.t. and F lies to the ri ht of Fj . The order corresponds thus to a reversed preorder traversal of tE , i.e. ri ht child left child parent node. Tk with T Tj for all i j. Suppose that after renamin F = T1 fdata(Tk ), with fdata(T ) bein the list The array rstdata is iven as fdata(T1 ) of positions correspondin to the yield of T . Moreover, by a preorder traversal of each T we can determine for each subexpression F of T the subinterval of fdata(T ) correspondin to rst(F ). The set rst(F ) is described by its startin position fstart(F ) within fdata(T ) and its len th flen th(F ) = rst(F ) . emark 9. (i) Let F G be subexpressions of E. Then we have = rst(F ) rst(G) if and only if fstart(G) fstart(F ) and fstart(G)+flen th(G) fstart(F )+ flen th(F ), i.e. if the subinterval correspondin to rst(G) includes the subinterval correspondin to rst(F ). Moreover, rstdata allows to determine the intersection rst(F ) \ pos(t) in O( t ) time, where F is a subexpression and t is subtree of tE (described as set of positions in increasin order). (ii) A similar data structure lastdata can be de ned for the last sets. We are now ready to describe an al orithm UnionFirst for the followin F1 and subtrees t t2 of F , problem. Given subexpressions F F1 of E with F resp. a subtree t1 of F1 , where t = t1 t2 , pos(F1 ) \ pos(t2 ) = , and a position x last(t1 ). We want to compute the set C = followt2 (x). Recall from Prop. 8 that (fnext(G) \ pos(t2 ))
C= G2G
284
Christian Ha enah and Anca Muscholl
with G G if and only if last(F1 ) last(G), and either F G = rststar(F ). function UnionFirst (node F1 , tree t2 ) : nodelist; var rootlist, tocheck: nodelist; G: node; be in rootlist := nil; tocheck := nil; G := F1 ; while (G = root(t2 ) and last(F1 ) last(G)) do be in A := parent expression of G; if A = G then rootlist := rootlist H H tocheck and rst(H) rootlist := rootlist G; tocheck := G ; else if A = G H then if L(G) then rootlist := rootlist H; else rootlist := H rootlist endif; tocheck := tocheck H ; endif; G := A; endwhile; return(rootlist); end
G
F1 or
rst(G) ;
The proof of the next proposition is omitted for lack of space. F1 , and let tE be Proposition 10. Let F F1 be subexpressions of E, E F a syntax tree. Let t1 be a subtree with root F1 and let t2 be a subtree with root F and pos(F1 ) \ pos(t2 ) = . Let x last(t1 ) be a position and let G be de ned Hl ) of (names as above. Then UnionFirst(F1 t2 ) yields a list rootlist = (H1 of ) subexpressions of E satisfying the following: l
G2G G6= rs s ar(F ) fnext(G). =1 rst(H ) = Moreover, rst(H )\ rst(Hj ) = for all i = j. 2. Let T (H ) denote the rst-tree in the forest F containing H . Then T (H ) T (Hj ) for all 1 i j k. Moreover, if T (H ) = T (Hj ) then H precedes Hj w.r.t. preorder (in tE ). 3. UnionFirst(F1 t2 ) runs in O( t2 ) steps.
1.
emark 11. Given the assertion of Prop. 10 it is not hard to verify that the set G2G (fnext(G) \ pos(t2 )) can be computed in O( t2 ) steps usin rootlist and rstdata. More precisely, we can precompute in time O( t2 ) a list fdata(t2 ) correspondin to pos(t2 ) sorted as rstdata. Next, we scan rootlist and fdata(t2 ) in parallel, buildin the intersection. Hereby we use Rem. 9 in order to determine in constant time whether a position belon s to a set rst(G). Note that rootlist has at most t2 elements, since the while loop in UnionFirst is executed at
Computin
-Free NFA from Re ular Expressions in O(n lo 2 (n)) Time
285
most t2 times. Finally, if S = rststar(F ) is de ned we can check whether last(F1 ) last(S) in O(1) time and compute rst(S) \ pos(t2 ) in time O( t2 ). Theorem 12. Given a regular expression E and a syntax tree tE for E of size O( E ) = O(n). We can compute a CFS system S for E in time O(n lo (n)). Therefore, we can compute an NFA AS for E of size AS in time O(n lo (n) + AS ). The worst-case complexity of the algorithm is thus O(n lo 2 (n)). Proof: Recall the recursive de nition of dec(x t) iven in Sect. 4.2. For last(F1 ) in constant time (usin a position x pos(t1 ) we test whether x lastdata), whereas C1 = followt2 (x) can be computed in time O( t2 ). The case where x pos(t2 ) is dual. Here, the set C2 = rst(F1 )\pos(t1 ) can be determined in constant time, whereas determinin which x pos(t2 ) satisfy followt1 (x) = C2 we have requires O( t1 ) steps. To see this, note that for a position y = precede(y) \ pos(t2 ), where precede(y) is x pos(t2 ) followt1 (x) = de ned as the dual of follow(y), i.e., precede(y) = x A xyA \ L(E) = . Moreover, by duality we have precede(y) \ pos(t2 ) = G2G (lprev(G) \ pos(t2 )), rst(G), and either F G F1 or G = rststar(F ). with G G if rst(F1 ) Therefore, we can compute in time O( t ) the sets dec(x t) from dec(x t1 ) and dec(x t2 ) for all positions x of t. Hence, our al orithm runs in time O(n lo (n)). Finally, outputtin the transitions of the NFA AS is possible in time O( AS ).
2
In the parallel settin we have a ain an output-size optimal al orithm on a CREW PRAM, as stated below. For lack of space we omit the proofs. Theorem 13. Given a regular expression E and a syntax tree tE for E of size O( E ) = O(n). We can compute a CFS system S for E on a C EW P AM in time O(lo (n)) using O(n) processors. Therefore, we can compute an NFA AS for E of size AS in time O(lo (n)) using O(n + AS lo (n)) processors (i.e., O(n lo (n)) processors in the worst case). Acknowled ment: We thank Volker Diekert for many comments and contributions and to the anonymous referees for su estions which helped improvin the presentation.
References 1. G. Berry and R. Sethi. From re ular expressions to deterministic automata. Theoretical Computer Science, 48:117 126, 1986. 2. A. Br¨ u emann-Klein. Re ular expressions into nite automata. Theoretical Computer Science, 120:197 213, 1993. 3. A. Ehrenfeucht and P. Zei er. Complexity measures for re ular expressions. Journal of Computer and System Sciences, 12:134 146, 1976. 4. A. Gibbons and W. Rytter. E cient Parallel Al orithms. Cambrid e University Press, 1989. 5. J. Hromkovic, S. Seibert, and T. Wilke. Translatin re ular expressions into small free nondeterministic nite automata. In Proc. of the 14th Ann. Symp. on Theor. Aspects of Comp. Sci. (STACS’97), no. 1200 in LNCS, p. 55 66, 1997. Sprin er.
Iterated Len th-Preservin Rational Transductions? (Extended Abstract) Michel Latteux, David Simplot, and Alain Terlutte C.N.R.S. U.R.A. 369, L.I.F.L. Univer ite de Lille I, Bat. M3, Cite Scienti que, 59655 Villeneuve d’A cq Cedex, France
Abs rac . The purpo e of thi paper i the tudy of the malle t family of tran duction containing length-pre erving rational tran duction and clo ed under union, compo ition and iteration. We give everal characterization of thi cla u ing re tricted cla e of length-pre erving tran duction , by howing the connection with context- en itive tran duction and tran duction a ociated with recognizable picture language . We al o tudy the cla obtained by only u ing length-pre erving rational function and we how the relation with determini tic context- en itive tran duction .
1
Introduction
The family of rational lan ua es turns out to be one of the most important classes within the Chomsky hierarchy. Finite automata that are the main object for studyin rational lan ua es are now used in most domains of computer science. Rational transductions introduced by C. C. El ot and J. E. Mezei [4] are a natural extension of rational lan ua es and were very useful to represent several kinds of computations. The theory of rational transductions was mainly developed by M. P. Schtzenber er, S. Eilenber and M. Nivat (see [3,11,12]). This theory is now well established and its basic results can be found in [2,3]. More recently, some representation theorems were achieved in terms of compositions of morphisms and inverse morphisms [13]. At the contrary, there is only a few papers dealin with iteration of rational transductions (see [6,14]). Since several mechanisms of computation are actually iterations of rational transductions, it seems that this study deserves to be undertaken. For instance, nitely enerated con ruences, derivations in a rammar, partial commutation as well as semi-commutation , L-systems are examples of such mechanisms. The set of transductions equipped with the operation of composition has a semi roup structure closed under iteration. The subset of rational transductions is closed under composition but not under iteration. We are mainly interested by the rational closure of the set of rational transductions, that is the smallest set ?
Thi work wa partially upported by the group MOSYDIS of the PRC/GDR AMI
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 286 295, 1998. c Springer-Verlag Berlin Heidelberg 1998
Iterated Length-Pre erving Rational Tran duction
287
of transductions closed under union, composition and iteration and containin the rational transductions. Indeed several interestin transductions need to compose rational transductions and iterated rational transductions. For instance, the mirror operation is shown in the preliminaries to be such a transduction. It is neither a rational transduction nor an iterated rational transduction but it can be realized by composition of these two kinds of transductions. In this paper, we shall restrict ourself to iterated len th-preservin transductions, more precisely, we shall study the rational closure of the class of len th-preservin rational transductions, that is the smallest family of transductions containin len th-preservin rational transductions and closed under union, composition and iteration. There are two main reasons for this choice. First, one easily veri es that iterations of arbitrary rational transductions can be obtained by composition of arbitrary rational transductions with iterated len th-preservin rational transductions. At reverse, arbitrary rational transductions can be achieved by composition of len th-preservin rational transductions and iterations of faithful rational transductions. In this way the projection from A onto B with B A is equal to the composition of the iteration of the rational function which erases only the rst occurrence of a letter of A B with the len th-preservin rational function which corresponds to the intersection with B. For lack of space we only ive rou h sketchs of proofs, but they can be found in the full version of this abstract which is available as Technical Report [9].
2
Preliminaries
We assume the reader to be familiar with basic formal lan ua e theory (see [2,3] for more precisions). The oal of this section is to x notations and terminolo y. 2.1
Words, Lan ua es, and Transductions
For a nite alphabet , we denote by the free monoid enerated by . The neutral element of this monoid is the empty word, which is denoted by . The size of the alphabet is denoted by and is equal to its number of letters. The len th of a word u is denoted by u . The classes of re ular, deterministic context-sensitive and context-sensitive lan ua es over are denoted respectively by Rec( ), CSd ( ) and CS( ). Now we ive some basic de nitions about transductions. A transduction is a subset of X Y where X and Y are two nite alphabets. For a word u, the set of ima es of u by a transduction is denoted by u and is de ned by: u = v (u v) . The set of transductions has asemi roup structure accordin to the composition operation. Let and be two transductions. The composition of and is the transduction de ned by:
288
Michel Latteux et al.
= (u w)
v such that (u v)
(v w)
A transduction from X into Y is rational if and only if it is a rational part of X Y (accordin to the usual concatenation product in this monoid). It is the class of transductions which can be realized by a nite transducer that is a nite automaton where ed es are labelled by an input and an output word. We say that a transduction is functional if for each word u, u contains at most one word. When we deal with a function we will write u = v instead of u = v . A transduction is len th-preservin (l.p.) if and only if for each couple (u v) we have u = v . In the remainder of the paper, we consider only l.p. transductions. The class of all l.p. rational transductions is denoted by T and the class of l.p. rational functions is denoted by F . In our proofs, we shall use several particular kinds of letter-to-letter morphisms the class of letter-to-letter morphisms is a particular class of l.p. functions denoted by H. For an arbitrary alphabet A, the identity over A is notice that IA is equivalent to the intersection with A which denoted by IA which is the cartesian is denoted by (\A ). When we consider an alphabet Xn (with n 1), the morphism i , product of n alphabets, = X1 X2 with 1 i n is the projection onto the ith component. 2.2
A Introductory Example
Let us start with a simple example to explain the use of iterated len th-preservin rational transductions. Let X be an arbitrary alphabet. We consider the funcX , tion f which associates the mirror ima e with each word of X : w wf = w. e Althou h this function is not rational, we show that f can be obtained by composition of l.p. rational functions and iterated l.p. rational functions. Let be the alphabet X X containin non-marked and marked letters of X. We de ne a rational function from into : for each word w = auv with a X, u X and v X , we have w = uav; the ima e of the empty word is the empty word, = , and the transduction is unde ned in the other cases. For instance, the successive applications of on a word over X of len th ve are: w = a1 a2 a3 a4 a5
w = a2 a 3 a 4 a 5 a 1 w 5 = a5 a4 a3 a2 a1
w w
2 6
= a3 a4 a5 a2 a1 =
where + denotes It is clear that for any word w X , the set w + (\X ) the iteration of contains a sin le word which is the marked mirror of w. If we denote by the morphism from X into X which ives the unmarked ima e, we have f = (\X ) + .
Iterated Length-Pre erving Rational Tran duction
3
289
Iterations of Rational Transductions
In this section we study the rational closure of T , denoted by Rat(T ), which is the smallest class of transductions which contains T and closed under union, composition and iteration. The iteration is the natural extension of the Kleene operator to the semi roup of len th-preservin transductions. Let be a transduction. The iteration of , denoted by + , is de ned by + = i1 i . Let C be a class of transductions. The C . class C+ denotes the class of iterated transductions of C: C+ = + For the sake of simplicity of our proofs, we introduce a new class of l.p. transductions called one-step transductions which is denoted by O. A one-step transduction is de ned by a couple (X P ) where X is a nite alphabet and P a nite set of l.p. rules of X X . The transduction realizes one step of the ) P . rewritin system de ned by P : = (u u0 u u0 ) X X ( The last characterization we ive in the next theorem concerns reco nizable picture lan ua es. A picture over an alphabet is a matrix of elements of . In 1992, D. Giammarresi and A. Restivo ive a de nition of reco nizable picture lan ua es in terms of projection of local picture lan ua es which are the natural extension of local strin lan ua es to the two-dimensional case (see [5] for complete de nitions). The rst row of a picture p is denoted by fr> (p) and the last row is denoted by fr? (p). The transduction associated to a iven reco nizable picture lan ua e L, denoted by L is the set of couples of words which appear on the rst and last rows of a picture of L: L = (fr> (p) fr? (p)) p L . The idea is to consider pictures as computations over the words which occur on the rst lines. The class of transductions associated to reco nizable picture lan ua es is denoted by T ec(LF ) . Here is the main result of this section which ives a characterization of the class Rat(T ). Theorem 1 (Representation theorem). Let lowin properties are equivalent:
be a transduction. The fol-
i. the transduction can be de ned by usin union, composition and iteration of l.p. rational transductions ( Rat(T )), = ii. there exist three l.p. rational transductions 1 , 2 and 3 such that + T T+ T ), 1 2 3 ( iii. there exist two l.p. rational transductions 1 and 3 and a one-step transT O+ T ), duction 2 such that = 1 2+ 3 ( iv. there exist two letter-to-letter morphisms and and a context-sensitive TCS ), lan ua e A such that = −1 (\A) ( v. there exists a reco nizable picture lan ua e L such that ( ) = L ( T ec(LF ) ). Sketch of proof. We can suppose that all the transductions we use do not contain the couple ( ) and that all context-sensitive lan ua es are -free. We show the di erent implications.
290
(i
Michel Latteux et al.
ii ) Clearly, T T+ T contains T . Then, it su ces to show that T T+ T is closed under union, composition and iteration. Let = 1 2+ 3 and 0 = 0 0+ 0 0 i and the 1 2 3 be two transductions where the i are l.p. rational transductions. By choosin carefully the di erent alphabets used by these transductions, we can assume that the followin property holds 0 1 2
=
0 1 2
=
0 2 3
0 2 3
=
=
1 3
=
0 2 2
=
0 2 2
=
0 0 1 3
=
0 1 3
=
The expected closure properties hold since we have: +
0 0 +
= ( 1 + 10 )( = 1( 2 + 3 =
1( 2
+
0 + 2 + 2) ( 3 0 0 + 0 1 + 2) 3 + ) 3 1 3
+
0 3)
i ) This implication is obvious. iii ) It is clear that it su ces to prove that T+ is included in T O+ T . Let T be a l.p. rational transduction realized by a nite transducer T whose transitions are letter-to-letter. The idea is to simulate several computations of T over the input word. The rst rational transduction marks the rst and the last letter of the word. The one-step transduction contains rules which (1) put an initial state on the rst letter in a non-deterministic way, (2) realize a transition over two successive letters, and (3) delete the state on the last letter if this state leads to a nal state by readin this letter. The last rational transduction veri es that the word contains no state. (iii ii ) Since O is included in T , this implication is trivial. (iii iv ) One-step transductions have been introduced because it is easy to prove the followin assertion. (ii (ii
Assertion. The class CS is closed under O+ . In order to show this assertion, we consider a -free context-sensitive lanua e L CS(X ) and a one-step transduction associated with the couple (Y P ). The lan ua e L0 = L(\Y ) is also a -free context-sensitive lanua e and then, is enerated by a rammar G = (Y V Q S) in Kuroda normal form [7]. It is clear that the lan ua e L + = L0 + is enerated by the len th-increasin rammar G0 = (Y P Q S) and then is also contextsensitive. This ends the proof of the assertion. iv is easily deLet be a transduction of T O+ T . The implication iii duced by showin that the lan ua e A de ned by A= u
(X
Y ) u
2
u
1
is context-sensitive. Indeed, A is the ima e of the re ular lan ua e (a a) a X by the transduction 0 which applies on the second component. Hence, we have = 1−1 (\A) 2 .
Iterated Length-Pre erving Rational Tran duction
(iv
291
iii ) Since inverse morphisms and morphisms are rational transductions, we just have to show that the intersection with a context-sensitive lan ua e A is a transduction of T O+ T . We use the assertion that follows. Assertion. Let A CS( ) be a context-sensitive lan ua e. There exist a re ular lan ua e R and a one-step transduction such that A = R + (\ ). The idea is to simulate the derivations of a len th-increasin rammar G = ( V P S) which enerates A by usin only l.p. rules. The rules realized by v where $ is a new symbol the one-step transduction are u$jvj−juj for every u v P , and the rules allowin to move the symbol $: a$ $a for a V . It is easy to see that A = (S$ ) + (\ ). So, the intersection with A is realized by the transduction = 1 2+ 3 where the i are de ned by (X denotes the alphabet used in ):
1 2 3
= (u v) = (u v) = (u v)
((X (
(
X) ) v 2
X) ) )
u
1
=u
=v 1 u 1=u 1
v
2
v 2 2 = v
R u
2
It is easy to see that the transductions 1 and 3 are rational and that 2 is a one-step transduction. (ii v ) We construct a reco nizable picture lan ua e whose transduction realizes the iterated l.p. transduction 2 which is supposed to be included in X Y . The idea is to show that the lan ua e K which contains all the pictures p such that if a word u is on the ith row (i > 1) then the above row (i − 1) contains a word v such that u v 2 is a reco nizable lan ua e. We use a variant of the Nivat’s theorem [11] which states that 2 = 1−1 (\R) 2 where R is a re ular lan ua e of (X Y ) . It brin s out that all this controls can be made locally and it is easy to see that K is reco nizable. We have K = 2+ . The reco nizable picture lan ua e L is obtained from K by addin a line at the top which corresponds to the application of 1 and a line at the bottom which realizes 3 . (v i ) The reco nizable picture lan ua e L is the ima e by a projection (letter-to-letter morphism) of a local picture lan ua e K. The principle is to show that for a local picture lan ua e, the set of authorized rows below a iven row is obtained by applyin a l.p. rational transduction. In the same way, the set of words authorized to appear on the top lines (respectively bottom lines) is a re ular set T (resp. B). Then we have K = (\T )( + I)(\B). Hence, we have L = −1 K which belon s to Rat(T ). Because of Point iv , by analo y to rational transductions, the transductions of Rat(T ) are called context-sensitive transductions . Moreover, by usin the fact that the class of context-sensitive lan ua es is closed under intersection and complement, we easily deduce the followin closure properties.
292
Michel Latteux et al.
Proposition 1. The class of transductions Rat(T ) is closed under intersection and di erence. The representation theorem allows us to deduce easily a result concernin reco nizable picture lan ua e theory [8] which is similar to the theorem which states that the frontier of reco nizable tree lan ua es is the class of context-free lan ua es [10].
Corollary 1 (Latteux Simplot 1997, [8]). The family of frontiers of reco nizable picture lan ua es is exactly the family of -free context-sensitive lanua es. In this corollary, frontiers means the bottom lines of the pictures.
4
Iterations of Rational Functions
In this section we show that we can obtain all the transductions of Rat(T ) by usin only functions. More precisely, we show that Rat(T ) and Rat(F ) coincide. We introduce a new class, denoted by Fin(F+ ), which is the smallest class of transductions containin F+ and closed under union and composition. This class is interestin since it contains T and corresponds to deterministic contextsensitive transduction as shown below. First, we remark that F is included in Fin(F+ ). Indeed, when the ima e of a function uses the same alphabet as the domain, we cannot forbid the iteration of the function. But, usin disjoint alphabets, we can use composition of two iterations in order to simulate a function. Thus the family of len th-preservin rational functions is included in F+ F+ . Like in Theorem 1 (i ii ), we show that one iteration su ces in Fin(F+ ). Proposition 2. The family Fin(F+ ) is equal to the family F F+ F . That means, a transduction belon s to Fin(F+ ) if and only if = f1 f2+ f3 for some f1 , f2 and f3 in F . Sketch of proof. Since F F+ F is obviously included in Fin(F+ ), it su ces to show that F F+ F is closed under union and composition. Let 1 and 2 in F F+ F . We have 1 = f1 1+ h1 and 2 = f2 2+ h2 for some fi i hi F. We shall suppose that ( ) does not belon to all this functions. An application of 1 + 2 looks like the followin :
Iterated Length-Pre erving Rational Tran duction
-v
v11
?h ,, u , w @ f @ R @ f1
1
1
v21
?
?
h1 w12
1
11
2 2
-v
1
12
-v
2
h2 w21
-v
?
h2 w22
-v
,, u ,
11
f
u2 2juj
?
h w11
-v
?
24
h2 w23
1
?
-
1
h1 w14 2
23
The idea is to apply alternatively u1 u2 1juj
?
14
h1 w13 2
22
-v
1
13
293
?
-
2
h2 w24
and
2
-v
11
like shown in the next v21 1juj
?
-v
12
h w21
ure:
v21 2juj
?
h w12
In order to avoid to break the computation the functions fi and i are transformed in complete functions (each word has an ima e) by addin a new symbol which is never selected by the functions hi . Hence 1 + 2 belon s to F F+ F . For the closure under composition, we remark that for a rational function n with = k, we have uf + = 1ikn uf i . Hence, by f and a word w insertin a counter (with a word of len th n over an alphabet of size k, one can count from 0 to k n − 1), it is possible by iteration of a rational function to cover the words of u 1 h1 f2 2+ , followed by the words of u 12 h1 f2 2+ and so on. The applications of this function look like the followin : u
u u
1 2 1
u 1 h1 f 2 u 12 h1 f2
2 2 2
0
u 1 u 1 h1 f2 22 1 n u 1 u 1 h1 f2 2k k n − 1
u u
1 2 1
u 1 h1 f 2 u 12 h1 f2
3 2 2
2 0
1
As previously, h1 , f2 and 2 have to be complete. The selection consists in takin the second component. Hence we just have to apply f1 , to iterate , to select the second component and to apply h2 and we obtain 1 2 . We have seen that F in this family.
Fin(F+ ), the next result states that T is also included
Proposition 3. The class of l.p. rational transductions is included in Fin(F+ ). Sketch of proof. Let be a l.p. rational transduction. We know that the transduction is equal to −1 (\R) where and are two letter-to-letter morphisms and R is a re ular lan ua e. Since letter-to-letter morphisms and the intersections with re ular lan ua es are l.p. rational functions, it su ces to show that
294
Michel Latteux et al.
inverse morphisms are in Fin(F+ ). Let be a letter-to-letter morphism from X into Y . For a word u Y of len th n, we enumerate in lexical order all the words over Y of len th n and a word is selected if its ima e by is u. All these operations are rational and the result holds. Since Fin(F+ ) is included in Rat(F ), the followin equality clearly holds. Proposition 4. The classes Rat(T ) and Rat(F ) coincide. As we have shown that Rat(T ) corresponds to the class of context-sensitive transductions, we show the connection between Fin(F+ ) and deterministic context-sensitive transductions. Theorem 2. Let be a transduction. It belon s to Fin(F+ ) if and only if there exist two letter-to-letter morphisms and and a deterministic context-sensitive lan ua e A such that = −1 (\A) . Sketch of proof. It su ces to show that, for a l.p. rational function f X X , the lan ua e A = u (X X) u 2 u 1 f + is a deterministic contextsensitive lan ua e. We use the decomposition theorem [1] which states that a rational function is the composition of a ri ht sequential transduction r with a left sequential function l . It is easy to build a deterministic linear bounded automaton (LBA) which simulates the successive applications of r and l on the rst component of words over X X and turns to a nal state if the two components are identical. At reverse, since inverse letter-to-letter morphisms are l.p. rational transductions which belon to Fin(F+ ) by Proposition 3 , we just have to show that the intersection with a deterministic context-sensitive lan ua e of is in Fin(F+ ). A step of computation of a deterministic LBA is a l.p. rational function if we omit transitions which read the last letter and lead to a non- nal state. Hence, it su ces to duplicate the word into (X X) and to return the rst component if a computation on the second component of the LBA leads to a nal state. We deduce the followin closure properties. Proposition 5. The class of transduction Fin(F+ ) is closed under inverse, intersection and di erence.
5
Conclusion
We have two classes Rat(T ) and Fin(F+ ). The rst class coincides also with Rat(F ) and with the class of context-sensitive transductions. The second class corresponds to the class of deterministic context-sensitive transductions. Then the class Fin(F+ ) is included in Rat(T ). To prove the reverse inclusion is equivalent to prove CSd = CS, and is also equivalent to SP ACE(n) = N SP ACE(n), which is a well-known open problem.
Iterated Length-Pre erving Rational Tran duction
295
We can also consider the classes obtained by iteration of l.p. sub-sequential functions, l.p. sequential functions or deterministic l.p. functions (sub-sequential functions without output function associated with nal states). Do we obtain new classes of transductions? Are these classes helpful to distin uish CSd and CS?
References 1. Arnold, A., and Latteux, M.: A new proof of two theorem about rational tran duction . Theoretical Computer Science 8, 2 (1979), 261 263. 2. Ber tel, J.: Transductions and Context-Free Lan ua es. Teubner Studienb¨ ucher, Stuttgart, 1979. 3. Eilenberg, S.: Automata, Lan ua es and Machines, vol. A. Academic Pre , New York, 1974. 4. Elgot, C. C., and Mezei, J. E.: On relation de ned by generalized nite automata. IBM Journal of Research and Development 9 (1965), 47 68. 5. Giammarre i, D., and Re tivo, A.: Two-dimen ional language . In Handbook of Formal Lan ua es, A. Salomaa and G. Rozenberg, Ed ., vol. 3. Springer-Verlag, Berlin, 1997, pp. 215 267. 6. Greibach, S. A.: Full AFL’ and ne ted iterated ub titution. Information and Control 16, 1 (1970), 7 35. 7. Kuroda, S.-Y.: Cla e of language and linear bounded automata. Information and Control 7, 2 (1964), 207 223. 8. Latteux, M., and Simplot, D.: Context- en itive tring language and recognizable picture language . Information and Computation 138, 2 (1997), 160 169. 9. Latteux, M., Simplot, D., and Terlutte, A.: Iterated length-pre erving tran duction . Tech. Rep. it-312, L.I.F.L., Univ. Lille 1, France, March 1998. 10. Mezei, J, and Wright, J. B.: Algebraic Automata and Context-Free Set . Information and Control 11, 2-3 (1967), 3 29. 11. Nivat, M.: Tran duction de langage de Chom ky. Ann. de l’Inst. Fourier 18 (1968), 339 456. 12. Sch¨ utzenberger, M. P.: Sur le relation rationnelle entre monode libre . Theoretical Computer Science 3, 2 (1976), 243 259. 13. Turakainen, P.: Tran ducer and compo ition of morphi m and inver e morphi m . In Studies in honour of Arto Kustaa Salomaa on the occasion of his ftieth birthday (1984), vol. 186 of Ann. Univ. Turku. Ser. A I, pp. 118 128. 14. Wood, D.: Iterated -NGSM map and Γ y tem . Information and Control 32, 1 (1976), 1 26.
The Head Hierarchy for Oblivious inite Automata with Polynomial Advice Collapses Hol er Petersen Institut f¨ ur Informatik, Universit¨ at Stutt art Breitwiesenstr. 20 22, D-70565 Stutt art
[email protected] art.de
Abs rac . We show that the hierarchy of classes of lan ua es accepted by nite multi-head automata with oblivious head movements that receive polynomial advice strin s collapses to the fth level. A characterization of nondeterministic lo arithmic space with polynomial advice is simpli ed. In the presence of polynomial advice, the question whether deterministic and nondeterministic lo arithmic space are equivalent can be reduced to the question whether simple nondeterministic automata can be simulated deterministically. Polynomial time can be characterized by a one-head device. For automata without advice we prove that multi-head counter automata, stack automata, and non-erasin stack automata do not lose power by the restriction to oblivious head movements.
1
Introduction
The investi ation of nite multi-head automata oes back at least to the work of Kosmidiadi and Marchenkov [7]. Already in this early reference a connection between multi-head automata and space complexity of Turin machine computations was established. The characterizations of the complexity classes DFA(k)
L= k1
NL =
NFA(k) k1
are well-known, see e. . [3] (here DFA(k) (NFA(k)) denotes the class of lanua es accepted by deterministic (nondeterministic) nite automata with k twoway input heads). Other complexity classes can be characterized with the help of two-way multi-head automata as well; as an example we mention that P is the class of lan ua es accepted by deterministic or nondeterministic multi-head pushdown automata [2] or alternatin nite multi-head automata [6]. See [11] for more equivalences between complexity classes and classes based on multi-head automata. Holzer [4] de ned oblivious (data-independent) nite multi-head automata, in order to obtain multi-head devices characterizin lo space uniform NC1 , the class of lan ua es accepted by lo space-uniform families of circuits with lo arithmic depth and bounded fan-in. He also investi ated the class of lan ua es Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 296 304, 1998. c Sprin er-Verla Berlin Heidelber 1998
The Head Hierarchy for Oblivious Finite Automata
297
accepted by these devices if a polynomial advice in the sense of Karp and Lipton [5] is supplied to the automata. He left open whether the in nite union over all possible numbers of input heads collapses to a xed level, as it does for nonoblivious automata. The main result of this paper ives a positive answer to this question. Despite their apparent weakness, oblivious nite multi-head automata with a small number of heads are able to perform tasks like strin matchin , i.e., decide whether a pattern occurs in a text. The strai htforward quadratic al orithm for a device with two heads can be adapted to the oblivious variant. Instead of abortin a comparison after the rst mismatch, both heads move ri ht until the one readin the text reaches the end-marker. Only then are the heads reset for the next comparison. A match is recorded in the nite control and the process is continued until all positions have been checked. The present paper is or anized as follows. We introduce informally the concepts and notation used. Then we show the collapse of the hierarchy of lan ua e classes accepted by oblivious nite multi-head automata with polynomial advice. This is a result analo ous to Theorem 14 of [4] for non-oblivious automata. However, as pointed out in [4], a new technique has to be developed since the simulation of non-oblivious automata relies on the input bein well-formed, i.e., composed of the input and a correspondin advice strin . Checkin this property in a strai ht-forward manner spoils the obliviousness that should hold for every input. For nite multi-head automata Holzer could reduce the number of input heads to two in the presence of a polynomial advice. We show that this characterization of NL poly by two-head nite automata can be improved to one-head bounded counter automata. We ive stren thened versions of the result from [4] linkin simple automata to the relation between L poly and NL poly. For two-way pushdown automata a sin le head simulates any nite number of heads in the analo ous settin , thus leadin to a characterization of P poly. In the concludin remarks of [4] other devices than multi-head nite automata are mentioned in connection with oblivious and non-oblivious computations. Here we investi ate counter automata as well as some variants of stack automata and show that obliviousness is no restriction for these devices. In a nal section we discuss some unresolved questions.
2
Notation
We consider one-way and two-way devices equipped with a nite control and a nite number of input heads that can be moved independently. The read-only input tape is bordered by special symbols, the end-markers. These devices start their computation in a xed initial state with their input heads next to the left end-marker and accept by nal state. Each step depends on the internal state of the automaton and the symbols read by the heads. A counter automaton has in addition access to a counter that can be incremented, decremented, and tested
298
Hol er Petersen
for bein zero. A stack is a sequential stora e similar to a pushdown store with the additional option to move the stack pointer in a read-only mode into the stack contents. It is non-erasin if no symbol is ever removed once it has been written. For more detailed de nitions see [11,4]. An automaton is called oblivious (data-independent) if the movements of its input heads depend on the len th of the input only. We also require that all computations on words of a iven len th terminate after the same number of steps, either by acceptin or by reachin a con uration that admits no further computation. Note that oblivious counter and stack automata may still modify their stora e contents in an arbitrary manner. The classes of lan ua es accepted by k-head deterministic resp. nondeterministic two-way nite automata and deterministic resp. nondeterministic counter automata will be denoted by DFA(k), NFA(k), DCA(k), and NCA(k). If the counters are bounded by the input-len th we call the respective classes DBCA(k) and NBCA(k). The class of lan ua es accepted by k-head two-way deterministic pushdown automata is DPDA(k). A pre x Di indicates that the heads move in an oblivious fashion. Let C be a class of lan ua es. Then C poly is the class of lan ua es L0 = w jwj w L where L C and = ( ) is a sequence of polynomially len thbounded advice strin s. Up to easy transformations of the input this de nition is equivalent to the ones in [5,1].
3
Automata with Advice
The rst result of this section shows that the syntactic hierarchy of lan ua e classes de ned in terms of oblivious automata with an increasin number of heads receivin a polynomial advice collapses to a xed level. The idea is to construct a simulator with a xed number of heads for a iven multi-head automaton that uses a modi ed advice in order to compensate for the lack of heads. Note however that it is not su cient to desi n a simulator that works in an oblivious way on input strin s containin the intended advice. Rather the simulator has to work in this way on every input strin . Our rst oal is an arithmetical encodin of the positions of many heads with the help of a xed number that does not depend on the contents, but only on the len th of a iven input strin . Lemma 1. Let m be a number stored as the distance of the rst head of a multihead automaton to the ri ht end-marker. Then the automaton can compute mk as the distance of another head for every k > 0 such that mk does not exceed the input len th. At most three additional heads are required and m is still encoded by the rst head. Proof. In order to preserve m the automaton uses a second head that moves in the opposite direction of the rst one. Two further heads alternate in storin . Suppose m is currently stored. This number is repeatedly decre1 m m2 mented and for every decrement operation m is added to the position of the
The Head Hierarchy for Oblivious Finite Automata
299
head storin the next result with the help of the rst two heads. Startin from 0 the resultin value is m +1 . Theorem 1. The in nite union vel,
k1
DiDFA(k) poly collapses to its fth le-
DiDFA(k) poly = DiDFA(5) poly k1
Proof. Let L DiDFA(k) poly be accepted by an oblivious k-head nite automaton A via a sequence of advice strin s = ( n ), and let x be a xed symbol from the alphabet of A. De ne a new advice 0 = ( 0n ) by 0n = k x(n+j n j+2) −n−j n j n , i.e., the new advice incorporates the old one and adds paddin symbols that will result in an input strin that has len th mk , where m is the number of symbols accessible to A (includin end-markers). Clearly 0 is polynomially bounded. We ive an oblivious al orithm for a nite automaton B equipped with ve heads receivin advice 0 that simulates A with advice . First B stores as the distance of its rst head to the ri ht end-marker m = 1 2 and in turn attempts to compute mk accordin to the precedin lemma. If eventually mk is equal to the input len th for some m this rst phase terminates and m is kept xed. If durin the computation B determines that the input-len th is not a k-th power it rejects its input. Now B starts a step-by-step simulation of A on a su x of len th m of B’s input. The head positions of A can be expressed as k distances to the ri ht end-marker that may vary between 0 and n + n + 1. These distances will be encoded as a sin le k-di it, m-ary number p for m = n + n + 2. Notice that the input for B has len th mk (assumin that the matchin advice is supplied). This number p is stored on head 3 (heads 1 and 2 store m). Initially k−1 p= n )m . =0 (n + In order to simulate a sin le step of A the automaton B rst determines the symbols scanned by the heads of A. It divides p by m, storin the result as the distance of head 4 and keepin the remainder r as the position of head 1. Now an input symbol can be read by head 1 and remembered in B’s nite control. Then B copies r onto head 5 and adds rmk−1 to the number stored by head 4. It achieves this by movin head 3 over the entire input strin (that has len th mk ) and incrementin the number stored on head 4 for every m-th symbol (usin heads 1 and 2). This sequence of operations is repeated r times usin head 5 as a counter. Notice that the left end-marker will not be available at the proper position because of the paddin . Therefore B in its simulation of A substitutes the left end-marker for every symbol read at distance m − 1, which will be determined with the help of the value m stored by heads 1 and 2. By repeatedly computin the remainders and k times rotatin the number stored on head 4, all symbols scanned by the heads of A can be determined. If the correct advice is presented to B it has assembled all the information necessary to simulate a step of A. By repeatin the rotation process described
300
Hol er Petersen
above it can update the encodin of the head positions and then record the new internal state of A. The input is accepted by B if and only if A accepts. It mi ht happen that the input len th is a k-th power althou h it has not been composed properly of the advice and a correspondin input. This will do no harm because B always simulates a computation of A on an input of len th m − 2. Since A is oblivious the head movements are the same for every strin of this len th. If B’s input len th is not a k-th power it always rejects after the rst (oblivious) sta e. Therefore B is oblivious on every input. We have (A accepts 0 (jwj+j |w| j+2)k −jwj−j |w| j jwj w) if and only if (B accepts jwj w = x jwj w). With the equality L poly = DFA(2) poly from [4] we obtain: Corollary 1. DiDFA(k) poly
L poly =
i
DFA(2) poly = DiDFA(5) poly
k1
Turnin now to non-oblivious automata, we improve the characterization NL poly = NFA(2) poly (the nondeterministic analo ue of Theorem 14 in [4]) from two-head nite automata to one-head counter automata, where the counter is bounded by the input len th. A bounded counter can easily be simulated with the help of a two-way input head. Theorem 2.
NL poly = NBCA(1) poly.
Proof. By the equality NL poly = NFA(2) poly it su ces to ive a simulation of a nondeterministic two-head automaton A with polynomial advice by a nondeterministic bounded counter automaton B. Let A’s advice be = ( n ) and introduce a new symbol #. We desi n an advice = ( n ) by lettin m = n + n + 2 and set n
0 0
=
(m−1)m+(m−1)
10(m−1)m
2
(m−1)m +(m−1)m+(m−1)
0 0
m+j
10
0m+0
10
m2 +jm+
10
0m2 +0m+0
2
+(m−1)m+(m−1)
10
m2 +jm+j
10
1
(m−1)m2 +(m−1)m
10
0m2 +0m+0
m2 +jm
10
1
1
0m2 +0m
1#
n
where i and j run throu h (m − 1) 0. If there are two or more symbols # in its input strin B rejects. Therefore words in the lan ua e de ned will not contain #. Now we describe the step-by-step simulation of A by B. If the distances of A’s heads from the ri ht end-marker are i and j respectively, B’s counter will store the number im + j. The blocks of 0’s in B’s advice are arran ed in roups of four. Countin modulo four startin at the left end-marker, B locates a roup such that the len th of the rst block matches the counter contents.
The Head Hierarchy for Oblivious Finite Automata
301
From this roup B copies the len th of the second block onto the counter, which now stores im2 + jm + i, and moves its input head to the ri ht end-marker. Decrementin the counter for every step of the input head, B moves its head nondeterministically on position i and remembers the input symbol read by A’s head. The head is never moved over # in these operations, thus boundin the number subtracted from the counter by m − 1. Then B nondeterministically returns to the roup and checks that the counter contents a ree with the fourth block. This comparison veri es that the correct position has been read by the input head and that the initial roup has been reached. The len th of the third block in the roup is copied onto the counter and the process is repeated for the second head of A. After restorin the ori inal counter contents the encoded head positions are updated accordin to the state transition by addin or subtractin one or m respectively. The last operation can be carried out with the help of the input head. If A enters an acceptin state, B accepts as well. None of the phases of the simulation stores a number exceedin the input len th on the counter. From the characterization in [4] follows, that the classes of lan ua es accepted by deterministic and nondeterministic Turin machines with lo arithmic space bound and polynomial advice coincide if and only if a correspondin inclusion relation holds for two-way nite automata with two heads, NL poly = L poly if and only if NFA(2) poly DFA(2) poly. With the previous simulation we obtain a stren thened version of Corollary 15 in [4]. Corollary 2. NL poly = L poly
if and only if
NBCA(1) poly = DFA(2) poly
In the case of automata without advice it is known that the equivalence between determinism and nondeterminism can be reduced to a question about one-way automata, NL = L if and only if 1NFA(2) DFA(k) for some k [10]. We observe that an analo ous relation holds for automata with advice, thus ivin another variant of Corollary 15 from [4]. Proposition 1. NL poly = L poly
if and only if
1NFA(2) poly
DFA(2) poly
With the same technique as in [4], two-head alternatin automata [6] characterize lan ua es accepted with a polynomial time bound in the presence of a polynomial advice. The next result ives a characterization of this class P poly usin a pushdown automaton with a sin le head. Theorem 3.
DPDA(1) poly = P poly.
Proof (sketch). The linear time simulation of deterministic one-head pushdown automata on the RAM shows that any lan ua e in DPDA(1) poly is in P poly as well. Conversely, P poly can be characterized as the class of lan ua es havin small circuits, i.e., families of polynomial size circuits. The circuit value problem
302
Hol er Petersen
can be decided by a deterministic two-way pushdown automaton, see [8]. The advice for input len th n is simply the encodin of the circuit for len th n, where the separation of the block of input symbols from the code of the circuit does not pose a problem for the pushdown automaton. The precedin proof requires a substantial transformation of a iven advice when oin from a polynomial time Turin machine to a two-way pushdown automaton. The followin brief discussion shows that by exploitin the power of pushdown automata a simple paddin actually su ces. Monien [9] has shown that any set accepted by a successor RAM (the set of instructions includes increment by one, a comparison with zero, and memory transfer operations with indirect addressin ) in time bound t(n) can be accepted by a counter pushdown automaton with a counter bounded by t(n) lo 2 t(n), provided that the bound t(n) is constructible by the pushdown automaton. A counter pushdown automaton is a deterministic two-way device with a pushdown stora e and a sin le input head that may read blank symbols beyond the end of its input strin . If the counter is bounded by s(n) it may access at most s(n) cells on its input tape. Clearly it does not matter whether the blank symbols are read before or after the input strin . By providin a su cient number of blank symbols before the ori inal advice, a new advice that admits a simulation of any polynomially time bounded successor RAM (and therefore of any polynomially time bounded Turin machine) can be constructed.
4
Oblivious Automata Without Advice
Holzer [4] su ests to study oblivious counter machines or stack automata. We show here that obliviousness or data-independence is no restriction for these multi-head devices if the stora e may be used freely. Lemma 2. Every k-head nite automaton can be simulated by a 2k-head oblivious counter automaton, NFA(k) DiNCA(2k) and DFA(k) DiDCA(2k). Proof. Note that for a k-head automaton the len th of a shortest acceptin computation can be bounded by a polynomial p(n) in O(nk ). Add a second set of heads and modify the nite control in such a way that the automaton stops after exactly p(n) steps for every input word. The resultin nite automaton will be simulated by an oblivious counter automaton that keeps an encodin of all head positions as an (n + 2)-ary number on its counter, similar to the proof of Theorem 1. It uses its 2k input heads to cycle throu h all possible combinations of head positions and decrement the counter in every step. When the counter reaches zero, the automaton records the symbols read by its heads. Then it continues to cycle throu h the head positions until it has exhausted all possibilities, now incrementin the counter. It repeats this process, interchan in increment and decrement, thus recoverin the initial counter contents. In order to simulate a step of the nite automaton the counter automaton determines the next state from the previous one and the symbols read. Here the mode depends on the simulated automaton bein deterministic or nondeterministic. In order
The Head Hierarchy for Oblivious Finite Automata
303
to adjust the encoded head positions the automaton repeatedly cycles throu h i 2k. head con urations eneratin intervals of len th (n + 2) for all 0 The encoded positions are updated by either incrementin or decrementin the counter alon with each step in the interval. The head movements are the same for every encodin and thus the counter automaton is oblivious. Theorem 4. Every deterministic or nondeterministic multi-head one-counter automaton can be simulated by an oblivious device of the same kind. Proof. First we notice that every k-head counter automaton can be simulated by a 2k-head nite automaton in the deterministic case and by a 3k-head nite automaton in the nondeterministic case [11, Theorem 13.8]. Now apply the precedin lemma to the resultin nite automata to prove the claim. Theorem 5. Every non-erasin multi-head stack automaton is equivalent to an oblivious device of the same kind. Proof (sketch). The class characterized by non-erasin multi-head stack automata in their nondeterministic as well as in their deterministic variant is PSPACE [11, Theorem 13.29]. It thus su ces to describe the oblivious simulation of a p(n) space-bounded deterministic Turin machine M by a non-erasin multi-head stack automaton A, where p is a polynomial. Without loss of enerality we assume that M ’s computations on input strin s of len th n have the same len th. We equip A with a number of heads that su ces to count up to p(n). Initially A writes the rst con uration of M on the stack, adds p(n) − n blanks and a marker symbol. Then it repeatedly enerates the successor conuration terminated by the marker-symbol from the old con uration until M either accepts or rejects. We note that the proof of [11, Theorem 13.29] uses the input heads to store information durin the copyin process and thus does not ive an oblivious simulation. Theorem 6. Every multi-head stack automaton is equivalent to an oblivious device of the same kind. Proof (sketch). Multi-head stack automata characterize the time complexity class DTIME(2Pol ) [11, Theorem 13.35]. We describe an oblivious stack automaton A simulatin a deterministic Turin machine M that accepts in O(2p(n) ) steps for some polynomial p. Without loss of enerality we require M to be a sin le tape Turin machine such that computations on inputs of size n have identical len th. Analo ous to the proof of Theorem 13.20.3 of [11] the head movements of M can be normalized with quadratic overhead to facilitate the calculation of M ’s head position. Stack automaton A makes use of its heads to copy, compare, and modify binary strin s of polynomial len th at the top of its stack. In this way A computes tuples encodin M ’s state, tape contents, and head position in a similar way as the pushdown-automaton in the proof mentioned above, usin binary instead of unary encodin of numbers. By the normalization A works in an oblivious way.
304
5
Hol er Petersen
Open Problems
Unlike the situation for nite multi-head automata with advice, oblivious or non-oblivious, we do not have a hierarchy or collapse result for nonuniform nite multi-head automata as de ned in [4]. In the case of our collapse result for oblivious automata the number of heads is not known to be optimal and, usin re ned simulation techniques, it seems possible to reduce this number. The lower bound is two since, as pointed out in [4], one-head automata are not su cient for this type of simulation. In the case of nondeterministic automata the characterization of NL poly has been simpli ed to counter automata, but the technique does not carry over to deterministic machines. Does some other simulation ive an analo ous result, or is this an inherent weakness of deterministic devices? Acknowled ement. I wish to thank Markus Holzer for several helpful discussions.
References 1. J. L. Balcazar, J. D az, and J. Gabarro. Structural Complexity I, volume 11 of EATCS Mono raphs on Theoretical Computer Science. Sprin er, BerlinHeidelber -New York, 1988. 2. S. A. Cook. Characterizations of pushdown machines in terms of time-bounded computers. Journal of the Association for Computin Machinery, 18:4 18, 1971. 3. J. Hartmanis. On non-determinancy in simple computin devices. Acta Informatica, 1:336 344, 1972. 4. M. Holzer. Multi-head nite automata: Data-independent versus data-dependent computations. In I. Pr vara and P. Ruzicka, editors, Proceedin s of the 22nd Symposium on Mathematical Foundations of Computer Science (MFCS), Bratislava, 1997, number 1295 in Lecture Notes in Computer Science, pa es 299 308. Sprin er, 1997. 5. R. M. Karp and R. J. Lipton. Turin machines that take advice. L’Ensei nement Mathematique, 28:191 209, 1982. 6. K. N. Kin . Alternatin multihead nite automata. Theoretical Computer Science, 61:149 174, 1988. 7. V. A. Kosmidiadi and S. S. Marchenkov. On multihead automata. Systems Theory Research, 21:124 156, 1971. Translation of Probl. Kib. 21:127 158, 1969, in Russian. 8. R. E. Ladner. The Circuit Value Problem is lo space complete for P. SIGACT News (ACM Special Interest Group on Automata and Computability Theory), 7:18 20, 1975. 9. B. Monien. Characterizations of time-bounded computations by limited primitive recursion. In Proceedin s of the 2nd International Colloquium on Automata, Lan ua es and Pro rammin (ICALP), Saarbr¨ ucken, 1974, number 14 in Lecture Notes in Computer Science, pa es 280 293. Sprin er, 1974. 10. I. H. Sudborou h. On tape-bounded complexity classes and multihead nite automata. Journal of Computer and System Sciences, 10:62 76, 1975. 11. K. Wa ner and G. Wechsun . Computational Complexity. Mathematics and its Applications. D. Reidel Publishin Company, Dordrecht, 1986.
The Equivalence Problem for Deterministic Pushdown Transducers into Abelian Groups Geraud Senizer ues LaBRI Universite de Bordeaux I 351, Cours de la Liberation 33405 Talence, France
[email protected]; fax: 05-56-84-66-69 http://www.labri.u-bordeaux.fr/ es
Abs rac . The equivalence problem for deterministic pushdown transducers with inputs in a free monoid X ∗ and outputs in an abelian roup H is shown to be decidable. The result is obtained by constructin a complete formal system for equivalent pairs of deterministic rational series on the variable alphabet associated with the dpdt M with coe cients in the monoid H 0 (the monoid obtained by adjoinin a zero to the roup H).
1
Introduction
We show here that, iven two deterministic pushdown transducers (dpdt’s for short) A B from a free monoid X into an abelian roup H, one can decide whether S(A) = S(B) or not ( i.e. whether A B compute the same function H). This result eneralizes the decidability of the equivalence problem f : X for deterministic pushdown automata ([13]) and can be also considered as a step towards the solution of the equivalence problem for dpdt’s from a free monoid X into another free monoid Y . This last problem has been adressed in [9,10,16] and remains open (see section 6 for other related problems). Our solution leans on the methods developped in [13] and our exposition will often refer the reader to this article. Complete proofs can be found in [14, section11, p.108-143], an example is treated in [14, section 12, p.153-158].
2 2.1
Preliminaries Semi-Rin s
The reader is refered to [1] for formal power series. We just review here some basic vocabulary and properties. Semi-Rin K W Let us consider a semi-rin (K + 0K 1K ) and an alphabet W . By (K W + ) we denote the semi-rin of series over the set of non-commutative undeterminates W , with coe cients in K. The sum and product are de ned as usual. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 305 315, 1998. c Sprin er-Verla Berlin Heidelber 1998
306
Geraud Senizer ues
A map : K W K W 0 which is a semi-rin homomorphism, a -additive map and which xes every element of K, will be called a substitution. The support of S is the lan ua e: supp(S) = w W Sw = 0K Semi-Rin B H Let (B + 0 1) where B = 0 1 denote the semi-rin of booleans and let (H ) be a roup. By B H we denote the semi-rin of formal power series with undeterminates in the roup H and coe cients in B. It is isomorphic with the semi-rin of subsets of H. 2.2
Automata
Finite H-Automata Let (H ) be some roup. We call a nite H-automaton over the alphabet W any 5-tuple M =< W Q
h0 q0 Q0 >
such that Q is the nite set of states, , the set of transitions, is a nite subset H, q0 Q and Q0 Q. As H is embedded in the of Q H W Q, h0 semi-rin K = B H such an automaton can be seen as a nite automaton with multiplicities in K and the series reco nized by M, S(M), is de ned as usual. It can be de ned , for example, by S(M) = h0 A B C, where B KQ Q W , and C KQ 1 W are iven by: A K1 Q W Aq0 = Aq = (for q Q − q0 ) Bq q = (q h v q )2 h v Cq 1 = ( if q Q0 ) Cq 1 = ( if q Q0 ) M is said W -deterministic i , q
Q
v
W Card( (r h v r0 )
q=r )
1
(1)
Finite m-H-Automata Let n m IN − 0 be positive inte ers. we denote the set of matrices of dimension (n m) with By B H n m W entries in the semi-rin B H W . We call a nite m-H-automaton over the alphabet W any 5-tuple M =< W Q h0 q0 (Qj )1jm > such that < [1 m], Qj W Q h0 q0 Q > is a nite H-automaton and for every j Q. For every j [1 m] we denote by Mj the nite H-automaton Mj =< W Q h0 q0 Qj > The vector reco nized by M, S(M), is de ned by: S(M) = (S(M1 )
S(Mj )
S(Mm ))
M is said W -deterministic i it ful lls the above condition (1). Pushdown H-Automata We call a pushdown H-automaton on the alphabet X any 6-tuple M =< X Z Q q0 z0 > where Z is the nite stack-alphabet, Q is the nite set of states, q0 Q is the ) Pf (H QZ ), initial state, z0 is the initial stack-symbol and : QZ (X 0 0 Q Z z Z h H u X and is the transition mappin . Let q q
The Equivalence Problem for Deterministic Pushdown Transducers
a −
X M
; we note (qz h au) − M (q 0 0 h h0 u) if (h0 q 0 0 ) is the reflexive and transitive closure of − M . For every q q 0 (h u) M
and h H u X , we note q − is said deterministic i for every z
q0 Z q
0
i (q Q:
either Card( (qz )) = 1 and for every x or Card( (qz )) = 0 and for every x
1H u) −
M
(q 0
0
0
1
(qz a). QZ
h ) M
X Card( (qz x)) = 0 X Card( (qz x))
307
(2) (3)
The mode qz is said -bound (resp. -free) when condition (2) (resp. (3)) is true. A H-dpda M is said normalized i , for every q Q z Z x X: q0
0
2 (qz
0
x)
2 and q 0
0
2 (qz
)
0
=0
(4)
) Pf (QZ ), is the second component of the map where 2 : QZ (X . Given some nite set F QZ of con urations, the series reco nized by M with nal con urations F is de ned by h u
S(M F ) = c2F
hu q0 z0 −!M c
B H of a word u X in the series One can see the coe cient Su S(M F ) either as the multiplicity with which the word u is reco nized , or as the output of the automaton M on the input u. We suppose that Z contains a special symbol e subject to the property: q 2.3
Q (qe ) = (1H q) and im( 2 )
Pf (Q(Z − e ) )
(5)
Free Monoids Actin on Semi-Rin s
Actions of Monoids The eneral notions of ri ht-action and -ri ht-action of a monoid over a semi-rin is the same as in [13, 2.3.2]. W The Action of H W on B H W is de ned by: S H W over B H W T = S (h w) is the series: v
A -ri ht-action of the monoid B H W h H w
W Tv = h−1 Swv
In words, S (h w) is the left-quotient of S by the monomial h w. (From now on, W ). we identify the pair (h w) H W with the monomial h w B H V Let M be some H-dpda (for sake The Action of H X on B H of simplicity , we suppose here that M is normalized). The variable alphabet VM associated with M is de ned as: VM = [p z q] p q Q z Z (from now
308
Geraud Senizer ues
on, we abbreviate VM by just V ). Let us consider the set PM of all the pairs of one of the followin forms: ([p z q] h x [p0 z1 p00 ][p00 z2 q]) or ([p z q] h x [p0 z 0 q]) or ([p z q] h a) (6) Q x X a X (h p0 z1 z2 ) (pz x) (h p0 z 0 ) where p q p0 p00 (pz x) (h q) (pz a). We de ne a -ri ht-action ⊗ of the monoid H (X e ) over the semi-rin (B H ) V by: for every p q Q z Z x X h H k B H : [p z q] ⊗ x = (
[p z q] ⊗ e = h i ([p z q] h)
m) (1H x)
PM
([p z q] m)2PM
[p z q] ⊗ e =
H V )
i ( [p z q] k⊗x=
k⊗e=
(9) B
The action is extended to all monomials by: for every k X e S B H V h H, :B
Action We de ne a map -additive map such that,
H
( )= and for every p
V
H
V
y (10)
as the unique
( )= V k
B
Q z
Z q
Q
([p z q]
)=
(([p z q] ⊗ e)
([p z q]
B
V
H
S ⊗ h = h−1 S
) ⊗ y = k ([p z q] ⊗ y)
(k [p z q]
(7) (8)
PM =
H
B
S
H
V
,
) if pz is − bound if pz is − free (S)
) = [p z q] (k S) = k
The ri ht-action of the monoid H X over the semi-rin B is then the unique monoid-action ful llin : for every S B H H x X, S (h x) = ( (S) ⊗ (h x))
H V
V h
Case where H is abelian Let us consider the case where H is abelian. Let B H V B H X de ned by: k
B
H
(k) = k;
v
V
:
h u
(v) = v (hu)=
One can check that, as H is supposed abelian, there exists a unique -additive semi-rin homomorphism : B H V B H X which extends . Let us denote by the same letter the ori inal and its extension . Lemma 21 For every S 1. 2.
B
H
(S) = ( (S)), (S (h u)) = (S) (h u) ( i.e.
We denote by (S) = (T ).
the kernel of
V
h
X ,
H u
is a morphism of ri ht-actions).
i.e.: for every S T
B
H
V
S
T
The Equivalence Problem for Deterministic Pushdown Transducers
2.4
309
Len th-Functions
Let us suppose now that H admits a presentation over a nite alphabet Y : H : H is a surjective monoid-homomorphism. We suppose the presentation Y Y Y Y = and for every y Y H is symetric in the sense that Y = Y (resp. y Y ), there exists a unique y Y (resp. y Y ) such that H (y y) = 1H . For every h H, the len th of h, relative to the presentation H , is de ned by: (h) = min u
u
Y
H (u)
=h
(h−1 h0 ) is a distance over H. In the One can notice that the map (h h0 ) case of the free roup F(W ) with basis W , by ( ) we denote the len th-function associated with the standard presentation of F(W ) over the set of enerators W W −1 .
3 3.1
Deterministic Series, Vectors, and Matrices Determinism
Let us x a roup (H ) and a structured alphabet (W ). (We recall it just means that is an equivalence relation over the set W ). W -Deterministic Rational Matrices For every n m 1 we de ne an equivby: S T h H S = h T The alence relation over B H 1 m W by: for every ri ht-action is extended componentwise to B H n m W h H u W , (S (h u))i j = Si j (h u) For every S B H nm W we de ne the set of residuals of S , Q(S) and the set of S B H nm W row-residuals of S, Qr (S), by: Q(S) = S
(h u) h
H u
W
Qr (S) =
1in Q(Si )
1H ) consistin of the Let us denote by (H 0 1H ) the submonoid of (B H empty series and all the sin letons h for h H. H 0 can be seen as the monoid obtained by adjoinin a zero to the roup H. We sometimes use the symbol 0 for the element H 0 and we identify every h H with the correspondin 0 0 W we denote the subset of series in B H W whose h H . By H coe cients are all in H0 . Proposition 31 Let m 1, S B H 1 m W . The followin properties are equivalent: (1) S is reco nized by some W -deterministic nite m-H-automaton is nite (2) j [1 m] u W ((Sj )u H 0 ) and Q(S) This proposition has been established in [3, prop.4, p.93] in the case where m = 1 and H is a free- roup. The extension to m 1 and to any roup H is strai htforward. De nition 32 Let S B H 1 m W . S is said W -deterministic rational i it ful lls one of points (1)(2) of proposition 31.
310
Geraud Senizer ues
Len th and Norm Let us consider a W -deterministic, nite, m-H-automaton M =< W Q h0 q0 (Qj )1jm >. We de ne the len th of M, k(M), the initial len th of M, k0 (M) and the norm of M, M as: k(M) = sup (h)
q
Q v
W r
; k0 (M) = (h0 ) and
Q (q h v r)
M = Card(Q) Let us consider now a vector S H01 m W . We de ne the len th of S, (S), the initial len th of S, 0 (S), and the norm of S, S by: (S) = inf
R+
i j
W Si u = 0
[1 m] u v
((Si u )−1 Sj v ) 0 (S)
=
0 (Su0 )
S = Card(Q(S)
(u−1 v) )
where Sj u denotes the coe cient of Sj on the word u, u0 is the minimum word m ) = 0. of m j=1 supp(Sj ) and we de ne 0 ( Lemma 33 For every W -deterministic rational vector S B H there exists some m-W -dfa M such that S(M) = S and k(M) M S S k0 (M) 0 (S)
1m
2
W , (S)
Let us consider now a matrix S H0n m W . We de ne the len th of S, (S), the initial len th of S, 0 (S), and the norm of S, S by: (S) = max (Si ) 1
i
n
0 (S)
= max
S = Card(Qr (S) In eneral, (S), S belon to IN
and
0 (Si )
1
i
n
and
)
0 (S)
belon s to IN.
-Determinism Let n m 1 S Bn m W . S is said -deterministic i it is deterministic in the sense of de nition 3.5 of [13] (this de nition was a strai htforward extension of [7, de nition 3.2 p.188]). A nite m-H-automaton M =< W Q h0 q0 (Qj )1jm > will be said -deterministic if and only if, for every q Q A A0 W h h0 H r r0 Q j j 0 [1 m] : ((q h A r)
and (q h0 A0 r0 )
)
A
A0 and j = j 0
Qj
Qj = (11)
Deterministic Rational Matrices Proposition 34 Let m 1 S B H 1 m W . The followin properties are equivalent: (1) S is W -deterministic rational and supp(S) is -deterministic. H 0 , Q(S) is nite and supp(S) is (2) j [1 m] u W Si u deterministic. (3) S is reco nized by some nite m-H-automaton which is both W -deterministic and -deterministic.
The Equivalence Problem for Deterministic Pushdown Transducers
311
De nition 35 Let m 1 S B H 1 m W . The vector S is said fully deterministic rational (deterministic rational, for short) i it ful lls one of points (1)(2)(3) of proposition 34. De nition 36 Let n m 1 S B H n m W . The matrix S is said fully deterministic rational (deterministic rational, for short) i every row-vector Si , for 1 i n, is fully deterministic rational. the set of Deterministic Rational matrices of We denote by DRH0n m W dimension (n m), with coe cients in B H W . Orderin We de ne a partial orderin on B H W by: for every S T B H W , S T ( u W Su = 0 or Su = Tu ) Given S T B H W such that S T we de ne T − S B H W by: u W (T − S)u = Tu ( if Su = 0); (T − S)u = 0( if Su = Tu ) 3.2
Al ebraic Properties
Let us x now some abelian roup (H ), some normalized H-dpda M and consider the structured alphabet (V ) associated with M. As B is embedded into B H the notations introduced in [13, 1.3.1] are still valid here. Some new statements concernin the functions 0 are introduced in the two next lemmas. T H0m s V Lemma 37 Let n m s 1 S DH0n m V (1) (S T ) max (S) (T ) + 2 0 (T ) + 2 (T ) T . (3) S T S + T . (2) 0 (S T ) 0 (S) + 0 (T )
. Then
u X . Then Lemma 38 Let m 1 S DH01 m V (1) (S u) (S). k(M) u + Q k(M) u 2 (2) 0 (S u) 0 (S) + S (3) S u S + Q u. Deterministic Spaces The notions of linear combination, d-space and eneratin set are de ned as in [13, 3.2] except that B is replaced by H 0 everywhere. Sj
Lemma 39 Let S1 DRH01 m
1.
Sm
V
2.
j0
[1 m] γ
DRH01 m
3.
j0
[1 m] γ 0
DRH01 m
DRH0
, such that V V
V
. The followin are equivalent Sj
1jm
(γ j0
), such that Sj0
1jm
γj0 0
, such that Sj0
1jm
j
1jm
j
Sj
γj Sj
γj0 Sj
(This lemma eneralizes [13, lemma 3.7] which eneralized the idea of [12, lemma 11 p.589]).
312
Geraud Senizer ues
4
Deduction System
4.1
General Systems
We use here a notion of deduction system which was inspired by [4]. The reader is referred to [13, section 4] for a precise de nition of this notion and of the related notion of strate y. 4.2
The System H0
We de ne here a particular deduction system H0 Taylored for the equivalence problem for H-dpda’s . Given a xed H-dpda M over the terminal alphabet X, we consider the variable alphabet V associated to M (see section 2.3) and the set (the set of Deterministic Rational series over V , with coe cients DRH0 V 0 in H ). The set of assertions is de ned by : A = IN
DRH0
DRH0
V
V
i.e. an assertion is here a wei hted equation over DRH0 V . The cost-function J : A IN is de ned by : J(n S S 0 ) = n + 2 0 0 Div(S S ) where Div(S S ), the diver ence between S and S 0 , is de ned by: Div(S S 0 ) = inf u ( (S))u = ( (S 0 ))u (Notice that, J(n S S 0 ) = S S 0) We de ne a binary relation −− Pf (A) A, the elementary deduction relation, as the set of all the pairs havin one of the followin forms: (H0) (p S T ) (H1) (p S T ) (H2) (p S S 0 ) (p S 0 S 00 ) (H3) (H 0 3) (H4) (p + 1 S x T x) x X where ( h H S h T h) (H5) (p S S 0 ) for x X (H6) (p S1 T + S2 T ) where ( h H S1 h) (H7) (p S1 T1 ) (p S2 T2 ) (H8) (p S S 0 ) (H9) (p T T 0) (H10) (H11) where p The map
−− −− −− −− −− −−
(p + 1 S T ) (p T S) (p S S 00 ) (0 S S) (0 S T ) for T (p S T )
−− (p + 2 S
x S0
S
T
x)
−− (p S1 S2 T ) −− −− −− −− −−
(p (p (p (0 (0
S1 + S 2 T 1 + T 2 ) S T S0 T ) S T S T 0) S (S)) S e (S))
DRH0 V (S1 S2 ) (T1 T2 ) DRH01 2 V . IN S S 0 T T 0 involved in rule (H10) was de ned in 2.3 and we de ne the new
The Equivalence Problem for Deterministic Pushdown Transducers
map e involved in rule (H11) as the unique substitution B B H V such that, for every p q Q z Z, e ([p
e q] = ( if p = q)
e ([p
e q] = ( if p = q)
e ([p
H
313
V
z q] = [p z q]( if z = e)
where e is the dummy symbol introduced in (5). e maps every S DRH0 V is called marked into an ima e e (S) DRH0 V . A series S DRH0 V (resp. unmarked) i its support has at least one occurence (resp. no occurence) of a letter of the form [p e q]. Let us de ne −− by : for every P Pf (A) A A, P −− A
P −−
[1]
−− 0 3 4 10 11
−− A
where −− 0 3 4 10 11 is the relation de ned by H0 H3 H 03 H4 H10 H11 only. We let H0 =< A J −− > Lemma 41 : H0 is a deduction system.
5 5.1
Strate ies Trian ulations
Let us consider a sequence S of n wei hted linear equations : d
(Ei ) : pi
d i j Sj
j=1
i j Sj j=1
where pi IN, and A = ( i j ) B = ( i j ) are deterministic rational matrices of dimension (n d), with indices m i m + n − 1 1 j d. As in [13, section 5], we associate to such a system S, another system of equations INV(S) and two inte ers D(S), W(S), which depend on the matrices A B only (and, essentially, Sd ). not on the series S1 S2 5.2
Constants
Let us x a normalized H-dpda M and an initial equation A0 = (
0
S0− S0+ )
IN
DRH0
V
DRH0
V
Some constants, i.e. inte ers dependin on (M, A0 ) only, are de ned. The inte ers k0 ,k1 ,D1 ,k2 ,K1 ,K2 ,K3 ,K30 , K3 ,K4 ,K40 , K4 ,d0 ,D2 N0 and the sequences ( i i Li si s0i si Si i )1id0 are de ned by formulas similar to those of [13, section 6]. We then introduce four new constants: K2 ,L2 ,K7 ,K8 ([14, section 6]).
314
5.3
Geraud Senizer ues
Strate ies
By some sli ht adapatations of the strate ies devised for the system D0 (see [13, section 7]), we obtain strate ies for the particular system H0 . An ) = B1 Tcut : Tcut (A1 h H, such that Oi
Si Oi0
Bm i
Si0 On
i
[1 n−1] Si Si0 Sn Sn0
Sn On0
Sn0
Oi
Oi0
On
DRH0
V
On0
Ai = (pi Si Si0 ) An = (pn Sn Sn0 ) pi < pn Si − Oi = h (Sn − On ) Si0 − Oi0 = h (Sn0 − On0 ) and m = 0 TH : TH (A1
An ) = B1
Bm i An = (p S T ) p
0
h
H S
T
h
and m = 0 The strate ies T; TA TB+ TB− TC and the compound strate ies SAB , SABC are then de ned similarly as in [13, end of section 7]. Lemma 51 : Tcut T; TH TA TB+ TB− TC are H0 -strate ies. Moreover, SAB SABC are closed H0 -strate ies.
6
Completeness of H0
Let us x a tree = T (SAB ( 0 U0− U0+ )) (i.e. is the proof tree associated with the assertion ( 0 U0− U0+ ) by the strate y SAB ). We suppose that, for every − + (U0 )
L2
rd(U0 )
D2 and U0− U0+ are both unmarked
(12)
A careful analysis of such a tree shows that, for every in nite branch with Ai , there exists some n 1 such that A1 An sequence of labels A1 dom(TC ) (see [14, section 11.12], the ideas follow those of [13, section 8], combined with the new lemmas 37 and 38). We can then deduce, alon the same lines as in [13, lemma 9.1], the lemma below. Lemma 61 : Let A0 be some true assertion which is supposed unmarked. Then the tree T (SABC A0 ) is nite. Theorem 62 The system H0 is complete. Theorem 63 The equivalence problem for deterministic pushdown H-automata is decidable. Other related results can be found in [8],[11],[6]. The decidability results [15, theorem p.203],[5, corollary 2 p.549] raise the problem of whether theorem 63 still holds for any commutative monoid H ?
The Equivalence Problem for Deterministic Pushdown Transducers
315
References 1. J. Berstel and C. Reutenauer. Rational Series and their Lan ua es. Sprin er, 1988. 2. A.P. Biryukov. Some al orithmic problems for nitely de ned commutative semiroups. Siberian Math. Journal 8, pa es 384 391, 1967. 3. C. Cho rut. A eneralization of Ginsbur and Rose’s characterisation of sm mappin s. In Proceedin s ICALP 79, pa es 88 103. LNCS, Sprin er-Verla , 1979. 4. B. Courcelle. An axiomatic approach to the Korenjac-Hopcroft al orithms. Math. Systems theory, pa es 191 231, 1983. 5. R.H. Gilman. Presentations of roups and monoids. Journal of Al ebra 57, pa es 544 554, 1979. 6. T. Harju and J. Karhum¨ aki. The equivalence problem of multitape nite automata. TCS 78, pa es 347 355, 1991. 7. M.A. Harrison, I.M. Havel, and A. Yehudai. On equivalence of rammars throu h transformation trees. TCS 9, pa es 173 205, 1979. 8. O. Ibarra. The unsolvability of the equivalence problem for -free n sm’s with unary input (output) alphabet and applications. In Proceedin s FOCS 78, pa es 74 81. IEEE, 1978. 9. O.H. Ibarra and L. Rosier. On the decidability of equivalence problem for deterministic pushdown transducers. Information Processin Letters 13, pa es 89 93, 1981. 10. K. Kulik II and J. Karhum¨ aki. Synchronizable deterministic pushdown automata and the decidability of their equivalence. Acta Informatica 23, pa es 597 605, 1986. 11. W. Kuich and D. Raz. On the multiplicity equivalence problem for context-free rammars. In Important Results and trends in Theoretical Computer Science (Colloquium in Honor of Aarto Salomaa), pa es 232 250. Sprin er-Verla , LNCS 812, 1994. 12. Y.V. Meitus. The equivalence problem for real-time strict deterministic pushdown automata. Cybernetics and Systems analysis, pa es 581 594, 1990. Ori inal article (in russian) in Kibernetika 5, p.14-25, 1989. 13. G. Senizer ues. L(A) = L(B)? In Proceedin s INFINITY 97, pa es 1 26. Electronic Notes in Theoretical Computer Science 9, URL: http://www.elsevier.nl/locate/entcs/volume9.html, 1997. 14. G. Senizer ues. L(A) = L(B)? Technical report, corrected and extended version of nr 1161-97, LaBRI, Universite Bordeaux I, can be accessed at URL:http://www.labri.u-bordeaux.fr/ es, 1998. 15. M. Taiclin. Al orithmic problems for commutative semi roups. Soviet Math. Dokl., pa es 201 204, 1968. 16. E. Tomita and K. Seino. A direct branchin al orithm for checkin the equivalence of two deterministic pushdown transducers, one of which is real-time strict. Theoretical Computer science, pa es 39 53, 1989.
The Semi-Full Closure of Pure Type Systems Gilles Barthe Institutionen f¨ or Datavetenskap, Chalmers Tekniska H¨ o skola, G¨ otebor , Sweden Departamento de Informatica, Universidade do Minho, Bra a, Portu al
[email protected] Abs rac . We show that every functional Pure Type System may be extended to a semi-full Pure Type System. Moreover, the extension is conservative and preserves weak normalization. Based on these results, we ive a new, conceptually simple type-checkin al orithm for functional Pure Type Systems.
1
Introduction
Pure Type Systems (PTSs) [1] capture in a uni ed settin many typed -calculi that form the basis of typed functional lan ua es and type-theory based proofdevelopment systems. One central issue in the theory of PTSs is the problem of type-checkin , which consists in decidin whether a jud ment Γ M : A is derivable accordin to the rules of a iven PTS S. Althou h type-checkin is undecidable in eneral, most systems of interest have decidable type-checkin . For such systems, the question remains whether it is possible to nd reasonable, sound and complete, al orithms for type-checkin . The existence of such al orithms is not obvious and indeed the completeness of the most natural typecheckin al orithm, due to R. Pollack [8], remains an open problem. In a nutshell, the problem is caused by the second premise of the abstraction rule, which makes it di cult to prove completeness by induction on the structure of derivations. Nevertheless several authors have proposed type-checkin al orithms that are sound and complete for some speci c classes of PTSs. In the early 90s, R. Pollack [7, 8] introduced the class of semi-full PTSs informally a PTS is semi-full if it has enou h rules and ave a sound and complete type-checkin al orithm for PTSs in that class. Unfortunately, many PTSs of interest are not semi-full. Later L.S. van Benthem Juttin , J. McKinna and R. Pollack [3, 8] ave an alternative al orithm that is sound and complete for functional PTSs, a lar e class of PTSs that comprises most of the systems that appear in the literature. In order to check for the second premise of the abstraction rule, their al orithm invokes a complex derivability relation with -application and -conversion, as iven by the application rule Γ Γ
M : x: A B Γ N :A M N : ( x: A B) N
B x := N . Their al orithm is not and the reduction rule ( x: A B) N fully satisfactory in the sense that it requires to consider an extended framework. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 316 325, 1998. c Sprin er-Verla Berlin Heidelber 1998
The Semi-Full Closure of Pure Type Systems
317
More recently, P. Severi [9] has su ested another al orithm that appeals to Pure Type Systems without the -condition (PTSWs). Those are a variant of PTSs in which the abstraction rule is Γ x:A M :B Γ x:A M : x: A B A ain PTSWs are used to check for the second premise of the abstraction rule. While Severi’s al orithm eliminates the need for considerin new reduction relations, it still introduces a new framework. As a result, Severi needs to prove numerous properties for PTSWs before provin the soundness and completeness of the al orithm. Finally there are other al orithms that are concerned with the smaller class of (weakly) injective PTSs [2, 6]. These al orithms are simpler but do not cover all existin systems. For example some of the lan ua es of the Automath family [4] and predicative F [5] are not weakly injective. The purpose of this paper is to present a new sound and complete typecheckin al orithm for functional PTSs. The novelty of our al orithm is to remain within the framework of PTSs. It is an improvement over [3, 8, 9]: our al orithm is conceptually clearer and suppresses the need for introducin new frameworks such as the ones of [3, 8, 9]. In order to de ne our al orithm and prove it correct, we show that every functional PTS may be extended conservatively to a semi-full PTS, its semi-full closure. This result makes it possible to check, usin Pollack’s al orithm for semi-full PTSs, the second clause in the abstraction rule in the semi-full closure of the PTS under consideration. Contents The paper is or anized as follows. Section 2 briefly reviews the de nition of PTSs. Section 3 introduces the semi-full closure of a PTS. Section 4 shows that the semi-full closure of a PTS is a conservative extension of the ori inal PTS provided the latter is functional. In Section 5, we use that result to prove the soundness and completeness of a type-checkin al orithm for functional PTSs.
2
Pure Type Systems
In this section, we present the syntax of PTSs and refer to standard texts, see e. . [1], for examples and motivations. De nition 1 (Speci cation). A speci cation is a triple S = (S A R) where S is a set of sorts, A S S is a set of axioms and R S S S is a set of rules. A speci cation S = (S A R) is functional if for every s1 s2 s02 s3 s03 S, (s1 s2 ) A (s1 s2 s3 ) R
(s1 s02 ) A (s1 s2 s03 ) R
s2 s3
s02 s03
Every speci cation S yields a PTS S as speci ed below. Throu hout this section, S = (S A R) is a xed speci cation.
318
Gilles Barthe
De nition 2 (Pure Type System). 1. The set T of pseudo-terms is iven by the abstract syntax T =V S TT 2.
V :T T
V :T T
where V is a xed countably in nite set of variables. is de ned as the compatible closure of the contraction -reduction ( x:A M ) N
M x := N
where := is the standard substitution operator. The reflexive-transitive are denoted by and = and reflexive-symmetric-transitive closures of respectively. xn : An where 3. A pseudo-context is a nite ordered list x1 : A1 xn V and A1 An T . The empty context is denoted by x1 and the set of pseudo-contexts is denoted by G. If Γ G, we let dom(Γ ) = x t T x:t Γ . 4. A jud ment is a triple Γ M : A where Γ G and M A T . The rules of Pure Type Systems are iven in Fi ure 1. If Γ M : A is derivable accordin to those rules, then Γ and M are le al. ) is the Pure Type System (PTS) induced by S. 5. S = (E G Some of the results of this paper are concerned with normalization. (axiom)
s1 : s2
(start)
Γ A:s Γ x:A x:A
(weakenin )
(product)
(application)
(abstraction) (conversion)
Γ
A:B Γ x:C
if (s1 s2 ) if x
Γ C :s A:B
A : s1 Γ x:A B : s2 Γ ( x: A B) : s3
Γ
F : ( x: A B)
if (s1 s2 s3 )
a:A
F a : B x := a
Γ x:A Γ Γ
Γ
b:B Γ x:A b :
( x: A B) : s x: A B
A:B Γ B :s Γ A:B
dom(Γ )
if x V dom(Γ ) and A V
Γ
Γ
V
A
if B = B
Fi . 1. Rules for Pure Type Systems
R
The Semi-Full Closure of Pure Type Systems
319
De nition 3. We write S = WN( ) and S = SN( ) respectively if every le al term in S is -weakly normalizin and -stron ly normalizin respectively. We conclude this section with a list of properties of PTSs. Lemma 1 (Closure properties). x := a 1. Substitution. If Γ x : A B : C and Γ a : A, then1 Γ A x := a : B x := a . 2. Correctness of Types. If Γ A : B then either B S or there exists s S such that Γ B : s. 3. Correctness of Contexts. If Γ x : C A : B then there exists s S such that Γ C : s. N then Γ N : A. 4. Subject Reduction. If Γ M : A and M A0 then Γ M : A0 . 5. Predicate Reduction. If Γ M : A and A Lemma 2 (Uniqueness of Types). Assume S is functional. Γ
3
M :A
M : A0
Γ
A = A0
The Semi-Full Closure of a Speci cation
Semi-fullness is a technical condition ensurin that a PTS has enou h rules . This is to be contrasted with ne ative notions such as functionality or injectivity which ensure that a PTS does not have too many rules . Because of the nature of semi-fullness, every PTS may be extended to a semi-full one while a non-functional or non-injective PTS may not be extended to a functional or an injective one. In fact, there are several ways to extend a PTS into a semi-full one. The next de nition su ests two possibilities: the strati ed closure, which is layered so as to facilitate reasonin , and the compact closure, which is more suited for type-checkin purposes. De nition 4 (Semi-full, semi-full closure). Let S = (S A R) be a speci cation. De ne O= s
S
P = (s1 s2 )
s0 s00 O
S (s s0 s00 ) S
s
R
S (s1 s2 s)
R
1. S is semi-full if P = . 2. The compact semi-full closure of S is the speci cation S = (S A R ) and where S = S R = R
1
(s1 s2 ) (s1 s2 )
P
(s
) s
O
Substitution is extended from pseudo-terms to pseudo-contexts in the usual way.
320
Gilles Barthe
A R )
3. The strati ed semi-full closure of S is the speci cation S = (S i N and where S = S R =R 4. Let j Sj = S
(s1 s2
0)
(s1 s2 )
P
(s
s
+1 )
O i
N
N . The j-closure of S is the speci cation Sj = (S j A Rj ) where
Rj = R
i
j and
(s1 s2
0)
(s1 s2 )
P
(s
+1 )
s
O
i<j
5. By convention, we set S−1 = S. The next result provides an alternative characterization of semi-fullness; in fact it corresponds to Pollack’s ori inal de nition of semi-fullness. Lemma 3. Let S = (S A R) be a speci cation. 1. S is semi-full if for every s02 S and (s1 s2 s3 ) R, there exists s03 such that (s1 s02 s03 ) R. 2. S and S are semi-full. 3. If S is functional so are S , S and Sj for every j N .
S
We conclude this section by relatin S , S and the Sj s. Lemma 4. 1. 2. 3. 4.
4
i then M T and A T If Γ x M : A for x Γ M : A. Let A T . Then Γ M : A Let M T . Then Γ M : j N Γ M: M :A j N Γ j M : A. Γ
i
N .
j.
Conservativity
The purpose of this section is to prove that S is conservative in a sense to be made precise below over S. We proceed in three steps: rst, we prove that S is conservative over S −1 for every i N . Second, we conclude that S is conservative over S. Third, we derive that S is conservative over S. The development of this section is similar to [9] but the use of PTSs and strati cation simplify the proofs. Throu hout this section, we let S = (S A R) be a functional speci cation. De nition 5 (Contractin functions). 1. M is i-constrained in Γ , written !Γ (M ), if one of the conditions below holds: in case i = 0 this clause is simply M S; (a) M S 0 −1 M : A and !Γ (A). (b) there exists A T such that Γ
The Semi-Full Closure of Pure Type Systems
2. The contractin functions Γ G:
Γ
: T
321
T are de ned simultaneously for all
=s (x) = x Γ ( x: A B) = x: Γ (A) Γ x:A (B) Γ Γ ( x:A M ) = x: Γ (A) Γ x:A (M ) ( Γ x:A (P )) x := Γ (N ) Γ (M N ) = Γ (M ) Γ (N ) Γ (s)
s x
S V
if !Γ (M ) and M otherwise
x:A P
3. Γ is i-constrained, written ! (Γ ), is de ned as follows: ! ( ) = true 4. !!Γ (M ) is de ned as ! (Γ ) 5. The contractin function
! (Γ x : A) = ! (Γ )
!Γ (A)
!Γ (M ). :G G is de ned as follows: (Γ x : A) =
( )=
(Γ ) x :
Γ (A)
There are alternative de nitions of !Γ (M ) that are not recursive but we prefer our compact de nition. The next result is the key to our development. Proposition 1 (Conservativity of S over S −1 ). If Γ !!Γ (M ) then there exists B T such that D = B and (Γ )
−1
M : D and Γ (M ) : B.
Proof. By induction on the structure of derivations. Next we derive the conservativity of S over S. De nition 6. Let Γ 0 Γ (M ) ??0Γ (M )
G and M
= 0Γ (M ) = !!0Γ (M )
T For every i
+1 Γ (M ) ??Γ+1 (M )
= i+1 (Γ ) = !!Γ+1 (M )
N , de ne ??
i+1 (Γ )
(
+1 Γ (M ))
We have: Lemma 5. If Γ B = A and (Γ )
M : A and ??Γ (M ) then there exists B Γ (M ) : B.
T such that
Proof. By a strai htforward induction on i. To conclude we need to ‘take the limit’ of the conservativity results. De nition 7. 1. For every Γ G and M T , let (Γ N ) denote, when it exists, the smallest M : A. number such that A T Γ (Γ M) (Γ M) ??Γ (M ) and Γ (M ) = Γ (M ). 2. De ne ??Γ (M ) = (Γ M )
322
Gilles Barthe
3. For every Γ G, let (Γ ) denote, when it exists, the smallest number such M : A. that M A T Γ ?? (Γ ) (Γ ) and (Γ ) = (Γ ) (Γ ). 4. De ne ?? (Γ ) = (Γ ) Lemma 6. If Γ (Γ ) B = A and
M : A and ??Γ (M ) then there exists B Γ (M ) : B.
T such that
Proof. Follows from Lemmas 4 and 5. S and S type the same terms, hence we can transfer the conservativity result to S . Corollary 1 (Conservativity of S over S). If Γ (Γ ) then there exists B T such that B = A and
M : A and ??Γ (M ) (M ) : B. Γ
Proof. Follows from Corollary 6 and Lemma 4. For the purpose of type-checkin , the crucial property is the one iven in the next corollary. Corollary 2. If Γ Γ x: A B : s.
x: A B : s and Γ x : A
B : s0 and s
S then
T such that C = s Proof. Necessarily ??Γ ( x: A B) hence there exists C (Γ ) s hence by Predicate Reduction and Γ ( x: A B) : C. Now C (Γ ) (Γ ) = Γ and Γ ( x: Γ ( x: A B) : s. To conclude, observe that A B) = x: A B since Γ x : A B : s0 . In order to type-check, one sometimes needs to check the convertibility of types. Hence it is important for the PTS to be -normalizin . Fortunately, preserves normalization. Proposition 2.
S = WN( )
S = WN( ).
S = WN( ). Assume Proof. It is enou h to show that S −1 = WN( ) M : A. To show that M WN( ). We proceed by induction on the len th Γ (and not on the structure) of terms and reason by cases (whether or not ! (Γ )).
5
Application to Type-Checkin
In this section, we exploit the results of the previous section and the decidability of type-checkin for semi-full normalizin PTSs [3, 8] to establish the decidability of type-checkin for functional normalizin PTSs. An important step towards decidability of type-checkin is to provide a syntax-directed presentation of the rules of PTSs. In a nutshell, a set of rules is syntax-directed if the premises of a rule are determined up to inessential details by its conclusion. The next de nition provides such a set of rules. It uses an auxiliary relation sfsd which instantiates the derivability relation sfsd of [3, 8] to S .
The Semi-Full Closure of Pure Type Systems
(axiom)
sfsd
s1 : s2
if (s1 s2 )
Γ sfsd A : wh s Γ x : A sfsd x : A
(start)
(weakenin )
(product)
(application)
(abstraction)
Γ
sfsd
Γ
sfsd
A:B Γ sfsd C : Γ x : C sfsd A : B A:
wh
Γ Γ
sfsd
if x
F :
wh
Γ Γ x:A Γ
sfsd
s1 sfsd
Γ
sfsd
wh
s2
a:A
F a : B x := a
b:B B x:A b :
sfsd
A dom(Γ )
if x V dom(Γ ) and A V
Γ x : A sfsd B : ( x: A B) : s3
( x: A B)
sfsd
s
wh
V
323
if (s1 s2 s3 )
R
if A = A
B x: A B
Fi . 2. Syntax-d rected rules for sem -full closures
De nition 8 (Syntax-directed Rules). 1. Weak-head reduction
wh
( x : A P ) Q R1
is de ned as the closure2 of the contraction Rn
P x := Q R1
wh
Rn
2. A sort s is a typed sort, written s S , if s0 S (s s0 ) A. 3. The derivability relation Γ sfsd M : A is iven by the rules of Fi ure 2 A0 wh A. where we write Γ sfsd M : wh A if A0 T Γ sfsd M : A0 4. The derivability relation Γ where we write Γ na M :
na wh
The soundness and completeness of
M : A is iven by the rules of Fi ure 3 A if A0 T Γ na M : A0 A0 wh A. sfsd
over
is already known.
Proposition 3 ([3]). For every speci cation S, 1. Soundness: Γ sfsd M : A 2. Completeness: Γ M : A
Γ
A0
M : A. T Γ
Usin the above proposition, we conclude that respect to . 2
na
sfsd
M : A0
A = A0
is sound and complete with
We insist on the closure not bein compatible so weak-head reduction di ers from -reduction by applyin only at the top-level.
324
Gilles Barthe
(axiom) (start)
(weakenin )
(product)
(application)
(abstraction)
s1 : s2
na
if (s1 s2 )
Γ na A : wh s Γ x : A na x : A Γ
na
Γ
na
A:B Γ na C : Γ x : C na A : B A:
na
F :
na
wh
Γ Γ x:A
na
Γ
s1
wh
Γ Γ
if x
na
wh
s
Γ
na
wh
s2
a:A
F a : B x := a
b:B Γ x:A b :
x: A B : s x: A B
if (s1 s2 s3 )
R
if A = A if s
sfsd
na
dom(Γ )
if x V dom(Γ ) and A V
Γ x : A na B : ( x: A B) : s3
( x: A B)
V
A
Fi . 3. Syntax-d rected rules for funct onal Pure Type Systems
Theorem 1. If S is functional, then 1. Soundness: Γ na M : A 2. Completeness: Γ M :A
Γ M : A. A0 T Γ
na
M : A0
A = A0
Proof. Soundness is proved by induction on the derivations, usin Corollary 2 in the (abstraction) rule. Completeness is also proved by induction on the structure of derivations, usin soundness. The proofs are routine. Corollary 3 (Decidability of type-checkin ). If S = (S A R) is a functional speci cation, then type-checkin is decidable provided S, A and R are recursive and S = WN( ). Proof. We need to prove that all side-conditions are decidable. Weak normalization is needed in order to decide -convertibility. Details are omitted. Acknowled ments The author is supported by a European TMR Fellowship.
References [1] H. Barendre t. Lambda calculi with types. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Lo ic in Computer Science, pa es 117 309. Oxford Science Publications, 1992. Volume 2. [2] G. Barthe. Type checkin injective pure type systems. Manuscript, 1997.
The Semi-Full Closure of Pure Type Systems
325
[3] L.S. van Benthem Juttin , J. McKinna, and R. Pollack. Checkin al orithms for pure type systems. In H. Barendre t and T. Nipkow, editors, Proceedin s of TYPES’93, volume 806 of Lecture Notes in Computer Science, pa es 19 61. Sprin er-Verla , 1994. [4] R. Nederpelt, H. Geuvers, and R. de Vrijer, editors. Selected papers on Automath, volume 133 of Studies in Lo ic and the Foundations of Mathematics. North-Holland, Amsterdam, 1994. [5] S. Peyton Jones and E. Meijer. Henk: a typed intermediate lan ua e. Proceedin s of the ACM Workshop on Types in Compilation, 1997. [6] E. Poll. A typechecker for bijective pure type systems. Technical Report CSN93/22, Technical University of Eindhoven, June 1993. [7] R. Pollack. Typecheckin in pure type systems. In B. Nordstr¨ om, editor, Informal proceedin s of LF’92, pa es 271 288, 1992. Available from http://www.dcs.ed.ac.uk/lfcsinfo/research/types-bra/proc/index.html. [8] R. Pollack. The Theory of LEGO: A Proof Checker for the Extended Calculus of Constructions. PhD thesis, University of Edinbur h, 1994. [9] P. Severi. Normalisation in lambda calculus and its relation to type inference. PhD thesis, Technical University of Eindhoven, 1996.
Predicative Polymorphic Subtypin Marcin Benke Institute of Informatics Warsaw University
[email protected] Abs rac . We consider a version of the Mitchell’s polymorphic type containment (aka subsumption). Here, it is not suited for the system F but for the predicative version of it introduced by Leivant. The aim of the approach is to propose a new notion of polymorphic functional subsumption which may be decidable unlike Mitchell’s one. We de ne a system for predicative subsumption in the style of Mitchell and then prove its equivalence with a Gentzen-style de nition. Next, we study the notion of bicoercibility. This is followed by a reduction of the typability in the Leivant’s system with subsumption to subsumption itself.
1
Introduction
The no ion of polymorphism formalised as sys em F ([Gir72, Rey74]) is widely used in func ional programming communi y. This no ion was re ned in many di eren direc ions in order o ob ain a s rongly expressible sys em wi h user friendly facili ies. The ML ype sys em in roduced in [Mil78] was a successful miles one in his direc ion wi h i s decidable ype inference [DM82]. On he o her hand i came ou ha sys em F i self is less convenien as i has undecidable ype inference [Wel94]. People s udied di eren varia ions of ype sys ems ha are closely connec ed wi h hese wo main sys ems. There was some e or spen in order o enrich he ML sys em wi h less res ric ed quan i ca ion. Exis en ial quan i ca ion in algebraic da a ypes was in roduced by Perry in [Per90] and by L¨ aufer and Odersky in [LO94]. This ex ension is in fac Milner s yle version of Mi chell and Plo kin abs rac ypes [MP88]. Then he sys em wi h exis en ial quan i ca ion was ex ended wi h universal quan i ca ion by [Rem94] which gave a possibili y o declare objec s wi h polymorphic me hods. L¨aufer and Odersky in roduced in [OL96] a ype sys em wi h ype schemes ha may have quan i ca ion in any place, bu ype variables may be ins an ia ed by ypes wi h no quan i ers only. All he aforemen ioned sys ems have decidable ype inference. Ano her direc ion was o change sys em F so ha one can ge decidable ype inference. One way consis ed in res ric ion on he form of ypes. Types of rank a mos 2 (rank is he maximal number of s eps made o he lef on a pa h leading in a ype o a quan i er) lead o decidable ype inference while he rank 3 leads o undecidabili y [KT92]. The idea of changing he sys em i self was he crucial poin in he work of Mi chell [Mi 88], where addi ional rela ion of Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 326 335, 1998. c Sprin er-Verla Berlin Heidelber 1998
Predicative Polymorphic Subtypin
327
containment (known also as subsumption) was in roduced, as well as in he one by Leivan [Lei91], where s ra i ca ion on ype variables was imposed (variable may be subs i u ed for by a ype wi h quan i ers on a lower level). The Mi chell’s sys em has already i s own s ory. Unfor una ely, ype inference is undecidable for his sys em as shown in [Wel96]. Moreover, he con ainmen rela ion is undecidable, oo ([TU96, Wel95]). This was surprising in he ligh of he fac ha he bicoercibili y rela ion ( is bicoercible wi h i and ) is decidable [Tiu95]. By con ras he Leivan ’s sys em has no been horoughly s udied ye . Contributions of the paper This paper presen s a version of he Mi chell’s subsump ion rela ion sui ed for Leivan ’s s ra i ed sys em F . This subsump ion rela ion does no cover he rule for dis ribu ion of quan i er, however. This choice was made because proofs are ge ing very involved in presence of such rule (see [LMS95]). Moreover, i seems ha he presence of his rule does no add any subs an ial complexi y as he same mechanism gives undecidabili y for he Mi chell’s sys em wi h his rule and wi hou [Chr98]. A las L¨ aufer and Odersky use exac ly his subsump ion in [OL96]. The no ion of subsump ion is given in he Mi chell s yle. We charac erise his no ion in he spiri of [LMS95] proving i s equivalence wi h a Gen zen-s yle de ni ion. Nex , we s udy he no ion of bicoercibili y ob aining very s raigh forward charac erisa ion of i . A reduc ion of he ypabili y problem o he problem of deciding subsump ion is s udied hen. The echnique is aken from [Jim95]. We end wi h an algori hm for deriving subsump ion in he res ric ed case for ypes ha have all possible zero-level quan i ca ion (variables may be subs i u ed for only by quan i er free ypes) and may have a vec or of level one quan i ers in he roo posi ion (variables may be subs i u ed for by erms wi h zero-level quan i ca ion). This resul ex ends he resul by L¨ aufer and Odersky [OL96]. Or anisation of the paper Sec ion 2 con ains preliminary de ni ions. Sec ion 3 presen s he no ion of sub yping in he spiri of Mi chell. In Sec ion 4 we inroduce he sequen sys em in he sense of [LMS95] and prove i s equivalence wi h he sys em de ned in Sec ion 3. Sec ion 5 in roduces a echnical ool of syn ax-driven sys em. The idea of his sys em is aken from [Wel95]. Bicoercions are s udied in Sec ion 6. Due o he page limi , some proofs have been omi ed. They may be found in he full version, en a ively published as [Ben98].
2
De nitions
2.1
Strati cation
Le t be a na ural number. Sys ems of ier1 t have he following componen s: Type expressions and heir levels L( ) are de ned induc ively: 1
while we use the word level to characterize types, the word tier is used to denote systems; a sytem of tier may involve types of levels 0 .
328
Marcin Benke
For each level p = 0 1 t here is a denumerable supply of ype variables (we omi he level superscrip when i is irrelevan or of level p: p p1 clear from con ex ). A ype variable of level p is also a ype expression of level p. If and are ype expressions hen is a ype expression of level max(L( ) L( )) q is a ype expression of level If is a ype expression of level p hen max(p q + 1) If T is a se of ypes, hen by L(T ) we shall mean he mul ise of levels L( )
T
The rela ion Mul will deno e he usual mul ise ordering. Le be a ype wi h L( ) = p + 1 by rank of we shall mean he maximum leng h of a pa h leading in o a quan i er binding a variable of level p. No e ha by erasing all level indices from a predica ive polymorphic ype we ge an ordinary sys em F ype. We shall deno e he resul of such erasure performed on ype by F ( ). 2.2
Representin Types: Trees and Canonical Form
Le P = 1 2 and P = 1 2 be se s of respec ively ni e and in ni e words over 1 2 (which may be viewed as pa hs in binary rees). We shall use capi al greek le ers (e.g. ) o deno e such pa hs. We may view a ype as a ree (wi h domain being a pre x-closed subse of P) where each arrow corresponds o an in ernal node, ype variables are leaf nodes, and each node may be labelled wi h a se of quan i ers. We shall deno e such a se labelling a node a address in ype by Q( ). The domain of such a ree shall be called he tree skeleton of a ype. De nition 1. We say that
is in the canonical form, if
1. It has no redundant quanti ers. N ). 2. BV ( ) = 1 n (for some n 3. names of bound variables are di erent from the names of free variables and no variable is bound more than once. = , 4. If for some paths where is lexico raphically earlier than , = j (and there is no lexico raphically earlier path leadin to j ) then i < j. 5. At every node the quanti ers are ordered accordin to indices of the variables they bound. In [Wel96], Wells in roduced ano her convenien represen a ion for ypes, Gn . Each which he called leaf roups: a ype is a se of leaf groups G1 leaf group deno es he se of occurrences of a par icular variable free or bound. A group referring o a free variable is of he form P where is he name of
Predicative Polymorphic Subtypin
329
he variable and P P is he se of pa hs leading o leaves labelled wi h ; a group referring o a variable bound a he node wi h address is of he form P . The connec ion be ween leaf-group represen a ion and canonical forms is es ablished by he following Proposition 1. Two types have the same canonical form if and only if they have the same leaf- roup representation. The ree represen a iuon allows us o de ne some useful (par ial) func ions, used la er in he paper: sign( ), de ned for P as +1 for posi ive pa hs (even number of 1’s) and −1 for nega ive ones. leaf( ) longes pre x of leading o a leaf in . quan ( ) pa h from roo o he quan i er binding he variable a leaf( ), if any. leafvar( ) name of he variable a leaf( ) if i is free, unde ned o herwise. quan sign( ) = sign(quan ( )) if quan ( ) is de ned, 0 if he variable is free, unde ned if leaf( ) is unde ned.
3 3.1
Subtypin A Hilbert-Style System
Axioms: (refl) (inst)
p
q
q
[
] L( )
q
FV(
q
)
Rules: 0
( )
0 0
0
( )
0
1
( rans)
1 0
0
0
We shall some imes use he no a ion o deno e he fac ha his t inequali y is derivable in he sys em of ier t. We shall also use he no a ion < o indica e he fac ha here is a deriva ion of such ha i s las rule is o her han ( rans). I is easy o see ha i
leaf( ) then quan sign( ) = −1. Lemma 5. If that dom( ).
0
then for every path
Proof. Assume he con rary, i.e. ha leaf(
dom( )
here is a pa h
) > leaf(
) < leaf(
) = leaf(
) and
dom( 0 ) we have
such ha 0
)
By Lemma 4, since and leaf( ) > leaf( ), we have ha quan 0 and leaf( ) < leaf( 0 ), sign( ) = −1. On he o her hand, since we ob ain ha quan sign( ) = +1. Hence, by con radic ion, he hesis is proved.
332
6
Marcin Benke
Bicoercions
Bicoercion is an impor an rela ion in roduced by Tiuryn [Tiu95]. Two ypes and are said o be bicoercible if and Proposition 2. If in M .
holds.
are bicoercible then F ( ) and F ( ) are bicoercible
and
Proof. By Lemma 1 M F( ) F( )
implies
M
F( )
F ( ) and
implies
In our sys em, however, bicoercibili y is a s ronger no ion: wo ypes are bicoercible if and only if hey have he same canonical form, i.e. are iden ical up o conversion, quan i er reordering and redundan quan i ers. 6.1
Proof System
The sys em given below is for deriving expressions of he form and are polymorphic ypes.
Axioms: (A1) (A2) (A3)
, where
FV ( )
if
Rules: 0
0
0
0
0
( )
0
(symm)
( rans) We wri e proof sys em.
( )
o indica e ha
Lemma 6 ([Tiu95]). The types
here is a deriva ion of and
in he above
are bicoercible.
Proof. The proof from [Tiu95] carries over o he predica ive case wi hou any changes. Lemma 7. If
then
and
are bicoercible.
Proof. Soundness of A2 follows from he previous lemma. Soundness of o her axioms and rules is easily veri ed, since hey correspond o respec ive axioms and rules for sub yping (apar from symm, bu his rule is obvious anyway).
Predicative Polymorphic Subtypin
333
Corollary 1. Every type is bicoercible with its canonical form. Lemma 8. Bicoercible types have identical tree skeletons. 0 0 = (where 0 0 have no quanti ers on top Lemma 9. Let = level) be types with no redundant quanti ers and such that for every path dom( ) such that quan ( )= , dom( ). If then
L( ) Theorem 3. If identical. Proof. If ha
and
and
Mul
L( )
are bicoercible types in canonical form then they are
are bicoercible hen here exis
< r means that p and r are not comparable. The other order is the lexicographic order induced by 0 1. If is a type and p a position in the tree of , then we denote by p a subtree at the position p. If and are types and p is a position in the tree of then [ ]p stands for with the subtree at position p replaced by . Unlike a substitution, this operation may make some free variables in bound by quantiers in .
3 Subtyping Relation The relation of subtyping
is dened by 3 axioms and 3 rules:
(re) (inst) (quant)
if
FV ( )
Polymorphic Subtyping Without Distributivity
Rules:
( -context)
2 1
1 1
1 2
349
2 2
( -context) (trans) Our denition diers from the original one introduced by Mitchell in [7] in the lack of the distributivity axiom: (distr) ( ) M if FV ( )
4 Type Rewriting For technical reasons instead of derivations in the above system we use type rewriting according to the following rules: C +[
p + i
C +[
p + q
C +[
]p ==
C + [ ]p ==
if
]p ]p FV ( )
C −[
r
− i
C −[
r
− q
C − [ ]r if FV ( )
]r == C−[
]r ==
]r
where C [ ]p and C [ ]r denote contexts with a hole at a positive position p and negative position r respectively. When we do not want to precise what step is considered, we omit the appropriate decoration and write for example = i or = + . Any nite number of steps may be denoted by a double arrow = = . Given a derivation step = , the absolute value of the dierence of weights of and is called the weight of this step. Intuitively, it is the number of arrows introduced (or removed) by this step. if and only if == . Lemma 1. For any types and we have +
−
5 Normal Derivations The goal of the present section is to show that every subtyping inequality can be proved by a normal derivation, that is a sequence of positive steps (which increase the weight of a type) followed by a sequence of negative steps.
Denition 1 (normal derivation).
A derivation == is called normal, if it is of the form == + == − for certain type . The weight of a normal derivation is the sum of weights of steps in it. It is easy to see that it is equal 2 weight ( ) − weight ( ) − weight ( ). Before showing how to normalize derivations, dene the notion of safe steps.
350
Jacek Chrz¡szcz
Denition 2 (safe step). A rewriting step
is safe, if one of the following conditions is satised:
=
1. it is a = q step; 2. it is a = i step, in which the inserted type is ; 3. it is a ==p i step, in which the inserted type is a variable position p0 p, of the same sign as the sign of p.
bound at a
The second condition above covers particularly the instantiation of empty quantiers, i.e. the steps C [ ] = +i C [ ] and respectively C [ ] = −i C [ ] for F V ( ). The last condition of Denition 2 expresses the following situations: +
+
C +[ C−[
C+[
C+[
−
]] =
+ i
C +[
C+[
]] =
− i
C−[
C+[
−
]] ]]
All safe steps have the weight 0. In addition, a safe step can be inserted in a normal derivation without changing its weight. The formal statement of this property, together with an example of a step of weight 0 which is not safe will be given by the end of the section. The following lemma shows how to permute negative and positive steps,1 which is necessary to normalize a derivation.
Lemma 2. Let and be types such that
. There exists a type such that = = . In addition, if the step = − is safe then after the permutation the step 0 = − will remain safe and similarly if = + is a safe step then so will be = + 0 . 0
+
0
−
=
−
=
+
Proof. Let ==p − ==r + . Depending on p and r we have three possibilities to consider: p > < r, p < r, and p > r. The rst one is easy, the other two, dual to each other, are also easy when any of the rewriting steps is a q-step. Otherwise both steps are instantiations and we use the fact that = for any types , , and .
Lemma 3. Given two types and such that
derivation
= =
+
= =
−
.
, there exists a normal
Now we dene the weight of an inequality and explain the meaning of safe steps.
Denition 3 (weight of inequality). The weight of an inequality = = + = = − . 1
is the minimal weight of a normal derivation
A permutation the other way is not always possible. One cannot for example change 0 == + ( ) == − ( ) the order of the steps
Polymorphic Subtyping Without Distributivity
Proposition 4. Let of the inequality
0
1
351
and let 0 = 1 be a safe step. Then the weight is no greater than the weight of the inequality 1 .
Let us give an example of a rewriting step of weight 0, which is not safe. ((
)
)=
((
0 − i
)
) ==
(
(
)
)
It is not safe, because the variable is bound at a positive position, unlike the variable . If we put this step in front of a one-step derivation of weight weight ( ): (
(
)
) ==
+ i
(
)
and permute the steps according to Lemma 2, we get a normal derivation of weight 3 weight ( ): ((
)
) ==
+ i
((
)
0 − i
) ==
(
)
6 Bicoercible Types and . We show in the Types and are called bicoercible if present section, that the bicoercibility relation may be identied with the least congruence containing the axioms
(B1) (B2)
(if all occurrences of in are positive2 ) The equivalence relation induced by the original Mitchell system was characterized by Tiuryn in [8]. It is dened by axioms (B1), (B2) and the axiom (B3) ( 1 (if F V ( 1 )) 2) M 1 2 which is not true in our system.3 The rest of the present section is devoted to the proof that the relation , dened as the least congruence containing axioms (B1) and (B2), is the equivalence relation induced by the quasi-order .
Lemma 5. If = and the axioms (B1) and (B2).
then the statement
can be derived from
is a positive step. By Proof. Since both situations are similar, assume = analyzing what changes introduced by the rst step can be undone by further steps of a normal derivation = + == + == − , we conclude that inserted types can only be variables, that the sign of a variable binding must not change, and nally that when a variable bound at a positive position has negative occurrences (or vice versa) the changes to its binding can only be trivial. If follows that all kinds of acceptable changes can be simulated by (B1) and (B2). 2 3
It covers also the situation It is not true that (
(
FV ( ) ))
(
)
352
Jacek Chrz¡szcz
can be proved by a single use of the axiom Lemma 6. If the statement (B1) or (B2) then == and == . Moreover these derivations use only safe steps.
Proof. There are four possibilities, depending on what axiom was used and what was the position sign. Since most of the reasoning is simple we analyze only the use of (B2) at a positive position: = [ ]p [ ]p = . The derivation from left to right can be done by a single i-step. Constructing a derivation from right to left is more complicated. Let r1 rn be all occurrences of in . For all i we have = = , so r i i i
[
]p
p + q pr1 + = = i prn + = i
==
=
[
γ
]p
[
γ
[
1 γ]r1 ]p
[
γ
[
1 γ]r1
[
γ
γ ]p =
pr2 + = = i
[
n
[
γ]rn ]p
]p
pr + where γ is fresh. All steps = = i are correct and safe because every ri is positive, and the inserted variable γ is bound at a positive position p. i
Theorem 1 (characterization of bicoercibility). Inequalities
and
are both true if and only if
.
For the rest of the proof the most important is the following proposition which follows from Lemma 6 and Proposition 4.
Proposition 7. If 0 1 and 1 then the inequality and the weights of both inequalities are the same.
0
also holds
7 Decomposing Inequalities The present section shows the properties of that will be directly used in the proof of undecidability. To this end we introduce ordered derivations. Intuitively, positive rewriting steps will be ordered by their positions compared with the lexicographic ordering (induced by 0 1). At one position, all q-steps will precede i-steps ordered from outermost to innermost. Negative steps will be ordered dually. The rewriting will then take place rst at positive positions from the root towards the leaves, and then at negative positions, from the leaves upwards.
Denition 4 (ordered derivations). p A sequence of positive steps
0
1
==
+
1. for all i, j if i < j then pi pj ; 2. for any given p, ==p +q steps precede
pn +
==
p + i
==
n
is ordered if:
steps;
Polymorphic Subtyping Without Distributivity
353
3. there are no pairs of steps p + i p + == i
j[
]p ==
j[
]p
j[
]p
A sequence of negative steps 0 = − = − n is ordered, if the dual + + sequence of positive steps n γ = = γ (for γ fresh) is ordered. 0 A normal derivation == + == − is called ordered if both sequences = = + and = = − are ordered.
Lemma 8. If
, then there exists an ordered derivation weight equal to the weight of the inequality.
= =
+
= =
−
, of
Proof. Consider a normal derivation == + == − of minimal weight. We observe that every two consecutive steps which are not ordered can be permuted. Since each phase is sorted separately, the middle type does not change and neither does the weight of the derivation.
Lemma 9. Let
and let p = and p = be subterms such that no variable that is free in (resp. in ) is bound in (resp. ). If p is positive, then and if p is negative then . Proof. Let == + == − be an ordered derivation. Only those steps which have p as a prex can inuence a subterm at position p. Since the derivation is ordered, those steps form two groups, `in the middle' of both phases. It turns out that those groups of steps can easily be transformed into the desired derivation = = (or == if p is negative).
Lemma 10. The inequality
holds if and only if both inequalities and hold. Moreover, if all inequalities are true then the weight of the rst one is equal to the sum of weights of the others. 0
0
00
0
00
0
00
00
Lemma 11. Let and be types. Assume that there exist two paths: positive p
and negative r such that p = r = and p = r = for a free variable . Suppose furthermore that is not of the form γ 0 . Then
if and only if ; 1. 2. if both inequalities hold then the weight of the latter is no smaller than the weight of the former; 3. moreover if weight ( ) > 0 then the weight of the rst inequality is strictly greater than the weight of the second.
354
Jacek Chrz¡szcz
, then since
Proof. If
==
, we have
+ i
(1) In order to show the opposite implication, suppose inequality (1) holds. Consider its ordered derivation of minimal weight. It begins with some meaningless == + steps. All they can do is to add some empty quantiers after the initial . Now the latter must be instantiated: 0
==
+ i
(2)
0
where 0 stands for 1 n , and 1 n are the empty quantiers. By 0 Lemma 9, , so also . By Proposition 7 this yields the desired inequality. Its weight is no greater than the weight of (1) minus the weight of (2), which is strictly positive, when weight ( ) is so. Since weight ( ) = weight ( ) we have our claim.
8 Encoding a Machine A stack register machine M is a deterministic computing device with two main registers V1 and V2 and a nite number of auxiliary registers v1 vn . The registers can hold nonempty words over the nite alphabet , containing instruction labels with one special end label e. A machine step consists of taking the top label from the rst main register and executing the instruction assigned to . If the read label is e the machine halts. we construct a type The encoding idea is the following. For each label embodying the associated instruction. Then we give the label composition rules to encode words contained by the machine's registers. So a given conguration yields n + 2 types, V V v v , containing one special free variable γ . 1
2
1
n
Proposition 12. Given a stack register machine M, it halts for an instantaneous description (V1 V2 v1 vn ) if and only if the encoding inequality holds V1
(
v1
v1 )
(
vn
vn )
V2
γ
Proof. The proof is based on two properties of which are exactly Lemmas 10 and 11. They correspond to Lemmas 12 and 14 in [9]. See the latter paper for all the details.
Theorem 2 (Main result). The relation
of polymorphic subtyping without distributivity is undecidable.
Proof. This follows from our Proposition 12 and Lemma 16 from the paper of Tiuryn and Urzyczyn [9] that reduces the halting problem of deterministic twocounter automata to the halting problem of stack register machines.
Polymorphic Subtyping Without Distributivity
355
9 Conclusions The same proof would also be valid if we removed both (distr) and (quant) from the denition of subtyping. The only dierence would emerge in Section 6, but Proposition 7 remains true which enables us to continue with the undecidability proof. Another direction of searching for decidable subtyping relation is the predicative version of System F, presented by Daniel Leivant [5]. Some work has already been done in this eld (see [1]) and we believe that further investigation should lead to interesting results.
References 1. M. Benke, Predicative Polymorphic Subtyping, these proceedings. 2. J. Chrz¡szcz, Polymorphic Subtyping Without Distributivity Technical Report TR98-03(252), Institute of Informatics, Warsaw University, May 1998. URL: http:\\zls.mimuw.edu.pl\~chrzaszc\papers
3. J.-Y. Girard, Y. Lafont, P. Taylor. Proofs and Types. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1989. 4. T. Jim, System F plus Subsumption Reduces to Mitchell's Subtyping Relation, Manuscript (1995). 5. D. Leivant, Finitely Stratied Polymorphism, Information and Computation , 93 (1), 1991, 93-113. 6. G. Longo, K. Milsted, S. Soloviev, A Logic of Subtyping, Proc. 10th IEEE Symp. Logic in Computer Science , 1995, pp. 292-299. 7. J.C. Mitchell, Polymorphic Type Inference and Containment, Information and Computation , 76 (2-3), 1988, pp. 211-249. 8. J. Tiuryn, Equational Axiomatization of Bicoercibility for Polymorphic Types, Proc. Conf. Foundations of Software Technology and Theoretical Computer Science'95, Bangalore, India; 18-20 Dec 1995. Lecture Notes in Computer Science 1026, pp. 166-179. 9. J. Tiuryn, P. Urzyczyn, The Subtyping Problem for Second-Order Types is Undecidable Proc. 11th IEEE Symp.Logic in Computer Science , 1996, pp. 74-85. 10. J.B. Wells, Typability and Type Checking in the Second-Order -calculus are Equivalent and Undecidable, Proc. 9th IEEE Symp. Logic in Computer Science , 1994, pp. 176-185. 11. J.B. Wells, The Undecidability of Mitchell's Subtyping Relationship, Technical Report, Computer Science Department, Boston University, Number 95-019, December 10 1995. 12. J.B. Wells, Typability is Undecidable for F+Eta Technical Report, Computer Science Department, Boston University, Number 96-022, March 9 1996.
A (Non-elementary) Modular Decision Procedure for LTrL Paul Gastin1 , Rapha¨el Meyer2 , and Antoine Petit2 1
2
LIAFA, Universite Paris 7, 2, place Jussieu, F-75251 Paris Cedex 05 Paul.Gast n @l afa.juss eu.fr LSV, URA 2236 CNRS, ENS de Cachan, 61, av. du Pres. Wilson, F-94235 Cachan Cedex rmeyer,pet t @lsv.ens-cachan.fr
Abs rac . Thiagarajan and Walukiewicz [18] have de ned a temporal logic LTrL on Mazurkiewicz traces, patterned on the famous propositional temporal logic of linear time LTL de ned by Pnueli. They have shown that this logic is equal in expressive power to the rst order theory of nite and in nite traces. The hopes to get an easy decision procedure for LTrL, as it is the case for LTL, vanished very recently due to a result of Walukiewicz [19] who showed that the decision procedure for LTrL is non-elementary. However, tools like Mona [8] or Mosel [7] show that it is possible to handle non-elementary logics on signi cant examples. Therefore, it appears worthwhile to have a direct decision procedure for LTrL; in this paper we propose such a decision procedure, in a modular way. Since the logic LTrL is not pure future, our algorithm constructs by induction a nite family of B¨ uchi automata for each LTrL-formula. As expected by the results of [19], the main di culty comes from the Until operator.
Topics: lo ic in computer science, automata and formal lan ua es, theory of parallel and distributed computation, model-checkin
1
Introduction
A run of a distributed system can be viewed, in many settin s, as a partial order between the events of the system. Two events are ordered if and only if their executions depend causally one of the other. The partial orders that arise in this fashion, are frequently Mazurkiewicz traces [9, 4]. A major interest of this model lies on the fact that a trace can be seen either as a labelled ordered raph expressin directly the partial order or as an equivalence class of sequences, each of them representin a linearization of the partial order. In a natural way, and in order to exploit directly the partial order underlyin to a trace, a ood amount of research have focused on developin temporal lo ics that can be directly interpreted over traces seen as labelled partially ordered raphs (rather than as sets of sequences). Recently, Thia arajan and Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 356 365, 1998. c Sprin er-Verla Berlin Heidelber 1998
A (Non-elementary) Modular Decision Procedure for LTrL
357
Walukiewicz [18] have de ned a new temporal lo ic, denoted by LTrL, patterned on the propositional temporal lo ic of linear time LTL de ned by Pnueli [12] with exactly the expressive power of F O( ), the rst order theory of nite and in nite traces (see also [10]). This work was the outcome of a lon sequence of papers on lo ics on traces [17, 5, 1, 13]. One of the most important property of LTL is to have a PSPACE-complete decision procedure for LTL is [15] (whereas the decision procedure for the equivalent lo ic F O( ) is non-elementary [16]). This lo ic LTL has thus been used successfully in model-checkin , see e. . [3]. So very naturally, people were interested in the complexity of the decision procedure for LTrL which was expected to be of low complexity. These hopes vanish after the very recent work of Walukiewicz who shows that the decision procedure for LTrL is non-elementary [19]. This result could be seen as an irremediable drawback for the use of LTrL for practical model-checkin . Nevertheless, recent tools such as Mona [8] or Mosel [7] have been proposed to handle non-elementary lo ics. Moreover, si ni cant real problems have been solved usin these tools. Therefore, it appears worthwhile to have a decision procedure for LTrL. Up to now, the only existin one lies on the transformation of a LTrL-formula into an equivalent F O( )-formula used by Thia arajan and Walukiewicz to prove their main theorem [18]. To achieve this oal, we propose as the main result of this paper, a modular direct decision procedure for LTrL. Precisely we construct for any LTrL-formula , a B¨ uchi automaton reco nizin the set of (the linearizations of) the models of . From the well-known decidability of the emptiness of the lan ua e reco nized by a B¨ uchi automaton, we et our decision procedure. Our construction is performed in a modular way from the structure of . In fact, since the lo ic LTrL is not pure future but contains some present operators, we need to construct by induction not a simple automaton but a sequence of automata indexed by some alphabetic information. The constructions for the boolean operators and the local next operators are classical and do not present any new di culty (note nevertheless that the ne ation requires of course a complementation of a B¨ uchi automaton). The crucial step is the construction for the Until operator. From [19], we know that the operator is responsible of the non-elementariness and therefore the construction can not be simple. We use the notion of alphabetic automaton (classical from nite automata theory) in order to simplify the presentation as much as possible. Our paper is or anized as follows. In Section 2 we set the basic de nitions for the trace theory and the temporal lo ic LTrL and we introduce the problem of Model-Checkin in this lo ic. Section 3 is devoted to the presentation of the main tools we will be usin : B¨ uchi automata and alphabetic automata. These tools allow us to describe our modular constructions in Section 4 in a more concise manner. Finally, we ive some conclusions about those constructions in Section 5, and devise some possible paths for future research.
358
2
Paul Gastin et al.
Model-Checkin on LTrL
2.1
Traces
A dependence alphabet is a pair ( I) where is a nite set and I is a symmetric and irreflexive relation called the independence relation. Elements of are called actions; two actions a b 2 are said independent if (a b) 2 I. The complementary relation D = n I is called the dependence relation. If a 2 , then I(a) and D(a) denote respectively the sets of letters independent and dependent with a. A (Mazurkiewicz) trace on ( I) is a -labelled partially ordered set (poset) that respects the dependence relation [9]. More formally, let (E ) be a labelled poset, that is: E is a nite or in nite set, is a partial order on E and is a labellin function from E into . For every subset Y of E, we de ne # Y = fx 2 E j 9y 2 Y x yg. If Y is a sin leton fyg we shall write # y instead of # fyg. We also de ne the coverin relation on E E: x y if x y and 8z 2 E, x z y implies z = x or z = y. Then a trace over ( I) is a -labelled poset u = (E ) satisfyin : (T 1) 8e 2 E # e is a nite set (T 2) 8e e0 2 E e e0 ) ( (e) (e0 )) 2 D (T 3) 8e e0 2 E ( (e)
(e0 )) 2 D ) e e0 or e0 e
Elements of E are called events. A con uration of a trace u = (E ) is a nite subset c E satisfyin # c = c. It can be viewed as a nite trace which is a pre x of u. The set of letters of maximal events in c (for the partial order induced by u) is denoted by max(c). We denote by Cu the set of con urations of a trace u. Remark that ; 2 Cu and max(;) = ;. The transition relation a !u Cu Cu is iven by: c !u c0 i there exists e 2 E such that (e) = a, e 62 c and c0 = c [ feg. 2.2
LTrL
Thia arajan and Walukiewicz[18] have proposed a temporal lo ic on ( nite and in nite) traces, called LTrL, that is expressively complete, i.e. equivalent to the rst-order lo ic F O( ) on ( nite and in nite) traces. The set of formulas belon in to LTrL is de ned inductively by: 1 LTrL(
I) ::= tt j : j
_
j a j
U
ja
The semantics of these formulas are de ned inductively: let u = (E trace and c a con uration of u, then
) be a
u c j= tt. Furthermore, the boolean connectives : and _ have the usual interpretations. 1
Our notations are slightly di erent from the ones of the original article.
A (Non-elementary) Modular Decision Procedure for LTrL
359
a
u c j= a i 9c0 2 Cu , c !u c0 and u c0 j= . u c j= U i 9c0 2 Cu , c c0 , such that u c0 j= c c00 c0 implies u c00 j= . a u c j= a i 9c0 2 Cu such that c0 !u c, i.e. a 2 max(c).
and 8c00 2 Cu ,
Note that the formulas of the form a describe the present con uration at which they are evaluated. For this reason, they will be referred to as present formulas. Thus, if c and c0 are two con urations such that max(c) = max(c0 ), then for any trace u and any formula of LTrL it holds: cu c j=
, c0 u c0 j=
Denote by R( I) the set of nite and in nite traces on the dependence alphabet ( I), then every formula of LTrL de nes a trace lan ua e L( ) in the followin way: L( ) = fu 2 R( I) j u ; j= g 2.3
The Model-Checkin Problem
The lobal nature of LTrL’s temporal operators makes it easy to specify lobal liveness and safety properties. However, this lobal nature has a counterpart re ardin the complexity of veri cation tasks such as satis ability or modelcheckin . Actually, Walukiewicz has shown[19] that the satis ability problem is non-elementary in LTrL, and that this non-elementarity is due to the possible nestin of until operators. However, this should not prevent us from lookin for direct al orithms for veri cation tasks. Indeed, such al orithms would allow to check at least formulas with a low until depth . Our approach is to start with a formula of LTrL and build an automaton reco nizin the lan ua e de ned by inductively on the structure of that formula. With these constructions, the satis ability and model-checkin problems are reduced to checkin for emptiness of automata. Our main result can be stated as follows: Theorem 1. Let be a formula of the temporal lo ic LTrL for a iven dependence alphabet ( I). A B¨ uchi automaton A on 1 that accepts exactly the linearizations of traces satisfyin , can be constructed inductively on the structure of .
3 3.1
Tools Words and Traces
Althou h we want to reco nize trace lan ua es, our approach is to construct automata that will reco nize I-closed sets of words. More formally, let 1 be the set of nite and in nite words on the alphabet , and recall that R( I) is the set of nite and in nite traces on ( I). Now let denote the canonical
360
Paul Gastin et al.
morphism from 1 into R( I). A word lan ua e L 1 is said to be I-closed if it is closed by the morphism , i.e. if L = −1 ( (L)). Note that R( I) can also be de ned as 1 I , where I is the con ruence induced by I on 1 (see e. . [4] for further details). 3.2
B¨ uchi Automata
In the sequel, we shall use some B¨ uchi automata, that is non-deterministic automata on words with a particular repeatin acceptance condition for in nite words [2, 11]. De nition A B¨ uchi automaton on
is a t-uple A = (Q ! S F R) where:
Q is the nite set of states a ! Q Q the transition relation. If (q a q 0 ) 2!, we shall write q ! q 0 . The transitive closure of ! will be denoted by ! . S Q is the set of initial states of A. F is the set of nal states. R Q is the set of repeated states. an , with Executions A nite execution of A on a nite word u = a1 a2 is a sequence = q0 q1 q2 qn of states such that q0 2 S and for 8i a 2 ai+1 ak is an in nite word, all 0 i n − 1, we have q ! q +1 . If u = a1 a2 qk of states an execution of A on u is an in nite sequence = q0 q1 q2 ai+1 such that q0 2 S and for all i 0, it holds q ! q +1 . Denote by rep( ) the set of states q 2 Q such that fi 0 j q = q g is in nite. Note that since A is non-deterministic, it can have di erent executions on the same word. Acceptance Conditions If u is a nite word, an execution of A on u is acceptin if the last state of is in F . If u is a in nite word, an execution of A on u is acceptin if rep( ) \ R 6= ;. Finally, the lan ua e L(A) of words accepted or reco nized by A is the set of ( nite and in nite) words w such that there exists an acceptin execution of A on w. 3.3
Alphabetic Automata
For our constructions we will need the notion of alphabetic automata: an automaton is alphabetic if all the words that can be used to reach a particular state have the same alphabet. Formally, a B¨ uchi automaton A = (Q ! S F R) is alphabetic if it satis es the followin property: 8q 2 Q 9B
8q0 2 S 8u 2
u
q0 −! q ) alph(u) = B
A (Non-elementary) Modular Decision Procedure for LTrL
361
If this is indeed the case, then we set alph(q) = B. Our constructions use intensively the followin result which can be considered as folklore in automata theory: Proposition 1. Every B¨ uchi automaton can be transformed into an alphabetic B¨ uchi automaton reco nizin the same lan ua e. Proof. Let A = (Q ! S F R) be a B¨ uchi automaton on the alphabet B = (Q1 !1 S1 F1 R1 ) such that:
. Let
Q1 = Q 2 , a a (q E) !1 (q 0 E 0 ) i q ! q 0 and E 0 = E [ fag, S1 = S f;g, S F1 = G F G, S and R1 = G R G.
Then a word u is accepted by A i it is accepted by B. Moreover, B is alphabetic, since if a state (q E) is reachable from an initial state (q0 ;) in B throu h a word u, then E = alph(u).
4 4.1
Modular Constructions Methodolo y
If is an LTrL formula, then L( ) is a trace lan ua e. Our oal is to build a B¨ uchi automaton on words that reco nizes the word lan ua e −1 (L( )).We achieve this construction in a modular way, inductively on the structure of the formula . One of the problems we encounter while attemptin to make such constructions comes from the fact that the lo ic LTrL is not pure future-oriented, since it features present formulas. For instance, if = a, then L( ) = ;, but L( a a) = aR( I). This example shows that L( ) is not a su cient information for our modular approach. In order to overcome this problem, we shall de ne, for every formula 2 LTrL a nite family of automata (AB )B for every set B compatible with I, that is such that B B I. For a compatible set B, the automata AB will reco nize the word lan ua e −1 (LB ( )) where LB ( ) is the trace lan ua e fu j 8c max(c) = B ) cu c j= g. Intuitively, our idea is that LB ( ) will be the set of traces u that satisfy startin at a con uration whose maximal letters are described by B. This trick will allow us to deal with a formulas more smoothly. With these notations, the word lan ua e −1 (L( )) will be reco nized by the automaton A; . Subsection 4.2 deals with the easy cases for the formula , while the di cult case of formulas of the form U γ is presented in Subsection 4.3.
362
4.2
Paul Gastin et al.
Boolean Connectors and Next-Step Operator
The Constant Formula Assume = tt. Then L( ) = R( I), so −1 (L( )) = 1 . Moreover, for every compatible subset B , the lan a e LB ( ) is R( I), so −1 (LB ( )) = 1 . We set AB tt = (Q ! S F R) where:
Q = f0g, a 0 ! 0 for all a 2 , S = f0g, and F = R = f0g.
In that way, it is obvious that every ( nite or in nite) word is accepted by AB tt . The Present Formulas Assume that = a for some a 2 . Now, dependin on the set B we choose, we will construct two di erent automata. Indeed, if a 2 B, then LB (a) = R( I), while if a 62 B, then LB (a) = ;. For B 3 a, we de ne AB = AB tt ; B For B 63 a, we de ne AB = AB :tt , this automaton bein the same as Att except that F = R = ;. In both cases, the automaton we construct reco nizes exactly
−1
(LB ( )).
Ne ation Assume that = : , and that the family of automata (AB )B is iven. For a xed B, the automaton AB reco nizin exactly the lan ua e 1 n −1 (LB ( )), which is precisely −1 (LB ( )), can be obtained by the classical method of Safra[14]. Note that this step involves an exponential blow-up in the size of the automata. Disjunction Assume that we know the automata AB and AB γ reco nizin respectively the lan ua es −1 (LB ( )) and −1 (LB (γ)). We want to construct the automata (AB )B for the formula = _ γ. We B can assume that AB and AB γ have disjoint sets of states, and de ne A as the B −1 (LB ( ))[ disjoint union of these two automata. It is clear that A reco nizes −1 (LB (γ)), i.e. −1 (LB ( ) [ LB (γ)), which is precisely −1 (LB ( )). The Indexed Next-Step Operator Assume that = a for some a 2 and some 2 LTrL. Assume that we have a xed compatible set B. Then it is a ) = aLB 0 ( ) with B 0 = (B \ I(a)) [ fag. easy to see that LB ( Therefore we de ne the automaton AB = (Q1 !1 S1 F1 R1 ) from the au0 tomaton AB = (Q ! S F R) (with B 0 = (B \ I(a)) [ fag as above) as follows: Q1 = Q f0 1 2g, S1 = S f0g,
A (Non-elementary) Modular Decision Procedure for LTrL
363
F1 = F f1g, R1 = R f1g, and !1 in the followin way:
(p (p (p (p (p
b
0) !1 b 0) !1 b 0) !1 b 1) !1 b 2) !1
(p0 (p0 (p0 (p0 (p0
0) 2) 1) 1) 2)
i i i i i
b
b 2 I(a) and p ! p0 ; b b 2 D(a) n fag and p ! p0 ; b b = a and p ! p0 ; b p ! p0 ; b p ! p0 .
It should be clear that AB reco nizes exactly remark. 4.3
−1
(LB ( )) from the precedin
A Construction for the Until Operator
We rst explain the idea of the simple construction in the word case. If we want to check some property of the form U γ on some word w, each time we read a letter a we have to start a new veri cation for , until some time in the future when we will start to check the property γ. So every new veri cation started for will be added to some set P , but the size of this set is bounded since if two di erent veri cations reach the same state p 2 P , then we know that we only have to carry on with one veri cation. The situation with traces is much more involved. We also have to check for all su xes up to the su x which satis es γ. The problem is that when a trace t is represented by a word w, the su xes of t are represented by certain subwords of w and not only su xes of w. Therefore, each time we read a letter a we mi ht either skip it or apply it to the current veri cation of and γ dependin on whether or not it is part of the considered trace su x. Moreover, when we start checkin γ, we mi ht still need to start new veri cations of . Finally, since we deal with in nite computation we need to take care of the acceptance conditions. Since the states that code the various veri cations of are put to ether in a set structure, we cannot know directly what are the repeated states of each veri cation. To overcome this problem, we will take an orderin transition that will transform this set into an ordered one, thus allowin to trace each veri cation individually. Note that this problem is not speci c to traces. Notations Assume that = U γ, and that the families of automata (AB )B B B B B B B B B B and (AB γ )B are iven. We set A = (Q1 !1 S1 F1 R1 ) and Aγ = (Q2 !2 B B B B S2 F2 R2 ). We can assume, without loss of enerality, that the sets (Q )B are pairwise disjoint for a xed i = 1 2. Now let A1 (resp. A2 ) be the disjoint . union of the automata AB (resp. AB γ ) for every compatible set B From Proposition 1, we can assume without loss of enerality that A1 and A2 are alphabetic. We set, for i = 1 2, A = (Q ! S F R ). Let’s x some total order on the set Q1 . This order induces a function f : 2Q1 ! Qn 1 with n =j Q1 j, which maps every subset P of Q1 to its correspondin ordered set P .
364
Paul Gastin et al.
Set of States and Transitions Recall that = set B, we de ne AB = (Q ! S F R) as follows:
U γ. For a xed compatible
Q = (2Q1 Q2 2 ) [ (Qn 1 Q2 2 ), S = f;g S2 fBg, F = 2F1 F2 2 , R = R1n R2 2 ,
and let the transition relation ! be de ned in the followin way: a
(P q E) ! (P 0 q E 0 ) i alph(q) I(a) and P 0 = Pa [ (P \ I(a)) [ fqE g a a such that 9q 2 S1E q !1 qE ; and Pa satis es 8q 2 P 9q 0 2 Pa q !1 q 0 and a 8q 0 2 Pa 9q 2 P q !1 q 0 ; and P \ I(a) = fq 2 P j alph(q) I(a)g; and 0 nally E = (E \ I(a)) [ fag. These transitions are called -transitions. a a (P q E) ! (P 0 q 0 E 0 ) i P 0 = Pa , q !2 q 0 , and E 0 = (E \ I(a)) [ fag. These transitions are called γ-transitions. a a (P q E) ! (P q 0 E 0 ) i P = f (Pa ), q !2 q 0 and E 0 = (E \ I(a)) [ fag. These transitions are called orderin transitions. a (P q E) ! (P 0 q 0 E 0 ) i 9n0 n j P 2 Qn1 0 and P 0 2 Qn1 0 and for all a a 1 i n0 , P !1 P 0 ; q !2 q 0 ; and E 0 = (E \ I(a)) [ fag. These transitions are called nishin transitions. Proposition 2. The automaton AB reco nizes exactly the word lan ua e −1 (LB ( U γ)). Due to lack of space, we do not provide here a proof of this proposition. The interested reader shall nd the complete proof in a technical report[6].
5
Conclusion
We have shown that it is possible to have a direct construction of a B¨ uchi automaton for every formula of LTrL and to make these constructions in a modular way, which allows us to reuse the automata for a formula in any construction for a formula where would be a subformula of . The two constructions involvin an exponential blow-up are for the ne ation and the until operator. We know that the blow-up for the until operator is unavoidable. As far as the ne ation is concerned, we could use some transformations on the formulas in order to push every ne ation inside as far as possible, and describe an easy construction for a conjunction operator. What remains to be done is to nd e cient al orithms for fra ments of LTrL that are elementary, as Walukiewicz has open the way in [19], and nd ood characterizations of the expressive power of these fra ments.
A (Non-elementary) Modular Decision Procedure for LTrL
365
References [1] R. Alur, D. Peled, and W. Penczek. Model-checking of causality properties. In Proceedin s of LICS’95, pages 90 100, 1995. [2] J.R. B¨ uchi. Weak second-order arithmetic and nite automata. Z. Math Lo ik Grundla . Math., 6:66 92, 1960. [3] C. Courcoubetis, M. Y. Vardi, P. Wolper, and M. Yannakakis. Memory e cient algorithms for the veri cation of temporal properties. formal Methods in System Desi n, 1:275 288, 1992. [4] V. Diekert and G. Rozenberg, editors. The Book of Traces. World Scienti c, Singapore, 1995. [5] W. Ebinger. Charakterisierun von Sprachklassen unendlicher Spuren durch Lo iken. Dissertation, Institut f¨ ur Informatik, Universit¨ at Stuttgart, 1994. [6] P. Gastin, R. Meyer, and A. Petit. A (non-elementary) modular decision procedure for LTrL. Technical report, LSV, ENS de Cachan, June 1998. [7] P. Kelb, T. Margaria, M. Mendler, and C. Gsottberger. Mosel: a flexible toolset for monadic second-order logic. In Proceedin s of CAV’97, LNCS 1254, 1997. [8] N. Klarlund. Mona & Fido: The logic-automaton connection in practice. In Proceedin s of CSL’97, LNCS, 1998. [9] A. Mazurkiewicz. Concurrent program schemes and their interpretations. DAIMI Rep. PB 78, Aarhus University, Aarhus, 1977. [10] R. Meyer and A. Petit. Expressive completeness of LTrL on nite traces: an algebraic proof. In Proceedin s of STACS’98, number 1373 in LNCS, pages 533 543, 1998. [11] D. Perrin and J. E. Pin. In nite words. Technical report, LITP, Avril 1997. [12] A. Pnueli. The temporal logics of programs. In Proceedin s of the 18th IEEE FOCS, 1977, pages 46 57, 1977. [13] R. Ramanujam. Locally linear time temporal logic. In Proceedin s of LICS’96, pages 118 128, 1996. [14] S. Safra. On the complexity of ω-automata. In Proceedin s of the 29th annual IEEE Symp. on Foundations of Computer Science, pages 319 327, 1988. [15] A. Sistla and E. Clarke. The complexity of propositional linear time logic. J. ACM, 32:733 749, 1985. [16] L. Stockmeyer. The complexity of decision problems in automata theory and logic. PhD thesis, TR 133, M.I.T., Cambridge, 1974. [17] P. S. Thiagarajan. A trace based extension of linear time temporal logic. In Proceedin s of the 9th Annual IEEE Symposium on Lo ic in Computer Science (LICS’94), pages 438 447, 1994. [18] P. S. Thiagarajan and I. Walukiewicz. An expressively complete linear time temporal logic for Mazurkiewicz traces. In Proceedin s of the 12th Annual IEEE Symposium on Lo ic in Computer Science (LICS’97), 1997. [19] I. Walukiewicz. Di cult con gurations - on the complexity of LTrL. In Proceedin s of ICALP’98, 1998.
Complete Abstract Interpretat ons Made Construct ve Roberto Giacobazzi1 , France co Ranzato2 , and France ca Scozzari1 1
2
Dipartimento di Informatica, Universita di Pisa, Italy iaco,scozzari @di.unipi.it Dipartimento di Matematica Pura ed Applicata, Universita di Padova, Italy
[email protected] Abs rac . Completeness is a desirable, although uncommon, property of abstract interpretations, formalizing the intuition that, relatively to the underlying abstract domains, the abstract semantics is as precise as possible. We consider here the most general form of completeness, where concrete semantic functions can have di erent domains and ranges, a case particularly relevant in functional programming. In this setting, our main contributions are as follows. (i) Under the weak and reasonable hypothesis of dealing with continuous semantic functions, a constructive characterization of complete abstract interpretations is given. (ii) It turns out that completeness is an abstract domain property. By exploiting (i), we therefore provide explicit constructive characterizations for the least complete extension and the greatest complete restriction of abstract domains. This considerably extends previous work by the rst two authors, who recently proved results of mere existence for more restricted forms of least complete extension and greatest complete restriction. (iii) Our results permit to generalize, from a natural perspective of completeness, the notion of quotient of abstract interpretations, a tool introduced by Cortesi et al. for comparing the expressive power of abstract interpretations. Fairly severe hypotheses are required for Cortesi et al.’s quotients to exist. We prove instead that continuity of the semantic functions guarantees the existence of our generalized quotients.
1
Introduction and Motivation
Within the cla ical and widely adopted Cou ot and Cou ot framework for approximating generic emantic de nition [7,8], it i well known that completeness for an ab tract interpretation i a much richer property than plain mandatory oundne . In fact, roughly peaking, a complete ab tract interpretation turn out to be a preci e a po ible, relatively to it underlying ab tract domain where approximate computation are encoded. Thi imple intuition explain why, although being a rather uncommon property in practice, notably in tatic program analy i , completene i a highly de irable feature for an ab tract interpretation, e pecially in ab tract model checking (indeed, ome author arguably term it optimality ). Example of complete ab tract interpretation can be found, e.g., when comparing algebraic polynomial y tem [10] and program emantic [9]. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 366 377, 1998. c Sprin er-Verla Berlin Heidelber 1998
Complete Abstract Interpretations Made Constructive
367
In recent year , there ha been a number of paper dealing with variou theoretical i ue related to completene in ab tract interpretation (cf. [6,12], [16,17,18,20]). Among them, Giacobazzi and Ranzato’ paper [12] point out that completene for an ab tract interpretation only depend on the underlying ab tract domain, and therefore i an ab tract domain property. In view of thi ba ic ob ervation, the following problem i then con idered: Given an ab tract interpretation with underlying ab tract domain A, do there exi t the lea t extenion and the greate t re triction of A making the whole ab tract interpretation complete? Giacobazzi and Ranzato [12] give an a rmative an wer, by howing that greate t complete re triction (called complete kernels) alway exi t, and, for continuou concrete emantic operation , least complete extensions exi t a well. According to [11], the e two operator on ab tract domain are, re p., intance of generic ab tract domain impli cation and re nement . Following the tandard notation, let u denote re p. by X Y and γY X the ab traction and concretization map for a concrete domain X and an ab tract domain Y . In [12], C, an ab tract interpretation I = A f , given a emantic operation f : C n A, i complete w.r.t. C f when C A f = f with f : An C n An . Thu , function of generic type C D, occurring frequently in denotational emantic for functional programming, cannot be handled. Moreover, Giacobazzi and Ranzato’ re ult , in general, only prove the exi tence of lea t complete exten ion and complete kernel , and give a con tructive iterative methodology for obtaining lea t complete exten ion only when the emantic operation are additive. However, additivity i a fairly re trictive hypothe i to be widely applicable in practice. By contra t, the pre ent work deal with the mo t general formulation of completene for ab tract interpretation no hypothe i on the type of emantic function i a umed and fully olve the limitation of Giacobazzi and Ranzato’ approach, in particular on the ide of complete domain con truction. Let u explain more in detail the general approach pur ued in thi paper. Fir tly, given any concrete domain C, we denote by LC the o-called lattice of abstract interpretations of C [7,8]. Let f : C D be any concrete emantic function occurring in ome complex emantic peci cation, and a ume that an B, where A LC and B LD . The ab tract emantic i given by f : A concept of oundne i tandard and well-known: A B f i a ound ab tract interpretation or f i a correct approximation of f relatively to A and B denote pointwi e ordering). On the other hand, when D B f f CA ( A B f i complete when equality hold , i.e. D B f = f C A . Since f f f γA C f , the canonical be t correct DB CA DB B of f relatively to the ab tract domain A and B i approximation f bA B : A def de ned by f bA B = D B f γA C . In thi cenario, the following ob ervation till hold : Given A and B, there exi t f uch that A B f i complete i A B f bA B i complete. Thi mean that, even in thi general context, completeness is an abstract domain property, and give ri e to the que tion whether ab tract domain can be minimally re ned and/or impli ed o that completene i achieved. Let u give a imple example concerning Mycroft’ trictne analy i for functional program [3,15]. Con ider the following function F of type Na Na Bool:
368
Roberto Giacobazzi et al. def
F ( x y ) = if (x = 3 and y = 3) then true else Following Burn et al. [3], from F one get in the mo t natural way it denotational P(Bool? ), where P i the Hoare powcollecting emantic f : P(N ? N ? ) erdomain operator and denote unde nedne (i.e., both nontermination and error). Let S = 0 < 1 be the ba ic trictne domain, ab tracting both P(N ? ) and P(Bool? ), and uch that S S ab tract P(N ? N ? ). Concretization and ab traction map are the u ual one , e.g. γ( 0 0 ) = and γ( 0 1 ) = N ? . Then, the be t correct approximation f b : S S S of x x 0 0 1 0 1 0 0 1 1 1 . f i a follow : f b = 0 0 Clearly, f b i not complete: For in tance, (f ( 4 5 )) = ( ) = 0, 4 5 )) = f b ( 1 1 ) = 1. The e phenomena of incompletewhil t f b ( ( ne in trictne analy i are analyzed in depth in [17,18], which, however, do not inve tigate the i ue of achieving completene by minimally modifying the ab tract domain . Moreover, becau e the range and domain of f are di erent, the method of [12] i not applicable here. In tead, the methodology propo ed here allow to con tructively derive the lea t exten ion E(S S) of S S which induce a complete ab tract interpretation. It hould be clear that by adding a point to S S which i able to repre ent the information that the r t and N ? , one get econd component are urely not imultaneou ly equal to 3 a domain inducing a complete ab tract interpretation. Indeed, our methodology allow to con tructively derive that E(S S) = (S S) = = , where 3 3 . In thi way, one get a be t correct approximaγ( = = ) = (N ? N ? ) S uch that f b ( = = ) = 0, and therefore completene tion f b : E(S S) ha been achieved. Let u illu trate the main contribution of the paper. In Section 3, the concept of completene i formalized by re orting to the Cou ot and Cou ot closure operator approach to ab tract interpretation [5,8]. Thi allow u to be independent from peci c repre entation of ab tract domain’ object . It i hown that completene i an ab tract domain property, which give ri e to a mathematically compact equation between clo ure , tudied in later ection . Moreover, we B i complete, and therefore ob erve that if an ab tract interpretation f : A f = f bA B , then for all the ab tract domain A0 more concrete than A and B 0 more ab tract than B, it turn out that f bA B : A0 B 0 i till complete. Thi implie that it i not meaningful to earch for the complete kernel of A and the lea t complete exten ion of B, becau e, e.g., if the complete kernel of A would exi t then A it elf would already be complete. In tead, one hould try to olve the conver e problem . Under the working hypothe i of dealing with continuou emantic function , a key con tructive characterization of the domain inducing complete ab tract interpretation i given in Section 4. More preci ely, given a B i comcontinuou emantic function f : C D, we how that f bA B : A plete i A i more concrete than a certain domain Rf (B) depending on B i B i more ab tract than a certain domain Lf (A) depending on A. Thu , the LD and Rf : LD LC form an adjunction. By exploiting mapping Lf : LC the e re ult , we are able to characterize: (1) the lea t complete exten ion of A relative to B a the lea t domain which contain both A and Rf (B), and (2) the
Complete Abstract Interpretations Made Constructive
369
complete kernel of B relative to A a the greate t domain contained in both B and Lf (A). A a further con equence, we ub ume the more re trictive notion of lea t complete exten ion and greate t complete re triction tudied in [12] and the corre ponding re ult of exi tence a well a the con tructive characterization given for additive emantic function . In Section 5, we inve tigate the relation hip between completene and the concept of quotient of an ab tract interpretation, recently introduced by Corte i et al. [4] for comparing the preci ion of ab tract interpretation in computing a given property. Informally, the quotient of a complex ab tract domain A w.r.t. a property P of A (i.e., a further ab traction of A) repre ent which part of A contribute in computing the property P . We how that, in general, Corte i et al.’ quotient do not alway exi t: In particular, the ba ic a umption of continuity of the emantic function doe not en ure their exi tence. However, we ob erve that quotient , when they exi t, turn out to be certain lea t complete exten ion , which naturally formalize the intuition behind the notion of quotient. Thu , a imple and natural generalization of the notion of quotient i propo ed, which retain the advantage of being alway well-de ned, under the hypothe i of continuity of the emantic function . 2
Preliminaries
Basic Notation. If S i any et, P a po et, and f : S P then we write f def P then max(S) = s S t S s if for all x S, f (x) P (x). If S t s = t . Given two po et C and D, C −m D, C −c D, and C − D denote, re p., the et of all monotone, continuou (i.e. pre erving lub’ of chain ), and (completely) additive (i.e. pre erving all lub’ , empty et included) function from C to D. denote the r t in nite ordinal. For a complete lattice C, given C of f i inductively de ned, f :C C, for any i N , the i-th power f i : C for any x C, a x if i = 0, and a f (f i−1 (x)) if i i a ucce or. The Lattice of Abstract Interpretations. In tandard Cou ot and Cou ot’ abtract interpretation theory, ab tract domain can be equivalently peci ed either by Galoi connection , i.e. adjunction , or by clo ure operator ( ee [5,8]). In the r t ca e, the concrete domain C and the ab tract domain A are related by an adjunction ( C A γ). It i generally a umed that ( C A γ) i a Galoi in ertion (GI), i.e. i onto or, equivalently, γ i 1-1. In the econd ca e in tead, an ab tract domain i peci ed a an (upper ) closure operator ( hortly uco or clo ure) on the concrete domain C, i.e., a monotone, idempotent and exten ive operator on C. The e two approache are equivalent, modulo i omorphic repreentation of domain’ object . In the following, uco(C) denote the po et of all uco’ on C. Let u recall that each uco(C) i uniquely determined by the et of it xpoint , which i it image, i.e. (C) = x C (x) = x , and that i (C) (C). Al o, when C i a complete lattice, uco(C) x x x i a complete lattice, and X C i the et def Y Y X of xpoint of a uco i X i meet-clo ed, i.e. X = M(X) = (where = X). Moreover, given uco(C), (C) i a complete meet ub emilattice of C. Hence, for a concrete domain C which i a complete lattice,
370
Roberto Giacobazzi et al.
we will identify uco(C) with the lattice LC of ab tract interpretation of C, i.e. the complete lattice of all po ible ab tract domain of C. Often, we will nd convenient to identify clo ure with their et of xpoint . Thi doe not give ri e to ambiguity, ince one can di tingui h their u e a function or et according to the context. The ordering on uco(C) corre pond preci ely to the tandard order u ed in ab tract interpretation to compare ab tract domain with regard to their preci ion: A1 i more preci e than A2 (i.e., A1 i more concrete than A2 in uco(C). Lub and glb of A2 or A2 i more ab tract than A1 ) i A1 uco(C) have therefore the following reading a operator on ab tract domain . Let Ai i2I uco(C): (i) i2I Ai i the mo t concrete among the domain which are ab traction of all the Ai ’ , i.e. it i their lea t (w.r.t. ) common ab traction; (ii) i2I Ai i the mo t ab tract among the domain (ab tracting C) which are more concrete than every Ai ; thi domain i known a reduced product of all the Ai ’ . 3
Completeness by Closures
Let f : C −m D be any monotone emantic function, where C and D are complete lattice playing the role of concrete emantic domain . Let an ab tract interpretation A B f of C D f be peci ed by the GI ( C A C A γA C ) and ( D B D B γB D ), and by an ab tract function f : A −m B. It i known [8] that f i a correct approximation of f , i.e. D B f f C A , if and def B i called only if D B f γA C f . Thu , f bA B = D B f γA C : A the canonical be t correct approximation of f relatively to the ab tract domain A and B. A B f i called complete when D B f = f C A . In thi ca e, bA B γ = f γ = f , i.e. f indeed i the be t corf =f CA AC DB AC rect approximation f bA B . Thi mean that, given two ab tract domain A and B, there exi t f uch that A B f i complete i A B f bA B i complete. Since f bA B only depend on A and B, we get that completeness is an abstract domain property. Thu , given A and B, we refer to completene of A and B in order to refer to completene of the whole ab tract interpretation A B f bA B . By u ing clo ure operator , if = γA C C A uco(C) and = γB D D B uco(D) are the uco’ a ociated, re p., with A and B, one can extend an analogou re ult in [12] by howing that A and B are complete i f= f . Thi ju ti e the following general de nition of completene . uco(C), and De nition 1. Let C and D be complete lattice , f : C −m D, uco(D). Then, the pair i complete for f if f = f . Al o, if i complete for F whenever f F f= f .2 F C −m D then Fir t, let u notice that, equivalently, one can de ne complete for f when f f . Further, it i worth remarking that our de nition encompa e the ca e where f : C C and one i intere ted in two di erent ab traction of input and output, i.e. uco(C) with = . Whenever f : C C and = , the above de nition of completene boil down to the equation f= f con idered in [7,12]. Al o, it would not be too di cult (although notationally
Complete Abstract Interpretations Made Constructive
371
heavy) to develop the whole theory by con idering emantic function of type Dm . Cn For any given et of function F C −m D, we will u e the following helpful def uco(C) uco(D) f F f = f notation: Γ (C D F ) = . Whenever F = f , we imply write Γ (C D f ). The following re ult li t ome intere ting propertie of completene , where point (i) (iii) generalize an analogou re ult given in [12]. Proposition 1. Γ (C D F ). (i) xx x D (ii) d D Γ (C D x d) = uco(C) uco(D). (iii) If Γ (C D f ) and Γ (D E ) then (iv) If Γ (C D F ), and , then
Γ (C E Γ (C D F ).
f ).
uco(D), let u now introduce the following Given F C −m D and operator tran forming ab tract domain of C (a u ual, we follow the tandard = uco(C) ). convention = uco(C) and def
KF ( ) = def
EF ( ) =
uco(C)
Γ (C D F ) ;
uco(C)
Γ (C D F ) .
Al o, given uco(C), analogou operator KF and EF of type uco(D) uco(D) are introduced. Thu , e.g., EF ( ) i the lea t common ab traction of all the domain more concrete than and uch that i complete for F . A a con equence of Propo ition 1 (iv), one can draw the following two important Γ (C D F ) then KF ( ) = ; (ii) If EF ( ) remark : (i) If KF ( ) Γ (C D F ) then EF ( ) = . Thi mean that it doe not make en e to earch of uco(C) uch that i complete, and, for the greate t re triction l uco(D) uch that i complete, becau e dually, the lea t exten ion l of either they coincide with their argument or they do not exi t. That i why we introduce ju t the following notion . Γ (C D F ) then KF ( ) i called the complete De nition 2. If KF ( ) Γ (C D F ) then EF ( ) i called kernel of relative to . Dually, if EF ( ) 2 the least complete extension of relative to . A far a complete kernel are concerned, it i an ea y ta k to how that they alway exi t, although no explicit characterization can be given. Proposition 2. Let F C −m D, the complete kernel of relative to .
uco(C) and
uco(D). There exists
Let u now con ider the ca e where C = D and = . It i important to Γ (C C F ), then EF ( ) i the mo t ab tract among remark that if EF ( ) the domain uch that f = f . Thu , we tre that thought of a output ab traction i con idered xed. We will ee in Section 5 how thi concept can be u efully exploited. Moreover, let u recall that in Giacobazzi and Ranzato’ approach [12], the lea t complete exten ion of , when it exi t , i in tead
372
Roberto Giacobazzi et al.
de ned a the mo t ab tract among the domain uch that f= f . def uco(C) Γ (C C F ) , thi Hence, by de ning EF ( ) = Γ (C C F ). latter lea t complete exten ion exi t whenever EF ( ) EF ( ) Therefore, in thi ca e, con idered a output ab traction i not xed. Thu , we remark that thi latter concept of lea t complete exten ion i di erent from that introduced in De nition 2. In the next ection, we will tudy both the e interΓ (C C F ), e ting notion . In order to di tingui h them, when EF ( ) EF ( ) we will call EF ( ) the absolute lea t complete exten ion of . Moreover, analogou dual con ideration hold for complete kernel : We will call them ab olute complete kernel . 4
Constructive Characterization of Completeness
The following key re ult characterize complete ab tract interpretation in a con tructive way: In fact, it how that a completene equation f = f hold i contain a certain et of point depending on , and, in a dual fa hion, i i contained in a certain et of point which depend on . The proof make u e of a variant of the axiom of choice, known a Hau dor ’ Maximal Principle [2, pag. 192]. We will exploit largely the following compact notation: For any def f :C D and y D, Hyf = x C f (x) y . Theorem 1. Let F
C −c D,
Γ (C D F )
y
uco(C) and
uco(D). Then,
f f 2F max(Hy )
D
f 2F y2
max(Hyf )
. Moreover, y
D
f 2F
max(Hyf )
uco(D).
It i then u eful to ob erve that, for any arbitrary et of point S and any uco , the following equivalence hold : S M(S). Thu , a the above theorem ugge t , given any et of continuou function F C −c D, we de ne uco(D) and RF : uco(D) uco(C) a follow : two mapping LF : uco(C) def
LF ( ) = y
D
f f 2F max(Hy )
def
RF ( ) = M(
;
f 2F y2
max(Hyf ))
In thi way, Theorem 1 can be re tated a follow : Γ (C D F )
LF ( )
RF ( )
In particular, (LF uco(C) uco(D) RF ) i an adjunction. Con equently, for any uco(C) and uco(D), one get the following characterization for the operator KF and EF : KF ( ) = EF ( ) =
uco(D) uco(C)
LF ( )
=
RF ( ) =
LF ( ); RF ( ).
LF ( ) and RF ( ) RF ( ), by Theorem 1, we Hence, ince LF ( ) RF ( ) Γ (C D F ), and therefore, according obtain that LF ( ) to De nition 2, we can draw the following con equence :
Complete Abstract Interpretations Made Constructive
The complete kernel of LF ( );
rel. to
The lea t complete exten ion of RF ( ).
373
i the lea t common ab traction of
and
rel. to
and
i the reduced product of
For any uco(C) and uco(D), it i helpful to de ne two dual mapping uco(C) and GF : uco(C) uco(D) a follow : FF : uco(D) def
FF ( ) =
def
GF ( ) =
RF ( );
LF ( )
Summing up, we have hown the following re ult, which explicitly tate what one mu t add to in order to get it lea t complete exten ion relative to and, dually, what one mu t ubtract from in order to get it complete kernel relative to . C −c D,
Theorem 2. Let F FF ( ) = M( GF ( ) =
(
\ y
uco(C) and
uco(D).
f f 2F y2 max(Hy )))
D
f 2F
is the least complete extension of rel. to ; max(Hyf ) is the complete kernel of rel. to .
Example 1. Con ider the example ketched in Section 1. Let uco(P(N ? N ? )) be the uco a ociated to the input ab tract domain S S, and uco(P(Bool? )) be the uco a ociated to the output ab tract domain S. ThereN? N? N ? N ? and = Bool? . fore, = The emantic function f i obviou ly continuou and hence, by Theorem 2, the lea t complete exten ion of for f relative to doe exi t, and it i given by the Rf ( ). Thu , for y , let u compute max(Hyf ). reduced product Ff ( ) = We have that: f )= max(HBool
N?
N? ; f ) = max( Z P(N ? N ? ) f (Z) ) max(Hf?g Z = (N ? = max( Z P(N ? N ? ) 3 3
N? )
3 3
.
(N ? N ? ) 3 3 )= (N ? N ? ) 3 3 . Hence, FF ( ) = M( Thu , a announced in Section 1, and a one naturally expect , thi how that the lea t complete exten ion of S S can be obtained by adding a point = = 3 3 , i.e. denoting that r t and econd with concrete meaning (N ? N ? ) component are urely not imultaneou ly equal to the value 3. It hould be clear that thi re ned input ab tract domain induce now a complete ab tract 2 interpretation. Let u now turn to ab olute complete kernel and ab olute lea t complete exten ion , a formally introduced at the end of Section 3. What follow generalize the re ult in [12, Section 6], where the hypothe i con i ted of dealing with additive emantic function . A ume that C = D, i.e. F C −c C, and let uco(C). By Theorem 1, for any uco(C), we have that:
374
Roberto Giacobazzi et al.
FF ( ) GF ( )
and
Γ (C C F );
and
Γ (C C F ).
Therefore, for the operator EF introduced at the end of Section 3, we obtain uco(C) FF ( ) . Then, ince FF : uco(C) uco(C) that EF ( ) = i clearly monotone for any , and hence admit the greate t xpoint, we get Γ (C C F ). EF ( ) = fp(FF ). Moreover, by Theorem 2, fp(FF ) fp(FF ) Thi mean that the ab olute lea t complete exten ion of exi t , and it i fp(FF ). Dual con ideration hold for complete kernel . Thu , we get the following con tructive characterization for ab olute completene . uco(C). Then, fp(FF ) and lfp(GF ) are, Theorem 3. Let F C −c C and resp., the absolute least complete extension and absolute complete kernel of . 5
Generalized Quotients of Abstract Interpretations
The concept of quotient of an ab tract interpretation ha been recently introduced by Corte i et al. [4] in order to formalize the lea t amount of information of a complex ab tract domain A that i u eful for computing ome property that A i able to repre ent. Corte i et al. [4] how how to exploit thi notion for comparing the preci ion of two ab tract interpretation in computing a given common property. Notably, they compare the well-known Jacob and Langen Sharin [13] and Marriott and S ndergaard Pos [14] Prolog ab tract interpretation , by demon trating that Pos i trictly more preci e than Sharin for computing variable groundne information. Further, Bagnara et al. [1] how, al o experimentally, that in order to compute pair- haring information, the u e of the quotient of Sharin w.r.t. the pair- haring S ndergaard domain [19] lead to remarkable gain of e ciency, when compared with the full domain Sharin . Let u recall from [4] the de nition of quotient. Let A be any complete uco(A) lattice, f : A −m A be a monotone emantic function on A, and be an ab traction of A. Here, A f model any ab tract interpretation of ome reference emantic de nition, while play the role of the property (i.e. the A Ai ab traction of A) one i intere ted in. The equivalence relation r de ned a follow :1 a 1 a2
r
i
i
(f i (a1 )) = (f i (a2 ))
r when A view a1 and a2 a equivalent w.r.t. Roughly peaking, a1 a2 the computation of the property . Thu , according to thi intuition, the quotient Q (A) of A w.r.t. i de ned (cf. [4, De nition 3.5]) a the ub et of A of the lub’ of all equivalence cla e of r : That i , if [a] denote a generic equivalence def [a] a A , and the ordering i that inherited from cla for r , then Q (A) = A. Corte i et al. [4, Theorem 3.6] how that if the equivalence r i additive, i.e. r r , then Q (A) i well-de ned, namely i I ai b i i2I ai i2I bi 1
This de nition considers the case of the rst limit ordinal ω for practical purposes a generalization to any (possibly trans nite) ordinal would be straightforward.
Complete Abstract Interpretations Made Constructive
375
it i in turn an ab traction of A, i.e. the et of xpoint of a uco on A, and i an ab traction of Q (A). Corte i et al.’ re ult can be harpened a follow . Fir tly, it i u eful to recall ( ee [8, Section 6.3]) that, in general, given an equivalence relation R on a complete lattice L, R i additive i x L [x]R uco(L). Thu , the hypothe i that the equivalence relation r i additive i indeed equivalent to the fact that a [a] uco(A), i.e. that the quotient Q (A) i well-de ned. In thi ca e, that (i.e. [4, Theorem 3.6 (ii)]) i an immediate con equence: In fact, if Q (A) a = (a) and b [a] then a = (a) = (f 0 (a)) = (f 0 (b)) = (b), and hence b a, i.e. [a] = a. En pa ant, we ob erve that the additivity of f i an obviou u cient condition guaranteeing that the quotient exi t . Actually, the quotient pre ented in [1,4] exi t ju t becau e the involved emantic function are additive. Lemma 1. If f : A − A and
uco(A) then Q (A)
uco(A).
It turn out that the quotient ab tract domain ati e the following remark= a [a] able property of minimality : When a quotient Q (A) exi t , if i the mo t ab tract olution in uco(A) i the uco a ociated to Q (A), then fi i . uco(A) of the y tem of equation fi = Lemma 2. Let uco(A) such that Q (A) uco(A), i f i Q (A), and for any Q (A).
uco(A). Then, i fi = fi
fi = implies
fi i i clearly equivalent Since the y tem of equation fi = i i f i > 0 , the above lemma ay to the y tem f = that, when a quotient Q (A) exi t (i.e. Q (A) uco(A)), it i characterized a follow : Q (A) =
uco(A)
i>0
fi =
fi
Of cour e, in the terminology of thi paper, thi mean that when it exi t , Q (A) i the lea t complete exten ion of for the et of function f i i>0 relative to it elf. However, it may well happen that, for ome A, f and , uch lea t complete exten ion exi t , whil t the quotient Q (A) doe not exi t, a the following imple example how . Example 2. Let A be the lattice depicted in the gure. Al o, let f : A A be dened a f = a a b a c e d e e e , and let uco(A) uch that (A) = a b e . Trivially, f i monotone (and therefore continuou ) but not additive. Moreover, f i idempotent, and therefore, for any i 1, f i = f . a It turn out that, for any i 1, fi = f. A b a con equence, r i not an additive equivalence rec d lation. In fact, for any i 0, (f i (c)) = (f i (d)): e If i = 0 then, (c) = (d) = b; if i 1 then, (f i (c)) = f (c) = e = f (d) = (f i (d)). But, (f (c d)) = (f (b)) = f (b) = a. Hence, thi mean
,@@ ,
376
Roberto Giacobazzi et al.
that the quotient Q (A) doe not exi t. In tead, a each f i i monotone, by Theorem 2, the lea t complete exten ion of for f i i>0 relative to doe exi t. Moreover, thi i given by the following reduced product: ( i>0 y2 max(Hyf )). It i then a routine ta k to check that thi i the domain A it elf, i.e. the identity 2 uco x x. Then, Lemma 2 and Example 2 hint to generalize the notion of quotient a the lea t complete exten ion of for f i i>0 relative to , whenever thi exi t . uco(A), the De nition 3. Given a complete lattice A, f : A −m A, and eneralized quotient of A w.r.t. i well-de ned when there exi t the lea t (A) of for f i i>0 relative to ; in uch a ca e, the complete exten ion 2 generalized quotient i de ned to be (A). It i here worth noting that the above de nition naturally extend the intuitive meaning of the concept of quotient: In fact, the ab tract domain (A) i the mo t ab tract domain which i more concrete than the property and which i a good a A for propagating the information through the emantic function f . In other word , (A) encode exactly the lea t amount of information of A that i u eful for computing the property . Thu , thi exactly formalize the clear intuition behind the concept of quotient. A an immediate con equence of Theorem 2, we are then able to give the following theorem en uring that, when the emantic function f i continuou , generalized quotient alway exi t. Theorem 4. If f : A −c A then, for any (A) exists.
uco(A), the eneralized quotient
Acknowled ments. We wi h to thank Enea Za anella for hi helpful remark on quotient of ab tract interpretation and an anonymou referee for hi /her u eful comment . The work of France co Ranzato ha been upported by an individual grant no. 202.12199 from Comitato 12 Scienza e Tecnologie dell’Informazione of Italian CNR.
References 1. R. Bagnara, P.M. Hill, and E. Za anella. Set-sharing is redundant for pair-sharing. In Proc. 4th Int. Static Analysis Symp., LNCS 1302:53 67, 1997. 2. G. Birkho . Lattice Theory. AMS Colloq. Publications vol. XXV, 3rd ed., 1967. 3. G.L. Burn, C. Hankin, and S. Abramsky. Strictness analysis for higher-order functions. Sci. Comput. Pro ram., 7:249 278, 1986. 4. A. Cortesi, G. File, and W. Winsborough. The quotient of an abstract interpretation. Theor. Comput. Sci., 202(1-2):163 192, 1998. 5. P. Cousot. Methodes iteratives de construction et d’approximation de points xes d’operateurs monotones sur un treillis, analyse semantique des pro rammes. PhD thesis, Universite Scienti que et Medicale de Grenoble, 1978. 6. P. Cousot. Completeness in abstract interpretation (Invited Lecture). In Proc. 1995 Joint Italian-Spanish Conference on Declarative Pro rammin , pp. 37 38, 1995.
Complete Abstract Interpretations Made Constructive
377
7. P. Cousot and R. Cousot. Abstract interpretation: a uni ed lattice model for static analysis of programs by construction or approximation of xpoints. In Proc. 4th ACM POPL, pp. 238 252, 1977. 8. P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proc. 6th ACM POPL, pp. 269 282, 1979. 9. P. Cousot and R. Cousot. Inductive de nitions, semantics and abstract interpretation. In Proc. 19th ACM POPL, pp. 83 94, 1992. 10. P. Cousot and R. Cousot. Abstract interpretation of algebraic polynomial systems. In Proc. 6th AMAST Conf., LNCS 1349:138 154, 1997. 11. R. Giacobazzi and F. Ranzato. Re ning and compressing abstract domains. In Proc. 24th ICALP, LNCS 1256:771 781, 1997. 12. R. Giacobazzi and F. Ranzato. Completeness in abstract interpretation: a domain perspective. In Proc. 6th AMAST Conf., LNCS 1349:231 245, 1997. 13. D. Jacobs and A. Langen. Static analysis of logic programs for independent ANDparallelism. J. Lo ic Pro ram., 13(2-3):154 165, 1992. 14. K. Marriott and H. S ndergaard. Precise and e cient groundness analysis for logic programs. ACM Lett. Pro ram. Lan . Syst., 2(1-4):181 196, 1993. 15. A. Mycroft. Abstract interpretation and optimisin transformations for applicative pro rams. PhD thesis, CST-15-81, Univ. of Edinburgh, 1981. 16. A. Mycroft. Completeness and predicate-based abstract interpretation. In Proc. ACM PEPM Conf., pp. 179 185, 1993. 17. U.S. Reddy and S.N. Kamin. On the power of abstract interpretation. Computer Lan ua es, 19(2):79 89, 1993. 18. R.C. Sekar, P. Mishra, and I.V. Ramakrishnan. On the power and limitation of strictness analysis. J. ACM, 44(3):505 525, 1997. 19. H. S ndergaard. An application of abstract interpretation of logic programs: occur check reduction. In Proc. ESOP ’86, LNCS 213:327 338, 1986. 20. B. Ste en. Optimal data flow analysis via observational equivalence. In Proc. 14th MFCS Symp., LNCS 379:492 502, 1989.
Timed Bisimulation and Open Maps Thomas Hune and Mo ens Nielsen BRICS? , Department of Computer Science, University of Aarhus, Denmark, bar s,mn @br cs.dk
Abs rac . Open maps have been used for de ning bisimulations for a range of models, but none of these have modelled real-time. We de ne a category of timed transition systems, and use the general framework of open maps to obtain a notion of bisimulation. We show this to be equivalent to the standard notion of timed bisimulation. Thus the abstract results from the theory of open maps apply, e.g. the existence of canonical models and characteristic logics. Here, we provide an alternative proof of decidability of bisimulation for nite timed transition systems in terms of open maps, and illustrate the use of open maps in presenting bisimulations.
1
Introduction
Durin the past decade, a number of formalisms for real-time systems have been introduced and studied, e. . the timed automata [AD90] and timed process alebras [Wan90]. A reat deal of the theory of untimed systems has been lifted successfully to the settin of formalisms modellin real-time behaviour of systems. As examples, many results from automata theory apply also to timed automata, [AD90, AD94, ACM97], and a number of timed versions of classical speci cation lo ics have been studied, [AH91, LLW95]. In this paper we study the notion of bisimulation [Mil89] for timed transition systems. The notion of bisimulation for timed models has already been introduced and studied by many researchers, e. . in [Wan90, AKLN95, NSY93]. Timed bisimulation was shown decidable for nite timed transition systems by Cerans in [Cer92], and since then more e cient al orithms have been discovered [LLW95, WL97] and implemented in tools for automatic veri cation[KN94]. These results like most other results concernin veri cation of real-time systems build on the re ion construction [AD90, AD94] which makes it possible to express the uncountable behaviour of a real-time system in a nite way. One of the main advanta es of Milners notion of bisimulation for untimed transition systems, is the fact that for two transition systems, the property of bein bisimilar may be expressed in terms of presentin an explicit bisimulation between the two systems, i.e. a relation on the states of the two systems. Unfortunately, this property does not eneralise to the settin of timed transition ?
Basic Research in Computer Sciencs, Centre of the Danish National Research Foundation
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 378 387, 1998. c Sprin er-Verla Berlin Heidelber 1998
Timed Bisimulation and Open Maps
379
systems, where bisimulations are de ned in terms of the uncountable unfolded version of iven timed transition systems, and where the decision procedures from e. . [Cer92] produce relations over nontrivial re ional constructions The contribution of this paper is rst and foremost to show the applicability of the eneral cate orical framework of bisimulations in terms of open maps from [JNW96]. This framework has already been applied successfully to (re)de ne a number of observational equivalences [CN96]. Here we de ne a cate ory of timed transition systems, where the morphisms are to be thou ht of as simulations, and an accompanyin path (sub)cate ory of timed words, which, followin [JNW96], provides us with a notions of open maps and a bisimulation with a number of useful properties, like a canonical (presheaf) model, and a characteristic (modal) lo ic. We show this notion of bisimulation to coincide with the standard timed bisimulation from [Cer92], and hence we may apply the eneral results from [JNW96] to this standard notion. Furthermore, we show within the framework of open maps that bisimilarity is decidable for nite timed transition systems. More importantly, for two bisimilar systems, our decision procedure will produce a span of open maps, i.e. a representation of bisimilarity within the framework of timed transition systems, matchin the internal representation of bisimulations for untimed transition systems. In Section 2 a cate ory of timed transition systems and a path subcate ory are de ned, and they are shown to have the required properties for applyin the approach of [JNW96]. Next, in Section 3 the resultin notion of bisimulation is studied, and shown to coincide with the standard notion of timed bisimulation. Finally, in Section 4 we provide a new proof of the decidability of timed bisimulation and illustrate the use of open maps to express bisimulations. Section 5 contains conclusions and future work.
2
A Cate ory of Timed Transition Systems
As a model for real time systems we use timed transition systems. These will be the objects of our cate ory. A timed transition system is basically a timed automata without a set of acceptin states and acceptance condition. R.Alur and D.L.Dill [AD94] call this a timed transition table. De nition 1 (Timed Transition Systems) A timed transition system is a quintuple (S s0 X T ) where S is a set of states and s0 is the initial state. is a nite alphabet of actions. X is a set of clock variables. is a T is the set of transitions such that T S 2X S where clock constraint enerated by the rammar ::= c x x + c y in which < > , c is an inte er constant and x, y are clock variables. s0 . A transition (s s0 ) is written s
380
Thomas Hune and Mogens Nielsen
Before lookin at an example of a timed transition system and discussin how we interpret the behaviour of such a system, we will de ne our notion of paths for timed transition systems. De nition 2 (Timed Words) A timed word over an alphabet is a ( n n ), where for all 0 sequence of pairs = ( 1 1 ) ( 2 2 ) ( 3 3 ) R+ and furthermore i < i+1 . n i i A pair ( ) represents an occurrence of action time (0) of the execution.
at time
nite i
relative to the startin
Example 1 The timed transition system in Fi ure 1 has two clocks x and y, and three actions a,b,c. The state s0 is the initial state.
- sm I2
x
a y
0
1
R sm 1
y
b
y
c 2
- sm 2
4 x>4 x y
Fi . 1. The timed transition system from Example 1.
To keep track of values of clocks durin an execution, we introduce the notion of a clock evaluation. De nition 3 (Clock Evaluation) A clock evaluation is a function : X R+ which assi ns times to the clock variables of a system. We de ne ( +c)(x) := (x)+c for all clock variables x. If is a set of clock variables then [ 0](x) := 0 if x , and (x) otherwise. For a constraint to be satis ed in a clock evaluation we require that the expression [ (x) x]1 evaluates to true. A constraint de nes a subset of Rn where n is the number of clocks in X. We will speak of this subset as the meanin of and write it [[ ]]X . A clock evaluation de nes a point in Rn which we shall denote by [[ ]]X , so the constraint is satis ed for the clock evaluation if and only if [[ ]]X [[ ]]X . De nition 4 Let T be a timed transition system. A con uration is a pair s , where s is a state and is a clock evaluation. T can make the run n s1 1 22 s for all i > 0 there is a transition s0 0 11 n n i n [[ i ]]X and i = ( i−1 + ( i − si−1 i i i si such that [[ i−1 + ( i − i−1 )]]X ))[ 0]. The state s is the initial state of T and 0 is the constant 0 i−1 i 0 function. We de ne 0 to be 0. The timed word ( 1 1 )( 2 2 )( 3 3 ) ( n n ) is enerated by this run. 1
[y x] is syntactic substitution of y for x in .
Timed Bisimulation and Open Maps
381
The morphisms of our cate ory will be simulation morphisms followin the approach of [JNW96]. This leads to the followin de nition of a morphism. De nition 5 A morphism (m ) between timed transition systems T and T 0 consists of two components; a map m : S S 0 between the states and a map 0 X between the clocks. These maps must satisfy that m(s0 ) = s00 and :X s0 then there is a transition whenever there is a transition in T of the form s m(s0 ) in T 0 satisfyin the followin two constraints: m(s) 1. 0 = 2. [[ ]]X
−1
( ) where −1 ( ) = x0 [[ 0 [ (x) x]]]X
X0
(x0 )
Example 2 There is a morphism from the timed transition system in Fi ure 2 to the one in Fi ure 1 mappin states t0 and t2 to s0 , t1 and t3 to s1 , and t4 to s2 . The clock variable x is mapped to z and y to u. It should be easy to check that the two constraints in De nition 5 are satis ed.
? t1
2
u
z
? t0
a 1
2
u
- t
b 4 z>4 z u
2
u
b 3 z>4 z u
z
a 1 u
6 t3
u
c
1
- t 4
Fi . 2. A timed transition system with a morphism to the system in Fi ure 1.
X and a clock evaluation De nition 6 For a function : X 0 we de ne −1 ( ) : X 0 R+ , as −1 ( )(x) := ( (x))
:X
R+
Theorem 1 Given two timed transition systems T and T 0 and a morphism (m ) from T to T 0 , we have that if T can make the run s0 0 11 s1 1 22 n sn n which enerates the timed word ( 1 1 )( 2 2 )( 3 3 ) ( n n ), n n m(s1 ) −1 ( 1 ) 22 then T 0 can make the run m(s0 ) −1 ( 0 ) 11 n −1 ( n ) eneratin the same timed word. m(sn ) De nition 7 The cate ory CTTS has timed transition systems with alphabet as objects, and the morphisms from De nition 5 as arrows. For morphisms (m )
(m
)
T −−− T 0 and T 0 −−−− T 00 composition is de ned as (m0 0 ) (m ) := 0 ). The identity morphism is the morphism where both m and are (m0 m the identity function.
382
Thomas Hune and Mogens Nielsen
CTTS has a number of useful properties. For our purpose here we only need the followin . Theorem 2 CTTS
has pullbacks and products.
The pullback construction is a combination of the pullback and pushout constructions in sets with functions, for m and respectively. 2.1
A Path Cate ory
We need to represent our observations (timed words) as a subcate ory of CTTS to use the framework of open maps. ( n n ) we De nition 8 Given a timed word = ( 1 1) ( 2 2) ( 3 3) n s . There are de ne a timed transition system T : s0 1 1 1 s1 2 2 2 n n n n + 1 states in the timed transition system and a clock variable for each of the sn . We de ne i and i as 2n subsets of states s1 s2 ^ xj and i = (xj = i − I(si xj ) ) i = xj si xj 2X
where I(si xj ) = max(k : k < i sk xj ). If there is no such k then I(si xj ) = 0 and we de ne 0 := 0. The index returned by I(si xj ) is the index of the last state at which xj was rest. This de nes a subclass TTSTW of timed transition systems. We write T for the transition system in TTSTW representin . The only purpose of this seemin ly ad hoc construction is that it allows us to identify runs of in T with morphisms from T to T , as expressed formally in the followin two theorems. Theorem 3 The full subcate ory of CTTS with objects from TTSTW , denoted CTTSTW , is isomorphic to the cate ory of timed words (as objects) with word extensions (as morphisms). Theorem 4 Given a timed word
and a timed transition system T , there is a
one to one correspondence between runs of
3
(m )
and morphisms T −−−
T.
Timed Bisimulation
Given our cate ory of timed transition systems and the path cate ory we can use the eneral framework from [JNW96] to de ne our notions of open maps and bisimulation. (m )
De nition 9 (Open Map [JNW96]) A morphism T −−− for all T
(p
p)
−−−−
T with T
T 0 is open i
CTTSTW and all morphisms T
(f
f)
−−−−
T
Timed Bisimulation and Open Maps
in CTTSTW such that the square
(p
T (f
/
T p
):T
commutes there exists a
T
f)
(m )
morphism (p0
p)
383
(q
q) /
T0
T such that the in the dia ram
(p
T (f
/
| || =
(p
f)
T
p)
||(q|
p
T
)
q)
(m )
/
T0
the two trian les commute.
De nition 10 Two timed transition systems T1 and T2 are T W-bisimilar i (m )
(m
there exists a span T1 −−−− T −−−−
)
T2 with vertex T of open morphisms.
It follows from [JNW96] and Theorem 2 that T W-bisimulation is the equivalence enerated by open maps. The ‘standard’ notion of timed bisimulation is de ned in terms of con urations. De nition 11 (Timed Bisimulation) Two timed transition systems are bisimilar i there exists a relation R over con urations ( s s t t ) of the two systems satisfyin ( sin s0 tin t0 ) R and for all ( s s t t ) R whenever s s some t0 t0 . whenever t t some s0 s0 .
s0 t0
0 s 0 t
then t then s
t
t0
0 t
with ( s0
0 s
t0
0 t
)
R for
s
s0
0 s
with ( s0
0 s
t0
0 t
)
R for
Theorem 5 Two timed transition systems T and T 0 are T W-bisimilar i they are bisimilar accordin to De nition 11.
Example 3 Since identity morphisms are open we have that two timed transition systems are bisimilar if we can nd an open map from one to the other. In Fi ure 3 the (only) morphism from T to T 0 is open. From Theorem 7 it should be easy for the reader to check that this indeed is an open morphism. In this setup, one can present the fact that two timed transition systems are timed bisimilar by providin a concrete span of open maps. In the next section we will show how one can e ectively construct a nite span of open maps for any iven pair of bisimilar nite timed transition systems.
384
Thomas Hune and Mogens Nielsen T 0:
T:
2
y
?m a 4, @ 2 y m, , @@R mx
a x y b 1
?m
x
4
a x y
4
2
a y x
4
R m c y 1, @ x 1 m, , @@R m b
c
?m
2
?m
1
Fi . 3. Two bisimilar timed transition systems.
4
Decidability
Showin the decidability of timed bisimulation amounts to decidin whether there exists a span of open maps between two nite timed transition systems. Our approach is rst to show that openness of a morphism between two nite timed transition systems is decidable, and next to show an upper bound on the size of the vertex of a span for two bisimilar nite timed transition systems. De nition 12 A con as a con uration.
uration s
is reachable i there is a run that has s
We will now characterise the open maps in terms of runs and con
urations.
(m )
Theorem 6 A morphism T1 −−− T2 is open i for all reachable con urations in T1 , and for all 0 = + whenever there is a transition m(s1 ) 2 2 s02 s1 such that [[ −1 ( 0 )]]X2 [[ 2 ]]X2 , then there exists a transition s1 1 1 s01 such that m(s01 ) = s02 and [[ 0 ]]X1 [[ 1 ]]X1 . To et a decidable characterisation of openness we introduce the notion of reions, [AD94]. De nition 13 (Re ion[AD94]) Given a nite set of clocks X and a constant cX a re ion is an equivalence class of valuations such that = 0 i For each x X : (x) = 0 (x) 2 or both (x) > cX and 0 (x) > cX . For every pair of clock variables x y X where both (x) cX and (y) cX we have that f ract( (x)) f ract( (y)) i f ract( 0 (x)) f ract( 0 (y)). For every clock variable x X where (x) cX we have f ract( (x)) = 0 i f ract( 0 (x)) = 0. 2
We use x for the largest integer smaller than or equal to x and f ract(x) := x − x .
Timed Bisimulation and Open Maps
385
The re ion to which belon s is denoted by [ ]. For a nite timed transition system T let RT be the set of re ions associated with the set of clock variables of T and the lar est constant referred to in the constraints of T transitions. A pair s re where re RT , is called an extended state. Our operations on clock evaluations can be extended to re ions which will be used below. We can now ive a characterisation of open maps in terms of extended states. T2 is open i for Theorem 7 For nite T1 and T2 a morphism (m ) : T1 Reach(re )3 , all reachable extended states s1 re in T1 , and for all re 0 whenever there is a transition m(s1 ) 2 2 s02 such that [[ −1 (re 0 )]]X2 [[ 2 ]]X2 , then there exists a transition s1 1 1 s01 such that m(s01 ) = s02 and [[re 0 ]]X1 [[ 1 ]]X1 . Notice that Theorem 7 implies immediately the decidability of openness of a morphism between two nite timed transition systems. Next, lookin for the existence of a nite vertex of a span of open maps between two nite timed transition systems, a rst attempt could be to look for a subsystem of their product. Unfortunately this is not enou h in all cases, however we still have the followin theorem. Theorem 8 Given two nite timed transition systems T1 and T2 if there exists (m )
(m
a vertex T such that T1 −−−− T −−−− vertex T
)
(p
R
T2 are open maps then there is a nite p)
and open morphisms T1 −−−− T
(q
R
q)
−−−
T2 .
We prove this by constructin the nite vertex T R . The clocks of T R are the disjoint union of the clocks of the two systems. We will write a clock evaluation 0 ), actin as for the clocks in T and as 0 over this set of clocks as ( otherwise. The states are triples of the form s1 s2 re , where re is a re ion over the new set of clocks. For a reachable con uration s in T , there is a −1 ( )]]XR [[re ]]XR . There state m(s) m0 (s) re in T R , where [[ −1 ( ) is a transition m(s) m0 (s) re R R m(s0 ) m0 (s0 ) re 0 , if there is a run in s0 with clock evaluations and 0 before and T which uses the transition s −1 ( )]]XR [[re ]]XR and after the transition respcetively, such that [[ −1 ( ) −1 0 −1 0 0 −1 −1 ( ) ( )]]XR [[re ]]XR . Here R = ( ) ( ), and R is the [[ −1 00 −1 00 ( ) ( ) belon s, where 00 lo ical expression for the re ion to which is the clock evaluation enablin then transition in T durin the run. Importantly, this construction de nes a system of bounded size in the number of states of T1 and T2 and the number of re ions over the disjoint union of the clocks of the two systems. The morphisms (p p ) and (q q ) are projections which can easily be shown to be morphisms and usin Theorem 7 can be shown to be open. From the proof of Theorem 8, we have the followin corollary.
Corollary 1 For nite timed transition systems timed bisimulation is decidable. 3
The function Reach returns a set of regions reachable from its argument.
386
5
Thomas Hune and Mogens Nielsen
Conclusion
We have shown that the eneral framework of open maps may also be applied to the settin of timed systems, providin a way of expressin a bisimulation purely within the framework of timed transition systems. Furthermore, a decision procedure for bisimulation was presented within this framework. We see our main contribution as extendin the open maps approach to the settin of timed systems. This opens up a number of possibilities of applyin eneral results from the cate orical settin to concrete timed bisimulations, like the one studied here. One particularly interestin example is the characteristic path lo ic obtained from [JNW96]. Properties of this lo ic and its relation to other timed lo ics will be subject to future work. We also propose the span of open maps idea as a useful way of expressin timed bisimulations. On the other hand, we do not claim that our alternative decision procedure as presented here is more e cient than existin ones, e. . [LLW95, WL97]. We have used the same method for timed transition systems extended by invariants on the states [HN98], and the method proved to be robust under this kind of extension.
References [ACM97]
E. Asarin, P. Caspi, and O. Maler. A Kleene theorem for timed automata. Proc. of LICS’97, 1997. [AD90] R. Alur and D.L. Dill. Automata for modelling real-time systems. Proc. of ICALP’90, LNCS 433:pages 322 335, 1990. [AD94] R. Alur and D.L. Dill. A theory of timed automata. Theoret cal Computer Sc ence, 126, 1994. [AH91] R. Alur and T.A. Henzinger. Logics and models for real time: A survey. Real-T me:Theory n Pract ce, LNCS 600:pages 74 106, 1991. [AKLN95] J.H. Andersen, K.J. Kristo ersen, K.G. Larsen, and J. Niedermann. Automatic synthesis of real time systems. Proc. of ICALP’95, LNCS 944:pages 535 546, 1995. [Cer92] K. Cerans. Decidability of bisimulation equivalence for parallel timer processes. Proc. of CAV’92, LNCS 663, 1992. [CN96] A. Cheng and M. Nielsen. Open maps (at) work. Proc. of FST&TCS ’95, LNCS 1026, 1996. [HN98] T. Hune and M. Nielsen. Timed bisimulation and open maps. Technical Report RS-98-4, BRICS, 1998. [JNW96] A. Joyal, M. Nielsen, and G. Winskel. Bisimulation from open maps. Informat on and Computat on, 127,2:pages 164 185, 1996. [KN94] K.J. Kristo ersen and J. Niedermann. User’s manual for Epsilon. Available via anonymous ftp at cs.auc.dk, December 1994. [LLW95] F. Laroussinie, K. G. Larsen, and C. Weise. From timed automata to logic and back. Proc. of MFCS’95, LNCS 969:pages 529 539, 1995. [Mil89] R. Milner. Commun cat on and Concurrency. Prentice Hall International Series in Computer Science, 1989.
Timed Bisimulation and Open Maps [NSY93] [Wan90] [WL97]
387
X. Nicollin, J. Sifakis, and S. Yovine. From ATP to timed graphs and hybrid systems. Acta Informat ca, 30:pages 181 202, 1993. Y. Wang. Real-time behaviour of asynchronous agents. Proc. of CONCUR’90, LNCS 458, 1990. C. Weise and D. Lenzkes. E cient scaling-invariant checking of timed bisimulation. Proc. of STACS’97, LNCS 1200:pages 177 188, 1997.
Deadlockin States in Context-Free Process Al ebra Jir Srba Faculty of Informatics MU, Botanicka 68a, 60200 Brno, Czech Republic srba@f .mun .cz
Abs rac . Recently the class of BPA (or context-free) processes has been intensively studied and bisimilarity and regularity appeared to be decidable (see [CHS95, BCS95, BCS96]). We extend these processes with a deadlocking state into BPA systems. Bosscher has proved that bisimilarity and regularity remain decidable [Bos97]. We generalise his approach introducing strict and nonstrict version of bisimilarity. We show that the BPA class is more expressive w.r.t. (both strict and nonstrict) bisimilarity but it remains language equivalent to BPA. Finally we give a characterization of those BPA processes which can be equivalently (up to bisimilarity) described within the ‘pure’ BPA syntax.
1
Introduction
This paper deals with BPA processes (Basic Process Al ebra) extended with deadlocks. BPA represents the class of processes introduced by Ber stra and Klop (see [BK85]), which corresponds to the transition systems associated with Greibach normal form (GNF) context-free rammars in which only left-most derivations are permitted. For detailed description of the relation between lanua e and process theory we refer to [HM96]. We de ne the class BPA of BPA processes extended with deadlocks and introduce two alternative de nitions strict and nonstrict of bisimilarity within this class. The de nition of BPA systems is based on a special variable (we call it a deadlock). In the usual presentation every variable used in a BPA system is supposed to be de ned but for the deadlock variable we allow no de nition. This causes that if the system reaches a state where the rst variable is , the system sticks at this state and no more actions can be performed. Bosscher has proved in [Bos97] that decidability of bisimilarity and re ularity in BPA systems extends to the BPA systems. The trick used for this extention is based on the idea that can be simulated by an unnormed variable. The main topic this article deals with is the issue of the lan ua e equivalence and of describin BPA in bisimilar BPA syntax. We show in Section 3 that extendin the BPA systems with deadlocks does not yield any lan ua e extension. The author is supported by the Grant Agency of the Czech Republic, grant No. 201/97/0456 Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 388 398, 1998. c Sprin er-Verla Berlin Heidelber 1998
Deadlocking States in Context-Free Process Algebra
389
On the other hand the class of BPA systems is lar er with re ard to bisimilarity. An interestin question explored in this paper (Section 4) is concerned with decidin whether there exists an alternative description of a BPA system in bisimilar BPA syntax. We show that it is decidable for the strict bisimilarity and we nd a nice semantic characterization of the situation in the nonstrict case. Moreover we show that the correspondin BPA syntax can be e ectively constructed. Several proofs in this paper are just sketched and their full version can be obtained in [Srb98].
2
Basic De nitions
When dealin with processes we need some structure to describe their operational semantics. As the most suitable structure transition systems are widely used. We introduce the labelled transition system in the extended version with the set of nal states as can be found e. . in [Mol96]. De nition 1. (labelled transition system) A labelled transition system is a tuple (S Act − 0 F ) where S is a set of states; Act is a set of actions a , for (or labels); − S Act S is a transition relation, written − ( a ) − ; 0 S is the root (or start state) of the transition system; F S is the set of nal states which are terminal: for each F there is no a Act a . and S such that − As usual we extend the transition relation to the elements of Act . We also write w if w Act is irrelevant. − instead of − De nition 2. (lan ua e eneration) Let (S Act − 0 F ) be a labelled transition system and suppose that S. The lan ua e enerated by the state def w 0 0 Act F : − We say that two states is L( ) = w and are lan ua e equivalent, written =L , i L( ) = L( ). Two labelled transition systems are lan ua e equivalent i their roots are lan ua e equivalent.
De nition 3. (bisimilarity) Let (S Act − 0 F ) be a labelled transition system. A binary relation R S S is a bisimulation i whenever ( ) R then for each a Act: if if
States
a
− a − F
0 0
then then F
0 0
S: S:
S are bisimilar (
a
− a −
0 0
( (
), i (
0
0
0
0
)
) )
R R
R for some bisimulation R.
390
Jir Srba
2.1
BPA and BPA Systems
Assume that Var and Act are nite sets of variables and actions such that Var Act = . We de ne the class EBPA of BPA expressions as the union of + , which is de ned by the followin abstract syntax: (empty process) and a set EBPA E ::= a
X
E1 E2
E1 + E2 def
+ Here a ran es over Act and X ran es over Var . We state EBPA = EBPA . We call the BPA expressions as processes and later on we assume xed sets Var and Act if no confusion is caused. As usual, we restrict our attention to uarded expressions: a BPA expression is uarded i every variable occurrence is within the scope of an atomic action.
De nition 4. (BPA system) A BPA system is a quadruple (Var Act X1 ) Xn ) where Var and Act are nite sets of distinct variables (Var = X1 Var is the leadin variable; is a nite set of recursive resp. actions; X1 def + n where each E EBPA is a uarded BPA equations = X = E i = 1 expression with variables drawn from the set Var and actions from Act. Speakin about variables and actions used in the system (Var Act X1 ) we use the notation Var( ) and Act( ) and for shorter referrin to the BPA system we often identify the system (Var Act X1 ) with . Assume that we have a BPA system (Var Act X1 ). This system deter) whose states are BPA mines a labelled transition system (S Act − X1 expressions built over Var and Act, Act is the set of labels, the transition relation is the least relation satisfyin the followin SOS rules, X1 is the root and is the only nal state. a
E0
E−
a
a
a−
E0 F
EF − a
E−
E0
a
E+F −
E0
a
F −
F0
a
E+F −
F0
if E 0 =
a
E−
a
EF − a
F
E−
E0
X−
E0
a
def
if X = E
We now de ne the class BPA of BPA systems with deadlock. The de nition is very similar to the de nition of BPA systems except for a new distinct variable . There is no operational rule for in the BPA systems. X1) De nition 5. (BPA system) A BPA system is a quadruple (Var Act Xn ( is a special variable called deadlock), Act is a where Var = X1 def
nite set of actions and is a nite set of recursive equations = X = E + EBPA is a uarded BPA expression with variables i=1 n where each E drawn from the set Var and actions from Act.
Deadlocking States in Context-Free Process Algebra
391
It is obvious that any BPA system is trivially a BPA system. BPA labelled (strict or nonstrict) transition system is de ned as in the case of BPA systems. If F = is the only nal state we call the labelled transition system strict and + we call it nonstrict. if the nal states are F = E E EBPA This means that the relation of bisimulation di ers for both these approaches. s n Similarly, we call the bisimulation strict resp. nonstrict (and write resp. ) accordin to the type of the labelled transition system we take into account. These n s but . An easy consequence of two notions of bisimilarity imply that s n decidability of bisimilarity in BPA [Bos97] is that both and are decidable. s n Followin lemma results from the de nition of and . Lemma 1. Let X
s
n def
Var. We de ne the norm of X as X = min len th(w)
w
E:X−
def
otherwise. We call the variable X normed E − , if such w exists; or X = i X < . A process is normed i its leadin variable is normed. De nition 6. A BPA (resp. BPA ) system
is said to be in Greibach Normal def
m
Form (GNF) i all its de nin equations are of the form X = j=1 aj j where is m > 0, aj Act( ) and j Var( ) . If len th( j ) < k for each j then said to be in k GNF. Followin theorem justi es the usa e of 3 GNF. Theorem 1. Let be a BPA system. We can e ectively nd a BPA system s n 0 in 3 GNF such that 0 resp. 0 . Proof. The proof is based on the proof of 3 GNF for BPA systems (see e. . [H¨ ut91]), which had to be modi ed to capture the behaviour of deadlocks. In fact we had to use some additional transformations exploitin (from left to ri ht) the rules + E E and E .
3
Expressibility of BPA Systems
In this section we justify the importance of introducin a deadlockin state into the BPA systems. We show that deadlocks enlar e the descriptive power of BPA systems w.r.t. both strict and nonstrict bisimilarity. On the other hand introducin deadlocks does not allow to enerate more lan ua es. Theorem 2. There exists a BPA bisimilar to it.
system such that no BPA system is strictly def
Proof. No BPA system can be strictly bisimilar to the system X = a since is reachable in this system and there is no match for in any BPA system.
392
Jir Srba
Theorem 3. There exists a BPA strictly bisimilar to it.
system such that no BPA system is non-
and show that there is no BPA system 0 Proof. We de ne a BPA system n def 0 such that . Consider = X = aXX + b + c and suppose that there is n
def
0 n , such that . a BPA system 0 in 3 GNF, 0 = Y = E i = 1 Then there are in nitely many states reachable from the leadin variable X of the system . They are of the form X n for n 1 and for each such state there n E. The state X n still must be reachable a state E from 0 such that X n has norm 1 whereas norm 1 for BPA processes implies that it must be a sin le variable. Thus is nonstrictly bisimilar to a system with nitely many reachable states, which is contradiction is a system where in nitely many nonstrictly nonbisimilar states are reachable.
In what follows we show that the classes of BPA and BPA systems are equivalent w.r.t. lan ua e eneration. We will consider just the nonstrict case + ) since it is obvious that the strict case cannot (F = EE EBPA brin any lan ua e extention. De nition 7. We de ne classes of lan ua es enerated by BPA resp. BPA def def systems as followin : L(BPA) = L( ) is a BPA system and L(BPA ) = is a BPA system . L( ) Theorem 4. It holds that L(BPA) = L(BPA ). there exists a BPA system such Proof. We show that for a BPA system that L( ) = L( ). The other direction is obvious. we de ne a couple Our proof will be constructive. For each variable X of new variables X X . The rst one will simulate the lan ua e behaviour of X when reachin the state , the second one will simulate endin in the su x of the form . We use the notation a Y meanin that a is a summand in the be a BPA system in 3 GNF. de nin equation of the variable Y . W.l.o. . let def The variables of the system will be Var( ) = X2Var( δ )−f g X X X1 where X , X are distinct fresh variables and X1 is the leadin variable, . Next we realize that the supposin that X1 was the leadin variable of are exactly of one of summands of the de nin equation for X Var( ) − the followin form (because of 3 GNF): (a) aAB
(b) bC
(c) c
(d) dD
(e) e
(1)
where a b c d e Act( ) and A B C D Var( ) such that A B C D = . Notice that we can suppose that there is no summand of the form a A because it can be replaced with a . and for We now de ne the variables from . For each X Var( ) − the summands of the variables X and X will hold:
Deadlocking States in Context-Free Process Algebra
if aAB if bC if c if dD if e
X X X X X
then aA B then bC then c then then
def
X X X
and aA B + aA and bC
X X
dD + dD
X X
e
def
393
def
if X1 = E and X1 = F then X1 = E + F If it is the case that there is a variable Y
Var( ) such that Y does not have
def
any summand we de ne Y = aY . (This variable cannot enerate any nonempty lan ua e because it is unnormed). Finally we state X1 to be the leadin variable of the system . def
def
= X = aXX + b + c + bY Y = Example 1. Let us have a BPA system b The correspondin lan ua e equivalent BPA system looks as followin : def
= X = aX X + b + bY aY
X
def
X = aX X + aX + c + bY
Y
def
= b Y
def
=
def
= aX X + b + bY + aX X + aX + c + bY
It is not di cult to see that the newly de ned system is in 3 GNF and we show that L( ) = L( ). For this we need one lemma usin followin notation. De nition 8. Let 0 be a BPA (resp. BPA ) system in 3 GNF, n Y Var( 0 ). We de ne Ln (Y ) and Ln (Y ) as followin : Ln (Y ) = w
def
Act(
0
Ln (Y ) = w
def
Act(
0
)
w
Y −
)
Lemma 2. For all n 1 and X and Ln (X) = Ln (X ).
len th(w) Var( Var(
1 and
n
0
w
)−
holds that Ln (X) = Ln (X )
) :Y −
len th(w)
n
Proof. The proof is led by induction on n, followin the subcases from (1). def
To nish the proof of our theorem let us de ne for n 1 the set Ln (Y ) = w L(Y ) len th(w) n . Notice that because of the Lemma 2 we et Ln (X1 ) = Ln (X1 ) Ln (X1 ) = Ln (X1 ) Ln (X1 ) = Ln (X1 ) for all n 1. Now it is clear that L(X1 ) = L(X1 ) since if w L(X1 ) then n : w Ln (X1 ) L(X1 ). The other direction is and so w Ln (X1 ) which implies that w similar. We have shown that L( ) = L( ) and our proof is complete.
4
Describin BPA in BPA Syntax
We have shown that w.r.t. bisimilarity the class of BPA systems is strictly lar er than that of BPA . This challen es the question whether a iven BPA system can be equivalently described in BPA syntax.
394
Jir Srba
Theorem 5. Let (Var Act X1 ) be a BPA system. It is decidable whether s 0 0 there exists a BPA system such that . Moreover if the answer is 0 can be e ectively constructed. positive, the system s
. Suppose w.l.o. . Proof. The proof is standard and is based on the fact that that the system is in 3 GNF. The notation E means a ain that is a summand in the expression E. We will construct the sets M0 M1 def and is reachable as followin : M0 = def X Var a Act Y M +1 = M E aZY E (a Y Z E and Y
of variables from which the deadlock for i 0 the sets M +1 are de ned as def Var Z M : (X = E) aZ < ) .
We remind that the norm of a variable can be e ectively computed. Let us denote the xed point of this construction as M . We can see that for each for some Var i X M . If X1 M then cannot X Var: X − be expressed by a BPA syntax since the deadlockin state is reachable from X1 . If X1 M we can naturally transform into a BPA system. The situation for the nonstrict case will be nicely characterised by the Corollary 1. In what follows, the set of variables from which a deadlockin state is reachable will be of reat importance. Hence we de ne the set Var of such varidef + or E EBPA :X − E − and ables: Var = X Var X − def
− Var The sets Var and Var can be e ectively we state Var = Var − constructed as we have demonstrated in the proof of the Theorem 5. In what follows let the variables U V X Y Z ran e over Var and A B C over Var . Theorem 6. Let (Var Act X1 ) be a BPA system in 3 GNF. Suppose that there are only nitely many pairwise nonstrictly nonbisimilar Y Var Var 0 0 0 such that X1 − Y . Then there exists a BPA system (Var Act X10 ) such n 0 . that Var . Then the system can be trivially Proof. Let us suppose that X1 transformed into bisimilar BPA system 0 . Thus assume that X1 Var . We may suppose w.l.o. . that each summand of every de nin equation in does not contain an unnormed variable (resp. ) followed by another variable. We Var . These functions take an expression from de ne functions f for each + EBPA in 3 GNF and transform it into another expression. Our oal is followin . n E and there should be no deadlock in f (E). We want to achieve f (E) For each Var let us also de ne a function r which returns the set of the Var , new variables added by the function f . Let us assume that X Y U Var such that < and γ Var . A B C Var with C = ,
Deadlocking States in Context-Free Process Algebra n
f (
n
a =1
f f f f f
(aXY ) (aX ) (a ) (aX) (aAB)
f (a)
f (aA ) f (aA)
f (aXA) f (aAX)
)=
n
f (a
)
r (
=1
n
a
)=
=1
= aX Y = aX =a = aX = aAB U γ = aAB C = aAB = a Uγ =a C =a = aA = aA U γ = aA C = aA = aX A = aAX
r r r r r
395
r (a
)
=1
(aXY ) (aX ) (a ) (aX) (aAB)
r (a)
r (aA ) r (aA)
r (aXA) r (aAX)
= = = = = = = = = = = = = = = =
XY X X Uγ Uγ
Uγ XA X
if = U γ if = Cγ otherwise if = U γ if = Cγ otherwise if = U γ if = Cγ otherwise
def
Let us now construct the nonstrictly bisimilar BPA system 0 where Var 0 = def def def Added; Act0 = Act; 0 = Γ ; X10 = X1 . The sets Added and Γ Var contains exactly the de nin are outputs of the followin al orithm and equations for variables from Var . Al orithm 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Solve:= X1 Added:= X1 Γ := while Solve =
do
Let us x X
def
Solve with (X = E) def
Γ := Γ X = f (E) n r (E) Z Added : Y Z Add:= Y n Add : Y = Z Y Z while Y Z Add:= Add − Y endwhile Solve:= (Solve − X ) Add Added:= Added Add r (E) − Add do for Y replace all occurences of Y in Γ with Z n where Z Added : Y Z endfor endwhile
do
In the followin lemmas we demonstrate that the al orithm is correct and yields n 0 . a BPA system 0 such that
396
Jir Srba
Lemma 3. For the loop 4 17 of Al .1 holds the followin invariant: Y n Y Z . Added : Y = Z
Z
Proof. An easy observation. Added then
Lemma 4. Whenever durin the execution of Al .1 we have Y Y Var .
Proof. All variables in Added had to be produced by the function r (see line 7 r (E) Var for any Var and and 12). It is easily seen that Y Y + E EBPA such that E is in 3 GNF. Added then
Lemma 5. Whenever durin the execution of Al .1 we have Y X1 − Y .
Proof. By induction on the number of repetitions of the loop 4 17. Basic step: The only variable in the set Added before the execution of the loop 4 17 started is X1 . However X1 = X1 and so X1 − X1 . Induction step: Suppose that at line 12 we have added a new variable Y into Added. So at line 7 we had to have Y r (E) for some X Solve def
. The induction hypothesis says that X1 − X (X had and (X = E) to be added in some previous repetition of the main loop). It must hold that f (E) where γ Var and γ < . From the construction of f we aγY can also see that X − Y . Thus we et X1 − X − Y . Lemma 6. Al .1 cannot loop forever (under the assumption of the Theorem 6). Proof. Suppose that the al orithm loops forever which means that the set Solve is never empty. But in every loop we remove exactly one element from the set Solve (line 11). This implies that the set Added will row arbitrarily because the set Add is in nitely often unempty (otherwise the al orithm would stop). The contradiction is immediate from the Lemmas 3, 4 and 5. The followin lemma is crucial for the proof of our theorem. Lemma 7. After the execution of Al .1 we have V
n
V
for all V
Added.
Proof. We use the strati ed bisimulation relations [Mil89] k . By induction on n k we show that V for all k 0. This implies that V V . This k V strai htforward but also lon and technical proof can be found in [Srb98]. Lemma 8. The system
0
is a BPA system and moreover X1
Proof. Immediately from the Lemma 7. We have constructed a BPA system
0
such that
n
0
.
n
X1 .
Deadlocking States in Context-Free Process Algebra
397
Theorem 7. Let (Var Act X1 ) be a BPA system. Suppose that there are in nitely many pairwise nonstrictly nonbisimilar Y Var Var such that n 0 . X1 − Y . Then there is no BPA system 0 such that n
implies = Let us assume Proof. The proof is based on the fact that n 0 . We show that this w.l.o. . that there exists 0 in 3 GNF such that is not possible. Since there are in nitely many reachable states Y1 1 Y2 2 of which are pairwise nonstrictly nonbisimilar there must be correspondin n of the system 0 such that Y for i = 1 2 . Let us states 1 2 def i = 1 2 where now de ne a constant Nmax as Nmax = max Y def
w
w
+ or E EBPA :Y − E . Notice that the Y = min len th(w) Y − (because Y Var ) and de nition of Nmax is correct since for all i Y < there are only nitely many di erent Y 0 s. Nmax for all i. This implies that the norm of is also less Clearly Y or equal Nmax for all i. However, 0 is a BPA system and all variables in 0 are uarded. This means that there are only nitely many di erent states of 0 such that their norm is less or equal Nmax . Hence there must be two states k and l n n with k = l such that k = l . This implies that k Yl l , l . Then also Yk k which is contradiction.
Suppose that we have a BPA system and that there are in nitely many nonbisimilar states from which, after some ‘short’ sequence of actions, a deadlockin state is reachable. Then the correspondin (nonstrictly bisimilar) BPA system does not exists. This condition appears to be both necessary and su cient as is illustrated by the followin corollary. Corollary 1. Let (Var Act X1 ) be a BPA system. There are only nitely many pairwise nonstrictly nonbisimilar Y Var Var such that X1 − Y n 0 0 . if and only if there exists a BPA system (Var Act0 0 X10 ) such that Proof. An immediate consequence of the Theorems 6 and 7.
5
Conclusion Remarks
In this paper we have focused on the class of BPA processes extended with deadlocks. We have shown that for lan ua e equivalence the extention is no acquisition. On the other hand the BPA class is lar er with re ard to the relation of bisimulation. We introduce two notions of bisimilarity to capture the di erent understandin of deadlock behaviour. If we do not distin uish between and , we speak about nonstrict bisimilarity and if we do, we call the appropriate bisimulation as strict. We have solved the question whether, iven a BPA system , there is an equivalent description (with re ard to bisimilarity) of in terms of BPA syntax. The solution for the strict bisimilarity is strai htforward. However, the answer to the problem dealin with the nonstrict bisimilarity exploited a nice semantic characterization of the subclass of BPA processes bisimilarly
398
Jir Srba
describable in BPA syntax: a BPA system can be transformed into a BPA system (preservin nonstrict bisimilarity) if and only if nitely many nonbisimilar states startin with some in -endin variable are reachable. There is still an open problem whether this semantic characterization is syntactically checkable. Acknowled ements: First of all, I would like to thank Ivana Cerna for her help and encoura ement throu hout the work. I am very rateful for her advise and valuable discussions. My warm thanks o also to Mojm r Kret nsky and Anton n Kucera for their constant support and comments.
References [BCS95] O. Burkart, D. Caucal, and B. Ste en. An elementary decision procedure for arbitrary context-free processes. In Proceedin s of MFCS’95, volume 969 of LNCS, pages 423 433, 1995. [BCS96] O. Burkart, D. Caucal, and B. Ste en. Bisimulation collapse and the process taxonomy. In Proceedin s of CONCUR’96 [Con96], pages 247 262. [BK85] J.A. Bergstra and J.W. Klop. Algebra of communicating processes with abstraction. Theoretical Computer Science, 37:77 121, 1985. [Bos97] D. Bosscher. Grammars Modulo Bisimulation. PhD thesis, CWI, University of Amsterdam, 1997. [CHS95] S. Christensen, H. H¨ uttel, and C. Stirling. Bisimulation equivalence is decidable for all context-free processes. Information and Computation, 121:143 148, 1995. [Con96] Proceedin s of CONCUR’96, volume 1119 of LNCS. Springer-Verlag, 1996. [HM96] Y. Hirshfeld and F. Moller. Decidability results in automata and process theory. In Lo ics for Concurrency: Automata vs Structure, volume 1043 of LNCS, pages 102 148. Faron Moller and Graham Birtwistle, 1996. [H¨ ut91] H. H¨ uttel. Decidability, Behavioural Equivalences and In nite Transition Graphs. PhD thesis, The University of Edinburgh, 1991. [Mil89] R. Milner. Communication and Concurrency. Prentice-Hall, 1989. [Mol96] F. Moller. In nite results. In Proceedin s of CONCUR’96 [Con96], pages 195 216. [Srb98] Jir Srba. Comparing the classes BPA and BPA with deadlocks. Technical Report FIMU-RS-98-05, Faculty of Informatics, Masaryk University, 1998.
A Superpolynomial Lower Bound for a Circuit Computin the Clique Function with At Most (1 6) lo lo n Ne ation Gates Kazuyuki Amano and Akira Maruoka Graduate School of Information Sciences, Tohoku University, Sendai, 980-8579 JAPAN ama|maruoka @ece .tohoku.ac.jp
Abs rac . We investi ate about a lower bound on the size of a Boolean circuit that computes the clique function with a limited number of ne ation ates. To derive stron lower bounds on the size of such a circuit we develop a new approach by combinin the three approaches: the restriction applied for constant depth circuits[Has], the approximation method applied for monotone circuits[Raz2] and boundary coverin developed in the present paper. Based on the approach the followin statement is established: If a circuit C with at most (1 6) lo lo m ne ation ates 1 2 detects cliques of size (lo m)3(log m) in a raph with m vertices, then (log m)1 2
C contains at least 2(1 5)(log m) ates. In addition, we present a eneral relationship between ne ation-limited circuit size and monotone circuit size of an arbitrary monotone function.
1
Introduction
Recently there has been substantial pro ress in obtainin stron lower bounds for restricted Boolean circuits that compute some function, in particular for those circuit models such as constant depth circuits or monotone circuits. Exponential lower bounds are derived for the size of constant depth circuits computin the parity function[Has] and for the size of monotone circuits computin the clique function[Raz],[AB],[AM]. It is natural to ask if we could make use of the approaches developed to obtain these bounds so as to derive stron lower bounds for more eneralized model. As such a eneralized model, we consider circuits with a limited number of ne ation ates. In fact, it remains open so far to derive non-trivial lower bounds on the size of a circuit computin some monotone function with, say, a constant number of ne ation ates[SW]. Fischer[Fis] showed that for any function f , the size of the smallest circuit computin f with an arbitrary number of NOT ates and the one with at most lo (n + 1) NOT ates are polynomially related(See also [BNT]). So if one can prove superpolynomial lower bounds on the size of circuits with at most lo (n + 1) NOT ates computin some problem in NP, then we have that P=NP. So we try to obtain superpolynomial lower bounds on the size of circuits, with O(lo lo n) NOT ates rather than O(lo n) NOT ates, computin some problem in NP. More Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 399 408, 1998. c Sprin er-Verla Berlin Heidelber 1998
400
Kazuyuki Amano and Akira Maruoka
precisely we prove the followin : If a circuit C with at most (1 6) lo lo m 1 2 in a raph with m vertices, NOT ates detects cliques of size (lo m)3(lo m) (log m)1 2
ates (Theorem 8). The problem of then C contains at least 2(1 5)(lo m) detectin a clique in a raph with m vertices will be written as a Boolean func variables. In addition, we present a eneral relationship between tion of n = m 2 ne ation-limited circuit size and monotone circuit size of an arbitrary monotone function (Theorem 2). To achieve the main results, we develop a new approach by combinin the three approaches: the restriction applied for constant depth circuits[Has], the approximation method applied for monotone circuits[Raz] and boundary coverin developed in the present paper. A Boolean function f can be viewed as dividin the Boolean cube into two re ions: The one is written as v 0 1 n f (v) = 1 n f (v) = 0 . So we can think of the boundary beand the other as v 0 1 tween the two re ions, which is de ned as the collection of pairs of vectors (w w0 ) such that f (w) = f (w0 ) and the Hammin distance between w and w0 is 1. The idea of the proof of the main theorem is as follows. Firstly, we verify in Section 3 a theorem that says the problem of provin lower bounds on the ne ation-limited circuit size of a monotone function f can be reduced to the one of provin lower bounds on the maximum of monotone circuit sizes of monotone functions such that the union of boundaries of the latter monotone functions covers the boundary of the former monotone function f . Secondly, we analyze carefully in Section 4 the proof due to Amano and Maruoka[AM] for an exponential lower bound on the monotone circuit size of the clique function, and verify a statement that we still need superpolynomial number of ates in a monotone circuit that computes even a certain small fraction of the boundary of the clique function (Theorem 3). Finally, we verify in Section 5 a statement (Theorem 8) that, no matter what collection of monotone functions we take to cover the boundary of the clique function, the lar est fraction of the boundary covered by some monotone function in the collection is more than what is needed to apply the result (Theorem 3) in the second part. This is the most di cult part of the proof. Throu hout this paper, the function lo x denotes lo arithm base 2 of x.
2
Preliminaries
For w in 0 1 n, let wi denote the value of the ith bit of w. Let w and w0 be in 0 1 n. We denote w w0 if wi wi0 for all 1 i n, and w < w0 if w w0 and w = w0 . Let Ham(w w0 ) denote the Hammin distance between w and w0 , 1 n wi = wi0 , where S denotes the written as, Ham(w w0 ) = i size of set S. A Boolean circuit is a directed acyclic raph with ate nodes (or, simply ates) and input nodes. Operation AND or OR is associated with each ate whose in-de ree is 2, whereas NOT is associated with each ate whose in-de ree is 1. A Boolean variable or a constant, namely, 0 or 1, is associated with each input node whose in-de ree is 0. In particular, a circuit with no NOT ates is called monotone. A Boolean function of n variables is called monotone if f (w) f (w0 )
A Superpolynomial Lower Bound for a Circuit
401
holds for any w w0 0 1 n such that w w0 . Let Mn denote the set of all monotone functions of n variables. The size of a circuit C, denoted size(C), is the number of ates in the circuit C. The circuit complexity (respectively, monotone circuit complexity) of a function f , denoted size(f ) (respectively, sizemon (f )), is the size of the smallest circuit (respectively, monotone circuit) computin f . For a function f and a positive inte er t, the circuit complexity with t limited ne ation (ne ation limited complexity, for short) of a function f , denoted sizet (f ), is the size of the smallest circuit C that computes f and includes at most t NOT ates. If the function f cannot be computed with only t NOT ates, then sizet (f ) is unde ned. Let C (w) denote the output of the ate in circuit C that has as input w. We say a ate in C separates a pair of vectors (w w0 ) (or simply, a ate separates (w w0 ) when no confusion arises) if C (w) = 0, C (w0 ) = 1 and Ham(w w0 ) = 1. In particular, when is taken to be the output ate in circuit C, we simply say that the circuit C separates such a pair (w w0 ). Similarly, when a circuit separates a pair we say the function computed by the circuit separates the pair. Althou h we can eneralize the notion of separation by droppin the condition that the Hammin distance between vectors bein 1, we don’t need such eneralization for the purpose of our ar ument.
3
Relatin Ne ation Limited and Monotone Circuit Complexity
In this section, we establish a relationship between ne ation-limited complexity and monotone circuit complexity for a monotone Boolean function. De nition 1 Let f be a Boolean function of n variables. A sensitive raph of f , denoted G(f ), is de ned as follows: G(f ) = (V E) is a directed raph with V = 0 1 n and E = (w w0 ) Ham(w w0 ) = 1 f (w) = 0 and f (w0 ) = 1 . So a sensitive raph of f is a raph whose ed e set consists of pairs that are separated by the function f . Let G1 and G2 be two raphs on the same set V of vertices, that is, G1 = (V E1 ) and G2 = (V E2 ). Then the union G1 G2 is de ned to be the raph (V E1 E2 ). Furthermore we say G1 contains G2 if E1 E2 holds, which is denoted by G1 G2 . Theorem 2. Let f be a monotone function of n variables. For any positive inte er t, ) ( [ 0 0 min sizemon (f ) G(f ) G(f ) max sizet (f ) 0 0 0 n F =ff1
where
=2
t+1
f gM
f 2F
f 0 2F 0
− 1.
This theorem shows that the problem of derivin lower bounds on the ne ationlimited circuit complexity of a monotone function can be reduced to the one of derivin the maximum lower bound for monotone circuit complexity amon monotone functions whose sensitive raphs cover that of the ori inal function.
402
Kazuyuki Amano and Akira Maruoka
Note that the set of all variables F 0 = x1 xn satis es the condition 0 0 0 G(f ) G(f ) for any monotone function f . Hence, if n, that is, f 2F t lo (n + 1) − 1, the ri ht-hand side of the inequality in Theorem 2 does not ive any non-trivial lower bound. Proof (of Theorem 2). Let f be a monotone function of n variables. Let C denote the circuit of the smallest size that computes f usin no more than t NOT ates. That is, size(C) =sizet (f ). Just for simplicity of notation, we assume the number of NOT ates in C is iven by t. Furthermore, without loss of enerality we assume that the output ate of C is not a NOT ate. Let 1 t be a list of NOT ates of C arran ed in topolo ical order. For 0 i t and u = ui ) 0 1 i, let Cu denote the subcircuit of C obtained by restrictin (u1 the output of the NOT ates j to constant uj for 1 j i and makin the input to i+1 in C the output of entire circuit Cu , where t+1 is supposed to denote the output ate of the entire circuit C. In particular, for the empty sequence , C denote the circuit obtained by makin the input to 1 in C the output of 0 1 n 0 1 n entire circuit C . Then it is easy to see that, for any (w w0 ) i separated by circuit C, there exists 0 i t and u 0 1 such that the circuit Cu separates the (w w0 ) or (w0 w). This is because as such an i we can simply take i such that i+1 is the rst ate in the sequence ( 1 t+1 ) such j i. The that C i+1 (w) = C i+1 (w0 ), and put uj = j (w)(= j (w0 )) for 1 for u 0 1 such that u t is iven number of the circuits represented as C u Pt by j=1 2j + 1 = 2t+1 − 1 = . Hence, denotin by fj ’s functions computed f . Thus, since by circuit Cu ’s, we have f 0 2F 0 G(f 0 ) G(f ) for F 0 = f1 sizet (f )(= size(C)) sizemon (f 0 ) for any f 0 F 0 , the proof is completed.
4
Hardness of Approximatin Clique Function
The clique function, denoted CLIQUE(m s), of m(m − 1) 2 variables xi j 1 i < j m is de ned to take the value 1 if and only if the undirected raph on m vertices represented in the obvious way by the input contains a clique of size s. A raph on m vertices is called ood if, for some positive inte er s2 , it corresponds to a clique on some set of s2 vertices, and havin no other ed es. Let I(m s2 ) denote the set of such ood raphs. A raph on m vertices is called bad if, for some positive inte er s1 , there exists a partition of the vertices into m mod (s1 − 1) sets of size m (s1 − 1) and s1 − 1 − (m mod (s1 − 1)) sets of size m (s1 − 1) such that any two vertices chosen from di erent sets have an ed e between them, and no other ed es exist. Let O(m s1 ) denote the set of such bad raphs. For 1 s1 s2 m, let F (m s1 s2 ) denote the set of all monotone functions f of m 2 variables representin a raph G on m vertices such that function f takes the value 0 if G contains no clique of size s1 , the value 1 if G contains a clique of size s2 , and an arbitrary value otherwise. For any function f in F (m s1 s2 ), the value of f is 1 for any ood raph in I(m s2 ) , and is 0 for any
A Superpolynomial Lower Bound for a Circuit
403
bad raph in O(m s1 ). The followin theorem will be needed in the next section to prove the main theorem. s1 s2 and Theorem . Let s1 and s2 be positive inte ers such that 64 1 3 m 200. Suppose that C is a monotone circuit and that the fraction s 1 s2 of ood raphs in I(m s2 ) such that C outputs 1 is at least h = h(s2 ). Then at least one of the followin s holds: (i) The number of ates in C is at least 1 3 (h 2)2s1 4 , (ii)The fraction of bad raphs in O(m s1 ) such that C outputs 0 is 1 3 at most 2 s1 . The proof of Theorem 3 is done by usin the same ar ument as in the proof of Theorem 1 in [AM]. In [AM], Amano and Maruoka presented a simpli ed proof of an exponential lower bound on the monotone complexity of the clique function based on the Razborov’s approximation method. The key of the proof is to de ne the approximate operations (which approximates an OR ate) and (which approximates an AND ate) in terms of DNF and CNF formulas such that the size of terms and clauses in the formulas is limited appropriately. For the purpose of the ar ument of the current paper, adopt the same de nition for the approximate operations as in [AM] except for the values of the parameters l and r in their de nitions, and follow their ar uments to obtain Theorem 3. See [AM] for the detail. 1 3 1 3 Choose l = s1 4 and r = 30s1 . Put w = m mod (s1 − 1). By the analo ous ar ument to the proof of Theorem 1 in [AM], we can et Fact 4 I(m s2 ) = (m!) (s2 !(m − s2 )!) and O(m s1 ) =
( m (s1 − 1)
!)w (
m! m (s1 − 1) !)s1 −1−w w!(s1 − 1 − w)!
Lemma 5 Let C be a monotone circuit. An approximator circuit C (i.e., C is ates, a circuit obtained by replacin every OR and AND ates in C by and respectively) outputs identically 0 or the fraction of bad raphs in O(m s1 ) such 1 3 that C outputs 1 is at least 1 − s1 . Proof. Replace the formula in the proof of Lemma 1 in [AM] with Ql−1 1 3 k=1 (1 − (k m (s1 − 1) ) m) > 1 − s1 . The rest of the proof is analo ous to that of Lemma 1 in [AM] ates Lemma 6 The number of bad raphs in O(m s1 ) for which the OR and ate produces produce di erent outputs (the OR ate produces 0, whereas the 1) is at most 1 6 (m s1 )r+1 (m − r − 1)! ( m (s1 − 1) !)w ( m (s1 − 1) !)s1 −1−w w!(s1 − 1 − w)! Proof. Replace the formula in the middle of the proof of Lemma 2 in [AM] with p 1 6 (l(l − 1) 2)(m (s1 − 1)) + (l(l − 1) 2)(2m2 (s1 − 1)) < m s1 . The rest of the proof is analo ous to that of Lemma 2 in [AM].
404
Kazuyuki Amano and Akira Maruoka
Lemma 7 The number of ood raphs in I(m s2 ) for which the AND and ate ates produce di erent outputs (the AND ate produces 1, whereas the produces 0) is at most ((2rs2 )l+1 (m − l − 1)!) (s2 !(m − s2 )!) Proof. Replace p the formula in the middle of the proof of Lemma 3 in [AM] with r(s2 − 1) + (r(r − 1) 2)s2 (s2 − 1) < 2rs2 . The rest of the proof is analo ous to that of Lemma 3 in [AM]. Proof (of Theorem 3). Let C be a monotone circuit such that Prv2I(m s2 ) [C(v) = 1 3
1] h(s2 ) and Pru2O(m s1 ) [C(u) = 0] > 2 s1 hold. To prove the theorem, we show that the circuit C must satisfy the condition (i) in Theorem 3. From Lemma 5, the approximator circuit C satis es Prv2I(m s2 ) [C(v) = C(v)] h(s2 ) 1 3
or Pru2O(m s1 ) [C(u) = C(u)] > 1 s1 . Thus in view of Fact 4, Lemmas 5, 6 and 7, the size of C is at least ! h(s2 )m! m! 1 min (1) 2 (2rs2 )l+1 (m − l − 1)! s1 3 (m s1 6 )r+1 (m − r − 1)! 1 1 The coe cient 1 2 here is caused by takin into account the extra restriction of the and alternation mentioned in [AM]. An elementary calculation completes the proof.
5
Proof of the Main Theorem
The oal of this section is to prove Theorem 8, which says that (1 6) lo lo m NOT ates are not enou h to compute the clique function feasibly. We don’t intend here to optimize the constant 1 6 in the number of NOT ates. Theorem 8. For any su ciently lar e inte er m, sizeb(1
6) lo lo mc (CLIQUE(m
(lo m)3(lo
m)1
2
)) > 2(1
1 2
5)(lo m)(log m)
Before proceedin to the proof, we describe an idea of the proof. Let f be CLIQUE(m s). Suppose to the contrary that a small circuit C with t NOT ates computes f . By Theorem 2, there are 2t+1 − 1(= ) monotone f such that each of them has small monotone complexity and functions f1 G(f ). Let l0 < l1 < < l be some monotone increasthat i2f1 g G(fi ) , a raph v is called ood in sequence with l0 = s and l = m. For 1 i in the i-th layer if v consists of a clique of size li−1 , and has no other ed es. For 1 i , a raph u is called bad in the i-th layer if there exists a partition of some li vertices into s − 1 sets with equal size such that any two vertices chosen from di erent sets have an ed e between them, and no other ed es exist. In other words, a bad raph in the i-th layer is a (s − 1)-partite complete raph on some subset of vertices with size li . Note that for any ood raph v in the rst layer, since deletin an ed e from v breaks the clique in v, an ed e endin at v is in G(f ). For any bad raph u in any layer, since addin an appropriate ed e to u produces a clique with size s, an ed e startin at u is in G(f ).
A Superpolynomial Lower Bound for a Circuit
405
Since i2f1 G(f ), there exists a function f 0 in f1 f such g G(fi ) that G(f 0 ) contains at least 1 fraction of ed es of G(f ) endin at ood raphs in the rst layer, and hence f 0 outputs 1 on at least 1 fraction of ood raphs in the rst layer. W.l.o. ., let the function f 0 be denoted by f1 . Since Theorem 3 says that a small monotone circuit can not separate not small number of ood raphs in the rst layer from not small number of bad raphs in the same layer, there are not small number of bad raphs u in the rst layer on which the function f1 takes the value 1. But since by addin an ed e appropriately to such a u we et a raph u+ which contains a clique of size s. Hence there are many ed es, denoted (u u+ ), that are not included in the ed es in G(f1 ). G(f ), there exists a function f 00 in f2 f such Since i2f1 g G(fi ) 00 that G(f ) contains at least 1 fraction of such ed es (u u+ ). W.l.o. ., let the function f 00 be denoted by f2 . On the other hands, since f2 is monotone, f2 takes the value 1 on the ood raph v in the second layer such that u+ v and that f2 (u+ ) = 1. Applyin Theorem 3 a ain, we can conclude that f2 outputs 1 for not too small fraction of bad raphs in the second layer. It can be shown that f1 also outputs 1 for such bad raphs. f By continuin above ar ument, we can conclude that every functions f1 outputs 1 on some bad raph u in the last layer, contradictin the fact that G(f ). This is an outline of the proof. i2f1 g G(fi ) Proof (of
Theorem
8).
Let
m
be
a
3(lo m)1
2
su ciently
lar e
inte er. 1 2
(1 5)(lo m)(log m)
, M = 2 and Put t = (1 6) lo lo m , s = (lo m) = 2t+1 − 1. We suppose to the contrary that a circuit C with at most t NOT ates computes CLIQUE(m s) and that size(C) M . From Theorem 2, there f Mn such that sizemon (fi ) M for any exist monotone functions f1 G(f ) G(CLIQUE(m s)). 1 i , and i2f1 i g 1 6
− 1, let lj = m1 10+(1 3)(j−1) (lo m) . Let l0 = s, l = m and for every j = 1 1 10+(1 3)(2(1 6) log log m+1 ) (lo m)1 6 = m1 10+2 3 < m9 10 , we have Since l −1 m < l . Let V be a set of m vertices of the raph associated with l 0 < l1 < V L = lj and let Lj (L) CLIQUE. For j 0 , let Lj denote L L L0 Lj . For i 1 and Li Li , a raph v is denote L0 called ood on the set Li in the i-th layer if it corresponds to a clique of size Li−1 (Li ) (i.e., Li−1 = li−1 and Li−1 Li ), havin no li−1 on some Li−1 other ed es. For i 1 and Li Li , a raph u is called bad on the set Vs−1 such that Li in the i-th layer if there exists a partition of Li into V1 Li (s − 1) Li (s − 1) for i = 1 s − 1, and (ii) a raph u (i) Vi has an ed e (w w0 ) i w Vi and w0 Vj such that i = j. Let ILi (respectively, OLi ) denote the set of all ood (respectively, bad) raphs on the set Li in the i-th layer. Note that a ood raph in the rst layer (respectively, a bad raph in the last layer) is a minterm (respectively, a maxterm) of CLIQUE(m s). We also note that there are one to one correspondin between ILi and I(li li−1 ), and that between OLi and O(li s), where I(li li−1 ) and O(li s) are de ned in Section 4, and hence separatin ILi and OLi is equiv-
406
Kazuyuki Amano and Akira Maruoka
alent to computin a function in F (li s li−1 ). Since s1 3 li−1 followin claim is strai htforward from Theorem 3.
li 200 holds, the
Claim 9 Let i 1 and Li Li . Suppose that C is a monotone circuit and the fraction of ood raphs in ILi such that C outputs 1 is at least h. Then at least one of the followin s holds: (i) The number of ates in C is at least 1 3 4 , (ii)The fraction of bad raphs in OLi such that C outputs 0 is at (h 2)2s 1 3 most 2 s . Proof (of Theorem 8 (continued)). For L V , let vL denote a raph correspondin to a clique on the set L, havin no other ed es. Recall that L0 = L L0 , there exists u < vL0 such that the ed e V L = s . Thus for any L0 such that (u vL0 ) is in G(CLIQUE(m s)). Hence there exists i1 in 1 1 > 1 2t+1 holds, and this implies PrL0 2L0 [ u < vL0 (u vL0 ) G(fi1 )] PrL0 2L0 [fi1 (vL0 ) = 1] 1 2t+1 . Then it is easy tosee that 1 1 (2) Pr Pr [fi1 (v) = 1] t+2 t+2 L1 2L1 v2IL1 2 2 L1 dense if Prv2IL1 [fi1 (v) = 1] 1 2t+2 holds. Put h = Now we call a L1 t+2 1 2 . An easy calculation shows h 1 m. Thus by applyin Claim 9 to every 1 3
(log m)1 2
−lo m−1 > dense L1 , we have sizemon (fi1 ) (1 2m)2s 4 = 2(1 4)(lo m) 1 3 1 2 for any dense L1 . Since the former M or Pru2OL1 [fi1 (u) = 1] 1 − 2 s M , we have Pru2OL1 [fi1 (u) = 1] contradicts the assumption sizemon (fi1 ) 1 2 for any dense L1 . By (2), we have 1 1 (3) Pr Pr [fi1 (u) = 1] t+2 L1 2L1 u2OL1 2 2 The proof is done by induction on a level of the layers. We use (3) as the induction basis and the induction step is as follows. For a proof of this claim, see the appendix.
fc3 be the monoClaim 10 Suppose c1 > 1 and c2 > 1. Put c3 = . Let f1 tone functions such that i2f1 c3 g G(fi ) G(CLIQUE(m s)) and sizemon (fi ) i1 ik 1 c3 M for any 1 i c3 . Suppose that for distinct indices = fik (u) = 1] 1 c1 1 c2 . If c1 c2 c3 s1 3 8, PrLk 2Lk Pru2OLk [fi1 (u) = 1 c3 i1 ik such that then there exists ik+1 1 1 = fik (u) = fik+1 (u) = 1 fi1 (u) = Pr Pr Lk+1 2Lk+1 u2OLk+1 4c1 c2 c3 2c2 c3 Proof (of Theorem 8 (continued)). First we claim that for any k 1 , i 1 such that there are k distinct indices i 1 k 1 1 = fik (u) = 1] (4) Pr Pr [fi1 (u) = 2 (t+2) k k(t+2) Lk 2Lk u2OLk 2 2 holds. The claim is proved by induction on k. The basis, k = 1, is trivial from (3). Now we suppose the claim holds for any k l and let k = l + 1. By the induction hypothesis, we have
A Superpolynomial Lower Bound for a Circuit
Pr
Pr [fi1 (u) =
Ll 2Ll
u2OLl
1
= fil (u) = 1]
2l2 (t+2)
407
1 2l(t+2)
2
Puttin c1 = 2l (t+2) , c2 = 2l(t+2) and c3 = , we have 4c1 c2 c3 2 2 2(l+1) (t+2) , 2c2 c3 21+l(t+2)+t+1 = 2(l+1)(t+2) and 22+l (t+2)+l(t+2)+(t+1) c 1 c2 c3 2 t+1 2 3t (1 2) log log m 2(l+1) (t+2) 4 2(2 ) (t+2) 4 22 8 22 8 = 2 lo m 8 < (lo m)
1 3 8. Thus by Claim 10, 8=s = fil+1 (u) = 1 fi1 (u) = Pr
lo m
Pr
Ll+1 2Ll+1 u2OLl+1
holds. Therefore Pr fi1 (u) = Pr
1 4c1 c2 c3 1
1 2c2 c3
1 Ll+1 2Ll+1 u2OLl+1 2c2 c3 1 2(l+1)(t+2) This completes the induction step and hence the proof of the claim. 1 Recallin L = V and settin k in (4) to , we have Pru2OV [ i fi (u) = 1] > 0. Thus there exists u OV and u+ CLIQUE(m s)−1 (1) such G(CLIQUE(m s)) and (u u+ ) G(fi ) for any i 1 . that (u u+ ) G(CLIQUE(m s)), a contradiction. This comThis implies i2f1 g G(fi ) pletes the proof. = fil+1 (u) = 1
2(l+1)2 (t+2)
References AB. N. Alon and R. B. Boppana, The Monotone Circuit Complexity of Boolean Functions , Combinatorica, Vol. 7, No. 1, pp. 1 22, 1987. AM. K. Amano and A. Maruoka, Potential of the Approximation Method , Proc. 7th FOCS, pp. 431 440, 1996. BNT. R. Beals, T. Nishino and K. Tanaka, More on the Complexity of Ne ationLimited Circuits , Proc. 27th STOC, pp. 585 595, 1995. Fis. M.J. Fischer, The Complexity of Ne ation-Limited Networks a Brief Survey , Lecture Notes in Computer Science , Sprin er-Verla , Berlin, pp. 71-82, 1974. Has. J. Hastad, Almost Optimal Lower Bounds for Small Depth Circuits , Proc. 18th STOC, pp. 6 20, 1986. Raz. A.A. Razborov, Lower Bounds on the Monotone Complexity of Some Boolean Functions , Soviet Math. Dokl., Vol. 281, pp. 798 801, 1985. Raz2. A.A. Razborov, On the Method of Approximations , Proc. 21st STOC, pp. 167 176, 1989. SW. M. Santha and C. Wilson, Limitin Ne ations in Constant Depth Circuits , SIAM J. Comput., Vol. 22, No. 2, pp. 294 302, 1993.
Appendix Proof (of Claim 10). Let Lbad denote the collection of sets Lk Lk with k = fik (u) = 1] 1 c1 . By the assumption of Claim 10, Pru2OLk [fi1 (u) = Lbad 1 c2 (A1). Let u OLk be chosen arbitrarily so that PrLk 2Lk [Lk k ]
408
Kazuyuki Amano and Akira Maruoka
fi1 (u) = = fik (u) = 1. By the de nition of a sensitive raph, any of G(fik ) does not contain an ed e from u. Let u+ be a raph obtained G(fi1 ) from u by addin an arbitrary ed e whose both endpoints are in Lk . Clearly, (u u+ ) G(CLIQUE(m s)). Since u+ vLk , we have [ u OLk u+ vLk (u u+ ) G(fj ) Lk Lbad k j2f1
c3 gnfi1
ik g
i1 ik with PrLk 2Lbad [ u OLk u+ Therefore there exists l 1 c3 k + + vLk (u u ) G(fl )] 1 c3 . If (u u ) G(fl ) for u OLk , then fl (u+ ) = 1, vLk implies fl (vLk ) = 1 by the monotonicity of fl . which to ether with u+ Lbad 1 c3 From Thus we can conclude that PrLk 2Lk [fl (vLk ) = 1 Lk k ] i1 ik such that PrLk 2Lk [Lk this and (A1), there exists l 1 c3 and fl (vLk ) = 1] 1 c2 c3 (A2) Now we choose an index l arbitrarily Lbad k et denote a colsatisfyin the above inequality and let ik+1 = l. Lettin Ltar k bad lection of sets Lk Lk such that Lk Lk and that fik+1 (vLk ) = 1, we have et ] 1 c2 c3 . By a similar ar ument to the derivation of (2), PrLk 2Lk [Lk Ltar k we have 1 1 et [Lk Ltar ] (5) Pr Pr k Lk+1 2Lk+1 Lk 2Lk (Lk+1 ) 2c2 c3 2c2 c3 et ] 1 2c2c3 (A3) Now we call a Lk+1 Lk+1 dense if PrLk 2Lk (Lk+1 ) [Lk Ltar k denote a collection of all dense sets in L holds, and let Ldense k+1 . Note that k+1 1 2c2 c3 , for any dense Lk+1 Ldense Prv2ILk+1 [fik+1 (v) = 1] k+1 . Put h = 1 2c2 c3 > 1 m. Thus by applyin Claim 9 to every dense Lk+1 , we have size s1 3 4 > M or Pru2OLk+1 [fik+1 (u) = 0] 2 s1 3 mon (fik+1 ) > (1 2m)2 1 4c1 c2 c3 , for any dense Lk+1 . (We use the assumption c1 c2 c3 s1 3 8 in Claim 10 here.) Since the former contradicts the assumption sizemon (fik+1 ) M , we have Pru2OLk+1 [fik+1 (u) = 0] 1 4c1c2 c3 (A4), for any Lk+1 Ldense k+1 . By (A3), we have 1 1 = fik (u) = 1] Pr [fi1 (u) = Pr c1 2c2 c3 Lk 2Lk (Lk+1 ) u2OLk which, to ether with the fact that all OLk ’s are disjoint, implies Pru2Ok0 [fi1 (u) = = fik (u) = 1] 1 2c1 c2 c3 , where Ok0 = Lk 2Lk (Lk+1 ) OLk . It is not di cult to = fik (u) = 1] 1 2c1 c2 c3 (A5) holds. By (A4) see that Pru2OLk+1 [fi1 (u) = dense and (A5), for any Lk+1 Lk+1 , we have Pru2OLk+1 fi1 (u) = = fik+1 (u) = 1 1 4c1c2 c3 . Now Claim 10 is strai htforward from this and (5).
On Countin AC 0 Circuits with Ne ative Constants Andris Ambainis1 , David Mix Barrin ton2, and
Hß½ng L^eThanh3
1
3
Computer Science Division, University of California at Berkeley
[email protected] 2 Computer Science Department, University of Massachusetts barrin @cs.umass.edu Laboratoire de Recherche en Informatique, Universite de Paris-Sud huon @lri.fr
Abs rac . Continuin the study of the relationship between T C 0 , AC 0 and arithmetic circuits, started by A rawal et al. [1], we answer a few questions left open in this paper. Our main result is that the classes Di AC 0 and GapAC 0 coincide, under poly-time, lo -space, and lo -time uniformity. From that we can derive that under lo space uniformity, the followin equalities hold: C= AC 0 = P AC 0 = T C 0
1
Introduction
The study of countin complexity classes was started by the pioneerin work of Valiant [16] on the class #P . It consists of functions which associate to a strin x the number of acceptin computations of an N P -machine on x. A wellknown complete problem for this class is the computin of the permanent of an inte er matrix. The class #L was de ned later analo ously with respect to N Lcomputation [3,18,14]. Each of these classes can be de ned equivalently either by countin the number of acceptin subtrees of the correspondin class of uniform circuits, or by computin functions via the arithmetized versions of these circuit classes [17,18,14]. These countin classes contain functions which take only natural numbers as values. Countin classes computin functions which mi ht also take ne ative values were introduced via the so-called Gap-classes. The class GapP was de ned by Fenner, Fortnow and Kurtz [8], and the class GapL was introduced by analo y in [18]. For both classes there are two equivalent de nitions. They can either be de ned as the set of functions computable as the di erence of two functions from the correspondin countin class, or as functions which are computed by the correspondin arithmetic circuits au mented by the constant -1. Recently, countin classes related to circuit model based lan ua e classes were also de ned. The class #N C 1 was introduced by Caussinus et al. in [7], and the class #AC 0 by A rawal et al. in [1]. The correspondin Gap-classes were also de ned in these papers. The two de nitions for GapN C 1 are a ain Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 409 417, 1998. c Sprin er-Verla Berlin Heidelber 1998
410
Andris Ambainis et al.
easily seen to be equivalent, the principal reason for this bein the fact that the PARITY lan ua e is in N C 1 . The same ar ument fails to work for the two de nitions of GapAC 0 since PARITY can not be computed in AC 0 . In fact, one of the problems left open in [1] was the exact relationship between these two classes (GapAC 0 and Di AC 0 in the notation of the paper). The main result of our paper is that GapAC 0 and Di AC 0 actually coincide. We will prove this in the lo -time uniform settin , thus showin that it also holds in the lo -space uniform and P -uniform settin s. As a consequence of this result, we can simplify the relationships amon the various boolean complexity classes de ned in terms of these arithmetic classes, resolvin several open problems of [1]. For example, under lo -space uniformity, the classes T C 0 , C= AC 0 and P AC 0 are all equal. (This result was proven in [1] only under P -uniformity.) Under lo -time uniformity, we have the new series of containments T C 0 C= AC 0 P AC 0 .
2
Preliminaries
Followin [1], we will consider three notions of uniformity for circuit families. A family Cn n1 of circuits is said to be P uniform (lo -space uniform) if there exists a Turin machine M and a polynomial T (n) (a function S(n) = O(lo n)) such that M, iven n in unary, produces a description of the circuit Cn within time T (n) (usin space S(n)). The de nition of lo -time uniformity [5] is a bit more complicated. A family Cn of circuits is said to be lo -time uniform if there is a Turin machine that can answer queries in its direct connection lan ua e in time O(lo n). The direct connection lan ua e consists of all tuples i j t y where i is the number of a ate of Cn , j is the number of one of its children (or the number of the referenced input xj , if ate i is an input ate), t ives the type of ate i, and y is any strin of len th n. The lo -time Turin machine has a read-only random-access input tape, so that it can determine the len th of its input by binary search. As shown in [5] and [4], lo -time uniform circuits are equivalent in power to circuits iven by rst-order formulas with variables for input positions and atomic predicates for order, equality, and binary arithmetic on these variables. By De Mor an’s law, it is su cient to consider circuits in which ne ations occur only on the input level, and all the other ates are OR- or AND- ates. For such circuits the notion of subtree was introduced in [17]. Let C be a Boolean circuit and let T (C) be the circuit obtained from C by duplicatin all ates whose fan-out is reater than one, until the underlyin raph of T (C) is a tree. Let x be an input of C. A subtree H of C on input x is a subtree of T (C) de ned as follows: the output ate of the circuit T (C) belon s to H; for each non-input ate already belon in to H, if is an AND- ate then all its input ates belon to H; if is an OR- ate then exactly one of its input ates belon s to H. A subtree on input x is an acceptin subtree if all its leaves evaluate to 1. We now de ne how to arithmetize a Boolean circuit. The input variables xn take as values the natural numbers 0 or 1, and the ne ated input x1 x2
On Countin AC 0 Circuits with Ne ative Constants
411
variables xi take the values 1 − xi . Each OR- ate is replaced by a +- ate and each AND- ate by a - ate. It was shown in [17] that the number of acceptin xn xn ) is equal to the output of subtrees of the circuit C on input (x1 x1 its arithmetized circuit on the same input. Note that the output of such an arithmetic circuit is always non-ne ative. If the constant −1 is allowed in the circuit, functions with ne ative values can also be computed. Let #C be a class of functions from 0 1 to N . By de nition, #C − #C is the class of functions expressible as the di erence of two functions from #C. De nition 1 [1] Let U be any of three uniformity de nitions: P , lo -space, or lo -time. For any k > 0, U -uniform #ACk0 (GapACk0 ) is the class of functions computed by depth k, polynomial size, U -uniform circuits with +, - ates havin unbounded fan-in, where inputs of the circuits are from 0 1 xi 1 − xi (from 0 1 for all i = 1 n. Let 0 1 −1 xi 1 − xi ) and xi [ #ACk0 #AC 0 = k>0
Di AC 0 = #AC 0 − #AC 0 [ GapACk0 GapAC 0 = k>0
It is easy to see that under all three uniformity conditions, Di AC 0 GapAC 0 . A very natural question, left open by A rawal et al. [1], is whether Di AC 0 =GapAC 0 . Let PARITY denote the usual 0-1 parity function which computes the sum of its inputs modulo 2, andQ let F-PARITY be its Fourier representation, that is n xn ) = i=1 (1 − 2xi ) (this function takes value 1 or -1). It F-PARITY (x1 is clear that F-PARITY is in GapAC 0 . Another open question was whether this function belon s to Di AC 0 . In the next sections we will ive a positive answer to both questions. By a #AC 0 circuit we mean an arithmetized AC 0 circuit in the above sense. Throu hout this paper we will need the followin fact. Fact 1 For each inte er N of m bits there exists a #AC 0 circuit with O(m2 ) ates, which on input 1m computes N . This circuit is lo -time uniform if the binary representation of N is iven as input. N1 N0 be the binary representation of N . The Proof. Let N = Nm−1 Nm−2 formula m−1 m−1 X X Ni 2 i = Ni (1 + 1) (1 + 1) (1 + 1) N= {z } | i=0 i=0 i times will ive a #AC 0 circuit of depth 3 and size O(m2 ) computin N usin the circuit Cr of depth 2 and size (3r + 1) introduced in [1], whose number of acceptin subtrees on input 12r is 2r Note that the family of circuits Cr r1 is
412
Andris Ambainis et al.
both P-uniform and lo space-uniform. A lo -time Turin machine can use its random access input tape to reference the sin le bit of N needed to answer any particular query.
3
Di AC 0 = GapAC 0
Theorem 1 Di AC 0 = GapAC 0 for lo -time uniform circuits (and hence for P -uniform and lo -space uniform circuits as well). Di AC 0 under each uniformity Proof. It is enou h to show that GapAC 0 condition. We will rst describe our eneral construction, and then show that it can be carried out preservin lo -time uniformity (and hence the other two conditions as well). Given an arithmetic circuit C for the inputs of len th n, which uses the constant −1, we will construct two other arithmetic circuits A and B, each with only positive constants, such that C(x) = A(x) − B(x) for all input x of len th n We will show, by induction on the depth of C, that for each ate , we can build two #AC 0 circuits A and B such that (x) = A (x) − B (x). The construction is trivial for ates of depth 0. Consider now a ate of depth d 1 havin as input ates 1 2 m . Suppose that for each i = 1 m, we have already constructed two #AC 0 circuits Ai and Bi satisfyin is a + - ate, the construction of A and B is i (x) = Ai (x) − Bi (x). If strai htforward. The interestin case is when is a - ate. For ease of notation we set ai = Ai (x) and bi = Bi (x). Qm Without any ne ative constants, we can Qmcompute the product i=1 (ai + bi ) which is of no immediate help in ettin i=1 (ai − bi ) The key idea is to notice that we can also compute some other products of positive linear combinations of Qm the ai ’s and bi ’s as well, such as i=1 (ai + 2bi ), and use linear al ebra to solve for the combination we want. cm+1 (m), Speci cally, we will nd a sequence of inte ers c1 (m) c2 (m) each of which depends only on m and has O(m) bits, such that m Y
=
(ai − bi )
i=1 m+1 X
ck (m)
k=1
=
X k:ck (m)>0
(1) m Y
(ai + k bi )
(2)
i=1
ck (m)
m Y i=1
(ai + k bi ) −
X
(−ck (m))
k:ck (m)
n−k k + j pj p
Since n, k, and pj are each polynomial in the input size, this function is in lo time uniform #AC 0 . We have now completed the proof of Theorem 1.
On Countin AC 0 Circuits with Ne ative Constants
4
415
A Few Consequences
Corollary 1 F-PARITY is in lo -time uniform Di AC 0 . Corollary 2 PARITY is in lo -time uniform Di AC 0 . Proof. Vinay pointed out [1] that PARITY is represented by the followin polynomial: 1 0 n i−1 X Y @ (1 − 2xj )A xi i=1
j=1
The corollary thus follows immediately from Theorem 1. De ne LDi AC 0 to be the class of lan ua es whose characteristic function is in Di AC 0 . A rawal et al. proved in [1] that every lan ua e in AC 0 has its characteristic function in #AC 0 , hence in Di AC 0 . They left open the question whether there exists a lan ua e in AC 0 whose characteristic function is not in LDi AC 0 . It is well known that PARITY is not in AC 0 . Therefore with Corollary 2 we have separated AC 0 from LDi AC 0 . In their paper [1], A rawal et al. showed that the class AC 0 [2] is exactly the class of lan ua es whose characteristic function is in GapAC 0 . Combinin this result with our result will ive AC 0 [2] = LDi AC 0 . Because of the result in [12] showin that the MAJORITY is not computable in AC 0 [2], we have: AC 0
( AC 0 [2] = LDi
AC 0
( T C0
Note that the modulus 2 is special. If p is any odd prime number, the MOD-p function is provably not in GapAC 0 , because (as noted in [1]) the low-order bit of any GapAC 0 function is in AC 0 [2] and it is known [13] that MOD-p is not in AC 0 [2]. Also, our result Di AC 0 =GapAC 0 implies that all properties known for one of these classes are true for the other too (like normal form or the closure under the weak product de ned in [1]). For the next results we need some more de nitions: 0 ) consists of those lan ua es L De nition 2 [1] The class C= AC 0 (C= ACcirc for which there exists a function f in Di AC 0 (GapAC 0 ) such that for all x:
x
L
f (x) = 0
0 ) is de ned in a similar way where the condition f (x) = The class P AC 0 (P ACcirc 0 is replaced by f (x) > 0.
Corollary
For lo -space or lo -time uniform circuits: 0 C= AC 0 = C= ACcirc 0 P AC 0 = P ACcirc
416
Andris Ambainis et al.
Proof. This follows immediately from Theorem 1. The correspondin equality for P uniformity was shown in [1].
Corollary 4 For lo -space uniform circuits : 0 0 = P ACcirc C= AC 0 = P AC 0 = T C 0 = C= ACcirc
Proof. It was shown in [1] that in the lo -space uniform settin we have: C= AC 0
P AC 0
0 0 T C 0 = C= ACcirc = P ACcirc
The result thus follows immediately from Corollary 3.
Corollary 5 For lo -time uniform circuits: T C0
C= AC 0
P AC 0
Proof. A ain, this follows immediately from Corollary 3 and the correspondin result in [1]. These three classes may be equal under lo -time uniformity as well, but the 0 T C 0 in the lo -space uniform settin , appears to proof in [1], that P ACcirc make essential use of techniques that are only known to be lo -space uniform. We can also answer another open question of A rawal et al. [1]: Corollary 6 Lo space-uniform P AC 0 is closed under union and intersection. Lo space-uniform C= AC 0 is closed under complement. Proof. T C 0 is clearly closed under union, intersection, and complement, so this follows from Corollary 4. Do these closure properties hold under lo -time uniformity as well? This remains an open question.
5
Acknowled ments
We would like to thank Michel De Rou emont and Miklos Santha for helpful discussions. In addition, we would like to thank Eric Allender, who reatly facilitated our collaboration on this work.
On Countin AC 0 Circuits with Ne ative Constants
417
References 1. M. A rawal, E. Allender, S. Datta, On T C 0 AC 0 and Arithmetic Circuits. In Proceedin s of the 12th Annual IEEE Conference on Computational Complexity, pp:134 148, 1997. 2. E. Allender, R. Beals, M. O ihara, The complexity of matrix rank and feasible systems of linear equations. In Proceedin s of the 28th ACM Symposium on Theory of Computin (STOC), pp:161 167, 1996. 3. C. Alvarez, B. Jenner, A very hard lo space countin class. Theoretical Computer Science, 107:3 30, 1993. 4. D. A. M. Barrin ton, N. Immerman, Time, Hardware, and Uniformity. In L. A. Hemaspaandra and A. L. Selman, eds., Complexity Theory Retrospective II, Sprin er Verla , pp:1 22, 1997. 5. D. A. M. Barrin ton, N. Immerman, and H. Straubin , On Uniformity Within N C 1 . Journal of Computer and System Science, 41:274 306, 1990. 6. P. Beame, S. Cook, H. J. Hoover, Lo depth circuits for division and related problems. SIAM Journal on Computin , 15:994 1003, 1986. 7. H. Caussinus, P. McKenzie, D. Therien, H. Vollmer, Nondeterministic N C 1 . In Proceedin s of the 11th Annual IEEE Conference on Computational Complexity, pp:12 21, 1996. 8. S. A. Fenner, L. J. Fortnow, S. A. Kurtz, Gap-de nable countin classes. Journal of Computer and System Science, 48(1):116 148, 1995. 9. J. K¨ obler, U. Sch¨ onin , J. Toran, On countin and approximation. Acta Informatica, 26:363 379, 1989. 10. B. Litow, On iterated inte er product. Information Processin Letters, 42(5):269 272, 1992. 11. M. Mahajan, V. Vinay, Determinant: Combinatorics, Al orithms and Complexity. In Proceedin s of SODA’97. ftp://ftp.eccc.unitrier.de/pub/eccc/reports/1997/TR97-036/index.html 12. A. A. Razborov, Lower bound on size of bounded depth networks over a complete basis with lo ical addition. Mathematicheskie Zametli, 41:598 607, 1987. En lish translation in Mathematical Notes of the Academy of Sciences of the USSR, 41:333 338, 1987. 13. R. Smolensky, Al ebraic methods in the theory of lower bounds for Boolean circuit complexity. In Proceedin s of the 19th ACM Symposium on the Theory of Computin (STOC), pp:77 82, 1987. 14. S. Toda, Classes of arithmetic circuits capturin the complexity of computin the determinant. IEICE Transactions, Informations and Systems, E75-D:116 124, 1992. 15. S. Toda, Countin problems computationally equivalent to the determinant. Manuscript. 16. L. Valiant, The complexity of computin the permanent. Theoretical Computer Science, 8:189 201, 1979. 17. H. Venkateswaran, Circuit de nitions of non-deterministic complexity classes. SIAM Journal on Computin , 21:655 670, 1992. 18. V. Vinay, Countin auxiliary pushdown automata and semi-unbounded arithmetic circuits. In Proceedin s of the 6th IEEE Structure in Complexity Theory Conference, pp:270 284, 1991.
A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice’s Theorem? Lane A. Hemaspaandra1 and J¨org Rothe2 1
Dept. of Computer Science, University of Rochester, Rochester, NY 14627, USA Inst. f¨ur Informatik, Friedrich-Schiller-Universit¨at Jena, 07740 Jena, Germany
2
Abstract. Rice’s Theorem states that every nontrivial language property of the recursively enumerable sets is undecidable. Borchert and Stephan [BS97] initiated the search for circuit complexity-theoretic analogs of Rice’s Theorem. In particular, they proved that every nontrivial counting property of circuits is UPhard, and that a number of closely related problems are SPP-hard. The present paper studies whether their UP-hardness result itself can be improved to SPP-hardness. We show that their UP-hardness result cannot be strengthened to SPP-hardness unless unlikely complexity class containments hold. Nonetheless, we prove that every P-constructibly bi-infinite counting property of circuits is SPP-hard. We also raise their general lower bound from unambiguous nondeterminism to constant-ambiguity nondeterminism.
1 Introduction Rice’s Theorem [Ric53,Ric56] states that every nontrivial language property of the recursively enumerable sets is undecidable. Theorem 1 (Rice’s Theorem, Version I). Let A be a nonempty proper subset of the class of recursively enumerable sets. Then the following problem is undecidable: Given a Turing machine M , is L(M ) A? In fact, the theorem can be stated in the following more provocative form ([Ric53], see [BS97]). Theorem 2 (Rice’s Theorem, Version II). Let A be a nonempty proper subset of the class of recursively enumerable sets. Then either the halting problem or its complement many-one reduces to the problem: Given a Turing machine M , is L(M ) A? This theorem conveys quite a bit of information about the nature of programs and their semantics. Programs are completely nontransparent. One can (in general) decide Supported in part by grants NSF-CCR-9322513 and NSF-INT-9513368/DAAD-315-PRO-foab, and a NATO Postdoctoral Science Fellowship from the DAAD (“Gemeinsames Hochschulsonderprogramm III von Bund und L¨andern”). Work done in part while the first author was visiting FSU Jena, and while the second author was visiting the Univ. of Rochester. Email:
[email protected],
[email protected]. Current address of second author: Dept. of Comp. Sci., Univ. of Rochester, Rochester, NY 14627, USA. Luboˇs Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 418–426, 1998. c Springer-Verlag Berlin Heidelberg 1998
A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice’s Theorem
419
nothing—emptiness, nonemptiness, infiniteness, etc.—about the languages of given programs other than the trivial fact that each accepts some language and that language is a recursively enumerable language.1 Recently, Kari [Kar94] has proven, for cellular automata, an analog of Rice’s Theorem: All nontrivial properties of limit sets of cellular automata are undecidable. A bold and exciting paper of Borchert and Stephan [BS97] proposes and initiates the search for complexity-theoretic analogs of Rice’s Theorem. Borchert and Stephan note that Rice’s Theorem deals with properties of programs, and they suggest as a promising complexity-theoretic analog properties of boolean circuits. In particular, they focus on . Boolean functions are funccounting properties of circuits. Let N denote 0 1 2 tions that for some n map 0 1 n to 0 1 . Circuits built over boolean gates (and encoded in some standard way—in fact, for simplicity of expression, we will often treat a circuit and its encoding as interchangeable) are ways of representing boolean functions. As Borchert and Stephan point out, the parallel is a close one. Programs are concrete objects that correspond in a many-to-one way with the semantic objects, languages. Circuits (encoded into ) are concrete objects that correspond in a many-to-one way with the semantic objects, boolean functions. Given an arity n circuit c, #(c) denotes under how many of the 2n possible input patterns c evaluates to 1. Definition 1. 1. [BS97] Each A N is a counting property of circuits. If A = , we say it is a nonempty property, and if A = N , we say it is a proper property. 2. [BS97] Let A be a counting property of circuits. The counting problem for A, Counting(A), is the set of all circuits c such that #(c) A. , we say B is 3. (see [GJ79]) For each complexity class C and each set B p p C-hard if ( L C) [L T B], where as is standard T denotes polynomial-time Turing reducibility.
4. (following usage of [BS97]) Let A be a counting property and let C be a complexity class. By convention, we say that counting property A is C-hard if the counting problem for A, Counting(A), is C-hard. (Note in particular that by this we do not mean C PA —we are speaking just of the complexity of A’s counting problem.) For succinctness and naturalness, and as it introduces no ambiguity here, we throughout this paper use “counting” to refer to what Borchert and Stephan originally referred to as “absolute counting.” For completeness, we mention that their sets Counting(A) are not entirely new: For each A, Counting(A) is easily seen (in light of the fact that circuits can be parsimoniously simulated by Turing machines, which themselves, as per the references cited in the proof of Theorem 4 (see the full version of this paper [HR97]), can be parsimoniously transformed into boolean formulas) to be 1
One must stress that Rice’s Theorem refers to the languages accepted by the programs (Turing machines) rather than to machine-based actions of the programs (Turing machines)—such as whether they run for at least seven steps on input 1776 (which is decidable) or whether for some input they infinite loop (which is not decidable, but Rice’s Theorem does not speak directly to this issue, that is, Rice’s Theorem does not address the computability of the set M there is some input x on which M (x) infinite loops ).
420
Lane A. Hemaspaandra and J¨org Rothe
many-one equivalent to the set, known in the literature as SATA or A-SAT, f the number of satisfying assignments to boolean formula f is an integer contained in the set A [GW87,CGH+ 89]. Thus, Counting(A) inherits the various properties that the earlier papers on SATA established for SATA , such as completeness for certain counting classes. We will at times draw on this earlier work to gain insight into the properties of Counting(A). The results of Borchert and Stephan that led to the research reported on in the present paper are the following. Note that Theorem 3 is a partial analog of Theorem 2, and Corollary 1 is a partial analog of Theorem 1. Theorem 3. [BS97] Let A be a nonempty proper subset of N . Then one of the following three classes is pm -reducible to Counting(A): NP, coNP, or UP coUP. Corollary 1. [BS97] hard.
Every nonempty proper counting property of circuits is UP-
Borchert and Stephan’s paper proves a number of other results—regarding an artificial existentially quantified circuit type yielding NP-hardness, definitions and results about counting properties over rational numbers and over Z, and so on—and we highly commend their paper to the reader. They also give a very interesting motivation. They show that, in light of the work of Valiant and Vazirani, any nontrivial counting property of circuits is hard for either NP or coNP, with respect to randomized reductions. Their paper and this one seek to find to what extent or in what form this behavior carries over to deterministic reductions. The present paper makes the following contributions. First, we extend the abovestated results of Borchert and Stephan, Theorem 3 and Corollary 1. Regarding the latter, from the same hypothesis as their Corollary 1 we derive a stronger lower bound— UPO(1) -hardness. That is, we raise their lower bound from unambiguous nondeterminism to low-ambiguity nondeterminism. Second, we show that our improved lower bound cannot be further strengthened to SPP-hardness unless an unlikely complexity class containment—SPP PNP —occurs. Third, we nonetheless under a very natural hypothesis raise the lower bound on the hardness of counting properties to SPP-hardness. The natural hypothesis strengthens the condition on the counting property to require not merely that it is nonempty and proper, but also that it is infinite and coinfinite in a way that can be certified by polynomial-time machines.
2 The Complexity of Counting Properties of Circuits All the notations and definitions in this paragraph are standard in the literature. Fix the alphabet = 0 1 . FP denotes the class of polynomial-time computable func , we say A polynomial-time tions from to . Given any two sets A B p ) [x A f (x) B]. many-one reduces to B (A m B) if ( f FP) ( x For each set A, A denotes the number of elements in A. The length of each string is denoted by x . We use DPTM (respectively, NPTM) as a shorthand for dex terministic polynomial-time Turing machine (nondeterministic polynomial-time Turing
A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice’s Theorem
421
machine). Turing machines and their languages (with or without oracles) are denoted as is standard, as are complexity classes (with or without oracles), e.g., M , M A , L(M ), L(M A ), P, and PA . We allow both languages and functions to be used as oracles. In the latter case, the model is the standard one, namely, when a query q is asked to a function N , a “[k]” denotes a restriction of at most oracle f the answer is f (q). For each k k oracle questions (in a sequential—i.e., “adaptive” or “Turing”—fashion). For exam ) [M f (x) ple, PFP[2] denotes L ( DPTM M )( f FP) [L = L(M f ) ( x makes at most two oracle queries]] , which happens to be merely an ungainly way of describing the complexity class P. A “[O(1)]” denotes that, for some constant k, a “[k]” restriction holds. We will define, in a uniform way via counting functions, some standard ambiguitylimited classes and counting classes. To do this, we will take the standard “#” operator ([Tod91] for the concept and [Vol94] for the notation, see the discussion in [HV95]) and will make it flexible enough to describe a variety of types of counting functions that are well-motivated by existing language classes. In particular, we will add a general restriction on the maximum value it can take on. (For the specific case of a polynomial restriction such an operator, #few , was already introduced by Hemaspaandra and Vollmer [HV95], see below).
N and each class C, define # Definition 2. For each function : N N ( L C) ( polynomial s) ( x ) [f (x) (x) f : y = s( x ) x y L = f (x)] .
C = y
Note that for the very special case of C = P, which is the case of importance in the present paper, this definition simply yields classes that speak about the number of accepting paths of Turing machines that obey some constraint on their number of acceptN ing paths. In particular, the following clearly holds for each : # P = f : ) [N (x) has exactly f (x) accepting paths and f (x) ( x )] . ( NPTM N ) ( x In using Definition 2, we will allow a bit of informality regarding describing the functions . For example, we will write #1 when formally we should write # x 1 , and so on in similar cases. Also, we will now define some versions of the # operator that focus on collections of bounds of interest to us. Definition 3. 1. For each class C, #const C = f : #k C] . 2. [HV95] For each class C, #few C = f : [f #s C] .
N ( k N ) [f N ( polynomial s)
N ( NPTM N ) ( x ) [N (x) has Definition 4. 1. [Val79] #P = f : ) exactly f (x) accepting paths] . 2. [Val76] UP = L ( f #1 P) ( x N− 0 , [x L f (x) > 0] . 3. ([Bei89], see also [Wat88]) For each k #k P) ( x ) [x L f (x) > 0] . 4. ([HZ93], see UPk = L ( f #const P) ( x ) [x L f (x) > also [Bei89]) UPO(1) = L ( f 0] . (Equivalently, UPO(1) = k1 UPk .) 5. [All86,AR88] FewP = L ( f ) [x L f (x) > 0] . 6. [CH90] Few = P(#few P)[1] . #few P) ( x
422
Lane A. Hemaspaandra and J¨org Rothe
7. Const = P(#const P)[O(1)] .2 8. [FFK94,OH93] SPP = L ( f #P) ( FP) ) [(x L f (x) = 2j (x)j ) (x L f (x) = 2j (x)j + 1)] . ( x UPO(1) FewP Few It is well-known that UP = UP1 UP2 SPP (the final containment is due to K¨obler et al. [KSTT92], see also [FFK94] for Const Few. SPP plays a central a more general result), and clearly UPO(1) role in much of complexity theory (see [For97]), and in particular is closely linked to the closure properties of #P [OH93]. Regarding relationships with the polynomial hierarchy, P UP FewP NP, and Few PFewP (so Few PNP ). It is widely suspected that SPP PH (where PH denotes the polynomial hierarchy), though this is an open research question. UP, UPO(1) , and FewP are tightly connected to the issue of whether one-way functions exist [GS88,AR88,HZ93], and Watanabe [Wat88] has shown that P = UP if and only if P = UPO(1) . Intuitively, UP captures the notion of unambiguous nondeterminism, FewP allows polynomially ambiguous nondeterminism and, most relevant for the purposes of the present paper, UPO(1) allows constant-ambiguity nondeterminism. Corollary 2 raises the UP lower bound of Borchert and Stephan (Corollary 1) to a UPO(1) lower bound. This is obtained via the even stronger bound provided by Theorem 4, which itself extends Theorem 3. Theorem 4. Let A be a nonempty proper subset of N . Then one of the following three classes is pm -reducible to Counting(A): NP, coNP, or Const. Corollary 2. Every nonempty proper counting property of circuits is UPO(1) -hard (indeed, is even UPO(1) - p1-tt -hard). Our proof, which can be found in the full version of this paper [HR97], applies a constant-setting technique that Cai and Hemaspaandra (then Hemachandra) [CH90] used to prove that FewP P, and that K¨obler et al. [KSTT92] extended to show that Few SPP. Corollary 2 raised the lower bound of Corollary 1 from UP to UPO(1) . It is natural to wonder whether the lower bound can be raised to SPP. This is especially true in light of the fact that Borchert and Stephan obtained SPP-hardness results for their notions of “counting problems over Z” and “counting problems over the rationals”; their UPhardness result for standard counting problems (i.e., over N ) is the short leg of their paper. However, we note that extending the hardness lower bound to SPP under the same hypothesis seems unlikely. Let BH denote the boolean hierarchy [CGH+ 88]. It is well-known that NP BH PNP PH. Proposition 1. If A
N is finite or cofinite, then Counting(A)
BH.
This result needs no proof, as it follows easily from [CGH+ 89, Lemma 3.1 and Theorem 3.1.1(a)] (those results exclude the case 0 A but their proofs clearly apply also to that case) or from [GW87, Theorem 15], in light of the 2
As noted in the proof of Theorem 4 (see the full version of this paper [HR97]), P(#const P)[O(1)] = P(#const P)[1] . Thus, the definition of Const is more analogous to the definition of Few than one might realize at first.
A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice’s Theorem
423
relationship between Counting(A) and SATA mentioned earlier in the present paper. Similarly, from earlier work one can conclude that, though for all finite and cofinite A it holds that Counting(A) is in the boolean hierarchy, these problems are not good candidates for complete sets for that hierarchy’s higher levels—or even its second level. In particular, from the approach of the theorem and proof of [CGH+ 89, Theorem 3.1.2] (see also [GW87, Theorem 15]) it is not too hard to see that ( B) [( finite A) [Counting(A) is not pmB -hard for NPB ] ( cofinite A) [Counting(A) is not pmB -hard for coNPB ]]. In light of the fact that SPP-hardness means SPP- pT -hardness, the bound of Proposition 1 yields the following result (one can equally well state the stronger claim that no finite or cofinite counting property of circuits is SPP- pm -hard unless SPP BH). Corollary 3. No finite or cofinite counting property of circuits is SPP-hard unless SPP PNP . Though we have not in this paper discussed models of relativized circuits and relativized formulas to allow this work to relativize cleanly (and we do not view this as an important issue), we mention in passing that there is a relativization in which SPP is not contained in PNP (indeed, relative to which SPP strictly contains the polynomial hierarchy) [For97]. Corollary 3 makes it clear that if we seek to prove the SPP-hardness of counting properties, we must focus only on counting properties that are simultaneously infinite and coinfinite. Even this does not seem sufficient. The problem is that there are infinite, coinfinite sets having “gaps” so huge as to make the sets have seemingly no interesting usefulness at many lengths (consider, e.g., the set i ( j) [i = AckermannFunct on(j j)] ). Of course, in a recursion-theoretic context this would be no problem, as a Turing machine in the recursion-theoretic world is free from time constraints and can simply run until it finds the desired structure (which we will see is a boundary event). However, in the world of complexity theory we operate within (polynomial) time constraints. Thus, we consider it natural to add a hypothesis, in our search for an SPP-hardness result, requiring that infiniteness and coinfiniteness of a counting property be constructible in a polynomial-time manner. Recall that a set of nonnegative integers is infinite exactly if it has no largest element. We will say that a set is P-constructibly infinite if there is a polynomial-time function that yields elements at least as long as each given (unary) input length. Definition 5. Let B FP) ( n N ) [f (0n )
B
. We say that B is P-constructibly infinite if ( f f (0n ) n].
Let us adopt the standard bijection between and N —the natural number i corre,1 0, 2 1, 3 00, sponds to the lexicographically (i + 1)st string in : 0 etc. If A N , we say that A is P-constructibly infinite if A, viewed as a subset of via this bijection, is P-constructibly infinite according to Definition 5. If A and A (or A N and N − A) are P-constructibly infinite, we will say that A is P-constructibly bi-infinite. Note that some languages that are infinite (respectively, bi-infinite) are not Pconstructibly infinite (respectively, bi-infinite), e.g., languages with huge gaps between successive elements.
424
Lane A. Hemaspaandra and J¨org Rothe
Borchert and Stephan [BS97] also study “counting problems over the rationals,” and in this study they use a root-finding-search approach to establishing lower bounds. In the following proof, we apply this type of approach (by which we mean the successive interval contraction of the same flavor used when trying to capture the root of a function on [a b ] when one knows initially that, say, f (a) > 0 and f (b) < 0) to counting problems (over N ). In particular, we use the P-constructibly bi-infinite hypothesis to “trap” a boundary event of A. Theorem 5. Each P-constructibly bi-infinite counting property of circuits is SPP-hard.
N be any P-constructibly bi-infinite counting property of circuits. Proof: Let A Let L be any set in SPP. Since L SPP, there are functions f #P and FP : (x L f (x) = 2j (x)j + 1) (x L f (x) = such that, for each x 2j (x)j ). Let h and h be FP functions certifying that A and A are P-constructibly infinite. We will describe a DPTM N that pT -reduces L to Counting(A). For clarity, let w henceforth denote the natural number that in the above bijection between N and corresponds to the string w. For convenience, we will sometimes view A as a subset of N and sometimes as a subset of (and in the latter case we implicitly mean the transformation of A to strings under the above-mentioned bijection). Since clearly A pm Counting(A),3 we for convenience will sometimes informally speak as if the set A (viewed via the bijection as subset of ) is an oracle of the reduction. Formally, when we do so, this should be viewed as a shorthand for the complete pT -reduction that consists of the pT -reduction between L and A followed by the pm -reduction between A and Counting(A). We now describe N . On input x, x = n, N proceeds in three steps. (As a shorthand, we will consider x fixed and will write N rather than N Counting(A) (x).) (1) N runs h and h on suitable inputs to find certain sufficiently large strings in A and A. In particular, let h(0j (x)j+1 ) = y. So we have y A and y (x) + 1, and thus y 2j (x)j+1 − 1 2j (x)j . Recall that x = n. Since both h and are in FP, there exists a polynomial p such that y p(n), and thus certainly y < 2p(n)+1 . So let p(n)+2 ) = z, which implies z A and z p(n) + 2. Thus, z 2p(n)+2 − 1 > h(0 p(n)+1 > y. Since h FP, there clearly exists a polynomial q such that z < 2q(n) . To 2 summarize, N has found in time polynomial in x two strings y A and z A such that 2j (x)j y < z < 2q(n) . N to find some u N that (2) N performs a search on the interval [ y z ] u z, (b) u A, and is a boundary event of A. That is, u will satisfy: (a) y (c) u + 1 A. Since z < 2q(n) , the search will terminate in time polynomial in x . We state the standard search algorithm (searching to find a boundary event of A): Input y and z satisfying y < z, y A, and z A. Output u, a boundary event of A satisfying y u z. u := y; 3
Either one can encode a string n (corresponding to the number n b in binary) directly into a circuit cn such that #(cn ) = n b (which is easy to do), or one can note the following indirect transformation: Let N be an NPTM that on input n produces exactly n b accepting paths. Using a parsimonious Cook/Karp/Levin reduction (as described earlier), we easily obtain a family of circuits e cn n such that, for each n , #(e cn ) = n b.
A Second Step Towards Circuit Complexity-Theoretic Analogs of Rice’s Theorem
425
while z > u + 1 do z b ; if a a := ub+ 2
A then u := a else z := a
end while (3) Now consider the #P function e( m x ) = m + f (x) and the underlying NPTM E witnessing that e #P. Let dE be the parsimonious Cook/Karp/Levin reduction that on each input m x outputs a circuit (representation) chm xi such that #(chm xi ) = e( m x ). Recall that N has already computed u (which itself depends on x and the oracle). N , using dE to build its query, now queries its oracle, Counting(A), as to whether chub−2 g(x) xi Counting(A), and N accepts its input x if and only if the answer is “yes.” This completes the description of N . As argued above, N runs in polynomial time. We have to show that it corL. Then f (x) = 2j (x)j , rectly pT -reduces L to Counting(A). Assume x j (x)j x) = u A. This implies that the answer to the query and thus e( u − 2 “chub−2 g(x) xi Counting(A)?” is “no,” and so N rejects x. Analogously, if x L, A, and so N acthen f (x) = 2j (x)j + 1, and thus e( u − 2j (x)j x ) = u + 1 cepts x. Finally, though we have stressed ways in which hypotheses that we feel are natural yield hardness results, we mention that for a large variety of complexity classes (amongst them R, coR, BPP, PP, and FewP) one can state somewhat artificial hypotheses for A that ensure that Counting(A) is many-one hard for the given class. For example, if A is any set such that either i i is a boundary event of A is P-constructibly infinite or i i is a boundary event of A is P-constructibly infinite, then Counting(A) is SPP- pm-hard. Acknowledgments: We are grateful to L. Fortnow, K. Regan, and H. Vollmer for helpful literature pointers and history, and to B. Borchert, E. Hemaspaandra, and G. Wechsung for helpful discussions and suggestions. We thank J. Hartmanis for commending to us the importance of finding complexity-theoretic analogs of index sets, and we commend to the reader, as J. Hartmanis did to us, the open issue of whether a crisp complexity-theoretic analog can be found to the early work of Hartmanis and Lewis [HL71].
References All86.
AR88. Bei89.
BS97.
E. Allender. The complexity of sparse sets in P. In Proceedings of the 1st Structure in Complexity Theory Conference, pages 1–11. Springer-Verlag Lecture Notes in Computer Science #223, June 1986. E. Allender and R. Rubinstein. P-printable sets. SIAM Journal on Computing, 17(6):1193–1202, 1988. R. Beigel. On the relativized power of additional accepting paths. In Proceedings of the 4th Structure in Complexity Theory Conference, pages 216–224. IEEE Computer Society Press, June 1989. B. Borchert and F. Stephan. Looking for an analogue of Rice’s Theorem in circuit complexity theory. In Proceedings on the 1997 Kurt G¨odel Colloquium, pages 114– 127. Springer-Verlag Lecture Notes in Computer Science #1289, 1997.
426
Lane A. Hemaspaandra and J¨org Rothe
CGH+ 88. J. Cai, T. Gundermann, J. Hartmanis, L. Hemachandra, V. Sewelson, K. Wagner, and G. Wechsung. The boolean hierarchy I: Structural properties. SIAM Journal on Computing, 17(6):1232–1252, 1988. CGH+ 89. J. Cai, T. Gundermann, J. Hartmanis, L. Hemachandra, V. Sewelson, K. Wagner, and G. Wechsung. The boolean hierarchy II: Applications. SIAM Journal on Computing, 18(1):95–111, 1989. CH90. J. Cai and L. Hemachandra. On the power of parity polynomial time. Mathematical Systems Theory, 23(2):95–106, 1990. FFK94. S. Fenner, L. Fortnow, and S. Kurtz. Gap-definable counting classes. Journal of Computer and System Sciences, 48(1):116–148, 1994. For97. L. Fortnow. Counting complexity. In L. Hemaspaandra and A. Selman, editors, Complexity Theory Retrospective II, pages 81–107. Springer-Verlag, 1997. GJ79. M. Garey and D. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman and Company, 1979. GS88. J. Grollmann and A. Selman. Complexity measures for public-key cryptosystems. SIAM Journal on Computing, 17(2):309–335, 1988. GW87. T. Gundermann and G. Wechsung. Counting classes with finite acceptance types. Computers and Artificial Intelligence, 6(5):395–409, 1987. HL71. J. Hartmanis and F. Lewis. The use of lists in the study of undecidable problems in automata theory. Journal of Computer and System Sciences, 5(1):54–66, 1971. HR97. L. Hemaspaandra and J. Rothe. Complexity-theoretic analogs of Rice’s Theorem. Technical Report TR-662, Department of Computer Science, University of Rochester, Rochester, NY, July 1997. HV95. L. Hemaspaandra and H. Vollmer. The Satanic notations: Counting classes beyond #P and other definitional adventures. SIGACT News, 26(1):2–13, 1995. HZ93. L. Hemaspaandra and M. Zimand. Strong forms of balanced immunity. Technical Report TR-480, Department of Computer Science, University of Rochester, Rochester, NY, December 1993. Revised May, 1994. Kar94. J. Kari. Rice’s Theorem for the limit sets of cellular automata. Theoretical Computer Science, 127(2):229–254, 1994. KSTT92. J. K¨obler, U. Sch¨oning, S. Toda, and J. Tor´an. Turing machines with few accepting computations and low sets for PP. Journal of Computer and System Sciences, 44(2):272–286, 1992. OH93. M. Ogiwara and L. Hemachandra. A complexity theory for closure properties. Journal of Computer and System Sciences, 46(3):295–325, 1993. Ric53. H. Rice. Classes of recursively enumerable sets and their decision problems. Transactions of the AMS, 74:358–366, 1953. Ric56. H. Rice. On completely recursively enumerable classes and their key arrays. Journal of Symbolic Logic, 21:304–341, 1956. Tod91. S. Toda. Computational Complexity of Counting Complexity Classes. PhD thesis, Department of Computer Science, Tokyo Institute of Technology, Tokyo, Japan, 1991. Val76. L. Valiant. The relative complexity of checking and evaluating. Information Processing Letters, 5(1):20–23, 1976. Val79. L. Valiant. The complexity of enumeration and reliability problems. SIAM Journal on Computing, 8(3):410–421, 1979. Vol94. H. Vollmer. Komplexit¨atsklassen von Funktionen. PhD thesis, Institut f¨ur Informatik, Universit¨at W¨urzburg, W¨urzburg, Germany, 1994. Wat88. O. Watanabe. On hardness of one-way functions. Information Processing Letters, 27:151–157, 1988.
Model Checkin Real-Time Properties of Symmetric Systems E. Allen Emerson and Richard J. Trefler Compu er Sciences Depar men and Compu er Engineering Research Cen er Universi y of Texas, Aus in, TX, 78712, USA h p://www.cs.u exas.edu/users/emerson/
Abs rac . We develop e cien algori hms for model checking quan i aive proper ies of symme ric reac ive sys ems in he general framework of a Real-Time Mu-calculus. Previous work has been limi ed o quali a ive correc ness proper ies. Our work no only permi s handling of quan ia ive correc ness, bu i provides a s ric ly more expressive framework for quali a ive correc ness since he Mu-calculus s ric ly subsumes, e.g, CTL*. Unlike he previous group- heore ic approaches of [CE96] and [ES96] and he echnical au oma a- heore ic approach of [ES97], our new approach may be viewed as model- heore ic .
1
Introduction
Model checking [CE81] (c.f. [QS82], [LP85] ) is an algori hmic me hod for de ermining whe her a given ni e s a e sys em M sa is es a emporal logic speci ca ion f . Lich ens ein and Pnueli [LP85] argued ha in prac ice he complexi y of model checking will be domina ed by M , he size of M . Unfor una ely, M can be of size exponen ial in he program ex . For example, a sys em wi h n processes running in parallel, each having jus 3 local s a es, can have 3n global s a es. Symme ry reduc ion is a echnique designed o subs an ially ameliora e his s a e explosion problem by exploi ing he fac ha many such sys ems are symme ric in heir design and opera ion (cf. [JR91], [ID96], [ES96], [CE96], [ES97], [GS97]). Symme ry is a form of redundancy ha can be fac ored ou . Many synchroniza ion and coordina ion pro ocols are he parallel composi ion of n processes which are iden ical up o renaming. The s a e graph M of such a sysem may reflec considerable symme ry. For example, s a es (C1 T2 ) and (T1 C2 ) may be presen in a solu ion o he mu ex problem. By clus ering oge her such symme ry equivalen s a es, we can form he symme ry reduced quo ien s rucure M . M , whose s a es are named by represen a ives of he clus ers, may be exponen ially smaller han M . Then he emporal formula f may be model ?
The au hors’ work was suppor ed in par by NSF gran s CCR-941-5496 and CCR-980-4736 and SRC con rac 97-DP-388. The au hors can be reached a emerson, refler @cs.u exas.edu
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 427 436, 1998. c Sprin er-Verla Berlin Heidelber 1998
428
E. Allen Emerson and Richard J. Trefler
checked over M o de ermine if f holds of M . In prac ice, M is ypically cons ruc ed incremen ally from he program ex , avoiding he self defea ing ask of rs building M . Work on symme ry reduc ion in model checking originally reduced M o an ‘unanno a ed’ symme ry reduced quo ien s ruc ure M [ES96], [CE96]. However, ha work, due o cer ain echnical provisos regarding he in ernal symme ry of he speci ca ions, was unable o handle fairness despi e o herwise ca ering for CTL . To remedy his, [ES97] in roduced he anno a ed quo ien s ruc ure M where he ransi ions be ween represen a ive s a es are labeled wi h permu aions indica ing how he meaning of all coordina es shif from represen a ive o represen a ive. [ES97] also in roduced a hreaded quo ien s ruc ure M indica ing how he meaning of individual coordina es shif . By combining au oma a wi h hese quo ien graphs in an au oma a- heore ic [VW86] rea men , [ES97] developed a echnical approach ha allowed fairness proper ies o be checked e cien ly. In his paper we inves iga e model checking quan i a ive, discre e real- ime proper ies over he quo ien s M and M in he framework of he Real-Time -calculus (RTL ) (c.f. [Ko83], [Em92], [Se96]) which s ric ly subsumes he logics considered in previous work. We de ne a new no ion of wis ed ru h or permu ed sa isfac ion of a formula over anno a ed s ruc ures, M s f , and prove ha his permu ed ru h corresponds o he usual one over unanno a ed s ruc ures M s = f , ha is M s f i M s = f . This new no ion leads o an e cien model checking algori hm for a formula ion of an Indexed Real-Time Mu-calculus, IRTL . In par icular, we give an O( M f n) algori hm, which acually opera es on M , for evalua ing IRTL formulae of al erna ion dep h 1 over M . This algori hm can be generalized o work on arbi rary formulae of he -calculus. Our rea men of hese problems, providing an al erna ive means of handling fairness proper ies, is done wi hou appeal o au oma a. Ins ead, our echniques show how expressive model checking over he anno a ed quo ien s ruc ure can be accomplished in a model- heore ic framework. In eres ingly, quan i a ive emporal proper ies of he s ruc ure M are preserved in M even hough M may be exponen ially smaller han M . For example, if he number of s a es of M < k < he number of s a es of M , hen checking for he exis ence of a pa h no longer han k s eps o a s a e where symme ric asser ion P is rue akes ime propor ional o k in M bu propor ional o he size of M in he symme ry reduced s ruc ure. This is no so for arbi rary boolean asser ions f and is complica ed in he anno a ed M by he shif ing meaning of coordina es. A sub le y ha arises is he fac ha cycles in he anno a ed quoien may no correspond o cycles in he original s ruc ure. The ex en o which his sub le y mus be clari ed in order o solve he model checking problem is a key issue in his paper. Finally, we presen resul s which rela e o he di cul y of model checking emporal formulae of symme ric sys ems. We show ha model checking cer ain emporal modali ies over anno a ed s ruc ures is NP-hard. Fur hermore, he model checking problem for cer ain quan i a ively bounded fairness problems
Model Checking Real-Time Proper ies of Symme ric Sys ems
429
is NP-hard even over unreduced s ruc ures, in con ras wi h he polynomial algori hms for checking unbounded fairness. Agains he background of hese somewha nega ive resul s we iden ify some classes of formulae and s ruc ures for which symme ry can reduce NP-hard problems o problems which can be solved in polynomial ime. The res of he paper is organized as follows. In sec ion 2 he logics discussed in he paper are in roduced. Sec ion 3 discusses he de ni ion of symme ry reduced s ruc ures. The precise correspondence be ween s ruc ures, heir symmery reduced anno a ed quo ien s ruc ures and emporal formulae is given in sec ion 4. An IRTL model checking algori hm is given in sec ion 5. Sec ion 6 discusses he complexi y of model checking symme ric s ruc ures and some applica ions of reasoning abou symme ry in s ruc ures. Finally, sec ion 7 con ains a shor conclusion.
2
RTL
Le LP deno e a ni e se of local proposi ions. I deno es an index se [1 n] for some n N which deno es he se of na ural numbers. RTL is formed husly: he se of a omic proposi ions is LP I; we will wri e (P i) LP I as P . We assume a se of variables over se s of s a es Var = V (V0 I), where V and V0 are unindexed and disjoin . RTL is he LP I and Y Y Var are a omic formulae; se of formulae de ned by P if f and are formulae hen so are f , f and R f . Finally, suppose f (Y ) is a formula syn ac ically mono one in Y , Y Var, ha is, every occurrence of Y falls wi hin an even number of occurrences, hen Y f (Y ) and kY f (Y ), k N, are formulae. Y f (Y ) and kY f (Y ) are abbrevia ions for Y f( Y ) and kY f ( Y ) respec ively and [R]f is an abbrevia ion for R f . Le iRTL be he sub-logic whose a omic formulae are proposi ions in LP i . Then he indexed mu-calculus, IRTL , is i and variables in V and V0 he logic whose a omic formulae are variables in V and formulae of he form f or f where he f are isomorphic formulae of iRTL . Formulae of IRTL are also formed from he connec ives R , Y and kY . Fur hermore, if f (Y ) and are formulae of IRTL , where Y is an unindexed variable no appearing wi hin any Y in f , hen he formula f ( ), which is ob ained by replacing each of occurrence of Y in f (Y ) by is a formula of IRTL . Formulae of RTL are given seman ics rela ive o ni e s ruc ures M = (S R) s i he i h elemen where S LP I and R S S. For s S we say ha P of s is P LP . Given formula f and s ruc ure M , he meaning of f , wri en [Var 2S ], in o 2S and is de ned below. f M , is a mapping from valua ions, M We say ha s a e s in M sa is es f if s f (al erna ively wri en M s = f ). s and Y M ( ) = (Y ). For a omic formulae, P M ( ) = s S P M For boolean combina ions, (f ) ( ) = f M ( ) \ M ( ) and ( f )M ( ) M = S f ( ). ( R f )M ( ) = s S t S, t f M ( ) and (s t) R .
430
E. Allen Emerson and Richard J. Trefler
( Y f (Y ))M ( ) = \ S 0 S (f (Y ))M ( [S 0 Y ]) = S 0 . ( 0Y f (Y ))M ( ) = . ( (k + 1)Y f (Y ))M ( ) = (f (Y ))M ( [( kY f (Y ))M ( ) Y ]). For valua ion , [A Y ] is he valua ion everywhere equal o excep ha [A Y ](Y ) = A. We say ha variable Y is free (no bound) in formula f if i does no occur syn ac ically wi hin a Y opera or. A sen ence is a formula wi h no free variables and we assume ha all bound variables are bound uniquely in sen ences. Al dep h(f ), is he al erna ion dep h of he formula f , ha is, 1 + he dep h of nes ing of al erna ing ’s and ’s when f is pu in posi ive normal form. We will a imes make use of Compu a ion Tree Logic (CTL) [CE81] and CTL [EH86] formulae o explica e resul s. Bo h logics use he universal A and exis en ial E pa h quan i ers oge her wi h he s andard X F G and U emporal opera ors over pa hs. CTL is res ric ed o formulae where each pa h quan i er is ma ched wi h a single pa h opera or while CTL allows arbi rary nes ing and boolean combina ions of emporal opera ors over pa hs o be combined wi h a single pa h quan i er. I is known ha CTL formulae can be seen as simple macros for -calculus formulae of al erna ion dep h 1, while CTL can be ransla ed in o he -calculus bu wi h an exponen ial blowup in formula leng h. We no e ha he CTL fairness formula E( GFP ), which says ha here is a pa h along which for each i, P is sa is ed in ni ely of en, can be EXEF(P Z) which is expressed in IRTL as expressed in RTL as Z ( Y R ((P Z) Y )). Z
3
Symmetry of Structures
Sym I = is a permu a ion on I . Sym I oge her wi h he func ion composi ion opera or, , is a group, where he inverse of is deno ed by −1 . Given s a e s and permu a ion , we say ha ac s on s, wri en (s), in LP I Pj s . For example, le s = he following way (s) = P (j) (C1 T2 ) and be he permu a ion which flips 1 and 2. Then (s) = (T1 C2 ). Similarly for s ruc ures, (M ), ac ing on M , is he s ruc ure (S 0 R0 ) where (s) LP I s S and (s) (t) R0 i s t R. Then is S0 = an au omorphism of M if (M ) = M and Aut(M ) is he se Sym I such ha is an au omorphism of M . Aut(M ) is a subgroup of Sym I which will be deno ed by Aut(M ) Sym I. Le f be a formula of RTL , (f ) is he formula which is iden ical o f LP I (Y V0 I)is replaced by P ( ) excep ha each occurrence of P (Y ( ) ). Then Aut(f ) = Sym I (f ) f [ES96]. Auto(f ) 1 is he se of Sym I such ha for each maximal proposi ional sub-formula, , of f , ( ) . Bo h Aut(f ) and Auto(f ) are subgroups of Sym I and Auto(f ) Aut(f ). 1
A more general de ni ion of Auto(f ) can be found in [ES96].
Model Checking Real-Time Proper ies of Symme ric Sys ems
431
Given s ruc ure M = (S R), le G be a subgroup of Aut(M ). Two s a es, G s s0 S are equivalen wi h respec o G, wri en s G s0 , if here exis s such ha (s) = s0 [ES96], [CE96]. Because G is a (sub)group i is clear ha G is an equivalence rela ion. Then for each equivalence class in G we choose an arbi rary member s a e o represen ha class and refer o ha s a e as s S, s is he represen a ive and i s equivalence class as [s]. Tha is, given s = (S R), is he unanno a ed quo ien of [s] = t S t G s . M = M G s ruc ure where S is he se of s such ha s is he represen a ive of an equivalence class of G . R S S is he se of ransi ions (s t) such ha here exis s s0 G s, t0 R. t0 G t and s0 M = M G = (S R), is he anno a ed quo ien s ruc ure where S is he se of s such ha , as above, s is he represen a ive of an equivalence class of G . R S G S is de ned by he res ric ions : (i) if s t R hen here is a t R and (t) = t; (ii) s t R only if s (t) R. unique such ha s Model checking for RTL could be carried ou on ei her M of M . We choose o make use of M which can be seen as a da a s ruc ure which, for a modes increase in he number of s a es in M , can help organize he model checking algori hm. However, he fac ha he number of s a es in M is larger, by a fac or of I , over M can be misleading. Al hough i may be unusual wo s a es s and t may have an exponen ial number of labeled arcs be ween hem in M bu in M hose same wo s a es will have a mos a quadra ic number of arcs I) R RED ) where R and RED be ween hem. Technically M = (S ( 0 are ransi ion rela ions. For i j I, s i t j R i here exis s −1 such ha s t R and (i) = j. For i I, s 0 s i RED and s i s 0 RED . Finally, s 0 t 0 R i here is a such ha t R. s
4
Temporal Formulae on Annotated Structures
We de ne he meaning of an RTL formula, f , on an anno a ed s ruc ure M . We say ha s a e s in M sa is es f if s f M (al erna ively wri en M s f ). For he purposes of his de ni ion M could, in general, be any anno a ed s ruc ure and need no correspond o he symme ry reduced quo ien of any par icular 2S ] 2S and valua ion [Var 2S ]. unanno a ed s ruc ure. f M : [Var S such ha P s. For Y Var, For P , P M ( ) is he se of s a es s M (Y ). Y ( ) is he se of s a es s S such ha s (f )M ( ) = f M ( ) \ M ( ). ( f )M ( ) = S f M ( ). t R and t ( −1 (f ))M ( ) . ( R f )M ( ) = s S here exis s s ( Y f (Y ))M ( ) = \ S 0 S (f (Y ))M ( [S 0 Y ]) = S 0 . ( 0Y f (Y ))M ( ) = . ( (k + 1)Y f (Y ))M ( ) = f (Y )M ( [( kY f (Y ))M ( ) Y ]).
432
E. Allen Emerson and Richard J. Trefler
The following heorem rela es he meaning of RTL sen ence f over a s rucure M and he meaning of f over he anno a ed s ruc ure M . For [Var S S [Var 2 ] we say ha and correspond i (Y ) = t t G s, 2 ] and for some s (Y ) . Aut(M ), and let and be correTheorem 1. Let M = M G , for G M spondin valuations. Then for any RTL sentence f , s f ( ) i s f M ( ).
5
Real-Time Mu-Calculus Model Checkin
We show how o reduce he problem of model checking IRTL formula f over M o he problem of checking he ransformed formulae T (f ), over he hreaded s ruc ure M . This reduc ion implies an algori hm for model checking f over M , by checking T (f ) over M . We proceed as follows, rs ly, we de ne a ransla ion from formulae of IRTL over LP I, V (V0 I) and R o formulae of RTL over LP , V, V0 , R and RED . The in ui ion behind his ransforma ion is ha he s a es of M , which are of he form s i , only record he sa isfac ion of proposi ions P which are rue a s. Therefore he subscrip i can be dropped in hese ‘local’ s a es. We hen use he s a e s 0 as a ‘global’ s a e o collec informa ion abou all he s i ’s. I is hen possible o rade he universal quan i ca ion over i in formulae of he form f for a modal opera or [RED] a s a e s 0 and check ha all he s i ’s sa isfy f . We hen model check he ransformed formulae over he s ruc ure M [EL86]. Since M is an unanno a ed s ruc ure, -calculus model checking algori hms may be applied direc ly o he problem of checking whe her he ransformed formula is sa is ed by M . For he purposes of his ∗ model checking we de ne he meaning of P LP over M as follows P M ( ) = s . The meaning of a compound formula or variable is s i i = 0 and P de ned by i s s andard meaning as given in Sec ion 2. Technically, we dis inguish be ween global and local IRTL formulae. Global formulae are hose where all indexed proposi ions and variables appear wi hin or quan i er. Local formulae have a leas one indexed he scope of an or . proposi ion or variable which does no appear wi hin he scope of any Then for formula, f , of IRTL we de ne he ransform of f , T (f ) as follows. T (P ) = P . T (Y ) = Y . T (Z) = Z. For f and bo h local or bo h global: T (f ) = T (f ) T ( ). T (f ) = T (f ) T ( ). ) = ( RED T (f )) T ( ). For f global and local: T (f ) = ( RED T (f )) T ( ). T (f T ( f ) = T (f ). T ( f ) = [RED]T (f1 ). Because he f ’s are isomorphic, T (f1 ) = T (f2 ), we need only check for T (f1 ). T ( f ) = RED T (f1 ). T ( Z f (Z)) = Z T (f (Z)). T ( kZ f (Z)) = kZ T (f (Z)).
Model Checking Real-Time Proper ies of Symme ric Sys ems
433
T ( Y f (Y )) = Y T (f (Y )). T ( kY f (Y )) = kY T (f (Y )). The idea behind T ( f ) = [RED]T (f1 ) is ha s sa is es f in M i for all i I, s i sa is es f in M and we use s 0 o check whe her in fac his is he case. Recall from he de ni ion of M ha he only ransi ions in RED are from s 0 o s i and vice versa. Le be a valua ion over M and be a valua ion over M . Then we say ha and correspond when for global variable Z, (Z) = s 0 s (Z) (Y ) . and for local variable Y V0 , (Y ) = s i s Proposition 1. Let f be a lobal formula of IRTL while and are corre∗ (T (f ))M ( ). spondin valuations. Then s f M ( ) i s 0 Let f be a local formula of IRTL while and are correspondin valua∗ (T (f ))M ( ). tions. Then s f M ( ) i s i Theorem 2. For lobal sentence f of IRTL , T (f ) can be model checked over the structure M in time O(( M f )altdepth(f ) ). Remark : This ime bound can be improved o O(( M f )b(altdepth(f )+1) 2c ) [LB94] and in general we may ake advan age of any -calculus algori hm wi h a be er ime bound. Corollary 1. The model checkin problem ‘does IRTL can be solved in time O(( M f )altdepth(f ) ).
6
formula f hold in M ’
Applications
Cer ain problems ha are in general NP-hard become solvable in polynomial ime in he special case of symme ric s ruc ures. We now discuss he complexi y of model checking symme ric s ruc ures and symme ric formulae. Our rs resul s show ha model checking cer ain basic emporal logic formulae over anno a ed symme ry reduced s ruc ures is NP-hard. Secondly, we show ha model GFk P over unanno a ed checking he indexed bounded fairness formula E s ruc ures is NP-hard. This implies ha i is unlikely ha here is a ‘shor ’ IRTL formula expressing his proper y and hence is an indica ion ha bounded fairness may be exponen ially harder o check han more s andard fairness noions. Theorem . M s
EFp is NP-hard. M s
EGp is NP-hard.
Pn ) be a boolean formula over he proposi ions Proof Idea: Le q(P1 Q2n−1 ) where he 2n Q ’s are fresh P1 hrough Pn . De ne p as q(Q1 Q3 proposi ional symbols. M is he anno a ed s ruc ure which consis s of he single Q2n−1 . There are wo s a e s which is labeled wi h he proposi ions Q1 Q3 ransi ions from s o s, he rs is labeled by he ro a ion permu a ion (1 2 2n) and he second by he ransposi ion permu a ion (1 2). Arbi rary composi ion of hese wo permu a ions is enough o crea e any permu a ion in Sym 2n. I Pn ) is sa is able i M s EFp. 2 can hen be shown ha q(P1
434
E. Allen Emerson and Richard J. Trefler
Theorem 4. M s = E
GFk P is NP-hard.
The following heorems rela e he CTL formula E( FP ) o any equivalen ransla ion in o he -calculus. E( FP ) says ha here is a pa h such ha for all i, even ually P is rue. Theorem 5. [SC85] (c.f. [CE81]) M s = E( FP ) is NP-complete. However, when Aut(M ) = Aut(s) = Sym I, where Aut(s) = Sym I (s) = s , hen he model checking problem for E( FP ) can be solved e cien ly. Proposition 2. M s = [E( FP )] i M s = EFP (n) ))
2Sym I
EF(P
(1)
EF(P
(2)
Theorem 6. Aut(M ) = Aut(s) = Sym I implies that M s = E( FP ) i EFPn )) . M s = EF(P1 EF(P2 Proof idea: Righ o lef follows from he exis ence of a pa h hrough each of he P ’s. Suppose s sa is es E( FP ) hen s also sa is es EF(P (1) EF(P (2) EFP (n) )) for some . By s a e symme ry [ES96] s also sa is es EF(P1 EFPn )). 2 EF(P2 Because EF(P1 EF(P2 EFPn )) is a CTL formula and can be ransla ed in o a -calculus formula of al erna ion dep h 1 i can be model checked on a s ruc ure M in ime linear in he size of he s ruc ure and he formula as opposed o he presumed exponen ial ime algori hm for model checking E FP . We can ex end his reasoning as follows. Theorem 7. Suppose M s = AGEFs and Aut(s) = Aut(M ) = Sym I. Then M s = E( FP ) i M s = EFP i M s = EFP1 . EFP can be ransla ed in o an IRTL formula of The poin being ha al erna ion dep h 1 and hence can be model checked on he symme ry reduced EFPn )) canno s ruc ure M quickly where as i seems ha EF(P1 EF(P2 be. I is, in general, in eres ing o consider he classes of linear ime formula h and s ruc ures M for which s sa is es E h is equivalen o s sa is es Eh because he la er formula can be checked much more quickly on bo h he large and he symme ry reduced s ruc ures.
7
Conclusion
This paper has described a general framework for performing model checking for formulae of he -calculus on symme ric sys ems. We have given e cien model checking algori hms for indexed sub-logics of he Real-Time -calculus over anno a ed s ruc ures. These real- ime logics are useful for describing he quan i a ive and quali a ive proper ies of a large class of programs ha opera e
Model Checking Real-Time Proper ies of Symme ric Sys ems
435
in real- ime environmen s, such as ne work communica ion pro ocols and embedded real- ime con rol sys ems. Fur hermore, our framework subsumes indexed formula ions of RTCTL [EM92] and CTL [ES97]. We have also shown ha he hreaded graph cons ruc ion of [ES97], used in a di eren form in [ES96], is more general and hus more applicable han previously hough . M suppor s general -calculus model checking. Bu ha leaves he ques ion, ‘where did he au oma a go?’ The answer is ha M may be viewed as an au oma on of a par icularly simple na ure, one whose job i is o s eadily keep rack of shif ing indices. We remark ha for checking fairness our me hod requires essen ially quadra ic ime in M for weak fairness versus linear ime in M for [ES97]; bu his is an ar ifac of using he more general -calculus of al erna ion dep h 2 (c.f. [EL86] vs [EL87]). The work presen ed here deals wi h quan i a ive, discre e real- ime logics. These logics are exponen ially more succinc bu no s ric ly more expressive han heir un imed coun erpar s. An in eres ing area for fur her research is reasoning abou symme ry on explici ly imed s ruc ures which model dense or discre e ime as discussed in [AC90], [Al91] and [He91]. We have also iden i ed an in eres ing open problem in he realm of model checking symme ric s rucures, ha is o fully charac erize he rela ionship be ween formulae of he form Eh and E( h ) over symme ric s ruc ures.
References AC90.
Al91. CE81.
CE96.
Em92. EH86.
EL86.
Alur, R., Courcoube is, C., and Dill, D., Model Checking for Real-Time Sysems. In Proceedin s of the Fifth Annual Symposium on Lo ic in Computer Science, pp. 414-425, IEEE Compu er Socie y Press, 1990. Alur, R., Techniques for Automatic Veri cation of Real-Time Systems. PhD hesis, S anford Universi y, 1991. Clarke, E. M., and Emerson, E. A., Design and Veri ca ion of Synchroniza ion Skele ons using Branching Time Temporal Logic, Logics of Programs Workshop, IBM York own Heigh s, New York, Springer LNCS no. 131., pp. 52-71, May 1981. Clarke, E. M., Filkorn, T., and Jha, S., Exploi ing Symme ry in Temporal Logic Model Checking. In Fifth International Conference on Computer Aided Veri cation, Cre e, Greece, June 1993. Journal version appears as: Clarke, E. M., Enders, R. Filkorn, T. and Jha, S., Exploi ing Symme ry in Temporal Logic Model Checking. In Formal Methods in System Desi n, Kluwer, vol. 9, no. 1/2, Augus 1996. E. Allen Emerson Real Time and he Calculus. In Proceedin s of RealTime: Theory in Practice, LNCS, Vol. 600, pp. 176-194, Springer, June 1992. Emerson, E. A., and Halpern, J. Y., ‘Some imes’ and ‘No Never’ Revisi ed: On Branching versus Linear Time Temporal Logic, JACM, vol. 33, no. 1, pp. 151-178, Jan. 86. Emerson, E. A., and Lei, C.-L., E cien Model Checking in Fragmen s of he Mu-Calculus, IEEE Symp. on Logic in Compu er Science (LICS), Cambridge, Mass., 1986.
436 EL87.
E. Allen Emerson and Richard J. Trefler
Emerson, E. A., and Lei, C.-L.m Modali ies for Model Checking: Branching Time S rikes Back, pp. 84-96, ACM POPL85; journal version appears in Sci. Comp. Prog. vol. 8, pp 275-306, 1987. EM92. Emerson, E. A., Mok, A. K., Sis la, A. P., and Srinivasan, J., Quan i a ive Temporal Reasoning. In Journal of Real Time Systems, vol. 4, pp. 331-352, 1992. ES96. Emerson, E. A. and Sis la, A. P., Symme ry and Model Checking. In Fifth International Conference on Computer Aided Veri cation, Cre e, Greece, June 1993. Journal Version appeared in Formal Methods in System Desi n, Kluwer, vol. 9, no. 1/2, Augus 1996. ES97. Emerson, E. A. and Sis la, A. P., U ilizing Symme ry when Model Checking under Fairness Assump ions. In Seventh International Conference on Computer Aided Veri cation Springer-Verlag, 1995. Journal version, TOPLAS 19(4): 617-638 (1997). GS97. Gyuris, V. and Sis la, A. P., On- he-Fly Model checking under Fairness ha Exploi s Symme ry. In Proceedin s of the 9th International Conference on Computer Aided Veri cation, Haifa, Israel, 1997. He91. Henzinger, T., The Temporal Speci ca ion and Veri ca ion of Real-Time Sysems, Ph.D. Thesis, S anford Universi y, 1991, repor number STAN-CS-911380. ID96. Ip, C-W. N., Dill, D. L., Be er Veri ca ion hrough Symme ry. In Proc. 11th International Symposium on Computer Hardware Description Lanua es(CHDL), April, 1993. Journal version appeared in Formal Methods in System Desi n, Kluwer, vol. 9, no. 1/2, Augus 1996. JR91. Jensen, K. and Rozenberg, G. (eds.), High-Level Pe ri Ne s: Theory and Applica ion, Springer- Verlag, 1991. Ko83. Kozen, D., Resul s on he Proposi ional Mu-Calculus, Theor. Comp. Sci., pp. 333-354, Dec. 83. LP85. Li ch ens ein, O., and Pnueli, A., Checking Tha Fini e S a e Concurren Programs Sa isfy Their Linear Speci ca ions, POPL85, pp. 97-107, Jan. 85. LB94. Long, D., Browne, A., Clarke, E. Jha, S. and Marrero, W., An Improved Algori hm for he Evalua ion of Fixpoin Expressions. In Proc. of the 6th Inter. Conf. on Computer Aided Veri cation, Stanford, Sprin er LNCS no. 818, June 1994. QS82. Queille, J. P., and Sifakis, J., Speci ca ion and veri ca ion of concurren programs in CESAR, Proc. 5 h In . Symp. Prog., Springer LNCS no. 137, pp. 195-220, 1982. Se96. Seidl, H., A Modal -Calculus for Dura ional Transi ion Sys ems. In Eleventh Annual IEEE Symposium on Lo ic In Computer Science, IEEE Compu er Socie y Press, 1996. SC85. Sis la, A. P., and Clarke, E. M., The Complexi y of Proposi ional Linear Temporal Logic, J. ACM, Vol. 32, No. 3, pp.733-749, 1985. VW86. Vardi, M., and Wolper, P. , An Au oma a- heore ic Approach o Au oma ic Program Veri ca ion, Proc. IEEE LICS, pp. 332-344, 1986.
Locality of Order-Invariant First-Order Formulas Martin Grohe1 and Thomas Schwentick2 1
2
Institut f¨ur mathematische Logik, Eckerstr. 1,79104 Freiburg, Germany Institut f¨ur Informatik, Johannes-Gutenberg-Universit¨at Mainz, 55099 Mainz, Germany
Abstract. A query is local if the decision of whether a tuple in a structure satisfies this query only depends on a small neighborhood of the tuple. We prove that all queries expressible by order-invariant first-order formulas are local.
1 Introduction One of the fundamental properties of first-order formulas is their locality, which means that the decision of whether in a fixed structure a formula holds at some point (or at a tuple of points) only depends on a small neighborhood of this point (tuple). This result, proved by Gaifman [5], provides very convenient proofs that certain queries cannot be expressed by a first-order formula. For example, to decide whether there is a path between two vertices of a graph it clearly does not suffice to look at small neighborhoods of these vertices. Hence by locality, s-t-connectivity is not expressible in first-order logic. Recently, Libkin and others [3,8,9,10] systematically started to explore locality as tool for proving inexpressibility results. The ultimate goal of this line of research would have been to separate complexity classes, in particular to separate TC0 from LOGSPACE. However, a recent result of Hella [7], showing that even uniform AC0 contains non-local queries, has destroyed these hopes. Nevertheless, locality remains an important tool for proving inexpressibility results for query languages. In database theory, one often faces a situation where the physical representation of the database, which we consider as a relational structure, induces an order on the structure, but this order is hidden to the user. The user may use the order in her queries, but the result of the query should not depend on the given order. It may seem that this does not help her, but actually there are first-order formulas that use the order to express order-invariant queries that cannot be expressed without the order. This is an unpublished result due to Gurevich [6]; for examples of such queries we refer the reader to [1,2] and Example 3 (due to [4]). Formally, we say that a first-order formula (x) whose vocabulary contains the order symbol is order-invariant on a class C of structures if for all structures A C, tuples a of elements of A, and linear orders 1 , 2 on A we have: (a) holds in (A 1 ) if, and only if, (a) holds in (A 2 ). It is an easy consequence of the interpolation theorem that if a formula is order-invariant on the class of all structures, it is equivalent to a first-order formula that does not use the ordering. This is no longer true when restricted to the class of all finite structures, or to a class consisting of a single infinite structure. Unfortunately, these are the cases showing up naturally in applications to computer science. We prove that for all classes C of structures the first-order formulas Luboˇs Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 437–445, 1998. c Springer-Verlag Berlin Heidelberg 1998
438
Martin Grohe and Thomas Schwentick
that are order-invariant on C can only define queries that are local on all structures in C. This gives us a good intuition about the expressive power of order-invariant first-order formulas and a simple method to prove inexpressibility results. The paper is organized as follows: After the preliminaries, we prove the locality of order-invariant first-order formulas with one free variable in Section 3. In Section 4 we reduce the case of formulas with arbitrarily many variables to the one-variable case. Due to space limitations, we can only sketch most of the proofs. The full paper is available via http://www.Informatik.Uni-Mainz.DE/˜tick/ and http: //logimac.mathematik.uni-freiburg.de/preprints/grohe/pub.html. We would like to thank Juha Nurmonen for pointing us to the problem and Clemens Lautemann for fruitful discussions about its solution.
2 Preliminaries A vocabulary is a set containing finitely many relation and constant symbols. A Ar structure A consists of a set A, called the universe of A, an interpretation RA A for each r-ary relation symbol R , and an interpretation c A of each constant symbol c . For example, a graph can be considered as an E -structure A = (A E A ), where E is a binary relation symbol. An ordered structure is a structure whose vocabulary contains the distinguished binary relation symbol which is interpreted as a linear order of the universe. [i j] always denotes the set i i + 1 j of integers. Occasionally, we need to consider strings as finite structures. For each l 1, we let P1 Pl min max with unary relation symbols Pj l denote the vocabulary and constant symbols min and max. We represent a string s = s1 sn over an l-letter alphabet = 1 l by the ordered l -structure with universe [1 n], where Pj is interpreted as i s = j , for every j, and min = 1, max = n. In our notation we do not distinguish between the string s and its representation as a finite structure s. A a subset that contains all constants of A, then the If A is a structure and B (induced) substructure of A with universe B is denoted by B A . Let be vocabularies. The -reduct of a -structure A, denoted by A , is the -structure with universe A in which all symbols of are interpreted as in A. On the other hand, each -structure A such that A = B is called a -expansion of B. B k1 Rl B kl , and b1 bm B, by For a -structure B, relations R1 Rl b1 bm ) we denote the expansion of B of a suitable vocabulary (B R1 that contains in addition to the symbols in a new k -ary relation symbol for each i l and m new constant symbols. Let k 1 and C a class of -structures. A k-ary query on C is a mapping that C such that for isomorphic assigns a k-ary relation on A to each structure A C each isomorphism f between A and B is also an isomorphism structures A B between the expanded structures (A (A)), (B (B)). 2.1 Types and Games Equivalence in first-order logic can be characterized in terms of the following Ehrenfeucht-Fra¨ıss´e game:
Locality of Order-Invariant First-Order Formulas
439
Definition 1. Let r 0 and A A0 structures of the same vocabulary. The r-round EF-game on A A0 is played by two players called the spoiler and the duplicator. In each of the r rounds of the game the spoiler either chooses an element v of A or an element v 0 of A0 . The duplicator answers by choosing an element v 0 of A0 or an element v of A, respectively. The duplicator wins the game if the mapping that maps v to 0 r) and each constant cA to the corresponding constant cA is a partial v 0 (for i isomorphism, that is, an isomorphism between the substructure of A generated by its domain and the substructure of A0 generated by its image. It is clear how to define the notion of a winning strategy for the duplicator in the game. The quantifier-depth of a first-order formula is the maximal number of nested quantifiers in the formula. The r-type of a structure A is the set of all first-order sentences of quantifier-depth at most r satisfied by A. It is a well-known fact that for each vocabulary there is only a finite number of distinct r-types of -structures (simply because there are only finitely many inequivalent first-order formulas of vocabulary and quantifierdepth at most r). We write A r A0 to denote that A and A0 have the same r-type. Theorem 1. Let r 0 and A A0 structures of the same vocabulary. Then A r and only if, the duplicator has a winning strategy for the r-round EF-game on A
A0 if, A0 .
The following two simple examples, both needed later, may serve as an exercise for the reader in proving non-expressibility results using the EF-game. Example 1. Let r 1 and m = 2r +1. Using the r-round EF-game, it is not hard to see that the strings 1m 0m and 1m−1 0m+1 have the same r-type. This implies, for example, that the class 1n 0n n 1 cannot be defined by a first-order sentence. Example 2. We may consider Boolean algebras as structures of vocabulary 0 1 . In particular, let P(n) denote the power-set algebra over [1 n]. It is not hard to prove that for each r 1 there exists an n such that P(n) r P(n + 1). Thus the class P(n) n even cannot be defined by a first-order sentence. In some applications, it is convenient to modify the EF-game as follows: Instead of choosing an element in a round of the game, the spoiler may also skip the round. In this case, v and v 0 remain undefined; we may also write v = v 0 = . Of course undefined v s are not considered in the decision whether the duplicator wins. It is obvious that the duplicator has a winning strategy for the r-round modified EF-game on A A0 if, and only if, she has a winning strategy for the original r-round EF-game on A A0 . 2.2 Order Invariant First-Order Logic Definition 2. Let be a vocabulary that does not contain and C a class of -strucxk ) of vocabulary is order-invariant on C if for all tures. A formula (x1 A C, a1 ak A, and linear orders 1 2 of A we have (A If
1)
= (a1
is order invariant on the class
ak )
(A
A
we also say that
2)
= (a1
ak )
is order-invariant on A.
440
Martin Grohe and Thomas Schwentick
To simplify our notation, if a -formula (x) is order-invariant on a class C of -structures and A C, a A we write A =inv (a) to denote that for some, hence for all orderings on A we have (A ) = (a). Furthermore, we say that (x) defines a A =inv (a) on C.1 Let us emphasize that, although orderthe query A invariant first-order logic sounds like a restriction of pure first-order logic, it is actually an extension: There are queries on the class of all finite structures that are definable by an order-invariant first-order formula, but not by a pure first-order formula [6]. The following example can be found in [4]. Example 3. There is an order-invariant first-order sentence of vocabulary 0 1 that defines the query P(n) n even on the class of all finite Boolean algebras. By Example 2, this query is not definable in first-order logic. 2.3 Local Formulas Let A be a -structure. The Gaifman graph of A is the graph with universe A where a b A are adjacent if they occur in a tuple c of some relation of A. The distance dA (a b) between two elements a b A is defined to be the length of a shortest path from a to b in the Gaifman graph of A; if no such path exists we let dA (a b) = . , The -ball around a A is defined to be the set B A (a) = b A dA (a b) and the -sphere is the set S A (a) = b A dA (a b) = . If A is clear from the For sets B C A weSlet d(B C) = context, we usually omit the superscript A . S min d(b c) b B c C and B (B) = b2B B (b), S (B) = b2B S (b). For ak b = b 1 bl A we let d(a b) = d( a1 ak b1 bl ), tuples a = a1 ak ), and S (a) = S ( a1 ak ). B (a) = B ( a1 Definition 3. (1) A k-ary query on a class C is local if there exists a for all A C and a b Ak we have B (a) A = B (b) A =
a
(A)
b
0 such that
(A)
The least such is called the locality rank of . (2) A formula (x) that is order-invariant on a class C is local, if the query it defines is local. The locality rank of (x) is the locality rank of this query. It should be emphasized that, in the definition of local order-invariant formulas, neither the isomorphisms nor the distance function refer to the linear order. Gaifman [5] has proved that first-order formulas can only define local queries.
3 Locality of Invariant Formulas with One Free Variable In this section we are going to show the locality of order-invariant first-order formulas with one free variable. Before we formally state and prove this result, we need some preparation. 1
This is ambiguous because (x) also defines a query on the class of all -structures. But if we speak of a query defined by an order-invariant formula, we always refer to the query defined in the text.
Locality of Order-Invariant First-Order Formulas
441
Lemma 1. For all l r N there are m n N such that for all l-strings s of size at least n there are unary relations P and P 0 on s such that (1) P = m, (2) P 0 = m−1, and (3) (s P ) r (s P 0 ).
N be fixed and t the number of r-types of vocabulary l . We let Proof. Let l r m = 2r + 1 and choose n large enough such that whenever the edges of a complete graph with n vertices are colored with t colors, there is an induced subgraph of size 2m + 1 all of whose edges have the same color. sn0 be an l-string of length n0 n. For i < j n0 we let i j Let s = s1 sj . denote the l-substring s For i < j n0 we color the pair i j (that is, the edge i j of the complete graph on [1 n]) with the r-type of (the representation of) i j . By the choice of n we find < p2m+1 n0 such that all structures p pj , for i < j 2m + 1 vertices p1 < pm and P 0 = p1 pm−1 . 2m + 1, have the same r-type. We let P = p1 We claim that (s P ) r (s P 0 ). Intuitively, we prove this claim by carrying over a winning strategy for the duplicator on the strings u = 1m 0m and u0 = 1m−1 0m+1 to our structures. Recall from Example 1 that such a strategy exists. Formally, we proceed [1 2m] by as follows: We define a mapping f : [1 n0 ] ( i < p +1 i if p f (x) = otherwise Consider the r-round EF-game on (s P ), (s P 0 ). As usual, let v and v 0 be the elements chosen in round i. It is not too difficult to prove, by induction on i, that the duplicator can play in such a way that for every i r one of the following conditions holds: (1) v < p1 and v 0 = v . (2) v > p2m+1 and v = v 0 . p2m+1 and the following two subconditions hold: (3) p1 v (a) The duplicator has a winning strategy for the (r − i)-round modified EF-game f (v )) and (u0 f (v10 ) f (v 0 )). on (u f (v1 ) (b) The duplicator has a winning strategy for the (r − i)-round modified EF(v )) and ( pf (vi0 ) pf (vi0 )+1 0 (v10 ) game on ( pf (vi ) pf (vi )+1 (v1 ) 0 0 (v )), where is the identity on pf (vi ) pf (vi )+1 and everywhere else and 0 is the identity on pf (vi0 ) pf (vi0 )+1 and everywhere else. Clearly, this implies the claim and thus the statement of the lemma.
2
Lemma 2. If a first-order formula (x) is order-invariant on a class C of structures then it is local on C. Proof. Let (x) be a first-order formula of quantifier-depth r that is order-invariant on a class C of -structures. Q0 Q2r , where Let l0 be the number of different r-types of vocabulary the Q are new unary relation symbols and let l := l0 2 . Let m and n be given by Lemma 1 above w.r.t. r and l. Let := n(2r + 1) + 2r and let := 5 + 1. Let A C. Let a b A, where B A (a) = B A (b) via an isomorphism .
442
a)
Martin Grohe and Thomas Schwentick
Our goal is to show that there are linear orders r (A 2 b). From this we can conclude
A =inv
(a)
(A
1)
(A
= (a)
1
and
2)
2
on A such that (A
= (b)
A =inv
1
(b)
In order to prove the existence of such linear orders, we first show that, w.l.o.g., we can assume the following. ( ) There is a set W a b , and an automorphism on B (W ) such that (a) = b. To show this, we distinguish the following two cases. – Case 1: d(a b) > 2 . In this case we simply set W := a b and define by ( (x) if x B (a) (x) := −1 (x) if x B (b) – Case 2: d(a b) 2 . Assume first that d(a (a)) > 4 , for some i > 0. Then we also have d(b (a)) > 2 . Furthermore, by the choice of , B (a) = B ( (a)) = B (b). We can conclude from the proof given below that
A =inv
(a)
If, on the other hand, d(a and = .
A =inv (a))
( (a))
A =inv
4 , for every i, we set W =
(b) (a) i
Z
Hence, we can assume ( ). In the following we only make use of B (a) = B (b) (as opposed to B (a) = B (b)). It is easy to see that every sphere S (W ) is a disjoint union of orbits of , i.e. a disjoint union of sets of the form O(v) = j (v) j Z , for some v. We fix, for every i, some linear order of the orbits of the sphere S (W ). Next we fix a preorder on A with the following properties. – is a linear order on A − B (W ), – c c0 , whenever c B (W ) and c0 A − B (W ), – c c0 , whenever c c0 B (W ) and d(c W ) < d(c0 W ), – c c0 , whenever c c0 B (W ), c and c0 are in the same sphere S (W ) but the orbit of c comes before the orbit of c in the order of the orbits of S (W ), and – c and c0 are not related with respect to , whenever c c0 B (W ) and c and c0 are in the same orbit. Both linear orders 1 and 2 will be refinements of . They will only differ inside some of the orbits. , is empty. Otherwise, B (W ) We can assume that no sphere S (W ), with i would be a union of connected components of A, hence we could fix any linear order on the orbits of B (W ) and define 1 by combining with and 2 by combining the image of under with . For each orbit O, we fix a vertex v(O) and define a linear order 0 on O by v(O) 0 0 −1 (v(O)) 0 2 (v(O)) 0 , if O is finite and by (v(O)) 0 v(O) 0
Locality of Order-Invariant First-Order Formulas
443
(v(O)) 0 , if O is infinite. For every k, we denote by k the image of 0 under 0 k . It is easy to see that (S (W ) j ) = (S (W ) j ), for all i j j 0 . To catch the intuitive idea of the proof, the reader should picture the spheres S (W ) (for 0 i ) as a sequence of concentric cycles, W itself being innermost. Outside these cycles is the rest of the structure A, fixed once and for all by the order . The automorphism is turning the cycles, say, clockwise. In particular, it turns the cycle W far enough to map a to b. Each cycle is ordered clockwise by 0 . The ordering k is the result of turning the cycle k-steps. (Unfortunately, all this is not exactly true, because usually the orbits do not form whole spheres. They may form small cycles or “infinite cycles”. But essentially it is the right picture.) To define the orders 1 and 2 we proceed as follows. We determine two sequences jm − 1 and 1 k1 km−1 − 1. We define 1 sphere1 j1 wise. On W we let 1 = 0 and 2 = 1 = ( 0 ). Then 1 looks from a as 2 looks from b, and this is how it should be. For all j < j1 we leave 1 = 0 on Sj (W ) but once we reach j1 we turn it one step. That is, we let 1 = 1 on Sj1 (W ). We stick with this, until we reach Sj2 (W ), and there we turn again and let 1 = 2 . We go on like this, and after the last turn at Sjm (W ) we have 1 = m , and that is what we wanted. Similarly, we define 2 by starting with 1 and taking turns at all spheres k , for 1 i m − 1. km−1 , hence, on the Again we end up with 2 = m on all spheres Sk (W ) for k outermost cycle S (W ) both orderings are the same. But of course the turns can be detected, so how can we hide that we took one more turn in defining 1 ? The idea is to consider the sequence of spheres as a long string, whose letters are the types of the spheres. The positions where a turn is taken can be considered as a unary predicate on this string. By Lemma 1, we can find unary predicates of sizes m and m − 1, respectively, such that the expansions of our string by these predicates are indistinguishable. This is exactly what we need. Essentially, this is what we do. But of course there are nasty details Let h = 2r + 1. For every i with 1 i n and j < j 0 2r let T(j j 0 ) denote the S h+j 0 (W ). Furthersubstructure of A that is induced by the spheres S h−j (W ) more let, for every i, 1 i n, the i-th super-sphere T be the structure T(2r 2r ) . Let the linear order j on T be defined by combining the orders j on the spheres of T with . Finally let Ej be the linear order on T that is obtained by combining ih, and with j+1 for the spheres Sq (W ) with j , for the spheres Sq (W ) with q 0 0 j j0 ) = (T ) and (T Ej ) = (T Ej ). with q > ih. For every i j j it holds (T Q2r on T by Qj = S c−j (W ) For every i, we define the unary relations Q0 S c+j (W ), i.e., a vertex v is in Qj , if its distance from the central sphere in T is j. sn as follows. Let z1 zl be an enumeration Now we define an l-string s = s1 Q2r -structures. We set s = j whenever zj is of all pairs of r-types of Q0 the pair (r-type of (T Q 0 ) r-type of (T Q E0 )) By Lemma 1 and our choice of the parameters l r m n there exist unary relations P and P 0 such that P = m, P 0 = m − 1 and the duplicator has a winning strategy in the r-round game on (s P ) and (s P 0 ). Now we are ready to define the linear orders 1 and 2 on A. For every i, let u(i) = j < i j P and u0 (i) = j < i j P . – –
1 2
is defined on T as is defined on T as
u( ) u( )
, if i , if i
P and as Eu( ) , if i P . P 0 and as Eu( ) , if i P 0 .
444
Martin Grohe and Thomas Schwentick
Observe that, although T and T +1 are not disjoint, these definitions are consistent. It remains to show that the duplicator has a winning strategy in the r-round game on (A 1 a) and (A 2 b). The proof of this fact is given in the full version. The winning strategy of the duplicator is obtained by transferring the winning strategy on (s P ) and (s P 0 ), making use of the gap preserving technique that was invented in [11].
2
4 Locality of Invariant Formulas with Arbitrarily Many Free Variables Lemma 3. Let be a vocabulary and r 0 k 1. Then there exists a = ( r k) xk ) is a first-order formula of vocabulary such that the following holds: If (x1 and quantifier-depth at most r that is order-invariant on a -structure A, then for all ak b = b 1 bk Ak with d(a aj ) d(b bj ) > 2 (for 1 i < j k) a = a1 we have B (a) A = B (b) A =
A=
(a)
A=
(b)
Proof. We only sketch the proof. Details are given in the full version. The proof is by induction on k. For k = 1 the lemma just restates the locality of order-invariant first-order formulas with one free variable, proved in Lemma 2. For k > 1, we assume that we have k-tuples a, b in A such that all the a aj and b bj are far apart (as the hypothesis of the Lemma requires) and we have an isomorphism : B (a) A = B (b) A for a sufficiently large . We prove that a and b cannot be distinguished by order-invariant formulas of vocabulary and quantifier-depth at most r. We distinguish between three cases: ak−1 The first is that some b , say, bk , is far away from a. Then we can treat a1 as constants and apply Lemma 2 to show that ak and bk cannot be distinguished in the ak−1 ). (Here we use the hypothesis d(a aj ) > 2k for expanded structure (A a1 all i k − 1). Then we treat bk as a constant and apply the induction hypothesis to ak−1 and b1 bk−1 cannot be distinguished in the prove that the (k − 1)-tuples a1 expanded structure (A bk ). (This requires our hypothesis that d(b bk ) > 2 for all i k − 1.) The second case is similar, we assume that for some h 1 the iterated partial isomorphism h maps some a far away from a. Then we first show that a and h (a) cannot be distinguished and then that h (a) and b cannot be distinguished. The third case is that for all h 1 the entire tuple h (a) is close to a. Then some restriction of is an automorphism of a substructure of A that maps a to b. We can modify this substructure in such a way that the tuples a and b can be encoded by single elements and then apply Lemma 2.
2
Theorem 2. Every first-order formula that is order-invariant on a class C of structures is local on C.
Locality of Order-Invariant First-Order Formulas
445
Proof. Again we only sketch the proof. For more details we refer the reader to the full version. The proof is by induction on the number k of free variables of a formula. We have already proved that formulas with one free variable are local. xk ) be invariant on C, A C, and a, b Ak such that B (a) A = So let (x1 B (b) A for a sufficiently large . Either all the a aj and b bj are far apart, then we can apply Lemma 3, or some of them are close together. In the latter case, we define a new structure where we encode pairs of elements of A that are close together by new elements. This does not spoil the distances too much, and we can encode our ktuples by smaller tuples that still have isomorphic neighborhoods. On these we apply the induction hypothesis.
2
5 Further Research The obvious question following our result is: What else can be added to first-order logic such that it remains local. Hella [7] proved that invariant first-order formulas that do not only use an order, but also addition and multiplication, are not local. On the other hand, we conjecture that just adding order and addition does not destroy locality. However, the fact that invariant formulas with built-in addition and multiplication are not local is more relevant to complexity theory, since first-order logic with built-in addition and multiplication captures uniform AC0 . One way to apply locality techniques to complexity theoretic questions in spite of Hella’s non-locality result is to weaken the notion of locality. For example, it is conceivable that all invariant AC0 or even TC0 -queries are local in the sense that if two points of a structure of size n have isomorphic neighborhoods of radius O(lo n), then they are indistinguishable. This would still be sufficient to separate LOGSPACE from these classes.
References 1. S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison-Wesley, 1995. 2. O. Belegradek, A. Stolboushkin, and M. Taitslin. Extended order-generic queries, 1997. Submitted for publication. 3. G. Dong, L. Libkin, and L. Wong. Local properties of query languages. In Proceedings of the 6th International Conference on Database Theory, volume 1186 of Lecture Notes in Computer Science, pages 140–154. Springer-Verlag, 1997. 4. H.-D. Ebbinghaus and J. Flum. Finite Model Theory. Springer-Verlag, 1995. 5. H. Gaifman. On local and non-local properties. In Proceedings of the Herbrand Symposium, Logic Colloquium ’81. North Holland, 1982. 6. Y. Gurevich. Private communication. 7. L. Hella. Private communication. 8. L. Hella, L. Libkin, and Y. Nurmonen. Notions of locality and their logical characterizations over finite models, 1998. unpublished. 9. L. Libkin. On forms of locality over finite models. In Proceedings of the 12th IEEE Symposium on Logic in Computer Science, pages 204–215, 1997. 10. L. Libkin. On counting and local properties. To appear in Proceedings of the 13th IEEE Symposium on Logic in Computer Science, 1998. 11. T. Schwentick. Graph connectivity and monadic NP. In Proceedings of the 35th Annual IEEE Symposium on Foundations of Computer Science, pages 614–622, 1994.
Probabilistic Concurrent Constraint Pro rammin : Towards a Fully Abstract Model Alessandra Di Pierro and Herbert Wiklicky adp,herbert @cs.c ty.ac.uk City University, Northampton Square, London EC1V OHB
Abstract. This paper presents a Banach space based approach towards a denotational semantics of a probabilistic constraint pro rammin lanua e. This lan ua e is based on the concurrent constraint pro rammin paradi m, where randomness is introduced by means of a probabilistic choice construct. As a result, we obtain a declarative framework, in which randomised al orithms can be expressed and formalised. The denotational model we present is constructed by usin functional-analytical techniques. As an example, the existence of xed-points is uaranteed by the Brouwer-Schauder Fixed-Point Theorem. A concrete xed-point construction is also presented which corresponds to a notion of observables capturin the exact results of both nite and in nite computations.
1
Introduction
Probabilistic Concurrent Constraint Pro rammin (PCCP) was introduced in [4] in order to allow the formulation of randomised al orithms within the declarative framework of Concurrent Constraint Pro rammin (CCP) [13]. The main feature of this lan ua e is a construct for probabilistic choice expressin a kind of nondeterminism which allows a pro ram to make stochastic moves durin its execution. An operational semantics describin such a behaviour was also iven in [4]. The ultimate aim of this work is to provide PCCP with a denotational semantics which is fully abstract with respect to the notion of observables introduced in [4], and correspondin to the exact results of both nite and in nite computations. One major problem that makes this task di cult is the presence in the lanua e of nondeterminism (thou h in its probabilistic, thus more re ned, version) in combination with synchronisation. In fact, any model reflectin these two aspects cannot be ‘too abstract’; information about the branchin structure and the synchronisation cannot be i nored, for which relatively complex structures are usually required like, for instance, the reactive sequences [3] or the bounded traces operators [13] adopted for CCP. Another problem, somehow ortho onal to the rst one, arises from the combination of (probabilistic) nondeterminism and in nite computations, in that it is di cult to nd the appropriate structure of the domain where limits can be characterised by a xed-point operator. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 446 455, 1998. c Sprin er-Verla Berlin Heidelber 1998
Probabilistic Concurrent Constraint Pro rammin
447
As a rst step, we concentrate in this paper on the second problem and we abstract from the problem of synchronisation. We therefore de ne a denotational semantics capturin both probabilistic nondeterminism and in nite limit results for a sub-lan ua e of PCCP which has no suspension mechanism (all the uards are true). This lan ua e corresponds to Constraint Lo ic Pro rammin where the or-nondeterminism is replaced by a probabilistic choice amon the input clauses. Thus we call it Probabilistic Constraint Lo ic Pro rammin (PCLP). The domains we will consider for the semantics of PCLP are based on linear structures, that is on vector spaces and their structure preservin morphisms: linear mappin s and operators. Vector spaces provide a common and most widely used model for various sciences, ran in from physics to economics, but they are much less popular in computer science. In the context of our investi ations they come into considerations because they combine quantitative and qualitative concepts. This is useful in PCCP (PCLP), as a computation in this paradi m incorporates some quantitative information, besides the usual qualitative one, in the form of probabilities associated to the choice. Furthermore, vector spaces are very well studied mathematical structures, which makes it possible to utilise a reat number of well established results. We ar ue that the introduction of quantitative aspects in the semantics of CCP plays a fundamental role in modellin the pro ram behaviour. Thanks to the ability to measure the stren th of a constraint (quality) by means of the probability (quantity) assi ned to it, our denotational model succeeds in capturin some observable behaviours that the more classical powerdomain or metric based approaches fail to capture. More speci cally, while the Smyth powerdomain and the metric approaches to the semantics of constraint pro rammin have been shown unable to model the exact (in nite) results of a computation [1], the probabilistic model we de ne in this paper perfectly matches this behaviour. Moreover, it can be used also for the standard (non-probabilistic) version of Constraint Lo ic Pro rammin .
2
Probabilistic Constraint Lo ic Pro rammin
In [4] we introduce the lan ua e PCCP, which is essentially CCP where the nondeterministic choice is replaced by a probabilistic one1 . This allows us to see the execution of a pro ram as a random walk on the transition raph. Probabilistic Constraint Lo ic Pro rammin is the sub-lan ua e of PCCP obtained by replacin all the uards in the probabilistic choice construct by true. This eliminates the aspect of synchronisation from the lan ua e, thus allowin us to abstract (for the time bein ) from this problem. The syntax of PCLP is iven in Table 1. Successful termination is expressed by the a ent stop; the a ent tell, the hidin operator x and the procedure call p(x) are the usual ones (of CCP). The operator expresses the parallel 1
Another approach to incorporate probabilistic aspects into CCP lan ua es was introduced later in [7]. It is based on the use of random variables and is substantially di erent in both the aim and the method from our approach.
448
Alessandra Di Pierro and Herbert Wiklicky
P ::= D A D ::=
D D p(x) : −A
A ::= stop tell(c)
e
n =1
true p
A
A
A
xA
p(x)
Table 1. The syntax for PCLP.
e
composition of two a ents. Additionally we provide a probabilistic choice . Operationally this construct expresses the choice of one of the a ents A accordin to the assi ned probabilities p . The intended meanin of this is the usual interpretation of probability in probability theory: if the choice is repeated (under the same condition and su ciently often) the relative frequency of executions of an a ent A is exactly p . For the de nition of the (cylindric) constraint system underlyin the lan ua e we refer to [13].
3
Operational Semantics for PCLP
For the operational semantics of PCLP we essentially use the probabilistic transition system introduced in [4]. Randomness is expressed by labels representin the probability that a transition takes place. A con uration represents the state of the system at a certain moment, namely the a ent A which has still to be executed, and the current store d. We denote a con uration by A d>. The probabilistic transition system for PCLP consists of a pair (Conf − p ), where Conf is a set of con urations and − p Conf R Conf is the transition relation de ned in Table 2. We denote the transitive closure of transition relation − p by − p0 , where p0 is the product of the probabilities associated to each sin le step. 3.1
The Observables
The notion of observables we consider captures the exact results of both nite and in nite computations to ether with their associated probabilities. Given a pro ram P , we de ne the result RP of an a ent A and an initial store d as the (multi-)set of all pairs c p>, where c is the least upper bound of the partial constraints accumulated durin a computation startin from d; and p is the probability of reachin that result. RP (A d) =
c p> Q A d>− p B c>− F d p> A d0>− p0
The rst term describes the results of nite computations, where the least upper bound of the partial store corresponds to the nal store. The second term
Probabilistic Concurrent Constraint Pro rammin
R1 R2 R
R4 R5
tell(c) d>
e
n =1
1
true p
A c> B c> A c>
A B
stop c
A d c>
d xA
p(y) c>
p p p
d>
A d>
pj
Aj d>
j
[1 n]
A0 c0> A0 B c0> B A0 c0>
x c> p d0 p x B 1
449
(
B d0> 0 c xd > x(
y
x
p(x) : −A
A)) c>
P
Table 2. The transition system for PCLP.
covers the in nite results. The probability of obtainin a certain result depends on the probabilities p associated to the possible paths which lead to it. To capture the true behaviour of an a ent we have to identify di erent computational paths leadin to the same result as well as to collect the accumulated probabilities associated with di erent interleavin s. In order to do this in a precise way we de ne the followin operation. By c j we denote the jth occurrence of the constraint c in the multi-set of all results. K(
c j p j>
j)
=
c Pci >
Pci =
P j
pj
Another operation normalises the probabilities. This is necessary as the probabilities in each interleavin add up to one such that the overall sum of probabilities is exactly the number of possible interleavin s. This process of renormalisation e ectively implies that all interleavin s are equally likely. N(
c p> )=
c
pi P>
P =
P
p
With these two operations we can de ne the observables associated to an a ent A and an initial store d as: OP (A d) = N (K(RP (A d))) Note that this notion of observables di ers from the classical notion of input/output behaviour in CCP. In the classical case a constraint c belon s to the input/output observables of a iven a ent A if at least one path leads from the initial store d to the nal result c. In the probabilistic case we have to consider all possible paths leadin to the same result c and combine the associated probabilities.
450
4
Alessandra Di Pierro and Herbert Wiklicky
A Denotational Semantics for PCLP
To simplify our presentation we will assume in the followin that the set of AjAj is nite, and that the set of constraints C = c 1 a ents A = A1 =0 is countable. In the case of uncountable constraint systems we can eneralise our approach, replacin sums by inte rals, l1 by L1 , etc. Then most of the results presented here can be transferred into an appropriate measure-theoretic settin . We assi n to each a ent a (probability) distribution on the set of constraints. De nition 1. A distribution on the set of constraints C isP a map from C into the real interval [0 1] satisfyin the normalisation condition: c2C (c) = 1. The set of distributions on C is denoted by D(C) or simply D. We de ne an interpretation I : A D as a function from the set of a ents A into the set of distributions D(C) on C. The set of all possible interpretations is denoted by I. For an a ent A A we represent its interpretation by I(A) = C and p = I(A)(c ). We will omit those pairs where the c p > , where c probability vanishes. The set of possible interpretations of an a ent A, I(A), forms a subset of the (real) Banach space l1 (C). The elements of the Banach space l1 (C) are iven by sequences of real numbers indexed by the elements of a (countable) constraint system such that the sum of their absolute values exists: l1 (C) =
x c>
x
Rc
C and
X
x
ci 2C
On the space of sequences l1 (C) we de ne a scalar product and vector addition pointwise and the norm as the usual l1 -norm (with q p R) by:
c p>
q +
c p> c q> c p>
= =
c qp > c p +q > X = p ci 2C
In order to model all constructs of our lan ua e we de ne two additional operations on this space: a tensor product ⊗ and a pointwise hidin operator: c p>
⊗ x
cj qj > c p>
j
= =
c
dj p qj > xc
j
p>
We can embed the set of all possible interpretations, I, in a similarly de ned Banach space l1 (C)jAj , i.e. the ( nite) cartesian product of A copies of l1 (C). Proposition 1. The space of interpretations I forms a convex, closed (nonempty) subset of the Banach space l1 (C)jAj .
Probabilistic Concurrent Constraint Pro rammin
(I)(stop)
=
true 1>
(I)(tell(c))
=
c 1>
(I)(
e
n =1
(I)(A1 (I)(
true p
A)=
P
n =1
p
(I)(A )
= (I)(A1 ) ⊗
A2 )
x A)
=
(I)(p(x))
x
= I(
451
(I)(A2 )
(I)(A) x y A)
Table 3. The compositional de nition of
:I
I.
On the set of interpretations I we de ne inductively the xed-point operator A)) as in Table 3 (where xy A is a shorthand notation for ( y x( x as in R5 in Table 2). Some useful properties of this operator are stated in the followin proposition. Proposition 2. The operator is well-de ned on I l1 (C)jAj and has the followin properties: (i) is continuous, and (ii) is compact, i.e. the closure of (I) is compact. Proof. (Idea) Ad (i): is linear and bound and therefore continuous, ad (ii): is the limit of nite-dimensional operators as PCLP is nitely branchin . To uarantee the existence of a xed-point of from functional analysis [5, Theorem 18.10’].
we use a classical theorem
Theorem 1. (Brouwer-Schauder Theorem) Let F : K K be a continuous mappin from a non-empty closed, convex set K in a Banach space into itself, with the closure of F (K) compact. Then there exists a xed-point of F , i.e. a point c K such that F (c) = c. By Theorem 1 and Propositions 1 and 2, we can uarantee: Theorem 2. The operator 4.1
Construction of a
has a xed-point. ixed-Point
In order to concretely construct a xed-point of we will mimic the classical xed-point construction: Startin with the initial interpretation I0 assi nin to true 1> , we iteratively apply in each a ent A the distribution I0 (A) = order to construct a (pointwise) limit of the sequence of interpretations In n =
452
Alessandra Di Pierro and Herbert Wiklicky
n I0 (I0 ) 2 (I0 ) (I0 ) . This limit will be a xed-point of because of continuity. To show conver ence we need some auxiliary constructions. We introduce the notion of volume of a constraint with respect to a distribution. This is rou hly the probability concentrated in the upward closure c of a constraint c C (with respect to in the constraint system) and will be essential in the construction of the limit interpretation de nin the meanin of our pro rams.
De nition 2. Given a distribution D, we de ne the volume of a constraint c with respect to as X (d) vol (c) = d2"c
There is a one-to-one correspondence between the ori inal distribution and the distribution of volumes vol . Usin a eneral inclusion-exclusion principle, e. . [6, Eqn. 3.3], we can show the followin lemma. Lemma 1. Given the volume vol (c) of each constraint c C with respect to a distribution D it is possible to reconstruct the distribution uniquely, by X X X vol(d) + vol(d e) − vol(d e f ) + (c) = vol(c) − d>c
d>e>c
f >d>e>c
The sequence In n in eneral is not pointwise monotone (e. . example 2 below), therefore it is not obvious how to prove its conver ence directly. However, it is easy to see that the correspondin sequence of volume distributions does conver e. Lemma 2. Let A A, c C and In sequence volIn (A) (c) n conver es.
n
Proof. (Sketch) For each constraint c
C the followin holds n
the sequence de ned above. Then the
N:
volIn (A) (c) 1, i.e. the volume of each constraint is bound by one in each interpretation, because is normalised , i.e. maps I(A) into I(A). volIn+1 (A) (c), i.e. the sequence of volumes is monotone (involIn (A) (c) creasin ). Therefore, the limit limn!1 volIn (A) (c) of a monotone and bound sequence of real numbers volIn (A) (c) exists. By Lemma 1 and continuity of we can reconstruct the pointwise limit of distributions from the pointwise limit of volumes of the constraints. Theorem 3. The sequence point of .
c In (A)(c)>
n
conver es pointwise to a
We are now in a position to de ne a semantics for PCLP.
xed-
Probabilistic Concurrent Constraint Pro rammin
De nition 3. For each a ent A wise limit of In (A) n ,
A we de ne its semantics Q(A) as the point-
Q(A) = lim In (A) = lim n!1
453
n!1
n
(I0 (A))
For this semantics we can establish the correspondence with the observables de ned in Section 3 by structural induction. Theorem 4. For all a ents A A the xed-point semantics Q(A) coincides with the observables OP (A true) = Q(A) We would like to point out that alternative xed-point constructions can be de ned which model di erent notions of observables. 4.2
Examples
Example 1. Consider the followin PCLP pro ram for computin the natural numbers: tell(x = 0) nat(x) : − true 12 true 12 nat(y)) y (tell(x = s(y))
e
The sequence of interpretations In (nat(x)) conver es pointwise to Q(nat(x)) = x = 0 1 2> x = s(0) 1 4> x = sn (0) 1 2n+1>
This clearly coincides with the observables OP (nat(x) true). Note that, contrary to the classical approach, these observables not only tell us that all numbers may be computed but also that the probability of computin lar er numbers decreases. Example 2. The followin declarations have been used in [1] (in their CCP formulation) as an example of the inapplicability of metric and order-theoretic approaches to modellin the exact results observables in constraint pro rammin . p(x) : − q(x) p(x) q(x) : − true 12 true 12 (r(x) tell(c)) r(x) : − tell(false)
e
In [1] it was shown that the interpretations de ned by usin an analo ous of the operator do not conver e with respect to any metric or order. In our quantitative semantics we et conver ence as the limit limn In exists for all three a ents, Q(p(x)) = Q(q(x)) = Q(r(x)) = false 1>
454
5
Alessandra Di Pierro and Herbert Wiklicky
Future Work
We plan to extend the denotational semantics developed here for PCLP to the full lan ua e PCCP. To this purpose it will be necessary to add an appropriate encodin of the branchin structure and the synchronisation for dealin with lobal choice. It seems that we can still use an underlyin Banach space structure; however it will be necessary to replace vectors (distributions) by matrices (operators) in order to keep track of the computational traces. We expect this model to be the ‘quantitative’ counterpart of the various (equivalent) fully abstract models developed until now for CCP. The only two attempts to describe the exact results of in nite computations in CCP we are aware of are [11] and [2], whereas the two approaches [3, 13] we already mentioned in the introduction have been shown to be fully abstract only with respect to the results of nite computations. Additional investi ations will compare our construction to other approaches towards the semantics of probabilistic pro rammin lan ua es [12, 9, 8], probabilistic predicate transformers [10] and lo ics and stochastic processes.
References [1] F. S. de Boer, A. Di Pierro, and C. Palamidessi. Nondeterminism and In nite Computations in Constraint Pro rammin . Theoretical Computer Science, 151(1), 1995. Selected Papers of the Workshop on Topolo y and Completion in Semantics, Chartres, France. [2] F. S. de Boer and M. Gabbrielli. In nite Computations in Concurrent Constraint Pro rammin . Electronic Notes in Theoretical Computer Science, 6:16, 1997. [3] F.S. de Boer and C. Palamidessi. A Fully Abstract Model for Concurrent Constraint Pro rammin . In S. Abramsky and T.S.E. Maibaum, editors, TAPSOFT/CAAP, volume 493, pa es 293 319. Sprin er Verla , 1991. [4] A. Di Pierro and H. Wiklicky. An operational semantics for Probabilistic Concurrent Constraint Pro rammin . In P. Iyer, Y. Choo, and D. Schmidt, editors, ICCL’98 International Conference on Computer Lan ua es, pa es 174 183. IEEE Computer Society and ACM SIGPLAN, IEEE Computer Society Press, May 1998. [5] K. Goebel and W.A. Kirk. Topics in Metric Fixed Point Theory, volume 28 of Cambrid e studies in advanced mathematics. Cambrid e University Press, Cambrid e, 1990. [6] C. M. Grinstead and J. L. Snell. Introduction to Probability. American Mathematical Society, Providence, Rhode Island, second revised edition, 1997. [7] V. Gupta, R. Ja adeesan, and V. A. Saraswat. Probabilistic concurrent constraint pro rammin . In Proceedin s of CONCUR 97. Sprin er Verla , 1997. [8] Claire Jones. Probabilistic Non-Determinism. PhD thesis, University of Edinbur h, Edin bur h, 1993. [9] Dexter Kozen. Semantics for probabilistic pro rams. Journal of Computer and System Sciences, 22:328 350, 1981. [10] C. Mor an, A. McIver, K. Seidel, and J.W. Sanders. Probabilistic predicate transformers. Technical Report PRG-TR-4-95, Pro rammin Research Group, Oxford University Computin Laboratory, 1995.
Probabilistic Concurrent Constraint Pro rammin
455
[11] S. O. Nystr¨ om and B. Jonsson. Indeterminate Concurrent Constraint Pro rammin : A Fixpoint Semantics for Non-Terminatin Computations. In D. Miller, editor, Proc. of the 1993 International Lo ic Pro rammin Symposium, Series on Lo ic Pro rammin , pa es 335 352. The MIT Press, 1993. [12] N. Saheb-Djahromi. CPO’s of measures for nondeterminism. Theoretical Computer Science, 12:19 37, 1980. [13] V. A. Saraswat, M. Rinard, and P. Panan aden. Semantics foundations of concurrent constraint pro rammin . In Proceedin s of POPL, pa es 333 353. ACM, 1991.
Lazy Functional Al orithms for Exact Real Functionals Alex K. Simpson LFCS, Department of Computer Science, University of Edinburgh, JCMB, King’s Buildings, Edinburgh, EH9 3JZ, Scotland
Abs rac . We show how functional languages can be used to write programs for real-valued functionals in exact real arithmetic. We concentrate on two useful functionals: de nite integration, and the functional returning the maximum value of a continuous function over a closed interval. The algorithms are a practical application of a method, due to Berger, for computing quanti ers over streams. Correctness proofs for the algorithms make essential use of domain theory.
1
Introduction
In exact real number computation, in nite representations of reals are employed to avoid the usual rounding errors that are inherent in floating point computation [4,5,6,17]. For certain real number computations that are highly sensitive to small variations in the input, such rounding errors become inordinately large and the use of floating-point algorithms can lead to completely erroneous results [1,14]. In such situations, exact real number computation provides guaranteed correctness, although at the (probably inevitable) price of a loss of e ciency. How to improve e ciency is a eld of active research [9]. Lazy functional programming provides a natural implementational style for exact real algorithms. One reason is that lazy functional languages support lazy in nite data structures, such as streams, which can be coveniently used to represent real numbers. The e cient management of such in nite data structures (for example, using call-by-need to avoid repeated computations) can be entrusted to the language implementer, leaving the programmer free to concentrate on the essentials of the algorithms being developed. Also, functional programming naturally supports the recursive de nition of functions, which is the most useful method of de ning exact functions on real numbers. Such considerations were important motivating factors in [4,5,17,6,7,10]. One principal distinguishing feature of functional languages is their acceptance of functions as rst-class values, and the associated possibility of passing functions as arguments to other function(al)s. In the context of exact real number computation, this raises the question of whether it is possible to write functional algorithms to implement useful functionals on real numbers. In [8], Edalat and Escardo show how to extend Real PCF [10] with primitive functionals for de nite integration, and for the maximum value attained by a continuous function Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 456 464, 1998. c Sprin er-Verla Berlin Heidelber 1998
Lazy Functional Algorithms for Exact Real Functionals
457
over a closed interval. However, their operational semantics is nondeterministic, and requires a parallel evaluation strategy which is not readily supported within the context of the standard sequential functional languages. The problem of whether such algorithms are possible sequentially was originally posed in Di Gianantonio’s PhD thesis [6], where it was conjectured that they are not. In this paper we show that Di Gianantonio’s conjecture is false. We provide sequential functional algorithms for the speci c and useful functionals of integration and maximum. The algorithms rely on a clever, but little known, idea of Berger, who showed how to compute quanti ers over predicates on streams sequentially [2]. Berger’s algorithms deserve to be better known, especially in the light of their possible applications. The work of Berger, Di Gianantonio, Escardo and Edalat, referred to above, was carried out in the context of the minimal functional language PCF [15] (and extensions of it). It would be fully possible to write this paper in the same setting, but we prefer instead to adopt a less spartan approach. The goal of this paper is to describe and verify particular functional algorithms. We therefore use an easily readable, although not formally de ned, functional pseudocode for expressing algorithms (just as an informal imperative pseudocode is used to specify algorithms throughout computer science). We also make use of a simple type discipline to specify the domains and codomains of functions. Not only does the type discipline improve the readability of the code, it also serves a more signi cant purpose. The statements of correctness of the algorithms and their veri cation make essential use of a denotational semantics de ned in terms of the type structure. Indeed it is a further bene t of using a functional language that a denotational semantics is easily obtained using standard constructions on complete partial orders. Because we have not formally de ned the language, we cannot formally de ne its semantics either. Nonetheless, the denotational semantics of functional programming languages is now well enough understood that it is possible to use such semantics in an informal way with full mathematical rigour. Our approach is to use denotational semantics as one more mathematical tool for verifying informally speci ed algorithms, alongside all the other tools available from the body of mathematics as a whole. Perhaps what is most interesting about the use of denotational semantics in this paper is that it goes beyond the mere existence of xed-points and their basic properties. Instead, the correctness proofs make use of topological properties (moduli of continuity) of the denotations of higher-order functions. Understanding the denotational semantics is helpful even to appreciate the correctness of the algorithms informally. In order to verify the algorithms rigorously, some use of domain theory appears to be essential.
2
Types and Their Denotations
In our functional pseudocode, we assume basic datatypes like int, the type of integers, bool, the type of booleans, as well as some convenient nite types: type two = {0,1} type three = {-1,0,1}
458
Alex K. Simpson
We assume that two is a subtype of three in the obvious way (so we shall not bother to include explicit coercions between them). The type constructors we use are A B, function space, A B, cartesian product, and A stream. Function application is assumed to be lazy. Mainly for denotational simplicity, we interpret as a lazy product (thus a pair may converge in one component but not the other). The behaviour of streams is best explained via the denotational semantics. For the denotational semantics, we use directed-complete partial orders with least element (henceforth cpos) for interpreting datatypes, and continuous functions between them for interpreting programs (see e.g. [12]). In Sec. 3 we refer to cpos as topological spaces, understanding them as carrying the Scott topology. Given a set X, we write X? for the flat cpo with least element and with all other elements taken from the set X. Basic types are interpreted as flat cpos by: [[int]] = Z?; [[bool]] = B ? where B = true false ; [[two]] = 2? where 2 = 0 1 ; and [[three]] = 3? where 3 = −1 0 1 . The function space is interpreted as the cpo, [[A B]], of all continuous functions from [[A]] to [[B]] ordered pointwise.The interpretation of the product type, [[A B]], is the straightforward cartesian product of [[A]] and [[B]] (as partially ordered sets). Streams will be denoted by possibly in nite sequences, so we develop some notation for these. For a set X we write: X for the set of nite sequences of its elements; X for the set of in nite sequences; and X 1 for the set of all for the (possibly sequences, i.e. X 1 = X X . For any sequence , we write in nite) length of and (i) (where 0 i < ) for the (i + 1)-th element of . We use textual juxtaposition, , for the concatenation of a nite sequence with an arbitrary sequence . We write n for the largest nite pre x, , of such that n. For x X we write − x for the in nite constant sequence. In the paper, we shall only ever use streams formed from base types. These have a straightforward interpretation. If [[A]] = X? then [[A stream]] = X 1 with X? and tl : X 1 X 1 for if and only if is a pre x of . We write hd : X 1 the evident head and tail functions. The cons operation on streams (written :: in our pseudocode) is the evident left-strict function from X? X 1 to X 1 .
3
Real Numbers: Representation and Semantics
In order to write algorithms for functions and functionals on the reals, we rst need to choose a representation for real numbers. It is well known that the standard base n notation for reals does not provide an adequate representation, as many simple functions (e.g. addition) are not computable exactly. However, many alternative choices of adequate representation are available. There are discussions of these issues in e.g. [6,9]. We shall use one of the simplest possible representations: a modi cation of the standard binary representation using negative digits. We consider an in nite sequence 3 (recall that 3 = −1 0 1 ) as representing the real number q( ) =
1 =0
(i)
2−( +1)
Lazy Functional Algorithms for Exact Real Functionals
459
This de nes a surjective function q from 3 to I, where we write I for the closed interval [−1 1]. The whole real line can be represented using a mantissa from 3 and an exponent from Z, thus (z ) Z 3 represents the real number 2z q( ). This representation will be used in the full version of the paper, but, for lack of space, is not considered further in this conference version. We use the natural type de nition to implement the representation. type interval = three stream There is, however, a mismatch between the datatype and the representation of reals. We have that [[interval]] = 31 , whereas only elements in the subset 3 have been given interpretations as real numbers. Just as not all values of type interval represent real numbers, neither do all functions of type interval interval represent functions on real numbers. We use the denotational semantics to distinguish those that do. For greater generality we work with n-ary functions. 31 is said to be total if it restricts to a An arbitrary function : (31 )n n 3 . Clearly , when it exists, is unique. Similarly, a function function : (3 ) 3 is said to be real if there exists a function : In I such that, for : (3 )n 3 , it holds that q( ( )) = (q( ) q( n )). Again all 1 n 1 n 1 is uniquely determined (because q is surjective). Putting the two together, we 31 is real-total if it is total and is real, in which case say that : (31 )n n I for the unique induced function. we write : I A functional program of type interval interval will always be denoted 31 . By topological trivialities, if we endow 3 with by a continuous : 31 the subspace topology of the Scott topology on 31 , and we endow I with the quotient topology of 3 under q, then, for any continuous real-total , we have that and are continuous. The proposition below makes this observation more interesting. Proposition 1. 1. The induced topolo ies on 3 and I are the product and Euclidean topolo ies respectively. I, there exists a real : (3 )n 3 such that 2. For any continuous f : In f= . 3 there exists a total : (31 )n 31 3. For any continuous : (3 )n such that = . In the full version of the paper the de nitions and results in this section will be related to work on totality in domain theory [2,3,16], and to topological injectivity (and projectivity) results [11].
4
Moduli of Continuity and Stream Quanti ers
Consider any continuous function : 21 X? where X is any set. We say that f is total if, for all 2 , it holds that ( ) X.
460
Alex K. Simpson
Proposition 2. For any total : 21 X? there exists n all 21 , it holds that ( ) = ( n ).
N such that, for
We call the least n satisfying the property stated in the proposition the intensional modulus of continuity of , and we write imc( ) for it. X? there exists n Corollary 1. For any total : 21 2 , it holds that n = n implies ( ) = ( ).
N such that, for all
We call the smallest such n the extensional modulus of continuity of , and we write emc( ) for it. Obviously emc( ) imc( ). In the full version of the paper there will be a discussion of the relative bene ts of the two notions of modulus. Our rst application, due to Berger [2], is to provide a universal quanti er for total predicates on two stream. The algorithm is presented in Fig. 1 below. witness-not: (two stream bool) two stream witness-not (P ) = lazylet w = witness-not ( v P (0 :: v)) in if P (0 :: w) then 1 :: witness-not ( v P (1 :: v)) else 0 :: w forall : (two stream bool) bool forall (P ) = P (witness-not P )
Fi . 1. Algorithms for the stream quanti er
Proposition 3. For any total [[forall]]( ) =
: 21
B?:
true if, for all false otherwise
2 , ( ) = true
B ? : if Proof. One proves, by induction on imc( ), that, for all total : 21 there exists 2 such that ( ) = false then [[witness-not]]( ) is one such − ; otherwise [[witness-not]]( ) = 1 . The proposition follows easily.
5
Functional Al orithms for Maximum and Inte ration
The denotation of every program of type interval interval will be a continous function from 31 to 31 . If is real-total then there is a corresponding continuous : I I. Our goal in this paper is to show how Berger’s algorithms can be applied to the practical problem of computing the values of functionals acting on continuous functions on I. We shall concentrate on two basic and useful functionals: the functional that nds the maximum value attained by a continuous function over the closed interval [0 1], and the function that computes the de nite integral of a continuous function over [0 1]. That such maximum values and de nite integrals exist for all continuous functions are very basic results in analysis. Observe that both operations return values in I.
Lazy Functional Algorithms for Exact Real Functionals
5.1
461
Maximum
The algorithm for the functional max-fun is presented in Fig. 2. A rst lemma states the important properties of the main auxiliary function de ned there. sub-one: interval sub-one (1 :: r) = sub-one (0 :: r) = sub-one (−1 :: r) =
interval −1 :: r −1 :: sub-one(r) − −1
max-real: interval interval max-real (d1 :: r1 d2 :: r2 ) = let d = d1 − d2 in case d of 2 1 0 −1 −2
interval then then then then then
d1 d1 d1 d2 d2
:: r1 :: max-real(r1 sub-one(r2 )) :: max-real(r1 r2 ) :: max-real(sub-one(r1 ) r2 ) :: r2
max-fun: (interval interval) interval max-fun (f ) = − let d = head (f ( 1 )) in if forall ( v head(f (v)) = d) then d :: (max-fun( v tail(f (v)))) else max-real (max-fun ( v f (0 :: v)) max-fun ( v f (1 :: v)) )
Fi . 2. Maximum-value algorithm
^ y) = max(x y) MoreLemma 1. [[max-real]] is real-total with: [[max-real]](x 1 ) min( ). over, for all 3 , [[max-real]](
Observe that the lemma includes the intensional information that max-real only examines n digits of the input streams in order to produce n digits of output. This is crucial in the proof of the proposition below, which states the correctness of max-fun. Proposition 4. For any real-total , it holds that [[max-fun]]( ) q([[max-fun]]( )) = max
(x) 0
x
3 and
1
To prove Proposition 4, we prove, by induction on n N , that, for all real31 , it holds that [[max-fun]]( ) n = d1 dn 3n such that: total : 31 n
max
(x) 0
x
1 −
d 2−
2−n
(1)
=1
3? de ned The base case, n = 0, is trivial. When n > 0, consider h( ) : 21 by h( )( ) = hd( ( )). Because is real-total, we have that h( ) is total. The required inequality (1) is now proved by an inner induction on emc(h( )).
462
Alex K. Simpson
Briefly, if emc(h( )) = 0 then (1) is proved using the outer induction hypothesis on n and the general equality, valid for any continuous f : I I: max f (x) + c 0
x
1 = max f (x) 0
x
1 +c
(2)
When emc(h( )) > 0 then (1) is proved using the induction hypothesis on the extensional modulus of continuity (the intensional information of Lemma 1 is needed) together with the general equality, valid for any continuous f : I I: max f (x) 0
5.2
x
1 = max( max f (x 2) 0 x 1 max f ((x + 1) 2) 0 x
(3) 1 )
Inte ration
Integration can be performed by much the same method. Observe that integration enjoys the following equalities, for any continuous f : I I: 1
1
f (x) + c dx = 0
f (x) dx + c 0
1
1
f (x) dx = 0
1
f (x 2) dx 0
f ((x + 1) 2) dx 0
I computes the average of two reals. The above equations where : I I are wholly analogous to (2) and (3) for maximum. Indeed we shall obtain an integration algorithm by replacing the binary max-real used in max-fun with a function computing the average of two reals. However, the translation is not completely straightforward. Recall that the intensional information of Lemma 1 was crucial to the proof of Proposition 4. This contrasts with the easy:
31 such that, for all x y Proposition 5. There is no real-total : 31 1 ) min( ). (x y) = x y and, for all 2 , (
I,
The observed problem is a quirk of the particular representation of real numbers we are using. A neat way of solving it is to use a second representation. Recall that the set of dyadic rationals is Q d = m 2n m n Z . We write D for the set Q d [−1 1], which we call the set of dyadic di its. We consider an in nite 1 2−( +1) . sequence γ D as representing the real number q 0 (γ) = =0 γ(i) [−1 1] extending q : 3 [−1 1]. This de nes a surjective function q 0 : D In order to write algorithms working with dyadic digits we assume an implemented datatype dyadic of dyadic digits, complete with the associated operations for the basic arithmetic operations on dyadic rationals. Then we simply de ne a new datatype for the interval [−1 1] in terms of dyadic streams: type q-interval = dyadic stream Semantically we assume that [[dyadic]] = D ? , so [[q-interval]] = D 1 . The D 1 being total and real-total are de ned entirely notions of a function : D 1 1 analogously to the cases for 3 . The full algorithm for integration is presented in Fig. 3. For convenience we assume that three is a subtype of dyadic and (hence) interval is a subtype of q-interval.
Lazy Functional Algorithms for Exact Real Functionals
463
coerce: q-interval interval coerce (qd1 :: qd2 :: qr) = let qc = (2 qd1 ) + qd2 in case qc −1 then −1::coerce((qc + 2) :: qr) qc > 1 then 1::coerce((qc − 2) :: qr) otherwise then 0::coerce(qc :: qr) q-av : q-interval q-interval q-interval q-av (qd1 :: qr1 qd2 :: qr2 ) = (qd1 +qd2 ) 2 :: q-av (qr1 qr2 ) q-int: (interval interval) q-interval − q-int (f ) = let d = head (f ( 1 )) in if forall ( v head(f (v)) = d) then d :: (q-int( v tail(f (v)))) else q-av ( q-int ( v f (0 :: v)), q-int ( v f (1 :: v)) ) inte rate: (interval interval) inte rate (f ) = coerce (q-int(f ))
interval
Fi . 3. Integration algorithm Lemma 2. 1. For any γ
3 and q([[coerce]](γ)) = q 0 (γ).
D , it holds that [[coerce]](γ)
^ ]](x y) = x D 1 is real-total with [[q-av 2. The function [[q-av ]] : D 1 0 1 0 D , [[q-av ]](γ γ ) min( γ γ 0 ). Moreover, for all γ γ
Proposition 6. For any real-total , it holds that [[inte rate]]( )
y.
3 and
1
(x) dx
q([[inte rate]]( )) = 0
The proof structure closely follows that of Proposition 4.
6
Further Developments
In the full version of the paper an extension of the integration algorithm will be presented that integrates, over any closed interval, functions de ned from the interval to the whole real line. This makes use of the mantissa-exponent representation of the real line mentioned briefly in Sec. 3. The algorithms in this extended abstract were implemented by Reinhold Heckmann in Gofer in summer 1997. The extensions to functions from an arbitrary closed interval to the full real line have recently been implemented in Haskell by David Plume. The integration algorithm performs abysmally on any interesting functions. The maximum algorithm performs a little better. A partial quantitative analysis of this situation will appear in the full version of the paper. The intrinsic intractibility of the operations of integration and nding maximum values is to be expected from the work of Ko [13].
464
Alex K. Simpson
Acknowled ements I have bene ted from discussions with Pietro Di Gianantonio, Gordon Plotkin and, especially, Mart n Escardo. I thank Ieke Moerdijk, Jaap van Oosten and Harold Schellinx for their hospitality in Utrecht, where the paper was written with nancial support from an NWO Pionier Project.
References 1. J.-C. Bajard, D. Michelucci, J.-M. Moreau, and J.-M. Muller. Introduction to special issue: Real Numbers and Computers . Journal of Universal Computer Science, 1(7):436 438, 1995. 2. U. Berger. Totale Objecte und Men en in Bereichstheorie. PhD Thesis, University of Munich, 1990. 3. U. Berger. Total objects and sets in domain theory. Journal of Pure and Applied Lo ic, 60:91 117, 1993. 4. H.J. Boehm and R. Cartwright. Exact real arithmetic: Formulating real numbers as functions. In D. Turner, editor, Research Topics in Functional Pro rammin , pages 43 64. Adison-Wesley, 1990. 5. H.J. Boehm, R. Cartwright, M. Riggle, and M.J. O’Donnel. Exact real arithmetic: a case study in higher order programming. In ACM Symposium on LISP and Functional Pro rammin , 1986. 6. P. Di Gianantonio. A Functional Approach to Computability on Real Numbers. PhD Thesis, University of Pisa, 1993. 7. P. Di Gianantonio. An abstract data type for real numbers. In Proceedin s of ICALP-97, pages 121 131. Springer LNCS 1256, 1997. 8. A. Edalat and M.H. Escardo. Integration in Real PCF. Information and Computation, To appear, 1998. 9. A. Edalat and P.J. Potts. Exact Real Computer Arithmetic. Presented at workshop: New Paradigms for Computation on Classical Spaces, Birmingham, 1997. 10. M.H. Escardo. PCF extended with real numbers. Theoretical Computer Science, 162(1):79 115, 1996. 11. M.H. Escardo. Properly injective spaces and function spaces. Topolo y and its Applications, To appear, 1998. 12. C.A. Gunter. Semantics of Pro rammin . MIT Press, 1992. 13. Ker-I Ko. Complexity Theory of Real Functions. Birkhauser, Boston, 1991. 14. V. Menissier-Morain. Arbitrary precision real arithmetic: Design and algorithms. Journal of Symbolic Computation, Submitted, 1996. 15. G.D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, 5(1):223 255, 1977. 16. G.D. Plotkin. Full abstraction, totality and PCF. Math. Struct. in Comp. Sci., To appear, 1998. 17. J. Vuillemin. Exact real arithmetic with continued fractions. IEEE Transactions on Computers, 39(8):1087 1105, 1990.
Randomness vs. Completeness: On the Dia onalization Stren th of Resource-Bounded Random Sets ? Klaus Ambos-Spies1 , Ste en Lempp2 , and Gunther Mainhardt1 1
2
Mathematisches Institut, Universit¨ at Heidelber ambos,
[email protected] .de Department of Mathematics, University of Wisconsin, Madison
[email protected] Abs rac . We show that the question of whether the p- -complete or p-T -complete sets for the deterministic time classes E and EXP have measure 0 in these classes in the sense of Lutz’s resource-bounded measure cannot be decided by relativizable techniques. On the other hand, we obtain the followin absolute results if we bound the norm, i.e., the number of oracle queries of the reductions: For r = T , p( p2 (
C : C p-r(kn)-complete for E ) = 0 and C : C p-r(nk )-complete for EXP ) = 0
In the second part of the paper we investi ate the dia onalization stren th of random sets in an abstract way by relatin randomness to a new enericity concept. This provides an alternative, quite ele ant and powerful approach for obtainin results on resource-bounded measures like the ones in the rst part of the paper.
1
Introduction
Lutz’s resource-bounded measure provides a framework for the quantitative analysis of complexity classes (see Lutz [13]). The most interestin results of this theory have been obtained for the deterministic exponential time classes E = DTIME(2l n ) and EXP = DTIME(2poly ), which are captured by the pand p2 -measure, respectively. Here, the question of determinin the measure of the complete sets for these classes under the various types of polynomial-time reducibilities became a challen in problem which in part is still unsolved. Research supported in part by the Human Capital and Mobility Pro ram of the European Community under rant CHRX-CT93-0415 (COLORET). The second author would like to acknowled e partial support by National Science Foundation rant DMS-9504474 and a rant of the British En ineerin and Physical Sciences Research Council. The main results of Section 3 were obtained by the rst and second author when they visited the University of Leeds in the sprin of 1996. In Section 4 some recent work by the rst and third author is reported. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 465 473, 1998. c Sprin er-Verla Berlin Heidelber 1998
466
Klaus Ambos-Spies et al.
Mayordomo [14] has shown that the class of p-m-complete sets for E (or EXP) has p-measure 0. Ambos-Spies, Neis and Terwijn [5] extended Mayordomo’s theorem to bounded truth-table completeness, by showin certain relations between enericity and randomness. The somewhat weaker form of this result for p2 measure was independently obtained by Buhrman and Mayordomo [8] by lookin at resource-bounded Kolmo orov complexity. For reducibilities with nonconstant norm, however, this question remained open. In fact, Allender and Strauss [1] have shown that, assumin BPP = EXP, the class of the p-T -hard sets has p-measure 1, whence the class of p-T -complete sets does not have p-measure 0, and their result can be easily extended to ptt-completeness. Since Heller [12] has constructed an oracle A relative to which BPPA = EXPA , this shows that it is impossible to use relativizable techniques to extend the result of Ambos-Spies et al. from bounded truth-table to truthtable or even Turin reducibility. The rst oal of our paper is to show that the p-measure (and p2 -measure) of the classes of the p-tt-complete and p-T -complete sets for E and EXP is in fact oracle dependent. This is shown by complementin the result of Allender and Strauss as follows: Assumin P = PSPACE (or at least PSPACE DTIME(2kn ) for some k), we show that the p-measure of the class of p-T -complete sets for EXP is 0. (Recently, this result was independently proved by Buhrman et al. [10] by usin a new nonmonotone martin ale concept su ested by Re an.) By analyzin the proof of our theorem, we can extend the absolute smallness results for the classes of complete sets as follows: For arbitrary but xed k, the class C : C p-T (kn)-complete for EXP has p-measure 0 and C : C p-T (nk )complete for EXP has p2 -measure 0, where p-T (l(n)) refers to p-T -reductions of norm l(n), i.e., to reductions havin the number of oracle queries on an input of len th n bounded by l(n) for arbitrary but xed oracle. (These results were obtained independently by Buhrman and Van Melkebeek [9].) Note that by the theorem of Allender and Strauss, the latter is the best possible result provable by relativizable techniques. By expressin resource-bounded measure in terms of resource-bounded randomness, the above results can be viewed as consequences of the dia onalizations built into random sets. In the second part of the paper we address the question of which types of dia onalizations are subsumed by randomness. Since the most common types of dia onalizations in complexity theory have been formalized by correspondin enericity notions (see [2] for details), this question can be answered by isolatin the enericity notions which are implied by randomness. First results in this direction were obtained by Ambos-Spies et al. in [5], where the compatibility of the enericity concept of [3] with randomness was shown. This enericity concept, however, is too weak for dealin with reducibilities of nonconstant norm. Here, we introduce a new enericity concept compatible with randomness, which captures the dia onalizations of the type required for establishin our smallness results in the rst part of the paper. Thou h this enericity approach is somewhat technical, once the required relations to randomness are
Randomness vs. Completeness
467
established it becomes a quite powerful tool for obtainin results on resourcebounded measure. Our notation is mainly standard and follows [4]. We let = 0 1 be the binary alphabet, be the set of nite binary strin s, and 1 be the set of in nite binary strin s. Sometimes, we identify strin s with numbers, and subsets A of with their characteristic sequences A(0)A(1)A(2) . The initial se ment of A of len th n is denoted by A n = A(0) A(n − 1). We assume the reader to be familiar with the polynomial-time reducibilities m (many-one), btt (bounded truth-table), tt (truth-table) and T (Turin ). For r = tt T , r(l(n)) will denote that the norm of the reduction is bounded by l(n).
2
Resource-Bounded Measure and Randomness
In this section, we introduce the fra ment of Lutz’s resource-bounded measure theory required for the followin . For more details, we refer to Lutz [13]. Lutz’s theory is de ned in terms of martin ales. A characterization of classical measure by martin ales was iven by Ville in 1939, while Schnorr [15] was the rst to look at computable martin ales. He also de ned resource-bounded randomness in these terms. Q+ (where Q+ is the set of nonne ative A martin ale is a function d : rationals) which satis es the so-called martin ale condition d(x0)+d(x1) = 2d(x) for all strin s x. A martin ale d succeeds on a set X if lim supn!1 d(X n) = , and d succeeds on a class C if d succeeds on all sets X C. By Ville, a class C has (classical) measure 0 i some martin ale succeeds on C. A t(n)-martin ale is a martin ale d DTIME(t(n)), and d is called a pk martin ale [p2 -martin ale] if d is an nk -martin ale [2(lo n) -martin ale] for some k 1. A class C has p-measure 0, p (C) = 0, if some p-martin ale succeeds on C. The p2 -measure is de ned correspondin ly. Note that martin ales operate on k k 2jxj , this implies initial se ments X x. Since X x k 2kjxj and 2(lo (jX xj)) that p-measure corresponds to E = DTIME(2l n ) while p2 -measure corresponds to EXP = DTIME(2poly ). Lutz has shown that p (DTIME(2kn )) = 0 for all k but p (E) = 0, whence a measure on E can be de ned as follows: A class C has measure 0 in E if p (C E) = 0, and C has measure 1 in E if the complement C of C has measure 0 in E. Similarly, we obtain a measure on EXP based on the p2 -measure. The resource-bounded measure can also be de ned in terms of resource-bounded randomness (see, e. ., [4]): A set R is t(n)-random [p-random, p2 -random] if no t(n)-martin ale [p-martin ale, p2 -martin ale] succeeds on R. For any k, there is an nk -random set R in E but there are no such sets in DTIME(2kn ). Hence there is no p-random set in E but such sets exist in EXP. Moreover, a class C has p-measure 0 i C does not contain any nk -random set for some k 1. In a k similar way, 2(lo n) -random sets characterize the p2 -measure and the measure on EXP.
468
3
Klaus Ambos-Spies et al.
Randomness vs. Completeness
In this section we show that the measure of the p-Turin and p-truth-table complete sets in E and EXP cannot be determined by relativizable techniques. Allender and Strauss [1] have shown that, assumin BPP = EXP, the p-T complete sets have measure 1 in E and EXP, and their result easily extends to the p-tt-complete sets. We complement this result by showin that the pT -complete sets, and hence the p-tt-complete sets, have measure 0 in E and EXP if we assume that PSPACE P. Oracles A and B relative to which BPPA = EXPA and PSPACEB = PB have been constructed by Heller [12] and Baker, Gill and Solovay [6], respectively. Our proof also yields the followin absolute result: The class of the p-T (kn)-complete sets for E (or EXP) has pmeasure 0 and the class of the p-T (nk )-complete sets for EXP has p2 -measure 0 (for arbitrary but xed k). Theorem 1. (Allender and Strauss [1]) Let A be n2 -random. Then A is p-tthard for BPP. Corollary 1. Assume BPP = EXP. Every n2 -random set is p-tt-hard for EXP. Hence, in particular, for r tt T , the class C : C p-r-complete for E has measure 1 in E, and the class C : C p-r-complete for EXP has measure 1 in EXP. Theorem 1 extends the result of Bennett and Gill in [7] that the p-T -hard sets for BPP have classical measure 1. The proof of Allender and Strauss uses results on pseudo-random number enerators, and in [1], the result is only claimed for p-T -reducibility. In 1996, the third author obtained an alternative, elementary proof based on the ori inal proof of Bennett and Gill, which also yields the result for p-tt-reducibility. This proof will appear in Mainhardt’s Ph.D. thesis. Corollary 1 shows that if BPP = EXP, i.e., if BPP is lar e , then the ptt- and p-T -complete sets for E and EXP are abundant in the sense of Lutz’s measure. We now complement this observation by showin that if PSPACE (hence BPP) is small , in particular if PSPACE = P, then the p-tt- and p-T -complete sets for E and EXP are scarce. Theorem 2. Assume that PSPACE DTIME(2kn ). There is no nk+2 -random set which is p-T -complete for E or EXP. Hence p(
C : C p-T -complete for E (EXP) ) = 0
whence C : C p-T -complete for E and C : C p-T -complete for EXP have measure 0 in E and EXP, respectively. Proof (sketch). Let R be nk+2 -random and, for any set X, let L(X) = x :
xy : x = y & xy
X
even
Randomness vs. Completeness
469
Then, for X E (EXP), we also have L(X) E (EXP), whence it su ces to k+2 show that L(R) P T R. So, iven a p-T -reduction M , we will de ne an n martin ale d which succeeds on C = B : L(B) = M B . Fix a polynomial time bound p for M where w.l.o. . p(n) > 2n, and let q(n) be a polynomial which bounds the norm of M , i.e., the number of oracle queries in the computation of M X (x) for any strin x of len th n and any oracle X. Note that q(n) p(n). Finally, x an easily reco nizable in nite sequence of strin s such that p( xm ) < 2jxm j < xm+1 for m 0. On x0 < x1 < x2 < the interval [xm xm+1 ) the martin ale d will be de ned in such a way that, for any set B, (3.1)
L(B)(xm ) = M B (xm )
d(B xm+1 )
3 2 d(B
xm )
will hold. Obviously this will make d succeed on C. For the de nition of d, x x = xm , x0 = xm+1 and some initial se ment = X x. Assume that d( ) is iven, and let n = x and n0 = x0 . We will de ne d(X y) for all proper extensions X y of with y < x0 . Note that, for any set X, L(X)(x) is determined by X Ix , where Ix = xy : y = x . Similarly, M X (x) only depends on X x0 . So, for = X x0 , determines L(X)(x) and M X (x) whence we may denote these values by L( )(x) and M (x), respectively. We call a proper extension = X y of a complete extension if y = x0 and a partial extension if y < x0 . A complete extension is called positive if L( )(x) = M (x) and ne ative otherwise. For a partial extension 0 , let pos( 0 ) be the number of positive extensions of 0 . Note that, for B as in the premise of (3.1), B x0 are positive, and that one half of the complete extensions of are positive. So, in order to uarantee (3.1) it su ces to de ne d on the interval [x x0 ) in such a way that the capital d( ) is uniformly distributed amon the positive extensions (while for the ne ative extensions X x0 , d(X x0 ) = 0). This is achieved by lettin pos((X y)0) d((X y)0) = d((X y)1) pos((X y)1) for any partial extension X y. It remains to show that the martin ale d is nk+2 -time bounded. For this, it su ces to show that pos(X y) can be computed in 2(k+1)m steps for any partial extension X y of , m = y . To do so, we distin uish three cases. Let v be the unique element of Ix such that there are exactly q(n) elements in Ix reater than v, and let w be the reatest element of Ix . Then, for y < v, one half of the total extensions are positive. For y > w, L(X y) is already determined by X y. So here we can compute pos(X y) by lookin at the query tree of the computation M (x) and countin the (appropriately wei hted) paths ivin output L(X y) which are consistent with X y. Note that this query tree has depth at most q(n) where q is the polynomial norm of the reduction M . So this procedure can be carried out in poly < (2q(n) ) steps. For q(n) > kn, however, this exceeds the time X y kn available to d. This problem is overcome by our
470
Klaus Ambos-Spies et al.
assumption that PSPACE DTIME(2kn ), since the above search of a tree of polynomial depth requires only polynomial space. The case of v y w is similar. Here, in addition, we have to cycle throu h the (at most 2q(n)+1 many) extensions X w of X y in order to determine L(X x). Then, for each X w, the positive extensions are counted as in 2 the second case. By relativizin the proofs of Corollary 1 and Theorem 2, we obtain Corollary 2. For r = tt T , the measure of C : C p-r-complete for E (EXP) in E (EXP) is oracle dependent. Corollary 2 has been obtained independently by Buhrman et al. [10] by investi atin a nonmonotone variant of resource-bounded martin ales introduced by Re an. By analyzin how the complexity of the martin ale d de ned in the proof of Theorem 2 depends on the norm q of the reductions M we consider (without the assumption that PSPACE DTIME(2kn )), we obtain the followin absolute results, which have been independently obtained by Buhrman and Van Melkebeek [9]. 0
Theorem . (a) For any k, there is a number k 0 such that no nk -random set is p-T (kn)-complete for E or EXP. Hence, for xed but arbitrary k, p(
C : C p-T (kn)-complete for E (EXP) ) = 0 k0
(b) For any k there is a number k 0 such that no 2(lo n) -random set is p-T (nk )complete for EXP. Hence, for xed but arbitrary k, p2 (
C : C p-T (nk )-complete for EXP ) = 0
Note that, by Corollary 1, the second part of the theorem cannot be improved by relativizable techniques. Also note that, by the rst part of Theorem 3, no p-random set is p-T (lin)-complete for EXP. The proof of the second part of the theorem can be easily modi ed to yield the followin resource-bounded random separation for the classes P and PSPACE, in fact for P and P. Theorem 4. For any p2 -random set R, PR = PR , so PR = PSPACER . A ain by Corollary 1, the resource-bound in Theorem 4 cannot be improved by relativizable techniques.
4
Genericity Compatible with Randomness
Guided by the results of the precedin section, we now introduce a new resource-bounded enericity concept compatible with measure. This concept will yield simpler proofs of the results above and of related results.
Randomness vs. Completeness
471
The theorems in Section 3 have been obtained by exploitin the built-in dia onalizations in a random set. The construction of an incomplete set is a quite simple exercise in dia onalization. So, once we have isolated the dia onalization ar uments subsumed by a randomness concept, properties of the random set which can be forced by this type of dia onalization can be established quite easily. Formalizations of di erent types of dia onalization techniques have been iven in terms of enericity, where a eneric set is a set havin all properties which can be forced by dia onalizations of this type (see [2] for a survey of enericity concepts introduced in complexity theory). Unfortunately, however, most of the enericity concepts in the literature are too stron for bein compatible with randomness. The rst successful attempt to isolate some dia onalizations built into random sets was made by Ambos-Spies, Neis and Terwijn [5] by showin that the enericity concept of Ambos-Spies, Fleischhack and Huwi [3] is compatible with randomness. In particular they showed that every nk+1 -random set is A H-nk eneric (in the sense of [3]), whence any property shared by all A H-nk - eneric sets (for any xed k) has p-measure 1 and measure 1 in E. Since no A H-n2 eneric set is p-btt-complete for E, in [5] Ambos-Spies et al. concluded that the class of the p-btt-complete sets for E has p-measure 0, hence measure 0 in E. The enericity concept of [3], however, is tailored for dia onalizations over bounded query reductions: As shown in [5], for any unbounded nondecreasin polynomial-time computable function f there are A H-nk - eneric sets (for k 1) which are p-tt(f (n))-complete for E. So the dia onalization stren th of this enericity concept does not su ce to obtain results on reducibilities of unbounded norm as in Theorem 3. Our new enericity concept, which will be su ciently stron to cope with this situation and which still is subsumed by randomness, re nes the concept of [3] by addin a device allowin look-aheads. This additional feature was inspired by Re an’s new concept of a nonmonotone martin ale introduced in [10]. The lookaheads ive us extra stren th similar to nonmonotonicity but in the context of enericity our approach is technically simpler. (The di erence between the common enericity concepts and our new look-ahead enericity notion parallels the di erence between self-reducibility and auto-reducibility. This will be made more explicit in the full version of this paper.) De nition 1. A prediction machine M is an oracle Turin machine where, x and whenever M X (x) is de ned, then M X (x) = (y i) for some strin y some i . Moreover, the computation of M X (x) is subject to the followin two constraints: (4 1) If M X (x) = (y i) then M X[fyg (x) = M X−fyg (x). (4 2) If in the computation of M X (x) the oracle is queried for some strin z x then M X (x) is de ned. A prediction function f is the functional computed by a prediction machine. f predicts A at x if f A (x) = (y A(y)), and f predicts A if f predicts A at some x. f is dense alon A if f A (x) is de ned for in nitely many x.
472
Klaus Ambos-Spies et al.
Note that (4.1) is a necessary fairness condition while (4.2) is an optional condition expressin that additional information on X for strin s x can be only required if actually a prediction is made at x. In order to et correspondin resource-bounded enericity concepts, we will introduce time bounds (which, in order to make the bounds compatible with those for martin ales, will be exponentially blown up) and bounds on the size of the look-ahead. De nition 2. A t(n)-prediction functionf is a functional computed by a t(2n+1 )time bounded prediction machine M . If, moreover, M X (x) queries at most l( x ) strin s x then the function f is an l(n)-l.a. t(n)-prediction function. A set G is l.a. t(n)- eneric [l(n)-l.a. t(n)- eneric] if every t(n)-prediction [l(n)-l.a. t(n)prediction] function f which is dense alon G predicts G. Note that A H- enericity coincides with 0-l.a. enericity in the above sense. On the other hand, one can easily show that look-ahead enericity is weaker than eneral enericity in the sense of [2], whence it induces resource-bounded cateory concepts on E and EXP. In particular, there are l.a. nk - eneric sets in E but, for any len th bound l, there is no l(n)-l.a. nk - eneric set in DTIME(2kn ). The followin theorem shows the compatibility of the new concept with resourcebounded measure if we appropriately bound the norm of the look-ahead. We omit the proof, which resembles the proof of Theorem 3. Theorem 5. Every n2k+3 -random set is (kn)-l.a. nk - eneric. Furthermore, evk+1 k ery 2(lo n) -random set is nk -l.a. 2(lo n) - eneric. Now, in order to obtain alternative proofs of the results in Section 3 based on our new enericity concept, it su ces to prove the correspondin results for eneric sets. For instance, in order to obtain Theorem 3(a) from Theorem 5, it su ces to show that no (2kn)-l.a. n2 - eneric set is complete for E under pT -reductions of norm kn. This can be shown by expressin a strai htforward dia onalization in terms of prediction functions, which uarantees that, for a (2kn)-l.a. n2 - eneric set G, L(G) P T (kn) G, where L(G) is de ned as in the proof of Theorem 2.
References 1. E. Allender, M. Strauss. Measure on small complexity classes with applications for BPP. In Proceedin s of the 35th Symposium on Foundations of Computer Science, 867-818, IEEE Computer Society Press, 1994. 2. K. Ambos-Spies. Resource-bounded enericity. In Computability, Enumerability, Unsolvability (S. B. Cooper et al., Eds.), London Mathematical Society Lecture Notes Series 224, 1-59, Cambrid e University Press, 1996. 3. K. Ambos-Spies, H. Fleischhack, H. Huwi . Dia onalizations over deterministic polynomial time. In Proceedin s of the First Workshop on Computer Science Lo ic, CSL’87, Lecture Notes in Computer Science 329, 1-16, Sprin er Verla , 1988. 4. K. Ambos-Spies, E. Mayordomo. Resource-bounded measure and randomness. In Complexity, Lo ic and Recursion Theory, Lecture Notes in Pure and Applied Mathematics 187, 1-47, Dekker, 1997.
Randomness vs. Completeness
473
5. K. Ambos-Spies, H.-C. Neis, S. A. Terwijn. Genericity and measure for exponential time. Theoretical Computer Science 168 (1996) 3-19. 6. T. Baker, J. Gill, R. Solovay. Relativizations of the P =?N P question. SIAM Journal on Computin 5 (1975) 431-442. 7. C. Bennett, J. Gill. Relative to a random oracle P A = N P A = co-N P A with probability 1. SIAM Journal on Computin 10 (1981) 96-113. 8. H. Buhrman, E. Mayordomo. An excursion to the Kolmo orov random strin s. In Proceedin s of the 10th IEEE Structure in Complexity Theory Conference, 197-205, IEEE Computer Society Press, 1995. 9. H. Buhrman, D. v. Melkebeek. Hard Sets are Hard to Find. In Proceedin s of the 13th IEEE Conference on Comput. Complexity, IEEE Computer Society Press, 1998. 10. H. Buhrman, D. v. Melkebeek, K. W. Re an, D. Sivakumar, M. Strauss. A eneralization of resource-bounded measure with an application. In Proceedin s of the Symposium on Theoretical Aspects of Computer Science, Lecture Notes in Computer Science, Sprin er Verla , 1998. 11. S. A. Fenner. Notions of resource-bounded cate ory and enericity. In Proceedin s of the 6th IEEE Structure in Complexity Theory Conference, 196-212, IEEE Computer Society Press, 1991. 12. H. Heller. On relativized exponential and probabilistic complexity classes. Information and Control 71 (1986) 231-243. 13. J. H. Lutz. The quantitative structure of exponential time. In Complexity Theory Retrospective II (L.A. Hemaspaandra, A.L. Selman, eds.), Sprin er-Verla , 1997. 14. E. Mayordomo. Almost every set in exponential time is P -bi-immune. Theoretical Computer Science 136 (1994) 487-506. 15. C. P. Schnorr. Zuf¨ alli keit und Wahrscheinlichkeit. Lecture Notes in Mathematics 218, Sprin er-Verla , 1971.
Positive Turin and Truth-Table Completeness for NEXP Are Incomparable Levke Bentzien Mathematisches Institut Universit¨ at Heidelber Im Neuenheimer Feld 294 D-69120 Heidelber
[email protected] .de
Abs rac . Usin ideas introduced by Buhrman et al. ([2], [3]) to separate various completeness notions for NEXP = NTIME(2poly ), positive Turin complete sets for NEXP are studied. In contrast to many-one completeness and bounded truth-table completeness with norm 1 which are known to coincide on NEXP ([3]), whence any such set for NEXP is positive Turin complete, we ive sets A and B such that P (1) A is ≤P bT (2) -complete but not ≤posT -complete for NEXP P (2) B is ≤P posT -complete but not ≤tt -complete for NEXP.
These results come close to optimality since a further stren thenin of (1), as was done by Buhrman in [1] for EXP = DTIME(2poly ), seems to require the assumption NEXP = co-NEXP.
1
Introduction
Polynomial time reductions and the correspondin completeness notions are central concepts of complexity theory. Since 1975, when Ladner, Lynch and Selman ([4]) studied the di erent types of polynomial time reductions on E = DTIME(2lin ), the relation between the correspondin completeness notions for deterministic and nondeterministic time classes have become of interest. Watanabe [5] proved separation results for the most important completeness notions for EXP exploitin special structural properties. These results were extended by Buhrman, Homer, Spaan and Torenvliet ([2], [3]) to NEXP. They constructed sets witnessin the separation of a reat variety of completeness notions, includin optimal results for bounded truth-table and bounded Turin completeness. Most of their constructions make use of some kind of surplus of queries to enable dia onalizations. For positive Turin complete sets, this surplus arises only when constructin a positive Turin complete set which is not truth-table complete, whereas other techniques have to be applied for a separation in the other direction. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 474 482, 1998. c Sprin er-Verla Berlin Heidelber 1998
Positive Turin and Truth-Table Completeness for NEXP Are Incomparable
475
The oal of this paper is to investi ate the mutual relation between positive Turin and truth-table completeness for NEXP. We show that 1. there is a set which is 2. there is a set which is
P bT (2) -complete but not P posT -complete but not
P posT -complete for NEXP P tt -complete for NEXP.
The second result stren thens the separation of Turin and truth-table completeness iven in [2], while the rst one settles an open question stated by Buhrman in [1] namely, for which k there is a set that is P btt(k) -complete but P not posT -complete for NEXP. In both cases, the proof consists of three steps. In the rst step, we de ne a reduction M (of appropriate type) we want to use to code some xed manyone-complete set K for NEXP into the desired set A. In the second step we construct sets A and W in sta es such that K = L(M A) and W P r A where r is the reduction type we want to dia onalize a ainst. Finally, we show that A and W are members of NEXP. Thus the central task will be to coordinate the codin of K into A with dia onalization a ainst reductions of type r. As mentioned above, in provin the second result we will exploit the fact that a positive Turin reduction may contain super-polynomial many queries in its entire computation tree, which cannot be covered by a polynomial time bounded truth-table reduction. Thou h the situation is di erent in provin the rst result, there we will be able to code K into A since the necessary addin (or removin ) of strin s will not chan e the behavior of the positive Turin reductions considered there. We close this section by introducin some notation. Let = 0 1 . Strin s are elements of , and denoted by lowercase letters x y z . Other lowercase letters usually denote natural numbers. For a strin x, x[i] denotes the (i + 1)th bit in x, i.e. x = x[0] x[n − 1], where n = x is the len th of x. We will use the binary representation of numbers to code IN into and some convenient pairin function x y on . The concatenation of x and y will be denoted by xy and 0n will denote the strin of len th n consistin only of zeroes. Lan ua es (also called sets) are subsets of , and denoted by capital letters A B C O X . For any set S the cardinality of S is denoted by S . For sets A and B, A B = 0x : x A 1x : x B is the join of A and B. We identify a set with its in nite characteristic sequence, i.e. x A i A(x) = 1 and x A i A(x) = 0. The reader is assumed to be familiar with the standard (oracle) Turin machine model. In this paper, reductions are characterized in this model, whence we distin uish between adaptive oracle Turin machines where queries may depend on the answers to previous queries and non-adaptive oracle Turin machines. Since we will simulate oracle Turin machines iven several di erent oracles, we use the notation sim(M x O) for the computation of machine M on input x iven oracle O besides the more commonly used notation M O (x). Moreover, at one point we will replace the
476
Levke Bentzien
oracle set O by some nite strin such that sim(M x ) will denote the computation of M on input x where the i-th query is answered by [i−1], the i-th bit of . In addition we use sim(M x O) = 0 for rejectin , and sim(M x O) = 1 for acceptin computations. The lan ua e accepted by the oracle Turin machine M equipped with oracle A will be denoted by L(M A). An oracle Turin machine M is positive if L(M A) L(M B) whenever A B. For sets A and B we say that A Turin reduces to B (A P T B) if A = L(M B) for some polynomial time bounded oracle Turin machine M P A positive Turin reduces to B (A P posT B) if A T B via some positive oracle Turin machine P A truth-table reduces to B (A P tt B) if A T B via some non-adaptive oracle Turin machine P A bounded Turin reduces to B with norm k (A P T B via bT (k) B) if A some oracle Turin machine makin at most k queries P A bounded truth-table reduces to B with norm k (A P T B via btt(k) B) if A some non-adaptive oracle Turin machine makin at most k queries A many-one reduces to B (A P m B) if there exists a polynomial time bounded function f such that x A i f (x) B. For r T posT tt bT (k) btt(k) m we say that A is P r -hard for NEXP if P P B m A for all B NEXP and A is P r -complete for NEXP if A is r -hard P for NEXP and A NEXP. Finally, for use as standard m -complete set for NEXP we de ne a set K NTIME(2n ) by K=
e x l : Ne accepts x within l steps
where Ne is the e-th nondeterministic Turin machine.
2
P Bein ≤P bT (2) -Complete Without Bein ≤posT -Complete
In [1] Buhrman ave a construction of a set which is P btt(2) -complete but not P -complete for EXP. That construction uses the parity function to obtain posT P btt(2) -completeness, whence this approach cannot be carried out for NEXP unless we assume NEXP = co-NEXP. The construction iven below avoids this di culty by usin a P bT (2) -reduction, where the answer to the rst query indicates which one out of two eventually relevant informations is in fact relevant. P That the resultin set is P bT (2) -hard but not posT -hard for NEXP will be quite clear from the construction, while some work has to be done on showin that A is in NEXP itself.
Positive Turin and Truth-Table Completeness for NEXP Are Incomparable P bT (2) -complete
Theorem 1. There is a complete for NEXP.
Proof. First de ne a sequence bn : n of intervals In by bn =
set A for NEXP which is not
P posT -
IN of natural numbers and a sequence
1 if n 1 n−1 bn−1 2 + 1 if n > 1 y : y 1 n−1 y : bn−1 < y
In =
477
(1) if n = 1 bnn if n > 1
(2)
Let Mi : i 1 be an enumeration of polynomial time bounded Turin reductions where the runnin time of Mi is bounded by ni . We will construct sets A and W in sta es such that W 0bn : n 1 and MnA (0bn ) = 1 − W (0bn ) if Mn is a positive reduction. On the other hand, we will uarantee that K P bT (2) A by x
K
00lo (bn ) or 00lo
A&1 x 0 A A&1 x 1
(bn )
A
(3)
n−1 n−1 < x 0 bnn . Note that lo (bn ) = bn−1 whence the for n such that bn−1 intended reduction from K to A will be computable in polynomial time.
The construction is as follows: sta e 0: B0 = C0 = sta e n: First we have to check whether the reduction Mn behaves in a positive way on input 0bn . I.e., we have to compute 1 if MnX (0bn ) MnY (0bn ) whenever X Y pos(n) = 0 otherwise Let A
n
=
S i n
Bi
S i n
Ci and
In Cn0 = x 1 : x 1 0 0 ( Cn ) An = A n
(4) (5)
Compute sn = sim(Mn 0bn A0n ) and x Bn and Cn by Bn = Cn = end of sta e n.
0lo
(bn )
if sn = 1 otherwise
pos(n) = 0
Cn0 x 0 : x K& x 1 x 1 : x K& x 1 In
In
(6) if Bn = if Bn =
(7)
478
Levke Bentzien
Finally, let B =
S n1
Bn , C =
S n1
A=B
Cn , W = 0bn : n [ A n C=
1 & sn = 0 and
n1
A0n ,
the oracle used in the simulation durin sta e n, provides Note that information about A n , but queries in the interval In are answered accordin to a mere syntactical property (see (4),(5)). Nevertheless, since Mn on input 0bn only queries strin s of len th bnn , the addin (resp. removin ) of strin s durin sta e n in (7) and (6) doesn’t a ect the outcome of this simulation if Mn is positive, in which case sn = sim(Mn 0bn A0n ) = sim(Mn 0bn A
n+1 )
= sim(Mn 0bn A)
(8)
Since W (0bn ) = 1 − sn , (8) implies that W is not polynomial time positive Turin reducible to A. Moreover, by (7), Cn provides information about K but only Bn tells whether the pair x 0 or x 1 carries information about x. To be n−1 < x 1 bnn , x K i either Bn = and more precise, for n such that bn−1 the strin x 0 entered Cn or Bn = and the strin x 1 still is a member of Cn . But this is equivalent to (3) whence A is P bT (2) -hard for NEXP. It therefore remains to show that A and W are members of NEXP. Claim. A
n (x)
2
can be nondeterministically computed in time n 23njxj .
Proof. (By induction on n.) For n = 1, A n = . So assume that the claim n−1 bn−1 or x > bnn , A n+1 (x) = A n (x) whence holds for A n . Then, for x it su ces to consider x Bn Cn . Note that for x In n−1
bnn < 2nbn−1
+1
2
2jxj
Case 1: x = 00lo (bn ) . By de nition, A n+1 (x) = Bn (0lo (bn ) ) = 1 i sn = 1 pos(n) = 0. By uessin two sequences of oracle answers 0 , 1 of len th 2 2jxj witnessin that Mn does not behave positively on input 0bn we can nonde2 terministically check that pos(n) = 0 in time 23jxj . Thou h we cannot directly compute sn = sim(Mn 0bn A0n ), in a second al orithm we can uess the oracle answers in this computation and check that this uess is (more or less) correct. That is, nondeterministically uess a strin 2 of len th 2jxj and check that sim(Mn 0bn ) = 1. If this is the case and qi denotes the i-th query to the oracle durin this simulation, then accept i [i − 1] = 1
A0n (qi ) = 1
(9)
for all i l where l denotes the number of queries made in sim(Mn 0bn ). By (5) and the induction hypothesis, all this can be done nondeterministically in time 2 2 2 2 2 2jxj + 2jxj n 23njxj < (n + 1) 23(n+1)jxj Combinin these two al orithms disjunctively we can nondeterministically compute A n+1 (x), since A n+1 (x) = 1 implies that at least one of the two
Positive Turin and Truth-Table Completeness for NEXP Are Incomparable
479
computations has an acceptin path. On the other hand, if A n+1 (x) = 0 then Mn behaves positively on input 0bn and sn = sim(Mn 0bn A0n ) = 0, whence no satisfyin (9) can lead to an acceptin path in the second computation. Therefore, none of the two al orithms can have an acceptin path. Case 2: x = 1 y j for some strin y and j 1. By de nition of Cn in (7), in this case x Cn i at least two out of the followin assertions hold: j=1
y
K
Bn (0lo
(bn )
)=1
Obviously, usin a nondeterministic computation for K and the al orithm iven 2 in case 1, this can be nondeterministically decided in time (n + 1) 23(n+1)jxj , too. For other x in the iven interval, A n+1 (x) = 0 by de nition of A n+1 . Since n < lo (bn ), the above claim shows that A P bT (2) -complete for NEXP. Claim. For n
3
NTIME(2jxj ), whence A is
4, W (0bn ) can be computed in time 22bn .
Proof. Since W (0bn ) = 1 − sn , we have to compute sn = sim(Mn 0bn A0n ). The runnin time of Mn on input 0bn is bounded by bnn , whence we have to compute bnn . For queries q such that A0n (q) for at most bnn many queries q of len th q 3
b 3 n−1
22 2bn by the previous claim. q bn−1 this can be done in time 22 For queries q such that q > bn−1 , one of the followin cases applies. 1. q = 00lo (bn ) . Then A0n (q) = 0 n−1 . 2. q = 1y and y > bn−1 0 y = z 1 for some z. Then An (q) = 1 n−2 n−1 < y bn−1 . 3. q = 1y and bn−2 Then A0n (q) = 1 (y = z 0 & z K) ], or (a) A(00lo (bn−1 ) ) = 1 and [ y = z 1 (b) A(00lo (bn−1 ) ) = 0 and y = z 1 & z K) for some z. 4. For other q, A0n (q) = 0. Note that in the third case the computation of A(00lo 3 2(log(bn−1 )+1)
(bn−1 )
) can be done in time
bn
2 by the previous claim and the computation of K(z) can be 2 y 2bn . Therefore, A0n (q) can be computed in done deterministically in time 22 bn time 2 for all queries q made by Mn on input 0bn , whence W (0bn ) = 1 − sn can be computed in time 2bn bnn 22bn for n 4. Since the claim implies that W DTIME(22n ) and W is not A, A is not P posT -complete for NEXP. This completes the proof of Theorem 1.
P posT -reducible
to
480
3
Levke Bentzien
P Bein ≤P posT -Complete Without Bein ≤tt -Complete
P Considerin the set A iven in [2] to separate P tt -completeness for T - from P EXP, we easily obtain a separation of posT -completeness from P tt -completeness for EXP by the set A A. Thou h the construction of A may be carried out in NEXP, this second step fails for NEXP since A A will not be a member of NEXP unless we assume NEXP = co-NEXP. Therefore, to obtain the desired separation, we ive a new set B in NEXP with the required properties by a more direct construction. To a reat extent, the proof of the next theorem relies on the construction of A in [2]. Once the question how to code K into B in a positive way is settled, the necessary steps to dia onalize a ainst polynomial time truth-table reductions can be carried out just the same way as in the construction of A in [2].
Theorem 2. There is a set B which is NEXP.
P posT -complete
but not
P tt -complete
for
Proof. B will be constructed in such a way that K is reco nized by a positive Turin machine M with oracle B which acts as follows. On input x of len th n, M performs n2 + 1 many rounds of queryin B. In the rst n2 rounds M chooses two queries dependin on the answers to the previous queries and accepts (rejects) if both answers are 1 (0). Otherwise, M starts the next round. If the nal round is reached, only one query is chosen and M accepts i the answer is 1. It es easy to see that M is indeed positive and that the computation tree 2 2 of M on input x may contain 2(2jxj − 1) + 2jxj many di erent queries. This fact provides enou h flexibility to dia onalize a ainst polynomial time truthtable reductions. As before, B will be constructed in sta es to ether with a witness set W . Durin the n-th sta e we will x B on a suitable interval Jn and 1 is dia onalize a ainst the n-th truth-table reduction Mn , where Mi : i some enumeration of polynomial time truth-table reductions and the runnin time of Mi is bounded by ni . We will only sketch this construction here, since all the technical details can be taken from Theorem 6 in [2]. First we de ne for every strin z the tree T (z) of queries to be chosen by M . Consider a balanced tree of depth z 2 where the root is labeled by z 1 z 2 and if a node is labeled by z i − 1 z i then its left son is labeled by z 2i − 1 z 2i and its ri ht son by z 2i + 1 z 2i + 2 . (I. e. take all the 2 pairs z 1 z 2(2jzj +1 − 1) and, startin from the root and proceedin for every level from left to ri ht, attach to each node the next two pairs.) Finally, we remove from the leaves the pairs z i for which i is odd. W.l.o. . we assume that for iven z, all the pairs z i occurrin in T (z) are of the same len th. The resultin labeled tree will uide M in the followin way: the rst round performed by M on input z will consist of queryin z 1 z 2 , i.e. the strin s that are labeled to the root of T (z). As described above, M accepts (rejects) in round m if all queries made in this round are answered by 1 (0). Otherwise, if M has reached the node nm of T (z) in this round, then M chooses the left
Positive Turin and Truth-Table Completeness for NEXP Are Incomparable
481
(ri ht) son of nm if only the rst (resp. the second) answer is 1 and starts the next round by queryin the strin s that are labeled to that node. 2 An easy computation shows that for any set S with S < 2 2jzj − 1, there exists a node n in T (z) such that S and the label of n are disjoint. Let Nz (S) denote the rst such node and Pz (S) the path in T (z) that leads to it. Now we are ready to sketch the construction of B and W . A ain we will use a n suitable sequence of dia onalization points vn : n 1 such that vn+1 > 2vn , n−1 < y vnn . Durin the n-th sta e of the and of intervals Jn = y : vn−1 construction we do the followin : 1. simulate Mn on input 0vn and let Qn be the set of queries made by Mn on this input. (Note that Mn is a truth-table reduction whence Qn is not oracle dependent.) 2. For every y = z i Jn x B(y) accordin to the followin rules: (a) If Nz (Qn ) exists then B(y) = 1 y is a member of the label of Nz (Qn ) & z or
K
there is a node on Pz (Qn ) such that y is a member of its label and (i is odd and Pz (Qn ) proceeds to the left) (i is even and Pz (Qn ) proceeds to the ri ht)
(10)
(b) If Nz (Qn ) does not exist then B(y) = 1
(z
K &i
1 2 )
(11)
3. Let W (0vn ) = 1 − sn where sn = sim(Mn 0vn B) By this construction it is strai htforward to see that K = L(M B) for the positive Turin machine M described above, that W is not polynomial time 2 truth-table reducible to B, and that B NEXP if we make sure that vnn < 2jyj for all y Jn . To see that W EXP, note that any query q = z i made by Mn on n−1 , in which case we can compute K(z) input 0vn is either of len th < vn−1 vn deterministically in time 2 and therefore B(q) in time exponential in vn , or q Qn Jn , in which case B(q) is computed accordin (10) or (11). If (10) applies, B(q)is decided by comparin Qn and T (z). If (11) applies, the len th of z is small compared to vnn . Therefore, if we choose the sequence vn : n 1 such that K(z) can be deterministically decided for those z in time exponential in vn , W (0vn ) = 1 − sim(Mn 0vn B) will be computable in time exponential in vn , too. (For details on the choice of vn and the distinction between small and non-small z see [2]). This completes the proof of Theorem 2.
482
4
Levke Bentzien
Conclusions
In Section 2 we proved that positive and non-positive completeness notions di er for NEXP from a quite early sta e, i.e. the di erence can be shown for P bT (2) complete, i.e. P -complete sets for NEXP. A stren thenin of this result to btt(3) P btt(2) -complete sets for NEXP, as can be done for EXP, seems unlikely unless we assume NEXP = co-NEXP. An oracle which ives evidence for the oracle dependence of such a stron er result would be an interestin further step. In Section 3 we stren thened the separation of Turin and truth-table completeness for NEXP iven in [2] to positive Turin complete sets. Taken toether, these two results prove the incomparability of P posT -completeness and P -completeness for NEXP. tt If we consider bounded reductions for which the number of queries is bounded P by some constant, P bT (k) -completeness and btt(l) -completeness for NEXP are k incomparable for k < l < 2 − 1 (see [3]). For a similar result in the case of positive bounded reductions, we may adapt the construction iven in Section 3 to obtain (for k 2) a set C which is positive bounded Turin complete with norm k but not positive bounded truth-table complete with norm l ( P pos−bT (k) bk 2c b(k−1) 2c -complete for short) for l < 2 + 2 − 1. Moreover, in and P pos−btt(l) P P [3] a set is iven which is disjunctive btt(k+1) -complete but not bT (k) -complete for NEXP (for k 1). Therefore, if we let (k) = 2bk 2c + 2b(k−1) 2c − 1, P pos−bT (k) -completeness P and pos−btt(l) -completeness for NEXP are incomparable for k < l < (k). If we replace the positive Turin reduction M used in Section 3 to code K into B by a (3n 2 ). more complex one, we can improve the bound (k) to 0 (k) where 0 Acknowled ments: I would like to thank Frank Stephan and Klaus AmbosSpies for discussin with me the results presented in this paper and providin many fruitful ideas to the proof in Section 2. I would also like to thank the anonymous referees for their helpful comments on an earlier version of this paper.
References 1. H. Buhrman. Resource Bounded Reduct ons. PhD thesis, Universiteit van Amsterdam, Amsterdam, 1993. 2. H. Buhrmann, S. Homer, and L. Torenvliet. Completeness for nondeterministic complexity classes. Mathemat cal Systems Theory 24, 179 200, 1991. 3. H. Buhrmann, E. Spaan, and L. Torenvliet. Bounded reductions. In K. Ambos-Spies, S. Homer, and U. Sch¨ onin , editors, Complex ty Theory, pa es 83 99. Cambrid e University Press, 1993. 4. R. Ladner, N. Lynch, and A. Selman. A comparison of polynomial-time reducibilities. Theoret cal Computer Sc ence 1, 103 123, 1975. 5. O. Watanabe. A comparison of polynomial time completeness notions. Theoret cal Computer Sc ence 54, 249 265, 1987.
Tally NP Sets and Easy Census unctions Judy Goldsmith1 , Mitsunori O ihara2 1
2
3
, and J¨ or Rothe3
Department of Computer Science, University of Kentucky, Lexin ton, KY 40506, USA
[email protected] r.uky.edu Department of Computer Science, University of Rochester, Rochester, NY 14627, USA o
[email protected] Institut f¨ ur Informatik, Friedrich-Schiller-Universit¨ at Jena, 07740 Jena, Germany
[email protected] Abs rac . We study the question of whether every P set has an easy (i.e., polynomial-time computable) census function. We characterize this question in terms of unlikely collapses of lan ua e and function classes such as #P1 FP, where #P1 is the class of functions that count the witnesses for tally NP sets. We prove that every #PPH function can be 1 #P1
computed in FP#P1 . Consequently, every P set has an easy census function if and only if every set in the polynomial hierarchy does. We show that the assumption #P1 FP implies P = BPP and PH MODk P for each k 2, which provides further evidence that not all sets in P have an easy census function. We also relate a set’s property of havin an easy census function to other well-studied properties of sets, such as rankability and scalability (the closure of the rankable sets under P-isomorphisms). Finally, we prove that it is no more likely that the census function of any set in P can be approximated (more precisely, can be n -enumerated in time n for xed and ) than that it can be precisely computed in polynomial time.
1
Introduction
Does every P set have an easy (i.e., polynomial-time computable) census function? Many important properties similar to this one were studied durin the past decades to ain more insi ht into the nature of feasible computation. Amon the questions that were previously studied are the question of whether or not every Supported in part by NSF rant CCR-9315354. Supported in part by the National Science Foundation under rants CCR-9701911 and INT-9726724. Supported in part by rants NSF-INT-9513368/DAAD-315-PRO-fo-ab and NSFCCR-9322513 and by a NATO Postdoctoral Science Fellowship from the Deutscher Akademischer Austauschdienst ( Gemeinsames Hochschulsonderpro ramm III von Bund und L¨ andern ). Current address: Department of Computer Science, University of Rochester, Rochester, NY 14627, USA. Work done in part while visitin the University of Kentucky and the University of Rochester. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 483 492, 1998. c Sprin er-Verla Berlin Heidelber 1998
484
Judy Goldsmith et al.
P set has an easy to compute rankin function [GS91,HR90], whether every P set is P-isomorphic to some rankable set [GH96], whether every sparse set in P is P-printable [HY84,AR88], whether there exists an in nite set in P havin no in nite P-printable subset [AR88,HRW97], whether every P-printable set is P-isomorphic to some tally set in P [AR88], and whether every P set admits easy certi cate schemes [HRW97], to name just a few. Some of those questions arise in the eld of data compression and are related to Kolmo orov complexity, some are linked to the question of whether one-way functions exist. Extendin this line of research, the present paper studies the complexity of computin the census functions of sets in P. Census functions have proven to be a particularly important and useful notion in complexity theory, and their use has had a profound impact upon almost every area of the eld (see the extensive literature related to the isomorphism conjecture of Berman and Hartmanis [BH77] or, for instance, [KL80,HY84,HIS85,KS85,LS86,BBS86,AR88,GH96] for other topics). Valiant, in his seminal papers [Val79a,Val79b], introduced #P, the class of functions that count the solutions of NP problems, and its tally version #P1 for which the inputs are iven in unary. Althou h #P1 has not become as prominent as #P, it contains a number of quite interestin and important problems such as the problem Self-Avoidin Walk (see [Wel93]): Given an inte er n in unary, compute the number of self-avoidin walks on the square lattice havin len th n and rooted at the ori in. Self-Avoidin Walk is a well-known classical problem of statistical physics and polymer chemistry, and it is an intri uin open question whether Self-Avoidin Walk is #P1 -complete (see [Wel93]). We characterize the question of whether every P set has an easy census function in terms of collapses of lan ua e and function classes that are considered to be unlikely. In particular, every P set has an easy census function if and only FP. The main technical contribution in Section 3 is that #PPH is if #P1 1 #P1
contained in FP#P1 . An immediate consequence of this result are upward collapse results of the form: the collapse #1 P FP implies the collapse #1 PH FP. Thus, every P set has an easy census function if and only if every set in PH does. Note that the correspondin upward collapse for the # operator applied to the levels of PH follows immediately from the upward collapse property of the polynomial hierarchy itself: # P FP implies NP = P and thus PH = P; so, # PH = # P FP. However, for the #1 operator this is not so clear, FP merely implies that all tally NP sets are since the assumption #1 P in P (equivalently, NE = E), from which one cannot immediately conclude that #1 NP or even #1 PH is contained in FP. In fact, Hartmanis et al. [HIS85] show that in some relativized world, NE = E and yet the (weak) exponentialtime hierarchy does not collapse. In li ht of this result, it is quite possible that the assumption of all tally NP sets bein in P does not force all tally sets from hi her levels of the polynomial hierarchy into P. We also show that the assumption FP implies both P = BPP and PH MODk P for each k 2, which #P1 provides further evidence that not all sets in P have a census function computable in polynomial time. We also relate a set’s property of havin an easy census function to other well-studied properties of sets, such as rankability [GS91] and
Tally NP Sets and Easy Census Functions
485
scalability [GH96]. In particular, thou h every rankable set has an easy census function, we show that (even when restricted to the sets in P) the converse is not true unless P = PP. This expands the result of Hemaspaandra and Rudich that every P set is rankable if and only if P = PP [HR90] by showin that P = PP is already implied by the apparently weaker hypothesis that every P set with an easy census function is rankable. Cai and Hemaspaandra [CH89] introduced the notion of enumerative countin as a way of approximatin the value of a #P function deterministically in polynomial time. Hemaspaandra and Rudich [HR90] show that every P set is k-enumeratively rankable for some xed k in polynomial time if and only if #P = FP. They conclude that it is no more likely that one can enumeratively rank all sets in P than that one can exactly compute their rankin functions in polynomial time. In Section 4, we similarly characterize the question of whether the census function of all P sets is n -enumerable in time n for xed constants and , or equivalently, whether every #P1 function is n -enumerable in time n . We show that this implies #P1 FP, and we thus conclude that it is no more likely that one can n -enumerate the census function of every P set in time n than that one can precisely compute its census function in polynomial time. Finally, Section 5 provides a number of relativization results.
2
Notation and De nitions
Fix the alphabet = 0 1 . denotes the set of all strin s over . For any , we denote the len th of x by x . For any set L , the number strin x is denoted L. Let of strin s in L is denoted L , and the complement of L in L=n (respectively, Ln ) denote the set of strin s in L of len th n (respectively, of len th at most n). As a shorthand, we use n to denote ( )=n . For any set L,
N , is de ned by censusL (1n ) = L=n ,1 the census function of L, censusL : and L denotes the characteristic function of L. A set S is said to be sparse if there is a polynomial p such that for each len th n, censusS (1n ) p(n). A set T is said to be tally if T 1 . The de nition of Turin machines and their lan ua es, Turin transducers and the functions they compute, relativized (i.e., oracle) computations, (relativized) complexity classes, etc. is standard in the literature. We briefly recall the complexity classes most important in this paper. FP denotes the class of polynomial-time computable functions. FE is the class of functions that can be computed by deterministic transducers runnin in time 2cn for some constant c. FP1 is the class of functions computable in polynomial time by deterministic transducers with a unary input alphabet. An unambi uous Turin machine is a nondeterministic Turin machine that on each input has at most one acceptin df
1
The census function of L at n is often de ned as the number of elements in L of len th up to n. This de nition and our de nition are compatible as lon as our computability admits subtraction. We let censusL map strin s 1n (as opposed to numbers n in binary notation) to L=n to emphasize that the input to the transducer computin censusL is iven in unary.
486
Judy Goldsmith et al.
path. UP [Val76] (respectively, UE) is the class of all lan ua es accepted by some unambi uous Turin machine runnin in polynomial time (respectively, in time 2cn for some constant c). For any nondeterministic Turin machine M and any , let accM (x) denote the number of acceptin paths of M (x). A input x spanP machine [KST89] is an NP machine that has a special output device on which some output is printed for each acceptin path. For any spanP machine , spanM (x) is de ned to be the number of di erent M and any input x outputs of M (x) if M (x) has at least one acceptin path, and 0 otherwise. A tally NP machine (respectively, a tally spanP machine) is an NP (respectively, a spanP) machine with a unary input alphabet. df
Valiant introduced the function classes #P = accM M is an NP machine df
[Val79a,Val79b] and #P1 = accM M is a tally NP machine [Val79b]. The df class spanP = spanM M is a spanP machine [KST89] can analo ously be df
restricted to tally sets: spanP1 = spanM M is a tally spanP machine . We will use the common operator notation at times in order to eneralize function classes such as #P and #P1 . For any lan ua e class C, de ne # C (respectively, #1 C) to be the class of all functions f for which there exist a set A C and ) [f (x) = y y = p( x ) and x y A ] a polynomial p such that ( x df n n N ) [f (1 ) = y y = p(n) and 1 y A ]). Let E = (respectively, ( n df
df
DTIME[2cn ] and NE = c>0 NTIME[2cn ], and de ne #E = accM M is an NE machine . For the other classes we consider, we simply ive a reference to the paper in which the class is de ned: The polynomial hierarchy PH [MS72,Sto77], PP [Gil77], BPP [Gil77], MODk P [CH90] for xed k 2 (if k = 2, we write P [PZ83,GP86] instead of MOD2 P), and SPP [OH93,FFK94]. We also consider nonuniform classes C poly [KL80] for any lan ua e class C, and we analo ously de ne nonuniform function classes F poly for any function class F. c>0
is a P-isomorphism if is computable De nition 1. A bijection : and invertible in polynomial time. A P-isomorphism is len th-preservin if for , (x) = x . A P-isomorphism mappin set A to set B all x is order-preservin if for any two strin s x and y satisfyin either x y A or x y A, if x y, then (x) (y). is the funcDe nition 2. [GS91] The rankin function of a lan ua e A N that maps each x to y x y A . A lan ua e A is tion r : rankable if its rankin function is computable in polynomial time.
Generalizin rankability, Goldsmith and Homer [GH96] introduced the property of scalability. They showed that the scalable sets are precisely those that are P-isomorphic to some rankable set. The de nition below is based on this characterization. De nition 3. [GH96] A lan ua e A is scalable if it is P-isomorphic to a rankable set. For any oracle X, the X-scalable sets are those that are PX -isomorphic to some set rankable in FPX .
Tally NP Sets and Easy Census Functions
3
Does P Have Easy Census
487
unctions?
We start by explorin the relationships between the properties of a set bein rankable, bein scalable, and havin an easy census function. Let A be any set (not necessarily in P). Consider the followin conditions: (i) A is rankable. (ii) A has an easy census function. (iii) A is P-isomorphic to some rankable set (i.e., A is scalable). (iv) A is P-isomorphic to some rankable set via some len th-preservin isomorphism. (v) A is P-isomorphic to some rankable set via some order-preservin isomorphism. It is immediately clear that for any set A, (i) implies each of (ii), (iv), and (v), and each of (iv) and (v) implies (iii). The next proposition shows that the rankable sets are closed under order-preservin P-isomorphisms (thus, conditions (i) and (v) in fact are equivalent) and that the class of sets havin an easy census function is closed under len th-preservin P-isomorphisms. The latter fact ives that (iv) implies (ii), since every rankable set has an easy census function. Due to space constraints, all proofs of this paper except the proof of Theorem 5 are omitted; they can be found in the full version of this paper [GOR98]. Proposition 1. (1) The class of all rankable sets is closed under orderpreservin P-isomorphisms. (2) The class of sets havin an FP-computable census function is closed under len th-preservin P-isomorphisms. So we are left with only the four conditions (i) to (iv). Since there are nonrecursive sets with an FP-computable census function, but any set satisfyin one of (i), (iii), or (iv) is in P, condition (ii) in eneral cannot imply any of the other three conditions. On the other hand, when we restrict our attention to the sets in P havin easy census functions, we can show that (ii) implies (i) if and only if P = PP. Thus, even when restricted to P sets, it is unlikely that (ii) is equivalent to (i). Theorem 1. All P sets with an easy census function are rankable if and only if P = PP. Corollary 1. All P sets are rankable if and only if all sets in P with an easy census function are rankable. One mi ht ask whether or not all P sets outri ht have an easy census function (which, if true, would make Corollary 1 trivial). The followin characterization of this question in terms of unlikely collapses of certain function and lan ua e classes su ests that this probably is not true. Thus, Corollary 1 is nontrivial with the same certainty with which we believe that for instance not all #P1 functions are in FP.
488
Judy Goldsmith et al.
Theorem 2. The followin are equivalent. 1. 2. 3. 4. 5.
Every P set has an FP-computable census function. #P1 FP. #E = FE. P#P1 = P. For every lan ua e L accepted by a lo space-uniform depth 2 AND-OR circuit family of bottom fan-in 2, censusL is in FP.
Theorem 2 can as well be stated for more eneral classes than #P1 = #1 P. In particular, this comment applies to #1 C, where for instance C = NP or C = PH. Noticin that spanP1 = #1 NP and focusin on the rst two conditions of Theorem 2, this observation is exempli ed as follows. Theorem 3. (1) Every NP set has an FP-computable census function if and FP. (2) Every set in PH has an FP-computable census only if spanP1 function if and only if #1 PH FP. We will show later that the conditions of Theorem 2 in fact are equivalent to the two conditions stated in either part of Theorem 3. Next, we ive some more evidence that the collapse #P1 FP is unlikely to hold. Theorem 4. If #P1 P = BPP.
FP, then PH
MODk P for any
xed k
2, and
Now we show that the conditions of Theorem 2 in fact are equivalent to the two conditions stated in either part of Theorem 3. To this end, we establish the followin theorem, which is interestin in its own ri ht. Theorem 5. #PPH 1
#P1
FP#P1
.
Remark 1. Note that Toda’s result PH P#P [Tod91] immediately ives that #P#P #PPH #P#P and #PPH 1 1 . Observe that the oracle is a #P function. #P#P In contrast to the inclusion #PPH 1 1 , Theorem 5 establishes containment PH of #P1 in a class in which only #P1 oracles occur. Thou h our proof also applies the techniques of [Tod91,TO92], the result we obtain seems to be incomparable with the above-mentioned immediate consequence of Toda’s Theorem. Note also that it is unlikely that Theorem 5 can be improved to even #PPH #P1 bein contained in FP#P1 , since this would imply that #PPH FP poly and thus, in particular, would collapse the polynomial hierarchy. Thou h the proof of Theorem 5 in fact establishes the statement of Theorem 5 (and its corollaries) even for the class PPH = BPPP in place of PH, we focus on the PH case. Proof of Theorem 5. Let f be any #1 PH. Thus, there exist a set L 0 1 p(n) each len th n, f (1n ) = y assume that p(n) is a power of 2 for
PH = function in #PPH 1 . Note that #P1 PH and a polynomial p such that for 1n #y L , where for convenience we each n. By Toda and O ihara’s result
Tally NP Sets and Easy Census Functions
489
that PH P poly [TO92], there exist a set A P, an advice function h #P1 (see [GOR98] for a proof of this claim), and a polynomial computable in FP1 q such that for each len th m and each x of len th m, h(1m ) = q(m), and x L A. Let M be a machine witnessin that A P, i.e., if and only if x h(1m ) for every strin z, z A if and only if accM (z) is odd. Toda [Tod91] de ned inductively the followin sequence of polynomials: For
N , let s0 (j) = j, and for each j N and i > 0, let s (j) = 3(s −1 (j))4 + j 4(s −1 (j))3 . One very useful property of this sequence of polynomials is that for all i j N , s (j) = c 22 for some c N if j is even, and s (j) = d 22 − 1 for some d N if j is odd (see [Tod91] for the induction proof). We describe a polynomial-time oracle transducer T that, on input 1n , invokes #P its #P1 1 function oracle and then prints in binary the number f (1n ). Fix the input 1n . First, T transfers the input to the oracle . Formally, function is de ned by df
df
(1n ) =
s n (accM ( 1n #y h(1n+1+p(n) ) ))
df
2
y2f0 1gp(n) df
#P
where n = lo p(n). Informally speakin , that is in #P1 1 follows from the properties of the Toda polynomials, from the closure of #P under addition and #P multiplication, and from the fact that advice function h is computable in FP1 1 . #P For a formal proof of #P1 1 , the reader is referred to the full version of this paper [GOR98]. We use the shorthands an = h(1n+1+p(n) ) for the advice strin for len th n strin s, and jy = accM ( 1n #y an ) for each xed y, y = p(n). By the above properties of the Toda polynomials, it follows that for each y of len th p(n), n N , and if jy is odd then if jy is even then s n (jy ) = c 22 for some c n 2 − 1 for some d N . Thus, recallin that 2 n = p(n), we have s n (jy ) = d 2 2 that (s n (jy )) = (c2 2p(n)−1 )2p(n)+1 if jy is even, and (s n (jy ))2 = (d2 2p(n)−1 − df
df
d)2p(n)+1 + 1 if jy is odd. De nin c(n) = c2 2p(n)−1 and d(n) = d2 2p(n)−1 − d, we obtain (s n (jy ))2 =
c(n) 2p(n)+1 if jy is even p(n)+1 + 1 if jy is odd. d(n) 2
2p(n) and since jy is odd if and only if 1n #y L, the Thus, since f (1n ) ri htmost p(n) + 1 bits of the binary representation of (1n ) represent the value of f (1n ). Hence, after the value (1n ) has been returned by the oracle, T can output f (1n ) by printin the p(n) + 1 ri htmost bits of (1n ). This completes the proof. Since #P1
#P1
FP implies FP#P1
FP, we have from Theorem 5:
Corollary 2. #P1 FP if and only if #PPH 1 FP if and only if spanP1 FP.
FP, and in particular, #P1
490
Judy Goldsmith et al.
Corollary 3. Every P set has an easy census function if and only if every set in PH has an easy census function. K¨ obler et al. [KST89] proved that spanP = #P if and only if NP = UP. Usin the analo ous result for tally sets, we can show that spanP1 and #P1 are di erent classes unless NE = UE, or unless every sparse set in NP is low for SPP. A set S is C-low for some class C if C S = C. In particular, it is known that every sparse NP set is low for PNP [KS85] and for PP [KSTT92], but it is not known whether all sparse NP sets are low for SPP. There are oracles known for which some sparse NP set is not SPP-low. Theorem 6. If spanP1 = #P1 , then NE = UE and every sparse NP set is SPP-low.
4
Enumerative Approximation of Census
unctions
De nition 4. [CH89] Let f : and : N N be two functions. A n , Turin transducer E is a (n)-enumerator of f if for all n N and x (1) E on input x prints a list Lx with at most (n) elements, and (2) f (x) is a member of list Lx . A function f is (n)-enumerable in time t(n) if there exists a (n)-enumerator of f that runs in time t(n). A set is (n)-enumeratively rankable in time t(n) if its rankin function is (n)-enumerable in time t(n).
Recall from the introduction Hemaspaandra and Rudich’s result that every P set is k-enumeratively rankable for some xed k (and indeed, even O(n1 2− )enumeratively rankable for some > 0) in polynomial time if and only if #P = FP [HR90]. We similarly characterize the question of whether the census function of all P sets is n -enumerable in time n for xed constants and . By the analo of Theorem 2 for xed time n , this is equivalent to askin whether every #P1 function is n -enumerable in time n . We show that this implies #P1 FP, and we thus conclude that it is no more likely that one can n -enumerate the census function of every P set in time n than that one can precisely compute its census function in polynomial time. It would be interestin to know if this result can be improved to hold for polynomial time instead of time t for some xed polynomial t(n) = n . Theorem 7. Let > 0 be constants. If every #P1 function is n -enumerable in time n , then #P1 FP.
5
Oracle Results
Theorem 8. There exists an oracle D such that #PD 1
FPD = #PD .
Corollary 4. There exists an oracle D such that all sets in PD have a census function computable in FPD , yet some set in PD is not rankable by any function in FPD .
Tally NP Sets and Easy Census Functions
491
Theorem 9. There exists an oracle A such that there exists an A-scalable set B whose census function is not in FPA . Theorem 10. There exists an oracle D such that D and its census function is not in FPD . Theorem 11. There exists an oracle A such that A its census function is in FPA .
PD is not D-scalable
PA is not A-scalable and
Acknowled ments. We are deeply indebted to Lance Fortnow, Lane Hemaspaandra, and Gabriel Istrate for interestin discussions and for helpful comments and su estions, and we thank Eric Allender and Lane Hemaspaandra for pointers to the literature.
References E. Allender and R. Rubinstein. P-printable sets. SIAM Journal on Computin , 17(6):1193 1202, 1988. BBS86. J. Balcazar, R. Book, and U. Sch¨ onin . The polynomial-time hierarchy and sparse oracles. Journal of the ACM, 33(3):603 617, 1986. BH77. L. Berman and J. Hartmanis. On isomorphisms and density of NP and other complete sets. SIAM Journal on Computin , 6(2):305 322, 1977. CH89. J. Cai and L. Hemachandra. Enumerative countin is hard. Information and Computation, 82(1):34 44, 1989. CH90. J. Cai and L. Hemachandra. On the power of parity polynomial time. Mathematical Systems Theory, 23(2):95 106, 1990. FFK94. S. Fenner, L. Fortnow, and S. Kurtz. Gap-de nable countin classes. Journal of Computer and System Sciences, 48(1):116 148, 1994. GH96. J. Goldsmith and S. Homer. Scalability and the isomorphism problem. Information Processin Letters, 57(3):137 143, 1996. Gil77. J. Gill. Computational complexity of probabilistic Turin machines. SIAM Journal on Computin , 6(4):675 695, 1977. GOR98. J. Goldsmith, M. O ihara, and J. Rothe. Tally NP sets and easy census functions. Technical Report TR 684, University of Rochester, Rochester, NY, March 1998. GP86. L. Goldschla er and I. Parberry. On the construction of parallel computers from various bases of boolean functions. Theoretical Computer Science, 43(1):43 58, 1986. GS91. A. Goldber and M. Sipser. Compression and rankin . SIAM Journal on Computin , 20(3):524 536, 1991. HIS85. J. Hartmanis, N. Immerman, and V. Sewelson. Sparse sets in NP−P: EXPTIME versus NEXPTIME. Information and Control, 65(2/3):159 181, 1985. HR90. L. Hemachandra and S. Rudich. On the complexity of rankin . Journal of Computer and System Sciences, 41(2):251 271, 1990. HRW97. L. Hemaspaandra, J. Rothe, and G. Wechsun . Easy sets and hard certi cate schemes. Acta Informatica, 34(11):859 879, 1997. AR88.
492 HY84.
Judy Goldsmith et al.
J. Hartmanis and Y. Yesha. Computation times of NP sets of di erent densities. Theoretical Computer Science, 34(1/2):17 32, 1984. KL80. R. Karp and R. Lipton. Some connections between nonuniform and uniform complexity classes. In Proceedin s of the 12th ACM Symposium on Theory of Computin , pa es 302 309, April 1980. An extended version has also appeared as: Turin machines that take advice, L’Ensei nement Mathematique, 2nd series 28, 1982, pa es 191 209. KS85. K. Ko and U. Sch¨ onin . On circuit-size complexity and the low hierarchy in NP. SIAM Journal on Computin , 14(1):41 51, 1985. KST89. J. K¨ obler, U. Sch¨ onin , and J. Toran. On countin and approximation. Acta Informatica, 26(4):363 379, 1989. KSTT92. J. K¨ obler, U. Sch¨ onin , S. Toda, and J. Toran. Turin machines with few acceptin computations and low sets for PP. Journal of Computer and System Sciences, 44(2):272 286, 1992. LS86. T. Lon and A. Selman. Relativizin complexity classes with sparse oracles. Journal of the ACM, 33(3):618 627, 1986. MS72. A. Meyer and L. Stockmeyer. The equivalence problem for re ular expressions with squarin requires exponential space. In Proceedin s of the 13th IEEE Symposium on Switchin and Automata Theory, pa es 125 129, 1972. OH93. M. O iwara and L. Hemachandra. A complexity theory for feasible closure properties. Journal of Computer and System Sciences, 46(3):295 325, 1993. PZ83. C. Papadimitriou and S. Zachos. Two remarks on the power of countin . In Proceedin s of the 6th GI Conference on Theoretical Computer Science, pa es 269 276. Sprin er-Verla Lecture Notes in Computer Science #145, 1983. Sto77. L. Stockmeyer. The polynomial-time hierarchy. Theoretical Computer Science, 3(1):1 22, 1977. TO92. S. Toda and M. O iwara. Countin classes are at least as hard as the polynomial-time hierarchy. SIAM Journal on Computin , 21(2):316 328, 1992. Tod91. S. Toda. PP is as hard as the polynomial-time hierarchy. SIAM Journal on Computin , 20(5):865 877, 1991. Val76. L. Valiant. The relative complexity of checkin and evaluatin . Information Processin Letters, 5(1):20 23, 1976. Val79a. L. Valiant. The complexity of computin the permanent. Theoretical Computer Science, 8(2):189 201, 1979. Val79b. L. Valiant. The complexity of enumeration and reliability problems. SIAM Journal on Computin , 8(3):410 421, 1979. Wel93. D. Welsh. Complexity: Knots, Colourin s and Countin . Cambrid e University Press, 1993.
Avera e-Case Intractability vs. Worst-Case Intractability Johannes K¨ obler and Rainer Schuler Theoretische Informatik, Universit¨ at Ulm, D-89069 Ulm, Germany
Abs rac . We use the assumption that all sets in NP (or other levels of the polynomial-time hierarchy) have e cient avera e-case al orithms to derive collapse consequences for MA, AM, and various subclasses of P/poly. As a further consequence we show for C P(PP) P PACE that C is not tractable in the avera e-case unless C = P.
1
Introduction
In eneral, the avera e-case complexity of an al orithm depends (by de nition) on the distribution on the inputs. In fact, there exist certain (so called mali n or universal) distributions relative to which the avera e-case complexity of any al orithm coincides with its worst-case complexity [26]. Fortunately, these distributions are not recursive. Even for the class of polynomial-time bounded al orithms, mali n distributions are not computable in polynomial time [31]. In recent literature, it has been shown that several N P-complete problems are solvable e ciently on avera e (i.e., in time polynomial on -avera e) with respect to certain natural distributions on the instances. However, this is not true in eneral unless E = N E [10]. In fact, some natural N P problems A are complete for N P in the sense that with respect to a particular distribution, A is not e ciently solvable on avera e unless any N P problem is e ciently solvable on avera e with respect to any polynomial-time computable distribution [25]. It is therefore one of the main open problems in avera e-case complexity theory whether N P problems can be solved e ciently on avera e with respect to natural, i.e. polynomial-time computable, distributions. Let AP F P denote the class of sets that are decidable in time polynomial on avera e with respect to every polynomial-time computable distribution. As noted above, N P AP F P implies that E = N E [10]. This result provides an interestin connection between avera e-case complexity and worst-case complexity. Namely, if all N P problems can be decided in time polynomial on avera e, then all sets in N E can be decided in (worst-case) exponential time. Similarly, as observed in [14], any random self-reducible set which can be decided in time polynomial on avera e (under the distribution induced by the random self-reduction) can be decided by a randomized al orithm in (worst-case) polynomial time. For example, Lipton [27] used an idea of Beaver and Fei enbaum [8] to show that multivariate polynomials of low de ree are (functionally) random self-reducible. In particular, it follows from Lipton’s result that if there Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 493 502, 1998. c Sprin er-Verla Berlin Heidelber 1998
494
Johannes K¨ obler and Rainer Schuler
is an al orithm computin the permanent e ciently for all but a su ciently small (polynomial) fraction of all n n matrices (over GF(p) where p > n + 1 is prime), then it is possible to compute the permanent of any n n matrix in expected polynomial time. Usin this property it is not hard to show that P(PP) AP F P unless PP = ZPP. From Corollary 1 below, P(PP) AP F P even implies that PP = P (in fact, it is easy to verify that PP = P already follows from the assumption that the middle bit class MP [16] is contained in AP F P ). This means that for C = P(PP), C is not tractable on the avera e unless C is tractable in the worst-case. As shown in Corollary 5, the same holds for C = PSPACE. Hence, the question arises whether a similar relationship holds for other classes C as, e. ., C = N P or, more enerally, for C = kp . In contrast to worst-case complexity, where N P P implies that PH P, it is not known whether N P AP F P implies that all sets in p2 = P(N P) are contained in AP F P (see [19] for an exposition). Consider for example an N P search problem. It is not known whether an e cient avera e-case al orithm for the correspondin decision problem can be used to compute solutions e ciently on avera e. To see the di culty consider the computation of a deterministic Turin machine M with oracle A, where the distribution on the inputs of M is computable in polynomial time. Since the oracle queries can be adaptive, it depends on the oracle set A which queries are actually made. Hence, the distribution induced on the oracle queries is not necessarily computable in polynomial time. On the other hand, it is known that N P AP F P implies that 2p = Ptt (N P) is contained in AP F P (cf. Theorem 5). We refer the reader to [19,36] for further discussions of this and related questions. As shown in [35], the class AP F P is not closed under Turin reducibility, moreover, AP F P even contains Turin complete sets for EX P (note that EX P is not contained in AP F P ). We use the assumption that all sets in NP (or hi her levels of the polynomialtime hierarchy) are e ciently solvable on avera e to derive collapse consequences for MA, AM, and various subclasses of P/poly. Our results are based on the followin special properties of any set A AP F P : Firstly, for any P-printable domain D there is an al orithm that decides A e ciently on all inputs in the domain D. Secondly, since A is e ciently decidable on avera e with respect to the standard distribution st (which is uniform on n ), there is an al orithm for A that is polynomial in the worst case for all but a polynomial fraction of the strin s of each len th. Rou hly speakin , we exploit these two properties in the followin context: A serves as an oracle in a computation that enerates oracle queries in such a way that it is su cient to answer these queries either on some P-printable domain or on any domain which contains a lar e fraction of the strin s of each len th. In particular, we et the followin collapse consequences. (The notion of instance complexity and the class IC[lo ,poly] of sets of strin s with low instance complexity were introduced in [32].) If N P AP F P then MA = N P and N P P/lo = P. AP F P then p2 IC[lo poly] = P and every self-reducible set in If p2 P/poly is in ZPP.
Avera e-Case Intractability vs. Worst-Case Intractability
495
p If 2p AP F P then AM = N P and all sets in 2p 2 that conjunctively, disjunctively, or bounded truth-table reduce to some sparse set are in P. p P/poly = P. If p3 AP F P then 2p 2 p p p P/poly = P. If 3 AP F P then 3 3
Recently a series of plausible consequences, not known to follow from the assumption P = N P, have been derived from the assumption that N P is not small in EX P, see, e. ., [30,28,29,1]. It is interestin to note that the assumption N P AP F P is contradictory to Lutz’ hypothesis that N P is not small in EX P, as follows directly from the fact that AP F P is small in EX P [37,13]. In this extended abstract proofs are omitted; see [22] for a full version.
2
Preliminaries
All lan ua es are over the binary alphabet = 0 1 . The len th of a strin is denoted by x . For a lan ua e A, let A=n denote the set of all strin s x in A of len th n. Strin s in 1 are called tally and a set T is tally if T 1 . A set S is called sparse if the cardinality of S =n is bounded above by a polynomial in n. TALLY denotes the class of all tally sets, and SPARSE denotes the class of all sparse sets. The cardinality of a nite set A is denoted by A . The join of two sets A and B is A B = 0x x A 1x x B . The join of lan ua e classes is de ned analo ously. To encode pairs (or tuples) of strin s we use a standard polynomial-time computable pairin function denoted by whose inverses are also computable in polynomial time. We assume that this function encodes tuples of tally strin s a ain as a tally strin . IN denotes the set of non-ne ative inte ers and by lo we denote the function lo n = max 1 lo 2 n . We assume that the reader is familiar with fundamental complexity theoretic concepts such as (oracle) Turin machines and the polynomial-time hierarchy (see, for example, [6,34]). Let C be a complexity class. A set A is P C -printable if there exists a set C C and a polynomial-time bounded oracle Turin transducer T such that the output of T with oracle C and input 1n is an enumeration of all strin s in A of len th n. An oracle Turin machine T is non-adaptive, if for all oracles C and all inputs x, the queries of T on input x are independent of C. T is honest if there exists a constant c such that x y c for all x and for all oracle queries y of T on input x. A set A is Ptt honest (C)-printable if A is P(C)-printable and the respective Turin transducer is honest and non-adaptive. Next we review the notion of advice functions introduced by Karp and Lipton is [20] to characterize non-uniform complexity classes. A function h : 0 called a polynomial-len th function if for some polynomial p and for all n 0, h(0n ) = p(n). For a class C of sets, let C poly be the class of sets L such that there is a set I C and a polynomial-len th function h such that for all n, and x h(0n ) I. The function h is called an advice for all x in n : x L function for L, whereas I is the correspondin interpreter set. In the followin we will also make use of multi-valued advice functions. A (total) multi-valued function h maps every strin x to a non-empty subis a re nement of h if for set of , denoted by set-h(x). We say that
496
Johannes K¨ obler and Rainer Schuler
all x, set- (x) set-h(x). A multi-valued advice function h has the property p(n) . Furthermore, for all that for some polynomial p and all n, set-h(0n ) x w I. Let F be a w set-h(0n ) and for all x in n it holds that x L class of (possibly multi-valued) functions and let L C poly. Then L is said to have an advice function in F (with respect to interpreter class C) if some h F is an advice function for L with respect to some interpreter set I C. Let be a probability distribution on . Associated with are a distribution function that we also denote by and a density function, denoted by 0 . Both and 0 are functions from to the interval [0 1], with the property denotes the lexthat x 0 (x) = 1 and (x) = yx 0 (y) where, as usual, ico raphic orderin on . Let t be a function from IN to IN. A distribution 0 (x) for all x. If t is a constant, t-dominates a distribution , if 0 (x) t( x ) then we say that dominates by a constant factor, similarly, if t is bounded by a polynomial, then we say that polynomially dominates . IN is polynomial on -avera e Let be a distribution. A function f : (x) 0 (x) < . [25], if there exists a constant > 0 such that x6= f jxj The class of functions polynomial on -avera e has many closure properties that are known for polynomials [25,17]. A further important property is robustness under the polynomial domination of distributions [25,17], i.e., any function that is polynomial on -avera e is also polynomial on -avera e provided that dominates . A distribution is said to be P-computable if its distribution function is Pcomputable, i.e., there exists a polynomial-time deterministic Turin transducer 2−k . Here the M such that for all x and all k it holds that M (x 1k ) − (x) output of M is interpreted as a rational number, in some appropriate way. For example, if M (x 1k ) = p q , then M (x 1k ) computes the number p q. As usual let F P denote the set of polynomial-time computable functions. An important subclass of the class of P-computable distributions is the class of so-called F P-computable distributions for which can be e ciently computed without error. For a complexity class C, we say that a distribution is F P(C)computable (in symbols: F P(C)) if its distribution function is F P(C)computable, i.e., there exist functions f F P(C) and F P such that for all x, (x) = f (x) (x). As the followin theorem shows, a problem is solvable in time polynomial on -avera e for every F P-computable distribution if and only if it is solvable in time polynomial on -avera e for every P-computable distribution . Theorem 1. [17] Every P-computable distribution is dominated by a F Pcomputable distribution by a constant factor. Furthermore, for all x, the binary representation of (x) is of len th linear in the len th of x. Followin [25,17] we assume that all natural distributions are either Pcomputable or dominated by a P-computable distribution. In this sense, a set is e ciently decidable on avera e (under natural distributions) if it is decidable in time polynomial on -avera e with respect to every distribution F P.
Avera e-Case Intractability vs. Worst-Case Intractability
497
De nition 1. [38] Let F be a set of distributions. A set A is decidable in avera e polynomial time under distributions in F (in symbols, A AP F ) if for every distribution F there exists a deterministic Turin machine M such that A = L(M ) and the runnin time of M is polynomial on -avera e. As noted by Ben-David et al. [10], all sets in AP F P are decidable in polynomial time on tally inputs. In [33], Schapire shows that a function f is polynomial on -avera e if and only if there exists a polynomial p such that for all m, 1 x f (x) > p( x m) m . From this characterization it follows immediately that any function f that is polynomial on -avera e is in fact polynomially bounded on n , except for a subset which has low probability under . Proposition 1. Let f be polynomial on -avera e. For every polynomial p there 1 p(n) f (x) > p0 (n) is a polynomial p0 such that for all n, x p(n) . Proposition 2. Let f be polynomial on -avera e. 1. Then for every polynomial p there exists a polynomial p0 such that f (x) p0 ( x ) holds for all x with 0 (x) 1 p( x ). 1 2−jxj for all 2. If = st is the standard distribution (where 0st (x) = jxj(jxj+1) x = ), then for every polynomial p there exists a polynomial p0 such that 2n n f (x) > p0 (n) for all n > 0, x p(n) .
3
Eliminatin Tally and Printable Oracle Queries
The followin consequence was the rst that has been derived from the assumption that all N P problems are decidable in time polynomial on -avera e for any distribution F P. Theorem 2. [10] If N P TALLY P).
AP F P , then E = N E (or, equivalently, N P
Put in other words, if N P problems have e cient avera e-case decision alorithms, then P(N P TALLY), a subclass of P/poly, collapses downto P. We observe that similar collapse consequences downto P can be derived for other subclasses of P/poly (see Corollary 1). Some of these collapse consequences follow immediately from recent results investi atin the complexity of sparse and tally descriptions for sets in P/poly [7,21,15,2]. For the others we can exploit an interestin connection between the worst-case complexity of a set L and the avera e-case complexity of oracles used in the computation of an advice function for L. The followin theorem shows that if an advice function h for some set L can be e ciently computed relative to some oracle which is e ciently decidable on avera e, then h is computable in polynomial time. Theorem . 1. If P(D) TALLY AP F P then any advice function that is computable in F P(D) is computable in F P.
498
Johannes K¨ obler and Rainer Schuler
2. If A A pm D TALLY AP F P then any advice function that is computable in F P tt (D) is computable in F P. Now, usin results from [7,2,21,15], we can state similar collapse consequences as in Theorem 2 for several subclasses of P/poly. We note that by usin a di erent proof technique it has been shown in [5] that BPP = P follows from the assumption that every tally set in 4p is contained in P. Corollary 1. 1. If N P TALLY AP F P then N P P/lo = P. 2. If p2 TALLY AP F P then p2 IC[lo poly] = P. p AP F P then all sets in 2p 3. If 2p TALLY 2 that conjunctively, disjunctively, or bounded truth-table reduce to some sparse set are in P. p P/poly = P and hence BPP = P. 4. If p3 TALLY AP F P then 2p 2 p p p P/poly = P. 5. If 3 TALLY AP F P then 3 3 In our next theorem we consider the complexity of sets in P/poly that have advice functions which can be computed by nondeterministic transducers under some oracle. The proof makes use of the followin proposition which shows as a special case that any set A AP F P is e ciently decidable on any P-printable domain B. Proposition . Let A AP F P(C) and let B be a P(C)-printable set for some oracle C. Then there exists a set D P such that B D and D A P. For an oracle B, a (multivalued) function h is in N PMV(B) if there exists a non-deterministic polynomial-time transducer T such that set-h(x) consists of all output values of T B on input x. h is in N PMV honest (B) if, additionally, there exists a constant c such that y c > x for all oracle queries y of T B on input x. If B = then we simply write N PMV instead of N PMV( ). Theorem 4. Assume that A AP F P(N P(A)) . Then any advice function h N PMV honest (A) has a re nement in N PMV, implyin that any set L (N P co-N P) poly that has an advice function in N PMV honest (A) belon s to N P co-N P. As an application we et the followin consequence for the class IP[P/poly] that contains all sets havin an interactive proof with prover complexity restricted to P/poly [4,3]. Corollary 2. If N P
AP F P(
p 2)
then IP[P/poly]
NP
co-N P.
As mentioned in the introduction, if a decision problem L2 is decidable in time polynomial on 2 -avera e for any F P-computable distribution 2 , then this does not necessarily imply that also any set L1 in P(L2 ) is e ciently decidable on avera e with respect to any F P-computable distribution 1 . If however for any F P(N P)-computable distribution 2 , L2 is decidable in time polynomial on 2 -avera e, then we can show that indeed L1 is e ciently solvable on avera e with respect to any F P-computable distribution 1 . For this it su ces to show that the distribution on the oracle queries induced by 1 and by the reduction of L1 to L2 is F P(N P)-computable.
Avera e-Case Intractability vs. Worst-Case Intractability
499
Theorem 5. Let C and D be lan ua e classes where C is closed under polynomial-time many-one equivalence. Then C AP F P(CD) implies P(C) AP F P(CD) and C AP F P(D) implies Ptt (C) AP F P(D) . Corollary . 1. If N P AP F P(N P) then p2 IC[lo poly] = P. p 2. If 2p AP F P( 2p ) then 2p 2 P/poly = P and in particular, BPP
4
P.
Eliminatin Random Oracle Queries
As mentioned in the introduction, any random self-reducible set which can be decided in time polynomial on avera e (under the distribution induced by the random self-reduction) can be decided by a randomized al orithm in expected polynomial time. As shown by Fei enbaum and Fortnow, many complexity classes like PP, Modk P, and PSPACE have complete sets that are random self-reducible. By combinin the results stated in [14] with Corollary 4 below, it is not hard to verify that for K P(PP) MP Modk P ModP PSPACE , K is not contained in AP F P unless K ZPP where the middle bit class MP, the classes Modk P, k 2, and the eneralized Mod class ModP have been introduced and studied in [16], [12,18,9], and [23], respectively. In Theorem 7 below we show a similar collapse for the subclass of P/poly consistin of all sets L for which a multivalued advice function can be computed by a randomized al orithm under an oracle that is easily decidable on avera e. Let h N PMV(B). Then we say that h F ZPP(B) if h is computable by an N PMV(B) transducer that, when considered as a probabilistic Turin machine, on any input x produces with probability at least 1 2 some output y. Let M be a randomized Turin machine. If we x a sequence r 0 1 of the probabilistic choices of M , then the computation of M on input x is deterministic. We use Mr (x) to denote the output of M on input x and com and p putation path r. Assumin that M uses a functional oracle f : is a polynomial boundin the runnin time of M , we de ne for any input x the distribution M f x induced by M on input x with oracle f , 0 M f x (y)
=
Ry (x) R(x)
0 1 p(n) and y is the ith query ofMrf (x) and where Ry (x) = (r i) r R(x) = y2 ∗ Ry (x). Assume that F ZPP f via some transducer M . Then we say that the f F ZPP f computation of M is dominated by a distribution (in symbols: via M ) if dominates the ensemble ( M f x )x2 ∗ , i.e., there exists a polynomial f 0 s such that for all x and y, 0 (y) M f x (y) s( x ). By ZPP we denote the class of all lan ua es whose characteristic function belon s to F ZPP f . For positive inte ers i and m, binm (i) denotes the binary representation of i, padded to len th m. For any function f , we de ne the set Af = ybinq(jyj) (i) 1
i
f (y) + 1 and the ith bit of f (y)1 is one
500
Johannes K¨ obler and Rainer Schuler
that contains for any strin y all strin s yz such that z = binq(jyj) (i) for some i 1 f (y) + 1 and the ith bit of f (y)1 is one. Here, q(n) is a xed n . polynomial boundin the len th of the strin s f (y), y Lemma 1. Let f be a function and q be a polynomial such that f (y) < q( y ). Then F ZPP f F ZPP Af where is the distribution de ned as 0
0
(u) =
0
(y) q( y )
if u = ybinq(jyj) (i) for some i otherwise
1
q( y )
AP F P and if is a distribution in F P, then F ZPP f Theorem 6. If Af has a re nement in F ZPP and, in particular, ZPP f ZPP. Since the standard distribution et the followin corollary.
st
is easily seen to be in F P, we immediately
Corollary 4. If Af AP F P , then any function h in F ZPP and, in particular, ZPP f st ZPP.
F ZPP f st has a re nement
Now we are ready to show that any advice function which can be computed by a randomized al orithm under an oracle that is easily decidable on avera e is computable in the same way without the help of an oracle. Theorem 7. Any advice function that is computable in F ZPP(D) where P(D) AP F P has a re nement in F ZPP. By usin results from [11,24,27,14,16,23] it is easy to derive the followin corollary. Corollary 5. 1. [39] If p2 AP F P then every self-reducible set in P/poly is in ZPP. 2. If N P AP F P(N P) then every self-reducible set in P/poly is in ZPP. 3. For K P(PP) MP ModP PSPACE , K is not contained in AP F P unless K = P. Finally, by applyin a technique used to show that MA ZPP(N P) [1] we extend a result in [19] showin that N P AP F P implies BPP = ZPP. More speci cally, we derive under the same assumption N P AP F P that MA can be derandomized, i.e., MA = N P, whereas under the stron er assumpAP F P also AM can be derandomized, i.e., AM = N P. Note that tion 2p AM = N P has some immediate stron implications as, for example, that Graph Isomorphism is in N P co-N P. Theorem 8. 1. If N P AP F P then MA = N P. 2. If 2p AP F P then AM = N P. We notice that in order to derive MA = N P (AM = N P) it su ces to assume that for any set L in co-N P (respectively, 2p ) and any F P-computable distribution there is some nondeterministic Turin machine for L whose runnin time is polynomial on -avera e.
Avera e-Case Intractability vs. Worst-Case Intractability
501
References 1. V. Arvind and J. K¨ obler. On resource-bounded measure and pseudorandomness. In Proc. 17th Conference on Foundations of Software Technolo y and Theoretical Computer Science, volume 1346 of Lecture Notes in Computer Science, pa es 235 249. Sprin er-Verla , 1997. 2. V. Arvind, J. K¨ obler, and M. Mundhenk. Upper bounds for the complexity of sparse and tally descriptions. Mathematical Systems Theory, 29(1):63 94, 1996. 3. V. Arvind, J. K¨ obler, and R. Schuler. On helpin and interactive proof systems. International Journal of Foundations of Computer Science, 6(2):137 153, 1995. 4. L. Babai, L. Fortnow, and C. Lund. Non-deterministic exponential time has twoprover interactive protocols. Computational Complexity, 1:1 40, 1991. 5. L. Babai, L. Fortnow, N. Nisan, and A. Wi derson. BPP has subexponential time simulations unless EXPTIME has publishable proofs. Computational Complexity, 3:307 318, 1993. 6. J. L. Balcazar, J. D az, and J. Gabarro. Structural Complexity I. EATCS Monoraphs on Theoretical Computer Science. Sprin er-Verla , second edition, 1995. 7. J.L Balcazar and U. Sch¨ onin . Lo arithmic advice classes. Theoretical Computer Science, 99:279 290, 1992. 8. D. Beaver and J. Fei enbaum. Hidin instances in multioracle queries. In Proc. 7th Symposium on Theoretical Aspects of Computer Science, volume 415 of Lecture Notes in Computer Science, pa es 37 48. Sprin er-Verla , 1990. 9. R. Bei el and J. Gill. Countin classes: thresholds, parity, mods, and fewness. Theoretical Computer Science, 103:3 23, 1992. 10. S. Ben-David, B. Chor, O. Goldreich, and M. Luby. On the theory of avera e case complexity. Journal of Computer and System Sciences, 44:193 219, 1992. 11. N. Bshouty, R. Cleve, R. Gavalda, S. Kannan, and C. Tamon. Oracles and queries that are su cient for exact learnin . Journal of Computer and System Sciences, 52:421 433, 1996. 12. J. Cai and L. A. Hemachandra. On the power of parity polynomial time. Mathematical Systems Theory, 23:95 106, 1990. 13. J.-Y. Cai and A. Selman. Fine separation of avera e time complexity classes. In Proc. 13th Symposium on Theoretical Aspects of Computer Science, volume 1046 of Lecture Notes in Computer Science, pa es 331 343. Sprin er-Verla , 1996. 14. J. Fei enbaum and L. Fortnow. Random-self-reducibility of complete sets. SIAM Journal on Computin , 22:994 1005, 1993. 15. R. Gavalda. Boundin the complexity of advice functions. Journal of Computer and System Sciences, 50(3):468 475, 1995. 16. F. Green, J. K¨ obler, K. Re an, T. Schwentick, and J. Toran. The power of the middle bit of a #P function. Journal of Computer and System Sciences, 50(3):456 467, 1995. 17. Y. Gurevich. Avera e case completeness. Journal of Computer and System Sciences, 42(3):346 398, 1991. 18. U. Hertrampf. Relations amon MOD-classes. Theoretical Computer Science, 74:325 328, 1990. 19. R. Impa liazzo. A personal view of avera e-case complexity. In Proc. 10th Structure in Complexity Theory Conference, pa es 134 147. IEEE Computer Society Press, 1995. 20. R. M. Karp and R. J. Lipton. Some connections between nonuniform and uniform complexity classes. In Proc. 12th ACM Symposium on Theory of Computin , pa es 302 309. ACM Press, 1980.
502
Johannes K¨ obler and Rainer Schuler
21. J. K¨ obler. Locatin P/poly optimally in the extended low hierarchy. Theoretical Computer Science, 134(2):263 285, 1994. 22. J. K¨ obler and R. Schuler. Avera e-case intractability vs. worst-case intractability. See ftp://theorie.informatik.uni-ulm.de/pub/papers/ti/ap.ps. z. 23. J. K¨ obler and S. Toda. On the power of eneralized MOD-classes. Mathematical Systems Theory, 29(1):33 46, 1996. 24. J. K¨ obler and O. Watanabe. New collapse consequences of NP havin small circuits. In Proc. 22nd International Colloquium on Automata, Lan ua es, and Pro rammin , volume 944 of Lecture Notes in Computer Science, pa es 196 207. Sprin erVerla , 1995. 25. L. Levin. Avera e case complete problems. SIAM Journal on Computin , 15:285 286, 1986. 26. M. Li and P.M.B. Vitanyi. Avera e case complexity under the universal distribution equals worst-case complexity. Information Processin Letters, 42:145 149, 1992. 27. R. J. Lipton. New directions in testin . In J. Fei enbaum and M. Merritt, editors, Distributed Computin and Crypto raphy, volume 2 of DIMACS Series in Discrete Mathematics and Theoretical Computer Science. American Mathematical Society, 1991. 28. J. H. Lutz. Observations on measure and lowness for P 2 . Theory of Computin Systems, 30:429 442, 1997. 29. J. H. Lutz. The quantitative structure of exponential time. In L. A. Hemaspaandra and A. L. Selman, editors, Complexity Theory Retrospective II, pa es 225 260. Sprin er-Verla , 1997. 30. J. H. Lutz and E. Mayordomo. Cook versus Karp-Levin: separatin reducibilities if NP is not small. Theoretical Computer Science, 164:141 163, 1996. 31. P.B. Milterson. The complexity of mali n measures. SIAM Journal on Computin , 22(1):147 156, 1993. 32. P. Orponen, K. Ko, U. Sch¨ onin , and O. Watanabe. Instance complexity. Journal of the ACM, 41(1):96 121, 1994. 33. R. E. Schapire. The emer in theory of avera e-case complexity. Technical Report TM-431, Massachusetts Institut of Technolo y, 1990. 34. U. Sch¨ onin . Complexity and Structure, volume 211 of Lecture Notes in Computer Science. Sprin er-Verla , 1986. 35. R. Schuler. Truth-table closure and Turin closure of avera e polynomial time have di erent measures in EXP. In Proc. 11th Annual IEEE Conference on Computational Complexity, pa es 190 197. IEEE Computer Society Press, 1996. 36. R. Schuler and O. Watanabe. Towards avera e-case complexity analysis of NP optimization problems. In Proc. 10th Structure in Complexity Theory Conference, pa es 148 159. IEEE Computer Society Press, 1995. 37. R. Schuler and T. Yamakami. Sets computable in polynomial time on avera e. In Proc. 1st International Computin and Combinatorics Conference, volume 959 of Lecture Notes in Computer Science, pa es 400 409. Sprin er-Verla , 1995. 38. R. Schuler and T. Yamakami. Structural avera e case complexity. Journal of Computer and System Sciences, 52:308 327, 1996. 39. O. Watanabe, 1996. Personal communication.
Shu e on Trajectories: The Sch¨ utzenber er Product and Related Operations ? Tero Harju1 , Alexandru Mateescu2 , and Arto Salomaa1 1
Turku Centre for Computer Science and Department of Mathematics, University of Turku, 20014 Turku, Finland 2 Turku Centre for Computer Science and Faculty of Mathematics, University of Bucharest, Romania. harju, mateescu, asalomaa @utu.f
Abs rac . We investi ate the problem of ndin monoids that reco nize lan ua es of the form L1 T L2 , where T is an arbitrary set of trajectories. Thereby, we describe two such methods: one based on the so-called trajectories monoids and the other based on monoids of matrices. Many well-known operations such as catenation, bi-catenation, shu e, literal shu e and insertion are just particular instances of the operation T . Hence, our results o er a uniform treatment for classical methods, notably the Sch¨ utzenber er product. We also investi ate some other related operations.
1
Preliminaries
In this paper we investi ate the problem of ndin monoids that reco nize lanua es of the form L1 T L2 , where T is an arbitrary set of trajectories. The solution o ers a uniform method to nd monoids that reco nize a number of operations with lan ua es such as, for instance: catenation, bi-catenation, shu e, literal shu e, balanced literal shu e, insertion, etc. Also, we compare our solution with other well-known constructions, notably with the Sch¨ utzenber er product. Some other operations with lan ua es are considered, too. The operation of shu e on trajectories of words and lan ua es was introduced in [3]. The operations considered below are de ned usin the notion of the trajectory. A trajectory de nes the eneral strate y to switch from one word to another word when carryin out the shu e operation. The operation is extended to sets T of trajectories. Let be an alphabet. The set of all words over is denoted by . The , then w denotes the len th of w and w a empty word is denoted by . If w denotes the number of occurrences of a in w, where a . Note that = 0. If A is a set, then the set of all subsets of A is denoted by P(A). The shu e operation, denoted by , is de ned recursively by: (ax
by) = a(x
by)
b(ax
y)
and
x
=
x= x
This work has been partially supported by the Project 137358 of the Academy of Finland. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 503 511, 1998. c Sprin er-Verla Berlin Heidelber 1998
504
Tero Harju et al.
where x, y and a, b . Other operations with words and lan ua es that we consider in this paper are: , x = x1 x2 xn , y = y1 y2 ym , literal shu e, denoted by l t : if x y , 1 i n, 1 j m, then where x yj
x
lt
y=
x1 y1 x2 y2 x1 y1 x2 y2
xm ym xm+1 xm+2 xn xn yn yn+1 yn+2 ym
if n > m if n m;
balanced literal shu e, denoted by bl t , and de ned as l t , but only for words of the same len th; insertion, denoted by −: x − y = x0 yx00 x0 x00 = x ; bi-catenation, denoted by : x y = xy yx ; anti-catenation, denoted by : x y = yx All the above operations are extended in a natural way to operations with − lan ua es, i.e., if ./ is an operation with words, ./ lt bl t and L1 , L2 are lan ua es, then L1 ./ L2 =
x ./ y x2L1 y2L2
2
Shu e on Trajectories
In this section we introduce the notions of the trajectory and shu e on trajectories. Let V = r u be the set of versors in the plane: r stands for the ri ht direction, whereas u stands for the up direction. V .
De nition 1. A trajectory is an element t, t Let
be an alphabet and let t be a trajectory, let d be a versor, d .
De nition 2. The shu e of with recursively de ned as follows: if = ax and = by, where a b ax if
= ax and
dt
= , where a ax
if
=
and
a(x b(ax
by =
dt
=
t
by) y)
a(x
t
b(
)
t y)
, then if d = r if d = u;
, then if d = r if d = u
Finally, t
=
, then
if d = r if d = u;
t
and y
by =
and x y
and x
= by, where b dt
on the trajectory dt, denoted
if t = otherwise
V , and dt
, is
Shu e on Trajectories: The Sch¨ utzenber er Product and Related Operations
Comment. Note that if
= t r or
= t u , then
t
505
= .
Example 1. Let and be the words = a1 a2 a3 a4 a5 a6 a7 a8 , = b1 b2 b3 b4 b5 and assume that t = r3 u2 r3 ururu. The shu e of with on the trajectory t is t
= a1 a2 a3 b 1 b 2 a4 a5 a6 b 3 a7 b 4 a8 b 5
Remark 1. Here we show that a number of operations with words and lan ua es are particular cases of the operation of shu e on trajectories. Let T be the set T = r u . Observe that T = , the shu e operation. Assume that T = r u . It follows that T = , the catenation operation. De ne T = r u r and note that T = −, the insertion operation. Consider T = (ru) and observe that T = bl t , the balanced literal shu e. Assume that T = (ru) (r u ). Note that in this case T = l t , the literal shu e. 6. Let T be the set T = r u u r . In this case T = , i.e., it is the bi-catenation operation. 7. Consider T = u r and observe that T = , the anti-catenation operation. 1. 2. 3. 4. 5.
3
The Problem of Reco nition and Trajectories Monoids
We now o into some eneral facts about lan ua es reco nized by monoids. Of a special interest is the case of lan ua es of the form L1 T L2 , where T is a set of trajectories. A monoid M1 is embedded in a monoid M2 i there exists an injective morphism from M1 to M2 . A monoid M1 divides a monoid M2 , denoted M1 < M2 , i M1 is isomorphic with a quotient of a submonoid of M2 . Clearly, if M1 is embedded in M2 , then M1 divides M2 . The division relation is transitive. The unit element of a monoid is denoted by 1. If M is a monoid, then the set P(M ) is a monoid with the multiplication de ned by AB = xy x A y B , where A B M . . A monoid M reco nizes L i De nition 3. Let L be a lan ua e, L M , such that there exists a morphism : − M , a subset F of M , F L = −1 (F ). If, additionally, (w) = 1 i w = , then we say that M unitseparately reco nizes L. , there exists a monoid M that reco nizes L. An For each lan ua e L, L example of such a monoid is the syntactic monoid of L. The syntactic con ruence : de ned by L is the con ruence L on de ned as: x L y i for all . The syntactic monoid of L, denoted by x Li y L, where x y ML , is the quotient monoid L . One can easily verify that ML reco nizes L. A monoid M reco nizes L i ML divides M . If a monoid M1 reco nizes L and if M1 divides M2 , then M2 reco nizes L, too.
506
Tero Harju et al.
Assume that a monoid M reco nizes L, but M does not unit-separately reco nize L. In this case we can adjoin a new unit element, say 10 , to M and the new monoid M 0 unit-separately reco nizes L. The morphism is extended 10 , if L, to a new morphism 0 such that 0 ( ) = 10 . Moreover, F 0 = F and F 0 = F , otherwise. Hence, for each lan ua e L there exists a monoid M that unit-separately reco nizes L. However, there are monoids that do not unitseparately reco nize any lan ua e, for instance the monoid 1 . The followin theorem oes back to Kleene: Theorem 1. A lan ua e L is re ular i L is reco nized by some nite monoid. . Let M1 M2 be monoids, such that M Let L1 L2 be lan ua es L1 L2 reco nizes L , i = 1 2. Assume that ./ is an operation with lan ua es such that . L1 ./ L2 The followin problem has been widely investi ated: nd a function Ψ such that the lan ua e L1 ./ L2 is reco nized by Ψ (M1 M2 ). For more details on this problem, as well as for a lar e biblio raphy, the reader is referred to [1], [4], or more recently, [5]. In the sequel we solve this problem for the operation T , where T is an arbitrary set of trajectories. The solution o ers a uniform method to nd monoids that reco nize a lar e number of operations with lan ua es. Also, we compare our solution with other well-known constructions, mainly with the Sch¨ utzenber er product. , and let M1 M2 be monoids De nition 4. Let L1 L2 be lan ua es, L1 L2 such that M reco nizes L , i = 1 2. Assume that T is a set of trajectories, T r u and let MT be a monoid that reco nizes T . The trajectories monoid associated to (M1 M2 MT ), denoted by T (M1 M2 MT ), is by de nition the monoid P(M1 M2 MT ), i.e., T (M1 M2 MT ) = P(M1 M2 MT ). , and let M1 M2 be monoids Theorem 2. Let L1 L2 be lan ua es, L1 L2 such that M reco nizes L , i = 1 2. Assume that T is a set of trajectories, T r u and let MT be a monoid that reco nizes T . The lan ua e L1 T L2 is reco nized by the trajectories monoid T (M1 M2 MT ).
: − M be morphisms such that −1 (F ) = L , for some Proof. Let M , i = 1 2. Assume that T : − MT is a morphism such that F −1 (FT ) = T , for some FT MT . De ne the morphism : − T (M1 M2 MT ), (a) = ( 1 (a) 1 T (r)) . It is easy to see that the morphism has the (1 2 (a) T (u)) , where a followin remarkable property: (x) = (
1(
)
2(
)
T (t))
x
t
where
t
V
Consider the set F = K M1 M2 MT K (F1 F2 FT ) = . Usin the above property of , one can easily show that −1 (F ) = L1 T L2 . Hence, the trajectories monoid T (M1 M2 MT ) reco nizes the lan ua e L1 T L2 .
Shu e on Trajectories: The Sch¨ utzenber er Product and Related Operations
507
Note that the monoid T (M1 M2 MT ) unit-separately reco nizes the lanua e L1 T L2 . Also, note that if M1 , M2 and MT are nite monoids, then also the trajectories monoid T (M1 M2 MT ) is nite. Hence, Corollary 1. If L1 , L2 and T are re ular lan ua es, then L1 lan ua e.
T
L2 is a re ular
Consider now the case T = r u . Therefore the operation T is the shu e, . Note that MT is the trivial monoid, i.e., MT = 1 . Hence, the monoid M1 M2 MT is isomorphic with the monoid M1 M2 and, consequently, in this case the trajectories monoid is P(M1 M2 ). Thus we obtain Corollary 2. If L1 , L2 are lan ua es, then the lan ua e L1 L2 is reco nized by the monoid P(M1 M2 ). Moreover, if L1 and L2 are re ular lan ua es, then L1 L2 is a re ular lan ua e. See [4], Proposition 1.3, for an entirely di erent proof of the above corollary. Similar results can be obtained for the operations of bi-catenation, literal shu e, balanced literal shu e, and insertion. However, we do not enter this discussion in this paper.
4
Catenation and the Sch¨ utzenber er Product
Of a special interest is the case of the catenation operation. We quote from Eilenber , [1], vol. B, pa e 249: The catenation product AB of two reco nizable subsets A and B of , turns out to be a rather complicated operation when looked at from the point of view of the syntactic invariants. It requires a new operation on semi roups due to Sch¨ utzenber er. The Sch¨ utzenber er product of two monoids M1 and M2 , denoted by M1 M2 , is the submonoid of [P(M1 M2 )]22 enerated by all matrices of the followin form: (m1 1) N 0 (1 m2 ) M , i = 1 2, and N M1 M2 . where m The followin theorem oes back to Sch¨ utzenber er, [6], see also [1], vol. B, Theorem 2.1, or [4], Theorem 1.4. Theorem 3. If M are monoids such that M reco nizes L , i = 1 2, then the monoid M1 M2 reco nizes L1 L2 . By Remark 1, for T = r u , T is the catenation operation. We start by considerin MT as bein the syntactic monoid of T , denoted by Mcat . Since T is a re ular lan ua e, it follows that Mcat is a nite monoid. Moreover, by a classical γ 0 , where 1 is the unit element, 0 method, one can obtain that Mcat = 1 = γ = γ and = γ = γ = γγ = 0. is the zero element, 2 = , 2 = , The morphism T : − MT , de ned by T (r) = and T (u) = , has the γ . property that −1 T (FT ) = T , where FT = 1 From Theorem 2 it follows in a strai htforward manner:
508
Tero Harju et al.
Theorem 4. If M are monoids such that M reco nizes L , i = 1 2, then the trajectories monoid T (M1 M2 Mcat ) reco nizes L1 L2 . In the remainder of this section we establish the interrelation between the utzenber er product M1 M2 . trajectories monoid T (M1 M2 Mcat ) and the Sch¨ Notations. Let : − T (M1 M2 Mcat ) be the morphism from the above theorem, with the property that −1 (F ) = L1 L2 , for some F T (M1 M2 Mcat ). We denote by M1 [cat]M2 the monoid ( ). Note that M1 [cat]M2 is a submonoid of T (M1 M2 Mcat ). Moreover, the monoid M1 [cat]M2 reco nizes the lan ua e L1 L2 , too. Let m be in M1 [cat]M2 , m = 1. From the de nition of the monoid M1 [cat]M2 there exists a word x , such that m = (x). One can easily verify that x is a nonempty word. Consider the mappin : M1 [cat]M2 − M1 M2 de ned as (m) =
(
1 (x)
1) (
0
0 1 (x )
00 2 (x ))
(1
x = x0 x00 2 (x))
and (1) = 1. One can prove that is well de ned. The followin theorem shows the relation between the trajectories monoids and the Sch¨ utzenber er product. Theorem 5. The mappin reco nizes L , i = 1 2, then
is a morphism and, moreover, if M unit-separately is injective.
Corollary 3. The monoid M1 [cat]M2 divides the monoid M1 M2 , if M unitseparately reco nizes L , i = 1 2. Note that, usin the above corollary and Theorem 4 we obtain a new proof of the classical Theorem 3 in the case that M unit-separately reco nizes L , i = 1 2.
5
Monoids of Matrices
The Sch¨ utzenber er product M1 M2 is a monoid of matrices. Consequently, the followin natural problem arises: does there exist for every set of trajectories T and for all lan ua es L1 and L2 a monoid of matrices that reco nizes the lanua e L1 T L2 ? The answer to this question is positive and the rst part of this section is dedicated to this problem. The section ends with some Sch¨ utzenber erlike products for some other operations: literal shu e, bi-catenation, insertion, etc. In this section we restrict our attention to re ular sets of trajectories. This is not a major restriction mathematically. However, nonre ular sets of trajectories lead to in nite matrices. We start with some eneral facts concernin re ular lan ua es and nite . There exists a nite automaton automata. Let R be a re ular lan ua e, R A = (Q Q n Qf n ) such that the lan ua e accepted by A, denoted by L(A)
Shu e on Trajectories: The Sch¨ utzenber er Product and Related Operations
509
is R, i.e., L(A) = R. Note that we do not assume that A is a deterministic automaton. Without loss of enerality, we may assume that the set Q of states, is of the form Q = 1 2 n , for some n 1. Let A be the transition matrix associated to A, i.e., A is an n n matrix A = (d j )1 jn such that (i x) = j . Note that the entries in A are subsets of . Let dj = x k be the kth power of the matrix A , where k 1. By de nition, 0A is the A unit matrix of size n n. Moreover, denote by A the matrix k0 kA . Note that A does always exist. Let n = (ij )1jn be the row matrix of size 1 n, where ij = 1, if j Q n and ij = 0, otherwise. Similarly, let f n = (fj )1jn be the column matrix of size n 1, where fj = 1, if j Qf n and fj = 0, otherwise. The followin theorem is well known, see [1], [2]. Theorem 6. Usin the above notations: (i w) = j and w = k , (i) if kA = ( j )1 jn , then j = w where k 0. (ii) the lan ua e accepted by the automaton A is L(A) = n A f n Let AT = (QT r u T QT n QT f n ) be a nite automaton such that L(AT ) = n and T = (d j )1 jn is the transition maT . Assume that QT = 1 2 trix associated to AT . , i = 1 2. Let be an alphabet, and let L1 , L2 be lan ua es, L : − M Assume that L is reco nized by the monoid M , i = 1 2. Let be a morphism such that L = −1 (F ), for some F M , i = 1 2. Let a be in and let a : r u − M1 M2 be the morphism de ned by a (r) = ( 1 (a) 1) and a (u) = (1 2 (a)). For each a , we de ne the matrix a ( T ) as the n n matrix obtained from the transition matrix T = (d j )1 jn by replacin each d j with a (d j ). Let MT (M1 M2 ) be the monoid enerated by the followin set of matri. Note that MT (M1 M2 ) is a submonoid of the monoid ces: a ( T ) a [P(M1 M2 )]nn . The followin theorem ives a positive answer to the question considered at the be innin of this section. be lan ua es and assume that L is reco nized by Theorem 7. Let L1 L2 r u be a re ular set of trajectories. The the monoid M , i = 1 2, and let T lan ua e L1 T L2 is reco nized by the monoid of matrices MT (M1 M2 ).
Havin a lan ua e of the form L = L1 T L2 we proved that L is reco nized by the trajectories monoid T (M1 M2 MT ) and also by the monoid of matrices MT (M1 M2 ). Hence, a natural question occurs: what is the interrelation between these two monoids? Let : − T (M1 M2 MT ) be the morphism such that −1 (F ) = L1 T L2 . Denote by M1 [T ]M2 the monoid ( ). Note that M1 [T ]M2 is a submonoid of T (M1 M2 ) and, moreover, M1 [T ]M2 reco nizes L1 T L2 . Consider the mappin : M1 [T ]M2 − MT (M1 M2 ) de ned as follows: (1) = 1 and, for each m M1 [T ]M2 , such that m = 1, there exists a nonempty
510
Tero Harju et al.
word x such that m = (x). Assume that x = a1 a2 1 i m. Then, by de nition,
(m) = One can show that
a1 (
T ) a2 (
T)
am (
am , where a
,
T)
is well de ned.
Theorem 8. The mappin reco nizes L , i = 1 2, then
is a morphism and, moreover, if M unit-separately is injective.
Corollary 4. The monoid M1 [T ]M2 divides the monoid MT (M1 M2 ), if M unit-separately reco nizes L , i = 1 2. Now we briefly describe the products correspondin to the operations listed in Remark 1. All these products are similar to the Sch¨ utzenber er product. Matrices in the product monoid MT (M1 M2 ) are referred to as product matrices. 1. The shu e operation: the transition matrix is T = ( r u ) and the product matrices are of the form (N ), where N M1 M2 . 2. The catenation operation: the transition matrix is: T
=
ru 0u
Product matrices:
(m1 1) N 0 (1 m2 )
utzenber er product. where, N M1 M2 . Hence, we obtain a ain the Sch¨ 3. The insertion operation: the transition matrix is:
T
ru0 0ur 00r
=
Product matrices:
N2 (m1 1) N1 0 (1 m2 ) N3 0 0 (n1 1)
where, N1 N2 N3 M1 M2 and m1 n1 M1 , m2 M2 . 4. The balanced literal shu e operation: the transition matrix is: T
=
0r u0
Product matrices:
m0 0 n
0 m0 n0 0
where, m n m0 n0 M1 M2 . 5. The literal shu e operation: the transition matrix is:
T
=
0r0u u0r 0 00r0 000u
Product matrices:
N2 m n N1 p q N3 N4 0 0 (m1 1) 0 0 0 0 (1 m2 )
M 1 M 2 , m1 M 1 , m2 M2 and, moreover, where, N1 N2 N3 N4 m = q = 0 n p M1 M2 or n = p = 0 m q M1 M2 .
Shu e on Trajectories: The Sch¨ utzenber er Product and Related Operations
511
6. The bi-catenation operation: the transition matrix is:
T
=
ru00 0u00 00ur 000r
Product matrices:
(m1 1) N1 0 (1 m2 ) 0 0 (1 0 0
0 0 0 0 m2 ) N 2 0 (m1 1)
where, N1 N2 M1 M2 , m1 M1 , and m2 M2 . 7. The anti-catenation operation: the transition matrix is: T
6
=
ur 0r
Product matrices:
(1 m2 ) N 0 (m1 1)
, where N
M1
M2
Conclusion
We introduced a uniform method to nd monoids that reco nize lan ua es of the form L1 T L2 and consequently, our results are applicable to many of the most important operations with lan ua es. Many details concernin this method remain to be clari ed. The above problems can be formulated for all associative 3. operations T and lan ua es of the form L1 T L2 T T Ln , n Acknowled ements. The authors are rateful to Volker Diekert for his comments that have improved the initial version of this paper.
References 1. 2. 3. 4. 5. 6.
S. Eilenber , Automata, Lan ua es and Machines, Academic Press, New York, vol. A, 1974, vol. B, 1976. W. Kuich and A. Salomaa, Semirin s, Automata, Lan ua es, Sprin er-Verla , Berlin, 1986. A. Mateescu, G. Rozenber and A. Salomaa, Shu e on Trajectories: Syntactic Constraints , Theoretical Computer Science, 197, 1-2, (1998) 1-56. J.E. Pin, Varieties of Formal Lan ua es, North Oxford Academic, 1986. J.E. Pin, Syntactic Semi roups , in Handbook of Formal Lan ua es, eds. G. Rozenber and A. Salomaa, Vol. 1, Sprin er, 1997, 679-746. M.P. Sch¨ utzenber er, On nite monoids havin only trivial sub roups , Information and Control, 8, (1965) 190-194.
Gau ian Elimination and a Characterization of Al ebraic Power Series Werner Kuich Abteilun f¨ ur Theoretische Informatik Institut f¨ ur Al ebra und Diskrete Mathematik Technische Universit¨ at Wien ku ch@tuw en.ac.at
Abs rac . We show rst how systems of equations can be solved by Gau ian elimination. This yields a characterization of al ebraic power series and of (A0 ), A0 ⊆ A, A a continuous semirin . In the case of context-free lan ua es this characterization coincides with the characterization iven by Gruska [7].
Alg
1
Introduction and Basic Results
In 1971, Gruska [7] characterized context-free lan ua es by certain expressions that are similar to re ular expressions. Let 1 be an in nite alphabet. Let L be a formal lan ua e over , L P( 1 ) by hL 1 , and x 1 . De ne the morphism hx : 1 x (x) = L, L 0 0 0 L ) P( 1 ). hx (x ) = x , x = x, and extend it to a substitution hx : P( 1 x x1 ; x j+1 L x xj = hx (L), L = hx (L), j 1, and L = j1 L . We De ne L ) equationally closed i E is a semirin closed call a set of lan ua es E P( 1 x E. under the followin operation: if L E and x 1 then L Gruska [7] proved that the set of context-free lan ua es over , 1, coincides with the least equationally closed semirin containin the nite lanua es. Consider the lan ua e equation x = L and its approximation sequence ( j )j0 (see Autebert, Berstel, Boasson [1] and Kuich [10]). Then we have 0 = , 1 = h;x (L), j+1 = hx (L), j 1. Hence, j = Lx j , j 1, and x L is the least solution of x = L. Denote the least solution (i. e., the least x ) is equationally point) of x = L by x L. Then a set of lan ua es E P( 1 closed i it is a semirin closed under least solutions x L of lan ua e equations x = L, where L E and x 1 . It is this formulation of Gruska’s result which we will eneralize in our paper. Earlier, in 1968, a similar theorem on reco nizable trees was proved by Thatcher and Wri ht [15] and, via the yield of trees, was projected to the contextfree lan ua es. (See Gecse , Steinby [5], Example 14.9.) Bozapalidis [3] extended the characterization of reco nizable trees to rational formal power series on trees ?
¨ Supported by Stiftun Aktion Osterreich-Un arn
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 512 521, 1998. c Sprin er-Verla Berlin Heidelber 1998
Gau ian Elimination and a Characterization of Al ebraic Power Series
513
and projected it via the yield to al ebraic power series (see Bozapalidis [3], Sections 5 and 6). We ive a complete and direct proof of Bozapalidis’ result on al ebraic power series in Section 2 and eneralize it in Section 3. We put Gau ian elimination into the center of our consideration and prove by it characterizations of context-free lan ua es, al ebraic power series and alebraic elements of continuous semirin s. Here Gau ian elimination means the step-by-step elimination of variables (or sets of variables) in the process of solvin al ebraic systems of equations (see Autebert, Berstel, Boasson [1], Theorem 2.4). It is assumed that the reader is familiar with the basics of semirin theory. Notions and notations that are not de ned are taken from Kuich [10]. In the sequel, A will always be a continuous semirin . This is a complete and naturally ordered semirin such that, for all index sets I and all families (a i I) the followin condition is satis ed: a = sup 2I
a
E
I E nite
2E
Here sup denotes the least upper bound with respect to the natural order (see Goldstern [6], Sakarovitch [13], and Karner [8]). A subsemirin A of A is called rationally closed i for all a A, we have A. By de nition, Rat(A0 ) is the smallest rationally closed suba := 0 a semirin of A containin A0 A. Furthermore, the collection of the components of the least solutions of all A0 -al ebraic systems, where A0 is a xed subset of A, is denoted by Alg(A0 ). Here, an A0 -al ebraic system is a system of formal pn are semirin -polynomials in the equations y = p , 1 i n, where p1 yn ) with coe cients in A0 . polynomial semirin over A (with variables y1 See also Lausch, N¨obauer [12], Chapter 1, 4.) In case the basic semirin is the semirin of formal power series A ( Y ) , yn are where A is a commutative continuous semirin and and Y = y1 disjoint alphabets, we consider al ebraic systems. Here an al ebraic system is a pn are polynomials system of formal equations y = p , 1 i n, where p1 in A ( Y ) . The collection of the components of the least solutions of all = Alg( aw a al ebraic systems as de ned above is denoted by Aal ). A w We need a more eneral framework for our considerations. In the sequel, A will denote a continuous semirin , 1 an in nite alphabet, and 1 a ( nite) alphabet. Additionally, in the remainder of this section, A will be commutative. A 1 be a monoid morphism. Extend it in the usual manner Let h : 1 A 1 by h(r) = (r )h( ), to a semirin morphism h : A 1 2 r A 1 . Our rst result is that h is a complete morphism, i. e., h( 2I r ) = A 1 , i I, and all index sets I. 2I h(r ) for all r Theorem 1 Let h : 1 semirin morphism h : A
A
1
1
A
be a monoid morphism. Then the extended 1 is a complete morphism.
514
Werner Kuich
Proof. We obtain h(
2I
h(
2 2I
r ) = h( (
2I
2I (r
(r
2
Corollary 2 Let h : 1 semirin morphism h : A
(r
2
)) ) =
1
A
A
2I (r
2
)h( ) =
1
) )=
2I
)h( ) =
h(r )
2
be a monoid morphism. Then the extended 1 is an -continuous mappin .
is continuous, each -chain has the form ( 0 n r n Proof. Since A 1 N ), r A 1 , i N , and its least upper bound is 2N r . The equality 2 h( 2N r ) = 2N h(r ) is now implied by Theorem 1. We use the followin notation: If r A 1 , and y1 yn 1 are dis yn ). If h : 1 A 1 is a morphism tin uished variables, we write r(y1 yn , then we write for h(r(y1 yn )) simsuch that h(x) = x, x 1 − y1 h(yn )). Hence, r(y1 yn ) induces a mappin from (A 1 )n ply r(h(y1 ) into A 1 whose value at 1 n is iven by r( 1 n ). By Corollary 2, this mappin is -continuous. yn A system (of equations) with variables y1 1 is iven by
y = r (y1 Let (A
1 1
= 1 − y1 )n such that
yn )
1
i
n
r
A
1
yn . A solution to this system is iven by ( =r(
n)
1
1
i
1
n)
n
, 1 i n, for all A solution ( 1 n ) is termed least solution i yn ), solutions ( 1 n ). Hence, the least solution of the system y = r (y1 rn ) : 1 i n, is nothin else than the least xpoint of the mappin (r1 )n (A 1 )n de ned by (r1 rn )( 1 (A 1 n ) = (r1 ( 1 n) )). Since this mappin is -continuous, we can apply the Fixrn ( 1 n point Theorem (see Wechler [16]) to achieve our next result. We use a vectorial notation in Theorem 3. )n , be a system of equations, where y = Theorem Let y = r, r (A 1 yn ) and r = (r1 rn ). Then the least solution of y = r(y) exists in (y1 )n , 1 = 1 − y1 yn , and equals (A 1
sup(r (0) i
N)
where r is the i-th iterate of the mappin r. Theorem 3 indicates how we can compute an approximation to the least solution of a system of equations y = r. The approximation sequence ( j )j0 , j )n , j 0, associated to y = r(y) is de ned as follows: (A 1 0
=0
j+1
= r(
j
)
j
0
Gau ian Elimination and a Characterization of Al ebraic Power Series
515
Clearly, ( j j N ) is an -chain and its least upper bound sup( j j N ) is the least solution of y = r. The followin method for the resolution of al ebraic systems is called Gau ian elimination by Autebert, Berstel, Boasson [1], Theorem 2.4. In the case of commutative continuous semirin s it was used by Kuich [9], Theorem 4.9. Bekic [2] has proved a more eneral result. For a full treatment of least xpoint and least pre- xpoint solutions see Thorem 6.1 of Esik [4]. yn and z1 zm of variables and Consider disjoint alphabets y1 yn z 1 zm . Let p (z1 zm y1 yn ), 1 i let 1 = 1 − y1 zm y1 yn ), 1 j m, be power series in A 1 and n, and qj (z1 consider the system of equations zj = pj (z1 y = q (z1
zm y1 zm y1
yn ) yn )
j i
1 1
m n
zm ) tn (z1 zm )) (A ( 1 z1 zm ) )n and Let (t1 (z1 rm ) (A 1 )n be the least solutions of the systems y = q (z1 zm (r1 yn ), 1 i n, and zj = pj (z1 zm t1 (z1 zm ) tn (z1 zm )), y1 rm t1 (r1 rm ) tn (r1 rm )) is 1 j m, respectively. Then (r1 the least solution of the ori inal system. zm ), In the next theorem and its proof, we use a vectorial notation: z = (z1 yn ), p = (p1 pm ), q = (q1 qn ), etc. y = (y1 Theorem 4 (Bekic [2]) Consider the system of equations z = p(z y)
y = q(z y)
Let t(z) and r be the least solutions of the systems y = q(z y) and z = p(z t(z)), respectively. Then (r t(r)) is the least solution of the system z = p(z y), y = q(z y). Moreover, r is the least solution of the system z = p(z t(r)).
2
Al ebraic Expressions for Al ebraic Power Series
In this section, A denotes a commutative continuous semirin . We introduce the y yn ) A 1 , where y1 y yn followin notation: Let r(y1 are variables. We denote the least A ( 1 − y ) such that r(y1 y yn ), 1 i n. This means that is the least yn ) = by y r(y1 y yn ) and y is a xpoint operator. xpoint of the equation y = r(y1 y yn ) A ( 1 − y ) . Observe that y r(y1 yn y) A 1 and Lemma 5 Let r(y1 yn ) = y r(y1 yn y). Then Let s(y1
s(
1
n)
= y r(
1
A (
n
y)
1−
y ) , 1
i
n.
516
Werner Kuich
Proof. Let ( j (y1 yn ))j0 be the approximation sequence of y = r(y1 yn )) is the approximation sequence of y = r( y). Then ( j ( 1 n j0 1 n y). j y) = sup( ( ) j N) = By Corollary 2, we infer that y r( 1 n 1 n ). 2 s( 1 n A subsemirin A of A 1 is called equationally closed i , for all r A and y 1 the power series y r is a ain in A. = r A nite and Aal = r Let A 1 1 1 al nite . Denote by A the least equationally closed A 1 1 . We will show in this section that A = semirin containin A 1 1 . Aal 1 yn ),
Theorem 6 Let t(y1 A 1 .
A
j
1
,1
j
n. Then t(
1
n)
Proof. The proof is by induction on the number of applications of the operations yn ). +, and to enerate t(y1 yn ) A 1 , i. e., t(y1 yn ) A for some (i) Let t(y1 1. Since t( 1 n ) is enerated from 1 n by applications of sum, product A and scalar product, we infer that t( 1 n) 1 . A (ii) We only prove the case of the operator . Let 1 n 1 for some and choose a y y1 yn . Without A 1 that is not in yn ) = y r(y1 yn y) (the variable y loss of enerality assume that t(y1 yn y) A is bound ), where r(y1 1 . By induction hypothesis, we A obtain r( 1 n y) n ) = y r( 1 n y) 1 . Hence, t( 1 A by Lemma 5. 2 1 Theorem 7 Aal
1
A
1
.
Proof. The proof is by induction on the number of variables of al ebraic systems. n 1, is the We use the followin induction hypothesis: If (Aal 1 ) , n yn ), 1 i n, with n least solution of an al ebraic system y = q (y1 yn where q A 1 , then A variables y1 1 . (1) Let n = 1 and assume that r is the least solution of the al ebraic system z = p(z). Then r = z p(z) A 1 . yn be variables and p q1 qn be polynomials in A 1 , (2) Let z y1 yn ) and consider the al ebraic system z = p(z y), y = q(z y), where y = (y1 n qn ). Let t(z) (Aal and q = (q1 1 ) be the least solution of y = n q(z y). By our induction hypothesis we obtain t(z) (A 1 ) . Since p(z y) is a polynomial, it is in A 1 . Hence, by Theorem 6, p(z t(z)) is in A 1 . This implies z p(z t(z)) A 1 . A ain, by Theorem 6, t( z p(z t(z)) n ) ). By Theorem 4, ( z p(z t(z)) t( z p(z t(z)))) is the least solution (A 1 of the al ebraic system z = p(z y), y = q(z y). Hence the components of the 2 least solution of this al ebraic system are in A 1 . We now show the converse to Theorem 7.
Gau ian Elimination and a Characterization of Al ebraic Power Series
Theorem 8 A
1
Aal
1
517
.
is an equationally closed semirin that conProof. We show that Aal 1 tains A 1 . Easy constructions (see Theorem 3.11 of Kuich [10]) show that is a semirin containin A 1 . Hence we have only to show that Aal 1 al al and z z r, r A 1 , is in A 1 1 . al be the rst component of the least solution of the alLet r A 1 yn z), 1 i n. Then, by Theorem 4, z r ebraic system y = p (y1 is the z-component of the least solution of the al ebraic system z = y1 , y = yn z), 1 i n. 2 p (y1 We have now achieved the main result of this section. Theorem 9 A 1 nite. 1,
= Aal
1
1
and A
A
= Aal
,
Analo ous to the re ular expressions (see Salomaa [14]) and similar to the context-free expressions of Gruska [7], we de ne al ebraic expressions. [ ] are mutually disjoint. A word E Assume that 1 , A and U = + i over 1 A U is an al ebraic expression over A 1 (i) E is a symbol of A, or (ii) E is a symbol of 1 , or else (iii) E is of one of the forms [E1 + E2 ], [E1 E2 ], or y E1 , where E1 and E2 are al ebraic expressions and y is a symbol of 1 . denotes a formal power series E in Each al ebraic expression E over A 1 accordin to the followin conventions: A 1 . (i) The power series denoted by a A is a in A 1 (ii) The power series denoted by x 1 is x in A 1 . and y (iii) For al ebraic expressions E1 E2 over A 1 E1 + E2 , [E1 E2 ] = E1 E2 , y E1 = y E1 .
1,
Let be the mappin from the set of al ebraic expressions over A nite sets of P( 1 ) de ned by (i) (ii) (iii)
(a) = , a A. (x) = x , x 1. ([E1 + E2 ]) = ([E1 E2 ]) = (E1 ) al ebraic expressions E1 E2 and y
[E1 + E2 ] = 1
into the
(E2 ), ( y E1 ) = (E1 ) − y , for 1.
Given an al ebraic expression E, (E) contains the free symbols of E. This means that E is a formal power series in A (E) . Theorem 9 and the above de nitions yield some corollaries. Corollary 10 A power series r is in Aal such that r = E . expression E over A 1
1
i
there exists an al ebraic
i there exists an al ebraic Corollary 11 A power series r is in Aal , such that r = E . expression E over A 1 , where (E)
518
Werner Kuich
Observe that B is isomorphic to the semirin L( 1 ) = L L 1 of formal lan ua es over . Hence, if A = B then each al ebraic express1 1 denotes by this isomorphism a formal lan ua e in L( 1 ) sion E over B 1 accordin to the followin conventions:
(i) The lan ua e denoted by 0 or 1 is or , respectively. is x . (ii) The lan ua e denoted by x 1 and y (iii) For al ebraic expressions E1 E2 over B 1 1 , [E1 + E2 ] = E2 , [E1 E2 ] = E1 E2 , y E1 = E1 y . E1 Corollary 12 (Gruska [7]) A formal lan ua e L in L( 1 ) is context-free i such that L = E . there exists an al ebraic expression E over B 1 Corollary 1 A formal lan ua e L over is context-free i there exists an , where (E) = , such that L = E . al ebraic expression E over B 1
3
Al ebraic Expressions for Al ebraic Elements
In this section A will denote a continuous semirin (not necessarily commutative) yn will denote a countably in nite set of variables and Y = y y1 y2 disjoint with A. Consider the continuous semirin N 1 A and let a A. The polynomial p N 1 A de ned by (p a) = 1, (p w) = 0 for all w A − a , A be the monoid morphism de ned by will be denoted by a. Let : A (a) = a, a A. Then, by Goldstern [6], extends uniquely to a complete A de ned by (r) = w2A (r w) (w) for semirin morphism : N 1 A yn ) N 1 (A y1 yn ) induces a mappin r N 1 A . Each r(y1 1 n 1 A ) N A as follows. Let h : (A y1 yn ) N 1 A r : (N 1 N A , 1 be a monoid morphism de ned by h(a) = a, a A, h(y ) = s i n. Then h extends uniquely to a complete semirin morphism h : N 1 (A yn ) N 1 A de ned by h(r) = )h( ). y1 2(A[fy1 yn g) (r sn ) is de ned to be h(r), i. e., r(s1 sn ) = h(r). Now the value of r at (s1 Consider now a system with one equation y = r(y1
yn y)
N1
r
(A
yn y )
y1
y1 yn y ) is deIts least solution (i. e., its least xpoint) in N 1 (A yn y). noted by y r(y1 By Lausch, N¨obauer [12] (see also Kuich [10], Section 3) each semirin -polyyn ) over the semirin A has a nomial in the polynomial semirin A( y1 representation as a nite sum of product terms, where a product term has the y n ) = a0 y 1 a1 ak−1 y k ak , aj A, 1 i1 ik n, i. e., a form t(y1 semirin -polynomial p has a representation p(y1
yn ) =
tj (y1 1jm
where tj is a product term, 1
j
m.
yn )
Gau ian Elimination and a Characterization of Al ebraic Power Series
519
A product term t(y1 yn ) as above induces the mappin t : An A sn ) = a0 s 1 a1 ak−1 s k ak for all s1 sn A. A semirin de ned by t(s1 yn ) represented as above induces the mappin p : An A polynomial p(y1 sn ) = 1jm tj (s1 sn ) for all s1 sn A. de ned by p(s1 Lemma 14 Let p such that p( (s1 )
yn ). Then there exists p N (A y1 yn ) A( y1 1 (sn )) = (p(s1 sn )) for all s1 sn N A .
y n ) = a0 y 1 a1 ak−1 y k ak , aj A, is a product term, de ne Proof. If t(y1 y n ) = a0 y 1 a1 ak−1 y k ak . If the semirin -polynomial p(y1 yn ) t(y1 yn ) = 1jm tj (y1 yn ), where tj (y1 yn ), has a representation p(y1 yn ) = 1jm tj (y1 yn ). But 1 j m, is a product term, de ne p(y1 yn ) depends on the representation choosen observe that the de nition of p(y1 yn ), while the mappin induced by p(y1 yn ) does not depend for p(y1 yn ). Let now s1 sn N 1 A . on the representation choosen for p(y1 (sn )) = a0 (s 1 )a1 ak−1 (s k )ak , t(s1 sn ) = Then t( (s1 ) ak−1 s k ak and (t(s1 sn )) = a0 (s 1 )a1 ak−1 (s k )ak . Hence, a 0 s 1 a1 (sn )) = (t(s1 sn )). Moreover, t( (s1 ) p( (s1 ) p(s1 (p(s1
(sn )) = sn ) =
1jm tj (
1jm
(tj (s1
(sn )) = (p(s1 sn )). Hence, p( (s1 ) We are now ready for the characterization of Theorem 15 Let A0
A. Then
(sn ))
sn ) and
1jm tj (s1
sn )) =
(s1 )
Alg(A0 ) =
sn ))
Alg(A0 ), A0
A.
N 1 al
A
(r) r
2 .
Proof. Consider an A0 -al ebraic system y = p (y1 with least solution system y = p (y1
yn )
p
A0 ( y1
yn )
Alg(A0 )n . Construct accordin yn )
p
N 1 (A0
y1
1
i
n
to Lemma 14 the al ebraic yn )
1
i
n
sn N 1 A , p( (s1 ) (sn )) = (p(s1 sn )). Let where, for all s1 1 al 0 n A ) be the least solution of the al ebraic system y = p , (N 1 i n. Let ( j )j0 and ( j )j0 be the approximation sequences of the systems y = p and y = p , 1 i n, respectively. We claim that j = ( j ), j 0, and show it by induction on j. We obtain 0 = 0 = (0) = ( 0 ) and, for j 0, j+1 = p( j ) = p( ( j )) = (p( j )) = ( j+1 ). Here the second equality follows by the induction hypothesis and the third equality by Lemma 14. Since is an -continuous mappin , we infer that = ( ). Hence, for each a Alg(A0 ) there exists an r N 1 al A0 and vice versa 2 such that a = (r).
520
Werner Kuich
We now restate our de nitions of Section 2 to achieve a characterization of ebraic expressions. Let A0 A and let U be de ned as in Section 2. A word E over A0 Y U is an al ebraic expression over N 1 (A0 Y ) i
Alg(A0 ) by al
(i) E is a symbol of N 1 , or (ii) E is a symbol of A0 Y , or else (iii) E is of one of the forms [E1 + E2 ], [E1 E2 ] or y E1 , where E1 and E2 are al ebraic expressions and y is a symbol of Y . denotes a formal power series E in Each al ebraic expression E over A 1 1 0 N (A Y ) accordin to the followin conventions:
(i) The power series denoted by n N 1 is n in N 1 (A0 Y ) . (ii) The power series denoted by a A0 or y Y is a N 1 (A0 Y ) or y N 1 (A0 Y ) , respectively. (iii) For al ebraic expressions E1 E2 over N 1 (A0 Y ) and y Y we set [E1 + E2 ] = E1 + E2 , [E1 E2 ] = E1 E2 , y E1 = y E1 . Let be the mappin from the set of al ebraic expressions over N 1 (A0 into the nite sets of P(Y ) de ned by: (i) (ii) (iii)
Y )
(n) = for each n N 1 . (a) = for each a A0 ; (y) = y for each y Y . (E2 ), ( y E1 ) = (E1 ) − y for ([E1 + E2 ]) = ([E1 E2 ]) = (E1 ) al ebraic expressions E1 E2 and y 1.
Theorem 15 and the above de nitions yield the followin corollary. A. An element a A is in Alg(A0 ) i there exists Corollary 16 Let A0 an al ebraic expression E over N 1 (A0 Y ) , where (E) = , such that a = ( E ).
References 1. Autebert, J.-M., Berstel, J., Boasson, L.: Context-free lan ua es and pushdown automata. In: Handbook of Formal Lan ua es (Eds.: G. Rozenber and A. Salomaa), Sprin er, 1997, Vol. 1, Chapter 3, 111 174. 2. Bekic, H.: De nable operations in eneral al ebras, and the theory of automata and flowcharts. Tech. Report, IBM Labor, Wien, 1967. 3. Bozapalidis, S.: Equational elements in additive al ebras. Technical Report, Aristotle University of Thessaloniki, 1997. 4. Esik, Z.: Completeness of Park induction. Theor. Comput. Sci. 177(1997) 217 283. 5. Gecse , F., Steinby, M.: Tree Lan ua es. In: Handbook of Formal Lan ua es (Eds.: G. Rozenber and A. Salomaa), Sprin er, 1997, Vol. 3, Chapter 1, 1 68. 6. Goldstern, M.: Vervollst¨ andi un von Halbrin en. Diplomarbeit, Technische Universit¨ at Wien, 1985.
Gau ian Elimination and a Characterization of Al ebraic Power Series
521
7. Gruska, J.: A characterization of context-free lan ua es. Journal of Computer and System Sciences 5(1971) 353 364. 8. Karner, G.: On limits in complete semirin s. Semi roup Forum 45(1992) 148 165. 9. Kuich, W.: The Kleene and the Parikh theorem in complete semirin s. ICALP87, Lect. Notes Comput. Sci. 267(1987) 212 225. 10. Kuich, W.: Semirin s and formal power series: Their relevance to formal lan ua es and automata theory. In: Handbook of Formal Lan ua es (Eds.: G. Rozenber and A. Salomaa), Sprin er, 1997, Vol. 1, Chapter 9, 609 677. 11. Kuich, W., Salomaa, A.: Semirin s, Automata, Lan ua es. EATCS Mono raphs on Theoretical Computer Science, Vol. 5. Sprin er, 1986. 12. Lausch, H., N¨ obauer, W.: Al ebra of Polynomials. North-Holland, 1973. 13. Sakarovitch, J.: Kleene’s theorem revisited. Lect. Notes Comput. Sci. 281(1987) 39 50. 14. Salomaa, A.: Formal Lan ua es. Academic Press, 1973. 15. Thatcher, J. W., Wri ht, J. B.: Generalized nite automata theory with an application to a decision problem of second-order lo ic. Math. Systems Theory 2(1968) 57 81. 16. Wechler, W.: Universal Al ebra for Computer Scientists. EATCS Mono raphs on Computer Science, Vol. 25. Sprin er, 1992.
D0L-Systems and Surface Automorphisms Luis-Mi uel Lopez1 and Philippe Narbel2 1 2
IGM, Univ. Marne-La-Vallee. 2, Butte Verte, 93166 Noisy-le-Grand, France lopez@un v-mlv.fr LABRI, Univ. Bordeaux I. 351, Cours de la Liberation 33405 Talence, France narbel@labr .u-bordeaux.fr
Abstract. We introduce a new relationship between formal lan ua e theory and surface theory. More speci cally, we show how substitutions on words can represent automorphisms of surfaces. This correspondance is applied to construct and analyze non-periodic irreducible automorphisms. We use results about D0L-systems, mainly the decidability of the non-repetitiveness of a D0L-lan ua e.
1
Introduction
This paper shows how results in formal lan ua e theory, speci cally iterated substitutions, can be used to solve a problem in surface theory. Its rst main point is to introduce how substitutions on words can represent surfaces automorphisms, i.e. bijective bicontinuous maps of a surface onto itself. Iteratin an automorphism conju ates then to iteratin a substitution [10], and automorphisms can be studied in the scope of substitutions and D0L-systems theory [20]. This approach is applied here to the classi cation of the automorphisms of compact oriented surfaces, which are known for a lon time to be either periodic, or reducible, or non-periodic irreducible [16]. Since, this classi cation into three families has been made more precise [7, 13, 8, 4, 22]. In particular non-periodic irreducible automorphisms have the strikin property to setwise x two closed sets of in nite pairwise disjoint simple curves. They are di cult to obtain, and much e ort has been dedicated to ndin systematic constructions [1, 18, 22, 4, 17, 11, 21]; in [22] Thurston indicated one and Penner eneralized it in [18]. Nevertheless the proofs rely on intricate eometric manipulations of raphs, and do not lead to an e ective description of the stable set of curves. By usin D0L-systems results [5, 6, 19, 14, 15], we obtain a simpler and constructive proof. Thurston’s method uses two mutually transverse sets of simple closed curves C D on a surface , to which is associated a basis of simple automorphisms, the so-called Dehn twists. Penner’s eneralization states that any positive composition involvin each of these twists at least once is non-periodic and irreducible. This is the result we prove here. The rst step we take is to make such a system of curves C D an oriented labelled raph Γ . This raph can be proved invariant under an associated set of twists, i.e. the twists can be interpreted as raph maps [2]. Next, curves on the surface are associated by homotopy to admissible paths of Γ , and can be coded into words by concatenatin the visited Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 522 532, 1998. c Sprin er-Verla Berlin Heidelber 1998
D0L-Systems and Surface Automorphisms
523
ed es labels. Applyin a twist is then the same as applyin the correspondin raph map which is the same as applyin the correspondin substitution to the codin words. Iteration of a composition of twists h corresponds to iteration of the correspondin substitution . Hence, the xed point set obtained by in nite iterations of h can be studied throu h the xed point set of , i.e. its boundary lan ua e [3, 15]. Now, decidin irreducibility of h is the same as decidin whether the boundary of does not contain periodic words. This can be solved by decidin non-repetitiveness for the D0L-lan ua e correspondin to [6] (see also [9]). Since the boundary of is constructive [15], we also obtain a constructive representation of the sets of curves xed by the constructed non-periodic irreducible automorphisms. The main technical steps of the proof are the followin : First, we must obtain substitutions, i.e. endomorphisms over free monoids. Hence, relations amon the codin words are dealt with by a recodin , such that the correspondin monoid becomes free. Second, the properties required to apply [6] are proved for the whole set of the considered substitutions, i.e. primitivity, elementarity [5], stron ly closedness, and non-cyclicity [6]. All the missin proofs will appear in a full version of this article.
2
Automorphisms as Substitutions
An admissible path in an oriented raph Γ is an oriented ed e-path, i.e. an oriented indexin map from an interval of Z towards the set of ed es of Γ . Accordin to if the interval is nite, half-in nite or all of Z, the path is respectively said to be nite, one-way in nite or two-way in nite. A path is said to be closed if it can be de ned by a two-way in nite periodic indexin map. Let Γ be embedded in a surface . A simple curve on , i.e. a non-crossin curve, which is homotopic, i.e. which can be continuously deformed, to an admissible path in Γ is said to be carried by Γ (for a nite curve, this deformation must take place with endpoints xed). Such a carried curve is called a leaf. In Fi ure 22(ii) is pictured a deformation of a leaf (normal style) to an admissible is a maximal path of a raph (dashed style). A lamination carried by Γ on set of pairwise non-homotopic, pairwise disjoint two-way in nite carried leaves. Assi nin a distinct label to every ed e of Γ ives the ed e alphabet A of Γ . The codin of a path is the word obtained by concatenatin its ed es’ labels accordin to its indexin map. Hence, to each leaf carried by Γ corresponds a word. If this word is unique, we say that Γ ives a well-de ned codin over the ed e alphabet. If Γ contains homotopic distinct ed e-paths this is no more true. So more enerally, a codin is said to be well-de ned if 1) there is a set of nite admissible paths in Γ , called the codin paths, 2) a path alphabet B with one label for each codin path, and 3) a codin rule such that every leaf carried by Γ has a unique codin over B. In the sequel, to save notation, the same symbol denotes a codin path and its correspondin label. Y where X Y A homeomorphism is a bijective bicontinuous map X are two topolo ical spaces. When X = Y , it is called an automorphism. An
524
Luis-Mi uel Lopez and Philippe Narbel
automorphism h of a surface is called periodic when there is n > 0 such that hn is homotopic to the identity. It is called reducible when it xes a nite set of pairwise disjoint simple closed curves. Non-periodic irreducible automorphisms have been proved to be pseudo-Anosov, i.e. they setwise x two laminations L1 and L2 (see [7, 13, 8, 4, 22]). Puttin a transverse measure on each of them, such an automorphism is respectively expandin on L1 and shrinkin on L2 by factors inverse of each other. A Dehn twist is a basic automorphism non homotopic to the identity: Consider a simple closed curve c on an oriented surface, such that c is homotopically non-zero, i.e. cannot be continuously deformed into a sin le point; next, cut o the surface alon c, and apply one (or more) turn(s) to one of the separated parts; nally paste back alon c. Fi ure 21 shows a cylinder-like piece of a surface where one can observe the local e ect of a twist alon c (bold style) on a transverse leaf (normal style) intersectin at p. Applyin the twist dra s the leaf alon c from p (left part of the ure).
x
Fig. 21
c
y
c
p
More formally, this map applies to a parametrized annulus (r e ) r 2
[r0 r1 ]
r−r0 1 −r0
nr
[0 2 ) and is homotopic to fn : (r e ) (r e e ) 0 < r0 < r1 for some n Z. Accordin to n’s si n, the twist is said positive or ne ative. The annulus can be described as a nei hborhood of the above homotopically non-zero simple closed curve c. In this case we say that a Dehn twist has been de ned alon c. This is well-de ned since fn ’s restriction to the boundary is the identity, and di erent annuli nei hbourhoods yield homotopic maps. Thus when performin a Dehn twist on a surface alon a curve, we always suppose that its nei hbourhood has been xed. An oriented raph map between two oriented raphs Γ to Γ 0 is a map which sends vertices of Γ to vertices of Γ 0 , and oriented ed es of Γ to oriented paths of Γ 0 . If Γ and Γ 0 are embedded oriented raphs in , an automorphism h of sends Γ to Γ 0 if h induces an oriented raph map up to homotopy rel. endpoints. If Γ 0 = Γ , we say that Γ is invariant under h. Note that if Γ is an invariant raph, then every leaf carried by Γ has its ima e by h still carried by Γ . As an instance, Fi ure 22(i) shows a cylinder-like piece of surface where a twist alon c intersects at p a sin le leaf (normal style) carried by Γ (dashed style). Applyin the twist results in Fi ure 22(ii) showin that the leaf is still carried by Γ .
D0L-Systems and Surface Automorphisms
c
Fig. 22
y
525
x
x y
p
(i)
(ii)
Given an alphabet A, a substitution over A is a transformation which sends any letter a of A to some word over A, and which is extended to any word A by sendin it to (w ) (w +1 ) . If nite words w = w w +1 with w are considered, a substitution is an endomorphism on the free monoid A and if some word to apply the substitution is speci ed, one speaks of a D0L-system. In what follows we denote by cod the codin map from leaves to words. Lemm 21 Suppose there is a well-de ned codin on Γ . Let Γ be invariant under h. Then h induces a unique substitution h . Proof. Let h be the raph map induced by h; take the codin paths, calculate their ima es by h and rewrite the result into the path alphabet: this is a substitution associated to h. Well-de nedness of cod implies uniqueness. } For instance, assumin that the ed e alphabet is on use in Fi ure 22 where the twist alon c intersects the ed e labelled y, then the correspondin substitution is the one which sends y to xy leavin all the other letters xed. We say that h preserves the codin i cod h = h cod, i.e. application of h on a leaf codin ives the codin of the ima e leaf by h. Note that since the raph map induced by h preserves concatenation of oriented ed es, if the current alphabet is the ed e one, preservation of the codin trivially holds. If codin preservation holds only for a subset L of all the carried leaves we say that h preserves the codin on L. This latter condition is automatically realized in the followin case: let L be a set of leaves on which the codin is injective up to homotopy, and assume that up to homotopy too h(L) L, then h preserves the codin on L. Lemm 22 Suppose there is a well-de ned codin on Γ . Let H be the semi- roup of automorphisms leavin Γ invariant and preservin the codin . Then H is homomorphic to a semi- roup of substitutions. Proof. The sets of maps in the statement are clearly semi- roups. So we have cod (h h0 ) = hh cod. On the other hand cod h h0 = h cod h0 = h h cod because h and h0 preserve codin s. Hence, hh = h h . } If the codin is preserved only on a subset L of all the leaves, the above equalities hold on L. So the lemma remains true if we de ne H as the semi- roup of automorphisms leavin Γ invariant and L setwise xed up to homotopy.
Non-periodic Irreducible Automorphisms Construction Consider a closed oriented surface with ne ative Euler characteristic (i.e. there is a trian ulation of which raph has a ne ative Euler characteristic). Let C
526
Luis-Mi uel Lopez and Philippe Narbel
and D be two sets of pairwise non-parallel and disjoint oriented simple closed curves on and assume that each component of the complement of C D in is a disk (i.e. C D lls ) without bein a bi on (i.e. C hits D e ciently), and that the orientation iven by C and D at any point of C \ D a rees with that of . In Fi ure 31 we show such a system of curves C D (dashed style) on a two-holed torus. The set Γ = C D as a set of points can be considered as an oriented raph: its vertex set bein C \ D and its oriented ed es bein the se ments of C D between two vertices. Now, consider another copy of Γ = C D, denoted by T, in eneral position with respect to Γ sli htly under Γ ( under with respect to Γ ’s orientation). In Fi ure 32, we show T (bold style) relatively to the C D of Fi ure 31. c2
c1 d2
Fig. 31 d1
d3
c1
Fig. 32
c2 d2
d1 d3
We denote by H+ the semi- roup of automorphisms enerated by compositions of Dehn twists alon T, where each curve is involved at least once. The sequel is dedicated to prove the announced followin result due to Thurston [22], and to Penner [18] in its stren thened version: Theorem 31 Consider a system of curves C D as described above. Then each automorphism in H+ is non-periodic and irreducible (i.e. pseudo-Anosov). First, accordin to 21 and 22, the next result indicates that we are close to interpret the automorphisms of H+ as substitutions: Lemm 32 Γ is invariant under every h
H+ .
However, we also need a well-de ned codin . The codin over the ed e alphabet induces a well-de ned codin if carried leaves with di erent associated admissible paths are not pairwise homotopic. Nevertheless, the above construction of the raph Γ may lead to such cases. We show indeed in Fi ure 33 a case for a three-holed torus where a subset of a system C D (dashed style) enerates a square ( ray re ion) in its complement: clearly, carried leaves may be homotopic, thou h havin di erent associated admissible paths.
D0L-Systems and Surface Automorphisms
527
Fig. 33
The next lemma shows that one must deal only with such squares: Lemm 33 If there is no square amon the poly on components of ives a well-de ned codin over the ed e alphabet.
Γ then Γ
Hence, in view of Lemmas 21 to 33, if there is no square in Γ , the semi- roup of substitutions enerated by the twists alon T is the semi- roup of substitutions associated to H+ , henceforth denoted by H+ . As a full example let us revisit the two-holed torus and its system of curves C D = c1 c2 d1 d2 d3 iven in Fi ure 31. In Fi ure 34, the same surface is shown, but with the ed es of Γ (dashed style) labelled by an alphabet of 8 letters A = x1 y1 y2 s1 s2 t1 z1 z2 . Considerin the set of twists curves T iven in Fi ure 32, the associated substitutions over A are the followin ( γ denotes the substitution associated to the twist alon γ, and we indicate only the labels with non-trivial ima es): c1 (x1 )
= y1 y2 x1 t 1 s1 c1 (z1 ) = y2 y1 z1
Fig. 34
c2 (z2 )
= s2 s1 z 2
d2 (y2 )
= z1 z2 y2
c2 (t1 )
= s 1 s 2 t1
d2 (s2 )
= z 2 z 1 s2
d1 (y1 )
z2 x1
y2
d3 (s1 )
=
s1
z1
y1
= x1 y1
s2
t1
Let us deal now with the case where squares occur in Γ . Two squares in Γ are said to be in relation i they have a side in common. This is extended by transitivity to an equivalence relation, and a square-re ion is the subset of iven by the union of all the squares of a class. Note that no twist curve can lie in the interior of a square-re ion because there are no parallel curves in T. So each twist curve intersectin a square-re ion intersects its frontier. Accordin ly, we locate a set of enterin points and exitin points on the ed es of the frontiers. We push these points towards the end vertices of the ed es they lie on, and we obtain two sets of vertices En and Ex. For each square-re ion R, let PR be a set of representatives of the homotopy classes of admissible paths from En to Ex. For instance, Fi ure 35 shows a square-re ion R made of 6 squares ( ray re ion) (dashed style is used for Γ and bold style for the twists curves T). For
528
Luis-Mi uel Lopez and Philippe Narbel
this square-re ion, En = a d h i j and Ex = b c e f . Denotin by (x y) En, y Ex, then (i c), (a f ) are such an homotopy class in PR where x instances. We take the union of the PR ’s over all the square-re ions, and add to it the subset of the ed e alphabet formed by the ed es outside or on the frontier of the square-re ions provided they do not already belon to some PR . We denote by AH the alphabet obtained by assi nin a distinct label to each of these paths and ed es. Note however that a square-re ion does not need to be simply connected, i.e. not all its ed e-paths with common endpoints are necessarily pairwise homotopic. In this case, carried leaves may stay forever in a square-re ion. We say that an admissible path in Γ is in normal position if it does not run the boundary of any square alon the left ed e (necessarily upwards), then alon the top one (necessarily ri htwards). It is obvious that any admissible path can be put in normal position in a unique way.
h
g
f
e
i c
Fig. 35
d
b j a
Now, a codin rule on Γ can be de ned assumin that admissible paths are in normal position. Once a path is in this position we push it sli htly under Γ (for example on T). If the path does not meet the square-re ions then either it is contained in one of them and then is coded by the empty word, or it lies outside and then is coded over the ed e alphabet. If the path meets square-re ions it is followed from some vertex towards the positive direction, and points in En and Ex are successively marked as the path crosses frontier ed es. The same thin is done backwards from the chosen vertex. We pull the path marked in this way back to Γ . Now: 1) a subpath from a vertex of En to one of Ex is coded by its label in AH ; 2) a subpath from one in Ex to one in En is coded in the ed e-alphabet; 3) a subpath endin at a vertex in Ex or be innin at a vertex in En is coded by the empty word; 4) a subpath endin at En or be innin at Ex is coded in the ed e alphabet. Uniqueness of the normal position and of the codin paths labellin imply well-de nedness of the codin on Γ over AH . Note that this codin may be not injective. There may even exist in nite leaves with the empty word as codin word (when for instance square-re ions are not simply connected). However, the followin lemma ives injectivity for a subset of leaves
D0L-Systems and Surface Automorphisms
529
on which we shall later restrict the discussion. We denote by I the set of all the two-way in nite leaves carried by Γ : Lemm 34 The above codin is injective on the subset of I meetin the squarere ions alon nite se ments. Two problems remain to be solved in order to be able to apply Lemmas 21 and 22: preservation of the codin and the possible in nite cardinality of AH . A substitution over an alphabet A is said to be: - stron ly rowin if for every s A, len th( n (s)) with n N becomes arbitrarily lar e; - primitive if there exists a nite power K such that for all s A, alph( K (s)) = A, where alph(w) is the set of labels that occur in w; - stron ly closed if for all s A, alph( (s)) = A; - cyclic if there exists a cyclic permutation of the alphabet A, such that for i m − 1; and for each s A, (s) = s1 sm , then s +1 = (s ), with 1 each pair s t A such that (s) = t, then (last( (s))) = f irst( (t)), where f irst(w) extracts the rst label of w, and last(w) its last one; - simpli able if there exists an alphabet B, such that B < A , where denotes the cardinality, B and : B A such that = f . This amounts and substitutions f : A uk with k < A such that ’s ima e to say that there is a set of words u1 words can be rewritten in terms of the u ’s [5]; - elementary if it cannot be simpli ed; - repetitive if for each k > 1 there is a non-empty word u such that uk = uuu u is a subword of a word in L = n (s) s A n N ; - stron ly repetitive if there is a non-empty word u such that for each k > 1, uk = uuu u is a subword of a word in L . In the sequel, h denotes the substitution associated to the automorphism h. Lemm 35 Suppose there is a well-de ned codin on Γ over the ed e alphabet. Then every substitution h H+ is primitive. Lemm 36 Suppose Γ contains square-re ions and let h H+ . Then there is a nite path-alphabet Ah AH and some k > 0 such that, for all n k and every admissible path γ, the codin word cod(hn (γ)) only uses labels in Ah . Lemm 37 Let h, Γ and Ah be as iven in the above lemma. Then h preserves the codin over Ah on hjTj (I). Proof. This follows from the above lemma and from Lemma 34. } Hence similarly to the case with no square-re ions, and accordin to Lemmas 21 and 22, the semi- roup of substitutions over Ah enerated by the twists alon T, also denoted H+ , is homomorphic to H+ . Lemm 38 Let be a primitive substitution on a nite alphabet A. Then for every n > 0, is primitive on all the subwords of len th n of the words in L . Lemm 39 Let h, Γ and Ah be as iven in the above lemma. Then over an alphabet A0h Ah .
h
is primitive
530
Luis-Mi uel Lopez and Philippe Narbel
Lemm 310 Every
h
H+
over A0h can e ectively be made elementary.
Note that by Lemma 38, a simpli ed primitive substitution can be seen to be still primitive. Moreover Lemma 37 is still valid for the alphabet after simpli cation. In the sequel, every h is therefore considered elementary. Coroll ry 311 Every substitution
h
H+
is stron ly rowin .
Lemm 312 Suppose there is a well-de ned codin on Γ . Then every substitution in h H+ is non-cyclic. Lemm 313 Suppose there is a well-de ned codin on Γ . Then for every substi1 such that hm is not stron ly repetitive. tution h H+ , there is m Proof. Accordin to Lemmas 35 and 39, h is primitive over Ah . Hence the with s Ah is constant and equal to Ah sequence of alph( h (s)) alph( h2 (s)) from some power m 1. Hence, hm is stron ly closed. Since hm H+ , it is also non-cyclic and elementary. Accordin to the main theorem in ([6], Section 6), any such substitution is non repetitive and therefore non stron ly repetitive. } n c associated to L = (s) s A n N is The pointed lan ua e L obtained by ivin every possible ori in to each of its words and indexin its letters accordin ly. Finite words are assumed padded to both in nities with c is a subset of (A )Z, and inherit the some dummy symbol , so that L c , called in short boundary of , is a topolo y of this set. The boundary of L set of one-way and two-way in nite words if is stron ly rowin (see [15]). Considerin only the two-way in nite words, we identify to ether all the words that are equal up to a translation of indexes in Z, i.e. up to applyin a shift. The resultin set of words is denoted by L . Now, recall that a lamination on is a maximal set of pairwise non-homotopic, pairwise disjoint two-way in nite carried leaves:
Lemm 314 There is a lamination
h
associated to L h .
We are now in position to prove Theorem 31: Accordin to Lemma 37, h preserves the codin and L h is by construction setwise xed by h . Thus h is setwise xed by h up to homotopy. Moreover, since for every m 1, the same set of subwords appears in L and L m , the boundary of is equal to the boundary of m . So h is homotopic to hm . Now h contains no compact leaf. Indeed, closed ones correspond to periodic words in L h and accordin to Lemma 313 there are none: if there is a periodic word uuuu in L h , for every n > 1, un must appear in some word of L h , i.e. h should be stron ly repetitive. Hence every leaf is dense in h . So Γ can be naturally measured thanks to the er odic theorem [12]: for a eneric two-way in nite leaf the limit of the avera e number of occurences of any letter in any subword conver es as the len th of the subword oes to in nity, and the measure at each ed e is the limit of its correspondin label. The e ect of h on h is expandin on the measure since h
D0L-Systems and Surface Automorphisms
531
is stron ly rowin . Now consider another raph Γ 0 obtained like Γ , but with reversed orientations of the curves in C D. Similarily, Γ 0 is invariant under h−1 . We denote by B its ed e alphabet, by Bh−1 its path alphabet, by L −1 and h−1 the lan ua e and the xed lamination correspondin to h−1 . However, no more substitution is associated to h actin on h−1 but instead a transformation which inverts the substitution h−1 (see [19, 14, 15]) by slicin the words belon in to L −1 into subwords in h−1 (s) s Bh−1 , and by replacin these occurences by the labels s. Existence and uniqueness of such a slicin for two-way in nite words enerated by a non stron ly repetitive and injective substitution on the letters is proved in [14]. Now since elementarity implies injectivity (see [5]), h−1 has all the required properties: its inverse h−1 −1 is well-de ned on L −1 . Hence, by construction, h−1 is also xed by h, and h is shrinkin on the transverse measure associated to L −1 : subwords len ths are shrunk by a coe cient inverse of the expandin one. That h and h−1 are transverse is immediate. }
References [1] P. Arnoux and JC. Yoccoz. Construction de di eomorphismes pseudo-Anosov. C.R. Acad. Sci., Paris, Ser. I, 292:75 78, 1981. [2] M. Bestvina and M. Handel. Train-tracks for surface homeomorphisms. Topolo y, 34(1):109 140, 1995. [3] L. Boasson and N. Nivat. Adherence of lan ua es. J. Comp. Syst. Sc., 20:285 309, 1980. [4] A.J. Casson and S. Bleiler. Automorphisms of Surfaces after Nielsen and Thurston. Number 9 in Student Text. London Mathematical Society, 1988. [5] A. Ehrenfeucht and G. Rozenber . Simpli cations of homomorphisms. Information and Control, 38:298 309, 1978. [6] A. Ehrenfeucht and G. Rozenber . Repetitions of subwords in D0L lan ua es. Information and Control, 59:13 35, 1983. [7] A. Fathi, F. Laudenbach, and V. Poenaru, editors. Travaux de Thurston sur les surfaces. Soc. Math. de France, 1979. Asterisque, Volume 66-67. [8] M. Handel and W. P. Thurston. New proofs of some results of Nielsen. Adv. in Math., 56:173 191, 1985. [9] Y. Kobayashi and Otto F. Repetitiveness of D0L lan ua es is decidable in polynomial time. In Proceedin s of MFCS’97, Slovakia, pa es 337 346. Sprin er Verla , 1997. Lecture Notes in Comp. Sci., 1295. [10] L-M. Lopez and Ph. Narbel. Generalized sturmian lan ua es. In Z. Fueloep and F. Gecse , editors, ICALP’95, pa es 336 347. Sprin er, 1995. Lecture Notes in Computer Science 944. [11] J. E. Los. Pseudo-Anosov maps and invariant train tracks in the disc: a nite al orithm. Proc. of London Math. Soc., 66(2):400 430, 1993. [12] R. Mane. Er odic Theory and Di erentiable Dynamics. Sprin er-Verla , 1983. [13] R.T. Miller. Geodesic laminations from Nielsen’s viewpoint. Adv. in Math., 45:189 212, 1982. [14] B. Mosse. Puissances de mots et reconnaissabilite des points xes d’une substitution. Theoretical Computer Science, 99:327 334, 1992. [15] Ph. Narbel. The boundary of iterated morphisms on free semi- roups. Intern. J. of Al ebra and Computation, 6(2):229 260, 1996.
532
Luis-Mi uel Lopez and Philippe Narbel
[16] J. Nielsen. Untersuchun en zur topolo ie des eschlossenen zweiseiti en fl¨ achen. Acta Math., 50:189 358, 1927. [17] A. Papadopoulos and R.C. Penner. Enumeratin pseudo-Anosov foliations. Paci c Journ. of Math., 142(1):159 173, 1990. [18] R.C. Penner. A construction of pseudo-Anosov homeomorphisms. Transc. of the Amer. Math. Soc., 310(1):179 197, 1988. [19] M. Que elec. Substitution Dynamical Systems. Spectral Analysis. Number 1294 in Lecture Notes in Mathematics. Sprin er-Verla , 1987. [20] G. Rozenber and A. Salomaa. The mathematical theory of L systems. Academic press, 1980. [21] I. Takarajima. On a construction of pseudo-Anosov di eomorphism by sequences of train tracks. Paci c Journ. of Math., 166(1):123 191, 1994. [22] William P. Thurston. On the eometry and dynamics of di eomorphisms of surfaces. Bull. Am. Math. Soc., New Ser., 19(2):417 431, 1988.
About Synchronization Lan ua es Isabelle Ryl, Yves Roos, and Mireille Clerbout C.N.R.S. U.R.A. 369, L.I.F.L. Univer ite de Lille I, Bat. M3, Cite Scienti que 59655 Villeneuve d’A cq Cedex, FRANCE
Abs rac . Synchronization language are a model u ed to de cribe the behavior of di tributed application who e ynchronization con traint are expre ed by ynchronization expre ion . Synchronization language were conjectured by Guo, Salomaa and Yu to be characterized by a rewriting y tem. We have hown that thi conjecture i not true. Thi negative re ult ha led u to extend the rewriting y tem and Salomaa and Yu to extend the de nition of ynchronization language . The aim of thi paper i to e tabli h the link between the e two exten ion , we how that the behavior expre ed by the two familie of ynchronization language are only eparated by morphi m .
1
Introduction
Synchronization languages, introduced in [6], are regular languages which correspond to synchronization expressions introduced by Govindarajan, Guo, Yu and Wang [5] within the framework of the P arC project. These expressions allow a programmer to express minimal synchronization constraints of a program in a distributed context. A synchronization language can be seen as the set of correct executions of a distributed application where each action is split in two atomic actions, its start and its termination. In this sense, synchronization languages take place in interleaving semantics (see [9] for a comparison between interleaving semantics and non-interleaving semantics) with split of actions [10]. Guo, Salomaa and Yu have de ned in [6] a rewriting system named R in order to characterize synchronization languages. One part of this system is a semicommutation [4], using this part we can put in sequence actions which occur in parallel. The second part of the system is a generalized partial commutation [4], using this part, we can rewrite a word corresponding with a parallel execution in a word with the same parallelism degree. The main interest of R is that synchronization languages are closed under R and Guo et al. have conjectured that the converse holds (see [6]). We have shown in [1] that this conjecture is true in the particular case of languages de ned over alphabets of two actions but not in the general case. In order to bypass this negative result, Salomaa and Yu have chosen to extend the de nition of synchronization languages [8] and we have chosen to keep the rst de nition and to extend the system R [7]. This paper makes the link between the two de nitions of synchronization languages and we show that the behaviors expressed by the two families of synchronization languages are only separated by morphisms. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 533 542, 1998. c Springer-Verlag Berlin Heidelberg 1998
534
I abelle Ryl et al.
2
Preliminaries
In the following, we shall denote by Y the projection onto the sub-alphabet Y , i.e. the image of w by the morphism Y de ned by: for each letter x, if x Y then Y (x) = x, else Y (x) = , where denotes the empty word. The shu e v = u1 v1 u2 v2 un vn u v product of two words u and v is u u = u1 u2 un v = v1 v2 vn Let us consider a rewriting system R. We shall write u − v if there is a R
rule − in R and two words w and w0 such that u = w w0 and v = w w0 and we shall write − if there are words w0 w1 wn , (n 0), such that R
w0 = u wn = v, and for each i < n w −
u−
R
3
R
v and fR (L) =
w +1 . We denote fR (u) = v
u2L fR (u).
Synchronization Lan ua es
Synchronization expressions are a high-level tool which allows a programmer to express the synchronization constraints his distributed application has to respect. The statements are tagged and, during the execution, a statement can be executed immediately if it satis es the constraints described by the expression, if it does not, the execution is delayed. A synchronization expression may be: a statement tag or for no action, if e1 and e2 are synchronization expressions: e2 ) which imposes that the execution of e2 starts only after the (e1 end of the execution of e1 , (e1 e2 ) which allows the executions of e1 and e2 to overlap. Because of the de nition of , the same statement tag cannot appear in both operands, (e1 e2 ) which speci es that either e1 or e2 can be executed but not both, (e1 &e2 ) which imposes that the execution satis es both expressions e1 and e2 , (e1 ) which allows the execution of e1 to be repeated an arbitrary number of times. Example 1. The expression (a b) (c d) represents the following constraints: statements c and d can be executed only after the end of a and b (there is no synchronization constraint between a and b and between c and d). With a synchronization expression, we associate a language describing all the executions which respect the constraints expressed by the expression. So, the language corresponds with the possible execution traces. Moreover, each action a is split in two parts, the beginning of the execution of a, as and its termination at in order to obtain words which show the real concurrency of actions. So, from an expression e over , we construct L(e) ( s t ) which is an st-language:
About Synchronization Language
De nition 1. Let by the relation:
be a nite alphabet. The alphabets (a
)
s)
(as
(at
s
and
t
535
are de ned
t)
, fxs xt g (u) A word u ( s t ) is an st-word if and only if for each x (xs xt ) . We extend this de nition in a canonical way to lan ua es. We denote by ST the lan ua e which contains all st-words over the alphabet s t. De nition 2. Let be the alphabet of actions (or ta s). The lan ua e L(e) is inductively de ned by: ( s t ) associated with an expression e over L( ) = , for each action a, L(a) = as at , e2 then L(e) = L(e1 ) L(e2 ), if e = e1 if e = e1 e2 then L(e) = L(e1 ) L(e2 ), if e = e1 &e2 then L(e) = L(e1 ) L(e2 ), if e = e1 e2 then L(e) = L(e1 ) L(e2 ), if e = e1 then L(e) = (L(e1 )) . We denote by LS the family of synchronization lan ua es. Notice that we obtain st-languages because we only compute shu e product of languages de ned over disjoint alphabets. Moreover, by construction, synchronization languages are clearly regular languages. Guo, Salomaa and Yu [6] have de ned the rewriting system R in order to characterize synchronization languages. De nition . Let be an alphabet of actions. The rewritin system R is the union of the semi-commutation =
xs ys
ys xs xt yt
yt xt xs yt
yt xs
x6=y
and the set of rules a1t
amt a1s
b1t
bnt b1s
for each sequence a1 m n 1.
am b1
ams b1t bns a1t
bnt b1s amt a1s
bns ams
bn of pairwise distinct elements of
with
Example 2. Let u = as bs at as bt bs at bt . Using the second part of R, we have: a s b s at as b t b s at b t −
R
as b s b t b s at as at b t
Guo et al. have shown in [6] that each synchronization language is closed under R and they have conjectured that an arbitrary regular st-language closed under R is a synchronization language. We have shown in [1] that this conjecture is true in the particular case of languages de ned over alphabets of two actions but not in the general case. So, we have extended the system R in order to nd a characterization of synchronization languages. Salomaa and Yu have chosen another way, they have extended the de nition of synchronization expressions.
536
4 4.1
I abelle Ryl et al.
Extensions Extension of Salomaa and Yu [8]
Salomaa and Yu have proposed a new de nition of synchronization expressions (that we call generalized synchronization expressions), they allow to use a parallel operator between two expressions de ned over non-disjoint alphabets, for example, a (a (b c)) is a generalized expression. These expressions lead to generalized synchronization languages: De nition 4. Generalized synchronization lan ua es (LSG ) are built like syne2 then chronization lan ua es except for the parallel operator: if e = e1 L(e) = (L(e1 ) L(e2 )) ST . This operation is called st-shu e. Clearly, we have LS LSG . Salomaa and Yu have shown that each generalized synchronization language is closed under and they have conjectured that an arbitrary regular st-language closed under is a generalized synchronization language. 4.2
Extension of R
We have chosen to keep the rst de nition of LS to remain closed to the implementation in P arC. The problem was that R does not give a characterization of synchronization languages. The synchronization expressions semantics leads us to conjecture that some projection properties are missing to R. Therefore, we de ne a new system as follow: De nition 5. Let be an alphabet of actions. The rewritin system R0 is de ned, for each u in ( s t ) , by: (u −
R
v)
( a b
fas at bs bt g (u)
−
R
fas at bs bt g (v))
The system R0 is an extension of R, in particular, it is easy to see that for each fR (u). The idea is to extend the second part of R. word u, we have fR (u) For example, for any integer n > 1, a factor at (ct cs )n as bt bs can be rewritten in bt bs at (ct cs )n as using R0 but not using R. We have shown that each synchronization language is closed under R0 [7] and we have shown that the system R0 is best suited to the study of synchronization languages: Lemma 1 (Clerbout, Roos and Ryl [ ]). For each rewritin system S such that each synchronization lan ua e de ned over a compatible alphabet of actions (fS (L) = L) is closed under S, we have: L ST (L = fR (L)) This lemma shows that R0 is a good choice. Nevertheless, there exists a language, fR (bs (as at ) cs bt (as at ) ct ), which is regular and which is shown not to be a synchronization language [1]. Therefore, we get the proposition: Proposition 1 (Clerbout et al. [ ]). There does not exist any rewritin system S such that each synchronization lan ua e is closed under S and each re ular st-lan ua e closed under S is a synchronization lan ua e.
About Synchronization Language
5
Relations Between
537
and R0
The aim of the rest of this paper is to establish a link between synchronization languages and generalized synchronization languages. In order to do this, we will use morphisms because of the following ideas. First the di erence between LS and LSG comes only from the alphabets of the operands of the , so it could be useful to rename some letters. Secondly, the di erence between and R0 comes from the second part of the system R and we will see that we can remove this di erence using a renaming. So, we de ne st-morphisms: De nition 6. When and X are two alphabets of actions, a strictly alphabetical morphism from into X is called action morphism. An action morphism from into X is extended in a natural way to obtain from ( s t ) into from into X , we associate a (Xs Xt ) . With each action morphism rational function called st-morphism: = (u Note that family.
ST and
(u)) u
is equal to ( STX )
(u)
STX
( ST ). We denote by
st
the st-morphism
Let us show a property of st-morphisms which will be useful in the rest of the paper. Lemma 2. The composition of two st-morphisms is an st-morphism. Proof. Let from X into
be in and
respectively associated with the action morphisms from into . We have:
st
= (u
(u)) u
STX and (u)
ST
= (u
(u)) u
ST and
ST
(u)
The composition of these two st-morphisms is: = (u Since
(u)
(u)) u
STX
ST implies that (u)
(u)
ST and
ST ,
(u)
ST
is an st-morphism.
Now, we will consider the families of languages closed under the rewriting systems we have de ned and their closures under st-morphisms. De nition 7. We denote respectively by L , R and RR , the family of -closed st-lan ua es, re ular -closed st-lan ua es and re ular R0 -closed st-lan ua es. Lemma . The family of -closed st-lan ua es is closed under st-morphism: st (L ) = L .
538
I abelle Ryl et al.
Proof. Clearly we have L (Xs Xt ) be a X -closed stst (L ). Let L language. Let be an action morphism from an alphabet containing X into and be the associated st-morphism. Let us show that (L) = f ( (L)). Let (v (L)). u (L). It su ces to show that: (u (L) and u − v) . Since u (L), Let us set u = u1 xyu2 and v = u1 yxu2 with (x y) L such that (w1 ) = u1 , (z) = x, (t) = y and there exists w = w1 ztw2 (t)) . Since L is closed, (w2 ) = u2 . We have (z t) X because ( (z) (L) and since X the word w1 tzw2 belongs to L so, we have (w1 tzw2 ) = v and preserve the st-property, v belongs to (L). We deduce from the previous lemma the corollary: Corollary 1. The family of re ular -closed st-lan ua es is closed under stmorphism: st (R ) = R . L . Since the closure Proof. Clearly we have R st (R ) and st (R ) under st-morphism preserves regularity of st-languages, we have immediately R . st (R )) Now we will state the main result of this section: Proposition 2. The family of the ima es by st-morphisms of re ular R0 -closed st-lan ua es and the family of re ular -closed st-lan ua es coincide: st (RR ) = R . The proof of this proposition is not obvious but we can see the main idea with an example (a complete proof can be found in [2]). Let us consider the word u = as bs at as bt bs at bt , clearly, f (u) = fR (u) because as bs bt bs at as at bt belongs to fR (u) but not to f (u). Using some renaming (we mark alternatively the occurrences of an action with 1 and 2), we convert u into v = a1s b1s a1t a2s b1t b2s a2t b2t clearly, we have f (v) = fR (v). The idea is that in each projection over subalphabets of two actions of a marked word, we can never nd a factor which is the left part of a rule of the second part of R.
6
Relation Between LS and LSG
The aim of this section is to compare LS and LSG . We start with some interesting properties of the family of synchronization languages. Lemma 4. Let L be an st-lan ua e and (L
LS)
(
be an st-morphism. We have: −1
(L)
LS)
Proof. First, we show the implication from left to right by induction on the construction of L as union, product, star, intersection and shu e of synchronization languages. The only non-trivial case is the case when L = L1 L2 . Since L1 and L2 are de ned over disjoint alphabets, −1 (L1 ) and −1 (L2 ) are also de ned over
About Synchronization Language
539
disjoint alphabets. Since these two languages are st-languages, their shu e is an −1 L2 ) = −1 (L1 ) (L2 ). st-language. Thus, we have −1 (L) = −1 (L1 By induction hypothesis, −1 (L1 ) and −1 (L2 ) are synchronization languages, therefore −1 (L) is a synchronization language. Conversely, let us consider an st-language L de ned over an alphabet of actions and an action morphism de ned from X into such that −1 (L) is a synchronization language. Let us consider the partition of the alphabet X, Xn with: ( 1 k n x y Xk ) ( (x) = (y)) Let x1 be in X = X1 X1 , , xn be in Xn . Let us set: M=
−1
(L)
[(x1s x1t )
(xns xnt ) ]
From this equality, we deduce M LS. Since the restriction of from the alphabet of actions of M into the alphabet of actions of L establishes a bijection between these two alphabets, and since L = (M ), L is a synchronization language. Lemma 5. The family of the ima es by st-morphism of synchronization lanua es is closed under intersection. Proof. Let L1 and L2 be two synchronization languages de ned over the alphabets of actions X1 and X2 , respectively. According to Lemma 2, the composition of two st-morphisms is an st-morphism so we can always distinguish these alphabets: without loss of generality, we can take X1 X2 = . Let 1 and 2 be two action morphisms respectively de ned from X1 into 1 and from X2 into 2 . Let us consider the following alphabets: X01 = x X1 1 (x) 2 (X2 ) X02 = x X2 2 (x) 1 (X1 ) = (x y) X1 X2 1 (x) = 2 (y) (note that X01
X02 = ) and the following action morphisms: 1
: (X01 ) − X1 0 x X1 − x (x y) − x − : (x y) −
: (X02 ) − 0 x X2 − (x y) − ( 1 ) 2 1 (x) = 2 (y) 2
X2 x y
We denote by 1 , 2 , , 1 and 2 the st-morphisms induced by these action morphisms. We will show that we have: 1 (L1 ) 2 (L2 ) = ( 1−1 (L1 ) 2−1 (L2 )) We rst remark the two following properties: Assertion. Let u1 L1 and u2 L2 . We have: (
1 (u1 )
=
2 (u2 ))
( v
ST
1 (v)
= u1 and
2 (v)
= u2 )
xk For the implication from left to right, it su ces to note that if u1 = x1 and u2 = y1 yk , the word v = (x1 y1 ) (xk yk ) belongs to ST with 1 (v) =
540
I abelle Ryl et al.
u1 and 2 (v) = u2 . The implication from right to left can be deduced from the de nitions of the alphabets and of the action morphisms. Assertion. For each v ST , we have: (v) = 1 ( 1 (v)) = 2 ( 2 (v)) From these two assertions, we deduce the following equivalences: w 1 (L1 ) 2 (L2 ) u1 L1 u2 L2 1 (u1 ) = 2 (u2 ) = w (v) = u L1 2 (v) = u2 L2 v ST 1 1 w = 1 ( 1 (v)) = 2 ( 2 (v)) = (v) −1 −1 v 1 (L1 ) 2 (L2 ) w = 1 ( 1 (v)) = 2 ( −1 −1 w ( 1 (L1 ) 2 (L2 ))
2 (v))
= (v)
−1 −1 Thus, we have 1 (L1 ) 2 (L2 ) = ( 1 (L1 ) 2 (L2 )). The synchronization languages family is closed under inverse st-morphism (Lemma 4), therefore 1−1 (L1 ) and 2−1 (L2 ) are synchronization languages so, we have 1 (L1 ) 2 (L2 ) st (LS)
Lemma 6. The family of the ima es by st-morphism of synchronization lanua es is closed under st-shu e. Proof. Let us recall that the st-shu e of two languages is the set of st-words of their shu e product. Let L1 and L2 be two synchronization languages respectively de ned over the alphabets of actions X1 and X2 . We can suppose that X1 X2 = . Let 1 and 2 be two action morphisms respectively de ned from X1 into 1 and from X2 into 2 . We consider the action morphism: 3
: (X1 x x
X2 ) − X1 − X2 −
(
1
2)
1 (x) 2 (x)
L2 is an st-language Since L1 and L2 are de ned over disjoint alphabets, L1 (L )] ST = (L L ) and we have: [ 1 (L1 ) 2 2 3 1 2 1[ 2 The closure properties of family of the images by st-morphisms of synchronization languages we have shown lead us to the main result of this section which establishes the link between synchronization languages and generalized synchronization languages: Proposition . The family of the ima es by st-morphism of eneralized synchronization lan ua es and the family of the ima es by st-morphism of synchronization lan ua es coincide: st (LSG ) = st (LS). Proof. The family st (LS) contains all the nite languages which represent the execution of one action (like as at ) and it is closed under union, product, star, intersection (Lemma 5) and st-shu e (Lemma 6) so, it contains the generalized ( st (LSG ) synchronization languages: (LSG st (LS)) st (LS)) Moreover, the family of synchronization languages is included in the family of gener( st (LS) alized synchronization languages, thus: (LS LSG ) st (LSG ))
About Synchronization Language
7
541
Conclusion
We have established a link between synchronization languages and their extensions and between the rewriting systems used to try to characterize them. The following diagram shows the present situation: some inclusions miss to complete the study of synchronization languages families. We have already shown that a non-obvious family included in R (the family of well-formed languages de ned in [6]) is included in st (LS), so we would like to extend this result and we conjecture that R st (LS) that is to say, we conjecture the equality st (RR ) = R = st (LS) = LS (LS ). Since R R , we also conjecst G R ll + ture the inclusion R R st (LS). The in~ l RR LS is conjectured by Salomaa clusion R G LSG and Yu [8], this conjecture leads to the followT T (R ) = R = (LS) = ing: ^ T = st R st st (LSG ) = . Nevertheless, a characterization of genLS G st (RR ) = R eralized synchronization languages may be k more di cult because of the very little structural relations between a generalized synchro? nization language and one of its generalized st (LS) = st (LSG ) synchronization expressions.
References 1. Clerbout, M., Roos, Y., and Ryl, I. Synchronization language . Theoretical Computer Science. to appear. 2. Clerbout, M., Roos, Y., and Ryl, I. About ynchronization language (full ver ion). Tech. Rep. IT-98-313, Univer ite de Science et Technologie de Lille, 1998. 3. Clerbout, M., Roos, Y., and Ryl, I. Langage de ynchroni ation et y teme de reecriture. Tech. Rep. IT-98-311, Univer ite de Science et Technologie de Lille, 1998. 4. Diekert, V., and Rozenber , G., Ed . The Book of Traces. World Scienti c, Singapore, 1995. 5. Govindarajan, R., Guo, L., Yu, S., and Wan , P. ParC project: Practical con truct for parallel programming language . In Proc. IEEE 15th Annual Internationnal Computer Software & Applications Conference (1991), pp. 183 189. 6. Guo, L., Salomaa, K., and Yu, S. On ynchronization language . Fundamenta Informaticae 25 (1996), 423 436. 7. Ryl, I., Roos, Y., and Clerbout, M. Partial characterization of ynchronization language . In Proc. 22nd International Symposium on Mathematical Foundations of Computer Science (MFCS’97) (Brati lava, Slovakia, 1997), I. Pr vara and P. Ruzicka, Ed ., vol. 1295 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, pp. 209 218. 8. Salomaa, K., and Yu, S. Rewriting rule for ynchronization language . In Structures in Lo ic and Computer Science, a Selection of Essays in Honor of A.
542
I abelle Ryl et al.
Ehrenfeucht, J. Myciel ki, G. Rozenberg, and A. Salomaa, Ed ., vol. 1261 of Lecture Notes in Computer Science. Springer-Verlag, Berlin, 1997, pp. 322 338. 9. Sassone, V., Nielsen, M., and Winskel, G. Model for concurrency: Toward a cla i cation. Theoretical Computer Science 170, 1-2 (1996), 297 348. 10. van Glabbeck, R. J., and Vaandra er, F. The di erence between plitting in n and n + 1. Information and Computation 136, 2 (1997), 109 142.
When Can an Equational Simple Graph Be Generated by Hypered e Replacement? Klaus Barthelmann Johannes Gutenber -Universit¨ at Mainz, Institut f¨ ur Informatik, D-55099 Mainz, Germany barthel@ nformat k.un -ma nz.de
Abstract. In nite hyper raphs with sources arise as the canonical solutions of certain systems of recursive equations written with operations on hyper raphs. There are basically two di erent sets of such operations known from the literature, HR and VR. VR is strictly more powerful than HR on simple hyper raphs. Necessary conditions are known ensurin that a VR-equational simple hyper raph is also HR-equational. We prove that two of them, namely havin nite tree-width or not containin the in nite bipartite raph, are also su cient. This shows that equational hyper raphs behave like context-free sets of nite hyper raphs. Usin an alternate characterization of VR-equational simple hyper raphs [3], this result provides a (necessary and) su cient condition and an e ective procedure to translate a lan ua e-theoretic de nition of an in nite hyper raph [9] into an operational one based on substitution [11].
1
Introduction
Operations on hyper raphs have been de ned in the literature in essentially two di erent ways. Hypered e replacement (HR) rewrites a hyper raph by substitutin a hyper raph for a hypered e. The inserted hyper raph contains some distin uished vertices (often called sources ) which are lued with the former attachment vertices of the removed hypered e. A rewritin rule, therefore, has to specify the label of the hypered e to replace (which in turn determines the number of attachment vertices) and the hyper raph (includin sources) to be inserted. This operational description can readily be turned into al ebraic operations [7, 12]. Vertex replacement (VR) rewrites a hyper raph by removin a vertex to ether with its adjacent hypered es, insertin a new hyper raph, and connectin it with the former nei hbours of the vertex by new hypered es. Only the labels of the former nei hbours and the labels of the removed hypered es are taken into account when creatin hypered es. A rewritin rule, therefore, has to specify the label of the vertex to replace, the hyper raph to be inserted, and the embeddin transformation. This operational description is modeled by al ebraic operations rather indirectly [18, 15]. These VR operations only make sense for simple hyper raphs, that is, hyper raphs without parallel hypered es with the same label. On the other hand, it is well-known that the VR operations are more powerful than the HR operations on simple hyper raphs. The reader Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 543 552, 1998. c Sprin er-Verla Berlin Heidelber 1998
544
Klaus Barthelmann
can nd comparisons of both approaches in [20, 17]. Su ce it to say that the duality is actually deeper than one mi ht expect from the precedin remarks. Al ebraic operations are mainly used in systems of recursive equations. One is often interested in polynomial equations which have sets of nite hyper raphs as their (least) solutions, those that can be enerated by the operational description above. But a system of recursive equations can also be used to describe a sin le, usually in nite hyper raph as its least solution. This is the aspect we consider in this paper. Such hyper raphs are called equational . They arise naturally in denotational semantics, because they eneralize re ular trees (see [10]). In many cases, they allow to verify properties of a computation. For example, equational hyper raphs de ned with HR operations (HR-equational hyper raphs for short) can be used to analyse recursive applicative pro ram schemes [11]. Caucal [9, 3] has iven a pure lan ua e-theoretic description of equational hyper raphs de ned with VR operations (VR-equational hyper raphs for short). Every equational hyper raph has a decidable monadic second-order (MSO) theory [11, 9, 3], because it can be de ned inside the (in nite) complete binary tree by formulas of MSO lo ic. It is also known that, vice versa, every hyper raph that can be de ned inside the (in nite) complete binary tree by formulas of MSO lo ic is equational [13, 3]. Althou h equational hyper raphs certainly do not constitute the lar est class of hyper raphs with a decidable MSO theory, they have perhaps the most natural description. This paper investi ates the relationship between the classes of equational hyper raphs de ned with HR and VR operations. It is clear that every HRequational simple hyper raph is also VR-equational. Since an HR-equational hyper raph has nite tree-width [14], there are VR-equational hyper raphs which are not HR-equational (see also [9]). Bounded tree-width and equivalent properties are known to be necessary and su cient for a VR-equational set of nite hyper raphs to be HR-equational [16, 2]. We establish a similar relationship between VR-equational and HR-equational hyper raphs, thereby answerin a question raised in [3]. We directly transform the correspondin systems of equations and do not need to build a tree decomposition (which would also ive the result accordin to [14]) or consider lo ical properties of the hyper raphs (like in [16]). The paper is or anized as follows. We rst recall the notion of hyperraphs and operations and show how to solve systems of re ular equations for hyper raphs. Section 3 states the main theorem. Since space is short, all proofs are omitted. (The full version is available as a technical report [4].) We conclude this paper with some remarks.
2
Preliminaries
First we x some notation. N is the set of nonne ative inte ers and N + the N ; [0] = . The set of set of positive ones. We set [n] = 1 n for n B is nite sequences (words) of elements from a set A is called A . If f : A B for its unique extension to A . [a]R is the a mappin , we write f : A equivalence class of a A modulo R and A R = [a]R a A . Accordin ly,
When Can an Equational Simple Graph Be Generated by HR?
545
[ ]R : A A R is the canonic surjection. If a formula (x1 xn ) contains xn in some speci ed order and d1 dn are at most n free variables x1 dn = (x1 xn ) appropriate values for them in a structure S then S d1 means that S satis es under the assi nment xi := di , i [n]. 2.1
Hyper raphs and Operations
Let us x a (su ciently lar e) nite set L of labels to ether with a rank mappin N+ . :L De nition 1 (hyper raph, homomorphism). A hyper raph G of sort n N consists of a set V of vertices, a set E of hypered es, a vertex mappin L, and a source mappin src: [n] V, vert: E V , a label mappin lab: E such that vert(e) = (lab(e)) for all e E. src(i) is called the ith source. In a simple hyper raph, the conditions vert(e) = vert(e0 ) and lab(e) = lab(e0 ) E. Therefore, E L V can always be to ether imply e = e0 for all e e0 assumed, and vert((l v)) = v, lab((l v)) = l. A homomorphism h: G G0 between hyper raphs of sort n consists of two 0 V and hE : E E 0 such that vert0 hE = hV vert, lab0 hE = mappin s hV : V 0 lab and src = hV src. For simple hyper raphs, hE is determined by hV . As usual, an isomorphism is a homomorphism with an inverse. The followin three de nitions introduce operations on isomorphism classes of hyper raphs. They are taken from [15] with small modi cations. (The restricted operations in [18, 16, 17] are su cient for ordinary raphs.)
N , denote discrete hyperDe nition 2 (constants). The constants 0n , n raphs of sort n: V = [n], E = (which also determines vert and lab) and src(i) = i for i [n]. The constants 1n , n N , denote one-vertex hyper raphs of sort n: V = [1], E = L, vert(l) = 1 (l) , lab(l) = l for l L and src(i) = 1 for i [n]. The constants l L denote hyper raphs of sort (l) containin exactly one hypered e: V = [ (l)], E = e , vert(e) = 1 (l), lab(e) = l and src(i) = i for i [ (l)]. De nition 3 (parallel composition). Parallel composition n1 n2 is a binary operation on hyper raphs G1 and G2 of respective sorts n1 and n2 . Its result has sort max n1 n2 . We can assume that V1 is disjoint from V2 and E1 is be the least equivalence relation on V1 V2 such that disjoint from E2 . Let src2 (i) for every i [min n1 n2 ]. Then G1 n1 n2 G2 is determined src1 (i) as follows: V = (V1 V2 ) , E = E1 E2 , vert = [ ] (vert1 vert2 ), lab = lab1 lab2 , and src = ([ ] src1 ) ([ ] src2 ). Note that all constants denote simple hyper raphs. However, the parallel composition of two simple hyper raphs is not always simple. The de nition has to be modi ed a little in this case: We assume Ei L Vi (i = 1 2) as usual and set E = (l [v] ) (l v) E1 E2 . That is, parallel hypered es with the same label, whose attachment vertices are all amon the sources, are fused.
546
Klaus Barthelmann
Simple hyper raphs of sort n are essentially relational structures with n constants. Their domain is V . They include predicates ed el of arity (l) for every vn ) means (l v1 vn ) E. The constant i for l L, such that ed el (v1 every i [n] represents the vertex src(i). Addin equality and a nite number of xk , atomic formulas are built as usual. The set of quanti er-free variables x1 (qf ) formulas is obtained from atomic formulas with the truth values rue, false and the Boolean connectives , and . The set of positive qf (pqf ) formulas consists of those qf formulas that can be formed without ne ation. We denote xk ) and PQFn (x1 xk ) the respective sets of qf and pqf forby QFn (x1 mulas up to (tauto)lo ical equivalence. (The axioms for equality are included, namely reflexivity, symmetry, transitivity and substitution of equals for equals in formulas. Note that lo ical equivalence and lo ical implication are decidable for (p)qf formulas, because they are even decidable for the fra ment of rst-order lo ic with equality, where all formulas are in pre x normal form and contain xk ) and PQFn (x1 xk ) are nite for only universal quanti ers.) QFn (x1 every n and k. It is more convenient to speak about their elements as formulas, and this should not cause any confusion. De nition 4 (qfd operations). A qf de nition scheme from m to n consists of a vertex formula QFm (x1 ) of the form 0 (x1 ) i , hypered e i2[n] x1 = x (l) ) for each l L, and source speci cations i formulas l QFm (x1 [m] for each i [n]. A pqf de nition scheme is de ned similarly with PQFm instead of QFm . determines a unary operation Def on simple hyper raphs G1 of sort m, which is called (positive) quanti er-free de nable ( qfd or pqfd). Its result Def (G1 ) has sort n and is determined as follows: V = v V1 G1 v = (x1 ) , v (l) ) l L v1 v (l) V G1 v1 v (l) = l (x1 x (l) ) , E = (l v1 src(i) = src1 ( i ) for every i [n]. One pqfd operation deserves a special name because it works on hypern, where f : [n] [m] raphs in eneral. renf is an operation of type m rue, l (x1 x (l) ) is a mappin . Its de nition scheme contains (x1 ) x (l) ) for each l L, and i f (i) for each i [n]. (renf (G) is ed el (x1 like G except that its source mappin is src f .) N , all l, l L, renf for all mappin s The HR operations are 0n , n N , and n1 n2 , n1 n2 N . This set of operations is obf : [n] [m], m n viously equivalent to the one introduced in [7, 12], where two other operations are used instead of parallel compositions, one for formin the disjoint union of two hyper raphs and one for fusin vertices. The VR operations are 0n and 1n , n N , all pqfd operations Def and n1 n2 , n1 n2 N . VR operations are dened on simple hyper raphs; the interpretation of parallel composition is sli htly di erent from the HR case, as said above. 2.2
Equations in
-Complete Cate ories
Solvin equations amounts to formin xpoints in some al ebraic structure. However, no topolo ical or order-theoretic de nition of conver ence for sequences of
When Can an Equational Simple Graph Be Generated by HR?
547
hyper raphs is known. There is no choice but usin a more eneral framework based on homomorphisms [5, 6]. It will require a basic understandin of cate ory theory (cate ories, functors, colimits and their construction for sets), which we assume from the reader. Let us review only a few less common facts (see also [3]). Hyper raphs of sort n N and their homomorphisms form (the respective objects and arrows of) a cate ory Gn . The same holds for simple hyper raphs; the correspondin cate ory is called SG n . Gn has all colimits. They can be obtained from the correspondin constructions in the cate ory of sets, applyin them to vertices and hypered es separately. Similarly, SG n has all colimits. Let us remark that 0n is the initial object in Gn (and SG n ). G1 n n G2 is the coproduct of G1 and G2 in Gn and, under the modi ed de nition mentioned earlier, also in SG n . Every hyper raph operation induces a functor. (Here the restriction to positive quanti er-free de nable operations is essential.) Moreover, all these functors and arbitrary compositions preserve colimits. A special case of this fact deserves a particular name. A cate ory is -complete i every dia ram of the form h
h
A0 −0 A1 −1
hi−1
h
−−− Ai − i
has a colimit. A functor is -continuous i it preserves all colimits of this form. Gmn Gm1 Gmn is an -continuous Fact 5 ([1, 5]). If F : Gm1 functor then its xpoints (the tuples of hyper raphs H such that F (H) is componentwise isomorphic to H) form a cate ory with an initial object. This initial object G (the initial xpoint) is the colimit of the dia ram f
F (f )
0 − F (0) −−−
F i−1 (f )
F i (f )
−−−−− F i (0) −−−
0mn ) and f is the tuple of initial homomorphisms. for i N , where 0 = (0m1 G, The cocone of G over the dia ram is iven by the arrows F i ( ): F i (0) where : 0 G is the tuple of initial homomorphisms. The same statement holds with SG m instead of Gm . De nition 6 (system of re ular equations, equational hyper raph). A system of re ular equations E is a sequence of equations x1 = t1
xk = tk
(k
N)
xk , each one havin a sort (xi ), and with pairwise distinct variables x1 xjr ), where the operation f has the ri ht-hand sides ti of the form f (xj1 (xjr ) (xi ), and j1 jr [k]. correct type (xj1 ) Sorts and operations are interpreted by -complete cate ories Cs and -continuous functors between them, respectively. E induces an -continuous C (xk ) C (x1 ) C (xk ) from the -complete functor EC : C (x1 ) C (xk ) to itself. Therefore, EC has an initial xpoint cate ory C (x1 ) L(E C). It is called the least solution of E in the family C. L(E C) xi is its ith component.
548
Klaus Barthelmann
A hyper raph is HR-equational i it is L(E G) x1 for some system E of re ular equations involvin HR operations. A simple hyper raph is VR-equational i it is L(E SG) x1 for some system E of re ular equations involvin VR operations.
3
The Main Theorem
We need a few raph-theoretic notions before we can state the theorem. De nition 7 (tree-width). A tree-decomposition of a hyper raph G = (V E vert lab src) of sort n consists of a tree T with set of nodes N and a mappin f : N P(V ) such that: 1. V = f (v) v N . 2. Every hypered e in E has all its vertices in f (v) for some v N . 3. If u v w N and if v is on the unique (undirected) shortest path from u to w in T then f (u) f (w) f (v). 4. src([n]) f (r), where r N is the root of T . The width of a tree-decomposition is sup f (v) v N − 1 (it may be ). The tree-width of a hyper raph G is the minimum width of a tree-decomposition of G. De nition 8 (clique- raph). The clique- raph c (G) derived from a hyperraph G is obtained by the substitution of an undirected clique Kn with vertices vn for every hypered e connectin vertices v1 vn , and deletin all lav1 bels (and sources). Theorem 9. A VR-equational simple hyper raph G is HR-equational i c (G) has only small (undirected, unlabelled) bipartite raphs Kn n as sub raphs i G has nite tree-width. This condition is decidable. Moreover, a VR-equational simple hyper raph is HR-equational if each of its vertices has nite (even bounded) de ree [8, 9]. This, however, is not a condition shared by all HR-equational hyper raphs. It leads to a natural subclass; such hyper raphs are called context-free in [21]. The ‘only if’ parts of the theorem are well-known [14]. Since the bipartite raph Kn n has tree-width n, the ‘if’ part of the second assertion follows from the rst. Finally, it turns out that it actually su ces to exclude the in nite (undirected, unlabelled) bipartite raph K1 1 from c (G). Our proof of the theorem is divided into two parts. The rst step is to collect information about the components of the least solution of the de nin system of re ular equations. We identify subhyper raphs with a nite number of occurrences. This is done by countin substructures satisfyin certain lo ical properties. The technique rew out of the typin in [2]. Similar approaches have been used in the literature, in particular [19]. The second step is to et rid of the pqfd
When Can an Equational Simple Graph Be Generated by HR?
549
operations by transformin the system of equations. If a pqfd operation adds only a nite number of hypered es, the same e ect can be achieved by introducin a su cient number of sources and usin HR operations. Otherwise the pqfd operation is moved throu h the system of equations towards the constants. The creation of hypered es that span a parallel composition can be dele ated to the operands if we supply each of them with a nite number of vertices from the partner. A similar technique was used in [2]. 3.1
Countin Substructures
Gk ) = L(E SG) have Let E be a system of re ular equations and let (G1 nk ). We count the number of occurrences of all subhyper raphs sorts (n1 of Gi , i [k], up to the size ni + (L), where (L) = max (l) l L . More x (L) and take ni as the disjoint union formally, we introduce variables x1 xjr ), r N , where j1 < < jr and j1 jr [ (L)]. of all QFni (xj1 Note that ni is nite. Let Mni be the set of all multisets over ni , that is, the . set of all mappin s from ni to N xjr ) De nition 10 (occurrences). Let QFn (xj1 n be a qf formula and G = (V E src) a simple hyper raph of sort n. We de ne satn (G ) = vr ) V r G v1 vr = (xj1 xjr ) and occn : SG n Mn such (v1 that occn (G)( ) = satn (G ) (this may be ). We compute occni (Gi ), i [k], by solvin E a second time. For each j N , let j Hk j ) = ESG (0n1 0nk ) and homous de ne tuples of hyper raphs (H1 j j hk j ) = ESG (g1 gk ), where gi : 0ni Gi , i [k], are the morphisms (h1 j initial homomorphisms. It follows easily from Fact 5 that Gi is the colimit of the hi 1 (Hi 1 ) hi j (Hi j ) . Note that hi j (Hi j ) dia ram hi 0 (Hi 0 ) is a subhyper raph of hi j+1 (Hi j+1 ) and of Gi . Moreover, because ESG is a funchk j+1 (H1 j+1 )) = ESG (h1 j (H1 j ) hk j (Hk j )). We tor, (h1 j+1 (H1 j+1 ) can compute occni (hi j (Hi j )) inductively for j N . The ima e of 0ni in Gi is QFni () Gi = of Gi determined as follows. The QF theory Th(Gi ) = is decidable (even its MSO theory is). Th(Gi ) induces an equivalence relation q means that Gi = p = q . Therefore, gi (0ni ) has V = [ni ] , on [ni ]: p [ni ]. satni (gi (0ni ) ), E = and src(p) = [p] for p ni , can then occnk (hk 0 (Hk 0 ))). be determined explicitly. This ives (occn1 (h1 0 (H1 0 )) occnk (hk j+1 (Hk j+1 ))) from It remains to compute (occn1 (h1 j+1 (H1 j+1 )) occnk (hk j (Hk j ))). (occn1 (h1 j (H1 j ))
Proposition 11. occn can be computed inductively with respect to the operations on simple hyper raphs. (This is a special case of a similar theorem in [19]. The main part was already proved in [15].) The pointwise orderin turns Mni into a complete partial order with least element (0 0). The sequence occni (hi j (Hi j )), j N , is an ascendin chain in Mni . Therefore, it has a least upper bound Bi . It is obvious from the de nitions that Bi = occni (Gi ). By analysin the recursions in E, it is possible to compute the xpoint in a nite number of steps.
550
3.2
Klaus Barthelmann
Eliminatin VR Operations
Gk ) = L(E SG) have Let E be a system of re ular equations and let (G1 nk ). We derive a new system of equations for G1 , with new varisorts (n1 ables and equations for them. The variables have the form xi Γ m , where Γ is a qf de nition scheme, consistin of , l , l L, and p p for p [m]; m N , m ni . xi Γ m will denote the simple hyper raph Def Γ (Gi ni m 0m ) with many more sources. The number of additional sources n0i is determined by the value occni (Gi ): The hyper raph has r occni (Gi )( ) additional sources for each xjr ) such that occni (Gi )( ) N . Their order of succession QFni (xj1 is arbitrary but xed. Of course, a sequence of r successive sources is used to desi nate one occurrence of in Gi . Γ will always delete all those hypered es from Gi such that the sub raphs induced by their attachment vertices occur only nitely often. In particular, those ed es whose attachment vertices are all amon the m sources are left out. This trick makes the distinction between parallel composition on simple hyper raphs and hyper raphs in eneral essentially disappear. It is possible to write an equation for G1 in the form x1 = ren (F (x1 Γ n1 )), [n1 + n01 ] is the inclusion, the expression F adds all missin where g: [n1 ] hypered es accordin to occn1 (G1 ) and Γ is a qf de nition scheme as described above. Now the main theorem reduces to the followin proposition. Proposition 12. It is possible to derive an equation for xi Γ m usin only HR operations from the equation xi = ti in E, provided that the in nite bipartite raph K1 1 is not a sub raph of c (G), G bein the hyper raph denoted by xi Γ m . If c (G1 ) does not contain the in nite bipartite raph K1 1 as a sub raph then the procedure will eventually stop creatin new variables. This property is decidable.
4
Conclusion
Takin to ether what is known about the relationships between the classes of HR-equational and VR-equational hyper raphs, one realises immediately that they mirror analo ous relationships between HR-equational and VR-equational sets of nite hyper raphs. This is no coincidence because every equational hyper raph is the colimit of an equational set of nite hyper raphs equipped with homomorphisms in a natural way. (If xi = ti , i [k], are the de nin equations for an equational hyper raph then the equations xi = ti + 0ni de ne an equational set of nite hyper raphs. Under a di erent interpretation, these equations de ne a unique re ular tree and the set of its nite approximations, respectively. Evaluatin these trees yields the ori inal hyper raphs and induces homomorphisms between them.) However, it does not seem to be easy to exploit this fact directly. As an advanta e, the independent approaches we used can be combined to handle equational sets of (possibly in nite) hyper raphs. Acknowled ements The author likes to thank the referees for their helpful comments.
When Can an Equational Simple Graph Be Generated by HR?
551
References [1] Adamek, J., Koubek, V.: Least Fixed Point of a Functor. J. Comput. System Sci. 19 (1979) 163 178 [2] Barthelmann, K.: How to Construct a Hypered e Replacement System for a Context-Free Set of Hyper raphs. Tech. Rep. 7, Universit¨ at Mainz, Institut f¨ ur Informatik (1996). Submitted for publication [3] Barthelmann, K.: On Equational Simple Graphs. Tech. Rep. 9, Universit¨ at Mainz, Institut f¨ ur Informatik (1997). Submitted for publication [4] Barthelmann, K.: When Can an Equational Simple Graph Be Generated by Hypered e Replacement?. Tech. Rep. 2, Universit¨ at Mainz, Institut f¨ ur Informatik (1998) [5] Bauderon, M.: In nite hyper raphs I. Basic properties. Theoret. Comput. Sci. 82 (1991) 177 214 [6] Bauderon, M.: In nite hyper raphs II. Systems of recursive equations. Theoret. Comput. Sci. 10 (1992) 165 190 [7] Bauderon, M., Courcelle, B.: Graph Expressions and Graph Rewritin s. Math. Systems Theory 20 (1987) 83 127 [8] Caucal, D.: On the re ular structure of pre x rewritin . Theoret. Comput. Sci. 106 (1992) 61 86 [9] Caucal, D.: On In nite Transition Graphs Havin a Decidable Monadic Theory. In: auf der Heide, F. M., Monien, B. (eds.): Automata, Lan ua es and Pro rammin (ICALP ’96), Lecture Notes in Computer Science, Vol. 1099. Sprin er (1996) 194 205 [10] Courcelle, B.: Fundamental properties of in nite trees. Theoret. Comput. Sci. 25 (1983) 95 169 [11] Courcelle, B.: The Monadic Second-Order Lo ic of Graphs, II: In nite Graphs of Bounded Width. Math. Systems Theory 21 (1989) 187 221 [12] Courcelle, B.: Graph Rewritin : An Al ebraic and Lo ic Approach. In: van Leeuwen [23], Ch. 5, 193 242 [13] Courcelle, B.: The monadic second-order lo ic of raphs IV: De nability properties of equational raphs. Ann. Pure Appl. Lo ic 49 (1990) 193 255 [14] Courcelle, B.: The monadic second-order lo ic of raphs III: Tree-decompositions, minors and complexity issues. RAIRO Informatique theorique et Applications/ Theoretical Informatics and Applications 26, 3 (1992) 257 286 [15] Courcelle, B.: The monadic second-order lo ic of raphs VII: Graphs as relational structures. Theoret. Comput. Sci. 101 (1992) 3 33 [16] Courcelle, B.: Structural Properties of Context-Free Sets of Graphs Generated by Vertex Replacement. Inform. and Comput. 116 (1995) 275 293 [17] Courcelle, B.: The Expression of Graph Properties and Graph Transformations in Monadic Second-Order Lo ic. In: Rozenber , G. (ed.): Handbook of Graph Grammars and Computin by Graph Transformation, Vol. 1, Foundations. World Scienti c (1997) Ch. 5, 313 400 [18] Courcelle, B., En elfriet, J., Rozenber , G.: Handle-Rewritin Hyper raph Grammars. J. Comput. System Sci. 46 (1993) 218 270 [19] Courcelle, B., Mosbah, M.: Monadic second-order evaluations on treedecomposable raphs. Theoret. Comput. Sci. 109 (1993) 49 82 [20] En elfriet, J.: Context-Free Graph Grammars. In: Rozenber and Salomaa [22], Ch. 3, 125 213
552
Klaus Barthelmann
[21] Muller, D. E., Schupp, P. E.: The theory of ends, pushdown automata, and secondorder lo ic. Theoret. Comput. Sci. 7 (1985) 51 75 [22] Rozenber , G., Salomaa, A. (eds.): Handbook of Formal Lan ua es, Vol. 3, Beyond Words. Sprin er (1997) [23] van Leeuwen, J. (ed.): Handbook of Theoretical Computer Science, Vol. B, Formal Models and Semantics. Elsevier (1990)
Spatial and Temporal Re nement of Typed Graph Transformation Systems ? Martin Gro e Rhode1 , France co Pari i Pre icce2, and Marta Simeoni2 1
Dip. di Informatica, Universita di Pisa, Corso Italia, 40, I 56125 Pisa, Italy, m
[email protected] 2 Universita di Roma La Sapienza, Dip. Scienze dell’Informazione, Via Salaria 113, I-00198 Rome, Italy, parisi,simeoni @dsi.uniroma1.it
Abs rac . Graph transformation systems support the formal modelin of dynamic, concurrent, and distributed systems. States are iven by their raphical structure, and transitions are modeled by raph transformation rules. In this paper we investi ate two kinds of re nement relations for raph transformation systems in order to support the development of a module concept for raph transformation systems. In a spatial re nement each rule is re ned by an amal amation of rules, in a temporal re nement it is re ned by a sequence of rules.
1
Introduction
Graph grammar and graph tran formation y tem , in their di erent variation , have become a well accepted approach to the formal modeling of y tem . (For a urvey ee [Roz97].) In thi paper we inve tigate re nement relation between graph tran formation y tem , a que tion that ha been addre ed only few in the literature up to now ( ee [CH95,HCEL96,Par96,Rib96]). Our main concern are re nement relation that pre erve the full behaviour of graph tran formation y tem , a oppo ed to [CH95,HCEL96] for in tance, who e re nement relation guarantee only the exi tence of peciali ed tran formation in the re ning y tem, not the whole behaviour. U ing typed graph tran formation y tem ([CEL+ 96]) re nement al o upport the implementation of a more ab tract y tem by another more concrete one. Thereby type re triction corre pond to the hiding of implementation detail . A po ible application of re nement i the development of a module concept for graph tran formation y tem . Well inve tigated in the eld of programming language module concept have been carried over al o to formal peci cation approache , a for in tance algebraic peci cation of ab tract data type ( ee e.g. [BEP87,EM90]). Ba ically, a module i given by an export and an import interface, and a body that implements the feature o ered at the export interface, po ibly u ing the feature required at the import interface. A nece ary ?
This research has been supported by the TMR Network GETGRATS, ERB-FMRXCT960061.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 553 561, 1998. c Sprin er-Verla Berlin Heidelber 1998
554
Martin Gro e Rhode et al.
formal mean to de ne uch module for formal peci cation are morphisms between the peci cation unit for the three part , that model the e relation hip appropriately. That mean , morphi m are required that model the inclu ion of the imported feature into the body, and morphi m that model the relation between the exported feature and their implementation in the body. Since the latter ta k i of more general nature there hould be an embedding of morphi m of the r t kind (inclu ion ) into morphi m of the econd kind (implementation ). In [EM90] horizontal compo ition operation have been introduced, uch a union and compo ition via import export interface matching. The e ential requirement on the category of peci cation unit to upport the e horizontal operation i that pu hout (more generally colimit ) of peci cation exi t. For the pecial and mo t important ca e of import export interface matching it u ce already, if pu hout of inclu ion and implementation exi t. The r t kind of morphi m between graph tran formation y tem , correponding to inclu ion , are mapping between the name et that are compatible with the a ociated rule . In a re nement morphi m name are mapped to instructions that indicate how a rule i re ned to a compo ition of rule of the re ning y tem. In a patial re nement, everal rule of the re ning y tem are glued together in parallel (amalgamated) to obtain the e ect of the original rule. That mean , the di erent rule of the re ning y tem mu t be applied at the ame time to di erent, po ibly overlapping part of the actual graph ( tate), and their imultaneou application yield the ame ucce or graph a the original rule. In a temporal re nement, a equential compo ition of rule re ne a given one, i.e. the equential computation tep are re ned. The paper i organized a follow . In the next two ection graph tran formation y tem and re nement are introduced for the untyped ca e. Although thi ca e i not very meaningful for application , the eparated pre entation make the pre entation ea ier. In ection 2 ba ic de nition and fact of graph tran formation y tem and their behaviour are revi ited. In ection 3 patial and temporal re nement are introduced. In ection 4 type for graph tran formation y tem and the exten ion and re triction con truction a ociated with type morphi m are revi ited. Finally in ection 5 the re ult of the previou ection are put together to obtain the re ult we con ider u eful for application . Full proof and further example can be found in the technical report [GPS97a,GPS97b].
2
Graph Transformation Systems
In thi ection we briefly review the tandard de nition and fact of graph tran formation y tem . A raph G = (N E src tar ) i given by a et N of node , a et E of edge , and function src tar : E N that a ign ource and target node to each edge. Thu graph are unlabeled directed graph that may G0 i given have multiple edge and loop . A raph morphism f = (fN fE ) : G 0 0 0 N and fE : E E uch that src fE = fN src and by function fN : N
Spatial and Temporal Re nement of Typed Graph Transformation Systems
555
tar 0 fE = fN tar . With identitie and compo ition being de ned component wi e thi de ne the category Graph. l
r
A raph transformation rule p = (L − K − R) i given by a left graph L, that i matched to the actual tate graph when the rule i applied, a right graph R by which the occurrence of L i replaced, and a pan L K R, given by a gluing graph K and graph morphi m to L and R. The pan expre e which item of L are related to which item of R. Intuitively, item related in thi way are pre erved when the rule i applied, and item in L − K are deleted. p0 i given by graph morphi m A rule morphism mp = (mpL mpK mpR ) : p 0 0 L , mpK : K K , and mpR : R R0 , that commute with l and l0 , mpL : L 0 0 and r and r re pectively, i.e. mpL l = l mpK and mpR r = r0 mpK . With component wi e identitie and compo ition thi de ne the category Rule. The amal amation of two rule w.r.t. a common ubrule i their pu hout in Rule. A raph transformation system G = (P ) i given by a et P of name , that i con idered a it ignature, and a mapping : P Rule that a ign to each name a rule, thu pecifying the behaviour. A morphism of raph transformation P 0 between the et of rule name systems, f : G G0 i a mapping f : P 0 0 f = . With compo ition and identity that i compatible with and , i.e. inherited from Set , thi de ne the category GTS. Since Graph and Rule are (i omorphic to) functor categorie to Set and GTS i a comma category to Set all three categorie are cocomplete. Given a graph tran formation y tem G = (P ) a direct derivation p m : G H over G from a graph G via a rule p and a matching morphi m m : L G i a pair (p S), where p P , S i a double pu hout diagram L
l o
m
(po)
G
r
K
/
k
h
(po)
o
l
R
D
/
r l
r
H
in Graph, and (p) = (L − K − R). G i called the input, and H the H over G output of p m : G H. A derivation p1 m1 ; ; pn mn : G pn and matching morphi m m1 mn i from a graph G via rule p1 a equence of direct derivation over G, uch that the output of the i’th direct derivation i the input of the (i+1)’ t direct derivation. The et of all derivation over G i denoted Der (G). U ing amalgamated rule for derivation allow to pre cribe ynchronized derivation . The expre ive power of amalgamated rule i in general higher than equential compo ition, ee [BFH87]. For a derivation with an amalgamated rule q we u e the notation q n : G H. Note that q i a rule here, wherea p in p m : G H i a rule name. The et of all derivation over G with amalgamated rule i denoted ADer(G). Con idering Der (G) a the behaviour of a graph tran formation y tem, H morphi m f : G G0 pre erve behaviour. I.e., for each derivation d : G ; pn mn ) in Der (G) there i a derivation f (d) : G with d = (p1 m1 ; ; f (pn ) mn ). The ame hold for H in Der(G0 ), where f (d) = (f (p1 ) m1 ; ADer (G).
556
Martin Gro e Rhode et al.
Untyped Re nements A mentioned in the introduction a re nement of a graph tran formation y tem i given by a mapping that a ociate with each rule name an in truction how to implement the a ociated rule a a compo ition of rule of the re ning y tem. In a patial re nement thi compo ition i an amalgamation, in a temporal re nement a equence. De nition 1 (Re nement Instructions). Let G = (P ) be a raph transformation system. A patial re nement in truction si on G is de ned by: pk ( (pi )
si = (p1
mij
mij
− rij −
(pj ))1i<jk ) mij
mij
pk P , rij Rule and (pi ) − rij − (pj ) for 1 i < j k where p1 is a span of morphisms in Rule. pk on G is a strin of sort A temporal re nement in truction ti = p1 pk P , such that Ri = Li+1 for i 1 k − 1 if (pj ) = names p1 Kj Rj ). (Lj The sets of spatial re nement instructions and temporal re nement instructions on G are denoted SRI (G) and TRI (G) respectively. The rule result(si) of a spatial re nement instruction si is de ned as the colimit in Rule of the dia ram iven by all spans of si with their adjacent pk is iven rules. The result of a temporal re nement instruction ti = p1 l r by result(ti) = (L1 − K − Rk ), where K is the limit of the dia ram L1
l1 o
K1
r1 /
in Graph, and l : K
R1 = L2
l2 o
L1 and r : K
lk
r2
K2
/
Kk
o
rk /
Rk
Rk are the correspondin projections.
De nition 2 (Re nement Morphisms). Let G = (P ) and G0 = (P 0 0 ) be two raph transformation systems. A patial (temporal) re nement morphi m ref : G G0 is a mappin from the set of rule names P to the set of spatial (temporal) re nement instructions SRI (G0 ) (resp. TRI (G0 )) such that, for p P , result(ref (p)) = (p) . G0 are equivalent Two re nement morphisms ref : G G0 and ref 0 : G 0 if, for all p P , result(ref (p)) = result(ref (p)) in Rule. From thi de nition follow immediately that any two re nement morphi m G0 are equivalent. ref : G G0 and ref 0 : G Example 1 (Asynchronous Communication). Con ider an a ynchronou communication of agent P and Q, with writing and reading acce to a common channel c. Agent P hold a value a, that it end to Q. Thu the ab tract view of the communication i asynch-com : __ __ _ _ _ a a Q Q _ _ ___ P TTTT P TTTT __ TT jjjjjj TT jjjjjj o
'&%$ !"#
()*+ /.-,
'&%$ !"#
()*+ /.-,
4
4
+3
*
c
*
c
/
Spatial and Temporal Re nement of Typed Graph Transformation Systems
Re ned into send :
557
intermediate tep thi communication would look a follow . ___ _ _ a Q P SSS P S __ SSS kkkkkk Q ___ SS_SS_S kkkkkk c a c __ o
'&%$ !"#
()*+ /.-,
'&%$ !"#
()*+ /.-,
5
5
+3
)
)
/
transmit :
Q P S ___ SS_SS_S kkkkkk a c __
P
()*+ /.-,
'&%$ !"#
'&%$ !"#
5
+3
)
receive :
P
'&%$ !"#
Q SSSS SS k_kk_kkk___ c a __
P
'&%$ !"#
5
/
()*+ /.-, 5
/
()*+ /.-,
)
SSSS kQ SS k kkkk __ c _ _ ___ a )
/
+3
__ a Q _ _ ___ SSSS SS kkkkkk c ()*+ /.-,
/
5
)
Fir t P end a to c, then a i tran mitted from the input port of c to it output port, where Q can receive it. The patial and temporal re nement relation are tran itive. Compo ition of re nement morphi m are con tructed via pullback and pu hout re pectively ([GPS97b]). Thu it cannot be expected that compo ition i trictly a ociative. Moreover, it i impo ible to obtain pu hout on thi level, that were required for horizontal compo ition of module . Thi i due to the fact that a re nement of a ingle rule may have arbitrary many component rule , that may be connected in many way . Thu a common re nement of two given one , that were required to con truct a pu hout, doe not exi t. Therefore we ab tract from the concretely given re nement in truction at thi point, and proceed with existence of patial re nement alone. De nition 3 (Cate ories of Re nements). The patial (temporal) re nement category SR (resp. TR ) has raph transformation systems as objects and equivalence classes of spatial (temporal) re nements as morphism. Since all diagram in the e categorie commute, all colimit of re nement exi t. They can be con tructed a di joint union (i.e. coproducts) of the rule name et of the component and the induced mapping to the rule . Note that the diagram of morphi m on the underlying et of name of a colimit diagram in SR or TR need not commute. Proposition 1 (Colimits of Re nements). The cate ories SR and TR have colimits. A mentioned in the introduction pu hout of inclu ion morphi m and patial re nement are required for the horizontal compo ition of module . The obviou embedding of morphi m of graph tran formation y tem into the renement categorie yield a more intuitive way to con truct a pu hout of (the G1 and a patial re neembedding of) an injective GTS morphi m f : G0 G2 . In thi ca e the et of name of the pu hout can ment morphi m sr : G0 in fact be taken a a pu hout in Set with the induced mapping to the rule , thu it al o commute . Since patial re nement u e amalgamation a re ning y tem mu t be able to u e amalgamated rule . Thi i reflected in the pre ervation propertie for the two kind of re nement .
558
Martin Gro e Rhode et al.
Theorem 1 (Preservation of Behaviour). Let sr : G G0 be a spatial re nement morphism of raph transformation systems. For each derivation d : G H with d = (p1 m1 ; ; pn mn ) in Der (G) there is an amal amated ; qn mn ) and qi = derivation d : G H in ADer (G0 ), where d = (q1 m1 ; result (sr (pi )). Let G0 be a raph transformation system with injective rules, i.e. for each l
r
P 0 the raph morphisms li0 ri0 of 0 (p0i ) = (L0i i− Ki0 − i Ri0 ) rule name p0 are injective, and tr : G G0 be a temporal re nement morphism. Then for ; pn mn ) in Der(G) there is a each derivation d : G H with d = (p1 m1 ; H in Der (G0 ), where d0 = (p011 m11 ; ; p0nkn mnkn ) and derivation d0 : G p0ini for i = 1 n. tr (pi ) = p0i1
4
Typed Graph Transformation Systems
In [CMR96] typed graph have been introduced a a technical mean for the con truction of graph proce e . Thi typing, however, may al o be con idered a a tructuring mean for graph tran formation y tem in the u ual en e of typing. Morphi m and re nement of graph tran formation y tem with type graph a tructuring mean have been introduced in [CH95,HCEL96,Rib96]. De nition 4 (Cate ories of Typed Graphs and Typed Rules). Given a raph TG, a TG typed graph is a raph morphism : G TG, and a TG typed graph morphi m k : h is a raph morphism with h k = . This de nes the cate ory GraphT G . The cate ory RuleT G of TG typed rules is iven by TG typed raph spans and morphisms, as for untyped rules. De nition 5 (Retypin , For etful Functor and Free Functor). Let f : TG T G0 be a raph morphism. f induces a backward retyping functor f < : GraphT G , f < ( 0 ) = and f < (k 0 : 0 h0 ) = k : h by GraphT G pullbacks and mediatin morphisms as in the followin dia ram, H z z k zz h zz zz
/
z k zzz z z zz
=
G D DD DD DD D TG !
H0
/
=
h G0 D DD DD DD D T G0 f !
/
and a forward retyping functor f > : GraphT G h) = k by composition. and f > (k :
GraphT G , f > ( ) = f
Forward and backward retyping functor are left and right adjoint , i.e. for GraphT G . Moreover, each f : T G T G0 we have f > f < : GraphT G Cat, and backward retyping i a forward retyping i a functor > : Graph
Spatial and Temporal Re nement of Typed Graph Transformation Systems
559
p eudo functor < : Graph Catop , i.e. (id T G )< = id raphT G and (e f )< = f < e< . Typing a graph tran formation y tem mean to de ne a type y tem a a type graph T G, and have all rule typed w.r.t. T G. De nition 6 (Typed Graph Transformation System). A typed graph tran formation y tem TG = (T G P ) consists of a type raph T G, a set of rule names P , and a mappin :P RuleT G , associatin with each rule name its T G typed rule. A morphi m of typed graph tran formation y tem mu t r t of all relate their type y tem , i.e. it mu t contain a type graph homomorphi m. Forward and backward retyping then induce tran lation to compare the rule of both y tem . In general, however, compatibility with the forgetful functor (backward retyping) i too weak to pre erve derivation . De nition 7. A morphi m of typed graph tran formation y tem , f = TG0 is iven by a mappin fP : P P 0 between the sets of (fP fT G ) : TG T G0 , such that rule names and an injective type raph morphism fT G : T G > 0 fT G ( (p)) = (fP (p)) for all p P . Typed graph tran formation y tem and morphi m form a category, called TGTS. Proposition 2 (Colimits). The cate ory TGTS has colimits. The pre ervation theorem for morphi m of typed graph tran formation y tem compare the behaviour of the y tem again in both direction . Each derivation of the r t y tem give ri e to a corre ponding derivation in the econd y tem, and the forgetful image of the derivation coincide with the original one. Theorem 2 (Preservation of Behaviour). Let f = (fP fT G ) : H with d = TG TG0 be a TGTS morphism. For each derivation d : G ; pn mn ) in Der (TG) there is a derivation f (d) : fT>G (G) fT>G (H) (p1 m1 ; > > 0 ; f (pn ) fT G (mn )). Furthermore in Der (TG ), where f (d) = (f (p1 ) fT G (m1 ); fT>G (H)) = (d : G H). f < (f (d) : fT>G (G)
5
Typed Re nements
Having de ned re nement and typing we are now in a po ition to combine the re ult and obtain the con truction that we con ider appropriate for the module concept di cu ed in the introduction, and other application . In the following de nition the et TySRI (G0 ) and TyTRI (G0 ) of typed spatial and temporal re nement instructions are given by replacing all rule by TG 0 typed rule . Their results are the corre ponding con truction in RuleT G .
560
Martin Gro e Rhode et al.
De nition 8 (Typed Re nements). Let TG = (T G P ) and TG0 = (T G0 P 0 0 ) be typed raph transformation systems. A typed patial (temporal) TG0 is iven by a mappin r : P re nement morphi m tr = (r fT G ) : TG TyTRI (G0 )) and an injective type raph morphism TySRI (G0 ), (resp. r : P T G0 , such that result(r (p)) = fT>G ( (p)) for all p P . fT G : T G TG0 Theorem 3 (Preservation of Behaviour). Let ref = (r fT G ) : TG be a typed re nement. For each derivation d : G H with d = (p1 m1 ; ; fT>G (H) over pn mn ) in Der (TG) there is a derivation ref (d) : fT>G (G) > > 0 Der (TG ), where ref (d) = (q1 fT G (m1 ); ; qn fT G (mn )) and qi = result(r(pi )). fT>G (H)) = (d : G H). Furthermore fTG (G) Example 2. The channel u ed for the a ynchronou communication of agent P and Q in example 1 hould be con idered a an internal communication infra tructure for the group that contain P and Q, and hould not be vi ible from the out ide. With the type graph for the ab tract y tem (left) and the re ned y tem (right) __ _ _ ___ T_TTTTT_TTTT_ _ _jj j_j__ __ TT jj
/
4
/
j
*
t
(that we implicitely already u ed in example 1) we obtain a vi ible (ab tract) behaviour the rule __ _ _ _ __ a a Q Q _ _ ___ P P __ o
'&%$ !"#
()*+ /.-,
+3
'&%$ !"#
()*+ /.-,
/
which i given by the backward retyping along the type inclu ion of the rule asynch-com. Then the rule send, transmit, and receive given in example 1, together with rule to connect and di connect agent P and Q via channel c, form a typed temporal re nement of thi ab tract behaviour, u ing the internal communication channel.
6
Conclusion
In thi paper we have tarted the inve tigation of re nement of graph tran formation y tem . For two ca e we have hown how the e can be de ned in a categorical framework. The background ha been the u e of re nement morphi m a relation between the interface and the body of a graph tran formation module, imilar to algebraic peci cation module . The pattern ha been the ame in both ca e , and the inve tigation of further po ibilitie of re nement, a e.g. the combination of temporal and patial re nement a di cu ed here, would al o pur ue thi pattern. Fir t the hape of the re nement in truction i de ned, ba ing on operation of rule like amalgamation and equential compo ition. It mu t be hown then, that the e re nement in truction can be compo ed vertically in order to obtain tran itivity of re nement and to allow for a categorical treatment. The latter proceed by taking equivalence cla e
Spatial and Temporal Re nement of Typed Graph Transformation Systems
561
of re nement morphi m , i.e. a pre order of re nement relation hip i con idered. Thi reflect the fact that the vertical compo ition in mo t ca e i not a ociative, and pu hout do not exi t. However, pa ing to the ab tract level of exi tence of re nement in tead of concrete re nement con truction yield the framework for the inve tigation and general formulation of further propertie , like the exi tence of pu hout for the general ca e, and the pecial ca e of pu hout of a re nement with an inclu ion morphi m. Thi particular re ult i e pecially important for the application to graph tran formation module compoition, ince it corre pond to the compo ition of module via their export and import interface .
References BEP87. BFH87. CEL+ 96.
CH95.
CMR96. Ehr79.
EM90.
GPS97a.
GPS97b.
HCEL96. Par96.
Rib96. Roz97.
E.K. Blum, H. Ehri , and F. Parisi-Presicce. Al ebraic speci cation of modules and their basic interconnections. JCSS, 34(2-3):293 339, 1987. P. B¨ ohm, H.-R. Fonio, and A. Habel. Amal amation of raph transformations: a synchronization mechanism. JCSS, 34:377 408, 1987. A. Corradini, H. Ehri , M. L¨ owe, U. Montanari, and J. Padber . The cateory of typed raph rammars and its adjunctions with cate ories of derivations. In 5th Int. Workshop on Graph Grammars and their Application to Computer Science, Williamsbur ’94, Sprin er LNCS 1073, pa es 240 256. 1996. A. Corradini and R. Heckel. A compositional approach to structurin and re nement of typed raph rammars. Proc. of SEGRAGRA’95 Graph Rewritin and Computation , Electronic Notes of TCS, 2, 1995. http://www.elsev er.nl/locate/entcs/volume2.html . A. Corradini, U. Montanari, and F. Rossi. Graph processes. Fundamenta Informaticae, 26(3,4):241 266, 1996. H. Ehri . Introduction to the al ebraic theory of raph rammars. In V. Claus, H. Ehri , and G. Rozenber , editors, 1st Graph Grammar Workshop Sprin er LNCS 73, pa es 1 69. 1979. H. Ehri and B. Mahr. Fundamentals of Al ebraic Speci cation 2: Module Speci cations and Constraints, volume 21 of EATCS Mono raphs on Theoretical Computer Science. Sprin er Verla , Berlin, 1990. M. Gro e Rhode, F. Parisi-Presicce, and M. Simeoni. Concrete spatial renement constructions for raph transformation systems. Technical Report 97-10, Universita di Roma La Sapienza, 1997. M. Gro e Rhode, F. Parisi-Presicce, and M. Simeoni. Spatial and temporal re nement of typed raph transformation systems. Technical Report 97-11, Universita di Roma La Sapienza, 1997. R. Heckel, A. Corradini, H. Ehri , and M. L¨ owe. Horizontal and vertical structurin of typed raph transformation systems. MSCS, pa es 1 35, 1996. F. Parisi-Presicce. Transformation of raph rammars. In 5th Int. Workshop on Graph Grammars and their Application to Computer Science, Williamsbur ’94, Sprin er LNCS 1073, 1996. L. Ribeiro. Parallel Composition and Unfoldin Semantics of Graph Grammars. PhD thesis, TU Berlin, 1996. G. Rozenber , editor. Handbook of Graph Grammars and Computin by Graph Transformations, Volume 1: Foundations. World Scienti c Publishin , 1997.
Approximatin Maximum Independent Sets in Uniform Hyper raphs? Thomas Hofmeis er and Hanno Lefmann LS Informa ik 2, Universi ¨ a Dor mund, D-44221 Dor mund, Germany hofme st,lefmann @Ls2.cs.un -dortmund.de
Abs rac . We consider he problems of approxima ing he independence number and he chroma ic number of k-uniform hypergraphs on n ver ices. For xed k 2, we describe for bo h problems polynomial ime approxima ion algori hms wi h approxima ion ra ios O(n (log (k−1) n)2 ). This ex ends resul s of Boppana and Halldorsson [5] who showed for he case of graphs ha an approxima ion ra io of O(n (log n)2 ) can be achieved in polynomial ime. On he o her hand, assuming N P = ZP P , here are no polynomial ime algori hms for he independence number and he chroma ic number of k-uniform hypergraphs wi h approxima ion ra io of n1− for any xed > 0.
1
Introduction
For a graph G = (V E) wi h ver ex se V and edge se E [V ]2 , a subse I V is called independent, if G con ains no edges on I. The independence number (G) is he size of a larges independen se . Compu ing an independen se I wi h I = (G) is an NP-hard problem. Therefore, polynomial ime approxima ion algori hms for his problem have been inves iga ed, cf. [1], [9]. For an op imiza ion ins ance I, le OP T (I) deno e he value of an op imal solu ion and A(I) he solu ion found by an algori ion ra io AR(n) of n hm A. The approxima o
T (In ) A(In ) where he maximum is algori hm A is de ned by maxIn OP A(In ) OP T (In ) aken over all ins ances In of inpu size n (e.g., graphs on n ver ices). A greedy s ra egy for compu ing independen se s was s udied by Halldorsson and Radhakrishnan [11] and approxima ion ra ios in erms of he average degree d = 2 E V and he maximum degree of a graph on V = n ver ices were derived, namely, AR(n) (d + 2) 2 and AR(n) ( + 2) 3, respec ively. For arbi rary graphs on n ver ices an approxima ion ra io of O(n (log n)2 ) can be achieved in polynomial ime as was shown by Boppana and Halldorsson [5]. They also showed ha in graphs G on n ver ices wi h (G) n k+m, where k is a xed in eger, one can nd in polynomial ime an independen se of size
This research was suppor ed by he Deu sche Forschungsgemeinschaf as par of he Collabora ive Research Cen er Compu a ional In elligence (SFB 531). Par of his work was done during his au hor’s visi a Humbold -Universi ¨ a zu Berlin. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 562 570, 1998. c Sprin er-Verla Berlin Heidelber 1998
Approxima ing Maximum Independen Se s in Uniform Hypergraphs
563
a leas Ω(m1 (k−1) ). This was improved by Alon and Kahale [2] who applied semide ni e programming in conjunc ion wi h he Lovasz -number (G) of a graph G and hey showed ha if (G) n k + m, hen an independen se of size a leas Ω(m3 (k+1) ) can be found in randomized polynomial ime. As far as inapproximabili y is concerned, he la es resul is due o Has ad [12] who showed ha for each xed > 0, here can be no polynomial ime algori hm wi h approxima ion ra io of n1 2− , unless P =N P . Under he assump ion ha N P = ZP P , he same holds even for an approxima ion ra io of n1− . The corresponding problem for hypergraphs has been less s udied. A hyperraph H = (V E) is given by a se V of ver ices and a se E of edges where E V for every edge E E. A hypergraph is called k-uniform if E = k for every edge E E. A subse I V is called independent if I con ains no edges from H, i.e., E I for each edge E E. The size of a larges independen se in H is called he independence number of H and is deno ed by (H). Some resul s are concerned wi h nding in parallel a maximal independen se in a hypergraph, see e.g. [6], [15]. However, he sizes of maximal independen se s can be much smaller han he size of a maximum independen se . In erms of he average degree dk−1 := k E V of a k-uniform hypergraph H = (V E), derandomizing a probabilis ic argumen of Spencer [19] yields a linear ime algori hm wi h approxima ion ra io O(d). However, d can be as large as Ω(n). We consider here he problem of approxima ing maximum independen se s in arbi rary k-uniform hypergraphs. I urns ou ha one can achieve in polynomial ime an approxima ion ra io of O(n (log(k−1) n)2 ). Here, log(k) n deno es he k-fold i era ed logari hm log log n. By a simple reduc ion from he case of graphs, inapproximabili y resul s of he order Ω(n1− ) for each given > 0 can be derived. We also consider he problem of coloring he ver ices of a k-uniform hypergraph H wi h as few colors as possible. Call a coloring of he ver ices of H proper if no edge is monochroma ic. If he ver ices of H can be colored properly wi h l colors, hen H is called l-colorable. Le (H) deno e he chromatic number of a hypergraph H, i.e., he minimum l such ha H is l-colorable. For graphs, de ermining he chroma ic number is an NP-hard problem. The curren ly bes known polynomial ime algori hm for coloring a 3-colorable graph on n ver ices is by Blum and Karger [4] and uses O(n3 14 ) colors. For graphs wi h larger chroma ic number, he curren ly bes known resul is due o Karger, Mo wani and Sudan [14] who showed ha graphs on n ver ices wi h maximum degree can be colored in polynomial ime using a mos min O( 1−2 (G) ) O(n1−3 ( (G)+1) ) colors. For arbi rary graphs on n ver ices, he rs polynomial ime approximaion algori hm for graph coloring was given by Johnson [13] wi h an approxima ion ra io of O(n log n). This was improved by Wigderson in [20] o O(n (log log n log n)2 ) and fur her by Boppana and Halldorsson [5] o O(n (log n)2 ). The la es improvemen is by Halldorsson [10] who gave a polynomial ime algori hm o achieve an approxima ion ra io of O(n (log log n)2 (log n)3 ). Recen ly,
564
Thomas Hofmeis er and Hanno Lefmann
Feige and Kilian [8] showed ha assuming N P = ZP P , given any xed > 0, here is no polynomial ime algori hm which approxima es he chroma ic number wi hin a fac or O(n1− ). For he corresponding problem of coloring hypergraphs no much is known. In fac , jus recen ly he rs polynomial ime algori hm capable of coloring a 2-colorable k-uniform hypergraph on n ver ices wi h a sublinear number of colors was given by Kelsen, Mahajan and Ramesh [16]. Their algori hm uses O(n1−1 k (log n)1−1 k ) colors. Our algori hm works no only for 2-colorable k-uniform hypergraphs, bu for k-uniform hypergraphs wi hou any res ric ions on heir chroma ic number. I achieves an approxima ion ra io of O(n (log(k−1) n)2 ) for he chroma ic number. Thus, if applied o k uniform hypergraphs which are l colorable for a xed l > 0, our algori hm also only uses a sublinear number of colors, hough in he case l = 2, he bound from [16] is be er. Never heless, i seems ha he echnique from [16] can no be applied o hypergraphs wi h chroma ic number a leas 3. By applying semide ni e programming, i was shown in [16] ha 2-colorable hypergraphs on n ver ices where each edge con ains a mos 3 ver ices can be colored wi h a mos O(n2 9 (log n)17 8 ) colors in polynomial ime. The assump ion on 2-colorabili y was essen ial in hose argumen s. The semide ni e programming approach does no seem o be applicable for k-uniform hypergraphs where k 4, cf. [16]. Our approxima ion ra io O(n (log(k−1) n)2 ) is sublinear, bu s ill ra her large. Again, one should no e ha under he assump ion N P =ZP P , he following holds: For each xed > 0, here is no polynomial ime algori hm which approxima es he chroma ic number of hypergraphs on n ver ices wi h approxima ion ra io O(n1− ).
2
An Approximation Al orithm
In addi ion o he no ions given in he in roduc ion, we also use he no ion of a clique in a k-uniform hypergraphwhich is a comple e subhypergraph of H, i.e., con ains, say, l ver ices and all kl edges. No e ha an approxima ion algori hm for compu ing independen se s can always be applied o he complemen of a hypergraph o ob ain an approxima ion algori hm for cliques, wi h he same approxima ion ra io. The case k=2, i.e., graphs, has been rea ed by Boppana and Halldorsson [5], who described he following algori hm 2 Ramsey. Al orithm 2 Ramsey: Transform he graph in o a binary ree, i s ver ices corresponding o he ver ices of he graph, in such a way ha for each ver ex v he se of i s lef descendan s con ains exac ly he non-neighbours of v. Given any pa h from he roo o a leaf in his ree, he leaf and he se of ver ices on his pa h which have an ou going righ edge, form a clique C. Likewise, he leaf and he ver ices wi h an ou going lef edge form an independen se I. Compu e a pa h wi h he larges number of righ edges and a pa h wi h he larges number
Approxima ing Maximum Independen Se s in Uniform Hypergraphs
565
of lef edges and he corresponding se s C and I. A Ramsey- ype argumen shows: Theorem 1. [5] In raphs on n vertices, al orithm 2 Ramsey returns an independent set I and a clique C such that I C 1 4 (log n)2 . Our algori hm uses a ransforma ion which cons ruc s (k−1)-uniform hypergraphs from k-uniform hypergraphs: and k uniform hyperDe nition 1. Let 2 < k, and let H and Hk be raphs, respectively, both with the same totally ordered vertex set V . Then, Hk is the ordered canonical extension of H whenever the followin vk with v1 < 0. Proof. By induc ion. For k = 2, see Theorem 1. In he induc ion s ep, algori hm (k−1) Ramsey is applied o a hypergraph wi h Ω((log n)1 (k−1) ) ver ices. We hen apply he induc ion hypo hesis. Algori hm k Ramsey guaran ees ha we ei her nd a reasonable large clique or an independen se in a given k-uniform hypergraph. If however he hypergraph con ains no large clique, hen he size of an independen se should be large. The idea, as in [5], is o remove independen se s. In s ep i, algori hm k Ramsey is applied o a graph on ni ver ices and reurns a clique Ci and an independen se Ii . Remove he ver ices from Ii and all inciden edges from he hypergraph. This is repea ed un il no ver ex is remaining. Le C be he clique Ci of maximum cardinali y. No e ha he removed COL, yield a proper coloring of he original hyindependen se s Ii , i = 1 pergraph. The following lemma was used in [5] for graphs, i also holds for hypergraphs and an implici proof of i can be found in [18], Sec ion 1.4. Lemma 2. If in k-uniform hyper raphs on i vertices one can nd an independent set of size at least f (i), where f (i) is non-decreasin and f (i) > 0, then one
Approxima ing Maximum Independen Se s in Uniform Hypergraphs
567
can nd Pna proper colorin for every k-uniform hyper raph on n vertices with at most i=1 1 f (i) colors. c (log(k−1) ni )2 , i.e., f (i) The re urned se s Ci and Ii sa isfy Ci Ii (k−1) 2 i) C . By Lemma 2, we have (for n n0 and some cons an max 1 c (log D > 0): n X C n C 1 c0 COL D + (k−1) 2 c (log i) (log(k−1) n)2 i=D
Le cl(H) be he size of a larges clique in H. Since cl(H) one ob ains cl(H) k−1
(H)
COL
c0
n (log
C
(k−1)
n)2
c0
n cl(H) (log
(k−1)
n)2
(k−1) ck n (log
(H), (H)
(k−1)
n)2
From his chain of inequali ies, one ob ains (simul aneously) he upper bounds for cl(H) C as well as for COL (H) expressed in he following heorem: Theorem 3. Let k 2 be xed. There is a polynomial time al orithm which approximates the independence number (H), the clique number cl(H) and the chromatic number (H) of a k-uniform hyper raph H on n vertices with approximation ratio O(n (log(k−1) n)2 ). One migh consider he ques ion how well he algori hm performs on random hypergraphs. The answer is ha unfor una ely, he approxima ion ra io which we can guaran ee is only sligh ly be er han he rivial algori hms which pick one ver ex as he independen se and color he graph wi h n colors. Consider for example random k-uniform hypergraphs on n ver ices where edges are presen wi h probabili y 1 2 independen ly of each o her. For such a random hyper1 graph, one can show ha almos always cl(H) (H) = (1 + o(1)) (k! log n) k−1 . 1 Moreover, we almos always have (H) = (1 + o(1)) n (k! log n) k−1 . This can be seen by using similar echniques as in he case of graphs, cf. [3]. cl(H) 0 n C 1 cl(H) COL c we Considering he produc (k−1) 2 C (H) C (H) (log n) see ha i is almos always bounded by ! 2 (log n) k−1 O (log(k−1) n)2 No e ha for k = 2, his is a cons an , while for k 3, i is growing wi h n. The rivial s ra egies on he o her hand almos always lead o a produc of he approxima ion ra ios of O((log n)2 (k−1) ).
3
Excludin l-Cliques
Very of en, he approxima ion ra io can be improved if we know ha our inpu graphs are aken from a cer ain subse of all graphs only. A par icularly
568
Thomas Hofmeis er and Hanno Lefmann
in eres ing subse which has of en been considered in he li era ure is he se of all graphs which for some xed l 2 do no con ain any clique on l ver ices ( l clique ). Boppana and Halldorsson observed in [5] ha if a graph G on n ver ices does no con ain any l-clique for some l 2 log n, hen G con ains an independen se of size a leas Ω(l n1 (l−1) ), and for xed l 2 such an independen se can be found in polynomial ime. They also showed ha his implies ha in graphs G on n ver ices wi h (G) n l + m, where l 3 is xed, one can always nd in polynomial ime an independen se of size a leas Ω(m1 (l−1) ). If we are given a hypergraph wi hou l cliques, hen he reduc ion echnique used in he algori hm k Ramsey also guaran ees ha he graph o which we apply 2 Ramsey is wi hou l cliques, hence ins ead of using 2 Ramsey in he nal s ep of k Ramsey, any of he procedures men ioned above can also be used. As an example, one ob ains Theorem 4. In every k uniform hyper raph on n vertices which does not contain any l cliques (for some xed l), one can nd in polynomial time an independent set of size at least Ω((log(k−2) n)1 (2(l−1)) ).
4
Ne ative Results
The nega ive resul s follow from a s raigh forward ransforma ion from he nega ive resul s for graphs. We lis hose resul s here for comple eness. They follow from considering he unordered canonical ex ensions. Theorem 5. Let k 2 be a xed inte er and let >0 be xed. One cannot approximate in polynomial time the size of a maximum independent set (or clique) in kuniform hyper raphs on n vertices within a factor of O(n1− ), unless N P =ZP P . Proof. For k=2, he asser ion holds by he resul of Has ad [12]. Now assume k > 2 and ha we had an approxima ion algori hm wi h ra io O(n1− ) for k-uniform hypergraphs. Cons ruc an approxima ion algori hm for graphs wi h he same ra io as follows: Firs , we check in polynomial ime O(nk ) whe her he independence number of a graph G is smaller han k. If his is he case, hen we can compu e he independence number exac ly. O herwise, le Hk be he k-uniform hypergraph which is he unordered canonical ex ension of he graph G. Then, G and Hk have he same independence number. We apply a similar ransforma ion in he case of he chroma ic number: Theorem 6. Let k 2 be a xed inte er and let > 0 be xed. One cannot approximate in polynomial time the chromatic number of a k-uniform hyper raph on n vertices within a factor of O(n1− ), unless N P = ZP P . Proof. For k=2, he asser ion holds by he resul of Feige and Kilian [8]. For k 3, consider he unordered canonical ex ension Hk of a given graph G. Then, (Hk )
(G)
(k − 1)
(Hk )
Approxima ing Maximum Independen Se s in Uniform Hypergraphs
569
The rs inequali y holds since every proper coloring of G is a proper coloring of Hk and for he second inequali y observe ha if we have a coloring of Hk wi h Cl , hen for each class Ci wi h Ci k, we can color he color classes C1 corresponding ver ices of G wi h he same color. If, however Ci < k, hen we color he corresponding ver ices in G by Ci dis inc colors. An approxima ion algori hm for k-uniform hypergraphs can hence be urned in o an algori hm for graphs wi h an approxima ion ra io which is only worse by a mos he cons an fac or (k−1).
5
Final Remarks and Questions
Can he approxima ion algori hm from [10] replace algori hm 2 Ramsey as he underlying procedure in an approxima ion algori hm for k uniform hypergraphs? Is i possible o improve (wi h respec o polynomial ime algori hms) he approxima ion ra io o o(n (log(k−1) n)2 ) for he coloring problem or he maximum independen se problem for k-uniform hypergraphs? I migh also be in eres ing o inves iga e he approxima ion ra io wi h respec o polynomial ime algori hms for he maximum independen se problem for l clique free graphs or hypergraphs on n ver ices. The algori hm from [5] can be seen as an approxima ion algori hm for graphs wi h approxima ion ra io 1 of O(n1− l−1 ) which shows ha he inapproximabili y resul s from [12] do no carry over o his case, when l is xed.
References 1. N. Alon, L. Babai and A. I ai, A Fast and Simple andomized Parallel Algorithm for the Maximal Independent Set Problem, Journal of Algori hms 7, 1986, 567583. 2. N. Alon and N. Kahale, Approximating the Independence Number via the Function, Ma hema ical Programming, o appear. 3. N. Alon and J. Spencer, The Probabilistic Method, Wiley & Sons, NY, 1992. 4. A. Blum and D. Karger, An O(n3 14 )-coloring Algorithm for 3-colorable Graphs, Informa ion Processing Le ers 61, 1997, 49-53. 5. R. Boppana and M. Halldorsson, Approximating Maximum Independent Sets by Excluding Subgraphs, BIT 32, 1992, 180-196, also in: Proc. 2nd Scandin. Workshop on Algori hm Theory (SWAT), Springer, LNCS 447, 1990, 13-25. 6. E. Dahlhaus, M. Karpinski and P. Kelsen, An E cient Parallel Algorithm for Computing a Maximal Independent Set in a Hypergraph of Dimension 3, Informa ion Processing Le ers 42, 1992, 309-313. 7. P. Erd¨ os and R. Rado, Combinatorial Theorems on Classi cation of Subsets of a Given Set, Proceedings London Ma hema ical Socie y 2, 1952, 417-439. 8. U. Feige and J. Kilian, Zero Knowledge and the Chromatic Number, Proc. 11 h IEEE Conference on Compu a ional Complexi y, 1996, 278-287. 9. M. Goldberg and T. Spencer, An E cient Parallel Algorithm that Finds Independent Sets of Guaranteed Size, SIAM Journal of Discre e Ma h. 6, 1993, 443-459.
570
Thomas Hofmeis er and Hanno Lefmann
10. M. Halldorsson, A Still Better Performance Guarantee for Approximate Graph Coloring, Informa ion Processing Le ers 45, 1993, 19-23. 11. M. Halldorsson and J. Radhakrishnan, Greed is Good: Approximating Independent Sets in Sparse and Bounded-degree Graphs, Proc. 26 h ACM Symposium on he Theory of Compu ing (STOC), 1994, 439-448. 12. J. Has ad, Clique is Hard to Approximate Within n1− , Proc. 37 h IEEE Symposium on Founda ions of Compu er Science (FOCS), 1996, 627-636. 13. D. S. Johnson, Worst Case Behaviour of Graph Coloring Algorithms, Proc. 5 h Sou heas ern Conference on Combina orics, Graph Theory and Compu ing, Congressus Numeran ium X, 1974, 513-527. 14. D. Karger, R. Mo wani and M. Sudan, Approximate Graph Coloring by Semidefinite Programming, Proc. 35 h IEEE Symposium on Founda ions of Compu er Science (FOCS), 1994, 2-13. 15. P. Kelsen, On the Parallel Complexity of Computing a Maximal Independent Set in a Hypergraph, Proc. 24 h ACM Symposium on he Theory of Compu ing (STOC), 1992, 339-350. 16. P. Kelsen, S. Mahajan and H. Ramesh, Approximate Hypergraph Coloring, Proc. 6 h Scandin. Workshop on Algori hm Theory (SWAT), Springer, 1996, 41-52. 17. J. Nese ril, amsey Theory, in: Handbook of Combina orics Vol II, eds. R. L. Graham, M. Gr¨ o schel and L. Lovasz, Nor h-Holland, 1995, 1331-1403. 18. R. Mo wani, P. Raghavan, andomized Algorithms, Cambridge Univ. Press, 1995. 19. J. Spencer, Turan’s Theorem for k-Graphs, Discre e Ma h. 2, 1972, 183 186. 20. A. Wigderson, Improving the Performance Guarantee for Approximate Graph Coloring, Journal of he ACM 30, 1983, 729-735.
Representin Hyper-Graphs by Re ular Lan ua es ? Salvatore La Torre and Mar herita Napoli Dipartimento di Informatica ed Applicazioni Universita de li Studi di Salerno 84081 Baronissi, Italy. sallat,napol @d a.un sa. t
Abstract. A new compact representation of in nite raphs is investiated. Re ular lan ua es are used to represent labelled hyper- raphs which can be also multi- raphs. Our approach is similar to that used by A. Ehrenfeucht et al. for nite raphs since we use a re ular pre x-free lan ua e as set of vertices, but it di ers from that in the representation of the ed es. In fact, we use a re ular lan ua e for the ed es instead of a nite loop-free raph. Our approach preserves the nite representation of the ed es and of the correspondin labellin mappin and yields to a hi her expressive power. As a matter of fact, our raph representation results to be more powerful than the equational raphs introduced by B. Courcelle. Moreover, the use of a re ular pre x-free lan ua e to represent the vertices allows ( xed the lan ua e of the ed es) to express a raph by a labelled tree. The advanta e to represent raphs by trees is that properties of raphs can be veri ed by induction on the tree, often leadin to e cient al orithms.
1
Introduction
A lot of e orts have been made in the last decade to obtain small speci cations of raphs. A well supported idea has been that of representin raphs by expressions or trees [1,6,12]. Recently, A. Ehrenfeucht et al. [9] have introduced a representation of nite raphs by nite pre x-free lan ua es of strin s whose alphabets have themselves a raph structure. The strin s of the lan ua e represent the vertices and there is an ed e between two vertices if and only if the pair of the rst two symbols, at which the two correspondin strin s di er, is an ed e in the alphabet. Another way to specify nite raphs was introduced by M. Bauderon et al. [3]. They de ne nite hyper- raphs in a compositional way, that is they use raph expressions built from basic ones by applications of simple raph operations correspondin to hyper-ed e replacements. Systems of raph equations with this ?
Partially supported by the M.U.R.S.T. in the framework of Tecniche formali per la speci ca, l’analisi, la veri ca, la sintesi e la trasformazione di sistemi software project.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 571 579, 1998. c Sprin er-Verla Berlin Heidelber 1998
572
Salvatore La Torre and Mar herita Napoli
kind of expressions provide a way to de ne in nite hyper- raphs, called equational raphs [7]. In the recent paper [2], the class of simple equational hyperraphs is extended by allowin vertex replacement. In this way a characterization is obtained of the class of simple raphs de ned in [5] whose monadic secondorder theory is decidable and strictly containin the simple raphs amon the equational raphs. In this paper we introduce a new way of specifyin in nite hyper- raphs throu h re ular lan ua es. Our approach is similar to that used in [9] for nite raphs since we use a re ular pre x-free lan ua e as set of vertices, but it di ers from that in the representation of the ed es. Actually, the nite loop-free raphs turn out to be not su cient when the oal is the representation of nite raphs. We use a re ular lan ua e P for the ed es instead of a nite loop-free raph with the meanin that the raph has an ed e linkin the ordered sequence of xk if their su x belon s to P . Intuitively, by su x we mean vertices x1 xk by cuttin their lon est common pre x, if the tuple obtained from x1 there exists i and j such that x = xj , and the tuple itself, otherwise. Our approach preserves the nite representation of the (possibly in nite) raphs and allows to specify a meanin ful class of in nite hyper- raphs. As a matter of fact, our raph representation results to be more powerful than the equational raphs introduced by B. Courcelle. In a similar way as in [9], the use of re ular lan ua es allows us to inherit concepts and ideas from the formal lan ua e theory and to use them for raphs. In particular we are interested in the relationships between lan ua e operations and raph operations: the relevance of this investi ation is due to the possibility of performin raph trasformations by manipulatin the re ular lan ua es used for the raph representation. Moreover, the use of a re ular pre x-free lan ua e to represent the vertices allows ( xed the lan ua e of the ed es) to express a raph by a labelled tree. The advanta e to represent raphs by trees is that properties of raphs can be veri ed by induction on the tree, often leadin to e cient al orithms [4,8,10,13]. In section 2 we ive some preliminary de nitions. In section 3 the raph representation is introduced, some properties of this representation are shown and the relationships between raph substitution and lan ua e concatenation is stated. The main result of section 4 is the proof that the raph representation introduced in section 3 is more expressive than the equational raphs de ned in [7]. The paper ends with some conclusions in section 5, where we remark the di erences between our approach and that in [9] and mention some directions for future works. Due to the lack of space the proofs are omitted, for a full version of the paper see the URL [14].
2
Preliminaries
In this section we ive some basic de nitions. We suppose that the reader is familiar with the basic concepts of the formal lan ua es (see for example [11]). We only recall that L is said pre x-free if for every x y L it holds that x is
Representin Hyper-Graphs by Re ular Lan ua es
573
not a pre x of y and remark that in this paper with Ln we denote the Cartesian Ln when L1 = = Ln = L. In the followin we will use N product L1 to denote the set of the positive inte ers. A multiset ms over a nite set is a mappin from into N 0 and ms(a) is said the multiplicity of a for each a . The set of the multisets over a iven nite set is denoted by M S( ). We denote with 0 the multiset mappin a into 0 for each a . Given two multisets ms and ms0 , we say that ms ms0 if ms(a) ms0 (a) for every into a and we denote with ms + ms0 the multiset which maps each a for each a , then with ms− ms0 we ms(a)+ ms0 (a). Moreover, if ms0 (a) = denote the multiset which maps a into ms(a) − ms0 (a), if ms(a) − ms0 (a) 0, and 0, otherwise. Obviously, +k = k+ = + = −k = holds. Sometimes in the followin we denote the multisets which are also sets with the usual set notation. In this paper we cope with directed labelled hyper- raphs which can be also multi- raphs, that is they can have many hyper-ed es linkin any ordered tuple of vertices. We consider a directed labelled hyper-ed e as iven by a sequence of vk ) and a multiset ms, with the meanin that there are exactly vertices (v1 ms(a) directed hyper-ed es linkin v1 vk and labelled by a . We denote vk ) a) and we say that an hyper-ed e is incident to each of them with ((v1 vk that it links. Note that we are not interested in each of the vertices v1 distin uishin amon hyper-ed es linkin the same tuple of vertices and havin the same label. Labels are taken from a ranked alphabet, that is a pair ( ) where is an alphabet and is a mappin from into N . De nition 1. Let ( ) be a ranked alphabet. A labelled n-hyper- raph is a tuple = (V E lab src) where: − V is the set of the vertices; 1 M S( ) is a total mappin such that, for every a and − lab : k=1 V k vk V , lab(v1 vk )(a) > 0 implies (a) = k; v1 1 k vk ) lab(v1 vk ) = 0 . − E = (v1 k=1 V − src is a total mappin from 1 n into V . The mappin src de nes a sequence of n vertices which is called the sequence of sources of G and the inte er n is the type of . From now on, we will consider only labelled n-hyper- raphs, so we use the word n- raph (or simply raph, when the speci cation of n is useless ) for a labelled n-hyper- raph and its hyper-ed es are simply called ed es. A sub raph of a raph = (V E lab src) is a raph 0 = (V 0 E 0 lab0 src0 ) such that V 0 V , lab0 (v1 vk ) lab(v1 vk ) for 0 vk ) and src (i) = src(i). In this case we say that 0 . Let each (v1 = (V E lab src) be a raph and be an equivalence relation on V . We de ne the quotient raph, denoted by , the raph (V E lab src ) [vk ]) = v0 2[vi ] lab(v1 vk ) and where: V = [v] v V , lab ([v1 ] i = (V E lab src ) for i = 1 2 be raphs, an src (i) = [src(i)]. Let V2 is a bijective mappin such that: isomorphism between raphs : V1 vk ) = lab2 ( (v1 ) (vk )) and src2 (i) = (src1 (i)). Finally we lab1 (v1 de ne the limit of a succession of nite raphs by referrin to the intuitive
574
Salvatore La Torre and Mar herita Napoli
concept of limit. For the sake of simplicity we omit a formal de nition and we use the intuitive concept of arbitrarily close . Then, let n n>0 be a succession of nite raphs, we say that a (possibly in nite) raph, denoted by limn n , is the limit for n of the succession n n>0 if it is always possible to nd a raph in the succession which is arbitrarily close to limn n . Given a succession of nite raphs n n>0 such that n = (Vn En labn src) and n n+1 , we have that limn n = ( n>0 Vn n>0 En limn labn src). Note that labn n>0 is a monotonic succession of functions, then its limit always exists. Moreover, it is easy to show the followin result. Lemma 1. Given two successions of raphs n n>0 and 0 each n > 0 n is isomorphic to n0 , n n+1 and n 0 isomorphic to limn n .
3
0 n n>0 such that for 0 n+1 , then limn n is
Graph Representation over a Re ular Lan ua e of Tuples
In this section we introduce a new way of representin raphs which is obtained from the representation introduced in [9]. The new representation is as powerful as the previous one when nite raphs are dealt with. The main di erence between them concerns the representation of the ed es. In fact, we use a re ular lan ua e instead of a nite loop-free raph. Moreover, our approach preserves some a reeable features of the previous one and the nite representation of the ed es and of the correspondin labellin mappin also for in nite hyper- raphs. To introduce the new raph representation we de ne rst a notion of reularity for lan ua es of tuples which we call parallel re ularity. Let be an xk , we denote with M atrix (x1 xk ) the alphabet, and x1 a1 k ] [ah 1 ah k ] over the alphabet ( )k where: word [a1 1 − h = max xj j = 1 k ; ajxj j j and ar j = for xj < r h. − for j = 1 k: xj = a1 j a k ] of the word M atrix (x1 xk ) is the That is the i-th symbol [a 1 xk . ordered tuple of the i-th symbols of the words x1 De nition 2. Let be an alphabet, and s be a positive inte er. Then, s ( ) is said to be re ular in parallel if the lan ua e M atrix (P ) = P =1 xk ) (x1 xk ) P is re ular. M atrix (x1 Then, we formalize the notion of su x of a tuple of strin s. be a pre x-free lan ua e. For De nition 3. Let be an alphabet and L xk we de ne the su x of the k-tuple (x1 xk ), denoted by each x1 xk ), as the k-tuple (a1 y1 ak yk ), if x = xa y , for a , and suf (x1 xk ), otherwise. j m such that aj = am , and as the k-tuple (x1
xk by cuttin Intuitively, by su x we mean the tuple obtained from x1 their lon est common pre x, if there exists i and j such that x = xj , and the xk ) = (x1 xk ) whenever tuple itself, otherwise. The fact that suf (x1
Representin Hyper-Graphs by Re ular Lan ua es
575
x1 = = xk allows us to represent the raphs with loops. In fact, we represent a raph with a pre x-free lan ua e (the vertices), a set of tuples P and a labellin xk if the function with the meanin that there is an ed e with vertices x1 xk ) belon s to P and the labellin function maps this su x of the tuple (x1 su x in a multiset which di ers from 0. Formally: be a De nition 4. Let be an alphabet, ( ) be a ranked alphabet, L 1 m j ( ) be such that P = P where P re ular pre x-free lan ua e, P j=1 =1 1 is re ular in parallel for all i = 1 m, lab be a total mappin from j=1 ( )j into M S( ) such that lab(P ) = 1 for all i = 1 m and src be a total mappin from 1 n into L. We denote with ra(L P lab src) the n- raph = (V E lab0 src) where: − V = L; 1 M S( ) is the mappin de ned as lab0 (x1 xk ) = − lab0 : j=1 ( )j xk )) if suf (x1 xk ) P and lab0 (x1 xk ) = 0, otherlab(suf (x1 wise. In this case we say that the raph is representable by re ular lan ua es.
Example 1. Let = (N E lab src) be such that: 1. E = (2i − 1 2i + 1) i N (2i − 1 2i) i N (2i + 2 2i) i N , 2. lab(2i − 1 2i + 1) = a lab(2i − 1 2i) = b and lab(2i + 2 2i) = c and 3. src is the sequence 1 2. We show that is representable by re ular lan ua es. In fact, consider the raph 0 = ra(1 (v + y + w + z) ((v y) (v w) (w z) (z y) (w 1w) (1z z) lab0 src0 ) where lab0 (v y) = lab0 (w z) = b , lab0 (v w) = lab0 (w 1w) = a , lab0 (z y) = lab0 (1z z) = c and src0 de nes the sequence v y (see Fi ure 1). Then, it easy to see that 0 is isomorphic to .
11 00 00 11 00 11 00 11 00 11 11 00 00 00 11 1010 11 0 1 0 1 00 11 00 11 00 11 00 11 0 1 0 1 00 11 11 00 11 00 11 00 v
a
b
w
a
b
y
c
1w
a
b
z
c
1z
11w
b
c
11z
Fi . 1. A raphical representation of
0
.
By usin this new raph representation, as for the raph representation introduced in [9], the followin substitution of raphs corresponds to a lan ua e concatenation. De nition 5. Let = (V E lab src) be an n- raph and v = (Vv Ev labv srcv ) be an nv - raph, for v V . Then, the raph obtained by substitutin v for v in 0 0 0 0 , denoted by [v v ]v2V , is the raph (V E lab src ) where:
576
Salvatore La Torre and Mar herita Napoli
− V 0 = v2V v Vv ; xk yk ) is equal to labx1 (y1 yk ), if x1 = − lab0 (x1 y1 xk ), otherwise; equal to lab(x1 sn where s = x srcxi (1) − src0 de nes the sequence s1 xn is the sequence de ned by src. and x1
= xk , and is x srcxi (nxi )
This raph substitution is said uniform if we substitute a unique raph for every vertex v. The followin theorem states that uniform raph substitution corresponds to lan ua e concatenation in the representation of the raph. Theorem 1. Let = ra(L P lab src) and x = ra(Lx P lab srcx ), for x 0 0 0 L. It holds that [x x ]x2L = ra(L P lab src ), where L is the lan ua e 00 0 L then L = LL00 . x2L x Lx . Moreover, if L = Lx for every x Another interestin property of our notation is related to the continuity of the function ra. In fact, the followin result holds. Theorem 2. Let ra(Ln Pn labn src) n>0 be a succession of raphs such that Ln Ln+1 , Pn Pn+1 and labn labn+1 . Then, limn ra(Ln Pn labn src) = ra( n>0 Ln n>0 Pn limn labn src).
4
Equational Graphs vs. Graphs Representable by Re ular Lan ua es
In this section we rst briefly recall the notion of the equational raphs as de ned in [7] and then we compare the expressive power of the equational raphs with our representation. In the followin , some operations on raphs are de ned. Let = (V E lab src) and 0 = (V 0 E 0 lab0 src0 ) be respectively an n- raph and an n0 - raph such that 0 , V V 0 = and E E 0 = . The disjoint union of and 0 , denoted by 0 0 0 0 00 00 is de ned as the (n + n )- raph (V V E E lab lab src ) where src is the mappin de nin the sequence which is the concatenation of the sequences m 1 n be a total de ned by src and src0 . Moreover, let f : 1 mappin , the source rede nition map f is de ned as f ( ) = (V E lab src f ) where is the usual composition of functions. Let be an equivalence relation is de ned as ( ) = , where over 1 n , the source fusion map is the quotient raph with respect to the equivalence relation on V de ned as: v = v 0 or (v = src(i) v 0 = src(j) and (i j) ) v v0 vn0 ) be a tuple belon in to E Finally, let ( ) be a ranked alphabet, (v1 vn0 )(a) = 0. The raph, which is obtained and a be such that lab(v1 vn0 ) a) in and which we denote as by substitutin 0 for an ed e ((v1 0 vn0 ) a) ], is the raph 00 where: [((v1 0 ) with f : 1 n 1 n + n0 de ned as f (i) = i for − 00 = f ( wk ) = lab(w1 wk ) i=1 n and = (V E lab src) where lab(w1 wk ) = (v1 vn0 ) and lab(v1 vn0 ) = lab(v1 vn0 ) − a ; for (w1 − is an equivalence relation on V V 0 de ned as: v = v 0 or (v = v and v 0 = src0 (i)) v v0
Representin Hyper-Graphs by Re ular Lan ua es
577
Rou hly speakin , the substitution of 0 for the ed e ((v1 vn0 ) a) in convn0 ) and labelled sists of the deletion in of an ed e linkin the tuple (v1 by a and the luin of 0 and by the fusion of the sources of 0 and the vertices vn0 ), in the order. Note that the raph is the result of the deletion in (v1 vn0 ) and labelled by a in . of one ed e amon those linkin (v1 The above raph substitution can be eneralized by de nin a substitution of all the ed es which have a iven label. Thus, for i = 1 m let be an n - raph be such that (a ) = n . We denote with [a1 am and a 1 m] for every ed e the raph which is obtained by simultaneously substitutin which is labelled by a in . The next de nition ives the notion of raph expression. De nition 6. Let ( ) be a ranked alphabet. The raph expressions are de ned as: − a is a raph expression of type (a) for all a ; − n is a raph expression of type n for all n N 0 ; − e1 e2 is a raph expression of type n1 + n2 for all the raph expressions e1 of type n1 and e2 of type n2 ; − f (e) is a raph expression of type m for all the raph expressions e of type n and for all the total mappin s f : 1 m 1 n ; − (e) is a raph expression of type n for all the raph expressions e of type n and for all the equivalence relations on 1 n . and f is obtained by the meanin of The meanin of the operators the correspondin operators on raphs. In fact, to each raph expression e of type n it is possible to associate a n- raph, denoted with val(e), which represent the evaluation of the expression e. By considerin some unknowns in the set , the raph equations and the systems of raph equations are de ned in an obvious way. A solution to such a system is a tuple of raph expressions whose depth (i.e. the nestin of the operators) may be in nite. An evaluation mappin exists associatin an unique (up to an isomorphism) raph to an in nite raph expression and we denote it a ain with val. More details can be found in [7]. um = em in the Let S be the system of raph equations u1 = e1 um . If S satis es the Greibach condition (that none of the unknowns u1 Um ) and the e is equal to an unknown), then S has a unique solution (U1 val(Um )) are said equational raphs [7]. We elements of the m-tuple (val(U1 ) p can de ne, for each h, a re ular per x-free lan ua e L, a set P = =1 P where each P is re ular in parallel , a labellin mappin lab such that lab(P ) = 1 and src, in such a way that val(Uh ) is equal to ra(L P lab src). So we have the followin theorem. Theorem 3. Every equational raph is representable by re ular lan ua es. The proof of the above theorem ives us a way to obtain a description of every equational raph. For example, if we consider the system u = f ( (c a b u)) where is (1 3) (2 6) (4 7) (5 8) and f : 1 2 1 2 3 4 5 6 7 8 is de ned as f (i) = i for i = 1 2, then the raph obtained in that way is the one in Fi ure 1.
578
Salvatore La Torre and Mar herita Napoli
The vice-versa of the above theorem is not true. In fact there is a class of raphs which are representable by re ular lan ua es but are not equational. Theorem 4. Let = (V E lab src) be a raph with a sub raph 0 = (V 0 E 0 V 0 there exists lab0 src0 ) such that: a) V 0 is in nite and b) for every v v 0 0 0 vk ) E such that (v1 vk ) is incident on v and v . Then, is not (v1 equational. Corollary 1. The class of the equational raphs is strictly included in the class of the raphs representable by re ular lan ua es.
5
Conclusions
In this paper we have introduced a new way of specifyin in nite hyper- raphs throu h re ular lan ua es and have compared the class of representable raphs with the equational raphs considered in [7]. Our approach is similar to that used in [9] where the authors introduce a new representation of nite raphs. They use nite pre x-free lan ua es of strin s on alphabets which have themselves a raph structure. The strin s of the lan ua e represent the vertices of the raph and there is an ed e between two vertices if and only if the pair of the rst two symbols, at which the two correspondin strin s di er, is an ed e in the alphabet. One can prove that in the above approach the class of in nite raphs which can be represented throu h an in nite pre x-free re ular lan ua e and a nite loopfree raph contains only raphs such that either they have an in nite de ree (that is, there is a vertex with in nite ed es incident on it) or they are the disjoint union of in nitely many maximal connected sub raphs. So, when the oal is the representation of in nite hyper- raphs, that approach turns out to be strictly less powerful than the one presented in this paper. Two interestin aspects in [9] are the use of pre x-free lan ua es, which can be viewed as trees so that this approch presents the advanta es of representin raphs by trees, and the relationships between raph operations and lan ua e operations (and then operations on the representation itself). Our aim was that of preservin these advanta es also when in nite raphs are dealt with. We have also proved that the class of the equational raphs is strictly contained in the class of raphs that we have considered. For the case of simple raphs, this result could also be derived by comparin the simple raphs in the class considered in our paper with the raphs de nedin [5]. However, our direct proof provides a way to obtain the representation by re ular lan ua es of a iven equational hyper- raph. By introducin some constraints on P and lab (such as, the number of di erent multisets ), it is possible to determine some hierarchies whose investi ation could ive interestin hints on the use of this representation. Another worthwhile aspect to study concerns the comparisons amon the di erent classes of hyper- raphs de ned by di erent choices of the set P . It would be interestin to check how the relationships amon di erent P ’s reflect on the correspondin classes. Acknowled ment We thank the referees for helpful comments and for pointin us to the paper of Caucal.
Representin Hyper-Graphs by Re ular Lan ua es
579
References 1. S. Arnbor , J. La er ren and D. Seese, Easy problems for tree-decomposable raphs , Journal of Al orithms, 12 (1991) 308 340. 2. K. Barthelmann, When Can an Equational Simple Graph Be Generated by Hypered e Replacement? , this Volume. 3. M. Bauderon and B. Courcelle, Graph Expressions and Graph Rewritin s , Mathematical System Theory, 20 (1987) 83 127. 4. H. L. Bodlaender and R. H. M¨ ohrin , The pathwidth and treewidth of co raphs , SIAM Journal on Discrete Mathematics, 6 (2) (1993) 181 188. 5. D. Caucal, On in nite transition raphs havin a decidable monadic theory , Proc. of ICALP’96, (F. M. auf der Heide and B. Monien, Eds.), Lecture Notes in Computer Science, vol. 1099 (1996) 194 205. 6. D. G. Corneil, H. Lerchs and L. Stuart Burlin ham, Complement reducible raphs , Discrete Applied Mathematics, (1981) 163 174. 7. B. Courcelle, The monadic second-order lo ic of raphs. II. In nite raphs of bounded width , Mathematical System Theory, 21 (1989) 187 121. 8. B. Courcelle, The monadic second-order lo ic of raphs. III. Tree-width, forbidden minors and complexity issues , RAIRO Inform. Theor. Appl., 26 (1992) 257 286. 9. A. Ehrenfeucht, J. En elfriet and G. Rozenber , Finite Lan ua es for the Representation of Finite Graphs , Journal of Computer and System Sciences, 52 (1996) 170 184. 10. J. En elfriet, T. Harju, A. Proskurowski and G. Rozenber , Characterization and Complexity of Uniformly Non-primitive Labeled 2-Structures , Theoretical Computer Science, 154 (1996) 247 282. 11. J. Hopcroft and J. Ullman, Introduction to Automata Theory, Formal Lan ua es and Computation Addison-Wesley Series in Computer Science (Addison-Wesley Publishin Company) (1979). 12. N. Robertson and P. Seymour, Graph Minors. II Al orithmic aspects of treewidth , Journal of Al orithms, 7 (1986) 309 322. 13. J. Valdez, R. E. Tarjan and E. Lawler, The reco nition of series parallel di raphs , SIAM Journal of Computin , 11 (1982) 298 313. 14. www.unisa.it/papers/ .ps. z
Improved Time and Space Hierarchies of One-Tape O -Line TMs Kazuo Iwama1 and Chuzo Iwamoto2 1
2
Kyoto University, Kyoto 606-8501, Japan wama@ku s.kyoto-u.ac.jp Hiroshima University, Hi ashi-Hiroshima 739-8527, Japan
[email protected] rosh ma-u.ac.jp
Abstract. This paper presents improved time and space hierarchies of one-tape o -line Turin Machines (TMs), which have a sin le worktape and a two-way input tape: (i) For any time-constructible functions 1 (n) t1 (n) log log t1 (n) and 2 (n) such that inf n = 0 and 1 (n) = nO(1) , there t2 (n) is a lan ua e which can be accepted by a 2 (n)-time TM, but not by any 1 (n)-time TM. (ii) For any space-constructible function s(n) and positive constant , there is a lan ua e which can be accepted in space s(n) + lo s(n) + (2 + ) lo lo s(n) by a TM with two worktape-symbols, but not in space s(n) by any TM with the same worktape-symbols. The (lo lo 1 (n))- ap in (i) substantially improves the Hartmanis and Stearns’ (lo 1 (n))- ap which survived more than 30 years.
1
Introduction
Althou h there are many di erent TM models, most standard ones are one-tape TMs and multitape TMs. As for the one-tape model, it is most simple and its properties are relatively well known. However, it is not an appropriate model for contemporary complexity theory because it is too ine cient. A typical example is that one-tape TMs need Ω(n2 ) time to reco nize palindromes. On the other hand, multitape TMs, the most standard model for desi nin TM-al orithms, are so stron that it appears to be very hard to obtain ti ht complexity results. For example, no one has succeeded in obtainin non-linear lower-bounds for multitape TMs. This is the reason why many researchers have been payin attentions to the intermediate model called one-tape o -line TMs, which have one read-write worktape and a two-way input tape. This model no lon er su ers from trivial ine ciency like the one-tape TM. At the same time, it is no lon er too powerful to defeat any lower-bound proofs [2]. Actually, there is a hu e literature discussin computational complexities on this one-tape o -line TMs [1,2,11,12,13,14,15,16]. These results often provide knowled e for the extension to the multitape case. It is known that space complexities of one-tape o -line TMs coincide with those of two-worktape models, but time complexities do not. This can be seen in, for example: (i) If time-constructible functions t1 (n) and t2 (n) satisfy inf n!1 t1 (n)t2lo(n)t1 (n) = 0, then there is a lan ua e which is accepted by Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 580 588, 1998. c Sprin er-Verla Berlin Heidelber 1998
Improved Time and Space Hierarchies of One-Tape O -Line TMs
581
a t2 (n)-time TM, but not by any t1 (n)-time TM [8]. (ii) If space-constructible functions s1 (n) and s2 (n) satisfy inf n!1 ss12 (n) (n) = 0, then there is a lan ua e which is accepted by an s2 (n)-space TM, but not by any s1 (n)-space TM [7]. The space hierarchy (ii) is ti ht because of the linear speed-up theorem [7]; on the other hand, the time hierarchy (i) has a lar e, lo arithmic ap between t1 (n) and t2 (n) (no such ap exists for two-tape TMs [4]). This fact mi ht be the reason why some researchers think one-tape o -line TMs are not a proper model to discuss time complexity. However, is this claim, i.e., no ap for space but a lar e ap for time, really true? In this paper, we ive a partial ne ative answer, i.e., there does exist a kind of ap for space, and the time ap can be si ni cantly reduced. For the time hierarchy, we show that the above lo t1 (n) ap can be replaced by lo lo t1 (n). We also show that a lo s(n) additive- ap exists for the space hierarchy if we x the number of tape symbols. More precisely, it is shown that for each inte er m 2 and for any small constant > 0, there is a lan ua e which can be accepted in space s(n) + lo m s(n) + (2 + ) lo m lo m s(n) by a TM with m symbols, but not by any TM in space s(n) with the same m symbols. Note that if we can use a xed number of symbols, it appears to be hard to save, in eneral, more than a constant number of cells. Thus the additive lo arithm function is re arded as a ap. The best previous result is due to [10,19,20,22], where there still exists a constant multiplicative- ap. Both proofs are by standard dia onalization but based on several new ideas: For the time hierarchy, our new idea is to make a novel use of the paddin sequence. For the space hierarchy, our result fully depends on the haltin spacebounded computations by Sipser [21]. The rst concrete lower bound ar ument for one-tape o -line TMs is iven by Dietzfelbin er, Maass, and Schnit er [2]; it was shown that transposin an l l-matrix with elements of bit len th p needs Ω(n l ((lo l) p)1 2 ) time. Dietzfelbin er [1] also showed that one-tape o -line TMs can copy a strin of len th s across d cells in O(d + sd lo (min n d )) time, and that the same model needs Ω(sd lo (min n d )) time for the same task if d s lo n. For TMs with one-way input tape, Maass [15] presented the quadratic lower bound for the simulation of two-tape TMs by one-tape ones. Li, Lon pre, and Vitanyi [12,13] presented the time lower bounds for the simulation of queue, stacks, and tapes by one worktape with one-way input. Several papers presented simulation results amon deterministic, nondeterministic and alternatin one-tape o -line TMs (e. ., [11,14]). Amon others, Maass and Schorr [16] showed that (t(n))2 3 lo 2 t(n)-time one-tape o -line TMs with twoalternation can simulate deterministic t(n)-time ones if t(n) n3 . Ge ert [5] 2 showed that for each constant k, nondeterministic t(n) n time can be simulated by nondeterministic t(n) k time even if the number of symbols is two. For multitape TMs, the followin separation results are known. Dymond and Tompa [3] showed that DTIME(t(n)) 0 ATIME(t(n)), and Paul et al. [17] showed DTIME(n) 0 NTIME(n), but it is unknown whether this separation can be extended to DTIME(nk ) 0 ? NTIME(nk ) for k > 1. Furthermore, Gupta [6]
582
Kazuo Iwama and Chuzo Iwamoto
proved DTIME(t(n)) 0 2 (t(n)), where 2 (t(n)) is the set of lan ua es accepted by t(n)-time multitape TMs with two-alternation.
2
Models, Main Theorems, and Related Results
Our TM model is the so-called one-tape o -line deterministic TM, which has one read-only input tape whose both ends are delimited by special end-markers and one semi-in nite read-write worktape whose left end is also delimited by a special end-marker. The worktape symbols of space-bounded (resp. time-bounded) TMs are only 0 and 1 (resp. 0 1 2 ). All space-hierarchy results in this paper can easily be extended to the ( xed) m-symbol case. We call a function t(n) timeconstructible if there is some t(n)-time bounded one-tape o -line TM which iven a strin of n ones produces the binary representation of t(n) (this de nition is based on [18]). Similarly, if there is an s(n)-space TM eneratin s(n) ones, we call s(n) space-constructible. Theorem 1. Suppose that t1 (n) and t2 (n) are time-constructible functions such lo t1 (n) = 0 and t1 (n) = nO(1) . Then, there is a lanthat inf n!1 t1 (n) lot2 (n) ua e L 0 1 which can be accepted by a t2 (n)-time TM, but not by any t1 (n)-time TM. If the number of read-write tapes is xed k 2, then it is known [4] that t2 (n)-time TMs with k tapes are stron er than t1 (n)-time TMs with k tapes for any time-constructible function t2 (n) not bounded by O(t1 (n)). For k = 1, however, no pro ress has been made since 1965 [8]. Theorem 2. Suppose that s(n) is an arbitrary space-constructible function. For any small constant > 0, there is a lan ua e L 0 1 which can be accepted in space s(n)+lo s(n)+(2+ ) lo lo s(n) by a TM T with two worktape-symbols, but not in space s(n) by any TM Tx with the same worktape-symbols, where T always halts but Tx may not halt. Since (s(n) + c)-space with two symbols can be simulated by s(n)-space with the same symbols [9,10], the additive term of lo s(n) + (2 + ) lo lo s(n) is re arded as a ap. The best results previously known [10] is that for any inte er 1 and rational constant 1 + , (1 + )cn -space TMs with m symbols are stron er than cn -space TMs with the same symbols. It should be noted that Theorem 2 can easily be extended to the m-symbol case, and that cn is a space-constructible function. Therefore, the above theorem improves the results of [10] in (i) narrowin the ap from multiplicative 1 + to additive lo s(n) and (ii) eneralizin the space-function s(n). The best results for eneral spaceconstructible functions are due to [19,20]; they showed that (2 + )s(n)-space is stron er than s(n)-space. Thus, our result also improves their results. In the case of linear s(n), the optimal result has been known; from the results in [22], s(n)space is stron er than s1 (n)-space if s(n) − s1 (n + 1) = O(1). The model in [22] is the same as [20] except that the worktape has a movable ri ht end-marker.
Improved Time and Space Hierarchies of One-Tape O -Line TMs
583
Remark 1. Our model is the same as [20]; namely, our TM is the simplest version of the TM in [20] (i.e., the number of tape symbols is two, and the number of worktape heads is one). On the other hand, the model de ned in [10] is sli htly di erent from our model. The TM in [10] has either a two-way in nite worktape or a one-way in nite worktape with no left end-marker. Our space-hierarchy theorem also holds for the same model as [10] if the additive term lo s(n) in Theorem 2 is replaced by 2 lo s(n). Hence, our result improves the hierarchy theorem in [10] on this no-end-marker model. The additive lo s(n) ap in Theorem 2 can be reduced if T may be an alternatin TM. This result su ests that alternatin TMs are stron er than deterministic TMs if the space is exactly the same. Theorem 3. Suppose that s(n) is an arbitrary space-constructible function, and (n) is an arbitrary function such that the strin 11 1 of len th (n) can be enerated by some s(n)-space TM. Then, for any slowly rowin function (n) = O(1), there is a lan ua e L 0 1 which can be accepted in space s(n) + (n) by an alternatin TM with two worktape-symbols, but not in space s(n) by any deterministic TM with two worktape-symbols. (The proof is a modi cation of that of Theorem 2. Omitted due to space limitations.)
Proof of Theorem 1 All lan ua es in this paper are over 0 1 . It is known that any TM can be encoded usin 0 and 1 by standard encodin , and that it can be checked in linear time whether the iven strin encodes a proper TM. Let Tx denote the TM whose encodin sequence is x. If x is not a proper encodin sequence, we re ard Tx as a TM acceptin as usual. The lan ua e L(t1 (n)) is de ned as x#y Tx does not accept input x within time t1 ( x ) , where # is a boundary strin not appearin b b b b 102 −1 is a paddin sequence. We call each 102 −1 in x, and y = 102 −1 102 −1 a len th-2b portion. The paddin sequence can easily be checked in O(n) time. It is obvious that any t1 (n)-time TM cannot accept L(t1 (n)). We rst construct a TM T acceptin L(t1 (x)) in time t2 (n) = O(t1 (n)(lo t1 (n))1 2 ) in Section 3.1, and then we improve it to t2 (n) = O(t1 (n) lo lo t1 (n)) in Section 3.2. 3.1
Simulation Usin Two Counters
We assume the worktape of TM T is divided into two tracks; track 1 is used for simulatin Tx ’s worktape and track 2 is for holdin counters. Track 2 is further divided into sub-tracks. If the worktape head of Tx is placed at the th cell, then the small counter of len th lo d is inserted at the position startin at the (c +1)st cell in track 2, where c is a constant dependin on Tx . We will x d and b later. Furthermore, the bi counter of len th lo t1 (n) is inserted at the (cd+1)st cell in track 2 from the ri ht end of the small counter. The small and bi counters count the numbers of steps from 0 up to d and up to t1 (n) d, respectively.
584
Kazuo Iwama and Chuzo Iwamoto
(Strictly speakin , the bi counter has len th lo (t1 (n) d), but the di erence between lo (t1 (n) d) and lo t1 (n) does not influence on the complexity in this case.) The encodin of Tx is included in a sub-track of the small counter. The bi counter is moved (at most) cd cells when the small one is moved d times. If we could use two read-write tapes, we can build a bucket on an extra read-write tape; i.e., when movin the bi counter, we put some contents of the bi counter into this bucket, move the head cd cells, and put the contents in the bucket back into the tape. Thus we need O(cd(lo t1 (n)) b) steps for d-step simulation (i.e., O(c(lo t1 (n)) b) overhead per step), where b is the bucket size. Note that we need lo t1 (n) overhead if we move the bi counter step-by-step. If c b 1, we can save a lot. Althou h our present model has no extra worktape for this bucket, we can still use this bucket by exploitin the input tape. Sta e 1: The t1 (n)-step simulation is divided into t1 (n) d time-se ments of len th d. In each time-se ment, T makes a d-step simulation of Tx usin the small counter. A sub-track of the small counter also contains the position s of the small counter itself from the ori inal position at the be innin of this timese ment. The small counter is always placed at the worktape-head position. The two counters do not collide because cd cells exist between them at the be innin of the time-se ment. T can make a d-step simulation in O(cd lo d) steps. Sta e 2: Suppose T has just nished a d-step simulation for one time-se ment and that the small counter (stored in the sub-track) moved cs cells to the ri ht durin this time-se ment (i.e., c(d − s) cells exist between the two counters). Then T moves the bi counter cs cells to the ri ht by extendin the idea in [1]. (1) T moves its input head to the leftmost 0 within the current len th-2b portion. Durin this task, T stores the ori inal position (within the len th-2b portion) of the input head into a sub-track in order that T can continue the dstep simulation of the next time-se ment. T stores the value s into the len th-2b portion in unary as the position of the input head. (Later, one can see 2b s.) T moves its worktape head to the leftmost cell of the bi counter. Usin the (unary) value s, T moves its worktape head to the (cs + 1)st cell from the left end of the bi counter, and T writes a marker there. The marker is required for indicatin the destination. We need O(cd) steps for this (1) because s d. (2) The bi counter is divided into (lo t1 (n)) b blocks of len th b. T moves every block cs cells to the ri ht usin a len th-2b portion as a unary counter. Note that the contents in each block of len th b can be stored in the len th-2b portion in unary. (In [1], the whole input tape is used as a unary counter, and thus the input head must o to the left end of the tape. Our TM T has unary counters which appear repeatedly in the whole area of the paddin sequence.) We need O(2b ) steps for storin (loadin ) a value into (from) a len th-2b portion, and O(cd) steps for movin the worktape head cd cells to the ri ht. Hence we need O((2b + cd)(lo t1 (n)) b) time for movin the bi counter. Finally, T moves its input head back to the ori inal position. Therefore, the time complexity for (1) and (2) is O (2b + cd)(lo t1 (n)) b . T repeats Sta es 1 and 2 until the value in the bi counter becomes t1 (n) d. Therefore, the time complexity becomes O cd lo d + (2b + cd)(lo t1 (n)) b
Improved Time and Space Hierarchies of One-Tape O -Line TMs
585
t1 (n) d . Durin the simulation, if Tx halts with an acceptin (rejectin ) state, T rejects x (accepts x). If Tx does not halt in the t1 (n) steps, T accepts x. We x b = (lo t1 (n))1 2 and lo d = (lo t1 (n))1 2 , and thus b and d satisfy 2b = O(d) and lo d = O((lo t1 (n)) b). Therefore, the above complexity can be written as O(ct1 (n)(lo t1 (n))1 2 ), by which t2 (n) is not bounded for any lar e constant c. Since the input strin must be pre xed by some TM, the function b must satisfy that n − 2b = O(1). Note that any polynomial t1 (n) satis es this condition. 3.2
Extension to the k-Counter Case
The discussion in the previous section allows us to make the followin observation. Suppose that we have a small counter of len th x and a bi counter of len th x. (i) The bi counter has to be moved once in 2x steps. The amount of movin distance is at most 2x . (ii) With the help of the paddin sequence, we can carry out this task in (2b + 2x ) x b steps. (iii) It appears to be optimal to set b = x (= the size of the small counter). Let C(x) be the cost (overhead per step) of manipulatin the bi counter to keep the number of steps with the help of the small counter. Then, this C(x) is shown as: o n 1 = min x C(x ) + 2 C(x) = min x C(x ) + x (2x + 2x ) 2 where 2x1 comes from (i), 2x is the cost for the movin distance and for the manipulation of the paddin sequence, and the nal is x b in (ii) that is equal to if we set b = x . Note that if we move the bi counter one cell every step, then C(x) = x obviously. x, then the solution of C(x) = One can verify that if we set = min x C( x) + 2 x is obviously C(x) = O( x), which is the result of Section 3.1. Now let us try to solve this equation by settin = 2 (n), where (n) is a slowly rowin function not bounded by O(1). Then one can easily see that the solution of C(x) = min x C(x ) + 2 satis es C(x) 2 lo x, which is C(x) = 4 (n) lo lo t1 (n) when the bi counter has len th x = lo t1 (n). Now we x (n) = t2 (n) (t1 (n) lo lo t1 (n)) and thus the time complexity for t1 (n)-step simulation is not bounded by O(t1 (n) lo lo t1 (n)). Finally, we must not for et one important thin , i.e., the paddin sequence. Recall that observation (ii) above assumes that the input head can encounter some unique mark within 2b steps re ardless of its initial position. In Section 3.1, it was enou h to put 1 at re ular intervals of len th 2b as this mark. This time, however, we need di erent marks at re ular intervals of len th 2 3 2x . Here is our solution to this problem. For j = 1 2 , we 2x 2x re ard the (2 −1 +2 (j−1))th cells of the input tape as the th track. Let 2l be the 2 2x . shortest interval. Then the above len th can be written as 2l 2 l 2 l −1 l is stored in the th The mark appearin at re ular intervals of len th 2 track. Thus, the complexity for the manipulation of the paddin sequence in the −1 −1 l l but 2 2 . Furthermore, a counter of len th x above (ii) is not 2b = 2
586
Kazuo Iwama and Chuzo Iwamoto +1
is moved once when the counter of len th x +1 is moved 2x times, and thus the amount of movin distance of the bi counter is calculated as 2 2 2x = 2x +x + 2x ( −1) . Therefore, 2x in (ii) should be 2x 2x ( −1) . These di erences do not influence on the time complexity in this case. T can verify that the paddin sequence has the above structure in O(n) time. T rst enerates a binary counter of len th lo n in the worktape. T then moves the input head to the leftmost cell of the paddin sequence. T ’s input head moves to the ri ht, while the value of the counter is increased one by one, doin both simultaneously. If the lowest −1 bits are all 0 and the th bit is 1, then the input head is placed on a cell in the th track. Furthermore, if the ( + 1)st throu h ( + −1 l)th bits are all 0 and the ( + −1 l + 1)st bit is 1, then T veri es that this cell contains the mark. This completes the proof. Paul [18] also uses many counters, and he succeeded in narrowin the ap to lo t1 (n) if the number of worktapes is xed k 2. However, it seems very hard to achieve such a small ap on our one-worktape model. The main disadvanta e is that storin value into the input tape in unary requires steps, while twoworktape model can store into an extra worktape in binary in lo steps.
4
Proof of Theorem 2
The lan ua e L(s(n)) is de ned as x#y TM Tx does not accept input x within space s( x ) , where y = 00 0. Obviously, any s(n)-space TM cannot accept L(s(n)). We construct a TM T acceptin L(s(n)) in space s(n) + (1 + ) lo s(n), which is improved to s(n) + lo s(n) + (2 + ) lo lo s(n) later. Let Tx0 be a TM satisfyin the followin conditions: Let z be an arbitrary strin of len th n. (i) Tx0 accepts z i Tx accepts z in space s(n). (ii) Tx0 uses at c lo s(n) + 2c cells re ardless of the space usa e of Tx , where c most s(n) + c−1 is some constant. (iii) The acceptin con uration of Tx0 is unique. We rst construct Tx0 , from which we will construct T that determines whether Tx accepts x. 4.1
Constructin Tx0
Tx0 works as follows: (i) Tx0 simulates an s(n)-space TM, say, Ts , which enerc lo s(n) + 2c. Tx0 ates 1s(n) , and (ii) Tx0 then simulates Tx in space s(n) + c−1 uses a binary counter and the purpose of (i) is to hold the value s(n) in it. (i) Tx0 enerates 1s(n) by simulatin Ts . Then, Tx0 constructs a binary counter, say, A, (of constant len th initially) havin value one at the position startin at the (s(n) + 1)st cell. Tx0 moves A one cell to the left and increases the value in A by one. Repeatin this procedure until A reaches the left end, the value in A becomes s(n). We need delimiters 1c at both ends of A, and 0 must be inserted at a re ular interval of c − 1 symbols in A so that 1c does not appear c lo s(n) + 2c. in it. Thus the len th of A is c−1 0 (ii) Tx simulates Tx , while Tx0 also updates A’s value and moves A accordin to the head position. Durin the simulation, if the value in A becomes less than 0 (which violates the space limit), then Tx0 halts in a rejectin state. If Tx halts in
Improved Time and Space Hierarchies of One-Tape O -Line TMs
587
an acceptin state (rejectin states), then Tx0 moves its worktape head and A to the left end and Tx0 halts in the unique acceptin state (rejectin states). The c lo s(n) + 2c. number of cells Tx0 uses is bounded by s(n) + c−1 4.2
Decidin Whether Tx Accepts x or Not
To decide if Tx accepts x, T simulates Tx0 instead of Tx . The simulation of Tx0 is similar to Section 4.1. T enerates two blocks, called B and C, of len th (n) at the left end of the worktape. Here, (n) = o(lo s(n)) may be an arbitrary function such that 1 (n) can be enerated in space s(n). As above, 1c is inserted at either end of each block, and 0 is inserted in B and C at re ular intervals of len th c − 1. We use B for keepin the encodin of Tx0 . We will use C later. Note that Tx0 may reject x by loopin . If T simulates Tx0 from the initial con uration to the nal one, T cannot know if Tx0 is loopin . Here, we implement Sipser’s method [21] on our model. Consider a nite directed raph such that each node is a con uration of Tx0 and an arc represents transition between two con urations. Since Tx0 is deterministic, the unique acceptin con uration, say, a, becomes the root of some tree. Tx0 accepts x i Tx0 ’s initial con uration belon s this tree. Thus, T performs a depth- rst search of the tree rooted at a. T accepts x i the initial con uration of Tx0 does not exist in the tree. To traverse all nodes in the tree, T must know (i) Tx0 ’s current con uration, say, c1 , and (ii) the next move function, say, , by which the previous con uration c2 has just been chan ed to the current con uration c1 . (i) Tx0 ’s input-head position, worktape head position, and symbols in the s(n) + (1 + ) lo s(n) cells are simulated as in Section 4.1. Tx0 ’s state is stored in block C. For (ii), we suppose that the encodin of Tx0 (in block B) is the concatenation of the next move functions, and that the encodin of any next move function is pre xed by 11. Then T can replace the rst two symbol 11 of the encodin of by 01. (a) Suppose the current con uration is c1 . By sweepin the concatenation of Tx0 ’s next move functions in B from left to ri ht, T nds a next move function, say, 1 , such that there is a con uration c2 which can be chan ed to c1 accordin to 1 . If such a 1 is found, T chan es Tx0 ’s con uration c1 back to c2 . If c2 is not the initial con uration, then T a ain applies procedure (a) to c2 . (b) If such a 0 1 is not found for c1 , T simply simulates the one-step move of Tx , by which c1 is chan ed to, say, c0 . Let 2 be the next move function which chan es c1 to c0 . Then, T applies the same procedure as (a) to c0 except that the sweep of the next move functions starts from 2 . 4.3
Improvin the Space Limitation
We only show the modi cations required to improve the space limitation. In c lo s(n) + 2c for an Section 4.1, we constructed Tx0 workin in space s(n) + c−1 0 arbitrary s(n)-space TM Tx . Here, we construct a Tx workin in space s(n) + 2c lo lo s(n) + 3c. In this section, we use A for the same purpose lo s(n) + c−1 as in Section 4.1, but 1c is not inserted at either end of A, and 0 is not inserted at re ular intervals of len th c − 1. The worktape head works just as in
588
Kazuo Iwama and Chuzo Iwamoto
Section 4.1. To reco nize the boundaries of A, two small counters are inserted at the worktape-head position. The small counters contain the head positions and h from the left and ri ht ends of A, respectively. The small counters are moved accordin to the head position. (Recall that the worktape head must always be inside A or the head must keep within a constant number of cells even if it oes out.) 1c is inserted at either end of the small counters, and 0 is inserted at re ular intervals of len th c − 1 only in the small counters. 2c lo lo s(n) + 3c. Hence Tx0 works in space Thus, the len th of A is lo s(n) + c−1 s(n) + lo s(n) + (2 + ) lo lo s(n).
References 1. M. Dietzfelbin er, The speed of copyin on one-tape o -line Turin machines, IPL (1989) 83 89. 2. M. Dietzfelbin er, W. Maass and G. Schnit er, The complexity of matrix transposition on one-tape o -line Turin machines, TCS 82 (1991) 113 129. 3. P.W. Dymond and M. Tompa, Speedups of deterministic machines by synchronous parallel machines, Proc. IEEE FOCS, 336 343, 1983. 4. M. F¨ urer, The ti ht deterministic time hierarchy, Proc. ACM STOC, 8 16, 1982. 5. V. Ge ert, A speed-up theorem without tape compression, TCS 118 (1993) 49 65. 6. S. Gupta, Alternatin time versus deterministic time: a separation, Proc. IEEE FOCS, 266 277, 1993. 7. J. Hartmanis, P.M. Lewis and R.E. Stearns, Classi cation of computations by time and memory requirements, Proc. IFIP Con ress, 266 277, 1965. 8. J. Hartmanis and R.E. Stearns, On the computational complexity of al orithms, Trans. Amer. Math. Soc. 117 (1965) 285 306. 9. O.H. Ibarra, A hierarchy theorem for polynomial-space reco nition, SIAM J. Comput. 3 (1974) 184 187. 10. O.H. Ibarra and S.K. Sahni, Hierarchies of Turin machines with restricted tape alphabet size, JCSS 11 (1975) 56 67. 11. O.H. Ibarra and S. Moran, Some time-space tradeo results concernin sin le-tape and o ine TM’s, SIAM J. Comput. 12 2 (1983) 388 394. 12. M. Li, L. Lon pre and P.M.B. Vitanyi, The power of the queue, SIAM J. Comput. 21 4 (1992) 697 712. 13. M. Li and P.M.B. Vitanyi, Tape versus queue and stacks: the lower bounds, Inform. and Comput. 78 (1988) 56 85. 14. M. Liskiewicz and K. Lorys, Fast simulations of time-bounded one-tape Turin machines by space-bounded ones, SIAM J. Comput. 19 3 (1990) 511 521. 15. W. Maass, Quadratic lower bounds for deterministic and nondeterministic one-tape Turin machines, Proc. IEEE FOCS, 401 408, 1984. 16. W. Maass and A. Schorr, Speed-up of Turin machines with one work tape and a two-way input tape, SIAM J. Comput. 16 1 (1987) 195 202. 17. W.J. Paul, N. Pippen er, E. Szemeredi, and W.T. Trotter, On determinism versus non-determinism and related problems, Proc. IEEE FOCS, 429 438, 1983. 18. W.J. Paul, On time hierarchies, JCSS 19 (1979) 197 202. 19. J.I. Seiferas, Techniques for separatin space complexity classes, JCSS 14 (1977) 73 99. 20. J.I. Seiferas, Relatin re ned space complexity classes, JCSS 14 (1977) 100 129. 21. M. Sipser, Haltin space-bounded computations, TCS 10 (1980) 335 338. 22. S. Zak, A Turin machine space hierarchy, Kybernetika, 26 2 (1979) 100 121.
Tarskian Set Constraints Are in NEXPTIME? Pawel Mielniczuk and Leszek Pacholski Institute of Computer Science University of Wroclaw m eln ,pacholsk @tcs.un .wroc.pl
Abs rac . In this paper we show that satis ability of Tarskian set constraints (without recursion) can be decided in exponential time. This closes the gap left open by D.A. McAllester, R. Givan, C. Witty and D. Kozen in [14].
Introduction Set constraints have a form of inclusions between set expressions built over a set of set-valued variables, constants and function symbols. They have been used in pro ram analysis and type inference al orithms for functional, imperative and lo ic pro rammin lan ua es [3], [11], [12], [15], [16], [18]. The systems of set constraints used for pro ram analysis were considered as inclusion constraints over the Herbrand universe i.e. a solution consisted of a collection of subsets of the Herbrand universe. To distin uish them from set constraints studied here we shall call them the Herbrand set constraints. The satis ability problem for Herbrand set constraints have been studied by many authors includin N. Heintze and J. Ja ar [10], A. Aiken and E.L. Wimmers [4], R. Gilleron, S. Tison, and M. Tommasi [7], L. Bachmair, H. Ganzin er, and U. Waldmann [5], A. Aiken, D. Kozen, M. Vardi, and E.L. Wimmers [1]. The stron est decidability results were obtained by A. Aiken, D. Kozen, and E. Wimmers [2], R. Gilleron, S. Tison and M. Tommasi [8], K. Stefansson [17], and by W. Charatonik and L. Pacholski [6]. Recently D.A. McAllester, R. Givan, C. Witty and D. Kozen [14] liberalized the notions of set constraints to so-called Tarskian set constraints over arbitrary rst-order domain, with a link to modal-lo ics. Early work on Tarskian set constraints by R. Givan and D. McAllester stemmed from the work on arti cial intelli ence [9,13]. D. McAllester, R. Givan, C. Witty and D. Kozen [14] ave a complexity analysis of systems of Tarskian set constraints dependin on various parameters. They proved that the satis ability problem for set constraints with deterministic operators of arbitrary arity (functions and constants) extended by recursion ( -operator) is undecidable. They proved that for pure set constraints with deterministic constants but without deterministic function symbols of arity > 0, the satis ability problem is EXPTIME-complete, and for pure set constraints with This research was partially supported by a KBN grant 8 T11C 029 13 Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 589 596, 1998. c Sprin er-Verla Berlin Heidelber 1998
590
Pawel Mielniczuk and Leszek Pacholski
deterministic function symbols of arity > 0, but without deterministic constants the satis ability problem is NEXPTIME-complete. Finally they proved that for full (with deterministic constant and function symbols) set constraints without recursion the satis ability problem is in 2-NEXPTIME and is NEXPTIME-hard, leavin the ap between the upper and the lower bound. The approach to the upper bound was based on a reduction of the satis ability problem to a problem of solvin systems of so called prequadratic Diophantine inequalities. The result of reduction was of exponential size and the al orithm solvin prequadratic Diophantine inequalities presented in [14] worked in nondeterministic exponential time, so the resultin set constraint al orithm worked in 2-NEXPTIME. D.A. McAllester, R. Givan, C. Witty and D. Kozen expressed a hypothesis that the satis ability problem for systems of prequadratic Diophantine inequalities was in NP, which would ive an al orithm of complexity matchin the lower bound. Here we ive a NEXPTIME al orithm solvin full systems of Tarskian set constraints (without recursion). We do it without a reduction to systems of prequadratic Diophantine inequalities.
1
Basic De nitions
We assume an in nite set of (deterministic and non-deterministic) operator symbols of each arity. De nition 1. 1. A set expression is de ned by the rammar: E ::= F (E1
En ) E1
E2 E1 \ E2
E
where F is an operator symbol of arity n. 2. By M we denote a rst order structure with the universe M . Set expressions are interpreted in M as follows: F M (E1 E2 ) = F M E1 F M E2 F M (E1 \ E2 ) = F M E1 \ F M E2 F M ( E1 ) = M F M E1 and F M (E1
En ) = x F M (x1
If F is deterministic then, for all x1 xn ) = x. such that F M (x1
xn ) = x x xn
EM 1
i
n
M, there is exactly one x
M
A non-deterministic operator of arity zero can, from the point of view of satis ability, be considered as a set variable. In the followin we shall identify non-deterministic operators of arity zero with set variables. For this reason we did not explicitly mention variables in De nition 1. A deterministic operator is called a function, if it is of arity zero we call it a constant. E2 (positive De nition 2. A constraint is an expression of the form E1 constraint) or E1 E2 (ne ative constraint), where E1 , E2 are set expressions. A constraint of the form E1 E2 (E1 E2 ) is satis ed in M if E1M E2M M (E1 E2M respectively). We say that a set S of constraints is satis able, if there is a structure M such that every element of S is satis ed in M.
Tarskian Set Constraints Are in NEXPTIME
591
We consider the problem to determine whether a nite set of constraints is satis able.
2
Set Constraints as
lat Expressions
We reduce systems of set constraints to one inclusion constraint de ned usin a flat set expression, where flat set expression is a set expression involvin terms of depth at most one. De nition . A flat set expression is de ned by the followin E ::= F (X1 where X1
Xn ) E1
E2 E1 \ E2
rammar:
E
Xn are set variables.
The size of a system S of set constraints is the number of symbols in S. Proposition 1. For every system S of set constraints of size n there is a flat set expression E of size polynomial in n such that S is equivalent to inclusion constraint E . Moreover, we can assume that ne ation is applied only to Xn ). expressions of the form F (X1 Proof. Set expressions of depth reater than one can be eliminated from S as En ) appears in S and E is not a variable, for some 0 i follows. If F (E1 X E E X , where X is a new set n, then S is replaced by S[X E ] variable and S[X E ] is the result of replacin E by X everywhere in S. E2 can be replaced by c E1 \ E2 , for a A ne ative constraint E1 E2 is equivalent to E1 \ E2 , and new constant symbol c. Finally, E1 E2 is equivalent to E1 E2 . E1 The last sentence follows by de Mor an rules. As an exercise the reader can check that a flat version of f (a) a) (X \ a) ( X \ a) .
3
a is (f (X) \
Description of Structures
Let E be a flat set expression. Denote by 0 the set of variables occurrin in Xn ), where F E, and by 1 - the set of set expressions of the form F (X1 Xn . De ne = . occurs in E and X1 0 0 1 T A -type ( 0 -type, 1 -type) is a set expression of the form T where T is a set of elements of ( 0 , 1 , respectively) and their ne ations such that for every E (E 0, 1 , respectively) exactly one of E and E occurs in . Note that every 0 -type ( 1 -type) can be expressed as a union of -types. Moreover, the number of -types is is at most sin le exponential in the size of E. Xn ) be a 1 -type, and let Consider a set expression F (X1 1 . Let F (X1 Xn ) and X , for 1 i n. 1 n be 0 -types such that
592
Pawel Mielniczuk and Leszek Pacholski
We say that ( 1 Xn ) if F (X1
n)
Yn
( Y1
is a domain of
0 )(
Y 1
i
(
is an ima e of (
n
F (Y1
n ))
1
for
Yn ))
which we write as (
n)
1 F (X1
F (X1
Xn )
Xn )
denotes that it is possible that in a The expression ( 1 n) M xn belon in to 1M structure M there exist x1 n , respectively such ( ) 1 n M xn ) . Denote by F (X1 Xn ) the number such n-tuples that F M (x1 xn . Formally: x1 ( 1 n) M M xn ) x 1 i n F M (x1 xn ) Xn ) = # (x1 F (X1 Given a relational structure M, the description of M is the pair Card , where Card is a function ivin for a -type the number Card( ) of elements M ), and is a function realizin in M (i.e the number of such x that x ( 1 n) Xn ) and ( 1 the cardinality of F (X ivin , for each F (X1 n) Xn ) . 1 For a iven pair Card as above, to determine whether it is a description of a structure it su ces to check the non-emptiness conditions and the cardinality conditions de ned below. De nition 4. The non-emptiness conditions hold if Xn ) F (X1 (1) For every F (X1 1 and a non-empty 1 -type X , for 1 i n such that there exist non-empty 0 -types F (X1
Xn )
. ( 1 n) Xn ) (2) For every f (X1 X,1 i 0 -types (
1
n)
f (X1
Xn )
Xn )
1 , where f is a function and all non-empty n there exists a non-empty 1 -type such that
.
The cardinality conditions hold if P Card( ) = 1, for every constant symbol c. (1) c
(2) For each function symbol f , each 1 -type , all variables X and such that X , for 1 i n, Y X ( 1 n) Card( ) Xn ) = f (X1 1 n
(3) For each function symbol f , each X (
1 -type 1
f (X1 (
1
n)
n)
Xn )
and all variables X Card( )
0 -types
Tarskian Set Constraints Are in NEXPTIME
593
Part (1) of non-emptiness conditions says that if a function has a non-empty ima e, then it has a non-empty domain and part (2) says the converse. Part (2) of the cardinality conditions says that every member of domain has exactly one ima e and part (3) that every member of ima e is the unique ima e for at least one member of domain.
4
Main Theorem
Consider a system S of set constraints of size n satis able in a structure M. In fact, as we have noticed earlier, we can assume that S is without variables, and we do it. So, we assume that M is a model of S. We shall construct another model M0 of S in which the cardinality of each set de ned by a -type is either in nite or at most double exponential in n. A description of M0 can be written in sin le exponential space. The idea is to nd all -types which always de ne nite sets and make all Xk de ne nite sets other sets in nite. We use the obvious fact that if X1 Xk ) is nite. Note that for non-deterministic and f is a function then f (X1 operators this is not true. We rst describe a procedure which determines -types which are always nite. This procedure works in steps. To provide some intuitions we ive an example. Let S be the system X
a
c
Y
f (X X)
W
f (Y Z)
where a, c are constants, X Y W Z are set variables, and f is a function. In the preprocessin step we mark as nite some -types which have to be empty. In our example we mark all -types contained in X \ (a c), Y \ f (X X) or W \ f (Y Z). Durin each step we mark as nite an ima e of a function for which the domain has been marked earlier as nite and we stop if we can not continue this procedure. In our example a and c will be marked in the rst step since the domain of a constant is empty. In fact X (all types containin X) will be marked since X (X \ (a c)) (X \ (a c)) - the rst summand bein nite by preprocessin and the second bein included in a c. In the second step we mark Y and the procedure stops after two steps. So, if S is satis ed, the cardinality of X is at most 2, and the cardinality of Y - at most 4. There is no reason, however, to bound the cardinalities of W and Z, so we can assume that they are in nite. The proof of the main result of this part oes as follows. First we prove that for a system S of set constraints of size n the procedure outlined above stops after n steps and ives a set Fn of types. Then we use the fact that the cardinality of an ima e does not exceed the cardinality of the domain to et the doubly exponential bound on the size of sets de nable by types in Fn . Finally iven a model of S we chan e it by leavin the types in Fn unchan ed and makin all other types in nite. The structure so obtained has a description of exponential size and is a model of S.
594
Pawel Mielniczuk and Leszek Pacholski
De nition 5. Let E be a flat constraint. 1. By F we denote the operator on the powerset of F (P) =
( f (X1 (((
1
n)
f (X1
Xn ) Xn )
1 )(
)
( 1
1
i
-types de ned as follows: 0)
n)(
(
n
0)
P))
where 1 -type represents all -types contained in . E , Fn+1 = Fn F(Fn ). By F1 we denote Fn , for 2. We put F0 = minimal n is such that Fn+1 = Fn . Part 1 of this De nition is quite technical but its meanin is quite clear. The operator F works as follows. In each step for any function f and a type which is the ima e under f of types which are all in P is included in F (P). In part 2 we include in F0 all types which are empty by direct application of iven constraints. Lemma 1. F1 = Fn , where n is the size of S. Proof. Clearly Fn+1 = Fn if each 0 type belon in to Fn belon s already to Fn−1 Moreover, if a 0 -type 1 is included into F before 0 -type 2 then there E and 2 \ E. To prove this assume that in is a 1 -type such that 1 \ a sta e i the operator F adds a new 0 type 1 and that 2 is not added neither in this sta e nor has been added earlier. Since the only relationship between 0 and 1 -types is throu h E it means that in the sta e i a new 1 -type has been E. Moreover, 2 \ E since otherwise 2 would have added and 1 \ been added in sta e i. Now, we will show that for a flat system E of set constraints of size n, if 0 0 k is an inte er for which there exist 0 -types 0 k and 1 -types 1 k such that 0 E \ 0 E for 1 i k −1 \ then k n. We prove it by induction on the size of E. We consider several cases: Case 1. E has the form X. Then for every 0 -type either is contained in E or and E are disjoint. It is clear that k 1. Xn ). Case 2. E has the form F (X1 Then for every 1 -type 0 either 0 is contained in E or 0 and E are disjoint and therefore k 0. Case . E has the form E = E1 E2 . Then for each 0 -type and each 1 -type 0 if \ 0 E then \ 0 E1 or \ 0 E2 . Moreover, for each 0 -type and each 1 -type 0 if \ 0 E then \ 0 E1 and \ 0 E2 . From this it follows that k k1 + k2 , where k1 and k2 are the maximal values for E1 and E2 , respectively. Case 4. E has the form E1 \ E2 . Then for each 0 -type and each 1 -type 0 if \ 0 E then \ 0 E1 and \ 0 E2 . Similarly for \ 0 E we have \ 0 E1 or \ 0 E2 .
Tarskian Set Constraints Are in NEXPTIME
595
From this we deduce that k k1 + k2 , where k1 and k2 are the maximal values for E1 and E2 , respectively. This completes the proof of Lemma. Lemma 2. In every structure M each type in Fn is realized by at most doubly exponential number of elements of M . Q Xn )) Proof. We use the fact that Card(f (X1 1 n Card(X ), and the fact that the arity of all function symbols in E is bounded. Theorem 1. If a system S of set constraints is satis able by a structure M then S is satis able by a structure M0 such that the cardinality of every -type interpreted in M0 is in nite or at most double exponential in the size of S. Proof. By Proposition 1 we can assume that S is of the form E where E is a flat expression. To construct a structure M0 from M we keep all types in F1 unchan ed, and make all other types in nite. So be the Lemma 2 of all types in F1 have cardinality at most double exponential. ( 1 n) if = , for some 1 i n, and leave Moreover, put F (X Xm ) = 1 it unchan ed otherwise. Clearly, as in the case of cardinality of types, the is either in nite or at most double exponential. It is easy to check that the nonemptiness and cardinality conditions remain valid after these chan es. By the Theorem 1 to determine satis ability of nite set of constraints it su ces to uess an exponential description DS of a structure to and verify correctness of DS i.e. the non-emptiness and the cardinality conditions for DS .
References 1. A. Aiken, D. Kozen, M. Vardi, and E. L. Wimmers. The complexity of set constraints. In Computer Science Lo ic’93, LNCS 832, pages 1 17. Springer-Verlag, 1994. 2. A. Aiken, D. Kozen, and E. L. Wimmers. Decidability of systems of set constraints with negative constraints. Technical Report 93-1362, Computer Science Department, Cornell University, June 1993. 3. A. Aiken and B. Murphy. Static type inference in a dynamically typed language. In Ei hteenth Annual ACM Symposium on Principles of Pro rammin Lan ua es, pages 279 290, January 1991. 4. A. Aiken and E. L. Wimmers. Solving systems of set constraints (extended abstract). In Seventh Annual IEEE Symposium on Lo ic in Computer Science, pages 329 340, 1992. 5. L. Bachmair, H. Ganzinger, and U. Waldmann. Set constraints are the monadic class. In Ei ht Annual IEEE Symposium on Lo ic in Computer Science, pages 75 83, 1993.
596
Pawel Mielniczuk and Leszek Pacholski
6. W. Charatonik and L. Pacholski. Set constraints with projections are in nexptime. In 35th Annual IEEE Symposium on Foundations of Computer Science, pages 642 653, November 1994. 7. R. Gilleron, S. Tison, and M. Tommasi. Solving systems of set constraints using tree automata. In 10th Annual Symposium on Theoretical Aspects of Computer Science, LNCS 665, pages 505 514. Springer-Verlag, 1993. 8. R. Gilleron, S. Tison, and M. Tommasi. Solving systems of set constraints with negated subset relationships. In Proceedin s of the 34 h Symp. on Foundations of Computer Science, pages 372 380, 1993. A full version Technical report IT 247, Laboratoire d’Informatique Fondamentale de Lille. 9. D. Givan, R. McAllester. New results on local inference relations. In M. K. Press, editor, Principles of Knowled e representation and Reasonin : Proceedin s of the Third International Conference, pages 403 412, 1992. 10. N. Heintze and J. Ja ar. A decision procedure for a class of set constraints (extended abstract). In Fifth Annual IEEE Symposium on Lo ic in Computer Science, pages 42 51, 1990. 11. N. Heintze and J. Ja ar. A nite presentation theorem for approximating logic programs. In Seventeenth Annual ACM Symposium on Principles of Pro rammin Lan ua es, pages 197 209, January 1990. 12. N. D. Jones and S. S. Muchnick. Flow analysis and optimization of lisp-like structures. In Sixth Annual ACM Symposium on Principles of Pro rammin Lan ua es, pages 244 256, January 1979. 13. D. A. McAllester and R. Givan. Taxonomic syntax for rst order inference. Journal of ACM, 40:346 283, 1993. 14. D. A. McAllester, R. Givan, C. Witty, and D. Kozen. Tarskian set constraints. In Proceedin s, 11th Annual IEEE Symposium on Lo ic in Computer Science, pages 138 147, New Brunswick, New Jersey, July 1996. IEEE Computer Society Press. 15. P. Mishra and U. Reddy. Declaration-free type checking. In Twelfth Annual ACM Symposium on the Principles of Pro rammin Lan ua es, pages 7 21, 1985. 16. J. C. Reynolds. Automatic computation of data set de nitions. Information Processin , 68:456 461, 1969. 17. K. Stefansson. Systems of set constraints with negative constraints are NEXPTIME-complete. In Ninth Annual IEEE Symposium on Lo ic in Computer Science, pages 137 141, 1994. 18. J. Young and P. O’Keefe. Experience with a type evaluator. In D. Bj rner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 573 581. North-Holland, 1988.
-Equational Theory of Context Uni cation is Π10 -Hard Ser ei Vorobyov Max-Planck Institut f¨ ur Informatik, Im Stadtwald, D-66123, Saarbr¨ ucken, Germany,
[email protected], http://www.mpi-sb.mpg.de/ sv
Abs rac . Context uni cation is a particular case of second-order unication, where all second-order variables are unary and only linear functions are sou ht for as solutions. Its decidability is an open problem. We present the simplest (currently known) undecidable quanti ed fra ment of the theory of context uni cation by showin that for every si nature containin a 2-ary symbol one can construct a context equation E (p r F w) with parameter p, rst-order variables r, w, and context variables F such that the set of true sentences of the form r
F
w E (p r F w)
is 10 -hard (i.e., every co-r.e. set is many-one reducible to it), as p ran es over nite words of a binary alphabet. Moreover, the existential pre x above contains just 5 context and 3 rst-order variables.
1
Introduction
The Context Uni cation Problem (CUP for short) is: A eneralization of the celebrated Markov-L¨ob’s problem of solvability of equations in a free semi roup proved decidable by Makanin [7]; CUP coincides with this problem for monadic si natures. A specialization of the Second-Order Uni cation (SOU), known to be undecidable due to Goldfarb [6,5]. CUP is almost SOU, but with only unary function variables allowed and solutions required to be linear, i.e., of the form x t(x), where t(x) contains exactly one occurrence of x. Context uni cation is useful in di erent areas of Computer Science: term rewritin , theorem provin , equational uni cation, constraint solvin , computational lin uistics, software en ineerin [11,9,12]. CUP is stated as follows: Given a pair of terms t, t0 built as usual from symbols of a si nature , rstorder variables w, and unary function variables F , does there exist an assi nment of terms to w and linear second-order functions to F such that (t) = (t0 )? Thus, CUP is a decidability problem for the existentially quanti ed equations ( -equational theory) of the form F
w t = t0
where the quanti ed context variables F ran e over linear functions. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 597 606, 1998. c Sprin er-Verla Berlin Heidelber 1998
(1)
598
Ser ei Vorobyov
Currently the decidability of CUP is an open problem [11,9,12]. Most researchers conjecture and hope that CUP is decidable. All the above papers provide some approximations: either prove decidability of particular cases, or settle undecidability of some eneralizations, or provide technical results towards decidability of CUP. Presumably, CUP is very hard to settle, both in decidable and undecidable sense. This is because CUP lies between a technically di cult decidable case of equations in free semi roups (Markov-L¨ ob’s problem proved decidable by Makanin [7]), and the undecidable case of SOU settled by Goldfarb [6] and reinforced by Farmer [5]. Farmer’s result is also technically quite di cult. Goldfarb [6] demonstrated that SOU is undecidable for second-order lanua es containin at least one 2-ary function constant and nitely many unary and ternary function variables. Later Farmer [5] improved it by showin that SOU remains undecidable in presence of unary function variables only (but, unlike CUP, substitutions looked for are not required to be linear ; in fact, they are not linear in Farmer’s proof). It follows from Makanin’s result [7] that SOU is decidable when all variable and constant function symbols are unary. Farmer [4] improved this by showin that decidability is preserved if n-ary function variables are allowed in addition to constant function symbols of arity at most one. Thus, CUP represents the only unknown remainin di cult intermediate case between decidable word equations and undecidable SOU (unary variables, n-ary constants, linear solutions). This explains why the pro ress on CUP has been quite slow. Indeed, decidability of CUP would considerably improve Makanin’s result, whereas undecidability would considerably improve Goldfarb-Farmer’s undecidability of SOU. In this paper we show that addin just one outermost universal quanti er to a context equation (1) leads to the 10 -hard class of formulas, where 10 is the class of all co-recursively enumerable sets. For comparison, the followin undecidability results are known about quanti ed fra ments of context uni cation. Quine [10] showed that the full rstorder theory of free semi roups is undecidable (this corresponds to context unication in unary si natures). Durnev [3] improved it to the undecidability of 3 -positive (without ne ation, but with and ) theory of free semi roups. Marchenkov [8] improved it to the undecidability of 4 -positive theory of free semi roups. Durnev [2] improved it to undecidability of 3 -positive theory of free semi roups. Niehren, Pinkal, and Ruhrber [9] claimed undecidability of the -theory of context uni cation. It should be noticed that all known methods to transform a positive formula of the theory of free semi roups into just one equation require a considerable number of auxiliary existentially quanti ed variables (see, e. ., [1]), dependin on the number of disjunctions involved. Thus the above undecidability results 4 3 - and -positive theories of free semi roups yield only undecidability for n -equational theories of free semi roups with a very lar e number n of of the existentially quanti ed variables.
∗
-Equational Theory of Context Uni cation is
0 1 -Hard
599
In this paper we show that the situation with context equations is quite di erent, and just two extra existentially quanti ed context variables su ce to eliminate all disjunctions. This, to ether with a direct reduction from the haltin 8 -equational problem for Turin machines, ives the undecidability of the theory of context uni cation, with a reasonably simple quanti er pre x. The main result of this paper may now be stated as follows. Main Theorem. For every si nature containin a 2-ary symbol one can construct a context equation E (p r C F F 0 G H x y z) with parameter p, rstorder variables r x y z, and context variables C F F 0 G H such that the set of true sentences of the form r
C F F0 G H
x y z E (p r C F F 0 G H x y z)
(2)
is 10 -hard (i.e., every co-r.e. set is many-one reducible to it), as p ran es over nite words of a binary alphabet. It follows, in particular, that the 8 -equational theory (without , , ) of context uni cation is undecidable. Warnin . We would like to stress that in this paper we do not intend to improve the undecidability results of Marchenkov and Durnev [8,2] for 4 - and 3 -positive theories of free semi roups as to minimizin the number of existential quanti ers. However, we do et an improvement over [8,2] (in a di erent framework of context uni cation) as to simplicity of the existential pre x in the undecidable -equational theory of context uni cation. As we mentioned above, all known methods of eliminatin disjunctions from positive formulas in free semi roups use a considerable number of auxiliary existentially quanti ed variables, proportional to the number of disjunctions to be eliminated. We show that in context uni cation just two extra variables are enou h. We do not claim that the quanti er pre x we obtain is minimal. We rather tried to keep proofs intuitive and transparent. We believe that applyin the methods of disjunction elimination with a constant number of extra variables (Section 5) directly to the reductions of [8,2] (the proofs absent from [2] are unavailable to the author) will yield the undecidability of the 5 -equational theory of context uni cation. Paper Outline. After Section 2 with preliminaries, in Sections 3, 4 we ive the main construction of an -sentence (expressin non-applicability) from a DTM with a complete 10 domain. In Section 5 we eliminate disjunctions.
2
Preliminaries
Context Uni cation. Let be a xed nite si nature with each symbol assi ned a xed arity, containin at least one constant. Let X be an in nite set of rst-order variables and F = F G be an in nite set of function variables of arity one, also called context variables. De nition 1 (Terms). The set T ( X) of terms of si nature with variables from X is de ned as usual: variables from X are terms and for f of arity tn ) is a term whenever t ’s are terms. n 0 an expression f (t1
600
Ser ei Vorobyov
We assume all the standard de nitions and conventions concernin like -reduction, normalization, etc.
-notation,
De nition 2 (Contexts). A context is an expression of the form x t(x), where t(x) T( x ) contains exactly one occurrence of the variable x. A context with -normal form x x is called empty. Remark 1. Note that the ‘exactly one’ requirement, absent from the de nition of SOU, is a characteristic feature of CUP, distin uishin it from SOU. De nition 3 (Context Terms). Are de ned inductively: if F is n-ary tn are context terms, then (t1 tn ) is a context term. and t1 Convention. Writin terms and context terms with unary function symbols and function variables we usually drop parentheses to improve readability. De nition 4 (CUP, Context Equations). An instance of CUP, also called a ? context equation (CE for short), is an expression 1 = 2 , where 1 2 are context terms. A solution to a CE variables such that ( 1 )
?
= 2 is a substitution of contexts for context ( 2 ) (equality modulo the usual -reduction).
1
Remark 2. The requirement of replacin functional variables with contexts, as opposed to arbitrary second-order -terms, distin uishes CUP from SOU. When this requirement is dropped, the problem becomes undecidable [5]. Turin Machine with Complete R.E. Domain. A 10 -set is a recursively enumerable set. A 10 -set is a complement of a 10 -set. An 10 -set (resp., 10 -set) A is called complete i every 10 -set (resp., 10 -set) B is many-one reducible to A, i.e., there exists a total recursive function f such that x B f (x) A. It is well known that there exists a DTM M whose domain is a complete 0 0 1 -set, and, therefore, the set of elements it does not accept is a complete 1set. We may assume, without loss of enerality, that the tape alphabet B of M consists of two symbols, 0 and 1, the tape of M is in nite to the ri ht, M never tries to move left from its leftmost tape cell, M may only extend its tape by qf , writin new symbols on the ri ht end, that the states of M are Q = q0 q0 is the unique initial state, qf is the unique nal state of M , M always starts by observin its leftmost tape cell, and M immediately stops enterin state qf . Further we assume that M is a xed such DTM. bm B + i there exists a The DTM M applies to a nonempty word b1 idF of M such that nite sequence of IDs (instantaneous descriptions) id0 bm , idF γqf for some γ B , and such that for every pair of id0 q0 b1 IDs id , id +1 in the sequence id +1 is obtained from id by application of some command of M . We omit the well-known de nitions. We will represent IDs of M by terms constructed from unary function symbols, startin from the constant for the empty word. We have a unary function symbol for every symbol in B Q, and represent a word q0 10101010 as a
∗
-Equational Theory of Context Uni cation is
0 1 -Hard
601
term q0 (1(0(1(0(1(0(1(0( ))))))))), which for simplicity will always be written as q0 10101010 (i.e., with ( ) and omitted), if it does not lead to ambi uity. idF of IDs as a ri ht-flattened list We will represent a sequence id0 f (id0 f (id1 f
f (idF −1 f (idF
))
))
(3)
where id ’s are term representations of words usin unary functional symbols as described above. Thus the DTM M applies to an input i such a term (3) exists. Si nature. Formally, we will use the followin si nature : 1) - constant, qf for the empty word and list, 2) 0, 1 - unary for the tape alphabet B, 3) q0 - unary for M ’s states in Q, 4) f - binary list constructor, 5) a - unary, auxiliary. Convention. If not stated otherwise, everywhere below s denotes a symbol from B Q, b denotes a symbol from B, q denotes a symbol from Q.
3
Sentence Expressin Inapplicability
To prove the main claim of this paper we will write a sentence of the followin form (with context variables C, F , F 0 , G, H, and ordinary variables r, x, y, z): r C F F0 x y z G H
f (q0 b 1
b p r) t1
tm
(4)
which expresses the fact that the DTM M does not apply to the input strin b p , because for every r, the term t f (q0 b 1 b p r) is not a correct s b1 b p is in the complement of the r.e.-complete domain run (3) of M , i.e., s b 1 of M . This implies the main claim of the paper. b p r) is not a correct run Technically, expressin that a term t f (q0 b 1 amounts to sayin that ‘somethin oes wron ’ in t. For example, t contains ‘senseless’ subterms like f (f ( ) ), or a( ), etc. It turns out that this can be expressed by sayin ‘contains one of the nitely many wron patterns’ tm , which can be done by sayin t = Ct1 t = Ctm , where C is t1 a context variable used to say ‘there exists a subterm of t’. All such patterns are expressed by usin 2 context variables F , F 0 and 3 rst-order variables x, y, z. In Section 5 we show how to et rid of disjunction by usin just two extra existentially quanti ed context variables (G and H in (4)), independently of the number m of patterns. Thus just one context equation with 5 context and 3 rstorder existentially quanti ed variables as in (2), (4) su ces for undecidability.
4
Forbidden Patterns
We enumerate all forbidden patterns preventin a term to be a correct run. Forbidden Structural Patterns. A term containin one of the followin subterms cannot represent a correct run (for some context F and terms x, y, z): 1. f (F (a(x))). Reason: a is an auxiliary symbol and cannot occur in a run. 2. f (f (x y) z). Reason: a run is a ri ht-flattened list of IDs, f cannot occur in the rst ar ument position to itself.
602
Ser ei Vorobyov
3. f (x g(y)) for every function symbol g B Q . Reason: a run is a ri ht-flattened list of IDs. 4. q(F (q 0 (x))) for all q q 0 Q . Reason: at most one state symbol per ID. 5. g(f (x y)) for all g B Q . Reason: IDs cannot contain f . 6. f (F (qf (x)) f (y z)). Reason: enterin qf DTM stops. B such that M has no commands 7. q(s(x)) for all q Q qf and s (q s ) . 8. q( ) for all q Q qf such that there are no commands to extend the tape on the ri ht end in state q . Patterns for Incorrect ID Transitions. Now we enumerate patterns that cannot occur in a correct run of the DTM M for the reason a term matchin one of these patterns contains a ‘senseless’ ID transition. This can be expressed by existence of solutions to a nite number of ‘local’ context equations. As an easy and representative example, note that an ID cannot be transformed into an ID , if for some context F , state q Q, tape symbols s1 2 3 4 5 B, and F s3 s4 s5 y. This is because x y one has simultaneously F s1 qs2 x and each TM’s transition moves head either left or ri ht, so in a correct transition either s3 or s5 should belon to Q (be a state). This illustrates the main idea. By routinely enumeratin all possibilities we can assure that a transition is correct i it does not match any of the patterns enlisted. The reader is invited to check that all these patterns use only three rst-order variables x y z, and two context variables F , F 0 . Recall that we use these patt = CPm to say that t contains a subterm terns P disjunctively in t = CP1 Pm (where the context variable C is used matchin one of the patterns P1 to say ‘there exists a subterm’). Since distributes over , the variables may be reused and we need just three context C, F , F 0 , and three rst-order variables x, y, z. The two extra context variables G, H will be needed to transform a disjunction into an equation in Section 5. List of the patterns for incorrect transitions. f (F sx f (F s0 y z)) for s s0 B, s = s0 . Reason: in two succeedin IDs the leftmost position in which they di er should necessarily contain a state from Q. For example, for a ri ht shift command (q s q 0 s0 ) we have, in a 0 correct ID transition (the rst disa reement is q s ): ID = s1 ID +1 = s1 For a left shift command (q s ID = s1 ID +1 = s1
sn q s sn+1 sn s0 q 0 sn+1
sn+m sn+m
q 0 s0 L) we have, in a correct ID transition: sn−1 sn q s sn+1 sn−1 q 0 sn s0 sn+1
sn+m sn+m
(the rst disa reement is sn q 0 ). For an ‘extension on the ri ht’ command (q q 0 s0 ) we have, in a correct ID transition ( rst disa reement q q 0 ): ID = s1 ID +1 = s1
sn q sn q 0 s0
∗
-Equational Theory of Context Uni cation is
0 1 -Hard
603
f (F sx f (F ( ) z)) for all s B Q . Reason: ID +1 cannot be shorter ID . f (qs1 x f (s2 s3 y z)) for all s3 B . Reason: if the rst symbol of the ID is a state, then the second symbol in the ID +1 should be a state. f (F s1 qs2 x f (F s3 s4 s5 y z)) for all s3 s5 B . Reason: if the k-th symbol in ID is a state then either k + 1-th or k − 1-th in ID +1 should be a state. f (F qsx f (F s1 s2 y z)) for every command (q s q 0 s0 ) and every pair of 0 symbols s1 s2 B Q such that either s1 = s or s2 = q 0 . Reason: an ID F qsx should yield F s0 q 0 x, thus each pair of consecutive IDs F qsx, F s1 s2 y is incorrect. f (F qsx f (F s1 ( ) z)) for every s1 B Q . Reason: ID +1 abruptly ends. Similar patterns must be written for the case of left shift commands below. q 0 s0 L), every b B, f (F bqsx f (F s1 s2 s3 y z)) for every command (q s and every triple of symbols s1 s2 s3 B Q such that either s1 = q 0 , or s2 = b, or s3 = s0 . Reason: an ID F bqsx should yield F q 0 bs0 x, thus each pair of consecutive IDs F bqsx, F s1 s2 s3 y is incorrect. ... Similar patterns should be spelled out for the commands extendin the tape on the ri ht. We leave it as a strai htforward exercise. q 0 s0 ) and every f (F qsF 0 s1 x f (F s0 q 0 F 0 s2 y z)) for every command (q s pair of di erent symbols s1 s2 B . Reason: an ID transformation is ‘almost’ correct, but some symbol to the ri ht of the head is copied erroneously. ... Similar pattern for an ‘almost correct’ left shift command (exercise). Let us add a brief explanation of how the above patterns work. In a correct run no ID can contain two states (since we have a pattern q(F (q 0 (x))). Can a correct run contain and ID with no state symbols at all? Let us show that this is impossible. For, if such a situation was possible, there would exist a pair of nei hborin IDs with the least index i such that id contains a state symbol and id +1 does not. Then it is easy to see that one of the patterns responsible for the transition correctness would match, thus uaranteein the run candidate incorrectness. tm such that the We thus constructed a nite number of patterns t1 b p if and only if DTM M does not apply to the word s = b 1 r C F F 0 x y z f (q0 b 1
b p r) = Ct1
f (q0 b 1
b p r) = Ctm
6 -theory of context uni cation is 10 This already proves that the positive hard (by the choice of M with a complete r.e.- or 10 -set). In the next section we proceed to eliminatin disjunctions from the sentence above.
5
Tradin Disjunctions for Equations
To nish the proof of the main claim we show how to represent a disjunction t = tm by just one context of context equations of the form t = t1 equation, usin only two auxiliary (existential) context variables, independently of the number m. Conjunctions do not cause any problems, because in presence
604
Ser ei Vorobyov
of function symbols of arity 2, a conjunction of context equations can be easily expressed by just one equation (s = s0 t = t0 i f (s t) = f (s0 t0 ); similarly for lar er arities). When all function symbols are unary, there exists a well-known trick to represent s = s0 t = t0 as satsbt = s0 at0 s0 bt0 , where a, b are di erent unary function symbols. Disjunction elimination is based on the followin Lemma 1. Let
be the substitution
Ct x
m
, where t ’s are the forbidden
=1
patterns enumerated in Section 4. Consider the system of two equations (where ] = f (e0 [ ])): [ ] denotes the empty list and [e0 G(a(H(a))) =
a ( x1 [x1
xm ])a
a ( x [x1
xm ])a
a ( xm [x1 Hf (q0 s r) = [x1
(5)
xm ])a
xm ]
(6)
For every round term r one has the followin equivalence: the system (5), (6) has a solution if and only if ( ) f (q0 s r) is an incorrect run. Brief Explanation. The term on the ri ht of (5) is (with a( ) on the dia onal): a [ a Ct2 a [ Ct1 a
Ct Ct
Ctm ] Ctm ]
a [ Ct1 Ct2
a
Ctm ]
a [ Ct1 Ct2
Ct
a
(7)
]
Proof. ( ) is strai htforward. Suppose for a round r the term f (q0 s r) is an incorrect run for the reason it contains one of the forbidden patterns t . Let G = u
a ( x1 [x1
xm ])a
a ( x −1 [x1
xm ])a
u a ( x +1 [x1
xm ])a
a ( xm [x1 H
=
x [x1
(8)
xm ])a x
xm ]
(9)
∗
-Equational Theory of Context Uni cation is
0 1 -Hard
605
Clearly, substitutin such G , H in (5) yields the identity. Moreover, by substitutin H in (6) we obtain Ct −1 f (q0 s r) Ct +1 Ctm ] = [Ct1 Ct −1 Ct Ct +1 Ctm ] [Ct1 which, obviously, has a solution for C, since f (q0 s r) contains a forbidden pattern t by assumption. Thus the system (5), (6) has a solution. For the opposite direction
in Lemma 1 we prove (the contrapositive)
Lemma 2. Let f (q0 s r) be a correct run. Then the system (5), (6) has no solutions. Proof. (5), (6) cannot have solutions of the form (8), (9), because the opposite would mean that f (q0 s r) is incorrect (see the proof of the previous lemma). The other ‘possible’ solutions split into the followin two cases. Case 1. The outermost a on the left of (5) matches one of the outermost a’s on the ri ht, but the innermost a on the left does not match the correspondin a on the ri ht. In other words, for some substitution 0 either H= z [ H= z [
Ctj
0
a [z a( )]
Ctj
0
[z a( )] a
] or ]
with a in the i-th (i = j) place in the list. It is readily seen that none of such ‘solutions’ can satisfy (6), because Ct 0 on the ri ht cannot be equal (for any C, 0 ) to a a( ) on the left, since all the forbidden patterns t enumerated in Section 4 contain function symbols di erent from a. Case 2. The whole a(H(a)) on the left of (5) matches with some subterm of Ctk 0 , 1 k m, for some substitution 0 (i.e., neither of a’s in a(H(a)) on the left matches a visible a on the ri ht of (5); see also (7)). Since a correct ID q0 s cannot match any of Ctj , in order to satisfy (6), H rl (x) rm ] for some terms r . Conseshould be substituted with x [r1 rl (a) rm ]. Let us show that this cannot quently, Ctk 0 contains a[r1 yield a solution. Suppose, k = l. Then Ctk 0 properly contains rk , and therefore (6) cannot be satis ed, because it requires rk = Ctk 0 . rk (a) rm ]. Thus Ctk 0 Suppose, k = l. We have Ctk 0 contains a[r1 contains p + 2 occurrences of a. On the other hand, to satisfy (6) we should have rk (f (q0 s r)) = Ctk 0 . Note that rk (f (q0 s r)) contains at most p occurrences of a (compared with p + 2 on the ri ht). Hence the above equality cannot hold. Thus, the system (5), (6) has no solutions. This nishes the proof of Lemmas 1, 2, and the proof of the main claim of his paper.
6
Conclusions
By reduction from the non-acceptance problem for a deterministic Turin machine with a complete r.e. domain we demonstrated that for a one-parametric set of context equations Ep the set of true sentences of the form 1 8 Ep is cor.e.-hard as p runs over binary words. It follows that the 1 8 -equational theory
606
Ser ei Vorobyov
of context uni cation is undecidable. This ives the simplest currently known undecidable quanti ed fra ment of context uni cation. The decidability of the CUP itself remains open. Quite surprisin ly, the only known lower bound for the CUP is NP-hardness [12]. Thus, in the absence of the decidability proof it would be very interestin to obtain nontrivial lower complexity bounds for CUP. Technically, we described an ad hoc method to eliminate disjunctions from the positive formulas (of some particular structure) of context uni cation, which is completely su cient for the purposes of this paper. It is clear that the method can be eneralized so as to apply to arbitrary positive formulas. We conjecture that combinin techniques presented with ideas of [8,2] will lead to a more ti ht undecidability results for CUP, with fewer quanti ers. Thanks to Mar us Veanes and anonymous referees for insi htful remarks.
References 1. J. R. B¨ uchi and S. Sen er. Codin in the existential theory of concatenation. Archive of Mathematical Lo ic, 26:101 106, 1986. 2. V. Durnev. Studyin al orithmic problems for free semi- roups and roups. In Lo ical; Foundations of Computer Science (LFCS’97), volume 1234 of Lect. Notes Comput. Sci., pa es 88 101. Sprin er-Verla , 1997. 3. V. G. Durnev. Positive theory of a free semi roup. Soviet Math. Doklady, 211(4):772 774, 1973. 4. W. Farmer. A uni cation al orithm for second-order monadic terms. Annals Pure Appl. Lo ic, 39:131 174, 1988. 5. W. Farmer. Simple second-order lan ua es for which uni cation is undecidable. Theor. Comput. Sci., 87:25 41, 1991. 6. W. D. Goldfarb. The undecidability of the second-order uni cation problem. Theor. Comput. Sci., 13:225 230, 1981. 7. G. S. Makanin. The problem of solvability of equations in a free semi roup. Math USSR Sbornik, 32(2):127 198, 1977. 8. S. S. Marchenkov. Undecidability of the positive -theory of a free semi roup. Siberian Math. Journal, 23(1):196 198, 1982. 9. J. Niehren, M. Pinkal, and P. Ruhrber . On equality up-to constraints over nite trees, context uni cation, and one-step rewritin . In W. McCune, editor, CADE14, volume 1249 of Lect. Notes Comput. Sci., pa es 34 48. Sprin er-Verla , 1997. 10. W. V. Quine. Concatenation as a basis for arithmetic. J. Symb. Lo ic, 11(4):105 114, 1946. 11. M. Schmidt-Schau . Uni cation of strati ed second-order terms. Interner Bericht 12/94, University of Frankfurt am Main, 1994. 12. M. Schmidt-Schau and K. U. Schulz. On the exponent of periodicity of minimal solutions of context equations. In Rewritin Techniques and Applications’98, volume 1379 of Lect. Notes Comput. Sci., pa es 61 75. Sprin er-Verla , 1998.
Speedin Up Nondeterministic Sin le Tape O -Line Computations by One Alternation (Extended Abstract) Jir Wiedermann Ins i u e of Compu er Science Academy of Sciences of he Czech Republic Pod vodarenskou vez 2 , 182 07 Prague 8, Czech Republic e mail: w eder@u vt.cas.cz
Abstract. I is shown ha any nonderminis ic single ape o line Turing machine of ime complexi y T (n) p can be speeded up by one ex ra al erna ion by he fac or log log T (n) log T (n), for any well behaved func ion T (n) This leads o he separa ion NTIME1+I (T (n)) 2 − TIME1+I (T (n)) of he respec ive complexi y classes. Analogous resul holds also for he complemen ary classes co-NTIME1+I (T (n)) and 2 TIME1+I (T (n)) This is he rs occasion where such separa ion resul s have been proved for a res ric ed ype of mul i ape nonde erminis ic machines. For he general case of mul i ape nonde erminis ic machines similar resul s are no known o hold.
1
Introduction
The separa ion of complexi y classes wi hin he hierarchy DTIME(T (n)) ATIME(T (n)) DSPACE(T (n)) is one NTIME(T (n)) 2 − TIME(T (n)) of he cen ral problems in complexi y heory. The rs proof ha nonde erminism is s ronger han de erminism comes probably from Hennie [2] who in 1965 proved his resul for single ape machines recognizing non palindroms. For muli ape machines he separa ion1 DTIME(n) NTIME(n) has been proved in 1983 by Paul, Pippenger, Szemeredi, and Tro er [12]. In 1973 Pa erson [10] proved ha de erminis ic space is more powerful han de erminis ic ime for single ape machines. The analogous resul for mul i ape machines DTIME(T (n)) DSPACE(T (n)) followed in 1977 by Hopcrof , Paul and Valian [5]. In 1980 Paul, Prauss, and Reischuk [11] proved ha unbounded number of al erna ions can speedup single ape compu a ions. The separa ion for mul i ape machines ensued in 1983 by Dymond and Tompa [3]: DTIME(T (n)) ATIME(T (n)) Finally, Kannan in 1983 and Maass and Schorr in 1987 proved increasingly be er resul s
1
This research was suppor ed by GA CR Gran No. 201/98/0717 and by an EU gran INCO COOP 96 0195 ‘ALTEC KIT’ join ly wi h he accompanying gran of he MMT R No. OK 304 The inclusion symbol ‘ ’ deno es he proper con ainmen .
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 607 615, 1998. c Sprin er-Verla Berlin Heidelber 1998
608
Jir Wiedermann
ha bounded number of al erna ions can speedup de erminis ic single ape compu a ions (also wi h a separa e inpu ape). For he case of mul i ape machines he respec ive resul DTIME(T (n)) 2 -TIME(T (n)) proved Gup a [4] in 1988. Thus, merely wo al erna ion were enough o separa e he la er complexi y classes. There are wo lessons o be aken from he previous shor his orical excursion in he con ex of he presen paper. The rs lesson is ha in all cases more general resul s for mul i ape machines always followed only af er proving similar resul s for simpler ypes of machines. Thus, resul s for res ric ed machines served as inspira ion for looking for similar resul s on more general models of compu ing. Second, as a rule, all he respec ive resul s separa e deterministic ime from some higher complexi y class in he above men ioned hierarchy. This is because i seemed ha here were principal reasons ha preven ed he applica ion of analogous speed up echniques also in he case of nonde erminis ic ime. Roughly, in some cases i was he impossibili y e cien ly rerunning a piece of nondeerminis ic compu a ion wice along he same compu a ional pa h (cf. [5]), or unavailabili y of nonde erminism wi hou adding a fur her al erna ion (cf. [9]). The problem of e cien speedup of nonde erminis ic compu a ions has been iden i ed as he major roadblock ha preven s any fur her progress in separa ing o her complexi y classes as before (cf. [4]). Never heless, recen ly a way of solving also his problem has appeared, so far a leas for res ric ed Turing machines. In order o see he key idea of such a solu ion we have o re urn o he idea of he bes separa ion resul ha separa es single ape o line de erminis ic ime bounded compu a ions from 2 single ape o line compu a ions [9]. This proof, and also o her simula ion proofs achieving speedup by wo al erna ions (cf. [4]) share roughly he same s ra egy. In he rs , nonde erminis ic phase a space e cien descrip ion of size o(T (n) of he original de erminis ic compu a ion is guessed. The correc ness of his guess is in urn veri ed in he second phase by invoking he parallelism o ered by co nonde erminism. Unfor una ely, his na ural idea of simula ion canno be s raigh forwardly ransferred o he nonde erminis ic case. This is because in he above men ioned approach he veri ca ion phase requires replaying of some pieces of he original compu a ion. Thus, when he original compu a ion was a nonde erminis ic one i appeared ha here was no way of i s e cien veri ca ion during one subsequen al erna ion. The rs solu ion of he problem of speeding up single ape nonde erminis ic compu a ions by one al erna ion has been devised in 1996 in [13]. The previously men ioned obs acle was roundabou by reorganizing he above men ioned wo phase schema of similar proofs. Namely, he original nonde erminis ic compu a ion was nonde erminis ically spli in o very small pieces in order o achieve ha among hem many pieces were equal. The equal pieces of compu a ions were elimina ed and only he correc ness of remaining di eren ones was checked, s ill in he rs phase. In he second phase he correc ness of spli and ha of he elimina ion was checked.
Speeding Up Nonde erminis ic Single Tape O -Line Compu a ions
609
This has lead o a speedup by fac or log T (n) by one ex ra al erna ion. A separa ion of he respec ive ime complexi y classes followed: NTIME1 (T (n)) 2TIME1 (T (n)) In i s machine ca egory his has been a much s ronger resul when compared wi h all he previous resul s since i achieves a speed up by he single al erna ion and separa es wo direc ly neighbouring complexi y classes. The presen paper con inues a acking he problem of speeding up nondeerminis ic compu a ions by one al erna ion for he nex more powerful ype of res ric ed Turing machines viz. Turing machines wi h one work ape and ex ra read only wo way inpu ape (or shor ly: single ape o line machines). No e ha his ype of machines is an in ermedia e ype be ween single ape machines wi hou an inpu ape, and wo ape o line machines. Due o he resul of Book e al. [1] in nonde erminis ic case he la er machines are ime equivalen o mul i ape o line machines. In Sec ion 2 a speed up heorem for single ape o line nonde erminis ic machines by one al erna ion is proved. As compared o previous cases a comple ely new simula ion s ra egy has been developed here in order o reflec he quali aive change in machine archi ec ure given by he addi ion of inpu ape as ha of he second ape. This has called for wo subs an ial changes. Firs , an idea of having a space e cien represen a ion of a lo of inpu head movemen s has been implemen ed. Second, veri ca ion of very shor nonde erminis ic pieces of compu aions has been moved back o co nonderminis ic phase where heir correc ness is checked by heir deterministic simulation in exponen ial ime w.r. . heir leng h. E cien realiza ion of bo h ideas requires a couple of fur her ricks ha make use of a a parallelism o ered by single- ape o line co nonde erminis ic compua ion. Even ually, a speed up of order log log T (n) log T (n) is achieved. Due o he space limi he proof of he speed up heorem had o be dras ically shor ened. For he omi ed de ails of he proof, see he full version of he paper [14]. Finally, in Sec ion 3 i is shown ha for single ape o line machines nonde erminis ic ime T (n) is s ric ly con ained in 2 ime T (n) The previous resul s hold also for he case of complemen ary machines. Thus, for de erminis ic single ape o line machines wo al erna ions lead o more e cien compu a ions han a single al erna ion. From me hodological poin of view a proof echnique ha is s rong enough o cap ure he e ciency di erence be ween single ape and (res ric ed) wo ape nonde erminis ic compu a ions has been devised. The resul s presen ed in his paper have so far no coun erpar in he case of nonde erminis ic mul i ape machines. I appears ha proof echniques ha make use of a rec angular represen a ion of nonde erminis ic single ape o line compu a ions have been pushed o heir limi s in our approach. Our resul s a leas leave open he possibili y ha similar resul s hold also for he general case of nonde erminis ic mul i ape compu a ions and in fac presen a necessary in ermedia e s ep owards proving such resul s.
610
2
Jir Wiedermann
Speed-Up
For he e cien speed up simula ion we are af er i is essen ial ha he nonde erminis ic machine o be simula ed works in he small space. For una ely, i is possible o make his assump ion wi hou any loss of generali y due o he following heorem [7] which we shall give wi hou a proof: T (n) log n be constructible in time T (n), with Theorem 21 Let T (n) n2 log n. Than any T (n) time bounded sin le tape o line nondeterministic Turin machine M can be simulated in linear time and in space O( T (n) log n) by a machine of the same type. Now we are in a posi ion o formula e and prove our main resul . The proof of he respec ive heorem has been par ly inspired by he proof of a similar heorem ha was proved in [13] for he case of single ape nonderminis ic TM without input tape. Thus, he di erence in curren proof cap ures he presence of inpu ape; his, however, leads o non rivial changes bo h in simula ion s ra egy, as well as in he respec ive da a represen a ion. The idea is as follows. The compu a ion of he machine o be simula ed is represen ed wi h he help of so called rec angular represen a ion ( his echniques goes back o Pa erson [10]). The posi ions of inpu head a selec ed imes are represen ed in a compressed way wi h he help of a so called lo , in which in chronological order he di erences be ween any wo subsequen posi ions of inpu head are recorded. The size of rec angles is selec ed so as o enable deterministic and w.r. . T (n) also a sublinear ime veri ca ion of any nondeterministic piece of compu a ion as described by he given rec angle, wi h he help of informa ion from he above men ioned log. Thus, he simula ion of he original machine M by he respec ive 2 machine consis s of wo phases: in he rs , nonde erminis ic phase he respec ive rec angular represen a ion and he log of inpu head movemen is guessed and recorded and, in he second, co nonde erminis ic (universal) phase he previous guesses are veri ed in parallel. Moreover, in order o make he veri ca ion process e cien enough, prior o he simula ion he compu a ion of he original machine is rs ransformed in o an equivalen one, wi h he help of he previous heorem, and hen cu in o cer ain ime segmen s ha have he proper y ha he con en s of working ape is comple ely rewri en a he end of each ime segmen . As a resul , he his ory of cell rewri ings ( ha is needed o verify he correc ness of rec angular represen a ion) can be comple ely veri ed by performing he respec ive veri ca ion in parallel for each ime segmen . In order o avoid worries concerning he ime cons ruc ibili y of T (n) we shall make use of he following de ni ion of ime complexi y for he al erna ing machines (cf. [11]). We shall say ha an al erna ing machine M is of time complexity T (n) if for every accep ed inpu of leng h n he respec ive compu a ion ree of M s ays accep ing if i is pruned a dep h T (n) Theorem 22 Let T (n) n2 log n. Than any T (n) time bounded sin le tape o line nondeterministic Turin machine M can be simulated by a sin le tape o line 2 machine in time O(T (n) log log T (n) log T (n))
Speeding Up Nonde erminis ic Single Tape O -Line Compu a ions
611
Proof Outl ne. According o he ps a emen of heorem 21, w.l.o.g. we can assume ha M is of space complexi y O( T (n) log n). Spli now he compu a ion ofM in o O(T 1 3 (n)) time se ments of leng h O(T 2 3 (n)) each and in roduce a so called sweep a he end of each ime segmen . A sweep consis s of one comple e raversal of M’s working head over he en ire rewri en par of M’s working ape i.e., he working head moves o he righ end of he rewri en par of working ape, hen o he lef end and nally re urns o i s marked original posi ion. Make each sweep a par of he respec ive ime segmen . Clearly, his ransforma ion does no influence he ime complexi y of he resul ing machine subs an ially he resul ing machine s ill works in ime O(T (n)). Now, consider he respec ive ime space compu a ional diagram (i.e., he sequence of ins an aneous descrip ions of M’s working ape, wri en one above he o her, s ar ing wi h he ini ial and ending wi h he nal accep ing ins an aneous descrip ion), wi h he recorded rajec ory of M’s working head movemen during he compu a ion. In he resul ing diagram, draw horizon al lines o deno e he boundaries be ween any wo subsequen ime segmen s. In wha follows hink abou each ime segmen separa ely. Spli a given ime segmen by ver ical lines in o slots of equal size b(n) ( he las slo can be shor er). The par icular choice of b(n) will be de ermined by he necessi y o simula e de erminis ically he nonde erminis ic compu a ions of leng hs b2 (n) wi hin he so called second order rec angles (see heir de ni ion in he sequel). This 2 de erminis ic simula ion requires hen ime O(cb (n) ) per square wha should be accommoda ed wi hin p he required 3o al asymp o ic simula ion ime. I appears ha he choice of b(n) = log(T (n) log T (n)) sa is es his condi ion (for he de ails, see he full version of he paper). Consider now he crossing sequence a he boundaries be ween individual slo s (i.e., he sequence of poin s where he rajec ory of inpu head crosses he above men ioned ver ical lines). By shif ing all slo boundaries simul aneously along he ape from i s origin o he righ , while keeping hem equidis an , a some posi ion j, wi h 0 < j < b(n), a si ua ion mus occur ha he sum of leng hs of crossing sequences a he curren slo boundaries does no exceed (T 2 3 (n)) = T 2 3 (n) b(n) wi hin he ime segmen a hand. Namely, in he opposi e case, if here was no such a posi ion j hen he o al sum of leng hs of crossing sequences in be ween every ape cell would exceed T 2 3 (n), wha is impossible in a ime segmen of he given leng h. S ill wi hin he ime segmen a hand, p x he rs slo boundary a he posi ion j This will spli he ime segmen in o T (n) log n b(n) = O(T 1 2 (n)) of so called rst order rectan les. Fur her, spli horizon ally each rs order rec angle in o second order rectan les whose size is maximized, subjec o he sa isfac ion of ei her of he following wo condi ions: none of he wo respec ive ver ical sides is crossed by M’s working head more of en han b(n) imes; he o al ime spen by M’s working head in a given second order rec angle mus no exceed b2 (n). Clearly, second order rec angles can be crea ed in each rs order rec angle, wi h he possible excep ion of oo shor slo s, or in remainders of slo s ha are ar i cially cu by he line separa ing ime segmen s. Call he respec ive second order rec angles, ha could no be crea ed in he full size , as required by he previous wo condi ions, as small rectan les.
612
Jir Wiedermann
In his way, in each ime slo we ob ain a mos O(T 2 3 (n) b2 (n)) second order full size rec angles (since he compu a ion wi hin each rec angle consumes ei her b(n) crossing sequence elemen s, or ime b2 (n)), plus a mos O(T 1 2 (n)) small ones (since he number of small rec angles does no exceed ha of rs order ones). Thus, in each ime segmen he o al number of second order rec angles is safely bounded by O(T 2 3 (n) b2 (n)). In a o al, he rec angular represen a ion con ains O(T (n) b2 (n)) second order rec angles. Each second order rec angle will be comple ely represen ed by i s wo horizon al sides of leng h b(n), giving he con en s of he corresponding block on M’s working ape a he respec ive ime s eps, and by he descrip ion of he his ory of crossing i s wo ver ical sides by he working head of M For each side he his ory of crossing is described by he so called crossin sequence of leng h 1 for he lef side and 2 for he righ side, respec ively, wi h 1 , 2 b(n) Any crossing sequence consis s from so called crossin sequence elements ha are ordered chronologically in ha order in which he head has crossed he respec ive rec angle side. Each elemen of a crossing sequence is represen ed by a pair q d . Here q deno es he s a e of M when crossing he ver ical side a hand and d lef t ri ht records he direc ion of he crossing. Hence, he size of each second order rec angle represen a ion is (b(n)), wha in a o al gives O(T 2 3 (n) b(n)) per ime segmen , or O(T (n) b(n)) for all rec angles. The rec angular represen a ion of M’s compu a ion per inen o he given inpu ha is wri en on ’s inpu ape will be represen ed on ’s ape in he following order, from lef o righ : i is he sequence of individual second order rec angles ha is genera ed for ime segmen by ime segmen , and wi hin each ime segmen , rs order rec angle by rs order rec angle, and wi hin each rs order rec angle, second order rec angle by second order rec angle, in chronological order. Boundaries be ween individual ( rs and second order) rec angles, and ime segmen s, respec ively, are marked by special symbols on a special rack. To represen he compu a ions of M in accordance wi h he idea men ioned before he s a emen of he heorem 22 we need moreover o record he posi ion of M’s inpu head ha corresponds o each crossing sequence elemen in each second order rec angle. Consider he sequence of crossing sequence elemen s ordered chronologically i.e., in ha order in which he boundaries be ween slo s are crossed during M’s compu a ion and consider also he respec ive associa e sequence of corresponding inpu head posi ions. This associa e sequence has as many elemen s as is he leng h (T (n)) of our chronologically ordered crossing sequence and he respec ive elemen s are in egers in he range < 1 n >. Now, ins ead of recording he absolu e posi ions of M’s inpu head on he inpu ape, record only he di erences d = p − p −1 beween any wo absolu e posi ions p and p −1 , respec ively, for i = 0 1 (T (n)) and p0 = 1 2 Thus, he di erences are in egers from he in erval < −n + 1 n − 1 >. The size of represen a ion of any d is a mos log n Superpose now he resul ing sequence ha , s ar ing from p0 enables o compu e M’s inpu head posi ions, wi h he above men ioned chronologically ordered crossing sequence and call he resul ing merged sequence a lo of M’s head movemen . Thus he log elemen s ake he form q d d of riples, where q deno es he s a e of M d he direc ion of M’s working head movemen , and d he di erence be ween curren and previous posi ion of M’s inpu head, wi h all values wi hin he i h riple per inen o he momen when M’s working 2
The idea of encoding head movemen by di erences in i s posi ions a prede ermined imes has been previously used by [8].
Speeding Up Nonde erminis ic Single Tape O -Line Compu a ions
613
head is crossing for he i h ime a boundary be P ween any wo slo s. Ignoring i ems (T (n)) of cons an size, for he log elemen s i holds ha d Therefore, he =1 PT(T(n). (n)) leng h of he corresponding represen a ion can be bounded by log d = =1 = O(log
Q (T (n)) =1
d )
O
(T (n)) log
P
(T (n)) =1
(T (n))
d
= O T (n) log log T (n)
log T (n)
The log represen a ion will be also represen ed on ’s working ape in a na ural way from lef o righ , wi h special separa ors in be ween he ime segmen s ha spli he log in o segmen s ha correspond o he compu a ions of M of leng h T 2 3 (n) I is no difcul o show by a similar argumen as above ha he leng h of represen a pion of a par of he log corresponding o any ime segmen is O(T 2 3 (n) log log T (n) log T (n)) In order o have he possibili y o work ex ra, bu in parallel wi h each ime segmen we will insis ha bo h rec angular represen a ion and he log represen a ion will be wri en one above he o her on wo parallel racks on ’s working ape. Moreover, we shall require ha he respec ive ime segmen separa ors bo h in he rec angular represen a ion and in he log will nd hemselves a he same posi ions. I is clear ha his can be done while preserving he ape leng h propor ional o he previously es ima ed o al leng h of log. Namely, comparing he previous es ima es of he leng h of a ime segmen in he log and in he rec angular represen a ion we see ha he former represen a ion is always grea er. Thus, by padding he represena ion of a ime segmen in he rec angular represen a ion wi h sui able symbols we can always achieve p ha bo h represen a ions will be of equal leng h, no exceeding O(T 2 3 (n) log log n log T (n)) This es ima e will be impor an for he complexi y es ima ion of ac ions performed wi hin one ime segmen . Never heless, i is obvious ha he o al leng h of he join represenpa ion of he log and of all second order rec angles is of order O(T (n) log log T (n) log T (n)) i.e., is bounded by he leng h of he log. Now, he idea of simula ion is rs o guess and record he above rec angular represen a ion simul aneously wi h he log of M’s compu a ions and hen o verify he correc ness of he above guesses. The veri ca ion process consis s of wo main phases. Firs , we have o verify whe her he guess of rec angular represen a ion was correc i.e., whe her all rec angles ‘ ’ oge her and whe her he size an he forma of rec angular represen a ion and of he log have been guessed correc ly (a so called lobal correctness). Second, we have o a es whe her each rec angle represen s a valid piece of M ’s compu a ion. Such a compu a ion s ar s in par ial con gura ion as described by he upper horizon al side of he rec angle a hand and ends in a con gura ion as described by he lower side of he rec angle. Moreover, in such a compu a ion M’s working head mus leave and re en er rec angles in accordance bo h wi h he respec ive wo crossing sequence a bo h rec angle’s ver ical sides and wi h he symbol read by M’s inpu head a ha ime (so called local correctness). This leads o he design of he simula ion scheme in which M is simula ed by a single ape o line 2 -machine in wo main phases: in he rs , nonde erminis ic (exis en ial) one, all guesses will be performed, whereas in he second, universal one, he veri ca ion of all previous guesses will be done. The e cien realiza ion of his idea requires a number of auxiliary da a s ruc ures. In hese s ruc ures, e.g. he number of second order rec angles, and of crossing sequence elemen s, wi hin each ime segmen , is kep . Addresses of each second order rec angle wi hin he rec angular represen a ion are needed as well. Moreover, here mus be informa ion abou he posi ion of inpu head wi hin each log segmen , plus he index of he corresponding slo in which he working head nds i self a ha ime, e c.
614
Jir Wiedermann
Making use of all hese s ruc ure he simula ion machine is able o orien i self in he rec angular represen a ion and log, separa ed in o individual ime segmen s, as wri en on he working ape. The simula ion ends successfully when all he veri ca ions performed ermina e successfully and in he universal subphase an accep ing rec angle has been discovered. The ime complexi y of simula ion is domina ed by he ime needed p o genera e he log in he exis en ial phase. Therefore i s leng h O(T (n) log log T (n) log T (n)) is a he same ime he bound on he ime complexi y of he en ire simula ion.
2
3
Separation Result
In erms of complexi y classes he previous heorem says ha for a sui able T (n) he class of nonde erminis ic T (n) ime bounded single ape o line compu aions is a subse of he T (n) log log T (n) log T (n)- ime bounded compu a ions on a 2 machine of he same ype: NTIME1+I (T (n))
2 -TIME1+I (T (n) log log T (n)
log T (n))
To prove a separa ion resul rela ed o he above men ioned complexi y classes ha are bounded by he same func ion we shall need he following hierarchy heorem for nonde erminis ic single ape of line machines by Lorys and Liskiewicz [7]: Theorem 31 Let T2 (n) be a fully time constructible function, with n log n o(T2 (n)) and such that there exists a deterministic o line Turin machine which for each input of len th n writes on the work tape the binary representation of T2 (n) in time T2 (n) Let T1 (n + 1) o(T2 (n)). Then NTIME1+I (T1 (n)) NTIME1+I (T2 (n)) Now we are in a posi ion o prove he separa ion resul we are af er: Theorem 32 Let T1 (n) = T (n) and T2 (n) = T (n) log log n ful ll the assumptions of Theorem 31 and let T2 (n) ful lls the assumptions of Theorem 22. Then NTIME1+I (T (n)) 2 -TIME1+I (T (n)) Proof Outline: From Theorem 31 we know he proper inclusion NTIME1+I (T (n)) NTIME1+I (T (n) log log T (n)) According o he Theorem 22 he la er class is con ained in 2 -TIME1+I
T (n) log log T (n) lo
lo (T (n) lo lo T (n)) lo (T (n) lo lo T (n))
2 -TIME1+I (T (n))
2
I appears ha all he previous heorems can be reworked o hold also for complemen ary classes co-NTIME1+I(T (n)) and 2 -TIME1+I (T (n)) However, from space reasons we will abs ain from he formula ion of he respec ive proofs (cf. [13] for a similar procedure for case of single ape machines wi hou an inpu ape).
Speeding Up Nonde erminis ic Single Tape O -Line Compu a ions
4
615
Conclusions
I has been shown ha for a large class of iden ically ime bounded compu a ions, adding of one more al erna ion o a nonde erminis ic or co-nonde erminis ic Turing machine wi h one work ape and ex ra inpu ape leads o s ric ly larger complexi y classes. Thus, for such machines he rs and he second level of he respec ive al erna ing hierarchy of complexi y classes do no collapse. This seems o be he rs occasion where such a general resul has been achieved for a res ric ed ype of mul i ape nonde erminis ic Turing machines.
References 1. Book, R.V. Greibach, S.A. Wegbrei , B.: Time and Tape Bounded Turing Accep ors and AFLs. JCSS 4, Vol. 6, Dec. 1970, pp. 602 621 2. Hennie, F.C.: One Tape, O line Turing Machine Compu a ions. Information and Control, Vol. 8, 1965, pp. 553 578 3. Dymond, P.W. Tompa, M.: Speedups of De erminis ic Machines by Synchronous Parallel Machines. In Proc. 24th Annual IEEE Symposium on Foundations of Computer Science, pp. 336 364, 1983 4. Gup a, S.: Al erna ing Time Versus De erminis ic Time: A Separa ion. Proc. of Structure in Complexity, San Diego, 1993 5. Hopcrof , J. Paul, W. Valian L.: On ime versus space and rela ed problems. Proc. IEEE FOCS 16, 1975, pp. 57 64 6. Kannan, R.: Al erna ion and he power of nonde erminism (Ex ended abs rac ). Proc. 15 th STOC, 1983, pp. 344 346 7. Lorys, K. Liskiewicz, M.: Two Applica ions of F¨ uhrers Coun er o One Tape Nonde erminis ic TMs. Proceedin s of the MFCS’88, LNCS Vol. 324, Springer Verlag, 1988, pp. 445 453 8. Maass, W.: Combina orial Lower Bound Argumen s for De erminis ic and Nondeerminis ic Turing Machines.Trans. Am. Math. Soc. 292, 1985, pp. 675 693 9. Maass, W. Schorr, A.: Speed-up of Turing Machines wi h One Work Tape and Two way Inpu Tape. SIAM J. Comput., Vol. 16, no. 1, 1987, pp. 195 202 10. Pa erson, M.: Tape Bounds for Time Bounded Turing Machines, JCSS, Vol. 6, 1972, pp. 116 124 11. Paul, W. Prauss, E. J. Reischuk, R.: On Al erna ion. Acta Informatica, 14, 1980, pp. 243 255 12. Paul, W.J. Pippenger, N. Szemeredi, E. Tro er, W.T.: On de erminism versus nonde erminism and rela ed problems. In Proc. 24th Annual IEEE Symposium on Foundations of Computer Science, pp. 429 438, 1983 13. Wiedermann, J.: Speeding up Single Tape Nonde erminis ic Compu a ions by Single Al erna ion, wi h Separa ion Resul s. Proceedin s of the 23 rd International Colloquium on Automata, Lan ua es, and Pro rammin , ICALP’96, LNCS Vol. 1099, Springer Verlag, Berlin, 1996 14. Wiedermann, J.: Accelera ing Nonde erminis ic Single Tape O Line Compu aions by One Al erna ion. Technical Repor V-725 97, Ins i u e of Compu er Science, Prague, 1998
Facial Circuits of Planar Graphs and Context-Free Lan ua es ? Bruno Courcelle1 and Denis Lapoire2 1
2
LaBRI (UMR 5800, CNRS), Universite Bordeaux 351, cours de la Liberation 33405 Talence Cedex (France)
[email protected] University of Bremen, P.O. Box 33 04 40, D-28334 Bremen (Germany) lden s@ nformat k.un -bremen.de
Abs rac . It is known that a lan ua e is context-free i it is the set of borders of the trees of reco nizable set, where the border of a (labelled) tree is the word consistin of its leaf labels read from left to ri ht. We ive a eneralization of this result in terms of planar raphs of bounded tree-width. Here the border of a planar raph is the word of ed e labels of a path which borders a face for some planar embeddin . We prove that a lan ua e is context-free i it is the set of borders of the raphs of a set of (labelled) planar raphs of bounded tree-width which is de nable by a formula of monadic second-order lo ic.
Thatcher and Wri ht [12] (see also Doner [5]) characterize context-free lanua es as the ima es of the reco nizable sets of nite trees under a mappin border that produces for each iven tree the sequence of symbols labelin its leaves, read from left to ri ht. Our aim is to extend such a characterization to Monadic Second Order de nable sets of raphs. Here, the border mappin concerns special raphs, that have a unique path of labeled ed es. Such a mappin , whose study is investi ated by En elfriet and Heyker [6], associates with every special raph the word read on the path. We know that the lan ua e enerated by a MS-de nable set of raphs is in eneral not context-free (see Example 1). 1 is de ned by the Example 1. The noncontext-free lan ua e an bn cn n MS-de nable set of special raphs Gn n 1 described in Fi . 1. Thus, we impose two restrictions. First, we consider special planar raphs, that admit a planar embeddin in which the labeled path borders a face (see Example 2). The path is actually made from a circuit by means of a special ed e marked #. Secondly, we consider sets of raphs of uniformly bounded tree-width. The tree-width is a measure of complexity for raphs introduced by Robertson and Seymour [11]. Example 2. The context-free lan ua e an bn de nable set of special-planar raphs Hn n ?
n 1 is de ned by the MS1 described in Fi . 2.
Research partly supported by the EC TMR Network GETGRATS (General Theory of Graph Transformation Systems).
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 616 624, 1998. c Sprin er-Verla Berlin Heidelber 1998
Facial Circuits of Planar Graphs and Context-Free Lan ua es
617
# b a
a
a
c
c
c
b
b
Fi . 1. A special raph G3 that de nes the word a3 b3 c3 . # a
a
a
b
b
b
Fi . 2. A special-planar raph H3 that de nes the word a3 b3 . Our main result is to characterize the context-free lan ua es as the sets of borders of MS-de nable sets of special-planar raphs of bounded tree-width.
1
Special Graphs
De nition 3. A hyper raph G is a tuple (V E f ), denoted by (VG EG vertG ), where V is the nite set of vertices, where E is the nite set of hypered es which is supposed disjoint with V and where f associates with every e E the sequence of its extremities f (e), supposed pairwise distinct (there is no loop) and denoted by (f (e 1) f (e n)). The initial (resp. terminal) extremity of e is f (e 1) (resp. f (e n)). A raph is a hyper raph such that each hypered e is an ed e, that has two extremities. A vertex x and an ed e e are incident if x is an extremity of e. om ) (VG EG )+ A path of some raph G is a sequence p = (o1 for some m 1 where oi and oi+1 are incident for every i [m − 1] and where o1 (resp. om ) is a vertex, its initial (resp. terminal) extremity. All vertices and ed es of a path, except eventually its extremities, are supposed pairwise distinct. A path is a cycle if o1 = om . It is said oriented if for every arc oi with i [2 m − 1], we have oi−1 = vertG (oi 1) and oi+1 = vertG (oi 2). A circular path is an oriented path havin identical extremities. To simplify, an oriented path is represented by a sequence of ed es. The raph G is connected if all two vertices are the extremities of some path of G. Let H and K be two hyper raphs. H is a subhyper raph of K if VH VK , EH EK and vertH vertK . If vertH (d) = vertK (d) for each d EH EK , the union of H and K, denoted by H K, is the hyper raph (VH VK EH EK vertH vertK ). De nition 4. A tree is a connected raph that contains no cycle. A vertex (resp. ed e) of a tree T is called a node (resp. arc). Their set is denoted by AT and s is an extremity of f , we let NT (resp. AT ). If T is a tree, if f T (f s) denote the subtree of T consistin of s and all paths in T containin s but not f . If a tree T is iven with a root r, we direct its arcs from the root
618
Bruno Courcelle and Denis Lapoire
towards the leaves. Every node except the root has then a unique father and zero, one or several sons. A leaf has no son. If x NT , we let T x = T if x = r, T x = T (f x) if f is the ed e between x and its father. The root of T x is x. In this article, # denotes a special label. De nition 5 (Special raphs). Let X be an alphabet that does not contain #. A special raph over X is a raph G with a unique ed e labeled #, denoted (Ea )a2X where Ea EG , the sets Ea are pairwise by #G , and with a family S Ea a X #G is the set of ed es of a unique disjoint and EX = circular path γ(G) of G havin as last ed e #G ; moreover, we suppose that no two distinct ed es havin same sequence of extremities and same label (resp. no label). We shall say that e EG has label a i e Ea . Some ed es of G may have no label. an For each special raph G, we let bd(G) X + be the nonempty word a1 where (e1 en #G ) is the circular path γ(G) and where for each i [n], ei is ej ) is a path in γ(G), labeled ai . We call it the border of G. If = (ei ei+1 aj which is a factor of γ(G). we denote by bd( ) the word ai ai+1 Such a raph will be represented by the relational structure G 2 =< VG EG incG (laba G )a2X[f#g > where laba G (e) holds i e Ea (or e = #G ) and incG = (e x y) e EG e links x to y . Hence, sets of raphs can be de ned by formulas in Monadic Second Order lo ic or in Countin MS lo ic, a re nement of MS lo ic usin special predicate expressin cardinality of sets modulo xed inte ers; see [2,3,4]. Such sets are said MS-de nable (resp. CMS-de nable), for short. MS lo ic is the extension of First-Order lo ic with set variables. For words and binary trees, MS-de nability equals reco nizability. De nition 6 (Tree-width). A tree-decomposition is a pair (T ) where T is a tree and where associates with every node t of T a raph (t) such that: E (s) E (t) = , for all distinct nodes s t of T . for all nodes s u of T and every node t of the path of T from s to u, we have: V (s) V (u) V (t) . The width of (T ) is the maximum of card(V (t) )− 1 taken over all t NT . The tree-width of a hyper raph G, denoted by S twd(G), is the minimum width of all tree-decompositions (T ) of G (such that t2NT (t) = G). De nition 7. Let (T ) be a tree-decomposition of a raphS G. If T 0 is a subtree 0 (s) s NT 0 . of T , we denote by G[T ] the sub raph of G de ned as T 0 ) is a tree-decomposition of G[T 0 ]. Let now G be special. A Thus (T 0 tree-decomposition (T ) of G is special if: 1. T has a root r which veri es #G E (r) . S E (u) u 2. for every s NT and incident ed e f , the set of ed es EX T (f s) is either empty, or is EX or forms a noncircular path, that we shall denote by γ(G f s).
Facial Circuits of Planar Graphs and Context-Free Lan ua es
619
We say that such a tree-decomposition is compact if for all f and s, γ(G f s) is a (nonempty) noncircular path. Let t be a node of some compact tree-decomposition (T ), d the eventual ed e linkin t to its parent. tn are linked to t by d1 dn . Clearly, if t is (resp. is Its sons t1 not) the root, γ(G) (resp. γ(G d t)) admits a unique expression of the form γ(G d (n) t (n) )wn for some permutation on [n]. We w0 γ(G d (1) t (1) )w1 bd(wn )). denote by t the sequence of words (bd(w0 ) Here is some intuition: a path in a raph iven with a tree-decomposition yields a traversal of a portion of the tree of the tree-decomposition. Special means that the distin uished path yields a sin le traversal of each subtree. Compact means that every box of the tree-decompositions contains one ed e of the distin uished path. Example 8. Fi ures 3 and 4 represents two tree-decompositions (T ) and (T h) of a same raph G (in the left part of Fi . 4) and havin a same tree T (in the left part of Fi . 3). The node 1 is the root of T . (T ) is not special: the raph γ(G) G[T 5 ] consists of two paths with correspondin words bb and dd.
a
1 2
a
3
#
a c
a
a
e
b
4
5
b
d
d
Fi . 3. A non special tree-decomposition.
(T h) is special: for example, γ(G) G[T 5 h] consists of a path with correspondin word bbcdd. (T h) is not compact, because γ(G e 4) is empty.
a a
a
#
a a a
a b
c b
d
d
a
#
a
a b
b
c
Fi . 4. A special but non compact tree-decomposition.
d
d
620
Bruno Courcelle and Denis Lapoire
De nition 9. Let F be a nite si nature and T(F ) be the set of nite terms built over F . Let X be a nite alphabet. For every f F of arity k, let be iven uk ), u0 uk X . We de ne a mappin a sequence of words f = (u0 tk )) = u0 (t1 )u1 (t2 ) (tk )uk where : T(F ) X by lettin : (f (t1 u k ) = f , f F , t1 tk T(F ). If k = 0 then f = (u0 ) and we let (u0 is called a homomorphism: T(F ) X . (f ) = u0 . Such a mappin Proposition 10. If K T(F ) is a reco nizable set of terms and X is a homomorphism, then (K) is a context-free lan ua e.
: T(F )
Proof. One constructs a context-free rammar the derivation trees of which are the terms in K. The result is well known (see [5,12]).
2
Tree-Decompositions as Al ebraic Terms
In this section, k denotes a xed inte er and X a nite alphabet. De nition 11 (Hypered e-substitution). We denote by G the set of all hyper raphs G labeled over X # equipped with a sequence of pairwise distinct vertices, called the sequence of sources and denoted by srcG . Let H K G with EH EK = and let e be an ed e of H such that vertG (e) equals srcK and contains every vertex of VH VK , we denote by H K e the hyper raph obtained from H K by for ettin the ed e e and havin as sequence of sources srcH . It results from the substitution in H of K for e. Notation 12 We denote by Tk the set of all compact tree-decompositions (T ) of width at most k − 1 such that every s NT has maximum de ree k. Let < < ep where be a linear orderin on VG EG such that e1 < e2 < e3 < ep #G ) = γ(G). For every s in NT , we order its set of sons as a (e1 e2 tn ), in such a way that the -smallest ed e in G[T ti ] is sequence (t1 strictly smaller with respect to than the -smallest one in G[T ti+1 ] and we make (s) into a hyper raph with sources, denoted by H(s), as follows: a) its sequence of sources is srcG if s = r, and, otherwise, consists of V (s) V (t0 ) in increasin order for with t0 the father of s. b) for each i = 1 n, we add to (s) a hypered e hi with sequence of vertices V (s) V (ti ) in increasin order for . For each isomorphism class of hyper raphs of the form H(s) with n hypered es and for each n + 1-tuple of the form s (see De nition 7), we et a function Gn ) of raphs with f for which f = s and that mapps an n-tuple (G1 sources into a raph with or without sources (If n = 0 then this function takes no ar ument and is a constant denotin a raph with sources). We denote by the homomorphism T(Fk ) X induced by Fk such a si nature and by (f f ) f Fk . It follows that a tree-decomposition (T ) of a raph as above can be repreraphs the sented by a term t T(Fk ). We shall denote by val : T(Fk ) mappin from terms to isomorphism classes of raphs.
Facial Circuits of Planar Graphs and Context-Free Lan ua es
621
With these notations, we have: Claim 13 For every node s of some (T ) Tk , we have G[T s ] = ) G[T tn ] hn , where for each i = 1 n, (H(s) G[T t1 ] h1 G[T ti ] is equipped with a sequence of sources consistin of V (ti ) V (s) ordered in increasin way w.r.t . Proof. Obvious from De nition 11 and the above construction. Since X is nite, since multiple ed es of any raph have distinct labels, and by the limitations iven by the bound k, there are nitely many isomorphism classes of hyper raphs H(s). Hence, Fk is nite. The followin result will allow us to represent compact tree-decompositions by terms in T(Fk ). Lemma 14. The de ree of a compact tree-decomposition of width at most k − 1 is at most k. Proof. Easy. Proposition 15. Let L be a CMS-de nable set of special raphs, let L0 be the set of raphs in L havin a compact tree-decomposition of width at most k − 1. Then bd(L0 ) is a context-free lan ua e. Proof. Let (T ) be a compact tree-decomposition of some raph G and let be the total order on VG EG de ned in Notation 12. A term t T(Fk ) represents (T ) if it is constructed from (T ) as in Notation 12 and if for every occurrence t of a symbol f Fk associated with a node u of T , we have: f = u. For every arc e from s to u in T , we have (t u) = bd(γ(G e u)). This is strai htforward by induction on the depth of t u from the de nitions of f and u. It follows that (t) = bd(γ(G)) = bd(G). Let L be a CMS-de nable set of special raphs, L0 be the subset of those havin a compact tree-decomposition of width at most k − 1. Let K T(Fk ) be the set of terms representin all these tree-decompositions. Thus, every term t T(Fk ) belon s to K i 1. val(t) L. 2. t actually speci es a compact tree-decomposition of width at most k − 1 (some terms may specify tree-decompositions that are even not special or de ne raphs that are not special). Condition (1) is CMS-de nable (because val−1 preserves CMS-de nability, see Courcelle [3]); condition (2) is easy to express in MS-lo ic. It follows that K is CMS-de nable, hence, reco nizable by the theorem of Doner et al. [5,2]. As a consequence of Lemma 14, each compact (T ) is represented by some term t T(Fk ) which veri es (t) = bd(γ(G)). It follows that bd(L0 ) = bd(val(t)) = (K), hence is a context-free lan ua e by Proposition 10.
622
Bruno Courcelle and Denis Lapoire
Our aim is now to extend Proposition 15 to sets of raphs havin special tree-decompositions of bounded width (as opposed to compact ones). We need some preliminary results from Courcelle (see [2] or the survey [4]). Notation 16 (Parallel-composition) Let n IN, let H and K be two ed edisjoint raphs havin the same sequence of n sources. If every common vertex of H and K is a source, then we denote by H n K the raph with no source obtained from the union H K by for ettin the sources. We denote by the isomorphism of raphs with and without sources (the isomorphism must preserve the sequence of sources in an obvious way). Let L be a CMS-de nable set of raphs. It is reco nizable (see [2]), hence we have the followin : Kp of raphs with a Fact 17 For every n, there exists a nite set K1 sequence of n sources such that for every raph K with n sources, there exists i such that for every raph G if G = H n K then: G
L
H
0 n Ki
L for some Ki0
Ki
(This means that in a raph G, a factor K can be replaced by one of bounded size, which is syntactically equivalent w.r.t. L). For later reference, we let p . (L n) denote max card(VKi ) − n i = 1 Proposition 18. Let m IN and L be a CMS-de nable set of special raphs, each of them havin a special tree-decomposition of width at most m. There exists an inte er k and a subset L0 of L such that bd(L0 ) = bd(L) and every raph in L0 has a compact tree-decomposition of width at most k. Proof. Let G L and (T ) be a special tree-decomposition of G of width at most m which is not compact. We let N0 NT be the set of nodes s of T such that (s) contains at least one ed e of γ(G). We let T 0 be the sub raph of T consistin of the (undirected) paths in T linkin two nodes of N0 . It is clear by the properties of tree-decompositions that T 0 is connected hence is a tree. Note that r T 0 . We shall de ne G0 L such that bd(G0 ) = bd(G) and havin a compact tree-decomposition of width at most k, where k is lar e enou h, but xed and de ned from m and the CMS-formula which characterizes L. Let u NT 0 which has nei hbors in T which do not belon to T 0 ; we call sl (since r NT 0 , the father of u in T is also in T 0 ). We let them s1 G[T sl ] and H be the unique sub raph of G such that K = G[T s1 ] V (u) hence has cardinality n at most G = H K. Note that S = VH VK m + 1. The circular path γ(G) is included in H. Let K 0 be the raph with n sources syntactically equivalent to K w.r.t. L obtained by Fact 17. Consider now G0 = H n K 0 ; it belon s to L, hence is a special raph; the circular path γ(G) bein in H is also in G0 . We obtain a T sl and replacin tree-decomposition for G0 from (T ) by deletin T s1
Facial Circuits of Planar Graphs and Context-Free Lan ua es
623
(u) by (u) n K 0 . We repeat this step for each node u of T 0 havin nei hbors in T that are not in NT 0 , and we eliminate these nei hbors. Doin this, we reduce the size of G, we restrict T to T 0 but we increase by the constant additive factor max (L n) n m + 1 (see Fact 17). Hence, we et at the end a raph G0 L such that bd(G0 ) = bd(G), G0 has a compact tree-decomposition of width at most k = m + max (L n) n m + 1 . Theorem 19. Let m IN and L be a CMS-de nable set of special raphs, each of them havin a special tree-decomposition of width at most m. Then, bd(L) is a context-free lan ua e. Proof. Immediate consequence of Propositions 15 and 18.
3
Special-Planar Graphs
A special raph G is special-planar if it is planar and if γ(G) borders a face in some planar embeddin of G. Such raphs verify the followin property, which is a consequence of a more eneral result of [8] or [7]. We have not enou h space to include the proof. Proposition 20. Every special-planar decomposition of width twd(G).
raph G admits a special tree-
Proposition 21. Every context free lan ua e L X + is bd(K) for some MSde nable set K of special-planar raphs of twd 2. Proof. The URL http :
proof is available in a more complete version at dept − nfo labr u − bordeaux fr courcell ActSc html.
Now, we can establish our main theorem. Theorem 22. A lan ua e L X + is context-free if and only if it is bd(K) for some CMS-de nable set K of special-planar raphs of bounded tree-width. Proof. As a consequence of Propositions 20, 21 and Theorem 19. As an immediate consequence of Theorem 22, a very simple proof of a wellknown result on context-free lan ua es (see [1]). Two words v w are said to be conju ates if there exist words t u such that v = t u and w = u t. If L is a lan ua e, its conju acy closure, denoted by L , is the set L au mented with all conju ates of all its words. Corollary 23. The class of context-free lan ua es is closed under conju acy closure. Proof. Let L be a context-free lan ua e. By Theorem 22, there is a CMSde nable set K of special-planar raphs of bounded tree-width such that L = bd(K). Two special raphs G and H are said conju ate if there is p [n] such that H is obtained from G by relabellin every ei with the label of ef (i) with γ(G) = (e1 en ) and where f is de ned by f (i) = i (resp. = n, = i − 1) for each i [p− 1] (resp. i = p, i [p+ 1 n]). Let K be the conju ate closure of K. Clearly, K is CMS-de nable, hence, veri es the conditions of Theorem 22 and bd(K ) = L . Then, L is context-free.
624
Bruno Courcelle and Denis Lapoire
Discussion: In Theorems 19 and 22, one can replace CMS-de nable by reco nizable since it is proved in [9] that CMS-de nability equals reco nizability for sets of raphs of bounded tree-width (see [2] or [3] or [4] for reco nizable sets of raphs). The limitation to bounded tree-width cannot be eliminated since it is proved in [10] that context-sensitive lan ua es can be de ned similarly as borders of rids. With the limitation of γ(G) to border a face, one can obtain noncontext-free lan ua es as shown in Example 1. One may ask about a similar characterization of linear lan ua es in terms of special-planar raphs of bounded parh-with.
References 1. J.-M. Autebert. Lan a es al ebriques. Etudes et recherches en informatique. Masson, 1987. 2. B. Courcelle. The monadic second-order lo ic of raphs I: Reco nizable sets of nite raphs. Information and Computation, 85:12 75, 1990. 3. B. Courcelle. The monadic second-order lo ic of raphs V: On closin the ap between de nability and reco nizability. Theor. Comput. Sc., 80:153 202, 1991. 4. B. Courcelle. The expression of raph properties and raph transformations in monadic second-order lo ic. In Handbook of Graph Grammars and Computin by Graph Transformations. Vol. I: Foundations, chapter 5, pa es 313 400. World Scienti c, 1997. 5. J. Doner. Tree acceptors and some of their applications. J. Comp. Syst. Sc., 4:406 451, 1970. 6. J. En elfriet and L. Heyker. The strin eneratin power of context-free hyper raph rammars. J. Comp. Syst. Sc., 43:328 360, 1991. 7. D. Lapoire. Treewidth and duality for planar hyper raphs. submitted. 8. D. Lapoire. Structuration des raphes planaires. PhD thesis, Universite Bordeaux I, Novembre 1996. 9. D. Lapoire. Reco nizability equals monadic second-order de nability for sets of raphs of bounded tree-width. In Proc. STACS’98, volume 1373 of LNCS, pa es 618 628. Sprin er Verla , 1998. 10. M. Latteux and D. Simplot. Context-sensitive strin lan ua es and reco nizable picture lan ua es. Information and Computation, 138,2:160 169, 1997. 11. N. Robertson and P. D. Seymour. Graph minors. III. Planar tree-width. J. Comb. Theory Ser. B, 36:49 64, 1984. 12. J.-W. Thatcher and J. Wri ht. Generalized nite automata theory with an application to a decision problem in second-order lo ic. Math. Systems Theory, 3:57 81, 1968.
Optimizin OBDDs Is Still Intractable for Monotone Functions ? Kazuo Iwama1 , Mitsushi Nozoe1 , and Shuzo Yajima2 1
2
Kyoto University, Kyoto 606, Japan Kansai University, Takatsuki, Osaka 569, Japan nouzoe@ku s.kyoto-u.ac.jp
Abs rac . Optimizin the size of Ordered Binary Decision Dia rams is shown to be NP-complete for monotone Boolean functions. The same result for eneral Boolean functions was obtained by Bolli and We ener recently. Keywords.Ordered Binary Decision Dia rams,NP-completeness, Monotone Functions
1
Introduction
It is well known that optimization problems are enerally hard. However, the de ree of this hardness is exceptionally hi h for the optimization of Boolean circuits. Let size (C) denote the smallest size of the circuit that is equivalent to the iven circuit C. Then (i) even the problem askin whether size (C) = 0 (i.e., whether C’s output is always 0 or always 1) is co-NP-complete, which is so-called the tautolo y problem. Furthermore (ii) any concrete family of circuits C of n variables such that size (C) > 4n has never been known[12] althou h its avera e for the whole circuits is easily calculated to be exponential[9]. These facts su est that Boolean circuits, which appear to be the only way of realizin Boolean functions, mi ht not be a ood way of representin Boolean functions. Another approach that mi ht be better for this purpose is to use Ordered Binary Decision Dia rams(OBDDs), rst introduced by Bryant[3]. There are lots of merits includin : (i) Several problems such as the equivalence problem of two OBDDs can be solved in polynomial time. (Hence the question size(B) = 0? for a iven OBDD B is now easy.) (ii) We can prove exponential lower bounds of size (B) for several kind of OBDDs[e. .,5,6]. More importantly, it is also known that size (B) is polynomial for many practical functions such as the binary addition. Not surprisin ly, therefore, there is a hu e literature dealin with the optimization problem of OBDDs[e. .,7]. Unfortunately, however, those papers mostly depend on heuristic approaches, and we had few concrete results on its computational complexity for lon time. The rst breakthrou h was in 1993. Tani, Hama uchi and Yajima proved that optimizin SBDDs is intractable[10], where ?
Supported in part by Scienti c Research Grant, Ministry of Education, Japan
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 625 635, 1998. c Sprin er-Verla Berlin Heidelber 1998
626
Kazuo Iwama et al.
SBDDs are an extension of OBDDs that can express multiple functions. There appeared to be a somewhat lar e ap between provin the intractability for SBDDs and OBDDs. However, the second breakthrou h was iven by Bolli and We ener[2] who succeeded in llin this ap, i.e., provin the intractability of optimizin OBDDs. In this paper, we show that the OBDD optimization problem is still intractable for monotone functions. It should be noted that there a ain appear to be a ap between our result and that of Bolli and We ener. To see this, for example, one should remember that exponential lower bounds are known for monotone circuits[1] a ainst only 4n for eneral circuits as mentioned above. Namely, we can use speci c proof techniques for monotone circuits that are not applicable in eneral. In the case of OBDDs, we can use so-called non-crossin OBDDs to represent monotone functions and our result holds for this subclass of OBDDs. Another contribution of this paper, we believe, is that althou h it follows the basic structure of [2] (and [10]), our intractability proof is simpler than [2]. As is well known, NP-hardness proofs must involve some kind of lower-bound proofs, which are sometimes very hard to read. However, this di culty can be reduced by payin much care to the desi n of the reduction and of course by inventin nice lemmas characterizin the tar et system which is now OBDDs. Needless to say, both contribute a lot to better understandin of OBDDs, which is even as important as the improved intractability result itself. It is easily seen that the problem (both for OBDDs and for SBDDs) is in P for majority functions. Henceforce, the next important oal is to (dis)prove that minimizin OBDDs is NP-hard for threshold functions.
2
Monotone Functions and OBDDs
A literal is a (Boolean) variable, x, or its ne ation x. x is sometimes called a xn ) is positive literal and x a ne ative literal. A Boolean function f (x1 x2 said to be monotone if f can be iven as a formula that includes only positive literals[8]. A typical example of a monotone function is a majority function which becomes 1 i more than one half of the whole variables are assi ned 1. See Fi .6. An ordered binary decision dia ram(OBDD) is a directed acyclic raph B(f ), which represents a Boolean function f . For its formal de nition, see, e. ., [10]. The OBDD in Fi .6 represents function f = x1 + x2 x3 . An OBDD is iven with a variable orderin = ( [1] [2] [ X ]), like B(f ), where [i] = j means variable xj appears at level i. Thus, in each path of B, the node for variable xj (if any) must appear at level i only once if [i] = j. In the OBDD in Fi .6, its variable orderin is = (3 2 1). Note that each node v in B represents the Boolean function which is obtained from f by assi nin 0 or 1 to the variables which already appeared above that node. If two nodes v1 and v2 represent the same function, then v1 and v2 are said to be equivalent. Two or more equivalent nodes can be mer ed.
Optimizin OBDDs Is Still Intractable for Monotone Functions
627
Suppose that both 1-ed e and 0-ed e from a node v o to the same node. Then v is said to be redundant and can be removed. Thus some variables may not appear (i.e., no node exists) in each path of B (see Fi .6). If B does not include redundant or equivalent nodes, then G is said to be reduced. The size of B, B , is de ned as the number of total nodes includin the two constant nodes. Now here is the most fundamental property of OBDDs. Proposition 1[3]: Reduced B(f ) is unique if f and are xed. In this paper, OBDDs mean reduced OBDDs unless otherwise stated. Thus the size of an OBDD B is also xed if the variable orderin is xed.
3
Main Results
Our problem in this paper is optimizin OBDDs, which is equivalent to ndin the best variable orderin by Proposition 1. More precisely, the OBDD Optimization Problem(OPT-OBDD) ives us a (not necessary reduced) OBDD B and an inte er k, and asks whether there is a variable orderin under which B is at most k. If this iven B is of size exponential in the number of variables, then the problem is not interestin , and that is why only polynomial-size OBDDs appear in this paper. Also recall that we shall prove that OPT-OBDD is NP-complete for monotone functions. It is not hard to see that monotone functions can be represented by non-crossin OBDDs which can be drown in such a way that there is no crossin between any two 0-ed es or between any two 1-ed es. Conversely, non-crossin OBDDs always represent monotone functions. All OBDDs from now on are non-crossin , i.e., our results holds for this subclass of OBDDs. As in [2], our NP-hardness proof uses a reduction from the Optimal Linear Arran ement Problem (OLA)[4]. An instance of OLA is a raph G = (V E) and a positive inte er K. Its question is whether there is a one-to-one function (specifyin an order of vertices) : V 1 2 V such that the cost of (u) − (v) , is at most K. See the example shown in G iven by (u v)2E Fi .6(a), where the best order of the vertices is (1 2 3 4), whose cost is 5. Main Theorem: OPT-OBDD is NP-complete for monotone functions. Proof: The problem is obviously in NP since the eneral OPT-OBDD is in NP[10]. Its NP-hardness is proved usin the remainin three sections: In Sec.4, we describe how OLA is reduced to OPT-OBDD. For a iven raph G = (V E), we introduce two monotone functions called ed e functions and a penalty function. These functions are mer ed into a sin le function f usin extra variables and then the OBDD for f is computed. There are several important points here: Our penalty function needs much lar er width than an ed e function in their OBDDs, mer in into f also includes new ideas, and so on. Those will reatly contribute to make our later ar uments simpler and more readable. In Sec.5, we will summarize several useful properties on the transformed OBDDs. Sec.6 is the main section where we prove that our reduction is correct, i.e., it keeps a ti ht
628
Kazuo Iwama et al.
relation between the size of the optimal vertex order in OLA and the size of the 2 optimal OBDD.
4
Polynomial-Time Reduction
Two major buildin blocks in our reduction are ed e functions and a penalty function. An ed e function is denoted by EF (x xj ) which is the followin monotone function of p variables: EF (x xj ) = (x + xj ) k2f1 2 pgnf jg xk . See Fi .6(b) for an example of OBDDs for ed e functions, where the names of the variables are a little modi ed for some purpose later iven. Note that B(EF (i j)) depends on the positions of variables x and xj . Lemma 4.1: Suppose that [l1 ] = x and [l2 ] = xj for some 1 Then B(EF (i j) ) = l1 − l2 + p + 1.
l1 l2
p.
Proof: See Fi .6(b) a ain. Note that the OBDD in this ure satis es the above condition for its size. One can see easily that two nodes on the same level 2 are not equivalent. Thus the lemma holds. The penalty function is simply the majority function of n majority functions, which is denoted by M jm j in this paper: M jm j = M j
M j(x11 x12
x1m y11 y12
y1m )
M j(x21 x22
x2m y21 y22
y2m )
M j(xn1 xn2
xnm yn1 yn2
ynm )
Now we shall ive the reduction from OLA to OPT-BDD. Let G(V E) be a vn and E = m. Then we iven raph as an instance of OLA, V = v1 v2 x1m x21 x2m xn1 xnm , rst introduce T = 2nm + 4m variables, x11 y1m y21 y2m yn1 ynm a1 a2m and b1 b2m . Then our oal y11 is to construct a monotone function, H , in the followin procedure: (i) For each ed e (v vj ) in E, we construct two ed e functions fk = EF (x k xjk) fm and and k = EF (y k yjk ). Thus we have 2m ed e functions, f1 f2 1 2 m , in total (see Fi .6). The reason for introducin 2m functions instead of m ones is just technical, i.e., for easy calculation. (ii) Construct one penalty function of 2mn variables, which is exactly the same as M jm j iven above. (iii) Those 2m + 1 functions are combined into a sin le monotone function as follows (see Fi .6): H1 = a1 f1 + b1 M jm j + a1 b1 H2 −1 = a2 −1 f + b2 −1 H2 −2 + a2 −1 b2 −1
H2 = a2 1 + b2 H1 + a2 b2 H2 = a2 + b2 H2 −1 + a2 b2
H2m−1 = a2m−1 fm + b2m−1 H2m−2 + a2m−1 b2m−1 H2m = H = a2m m + b2m H2m−1 + a2m b2m
Optimizin OBDDs Is Still Intractable for Monotone Functions
629
The remainin job is to construct an OBDD which represents this H . For this purpose, we adopt what we call the standard variable order (or SVO). The re[2m] [2m+ sultin OBDD is denoted by B (G). SVO is iven as ( [1] [2] 1] [2m + 2] [2mn + 2m] [2mn + 2m + 1] [2mn + 2m + 2] [T ]) = b1 y11 y12 xmn a1 a2 a2m ). Recall that B (G) is not nec(b2m b2m−1 essarily reduced. Construction of B (G) is strai htforward and therefore we shall x8 )) is conuse an example to explain it. Let m = n = 4: (i) B (M j(x1 x2 structed as in Fi .6. B (M jm j) is its simple extension. B (fj ) was already iven in Fi .6 . To combine all those OBDDs, we use a and b . To see this, let us consider a function h = af +b +ab. One can see that if f and are monotone, then the whole h is also monotone. Combinin B (M jm j) B (f1 ) B ( 1 ) B (fm ) B ( m ) is a ain a simple extension of this construction (Fi .6). Lemma 4.2: B (G) can be written as 2K + (G), where K is the cost vn , and (G) is iven of the raph G in OLA when the vertex order is v1 v2 as the followin formula, (G) = 2(n − 1)m + (m2 + m)
( n 2 + 1)
n 2 + 4m + 2
2 Proof: Just by a simple countin . Now the raph G and Inte er K is transformed into the OBDD B (G) with the tar et cost of 2K + (G). One can see that this reduction can be done in polynomial time. Thus the buildin blocks are di erent, but the underlyin idea is the same as [2,10]: (i) As shown in Fi .6, OBDDs for ed e functions provide a hi h cost if the distance of the two nodes for a sin le ed e is lar e. (ii) No two ed e-function OBDDs share the same variables, i.e., there are di erent nodes for the same vertex of G. Hence, if we have only ed e function OBDDs then there exists a trivial orderin which minimizes the size. (iii) To prevent it, the penalty function is introduced. It ives us a penalty size if we separates the nodes for the same vertex of G. 5
Useful Properties
This section is for introducin more de nitions needed in later discussion and summarizin lemmas bein used to justify the reduction iven in the previous x8 ) in Fi .6 is optimal. section. First of all, the OBDD for M j(x1 x2 Lemma 5.1: For any variable orderin , the size of the OBDD for M j xp ) is iven as follows (Proof is omitted): (x1 x2 B(M j(x1 x2
xp )) =
(p 2 + 1) p 2 + 2 (if p is even) p 2 2+2 (if p is odd).
yj 1 j m , which is called the ith block. Let B = x j 1 j m If the variables in each B are arran ed consecutively in a variable orderin ,
630
Kazuo Iwama et al.
then it is called rouped, otherwise un rouped. If a variable orderin is rouped B n ), then we say that its hi h-level orderin , deand looks like (B 1 B 2 in ). If ( [i] [2nm + 4m − i + 1]) = noted by ( (1) (2) (n)), is (i1 i2 i 2m, i.e., if all a-variables are placed on the (b2m− +1 a2m− +1 ) for 1 top and all b-variables on the bottom, then this orderin is said to be splitted, otherwise unsplitted. Lemma 5.2: For any rouped variable orderin B(M jm j
,
) = S(2m)S(n) + 2
where S(i) is the size of an OBDD for i-variable majority functions except two constant nodes (Proof is omitted). xp ), f x1 =b1 x2 =b2 xq =bq , b = 0 or 1, For a p-variable function f (x1 x2 denotes the partially assi ned(PA) function. A properly partially assi ned(PPA) function means 1 q p − 1, i.e., there is at least one assi ned and unassi ned variables. If q = p, then we call it a totally assi ned(TA) function and if q = 0, a zero assi ned(ZA) function. Recall that M jm j is the majority function of n (j j ) xm y1 y2 y m) 1 i n. M j 1 2 majority functions M j (x 1 x 2 denotes a PA M j such that j1 variables are assi ned 0 or 1 out of which j2 ones are assi ned 1. (j j ) Note that the value of M j 1 2 may be xed to 0 or 1 even if it is not TA. (j1 j2 ) is said to be xed. M jm j(j1 j2 ) denotes a PA M jm j such Such M j that j1 M j ’s are xed out of which j2 are xed to 1. Then, the followin lemma holds (Proof is omitted). Intuitively speakin , M jm j has a lar e width. Lemma 5.3: For PA M jm j the followin property holds: (i) If the number of TA M j s is k1 , then the number of di erent (i.e., pairwise n 2 − 1, and n − k1 + 2 if inequivalent) PA M jm js is k1 + 1 if k1 n 2 , k1 (ii) If the number of PPA M j s is k2 and k2 n 2 , then the number of di erent PA M jm js is more than 2k2 .
6
Justi cation of the Reduction
In this paper, we assume m automatically holds when n under this assumption.
4n m 13 and n2 m2 2n 6 . The last inequality 281 in a iven raph in OLA. OLA is NP-hard
Lemma 6.1: An arbitrary unsplitted B(H ) can be transformed into a functionally equivalent splitted B(H ) with less nodes. Proof: Only the idea is iven bliefly: See Fi .6 where the OBDD chan es from G to G0 by movin some b-variable to the bottom and then chan es to G00 by movin some b-variable to the bottom. Let us look at what happens when we move b = b2m from level k (2 k T − 1) to level 1. Recall that G consists of
Optimizin OBDDs Is Still Intractable for Monotone Functions
631
OBDDs H for the penalty function and ’s for ed e functions. We now assume that the level k is intermediate for both H and ’s (and we also have to consider other cases). We de ne F as the set of di erent functions which can be obtained by assi nin 0 or 1 to each variable of level [i] [i + 1] [T ] of H . Then Fk+1 is expressed as follows: Fk+1 = bH1 bH2
bHk1
1 m
+b
2 m
+b
k2 m
+b
where H and m are the functions which can be obtained by assi nin 0 or 1 to each variable of [k + 1] [k + 2] [T ] of H and m , respectively. By the above 0 k00 , which are assumption, there are obviously at least two functions Hk and m 0 00 k + b depend on b and one can prove that the not constant. Both bHk and m two functions are not equivalent. Therefore, the number of nodes labeled b in G is at least two, which is lar er than that in G0 . The number of nodes at level ( [k + 1] [T ]) of G is the same as that of G0 because the variable orderin there does not chan e. Also, it is not hard to prove that the number of nodes at level ( [1] [k − 1]) of G is equal to that of G0 . Thus we can move b to the 2 bottom without increasin the size. Now we can assume that an optimal B(H ) is splitted. It is furthermore shown below that there is an optimal B(H ) which is both splitted and rouped. Lemma 6.2: An arbitrary splitted and un rouped B(H ) can be transformed into a functionally equivalent splitted and rouped B(H ) with less nodes. Before provin this lemma, let us nish the proof of our Main Theorem. Lemma 6.3: Let B be a splitted and rouped B(H ) which is constructed in the same way as B (G) (see Sec.4). Then B is reduced and B = 2K + (G) where K is the cost of the OLA raph G for the variable orderin that matches the hi h-level orderin of B(Proof is omitted). Now we are almost done with the justi cation of our reduction: Suppose that G can be drawn in cost K. Then there is a vertex orderin that realizes this cost K. This implies that we can chan e the hi h-level variable orderin of B (G) so as to match . By Lemma 6.3, the size of this OBDD is bounded by the tar et cost. Suppose conversely that B (G) can be transformed into some equivalent OBDD B of cost 2K + (G). Then B can be transformed into a splitted and rouped OBDD of cost 2K + (G) by Lemma 6.2. Then we can derive the vertex order for G from its hi h-level orderin and the cost of is at most K by Lemma 6.3. (Proof of Lemma 6.2) A splitted and not rouped B(H ) G is transformed into an equivalent splitted and rouped G0 with less nodes by the followin procedure: Since G is splitted the top 2m variables are a-variables and the bottom 2m ones b-variables. So we rst take the lowest non-ab variable (at level 2m+ 1), say, x. Then we ather all the variables that are in the same roup as x, say Bu1 . Then we move them to the bottom, i.e., at levels [2m + 1] [2m + 2] [4m] without chan in their relative order. This is what we call sta e (1a). Now G chan es into G1a .
632
Kazuo Iwama et al.
In sta e (1b), we ather all the variables in the same roup, say Bu2 , as the non-ab variable existin at the top of G1a . They are moved to the top similarly as before. In sta e (2a), another roup of variables are moved the bottom and so on. The key idea of this approach is that when movin a variable x, downward at some sta e, x does not come from too hi h positions since those hi h positions were already rouped. One should observe how this is important to our ar ument below. In the followin , we prove that the number of nodes does not increase at each sta e. To evaluate the variation in the nodes of the splitted and un rouped B(H ), we observe the fj -parts and j -parts separately from M jm j-part. (Case1:(wa) sta e (2 w n 2 )): Suppose that after the ((w − 1)b) sta e, the variable at [2mw +1] is in the block Bu and that there are q variables which [max p [p] Bu ]. If q = 0, are not in Bu amon [2mw + 1] [2mw + 2] all the variables between [2mw + 1] and [max p [p] Bu ] = [2m(w + 1)], are already all in Bu after the ((w − 1)b) sta e. Thus at the (wa) sta e the variable orderin does not chan e. We assume q > 0 in the followin of this proof. We denote min p [p] Bu and max p [p] Bu by pmin and pmax respectively, and the decrease in the number of the nodes of M jm j-part at the (wa) sta e by − M jm j. m) First, we observe the variation in the nodes of B(fj ) and B( j ) (j = 1 2 at the (wa) sta e. We denote the increase in the number of nodes of each B(fj ) and each B( j ) at the (wa) sta e by fj and j , respectively. For a similar q reason as [10], it holds that m j=1 ( j + j ) Secondly, we compute M jm j. Let the OBDD G1 turn into the OBDD G2 at the (wa) sta e. We divide the whole 2nm variables (if we say variables in this proof, they are non-ab variables) into three parts, which are called an A-part, a B-part and a C-part, respectively. The variables which do not move at the (wa) sta e belon to the A-part. The variables which move and are in Bu belon to the B-part. The variables which move and are not in Bu , i.e., those that are passed by by B-part variables, belon to the C-part. As the variable orderin in the A-part does not chan e, the number of nodes in the A-part does not chan e either. The number of nodes in the B-part does not increase by Lemma 5.2, because there are (w − 1) consecutive variable blocks at the top. For each level in the C-part, the number of nodes in the level decreases by at least one for the followin reason: Assume [k1 ] is in the C-part in G1 and [k1 ] moves to [k2 ](k1 < k2 ) at the (wa) sta e, i.e., [k1 ] in G1 and [k2 ] in G2 have the same label. Let the number of nodes in level k2 is n2 in G2 , then the functions representin the nodes in level k2 is expressed as follows: Fk22 +1 = M jm jn2 2 where M jm j2 is the function which can be obM jm j12 [2nm] in G2 . In G2 all tained by assi nin 0 or 1 to each variable of [k2 + 1] the variables of Bu are lower than level k2 , hence the function M ju in M jm j2 is ZA, i.e., M jm j2 = M j(M j1 M ju M jn )(M jj is a PA M jj ). In G1 , the function M ju in the functions representin the nodes in level k1 is PA by the de nition of the C-part. Then we can et n2 functions in level k1 of G1 , M jm jn1 2 , where M jm j1 = M j(M j1 M j0u M jn ) M jm j11
Optimizin OBDDs Is Still Intractable for Monotone Functions
633
and M j0u is a PA M ju which is not constant. We will show these n2 functions are di erent. Because M jm j2 and M jm jj2 are inequivalent, so are au M jn ) and M j(M jj1 au M jjn ), where au is a TA M j(M j1 M ju , i.e., 0 or 1. By a proper assi nment, we can make M j0u = au . Therei n2 ) are di erent. Moreover we choose an assi nment fore, M jm j1 (1 1 M j00u M j1n ), where M j00u is for G1 such that M jm j1a 1 = M j(M j1 1a another PA M ju . Then M jm j1 is not equivalent to M jm j11 because by a proper assi nment, we can make (M j0u M j00u ) = (0 1) or (1,0). M jm j1a 1 is not equivalent to M jm j1 (2 i n2 ) because by a proper assi nment, we can make M j0u = M j00u = au . Hence, the number of nodes in level k1 is at least n2 + 1. As there are q levels in the C-part, − M jm j q. m Thus we obtain: j=1 ( fj + j ) + M jm j 0 Therefore one can now see that at the (wa) sta e, the number of nodes of the B(H ) does not increase. For the (1a) sta e, our proof oes in exactly the same way. (Case2:(wb) sta e (1 w n 2 )): Suppose that after the (wa) sta e, [2m(n + 2 − w)] is in Bu and that there are q variables which are not in [2m(n + 2 − w) − 1] [2m(n + 2 − w)]. If Bu amon [min p [p] Bu ] q = 0, all the variables between [min p [p] Bu ](= [2m(n + 1 − w)]) and [2m(n + 2 − w)] are already all in Bu after the (wa) sta e. Thus at the (wb) sta e the variable orderin does not chan e. We assume q > 0 in the followin of this proof. We denote the amount of decrease in the number of the nodes of M jm j-part at the (wb) sta e by − M jm j. In the same way as Case1, the increase in the number of nodes of Ed e functions is less than q. We compute M jm j. Let the OBDD G2 turn into the OBDD G3 at the (wb) sta e. We divide all 2nm variables into three parts, exactly as before. Claim 6.1: Let zk be a variable in the B-part where k is its position amon Bu (which has not chan ed). Let a(k) be the number of zk -nodes in an OBDD z2m ). Then there are at least (w + for M ju with the variable orderin (z1 1) a(k) zk -nodes in G2 . Moreover, there are exactly w a(k) zk -nodes in G3 . The proof of this claim is omitted. Let r 2 be the number such that the top variable in the C-part in G2 is in level 2m(n + 2 − w) − r + 1. This implies that the number of variables in the B-part is 2m − r + 1. We can apply claim 6.1 to these variables. If r m + 1, then 2m − r + 1 m. Hence, the number of nodes in the B-part x2m )) − 2) 2 − 1 in G3 is less than that in G2 by at least ( B(M j(x1 m(m + 1) 2 2nm r. Here, we use the assumption that m 4n. If r m + 2, for each level in the C-part, the number of nodes in the level decreases by at least one. As there are q levels in the C-part, − M jm j q. m M jm j 0 Thus we have shown that Thus we obtain j=1 ( fj + j) + 2 at the (wb) sta e, the number of nodes of the B(H ) does not increase.
Acknowled ments Thanks are due to Y.Okabe and K.Yasuoka for valuable discussions.
634
Kazuo Iwama et al.
References 1. N.Alon and R.B.Boppana: The monotone circuit complexity of Boolean functions, Combinatorica 7(1)a, pp.1-22(1987). 2. B.Bolli and I.We ener: Improvin the variable orderin of OBDDs Is NPcomplete, IEEE Trans. Comput. Vol.45,No.9,pp.993-1002(1996). 3. R.E.Bryant: Graph-based al orithms for Boolean function manipulation, IEEE Trans. Comput. Vol.C35,N0.8,pp.677-691(1986). 4. M.R.Garey, D.S.Johnson and L.Stockmeyer: Some simpli ed NP-complete raph problems, Theoretical Computer Science, Vol.1, pp.237-267(1976). 5. K.Hosaka, Y.Takena a, T.Kaneda and S.Yajima: Size of ordered binary decision dia rams representin threshold functions, Theoret. Comput. Sci. 180,pp.4760(1997). 6. S.Jukuna, A.Razborov, P.Savicky and I.We ener: On P versus NP∩co-NP for decision trees and read-once branchin problems, Proc.27nd MFCS, pp.319-326(1997). 7. M.R.Mercer, R.Kapur and D.E.Ross: Functional approached to eneratin orderin s for e cient symbolic representation, Proc. 29th ACM/IEEE Desi n Automation Conference, pp.614-619(1992). 8. S.Muro a: Threshold lo ic and its applications, John Wiley & Sons(1971). 9. C.E.Shannon: The synthesis of two-terminal switchin circuits, Bell Systems Tech.J.28(1), pp.59-98(1949). 10. S.Tani,K.Hama uchi and S.Yajima: The complexity of the optimal variable orderin problems of a shared binary decision dia ram, IEICE Trans.Inf.& Syst., Vol.E79-D, No.4, pp.271-281(1996).Also, in Proc.ISAAC93. 11. E.Tardos: The ap between monotone and non-monotone circuit complexity is exponential, Combinatorica, Vol.8,No.1,pp.141-142(1988). 12. U.Zwick: A 4n lower bound on the combinational complexity of certain symmetric Boolean functions over the basis of unate dyadic Boolean functions, SIAM J. COMPUT., Vol.20, No.3, pp.499-505(1991).
Optimizin OBDDs Is Still Intractable for Monotone Functions
x1
0
x2 x3
EF(3,4) EF(1,3)
1 1
0 0
1 1
0
635
(a)
f = x1+ x2 x3 Fi . 1. an example of an OBDD
4
x14
3
x13
2
x12
1
x11 1
1 (b)
Fi . 2. a raph of OLA and OBDDs representin ed e functions
π[ 2mn+8 ] π[ 2mn+7 ] π[ 2mn+6 ] a3 π[ 2mn+5 ] a2 a1
x8 MAJ x7 x6 x5 x4 x3 x2 x1 0
1
Fi . 3. an M j(x1 x2
OBDD x8 )
2mn variables
for
g2
Fi . 4. an OBDD for H where m=2
a G’ H
g b
1
f2
π[2] b3 π[1] b4
a
0
g1
π[4] b1 π[3] b2
G
b
MAJMAJ f1
a4
0
1
Fi . 5. splitted MOLAD G0 (left) and unsplitted MOLAD G(ri ht)
Blockwise Variable Orderin s for Shared BDDs Extended Abstract Harry Preu 1
1
and Anand Srivastav2
Institut f¨ ur Informatik, Humboldt-Universit¨ at zu Berlin, Unter den Linden 6, 10099 Berlin, Germany (preuss@ nformat k.hu-berl n.de) 2 Mathematisches Seminar, Universit¨ at zu Kiel, Ludewi -Meyn-Str. 4, 24098 Kiel, Germany (asr@numer k.un -k el.de)
Abs rac . A state-of-the-art data structure for the representation of Boolean functions are ordered binary decision dia rams (OBDDs). The size of an OBDD representin a Boolean function depends on the variable orderin . Findin a variable orderin with optimal (i.e. minimum) OBDD size is a central, but N P -hard problem. Thus it is of reat interest to characterize optimal variable orderin s from the structure of the iven function. In this paper we investi ate the problem of characterizin optimal variable orderin s for shared OBDDs of two Boolean functions fi = i ⊗i hi i = 1 2, where ⊗i is an operator from the base B2∗ , (the full binary basis consistin of all ten binary operations dependin essentially on both inputs) and i (resp. hi ) depends only on x-variables (resp. yvariables). Tree-like circuits provide an example for such functions. In the special case f1 = f2 , Sauerho , We ener and Werchner [6] proved that there is some optimal orderin where all x-variables are tested before all y-variables or vice versa (blockwise variable orderin ). We show that this is also true for arbitrary f1 f2 provided that ⊗1 = and ⊗2 = , and for shared OBDDs with complemented ed es and arbitrary f1 f2 provided that ⊗1 = and ⊗2 = . For all other combinations of ⊗1 und ⊗2 we ive counterexamples.
1
Introduction
Shared binary decision dia rams (briefly denoted by SBDD) introduced by Minato, Ishiura and Yajima [5] are a eneralization of ordered binary decision dia rams (OBDD) (introduced by Bryant [2]). 0 1 with variables x1 xn a variFor a Boolean function f : 0 1 n x (n) where is a permutation able orderin is a permuted sequence x (1) on 1 n . An OBDD for a Boolean function f and a variable orderin for f is a rooted directed acyclic raph with one source and two sinks, one labeled by 0 (called 0-sink) and the other labeled by 1 (called 1-sink). The non-sink nodes xn and have two out oin ed es, are labeled by the Boolean variables x1 one labeled by 0 (called 0-ed e) and the other by 1 (called 1-ed e) . If an ed e Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 636 644, 1998. c Sprin er-Verla Berlin Heidelber 1998
Blockwise Variable Orderin s for Shared BDDs
637
leads from a node labeled by x to a node labeled by xj , then x has to precede xj in the variable orderin . Furhermore, the OBDD must represent f : each input a 0 1 n corresponds to an unique path in the OBDD startin in the root and endin in the f (a)-sink. A SBDD is rou hly speakin a data structure representin multiple OBDDs for a variable orderin in one dia ram by sharin nodes which represent the same subfunction (so isomorphic sub raphs do not co-exist in the SBDD; for a technical de nition we refer to Minato et al. [5]) The OBDD and resp. SBDD for iven functions and a iven variable orderin is unique (up to isomorphisms). As for OBDDs, the size of SBDDs heavily depends on the variable orderin . Findin an optimal variable orderin , i. e. an orderin with minimum OBDD (resp. SBDD size), has been shown to be a NP-hard problem [1] resp. [9]. This is one motivation to characterize optimal variable orderin s for interestin classes of Boolean functions. For OBDDs of Boolean functions represented by tree-like circuits the problem has been resolved by Sauerho , We ener and Werchner [6], who proved that there is some depth- rst-search traversal leadin to an optimal variable orderin ; moreover an optimal variable orderin and the resultin OBDD can be computed in linear time. This result is a consequence of a more eneral result for Boolean functions which are a ⊗-product of two functions not sharin variables, where ⊗ is an operator from the full binary basis B2 of all ten binary operations dependin essentially on both inputs x y 0 1 , namely x y (AND), x y (OR), x y (NAND), x y (NOR), x y, x y, x y, x y, x y (EXOR), x y (NEXOR). The result of Sauerho , We ener and Werchner can be stated and h be Boolean functions, where (resp. h ) as follows: For i = 1 2 let xk ) and depends only on some x-variables (resp. y-variables), so = (x1 ym ), and consider the product functions f = ⊗ h , with h = h (y1 B2 . Then OBDD(f ) admits an optimal variable orderin in which all ⊗ x-variables are tested before all y-variables or vice versa. Such orderin s are called blockwise variable orderin s. The authors also prove that for f1 = f 2 the SBDD(f1 f2 ) always has an optimal variable orderin which is blockwise. In this paper we ask whether this result extends to arbitrary f1 f2 (decomposable as above). We prove that there is an optimal blockwise variable orderin for the SBDD (SBDD with complemented ed es respectively) of arbitrary f1 f2 whenever ⊗1 = and ⊗2 = (⊗1 = and ⊗2 = respectively). Moreover for SBDDs this is also true, if ⊗1 = ⊗2 and h1 = h2 . For all other combinations of ⊗1 ⊗2 there are examples for which all blockwise variable orderin s are not optimal.
2
Basic Notations and Known Results
In this section we briefly recall some basic notations and de nitions. For a Boolean function f , fjxi =bi denotes the Boolean function resultin from f by 0 1 . We say f depends essenreplacin the variable x by the constant b tially on a variable x , i fjxi =1 = fjxi =0 . In this notation B2 can be re arded as
638
Harry Preu and Anand Srivastav
the set of functions from B2 dependin essentially on both variables. An OBDD with respect to a variable orderin representin the Boolean function f is denoted by -OBDD(f ). The size of a iven OBDD G is de ned as the number of its inner nodes and is denoted by G . For a iven variable z and a iven OBDD G we denote the number of inner nodes of G with label z by G z . The followin theorem of Sielin and We ener [8] ives a relation between the number of nodes labeled by z and the number of functions that are represented at a node of an OBDD. Theorem 1 (Sielin and We ener [8]). If f is a Boolean function de ned xn and is the variable orderin (x1 xn ), then -OBDD(f ) xi is on x1 a −1 equal to the number of di erent subfunctions fjx1 =a1 xi−1 =ai−1 for a1 B which depend essentially on x . An extension of OBDDs and SBDDs are OBDDs with complemented ed es (OBDDce ) and SBDDs with complemented ed es (SBDDce ), also introduced by Minato et al. [5]. In OBDDs and SBDDs with complemented ed es a subfunction and its complement are represented by the same node by complementin some 1-ed es. In the best case this can reduce the size by a factor of 2. For a Boolean function arisin from a tree-like-circuits Sauerho et al. ave a linear-time al orithm to compute an optimal variable orderin . The underlyin structure theorem is the followin one: Theorem 2 (Sauerho , We ener, Werchner [7]). Let f (x1
xk y1
ym ) :=
(x1
xk ) ⊗ h(y1
ym )
for ⊗ B2 . Then there is an optimal variable orderin for f where all x-variables are tested before all y-variables or vice versa. The same holds for SBDD(f ,f ). If a Boolean function f is de ned as in theorem 2, we call a variable orderin for f blockwise, if all x-variables are tested before all y-variables or vice versa.
3
SBDDs Without Complemented Ed es
Let 1 (x1 xk ), 2 (x1 xk ), h1 (y1 ym ), h2 (y1 ym ) be Boolean functions, where every function depends essentially on all its variables. Further let f1 (x1
xk y1
ym ) =
1 (x1
xk ) ⊗1 h1 (y1
ym )
f2 (x1
xk y1
ym ) =
2 (x1
xk ) ⊗2 h2 (y1
ym )
for arbitrary ⊗1 ⊗2 3.1
(1)
B2 .
A rmative Answer for ⊗1 =
and ⊗2 =
The main positive result of this section is: Theorem 3. For the SBDD(f1 f2 ) with f1 f2 de ned by (1) and ⊗1 = ⊗2 = there is always an optimal variable orderin which is blockwise.
and
Blockwise Variable Orderin s for Shared BDDs
639
Proof. Let be an arbitrary variable orderin and w. l. o. . let the last variable in be a y-variable. Let 0 be the variable orderin , where rst all x-variables are tested in the same order as prescribed by and then all y-variables are tested in the same order as prescribed by . Therefore we can assume that 0 is iven xk y1 ym ). Let G (resp. G0 ) be the -SBDD(f1 f2 ) (resp. the by (x1 0 -SBDD(f1 f2 )). G z . So if is optimal for the We show that for every variable z, G0 z SBDD(f1 f2 ), 0 is optimal, too. We distin uish two cases: z is an x-variable or a y-variable. Case 1 (Variable x ): From theorem 1 it follows that 0 -OBDD(f1 ) xi is equal to the number of di erent functions 1 jx1 =a1
xi−1 =ai−1
h1
which depend essentially on x . We assume that j y-variables are tested in before x . So is equal to the number of di erent subfunctions 1 jx1 =a1
xi−1 =ai−1
h1
jy1 =b1
-OBDD(f1 ) xi
yj =bj
dependin essentially on x . Because h1 depends essentially on all its variables and because j < m (we remember: the last variable in is a y-variable), we can choose xed constants b0j such that h1 jy1 =b1 yj =bj is not constant and obtain b01 0
-OBDD(f1 ) xi =
-OBDD(f1
jy1 =b1
-OBDD(f2 ) xi =
-OBDD(f2
-OBDD(f1 ) xi
xed constants b001
In the same manner we choose h2 jy1 =b1 yj =bj is not constant and 0
yj =bj ) xi
jy1 =b1
yj =bj
) xi
b00j such that -OBDD(f2 ) xi
Now we show that no x -node of the -OBDD(f1 jy1 =b1 yj =bj ) can be mer ed with an x -node of the -OBDD(f2 jy1 =b1 yj =bj ), if we construct the -SBDD(f1 jy1 =b1 yj =bj f2 jy1 =b1 yj =bj ) by mer in the two OBDDs. Let us assume that there are x -nodes in the -OBDD(f1 jy1 =b1 yj =bj ) which are mer ed with x -nodes in the -OBDD(f2 jy1 =b1 yj =bj ). From this assumption it follows that there must exist xed constants a0 −1 and a001 a00−1 B such that 1 jx1 =a1 xi−1 =ai−1 and a01 2 jx1 =a1 xi−1 =ai−1 depend essentially on x and 1 jx1 =a1
Since h1
xi−1 =ai−1 jy1 =b1
yj =bj
h1 jy1 =b1
yj =bj
=
2 jx1 =a1
xi−1 =ai−1
is not constant, there are constants b0j+1 h1
jy1 =b1
ym =bm
= 0
h2 jy1 =b1
yj =bj
(2) b0m such that
640
Harry Preu and Anand Srivastav
and therefore 1 jx1 =a1
h1
xi−1 =ai−1
jy1 =b1
= 0
ym =bm
Now h2
jy1 =b1
yj =bj yj+1 =bj+1
ym =bm
= 1
yj =bj yj+1 =bj+1
ym =bm
= 0
is a contradiction to (2). But h2
jy1 =b1
also leads to a contradiction to (2), because 2 jx1 =a1
h2
xi−1 =ai−1
jy1 =b1
yj =bj yj+1 =bj+1
ym =bm
depends essentially on x , while 1 jx1 =a1
xi−1 =ai−1
h1
jy1 =b1
does not. So no x -node of the -OBDD(f1 jy1 =b1 an x -node of the -OBDD(f2 jy1 =b1 yj =bj ). Hence G0
xi
-SBDD(f1
jy1 =b1
yj =bj
f2
ym =bm yj =bj )
jy1 =b1
can be mer ed with
yj =bj
) xi
Because each x -node of the -SBDD(f1 jy1 =b1 yj =bj f2 jy1 =b1 yj =bj ) represents a function which must also be represented by an x -node in G, we have -SBDD(f1
jy1 =b1
yj =bj
f2
jy1 =b1
yj =bj
) xi
G xi
G xi . All to ether we et G0 xi Case 2 (Variable yj ): The proof is analo ous to the proof in case 1. 3.2
Counter Examples
If we choose other operators from B2 for ⊗1 and ⊗2 , there are always functions f1 und f2 for which all blockwise variable orderin s are not optimal. Let f1 and f2 be de ned as in (1). If ⊗1 = , ⊗2 =
and x2 x3 x4 ) = x1 2 (x1 x2 x3 x4 ) = x1 1 (x1
x2 x2
(x3 (x3
x4 ) x4 )
(3)
h1 (y1 ) = h2 (y1 ) = y1 the SBDD(f1 f2 ) for variable orderin s, where the y-variable is tested rst or last, contains at least 12 nodes, while the SBDD with the optimal variable orderin (x1 x2 y1 x3 x4 ) contains 11 nodes.
Blockwise Variable Orderin s for Shared BDDs
If ⊗1 = ⊗2 =
641
and x2 ) = x1 2 (x1 x2 ) = x1
x2 x2
h1 (y1 y2 ) = y1
y2
h2 (y1 y2 ) = y1
y2
1 (x1
the SBDD(f1 f2 ) for the optimal variable orderin (x1 y1 x2 y2 ) contains 6 nodes, while it contains at least 7 nodes for every blockwise variable orderin . If ⊗1 = ⊗2 = and 1 (x1
x2 x3 ) = (x1
x2 )
x3
2 (x1
x2 x3 ) = (x1
x2 )
x3
h1 (y1 y2 y3 ) = y1 h2 (y1 y2 y3 ) = y1
(4)
y3 ) y3 )
(y2 (y2
the SBDD(f1 f2 ) for every blockwise orderin contains at least 16 nodes, while the SBDD with the variable orderin (x1 x2 y1 y2 y3 x3 ) contains 14 nodes and is optimal. With theorem 3 and these counterexamples we have covered all cases of ⊗1 and ⊗2 from B2 . The results are summarized in the followin table.
h2
2 1
f1 =
1 1
h1 h1 h1
+ -
f2 = h2 + -
2
h2
2
-
+ in line f1 = 1 ⊗1 h1 and column f2 = 2 ⊗2 h2 means: there is an optimal variable orderin for the SBDD(f1 f2 ) which is blockwise, and - means, there are functions f1 f2 for which no optimal variable orderin for SBDD(f1 f2 ) is blockwise. 3.3
Special Cases
Now we consider the special case of (1), where h1 = h2 . Due to this restriction B2 in order to cover all cases. we must also handle the NAND-Funktion If ⊗1 = and ⊗2 = , or ⊗1 = and ⊗2 = , we conclude from Theorem 3, that there is always an optimal variable orderin which is blockwise. If ⊗1 = and ⊗2 = , example (3) serves as a counterexample.
642
Harry Preu and Anand Srivastav
If ⊗1 = , ⊗2 = , x2 ) = x1 (x 2 1 x2 ) = x1
x2 x2
1 (x1
h1 (y1 y2 ) = h2 (y1 y2 ) = y1
y2
and f1 and f2 are de ned by (1), the SBDD for the best blockwise variable orderin contains 8 nodes, while it contains 7 nodes for the optimal variable orderin (x1 y1 y2 x2 ). So only the case ⊗1 = ⊗2 is open. Here we have the followin nice characterization even for the SBDD of more than two functions. xk ) xk ) be p pairwise Let p N p 2, and let 1 (x1 p (x1 di errent functions, each dependin essentially on all its variables. Furthermore ym ) be another Boolean function dependin essentially on all its let h(y1 variables, ⊗ an operator from B2 and f1 (x1
xk y1
fp (x1
xk y1
ym ) = .. . ym ) =
1 (x1
xk ) ⊗ h(y1
ym )
p (x1
xk ) ⊗ h(y1
ym )
Theorem 4. There is always an optimal variable orderin for the SBDD(f1 fp ), where all x-variables are tested before any y-variable is tested. Proof. We introduce p − 1 additional variables z1 OBDD(f ) where f is the function zp−1 x1 xk y1 f (z1 = z 1 f1 z1 z2 f2
zp−1 . Apply theorem 2 to
ym ) z1 zp−2 zp−1 fp−1
z1
zp−1 fp
The results for the special case h1 = h2 are summarized in the followin table.
h
2 1
f1 =
1 1
(
1
h h h h)
+ + +
2
+ + -
f2 = h 2 h ( 2 h) + + +
Blockwise Variable Orderin s for Shared BDDs
4 4.1
643
SBDDs with Complemented Ed es A rmative Answer for ⊗1 =
and ⊗2 =
The startin point for the results in this section is the followin lemma which eneralizes a theorem of Sauerho , We ener, and Werchner [7]. Lemma 1. For arbitrary Boolean functions f1 fp it holds orderin for f1 -SBDD(f1
fp f 1
fp p
N and every variable
fp ) = 2 -SBDDce (f1
fp )
Our main positive results for SBDDs with complemented ed es is: Theorem 5. For the SBDDce (f1 f2 ) with f1 f2 de ned by (1) and ⊗1 = ⊗2 = there is always an optimal variable orderin which is blockwise.
and
Sketch of Proof: Let be an arbitrary variable orderin for f1 f2 , w. l. o. . let the last variable in be a y-variable. Let 0 be the variable orderin , where rst all x-variables are tested in the same order as prescribed by and after that all y-variables are tested in the same order as prescribed by . Thus we can xk y1 ym ). assume w. l. o. . that 0 is the variable orderin (x1 Let G be -SBDD(f1 f2 f1 f2 ) and let G0 be 0 -SBDD(f1 f2 f1 f2 ). We G z . Then by lemma 1 it follows that show that for every variable z, G0 z 0
-SBDDce (f1 f2 )
-SBDDce (f1 f2 )
So if is optimal for the SBDDce (f1 f2 ), 0 is optimal, too. A ain we have to distin uish the cases whether a node is labeled with an x-variable or a y-variable. For the technical proof we must refer to the full paper. 4.2
Counter Examples
If ⊗1 and ⊗2 are other operators from B2 , we can nd counterexamples. Let f1 f2 be de ned by (1). If ⊗1 = ⊗2 = and x2 x3 ) = x1 2 (x1 x2 x3 ) = x1 1 (x1
(x2 (x2
x3 ) x3 )
h1 (y1 ) = h2 (y1 ) = y1 the SBDDce (f1 f2 ) contains 5 nodes for the optimal variable orderin (x1 y1 x2 x3 ), while it contains at least 6 nodes for every blockwise variable orderin . If ⊗1 = ⊗2 = , (4) serves as a counterexample. The SBDDce (f1 f2 ) contains 9 nodes for the optimal orderin (x1 x2 y1 y2 y3 x3 ), while it contains at least 10 nodes for every blockwise variable orderin . If we complement f1 and/or f2 , the size of the SBDD(f1 f2 f1 f2 ) does not chan e. Thus for every ⊗1 and ⊗2 we can decide now, whether for every f1 f2 satisfyin (1) the SBDDce (f1 f2 ) has an optimal variable orderin which is blockwise.
644
4.3
Harry Preu and Anand Srivastav
Special Cases
For the special case of (1) with h1 = h2 similar results as in section 3.3 can be proved.
5
Concludin Remarks
Findin an optimal variable orderin for OBDDs or SBDDs is a NP-hard problem. Therefore it is promisin to look for special classes of Boolean functions for which the problem can be solved e ciently. Tree-like-circuits are a special class of Boolean functions with an optimal blockwise variable orderin , and for which such an orderin can be computed in linear time by a depth- rst-search traversal [6]. It is a natural and relevant question askin whether this is also true for the SBDD of functions of tree-like-circuits. Our results classi es the situations when an optimal blockwise variable orderin for the SBDD of two functions each represented by a tree-like-circuit does exist and when all blockwise variable orderin s are non optimal. We leave open the question of ndin an optimal blockwise variable orderin for the SBDD of two tree-like circuits in polynomial time, whenever such an orderin exists. Also it would be interestin to derive upper bounds for the size of the optimal SBDD of two functions iven by tree-like circuits. A solution for this problem in case of OBDDs is iven in [6].
References 1. B. Bolli , I. We ener: Improvin the variable orderin of OBDDs is NP-complete. IEEE Transactions on Computers 45, pa es 993-1002, 1996 2. R. E. Bryant: Graph-based al orithms for Boolean function manipulation. IEEE Transactions on Computers, vol. C-35(8), pa es 677-691, 1986. 3. R. E. Bryant: Symbolic Boolean manipulation with ordered binary decision diarams. ACM Computin Surveys, vol. 24, pa es 293-318, 1992. 4. S. J. Friedman, K. J. Supowit: Findin the optimal variable orderin for binary decision dia rams. IEEE Trans. on Computers 39, pa es 710-713, 1990. 5. S. Minato, N. Ishiura, S. Yajima: Shared binary decision dia rams with attributed ed es for e cient Boolean function manipulation. Desi n Automation Conference, pa es 52-57, 1990. 6. M. Sauerho , I. We ener, R. Werchner: Optimal ordered binary decision dia rams for fanout-free circuits. Proc. of SASIMI 1996. 7. M. Sauerho , I. We ener, R. Werchner: Optimal ordered binary decision dia rams for tree-like circuits. Forschun sbericht Nr. 613, Universit¨ at Dortmund 1996. 8. D. Sielin , I. We ener: NC-al orithms for operations on binary decision dia rams. Parallel Processin Letters, vol. 3, pa es 3-12, 1993 9. S. Tani, K. Hama uchi, S. Yajima: The complexity of the optimal variable orderin problems of a shared binary decision dia ram. Proc. 4th Int. Symp. on Al orithms and Computation ISAAC, Lecture Notes in Computer Science 762, pa es 389-398, 1993.
On the Composition Problem for OBDDs with Multiple Variable Orders Anna Slobodova Institute of Telematics, Trier, Germany
[email protected] .de
Abs rac . Ordered Binary Decision Dia ram (OBDD) is a favorite data structure used for representation Boolean functions in computer-aided synthesis and veri cation of di ital systems. The secret of its success is the e ciency of the al orithms for Boolean operations, satis ability and equivalence check. However, the al orithms work well under condition only that the variable order of considered OBDDs is the same. In this paper, we discuss the problem of Boolean operations on OBDDs with multiple variable orders, which naturally appears, e. ., in the connection with minimization techniques based on dynamic variable reorderin . Our oal is to place the problem with respect to its complexity and to point out the di culties in ndin an acceptable solution.
1
Some Motivation Remarks
The main application of Ordered Binary Decision Dia rams (OBDDs) up to now is in computer-aided synthesis, veri cation and testin of di ital systems. The operations like equivalence test, variable quanti cation and binary Boolean operations, that are crucial for CAD can be performed e ciently, if the considered Boolean functions are represented by OBDDs that are built with respect to the same variable order [2]. The variable order plays an important role in minimization of OBDDs, since the size of an OBDD representation for a function may vary exponentially with di erent orders. The problem of ndin an optimal variable order is known to be NP-complete [11, 4]. Hence, a bi e ort is focused to development of heuristics that nd an acceptable order. Heuristics that are based on a variable reorderin are of a special interest, as they allow to optimize OBDDs dynamically whenever their size rows too much durin computations. Many tasks cannot be completed without dynamic minimization at all. The trick is that althou h variable order varies durin a computation, at any time point, it is the same order for all stored OBDDs, and this assures an e cient performance of all operations. In some applications, like traversal of lar e nite state machines that model sequential circuits, the rowin size of OBDDs forces to partition them, keep the OBDDs that are necessary in the next step of the computation and to store the rest into secondary memory. The OBDDs are loaded back at the point when they are required for the computations. As This work has been supported by German Research Society project Me 1077/12-1 Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 645 655, 1998. c Sprin er-Verla Berlin Heidelber 1998
646
Anna Slobodova
a consequence, we are faced with the problem of di erent variable orders in the current and loaded OBDDs. Another example of manipulation of OBDDs with multiple variable orders appears in combinatorial veri cation of a circuit. It is one of the main CAD tasks that can be formulated as equivalence test between outputs of the circuit an its speci cation that may be another circuit. The OBDD representation of circuit outputs is obtained by symbolic simulation of the circuit a proccess that usually requires a dynamic reorderin . The nal variable order of the resultin OBDDs depends on many factors, e. ., used dynamic heuristic and structure of the circuit, and is unpredictable. The usual way of testin equivalence of two circuits is the application of XOR operation on OBDD representation of the correspondin outputs (which is more informative than a simple equivalence check). It is not known how to perform an operation on OBDDs with di erent variable orders (output) e ciently. This is the central problem in our paper. We investi ate its complexity and try to estimate our chances to nd an e cient solution at least for somehow restricted input. The obtained results have served as the rst step towards development of heuristics for a feasible solution of the described problem [5].
2
Preliminaries
In order to make the paper self-contained, we present brief de nitions of the notions used. For formal de nition and the basic properties of OBDDs, we refer to [2, 3]. An Ordered Binary Decision Dia ram P over a set of Boolean variables Xn is a sin le-rooted DAG with two sink-nodes labelled by 0 and 1. Each internal node is labelled by a variable from Xn and has two ordered successors called low and hi h son. On any root-to-sink path, any variable occurs at most once, and Xn be the set of the occurrence of variables satis es a xed order. Let Xnk the k top-most variables with respect to the variable order in P . An assi nment (k) : Xnk 0 1 k naturally de nes a computational path with initial point in the root: if the path contains a node v labelled by x , and (k) (x ) = 0 ( (k) (x ) = 1), then the path contains the low (respectively, hi h) son of v. The size of OBDD P is measured by the number of its internal nodes and is denoted xn ), f : 0 1 n by P . An OBDD P represents a Boolean function f (x1 (n) , the correspondin path terminates in the sink 0 1 , if for each assi nment (n) (xn )). An OBDD for f is denoted by OBDD(f ), labelled by f ( (n) (x1 ) or by OBDD(f ), where is an order of variables in the OBDD. Fi ure 1 depicts an OBDD for a function r de ned in Section 3. Multiple functions are represented by OBDDs that share isomorphic sub raphs. Any node v of an OBDD(f ) represents a subfunction of f , namely a cofactor of f with respect to an assi nment that corresponds to some root-to-v path. This cofactor is denoted by fj . An OBDD is called reduced, if all its nodes represent di erent functions. Any OBDD can be reduced in linear time [9]. Throu hout the paper, we will work with reduced OBDDs without explicitly pointin it out. A dependence of f
On the Composition Problem for OBDDs with Multiple Variable Orders
647
on a variable x means that the cofactors of f with respect to x di er. A support of f (sup(f )) is the set of all variables variables f depends on.
xi1 xi2
xi2
xi3
xi3
xi4
xi4
xin
0 Fi . 1.
1 OBDD(r
xin
1
0
) (the low son of a node appears left from its hi h son).
xk−1 ] have meanin of We represent variable orders by strin s, e. ., = [x0 x < xj for i < j. Let be an order over Xn and A Xn . Then − A denotes the order obtained from by removin all variables in A. For two orders 1 and 2, 1 2 is the set of variables that appear in both strin s. If 1 2 = , 1 2 is de ned as an order that corresponds to concatenation of the strin s. N P denotes the set of all decision problems that are solvable in nondeterministic polynomial time [6]. A problem is output e cient, if its time complexity is bounded polynomially with respect to the size of input and output. P OBDD denotes the set of Boolean functions with a polynomially bounded OBDD representations (with respect to the number of variables). POBDD = P OBDD .
2.1
Problems
We start by de nin the problems considered in the paper, either as objects of our investi ation or as references in the proofs. The problem of optimal variable order for OBDDs can be formulated as decision and/or construction problem.
648
Anna Slobodova
OPTORDER input : OBDD(f ), an inte er s question : Is there any variable order
such that
OBDD(f )
s?
OPTORDER input : OBDD(f ), an inte er s output : a variable order such that
OBDD(f )
s
The central problem of this paper is an optimal variable order for an OBDD representation of the function resultin from a binary Boolean operation. The standard way of implementin binary Boolean operations in the OBDD packa es used for CAD (e. ., [1]) is via an ite-operator de ned by: ite(f
h) = f + f h
The advanta e of a sin le operator is in the use of a common computed table for all Boolean functions, that avoids recomputations. For the sake of enerality, we will formulate the considered problem for this operator. OPTORDER ITE input : 1 OBDD(f1 ), 2 OBDD(f2 ), 3 OBDD(f3 ), an inte er s question : Is there any variable order such that OBDD(ite(f1 f2 f3 ))
s?
It is easy to see that the problem OPTORDER is polynomially reducible to that of ndin an optimal variable order, and vice versa. Similarly, we can formulate the problem of ndin an optimal variable order for a result of the ite-operation. We will show that the problem is hard even for the instances with optimal input OBDDs. OPTORDER ITE input :
1 OBDD(f1 ),
2 OBDD(f2 ), 3 OBDD(f3 ), such that are optimal for f1 f2 f3 , respectively output : an optimal variable order for ite(f1 f2 f3 ) 1
2
3
Results In this section we investi ate OPTORDER ITE and OPTORDER ITE . Since the problems are of hi h practical interest, the lower bound estimation of their complexity (in our case it is N P-hardness) is the rst step in understandin the limits of our abilities to develop e cient al orithms for their solution. Bein equipped by this knowled e, we stress our attention on ndin at least a solution for restricted subsets of all possible inputs. The results could be considered as a startin point for development of heuristics.
On the Composition Problem for OBDDs with Multiple Variable Orders
649
Theorem 1. [4, 11] OPTORDER is N P-complete Theorem 2. OPTORDER ITE is N P-hard Proof. The problem OPTORDER is reducible to OPTORDER ITE by the fact that any Boolean function f can be expressed by means of f = ite(f 1 0), where 1 and 0 are the constant functions. The next question is, whether OPTORDER ITE is in N P. In the case of OPTORDER problem, we can uess an optimal order, construct an optimal OBDD and check whether it is smaller than s. Since there are known output e cient al orithms for rebuildin of an OBDD to an equivalent OBDD with respect to a iven order of variables [8, 10] that can be interrupted whenever the output OBDD turns to be lar er than the input, OPTORDER is in N P. In the case of OPTORDER ITE , we cannot assure that the function resultin from the ite-operation is in POBDD . Even if it would be the case, it is not known, how to construct the correspondin OBDD e ciently (even if the tar et order would be known). An e cient procedure for checkin the size of OBDDs for a function without its construction is not known, too. These facts make the problem OPTORDER ITE hard. We try to nd solutions for special cases (when some additional restrictions are put onto its instances) and investi ate how far they cover all possible cases. The rst case is less interestin , but it is the basis to which some other cases can be easily reduced. Lemma 1. OPTORDER ITE restricted to the instances with the same variable order is in N P. Proof. We use two facts: 1 2 3 are iven. OBDD(ite(f1 f2 f3 )) can 1. Let P = OBDD(f ), for i be constructed within time and space in O( P1 P2 P3 ), see e. .,[1]. 2. There is an output-e cient procedure that for any iven OBDD(f ) and constructs OBDD(f ), see e. ., [8]. The N P-al orithm for the problem applies the ite-operation, uesses a tar et order and rebuilds the result with respect to this order. Let us try to extend this result. De nition [ ood order] Let be a variable order over a set of variables Xn , A = 1 OBDD(f1 ) k OBDD(fk ) be a set of OBDDs over Xn . Let m be the size of the maximal OBDD in A. is a ood order for A, if there is a polynom p(m) . p such that i : OBDD(f ) Theorem 3. All instances of OPTORDER ITE with the property that there is a ood variable order for the input OBDDs, are solvable in nondeterministic polynomial time.
650
Anna Slobodova
Proof. In the considered case, all input OBDDs can be rebuilt with respect to a common variable order in nondeterministic polynomial time. Afterwards, Lemma 1 is applicable. If A contains an OBDD of exponential size, i.e., m is exponential with respect to n, then any variable order is ood for A. Such instances are consequently easy . Corollary 1 Instance of OPTORDER ITE with an exponentially lar e OBDD (wrt the number of variables), are solvable in nondeterministic polynomial time. Di cult Examples The last corollary covers all cases when one of the considered functions has exponentially lar e OBDD representations only. This fact induces the question, whether it is possible that all considered functions have polynomial OBDD representations but there is no ood order for them. We explicitly show that this case may appear by provin a stron er result. Lemma 2. f
1 2
:
P 1 OBDD ) & (
(f
Proof. Let M be an n
P 2 OBDD ) & (
P OBDD )
:f
n matrix over 0 1 . We de ne
f (M ) =
1 0
: :
each row of M has exactly one 1 otherwise
(M ) =
1 0
: :
each column of M has exactly one 1 otherwise
We de ne a function h(M ) that equal 1 i M is a permutation matrix, i.e., h(M ) = (f )(M ). Let M = (x j )nj=1 . Let 1 and 2 order variables accordin to rows, respectively to columns, i.e., 1
= [x11 x12
x1n x21 x22
xr1 2
= [x11 x21
xn1 x12 x22
xc1
xn1 xn2
1 0
xnn ]
xrn
xn2
x1n x2n
xc2
f can be decomposed to functions r1 r (xr ) =
x2n
xr2
xnn ]
xcn
rn de ned by
there is exactly one 1 in xr otherwise
: :
For any i, the reduced 1 OBDD(r ) consists of 2n − 1 nodes (Fi . 1). Since n n f = =1 r and =1 sup(r ) = , 1 OBDD(f ) can be obtained by identifyin the 1-sink of r with the root of r +1 , for 1 i n − 1. Therefore n 1 OBDD(f )
=
1 OBDD(r
) = n(2n − 1)
=1
By a similar construction, 2 OBDD( ) = n(2n − 1). Accordin to the result by Krause,Meinel,Waack [7], h POBDD .
On the Composition Problem for OBDDs with Multiple Variable Orders
651
Theorem 4. There are functions f1 , f2 , f3 , and variable orders 1 , 2 , and s.t. no variable order is ood for 1 OBDD(f1 ) 2 OBDD(f2 ) 3 OBDD(f3 ) .
3
Proof. Let f h 1 2 have the same meanin as in the previous lemma. Let f3 = 0 us de ne f1 := f f2 := 1 := 1 2 := 2 3 as any order. Let us assume be a ood order for 1 OBDD(f1 ) 2 OBDD(f2 ) 3 OBDD(f3 ) . Then OBDD(h) = OBDD(ite(f1 f2 f3 )) is polynomially bounded. This contradicts Lemma 2. The result of the ite-operation from Theorem 4, was a function that has an exponential OBDD representation with respect to any variable order. From the practical point of view, the construction of the function is uninterestin in this case, even if the optimal variable order would have been known. Is there any example where f1 , f2 , f3 and ite(f1 ,f2 ,f3 ) have polynomial OBDD representations but there is no ood order for those OBDDs? If such functions exist, then it makes sense to look for an al orithm that constructs the ite-result directly from the iven OBDDs, without rebuildin them to a common order (that is suitable for the result but not for all ar ument functions), and avoids an exponential size explosion of the intermediate results. Theorem 5. There are functions F and G, and variable orders that ful l all followin properties simultaneously: 1. F P 1 OBDD 2. G P 2 OBDD 3. (F G) P 3 OBDD 4. : F P OBDD
G
1,
2,
and
3
P OBDD
Proof. Let f , , 1 and 2 be functions, respectively, variable orders de ned in the proof of Lemma 2. Let x be a variable that does not belon to sup(f ) sup( ). For F := x f G := x , the conjunction F G equals constant zero function. We de ne the variable orders for OBDD representations of F and G by appendin the missin variable x to the top of 1 , respectively, 2 : 1 := x 1 2 := x 2 . 3 is any variable order. Accordin to the size estimations of 1 OBDD(f ) and 2 OBDD( ) and the de nitions of F , G, 1 , 2 and 3 , the rst three conditions are ful lled. P OBDD ). f and Assume that there is such that (F P OBDD ) & (G are cofactors of F , respectively G. This implies that f P −fxgOBDD and ) P −fxgOBDD , too. This contradicts P −fxgOBDD . Consequently, (f the exponential lower bound for f in [7].
Corollary 2 There are functions f1 , f2 , f3 , f = ite(f1 f2 f3 ) with polynomial OBDD representations with respect to variable orders 1 , 2 , 3 and , respectively, such that there is no ood variable order for the set of OBDDs 1 OBDD(f1 ) 2 OBDD(f2 ) 3 OBDD(f3 ) OBDD(ite(f1 f2 f3 )) .
652
Anna Slobodova
Close Variable Orders We have seen that even if all ar ument functions and also the result of the ite-operation have polynomial OBDD representations there need not be a common variable order that is suitable for all functions involved. Our hope is, that such variable order exists if the suitable variable orders for the ar ument functions are close to each other. We de ne a metric on the space of variable orders over the same variable set as a minimal number of variables that must be removed for obtainin the same order. It will be shown that if orders are close to each other wrt this metric, then a new order can be found (deterministically) that allows an e cience performance of the ite-operation. De nition [witness of di erence] Let 1 , 2 be variable orders over Xn . Let W be a minimal subset of Xn (minimal with respect to the number of elements) such that 1 − W = 2 − W . W is called a witness of di erence and its size ( 1 2 ) = W a di erence. The notions of witness and di erence de ned above can be easily extended to any nite set of variable orders. Lemma 3. Let 1 , 2 , and 3 be variable orders over Xn . Let P1 = 1 OBDD(f1 ), P2 = 2 OBDD(f2 ), P3 = 3 OBDD(f3 ), and ( 1 2 3 ) = d. Then there is a variable order such that the reduced OBDD(ite(f1 f2 f3 )) can be constructed from P1 P2 and P3 in time and space O(2d P1 P2 P3 ) x k be a witness of the di erence for 1 , 2 and Proof. Let W = x 1 3 . We will construct an OBDD(ite(f1 f2 f3 )) P with respect to variable order x k ] [ 1 −W ]. The top part of the OBDD is a complete tree of depth = [x 1 d. The nodes on the j-th level are labelled by the variable x j . A leaf of this tree reachable via the path associated with an assi nment represents the function is an assi nment to all variables in W , the ite((f1 )j (f2 )j (f3 )j ). Since cofactors of f1 , f2 , and f3 with respect to have the same support 1 − W and their OBDD representations (P1 )j , (P2 )j , and (P3 )j are built with respect to the same variable order 1 − W . The time and space complexity of these (P2 )j (P3 )j P1 P2 P3 . particular ite-operations is bounded by (P1 )j Corollary 3 Let 1 OBDD(f1 ), 2 OBDD(f2 ), 3 OBDD(f3 ), are OBDDs of an OPTORDER ITE instance of size N . Let ( 1 2 3 ) O(lo N ). Then OPTORDER ITE for this instance is solvable in nondeterministic polynomial time. Lemma 4. For any constant number of variable orders over Xn , a witness of their di erence can be found in time and space O(n2 ). Proof. The problem of ndin a witness of di erence for two variable orders is a special case of ndin a lon est common substrin (not necessarily a continuous one) of two strin s. For this problem, we desi n an e cient al orithm that is easily extendable for an application to several orders and to ndin all lon est suborders. The basic idea is to assi n a raph to iven orders such that there
On the Composition Problem for OBDDs with Multiple Variable Orders
653
is one-to-one correspondence between lon est paths in the raph and lon est common suborders. Let 1 and 2 be two variable orders over Xn . We can associate a raph G = (V E) with them, s.t. V = Xn , and (x xj ) E i (x < 1 xj ) & (x < 2 xj ). V = n and E n2 . It holds: 1. G can be constructed in time and space O(n2 ). 2. For any ed e (x 1 ( ) x 1 (j) ) E, it holds: i < j. Consequently, G is acyclic. Lon estPath( 1 2 ) vn ].*/ /* Let 1 = [v1 len th(vn ) = 1; next(vn ) =NIL; for (i = n − 1,to 1, step -1) Find a successor u of v with maximal value of len th len th(v ) = len th(u) + 1; next(v ) = u; Find node v with maximal value of len th; while (v =NIL) print(v); v = next(v);
Lemma 5 (Correctness). Let G be a raph that corresponds to variable orders 1 and 2 as described above. Lon estPath( 1 2 ) computes a lar est suborder consistent with 1 and 2 . Proof. It is su cient to prove, that the procedure correctly computes the lon est path in G. It follows from the followin facts: vn are 1. Before the labels of v are computed, the labels of v +1 v +2 known. 2. If the labels of v are computed, then len th(v) equals the len th of the lon est path that starts in v and oes via next(v). The second statement can be proved by induction on i = n 1, for v = v . Lemma 6 (Complexity). The time complexity (under unit cost) of the al orithm Lon estPath is O( E + n), where E are the ed es of the raph G that correspond to the considered variable orders over Xn . Theorem 6. Let N := 1 OBDD(f1 ) + 2 OBDD(f2 ) + 3 OBDD(f3 ) and O(lo N ), for i j 1 2 3 . Time complexity for a deterministic ( j) construction of an OBDD representation for ite(f1 f2 f3 ) is bounded by a polynomial of N .
654
Anna Slobodova
Theorem 7. OPTORDER ITE is N P-hard. Proof. OPTORDER is many-one reducible to OPTORDER ITE by means of the procedure OptOrder. Let OBDD(f ) Pf be an input. If OptOrderIte solves OPTORDER ITE , then OptOrder(Root(Pf )) returns an optimal variable order for f . The use of computed table assures that there are 2 Pf recursive calls of OptOrder invoked by the top-most call. Since rebuildin of an OBDD wrt an optimal order can be performed in polynomial time, OPTORDER is polynomially reducible to OPTORDER . This proves that OPTORDER and consequently OPTORDER ITE are N P-hard. OptOrder(v) if IsConstant(v) return []; if IsComputed(f ) return result; /* any node is represented by a variable, low son and hi h son */ 0 =OptOrder(v low); 1 =OptOrder(v hi h); =OptOrderIte(v var), Rebuild(v hi h, 1 ), Rebuild(v low, 0 )); StoreInComputed(v, ) return Theorem 8. All instances of OPTORDER ITE with a ood variable order for the set of input OBDDs are solvable nondeterministically in polynomial time. In particular, all instances for which the di erence of the variable orders is bounded by O(lo N ), where N is the size of the instance, are solvable nondeterministicaly in polynomial time.
References [1] K.S. Brace, R.L. Rudel, and R.E. Bryant. E cient Implementation of a BDD Packa e. ACM/IEEE Proc. Desi n Automation Conference, pa es 40 45, 1990. [2] R.E. Bryant. Graph Based Al orithms for Boolean Function Manipulation. IEEE Transaction on Computers, C-35:677 691, 1986. [3] R.E. Bryant. Symbolic Boolean Manipulation With Ordered Binary Decision Dia rams. Comp. Surveys, 24:293 318, 1992. [4] B. Bolli and I. We ener. Improvin the Variable Orderin of OBDDs is NP complete. IEEE Transaction on Computers, 45(9):993 1002, 1996. [5] G. Cabodi and S. Quer and Ch. Meinel and H. Sack and A. Slobodova and Ch. Stan ier. Binary Decision Dia rams and Multiple Variable Order Problem International Workshop on Lo ic Synthesis’98, Lake Tahoe, CA [6] M.R. Garey and D.S. Johnson. Computers And Intractability - A uide to NPCompletness. Freeman, 1979. [7] M. Krause, Ch. Meinel, and S. Waack. Separatin the Eraser Turin Machine Classes Le , NLe and Pe . TCS, 86:267 275, 1991. [8] Ch. Meinel and A. Slobodova. On the Complexity of Constructin Optimal Ordered Binary Decision Dia rams. Proc. of MFCS, LNCS 841:515 525, 1994. [9] D. Sielin and I. We ener. Reduction of bdds in linear time. Information Processin Letters, 48(3):139 144, 1993.
On the Composition Problem for OBDDs with Multiple Variable Orders
655
[10] P. Savicky and I. We ener. E cient al orithms for the transformation between di erent types of binary decision dia rams. Acta Informatica, 34:245 256, 1997. [11] S. Tani, K. Hama uchi, and S. Yajima. The Complexity of the Optimal Variable Orderin Problem of Shared Binary Decision Dia rams. In Proc. ISAAC, LNCS 762, pa es 389 398. Sprin er, 1993.
Equations in Trans nite Strin s Christian Cho rut1 and Sandor Horvath2 1
LIAFA, Universite Paris 7 Tour 55 56, 2 Place Jussieu, 75251 Paris Cedex 05 cc@l afa.juss eu.fr 2 Dept. of Computer Science, E¨ otv¨ os Lorand University, Budapest, Muzeum k¨ orut 6 8., II. em. 2 3, H 1088, Hungary
[email protected] Abs rac . We address t e question of extending t e t eory of equations in nite strings to trans nite strings. We give a full description of t e solutions of t e equations in two unknowns as well as t ose of t e equations of t e form xm y p = z q for m p q ≥ 2. By so doing we introduce some new notions t at we believe are interesting for t eir own sake.
1
Introduction
Trans nite strin s have lon been introduced. Lo icians were the rst to study them by extendin to trans nite strin s B¨ uchi’s result showin that with every sentence of the second order lo ic of one successor one can associate a rational subset of in nite strin s, [2] and [4]. In the area of theoretical computer science such objects can be viewed as modellin the behaviour of sequential processes consistin of in nitely many successive actions whose times de ne a conver ent sequence, also known in the literature as Zeno strin s. The vivid area of timed automata which takes the actual duration of transitions of nite automata into account makes explicit use of this notion, [1]. Combinatorics in strin s is an old and wide area whose ori in is usally traced back to Axel Thue, but that matured in the sixties with the works of MarcelPaul Sch¨ utzenber er and his followers. Numerous publications have already iven account of the state of art (e. . [9] or the chapter [3]) and they testify for the richness and profoundness of the topic. One of the main aspects of this theory is concerned with solvin equations with strin s as unknowns which ave rise to di cult issues. Let us mention for example the e ective possibility of determinin whether or not an equation with constants has a solution established by Makanin’s or the possibility of expressin all solutions of an equation with at most three variables with parameters due to Hmelevskii, see [10] and [6]. The picture for trans nite strin s is quite di erent since apart from isolated results (see, e. ., [7]) little is developped yet. We believe thou h that some elementary combinatorial properties on trans nite strin s mi ht help the study of subsets of trans nite strin s as they have helped the study of subsets of nite strin s. Amon the variety of issues on trans nite strin s, we focus as said on that of solvin equations, i. e., on describin the set of their solutions. Our main contribution is a thorou h description of the solutions of equations in two unknowns Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 656 664, 1998. c Sprin er-Verla Berlin Heidelber 1998
Equations in Trans nite Strings
657
as well as those of the form xm y p = z q for m p q 2. Observe that not much more is known for nite strin s. As a by-product, we discover new notions that are sli ht modi cations of standard ones. Indeed, instead to the property for two strin s x and y to be powers of a third one or equivalently to commute, here we need a more eneral property that says that xy is a pre x of yx or vice versa. We also tackle the standard notions of conju acy, of primitivity and of periodicity. In particular the famous result attributed to Fine and Wilf concernin the periods of a ( nite) strin can be extended to trans nite strin s with little dama e. For lack of space the proofs of the results are omitted.
2
Preliminaries
We refer the reader to [11] for a comprehensive exposition of the theory on ordinals. In the present work, Ord denotes the class of all ordinals satisfyin . Every ordinal admits a unique polynomial representation n an + < n−1 an−1 + + a1 + a0 where n an a1 a0 < . The inte er n is the de ree of the ordinal also denoted . The sum of two ordinals satis es for all a b < n
p
a+
b=
p
b if p > n (a + b) if p = n
n
Addition is not commutative but characterizin the pairs of ordinals that commute is easy. Proposition 1. (e. ., [11], Thm. 1., p. 346) For two ordinals the followin conditions are equivalent i) + = + ii) there exist an ordinal γ and two inte ers q p 0 such that = γq and = γp. iii) either = 0 or else for some 0 p q n < and < n we have n n = p + and = q + into . EquivGiven a nite alphabet , a strin is a mappin u of < alently, u is a sequence of indexed by the ordinal and we write indi erently u or u(i) for all i < . The set of all strin s is denoted by Ord . The ordinal is the len th of u, denoted by u . By extension, the de ree of a strin x is the , u a denotes the len th de ree of its len th and it is denoted by x . For a in the letter a of the strin u, i. e., the ordinal of the subsequence consistin of all the positions i < for which u = a. Given a strin u, we denote by u the strin of len th u de ned by u where
= u,k
1. E. ., a a2 is primitive.
5
Conju acy
We recall that two elements x y of a monoid are conju ate if there exist two elements z t such that x = zt and y = tz. The proof of the next property connects the notions of primitivity and conju acy. Its proof follows the same line as in the case of nite strin s and it is left to the reader. Proposition 7. Two conju ate strin s have conju ate roots and equal exponents. As in the case of free monoids there is an alternative de nition of the notion of conju acy. The followin result is a direct extension of [8]. Ord , y = 1 satisfy the condition xz = zy Proposition 8. The strin s x y z Ord and n < such that x = uv, y = vu and if and only if there exist u v n z = (uv) u Observe that the equality xx = x 1 holds. Therefore the condition y = 1 is necessary.
Equations in Trans nite Strings
5.1
661
Stron Conju acy
The followin is a re nement of the notion of conju acy. Ord are stron ly conju ate if and only if De nition 1. Two strin s x y Ord there exist z t and two inte ers m n such that x = z tz n and y = z tz m
(4)
Stron conju acy has nice properties which we proceed to state. Ord . The followin conditions are equivalent Proposition 9. Let x y i) x y are stron ly conju ate ii) xy = yy (resp. yx = xx) iii) x y are conju ate and x is a pre x of y or y is a pre x of x iv) there exist z t such that x = zt y = tz and either zt = t or tz = z Furthermore, the relation bein stron ly conju ate is an equivalence relation As a consequence we have Corollary 1. If two strin s x y are stron ly conju ate then so are their roots. 5.2
Quasi-Cyclicity
From the section 3, it should be clear that the followin concept is useful. De nition 2. Two strin s x y u v such that x y (u v) u
Ord are quasi-cyclic if there exist two strin s
Proposition 10. In the previous de nition, u and u v may be assumed primitive. The followin are the main results on quasi-cyclicity that are used in the proof of Theorem 1. Ord are quasi-cyclic if and only if so Proposition 11. Two strin s x y are their roots. Furthermore, the relation x and y are quasi-cyclic reduced to the strin s of equal de ree is an equivalence relation. Observe that reducin the relation to the strin s havin the same de ree is necessary. Indeed, with x = a a, y = a, z = (a b) a = a (ba ) a we have that x y are quasi-cyclic and so are y z but x z are not. We may reformulate the notion of quasi-cyclicity by re nin it.
662
C ristian C o rut and Sandor Horvat
Ord , the followin conditions are Proposition 12. Given two strin s x y equivalent. i) x y are quasi-cyclic Ord such that u and u v are primitive, and x y ii) there exist u v (u v) u . iii) xy and yx are comparable. As an application we may state a weaker version than that of Proposition 5 in the case of xy = yx . Ord . Then the followin conditions are equivalent Proposition 13. Let x y i) x = y ii) x and y are quasi-cyclic and x = y iii) x and y have a common pre x of len th min xy yx
6
The Equation xm y p = z q
We extend the notion of quasi-cyclicity to arbitrary subsets X of strin s by Ord . We rst state imposin that X (u v) u holds for some strin s u v a technical result (for nite strin s this would mean if two of the three unknowns are powers of a third strin then so are the three unknowns ). The proof makes use of Propositions 13, 6 and assertion 12, ii). Proposition 14. Let x y z be a solution of the equation xm y p = z q where 2 m p q . If two of the three unknowns are quasi-cyclic, then so are the three unknowns. The followin is the main result of our paper. Theorem 1. All solutions of the equation xm y p = z q with m p q cyclic.
2 are quasi-
For lack of space, we can not reproduce the proof. It rst consists in showin that by applyin Propositions 5 and 6, the cases q 4 and m p 3 q = 3 may be ruled out. The rest of the proof, which is more technical, proceeds by examinin the remainin cases and by repeatedly applyin the results of the previous sections. In order to ive the reader a flavour of the techniques used, we reproduce the veri cation of the case p = m = 2 q = 3. We are able to prove that there exist Ord , and r 0 (the case r = 0 can be handled directly) such that some u v x = (uv)r+1 u y 2 = vu(uv)r+2 uuv and z = (uv)r+1 uuv
(5)
Equations in Trans nite Strings
663
Subcase 1) r + 1 = 2r0 for some r0 > 0. Observe rst that u v holds 0 0 else we have vu(uv)r = u(vu)r uv meanin that u and v are quasi-cyclic. By standard considerations on the len th, equation (5) implies 0
0
y = vu(uv)r u1 = u2 (vu)r uv
(6)
with u1 u2 = u. If u > v then by considerin the len ths of both handsides we have u1 = u2 v . Furthermore, the two handsides have the same pre x of len th u1 = vu1 = u2 v thus vu1 = u2 v implyin u1 = vu1 . We are left with u = v . By considerin the len ths of both handsides we have vu1 = u2 v and then by considerin both pre xes we et vu1 = u2 v. By cancellin out this common pre x, we observe that u1 u2 and u2 u1 are comparable, i. e., for some k i j, we et u1 = (a b)r a and u2 = (a b)r aj by Property 12. Then equality vu1 = u2 v yields v = (a b)s a for some s 0 and thus uv = (a b)r+s a = (a ba )r+s . Finally, y 2 z (a ba ) which closes this subcase. Subcase 2) r + 1 = 2r0 + 1 for some r0 0. Observe rst that u v holds 0 0 else we have vu(uv)r +1 = (uv)r uuv meanin that u and v are quasi-cyclic. Usin considerations on the len ths we have 0
0
y = vuu(vu)r v1 = v2 u(vu)r uv
(7)
By considerin the len ths of both handsides, we have v1 = v2 . Since v1 and v2 are pre xes of y we et v1 = v2 . Thus equation (7) is an equation in the two unknowns, and the veri cation follows from Proposition 3.
References 1. B. Berard and C. Picaronny. Accepting Zeno words wit out stopping time. In Proceedin s of the 22th International Symposium MFCS’97, number 1295 in Lecture Notes in Computer Science, pages 148 158. Springer, 1997. 2. J. B¨ uc i. T e monadic t eory of 1 . In Decidable Theories II, number 328 in Lecture Notes in Mat ematics. Springer, 1973. 3. C. C o rut and J. Kar um¨ aki. Combinatorics of words. In G. Rozenberg and A. Salomaa, editors, Handbook of Formal Lan ua es, volume 1, pages 329 438. World Scienti c, 1997. 4. S. C. C oueka. Finite automata, de nable sets and regular expressions over n tapes. J. Comb. Sys. Sci., 17:81 97, 1978. 5. N. J. Fine and H. S. Wilf. Uniqueness t eorems for periodic functions. Proc. Am. Math. Soc., 3(2):109 114, 1965. 6. Y. I. Hmelevskii. Equations in free semi roups, volume 107 of Am. Math. Soc. Transl. Proc. Steklov and Insti. Mat, 1976. 7. S. Horvat . Continuum-long squarefree words on t ree letters. 1996. 8. A. Lentin and M. P. Sc u ¨tzenberger. A combinatorial problem in t e t eory of free monoids. In R. C. Bose and T. E. Bowlings, editors, Combinatorial Mathematics, pages 112 144. Nort Carolina Press, C apel Hill, N. C., 1967. 9. Lot aire. Combinatorics on Words, volume 17 of Encyclopedia of Mathematics and its Applications. Addison-Wesley, 1983.
664
C ristian C o rut and Sandor Horvat
10. G. S. Makanin. On t e rank of equations in four unknowns in a free semigroup. Proc. Am. Math. Soc., 100:285 311, 1976. (Englis trans. in Math. USSR Sb., 29 257-280). 11. W. Sierpinski. Cardinal and Ordinal Numbers. Warsaw: PWN, 1958.
Minimal Forbidden Words and Factor Automata M. Crochemore
1
, F. Mi nosi2 , and A. Restivo2
1
2
Institut Gaspard-Mon e
[email protected] Universita di Palermo [mi nosi,restivo]@altair.math.unipa.it
Abstract. Let L(M ) be the (factorial) lan ua e avoidin a iven antifactorial lan ua e M . We desi n an automaton acceptin L(M ) and built from the lan ua e M . The construction is e ective if M is nite. If M is the set of minimal forbidden words of a sin le word v, the automaton turns out to be the factor automaton of v (the minimal automaton acceptin the set of factors of v). We also ive an al orithm that builds the trie of M from the factor automaton of a sin le word. It yields a non-trivial upper bound on the number of minimal forbidden words of a word. Keywords: factorial lan ua e, anti-factorial lan ua e, factor code, factor automaton, forbidden word, avoidin a word, failure function.
1
Introduction
Let L A be a factorial lan ua e, i.e., a lan ua e containin all factors of its words. A word w A is called a minimal forbidden word for L if w L and all proper factors of w belon to L. We denote by M F (L) the lan ua e of minimal forbidden words for L. The study of combinatorial properties of M F (L) helps investi ate the structure of the lan ua e L or of the system it describes. For instance, locally testable factorial lan ua es (cf [8]) are characterized by the fact that the correspondin lan ua es of minimal forbidden words are nite. In the context of Symbolic Dynamics they correspond to systems of nite type. Another example is iven by a lan ua e L that is the set of factors of an in nite word: in this case, as shown in [2], the elements of M F (L) are closely related to the bispecial factors (cf. [6], [7] and [3]) of the in nite word. A measure of complexity of the lan ua e L is introduced in [2] based on the function FL , that counts, for any n, the number of words of len th n in M F (L). Authors prove that the rowth of FL (n) as well as the topolo ical entropy of M F (L) are topolo ical invariants of the dynamical system de ned by L. This result provides a usefull tool to show that some systems are not isomorphic, which comes in addition to other notion like the ordinary notion of entropy and the zeta function, for example. Finally, [5] considers properties of lan ua es de ned by nite forbidden sets of words. Authors de ne the M¨ obius function for these lan ua es. ?
Work by this author is supported in part by Pro ramme Genomes of C.N.R.S.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 665 673, 1998. c Sprin er-Verla Berlin Heidelber 1998
666
M. Crochemore et al.
In this paper we focus on the transformations between L and M F (L). We rst desi n an automaton acceptin L(M ) and that is built from the lan ua e M . When M is a nite set the transformation is e ective. Moreover, if M is iven by its di ital tree, that is, its tree-like deterministic automaton, the al orithm is very similar to the al orithm of Aho and Corasick that builds a pattern-matchin machine for a nite set of words [1]. In a second part we consider the particular situation of a lan ua e that is the set of factors of a sin le word v. The construction of its factor automaton, the minimal deterministic automaton acceptin the factors of v (see [4]) is known to be rather intricate. It is remarkable that the precedin transformation yields exactly the factor automaton of v when the input if the set M of minimal forbidden words of v. We also ive an al orithm that realizes the converse transformation, buildin the trie of M from the factor automaton of v. A corollary of the al orithm is a non-trivial upper bound on the number of minimal forbidden words of a word. The complexities of al orithms described in this paper are all linear in the size of their input or output. Therefore, the desi n of possible faster al orithms relies on di erent representations of objects, which is not the aim of the paper.
2
Avoidin an Anti-Factorial Lan ua e
Let A be a nite alphabet and A be the set of nite words drawn from the alphabet A, the empty word included. Let L A be a factorial lan ua e, L = u v L. The complement i.e. a lan ua e satisfyin : u v A uv lan ua e Lc = A L is a (two-sided) ideal of A . Denote by MF (L) the base of this ideal, we have Lc = A MF (L)A . The set MF (L) is called the set of minimal forbidden words for L. A word v A is forbidden for the factorial lan ua e L if v L, which is equivalent to say that v occurs in no word of L. In addition, v is minimal if it has no proper factor that is forbidden. One can note that the set MF (L) uniquely characterizes L, just because L = A A MF (L)A
(1)
The followin simple observation provides a basic characterization of minimal forbidden words. Remark 1 A word v = a1 a2
an belon s to MF (L) i the two conditions hold:
v is forbidden, (i.e., v L), an−1 L and a2 a3 both a1 a2 len th n − 1 belon to L).
an
L (the pre x and the su x of v of
The remark translates into the equality: MF (L) = AL \ LA \ (A L)
(2)
As a consequence of both equalities (1) and (2) we et the followin proposition.
Forbidden Words
667
Proposition 1 For a factorial lan ua e L, lan ua es L and MF (L) are simultaneously rational, that is, L Rat(A ) i MF (L) Rat(A ). The set MF (L) is an anti-factorial lan ua e or a factor code, which means that it satis es: u v MF (L) u = v = u is not a factor of v, property that comes from the minimality of words of MF (L). We introduce a few more de nitions. De nition 1 A word v A avoids the set M , M A , if no word of M is a factor of v, (i.e., if v A M A ). A lan ua e L avoids M if every words of L avoid M . From the de nition of MF (L), it readily comes that L is the lar est (accordin to the subset relation) factorial lan ua e that avoids MF (L). This shows that for any anti-factorial lan ua e M there exists a unique factorial lan ua e L(M ) for which M = MF (L). The next remark summarizes the relation between factorial and anti-factorial lan ua es. Remark 2 There is a one-to-one correspondence between factorial and antifactorial lan ua es. If L and M are factorial and anti-factorial lan ua es respectively, both equalities hold: MF (L(M )) = M and L(MF (L)) = L. We also refer to the next de nition that is to be considered in the context of dynamical systems (see [9] for example). De nition 2 The factorial lan ua e L is said to be of nite type when MF (L) is nite. Finally, with an anti-factorial nite lan ua e M we associate the nite automaton A(M ) as described below. The automaton is deterministic and complete, and, as shown at the end of the section by Theorem 3, the automaton accepts the lan ua e L(M ). The automaton A(M ) is the tuple (Q A i T F ) where the set Q of states is w w is a pre x of a word in M , A is the current alphabet, the initial state i is the empty word , the set T of terminal states is Q M . States of A(M ) that are words of M are sink states. The set F of transitions is partitioned into the three (pairwise disjoint) sets F1 , F2 , and F3 de ned by: F1 = (u a ua) ua Q a A (forward ed es or tree ed es), F2 = (u a v) u Q M a A ua Q v lon est su x of ua in Q (backward ed es), F3 = (u a u) u M a A (loops on sink states). The transition function de ned by the set F of arcs of A(M ) is noted .
668
M. Crochemore et al.
Remark 3 One can easily prove from de nitions that 1. if q Q (M ), all transitions arrivin on state q are labeled by the same letter a A, 2. from any state q Q we can reach a sink state, i.e., q can be extended to a word of M . De nition 3 For any v A , qv denotes the state ( v), tar et of the unique path in A(M ) startin at the initial state and labeled by v. Since A(M ) is a complete automaton, qv is always de ned. In the automaton A(M ) states are words, but to avoid misunderstandin s we sometimes write the word correspondin to qv instead of just the word qv . Remark 4 Note that if v is a state of A(M ) we have qv = v. We are now ready to state the next lemma (which proof is by induction on v) that is used in the proof of Theorem 3, the main result of the section. Lemma 2 Let M be an anti-factorial lan ua e and consider A(M ). Let v A be such that, for any proper pre x u of v, q is not a sink state (q M ). Then, 1. the word qv is a su x of v, 2. qv is the lon est su x of v that is also a state of A(M ) (or q Q q su x of v = q su x of qv ). Proof. By induction on v . ./ Denotin by Lan (A) the lan ua e accepted by an automaton A, we et the main theorem of the section. Theorem 3 For any anti-factorial lan ua e M , Lan (A(M )) = L(M ). Proof. We rst prove L(M ) Lan (A(M )). We have to show that if v is a word that avoids M then v Lan (A(M )). Assume ab absurdo that v Lan (A(M )); therefore qv is a sink state. Let u be the shortest pre x of v for which q is a sink state (note that q = qv ). By lemma 2 statement 1, q is a su x of u, but qv is by de nition an element of M , and so v does not avoid M , a contradiction. We then prove Lan (A(M )) L(M ). Let v Lan (A(M )). Let us suppose ab absurdo that v does not avoid M , i.e., v = uwz for some w M u z A . We choose uw as the shortest pre x of v that belon s to A M . Since w M it is by de nition a state of A(M ); since w is a state that is a su x of uw, by Lemma 2 statement 2, w is a su x of q w . But q w , which is by de nition a state of A(M ), is a pre x of an element w0 of M . Since w is a su x of a pre x ./ of w0 , w is a factor of w0 , a contradiction because M is anti-factorial. The above de nition of A(M ) turns into the al orithm below, called Lautomaton, that builds the automaton from a nite anti-factorial set of words. The input is the trie T that represents M . It is a tree-like automaton acceptin the set M and, as such, it is noted (Q A i T 0 ). The procedure can be adapted
Forbidden Words
669
to test whether T represents an anti-factorial set, or even to enerate the trie of the anti-factorial lan ua e associated with a set of words. In view of Equality 1, the desi n of the al orithm remains to adapt the construction of a pattern matchin machine (see [1] or [4]) The al orithm uses a function f called a failure function and de ned on states of T as follows. States of the trie T are identi ed with the pre xes of words in M . For a state au (a A, u A ), f (au) is 0 (i u), quantity that may happen to be u itself. Note that f (i) is unde ned, which justi es a speci c treatment of the initial state in the al orithm. L-automaton (trie T = (Q A T 0 )) 1. for each a A 2. if 0 ( a) de ned 3. set ( a) = 0 ( a); 4. set f ( ( a)) = ; 5. else 6. set ( a) = ; 7. for each state p Q in width- rst search and each a 8. if 0 (p a) de ned 9. set (p a) = 0 (p a); 10. set f ( (p a)) = (f (p) a); 11. else if p T 12. set (p a) = (f (p) a); 13. else 14. set (p a) = p; 15. return (Q A Q T );
,,
m -
1
a
, - 0m, @@ a
, , b @@R m b - m,,b 2 3
Fi . 1. Trie of the factor code represent terminal states.
A
m -
4
b
a
bb
bbb on the alphabet
b . Squares
Example. Fi ure 1 displays the trie that accepts M = bb bbb . It is an anti-factorial lan ua e. The automaton produced from the trie by al orithm Lautomaton is shown in Fi ure 2. It accepts the pre xes of ( b b)( b) b that are all the words avoidin M .
670
M. Crochemore et al.
m - a,b
,, 6
a
I@@ a , @@ a,b , b - 0m a b - 4m @@ , a, b @@R ? b - ,,b - a,b 2m 3m 1
a
Fi . 2. Automaton acceptin the words that avoid the set Squares represent non-terminal states (sink states).
bb
bbb .
Theorem 4 Let T be the trie of an anti-factorial lan ua e M . Al orithm Lautomaton builds a complete deterministic automaton acceptin L(M ). Proof. The automaton produced by the al orithm has the same set of states as the input trie. It is clear that the automaton is deterministic and complete. Let u A+ and p = (i u). A simple induction on u shows that the word correspondin to f (p) is the lon est proper su x of u that is a pre x of some word in M . This notion comes up in the de nition of the set of transitions F2 in the automaton A(M ). Therefore, the rest of the proof just remains to check that instructions implement the de nition of A(M ). ./ Theorem 5 Al orithm L-automaton runs in time O( Q A ) on input T = (Q A i T 0 ) if transition functions are implemented by transition matrices.
3
Factor Automaton of a Sin le Word
In this section we specialize the previous results to the lan ua e of factors of a sin le word. It is proved below that the contruction of Section 2 yields the factor automaton (minimal dterministic automaton acceptin the factors) of the word (see Theorem 7). The minimality of the automaton seems to be exceptional because, for example, the same construction applied to the set aa ab does not provide a minimal automaton. The reverse construction that produces the trie of minimal forbidden words from the factor automaton is described in the next section. We consider a xed word v A and denote by F (v) be the lan ua e of factors of v. Proposition 6 The lan ua e F (v) is of nite type. Proof. Indeed, factors of v, of len ths less than v + 1, avoid all words of len th exactly v + 1. Therefore, every minimal forbidden word of F (v) has len th at most v + 1. ./
Forbidden Words
671
The result of the previous proposition is made more precise in the next section, but an immediate consequence of it and of the de nition of the automaton A(M ) for an anti-factorial lan ua e M , the automaton A(MF (F (v))) has a nite number of states. The next statement ives a complete characterization of the automaton as the factor automaton of v. Theorem 7 For any v A , the automaton obtained from A(MF (F (v))) by removin its sink states is the minimal deterministic nite automaton acceptin the lan ua e F (v) of factors of v. Proof. The automaton A(MF (F (v))) is already a deterministic nite automaton that accepts the lan ua e F (v) by Theorem 3. We only have to prove that it is minimal after removin the sink states. Suppose ab absurdo that there exist two equivalent non-sink states p q in Q. By the standard equivalence relation of undistin inshability and by construction p q F(v). Hence, v = xpy and v = x0 qy 0 and we can choose x and x0 of minimal len th. We consider two cases: (i) xp = x0 q , (ii) xp = x0 q . Case (i). We can suppose for example that xp x0 q (the case xp > x0 q is handled symmetrically). Then, xpy F(v) implies that (p y) is not a sink state, hence, by the equivalence (q y) is not a sink state, that is, qy F(v) by Remark 4. Therefore, v = x qyz where x x0 by the choice of x0 (of minimal 0 len th). Hence, v x + q + y + z > xp + y = v , a contradiction. Case (ii). The equality xp = x0 q implies either that p is a su x of q or the converse. Let us suppose for example that p = sq for some word s = . By Remark 3 statement 2, there exists w = pz that belon s to MF (F (v)). By the equivalence, qz is also a sink state and, a ain by the equivalence, for no proper pre x u of qz, q is a sink state. Hence, by Lemma 2.1, qqz is an element of MF (F (v)), that is, a su x of qz. Since p = sq s = , qqz is a proper su x of pz a ainst the anti-factorial property of MF (F (v)). A contradiction a ain. After cases (i) and (ii) it appears that there cannot exist two di erent nonsink states p q in Q that are equivalent. Therefore the automaton without sink states is minimal, which ends the proof. ./
4
Minimal Forbidden Words of a Word
We end the article by an al orithm that builds the trie acceptin the lan ua e MF (F (v)) of minimal words avoided by v. This is an implementation of the inverse of the transformation described in Section 2. Its desi n follows Equality 2. A corollary of the transformation ives a bound on the number of minimal forbidden words of a sin le word, which improves on the bound comin readily from Proposition 6.
672
M. Crochemore et al. MF-tr e (factor automaton A = (Q A T ) and its su x function s) 1. for each state p Q in width- rst search from and each a A 2. if (p a) unde ned and (p = or (s(p) a) de ned 3. set 0 (p a) = new sink; 4. else if (p a) = q and q not already treated 5. set 0 (p a) = q; 6. return (Q A s nks 0 );
The input of al orithm MF-tr e is the factor automaton of word v. It includes the failure function de ned on the states of the automaton and called s. This function is a by-product of e cient al orithms that build the factor automaton (see [4]). It is de ned as follows. Let u A+ and p = (i u). Then, s(p) = (i u0 ) where u0 is the lon est su x of u for which (i u) = (i u0 ). It can be shown that the de nition of s(p) does not depend on the choice of u.
- 0m a - 1m b - 2m b - 3m a - 4m b - 6m , 6 b, , & b - 5m, a % Fi . 3. Factor automaton of bb b; all states are terminal.
a ,, a,, b,, , ,, b, , , , , , - 0m, a - 1m, b - 2m, 3m, 4m b - 6m, , 6 b, , & b - 5m, a % c
Fi . 4. Trie of minimal forbidden words of F ( bb b) on the alphabet Squares represent terminal states.
b c .
Example Consider the word v = bb b on the alphabet b c . Its factor automaton is displayed in Fi ure 3. The failure function s de ned on states has values: s(1) = s(5) = 0, s(2) = s(3) = 5, s(4) = 1, s(6) = 2. Al orithm MF-tr e produces the trie of Fi ure 4 that represents the set of ve words b b bb bbb c .
Forbidden Words
673
Theorem 8 Let A be the factor automaton of a word v A . (It accepts the lan ua e F (v).) Al orithm MF-tr e builds the tree-like deterministic automaton acceptin MF (F (v)) the set of minimal forbidden words of F (v). Corollary 9 A word v A has no more than 2( v − 2)( Av − 1) + A minimal forbidden words if v 3, where Av is the set of letters occurrin in v. The bound becomes A + 1 if v 3. Proof. The number of words in MF (F (v)) is the number of sink states created durin the execution of al orithm MF-tr e. These states have exactly one inoin arc ori inated at a state of the factor automaton A of v. So, we have to count these arcs. From the initial state of A there is exactly A − Av such arcs. From the (unique) state of A without out oin arc, there are at most Av such arcs. From other states there are at most Av − 1 such arcs. For v 3, it is known that A has at most 2 v − 2 states (see [4]). Therefore, MF (F (v)) ( A − Av ) + Av + (2 v − 4)( Av − 1) = 2( v − 2)( Av − 1) + A . When v 3, it can be checked directly that MF (F (v)) A + 1. ./ Theorem 10 Al orithm MF-tr e runs in time O( v A ) on input word v if transition functions are implemented by transition matrices.
References 1. A. V. Aho and M. J. Corasick. E cient strin matchin : an aid to biblio raphic search, Comm. ACM 18:6 (1975) 333 340. 2. M.-P. Beal, F. Mi nosi, and A. Restivo. Minimal Forbidden Words and Symbolic Dynamics, in (C. Puech and R. Reischuk, eds., LNCS 1046, Sprin er, 1996) 555 566. 3. J. Cassai ne. Complexite et Facteurs Speciaux, Bull. Bel . Math. Soc. 4 (1997) 67 88. 4. M. Crochemore, C. Hancart. Automata for matchin patterns, in Handbook of Formal Lan ua es, G. Rozenber , A. Salomaa, eds. , Sprin er-Verla , 1997, Volume 2, Linear Modelin : Back round and Application, Chapter 9, 399 462. 5. V. Diekert, Y. Kobayashi. Some identities related to automata, determinants, and M¨ obius functions, Report 1997/05, Fakult¨ at Informatik, Universit¨ at Stutt art, 1997. 6. A. de Luca, F. Mi nosi. Some Combinatorial Properties of Sturmian Words, Theor. Comp. Sci. 1 6 (1994) 361 385. 7. A. de Luca, L. Mione. On Bispecial Factors of the Thue-Morse Word, Inf. Proc. Lett. 49 (1994) 179 183. 8. R. McNau hton, S. Papert. Counter-Free Automata, M.I.T. Press, MA 1970. 9. D. Perrin. Symbolic Dynamics and Finite Automata, invited lecture in Proc. MFCS’95, LNCS 969, Sprin er, Berlin 1995.
On Defect E ect of Bi-In nite Words? Juhani Karhum¨ aki, Jan Manuch, and Wojciech Plandowski Department of Mathematics and Turku Centre for Computer Science, University of Turku, SF-20014 Turku, Finland
[email protected] ,
[email protected] , wojtekpl@m muw.edu.pl
Abs rac . We prove the followin two variants of the defect theorem. Let X be a nite set of words over a nite alphabet. Then if a nonperiodic bi-in nite word w has two X-factorizations, then the combinatorial rank of X is at most card(X) − 1, i.e. there exists a set F such that X F + with card(F ) card(X). Further, if card(X) = 2 and a bi-in nite word possesses two X-factorizations which are not shift-equivalent, then the primitive roots of the words in X are conju ates. Moreover, in the case card(F ) = card(X), the number of periodic bi-in nite words which have two di erent X-factorizations is nite and in the two-element case there is at most one such bi-in nite word.
1
Introduction
Defect theorem is one of the fundamental results on words, cf [Lo]. Intuitively it states that if n words satisfy a non-trivial relation then these words can be expressed as products of at most n − 1 words. Actually, as discussed in [CK], for example, there does not exist just one defect theorem but several ones dependin on restrictions put on the required n − 1 words. It is also well-known that the nontrivial relation above can be replaced by a weaker condition, namely by the nontrivial one-way in nite relation. The oal of this note is to look for defect theorems for bi-in nite words. In a strict sense such results do not exist: the set X = ab ba of words satis es a bi-in nite nontrivial relation since (ab)Z = (ba)Z, but there exists no word such that + . However, we are oin to prove two results which can be viewed as X defect theorems for bi-in nite words. In terms of factorizations of words defect theorem can be stated as follows: + + be a nite set of words. If there exists a word w havin two Let X di erent X-factorizations, then the rank of X is at most card(X) − 1. Here the rank of X can be de ned in di erent ways, cf a ain [CK]. For example, it can be de ned as a combinatorial rank rc (X) denotin the smallest number k such that X Y + with card(Y ) = k. To describe our results let w be a bi-in nite word, i.e. an element of Z, and X a nite subset of + . We say that w has an X-factorization if w X Z, and that w has two di erent X-factorizations, if it has two X-factorizations such Supported by Academy of Finland under Grant No. 14047. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 674 682, 1998. c Sprin er-Verla Berlin Heidelber 1998
On Defect E ect of Bi-In nite Words
675
that they do not match at least in one point of w. We are oin to prove the followin two results: i) If a nonperiodic bi-in nite word w has two di erent X-factorizations, then the combinatorial rank rc (X) of X is at most card(X) − 1. Moreover, if rc (X) = card(X) then the number of bi-in nite words with two di erent X-factorizations is nite. ii) Let card(X) = rc (X) = 2, so that X is a code. If a bi-in nite word w has two di erent X-factorizations which are not shift-equivalent, then the primitive roots of words in X are conju ates. Moreover, there is at most one bi-in nite word possessin two di erent X-factorizations. Note that case ii) is a strict sharpenin of case i) for two-element sets. We also want to emphasize that a restriction to nonperiodic words in case i) is necessary, and even more that this theorem requires to consider the combinatorial rank. This seems to be the rst result where the defect e ect is realized only by the combinatorial rank, and not by the other types of ranks, cf a ain [CK]. The rst part of the result in ii) is related to the main result of [lRlR], and, we believe, deducible from considerations of that paper. However, our proof is self-contained and essentially shorter, and moreover formulated directly to yield a defect-type of theorem. Our paper is or anized as follows. In Section 2 we x our terminolo y and present the auxiliary results needed for our proofs. In Section 3 we prove our eneral defect theorem for bi-in nite words, i.e. i) above. In Section 4 we prove, as our main result, a defect theorem for binary sets X satisfyin a nontrivial bi-in nite relation, i.e. above ii). In Section 5 we prove the second part of ii), i.e. the uniqueness of the bi-in nite word in the two-element case. The last section contains conclusions and open problems. The full version of this paper with complete proofs appears in [KMP].
2
Preliminaries
In this section we x our terminolo y and recall a few lemmas on combinatorics of words needed for our proofs. For unde ned notions we refer to [Lo] or [CK]. Let be a nite alphabet and X a nite subset of + . The set of all nite, in nite and bi-in nite words are denoted by , N and Z, respectively. Hence, , usually written as formally a bi-in nite word is a mappin fw : Z w=
a−1 a0 a1
with ai = fw (i) .
An X-factorization of w is any sequence of words from X yieldin w as their prodZ is a mappin F : Z X Z such ucts. Formally, an X-factorization of w aj−1 = that for each k Z if F (k) = ( i) and F (k + 1) = ( j), then ai ai+1 , i.e. the position i is a startin position of the factor in w. We say that two X-factorizations F1 and F2 of a bi-in nite word are
676
Juhani Karhum¨ aki et al.
di erent, whenever there is a k0 Z such that for each k Z, F1 (k0 ) = F2 (k), disjoint, whenever the startin positions of all factors in F1 are distinct from the ones in F2 , shift-equivalent, if there is a k0 such that whenever F1 (k) = ( i) and F2 (k0 + k) = ( j), then = . Example 1. Let X = a bab baab . The word (baa)Z has two di erent X-factorizations, namely the ones depicted as baabaab
.
They are clearly shift-equivalent. On the other hand the word w=
bababaabaab
= Z(ba)b(aab)Z
also has two di erent X-factorizations which, however, are not shift-equivalent b a b a b aa b aa
.
Clearly, in both of the above cases the two factorizations are disjoint. We de ne the combinatorial rank of X
+
rc (X) = min card(Y ) X
by the formula Y+
For the sake of completeness we remind that rc (X)
rf (X)
card(X)
where rf (X) denotes the free rank (or simply the rank) of X de ned as the cardinality of the base of the smallest free semi roup containin X, cf [CK]. a b +, but for no word Example 1 (continued). Clearly, rc (X) = 2, since X + holds. On the other hand, since X is a code we conclude the inclusion X that rf (X) = 3. Example 2. Let X = ab bc ca . Then we have rc (X) = rf (X) = card(X). Note also that the word (abc)Z has two disjoint, but shift-equivalent, X-factorizations: a b c a b c
.
On Defect E ect of Bi-In nite Words
677
Next we recall a few basic results on words that we shall need in our later considerations, for their proofs the reader is referred to [Lo] or [CK]. + . If the words uN and v N have a common pre x of Lemma 1. Let u v len th at least u + v − cd( u v ), then u and v commute.
Lemma 2. No primitive word
satis es a relation
= s p with s p = 1.
Lemma 3. If two words u and v satisfy the relation ut = tv for some u v t + , i.e. if they are conju ates, then there exist words p and q such that pq is primitive and u = (pq)i
v = (qp)i
and
t
p(qp)
for some i
1
In Section 5 we shall need also the followin claim, cf [LyS]. Lemma 4. Consider nonempty words x, y, z satisfyin equation xm = y n z p , where m n p 2. Then all words x y z are powers of a common word. In order to formulate our fth, and the most crucial lemma, we need some + with a raph terminolo y, cf [CK] or [HK]. We associate a nite set X GX = (VX EX ), called the dependency raph of X, as follows: the set VX of vertices of GX equals to X, and the set EX of ed es of GX is de ned by the condition i xX N yX N = (x y) EX Then we have + , the combinatorial rank of X is at most Lemma 5. For each nite set X the number of connected components of GX .
As we shall see Lemma 5 is particularly suitable for our subsequent considerations. Indeed, in that lemma it is crucial that words in X are nonempty, and that indeed is satis ed in the proofs of our Theorems 1 and 2.
The General Case In this section we prove our rst defect theorem for bi-in nite words. To make ideas of our proofs clearer we shall frequently use pictures as illustrations. Let us x some notations used in pictures. A horizontal line expresses a bi-in nite word with two X-factorizations F1 F2 . The sequences of words in the factorization F1 are depicted above the line by consecutive arcs, similarly the sequences of words in F2 are depicted by arcs, which are below the line. For example, in Fi ure 2 we consider the words f1 f10 f2 f20 X , such that f1 f10 are parts of the factorization F1 and f2 f20 are parts of F2 .
678
Juhani Karhum¨ aki et al.
+ Theorem 1. Consider a set X = . Let w be a bi-in nite 1 n word over and F1 F2 two di erent X-factorizations of w. Then the combinatorial rank of X is at most n − 1, or both the word w and the X-factorizations F1 F2 are periodic. Moreover, if the rank of X is n, then the number of periodic bi-in nite words with two di erent X-factorizations is nite.
Proof. If F1 and F2 are not disjoint the result follows from Lemma 5. Now we + as depicted in Fi ure 1 with x y X. More precisely, study all words t we take the be innin of any x X in the lower factorization F2 , i.e. the point A, and we nd the closest end of y X in the upper factorization F1 to the ri ht from the point A, i.e. the point B. Now the X-di erence t is de ned as the word between points A and B. Note that there are in nitely many occurrences of X-di erences, but only nitely many of di erent values of t’s, since all t’s are proper su ces of words in X. By the pi eon hole principle there exists a t such that the X-di erence t occurs in nitely many times in the bi-in nite word w. Consider now two occurrences of an X-di erence t. Let the part of the factorization F1 between the end of the rst t and the end of the second t be f1 X + and the part of F2 between the be innin s of the t’s be f2 X + . We shall call the pair (f1 f2 ) the t-pair. Notice that for any t-pair (f1 f2 ) it holds tf1 = f2 t. Further, we shall call a t-pair (f1 f2 ) minimal, if there is no other occurrence of the X-di erence t inside the f1 f2 . Let us look at 3 consecutive occurrences of an X-di erence t, which has in nitely many occurrences in w, see Fi ure 2. Clearly, the pairs (f1 f2 ) and (f10 f20 ) are minimal t-pairs.
f10
f1
y
f10
f1
A
t
t B x
t
t
f2
f
t
i
h
f
1
t0
t
f20
x
t0
Fi . 2
t
i0
h
f20
f2
Fi . 1
0 1
x0
Fi . 3
In the case that for any such 3 occurrences we have f1 = f10
f2 = f20
(1)
the word w and both of the X-factorizations are periodic with the len th of a period equal to f1 . So assume that we found such 3 occurrences for which at least one of the equalities (1) does not hold. Take the pair fi fi0 in which the factorizations di er earlier. Without loss of enerality we can assume that X be the lon est common pre x of f1 f10 and it is the pair f1 = f10 . Let f 0 X their di erently startin su ces. Similarly de ne h i i0 X for 0 0 is empty or they start with di erent f2 f2 . Now either one of the words words x x0 X.
On Defect E ect of Bi-In nite Words
679
If, for example, is empty, then by the choice of the pair f1 f10 , the word i must be also empty. But then we immediately have an intermediate occurrence of the X-di erence t in f10 f20 , i.e. the pair (f10 f20 ) is not minimal. So assume 0 are both nonempty and their factorizations start with di erent words that X . By the choice of f1 x x0 X, i.e. that = x 1 , 0 = x0 10 , where 1 10 and f10 the common pre x h ends after the be innin of x and x0 . In Fi ure 3 it is shown the case when it ends inside x and x0 , but the followin considerations work also in the other cases. We have 3 equations over X t t0 : t0 it = x
1
t0 i0 t = x0
0 1
tf1 = f2 t
where x = x0 . So by Lemma 5 we obtain rc (X) n − 1. On the other hand, this implies that in the case rc (X) = card(X), for each value of t there is at most one minimal t-pair. By periodicity this minimal t-pair speci es the whole bi-in nite word w, and so for each value of t there is also at most one bi-in nite word containin X-di erence t. But any t must be a proper su x of a word from X, hence we have only nitely many bi-in nite words with two di erent X-factorizations. In the two-element case we have the followin consequence. + . Let w be a bi-in nite word over Corollary 1. Consider set X = commute and F1 F2 two di erent X-factorizations of w. Then the words or both the word w and the X-factorizations F1 F2 are periodic.
Theorem 1 deserves a few comments. First, the possibility that the two factorizations are both periodic cannot be ruled out. This follows from Example 2. Second, the combinatorial rank cannot be replaced by the free rank, for example. This indeed follows from Example 1. This latter remark is quite interestin since in all previous defect theorems, see [CK], either of our notions of the rank, or even some others, can be used to witness the defect e ect.
4
The Two-Element Case
In this section we eneralize the result of the previous section in the case of two-element sets. First we recall that in a strict sense we cannot have a defect theorem for bi-in nite words even in this simple case. Example 3. The set X = ab ba is of combinatorial rank 2 althou h the word (ab)Z has two disjoint, and even non-shift-equivalent, X-factorizations. As a main result of this paper we, however, show that the above example, and its natural variants, are the only exceptions which may occur. And even in these cases the roots of words in X are conju ates, i.e. they are cyclic permutations of powers of a common word. + . Let w be a bi-in nite Theorem 2. Consider set X = with word over and F1 F2 two di erent X-factorizations of w containin to ether both elements of X. Then one of the followin possibilities holds:
680
Juhani Karhum¨ aki et al.
i) and commute, or Z F2 Z, or vice versa, or ii) the roots of and are conju ates and F1 iii) the two X-factorizations F1 F2 are shift-equivalent and there exists an n 1 such that F1 F2 ( n )Z and is primitive or F1 F2 ( n )Z and is primitive. The proof of this is rather lon and can be found in [KMP]. It uses essentially Lemma 5. Theorem 2 deserves a few comments. The number of di erent X-factorizations of the bi-in nite word w havin an X-factorization is very di erent in cases i) iii). In case i) there exist nondenumerably many such X-factorizations, in case ii) there are nitely many di erent X-factorizations and if we consider shiftequivalent X-factorization as the same, then there are exactly two of them. Finally, in case iii) there are also nitely many di erent X-factorizations, which are all shift-equivalent. This actually means that in case iii) no bi-in nite word can be expressed in two di erent ways as a product of words from X. Hence, indeed, Theorem 2 shows a defect e ect of a two-element set for bi-in nite factorizations. In Theorem 2 we showed that if the words of X do not commute and are not conju ates then only the case iii) is possible. But if they do not commute and are conju ates Theorem 2 allows either case ii) or iii). It can be proved that only case ii) is possible. We can formulate the followin lemma and its corollaries, cf [KMP]. Lemma 6. If pq is primitive, then p(qp)n and q(pq)n are not conju ates for any n 1. Corollary 2. If
and
are di erent conju ates, then
must be primitive.
In fact Corollary 2 is a special case of the claim in [LeS] which states under m is primitive for all the additional assumption that are primitive, that natural numbers m. + . Let w be a bi-in nite Corollary 3. Consider set X = with word over and F1 F2 two di erent X-factorizations of w containin to ether both elements of X. If the roots of , are non-commutin conju ates, then Z F2 Z, or vice versa. F1
5
The Uniqueness of the Bi-In nite Word
In Section 3 we proved that if the rank of the set X equals to card(X), then the number of bi-in nite words possessin two X-factorizations is nite. In this section we shall prove that in the two-element case there is at most one such bi-in nite word. This holds also in the case when rc (X) = 1, since then both elements of X are powers of a common word t and the only possible bi-in nite word is tZ. The situation is also trivial in the case when roots of elements of
On Defect E ect of Bi-In nite Words
681
X = are conju ates, by Corollary 3 the only possible bi-in nite word is w = Z = Z. So we need to consider only the case when the roots of and are not conju ates. In this case, by Theorem 2, we know that a bi-in nite word possessin two X-factorizations must be of the form ( n )Z or ( n )Z. Moreover, since w has n or the word n cannot be primitive, by two X-factorizations, the word Lemma 2. As we stated in the previous section, if and are conju ates, then n and n are primitive for all natural n. We have showed a similar the words result for bein non-conju ates, i.e. we have showed that at most one word n , n is not primitive, cf [KMP]. By this result, we have that also in of the last case there is at most one bi-in nite word possessin two di erent Xfactorizations. + . There is at most one biTheorem 3. Consider set X = , in nite word over possessin two di erent X-factorizations.
6
Conclusions and Open Problems
Our Theorem 2 is closely related to the main result of [lRlR], where it is characterized when a nite word can have two disjoint X-interpretations for a binary set X. Our result could be concluded, with some e ort, from the considerations in this paper. However, our proof is simpler, due to the use of the raph lemma (5), and moreover directly formulated to obtain a defect type of theorems. We pose an open problem askin whether Theorem 2 can be extended to arbitrary sets. + be a nite set such that rc (X) = card(X). Open Problem 1. Let X Does there exist a bi-in nite word w havin two X-factorizations F1 and F2 satisfyin :
i) both F1 and F2 contain all elements of X, and ii) F1 and F2 are not shift-equivalent. Observe here that even in the case of a two-element set X without the assumption that all elements of X occur in both factorizations the answer to this problem is trivially ne ative. The answer is also ne ative if the condition rc (X) = card(X) is replaced by a weaker one involvin free rank: rf (X) = card(X). This is veri ed by the followin example. Example 4. Let X = 1 2 3 where 1 = babab, 2 = abbabba and 3 = babbab. Then ( 1 2 3 )Z = ( 2 1 3 )Z and we have rf (X) = 3 = card(X), since X is a code. Clearly, rc (X) = 2 < card(X). Another open problem asks whether Corollary 3 can be eneralized for an arbitrary nite X.
682
Juhani Karhum¨ aki et al.
+ Open Problem 2. Let X be a nite set satisfyin rc (X) = card(X). Suppose that primitive roots of all elements of X are conju ates and that a bi-in nite word w has at least two di erent X-factorizations. Are all XX? factorizations of w of the form Z, where
Example 5. The answer to the above question is ne ative if we omit the assumption rc (X) = card(X). Indeed, let X = 1 2 3 , where 1 = baa, 2 = aba, Z 3 = aab. Then clearly 1 2 3 and the word (abaaab) has two di erent X-factorizations: ( 1 2 )Z and ( 2 3 )Z. In Section 5 we proved that in the two-element case there is at most one biin nite word possessin two di erent X-factorizations. In Section 3 we showed that if rc (X) = card(X), then there are nitely many such bi-in nite words, or more precisely, at most s(X) − card(X) such words, where s(X) is the sum of len ths of words in X. We conclude with our last open problem. + be a nite set satisfyin rc (X) = card(X). Open Problem 3. Let X Find a ood upper bound for the number of bi-in nite words possessin two di erent X-factorizations. Does there exist an upper bound which depends only on card(X)?
Acknowled ement The authors are rateful to Dr Tero Harju for useful discussions.
References CK. lRlR. Lo. HK. LeS. LyS. KMP.
Cho rut, C., Karhum¨ aki, J., Combinatorics of words, in G. Rozenber and A. Salomaa (eds), Handbook of Formal Lan ua es, Sprin er, 1997. Le Rest, E., Le Rest, M. Sur la combinatoire des codes a deux mots, Theoretical Computer Science 41, 61 80, 1985. Lothaire, M., Combinatorics on words, Addison-Wesley, 1983. Harju, T., Karhum¨ aki, J., On the defect theorem and simpli ability, Semi roup Forum 33, 199 217, 1986. Lentin, A., Sch¨ utzenber er, M. P., A combinatorial problem in the theory of free monoids, Proc. University of North Carolina, 128 144, 1967. Lyndon, R.C., Sch¨ utzenber er, M. P., The equation am = bn cp in a free roup, Michi an Mathematical Journal 9, 289 298, 1962. Karhum¨ aki, J., Manuch, J., Plandowski, W., On defect e ect of bi-in nite words, TUCS Report 181, 1998.
On Repetition-Free Binary Word of Minimal Den ity (Extended Ab tract) Roman Kolpakov1 , Gre ory Kucherov1, and Yuri Tarannikov3 1
2
1
INRIA-Lorraine/LORIA, 615, rue du Jardin Botanique, B.P. 101, 54602 Villers-les-Nancy, France, roman,kucherov @loria.fr Faculty of Discrete Mathematics, Department of Mechanics and Mathematics, Moscow State University, 119899 Moscow, Russia,
[email protected] Introduction
In this paper we continue with the study initiated in [12]. The eneral problem behind this study can be described as follows. Assume we have speci ed a set A of of prohibited words P A and we are interested in the set F words that don’t contain words from P as subwords. Words of F are said to avoid P . If the set F is in nite, the set P is called avoidable, otherwise it is called unavoidable. One mi ht specify, for example, a nite number of prohibited subwords P . Properties of unavoidable nite sets of words were studied in [13]. The set P of prohibited subwords can be in nite, in which case it may be speci ed by one or several patterns, i.e. words composed with variables and possibly with alphabet letters. Pattern avoidability has been subject of many works, and we refer to [7,6] for an introduction to this area and a survey of known results. One mi ht think of other ways of specifyin the set of subwords to be avoided, e. . as a lan ua e speci ed by a rammar. Note that for any set P of prohibited subwords, the set F of avoidin words is closed under takin subwords, and vice versa, any set F closed under subwords is the set of avoidin words for some P (just take P = A F ). Therefore, bein closed under subwords can be considered as a characterization for the sets of words that can be speci ed by means of prohibited subwords. The case when the prohibited subwords are those of the form un , for some n 2, has been extensively studied. Such subwords are called n-repetitions or npowers, and words that don’t contain such subwords are called n-th power-free. Back in the be innin of the century, Thue proved that there exist in nite 2-nd power-free (square-free) words over the three-letter alphabet, and 3-rd power-free (cube-free) words over the two-letter alphabet [15,16] (see also [4]). To recast it in terms of pattern avoidability, Thue showed that pattern xx is avoidable on the three-letter alphabet, and pattern xxx is avoidable on the two-letter alphabet. Note that xx is unavoidable on the 2-letter alphabet, and this illustrates the ?
On leave from French-Russian Institute for Informatics and Applied Mathematics, Moscow University, 119899 Moscow, Russia
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 683 692, 1998. c Sprin er-Verla Berlin Heidelber 1998
684
Roman Kolpakov et al.
fact that a set of subwords (or patterns) can be avoidable on some alphabet and unavoidable on a smaller alphabet. Paper [2] contains an example of a pattern which is avoidable on four letters but not on three letters. The question whether a iven pattern is avoidable on the k-letter alphabet (for a iven k) is not known to be decidable (see [9]) even if patterns are composed only of variables. In contrast, the question whether a iven pattern is unavoidable on any alphabet has been shown decidable in [3,1]. This paper is motivated by the followin eneral question: If a pattern p is unavoidable on k letters but avoidable on (k + 1) letters, what is the minimal proportion (density) of a letter in words over (k + 1) letters avoidin p? In other terms, what is the minimal contribution (in terms of relative number of occurrences) of the (k + 1)-st letter that allows to create words of unbounded len th avoidin p? Note that the minimal proportion is understood here as the limit minimal proportion as the len th of words oes to in nity. An answer to this question would establish a relationship between two properties of di erent kind: avoidance of a certain pattern (re ularity) and proportion of occurrences of a letter. To the best of our knowled e, minimal density has been rst studied in a related paper [12]. However, some work had been done on countin limit densities of subwords in words de ned by DOL-systems (cf e. . [11]). In [12], this study was undertaken for the case of n-th power-free words on the 2-letter alphabet, and some rst results were obtained. Here we continue with this analysis, and considerably extend the results of [12]. First, we analyse the very notion of minimal limit proportion (density) of a letter by comparin di erent possible de nitions. In particular, we prove that two natural de nitions, throu h nite and in nite words, lead actually to the same quantity. This con rms the si ni cance of this notion and the interest of studyin it. We then analyse the minimal proportion (n) of one letter in n-th power-free binary words. In [12] it has been shown that (n) = n1 + O( n12 ). Here we obtain a much more precise estimate by computin the rst four terms of the asymptotic expansion of (n). Speci cally, we show that (n) = n1 + n13 + n14 + O( n15 ). Then we turn to the analysis of the eneralized minimal density (x), de ned for all real x > 2. This eneralization, based on the notion of period of a word, was introduced in [12]. It was shown, in particular, that (x), considered as a real function, is discontinuous, as it admits a jump at x = 73 . Here we prove much more, namely that (x) has actually an in nity of discontinuity points, as those are all inte er points n 3. Futhermore, we ive an estimate for (n + 0) the ri ht limit of (x) at inte er points n 3 and prove that (n + 0) = n1 − n12 + n23 − n24 + O( n15 ).
As usual, A denotes the free monoid over an alphabet A. u A is a subword of w A if w can be written as u1 uu2 for some u1 u2 A . u stands for the len th of u A . A stands for the set of one-way in nite words, often called A. For n N , the word w-words, over A, that are de ned as mappin s N w obtained by concatenatin n copies of a word v is called the n-th power of v and denoted by v n . A word v is a period of w i w is a subword of v n for some n N.
On Repetition-Free Binary Words of Minimal Density
2
685
Minimal Den ity: General De nition and Propertie
Assume we have an in nite set F A which is closed under subwords, that is if a word w is in F , then any subword of w belon s to F too. As noted in Introduction, the property of bein closed under subwords characterizes the class of lan ua es that can be speci ed by a set of prohibited subwords. As F is in nite and closed under subwords, there exist an in nite word from A such that its every nite subword belon s to F . With interpretation of subword avoidance, this allows to speak about in nite words avoidin the set of subwords. We denote by F the set of in nite words of A with every nite subword belon in to F . Let a A be a distin uished letter, and we are interested in the minimal limit proportion of a’s in words of F of unbounded len th. For w F , de ne (w) . Denote ca (w) to be the number of occurrences of a in w and a (w) = cajwj F (l) = w F w = l . De nition 1. For every l N , let a (F l) = 1l minw2F (l) ca (w) and liml!1 a (F l). a (F ) is called the minimal (limit) density of a in F .
a (F )
=
Note that the type of ar ument of a will always make it clear if the density of an individual word, or the minimal density is meant. Obviously, all numbers a (F l) belon to [0 1] and therefore a (F ) belon s to [0 1] too. The followin two Lemmas clarify the behaviour of the sequence 1 a (F l) l=1 with respect to a (F ). They are direct eneralizations of Propositions 1,2 from [12] and are iven without proof.
N,
a (F
l)
= liml!1
a (F
l) = supl1
Lemma 1. For every l
Lemma 2.
a (F )
a (F ).
a (F
l).
By Lemma 2, the lower limit in De nition 1 can be replaced by the simple limit. Thus, the de nition a (F ) = liml!1 minw2F (l) a (w) is correct and seems to capture in a ri ht way the notion of the minimal density. However, there is another natural way to de ne the minimal limit density directly in terms of in nite words F , and one may ask if this can lead to a di erent density value. For a word w F F , let w[1 : j] denotes the pre x of w of len th j. The density of letter a in an in nite word v F is naturally de ned as the limit limj!1 a (v[1 : j]). Obviously, this limit may not exist. However, below we show that amon all words for which this limit exists, there is one that realizes the minimum of these limits, which is equal to a (F ). This con rms that a (F ) is the ri ht quantity caracterizin the limit density. We de ne an auxiliary measure a (F l) = minw2F (l) max1jl a (w[1 : j]). The followin lemma ives a key ar ument.
686
Roman Kolpakov et al.
Lemma . For every l
N,
a (F
l)
a (F
l)
a (F ).
Proof. It is easily seen that a (F l) a (F l). Let us prove that a (F l) (F ) for all l N . Assume that (F L) > a (F ) for some L N . This a a means that every word v F of len th at least L has a pre x v[1 : j] with a (v[1 : j]) > a (F ). Let = min a (v[1 : j]) − a (F ) where minimum is taken over all such pre xes. Take any word w F (N ) with N > 2L ( a (F ) + ). Find wm such that wj L and a (wj ) > a (F ) for a decomposition w = w1 w2 every j 1 j m − 1, and wm < L. Then ca (w) ( a (F ) + )( w − L) and a (F )+ ) a (w) a (F ) + − L( a (F ) + 2 . Since w was chosen arbitrarily, jwj (F ) (Lemma 1). this contradicts to a (F N ) a Corollary 1. The limit liml!1 Lemma 4. There exists a word v is equal to a (F ).
a (F
F
l) exists and is equal to such that limj!1
a (F ).
a (v[1
: j]) exists and
Proof. From Lemma 3 it follows that for every l N , there exists a word w F (l) with (w) = a (F l) a (F ), that is max1jjwj a (w[1 : j]) a (F ). Moreover, every pre x of w veri es the same inequality. Therefore, the set of words w verifyin the inequality forms an in nite tree with respect to the pre x relation such that the parent of a word w in the tree is its immediate pre x, obtained by removin the ri htmost letter. Since the alphabet A is nite, the tree is nitely branchin . By K¨ oni ’s Lemma, there exists an in nite path in this N. tree which de nes the in nite word v with a (v[1 : j]) a (F ) for all j (v[1 : j]) Since a (F j) a (F ), the result follows from Lemma 2. Lemma 5. minv2F limj!1 a (v[1 : j]) = all v F for which the limit exists.
a (F ),
where minimum is taken over
Proof. By Lemma 4, there exists a word v F such that limj!1 a (v[1 : j]) = a (F ). Therefore, inf v2F limj!1 a (v[1 : j]) a (F ). On the other hand, since v[1 : j] F (j), then a (v[1 : j]) a (F j), then limj!1 a (v[1 : j]) limj!1 a (F j) = a (F ) and inf v2F limj!1 a (v[1 : j]) a (F ). The lemma follows. Lemmas 4 and 5 imply that there exists a word v F that realizes the minimal limit limj!1 a (v[1 : j]) amon all words of F for which the limit exists. Moreover, this minimum is equal a (F ). To avoid the problem of existence of the limit, we could replace it by the lower limit and de ne the quantity inf v2F limj!1 a (v[1 : j]) where the in mum is taken over all words v F . The proof of Lemma 5 shows that this value is also equal to a (F ), and the in mum is reached on some word v F . The equvalence of di erent de nitions ives a stron evidence that a (F ) is an interestin quantity to study. In this paper, we undertake this study for a particular family of sets F the sets of n-th power-free binary words.
On Repetition-Free Binary Words of Minimal Density
3
687
Minimal Letter Den ity in n-th Power-Free Binary Word
Consider an alphabet A. For a natural n 2, a word w A is called n-th powerfree i it does not contain a subword which is the n-th power of some non-empty word. We denote P F (n) A the set of n-th power-free nite words. Words from P F (2) are called square-free, and words from P F (3) are called cube-free. If w A does not contain a subword uua, where u is a non-empty word and a is the rst letter of u, then w is called stron ly cube-free. An equivalent property (see [14]) is overlap-freeness w is overlap-free if it does not contain two overlappin occurrences of a non-empty word u. Well known Thue’s results [15,16] state that there exist square-free words of unbounded len th on the 3-letter alphabet, and stron ly cube-free words of unbounded len th on the 2-letter alphabet. Note that the existence of in nite stron ly cube-free words on the 2-letter alphabet implies that for that alphabet the set P F (n) is in nite for every n 3. From now on we x on the binary alphabet A = 0 1 . Our oal is to compute, for all n > 2, the value 1 (P F (n)) minimal density of 1 in the words P F (n). Note that by symmetry, 1 (P F (n)) = 0 (P F (n)), and to simplify the notation, we denote 1 (P F (n)) (respectively 1 (P F (n) l)) by (n) (respectively (n l)) in the sequel. Similarly, we will drop the index in c1 (w) and 1 (w), and will write c(w) and (w) instead. In [12] it has been proved that (n) = n1 + O( n12 ). Here, usin a di erent method, we prove the followin more precise estimation, that corresponds to the rst four terms in the asymptotic expansion of (n). Theorem 1.
(n) =
1 n
+
1 n3
+
1 n4
+ O( n15 ).
We rst establish the upper bound (n)
1 1 1 1 + + 4 + O( 5 ) n n3 n n
The proof is based on the followin lemma. Denote by
(1) the word 0 1.
Lemma 6. Let k 3. For i j 0 i j k and i = j, consider a morphism 0 1 de ned by h(0) = , h(1) = j . For a word w 0 1 , if h: 0 1 w P F (k) then h(w) P F (k + 1). Proof. First observe that h(0) h(1) is a pre x code, i.e. the inverse ima e w of any word h(w) is unique. Furthermore, for any u 0 1 , the occurrences of 1 in h(u) delimit the ima es of individual letters of w. This means that any subword of h(w) which ends with 1 and is preceeded by 1 (or starts at the be innin of h(w)) is the ima e of some subword of w. To prove the lemma, assume by contradiction that for some w P F (k), h(w) contains a subword v k+1 . Proceed by case analysis on the number of 1’s in v. If v contains no 1’s, then v k+1 contains at least k + 1 consecutive 0’s which is impossible as h(w) is a concatenation of words j . If v contains , we one 1, then v = 0l 10m , and v k+1 = 0l 1(0l+m 1)k 0m . Since h(w) j
688
Roman Kolpakov et al.
conclude that l + m i j and w must contain k consecutive occurrences of m , the letter h−1 (0l+m 1). Finally, if v contains s 1’s, then v = 0l 1 1 s−1 0 l+m k m 0 1) 0 . A ain, l + m i j and w contains the and v k+1 = 0l 1( 1 s−1 l+m 1). k-th power of the inverse ima e h−1 ( 1 s−1 0 Lemma 7. For every n
4, (n)
1 n − (n − 1)
(2)
Proof. For l N , take a word w P F (n− 1) with w = l and (w) = (n− 1 l). Denote by h the morphism de ned by h(0) = n−1 , h(1) = n−2 . Let u = h(w). By Lemma 6, u P F (n). Since c(u) = w , and u = (n−1)c(w)+n( w −c(w)) = 1 1 n w − c(w), we have (n u ) (u) = c(u) juj = n− (w) = n− (n−1 l) . Takin the 1 . limit for l , and then u , we have (n) n− (n−1) Upper bound (1) is now proved as follows. (2) trivially implies
(n)
1 1 1 1 = n1 + n13 1 n−1 2 = n + O( n2 ). Then, from (2) a ain, (n) n− n−1 +O( n12 ) O( n14 ). Substitutin this into (2) a ain, we have (n) n−( 1 + 11 +O( 1 )) n−1 (n−1)3 n4 1 1 1 3 1 + + + + O( ). This subsumes (1). 3 4 5 6 n n n n n
Now we turn to boundin bound.
+ =
(n) from below, and prove the followin lower
(n)
n2
n−1 −n−1
(3)
for all n 3. Consider an arbitrary nite n-th power-free word w. First, roup its letters = 0 1, 0 i n − 1. For a technical reason we assume that w into blocks does not start with n−1 . If it does, we temporarily remove the rst symbol 0. w is uniquely decomposed into a concatenation of ’s and a su x of at most n − 1 0’s. Then, we roup occurrences of ’s into lar er blocks (m k) = ( n−1 )m k , 0 m n − 1, 0 k n − 2. Informally, blocks are delimited by occurrences with i n − 2. A ain, w is uniquely decomposed into blocks and the of remainin su x Q of len th at most n2 − 1 (n − 1 occurrences of n−1 followed by n − 1 0’s). We proceed by roupin blocks into yet more lar e blocks. Let γ(l k0 k1
ks ) = (l k0 ) (n − 1 k1 ) (
l n−1 n−1 ) k0 ( n−1 ) k1
(n − 1 ks ) = (
n−1 n−1 ) ks
ks n − 2. Blocks γ are delimited where 0 l n − 2, s 0, 0 k0 k1 by each occurrence of (l k) with l n − 2. Note that since w starts with n − 2, it starts with (0 k) and therefore the rst block γ starts at the k, k be innin of w. Thus, the decomposition of w is uniquely de ned with a possibly remainin su x Q of len th up to n2 − 1. Takin into account the rst possibly 1 Q n2 − 1, and w0 is uniquely removed 0, we have w = P w0 Q, where P decomposed into blocks γ. Let us now compute the minimal possible ratio of 1’s in blocks γ. Consider ks ). We distin ish two cases: a block γ(l k0 k1
On Repetition-Free Binary Words of Minimal Density
689
Case s 1: We claim that kj + kj+1 n − 2 for every j 0 j s − 1. Indeed, ks ). If kj + kj+1 consider the subword kj ( n−1 )n−1 kj+1 of γ(l k0 k1 n − 1 then it has the pre x (0kj 10n−1−kj )n which contradicts to the n-th powerfreeness of w. Ps Usin this observation, we can bound j=0 kj by s+1 2 n when s is odd, and s s ks ) by 2 n + (n − 1) when s is even. Then γ(l k0 k1 2 n + (n − 1) + sn(n − n ks ) 1) + ln = s(n2 − 2 ) + nl + n − 1. Since the number of 1’s in γ(l k0 k1 ns+l+1 is ns + l + 1, we have (γ(l k0 k1 ks )) . The ri ht-hand s(n2 − n 2 )+nl+n−1 side minimizes when l is maximal (l = n − 2) and s is minimal (s = 1). We then ks )) 2n22n−1 . obtain (γ(l k0 k1 − 3n −1 2
Case s = 0: In this case γ(l k0 ) = (l k0 ), γ(l k0 ) = ln + k0 + 1, and l+1 . The ri ht-hand mininizes when both l and k0 are maximal (γ(l k0 )) = ln+k 0 +1 (l = k0 = n − 2), which ives (γ(l k0 )) n2n−1 −n−1 . The second case ives a smaller bound for all n 3 and we conclude that n−1 0 ks )) . Since w is a concatenation of blocks γ, this im(γ(l k0 2 n −n−1 n−1 n−1 0 0 . Returnin to w, we have c(w) c(w ) plies (w0 ) 2 n −n−1 n2 −n−1 w n−1 n2 −n−1 (
w − n2 ), and then (w) =
n-th power-free word, we have (n l) limit for l oin to in nity, we obtain that (n)
n−1 n2 n2 −n−1 (1 − jwj ). As w is an arbitrary n−1 n2 n2 −n−1 (1 − l ) for all l. Takin the (n) n2n−1 −n−1 . This implies in particular
c(w) jwj
1 1 2 1 + + 4+ 5 n n3 n n
(4)
Lower bound (4) to ether with upper bound (1) implies Theorem 1.
4
Generalized Minimal Den ity Function
Followin [12], we consider in this Section a natural eneralization of function jwj (n) to real ar uments. Recall that the exponent of a word w is the ratio min jvj , where the minimum is taken over all periods v of w. The exponent is a useful notion often used in word combinatorics (see [10,5,8]), that eneralizes the notion of n-th power. For example, Dejean proved that on the 3-letter alphabet, there exist in nite words that don’t contain any subword of exponent more than 74 . This stren thens Thue’s result on the existence of square-free words (i.e. words without subwords of exponent 2) over the 3-letter alphabet. Usin periods, function (n) can be de ned on real numbers in the followin way. For a real number x, de ne P F (x) (resp. P F (x + )) to be the set of binary words that do not contain a subword of exponent reater than or equal to (resp. strictly reater than) x. Note that P F (2 + ) is precisely the class of stron ly cube-free words. For the binary alphabet, the existence of in nite cube-free words implies that P F (x) (resp. P F (x + )) is in nite for x > 2 (resp. for x 2). Usin the results of
690
Roman Kolpakov et al.
Section 2, values 1 (P F (x)) and 1 (P F (x + )) are well-de ned for x > 2 and x 2 respectively. Similar to the previous section, we denote them respectively by (x) and (x + ). Notation (x l) and (x + l) is de ned accordin ly. Observe that for natural values of x > 2, (x) coincides with (n) studied in the previous section. Functions (x) (x + ) are non-increasin with values from [0 12 ]. This implies the existence, for every x > 2, of the ri ht limit (x + 0), that veri es (x + 0) = supy>x (y). The followin lemma is from [12]. Lemma 8. For every x > 2, (x + 0) = (x + ). In [12], it has been shown that (x) = 12 for x (2 73 ], and then proved that the ri ht limit of (x) at x = 73 is strictly smaller than 12 , implyin that (x) has a jump to the ri ht of x = 73 . Here we complement this result by provin that (x) has an in nite number of discontinuity points. We show that, besides x = 7 3, the function (x) is discontinuous to the ri ht at all inte er points x 3. The = 0 1. followin lemma is somewhat similar to Lemma 6. Recall that ak and n 3. Let h : A 0 1 be a morphism Lemma 9. Let A = a1 n for all 1 i k, and m = mj for all such that h(a ) = m , where m i = j. Then for every (n − 1)-th power-free word w A , h(w) is (n + )-th power-free. We skip the proof which oes alon the same lines as that of Lemma 6. Lemma 10. For every n
4, (n + )
1 n + 1 − (n − 1)
(5)
0 1 the morphism de ned by hn (0) = n , Proof. Denote by hn : 0 1 hn (1) = n−1 . Let wl be an (n − 1)-th power-free word of len th l with minimal number of 1’s ( (wl ) = (n−1 l)). Clearly, hn (wl ) = (n+1)(l−c(wl ))+nc(wl ) = (n + 1)l − c(wl ), and c(hn (wl )) = l. By Lemma 9, hn (wl ) is (n + )-th power-free, and we have (n +
hn (wl ) )
By takin the limit for l
(hn (wl )) =
1 l = (n + 1)l − c(wl ) n + 1 − (n − 1 l)
(see Lemma 2), inequality (5) follows.
Inequality (5) to ether with the trivial inequality (n − 1) 1 2 ives (n + 1 1 4. On the other hand, from lower bound (3) it follows ) n−1 2 < n for n n−1 1 that (n) n2 −n−1 > n . This implies that (n + 0) = (n + ) < (n), that is (x) has a jump to the ri ht of all inte er points n 4. For n = 3, inequality (5) does not make sense ( (2) is not de ned). Therefore, the case n = 3 should be analysed separately.
On Repetition-Free Binary Words of Minimal Density
Lemma 11.
(3 + )
691
1 3
Proof. Take a 3-letter alphabet A = 1 2 3 . For w A , let c (w) (i = 1 2 3) denote the number of occurrences of i in w. For any l N , choose a square-free A of len th l such that c1 (w) c2 (w) c3 (w). Note that for all word wl l N , wl is well-de ned, which follows from the existence of in nite square-free 0 1 de ned words on the 3-letter alphabet. Consider the morphism h : A by h(1) = 01, h(2) = 001, h(3) = 0001. Then h(wl ) = 2c1 (wl ) + 3c2 (wl ) + l 1 3l, and (h(wl )) 4c3 (wl ) = 3l + (c3 (wl ) − c1 (wl )) 3l = 3 . By Lemma 9, 1 word wl is (3 + )-th power-free, and then (3 + h(wl ) ) 3 . Takin the limit for l and usin Lemma 2, we et (3 + ) 13 . On the other hand, from lower bound (3) it follows that (3) 25 . Therefore, (x) has a jump to the ri ht of x = 3. Puttin all to ether, we obtain Theorem 2. (x) is discontinuous to the ri ht of x = of all natural points n 3.
7 3
as well as to the ri ht
Finally, we compute rst four terms in the asymptotic expansion of (n + ). To ether with Theorem 1, this will ive an estimate to the size of jumps postulated by Theorem 2. Recall that (n + ) = (n + 0) by Lemma 8. The followin lower bound holds for all n 3. (n + )
n−1 n2 − 2
(6)
We omit the proof which follows closely the proof of lower bound (3). Expandin the ri ht-hand side of (6), we have 1 2 2 1 1 − 2 + 3 − 4 + O( 5 ) n n n n n
(n + )
(7)
To obtain an upper bound to (n+ ) that matches lower bound (7), it su ces 1 +O( n13 ) implied to substitute into inequality (5) the upper bound (n−1) n−1 1 by (1) (instead of trivial upper bound (n − 1) 2 as above). We then et (n + )
1 n+1−
1 n−1
+
O( n13 )
=
1 2 2 1 1 − 2 + 3 − 4 + O( 5 ) n n n n n
2 n4
+ O( n15 ).
To ether with (7), this ives Theorem .
5
(n + ) =
1 n
−
1 n2
+
2 n3
−
Concluding Remark
In this paper we have continued with the study of minimal density function (x), introduced in [12]. We analysed this notion in a eneral framework, and proved that di erent possible de nitions are actually equivalent. Then, for the case of repetition-free binary words, we have extended several results of [12].
692
Roman Kolpakov et al.
Speci cally, we have iven a more precise estimation for the values of (n), and we proved that (x), considered as a function on real ar ument, is discontinuous to the ri ht of all inte er values of x. Finally, we ave an estimate of values (n) and (n + ). Many questions about minimal density function (x) remain open. Does it have other discontinuities? What are they? Is this function piece-wise constant? All these questions are still to be answered. Acknowled ements This work was supported by the French-Russian A.M.Liapunov Institut of Applied Mathematics and Informatics. The rst and third authors were supported by the Russian Foundation of Fundamental Research ( rant 96 01 01068). We are rateful to Alexander U olnikov and Vladimir Grebinski for their help, and to the anonymous referees for their useful remarks.
Reference 1.
2. 3. 4.
5. 6. 7.
8. 9. 10. 11. 12.
13. 14. 15. 16.
.. ¨¬¨. «®ª¨àãî騥 ¬®¦¥á⢠â¥à¬®¢. ⥬ â¨ç¥áª¨© ¡®à¨ª,
119(3):363 375, 1982. En lish Translation: A.I.Zimin, Blockin sets of terms, Math. USSR Sbornik 47 (1984), 353-364. K. Baker, G. McNulty, and W. Taylor. Growth problems for avoidable words. Theoret. Comp. Sci., 69:319 345, 1989. D. Bean, A. Ehrenfeucht, and G. McNulty. Avoidable patterns in strin s of symbols. Paci c J. Math., 85(2):261 294, 1979. J. Berstel. Axel thue’s work on repetitions in words. Invited Lecture at the 4th Conference on Formal Power Series and Al ebraic Combinatorics, Montreal, 1992, June 1992. accessible at http://www-litp.ibp.fr:80/berstel/. J. Berstel and D. Perrin. Theory of codes. Academic Press, 1985. J. Cassai ne. Motifs evitables et re ularites dans les mots. These de doctorat, Universite Paris VI, 1994. C. Cho rut and J. Karhum¨ aki. Combinatorics of words. In G. Rozenber and A. Salomaa, editors, Handbook on Formal Lan ua es, volume I. Sprin er, BerlinHeidelber -New York, 1996. M. Crochemore and P. Goralcik. Mutually avoidin ternary words of small exponent. International Journal of Al ebra and Computation, 1(4):407 410, 1991. J. Currie. Open problems in pattern avoidance. American Mathematical Monthly, 100:790 793, 1993. F. Dejean. Sur un theoreme de Thue. J. Combinatorial Th. (A), 13:90 99, 1972. M. Dekkin . On the Thue-Morse measure. Acta Univ. Carolin. Math. Phis, 33(2):35 40, 1992. R. Kolpakov and G. Kucherov. Minimal letter frequency in n-power-free binary words. In Proceedin s of the 22nd International Symposium on Mathematical Foundations of Computer Science (MFCS), Bratislava (Slovakia), volume 1295 of Lecture Notes in Computer Science, pa es 347 357. Sprin er Verla , 1997. L. Rosaz. Makin the inventory of unavoidable sets of words of xed cardinality. Theoretical Computer Science, 1998. to appear. A. Salomaa. Jewels of formal lan ua e theory. Computer Science Press, 1986. ¨ A. Thue. Uber unendliche Zeichenreihen. Norske Vid. Selsk. Skr. I. Mat. Nat. Kl. Christiania, 7:1 22, 1906. ¨ A. Thue. Uber die e enseiti e La e leicher Teile ewisser Zeichenreihen. Norske Vid. Selsk. Skr. I. Mat. Nat. Kl. Christiania, 10:1 67, 1912.
Embeddin of Hypercubes into Grids
?
ott er1 , and U.-P. Schroeder1 S.L. Bezrukov1, J.D. Chavez2 , L.H. Harper3 , M. R¨ 1
2
Department of Math. and Computer Science, University of Paderborn, D-33102 Paderborn, Germany Department of Math., California State University, San Bernandino, CA 92407, USA 3 Department of Math., California State University, Riverside, CA 92521, USA.
Abstract. We consider one-to-one embeddin s of the n-dimensional hypercube into rids with 2n vertices and present lower and upper bounds and asymptotic estimates for minimal dilation, ed e-con estion, and their mean values. We also introduce and study two new cost-measures for these embeddin s, namely the sum over = 1 n of dilations and the sum of ed e-con estions caused by the hypercube ed es of the th dimension. It is shown that, in the simulation via the embeddin approach, such measures are much more suitable for evaluatin the slowdown of uniaxial hypercube al orithms then the traditional cost measures.
1
Introduction
The power of messa e-passin multiprocessor systems strictly depends on the structure of their interconnection network. Various types of network topolo ies have ained favor and are in use today. Amon these, rids are emer in as one of the most popular network architectures. An obvious reason for the popularity of rids lies in their simple structure, which provides easy construction and scalin -up of such systems. On the other hand, a lar e number of al orithms and pro rammin techniques (e. . the ascend-descend al orithms) are developed for the hypercube. Its popularity, e ciency, and versatility as a pro rammin network model is mostly due to its recursive structure that is well suited for many al orithms. In order to run these e cient hypercube al orithms on a ridbased parallel computer, one has to simulate their communication requirements. A natural approach to such simulation would be via raph embeddin . We denote by V (G) and E(G) the vertex and ed e set of a raph G. An embeddin f = ( V E ) of a raph G into a raph H is an injective mappin V (H) to ether with a routin scheme E : E(G) 2E(H) , V : V (G) which assi ns for each ed e e = u v E(G) some path E (e) from V (u) to V (v) in H. The quality of an embeddin f may be expressed in terms of dilation and ed e-con estion, in order to satisfy the demands of process locality and communication e ciency. For an ed e e E(G) its dilation dilf (e) in the This work was supported by the DFG-Sonderforschun sbereich 376 Massive Parallelit¨ at: Al orithmen, Entwurfsmethoden, Anwendun en and by the EC ESPRIT Lon Term Research Project 20244 ALCOM-IT . Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 693 701, 1998. c Sprin er-Verla Berlin Heidelber 1998
694
S.L. Bezrukov et al.
embeddin f is de ned as the len th of the path E (e) in H. Now, for an ed e e0 E(H) we put its con estion conf (e0 ) in the embeddin f to be equal to e E(G) e0 E (e) . In this paper we consider embeddin s of hypercubes into rids. As usual by the hypercube of dimension n IN (denotation Qn ), we mean the raph with V (Qn ) = 0 1 n and E(Qn ) = x y x y V (Qn ) (x y) = 1 , where (x y) is the Hammin distance (i.e. the number of entries where x y di er). The d-dimensional rid Gd is de ned as the Cartesian product of d linear arrays with p vertices each. We assume throu hout the paper that the rid Gd n has 2n vertices, i.e. d divides n, and so p = 2 d . For the class F of all considered n d embeddin s of Q into G , denote dil(n d) = min maxn dilf (e) dil(n d) = min f 2F e2E(Q )
f 2F
1 E(Qn )
con(n d) = min max conf (e0 ) con(n d) = min f 2F e 2E(Gd )
f 2F
1 E(Gd )
X
dilf (e)
e2E(Qn )
X
e
conf (e0 )
2E(Gd )
In the case d = 1 the numbers dil(n 1) and con(n 1) are called bandwidth and cutwidth and are well studied. For t IN and for A V (Qn ), we denote V (Qn ) A minw2A (v w) t , A = u v E(Qn ) u Γt A = v n A v V (Q ) A It is known (see [6] and [2,5,9], respectively) that dil(n 1) = max min Γ1 A = m
jAj=m
con(n 1) = max min m
jAj=m
n−1 X =0
A =
i
i 2
1 n+1 2 − 2 + (n mod 2) 3
(1) (2)
We denote by fban and flex the embeddin s of Qn into the linear array G1 , which have the correspondin parameters as in (1) and (2), respectively. To de ne these embeddin s we rst number the vertices of the linear array by 1 2 2n from one end to the other, then introduce the Bandwidth order B and the Lexico raphic order L on the vertices of Qn and nally map the ith vertex of Qn in the order B (resp. L) to the vertex of the linear array numbered by i for i = 1 2n . Moreover, we assume that the routin scheme is iven by usin the shortest paths. xn ), y = (y1P yn ). We say P that x is Let x y V (Qn ) with x = (x1 n n n− x 2 > reater than y in order L (denotation x >L y) i =1 =1 y n− 2 . Similarly, replacin n with d and 2 with p in this formula, we de ne the d n Lexico raphic order vertices of G Pn of the P P.n Concernin Pn the order B for Q , we n write x >B y i =1 x > =1 y , or =1 x = =1 y and x 1. However, our ar uments provide a lower bound for Sdil(n d) for arbitrary wei hts as well. Theorem 3
Sdil(n 1) =
n P
w
2 −1
=1
Sdil(n d)
2 2.1
n
d2d
for d > 1 w1 =
= wn = 1 as n
Standard Measures Bounds for the Dilation
Proof of Theorem 1. , we immediately et dil(n d) dil(n d 1) Considerin the embeddin fban n This inequality in combination with (1) and dil(n 1) as n (see bn 2c [3] for a complete proof) provides the upper bound in Theorem 1. xd ) V (Gd ) denote x = Let us turn to the lower bound. For x = (x1 Pd d V (Gd ) =1 x . We introduce the levels L of the rid G de ned by L = x Sk D0 for some x = i for i = 0 d(p − 1) and consider a set D = =0 L 0 Lk+1 . As it follows from the vertex isoperimetric problem for the k and D rid [4], for any xed h such a set D (with an appropriate choice of the subset D0 ) has a minimal number of vertices at distance at most h in the rid (outside of the set itself) amon all subsets of the rid of the same cardinality. Denote D = m. Let A be the collection of vertices of Qn mapped onto D in an embeddin f and consider the set F of vertices of the rid, which are ima es of the vertices F be a vertex with maximal value of y of Γt A in the embeddin . Let y and denote q = y . Now q − k is the width of a band in the rid located between its levels Lk and Lq , which is required to contain the vertices of Γt A for A = D = m. We denote Wt (m) := q − k − 1. Furthermore, let u be a vertex of Γt A, whose ima e in the embeddin is y and let f (v) = x D for some v A. Considerin a shortest path P connectin the vertices u and v in Qn , we conclude that there exists an ed e e P , so that dilf (e) ( y − x − 1) (u v) Wt (m) t. This leads to the lower bound dil(n d)
max max m
t
Wt (m) t
P(n−spn) 2 n Let us choose m and t of the form m = and t = s n with some =0 positive constant s, which will be an optimization parameter (here and below we omit the inte er parts for brevity). Let H be the ball of radius n − s n (in
Embeddin of Hypercubes into Grids
697
the Hammin metric) centered in (0 0) V (Qn ). Now, H = m and from the vertex isoperimetric problem for Qn [7] it is known that p (n+s n) 2 t (m)
:= min Γt A = Γt H = jAj=m
X
p =(n−s n) 2
n i
(3)
m which implies V (Gd ) (D F ) m. This shows that V (Qn ) (A Γt (A)) d Since the rid G has d(p − 1) + 1 levels, we et Wt (m) z := d(p − 1) − 1 − 2k In other words, z is de ned in such a way, that the sum of the z reatest j d(p − 1)) asymptotically equals t (m) (cf. (3)). Since numbers Lj (0 the lar est levels of Gd are located symmetrically around its middle level (with j = d(p − 1) 2), we have z = 2x with x determined by the equation X
d(p−1) 2+x
Lj
t (m)
(4)
j=d(p−1) 2−x
For further applications we have to estimate the sums in (3) and (4) asymptotically. Therefore, we use some facts taken from the probability theory. Let be a continuous random variable and F (x) be its distribution function (i.e. F (x) = P ( x)). We say that is normally distributed in (− ) if Rx 2 F (x) = (x) := p12 −1 e−z 2 dz Furthermore, consider a sequence of discrete random variables n , takin on a nite number P of values xn with correspondin probabilities pn . Let Fn (x) = P ( n x) = xn x pn be the distribution function of n , and n and n2 be its mean and variance, respectively. PWe say that n is asymptotically normal with mean n and variance n2 if lim xn n +x n pn = n!1
(x) for every x (− pendent if P ( 1 < x1
n
) The random variables < xn ) = P ( 1 < x1 ) P(
1 n
n
are called inde-
< xn )
Theorem 4 (Central Limit Theorem) If 1 n are independent random variables with the common distribution function F , mean , and variance 2 , then + n is asymptotically normal with mean n the random variable n = 1 + and variance n 2 . We apply Theorem 4 to the independent discrete random variables 1 n, which take on the values 0 l − 1 each with probability 1 l. Then, the random + n is asymptotically normal with mean and variance variable n = 1 + l−1 l2 −1 2 Denote by Lj the number of vertices respectively n l = n 2 n l = n 12 0), i.e. the size of the l l rid Gn on distance j from the vertex (0 n(l − 1) each with of its jth level. Clearly, n takes on the values 0 P probability 1 ln, so the distribution function Fn (x) of n is Fn (x) = l1n jx Lj . P P n l +x n l 1 p = lim Lj = (x) This imTherefore, lim n n j=0 x +x l n l n l n n!1 P n ln!1 +x n l (x) ln as n , where (x) = (x) − (−x) = plies j= n l −x n l Lj R 2 x −z 2 p1 dz. −x e 2
698
S.L. Bezrukov et al.
Now turnin back to the estimation of the sum in (4), let us consider x represented in the form x = y d p . Applyin Theorem 4 with n = d, l = p = 2n d , n l = d p = d(p − 1) 2, n l = d p , we et X
t (m)
X
dp 2+y
d(p−1) 2+x
Lj =
j=d(p−1) 2−x
d p
j=dp 2−y
Lj
(y) 2n
(5)
d p
Similarly, for the estimation of the sum in (3) we apply Theorem 4 to Qn with l = 2 and n 2 = n 2. Rewritin t in the form t = 2s n 2 , we et X n 2 n j
n 2+s t (m)
=
j=n 2−s
(s) 2n
(6)
n 2
From (5) and (6) it follows that y s. Thus, Wt (m)p z 2s d p . Finally, takin into account that t = 2s n 2 = s n and d p p d 12, one has r p 2p d 12 2s d p d 2n d Wt (m) = t 2s n 2 3 n n and the lower bound in Theorem 1 is proved. 2.2
Avera e Case Analysis
Note that for any embeddin f F of a raph G into H it holds X X dilf (e) = conf (e0 ) e2E(G)
(7)
e 2E(H)
Proof of Theorem 2. Consider an embeddin f of Qn into Gd and let us compute the sum on the ri ht hand side of (7), which we denote by f . Let A V (Qn ) and D be its ima e in f in the rid Gd . Consider the ed e-cut D separatin D from its complement in Gd . Then, X conf (e) A (8) e2rD
Indeed, the ima e of each ed e of A passes throu h the ed es of D. However, maybe there are some other paths connectin two vertices of D (or of its complement), which are also cut by D. This could make the sum in (8) reater than A . Now, let Dm be the collection of the rst m vectors of Gd in the V (Qn ) be the vertices mapped into Dm in the Lexico raphic order and Am embeddin f . Then Am = m and (8) implies n
2 X X m=1 e2rDm
n
conf (e)
2 X m=1
Am
(9)
Embeddin of Hypercubes into Grids
699
In [5] it is shown n
2 X
Am
2n−1 (2n − 1)
(10)
m=1
where the equality takes place if each Am is the collection of the rst m vertices of Qn taken in the Lexico raphic order. Let us estimate the double sum in (9). We say that an ed e e = u v E(Gd ) is an i-ed e, if the vectors u v di er in the ith entry. Denote by E the set of all i-ed es of Gd . It is easily shown by induction on d that, due to the choice of the Lexico raphic order, conf (e) for each P i-ed e e appears in the double sum at most p −1 times. Therefore, denotin Pd c = e2E conf (e) and takin into account (9) and (10), one has f = =1 c n Pd P2 P −1 n−1 n and c p con (e) 2 (2 − 1) f m=1 e2rDm =1 Thus, we are able to estimate the sum of c p −1 . To et a bound for f , however, we need to estimate the sum of c . In order to do this, let us de ne a squashed Lexico raphic order Lj . Consider the permutation 1 j−1 j j+1 d j = d−j+2 d 1 2 d−j+1 where the bottom row is a cyclic shift of the top row on j entries. Now, for xd ) y = (y1 y ) V (Gd ) we say that x is reater y in order Lj x = (x1 Pd Pd d j ( )−1 if p p j ( )−1 . Clearly, the order Lj is isomorphic to =1 x =1 y the Lexico raphic order up to rotations of the rid Gd . Therefore, considerin instead of the set Dm , the collections of the rst m vertices of Gd in order Lj and applyin the ar uments mentioned above, for any j 1 d one has Pd n−1 n j ( )−1 c p 2 (2 − 1) Summarizin these inequalities for j=1 d, =1 Pd Pd j−1 n−1 n n d d2 (2 − 1) which, with p = 2 , implies we nally et =1 c j=1 p as n f
=
d X
c
d 2n−1 (2n − 1) pd −1 p−1
=1
=
d n(d+1) 2 2
d
(1 − o(1))
(11)
. We call a To et an upper bound for minf 2F f , consider the embeddin flex d set of p vertices of G a column, if all these vertices a ree in some p − 1 entries. Denote by Cd the number of columns in Gd . Since the ima e of each ed e of Qn in the embeddin flex belon s to some column, denotin by Am the collection of the rst m vertices of Qn d in the Lexico raphic order, we et (cf. (10), [5])
f
lex
Cd
X e2E(G1 )
conf
lex
(e) =
n d 2X
Am = Cd 2n
d−1
(2n
d
− 1)
(12)
m=1
Simple ar uments show that Cd satis es the recursion Cd = p Cd−1 + pd−1 , which with C1 = 1 ives Cd = d pd−1 . Therefore, (11) and (12) imply as d n(d+1) d Finally, combinin this fact with (7), one has n minf 2F f 2 2
700
S.L. Bezrukov et al.
dil(n d) = minf 2F f E(Gd ) and con(n d) = minf 2F f E(Qn ) , which, d 2n and E(Qn ) = n 2n−1 , after takin into account E(Gd ) = (p − 1) Cd completes the proof of Theorem 2.
3
Simulation of the Uniaxial Al orithms
Proof of Theorem . Consider rst the case d = 1.PWe apply induction on n. For an embeddin f and i=1 n denote d = jE1 j e2E dilf (e). Note that maxe2E dilf (e) d and Pn 2n − 1 (cf. (11) and (10)). Now assumin w1 w2 wn and =1 d n − 1, one has applyin the inductive hypothesis with w0 = w − wn , i = 1 Sdil(n 1)
n X
w d =
=1
n−1 X
n X
=1
=1
w0 d +wn
d
n−1 X
n X
=1
=1
w0 2 −1 +wn (2n −1) =
w 2 −1
For d > 1 usin the same method and (11) a ain, we et Sdil(n d)
n X
d =
=1
n 2 XX 2 dilf (e) = n 2n =1 2 e2E
X
dilf (e)
n
d 2 d (1 − o(1))
e2E(Qn )
n and, thus, Clearly, for flex it holds d = 2 −1 for i = 1 Pnthe embeddin −1 2 , which matches the lower bound. Furthermore, the Sdil(n 1) =1 w with w1 = = wn = 1 provides Sdil(n d) d Sdil(n d 1) embeddin flex n d 2 d which completes the proof of Theorem 3. Note that in the case of arbitrary wei hts w and d > 1 our approach provides Pn 1−d −1 (1 − o(1)) Concernin a lower bound for Sdil of the form 2 d n =1 w 2 the quality measure Scon(n d) let us mention some results without ivin the = wn = 1 we obtain proofs because of space limitation. In the case w1 = n n Scon(n d) d Scon(n d 1) d 2 d where the upper the estimation 13 2 d . In the case of arbitrary wei hts we can bound is iven by the embeddin flex prove that the above iven lower bound for Sdil also ives a lower bound for Scon(n d) and in the case d = 1 this bound is asymptotically equal to the upper . bound iven by the embeddin flex
4
Applications
It is interestin to note that concernin the ordinary parameters (dilation and ed e-con estion) an embeddin optimal for one of them is not optimal for the seems to be optimal other, while for our new cost-measures the embeddin flex for both of them. This makes it hi hly probable that this embeddin provides ood practical results for the simulation. Below, we present some experimental results concernin data transfer in the Parsytec GCel 1024 parallel computer, consistin of 1024 transputers T-800 con ured in the 32 32 rid. The messa e-routin in this computer is supported by a software implementation of the wormhole routin . We simulated the communication behavior of the uniaxial
Embeddin of Hypercubes into Grids
701
kbyte/s
al orithms with w1 = = wn for n = 1 10, by sendin an amount 1000 of 6.4 Mbyte of data split into small "bandwidth" "lexicographic" packets of size 120 bytes throu h each 800 n. For ed e of E in Qn for i = 1 each mentioned value of n, we embed600 ded Qn into a sub rid of the 32 32 rid and for each i = 1 n we mea400 sured the maximal time t taken for a 200 messa e to reach its destination in the rid alon the paths correspondin to 0 the ima es of the ed es of E in the 0 2 4 6 8 10 + tn ) n, embeddin . Let t = (t1 + dimensions of the hypercubes then the avera e performance P (f ) of the communication in the embeddin Fi . 1. Emulation of uniaxial hyperf equals P (f ) = 6 4 t Mbyte/s. In cube al orithms. ) and P (fban ). As one can see from the Fi . 1 we show the results for P (flex ure, the performance of each embeddin is almost the same for n 4, which is explained by the similarity of the orders B and L for small n. However, for lar er n, the di erence increases and reaches the factor of approximately 6 for n = 10, i.e. the whole communication in uniaxial al orithms is done 6 times compared to fban . Therefore, the embeddin flex faster in the embeddin flex is not only asymptotically optimal, as we showed above, but also provides very ood practical results for concrete instances.
References 1. Annexstein, F.: Embeddin hypercubes and related networks into mesh-connected processor arrays. J. Parall. D str. Comput., 2 (1994), 72 79. 2. Bezrukov, S.L., Chavez, J.D., Harper, L.H., R¨ott er M., Schroeder U.-P.: The conestion of n-cube layout on a rectan ular rid, to appear in D sc. Mathemat cs. 3. Bezrukov, S.L., R¨ ott er, M., Schroeder, U.-P.: Embeddin of hypercubes into rids. Techn cal Report tr-sfb-95-1, University of Paderborn, (1995). 4. Bollobas, B., Leader, I.: Compressions and isoperimetric inequalities. J. Comb. Th., A-56 (1991), 47 62. 5. Harper, L.H.: Optimal assi nment of numbers to vertices. J. Sos. Ind. Appl. Math, 12 (1964), 131 135. 6. Harper, L.H.: Optimal numberin s and isoperimetric problems on raphs. J. Comb. Theory, 1 (1966), No.3, 385 393. 7. Katona, G.O.H.: A theorem on nite sets. In: Theory of Graphs, Akademia Kiado, Budapest, (1968), 187 207. 8. Lai, T.-H., Spra ue, A.P.: Placement of the processors of a hypercube. IEEE Trans. Comp., 40 (1991), No.6, 714 722. 9. Nakano, K.: Linear layout of eneralized hypercubes. In: Proc. Graph-Theoret c Concepts n Computer Sc ence, LNCS 790, Sprin er Verla , (1994), 364 375. 10. Zienicke, P.: Embeddin hypercubes in 2-dimensional meshes. Humboldt-Un vers t¨ at zu Berl n, (manuscript).
Tree Decompositions of Small Diameter? Hans L. Bodlaender1 and Torben Ha erup2 1 2
Department of Computer Science, Utrecht University, P.O. Box 80.089, 3508 TB Utrecht, the Netherlands
[email protected] Fachbereich Informatik, Johann Wolf an Goethe-Universit¨ at Frankfurt, Robert-Mayer-Str. 11-15, D 60054 Frankfurt am Main, Germany ha
[email protected] Abs rac . Motivated by applications in parallel and dynamic raph alorithms, we investi ate the tradeo between width and diameter of tree decompositions. For all inte ers n, k and K with 1 k K n − 1, denote by D(n k K) the maximum, over all n-vertex raphs of treewidth k, of the smallest diameter of a tree decomposition of of width K. We determine D(n k K), up to a constant factor, for all values of n, k and K. When K is bounded by a constant (the case of reatest practical relevance), D(n k K) is (n) for K 2k − 1, ( n) for 2k K 3k − 2, and (lo n) for K 3k − 1. We provide much more accurate bounds for the case K 2k − 1.
1
Introduction
A tree decomposition of a raph G is a tree that, informally, imparts a tree structure to G (precise de nitions are provided in the next section). A tree decomposition is characterized by a nonne ative inte er called its width, and the treewidth of a raph G is the smallest width of any tree decomposition of G. The treewidth of a raph G, informally, is a measure of how closely G resembles a tree the smaller the treewidth, the more tree-like G is. It has been observed that a tree decomposition of small width of a raph G is a powerful aid in the solution of any of a lar e number of computational problems on G. E. ., if the width is bounded by a constant, many NP-complete raph problems can be solved in linear time on G by usin the tree decomposition to uide the computation (a recent overview of such results can be found in [2]). In the traditional settin of raph al orithms, any tree decomposition of G of su ciently small width will do. For the newer models of parallel and dynamic computation, however, a tree decomposition of small width of an input raph is as useful as in the traditional settin , but a second parameter of the tree decomposition acquires importance, namely its diameter, the maximal distance between two nodes in the tree decomposition. This is because, after rootin the ?
This research was partially supported by ESPRIT Lon Term Research Project 20244 (project ALCOM-IT: Al orithms and Complexity in Information Technolo y). The work was carried out while the rst author was with the Max-Planck-Institut f¨ ur Informatik in Saarbr¨ ucken, Germany.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 702 712, 1998. c Sprin er-Verla Berlin Heidelber 1998
Tree Decompositions of Small Diameter
703
tree decomposition at an arbitrary node, a parallel al orithm typically processes the nodes in the tree decomposition one level at a time, while a dynamic al orithm answers a query or executes an update by traversin a root-to-leaf path. In both cases, the resultin time bound is (at least) proportional to the hei ht of the tree, which in turn is at least half the diameter. Al orithms of this kind were described, e. ., in [1,3,4,5,6,7,8]. It was shown by Bodlaender [1] that every n-vertex raph of treewidth k has a tree decomposition of width at most 3k + 2 and diameter O(lo n). By allowin a width sli htly lar er than the minimum width, we can thus reduce the diameter to a very low value. However, enlar in the width ever so sli htly is hi hly undesirable, because the runnin times of the al orithms that employ a tree decomposition typically increase dramatically at least exponentially with the width of the decomposition. It is therefore natural to ask whether it is really necessary to o from treewidth k to treewidth 3k + 2 in order to ensure a lo arithmic diameter. We answer this question completely. The answer turns out to be Almost, but not quite . More precisely, we show that a lo arithmic diameter can be preserved while the width is reduced to 3k − 1, whereas it is impossible in eneral to achieve a lo arithmic diameter and a width of 3k − 2 simultaneously. More enerally, we investi ate the complete tradeo between width and diameter of tree decompositions. For all inte ers n, k and K with 1 k K n − 1, denote by D(n k K) the maximum, over all n-vertex raphs G of treewidth k, of the smallest diameter of a tree decomposition of G of width K. We determine the value of D(n k K), up to a constant factor, for all combinations of n, k and K. Our ndin s are summarized in the theorem below. Note that we intend E1 = (E2 ), where E1 and E2 are nonne ative expressions, to mean that there are constants c c0 > 0 such that cE2 E1 c0 E2 for all values of the parameters occurrin in E1 and E2 . We allow E2 to be zero, in which case E1 is zero as well. Theorem 1. Let n, k and K be inte ers with 1 D(n k K) has the followin value: n−k−1 K −k+1 (K − 2k + 1)n + k 2 − K + k − 1 K − 2k + 1 lo
2
n−k K −k+1
lo 2 (K k)
k
n − 1. Then
K
if
k
K
2k − 1;
if
2k
K
3k − 2;
if 3k − 1
K.
In rou h approximation and for small values of k and K relative to n, we can say that D(n k K) is linear (in n) if K is below 2k, square-rootic if K is between 2k and 3k, and lo arithmic if K is above 3k. In an al orithmic context, it is not su cient to know that tree decompositions of small width and diameter exist; we must also be able to construct them.
704
Hans L. Bodlaender and Torben Ha erup
When K is bounded by a constant the most interestin case our upper bounds can be realized by e cient sequential and parallel al orithms. We omit further discussion of the al orithmic aspect.
2
De nitions
A tree decomposition of an undirected raph G = (V E) is a tree T = (X F ), each of whose nodes x X is labeled with a subset Ux of V , called the ba of x, such that x2X Ux = V (every vertex in G occurs in some ba ); for all u v E, there exists an x X such that u v Ux (every ed e in G is internal to some ba ); for all x y z X, if y is on the path from x to z in T , then Ux Uz Uy (every vertex in G occurs in the ba s in a connected part of T , i.e., in a subtree).
The width of the tree decomposition T is maxx2X Ux − 1, i.e., one less than the size of a lar est ba . We will refer to the third requirement imposed on tree decompositions above as the connectedness property . A path decomposition is a tree decomposition that is a path. It is obvious that every n-vertex raph has a tree decomposition of width n−1 and diameter 0 (put all vertices in a sin le ba ), and the case of treewidth 0 (no ed es) is trivial and without interest. Thus we lose nothin essential throu h the condition 1 k K n − 1 imposed throu hout the paper.
3
Upper Bounds
For all inte ers n, k and K with 1 k K n − 1, let f (n k K) = (n − k − 1) (K − k + 1) . We prove that f (n k K) D(n k K) f (n k K)+ 1 for K 2k − 1. Since D(n k K) = 0 K = n−1 f (n k K) = 0, this implies that D(n k K) = (f (n k K)) for this ran e of K. Theorem 2. (the linear upper bound ) Let n, k and K be inte ers with 1 k K n − 1. Then every n-vertex raph of treewidth k has a tree decomposition of width K with at most f (n k K) nodes of de ree reater than 1. In particular, D(n k K) f (n k K) + 1. Proof. Let G = (V E) be an n-vertex raph of treewidth at most k and let T = (X F ) be a tree decomposition of G in which every ba contains exactly k + 1 vertices it is easy to obtain such a tree decomposition from an arbitrary tree decomposition of G of treewidth at most k by addin vertices to ba s with too few vertices. We root T at an arbitrary node r X and process the nodes in T in postorder, i.e., process all children of a node x X before processin x itself. The processin of a node x X consists in computin the union U of the ba s of x and its children and, if and only if U K + 1, contractin all
Tree Decompositions of Small Diameter
705
ed es between x and its children (in any order) and assi nin U as the ba of the new node resultin from the contractions. It is easy to see that this yields a tree decomposition T 0 of G of width at most K. It now su ces to show that the size of the set Z of internal nodes in T 0 is bounded by f (n k K). To this end, de ne the hi h point of each vertex v V as the node of minimal depth in T 0 whose ba contains v; it follows from the connectedness property of tree decompositions that there is a unique such node. Durin the construction of T 0 described above, whenever a node x X is processed but the ed es between x and its children are not contracted, the ba s of x and of its children to ether contain at least K + 2 vertices. At most k + 1 of these occur in the ba of x, and the hi h points of all the remainin at least K + 2 − (k + 1) = K − k + 1 vertices are children of x. This ar ument assi ns at least K − k + 1 vertices in V uniquely to each node in Z. Moreover, the k + 1 vertices belon in to the ba of r are not assi ned to any node. It follows that Z (n − (k + 1)) (K − k + 1) = f (n k K). Lemma 3. For all inte ers n k 1, every raph that has a path decomposition of width k with n nodes has a tree decomposition of width at most 2k with diameter at most 2 n. Proof. Suppose that we are iven a raph G to ether with a path decomposition of G of width k and with n nodes. We be in by preprocessin the iven path decomposition as follows: First, we contract every ed e whose endpoints have identical ba s. Second, we place a new node on every (remainin ) ed e and ive each such node x a ba that is the intersection of the ba s of the nei hbors of x. It is easy to see that these steps produce a new path decomposition of G whose number N of nodes is bounded by 2n and with the property that every other node has a ba of size at most k. For i = 1 N , let U be the ba of the ith node in this path decomposition, counted from one xed end. We use a tree decomposition of a form illustrated in Fi . 1. In eneral, for all inte ers m 1, there is a tree Tm of diameter 2m − 2 with the followin properties:
1,2
3,6
7,12
13,16
4,5
8,11
14,15
9,10 Fi . 1. The tree Tm for m = 3
17,18
706
Hans L. Bodlaender and Torben Ha erup
1. Every node in the tree is labeled by two inte ers in the ran e 1 2m2 , and every inte er in this ran e labels exactly one tree node. 2. For i = 1 2m2 −1, the inte ers i and i+1 label the same node or adjacent nodes. 3. Every node is labeled by an odd inte er and an even inte er. We choose m minimal so that a node in Tm has the label N , i.e., so that 2m2 N , and associate each node x in Tm with a ba that is the union of U over the at most two inte ers i in 1 N labelin x. We must show that this yields a tree decomposition of G. By Condition (1) above, the rst two properties of a tree decomposition are clearly inherited from the path decomposition, and the connectedness property is implied by Condition (2). By Condition (3) and the fact that every other node in the modi ed path decomposition has a ba of size at most k, all ba sizes in the tree decomposition are bounded by 2k + 1; i.e., the width of the tree decomposition is at most 2k. What remains is to show that N 2 and hence the diameter 2m − 2 of Tm is bounded by 2 n. But m = 2m − 2 2 N 2 2 n. al be nonne ative real numLemma 4. Let l be a positive inte er and let a1 l a −1 + a −2 + + a1 . Then a bers such that, for i = 2 l, a =1 (1 +
2)
l =1
a.
Proof. Omitted. By a clique in a raph G = (V E) we mean a subset of V that induces a complete sub raph of G. We say that a clique C in G is covered by a node x in a tree decomposition of G if C is a subset of the ba of x. It is well-known that for every clique C in a raph G and for every tree decomposition (X F ) of G, C is covered by some node in X; we will refer to this as the clique-coverin property. Theorem 5. For all inte ers m k 1, every raph that has an m-node tree decomposition of width k has a tree decomposition of width at most 2k with 12 m. diameter at most 4(1 + 2) m + 2 lo 2 m Proof. Let T be a rooted m-node tree decomposition of width k of the iven raph G. De ne the wei ht of a node in T as the number of its descendants. For each internal node x in T , x a child y of x of maximum wei ht and call the ed e from x to y heavy; all other ed es in T are li ht. This partitions the nodes in T into heavy paths (some of which may consist of a sin le node). Independently for each heavy path P , consider for each ba U of a node on P the complete raph on the vertex set U , and let HP be the union of these complete raphs. We process HP accordin to Lemma 3, of course usin P as the path decomposition of HP . For each heavy path P , this yields a tree decomposition TP of HP that we will call the comb of P . We combine the combs into a sin le raph T 0 by, for each li ht ed e x y that joins heavy paths Px
Tree Decompositions of Small Diameter
707
and Py , addin an ed e between nodes in the combs of Px and Py whose ba s are supersets of Ux and Uy , respectively such nodes exist, by the clique-coverin property. It is clear that T 0 is a tree and that it inherits the two rst properties of a tree decomposition from the combs. The way in which the combs are stitched to ether uarantees that the connectedness property is also satis ed; i.e., T 0 is a tree decomposition of G. What remains is to bound the diameter of T 0 . We root T 0 at an arbitrary node of the comb of the heavy path containin the root of T . The diameter of T 0 is at most twice the number of ed es on a lon est leaf-to-root path in T 0 . Consider such a path P and assume that the combs that it touches are TPl , in that order. For i = 1 l, de ne a to be the number of nodes TP1 in T that are descendants of a node on P , but not, if i > 1, of a node on l, the ed e that joins P −1 to P is li ht, which implies that P −1 . For i = 2 l a a −1 + + a1 and that l lo 2 m + 1. Moreover, =1 a = m. By l a (1 + 2) m. Since a is an upper bound on the number Lemma 4, =1 l, Lemma 3 can now be seen to imply that the of nodes on P , for i = 1 len th of P is at most 2(1 + 2) m + l − 1, from which the theorem follows. Corollary 6. (the square-rootic upper bound ) For all inte ers n, k and K with 1 k < 2k K n − 1, D(n k K) 12 f (n k K 2 ) + 2. Proof. Given an n-vertex raph G of treewidth k, we rst use the al orithm of Theorem 2 to obtain a tree decomposition T of G of treewidth K 2 with at most m = f (n k K 2 ) nodes of de ree reater than 1. For each ba U of a node in T of de ree reater than 1, consider the complete raph on the vertex set U , and let H be the union of these complete raphs. We now use the al orithm of Theorem 5 to obtain a tree decomposition of width K with diameter at most 12 m of H. By the clique-coverin property, we can obtain a tree decomposition of G of width at most K by stickin back the ori inal nodes of de ree 1, which increases the diameter by at most 2. We omit the proof of the upper bound of Theorem 1 for the case K 3k − 1, but provide the followin brief outline of some of the ideas involved: In a natural way, the proof of Theorem 2 can be viewed as partitionin a tree decomposition of width k, now assumed without loss of enerality to be binary, of an n-vertex raph into at most 2f (n k K) + 1 vertex-induced subtrees, such that the union of the ba s of the nodes in each subtree contains at most K + 1 vertices. We re ne this partition to ensure several additional properties, while keepin the number of subtrees O(f (n k K) + 1). In particular, each subtree is required to have at most two boundary nodes, nodes adjacent to nodes in other subtrees. We then remove all nonboundary nodes, introducin an ed e between each pair of boundary nodes in the same subtree, after which we apply a more re ned variant of the tree-contraction al orithm of [1]. A detailed analysis shows that this yields a binary tree of diameter O(lo (f (n k K) + 1)) in which each node has a ba of size at most 3k. Subsequently we reduce the diameter to O(lo (f (n k K) + 1) lo (K k)) while allowin the maximum ba size to row
708
Hans L. Bodlaender and Torben Ha erup
to K + 1 by contractin subtrees of hei ht (lo (K k)) to sin le nodes. The resultin tree is not yet a tree decomposition of the input raph (in particular, many vertices may not be represented in ba s at all), but we can turn it into one by addin appropriate nodes of de ree 1, which increases the diameter by at most 2.
4
Lower Bounds
Throu hout this section, n, k and K are xed inte ers with 1 k K n − 1. We show the constructions of the previous section to be essentially optimal in the n i j : 1 i < j n and i − j case of the speci c raph Gn k = ( 1 k ) (see Fi . 2). Usin the clique-coverin property, one can easily show the treewidth of Gn k to be exactly k.
1
2
3
4
5
6
7
8
Fi . 2. G8 3
Let T = (X F ) be a tree decomposition of width at most K of Gn k and X. We can assume without loss of denote the ba of x by Ux , for all x enerality that the ba of every node in T of de ree 1 contains at least one vertex that does not occur in any other ba otherwise the node is superfluous and can be removed without increasin the diameter. For each node x in T of de ree 1, x such a vertex and call it the unique vertex of x. Our proofs consist of two components: On the one hand, we show that T must be a path if K 2k −1, a caterpillar (suitably de ned later) if K 3k − 2, and a tree whose de ree is bounded by a function of K k in eneral. On the other hand, we prove lower bounds for the number of nodes in T by exploitin the fact that every element of the family C = i i + k : 1 i n − k of n − k cliques of size k + 1 in Gn k is covered by some node in X. De ne an interval as a nite set of consecutive inte ers and the intervalcoverin number of a nite set U of inte ers as the number of maximal intervals of size at least k contained in U . Lemma 7. Let x X and suppose that Ux has interval-coverin number m. Then x covers at most K + 1 − mk cliques in C, and x covers no cliques in C if m = 0. Im be the m maximal intervals of size at least k contained Proof. Let I1 in Ux and note that each clique in C covered by x, itself bein an interval of 1 m . By considerin the size k + 1, must be contained in Ij for some j cliques in C in the natural order iven by their smallest vertices, it is easy to see
Tree Decompositions of Small Diameter
709
for arbitrary l 0 and for j = 1 m that if Ij contains the union of l distinct k + l, i.e., there is an overhead of k per interval. The cliques in C, then Ij K + 1. lemma now follows by recallin that Ux Theorem 8. (the linear lower bound ) For all inte ers n, k and K with 1 K 2k − 1, D(n k K) f (n k K) = (n − k − 1) (K − k + 1) .
k
Proof. Since all nei hbors of the unique vertex of a node of de ree 1 in T occur in the ba of a sin le node, all unique vertices must be drawn from the set 1 k n−k+1 n of vertices in Gn k with fewer than 2k nei hbors. Moreover, since all vertices in 1 k are nei hbors, at most one node of de ree 1 can have a vertex from this set as its unique vertex, and the same is true of the set n − k + 1 n . Therefore T has at most two nodes of de ree 1: T is a path. By Lemma 7, no node in T can cover more than K − k + 1 cliques in C. It follows that T contains at least C (K − k + 1) = f (n k K) + 1 nodes and, since T is a path, that the diameter of T is at least f (n k K). Theorems 2 and 8 to ether show the validity of the rst bound of Theorem 1. Let us say that a node y X separates inte ers ix and iz if ix iz Uy , but there are nodes x z X with ix Ux and iz Uz such that y lies on the path in T between x and z. Lemma 9. Suppose that y X separates inte ers ix and iz with ix < iz . Then iz − 1 . Uy contains at least k elements of ix + 1 Ux , iz Uz , and Proof. Let x z X be as in the de nition above; i.e., ix y lies on the path in T between x and z. Let Tx be the subtree of T induced by the nodes that can be reached from x without touchin y, and let j be the smallest inte er lar er than ix that does not belon to the ba of a node in Tx . It is easy to see that such an inte er indeed exists, and that j iz . Since ix does not belon to Uy and each of ix + 1 min ix + k n is a nei hbor of ix , we have j > ix + k. By de nition of j, thus, each element of the k-element set W = j−k j − 1 belon s to the ba of a node in Tx . On the other hand, each element of W , bein a nei hbor of j, also belon s to the ba of a node not ix + 1 iz − 1 . in Tx , and thus to Uy . A nal observation is that W We de ne a caterpillar as a tree in which no node is of de ree more than 3 and all nodes of de ree 3 lie on a sin le path. A spine of a caterpillar J is a maximal path in J that contains all nodes of de ree 3. For every node x on a xed spine S of a caterpillar J, we de ne the le attached at x as the sub raph of J induced by the nodes in J closer to x than to any other node on S. Lemma 10. For every inte er d most 14 (d + 2)2 nodes.
0, a caterpillar of diameter d contains at
710
Hans L. Bodlaender and Torben Ha erup
Proof. Let J be a caterpillar of diameter d with a maximal number of nodes and x a particular spine S of J. A little thou ht shows that the number of nodes on two le s of J attached at nei hborin nodes of S cannot di er by more than one. The two le s attached at the endpoints of S by de nition consist of just one node (which belon s to S), and thus the total number of nodes in J cannot exceed 1 + 2 + 3 + + 3 + 2 + 1, where the sum has exactly d + 1 terms. The value of this sum is bounded by 14 (d + 2)2 . Theorem 11. (the square-rootic lower bound ) Let n, k, and K be inte ers with 1 k < 2k K 3k − 2. Then D(n k K) (n k K) , where (n k K) = 2
(K − 2k + 1)n + k 2 − K + k − 1 K − 2k + 1
k+1 Proof. Let z and z 0 be nodes in T whose ba s contain the cliques 1 and n − k n , respectively. We assume that 1 occurs in no ba other than that of z and that n occurs in no ba other than that of z 0 this condition can be enforced simply by removin all o endin occurrences of 1 and n. We be in by showin that T is a caterpillar whose spine can be chosen to contain z and z 0 . If this is not the case, T contains a node y that either is of de ree at least 4 or is of de ree 3 and does not belon to the path from z to z 0 . In either case, removin y splits T into subtrees, at least two of which, say, T1 and T2 , contain neither z nor z 0 . Choose i1 and i2 as unique vertices of nodes of de ree 1 in T that belon to T1 and T2 , respectively, and assume without loss of enerality that i1 < i2 . Now y separates i1 and i2 and therefore, by Lemma 9, i2 − 1 . Similarly, y = z or y Uy contains at least k elements of i1 + 1 i1 − 1 . Finally, separates 1 and i1 , so Uy contains at least k elements of 1 n , contradictin the fact that Uy contains at least k elements of i2 + 1 K + 1 < 3k. Uy Thus T is a caterpillar, and we can x a spine S in T that contains z and z 0 . An ar ument similar to the one used above shows that if y is a node in T of de ree at least 2 whose removal disconnects some node of de ree 1 in T from both z and z 0 , then Uy has interval-coverin number at least 2. On each le L, at most one node is not of this kind, namely the node on L farthest from S. Thus each le contributes at most one node whose ba has interval-coverin number 1. Since all n − k cliques in C are covered by some node in X, Lemma 7 implies that X (K − 2k + 1) + S k n − k. Let d be the diameter of T . Then S d+1 1 2 0, where p is the and, by Lemma 10, X 4 (d + 2) . It follows that p(d) quadratic polynomial with p(m) = 14 (m + 2)2 (K − 2k + 1) + (m + 2)k − n. Since p(−2) = −n < 0, p has two roots, the smaller of which is ne ative. A standard analysis shows that the lar er of the two roots is precisely (n k K). It is now easy to see that D(n k K) (n k K) . It can be shown that the smaller of the bounds of Theorem 2 and Corollary 6 is within a constant factor of the bound of Theorem 11 for K 2k, which proves the validity of the second bound of Theorem 1.
Tree Decompositions of Small Diameter
711
Theorem 12. (the lo arithmic lower bound ) Let n, k and K be inte ers with 1 k K n − 1. Then D(n k K)
lo
2
n−k K −k+1
lo
2
K +k+1 k
Proof. If a node y in T is of de ree r 2, removin y splits T into r subtrees, ir , one from each subtree, such that and we can pick unique vertices i1 < ir . Then, for j = 2 r, y separates ij−1 and ij and hence, i1 < i2 < ij − 1 . Thus by Lemma 9, Uy contains at least k elements of ij−1 + 1 K + 1 and therefore r (K + k + 1) k . (r − 1)k Uy It is easy to see that a tree of maximum de ree at most r 2 and with diameter d contains at most rd nodes. As already observed in the proof of Theorem 8, Lemma 7 implies that T contains at least (n − k) (K − k + 1) nodes. Theorem 12 follows by combinin this with the bound on the maximum de ree of T established above.
Acknowled ment We thank the or anizers of ICALP’95 and the city of Sze ed for providin the hospitable environment in which this research was be un.
References 1. H. L. Bodlaender, NC-al orithms for raphs with small treewidth, in Proc. 14th International Workshop on Graph-Theoretic Concepts in Computer Science, J. van Leeuwen, ed., Lecture Notes in Computer Science, Sprin er-Verla , Berlin, vol. 344, 1989, pp. 1 10. 2. H. L. Bodlaender, Treewidth: Al orithmic techniques and results, in Proc. 22nd International Symposium on Mathematical Foundations of Computer Science, I. Pr vara and P. Ruzicka, eds., Lecture Notes in Computer Science, Sprin er-Verla , Berlin, vol. 1295, 1997, pp. 19 36. 3. H. L. Bodlaender and T. Ha erup, Parallel al orithms with optimal speedup for bounded treewidth, in Proc. 22nd International Colloquium on Automata, Lanua es and Pro rammin , Z. F¨ ul¨ op and F. Gecse , eds., Lecture Notes in Computer Science, Sprin er-Verla , Berlin, vol. 944, 1995, pp. 268 279. To appear in SIAM J. Computin , 1998. 4. N. Chandrasekharan, Fast Parallel Al orithms and Enumeration Techniques for Partial k-Trees, Ph.D. thesis, Clemson University, 1989. 5. N. Chandrasekharan and S. T. Hedetniemi, Fast parallel al orithms for tree decomposin and parsin partial k-trees, in Proc. 26th Annual Allerton Conference on Communication, Control, and Computin , Urbana-Champai n, Illinois, 1988, pp. 283 292. 6. S. Chaudhuri and C. D. Zarolia is, Optimal parallel shortest paths in small treewidth di raphs, in Proc. 3rd Annual European Symposium on Al orithms, P. Spirakis, ed., Lecture Notes in Computer Science, Sprin er-Verla , Berlin, vol. 979, 1995, pp. 31 45. To appear in Theoretical Computer Science, 1998.
712
Hans L. Bodlaender and Torben Ha erup
7. T. Ha erup, Dynamic al orithms for raphs of bounded treewidth, in Proc. 24th International Colloquium on Automata, Lan ua es and Pro rammin , P. De ano, R. Gorrieri, and A. Marchetti-Spaccamela, eds., Lecture Notes in Computer Science, Sprin er-Verla , Berlin, vol. 1256, 1997, pp. 292 302. 8. T. Ha erup, J. Katajainen, N. Nishimura, and P. Ra de, Characterizations of kterminal flow networks and computin network flows in partial k-trees, in Proc. 6th Annual ACM-SIAM Symposium on Discrete Al orithms, 1995, pp. 641 649.
De ree-Preservin Forests Hajo Broersma1, Andreas Huck2 , Ton Kloks3 , Otto Koppius1 , Dieter Kratsch4 , Haiko M¨ uller4 , and Hilde Tuinstra1 1
University of Twente Faculty of Applied Mathematics P.O. Box 217 7500 AE Enschede, the Netherlands broersma,tu nstra @math.utwente.nl 2
University of Hannover Institute of Mathematics Welfen arten 1 30167 Hannover, Germany
[email protected] -hannover.de 3
Department of Applied Mathematics Charles University Malostranske nam. 25 11800 Praha 1, Czech Republic
[email protected] .cz 4
Friedrich-Schiller-Universit¨ at Jena Fakult¨ at f¨ ur Mathematik und Informatik 07740 Jena, Germany kratsch,hm @m net.un -jena.de
Abstract. We consider the de ree-preservin spannin tree (DPST) problem: iven a connected raph , nd a spannin tree T of such that as many vertices of T as possible have the same de ree in T as in . This problem is a raph-theoretical translation of a problem arisin in the system-theoretical context of identi ability in networks, a concept which has applications in e. ., water distribution networks and electrical networks. We show that the DPST problem is NP-complete, even when restricted to split raphs or bipartite planar raphs. We present linear time approximation al orithms for planar raphs of worst case performance ratio 1 − for every constant > 0. Furthermore we ive exact al orithms for interval raphs (linear time), raphs of bounded treewidth (linear time), cocomparability raphs (O(n4 )), and raphs of bounded asteroidal number.
1
Description of the Problem and Its Practical Niche
Analysis of communication or distribution networks is often concerned with ndin spannin trees (or forests) of those networks ful llin certain criteria. Also in other contexts spannin trees show up as important tools in modelin and analyzin problems. Therefore, a myriad of problems on spannin trees have been Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 713 721, 1998. c Sprin er-Verla Berlin Heidelber 1998
714
Hajo Broersma et al.
studied in literature (see [5,6,8,9]). This paper deals with a virtually unexplored problem concernin spannin trees which we call the de ree-preservin spannin tree (DPST) problem: iven a connected raph G, nd a spannin tree T of G with a maximum number of de ree-preservin vertices, i.e., with a maximum number of vertices havin the same de ree in T as in G. Some closely related questions were studied before by Lewinter et al. [1,12,13] from a purely theoretical point of view. They published a number of short notes on the subject. For example, Lewinter [12] introduced the concept of de reepreservin spannin trees and he proved that the number of de ree-preservin vertices interpolates on the set of spannin trees of a iven connected raph G. In other words: if spannin trees exist with k and l de ree-preservin vertices respectively and k l, then there exists a spannin tree with exactly m de reepreservin vertices for every m with k m l. Our attention was initially turned to this problem throu h a practical application in water distribution networks (see [14]), which makes the DPST problem a nice example of theory and practice oin hand-in-hand. Suppose that we have to determine (or control) all flows in such a network by installin and usin a small number of flow meters and/or pressure au es. The network can be re arded as an undirected connected raph G and the flow throu h each ed e of G is described by an orientation of that ed e and a nonne ative flow value. Since the sum of all flow values of ed es enterin a vertex is always the same as the sum of all flow values of ed es leavin that vertex, except for possible sources and sinks, it is not di cult to derive all flows in the network from the flows throu h all ed es of a cotree C of G (i.e., C is obtained from G by removin the ed es of a spannin tree). Hence it would su ce to install flow meters at the ed es of C. However the costs of installin a flow meter is much hi her than those of installin a water pressure au e at some vertex. Alternatively, we can derive the flow throu h an ed e from the water pressure drop between the two incident vertices. If we only use pressure au es, and want to minimize the costs, the problem becomes that of ndin a cotree whose ed es are incident with a minimum number of vertices (in order to minimize the number of pressure au es that have to be installed) or, equivalently, of ndin a spannin tree T whose complement in G has as many isolated vertices as possible, i.e., T has a maximum number of de ree-preservin vertices. Rahal [15] independently discovered the cotree approach in his investi ation of a steady state formulation for water distribution networks. Our problem of determinin all flows in the network with minimal costs of measurin (installin pressure au es) is a so-called identi ability problem (see Walter [16]). The concrete water distribution network that we considered has 80 vertices and 98 ed es, makin it a very sparse network. Our network is planar and it has outerplanarity 2. Especially this latter fact enables us to solve the DPST problem in our case by a linear time al orithm.
De ree-Preservin Forests
2
715
Preliminaries
Throu hout let G = (V E) be a raph and let n = V and m = E . For a subset S V we use G[S] to denote the sub raph of G induced by the vertices of S. For a subset S V we also write G − S for G[V S], and for a vertex x of G we write G − x instead of G − x . For a vertex x of G we use NG (x) to denote the set of nei hbors of x in G, NG (x) for the closed nei hborhood of x in G; the and we write NG [x] = x de ree of x in G is dG (x) = NG (x) . A pendant vertex of G is a vertex with de ree one in G. We omit the subscript G from the above expressions if it is clear which raph G we consider. De nition 1. A subset S V is realizable if there exists a spannin forest T of G such that the de ree of every vertex x S is preserved in T (i.e., if dT (x) = dG (x) for every vertex x S). If T is such a spannin forest, then we call T an S-preservin forest. If, moreover, T is chosen in such a way that S is maximum, then we call T a maximum de ree-preservin forest, and S the de ree-preservin number (of T or G). The DPST problem is the problem to nd for a iven raph G a maximum de ree-preservin spannin forest. As an example, the de ree-preservin number of a tree, a unicyclic raph, and a complete raph (= K2 ) on n vertices are respectively n, n − 2, and 1. Notice that to solve the DPST problem, it is su cient to compute a maximum (cardinality) realizable set S since, iven S, an S-preservin spannin forest is then easy to nd. By p(G) we denote the cardinality of a maximum realizable set in G. Clearly p(G) is the sum of p(C) taken over all 2-ed e-connected components C of G. Therefore we can restrict to 2-ed e-connected raphs. Let W be a set of vertices of a raph G. By G[[W ]] we denote the raph with vertex set N [W ] containin all ed es of G incident with a vertex in W . Lemma 1. Let S be a nonempty set of vertices of a raph G = (V E). Then S is a realizable set of G if and only if G[[S]] is a forest.
3
Hardness Results
A raph G = (V E) is called a split raph (bipartite raph) if V can be partitioned into an independent set I and a clique C (into two independent sets X and Y ) of G. Such a raph is also denoted by G = (I C E) (G = (X Y E)). Let G = (V E) be a raph. We de ne a split raph H with independent set V and clique E 1 2 as follows. A pair v (e i) is an ed e of H if and only if v V , e E, i 1 2 and v e. It is easy to see that a set W V is an independent set of G if and only if W is a realizable set in H. Moreover, if G has no isolated vertices (i.e., vertices with de ree zero), then for every realizable set W of H with W > 1 we have W V . These simple observations lead to the followin theorem showin that the DPST problem restricted to split raphs is NP-complete.
716
Hajo Broersma et al.
Theorem 1. For a iven split raph H and a iven inte er k it is NP-complete to decide whether H contains a realizable set of cardinality k. Proof. The reduction is from the NP-complete raph problem ndependent set. As seen before a raph G has an independent set of cardinality k if and only if the correspondin split raph H has a realizable set of cardinality k. Next we apply the same idea to bipartite raphs. Let G = (V E) be a raph. We de ne a bipartite raph B = (V (E 2 4 6 8 ) E 1 3 5 7 F1 F2 ), where F1 =
v (e i) : v
V e
E i
F2 =
(e 1) (e 2) (e 5) (e 6)
(e 2) (e 3) (e 6) (e 7)
1 5 v
e
(e 3) (e 4) (e 7) (e 8)
(e 4) (e 1) (e 8) (e 5) : e
E
Note that for the maximum de rees (B) and (G) of B and G we et (B) = max 4 2 (G) . Moreover, B is planar if and only if G is planar. We observe that for every ed e e E and every realizable set S of B, S\( e 1 2 3 4 ) 2. In what follows we may assume S V (E 2 3 6 7 ) for all realizable sets S of B, since for every other realizable set T 2 3 6 7 ) is also realizable and ful lls T T0 . the set T 0 = (T \ V ) (E Next observe that W V is an independent set of G if and only if W is a realizable set of B. This leads to the followin theorem showin that the DPST problem restricted to bipartite planar raphs is NP-complete. Theorem 2. For a iven bipartite planar raph B of maximum de ree six and a iven inte er k, it is NP-complete to decide whether B contains a realizable set of cardinality k. Proof. The reduction is from the ndependent set problem restricted to cubic (i.e., 3-re ular) planar raphs [9]. Let (G k) be an instance of this NP-complete problem where G = (V E) with E = m. As seen before a planar raph G has an independent set of cardinality k if and only if the correspondin bipartite planar raph B has a realizable set of cardinality k + 4m. Our problem remains NP-complete even when restricted to bipartite planar raphs of maximum de ree three [7]. The ndependent set problem is not only NP-complete, it is also hard to approximate. More precisely for every > 0, there is no polynomial time approximation al orithm for the max mum ndependent set problem with worst case ratio n1 4− unless P=NP [4], and there is no polynomial time approximation al orithm with worst case ratio n1− unless co-NP=NP [11]. By the reduction used in the proof of Theorem 1, approximatin an optimal solution to the DPST problem is as hard as approximatin max mum ndependent set, even when DPST is restricted to split raphs. Theorem . For every > 0, there is no polynomial time al orithm to approximate a maximum realizable set of a iven split raph with worst case ratio n1 4− unless P=NP (respectively with worst case ratio n1− unless co-NP=NP).
De ree-Preservin Forests
4
717
Approximation for Planar Graphs
In this section we apply an idea of Baker [3] to establish linear time approximation al orithms for the DPST problem when restricted to planar raphs. We will prove the followin theorem. Theorem 4. For every > 0 there is a linear time approximation al orithm of worst case performance ratio 1 − for the DPST problem restricted to planar raphs. Let W V be a set of forbidden vertices. A realizable set R of G is called maximum W -avoidin realizable set if R \ W = and R R0 for every 0 0 realizable set R of G with R \ W = . Let G = (V E) be a planar raph iven with a xed embeddin . We partition Ld . The level L1 contains all vertices on the outer face V into levels L1 L2 −1 of G. For i > 1, the level L contains all vertices on the outer face of G− j=1 Lj . Let d be the lar est index such that Ld = . For technical reason set L = for i > d or i 1. A planar raph is k-outerplanar if and only if it has an embeddin de nin at most k nonempty levels. We decompose the planar raph G into k-outerplanar raphs. Each k-outerplanar raph consists of k consecutive levels of G. More precisely, let k and r be we de ne inte ers with 1 r k. For i = 0 1 q with q = d−r k Gk r = G
k+r j=( −1)k+r+1
Lj
Wk r = L( −1)k+r+1
and
L k+r
Note that Wk r contains all vertices in the outer and inner level of Gk r . Lemma 2. For i = 0 1 q let Rk r be a Wk r -avoidin realizable set of q Gk r . Then =0 Rk r is a realizable set of G. Proof. For all i the set Wk r contains the vertices on the outer and the inner level of the k-outerplanar raph Gk r . Hence the endpoints of an arbitrary ed e of G[[Rk r ]] belon to the same k-outerplanar raph. Lemma . For every k
1 there is an index r(k) with 1 R
q =0
k−2 k
Wk r(k)
r(k)
k such that
p(G) q
Proof. Let R be a maximum realizable set of G and let Wk r = =0 Wk r . For d, of G there exist at most two r 1 2 k every level Lj , j = 1 2 2 R , which implies that there is an with Lj Wk r . Hence kr=1 R \ Wk r 2 r = r(k) such that R \ Wk r(k) k R . Let k 1. For every r = 1 2 k and every i = 1 2 q let Rk r be a maximum Wk r -avoidin realizable set of Gk r . By Lemma 2, Rk r = q =0 Rk r is a realizable set of G. Consequently, max Rk r : 1
r
k
k−2 k p(G)
718
Hajo Broersma et al.
For every k we develop an exact linear time al orithm computin a maximum W -avoidin realizable set for k-outerplanar raphs. Usin standard techniques for raphs of bounded treewidth, it can be shown that a linear time al orithm, exists [2]. Notice that the treewidth of a k-outerplanar raph is at most 3k − 1. Consequently, for every xed k we obtain a linear time approximation al orithm of worst case performance ratio k−2 k .
5
Interval Graphs
De nition 2. A raph is chordal if it contains no induced cycle of len th more than three. Notice that for chordal raphs, the problem of ndin a maximum realizable set is NP-complete, since the class of split raphs is a proper subclass of the class of chordal raphs. However, for the class of interval raphs, which is another important subclass of the class of chordal raphs, we can ive a fast al orithm. For an introduction into these raph class we refer to [10]. Our rst result shows that for chordal raphs we can restrict our search for realizable sets to independent sets. Remember that we may restrict to 2-ed e connected raphs. Theorem 5. If G is a 2-ed e connected chordal raph, then any realizable set S of G is an independent set of G. Proof. Let G = (V E) be a 2-ed e connected chordal raph and assume x y E for two distinct vertices x y S. Since G is 2-ed e connected, x y is contained in a cycle of G, and, since G is chordal this implies x y is contained in some trian le of G. This contradicts Lemma 1. If a raph G is disconnected, then a maximum realizable set of G is simply the union of maximum realizable sets of all components of G. If a connected raph G (or a component) has a brid e e, then to compute a maximum realizable set of G delete e and compute maximum realizable sets S1 and S2 for both components. Let T1 be an S1 -preservin forest and T2 be an S2 -preservin forest. Addin e as an ed e between T1 and T2 ives a forest T which is S1 S2 -preservin , and S1 S2 is a maximum realizable set in G. We will use the above observations and the followin properties of 2-ed e connected interval raphs. De nition . An interval raph is a raph for which one can associate with each vertex an interval on the real line such that two vertices are adjacent if and only if their correspondin intervals have a nonempty intersection. Interval raphs can be reco nized in linear time, and, iven an interval raph, an interval model for it can be found in linear time [10]. In the followin we assume that an interval model of the raph is iven, and we identify the vertices of the raph with the correspondin intervals. Without loss of enerality we may assume that no two intervals have an endpoint in common.
De ree-Preservin Forests
719
De nition 4. An interval and its correspondin vertex are called minimal if it is minimal with respect to inclusion, i.e., if it does not contain any other interval. Lemma 4. Let G be a 2-ed e connected interval raph. Then there exists a maximum realizable set S of G such that for every vertex p S the correspondin interval is minimal. Proof. Let S be a maximum realizable set containin a vertex x which is not minimal. Then there exists an interval y contained in the interval x. By Theorem 5 we know that a realizable set can contain only one of x and y and hence y S. Now N (y) N [x], and hence, there exists a maximum realizable set S x . Repeatin the ar uments we can prove the assertion of the S0 = y theorem. Consider the orderin of the minimal intervals de ned by the left endpoints. Lemma 5. Let G be a 2-ed e connected interval raph with correspondin interval model and let x be the rst minimal interval (i.e., with the leftmost left endpoint). There exists a maximum realizable set S of G with x S. Proof. Consider a maximum realizable set S of G containin only minimal intervals. If x S there is nothin to prove. Otherwise, let y be the rst interval in S. The other intervals of S lie totally to the ri ht of y because S is an independent set by Theorem 5. The ri ht endpoint of y must be to the ri ht of the ri ht endpoint of x since the interval x is minimal. It follows that S 0 = y S x is also realizable, since x lies totally left of S y and N (z) \ N (x) N (z) \ N (y) for all z S y . Theorem 6. There is a linear time al orithm to compute a maximum realizable set S for iven interval raph G. Proof. Locate the set of brid es B in G and compute maximum cardinality realizable sets for each component of G − B. This can be done as follows. Consider an interval model for a 2-ed e connected component. First mark the minimal intervals. Take the minimal interval with the leftmost left endpoint as the rst element of S. Consider the endpoints one by one, from left to ri ht. We keep track of the last minimal interval in S which is totally left of the current position. We also keep a counter for the number of intervals that have one endpoint to the left of the current position and that overlap with the last interval in S. If we encounter a left endpoint of a minimal interval which starts to the ri ht of the last interval in S so far, and if there is at most one interval overlappin the current position and the last interval of S, then we put this new minimal interval in S. Let S 0 be a maximum realizable set such that S = S 0 . By the previous lemmas we may assume that S 0 contains minimal intervals only and that S and S 0 have a common rst interval. Suppose y is the rst interval of S 0 which is not in S, and
720
Hajo Broersma et al.
that x1 x2 xp are common intervals of S and S 0 and xp+1 = y is the next interval of S chosen by the above procedure. We complete the proof by showin that y in S 0 can be replaced by xp+1 . This follows by the same ar uments as in the xp , proof of Lemma 5 and the followin observations. By the choice of x1 x2 for all i j 1 p with i = j, x and xj have at most one common nei hbor p − 1). If the addition of and N (xp+1 ) \ N (x ) N (xp+1 ) \ N (x +1 ) (i = 1 xp would cause a cycle in G[[ x1 x2 xp xp+1 ]], then such xp+1 to x1 xp ]], a contradiction to the choice of a cycle would already exist in G[[ x1 xp . x1 x2
6
Other Classes of Graphs
In this section we list further results proven in the full version. Theorem 7. The de ree preservin spannin tree problem is solvable in linear time for raphs of bounded treewidth. De nition 5. A raph G = (V E) is a cocomparability raph if and only if vn of V such that i j k and v vk E there is an orderin v1 v2 E or vj vk E. Hence N (vj ) \ v vk = for all j implies either v vj with i j k. Such an orderin is called cocomparability orderin . Theorem 8. There is an al orithm to compute a maximum de ree-preservin forest of a cocomparability raph in time O(n4 ). De nition 6. An independent set A is called an asteroidal set if for every vertex a A, the set A a is contained in a component of G − N [a]. The asteroidal number of a raph G, is the maximum cardinality of an asteroidal set in G. Theorem 9. There is an al orithm to solve the de ree preservin spannin tree 3 problem for any raph G in time O(2k nk+3 lo n), where k is the asteroidal number of G.
References 1. Aaron, M. and M. Lewinter, 0-de cient vertices of spannin trees, NY Acad. Sci. Graph Theory Notes XXVII, (1994), pp. 31 32. 2. Arnbor S., J. La er ren and D. Seese, Easy problems for tree-decomposable raphs, Journal of Al orithms 12, (1991), pp. 308 340. 3. Baker, B. S., Approximation al orithms for NP-complete problems on planar raphs, J. ACM 41, (1994), pp. 153 180. 4. Bellare, M., O. Goldreich and M. Sudan, Free bits, PCPs and non-approximability - towards ti ht results, SIAM J. Comput. 27 (1998), pp. 804 915.
De ree-Preservin Forests
721
5. Camerini, P. M., G. Galbiati and F. Ma oli, Complexity of spannin tree problems: Part I, Eur. J. Oper. Res. 5, (1980), pp. 346 352. 6. Camerini, P. M., G. Galbiati and F. Ma oli, The complexity of wei hted multiconstrained spannin tree problems, Colloq. Math. Soc. Janos Bolyai 44, (1984), pp. 53 101. 7. Damaschke, P., De ree-preservin spannin trees and colorin bounded de ree raphs, Manuscript 1997. 8. Dell’Amico, M., M. Labbe and F. Ma oli, Complexity of spannin tree problems with leaf-dependent objectives, Networks 27, (1996), pp. 175 181. 9. Garey, M. R. and D.S. Johnson, Computers and Intractability: A uide to the Theory of NP-completeness, Freeman, New York, 1979. 10. Golumbic, M. C., Al orithmic Graph Theory and Perfect Graphs, Academic Press, New York, 1980. 11. Hastad, J., Clique is hard to approximate within n1− , Proc. 37th Ann. IEEE Symp. on Foundations of Comput. Sci., (1996), IEEE Computer Society, pp. 627 636. 12. Lewinter, M., Interpolation theorem for the number of de ree-preservin vertices of spannin trees, IEEE Trans. Circ. Syst. CAS- 4, (1987), 205. 13. Lewinter, M. and M. Mi dail-Smith, De ree-preservin vertices of spannin trees of the hypercube, NY Acad. Sci. Graph Theory Notes XIII, (1987), 26 27. 14. Pothof, I. W. M. and J. Schut, Graph-theoretic approach to identi ability in a water distribution network, Memorandum 1283, Faculty of Applied Mathematics, University of Twente, Enschede, the Netherlands, (1995). 15. Rahal, A co-tree flows formulation for steady state in water distribution networks, Adv. En . Softw. 22, (1995), pp. 169 178. 16. Walter, E., Identi ability of state space models with applications to transformation systems, Sprin er-Verla , New York NY, USA, 1982.
A Parallelization of Dijkstra’s Shortest Path Al orithm A. Crauser, K. Mehlhorn, U. Meyer, and P. Sanders Max-Planck-Ins i u f¨ ur Informa ik, Im S ad wald, 66123 Saarbr¨ ucken, Germany. crauser,mehlhorn,umeyer,sanders @mpi-sb.mp .de http://www.mpi-sb.mp .de/ crauser, mehlhorn, umeyer, sanders
Abs rac . The single source shor es pa h (SSSP) problem lacks parallel solu ions which are fas and simul aneously work-e cien . We propose simple cri eria which divide Dijks ra’s sequen ial SSSP algori hm in o a number of phases, such ha he opera ions wi hin a phase can be done in parallel. We give a PRAM algori hm based on hese cri eria and analyze i s performance on random digraphs wi h random edge weigh s uniformly dis ribu ed in [0 1]. We use he (n d n) model: he graph consis s of n nodes and each edge is chosen wi h probabili y d n. Our PRAM algori hm needs O(n1 3 log n) ime and O(n log n+dn) work wi h high probabili y (whp). We also give ex ensions o ex ernal memory compu a ion. Simula ions show he applicabili y of our approach even on non-random graphs.
1
Introduction
Computin shortest paths is an important combinatorial optimization problem with numerous applications. Let G = (V E) be a directed raph, E = m, V = n, let s be a distin uished vertex of the raph, and c be a function assi nin a non-ne ative real-valued wei ht to each ed e of G. The sin le source shortest path problem (SSSP) is that of computin , for each vertex v reachable from s, the wei ht dist(v) of a minimum-wei ht path from s to v; the wei ht of a path is the sum of the wei hts of its ed es. The theoretically most e cient sequential al orithm on di raphs with nonne ative ed e wei hts is Dijkstra’s al orithm [8]. Usin Fibonacci heaps its runnin time is O(n lo n + m)1 . Dijkstra’s al orithm maintains a partition of V into settled, queued and unreached nodes and for each node v a tentative distance tent(v); tent(v) is always the wei ht of some path from s to v and hence an upper bound on dist(v). For unreached nodes, tent(v) = . Initially, s is queued, tent(s) = 0, and all other nodes are unreached. In each iteration, the queued node v with smallest tentative distance is selected and declared settled and all ed es (v w) are relaxed, i.e., tent(w) is set to min tent(w) tent(v) + c(v w) . 1
There is also an O(n + m) ime algori hm for undirec ed graphs [20], bu i requires he RAM model ins ead of he comparison model which is used in his work.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 722 731, 1998. c Sprin er-Verla Berlin Heidelber 1998
A Paralleliza ion of Dijks ra’s Shor es Pa h Algori hm
723
If w was unreached, it is now queued. It is well known that tent(v) = dist(v), when v is selected from the queue. The queue may contain more than one node v with tent(v) = dist(v). All such nodes could be removed simultaneously, the problem is to identify them. In Sect. 2 we ive simple su cient criteria for a queued node v to satisfy tent(v) = dist(v). We remove all nodes satisfyin the criteria simultaneously. Althou h there exist worst-case inputs needin (n) phases, our approach yields considerable parallelism on random directed raphs: We use the random raph model G(n d n), i.e., there are n nodes and each theoretically possible ed e is included into the raph with probability d n. Furthermore, we assume random ed e wei hts uniformly distributed in [0 1]: In Sect. 3 we show that the number of phases is O( n) usin a simple criterion, and O(n1 3 ) for a more re ned criterion with hi h probability (whp)2 . Sect. 4 presents an adaption of the phase driven approach to the CRCW PRAM model which allows p processors (PUs) concurrent read/write access to a shared memory in unit cost (e. . [13]). We propose an al orithm for random raphs with random ed e wei hts that runs in O(n1 3 lo n) time whp. The work, i.e., the product of its runnin time and the number of processors, is bounded by O(n lo n + dn) whp. In Sect. 5 we adapt the basic idea to external memory computation (I/O model [22]) where one assumes lar e data structures to reside on D disks. In each I/O operation, D blocks from distinct disks, each of size B, can be accessed dn n dn + DB lo S B DB ) I/Os on in parallel. We derive an al orithm which needs O( D S 2 3 lo n B ) independent random raphs whp and can use up to D = O(min n disks. S denotes the size of the internal memory. In Sect. 6 we report on simulations concernin the number of phases needed for both random raphs and real world data. Finally, Sect. 7 summarizes the results and sketches some open problems and future improvements. Previous Work PRAM al orithms: There is no parallel O(n lo n+m) work PRAM al orithm with sublinear runnin time for eneral di raphs with non-ne ative ed e wei hts. The best O(n lo n+m) work solution [9] has runnin time O(n lo n). All known al orithms with polylo arithmic execution time are work-ine cient. (O(lo 2 n) time and O(n3 (lo lo n lo n)1 3 ) work for the al orithm in [11].) An O(n) time al orithm requirin O((n + m) lo n) work was presented in [3]. For special classes of raphs, like planar di raphs [21] or raphs with separator decomposition [6], more e cient al orithms are known. Randomization was used in order to nd approximate solutions [5]. Random raphs with unit wei ht ed es are considered in [4]. The solution is restricted to dense raphs (d = (n)) or ed e probability d = (lo k n n) (k > 1). In the latter case O(n lo k+1 n) work is needed. Properties of shortest paths in complete raphs (d = n) with 2
Throughou his paper whp s ands for wi h high probabili y in he sense ha he probabili y for some even is a leas 1 − n− for a cons an > 0.
724
A. Crauser e al.
random ed e wei hts are investi ated in [10, 12]. In contrast to all previous work on random raphs, we are most interested in the case of small, even constant d. External Memory: The best result on SSSP was published in [16]. This al om lo 2 m rithm requires O(n + DB B ) I/Os. The solution is only suitable for small n because it needs (n) I/Os.
2
Runnin Dijkstra’s Al orithm in Phases
We ive several criteria for dividin the execution of Dijkstra’s al orithm into phases. In the rst variant (OUT-version) we compute a threshold de ned via the wei hts of the out oin ed es: let L = min tent(u) + c(u z) : u is queued and (u z) E and remove all nodes v from the queue which satisfy tent(v) L. Note that when v is removed from the queue then dist(v) = tent(v). The threshold for the OUT-criterion can either be computed via a second priority queue for o(v) = tent(v) + min c(v u) : (v u) E or even on the fly while removin nodes. The second variant, the IN-version, is de ned via the incomin ed es: let M = min tent(u) : u is queued and i(v) = tent(v) − min c(u v) : (u v) E for any queued vertex v. Then v can be safely removed from the queue if i(v) M . Removable nodes of the IN-type can be found e ciently by usin an additional priority queue for i( ). Finally, the INOUT-version applies both criteria in conjunction.
3
The Number of Phases for Random Graphs
In this section we rst investi ate the number of delete-phases for the OUTvariant of Dijkstra’s al orithm on random raphs. Then we sketch how to extend the analysis to the INOUT-approach. We start with mappin the OUT-approach to the analysis of the reachability problem as provided in [14] and [1, Sect. 10.5] and ive lower bounds on the probability that many nodes can be removed from the queue durin a phase. Theorem 1. OUT-approach. Given a random raph from G(n d n) with ed e labels uniformly distributed in [0 1], the SSSP problem can be solved usin r = O( n) delete-phases with hi h probability. We review some facts of the reachability problem usin the notation of [1]. The followin procedure determines all nodes reachable from a iven node s in a random raph G from G(n d n). Nodes will be neutral, active, or dead. Initially, s is active and all other nodes are neutral, let time t = 0, and Y0 = 1 the number of active nodes. In every time unit we select an arbitrary active node v and check all theoretically possible ed es (v w), w neutral, for membership in G. If (v w) E, w is made active, otherwise it stays neutral. After havin treated all neutral w in that way, we declare v dead, and let Yt equal the new number of active nodes. The process terminates when there are no active nodes.
A Paralleliza ion of Dijks ra’s Shor es Pa h Algori hm
725
The connection with the OUT-variant of Dijkstra’s al orithm is easy: The distance labels determine the order in which queued vertices are considered and declared dead, and time is partitioned into intervals (=phases): If a phase of the OUT-variant removes k nodes this means that the time t increases by k. Let Zt be the number of nodes w that are reached for the rst time at time t. B [n − (t − 1) − Yt−1 d n] where Then Y0 = 1, Yt = Yt−1 + Zt − 1 and Zt B [n q] denotes the binomial distribution for n trials and success probability q. Let T be the least t for which Yt = 0. Then T is the number of nodes that are reachable from s. The recursive de nition of Yt is continued for all t, 0 t n. We have Yt B [n − 1 1 − (1 − d n)t ] + 1 − t. It is shown in [1] that the number of nodes reachable from s is either very small (less than O(lo n)) or concentrates around T0 = 0 n, where 0 < 0 < 1, and 0 = 1 − e−d 0 . Only the case T T0 requires analysis; if T = O(lo n) the number of phases is certainly small. Cherno bounds yield: n) and lar e t (t Lemma 1. Except for small t (t (1 o(1 n2 ))E [Yt ] with hi h probability.
T 0 − n1
2+
) Yt is
The yield of a phase in the OUT-variant is the number of nodes that are removed in a phase. We call a phase startin at time t pro table if its yield is Ω( Yt d) and hi hly pro table if its yield is Ω( (Yt 2 − t 2)t n) and show: Lemma 2. A phase is pro table with probability at least 1 8. A phase startin d t at time t with n ln 0 n − n d is hi hly pro table with probability at least d 1 8. Theorem 1 follows fairly easily from lemmas 1 and 2: We call a phase with n, early intermediate if n < t (n ln d) d, startin time t early extreme if t early central if (n ln d) d < t n 2, late central if n 2 < t 0 n − n d, 1 2+ n − n , and late extreme if 0 n − late intermediate if 0 n − n d < t 0 n1 2+ < t, and show that there are only O( n) phases of each kind with hi h probability. Consider, for example, the late intermediate phases. A pro table late intermediate phase startin at time t has yield Ω( Yt d) = Ω( E [Yt ] d) = Ω( ( 0 n − t) d), where the rst equality holds with hi h probability by t0 < 2 +1 Lemma 1. Let t0 := 0 n − t. The number of pro table phases with 2 is therefore O( 2 d) and the number of pro table phases with 0 n − n d t = 0 0 n − t is therefore lo (n d) O( 2 d) = O( n). Since a phase is pro table with probability at least 1 8, the number of phases is also O( n) with hi h probability. The number of early extreme phases is O( n) trivially. For the number of late extreme phases we ar ue as follows. We rst show that T 1 2+ with hi h probability and then consider the rst time t1 , t1 0n + n 1 2+ n− n , with Yt1 n1 4 . Lemma 1 implies that the number of late extreme 0 phases startin before t1 is O( n). If the number of phases startin after t1 is n + Zt1 +pn n − n1 4 n 2. The probability or more, then Zt1 + Zt1 +1 + 1 2 1 2+ )) d n] n 2 , which of this event is bounded by P B[n (n − (n − n is exponentially small.
726
A. Crauser e al.
The idea for the proof of Lemma 2 is as follows. Let v1 v2 vq , q = Yt , be the queued nodes in order of increasin tentative distances, and let L0 be the value of L in the previous phase. The distance labels tent(v ) are random variables in [L0 L0 + 1]. We show that their values are independent and their distributions are biased towards smaller values (since tent(v ) = min dist(v) + L0 , c(v v ) uniform in [0 1]. The c(v v ) v settled and (v v ) E , dist(v) value of tent(vr ) is therefore less than r q with constant probability for arbitrary vr is r(d n)n = rd on the r, 1 r q. The number of ed es out of v1 avera e and not much more with constant probability. The shortest of these 1 . We remove v1 vr from the queue if tent(vr ) is ed es has len th about rd vr . This is the case smaller than the len th of the shortest ed e out of v1 1 or r q d. (with constant probability) if r q rd For the phases startin at time t with (n ln d) d t 0 n − n d we rene the ar ument as follows. We call a node queued at time t old if it was already queued before time t 2 and show that the number of old queued nodes at time t is at least Yt 2 − t 2. Each old queued node has an expected inde ree from settled nodes of at least 2t nd . We use this fact to deduce that tent(vr ) is td (Yt 2 −t 2)) with constant probability and then proceed as above. less than r ( 2n INOUT Approach. If both IN- and OUT-criterion are applied to ether, the tentative distance labels of queued nodes may spread over a ran e as lar e as [L0 L0 + 2), while the ed e wei hts are only in [0 1]. In order to reuse the analysis of the OUT-part we analyze a sli htly slower version which alternates the two criteria in the followin way: I-Step: Let q be the current queue size. Apply the IN-criterion to the (q) nodes with smallest tentative distances where is a function we are free to choose3 . Let L be the lar est distance of any removed node. Switch to O-Step. O-Step: Repeatedly apply the OUT-criterion until no tentative distance is smaller than L. Then switch back to I-Step. The function () is chosen in such a way that there is both a constant probability for a lar e yield in an I-Step and the expected number of subsequent O-Steps is constant. The function () is chosen dependent of the current phase type. For example, durin late intermediate phases we take (q) = cq 2 3 d1 3 for some constant c. A super-phase consistin of an I-Step and series of O-Steps is now pro table if at most a constant number of O-Steps is needed and if its total 2 3 d1 3 ), hi hly pro table if its yield is Ω((Yt 2 − t 2)2 3 (n t)1 3 ). yield is Ω(Yt Then one has to show a ain that a super-phase is (hi hly) pro table with constant probability. Theorem 2. INOUT-approach. Given a random raph from G(n d n) with ed e labels uniformly distributed in [0 1], the SSSP problem can be solved usin r = O(n1 3 ) delete-phases with hi h probability. 3
No e ha he implemen a ion does no need o know his func ion since i uses he fas er combined cri erion.
A Paralleliza ion of Dijks ra’s Shor es Pa h Algori hm
4
727
Parallelization
We now show how the sequential OUT-variant of Sect. 2 can be e ciently implemented on an arbitrary-write CRCW PRAM for random raphs from G(n d n) and random ed e wei hts. The actual number of ed es is m = (dn) whp. The al orithm keeps a lobal array tent( ) for all tentative distance values. Each processor P , 0 i < p is responsible for two sequential priority queues: Q and Q . Each pair (Q Q ) only deals with a subset of nodes, the distribution is made randomly and stored in a lobal array ind(). Furthermore, each PU maintains a bu er array for incomin requests. The queues Q handle tentative node distances for the nodes they are responsible for, the key of a node v Q is iven by tent(v) + o (v) where E ; o (v) is precomputed once and for all upon o (v) := min c(v w) : (v w) initialization. The Q queues are used to e ciently derive the criterion of the OUT-version indicatin whether a node can be deleted in a phase. The queues are implemented as relaxed heaps [9] because they provide worst-case runnin times: f ndM n, nsert and decreaseKey are performed in O(1) time and delete/deleteM n in O(lo q) time where q denotes the local queue size. Let r be the number of delete-phases which are needed, e. . for the OUTvariant r = O( n) whp. For the analysis we x the number of processors as p = max r lon n r lodn2 n ; so from now on a time bound T implies a work bound pT . The al orithm works similar to Dijkstra’s al orithm: The queues start with only s in Qind(s) and Qind(s) and all other local queues empty. This and the initialization of other arrays and bu ers (ind(), out oin ed es, . . . ) can be done in time O((n + m) p) = O(r lo 2 n) whp, even if the input uses an adjacency-list representation. While any queue is nonempty the al orithm performs a phase consistin of ve steps. These steps are now further explicated to ether with the most interestin part of their analysis, namely for the case that at most n r nodes are deleted in this phase. Step 1 nds the lobal minimum L of all elements in all Q and can clearly be performed in O(lo p) O(lo n) time. In Step 2 each PU i removes the nodes with tent(v) L from Q and Q . Let R denote the union of all these sets of deleted nodes. Our index distribution ensures that no PU has to deal with more than O(lo p + R p) deleteM ns whp. A sin le deleteM n or delete operation takes O(lo n) time, thus due to R n r and p = max r lon n r lodn2 n Step 2 can be performed in O(lo 2 n) time whp. In Step 3 all PUs cooperate to enerate a set Req := (w tent(v)+c((v w))) : v R and (v w) E of requests. By compactin R and usin pre x sums to schedule the PUs this task can be perfectly load balanced. Since Req = O d R + lo n whp for R + lo n) = O(lo
2
n) whp.
n r, this step can be performed in time O(m (rp)
728
A. Crauser e al.
Step 4 permutes the requests such that (w x) is put into a bu er array Bind(w) . Alto ether there are at most O(d R ) requests whp that are spread over p bu ers, thus, because of the random node distribution, each bu er ets n r, p = O(lo n + d R p) = O(lo 2 n) requests whp (Cherno bounds, R max r lon n r lodn2 n ). The requests are placed by randomized dart throwin
[18]. If each processor is responsible for the placement of a roup of O(lo 2 n) requests (which may o to di erent bu ers) Step 4 takes O(lo 2 n) time whp. The dart throwin pro ress is re ularly monitored. In the unlikely case of sta nation (bu ers are chosen too small), the bu er sizes are adapted. Finally, in Step 5 PU i scans bu er i and for each request (w x) with x < tent(w) it updates tent(w) to x and calls decreaseKey(Q w x), decreaseKey (Q w x + o (w)) (respectively nsert for new nodes). Each operation can be executed in O(1) time, so for R n r Step 5 needs time O(lo 2 n) whp. Phases with R > n r show whp at least as balanced queue access patterns as those phases deletin less elements, thus time and work of a phase increase at most linearly. Let k denote the number of nodes removed in phase i. Then n. The total time over all phases is T = O( r k r n lo 2 n) = r k 2 O(r lo n + (nr n) lo 2 n) = O(r lo 2 n) whp. For d > r lo 2 n more than n PUs can be used by droppin explicit queues: n lobal bits denote whether an element is queued or not and p n PUs take care of each bu er area in order to cope with the increased number of requests. Alternatively, one can apply an initial lterin step because all but the c lo n smallest ed es per node, c some constant, can be i nored whp without chan in the shortest paths [10, 12]. The INOUT-version is supported by p additional priority queues. Initialization of (v) := min c(w v) : (w v) E involves collectin the wei hts of ed es that are potentially distributed over Ω(d) adjacency-lists. For random raphs, the number of incomin ed es of k = Ω(lo n) randomly selected nodes is O(dk) whp. Thus, we can use the randomized dart throwin to perform the initialization usin O(dn) work whp. Theorem 3. If the number of delete-phases is bounded by r then the SSSP can be solved in O(r lo 2 n) time and O(n lo n + m) work whp. usin max r lon n , m processors on a CRCW PRAM. r lo 2 n The runnin time can be improved by a factor of O(lo n) if we choose an alternative implementation for the queues based on the parallel priority queue data structure from [19] which supports nsert and deleteM n for O(p) elements in time O(lo n) usin p PUs whp. In [7] we show how to au ment this data structure so that decreaseKey and delete are also supported. A queue is represented by three relaxed heaps: A main heap Q1 , a bu er Q0 for newly inserted elements plus the O(lo n) smallest ones and Qd for elements whose key drops below a bound L0 due to a decreaseKey. Deleted elements in Q1 are only marked as deleted. More enerally, delete and deleteM n are most of the time only performed on Q0 and Qd and only every O(lo n) phases
A Paralleliza ion of Dijks ra’s Shor es Pa h Algori hm
729
a function cleanUp is called which uarantees that Q0 and Qd do not row too lar e. For an analysis we refer to [19, 7]. Corollary 1. SSSP on random raphs with random ed e wei hts uniformly distributed in [0 1] can be solved on a CRCW PRAM in O(n1 3 lo n) time and O(n lo n + m) work whp. The approach is relatively easy to adapt to distributed memory machines. The ind-array can be replaced by a hash-function and randomized dart throwin by routin . For random raphs, the PU schedulin for eneratin requests is unnecessary, if the number of PUs is decreased by a lo arithmic factor. The al orithm can also be adapted to a O(n1 3+ ) time and O(n lo n + m) work EREW PRAM for an arbitrary small constant > 0. Concurrent write accesses only occur durin the randomized dart throwin . It can be replaced by 1 reorderin phases (essentially radix sortin ), such that phase i roups all request for a subset of p1− queue pairs. Processors are rescheduled after each phase. After the last phase all requests to a certain queue pair are rouped to ether and can be handled sequentially.
5
Adaption to External Memory
The best previous external memory SSSP al orithm is due to [16]. It requires at least n I/Os and hence is unsuitable for lar e n. For our improved al orithm we use D to denote the number of disks and B to denote the block size. Let r be the number of delete-phases and assume for simplicity that each phase removes n r elements from the queue. Furthermore, we assume that D lo D n r and that the internal memory, S, is lar e enou h to hold one bit per node. It is indicated in [7] how to proceed if this reasonable assumption does not hold. We partition the adjacency-lists into blocks of size B and distribute the blocks randomly over the disks. All requests to adjacency-lists of a sin le phase are rst collected in D bu ers, in lar e phases they are possibly written to disk temporarily. At the end of a phase the requests are performed in parallel. If D lo D n r, the n r adjacency-lists to be considered in a phase will distribute almost evenly over the disks whp, and hence the time spent in readin adjacency-lists is O(n D + m (DB)) whp. We use a priority queue without decreaseKey operation (e. . bu er trees [2]) and insert a node as often as it has incomin ed es (each ed e may ive a di erent tentative distance). When a node is removed for the rst time its bit is set. Later values for that node are i nored. n m + DB lo S B m The total I/O complexity for this approach is iven by O( D B) n S I/Os whp. The number of disks is restricted by D = O(min r lo n B ). We note that it is useful to sli htly modify the representation of the raph (provide each ed e (v w) with o (w), the minimum wei ht of any ed e out of w). This allows us to compute the L-value while deletin elements from the queue without the auxiliary queue Q . This online computin is possible because the nodes are deleted with increasin distances and the L-value initialized with
730
A. Crauser e al.
f ndM n() + 1 can only decrease. The preprocessin to adapt the raph takes m O( n+m DB lo S B B ) I/Os. Theorem 4. SSSP with r delete-phases can be solved in external memory usin n m n S + DB lo S B m O( D B ) I/Os whp if the number of disks is D = O(min r lo n B ) and S is lar e enou h to hold one bit per node.
6
Simulations
Simulations of the al orithm have reatly helped to identify the theoretical bounds to be proven. Furthermore, they ive information about the involved constant factors. For the OUT-variant on random raphs with random ed e wei hts we found an avera e value of 2 5 n phases. The re ned INOUT-variant needs about 6 0 n1 3 phases on the avera e. A modi cation of the INOUT-approach which switches between the criteria as described in Sect. 2 takes about 8 5 n1 3 phases. We also ran tests on planar raphs taken from [15, GB PLANE] where the nodes have coordinates uniformly distributed in a two-dimensional square and ed e wei hts denote the Euclidean distance between respective nodes. The OUTversion nished in about 1 2 n2 3 phases; takin random ed e wei hts instead, about 1 7 n2 3 phases su ced on the avera e. The performance of the INOUTversion is less stable on these raphs; it seems to ive only a constant factor improvement over the simpler OUT-variant. Motivated from the promisin results on planar raphs we tested our approach on real-world data: startin with a road-map of a town (n = 10 000) the tested raphs successively rew up to a lar e road-map of Southern Germany (n = 157 457). While repeatedly doublin the number of nodes, the avera e number of phases (for di erent startin points) only increased by a factor of about 1 63 20 7 ; for n = 157 457 the simulation needed 6 647 phases.
7
Conclusions
We have shown how to subdivide Dijkstra’s al orithm into delete phases and ave a simple CRCW PRAM al orithm for SSSP on random raphs with random ed e wei hts which has sublinear runnin time and performs O(n lo n+m) work whp. Althou h the bounds only hold with hi h probability for random raphs, the approach shows ood behavior on practically important real-world raph instances. Future work can tackle the desi n and performance of more re ned criteria for safe node deletions, in particular concernin non-random inputs. Another promisin approach is to relax the requirement of tent(v) = dist(v) for deleted nodes. In [7, 17] we also analyze an al orithm which allows these two values to di er by an amount of . While this approach yields more parallelism for random raphs, the safe criteria do not need tunin parameters and can better adapt to inhomo eneous distributions of ed e wei hts over the raph.
A Paralleliza ion of Dijks ra’s Shor es Pa h Algori hm
731
Acknowled ements We would like to thank Volker Priebe for fruitful discussions and su
estions.
References [1] N. Alon, J. H. Spencer, and P. Erdos. The Probabilistic Method. Wiley, 1992. [2] L. Arge. E cient external-memory data structures and applications. PhD hesis, Universi y of Aarhus, BRICS-DS-96-3, 1996. [3] G. S. Brodal, J. L. Tr¨ a , and C. D. Zaroliagis. A parallel priori y queue wi h cons an ime opera ion. In 11th IPPS, pages 689 693. IEEE, 1997. [4] A. Clemen i, L. Kucera, and J. D. P. Rolim. A randomized parallel search s ra egy. In A. Ferreira and J. D. P. Rolim, edi ors, Parallel Al orithms for Irre ular Problems: State of the Art, pages 213 227. Kluwer, 1994. [5] E. Cohen. Polylog- ime and near-linear work approxima ion scheme for undirec ed shor es pa hs. In 26th STOC, pages 16 26. ACM, 1994. [6] E. Cohen. E cien parallel shor es -pa hs in digraphs wi h a separa or decomposi ion. Journal of Al orithms, 21(2):331 357, 1996. [7] A. Crauser, K. Mehlhorn, U. Meyer, and P. Sanders. Parallelizing Dijks ra’s shor es pa h algori hm. Technical repor , MPI-Informa ik, 1998. in prepara ion. [8] E. Dijks ra. A no e on wo problems in connexion wi h graphs. Num. Math., 1:269 271, 1959. [9] J. R. Driscoll, H. N. Gabow, R. Shrairman, and R. E. Tarjan. Relaxed heaps: An al erna ive o Fibonacci heaps wi h applica ions o parallel compu a ion. Communications of the ACM, 31(11):1343 1354, 1988. [10] A. Frieze and G. Grimme . The shor es -pa h problem for graphs wi h random arc-leng hs. Discrete Appl. Math., 10:57 77, 1985. [11] Y. Han, V. Pan, and J. Reif. E cien parallel algori hms for compu ing all pairs shor es pa hs in direc ed graphs. In 4th SPAA, pages 353 362. ACM, 1992. [12] R. Hassin and E. Zemel. On shor es pa hs in graphs wi h random weigh s. Math. Oper. Res., 10(4):557 564, 1985. [13] J. Jaja. An Introduction to Parallel Al orithms. Addison-Wesley, 1992. [14] R. M. Karp. The ransi ive closure of a random digraph. Rand. Struct. Al ., 1, 1990. [15] D. E. Knu h. The Stanford GraphBase : a platform for combinatorial computin . Addison-Wesley, New York, NY, 1993. [16] V. Kumar and E. J. Schwabe. Improved algori hms and da a s ruc ures for solving graph problems in ex ernal memory. In 8th SPDP, pages 169 177. IEEE, 1996. [17] U. Meyer and P. Sanders. -s epping: A parallel shor es pa h algori hm. In 6th ESA, LNCS. Springer, 1998. [18] G. L. Miller and J. H. Reif. Parallel ree con rac ion and i s applica ion. In 26th Symposium on Foundations of Computer Science, pages 478 489. IEEE, 1985. [19] P. Sanders. Randomized priori y queues for fas parallel access. Journal Parallel and Distributed Computin , 49:86 97, 1998. [20] M. Thorup. Undirec ed single source shor es pa hs in linear ime. In 38th Annual Symposium on Foundations of Computer Science, pages 12 21. IEEE, 1997. [21] J. L. Tr¨ a and C. D. Zaroliagis. A simple parallel algori hm for he single-source shor es pa h problem on planar digraphs. In Irre ular’ 96, volume 1117 of LNCS, pages 183 194. Springer, 1996. [22] J. S. Vi er and E. A. M. Shriver. Algori hms for parallel memory I: Two-level memories. Technical Repor CS-90-21, Brown Universi y, 1990.
Comparison Between the Complexity of a Function and the Complexity of Its Graph Bruno Durand1 and Sylvain Porrot2 1 2
LIP, ENS-Lyon CNRS, 46 Allee d’Italie, 69634 Lyon CEDEX 07, France;
[email protected] LAIL and LIFL, Bat. P2, Universite des Sciences et Technolo ies de Lille, 59655 Villeneuve d’Ascq CEDEX, France;
[email protected] Abstract. This paper investi ates in terms of Kolmo orov complexity the di erences between the information necessary to compute a recursive function and the information contained in its raph. Our rst result is that the complexity of the initial parts of the raph of a recursive function, althou h bounded, has almost never a limit. The second result is that the complexity of these initial parts approximate the complexity of the function itself in most cases (and in the avera e) but not always.
Introduction The oal of this paper is to compare the information contained in the raph of a function to the information needed to compute the function. Our approach is based on Kolmo orov complexity (also known as Al orithmic Information Theory). In this framework we compare the Kolmo orov complexity of a recursive function f , i.e. the size of a smallest pro ram that computes f , with the conditional Kolmo orov complexities of initial parts of the raph of f . As far as we know, the only result in this eld is a theorem of Meyer (see Theorem 2 in this paper), reported in the well-known article of Loveland [4]. A proof of this theorem is also iven in the fundamental article of Zvonkin and Levin [7]. However, the point of view of these papers is di erent from ours: they are mainly interested in non-recursive sequences and in randomness. They also investi ate varieties of Kolmo orov complexity (see on this topic the paper of Uspensky and Shen [6]). We focus on recursive sequences (or functions). Our study is also motivated by the analysis of data flows (see also [5]). Ima ine a flow that, step by step, produces inte er numbers. The information contained in the flow up to time t can be understood as the conditional Kolmo orov complexity of the outputs obtained before time t, knowin t. Our oal is to analyze the variations of this information when t varies. Our results are rather surprisin : the rst one is that this information is bounded when the function is recursive, but has no limit, except for a nite number of functions (Theorem 1). Our second result is that the complexities of the initial parts of a raph do not always constitute an approximation of Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 732 739, 1998. c Sprin er-Verla Berlin Heidelber 1998
The Complexity of a Function Versus the Complexity of Its Graph
733
the complexity of the function (Theorem 3). In the case of data flows it means that, if we consider any recursive family of systems producin data flows, the amount of information issued by some of the systems is much lower than the information contained in the systems themselves. But we prove in Theorem 4 and in Corollary 1 that this stran e behaviour appears rather rarely in the family, and that, in the avera e, this approximation is justi ed. A more theoretical eld of investi ation is to compare the maximum of the complexity of the raph, its lim sup, the Kolmo orov complexity of the function and some other varieties of de nitions of its Kolmo orov complexity relativised to oracles (e. . the standard oracle set K , also called 00 in recursion theory), see [2].
1 1.1
Preliminaries Kolmo orov Complexity
Theory of Kolmo orov complexity [3], also called Al orithmic Information Theory [1], ives ri orous mathematical foundations to the notion of information content of an object x (represented by a word over the binary alphabet 0 1 ). This quantity K(x) is the len th of a smallest pro ram that halts and outputs x on an empty input. The pro rammin lan ua e must satisfy an important technical property called additive optimality which is true in all natural prorammin lan ua es: K1 K2 C x K1 (x) − K2 (x) < C where K1 (x) and K2 (x) are Kolmo orov complexities de ned for two di erent additively optimal pro rammin lan ua es. In order to talk about the complexity of inte ers, we use the followin one-toone mappin between words and inte ers: we associate each word with its index in the orderin , rst by len th, then lexico raphically. 1.2
De nitions of Models
We study recursive functions and their raphs f = x y y = f (x) . We denote by fn the initial part of the raph f i.e. fn = x y x n y = f (x) . As it is de ned here, fn is a set. So there is a choice of di erent representations f (n) n where n for this set. We choose to identify fn with f (0) f (1) denotes the standard encodin of N n in N . Any other recursively equivalent de nition could have been chosen. Note that the special case where the ima es of the functions are restricted to the pair 0 1 is equivalent to the study of recursive in nite sequences. All results in the sequel remain valid if recursive functions from N to N are replaced by recursive sequences over the alphabet 0 1 . De nition 1. A pro ram P is a weak model of a function f over a domain D if D is an in nite subset of N and n D P (n) halts and outputs fn .
734
Bruno Durand and Sylvain Porrot
Note that if n D, either P (n) does not halt, or P (n) halts and its output can be di erent from fn . De nition 2. The weak complexity of a function f is de ned by Kw (f ) = lim sup K( n!1
n f
n)
Note that any limit point of K( fn n) (reached over an in nite subset D of N ) corresponds to the size of a smallest weak model of f over D. De nition 3. A stron model of a function f is a pro ram P acceptin one input n and that, for all n, halts and outputs fn , i.e. n N P (n) = fn . We could present a di erent de nition of a stron model e. . n N P (n) = N P (n) = fn . It ives, up to an additive constant, the f (n) instead of n same notion of stron complexity (see below). De nition 4. The stron complexity Ks (f ) of a function f is the len th of a smallest stron model of f if it exists, the in nity otherwise. Remark that f is recursive if and only if Ks (f ) is nite.
2
A Study of Weak Models
A stron model of a function is also a weak model of this function. Thus we et the followin strai htforward proposition. Proposition 1. If f is a recursive function, then there exists a stron model of f and we have Kw (f ) Ks (f ). If other (equivalent) de nitions of Kw and Ks are iven, then an additive constant is added to the previous proposition: Kw (f ) Ks (f ) + C. We now present some results concernin the series K( fn n) in order to justify the choice of the upper limit in the de nition of the weak complexity. Indeed, 1. the limit of K( fn n) exists at most for a nite number of recursive functions f (Theorem 1); 2. the lower limit of K( fn n) is bounded by a constant not dependin on f (Lemma 1), due to the fact that the whole information describin f can be in nitely often found encoded in the parameter n; 3. the upper limit of K( fn n) is the size of a smallest weak model for which the input n provides no information on f ; thus a countin ar ument proves that it cannot be uniformly bounded (Lemma 2). Lemma 1. There exists a universal weak model for recursive functions: there exists a pro ram Pu (n) such that for all recursive function f , Pu is a weak model of f .
The Complexity of a Function Versus the Complexity of Its Graph
735
Proof. Let Pu (n) be the followin pro ram: if there exist k and x such that n = 1k 0x, Pu simulates pro ram x on n, otherwise Pu loops inde nitely. Let f be a recursive function of stron model P . Pu is a weak model of f since for all n in 1k 0P k N , Pu (n) computes fn . Lemma 2. Given A > 0, the set of functions havin a weak complexity bounded by A is nite. This lemma is obtained by a standard countin ar ument (we skip the proof). Lemmas 1 and 2 clearly imply the followin theorem: Theorem 1. The set of recursive functions such that lim K( n!1 nite.
n f
n) exists is
In this theorem the nite number of functions such that a limit exists depends on the pro rammin system. Let us rst present a system in which this number is zero. Consider a standard enumeration of partial recursive functions i and let us de ne the followin pro rammin system: 0 = fu , fu bein the partial recursive function computed by Pu , 1 1998 are functions of which indexes are pro rams that always diver e, i = i for all i > 1998. In this system lim inf K( fn n) = 0 and clearly lim sup K( fn n) len th(1998). Now let us present a pro rammin system in which the limit exists for some γ1998 are distinct total recursive functions, γ1999 = fu and functions : γ0 γi = i for all i > 1999.
3 3.1
Comparison Between Stron and Weak Models Existence of a Stron Model
A well known theorem (here Theorem 2) due to Meyer and reported in [4, 7] states that if K( fn n) is bounded over an in nite recursively enumerable domain D, then f is recursive. A weaker version of this theorem states that if the weak complexity of f is nite then f is recursive. In other terms the hypothesis is that there is a nite number of weak models computin fn for all n. This result is not obvious (and is rather stron ) since we do not know a priori which one of all weak models computes fn for a iven n in D. Theorem 2 (Meyer). A function f is recursive if and only if there exists an in nite recursively enumerable set D N where K( fn n) is bounded. 3.2
Comparin Weak and Stron Complexities
We have just seen that a nite weak complexity implies the existence of a stron model. Does weak complexity approximate stron complexity? The proof of Theorem 2 does not provide any answer to this question, because it is not constructive. Indeed, no proof of this theorem can be constructive as shown below in Theorem 3. As Kolmo orov complexity is de ned up an additive constant we need a family of functions to express this fact.
736
Bruno Durand and Sylvain Porrot
Theorem 3. Let F = fi i2N be any recursive family of distinct recursive functions. Then C fi F Ks (fi ) − Kw (fi ) > C. More precisely, a recursive family of recursive functions is a family such that P i x P(i x) halts and outputs fi (x). In the sequel, we prove a stron er result: Ks is in nitely often of order k when Kw is of order lo (k). Example: The family F de ned by n i fi (n) = 1 and n > i fi (n) = 0 satis es the hypothesis of Theorem 3, and therefore we cannot bound by a constant the di erence between the weak and the stron complexities of functions of this family. In eneral, accordin to Lemma 1 and Theorem 3, the behaviour of the series K( fn n) as a function of n is illustrated by Fi ure 1. K(
n f
n)
K (f ) Kw (f ) Pu lim inf K(
n f
n) n Fi . 1. Graph of K(
n f
n)
In order to prove Theorem 3 we need some preliminary results. In the followin , the standard notation Step(P x t) denotes the pro ram that simulates t steps of pro ram P with x as input, ives as result P (x) + 1 if conver ence is observed, else ives as result 0. In the proofs, the notation Ok (1) (resp. Ok n (1)) denotes a function of k (resp. of k and n) that is bounded by a constant. De nition 5. Let P be a pro ram and f a function. We de ne the extension properties P f and for all n P n f by (P
n
(P f ) f) ( x
(if P (x) conver es, then P (x) = f (x)) n Step(P x n) = 0 Step(P x n) = f (x) + 1)
De nition 6. ( oodness) We say that i is ood for k, i P P < k (P
fi and i0
2 k i0 = i P
2k , if: fi0 );
The Complexity of a Function Versus the Complexity of Its Graph
We say that i is n- ood for k, i P P < k (P
n
737
2k , if: fi and i0
2 k i0 = i P
n
fi0 )
We say that i is bad for k (resp. n-bad ) if it is not ood (resp. n-bad) i.e. respectively P P < k (P P P < k (P
n
( i0 ( i0
fi ) fi )
Lemma 3. For all n k there exists i Proof. There is 1 more function fi
2 k i0 = i P 2 k i0 = i P
fi0 ) n fi0 )
2k such that i is n-bad for k.
i2k
than pro rams of len th
The relation n is an approximation of but beware that the conver ence speed of
n
k.
as proved in the followin lemma, to is not computable.
Lemma 4. Given k, for all lar e enou h n, i(n k) is stationary and equal to i(k). We skip the proof. The idea is that only n- oodness of the nitely many (i k).
nitely many n can chan e the
Proof (of Theorem 3, see acknowled ements). It is su cient to prove the followin inequalities: 1. 2.
k Ks (fi(k) ) k, k lim supn!1 K(
n fi(k)
n)
lo (k) + Ok (1).
Step 1: Suppose there exists k such that Ks (fi(k) ) < k. Then there exists a pro ram P (n), P < k, computin fi(k) (n) for all n. Since i(k) is bad for k, there exists i0 = i(k) such that P fi0 . Since P always conver es, it means that for all n, P (n) halts and outputs fi0 (n). Thus fi(k) = fi0 which is false accordin to the hypothesis on the family F . Step 2: Since F is a recursive family of recursive functions there exists a pro ram P such that for all i x, P(i x) halts and outputs fi (x). Consider the followin pro ram P (n k) acceptin two inputs n and k and computin i(n k): Pro ram P (n k) Simulate n steps of all pro rams of len th less than k with all inputs less or equal to n. Compute the 2k first functions fi on [0 n] usin pro ram P. Compare the results and output the smallest that is bad for k. End
738
Bruno Durand and Sylvain Porrot
Lemma 3 indicates that P (n k) computes i(n k) for all n and all k. Because of the recursivity hypothesis on family F , we can compute fni from input i and n usin P, thus i K( fni n) K(i n) + On (1). Moreover, since for all n k, P (n k) computes i(n k), we have n k K(
n fi(n
k)
n)
P ( k) + On k (1) lo (k) + On k (1)
nk i(n k) = i(k). With Lemma 4, iven k, there exists nk such that n Therefore we et k nk n nk K( fni(k) n) lo (k) + On k (1) and nally we obtain lim sup K( fni(k) n) lo (k) + Ok (1). We have just seen that even for reasonable family of functions, the complexities of the initial parts of a raph does not always constitute an approximation of the complexity of the function itself, since some functions appear to be patholo ical. However, in most cases, both complexities are close to each other, as shown in the followin theorem. Theorem 4. Let F = fi i2N be any recursive family of distinct recursive functions. For all and all k, there are at most a proportion of 2A functions, amon the k rst functions fi , for which the di erence between stron and weak complexities is reater than , i.e. A k Ks (fi ) − Kw (fi ) k 2 Proof. Since the family F is a recursive family of recursive functions, there exists a pro ram computin fi for all i, thus we have A
k
Card i
A i Ks (fi ) Since Kw (fi ) = lim sup K( n!1
n fi
lo (i) + A
(1)
n) we et
i n0i n
n0i Kw (fi )
K(
n fi
n)
(2)
and from equations 1 and 2 we obtain A i n0i n
n0i Ks (fi ) − Kw (fi )
lo (i) + A − K(
n fi
n)
(3)
Let k and be xed. Since all functions of family F are distinct, there exists nk such that, for all n nk , all truncated raphs ( fni )i , and the function (L) is continuous on ( ) and satis es lims# s (L) = (L).2 If, moreover, (w) < 1 for all w L, then the function (L) is strictly decreasin and lims!1 s (L) = 0. The -entropy of the lan ua e L n , written HL , is de ned as the point de ned above, which is a chan e-over-point of the function (L), i.e., HL := s 3 s (L) < so that HL < i ( (0 ) (L) < ). inf : 0
Remark 1. One can construct valuations and lan ua es L such that (w) < 1 for all [0 ). In the sequel, however, for w L and nevertheless s (L) = we are not interested in such patholo ical cases. If (a) < 1 for every a n, then there is a nite chan e-over-point of the function s (L) for any L n. It was shown in [21,28,29] that the entropy of lan ua es introduced by Chomsky and Miller (cf. [16]) is a useful tool for the calculation of the Hausdor dimension of certain subsets of the Cantor space n or of the Euclidean space IRd . Here, we will see the usefulness of the eneralized notion of -entropy, especially leadin ) to similar calculation formulae for the Hausdor dimension of subsets of ( n and of IRd , thereby eneralizin results of [1,20]. The main tool is to eneralize properties of the entropy of lan ua es (see [26], [29, Section 2]). So, we nd: HW [V = HW V = max HW HV
if W V = , and
HL = 0 if L is nite.
3
(2) (3)
-Entropy of Lan ua es
In this section we show for two classes of lan ua es that their -entropy can be computed. The rst class is the class of re ular lan ua es. Here we rely on results of [1,20]. Moreover, we show the close relationship between the -entropy of a re ular lan ua e and the -entropy of its lan ua e of subwords. The second subsection deals with the approximation of the -entropy of a starlan ua e by the -entropy of their nitely enerated sublan ua es.4 It is interestin to note that this approximation is valid for arbitrary star-lan ua es. 3.1
The
-Entropy of Re ular Lan ua es
We can characterize the re ular lan ua es with nite -entropy. The state of M n n derived from w n is de ned as: M w := p : p n w p M M n n n is called nite-state if it has a nite number of distinct states. It is well-known that L n is nite-state i it is re ular, 2 3 4
permi ing he value for (L) Here we follow he conven ion inf = . In general, he -en ropy is in no way con inuous, ha is, lim necessarily imply ha HL ends o HL .
L = L does no
IFS and Con rol Languages
743
whereas every re ular -lan ua e 5 is nite-state but the converse does not hold (see e. . [25]). w n is called pre x of a strin p n n provided (abbreviated by w p). For M p = w p0 for some p0 n n n n its set of nite pre xes is denoted by A(M ) and its set of subwords (in xes) is p w(w w v p M) . T(M ) := v : v n n Properties 2 If L n is a re ular lan ua e and valuation, then the followin conditions are equivalent.
n
:
(0
) is a
1. There is an 0 such that s (L) < . 2. w v(v = e L w = L w v = (v) < 1) 6 3. There are an IN and a positive constant c < 1 such that for all u with u it holds (u) cjuj .
T(L)
We obtain the followin relations between the -entropies of L, A(L) and T(L): Properties 3 Let L be re ular. Then, s (L) < s (T(L)) < . Further, HL = HA(L) = HT(L) .
i
s
(A(L))
0 he inequali y c (s) holds. L (s + )
744
Henning Fernau and Ludwig S aiger
Lemma 1. If L is a nite union of k codes which satis es = HL < , then HL > HL .
(L) > k for
Corollary 2. If L n is re ular and a nite union of codes and HL < then HL > HL . (See Cor. 1.)
,
Next we consider the approximation of HL via HU where U is a nite subset of L. We derive an analo ue to the theorem of [26] stated in Thm. 5. In [26] we used the real numbers m de ned as the smallest (positive) roots of the equation 1 = m + ( m )m .8 In the sequel we assume there is a positive constant c < 1 such that every word w L (and, hence also every w L ) satis es (w) cjwj , (w) cjwj . Note that V c V c . i.e., L V c where V c := w : w n Theorem 4. Let L V c , L = . Then for m s s (L ) m := lo c m we have 2IN ( (L)) If (L) = 1, then on the one hand HL to Thm. 4, − m (L ) = , i.e., HL Corollary 3. Let L 0. Then 0 − HL
V
c m
−
min w : w L s− m (L ) for all
e
and m.
and on the other hand, accordin m . So, we et:
for some c < 1, e L and min w : w whenever (L) = 1
Theorem 5. Let L V c for some c < 1. Then for every subset U L such that HL − HU
> 0 there is a nite
We derive an upper bound to the -entropy of V c n where c < 1: HV c s s s c = if only n cs < 1. − lo c n, for (V c ) 2IN n 2IN (n c )
for some > 0 and all = . isolated points, i.e., n 4. Balls IB ( ) = : ( ) with center and radius > 0 (they are simultaneously open and closed) are described by: IB ( ) =
w (
)
n
, if ( = ( ) > ), and , otherwise (w ( ) exists!);
(4)
. where w ( ) is the shortest pre x (provided it exists) w < with (w) IB ( ) can be chosen to be the center, which shows that its radius is Any an upper bound of its diameter. In contrast to the contractive case, neither all balls are subsets of the form w n nor all subsets of the form w n are ) where (1) < 1 and (2) 1. balls; e. ., take 12 2 in ( 2 : inf (w) : w < > 0 be the set of all isolated points. II is 5. Let II := is contractive. For noncontractive we have II = n a open. II = i i (a) = 1 and (b) < 1 for b a , and else II is uncountable. n -fundamental. IF is closed. If IF = , it is not 6. We call IF := n II stron ly closed unless is contractive, since IF = IF w for all w n and only two stron ly closed one-state -lan ua es exist in n : n and . In order to introduce the Hausdor dimension of subsets of ( the -dimensional outer Hausdor measure induced by : (F ) := lim inf !0
(diam F ) : F 2IN
F
n
diam F
0.
Since U is nite-state and stron ly closed if only U is nite, in view of A(U ) = IF is obtained as dim( ) U = HU . A(U ) and Prop. 3 the HD of any U By an approximation as in Thm. 5, we ot a eneral formula for the HD of L : Lemma 5. If c
(0 1) and L
V
c,
then dim(
Lemma 6. If c
(0 1) and L
V
c,
then
)
L = dim( ) (L ) = HL .
((L ) )
1 for
= HL .
De ne the stron closure of an -lan ua e E as cl(E) := (A(E)) ; it is the smallest stron ly closed -lan ua e containin E, thus independently of it -closed set F with E F . By Lemma 5 and contains the smallest n Prop. 3, we obtain: Corollary 4. If c
(0 1) and L
Corollary 5. If c (0 1) and L and = HL , then 0 < (L ) =
V
c
is re ular, dim(
)
L = dim(
)
cl(L ).
V c is re ular and a nite union of codes (cl(L )) 1.
Remark 2. More involved calculations as in [21, Thm. 6] show 0 < ((L ) ) = (cl(L )) 1 for arbitrary re ular L V c , but in the case of nonre ular W one mi ht even have dim( n ) W < dim( n ) cl(W ) (cf. [29, Ex. 6.3 and 6.5]).
IFS and Con rol Languages
5
747
IFS and Fractal Geometry
One of the most popular ways to describe fractals is IFS [2]. We restrict ourselves in the followin to Euclidean spaces X IRm equipped with the Euclidean X by S(X ), distance E . Denotin the set of contractive similitudes f : X S(X ). We sketch some wellwe can describe an IFS F as a map F : n known properties of IFS in the followin : An IFS F ives a contractive valuation (0 ), where F (i) (for i F : n ) denotes the similarity factor of F (i). n + can be seen as a similitude S(X ), where F is a semi roup So, w F (w) n (S(X ) ). Recall the notion of address derived from Eq. (1) morphism ( n+ ) (X E ) is Lipschitz. in the introduction. Further, the map F : ( n F) Call AF = F ( n ) limit set of F . S(X ), we interpret a nite (m-element) lan ua e Given an IFS F : n + wm as an IFS FL : m S(X ) i L = w1 F (w ). We have n AFL = F (L ). Similarly, in nite L lead to in nite IFS (IIFS) [36,9,19] whose theory is more involved but analo ous to IFS theory. We can still de ne a set described by an IIFS FL (based on the IFS F and the lan ua e L), the limit + set F (L ).11 In X = ( n n ), we interpret any L n as an (I)IFS by + w x with limit set L . For L w : n n x n , call vd (L) = s inf : (L) 1 valuation dimension (VD). Prop. 1 shows the close relation of vd (L) and HL . VD corresponds to the similarity dimension in IFS theory. We denote the -dimensional outer Hausdor measure on (X E ) by Hs , and the correspondin HD by dimH . For IFS, Moran’s open set condition (OSC) is well-known as an assumption alleviatin the determination of the HD of AF [2,6,8]: Provided there is an open bounded non-empty test set M X such , and that, furthermore, for any i j that F (i)(M ) M for any i n n, i = j, F (i)(M ) \ F(j)(M ) = , then, for = vd F ( n ), 0 < Hs (AF ) < , and = dimH (AF ). Generally, it is not trivial to nd a test set for some F . But, if we knew that F ful lls OSC, (when) could we say somethin about FL ? Here, we need two further notions [30]. Call V n OSC-code i there is a =W n (OSC-witness) verifyin : v(v v v 0 (v v 0
V V
v W v = v0
n
v W
W
n) n
, and
\ v0 W
n
(9) = )
(10)
Any OSC-code is a code, and any pre xcode is an OSC-code. Moreover, any re ular code is an OSC-code [30]. Note further the correspondence with the Euclidean case: Interpretin V as an (I)IFS in n , V satis es the OSC with open test set W n i V is an OSC-code with OSC-witness W . : IRd IRd be an IFS satisfyin Theorem 7. Let F = ( 1 n ) where OSC, and let C n be an OSC-code. Then (I)IFS FC satis es OSC, too. To ether with [9, Thm. 3.11], we obtain dimH ( F (L )) = vd F (L) if the IFS S(X ) satis es the OSC and L is an OSC-code. The previous sections F: n 11
When res ric ing one’s a en ion o compac se s, ake i s closure ins ead.
748
Henning Fernau and Ludwig S aiger
to ether with Thm. 3 of [1], however, allow to stren then the mentioned result and to eneralize it to not necessarily contractive valuations. In [1,20], IFS have been eneralized to systems F with arbitrary similitudes. To uarantee the conver ence of (1) one has to restrict the set of admissible (X E ) is Lipschitz -words . In [1, Thm. 3], it is shown that F : (E F ) whenever E is a stron ly closed nite-state subset of IF F . Related to this, the followin eneralization of the OSC for pairs (F E) satisfyin the abovementioned property is introduced. Let M be a nite set of open subsets of M. We say that the assi nment (X E ). To every w n we assi n a set Mw w A(E), n=1 (Mw ) Mw , and is compatible with E i Mw = (Mw ) \ j (Mwj ) = , for i = j. We say that a pair (F E) satis es the Generalized Open Set Condition (GOSC) i E is a nite-state stron ly closed Mw M compatible subset of IF F and there are an M and an assi nment w with E. By the rst condition, for every nite-state stron ly closed subset F E the pair (F F ) satis es GOSC if (F E) satis es GOSC. Thm. 3 of [1] ives: Theorem 8. Let E be a nite-state stron ly closed subset of IF F so that (F E) F = dim( F ) E =: with satis es GOSC. Then, we have: dimH F (E) = HA(E) H ( F (E)) > 0. We proceed with the stren thenin of dimH (
F (L
)) = vd
F
(L).
S(X ), E be a niteTheorem 9. Let (X E ) be a Euclidean space, F : n E. state and stron ly closed subset of IF , and let L n such that L Assume the pair (F E) satis es the GOSC. Then dimH ( F (L )) = dim( F ) L , and provided L is a code, we have dimH ( F (L )) = vd F (L). Remark 3. An analo ue for IIFS satisfyin the OSC (usin the notion of topolo ical pressure function) is iven in [19, Thm. 3.15]. Confer also [12, Thm. 10]. S(X ), and let L Theorem 10. Let (X E ) be a Euclidean space, F : n be a re ular lan ua e such that (w) < 1 for all w L e . Then cl(L ) F n IF F and dimH ( F (cl(L )) = dimH ( F (L )) = dim( F ) L . If, moreover, L is [0 ). a nite union of codes then Hs ( F (L )) = Hs ( F (cl L )) for Note 1. In [9, Remark 3.12], the question was raised whether requirin an OSC F (n)) of a iven IIFS F is weaker than for each IFS-part Fn = (F (1) requirin an OSC for F itself. We can show the followin here: If all Fn ful ll an OSC, then F itself does not necessarily satisfy an OSC. Namely, take as basic S(([0 1] E )) de ned by F (1)(x) = x 2 and F (2)(x) = x 2 + 1 2. IFS F : 2 Clearly, AF = [0 1]. Consider the su xcode L = w12jwj : w 2 (which is no OSC-code) from [30, Example 1]. The IIFS FL doesn’t satisfy an OSC. Acknowled ment: The rst author has been supported by DFG La 618/3-2.
IFS and Con rol Languages
749
References 1. C. Band . Self-similar se s 3. Monatsh. Math., 108:89 102, 1989. 2. M. F. Barnsley. Fractals Everywhere. Acad. Press, 1988. 3. J. Bers el and M. Morcre e, Compac represen a ions of pa erns by ni e au oma a, in: Proc. Pixim ’89, Hermes, Paris, 1989, pp. 387 402. 4. K. Culik II and S. Dube, A ne au oma a and rela ed echniques for genera ion of complex images, TCS , 116:373 398, 1993. 5. K. Culik II and J. Kari, in: [24], pp. 599 616. 6. G. A. Edgar. Measure, Topolo y, and Fractal Geometry. Springer, 1990. 7. S. Eilenberg. Automata, Lan ua es, and Machines, A. Acad. Press, 1974. 8. K.J. Falconer, Fractal Geometry. Wiley, 1990. 9. H. Fernau. In ni e IFS. Mathem. Nachr., 169:79 91, 1994. 10. H. Fernau. Valua ions of languages, wi h applica ions o frac al geome ry. TCS, 137(2):177 217, 1995. 11. H. Fernau. Valua ions, regular expressions, and frac al geome ry. AAECC, 7(1):59 75, 1996. 12. H. Fernau and L. S aiger. Valua ions and unambigui y of languages, wi h applica ions o frac al geome ry. In S. Abi eboul and E. Shamir, eds., ICALP’94, vol. 820 of LNCS, pp. 11 22, 1994. 13. H. Fernau and L. S aiger. Valua ions and unambigui y of languages, wi h applica ions o frac al geome ry. TR No. 94-22, RWTH Aachen, 1994. 14. A. Habel, H.-J. Kreowski, and S. Taubenberger. Collages and pa erns genera ed by hyperedge replacemen . Lan . of Desi n, 1:125 145, 1993. 15. F. Haeseler, H.-O. Pei gen, and G. Skordev. Cellular au oma a, ma rix subs i u ions and frac als. Ann. Math. and Artif. Intell., 8:345 362, 1993. 16. W. Kuich. On he en ropy of con ex -free languages. IC, 16:173 200, 1970. 17. R. Lindner and L. S aiger. Al ebraische Codierun stheorie; Theorie der sequentiellen Codierun en. Akademie-Verlag, 1977. 18. B. Mandelbro . The Fractal Geometry of Nature. Freeman, 1977. 19. R. D. Mauldin and M. Urbanski. Dimensions and measures in in ni e i era ed func ion sys ems. Proc. Lond. Math. Soc., III. Ser. 73, No.1, 105 154, 1996. 20. R. D. Mauldin and S. C. Williams. Hausdor dimension in graph direc ed cons ruc ions. Trans. AMS, 309(2):811 829, Oc . 1988. 21. W. Merzenich and L. S aiger. Frac als, dimension, and formal languages. RAIRO Inf. theor. Appl., 28(3 4):361 386, 1994. 22. P. Prusinkiewicz and A. Lindenmayer. The Al orithmic Beauty of Plants. Springer, 1990. 23. P. Prusinkiewicz et al. in: [24], pp. 535 597. 24. G. Rozenberg and A. Salomaa (eds.) Handbook of Formal Lan ua es, Vol. 3, Springer, 1997. 25. L. S aiger. Fini e-s a e -languages. JCSS, 27:434 448, 1983. 26. L. S aiger. Ein Sa z u ¨ber die En ropie von Un ermonoiden. TCS, 61:279 282, 1988. 27. L. S aiger. Quad rees and he Hausdor dimension of pic ures. In Geobild’89 , pp. 173 178, Akademie-Verlag, 1989. 28. L. S aiger. Hausdor dimension of cons ruc ively speci ed se s and applicaions o image processing. In Topolo y, Measures, and Fractals, pp. 109 120. Akademie-Verlag, 1992.
750
Henning Fernau and Ludwig S aiger 29. L. S aiger. Kolmogorov complexi y and Hausdor dimension. IC, 103:159 194, 1993. 30. L. S aiger. Codes, simplifying words, and open se condi ion. IPL, 58:297 301, 1996. 31. L. S aiger, in: [24], pp. 339 387. 32. L. S aiger. Rich -words and monadic second-order ari hme ic, o appear in: Proc. CSL’97, LNCS, 1998. 33. S. Takahashi. Self-similari y of linear cellular au oma a. JCSS, 44:114 140, 1992. 34. S. Taubenberger. Correc ransla ions of generalized i era ed func ion sysems o collage grammars. TR 7/94, Universi ¨ a Bremen, Fachbereich Ma hema ik und Informa ik, 1994. 35. C. Trico . Douze de ni ions de la densi e logari hmique. CR de l’ Academie des Sciences (Paris), serie I, 293:549 552, Nov. 1981. 36. K. Wicks. Fractals and Hyperspaces, vol. 1492 of LNM. Springer, 1991.
One Quanti er Will Do in Existential Monadic Second-Order Lo ic over Pictures Oliver Matz Institut f¨ ur Informatik und Praktische Mathematik Christian-Albrechts-Universit¨ at Kiel, 24098 Kiel, Germany oma@ nformat k.un -k el.de
Abs rac . We show that every formula of the existential fra ment of monadic second-order lo ic over picture models (i.e., nite, two-dimensional, coloured rids) is equivalent to one with only one existential monadic quanti er. The correspondin claim is true for the class of word models ([Tho82]) but not for the class of raphs ([Ott95]). The class of picture models is of particular interest because it has been used to show the strictness of the di erent (and more popular) hierarchy of quanti er alternation.
1
Introduction
We study monadic second-order lo ic (MSO) over nite structures. For a iven class of structures, one can consider the followin two hierarchies: 1. the quanti er alternation hierarchy, where properties are classi ed wrt. the number of monadic quanti er alternations required for an MSO-sentence; 2. the existential-quanti er depth hierarchy, where properties in the existential fra ment of monadic second-order lo ic (i.e., on the lowest level of the alternation hierarchy) are classi ed wrt. the number of existential quanti ers required. Both hierarchies are strict for raphs, i.e., on each level there are raph properties that are not on the previous. The proof of the strictness of the rst ([MT97]) oes via another domain, namely the class of ( nite, two-dimensional) pictures, i.e., arrays over a nite alphabet. The proof of the strictness of the second ([Ott95]) also uses rid-like structures, but di erent ones. In contrast to that, for the class of nite strin s, both hierarchies collapse, i.e., every MSO-sentence over strin s is equivalent to a sentence whose monadic quanti er pre x consists of only one existential quanti er. The proof for the collapse of the second hierarchy can be found in [Tho82]. In the present paper we show (by an adaption of this proof) that the second hierarchy also collapses for the class of pictures, i.e., in a formula of the existential fra ment of monadic second-order lo ic over picture models, the len th of the quanti er pre x can be reduced to one. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 751 759, 1998. c Sprin er-Verla Berlin Heidelber 1998
752
2
Oliver Matz
De nitions
For 1 j n, we denote fj ng by [j n] and [1 n] by [n]. A picture of size (m n) over a iven nite alphabet Γ is an (mn)-matrix over Γ , i.e. a mappin [m] [n] ! Γ . If P is a picture of size (m n), we call m and n the hei ht and width of P , denoted by P and jP j, respectively. If i i0 P and j j 0 jP j, then the subblock of P on the rectan le [i i0 ][j j 0 ] is denoted by P ([i i0 ][j j 0 ]) =
P (i j) P (i j 0 ) .. .. .. . . . P (i0 j 0 ) P (i0 j)
By picture lan ua es we refer to sets of pictures. The lan ua e of all pictures (all picture of size (m n), or of hei ht m, or of width n, respectively) over Γ is denoted by Γ + + (or Γ m n , or Γ m + , or Γ + n , respectively). If P 2 Γ + + , Q 2 Ω + + are pictures of the same size over two alphabets Γ and Ω, then we denote by P ⊗ Q the picture over Γ Ω for which (P ⊗ Q)(x) = (P (x) Q(x)) for every x 2 domP . 2.1
Monadic Second-Order Lo ic over Picture and Word Models
In the case of pictures, formulas are in the si nature Γ := fS1 S2 (Qa )a2Γ g, where the Qa are unary and S1 , S2 are binary relation symbols. To every mnpicture P over Γ we associate the picture model P := ([m] [n] S1P S2P (QP a )a ), where S1P = f((i j) (i + 1 j)) j (i j) 2 [m − 1] [n]g and S2P = f((i j) −1 (a) is the set of all posi(i j + 1)) j (i j) 2 [m] [n − 1]g, and QP a = P tions that carry the letter a 2 Γ . When the picture P is displayed the usual way, the relations S1P and S2P are the vertical (respectively horizontal) successor relations. We use x y z as rst-order variables (ran in over elements of the universe) and X Y as monadic second-order variables (ran in over subsets of the universe). Consequently, atomic formulas over picture models are of the form X(x) (sayin that position x is in the set X), x = y (sayin that positions x and y are equal), Qa (x) (sayin that position x carries letter a), S1 (x y) (sayin that x is a vertical successor of y), or S2 (x y) (sayin that x is a horizontal successor of y). Formulas of monadic second-order lo ic (MSO-formulas) over picture models are built inductively from atomic ones by usin (1) boolean connectives _ :, (2) rst-order quanti cations of the form 9x , and (3) second-order quanti cations of the form 9X . First-order formulas are MSO-formulas in which no second-order quanti er occurs. The existential fra ment EMSO of MSO consists of formulas of the form 9X t , where is rst-order. We write (X 1 X t ) if is a formula 9X 1 X t . If X1 Xt domM for with free second-order variables amon X 1
One Quanti er Will Do in Existential Monadic Second-Order Lo ic
753
a structure M such that holds in M under the assi nment mappin X i to Xi , Xt ]. we write M j= [X1 The picture lan ua e (over alphabet Γ ) de ned by a sentence of si nature true. If a Γ ) is the set of pictures whose associated picture models make picture lan ua e is de ned by some EMSO-sentence over Γ then it is called EMSO-de nable. In the case of words, formulas are in the si nature Γ := fS (Qa )a2Γ g with the binary relation symbol S. The word model associated to a nonempty word w 2 Γ + is the Γ -structure w := (domw S w (Qw a )a2Γ ), where domw = f1 jwjg is the set of positions of w, and S w is the successor relation on f1 jwjg, and Qw a is the set of those positions of w that carry the letter a. Atomic formulas over word models are of the form X(x), x = y, Qa (x), or S(x y), the latter sayin that y is the succesor of x.
3
Compression of Existential Quanti er Block
[Tho82] exploits the connection of EMSO-de nable word lan ua es to local lanua es. This connection is presented in the next subsection. Afterwards we recall how locality is transferred to pictures, here usin the notion of domino-local picture lan ua es as in [LS94,Mat95], and then use this notion to prove Theorem 4. 3.1
EMSO vs. Locality
A word lan ua e L Γ + is local i there are sets A B Γ and C Γ 2 such that L = (AΓ \ Γ B) n (Γ CΓ ). The followin remark about re ular word lan ua es is folklore. Remark 1. Every word lan ua e de nable in existential monadic second-order lo ic is a projection of a local word lan ua e. The above remark also holds if the word existential is removed. The followin is shown in [Tho82]. Theorem 2. Let L be a a projection of a local word lan ua e. Then there exists a rst-order formula (X) in the si nature Γ such that L = Mod(9X (X)). The proof idea is a follows: Let M be a local word lan ua e over alphabet Γ and L = (M ) for an alphabet projection : Γ ! . A word u 2 M is called a run on (u), and letters from Γ are called states. A word w over is partioned into su ciently lar e sequences such that a f0 1g-colourin of such a sequence can encode the rst state of the correspondin substrin of a run on w. Now the existence of a run on w can be checked by a formula of the required form: checks that X corresponds to a f0 1g-colourin that encodes the rst states of all sequences of a run on w. The above two results ive the followin compression corollary that says that the number of existential quanti ers in EMSO-formulas can be reduced to one.
754
Oliver Matz
Corollary 3. Every sentence of existential monadic second-order lo ic over words is equivalent to a sentence of the form 9X (X), where is rst-order. The contribution of this paper is to transfer the above proof and result to pictures lan ua es, i.e., we will show the followin analo ue of Corollary 3: Theorem 4. Every sentence of existential monadic second-order lo ic over picture models is equivalent to a sentence of the form 9X (X), where is rstorder. This theorem is proved in the followin three subsections. Before that, let us note that we can conclude the followin corollary, which states that the compression of an existential quanti er block also works in the presence of free variables. Corollary 5. Every formula of existential monadic second-order lo ic over picture models is equivalent to a formula of the form 9X (X), where is rstorder. The proof is strai htforward. The essential idea is to pass to a sentence over a lar er alphabet that encodes the free variables, and then to apply Theorem 4. 3.2
Domino-Local Picture Lan ua es
The rst step is to transfer the notion of locality from words to pictures. De nition 6. Let P be a picture, and 1 (and 2 ) be a set of pictures of size (2 1) (or (1 2), respectively) over the same alphabet. 1 (or 2 ) tiles P i all subblocks of P of size (2 1) (or (1 2)) are in 1 (or 2 , respectively) Let P be a picture over Γ . The picture that results from P by surroundin it with the fresh boundary symbol # is denoted by P . A picture lan ua e L over Γ is domino-local i there exist sets 1 (Γ [ f#g)2 1 and 2 (Γ [ f#g)1 2 such that for every picture P 2 L, both 1 and 2 tile P . In that case, ( 1 2 ) is called a domino tilin system that reco nizes L. (The notion of locality has been introduced in [GRST96] in another way, usin (2 2)- tiles instead of (2 1)- and (1 2)-tiles. The sli htly di erent and more convenient notion presented here has been studied in [LS94,Mat95]. See [GR96] for a comprehensive survey.) By projection we refer to a mappin from one alphabet to another. A projection is lifted to pictures, words, picture lan ua es, and word lan ua es the obvious way. Then we have indeed the analo ue to Remark 1. Theorem 7. ([GR96,LS94,Mat95]) Every EMSO-de nable picture lan ua e is a projection of some domino-local picture lan ua e.
One Quanti er Will Do in Existential Monadic Second-Order Lo ic
755
Thus it su ces to show the followin in order to obtain Theorem 4, which will be done in the next two subsections Theorem 8. Let L be a projection of a domino-local picture lan ua e. Then there exists some rst-order formula (X) such that L = Mod(9X (X)) 3.3
Pictures of Bounded Hei ht
Firstly, we consider a domino-local picture lan ua e restricted to pictures of a xed hei ht. In this case, the compression of existential quanti er pre xes of EMSO-formulas over picture models can easily be reduced to the case of word models. Theorem 9. Let L be a projection of a domino-local picture lan ua e over Ω and m 1 a xed hei ht. Then there exists an rst-order formula (X) (in the si nature Ω ) such that Mod(9X (X)) is the set of pictures in L that have hei ht m. Proof (Sketch). Let L0 be the word lan ua e over alphabet Ω m 1 that contains all words in (Ω m 1 ) that are (as a picture of size hei ht m over Ω) in L. Application of Theorem 2 to the local word lan ua e L0 yields a rst-order formula in the si nature Ω m 1 , which can be translated to a rst-order formula in the si nature Ω in a strai htforward way. 3.4
Pictures of Unbounded Hei ht
In this subsection, we consider projections of domino-local picture lan ua es without the restriction of a xed hei ht. We will sketch the main construction. The aim is to construct a formula of the existential fra ment of monadic second-order lo ic whose models are exactly the pictures of some projection of a iven domino-local picture lan ua e M Ω + + under an alphabet projection . Let ( 1 2 ) be a domino tilin system reco nizin M . Without the additional limitation to one sin le monadic quanti er, such a formula may, informally speakin , work as follows: (1) Guess an Ω-colourin of the input picture, and then (2) check that the local restrictions are ful lled, i.e., the picture obtained this way is tiled by 1 and 2 . Since we are restricted to one sin le monadic quanti er, the formula is not able to uess the Ω-colourin in step (1) but only a f0 1g-colourin . However, if we partition the picture into su ciently lar e blocks, then it is possible to uess the Ω-colourin of the border of each block and store this in a f0 1g-colourin of the complete block. Then a nite disjunction may check if there really is a Ω-colourin of the block with that border such that 1 and 2 tile the inside of it. What remains to be done is to check whether the colourin of the borders of nei hboured blocks t to each other in the sense that the 2 1 or 1 2-subblocks (of the Ω-coloured picture) alon the ed es of blocks are in 1 or, respectively, 2 . This can be checked (in the actual f0 1g-coloured picture) by a rst-order
756
Oliver Matz
z
2d }|
{
z
2d }|
2d 4d
{z }| {
2d
2d 2d 4d
8 < : Fi . 1. Partition into Blocks
formula because the information about the Ω-colourin of the border of the block is coded in the f0 1g-colourin of the inside. We prepare the proof with some de nitions. De nition 10. Let P 2 Γ + + be a picture of size (m n). Then left(P ) = (P (1 1) right(P ) = (P (1 n) top(P ) = (P (1 1) bottom(P ) = (P (m 1)
P (m 1))> P (m n))> P (1 n)) P (m n))
border(P ) = (left(P ) right(P ) top(P ) bottom(P )) The next de nition will help to de ne the partition of a picture into blocks. De nition 11. Let m d 1. Choose n 0 and r d in such a way that m = (n + 1)d + r. The tuple (1 d + 1 2d + 1 nd + 1 m + 1) is called the d-step sequence in m. in+1 ) is the d-step sequence in m, then d in+1 − in 2d. Note that if (i0 Let P be some picture of size (m n) (with m n d). Let i i0 (respectively j j 0 ) be consecutive components in the d-step sequence in m (respectively n). The d-block of P at position (i j) is the subblock Block(P d (i j)) = P ([i i0 − 1][j j 0 − 1])) of P . If i00 (respectively j 00 ) are components followin i0 (respectively j 0 ) in these sequences, then P [i0 i00 − 1][j j 0 − 1] (respectively P [i i0 − 1][j 0 j 00 − 1]) will be called a horizontally (respectively vertically) followin d-block of P . Fi ure 1 illustrates how a picture of size (2d 2d) is split into 2d-blocks.
One Quanti er Will Do in Existential Monadic Second-Order Lo ic
757
We will make use of the fact that every picture P over Ω whose width and hei ht are 2d can be split into 2d-blocks, and there are only sin ly exponentially many essentially di erent (wrt. tilability by ( 1 2 )) types of 2d-blocks. Proof. (of Theorem 8.) Let L Γ + + be a projection of a domino-local picture lan ua e M . W.l.o. . we may assume that M is over alphabet Ω = Γ and that L is the ima e of M under the alphabet projection : Ω ! Γ , (a b) 7! b. Let ( 1 2 ) be a domino tilin system that reco nizes M . Choose d such that there exists an injective mappin f:
(Ω m Ω m Ω n Ω n ) ! f0 1gdd 2dm n 4d
We will only show that there exists a rst-order formula (X) such that for every picture P over Γ we have P 2 L i P j= 9X (X) and P jP j 2d. The claim will then follow from Theorem 9 because for every m 2d, there are formulas m (X) and γm (X) such that Mod(9X (X)) = L \ Γ m + and Mod(9Xγ(X)) = L \ Γ + m , and hence for = _ m 2d ( m _ γm ) we have L = (L \ Γ 2d 2d ) [
(L \ Γ m + ) [ (L \ Γ + m ) m 2d
= Mod(9X _
(9X
m
_ 9Xγm )
m 2d
= Mod(9X ) We proceed with the construction of . For a block B over Ω whose width and hei ht are 2d and 4d, let ess(B) be the picture of same size as B such that ess(B)(i j) =
1 f (border(B))( 12 (i + 1) 0
1 2 (j
if i = 0 _ j = 0 + 1)) if i 2 j 2 1 ^ i j else
2d
Intuitively, ess(B) carries all the essential information of a block B. The followin are equivalent for every picture P over Γ :
\
1. P 2 L 2. There exists a picture Q over of the same size such that 1 and 2 tile 1 (Q ⊗ P ). 3. There exists a picture Q over of the same size such that for every 2d-block B of (Q ⊗ P ) we have: (a) for the horizontally next 2d-block B1 of (Q ⊗ P ) (if present), 2 tiles (right(B) left(B1 ))> ; (b) for the vertically next 2d-block B1 of (Q ⊗ P ) (if present), 1 tiles bottom(B) top(B1 ); 1
Remember that P means P surrounded with the boundary symbol #.
758
Oliver Matz
(c) if B is a top-most 2d-block, then 1 tiles #jBj top(B); (d) if B is a bottom-most 2d-block, then 1 tiles bottom(B) #jBj ; (e) if B is a leftmost 2d-block, then 2 tiles (#B left(B))> ; (f) if B is a ri htmost 2d-block, then 2 tiles (right(B) #B )> ; ( ) 1 and 2 tile B. 4. There exists a picture Q0 over f0 1g of the same size such that: for every i from the 2d-step sequence of P and every j from the 2d-step sequence of jP j, if B 0 = Block(Q0 2d (i j)), then (a) there is some B 2 ess−1 (B 0 ) \ −1 (Block(P 2d (i j))) that is tiled by 1 and 2, (b) some (and hence any) 2d-block B 2 ess−1 (B 0 ) satis es 3a to 3f. The equivalence of 3 an 4 is due to the fact that properties 3a to 3f only depend on border(B) and hence only on ess(B). The properties 4b and 4a can be checked by a rst-order formula (X), where X encodes the f0 1g-picture Q0 . To see the latter we observe that every picture Q0 all of whose 2d-blocks have property 4a has the property that two horizontally (respectively vertically) consecutive 1-positions mark a row (respectively column) whose index is in the 2d-step sequence of the hei ht (respectively width) of a picture. And for a picture that has this property, it is possible to determine consecutive 2d-blocks by rst-order formulas and hence to check 4b by nite disjunctions ran in over all possible 2d-blocks over f0 1g. This completes the proof of Theorem 8. From Theorems 7 and 8 we can conclude our main result Theorem 4, i.e., that the existential quanti er pre x of an EMSO-sentence over picture models can be compressed to len th one.
4
Concludin Remarks
The proof that the number of quanti ers in formulas of existential monadic second-order lo ic over words can be limited to one has been transfered to pictures, which are the 2-dimensional analo ue to words. It is quite obvious that this proof can be transfered to arbitrary nite dimensions by induction.2 For the four classes of models mentioned in the introduction and the two monadic hierarchies of quanti er alternation and existential quanti er depth, the situation looks as follows. Here, collapse always means collapses to the existential fra ment EMSO . Word Models Picture Models Otto-Grids Graphs 2
Quanti er Alternation collapse strict (see [MT97]) (open) strict
Existential Quanti er Depth collapse (see [Tho82]) collapse (this paper) strict (see [Ott95]) strict
The crucial point is to reprove Theorem 7 for hi her dimensions, which has not been done yet thou h it is strai htforward.
One Quanti er Will Do in Existential Monadic Second-Order Lo ic
759
The results of the bottom row are infered by the results of the second and third row, respectively, by encodin techniques. I conjecture that for the class of Ottorids (as de ned in [Ott95]), the quanti er alternation hierarchy collapses. The class of pictures is of special interest because it has a strict quanti er alternation hierarchy. Re ardin this hierarchy, the followin question is natural: Can the number of quanti ers in each block of a formula of minimal quanti er alternation be limited to one? Acknowled ments. I thank Wolf an Thomas and Thomas Wilke for their explanations of Corollary 3, which was the startin point for this paper. Furthermore, I thank Ina Schierin for valid criticism concernin the presentation.
References GR96.
D. Giammarresi and A. Restivo. Two-dimensional lan ua es. In G. Rozenber and A. Salomaa, editors, Handbook of Formal Lan ua e Theory, volume III. Sprin er-Verla , New York, 1996. GRST96. D. Giammarresi, A. Restivo, S. Seibert, and W. Thomas. Monadic secondorder lo ic and reco nizability by tilin systems. Information and Computation, 125:32 45, 1996. LS94. M. Latteux and D. Simplot. Reco nizable picture lan ua es and domino tilin . Internal Report IT-94-264, Laboratoire d’Informatique Fondamentale de Lille, Universite de Lille, France, 1994. Mat95. O. Matz. Klassi zierun von Bildsprachen mit rationalen Ausdr¨ ucken, Grammatiken und Lo ik-Formeln. Diploma thesis, Christian-Albrechts-Universit¨ at Kiel, 1995. (German). MT97. O. Matz and W. Thomas. The monadic quanti er alternation hierarchy over raphs is in nite. In Twelfth Annual IEEE Symposium on Lo ic in Computer Science, pa es 236 244, Warsaw, Poland, 1997. IEEE. Ott95. M. Otto. Note on the number of monadic quanti ers in monadic 11 . Information Processin Letters, 53:337 339, 1995. Tho82. W. Thomas. Classifyin re ular events in symbolic lo ic. Journal of Computer and System Sciences, 25:360 376, 1982.
On Some Reco nizable Picture-Lan ua es
?
Klaus Reinhardt Wilhelm-Schickhard Institut f¨ ur Informatik, Universit¨ at T¨ ubin en Sand 13, D-72076 T¨ ubin en, Germany
[email protected] en.de
Abs rac . We show that the lan ua e of pictures over b , where all occurrin b’s are connected is reco nizable, which solves an open problem in [Mat98]. We eneralize the used construction to show that monocausal deterministically reco nizable picture lan ua es are reco nizable, which is surprisin ly nontrivial. Furthermore we show that the lan ua e of pictures over b , where the number of ’s is equal to the number of b’s is nonuniformly reco nizable.
1
Introduction
In [GRST94] pictures are de ned as two-dimensional rectan ular arrays of symbols of a iven alphabet. A set (lan ua e) of pictures is called reco nizable if it is reco nized by a nite tilin system. It was shown in [GRST94] that a picture lanua e is reco nizable i it is de nable in existential monadic second-order lo ic. In [Wil97] it was shown that star-free picture expressions are strictly weaker than rst-order lo ic. A comparison to other re ular and context-free formalisms to describe picture lan ua es can be found in [Mat97, Mat98]. Characterizations of the reco nizable picture lan ua es by automata can be found in [IN77] and [GR96], where also the subclasses, which are de ned by a restriction from nondeterminism to determinism or unambi uity are considered. We show in chapter 2 that the lan ua e of pictures over a b , where all occurrin b’s are connected is reco nizable, which solves an open problem in [Mat98]. (Connectedness is not reco nizable in eneral [FSV95].) The technique which is used here is eneralized in the followin chapter to show that monocausal deterministically reco nizable lan ua es are reco nizable. The notion of deterministic reco nizability, which we use is stron er than the determinism in [GR96], has more closure properties (for example rotation), which promises practical relevance. Furthermore we show in the last chapter that the lan ua e of pictures over a b , where the number of a’s is equal to the number of b’s is nonuniformly reco nizable. Hereby we use counters similar to those used in [F¨ ur82]. De nition 1. [GRST94] A picture over is a two-dimensional array of elements of . The set of pictures of size (m n) is denoted by m n . A picture ?
This research has been supported by the DFG Project La 618/3-1 KOMET.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 760 770, 1998. c Sprin er-Verla Berlin Heidelber 1998
On Some Reco nizable Picture-Lan ua es
lan ua e is a subset of := m n0 mn m+2 n+2 , we have p For a p addin a frame of symbols # .
mn
.
p := Let T2 2 (p) be the set of all sub-pictures of p with size (2 2).
761
# # # # # # # # # # p # # # # # # # # # #
A picture lan ua e L Γ is called local if there is a T2 2 (p) . A picture lan ua e with L = p Γ is called reco nizable if there is a mappin : L Γ and a local lan ua e L0 Γ with L = (L0 ). A necessary condition for reco nizability is the followin : Γ n Γ n ) be Lemma 1. [Mat98] Let L Γ be reco nizable and (Mn pairs with n (l r) Mn lr L and (l r) = (l0 r0 ) Mn lr0 L or l0 r L, 2O(n) . then Mn n lr = r l
Considerin pictures where the width is in 2 (n) for the hei ht n, we can nd pairs (l r) such that the number of a’s in lr is equal to the number of b’s 2 in lr but all the l’s have a di erent di erences of numbers of a’s and b’s. By contradiction we et the followin : (n)
Corollary 1. The lan ua e of pictures over a b , where the number of a’s is equal to the number of b’s (and where the size (n m) is only restricted to f −1 (n) m f (n) for a function f 2 (n) ) is not reco nizable. In Section 4 we will see that we can not make such a conclusion, if we restrict the width of the pictures to be at most exponential to the hei ht (and vice versa), by showin nonuniform reco nizability in this case.
2
Connectedness in a Planar Grid
An interestin question for picture reco nition is, whether an object is ’in one piece’, which means the sub raph of the rid havin a special color respectively letter is connected. Theorem 1. The lan ua e of pictures over a b , where all occurrin b’s are connected is reco nizable. Proof. Since the reco nizable lan ua es are closed under concatenation accordin to [GRST94], it su ces to show that the lan ua e of pictures pr over a b , where all occurrin b’s are connected and one of them touches the left side is reco nizable. Then we can concatenate with the lan ua e of pictures pl consistin only of a’s. The result is the lan ua e of pictures pl pr of the theorem.
762
Klaus Reinhardt
The idea is that the b’s are connected if and only if they can be or anized as a tree bein rooted at the lowest b on the left side. (All a’s under this b are distin uished from the other a’s.) Hereby and are constructed in a way such that every in Γ with ( ) = b encodes the direction to the parent node. To achieve this has to contain tiles havin for example the form
#
ar
#
#
,
b but contain no tiles of the form
? 6 b
#
ar
#
ar
? b b- 6 b
,
b
,
#
b
#
ar
? ,
b
?
b
-
b 6 b
,...
a
a
, ,... which would build a cycle or # # # # # # # # # not connect to parent nodes. But the picture to the ri ht b b a a # a # b a side shows that it is not so easy: A problem of this naive b b a b # # b a b approach is that cycles could exist independently from the b a # ar # b a root. b b To solve this problem we a a # ar b b # additionally encode tentacles b b into each cell, where they can a a a a # ar # b b occur at the lower and the ri ht side and must occur at # # # # # # # # # the lower ri ht corner. (This means we interpret one cell as a two-dimensional structure of four cells like embeddin a rid into a rid with double resolution.) These tentacles also have to build trees, which can have their roots at any # or ar . Furthermore we do not allow a tentacle crossin a connection of the tree of b’s. Each lower ri ht side of a cell must be a tentacle part, which needs a way to a # or ar , therefore the b’s can not have a cycle around such a spot and thus no cycle at all. Analo ously we have to avoid cycles in a tentacle tree. Therefore we also or anize the a’s in trees which are rooted to the tree of b’s. This means the tree of b’s and a’s and the tentacle trees completely intrude the spaces between the other tree and hereby avoid any cycle. The alphabet Γ contains for example a a a a b a a , , , , , , ,... The rst kind allows 2 possible parent directions for the a (the other 2 direction would cross the tentacle) and 4 possible parent directions for the tentacle, which lead to 8 possible combinations; the second kind allows 4 possible parent directions for the a and 2 possible parent directions for the tentacle, which a ain leads to 8 possible combinations; the third and fourth kind allow 3 possible par-
?
?-
6 6 -
,
?
6
6 6
-
? - ? 6 ? 6 6
-
?
?
On Some Reco nizable Picture-Lan ua es
763
ent directions for the a and 3 possible parent directions for the tentacle, which leads to 9 possible combinations. This means 34 elements for a and the same number for b thus to ether with ar we have Γ = 69. Our tilin allows nei hborin cells if tentacles have a parent direction pointin to a tentacle, # or ar , if furthermore b’s have a parent direction pointin to a b or downward to an ar and a’s have a parent direction pointin to an a or a b like for example (only half of a tile is shown):
6 b a b6 6 a # a b , , , a a b a ? ?, ? ?, ... but does a b b ? ?, or not allow tiles containin for example r
The picture p could for example look like: # # # # # # #
3
#
#
#
#
#
#
b a a 6b 6a ? ? - b - - - b ? ? b - a 6a b - b ? ?6 b 6 a - b6 a b a b ?? 6 b6 b b b b a a ? - - ? - 6 b6 a a b6 a a a ? ? ? ? ? ? a
-
#
b ? ?,
a ? ?. #
b
?-
# #
r
#
r
#
r
#
#
#
#
#
#
#
#
#
The Reco nition of a Picture as a Deterministic Process
Reco nizin a iven picture p can be viewed as a process ndin a picture p0 over Γ in the local lan ua e with (p0 ) = p. One major feature for reco nizable lan ua es is that this process is nondeterministic. For practical applications however, we would like to have an appropriate deterministic process startin with a iven picture p over and endin with
764
Klaus Reinhardt
the local p0 over Γ . The intermediate con urations are pictures over Γ. One step is a replacement of an s by a Γ with s = ( ), which can be performed only if it is locally the only possible choice. This means formally: De nition 2. Let Γ = , :Γ and # )2 1 , which means (Γ # )1 2 (Γ we consider two kinds of tiles (We conjecture that usin 2 2-tiles would make non reco nizable picture lan ua es deterministically reco nizable): s r
s f
r q o q d e Extend to 0 = ( ) r = (f ) q = (e) o = (d) by also allowin tilin . ( For two intermediate con urations p p0 we allow a replacement step p ==> p0 if for all i p(i j) = p0 (i j) or p(i j) = p(i j-1)
p0 (i j)
(
o
f
e d
s= the ima e symbols in the Γ # )m n , n m > 0 m j n we have either
)
(p0 (i j)) and all of the 4 tiles containin this
p0 (i j)
p(i j+1) p(i-1 j) p0 (i j)
p0 (i j) p(i+1 j)
and p0 (i j) namely are in 0 and if the choice of p0 (i j) was ’forced’, that means there is no other = p0 (i j) in Γ with p(i j) = ( ) such that replacin p(i j) in p by would result in each of the 4 tiles containin this is in 0 . If the choice of p0 (i j) was forced even if 3 of the nei hbors where in (or re arded as their ima e of ), then the replacement step p ==> p0 is called monocausal. m(
The accepted lan ua e is Ld ( and analo ously Lmd (
) := p
)
) := p
(
p ==> p0 m(
p ==> p0 (Γ
(Γ
# )
)
# )
A picture
)
is called deterministically reco nizable if there are with lan ua e L ) and analo ously monocausal deterministically reco nizable if L = L = Ld ( ). Lmd ( ) Ld ( ) L( ). Furthermore it is easy to see that Clearly Lmd ( ==> is confluent on pictures (and their intermediate con urations), which are (
)
), if we re ard possible replacements as voluntarily. (But even if the in Ld ( enerated picture p0 Γ is unambi uous, this does not mean that that a deterministically reco nizable lan ua e is unambi uously reco nizable in the sense of [GR96], since the simulation of order of replacements mi ht be ambi uous.) This ives us a simple al orithm to simulate the process by addin those nei hbors
On Some Reco nizable Picture-Lan ua es
765
of a cell, which has just been replaced, to a queue if they are now forced to be replaced and not already in the queue. Corollary 2. Deterministically reco nizable picture lan ua es can be accepted in linear time. As an exercise for the followin Theorem 2 we show: Lemma 2. The lan ua e of pictures over a b , where all occurrin b’s are connected to the bottom line is monocausal deterministically reco nizable. Proof. The lan ua e is Ld ( bc #
# b
ac
# ac
#
b
b
b
#
) for (x ) = x and = # b ac ac b b ac b b b
b ac
ac ac
ac #
# ac
ac ac
i c u . Clearly a’s can only be replaced by ac . The b’s could possibly be bc or bu . In the rst step only the b’s at the bottom line can be replaced by bc since bu can not occur there. Then in the followin steps b’s, which are nei hbors of an bc can be replaced by bc since a bu can not occur beside a bc . In this way all connected b’s are replaced by bc . Theorem 2. The lan ua e of pictures over a b , where all occurrin b’s are connected is (monocausal) deterministically reco nizable. Proof. The lan ua e is Ld ( asr #
) for (x ) = x and asl
# asr asr asr asr # asr asl # asl asl
bc
bc bc # asr asl asr bc ac
b ac
b
ac
ar
#
#
ac
b
ac b
b al
# bc
bc #
al b
al b
b ar
# asl
#
b
b
b
# al
# bl
br
al ac
ac ac
bl br # asr asl
ac ar
b
ar b
b al
br #
bc asl
=
ar ac
asr # # asl asl asr b # a ar
a a ac
ar # asr asr asl asl
i l c r . The deterministic process starts in the lower left corner. If there is an a then asr is the only possible choice here since al can not occur over # and ac and ar can not occur ri ht of #. Then the ri ht nei hbor can only be asr since no other a can be ri ht of an asr . This continues alon the bottom line. Then the process proceeds on the ri ht lower corner. If there is an a then asl is the only possible choice here since ar can not occur over asr and ac and al can not occur
766
Klaus Reinhardt
left of #. Analo ously the second line becomes asl . This continues in snakelike manner producin asr on the way ri ht and asl on the way left until the rst b is found, which is then forced to become a bc since neither bl nor br can be left of asl or ri ht of asr . Then all connected b’s must become bc and all remainin a’s become al , ar or ac dependin on their position. # # # # # # # # # al ac ac b c b c b c ar # b c b c b c b c ac b c ar # al b c ac b c b c b c ar
# # # #
# # # # # # # # # al ac ac b c ac b ar # b ac b c b c ac b ar # al b c ac b c ac b ar
# # # #
# al ac ac b c ac ac ar # # asr asr bc bc ac ac ar # # asl asl asl asl asl asl asl # # asr asr asr asr asr asr asr #
# al ac ac b c ac ac ar # # asr asr bc bc ac ac ar # # asl asl asl asl asl asl asl # # asr asr asr asr asr asr asr #
# # # # # # # # #
# # # # # # # # #
But if the b’s are not connected, then some of them can not be determined to bc , bl or br and the process stops, as shown in the ri ht picture. Note that the tilin is not monocausal since an a left of a bc can only become a ac if the a under that a became an ac or asr (and not an asl ); but it could be made monocausal by introducin two more b -symbols for the rst b. The fact that Lmd ( non trivial:
) and L(
) mi ht be di erent makes the followin
Theorem 3. Every monocausal deterministically reco nizable lan ua e is reco nizable. Proof. (Sketch) The idea is a eneralization of the tentacle method in the proof of Theorem 1. The tree which was used there corresponds to the order of the replacements in Theorem 2: A b was replaced by bc if the ’parent’ b had been replaced by bc before. Every cell contains encoded tentacles like in Theorem 2 and additional the ima es of the 4 nei hbors (which is checked by the tilin ) and one third pointer. These third pointers use the same ways (but not the same direction) as the causal pointers and connect all cells to a forest rooted to #’s, which to ether with the tentacle forest uarantees the cycle freeness. The tilin s simulate the monocausal replacement. Conjecture Every deterministically reco nizable lan ua e is reco nizable. What chan es in the eneral case is that several (up to 4) nei hbors to ether can force one cell to be replaced, which means instead of a tree we need a planar directed acyclic raph to simulate the order of replacements in the deterministic process. Open problem Are the deterministically reco nizable lan ua es closed under complement?
On Some Reco nizable Picture-Lan ua es
4
767
Nonuniform Countin
Nonuniformity is a widely used principle in theoretical computer science. It says that we do not need one al orithm, Turin machine, rammar or whatever to reco nize a lan ua e but we may use a hole family of them, where each is used only for words of one special size. Connections of nonuniformity and countin can for example be found in [RA97] and [AR98]. A common characterization of nonuniformity is by advice strin s. One major observation is that most lower bounds of problems or statements sayin that a problem does not belon to a certain class also hold for the nonuniform version of the measure or class. This also holds for Lemma 1. It is easy to see that, as lon as we keep the size of the alphabet constant, the lemma does not make use of uniformity. It is an open problem, whether the lan ua e of pictures over a b , where the number of a’s is equal to the number of b’s and havin a size (n m) with lo n m 2n is reco nizable. The followin result shows that it is not possible showin its non reco nizability usin Lemma 1. De nition 3. For 2 pictures p p q ( Γ ) is de ned by (p
and q Γ of size (m n) the product q)(i j) = (p(i j) q(i j)).
is called nonuniformly local if there is an in nite A picture lan ua e L 2-dimensional array of advice-pictures (am n Γ ) and a local picture lan ua e Γ ) with L0 ( p L p am n L 0
for every picture p of size (m n). Theorem 4. The lan ua e of pictures over a b , where the number of a’s is equal to the number of b’s and havin a size (n m) with lo n m 2n is nonuniformly reco nizable. For the proof we need the followin closure property: ( 2 ) , De nition 4. A horizontal (or vertical) foldin is a function f : of size (m 2n) (or (2m n)) to f (p) of size (m n) which maps a picture p with (f (p))(i j) = (p(i j) p(i 2n − 1 − j)) (or (f (p))(i j) = (p(i j) p(2m − 1 − i j)) ). For a picture lan ua e L we de ne the foldin f (L) = f (p) p L . Lemma 3. The (nonuniformly) reco nizable lan ua es are closed under foldin . Proof. (Sketch of Theorem 4) Because of the last lemma it su ces to restrict to those cases, where we only have to count the di erence of a’s and b’s in the upper left quadrant (we may for example assume the rest to be lled with alternatin stripes of a’s and b’s); by a nite number of foldin s and projectin to the upper left quadrant we et the ori inal lan ua e. Furthermore w.l.o. . we assume the width to be reater than the hei ht.
768
Klaus Reinhardt
The essential idea of the proof is that the counter is constructed from small constant size counters which have di erent order. The orders are powers of 2. The number of occurrences of a counter with order 22 is exponentially decreasin with i similar to the counter used in [F¨ ur82]. Since the order can not be known on the local level (the alphabet is nite but not the order), the advice is needed to tell, when counters can be combined. The constant size counters of a column represent a counter state, which holds the di erence of a’s and b’s left of this column. We simulate a process movin the counter from left to ri ht performin an increment for each a and a decrement 2. The order for each b. Let every cell c have 3 counters c1 c2 c3 , with −2 c of the rst counter is always 1, the order of the second counter depends only on the row: - In the upper half the order is 22 in all rows 2 −1 + j2 for every i j. - In the lower half the order is 22 in the row i for every i. The order of the third counter is 22 −1 if column + n - row= 2 −1 + j2 , where 0 s 2 4 and an n is the hei ht of the picture. A cell c has an advice ca −1 +1 which is ce = 1 if (c) = a and ce = −1 if (c) = b, this e ect ce means an a increments the counter and a b decrements the counter. An example for the order of the counters is the followin : 1 4 2 1 4 512 1 4 2 4 0 4 1 16 8 1 16 2 1 16 512 2 0 1 4 2 1 4 8 1 4 2 4 s 4 1 64 32 1 64 2 1 64 8 2 0 1 4 2 1 4 32 1 4 2 4 0 4 1 16 8 1 16 2 1 16 32 2 s 1 4 2 1 4 8 1 4 2 4 s 4 1 256 128 1 256 2 1 256 8 2 0 with the advice 1 4 2 1 4 128 1 4 2 4 0 4 1 16 8 1 16 2 1 16 128 0 0 1 64 2 1 64 8 1 64 2 0 0 0 1 256 32 1 256 2 1 256 8 0 0 0 1 1024 2 1 1024 32 1 1024 2 0 0 0 1 4096 8 1 4096 2 1 4096 32 0 0 0 1 16384 2 1 16384 8 1 16384 2 0 0 0 1 65536 512 1 65536 2 1 65536 8 0 0 0 c d We allow tiles of the form e f in the followin 5 cases: fa = 0, e1 + fe = f1 , e2 = f2 , c3 = f3 , which means the rst counter has to take the e ect, the second counter is just moved to the next column and the third counter is moved to the next column simultaneously chan in the row fa = s, e1 +fe = f1 , e2 +2c3 = f2 +2f3 , which means additionally the second counter has the double order of the third counter, which allows transfer between them fa = , e1 + fe = f1 , 2e2 + c3 = 2f2 + f3 , which means the second counter has the half order of the third counter
On Some Reco nizable Picture-Lan ua es
769
fa = 2, e1 + fe + 2c3 = f1 + 2f3 , e2 = f2 , which means the rst counter has the half order of the third counter fa = 4, e1 + fe + 2c3 + 4e2 = f1 + 2f3 + 4f2 , which means the rst counter has the half order of the third counter and the forth order of the second counter. A counter of a certain order will meet two times a counter of half order and take their load until it meets a counter of double order, where it can et rid of its load. If it has for example a 1, then it can nondeterministically decide to keep it or to et -1 and increment the counter with double order by 1. Third counters are only allowed leavin the picture at the bottom if they are zero. A picture is in the lan ua e i the tilin system can simulate a process of a counter startin at the leftmost column with zero and endin at the ri htmost column with zero. Acknowled ment: We thank V. Diekert, H. Fernau, K.-J.Lan e, P. McKencie, O. Matz, W. Thomas and T. Wilke for helpful discussions.
References [AR98]
E. Allender and K. Reinhardt. Isolation matchin and countin . to appear in Proc. of 13th Computational Complexity, 1998. [FSV95] Ronald Fa in, Larry J. Stockmeyer, and Moshe Y. Vardi. On monadic NP vs. monadic co-NP. Information and Computation, 120(1):78 92, July 1995. [F¨ ur82] Martin F¨ urer. The ti ht deterministic time hierarchy. In Proceedin s of the Fourteenth Annual ACM Symposium on Theory of Computin , pa es 8 16, San Francisco, California, 5 7 May 1982. [GR96] D. Giammarresi and A. Restivo. Two-dimensional lan ua es. In G. Rozenber and A. Salomaa, editors, Handbook of Formal Lan ua e Theory, volume III. Sprin er-Verla , New York, 1996. [GRST94] Dora Giammarresi, Antonio Restivo, Sebastian Seibert, and Wolf an Thomas. Monadic second-order lo ic over pictures and reco nizability by tilin systems. In P. Enjalbert, E.W. Mayr, and K.W. Wa ner, editors, Proceedin s of the 11th Annual Symposium on Theoretical Aspects of Computer Science, STACS 94 (Caen, France, February 1994), LNCS 775, pa es 365 375, Berlin-Heidelber -New York-LondonParis-Tokyo-Hon Kon -Barcelona-Budapest, 1994. Sprin er-Verla . [IN77] K. Inoue and A. Nakamura. Some properties of two-dimensional on-line tessellation acceptors. Information Sciences, 13:95 121, 1977. [Mat97] Oliver Matz. Re ular expressions and context-free rammars for picture lan ua es. In 14th Annual Symposium on Theoretical Aspects of Computer Science, volume 1200 of lncs, pa es 283 294, L¨ ubeck, Germany, 27 February March 1 1997. Sprin er. [Mat98] Oliver Matz. On piecewise testable, starfree, and reco nizable picture lanua es. In Maurice Nivat, editor, Foundations of Software Science and Computation Structures, volume 1378 of Lecture Notes in Computer Science, pa es 203 210. Sprin er, 1998.
770 [RA97]
[Wil97]
Klaus Reinhardt K. Reinhardt and E. Allender. Makin nondeterminism unambi uous. In 38 th IEEE Symposium on Foundations of Computer Science (FOCS), pa es 244 253, 1997. Thomas Wilke. Star-free picture expressions are strictly weaker than rstorder lo ic. In Pierpaolo De ano, Roberto Gorrieri, and Alberto MarchettiSpaccamela, editors, Automata, Lan ua es and Pro rammin , volume 1256 of Lect. Notes Comput. Sci., pa es 347 357, Bolo na, Italy, 1997. Sprin er.
On the Complexity of Wavelen th Converters? Vincenzo Auletta1 , Ioannis Cara iannis2, Christos Kaklamanis2, and Pino Persiano1 1
Dipartimento di Informatica ed Appl. Universita di Salerno, 84081 Baronissi, Italy auletta, iuper @dia.unisa.it 2 Computer Technolo y Institute Dept. of Computer En ineerin and Informatics University of Patras, 26500 Rio, Greece cara
[email protected]. r, kakl@cti. r.
Abs rac . In this paper we present a reedy wavelen th routin al orithm that allocates a total bandwidth of w(l) wavelen ths to any set of requests of load l (where load is de ned as the maximum number of requests that o throu h any directed ber link) and we ive su cient conditions for correct operation of the al orithm when applied to binary tree networks. We exploit properties of Ramanujan raphs to show that (for the case of binary tree networks) our al orithm increases the bandwidth utilized compared to the al orithm presented in [3]. Furthermore, we use another class of raphs called dispersers, to implement wavelen th converters of asymptotically optimal complexity with respect to their size (the number of all possible conversions). We prove that their use leads to optimal and nearly optimal bandwidth allocation even in a reedy manner.
1
Introduction
Optical ber is rapidly becomin the standard transmission medium for networks. Networks usin optical transmission and maintainin optical data paths throu h the nodes are called all optical networks. Wavelen th division multiplexin (WDM) technolo y establishes connectivity by ndin transmitter receiver paths and assi nin a wavelen th to each path such that no two paths oin throu h the same link use the same wavelen th. Optical bandwidth is the number of available wavelen ths. Current techniques for optical bandwidth allocation cannot uarantee hi h bandwidth utilization under the worst conditions. A promisin solution for efcient use of bandwidth is wavelen th conversion. Devices called wavelen th converters are located at the nodes of the network and they can chan e the wavelen th assi ned to a transmitter receiver path up to a node and allocate a di erent wavelen th at the rest of the path. ?
This work has been partially supported by Pro etto MURST 40% Al orithmi, Modelli di Calcolo e Strutture Informative, EU Esprit Project 20244 ALCOM IT, and Project 3943 of the Greek General Secretariat of Research and Technolo y.
Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 771 779, 1998. c Sprin er-Verla Berlin Heidelber 1998
772
Vincenzo Auletta et al.
Related Work. Several authors have already addressed the case of no wavelen th conversion in tree networks. Ra havan and Upfal [10] showed that routin requests of maximum load l per link of undirected trees can be satis ed usin 3l 2 optical wavelen ths and their ar uments extend to ive a 2l bound for the directed case. Mihail et al. [8] address the directed case. Their main result is a 15l 8 upper bound which was improved to 7l 4 in [4] and independently in [6]. Kaklamanis et al. [5] present a reedy al orithm that routes a set of requests of maximum load l usin at most 5l 3 and prove that no reedy al orithm can o below 5l 3 in eneral. Models for wavelen th routin with converters in trees have been studied in [1,2,3]. The authors present in [1] how to obtain optimal routin in binary tree networks that support l wavelen ths usin converters of de ree 2 l − 1. The model used is actually the one addressed throu hout the current paper. A model with many wavelen th converters in each node of the network is studied in [2]. In that work it is shown how to obtain nearly optimal and optimal bandwidth allocation usin converters of constant de ree. This result refers to binary trees as well. A wavelen th routin al orithm of any pattern of requests of load l in arbitrary tree networks with 3l 2 + o(l) wavelen ths usin converters of polylo arithmic de ree is also presented in [2]. Gar ano in [3] presents an al orithm that uarantees e cient wavelen th routin in arbitrary trees under a di erent network model of limited wavelen th conversion. She also extends the optimal result of [2] in quasi binary trees. Network Model. We model the underlyin ber network as a directed raph. Connectivity requests are ordered pairs of nodes, to be thou ht of as transmitter receiver paths. For networks with unique transmitter receiver paths (such as trees), the load l of a directed ber link is the number of paths oin throu h the link. Each directed ber link can support w(l) wavelen ths 1 2 w(l) , with distinct optical frequencies. Current approaches to the wavelen th assi nment problem in trees use reedy al orithms [4,5,6,8]. Intuitively we can think of wavelen ths as colors and the procedure of wavelen th assi nment as colorin . A reedy al orithm visits the network in a top to bottom manner and at each vertex v colors all requests that touch vertex v and are still uncolored. Moreover, once a request has been colored it is never recolored a ain. Althou h reedy al orithms are important as they are very simple and amenable of bein implemented in a distributed settin , they cannot uarantee a bandwidth utilization hi her than 60% [5]. Furthermore, no al orithm can uarantee bandwidth utilization better than 80% [6] if wavelen th conversion is not supported. A wavelen th converter is represented by a bipartite raph G(U V E). For each wavelen th i , there exist two vertices ui U and vi V in the bipartite raph ( U = V = w(l)). The set of ed es E is de ned as follows: (ui vj ) E the wavelen th i can be converted to the wavelen th j . Previous work on wavelen th conversion consider that the cost of the converters depends on their wavelen th de ree, i.e. the maximum de ree of any node u U of the correspondin bipartite raph. Another factor that is expected to
On the Complexity of Wavelen th Converters
773
influence the cost of a converter is its size, i.e. the number of ed es in its bipartite raph (the number of all possible conversions). We can de ne the class of reedy al orithms for networks that support wavelen th conversion. Such al orithms visit the network in a DFS manner but the functionality in a node u that supports wavelen th conversion is di erent. In this case, the reedy al orithm colors the se ments of a request that touch u. Thus, a reedy al orithm may assi n a di erent color for a request that has been colored in a previous step, so that the wavelen th correspondin to the old color can be converted to the new one by the wavelen th converter located at node u which is responsible for the conversion of that request. Converters are placed at network nodes as follows. The tree network is rooted at a prede ned node. At each non leaf node u of de ree d+1 d > 1 with a parent vd , there are 2d converters C1 C2 C2d−1 C2d . Converter f and children v1 i d is responsible for the conversion of the wavelen ths assi ned C2i−1 1 to the set of requests R2i−1 , which comes from the parent node f and oes to i d is responsible for the conversion of the the child vi . Converter C2i 1 wavelen ths assi ned to the set of requests R2i , which comes from the child vi and oes to the parent node f . Summary of results. We start with some preliminary de nitions and lemmas in section 2. In section 3 we present a reedy wavelen th routin al orithm for binary tree networks with converters. As a rst application, we use Ramanujan raphs as converters and prove that our al orithm utilizes the two thirds of the bandwidth wasted by the al orithm presented in [3] (when a Ramanujan raph of a iven de ree is used as converter in both cases). Next we exploit properties of dispersers to present upper bounds on the size of the converters in order to reedily achieve optimal and almost optimal (w(l) = l+o(l)) bandwidth allocation. These results are presented in section 4. In section 5 we prove that our upper bounds are asymptotically ti ht for reedy al orithms. Also, we prove that the 2 l − 1 upper bound on the de ree of the converters presented in [1] is asymptotically ti ht as well.
2
Preliminaries
As in [2,3] we will exploit expansion properties of k re ular bipartite raphs to build wavelen th converters. The followin lemma states Tanner’s inequality which relates the expansion of a raph with the value of its second ei envalue. Lemma 1. Let G(U V E) with U = V = n be a k re ular bipartite raph. For any X U , k2 N (X) 2 + (k 2 − 2 ) X n X where value.
is the second lar est ei envalue of the adjacency matrix of G in absolute
774
Vincenzo Auletta et al.
Ramanujan raphs have the property that their second ei envalue is upper bounded by 2 k − 1. Furthermore, these raphs have been explicitly constructed in [7]. In this work we also exploit properties of another class of bipartite raphs called dispersers. De nition 1. [11] A bipartite raph G = (U V E) is an (K ) disperser if for each subset A U of size K there are at least (1 − ) V vertices of V that are adjacent to A. Sipser showed in [11] that such raphs exist. An almost optimal explicit construction of dispersers is reported in [12]. Lemma 2. [11] There exist a (K ) disperser G(U V E) with U = N and 2 (1 + V = M , such that each node v U has de ree max 2M K (1 + ln 1 ) ln N K . The properties of dispersers have been used for the construction of asymptotically optimal depth two superconcentrators. De nition 2. A N superconcentrator is a directed raph with N distin uished vertices called inputs, and N other distin uished vertices called outputs, such that for any 1 k N , any set X of k inputs and any set Y of k outputs, there exist k vertex disjoint paths from X to Y . The size of a superconcentrator G is the number of ed es in it, and the depth of G is the number of ed es in the lon est path from an input to an output. Lemma . [9] Depth two N superconcentrators have size
2 N lolo lo NN .
The construction of [9] produces a depth two superconcentratorH(U V W E) with U = W = N and V = 2N . We sli htly extend their ar uments to obtain the followin lemma. Lemma 4. There exist a depth two superconcentrator G(U V W E) of size lo 2 N O N lo lo N with U = ui 1 i N , V = vi 1 i N , W = wi 1 i
3
N , such that for any 1
i j
N , (ui vj )
E
(vi wj )
E.
The Wavelen th Routin Al orithm
In this section we describe a reedy wavelen th routin al orithm that allocates optical bandwidth of w(l) available wavelen ths to any set of communication requests of load l on a binary tree network. Four wavelen th converters C1 ,C2 ,C3 ,C4 are placed at each node as described. We denote by S the set of available wavelen ths (colors). Startin from a node, the al orithm computes a DFS numberin of the nodes of the tree. The al orithm proceeds in phases, one per each node u of the tree.
On the Complexity of Wavelen th Converters
775
The nodes are considered followin their depth rst numberin . The phase associated with node u assumes that we already have a partial proper colorin where the se ments of requests (paths) that touch nodes with numbers strictly smaller than u’s have been colored and no other se ments have been colored. Consider a phase of the al orithm associated with a node u. Let f be the parent node of u and v,w its children. Let A1 be the set of colors assi ned to the set R1 of the requests from f to v, A2 the set of colors assi ned to the set R2 of the requests from v to f , A3 the set of colors assi ned to the set R3 of requests from f to w, and A4 the set of colors assi ned to the set R4 of requests from w to f . These colors are used only in se ment (f u). Also let R5 be the set of requests from v to w and R6 the set of requests from w to v. We i nore requests than start or end at u since they can be colored easily. The al orithm performs two independent steps: Step 1: Converters C1 and C4 are set in such way that: C1 converts the color assi ned to the se ment (f u) of each request r R1 to a color that is assi ned to the se ment (u v) of r. C4 converts a color that is assi ned to the se ment (w u) of each request r R4 to the color assi ned to the se ment (u f ) of r. Let A01 and A04 the set of colors assi ned to the se ments (u v) and (w u) of the requests R1 and R4 , respectively. The al orithm maintains the followin invariants: 1. Se ments (u v) of the requests R1 are assi ned di erent colors ( A01 = A1 ) and se ments (w u) of the requests R4 are assi ned di erent colors ( A04 = A4 ). min R1 R4 − w(l) + l. 2. A01 \ A04 Requests R6 are assi ned colors from S (A01
A04 ).
Step 2: This step is symmetric to step 1. Converters C2 and C3 are set and the uncolored se ments of requests R2 ,R3 , and R5 are colored in a similar way. The followin lemma ives su cient conditions for the correctness of our al orithm. Lemma 5. Let H(A B E(H)) be the bipartite raph that corresponds to the i w(l) and B = bi 1 i w(l) ). wavelen th converter (A = ai 1 i Consider the three level raph G(U V W E(G)) such that U = ui 1 w(l) ,V = vi 1 i w(l) , W = wi 1 i w(l) , and E(G) = (ui vj ) (ai bj )
E(H)
(vj wi ) (ai bj )
E(H)
The wavelen th routin al orithm correctly assi ns w(l) colors to any set of communication requests of load l on a binary tree network with wavelen th converters l, the followin H if for any sets Γ1 U and Γ2 W of cardinalities Γ1 Γ2 conditions hold:
776
Vincenzo Auletta et al.
1. There exist sets X Γ1 and Z Γ2 of cardinality k = X = Z min Γ1 Γ2 − w(l) + l such that there exist k vertex disjoint paths from X to Z. 2. Let Y V the set of vertices of V that belon s to the k disjoint paths. The set Γ1 X has a matchin of cardinality Γ1 X with vertices of V Y , and the set Γ2 Z has a matchin of cardinality Γ2 Z with vertices of V Y . Proof. We concentrate on step 1 of the al orithm at a node u. The proof is identical for step 2. Assume that at the current step the al orithm has colored the se ments (f u) of the requests R1 and R4 . Consider the color assi ned to the se ment (f u) of a request r1 R1 as a vertex of U and a color assi ned to the se ment (u f ) of a request r4 R4 as a vertex of W . The mate vertex of V that is connected with an ed e (implied by the two conditions) to a vertex of U is the color assi ned to the se ment (u v) of r1 , while the mate vertex of V that is connected with an ed e to a vertex of W is the color that will be assi ned to the se ment (w u) of r4 . Both conditions maintain that requests of R1 are assi ned di erent colors in se ment (u v) (similarly for the requests of R4 in se ment (w u)). Furthermore, condition 1 uarantees that the invariant 2 of the al orithm is satis ed. Thus the al orithm can assi n the remainin colors (correspondin to vertices of V that have no mates to U or V ) to requests of R6 . The al orithm is correct even if sets Γ1 and Γ2 have the same cardinality. The second condition can be eliminated if the bipartite raph H of the wavelen th converter has a perfect matchin (which always holds). Formally Lemma 6. Let H and G be the raphs de ned in lemma 5. H has a perfect U , Γ2 W of the same cardinality g, there matchin and for any sets Γ1 Γ2 of cardinality k = X = Z g − w(l) + l exist sets X Γ1 and Z such that there exist k vertex disjoint paths from X to Z. Let Y V the set of vertices of V that belon s to the k disjoint paths. Then the set Γ1 X has a matchin of maximum cardinality g − k with vertices of V Y , and the set Γ2 Z has a matchin of maximum cardinality g − k with vertices of V Y . As a corollary, when the cardinality of R1 and R4 is small, no vertex disjoint paths need to be found. In particular, Corollary 1. Consider a node u of a binary tree network of w(l) > l available wavelen ths and wavelen th converters H, and a pattern of requests of maximum w(l) − l, then the uncolored se ments of R1 R4 , and R6 load l. If R1 = R4 have a proper wavelen th assi nment with w(l) wavelen ths. The followin lemma ives a condition for the existence of vertex disjoint paths when the cardinality of R1 and R4 is lar e. Lemma 7. Let G(U V W E) be a three level raph with U = W = w(l). If U and Γ2 W of cardinality k with w(l) − l < k l there for any sets Γ1 exist k − w(l) + l common nei hbors in V , then for any sets A U B W of cardinality k l, there exist subsets X A and Z B such that there exist k − w(l) + l vertex disjoint paths from X to Z.
On the Complexity of Wavelen th Converters
777
Proof. By Men er’s theorem provin that the minimum cut has size at least k − w(l) + l.
4
Upper Bounds
Theorem 1. Let T be a binary tree network and w(l) be the available number of wavelen ths on each link. Usin (explicitly constructible) converters of de ree k, it is possible to reedily assi n wavelen ths to any set of requests of load 4(k−1) w(l). l 1 − 3(k−2) 2 Proof. We use a k re ular Ramanujan raph H as converter with w(l) wavelen ths. We construct the three level raph G. Let X U , such that X > w(l) − l. It can be veri ed that N (X)
k2 X 4(k − 1) + (k − 2)2 X w(l)
l+ X 2
U and where N (X) is the nei hborhood of X in V . Thus, for any sets Γ1 Γ2 W of cardinality k with w(l) − l < k l, there exist k − w(l) + l common nei hbors in V . H has a perfect matchin , thus, by lemmas 7 and 6 the conditions of lemma 5 hold. The theorem follows. The result of [3] and theorem 1 imply the followin . Theorem 2. Let 1 < f (l) = o(l). There exist converters of size O(lf (l)) that l wavelen ths. allow routin of requests of load l usin at most l + f (l) Next we show better tradeo s between the unutilized bandwidth and the size of the converters under our network model. Lemma 8. Let f (l) = o(l). There exists a 2three level raph G(U V W E) with l with size O l lolo lo ff(l)(l) such that for any sets X U U = V = W = l + f (l) and Y W with cardinality k with nei hbors.
l f (l)
< k
l there exist l −
l f (l)
common
l . We build a three level Proof. The proof is based on [9]. Let w(l) = l + f (l) raph (A = [w(l)] C = [w(l)] B = [w(l)] E). Let C = Cis where Cis is de ned w(l) lo f (l) i+1 f (l) , as follows. Let is = lo lo 3f (l) − 1, i0 = lolo l−lo lo f (l) , and Ci = 3 lo Ci+1 , for i0 i is − 1. For every i put a i = i0 is , such that Ci K = lo i f (l) = 13 disperser Di = (A Ci Ei ) and another (K ) disperser between B and Ci . Also, put a copy of the ed es between A C between C A and C B and (symmetric) 15 re ular ramanujan raphs H1 = (A C E(H1 )) and H2 = (B C E(H2 )) (in order raphs (A C) and (C B) can correspond to identical wavelen th converters). K lo i+1 f (l), for every set X A of cardinality K, its For lo i f (l) 2jCi j B of nei hborhood N (X) has size at least 3 . Similarly for each set Y
778
Vincenzo Auletta et al.
cardinality K, N (Y ) X and Y is at least jC3i j
2jCi j 3 .
Thus the number of the common nei hbors of l l K − f (l) . This holds for any K with f (l) = w(l) w(l) i0 is +1 f = 3 . lo f (l) K lo 3 Applyin the Tanner’s inequality to the ramanujan raph H1 , we have that w(l)+K nei hbors in C. for any set X A of cardinality K > w(l) 3 , there are 2 A and Y B of The same ar ument holds for H2 and thus any two sets X w(l) l cardinality K > 3 have at least K > K − f (l) common nei hbors. It can be veri ed that the total size of the converters used in the above 2 construction is O l lolo lo ff(l)(l) . K
2 Theorem . Let f (l) = o(l). There exist converters of size O l lolo lo ff(l)(l) that allow reedy routin of requests of load l usin at most l +
l f (l)
wavelen ths.
Proof. We use the converter implied by lemma 8. The theorem follows by lemmas 7, 6, and 5. Usin as a converter the half part of the depth two superconcentrator of lemma 4, we obtain the followin . 2 Theorem 4. There exist converters of size O l lolo lo l l that allow reedy routin of requests of load l usin at most l wavelen ths.
5
Lower Bounds
In [1] it is shown that if the binary tree network has wavelen th converters with de ree 2 l−1, under this model it is possible to route all possible sets of requests of load l with l wavelen ths. Next we show that this result is asymptotically ti ht. Theorem 5. Let T be a binary tree network supportin l wavelen ths. Then, wavelen th converters of de ree Ω( l) are necessary to uarantee that all sets of requests of load l can be routed on T by a reedy deterministic al orithm. Proof. Consider a node v of the tree. Assume that there is one request from the parent p of v to the left child u colored with a color c1 , one request from the ri ht child w to the parent colored with c2 and l − 1 requests from w to u. Since no conversion is supported for requests from w to u, the color c1 must be converted to a color that can be converted to c2 . We can create a pattern on a su ciently lar e tree T such that a color c1 must be converted to colors that can be converted to all colors c1 cl . Assume that the converter translates c1 to k colors. Then there must be a color ci that can be converted to at least l k colors. Thus the de ree of the converter must be at least min k l k = l. The followin theorems state that the upper bounds of theorems 3 and 4 are asymptotically ti ht as well. The proofs are omitted.
On the Complexity of Wavelen th Converters
779
Theorem 6. Let T be a tree supportin l wavelen ths. Then, wave network lo 2 l len th converters of size Ω l lo lo l are necessary to uarantee that all sets of requests of load l can be routed on T by a reedy deterministic al orithm. l Theorem 7. Let f (l) = o(l) and T be a tree network supportin w(l) = l + f (l) 2 wavelen ths. Then, wavelen th converters of size Ω l lolo lo ff(l)(l) are necessary to uarantee that all sets of requests of load l can be routed on T by a reedy deterministic al orithm.
References 1. V. Auletta, I. Cara iannis, C. Kaklamanis, P. Persiano, Bandwidth Allocation Al orithms on Tree Shaped All Optical Networks with Wavelen th Converters . In Proc. of SIROCCO ’97, 1997. 2. V. Auletta, I. Cara iannis, C. Kaklamanis, P. Persiano, E cient Wavelen th Routin in Trees with Low De ree Converters . In Proc. of the DIMACS Workshop on Optical Networks, 1998, to appear. 3. L. Gar ano, Limited Wavelen th Conversion in All Optical Tree Networks . In Proc. of ICALP ’98, 1998, to appear. 4. C. Kaklamanis, P. Persiano, E cient Wavelen th Routin on Directed Fiber Trees . In Proc. of the 4th European Symposium on Al orithms (ESA ’96), LNCS, Sprin er Verla , 1996, pp. 460 470. 5. C. Kaklamanis, P. Persiano, T. Erlebach, K. Jansen, Constrained Bipartite Ed e Colorin with Applications to Wavelen th Routin . In Proc. of ICALP ’97, LNCS 1256, Sprin er Verla , 1997, pp. 493 504. 6. V. Kumar, E. Schwabe, Improved Access to Optical Bandwidth in Trees . In Proc. of the 8th Annual ACM SIAM Symposium on Discrete Al orithms, 1997. 7. A. Lubotsky, R. Philipps, P. Sarnak, Ramanujan Graphs . Combinatorica, vol. 8, pp. 261 278, 1988. 8. M. Mihail, C. Kaklamanis, S. Rao, E cient Access to Optical Bandwidth . In Proc. of the 36th Annual Symposium on Foundations of Computer Science, pp. 548 557, 1995. 9. J. Radhakrishnan, A. Ta-Shma, Ti ht Bounds for Depth-Two Superconcentrators . In Proc. of the 38th Annual Symposium on Foundations of Computer Science, 1997. 10. P. Ra havan, E. Upfal, E cient Routin in All-Optical Networks . In Proc. of the 26th Annual ACM Symposium on the Theory of Computin , 1994, pp. 133 143. 11. M. Sipser, Expanders, randomness, or time versus space . Journal of Computer and System Sciences, 36:379 383, 1988. 12. A. Ta Shma, Almost Optimal Dispersers . In Proc. of STOC ’98, 1998, to appear.
On Boolean vs. Modular Arithmetic for Circuits and Communication Protocols Carsten Damm University of Trier, Department of Computer Science D-54296 Trier, Germany damm@un -tr er.de http://www. nformat k.un -tr er.de/ damm/
Abs rac . We compare two computational models that appeared in the literature in a Boolean settin and in an analo settin based on modular arithmetic. We prove that in both cases the arithmetic version can to some extend simulate the Boolean version. Althou h the models are very di erent, the proofs rely on the same idea based on the Schwartz-ZippelTheorem. In the rst part we prove that depth d semi-unbounded Boolean circuits can be simulated by depth 2d + O(lo d + lo n) semi-unbounded arithmetic circuits, re ardless of the size. This is an improvement on a similar construction in [3] that achieves depth 3d + O(lo s + lo n), where s is the size of the ori inal circuit. Our construction is simpler and uses fewer random bits. In the second part we prove, that two-party parity communication protocols can approximate nondeterministic communication protocols. A strict simulation of one by the other is impossible as was shown in [2].
1
Introduction
We present two randomized simulations of Boolean computational models by their correspondin parity models. The rst results of this kind are due to SAC 1 poly, where [4,3], who prove NL poly L poly and SAC 1 poly the latter are the classes of Boolean functions computable by polynomial size, lo arithmic depth semi-unbounded circuits with unbounded OR- and PARITY ates, respectively (de nitions to follow). Our results are inspired by a recent paper by Beimel and Gal [1], who ive an improved simulation for NL poly L poly. The ori inal proof for this (as SAC 1 poly) in [3] was shown on base of well as for the result SAC 1 poly the Isolation Lemma of Mulmuley et al. [7]. The Isolation Lemma is a means to isolate with hi h probability a unique minimal certi cate from a non-empty set of certi cates by addin random wei hts. Hence, an odd number of certi cates is isolated, which can be used to translate an existential computation into a parity computation. Actually, uniqueness is more than is needed to do this translation. It was shown in [8] that this aspect can be exploited further. The proof of [1] relies on testin of polynomial identities. We apply the technique Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 780 788, 1998. c Sprin er-Verla Berlin Heidelber 1998
On Boolean vs. Modular Arithmetic
781
to semi-unbounded circuits. We obtain an alternative and simpler proof for the SAC 1 poly rst shown in [3]. Further this ives containment SAC 1 poly better depth bounds and the depth of our simulation is independent from the size of the circuits. In the second part we consider a similar question, namely to what extend can parity communication protocols simulate nondeterministic protocols. A simulation as in the circuit case is not possible, since there are functions whose parity communication complexity is exponentially lar er than their nondeterministic communication complexity. So the best we can hope for is an approximation result. We show basically alon the same lines as in the rst part, that parity communication protocols can approximate nondeterministic protocols with only small increase in len th. There is nothin special about considerin parity, i.e., arithmetic modulo 2. When workin modulo a xed prime p, everythin remains true1 . The same holds for the case of a composite modulus: e. ., acceptance modulo 6 can simulate acceptance modulo 2 and acceptance modulo 3, as has been formally proved for a lot of other computational models. We will not o further into these issues. Throu hout lo stands for lo 2 .
2
De nitions
2.1
Circuits
xn x1 xn is a pair A Boolean semi-unbounded circuit on Xn = x1 C = (G ), where G = (V E) is a directed acyclic raph with set of vertices V , . The vertices of G are set of ed es E, and vertex labelin :V Xn called the ates of C. If ( 0 ) E then 0 is called an input to . We denote the set of inputs to a speci c ate by I( ). The size of I( ) is the fan-in of . Accordin to their label we distin uish the ates into input ates, - ates and - ates. Further we require that input ates have fan-in 0. The other ates have fan-in at least 1 and the fan-in of - ates is at most 2. The size of a circuit is it’s number of ates, the depth is the len th (number of ed es) of the lon est path from an input to an output ate (these are the ates that are not input to any ate). Finally we assume the circuit has one distin uished output ate . In the usual way an input 0 1 n assi ns to each ate of C a Boolean value val( ) which is used to de ne the Boolean function computed at this ate. Formally: ) = i or 1) If I( ) = then ( ) is xi or xi for some i. In this case val( val( ) = 1 − i , respectively. 2) If I( ) = then val( ) is the lo ical OR or the AND of the val( 0 ) with 0 I( ) accordin to whether ( ) = or ( ) = . 1
An appropriate notion of modulo p acceptance is: accept, if the number of certi cates is not divisible by p.
782
Carsten Damm
The function computed by C is de ned by C( ) = val( ). Analo ously we de ne arithmetic semi-unbounded circuits over the eld GF (2) = ( 0 1 ) by replacin in the de nition above by , by (multiplication), and lo ical OR by the sum modulo 2. If no confusion can arise or if statements hold for both models we speak just of semi-unbounded circuits. 2.2
Communication Protocols
Let X and Y be disjoint sets. We consider two-party communication ames on X Y : the players share an input (x y) X Y , where access is restricted to x for one player and to y for the other. They exchan e bits subject to a iven communication protocol. In the deterministic version the communicated bit is determined by the accessible part of the input and the communication history. In a nondeterministic protocol (which is basic for our considerations) there may additionally be situations, in which the player in turn may nondeterministically choose the bit to be sent. In either case, at each step the bit to be communicated is chosen from a nonempty set of bits determined by the accessible part of the input and the communication history. The protocol speci es a pre x-free set of complete communication strin s (we call them simply communications). Hence players can tell from the communication strin whether the ame is over. A subset of the communications is distin uished as acceptin . The 0 1 computed by P depends on the number aP (x y) of function fP : X Y acceptin computations of P on (x y): If P is interpreted nondeterministically, then fP (x y) = 1 i aP (x y) > 0, if P is interpreted as parity protocol, then fP (x y) = 1 i aP (x y) is odd. Now we ive a formal de nition: a communication protocol on X Y is a directed full binary tree P = (V E) with speci c ed e and node labelin . The ed es leavin an inner node are labeled 0 and 1, respectively. The inner nodes are partitioned into X - and Y -nodes. Let Z be any of the types X and Y. Each 0 1 0 1 , where we Z -node v is labeled by some mappin bv : Z write bv (x y) to uniquely denote bv (x) or bv (y). Each node v is a state in the communication process and the type of the actual node determines the player in turn. bv (x y) is the set of bits from which this player chooses the next messa e upon seein her input and the exchan ed bits v. Further the leaves of the tree are labeled by 0 or 1. Adoptin this formalism, a communication of P on input (x y) X Y pt of the tree such that for 1 i t is a non-extendible path p = p1 p2 bp0 p1 pi−1 (x y), where we identify nodes with the strin of ed e holds pi labels alon the path from the root to the node. Acceptin communications are those paths that reach a leaf labeled by 1. The len th of a protocol is the maximum over all inputs (x y) of the maximal len ths of communications on this inputs. Consider a function f : X Y 0 1 . The nondeterministic communication complexity of f is the minimum len th of a nondeterministic communication protocol computin f . The parity communication complexity is the minimum len th of a parity communication protocol computin f . We denote
On Boolean vs. Modular Arithmetic
783
the nondeterministic and parity communication complexities of f by cn (f ) and c (f ), respectively.
3
Simulatin Boolean Circuits by Arithmetic Circuits
We are oin to prove the followin result: Theorem 1 Any Boolean semi-unbounded circuit C of size s and depth d = d(n) can be simulated by a size sO(1) arithmetic semi-unbounded circuit over GF (2) with depth 2d + lo (d + 2) + lo n + 2. To prove this we need some technical preparations. Observation 2 Any semi-unbounded circuit can be transformed into strictly alternatin form, i.e., into a circuit whose ates are or anized in levels, such that each ate has inputs only on the precedin level and the type of ates alternates from one level to another. Further we require, that the rst level above the input ates is a -level. Translation of an arbitrary circuit into this form requires doublin of depth and only polynomial size blow-up. Let k be a eld. We identify the Booleans 0 and 1 with the eld elements 0 1. Let E be the set of ed es in the raph G underlyin C. Consider a sequence 0 1 n de nes polynomials p k[z] z = (ze )e2E of indeterminates. Each in the followin way: ) is an input ate, then p = val( is an inner ate with inputs 1 r zei and if ( ) = put p = i=1 p i for i = 1 r.
1) If 2) If
We denote the polynomials p
r
k[z]. then if ( ) = put p r p , where e = ( i ) i i i=1
= E
assi ned to the output ate by p .
Observation If the depth of C is d, then de p < 2d+1 . More accurately, if on each path from an input ate of the circuit to the output ate there are at most d - ates, then de p < 2d+1 . Lemma 4 p = 0 (the zero polynomial) if and only if C( ) = 0. G Proof: Let a certi cate for C( ) = 1 be a sub raph G0 = (V 0 E 0 ) V 0 and for each ate in G0 holds: 1) val( ) = 1 and 2) if such that is a - ate, then each input 0 to belon s to G0 , and if is a - ate, then exactly one input 0 to belon s to G0 . By doublin of ed es a certi cate G0 for ( ) = 1 can be expanded into a tree TG . For each certi cate G0 for ( ) = 1 m(e) consider the monomial MG = e2E ze , where m(e) is the multiplicity of e 0 in T (G ). Now it is easy to see, that p = G MG , where the sum runs over all certi cates for C( ) = 1. Since di erent certi cates lead to di erent monomials, the monomials cannout cancel out each other, re ardless of the eld. Clearly, C( ) = 1, if and only if there is a certi cate for C( ) = 1. Hence, p = 0 if and only if val( ) = 0.
784
Carsten Damm
Lemma 5 If k 2d+2 then there exist assi nments w1 wn : E k such that for all 0 1 n holds C( ) = 0 if and only if p (wi ) = 0 for all i = 1 n. For the proof we need the followin result (see [6]): zt ] be a polynomial Lemma 6 (Schwartz-Zippel Theorem) Let p k[z1 rt are chosen indepenof total de ree D and let S k be a nte set. If r1 dently and uniformly at random from S, then Pr[p(r1
rt ) = 0 p = 0]
D S
Proof of Lemma 5. By Observation 3 and Lemmas 4 and 6 for uniformly and randomly chosen w : E k holds Pr[p (w) = 0] < 1 2 if C( ) = 0. wn , we obtain Pr[p (w1 ) = = Takin n independent random trials w1 p (wn ) = 0] < 1 2n if C( ) = 0. This means for less than a 1 2n -fraction wn ) there is joint disa reement. By a standard countin of all tuples (w1 wn ) for which there is joint disa reement ar ument there is one tuple (w1 on less than a 1 2n -fraction of all input assi nments . Since there are only i : p (wi ) = 0. On 2n input assi nments, for this choice holds: C( ) = 0 the other hand, if C( ) = 0 then clearly p (wi ) = 0 for all i. This proves the claim. Now we introduce wei hted arithmetic circuits similar to the arithmetic branchin pro rams introduced in [1]. A wei hted arithmetic circuit over a eld k is a circuit C to ether with a wei ht function w : E k (where G = (V E) is the underlyin raph). The ates perform eld arithmetics over the wei hted inputs. We restrict consideration to wei ht functions that assi n wei ht 1 to ed es feedin into - ates Wei hted arithmetic circuits de ne Boolean functions in the sense that the computed value is 1 if and only if the value (a eld element) propa ated to the output ate is di erent from 0 k. By xin a wei ht function w we can to each Boolean circuit C assi n an arithmetic circuit (C w) just by interpretin Boolean ates as correspondin arithmetic ates ( for product and for sum). More formally: Let C = ((V E) ) and w : E k. In the followin way an n k assi ns to each ate of C a value valw ( ) k: input 0 1 is an input ate, then p = val( is an inner ate with inputs 1 r ) w(ei ) and if ( ) = i=1 valw ( i r. where ei = ( i ) E for i = 1
1) If 2) If
)
0 1 k. then if ( ) = put valw ( put valw ( ) = ri=1 valw (
r
The Boolean function computed by (C w) is de ned by Cw ( ) = 0 if valw ( 0 and Cw ( ) = 1 otherwise. Observe that for all w : E k as above and 0 1 n holds valw ( p (w). Thus by Lemma 5 we obtain immediately:
i
)= ),
)=
)=
On Boolean vs. Modular Arithmetic
785
Corollary 7 Let C be a Boolean semi-unbounded circuit on n variables. If k (C wn ) over k such 2d+2 then there exist wei hted arithmetic circuits (C w1 ) n that for 0 1 n holds C( ) = i=1 Cwi ( ). In the sequel we consider only nite elds k. Throu hout let T = k . Lemma 8 Let (C w) be a depth d semi-unbounded wei hted arithmetic circuit over k. There is an semi-unbounded wei hted arithmetic circuit (C 0 w0 ) of depth 0 = Cw . d + lo T + 1 with Cw 0 is a roup of order T − 1 under Proof: Let a k a = 0. Since k = k multiplication, we have aT −1 = 1 (see, e. ., [5]). This exponentiation can be modeled by au mentin a binary tree of product- ates on top of a wei hted arithmetic circuit. In the resultin circuit each 0 1 n assi ns only values v = 1 or v = 0 to the output ate. The ne ation of v is 1 − v, which can be accomplished by a nal - ate with appropriate wei hts at incomin ed es. For 0 = Cw . the wei hted arithmetic circuit (C 0 w0 ) thus obtained holds Cw Lemma 9 Let C be a Boolean semi-unbounded circuit of depth d on n variables. If k 2d+2 then there exists a wei hted arithmetic circuit (C 0 w) over k such 0 ( ) and the depth of C 0 is at most d + that for 0 1 n holds C( ) = Cw lo k + lo n + 2. n
Proof: Observe that by the corollary C( ) = ( i=1 Cwi ) for appropriate wn . By Lemma 8 the inner ne ations increase the depth by lo k + 1 w1 and the product increases the depth by lo n . The resultin circuit is 0-1valued , hence the nal ne ation needs only one additional ate on top. Note that in both constructions the increase in size is a polynomial in the size of the ori inal circuit and the size of the eld. Now we are ready to prove the simulation: small depth Boolean semi-unbounded circuits can be simulated by small depth arithmetic semi-unbounded circuits. Proof of Theorem 1: First we describe a simulation that achieves depth 3d + 2 lo n + 4. We describe a further improvement afterwards. Translate C into strictly alternatin normal form as in Observation 2. This increases the depth to at most 2d, however the de ree of the p is still bounded by 2d+1 by Observation 3. By Lemma 9 there exists a polynomial size wei hted arithmetic circuit C 0 over the eld k = GF (2d+2 ) with depth 3d+ lo n +4 computin the same function. This circuit can be simulated by a semi-unbounded circuit G00 over GF (2), similar to the simulation of arithmetic branchin prorams over GF (q d ) by those over GF (q) in [1]. The simulation relies on the fact, that each eld element of k is an univariate polynomial over GF (2) reduced modulo an irreducible polynomial of de ree d + 2. Hence, eld elements a k can naturally be represented as vectors va in (GF (2))d+2 , where addition in k translates to component-wise addition in GF (2), and multiplication in k translates into a sum of products in GF (2) (details omitted). Thus, levels of sum- ates in C 0 are simulated by a sin le sum-level in C 00 and levels of product ates in C 0 are simulated by a sum-level followed by a product level. Since the rst 2d
786
Carsten Damm
levels of C 0 are strictly alternatin , those can be simulated by 2d levels in C 00 . The tree of product- ates in C 0 requires 2 lo n depth in C 00 , hence alto ether we have depth 3d + 2 lo n + 4. The improvement to depth 2d + lo (d + 2) + lo n + 2, as promised, can be achieved by the followin strate y (instead of the above): 1) translate into alternatin form, 2) simulate each (C wi ) over GF (2) to 0-1-output, and 3) compute the OR of the results. For step 2) lo (d + 2) levels are su cient (to test whether at least one of d + 3 components is di erent from 0). Remark 10 The simulation in [3], achieves depth of order 3d + lo n + lo s + O(1), where s is the size of the ori inal circuit. Observe that in our simulation the depth of the simulatin circuit does not depend on the size of the ori inal circuit. Further their construction uses at least Ω(n(m lo m + d)) random bits, where m is the number of ed es in the Boolean circuit. Our construction uses only O(n m0 d) random bits, where m0 is the number of input ed es to - ates of the Boolean circuit, which is much less in case of lar e ciruit size.
4
Approximatin Nondeterministic Protocols by Modular Protocols
It is known, that nondeterministic and parity communication complexity are incomparable: there are functions whose nondeterministic communication complexity is exponentially lar er than it’s parity communication complexity and vice versa [2]. However, we prove that the approximative parity communication complexity of a function is not much reater than it’s nondeterministic communication complexity. To ive an exact formulation, we denote for iven > 0 by c1 (f ) the minimal len th of a parity communication protocol computin f correctly on all inputs with exception of at most an -fraction of the inputs in 0 1 computed by the parity protocol f −1 (1), i.e., for the function : X Y holds Pr[ (x y) = 0 f (x y) = 0] = 1 and Pr[ (x y) = 0 f (x y) = 1] if (x y) X Y is chosen at random. Theorem 11 Let f : X
Y
0 1 and
> 0. Then
c1 (f ) = O(cn (f ) lo cn (f )) For the proof we introduce the followin model. Let k be a eld. An arithmetic communication protocol over k with respect to the input space X Y is a communication protocol P = (V E) on X Y to ether with a wei ht function w : E k. The notions communication , acceptin comunication , and len th carry over from the base model. The function f : X Y 0 1 computed pt of P let by (P w) is de ned as follows: for a communication p = p1 p2 valw (p) = e2p w(e), where e p means, that e is an ed e in the path p. We de ne f (x y) = 1 i p2AP (x y) valw (p) = 0, where AP (x y) denotes the set of acceptin communications of P on (x y).
On Boolean vs. Modular Arithmetic
787
The arithmetic communication complexity of f over k is the minimum len th of an arithmetic communication protocol over k that computes f . We denote this complexity by ck (f ). Finally, we denote by c1k (f ) the minimal len th of an arithmetic communication protocol over k that computes a function : X Y 0 1 such that Pr[ (x y) = 0 f (x y) = 0] = 1 and Pr[ (x y) = 0 f (x y) = 1] if (x y) X Y is chosen at random. Lemma 12 Let then
> 0 and f : X
Y
0 1 . If k is a eld with k
c1k (f )
cn (f ) ,
cn (f )
Proof. Let P = (V E) be a nondeterministic communication protocol of len th E consider an indeterminate t = cn (f ) that computes f . For each ed e e ze . Obviously the polynomial q(x y) ((ze )e2E ) := p2AP (x y) e2p ze vanishes if and only if there is no acceptin computation of P on (x y) if and only if f (x y) = 0. Observe that the de ree of q(x y) is t. Let S k be a set of size at least cn (f ) . By Lemma 6 we know that, if q(x y) 0, then for randomly chosen w = (we )e2E S jEj holds Pr[q(x y) (w) = 0]
t S
By a standard double countin ar ument there is at least one vector w S jEj such that for at most a fraction of all inputs (x y) f −1 (1) holds q(x y) (w ) = 0. On the other hand, clearly q(x y) = 0 if f (x y) = 0. Hence, the arithmetic communication protocol (P w ) computes f in the above mentioned approximative sense. Now we consider the special case of nite elds k of characteristic 2. Lemma 1
Let d be a positive inte er. Then for f : X c (f )
Y
0 1 holds
1 + d (cGF (2d ) (f ) + 1)
Proof. Recall that elements in GF (2d ) can be naturally represented as len th d binary vectors. We denote the j-th component of this representation of a eld element a by [a]j . Let (P w) be an arithmetic communication protocol over GF (2d ) that comPd of P . The modi cation concerns putes f . We consider modi ed copies P1 the labels of the leaves, while the labelin of the ed es and of the inner nodes is preserved in each copy. Leaf p will be labeled 1 in Pj if and only if [valw (p)]j = 1 (remember the correspondence between communications = maximal paths and leaves). Let fj denote the function computed by Pj as parity communication protocol. By de nition valw (p) = 0
f (x y) = 0 i p2AP (x y)
i i
j : fj (x y) = 0 j : fj (x y) = 1
788
Carsten Damm
Denote by Pj0 the parity communication protocol obtained from Pj by complementation , i.e., by au mentin a new root with one acceptin branch and one branch leadin to the root of Pj . Clearly Pj0 computes fj . From copies of these protocols we construct a new parity communication protocol P 0 in d sta es: sta e 1 consists of P10 . In sta e i < d we identify each acceptin leaf of 0 . It is easy to check, that the number the present construction with a copy of Pi+1 of acceptin communications of P 0 on (x y) is odd if and only if the number of acceptin communications of Pj0 on (x y) is odd for each j. Hence, P 0 computes f . A nal complementation step on P 0 ives a parity communication protocol that computes f as desired. Proof of Theorem 11: Let k = GF (2d ) with d = lo (cn (f ) ) . Then by Lemma 12 there is an arithmetic communication protocol over k that computes a function : X Y 0 1 that a rees with f on all of f −1 (0) and disa rees with f on at most a fraction of of f −1 (1). Simulatin this protocol as in Lemma 13 yields a parity communication protocol of len th (cn (f ) + 1) + 1 lo cn (f ) − lo
References 1. Amos Beimel and Anna Gal. On arithmetic branchin pro rams. Proc. Conf. on Computational Complexity, 1998 (Preliminary version: Technical Report 97-81, Center for Discrete Mathematics and Theoretical Computer Science 1997) 2. Carsten Damm, Matthias Krause, Christoph Meinel, and Stephan Waack. On Relations Between Countin Communication Complexity Classes. Journal on Computer System Sciences (to appear). 3. Anna Gal and Avi Wi derson. Boolean complexity classes vs. their arithmetic analo s. Random Structures and Al orithms. John Wiley & Sons, Inc., 1996. see also: Electronic Colloquium on Computational Complexity, Report 95-49, http://www.eccc.un -tr er.de/eccc/, 1995. 4. Avi Wi derson. N L poly L poly. Proc. of the 9th Conference on Structure in Complexity Theory, pp. 59 62, 1994. 5. Rudolf Lidl and Harald Niederreiter. Introduction to nite elds and their applications. Cambrid e University Press, 1986. 6. Rajeev Motwani and Prabhakar Ra havan. Randomized Al orithms. Cambrid e University Press, 1995. 7. K. Mulmuley, U. Vazirani, and V. Vazirani. Matchin is as easy as matrix inversion. In Proceedin s of the 19th STOC, pa es 345 354, 1987. 8. Klaus Reinhardt and Eric Allender. Makin nondeterminism unambi ous. Electronic Colloquium on Computational Complexity, Report 97-14, http://www.eccc.un -tr er.de/eccc/, 1997.
Communication Complexity and Lower Bounds on Multilective Computations (Extended Abstract) Juraj Hromkovic Dept. of Computer Science I, RWTH Aachen Ahornstr. 55, 52074 Aachen, Germany jh@ 1. nformat k.RWTH-Aachen.de
Abs rac . Communication complexity of two-party (multiparty) protocols has established itself as a successful method for proving lower bounds on the complexity of concrete problems for numerous computing models. While the relations between communication complexity and oblivious, semilective computations are usually transparent and the main di culty is reduced to proving nontrivial lower bounds on the communication complexity of given computing problems, the situation essentially changes, if one considers non-oblivious or multilective computations. The known lower bound proofs for such computations are far from being transparent and the crucial ideas of these proofs are often hidden behind some nontrivial combinatorial analysis. The aim of this paper is to create a general framework for the use of two-party communication protocols for lower bound proofs on multilective computations. The result of this creation is not only a transparent presentation of some known lower bounds on the complexity of multilective computations on distinct computing models, but also the derivation of new nontrivial lower bounds on multilective VLSI circuits.
1
Introduction
The communication complexity of two-party protocols has been introduced by Abelson [Ab78] and Yao [Ya79]. The initial goal was to develop a method for proving lower bounds on the complexity of distributed and parallel computations. 0 1 n N, be a Boolean function over a Informally let f : 0 1 n set X of n Boolean variables, and let = (X1 X2 ) be a partition of X. A two-party (communication) protocol D computin f accordin to consists of two computers CI and CII with unbounded computational power. 0 1 and CII obtains an input At the beginning CI obtains an input x : X1 0 1 . Then CI and CII communicate according to the protocol by y : X2 exchanging binary messages until one of them knows the result f (x y). The complexity of the protocol computation on the input (x y) is the sum of the This work has been supported by the DFG Project HR 14/3-1. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 789 797, 1998. c Sprin er-Verla Berlin Heidelber 1998
790
Juraj Hromkovic
lengths of messages exchanged. The complexity of the protocol D, cc(D), is the maximum of the complexities over all inputs from z : X 0 1 1 . The communication complexity of f accordin to , cc(f ), is the complexity of the best protocol computing f according to . There are several ways how to de ne the communication complexity of a Boolean function f . The choice depends on the application considered. The most common de nition used in many applications is to consider the communication complexity of f , cc(f ), as the minimum of cc(f ) over all almost balanced 2 partitions of input variables. In the almost 20 years of its existence communication complexity has established itself as a method for proving lower bounds on several fundamental complexity measures of sequential and parallel computations. Its success in the applications is comparable with that of Kolmogorov complexity in computability and complexity theory. The simpliest standard application of communication complexity is based on the division of the hardware of the computing model considered (circuit, input tape, etc.) into two parts, in such a way, that each part contains approximately half the inputs. Obviously, such a cut corresponds to an almost balanced partition of the set of input variables. So cc(f ) gives a lower bound on the amount of information that must be exchanged between these two parts of hardware. Lower bounds on the size of the hardware or on some tradeo s between hardware size and time follow. Another standard possibility is to cut time in some discrete moment t in such way that the number of input bits read before t is approximately the same as the number of input values read after t. Again this corresponds to an almost balanced partition of the set of input variables. Then cc(f ) is a lower bound on the amount of information transfered between two time units of the computation. To realize this transfer the size of the hardware (memory, circuit) has to be large enough. The standard applications mentioned above are elegant and transparent and the main technical di culty lies in proving nontrivial lower bounds on cc(f ) of a function f of interest. But these cuts with required properties can be found only if the computing model is oblivious3 and semilective4 . If the model is 2-multilective (each variable may enter at most twice) the ideas for the above standard applications do not work anymore, because there are no cuts corresponding partitions of the set of input variables as de ned above. This should be not surprising because usually multilective computing models are much more powerful than their 1 2 3
4
We consider an input as an assignment of values to the input variables. Usually almost balanced means that at least one third of the input is assigned to each of the two computers of a protocol. Obliviousness means that the position (time), where (when) an input enter our computing device is xed for every input variable, i.e. independent of the values of speci c inputs. Semilectivity means that each variable enters the computing device exactly once, i.e. is read exactly once.
Communication Complexity and Lower Bounds
791
semilective counterparts5. So the known lower bounds proofs for multilective computations are far from beeing obvious and transparent (see, for instance, [BRS93,DG93,Gr91,HKMW92,KMW89,Ok93,Sau97,Sa84,Tu89,Ya81]) and the crucial ideas of these proofs are often hidden behind some nontrivial combinatorial analysis. The main aim of this paper is to create a general framework enabling to present some lower bound proofs on multilectivity as a well-structured transparent method based on two-party communication protocols. Another consequence of our e ort are some new applications for proving lower bounds for multilective VLSI circuits and multilective planar Boolean circuits. Moreover, using our approach one can get lower bounds for numerous concrete functions and not only for one (or a few) function as it is usual for lower bound proofs. The paper is organized according to three steps in which we consecutively present our method for proving lower bounds on multilective computations. Section 2 gives the de nition of a so called overlapping communication complexity introduced in [Hr97] in a slightly di erent form. This captures the fact, that for multilective devices we are unable to cut them in such way, that the cut corresponds to a partition of the set of input variables X into two disjoint subsets. But what is possible to nd, is a cut corresponding to a partition of X into X1 and X2 in such a way that X1 − X2 and X2 − X1 are large enough . Because we have methods to prove nontrivial lower bounds on communication complexity according such overlapping partitions this concept has good chances to be applied. Section 3 is devoted to the problem how to search for a cut of a multilective device (computation). The cuts can not be found so easily as in the semilective case. Usually we need to partition the device (computation) considered into small pieces and then to build the cut by sticking some small pieces together. The method explaining how to partition and how to stick together is based on a combinatorial lemma. We present this lemma having broad applications in Section 3 and explain there its relation to overlapping communication complexity introduced in Section 2. In Section 4 we illustrate the applications of the concept developed in Sections 2 and 3 for proving lower bounds on multilective VLSI circuits and some versions of k-time-only branching programs. 6
2
Overlappin Communication Complexity
For the reasons explained in the introduction we give the formal de nition of overlapping communication complexity here. 0 1 be a Boolean function de ned De nition 1. Let f : 0 1 n xn n N. Let U0 X V0 over a set of variables X = x1 x2 5 6
Consider for instance branching programs, VLSI circuits, space bounded Turing machines, nite automata, etc. Following our aim we rather prefer to present ideas instead of technical proofs in this extended abstract.
792
Juraj Hromkovic
X U0 = V0 be two disjoint subsets of X. Let k be a positive inte er. A pair = ( L R ) is called a (U0 V0 k)-overlappin partition of X, if: 1. L R = X, and V0 R such that U R = V 2. there exist U U0 L and V L = V0 32k . and U U0 32k V P r(X U0 V0 k) denotes the set of all (U0 V0 k)-overlappin partitions of X. The reason to consider such partitions is the following one. May be, one knows that if CI knows values of variables from U0 but no variable from V0 and CII knows all from V0 but none of U0 then the communication complexity must be large. But one is unable7 to nd a cut separating U0 from V0 . The idea is to V0 are nd a cut where at least some parts of input variables U U0 and V separated. To have a chance to prove the necessity of a long communication the sizes of U and V may not be too small compared with U0 and V0 respectively In what follows we say that a communication has k-rounds if exactly k mesN. A protocol is sages between CI and CII have been exchanged for any k called k-rounds8 if for every input the communication of the protocol consists of at most k rounds. De nition 2. Let k be a positive inte er. Let f X U0 V0 have the same meanin as in De nition 1. For every P ar(X U0 V0 k) we de ne the overlappin 2k-rounds communication complexity of f accordin to , occ2k (f ), as the complexity of the best 2k-rounds protocol computin f accordin to . X we de ne the overlappin 2kFor all disjoint subsets U0 V0 rounds communication complexity of f accordin to U0 and V0 as occ2k (f U0 V0 ) := min occ2k (f
)
P ar(X U0 V0 k)
(1)
Finally, the overlappin 2k-rounds communication complexity of f is occ2k (f ) := max occ2k (f U0 V0 ) U0 U0 = V0
X
8 U0
X V0
X
V0 =
In what follows we also want to apply a new version of overlapping communication complexity. Let occ2k (f ) and occ2k (f ) be de ned in the same way as occ2k (f ) and occ2k (f ), resp. with the only di erence that we give no bounds on the number of rounds (i.e. k is related only to k-overlapping partitions). Obviously occ2k (f ) occ2k (f ) for every f and . Overlapping 2k-rounds communication complexity has been introduced in order to be applied for lower bounds on k-multilective computations9 . We see 7 8 9
Usually, such cut even does not exists. For formal de nition and the study of k-rounds protocol see [DGS84]. In a k-multilective computation each variable can be read at most k-times.
Communication Complexity and Lower Bounds
793
that k is strongly related to the size of the input variable subsets U and V (see De nition 1, (2)) separated by a cut. With the growth of the multilectivity the sizes of subsets, one is able to separate, decreases. Why the speed-up of the decrease of U is related to U0 32k we shall see in the next section. The reason to consider 2k-rounds protocols is that one is able to nd such cuts of kmultilective devices (computations) that the information flow crossing this cuts can be described by the exchange of 2k-binary messages between the two parts given by the cuts. Before using occ2k (f ) and occ2k (f ) to get lower bounds on k-multilective computations we should mention, that one is able to prove high lower bounds on occ2k (f ). This seems to be hard because following De nition 2, occ2k (f ) is the minimum over all P ar(X U0 V0 k) and over the communication complexities of all protocols computing f according to . Despite of this we have standard methods (in communication complexity theory) that can be used to prove nontrivial (even linear10 ) lower bounds on the communication complexity of concrete computing problems. On the other hand a detailed, technical presentation of a lower bound proof on occ2k (f ) for a speci c function f would be to long for this extended abstract. Because of this we prefer to explain one of the possible ideas only. Let f be de ned over a set of input variables X = X1 X2 X3 , where X 4 X2 X 4 X = n. Let the values X Xj = for i = j and X1 of variables in X3 determine which pairs (u v) X1 X2 are in some relation (for instance have to have the same value), and so they must be somehow compared. To prove occ2k (f ) n (4 32k ) one may choose U0 = X1 and V0 = X2 11 . Now P ar(X X1 X2 k). Let we have to prove occ2k (f ) n (4 32k ) for every = ( L R ) be an arbitrary (X1 X2 k)-overlapping partition of X. Then, there X2 R such that U exist U X1 L and V R = V L = , and U and V are at least n (4 32k ). 12 Now, one can choose the set of input assignments by xing the values of variables in X3 in such a way that n (4 32k ) di erent pairs form U V have to be compared. The standard methods like the fooling set method and the rank method (see for instance [DHS96,AUY83,Hr97,KN97]) are able to establish occ2k (f ) n (4 32k ). Since k is a constant independent of n, we have occ2k (f ) = Ω(n). 13
3
A Combinatorial Lemma
In what follows we present a lemma giving a very general concept for searching for cuts of multilective computations. This lemma has been proved in several 10 11 12 13
Note that the communication complexity is at most linear. Note that occ2k (f ) is de ned as the maximum over the choices of 0 and V0 . For the explanation see the next section. Note that the idea described above means that one can get numerous linear lower bounds on overlapping communication complexity. In fact, for every function f and every balanced partition one can construct a function Ff such that occ2k (Ff ) ≥ cc(f ).
794
Juraj Hromkovic
versions in the literature (see for instance [DG93,Hr97]) and so we omit to present its proof. Lemma 1. Let m n and k be positive inte ers, m n 32k k < 12 log2 n. n V0 n. Let Let U0 V0 be two disjoint subsets of a set X U0 Wd be a sequence of subsets of X with the properties W = W0 W1 m for every i = 1 d and for every x X, x belon s to at W V0 and inte ers most k sets of W . Then there exist U U0 and V tb b N, such that the followin ve conditions hold: t0 = −1 t1 n 32k 1. U n 32k V 2. b 2k ta 1 d for a = 1 2 b and t0 < t1 < < tb ti+1
3. if U
(
Wj ) =
b − 1 then
for some i = 0
j=ti +1 ti+1
V
Wj ) =
(
and
j=ti +1 ti+1
4. if V
Wj ) =
(
b − 1 then
for some i = 0
j=ti +1 ti+1
U
Wj ) = ,
( j=ti +1
d
5. (U
V)
Wj ) =
( j=tb +1
Now let us explain the relation of Lemma 1 to our lower bound proof concept by describing the interpretation of symbols (objects) appearing in Lemma 1. As before X denotes the set of input variables of a computing problem, that has to be solved in a k-multilective computation of a computing device. The sets U0 and V0 have the same meaning as in De nition 1 of an overlapping partition of X. These two subsets of X one may choose arbitrarily14. The idea to apply Lemma 1 in the search for a cut of the hardware or of the computation of a k-multilective computing device corresponding to an overlapping partition from P ar(X U0 V0 k) is as follows. Partition the hardware (or the computation) into d very small pieces (or time intervals), where d may be arbitrarily large. The pieces have to be so small, that the number of variables entering one piece (the number of variables read in one interval) is bounded by m n 32k . Obviously each variable enters (is read in) at most k di erent pieces (intervals). Then Lemma 1 says that one can stick the pieces corresponding to Wd together into at most b + 1 2k + 1 larger pieces15 W0 W1 ti+1
W = j=ti +1 14
15
d
Wj W =
Wj
(2)
j=tb +1
Obviously, the quality of the resulting lower bound essentially depends on the appropriate choice of 0 and V0 . The fact that one may choose 0 and V0 is the consequence of the fact that occ2k (f ) is de ned as the maximum over all choices of 0 and V0 . See (2) of Lemma 1.
Communication Complexity and Lower Bounds
795
for i = 0 1 b − 1 in such a way that there exist U U0 and V V0 with U = or W V = for all i = 0 1 b − 1 16 and the properties W (U V ) W = 17 . The nal product is a cut of the hardware (time) into only two parts L and R, where L is the union of all parts of corresponding W ’s containing no variable from V , and R is the union of the rest (i.e. the complement). The cut (L R) corresponds to a partition = ( L R ) P ar(X U0 V0 k). Thus we have the lower bound striven for, because occ2k (f ) occ2k (f U0 V0 ) bits must flow via the boundary between the parts L and R. So Lemma 1 provides a general strategy for proving lower bounds on multilective computations by communication complexity. But there are a few free parameters in this strategy and these parameters decide about the success of this method. The rst free parameter is the choice of U0 and V0 . A deep analysis of the inner structure of the computing problem is necessary to nd the best possibility. The second free parameter is the manner in which the hardware Wd . The par(time) is partitioned into small pieces correspoding to W0 W1 tition should be done in such a way that after sticking the pieces together 18 the resulting border between L and R is as small as possible. 19
4
Applications
We start to illustrate the applications on VLSI circuits. 20 First we give a transparent presentation of the method introduced by Duris and Galil for proving lower bounds on the area of multilective VLSI circuits. Let for a given circuit S, A(S) denote the area complexity of S, T (S) denote the time complexity of S, and P (S) denote the number of processors of S. Obviously P (S) A(S) for every S. The idea of the proof of the following theorem is to consider the sets W as the sets of inputs read in the time t by the circuit S. Theorem 1. Let f be a Boolean function of n0 variables, for a positive inte er n0 . Let k < 12 log2 n0 − 2 be a positive inte er. Then, for every k-multilective VLSI circuit computin f , A(S)
P (S)
occ2k (f ) 2k
(3)
Now, we present a new result by showing that overlapping communication complexity may be even used to prove lower bounds on AT 2 -tradeo of multilective VLSI-circuits. This generalizes a similar result [Th79] for the relation between communication complexity and (semilective) VLSI circuits. The idea of the proof is to consider W as the set of inputs read by the i-th processor of the circuit. 16 17 18 19 20
See (3) and (4) of Lemma 1. See (5) of Lemma 1. First to W ’s and W and then to L and R. The second free parameter does not depend on the computing problem considered, but on the multilective computing model. The formal de nition of k-multilective VLSI circuits may be found in [Hr97,Sa84].
796
Juraj Hromkovic
Theorem 2. Let k and n0 be positive inte ers, k < 12 log2 n0 − 2. Let f be a Boolean function dependin on all its n0 variables. Then, for every k-multilective VLSI circuit S computin f , A(S) (T (S))2
(occ2k (f ) 4k)2
(4)
Now, we consider branching programs [HKMW92,PZ83,We88]. In [KMW89] an exponential lower bound on the size of k-times-only oblivious branching programs has been proved. The proof does not explicitely use the method based on communication complexity. We show that by using overlapping communication complexity we will not only get a transparent proof of this fact, but even a more powerful lower bound. The k-time-only oblivious branching program consists of levels. All nodes of every level read the same variable and every variable is read at at most k levels. Using overlapping communication complexity we can remove obliviousness and allow several variables to be read in one level. Theorem 3. Let f be a Boolean function of n variables, n N. Let k m be positive inte ers such that k < 12 log2 n − 2 and m n 8 32k . The size of every branchin pro ram readin at most m variables on every level, askin for every variable on at most k distinct levels, and computin f is at least: 2occ2k (f )
2k
(5)
So Theorem 3 enables to prove 2Ω(n) lower bounds on the size of k-time-only branching programs (with the above restriction) computing speci c functions. Note that there are already known exponential lower bounds on syntactic ktimes-only branching programs [BRS93, Ok93, Sue97] that are a more powerful model of branching programs than those considered in Theorem 4.3. The next assertion shows how overlapping communication complexity can be used to get lower bounds on syntactic k-times-only branching programs. Unfortunately, this application is not so transparent and easy to use as the previous ones. Theorem 4. Let f be a Boolean function of n variables, n N. Let k be a positive inte er such that k < 12 log2 n − 2. Let D be a syntactic k-times-only branchin pro ram computin f . Let the width of D be bounded by r. Then there exists a partition of f into 2k fc such that c = r8k3 partial Boolean functions f1 f2 occ2k (f ) for every i = 1
2k lo 2 (8k 32k r)
(6)
c.
The last application, we can mention only very shortly in this extended abstract, is to prove lower bounds on multilective planar Boolean circuits. Using the Planar separator theorem of Lipton and Tarjan [LT79] and our general concept of overlapping communication complexity we can obtain transparent proofs of essentially stronger lower bounds than the lower bounds presented in [Gr91,Tu89], where multiparty communication complexity has been applied.
Communication Complexity and Lower Bounds
797
References Ab78. Ableson, H.: Lower bounds on information transfer in distributed computations, Proc. 19th IEEE FOCS, IEEE 1978, pp. 151-158. AUY83. Aho, A.V., Ullman, J.D., Yanakakis, M.: On notions of informations transfer in VLSI circuits, Proc. 15th ACM STOC, ACM 1983, pp. 133-139. BRS93. Borodin,A., Razborov,A., Smolensky,R.: On lower bounds for read-k-times branching programs. Computational Complexity 3 (1993), 1-18. DG93. Duris, P., Galil, Z.: On the power of multiple read in chip, Information and Computation 104 (1993), pp. 277-287. DGS84. Duris, P., Galil, Z., Schnitger, G.: Lower bounds on communication complexity, Proc. 16th ACM STOC, ACM 1984, pp. 81-91. DHS96. Dietzfelbinger, M., Hromkovic, J., Schnitger, G.: A comparison of two lower bounds methods for communication complexity, Theoretical Computer Science 168 (1996), pp. 39-51. Gr91. Groger, H.D.: A new partition lemma for planar graphs and its application to circuit complexity, In: Proc. FCT’91, Lecture Notes in Computer Science 529, Springer-Verlag 1991, pp. 220-229. HKMW92. Hromkovic, J., Krause, M., Meinel, Ch., Waack, S.: Branching programs provide lower bounds on the area of multilective deterministic and nondeterministic VLSI circuits, Information and Computation 95 (1992), pp. 117-128. Hr97. Hromkovic, J.: Communication Complexity and Parallel Computin , EATCS Series, Springer 1997, 336p. KMW89. Krause, M., Meinel, Ch., Waack, S.: Separating complexity classes related to certain input oblivious logarithmic space-bounded Turing machines, In: Proc. Structure in Complexity Theory 1989, pp. 240-249. KN97. Kushilevitz, E., Nisan, N.: Communication Complexity, Cambridge University Press 1997. LT79. Lipton, R.J.,Tarjan, R.E.: A separator theorem for planar graphs, SIAM J. Applied Mathematics 36 (1979), pp. 177-189. PZ83. Pudlak, P., Zak, S.: Space complexity of computations, Tech. Report, Prague 1983. Ok93. Okolnishkova,E.A.: On lower bounds for branching programs. Siberian Advances in Mathematics 3 (1993), 152-166. Sau97. Sauerho ,M.: Lower bounds for randomized read-k-times branching programs. In: Proc. STACS’98, Lecture Notes in Computer Science 1373, pp. 105-115. Sa84. Savage, J.E.: Multilective VLSI algorithms, JCSS (1984), pp. 243-273. Th79. Thompson, C.D.: Area-time complexity for VLSI, Proc. 11th ACM STOC, ACM 1979, pp. 81-88. Tu89. Turan, Gy.: On restricted Boolean circuits, In: Proc. FCT’89, Lecture Notes in Computer Science 380, Springer-Verlag 1989, pp. 460-469. We88. Wegener, I.: On the complexity of branching programs and decision trees for clique funcion, J. of ACM 35 (1988), pp. 461-471. Ya79. Yao, A.C.: Some complexity questions related to distributive computing, Proc. 11th ACM STOC, ACM 1979, pp. 209-213. Ya81. Yao, A.C.: The entropic limitations on VLSI computations, Proc. 11th ACM STOC, ACM 1979, pp. 209-213.
A Finite Hierarchy of the ecursively Enumerable eal Numbers Klaus Weihrauch and Xizhong Zheng Theoretische Informatik I, FernUniversit¨ at Ha en, 58084 Ha en, Germany
Abs rac . For any set A of natural numbers, denote by xA the correspondin real number such that A is just the set of 1 positions in its binary expansion. In this paper we characterize the number xA for some classes of recursively enumerable sets A. Applyin nite injury priority methods we show that there is a d-r.e. set A such that xA is not a semicomputable real number (which corresponds to the limit of computable monotonic sequence of rational numbers) and that there is an -r.e. set A such that xA can’t be represented as a sum of two semi-computable real numbers.
1
Introduction
A real number x is computable, if here is a compu able Cauchy sequence (rn )n2IN of ra ional numbers which converges e ec ively o x (see e.g. [3,5,6].) Where a sequence (rn )n2IN of ra ional numbers is computable means ha here are recursive func ions a b c : IN IN such ha rn = (a(n) − b(n)) (c(n) + 1) for all n IN, 2−n and he sequence (rn )n2IN conver es e ectively means ha rn+m − rn holds for all m n IN (IN is he se of all na ural numbers.) We deno e he class of all compu able real numbers by C0 . Here he e ec ivi y of he convergence is crucial, because here are compu able sequences of ra ional numbers which converge (non-e ec ively, of course) o non-compu able real numbers (see [5,11]). A s andard example is he real number xA := n2A 2−n for a nonrecursive r.e. se A IN. Le a : IN IN be an 1-1 recursive enumera ion func ion of A, i.e., rang(a) = A, hen he increasing compu able sequence (xn )n2IN de ned by n −a( ) converges none ec ively o he noncompu able real number xn := =0 2 xA (see [4]). In fac , i is easy o see ha xA is a compu able real number i A is a recursive se . Al hough he real number xA for a nonrecursive r.e. se A is no compu able, i is s ill qui e e ec ive in he sense ha we can approxima e i e ec ively from below. We call a real number x left computable (ri ht computable), if here is an increasing (decreasing) compu able sequence of ra ional numbers which converges o x. A real number is called semi-computable, if i is ei her lef compu able or righ compu able. The class of all semi-compu able real numbers Contact author. Email address: xizhon .zhen @fernuni-ha en.de Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 798 806, 1998. c Sprin er-Verla Berlin Heidelber 1998
A Finite Hierarchy of the Recursively Enumerable Real Numbers
799
is deno ed by C1 . The above example shows ha C0 C1 . Obviously, xA is (righ ) lef compu able, if A is (co-)r.e. On he o her hand, C. G. Jockusch (see [9]) has observed ha if B is a non-recursive r.e. se , hen he non-r.e. se 2n + 1 : n B s ill corresponds o a lef compu able B B := 2n : n B real number xBB . No e ha he se B B above is in fac a d-r.e. se (difference of r.e. se s.) We can ex end Jockusch’s resul o show ha here are a real (k + 1)-r.e se (which is no k-r.e.) and a real -r.e. se (which is no k-r.e for any k), respec ively, such ha heir corresponding real numbers are s ill lef compu able. Because xA = xB[C − xC if A = B C (se di erence,) he above resul s show ha here are many semi-compu able real numbers whose di erences are s ill semi-compu able. Le C2 deno e he closure of C1 under he ari hme ic opera ions of + and − . Then i is na ural o ask whe her C1 = C2 holds. The answer is no. We can cons ruc by ni e injury priori y me hod a d-r.e. se C2 A such ha xA is nei her lef compu able nor righ compu able, hus C1 holds. C2 is an in eres ing class of real numbers. I forms in fac a eld, i.e. i is closed under he ari hme ical opera ions + , − , and . We will give ano her charac eriza ion of he elemen s of C2 by he limi s of he weakly e ec ively convergen sequences , namely, x C2 i here is a compu able 1 sequence (xn )n2IN of ra ional numbers such ha n=0 xn+1 − xn is bounded and converges o x. Compairing wi h he e ec ively convergen sequence (yn )n2IN which sa is es ha yn+m − yn 2−n , for every n m IN, hence 1 n=0 yn+m − yn is bounded for every m IN, we can say ha he sequence (xn )n2IN above converges o x weakly e ectively. So he real numbers in C2 can be na urally called weakly computable. Our las resul shows ha no every convergen compu able sequence converges weakly e ec ively. Again by a priori y injure cons ruc ion we show ha here is an -r.e. se A such ha xA is no in C2 , i.e. here is no compu able sequence of ra ional numbers which converges o xA weakly e ec ively. We call a real number recursively enumerable, if here is a compu able sequence of raional numbers which converges o i and deno e by C3 he class of all such real numbers. Our resul s show ha (C : i 3) forms a noncollapsed hierarchy.
2
Computable and Semi-Computable
eal Numbers
This sec ion discusses he compu able and semi-compu able real numbers. By de ni ion, i is easy o see ha x is lef compu able i −x is righ compu able. Lef and righ compu abili ies are incomparable and x is compu able i i is bo h lef and righ compu able. If A IN is a r.e. (co-r.e.) se , hen xA is a lef (righ ) compu able real number. We will show ha he inverse is no rue. De nition 1 ((cf. [10])). A r.e. se A IN is called 1-r.e. For any k 1, se A IN is called (k + 1)-r.e, if here are r.e. se B IN and k-r.e. se C IN such ha A = B C. 2-r.e. se is usually called d-r.e. For any ni e se E IN, we de ne i s canonical index i by i := j2E 2j . A ni e se wi h canonical index i is deno ed by D . A sequence (En )n2IN of ni e
800
Klaus Weihrauch and Xizhon Zhen
subse s of IN is called computable, i such ha En = Df (n) for all n IN.
here is a recursive func ion f : IN
Proposition 1. A set A IN is k-r.e i (As )s2IN of nite subsets of IN such that 1. A = lim An := n!1
2.
s
IN : n
1
1
n=0 s=n
As+1
IN
there is a computable sequence
As , and
As
k, for all n
IN.
where A B := (A B) (B A) is the symmetric di erence of sets A and B, and B denotes the cardinality of set B. The sequence (As )s2IN above is usually called an e ec ive k-enumera ion of A. Jockusch’s example shows ha here is a d-r.e. se A such ha xA is lef compu able. R.I. Soare [9] ex ended his resul in several direc ions. He has shown, e.g., ha here is a dominan d-r.e. se A and a cohensive se C such ha xA and xC are lef compu able. Where A is dominan i he principal func ion of A domina es every recursive func ion, and C is cohensive i C is in ni e and here is no r.e. se W such ha W C and W C are bo h in ni e (see [9] for exac de ni ions.) The nex heorems give ano her ex ension of Jockusch’s observa ion and induce o an in ni e hierarchy of lef compu able real numbers. Theorem 1. For any k 2, there are k-r.e. sets A B which are not (k − 1)-r.e. such that xA and xB are left and ri ht computable, respectively. The concep of k-r.e. se can be generalized o -r.e. by he Proposi ion 1. De nition 2. Se A IN is called -r.e., i (As )s2IN of ni e subse s of IN such ha 1
1. A = 2.
n
here is a compu able sequence
1
n=0 s=n
IN k
As , and IN( s
IN : n
As+1
As
The sequence (As )s2IN is called an e ective
k). -enumeration of A.
Theorem 2. There is an -r.e. sets A which is not k-r.e., for any k IN, such that xA is left computable. The same claim holds for ri ht computability as well.
3
Weakly Computable
eal Numbers
From he las sec ion we know ha here are many noncompu able semi compu able real numbers whose sums and di erences are s ill semi-compu able. We will show in his sec ion ha his is no always he case, i.e., here are lef compu able real numbers y and z such ha heir di erence x := y − z is nei her lef compu able nor righ compu able. Hence C1 is no closed under he ari hme ical opera ions + and − . We in roduce a new no ion a rs .
A Finite Hierarchy of the Recursively Enumerable Real Numbers
801
De nition . A real number x is called weakly computable, if here are wo lef compu able real numbers y z such ha x = y − z. The se of all weakly compu able real numbers is deno ed by C2 . Equivalen ly, x is weakly compu able i here are lef compu able real y and righ compu able real z such ha x = y + z. If A is a d-r.e. se , hen xA is weakly compu able. More generally, we can show by an easy induc ion on k 1, ha , if A is a k-r.e se , hen xA is a weakly compu able real number. Now we give ano her charac eriza ion of weakly compu able real numbers by he weak convergence of sequences. De nition 4. A sequence (xn )n2IN of real numbers is weakly e ectively conver1 ent (w.e. conver ent for shor ) if , if n=0 xn+1 − xn is bounded. 1
If a sequence (xn )n2IN converges weakly e ec ively, i.e., n=0 xn+1 − xn , hen big jumps may occur in he sequence and hen may occur very la e. If, however, he sequence is e ec ively convergen , hen he big jumps mus occur early. So, weakly e ec ive convergence is a kind of weak version of e ec ive convergence. Any e ec ively convergen sequence of ra ional numbers converges o compu able real numbers. For w.e. convergen sequences, we have Theorem . A real number x is weakly computable, i there is a computable sequence (xn )n2IN of rational numbers which conver es to x weakly e ectively. Proof. . Le x be a weakly compu able real number. Then here are wo compu able increasing sequences (yn )n2IN and (zn )n2IN of ra ional numbers such ha y := limn!1 yn and z := limn!1 zn exis and x = y − z. Le xn := yn − zn . Then (xn )n2IN is a compu able sequence of ra ional numbers which sa is es 1
1
xn+1 − xn n=0
1
(yn+1 − yn ) + n=0
(zn+1 − zn ) = y − y0 + z − z0 n=0
So (xn )n2IN converges o x weakly e ec ively. . Le (xn )n2IN be a compu able sequence of ra ional numbers which converges o x weakly e ec ively. De ne compu able sequences (yn )n2IN and (zn )n2IN of ra ional numbers by n
n
(x +1 − x ) and zn :=
yn := x0 + =0
(x − x +1 ) =0
Obviously, hey are bo h non-decreasing and bounded. Hence y := limn!1 yn and z := limn!1 zn exis and hey are he lef compu able real numbers which sa isfy n
y − z = lim (yn − zn ) = lim (x0 + n!1
n!1
n
(x +1 − x ) − =0
n
(x +1 − x )) = lim xn = x
= lim (x0 + n!1
=0
Tha is, x is weakly compu able.
n!1
(x − x +1 )) =0
802
Klaus Weihrauch and Xizhon Zhen
Corollary 1. A real number x is weakly computable i there is a computable 1 sequence (xn )n2IN of rational numbers such that n=0 xn+ − xn is bounded for every i IN and limn!1 xn = x. Proposition 2. If (xn )n2IN is a computable sequence of computable real numbers which conver es w.e. to x, then x is weakly computable. Theorem 4. The class C2 is a eld enerated by C1 . Now we will show ha C2 ex ends C1 properly. Theorem 5. There is a d-r.e. set A such that xA is neither left computable, nor ri ht computable. Proof. We cons ruc he se A e ec ively in s ages so ha , for any s IN, he number 2s is always enumera ed in o A a he beginning. They can be removed from A a a la er s age and hen will never en er A again. The number 2s + 1 can only be enumera ed in o A and can no be removed from A. This makes sure ha A is a d-r.e. se . We use As o deno e he se cons ruc ed a he end of s age s. Our proof is a ni e injury priori y cons ruc ion. The de ail explana ions abou such kind of cons ruc ions can be found in [10]. To guaran ee ha xA is nei her lef compu able nor righ compu able, we le xA diagonalize all semi-compu able real numbers. Le (Mn )n2IN be he s andard IN he func ion come ec ive enumera ion of all Turing machines, n : IN IN is de ned by n s (x) := y, if Mn (x) pu ed by Mn . Func ion n s : IN hal s and ou pu s y in s s eps and n s (x) unde ned o herwise. Le an := sup( bn := inf(
Q (i) Q (i)
an s := max( bn s := min(
2:i 0:i
Q (i) Q (i)
dom( dom(
n)
0 )
n)
2:i
dom(
0:i
dom(
2 ) n s) n s)
0 ) 2 )
Q l is an e ec ive enumera ion of ra ional numbers. For any where Q : IN increasing compu able sequence (xs )s2IN of ra ional numbers from [0; 2], here is an n such ha s IN(xs = an s ). And an = lims!1 an s for every n IN. Then L := an : n IN consis s of all lef compu able real numbers of in erval [0; 2]. Similarly, R := bn : n IN consis s of all righ compu able real numbers of in erval [0; 2]. I su ces now o make sure ha he se A sa is es, for all n IN, he following requiremen s: R2n R2n+1
: :
xA = an xA = bn
A Finite Hierarchy of the Recursively Enumerable Real Numbers
803
The s ra egy o sa isfy a single requiremen R2n is simple: we pu a he beginning all even numbers in o A0 . If, a some s age s + 1, here is some i such an s , hen reduce he value of xAs by removing he number 2i ha xAs − 2−2 from As . Tha is, de ne As+1 := As 2i (we call R2n is a acked a his s age.) Fur hermore, we de ne a res rain r(2n s + 1) := j(xAs − 2−2 + 2−j an s ). A any s age t + 1 > s + 1, all elemen s x r(2n s + 1) are no allowed o be pu in o or aken ou from At . Therefore, he se A := lims!1 As sa is es ha xA xAs+1 + 2−r(2n s+1) = xAs − 2−2 + 2−r(2n s+1) an s an . Hence R2n is sa is ed. If no such s age s + 1 exis s, hen an s xAs − 2−2 holds for all s and i, hence, say, an xA − 2−2 xA . Tha is, R2n is sa is ed oo. The s ra egy for R2n+1 is similar. To accommoda e all requiremen s Rn simul aneously, we use ni e injury , priori y me hod. We give all requiremen s he priori y in order R0 R1 R2 i.e., Rm has higher priori y han Rn i m n. A any s age s + 1, if we wan o enumera e an elemen k in o As while a acking he requiremen R2n+1 , we do no need o ake care for lower priori y requiremen s Rm (wi h m > 2n + 1) bu we have o do ha for all higher priori y requiremen s Rm (wi h m 2n + 1.) In his case, he elemen k can be pu in o As a his s age only, if his does no injury any higher priori y requiremen , i.e., k mus be bigger han all res rain r(m s) for all m 2n+1. No e ha , for any requiremen Rm , one a ack su ces o sa isfy i , if i is no injuried any more. Then any requiremen Rm can be injuried only ni ely of en (a mos 2m − 1 imes for Rm .) Even ually, every requiremen can be sa is ed by his s ra egy. The cons ruc ion of (As )s2IN is as following: IN and r(n 0) := 0 for all n IN. All S age 0: De ne A0 := 2i : i requiremen s are se o he s a e of unsatis ed. S age s + 1: Given As and r(n s) for all n. The requiremen R2n requires attention, if here is an i s such ha (i) r(m s) 2i for all m 2n; (ii) an s > xAs − 2−2 and (iii) R2n is in he s a e of unsa is ed. The requiremen R2n+1 requires attention, if here is an i s such ha (i)’ r(m s) 2i + 1 for xAs + 2−(2 +1) and (iii)’ R2n+1 is in he s a e of all m 2n + 1; (ii)’ bn s unsa is ed. Choose m s minimal such ha Rm requires a en ion. If m = 2n, hen 2i0 ; r(e s + 1) := r(e s), if e = m and r(m s + 1) := de ne As+1 := As i(an s > xAs − 2−2 0 + 2− ), where i0 is he leas i which sa is es he condi ion (i) (iii). 2i0 + 1 ; r(e s + 1) := r(e s), if If m = 2n + 1, hen de ne As+1 := As e = m and r(m s + 1) := i(bn s xAs + 2−2 0 +1 − 2− ), where i0 is he leas i which sa is es he condi ion (i)’ (iii)’. In bo h cases, we say ha Rm receives attention and se i now o he s a e of satis ed. Fur hermore, all requiremen s Rm wi h m0 > m are se o he s a e of unsatis ed. If Rm , m0 > m, was sa is ed a s age s, hen i is injured a his s age by Rm . If here is no m s such ha Rm requires a en ion, hen de ne simply As+1 := As and r(n s + 1) := r(n s) for all n IN.
804
Klaus Weihrauch and Xizhon Zhen
This ends he cons ruc ion. I is easy o see ha he cons ruc ion succeeds by he following claims whose proofs are omi ed here. Claim 1 A := lim An is a d-r.e. se . n!1 Claim 2 For any n IN, Rn receives a en ions a mos ni ely many imes. Claim For any n IN, Rn is even ually sa is ed. I follows immedia ely from above heorem he following corollary. Corollary 2. There are non-semi-computable weakly computable real numbers, C2 . i.e. C1
4
ecursively Enumerable
eal Numbers
We have shown ha xA is weakly compu able, if A is k-r.e. for any k 1 and here are also -r.e. se A such ha xA is semi-compu able (Theorem 2), hence weakly compu able. I comes he ques ion: is every xA weakly compu able, if A is -r.e.? Or more generally, is here any convergen compu able sequence of ra ional numbers which converges no weakly e ec ively? This sec ion will answer hese ques ion posi ively. Theorem 6. There is a r.e. real number which is not weakly computable. Thus, C3 holds. C2 Proof. We cons ruc a compu able sequence (xn )n2IN of ra ional numbers in s ages such ha he limi x := limn!1 xn diagonalizes all di erences of lef compu able real numbers. Le an and an s be same as in he proof of Theorem 5 and de ne, for all n m IN, ha dhn mi := an − am and dhn mi s := an s − am s
(1)
IN is he Can or’s pairing func ion de ned by n m := where : IN2 (n + m)(n + m + 1) 2 + m. Then D := dn : n IN is he se of all weakly compu able real numbers by he De ni ion 3. I su ces now o make sure ha x is a r.e. real number which sa is es all he following requiremen s: Rn :
x = dn 1
−( +1) and x is a limi of We will cons ruc x in such a way ha x = =0 w 8 0 4 for all i IN. some compu able sequence of ra ional numbers, where w To sa isfy he requiremen Rn , we change he value of wn from 0 o 4 or from 8−(n+1) holds. For single Rn , he 4 o 0, if i is necessary, so ha x − dn n−1 −( +1) (for any given ra ional numbers s ra egy is simple. Le rn := =0 w 8 w wi h i n) and consider he in erval [rn ; rn + 8−n ]. A he beginning, le wn := 0. We rede ne wn := 4, if here is an s such ha dn s rn + 2 8−(n+1) , se wn back o 0 la er, if some t > s appears such ha dn t rn + 3 8−(n+1) and rn + 2 8−(n+1) , and le wn = 4 again, if here is ano her s0 > t such ha dn s
A Finite Hierarchy of the Recursively Enumerable Real Numbers
805
so on. Every change of he value of wn is called an attack o Rn . Since (dn s )s2IN is no necessarily mono onic, wn may be changed many imes. We deno e by wns he value of wn a he end of s age s. Then wns can’ be changed in ni ely of en because (dn s )s2IN converges, hence wn := lims!1 wns exis s. We de ne simply 8−(n+1) x := rn + wn 8−(n+1) . By he de ni ion, dn s − (rn + wns 8−(n+1) ) holds for all s IN. Therefore dn − (rn + wn 8−(n+1) ) = dn − x 8−(n+1) holds. Tha is, x sa is es Rn . To rea all requiremen s simul aneously, we apply priori y injury me hod again. Here is he cons ruc ion of (xn )n2IN : S age s = 0. Se x0 := w00 := 0. s s −( +1) wi h ws 0 4 for all i s. The S age s + 1. Given xs := =0 w 8 requiremen Rn , n s, requires attention, if ei her wns = 0 & dn s wns = 4 & dn s
n−1 =0 n−1
ws 8−( +1) + 2 8−(n+1)
or
ws 8−( +1) + 3 8−(n+1)
(2)
(3)
=0
s such ha Rn requires a en ion. If (2) holds, hen
holds. Choose he leas n de ne s+1 wm
:=
s wm 4 0
if m n; if m = n; if n m
s+1
s wm 0
if m if n
s+1
(4)
If (3) holds, hen de ne s+1 := wm
n; m
In bo h cases we say hen Rn receives attention. If no requiremen Rn , n s, requires a en ion, hen de ne, for all m simply s+1 s+1 s := wm and ws+1 := 0 wm
(5)
s, (6)
s+1
s+1 −( +1) 8 . This ends he cons ruc ion. We can show A las , se xs+1 := =0 w our cons ruc ion succeeds by he flowing Claims whose proofs are omi ed here. Claim 1 For every n IN, he requiremen Rn receives a en ions a mos ni ely of en. Claim 2 For every n IN, he limi wn := lim wns exis s. s!1
−( +1) . Then x = limn!1 xn holds. Claim Le x := 1 =0 w 8 Claim 4 The real number x of Lemma 3 sa is es all requiremen s Rn for n IN.
806
Klaus Weihrauch and Xizhon Zhen
Corollary . There is an is not weakly computable.
-r.e. set A such that xA is a r.e. real number which
s) be same as in he proof of he Theorem 6. No e Proof. Le ws (s IN i IN) of ha 4 8−(n+1) = 2−(3n+1) . De ne a compu able sequence (As : s IN : i s & ws = 4 . Since here ni e sunse s of IN by As := 3i + 1 are only ni e many s such ha wns = wns+1 , here are only ni e many s such As con ains n, for every n IN. Tha is (As : s IN) is an ha As+1 e ec ive -enumera ion of he se A := lims!1 As , hence A is an -r.e. se . On he o her hand, i is easy o see ha A = 3n + 1 IN : wn = 4 . Then 1 2−(3n+1) : wn = 4 = n=0 wn 8−(n+1) = x. By he proof of Theorem xA = 6, xA is a r.e. real number which is no weakly compu able. Corollary 4. (C : i
3) forms a noncollapsed hierarchy.
eferences 1. Ker-I Ko On the de nitions of some complexity classes of real numbers, Math. Systems Theory 16(1983) 95 100. 2. A. H. Lachlan Recursive real numbers. J. Symbolic Lo ic 28(1963), 1 16. 3. J. Myhill Criteria of constructivity for real numbers, J. Symbolic Lo ic 18(1953), 7 10. 4. M. Pour-El & J. Richards Computability in Analysis and Physics. Sprin erVerla , Berlin, Heidelber , 1989. 5. H. G. Rice Recursive real numbers, Proc. Amer. Math. Soc. 5(1954), 784 791. 6. R. M. Robinson Review of R. Peter: ‘ Rekursive Funktionen’, Akad. Kiado. Budapest, 1951 , J. Symb. Lo ic 16(1951), 280. 7. H. Jr. Ro ers Theory of Recursive Functions and E ective Computability McGraw-Hill, Inc. New York, 1967. 8. R. Soare Recursion theory and Dedekind cuts, Trans, Amer. Math. Soc. 140(1969), 271 294. 9. R. Soare Cohensive sets and recursive enumerable Dedekind cuts Paci c J. of Math. 31(1969), no.1, 215 231. 10. R. Soare Recursively Enumerable Sets and De rees, Sprin er-Verla , Berlin, Heidelber , 1987. 11. E. Specter Nicht konstruktive beweisbare S¨ atze der Analysis, J. Symbolic Lo ic 14(1949), 145 158 12. K. Weihrauch Computability. EATCS Mono raphs on Theoretical Computer Science Vol. 9, Sprin er-Verla , Berlin, Heidelber , 1987.
One Guess One-Way Cellular Arrays Thomas Buchholz, Andreas Klein, and Martin Kutrib Institute of Informatics, University of Giessen Arndtstr. 2, D-35392 Giessen, Germany buchholz,kutrib @informatik.uni- iessen.de
Abstract. One-way cellular automata with restricted nondeterminism are investi ated. The number of allowed nondeterministic state transitions is limited to a constant. It is shown that a limit to exactly one step does not decrease the lan ua e acceptin capabilities. We prove a speed-up result that allows any linear-time computation to be sped-up to real-time. Some relationships to deterministic arrays are considered. Finally we prove several closure properties of the real-time lan ua es.
1
Introduction
Linear arrays of nite automata can be re arded as models for massively parallel computers. Mainly they di er in how the automata are interconnected and in how the input is supplied. Various types have been studied for a lon time. Here we are investi atin arrays with a parallel input mode and a very simple interconnection pattern. Each node is connected to its ri ht immediate nei hbor only. They are usually called one-way cellular automata (OCA). Althou h deterministic and nondeterministic nite automata have the same computin capability, nondeterminism can stren then the power of OCAs under some time resource bounds. Nondeterministic OCAs have been investi ated e. . in [7] where (NOCA) = (NCA) was proved, and in [10] where it was shown in terms of homo eneous trellis automata that rt (NOCA) contains the -free context-free lan ua es as well as a NP-complete lan ua e, and is an AFL closed under intersection. Here we consider arrays with restricted nondeterminism. We limit the number of allowed nondeterministic transitions. Moreover, all nondeterministic transitions have to appear before the deterministic ones. The main object of the present paper is to investi ate arrays that are limited to exactly one nondeterministic transition step.
L
2
L
L
Basic Notions
We denote the inte ers by Z, the positive natural numbers 1 2 by N, the 0 by N0 and the powerset of a set S by 2S . set N A nondeterministic one-way cellular automaton is a linear array of nondeterministic nite automata, sometimes called cells, each of them is connected to Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 807 815, 1998. c Sprin er-Verla Berlin Heidelber 1998
808
Thomas Buchholz et al.
its nearest nei hbor to the ri ht. For our convenience we identify the cells by natural numbers. The state transition depends on the actual state of each cell and the actual state of its nei hbor. The transition function is applied to all cells synchronously at discrete time steps. More formally: De nition 1. A nondeterministic one-way cellular automaton (NOCA) is a system (S #), where 1. S is the 2. # S is 3. : S 2 s 1 s2
nite, nonempty set of states, the boundary state, 2S is the local transition function satisfyin S : ( (s1 s2 ) = ) and ( (s1 s2 ) = #
s1 = #).
Let M be an NOCA with n cells. A con uration of M at some time i 0 is n] S. a description of its lobal state, which is actually a mappin ci : [1 Durin its course of computation an NOCA steps nondeterministically throu h a sequence of con urations. The con uration c0 at time 0 is de ned by the initial sequence of states in an NOCA, while subsequent con urations are chosen accordin to the lobal transition : N be an arbitrary natural number and c resp. c0 be de ned by Let n sn S resp. s01 s0n S. s1 c0
s01
(c)
The i-fold composition of 0
(s1 s2 ) s02
(s2 s3 )
s0n
(sn #)
is de ned as follows:
(c) := c
i+1
(c0 )
(c) := c0 2
i (c)
sn ) := si selects the ith component of s1 sn . If the state set is a i (s1 Sr , we will use the Cartesian product of some smaller sets S = S0 S1 notion ‘re ister’ for the sin le parts of a state. If the flow of information is extended to two-way, the resultin device is a nondeterministic two-way cellular automaton (NCA). I.e. the next state of each cell depends on the state of the cell itself and the states of its both immediate nei hbors (to the left and to the ri ht). An NOCA (NCA) is deterministic if (s1 s2 ) ( (s1 s2 s3 )) is a sin leton for all states s1 s2 s3 S. Deterministic cellular arrays are denoted by OCA resp. CA. De nition 2. Let A be an Alphabet and M = (S
#) be an NOCA with A
S.
S in t time steps 1. A word w A+ is accepted by M with nal states F t0 t such that there exists a con uration ct0 (c0 ) if there exists a t0 where 1 (ct0 ) F . 2. L(M) = w A+ w is accepted by M is the lan ua e accepted by M. N, t(n) n, be a mappin . If all w L(M) are accepted within 3. Let t : N t( w ) time steps, then L is said to be of time complexity t.
One Guess One-Way Cellular Arrays
809
The family of all lan ua es which can be accepted by an NOCA with time complexity t is denoted by t(n) (NOCA). If t equals the identity function id(n) := n acceptance is said to be in real-time and we write rt (NOCA). There is a natural way to restrict the nondeterminism of the arrays. One can limit the number of allowed nondeterministic state transitions of the cells. For the followin let us suppose the local transition consists of a deterministic and nondeterministic part d and nd , where d (s1 s2 ) nd (s1 s2 ). At a whole = nd remains nondeterministic, but with this distinction the restriction is easily de ned. nd denotes the lobal transition based on nd and d the deterministic one based on d . N be a mappin for which (n) t(n) holds. ives the number Let : N of allowed nondeterministic transitions. An NOCA of len th n for which the i-fold lobal transition i is de ned as
L
i
:=
L
i nd i− (n) d
if i (n) nd
(n)
otherwise
is denoted by G-OCA ( uess OCA). Observe that all nondeterministic transitions have to be applied before the deterministic ones. In the sequel we are mainly interested in NOCAs allowed to uess constant times (i.e. (n) = k, k N0 ).
Speed-Up and Guess Reduction It is known [4] that deterministic OCAs can be sped-up by a constant amount of time as lon as the remainin time complexity does not fall below real-time. For constructions it is sometimes convenient to have a correspondin result for 1G-OCAs: For example, after the rst nondeterministic step a deterministic t(n)-time OCA can be simulated and subsequently the resultin (t(n) + 1)-time 1G-OCA can be sped-up to a t(n)-time 1G-OCA a ain. Observe that in case of real-time it is not possible to speed-up the deterministic OCA by 1 time step before its simulation.
N, t(n) n, be a mappin and k Lemma 3. Let t : N number. Then t(n)+k (1G-OCA) = t(n) (1G-OCA) holds.
L
L
N0
be a constant
Proof. Let M be an 1G-OCA with time complexity t(n)+k which passes throu h the con urations c0 to ct(n)+k . An 1G-OCA M0 which simulates M in time t(n) works as follows. Each cell consists of k + 1 re isters each may contain a state from S, thus S 0 := S k+1 . k of the re isters are initially empty. The ri htmost cell ‘knows’ its input in advance (i.e. the border state). Thereck+1 (n) in the rst transition and store fore it can compute the states c1 (n) them in its re isters. Subsequently it simulates one step of cell n of M in every time step. At the second time step cell n − 1 observes the lled re isters of its ck+2 (n − 1) in one time step. nei hbor and can compute the states c2 (n − 1) A ain, subsequently it simulates one transition per time step. The behavior of
810
Thomas Buchholz et al.
cells n − 1 to 1 is identical. Thus at time n the rst cell computes the states cn+k (1), and at time t(n) the state ct(n)+k (1). cn (1) Deterministic OCAs can be sped-up from (n+t(n))-time to (n+ t(n) k )-time [1, 11]. Thus linear-time (i.e. k times real-time, k 1) is close by real-time. By the way, it is not the same, since the inclusion rt (OCA) rt (CA) (1+ )id (OCA) = is a proper one [17, 4]. For 1G-OCAs we have the followin stron er result, from which follows that real-time is as powerful as linear-time.
L
N, t(n) Theorem 4. Let t : N number. Then kt(n) (1G-OCA) =
L
L L L
L
n, be a mappin and k t(n) (1G-OCA) holds.
L
L
L
N be a constant
Proof. The inclusion t(n) (1G-OCA) kt(n) (1G-OCA) follows from the definition. In order to prove kt(n) (1G-OCA) t(n) (1G-OCA) let L be a lanua e belon in to kt(n) (1G-OCA) and let M be an 1G-OCA that accepts L with time complexity k t(n). We construct an 1G-OCA M0 that simulates M in time t(n). The idea is as follows: on an input of len th n each cell i with 1 i n k, ki and of M0 , uesses the initial states of the cells k(i − 1) + 1 k(i − 1) + 2 additionally what each cell of M mi ht have uessed with respect to these initial states. (For simplicity here we assume that n is a multiple of k. The other cases are omitted since their handlin is only a technical challen e.) Based on this compressed representation M0 can simulate k time steps of M per time step. In parallel M0 has to check whether the uesses of the initial states were correct. Therefore each cell (n k)j + i with 1 i n k and 0 j k−1 uesses the initial states of the cells (i − 1)n k + 1 (i − 1)n k + 2 in k, too. xn k So we are concerned with an interim con uration of the form x1 x2 where xi = k and each xi mi ht contain the compressed initial input. Now M0 subsequently veri es the rst checkin task that the initial states uessed in the cells correspondin to xj and xj+1 , are the same, 1 j < n k. Additionally it checks the second one whether the uessed initial states xn k are really the packed initial states of all cells. So in total it can be ensured that the simulation of M is based on the correct data. To complete the proof we have to show how the two checkin tasks can be realized. For the rst task w.l.o. . we may assume that k = 2. Further we may assume that the rst n 2 cells and the last n 2 cells are distin uishable which can be provided by uessin and a simple veri cation task. The rst checkin task is then performed as follows. The last n 2 cells shift there uessed initial states in some re ister with maximum speed to the left. Two initially empty re isters of each of the rst n 2 cells work as a queue in a rst-in rst-out manner throu h which the arrivin symbol stream is successively piped (cf. Fi . 1). Additionally in the ri htmost cell a si nal is enerated in the rst time step which moves leftward with maximum speed. If it enters one of the rst n 2 cells it checks whether the cell’s uessed initial states which were stored in some re ister are equal to the initial states that are currently in the position to leave the queue next. If they are not equal the si nal prohibits the cell and the cells left from this cell to become nal.
L
One Guess One-Way Cellular Arrays
ab cd ef gh ab cd ef gh
a
b
c
d
e
f
g
ab cd ef gh ab cd ef gh cd ef gh ab ab ef gh cd cd gh ab ef ab ef cd gh cd gh ab ef ab ef cd gh
1 abc 0 0 abc def
Fi . 1. Example to the proof of Theorem 4 with k = 2
0 abc 2 abc 1 def 0 ghi
1 abc 0 def 2 def 1 ghi 0 jkl
0 abc 2 abc 1 def 0 ghi 2 ghi 1 jkl
1 abc 0 def 2 def 1 ghi 0 jkl 2 jkl
0 abc 2 abc 1 def 0 ghi 2 ghi 1 jkl
h 1 abc 0 def 2 def 1 ghi 0 jkl 2 jkl
i 2 abc 1 def 0 ghi 2 ghi 1 jkl
j 2 def 1 ghi 0 jkl 2 jkl
811 k l 2 2 ghi jkl 1 jkl
Fi . 2. Example to the proof of Theorem 4 with k = 3
To perform the second checkin task each cell is equipped with a counter modulo k which is initialized to k − 1 and decremented by one at each time step. Further at each time step a cell takes over the uessed packed input symbols of its ri ht nei hbour if its counter di ers from k − 1 such that they are shifted throu h the cells. Otherwise a cell holds the packed input symbols which it actually contains (cf. Fi . 2). A ain in the ri htmost cell a si nal is enerated in the rst time step which moves leftward with maximum speed. If it enters a cell it checks whether the symbol in the packed representation at position r + 1 equals to the (real) initial state of that cell where r denotes the value of its counter. Similarly if there exists some cell where the equality check fails this si nal prohibits this cell and the cells left from this cell to become nal. The next result shows that k + 1 uesses per cell are not better than k uesses. Theorem 5. Let : N constant number. Then N, t(n) mappin s t : N
L
N,
t(n) ((
n.
(n) t(n), be a mappin and k N0 be a + k)G-OCA) = t(n) ( G-OCA) holds for all
L
Proof. It su ces to show the theorem for k = 1. Let M be a ( + 1)G-OCA. We construct a G-OCA M0 which simulates M without any loss of time. In its rst (nondeterministic) step M0 simulates the rst step of M and, additionally, another nondeterministic step of M for all possible pairs of states of M. The second result is stored in an additional re ister. It is a table S 2 S, which contains one row for every (s1 s2 ) S 2 . After (n) time steps the rst deterministic step of M0 is as follows. Every cell takes the actual state of itself and its nei hbor and selects the correspondin row in the table. The next state
812
Thomas Buchholz et al.
is the third component of that row. Since the third components were nondeterministically chosen a nondeterministic transition is simulated deterministically. From time (n) + 2 to t(n) M0 simulates M directly.
4
Comparisons with Deterministic Cellular Arrays
In order to compare the real-time computin power of 1G-OCAs to the wellinvesti ated deterministic devices we prove the followin theorem which states that the computin power of real-time OCAs is strictly increased by addin one nondeterministic step to that device. Theorem 6.
L
rt (OCA)
L
rt (1G-OCA)
Proof. Obviously, we have an inclusion between the families since the nondeterministic part of the state transition can be desi ned to be deterministic. In [3] L = wjwj w A+ rt (1G-OCA) has been shown for an arbitrary alphabet A. In [16] it was shown that it does not belon to rt (OCA): L intersected with 2 + is the unary lan ua e n n N which is not the re ular lan ua e re ular and thus not a real-time OCA lan ua e. Thus the inclusion is a proper one.
L
L
L
It is known that rt (OCA) is closed under inverse homomorphism [14], injective len th multiplyin homomorphism [5, 6] and inverse deterministic sm mappin s [10] but is not closed under -free homomorphism [14]. There is another relation between rt (OCA) and rt (1G-OCA). If we build the closure under -free homomorphisms of rt (OCA) we obtain exactly the family rt (1G-OCA). To prove the assertion we need the result from [3] that rt (OCA) is closed under another weak kind of homomorphism.
L
L
L
L
L
B be an -free homomorphism. h is structure De nition 7. Let h : A 0 A with h( ) = b1 bm and h( 0 ) = b01 b0n preservin if for every two 0 0 0 the sets b1 bm and b1 bn are disjoint if = . Lemma 8.
L
rt (OCA)
is closed under structure preservin homomorphism.
L
Theorem 9. 1. Let L be a lan ua e belon in to rt (OCA) and h be an -free homomorphism. Then h(L) belon s to rt (1G-OCA). 2. Let L be a lan ua e belon in to rt (1G-OCA). Then there exist an -free 0 homomorphism and a lan ua e L0 rt (OCA) such that h(L ) = L holds.
L L L
Proof. a) Let L be a lan ua e over the alphabet A = 1 B be de ned accordin to homomorphism h : A b1 n1 h( m ) = bm 1 bm nm h( 1 ) = b1 1 where bij B.
m
and a
One Guess One-Way Cellular Arrays
813
We introduce an alphabet B := b1 1 b 1 m1 b 2 1 bm nm of di erent B: symbols and a structure preservin homomorphism h0 : A b1 n1 h0 ( m ) = b m 1 bm nm h0 ( 1 ) = b 1 1 Since rt (OCA) is closed under structure preservin homomorphism h0 (L) is a real-time OCA lan ua e. De ne an -free len th preservin homomorphism B : h00 (b1 1 ) = b1 1 h00 (bm nm ) = bm nm . h00 : B Obviously, we have h(L) = h00 (h0 (L)). An 1G-OCA M0 that accepts h(L) in n + 1 time steps works as follows. Since h00 is len th preservin , in the rst time step every cell can uess the inverse ima e of its initial state under h00 . Durin the next n time steps M0 simulates a real-time OCA M that accepts h0 (L). As shown in Lemma 3 we can speed-up M by one time-step. b) Let M be an 1G-OCA acceptin L in real-time. M can be simulated by another 1G-OCA M0 which works in (n + 1)-time as follows. In the rst step M0 uesses the state of each cell of M at time 2. In the second step M0 veri es its uess. Durin the steps 3 to n + 1 M0 works exactly as M durin the steps 2 to n. Now let M00 be an OCA which simulates the computation of M0 durin the time steps 2 to n + 1 and h be the -free homomorphism that maps a pair of states of M to the rst component h(s1 s2 ) = s1 . Thus h(L(M00 )) = L.
L
Addin two-way communication to deterministic cellular arrays yields more powerful real-time devices. It is well known that rt (CA) is a proper superset of rt (OCA) [14]. The followin two theorems relate both au mentations.
L
L
Theorem 10.
L
rt (CA)
L
rt (1G-OCA)
L L L
R Proof. In [4, 17] it has been shown that L rt (CA) if and only if L R denotes the reversal of L. From Theorem 4 we know 2id (OCA), where L 2id (1G-OCA) = rt (1G-OCA). The inclusion 2id (OCA) 2id (1G-OCA) holds due to structural reasons. In [3] the closure of rt (1G-OCA) under reversal was shown what proves the assertion.
L L
L
Theorem 11.
L
rt (1G-OCA)
L
L (CA)
Proof. The idea is to construct a brute-force CA which tries all possible choices of the rt (1G-OCA). In order to realize such a behavior we need two mechanisms. One has to select successively all possible choices. The other mechanism is the simulation of the rt (1G-OCA) on the actual choice. To control the mechanisms we use synchronization by a modi ed fssp. If the synchronization is started at both border cells simultaneously it can be done in exactly n time steps, where n is the len th of the array. This process can be repeated such that the array res every n time steps. Let S denote the state set of a real-time 1G-OCA. To enerate all of its possible time step 1 con urations it su ces to set up a S -ary counter. At most every possible number on the counter corresponds to one con uration. To increment the counter a si nal is send from the border cell containin the least si ni cant di it to the opposite. It needs n time steps.
L
L
814
Thomas Buchholz et al.
L
Subsequently n time steps of the rt (1G-OCA) are simulated in a strai htforward manner. The input is accepted if one of the choices leads to an acceptin simulation. Otherwise it is rejected when the border cell containin the most si ni cant di it enerates a carry-over.
5
Closure Properties
The family
L
Lemma 12. ence.
rt (1G-OCA)
L
has stron closure properties.
rt (1G-OCA)
is closed under union, intersection and set di er-
Proof. Usin the same two channel technique of [15] and [7] the assertion is easily seen. Each cell consists of two re isters in which acceptors for both lan ua es are simulated in parallel.
L
Theorem 13. rt (1G-OCA) is an AFL (i.e. is closed under intersection with re ular sets, inverse homomorphism, -free homomorphism, union, concatenation and positive closure). Proof. Closure under intersection with re ular sets and union have been shown in Lemma 12. Assume there is a lan ua e L0 rt (1G-OCA) and an -free homomorphism h0 such that L00 := h0 (L0 ) rt (1G-OCA). From Theorem 9 follows that there exists a lan ua e L rt (OCA) and an -free homomorphism h such that h(L) = L0 . Therefore we have L00 = h0 (h(L)). Since h0 h is an -free homomorphism too, Theorem 9 is contradicted. The closure under -free homomorphism follows. A be a hoLet L rt (1G-OCA) be a lan ua e over A and h : B momorphism. From Theorem 9 we obtain a real-time OCA lan ua e L0 over A with h0 (L0 ) = L. Let A0 and a len th preservin homomorphism h0 : A0 0 0 h1 be the homomorphism with h1 ((x x )) = x for every x B, x0 A0 with h(x) = h0 (x0 ). Further let p1 be an -free homomorphism with p1 ((x x0 )) = x 0 −1 0 (h (L0 )) = h−1 (L). Since rt (OCA) for x B, x0 A0 . Then p1 (h−1 1 (L )) = h 0 is closed under inverse homomorphism [14], h−1 rt (OCA). Now 1 (L ) belon s to −1 Theorem 9 implies h (L) rt (1G-OCA) which proves the closure under inverse homomorphism. Now let L1 L2 rt (1G-OCA) and M1 , M2 be acceptors for L1 and L2 . We construct a 2G-OCA M0 that accepts the concatenation L1 L2 in n + 1 time steps. To accept an input w1 w2 , w1 L1 , w2 L2 , M0 uesses in its rst time step the cell in which the rst symbol of w2 occurs. In the remainin time steps 2 to n + 1 M0 simulates M1 in the left part on w1 and M2 in the ri ht part of the array on w2 . Due to Theorem 5 we can construct an 1G-OCA that accepts L1 L2 in time n + 1 which accordin to Lemma 3 can be sped-up to work in real-time. The closure under positive closure follows analo ously.
L
L
L
L
L
L
L
L
One Guess One-Way Cellular Arrays
Corollary 14.
L
rt (1G-OCA)
815
is closed under -free substitution.
Proof. In [8] it has been shown that an AFL that is closed under intersection is also closed under -free substitution. Thus the assertion follows from Lemma 12 and Theorem 13.
L
In [3] it has been shown that rt (1G-OCA) is closed under reversal and that (CA). Up to now it is not theorem 11 proves the inclusion rt (1G-OCA) known whether the family is closed under complement. A ne ative answer would imply that there exists a CA lan ua e which is not a real-time CA lan ua e.
L
L
References [1] Bucher, W., Culik II, K.: On real time and linear time cellular automata. RAIRO Inform. Theor. 18 (1984) 307 325 [2] Buchholz, Th., Kutrib, M.: On time computability of functions in one-way cellular automata. Acta Inf. 5 (1998) 329 352 [3] Buchholz, Th., Klein, A., Kutrib, M.: One uess one-way cellular arrays. Research Report 9801, Institute of Informatics, University of Giessen, Gie en, 1998. [4] Cho rut, C., Culik II, K.: On real-time cellular automata and trellis automata. Acta Inf. 21 (1984) 393 407 [5] Culik II, K., Gruska, J., Salomaa, A.: Systolic trellis automata I. Internat. J. Comput. Math. 15 (1984) 195 212 [6] Culik II, K., Gruska, J., Salomaa, A.: Systolic trellis automata II. Internat. J. Comput. Math. 16 (1984) 3 22 [7] Dyer, C. R.: One-way bounded cellular automata. Inform. Control 44 (1980) 261 281 [8] Ginsbur , S., Hopcroft, J. E.: Two-way balloon automata and AFL. J. Assoc. Comput. Mach. 17 (1970) 3 13 [9] Ibarra, O. H., Jian , T.: On one-way cellular arrays. SIAM J. Comput. 16 (1987) 1135 1154 [10] Ibarra, O. H., Kim, S. M.: Characterizations and computational complexity of systolic trellis automata. Theoret. Comput. Sci. 29 (1984) 123 153 [11] Ibarra, O. H., Palis, M. A.: Some results concernin linear iterative (systolic) arrays. J. Parallel and Distributed Comput. 2 (1985) 182 218 [12] Kutrib, M.: Pushdown cellular automata. Theoret. Comput. Sci. (1998) [13] Kutrib, M., Richstein, J.: Real-time one-way pushdown cellular automata lanua es. In: Developments in Lan ua e Theory II. At the Crossroads of Mathematics, Computer Science and Biolo y, World Scienti c, Sin apore, (1996) 420 429 [14] Seidel, S. R.: Lan ua e reco nition and the synchronization of cellular automata. Technical Report 79-02, Department of Computer Science, University of Iowa, 1979 [15] Smith III, A. R.: Real-time lan ua e reco nition by one-dimensional cellular automata. J. Comput. System Sci. 6 (1972) 233 253 [16] Terrier, V.: Lan ua e reco nizable in real time by cellular automata. Complex Systems 8 (1994) 325 336 [17] Umeo, H., Morita, K., Su ata, K.: Deterministic one-way simulation of two-way real-time cellular automata and its related problems. Inform. Process. Lett. 14 (1982) 158 161 [18] Vollmar, R.: Al orithmen in Zellularautomaten. Teubner, Stutt art, 1979
Topolo ical De nitions of Chaos Applied to Cellular Automata Dynamics Gianpiero Cattaneo1 and Luciano Mar ara2 1
2
Dipartimento di Scienze dell’Informazione, Universita di Milano, Via Comelico 39, 20135 Milano, Italy. cattan @dsi.unimi.it Dipartimento di Scienze dell’Informazione, Universita di Bolo na, Mura Anteo Zamboni 7, 40127 Bolo na, Italy. mar
[email protected] Abstract. We apply the two di erent de nitions of chaos iven by Devaney and by Knudsen for eneral discrete time dynamical systems (DTDS) to the case of 1-dimensional cellular automata. A DTDS is chaotic accordin to the Devaney’s de nition of chaos i it is topolo ically transitive, has dense periodic orbits, and it is sensitive to initial conditions. A DTDS is chaotic accordin to the Knudsen’s de nition of chaos i it has a dense orbit and it is sensitive to initial conditions. We continue the work initiated in [3], [4], [5], and [14] by provin that an easy-to-check property of local rules on which cellular automata are de ned introduced by Hedlund in [11] and called permutivity is a su cient condition for chaotic behavior. Permutivity turns out to be also a necessary condition for chaos in the case of elementary cellular automata while this is not true for eneral 1-dimensional cellular automata. The main technical contribution of this paper is the proof that permutivity of the local rule either in the leftmost or in the ri htmost variable forces the cellular automaton to have dense periodic orbits.
1
Introduction
The notion of chaos is very appealin , and it has intri ued many scientists (see [1,2,9,13,16] for some works on the properties that characterize a chaotic process). There are simple deterministic dynamical systems that exhibit unpredictable behavior. Thou h counterintuitive, this fact has a very clear explanation. The lack of in nite precision in the description of the state of the system causes a loss of information which is dramatic for some processes which quickly loose their deterministic nature to assume a non deterministic (unpredictable) one. A chaotic phenomenon can indeed be viewed as a deterministic one, in the presence of in nite precision, and as a nondeterministic one, in the presence of nite precision constraints. Thus one should look at chaotic processes as at processes mer ed into time, space, and precision bounds, which are the key resources in the science of computin . A nice way in which one can analyze this nite/in nite dichotomy is by usin cellular automata (CA) models. CA are dynamical systems consistin of a re ular lattice of variables which can take a nite Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 816 824, 1998. c Sprin er-Verla Berlin Heidelber 1998
Topolo ical De nitions of Chaos Applied to Cellular Automata Dynamics
817
number of discrete values. The lobal state of the CA, speci ed by the values of all the variables at a iven time, evolves in synchronous discrete time steps accordin to a iven local rule which acts on the value of each sin le variable. is the Consider the 1-dimensional CA X , where X = 0 1 Z and left-shift map on X associatin to any con uration c 0 1 Z the next time Z In step con uration (c) 0 1 Z de ned by [ (c)](i) = c(i + 1) i order to completely describe the elements of X, we need to operate on two-sided sequences of binary di its of in nite len th. Assume for a moment that this is possible. Then the shift map is completely predictable, i.e., one can completely X and for any inte er n. In practice, only nite describe n (x) for any x objects can be computationally manipulated. Let x X Assume we know a portion of x of len th n. One can easily verify that n (x) completely depends on the unknown portion of x. In other words, if we have nite precision, the shift map becomes unpredictable, as a consequence of the combination of the nite precision representation of x and the sensitivity of . In the case of discrete time dynamical systems X F , many de nitions of chaos are based on the notion of sensitivity to initial conditions (see for example [9,12]). Here, we assume that the phase space X is equipped with a distance d and that the next state map F : X X is continuous on X accordin to the topolo y induced by the metric d. De nition 1 (Sensitivity). A DTDS X F is sensitive to initial conditions i >0 x X Constant
>0 y X n N:
(d(x y)
and d(F n (x) F n (y))
)
is called the sensitivity constant.
Intuitively, a map is sensitive to initial conditions, or simply sensitive, if there exist points arbitrarily close to x which eventually separate from x by at least under iteration of F . We emphasize that not all points near x need eventually separate from x, but there must be at least one such point in every nei hborhood of x. In the case of continuous dynamical systems de ned on a metric space, there are many possible de nitions of chaos, ran in from measure theoretic notions of randomness in er odic theory to the topolo ical approach we will adopt here. We now recall some other properties which are central to topolo ical chaos theory namely, havin a dense orbit, topolo ical transitivity, and denseness of periodic points. De nition 2 (Dense orbit). A dynamical system X F has a dense orbit i x X
y X
>0 n N:
d(F n (x) y)
The existence of a dense orbit implies topolo ical transitivity.
818
Gianpiero Cattaneo and Luciano Mar ara
De nition 3 (Transitivity). A dynamical system X F is topolo ically transitive i for all nonempty open subsets U and V of X n N : F n (U )
V =
Intuitively, a topolo ically transitive map has points which eventually move under iteration from one arbitrarily small nei hborhood to any other. As a consequence, the dynamical system cannot be decomposed into two disjoint closed sets which are invariant under the map (undecomposability condition). De nition 4 (Denseness of periodic points). A dynamical system X F has dense periodic points i the set of all the periodic points of F de ned by P er(F ) = x X k N : F k (x) = x is a dense subset of X, i.e., x X
> 0 p P er(F ) : d(x p)
Denseness of periodic points is often referred to as the element of re ularity a chaotic dynamical system should exhibit. The popular book by Devaney [9] isolates three components as bein the essential features of topolo ical chaos. They are formulated for a continuous map F : X X, on some metric space (X d). De nition 5 (D-chaos). Let F : X X be a continuous map on a metric space (X d). Then the dynamical system X F is chaotic accordin to the Devaney’s de nition of chaos (D-chaotic) i (D1 ): F is topolo ically transitive, (D2 ): F has dense periodic points (topolo ical re ularity), and (D3 ): F is sensitive to initial conditions. It has been proved in [2] that for a eneric DTDS, transitivity and denseness of periodic points imply sensitivity to initial condition. A stron er result has been proved in [6] by one of the authors in the case of CA dynamical systems: topolo ical transitivity alone implies sensitivity to initial conditions. As a consequence of these results, in order to prove that a DTDS X F is chaotic in the sense of Devaney, one has only to prove properties D1 and D2 . Knudsen in [13] proved that in the case of a dynamical system which is chaotic accordin to Devaney’s de nition, the restriction of the dynamics to the set of periodic points (which is clearly invariant) is Devaney’s chaotic too. Due to the lack of nonperiodicity this is not the kind of system most people would consider labelin chaotic. In view of these considerations, Knudsen proposed the followin de nition of chaos which excludes chaos without non-periodicity [13]. De nition 6 (K-chaos). Let F : X X be a continuous map on a metric space (X d). Then the dynamical system X F is chaotic accordin to the Knudsen’s de nition of chaos (K-chaotic) i (K1 ): F has a dense orbit, and (K2 ): F is sensitive to initial conditions.
Topolo ical De nitions of Chaos Applied to Cellular Automata Dynamics
819
The two-sided shift dynamical system AZ on a nite alphabet A is a paradi matic example of both Devaney’s and Knudsen’s chaotic system. In the case of perfect compact DTDS, i.e., DTDS whose phase space is a perfect and compact metric space, we have that topolo ical transitivity is equivalent to have a dense orbit. In addition, in this case the next state map is surjective. As we will see later, the phase space of DTDS induced by CA local rules is perfect and compact. As a consequence, the followin immediately follows. 1- If a compact DTDS X F is D-chaotic then it is K-chaotic. 2- In the case of a DTDS AZ Ff induced by a CA local rule f , the dynamical system is K-chaotic i it is topolo ically transitive. In the case of 1-dimensional CA, there have been many attempts of classi cation accordin to their asymptotic behavior (see for example [5,7,10,15,17]), but none of them completely captures the notion of chaos. As an example, Wolfram divides 1-dimensional CA in four classes accordin to the outcome of a lar e number of experiments. Wolfram’s classi cation scheme, which does not rely on a precise mathematical de nition, has been formalized by Culik and Yu [8] who split CA in three classes of increasin complexity. Unfortunately membership in each of these classes is shown to be undecidable. In this paper we complete the work initiated in [3], [4], [5], and [14], where the authors for the rst time apply the de nition of chaos iven by Devaney and by Knudsen to CA. More precisely: - In [5] the authors make a detailed analysis of the behavior of the elementary CA based on a particular non-additive rule (rule 180) and prove its chaoticity accordin to the Devaney’s de nition of chaos. - In [14] the authors completely classify 1-dimensional additive CA de ned over any alphabet of prime cardinality accordin to the Devaney’s de nition of chaos. - In [4] the authors completely characterize topolo ical transitivity for every Ddimensional additive CA over Zm (m 2, and D 1) and denseness of periodic points for any 1-dimensional additive CA over Zm (m 2). - In [3] the authors classify a number of non-additive elementary CA (ECA), i.e., binary 1-dimensional CA with radius 1, accordin to the Devaney de nition of chaos and leave open the problem of the classi cation of all ECA. In this paper we apply both the Devaney’s and the Knudsen’s de nitions of chaos to the class of ECA. To this extent, we introduce the notion of permutivity of a map in a certain variable. A boolean map f is permutive in the variable xi ) = 1 − f( 1 − xi ) In other words, f is permutive in xi if f ( the variable xi if any chan e of the value of xi causes a chan e of the output produced by f , independently of the values assumed by the other variables. The main results of this paper can be summarized as follows. Every 1-dimensional CA based on a local rule f which is permutive either in the rst (leftmost) or in the last (ri htmost) variable is Devaney, and then Knudsen, chaotic. An ECA based on a local rule f is Devaney chaotic if and only if f is permutive either in the rst (leftmost) or in the last (ri htmost) variable (in this case Devaney and Knudsen chaoticity are equivalent).
820
Gianpiero Cattaneo and Luciano Mar ara
There exist chaotic CA based on local rules that are not permutive in any variable. We wish to emphasize that in this paper we propose the rst complete classi cation of the ECA rule space based on a widely accepted ri orous mathematical de nition of chaos.
2
Notations and De nitions
For m 2, let A = 0 1 m − 1 denote the rin of inte ers modulo m with the usual operations of addition and multiplication modulo m. We call A the A be any map dependin on the 2k + 1 alphabet of the CA. Let f : A2k+1 xk . We say that k is the radius of f . A 1-dimensional CA variables x−k based on the local rule f is the pair AZ F , where AZ = c : Z
A i
is the space of con urations and F : AZ de ned as follows. For any con uration c [F (c)](i) = f (c(i − k)
c(i)
AZ is the lobal next state map, AZ and for any i Z c(i + k))
Throu hout the paper, F (c) AZ will denote the result of the application of the map F to the con uration c AZ and c(i) A will denote the ith element of the con uration c. We recursively de ne F n (c) by F n (c) = F (F n−1 (c)) where F 0 (c) = c In order to specialize the notions of sensitivity to the case of D-dimensional CA, we introduce the followin distance (known as Tychono distance) over the space of con urations. For every a b AZ d(a b) =
+1 X
1 a(i) − b(i) jij m i=−1
where m is the cardinality of A. It is easy to verify that d is a metric on AZ and that the metric topolo y induced by d coincides with the product topolo y induced by the discrete topolo y of A. With this topolo y, AZ is a complete, compact and totally disconnected space and F is a (uniformly) continuous map, whatever be the CA local rule inducin this lobal next state map. We now ive the de nition of permutive local rule and that of leftmost [resp., ri htmost] permutive local rule, respectively. De nition 7. [11] f is permutive in xi , −k x−k
xi−1 xi+1
i xk
k i for any iven sequence A2k
we have f (x−k
xi−1 xi xi+1
xk ) : xi
A =A
Topolo ical De nitions of Chaos Applied to Cellular Automata Dynamics
821
De nition 8. The CA local rule f is said to be leftmost [resp., ri htmost] permutive i there exists an inte er i : −k i 0 [resp., i : 0 i k] such that 1. i = 0, 2. f is permutive in the ith variable, and 3. f does not depend on xj j i, [resp., j > i]. De nition 9. A 1-dimensional CA based on a local rule f : A2k+1 elementary CA (ECA) i k = 1 and A = 0 1
A is an
3
We enumerate the 22 = 256 di erent ECA as follows. The ECA based on the local rule f is associated with the natural number nf , where nf = f (0 0 0) 20 + f (0 0 1) 21 + In the case of ECA, a rule f : 0 1 x0 x1 :
3
+ f (1 1 0) 26 + f (1 1 1) 27 0 1 is leftmost permutive i
f (0 x0 x1 ) = f (1 x0 x1 )
Similarly, it is ri htmost permutive i x−1 x0 :
3
f (x−1 x0 0) = f (x−1 x0 1)
Chaotic Cellular Automata
In this section we analyze lobal dynamics of 1-dimensional CA accordin to both Knudsen’s and Devaney’s De nitions of Chaos. Leftmost and/or Ri htmost Permutive CA: D-Chaos. We recall the followin result due to one of the authors.
Theorem 1. [14] Let AZ F be any leftmost and/or ri htmost permutive 1Z dimensional CA de ned on a nite alphabet A. Then A F is topolo ically transitive (K-chaotic). We now prove now that Leftmost [Ri htmost] Permutive 1-dimensional CA have dense periodic points. To this extent we need some preliminary de nitions and lemmas. We say that a con uration x AZ is spatially periodic i there exists s N such that s (x) = x
Lemma 1. Let AZ F be a surjective CA. Every predecessor accordin to F of a spatially periodic con uration is spatially periodic Proof. Let x y AZ be such that F (x) = y and every i Z we have F(
is
(x)) =
is
(F (x)) =
is
s
(y) = y for some s
N For
(y) = y
Assume that x is not spatially periodic. Then there exist in nitely many predecessors of y accordin to F namely, is (x) i Z Since every 1-dimensional surjective CA have a nite number of predecessors (see [11]), we have a contradiction.
822
Gianpiero Cattaneo and Luciano Mar ara
We now ive the de nition of Ri ht [Left] CA.
De nition 10. Let AZ F be a CA based on the local rule f (x−r x0 [x0 xr ]. is a Ri ht [Left] CA i f does not depend on x−r
xr ). F
We have the followin Lemma.
Lemma 2. Let AZ F be a Ri ht [Left] CA. Then G = I − F is surjective, where I denotes the identity map. Proof. Since F is a Ri ht [Left] CA, we have that I − F is Leftmost [Ri htmost] permutive and then surjective. In the next theorem we prove that for surjective Ri ht [Left] CA periodic conurations are also spatially periodic.
Theorem 2. Let AZ F be a Ri ht [Left] CA (non necessarily surjective). Then for every x AZ we have ( s N : s (x) = x) t N : F t (x) = x Proof. If x is periodic for F , i.e., F n (x) = x, then x is a predecessor of the allzero con uration ( 0 0 0 ) accordin to G = I − F n . Since F is a Ri ht n [Left] CA then F is a ain a Ri ht [Left] CA and then, from Lemma 2, we have that G = I − F n is surjective for every n N. From Lemma 1 we conclude that x is spatially periodic.
Corollary 1. Let AZ F be a (non necessarily surjective) CA. Let n Z be such that G = n F is a Ri ht [Left] CA lobal map. Every periodic con uration for G is periodic also for F i.e., 0 t0 N : F t (x) = x t N : Gt (x) = x Proof. Let x be such that Gt (x) = x. From Theorem 2 we have that there exists s N such that s (x) = x We have x = Gt (x) = Gts (x) = ( n F )ts (x) = nts F ts (x) = F ts nts (x) = F ts (x) We are now ready to prove the main result of this section. Theorem 3. Ri htmost [Leftmost] permutive 1-dimensional CA have dense periodic points. Proof. Assume without loss of enerality that F is Ri htmost permutive. Let s Z be such that Gs = s F is a Ri ht CA. We now prove that Gs has dense periodic orbits. Let w = (w−k
w0
wk )
A2k+1 m
Topolo ical De nitions of Chaos Applied to Cellular Automata Dynamics
be any nite con con uration
AZ m be the followin
uration of len th 2k + 1. Let V0 V0 =
2 1 w−k
w0
wk
823
1 2
where w is centered at the ori in of the lattice, i.e., V0 (0) = w0 Since Gs is a ri htmost permutive CA then, in view of Theorem 1, it is topolo ically transitive and there exist n N and W0 =
0 0 2 1 w−k
such that
w0
wk
0 0 1 2
Gn (V0 ) = W0
Let W1 =
0 0 2 1 w−k
w0
wk
0 1 2
Since Gs is a Ri ht and Ri htmost permutive CA one can nd suitable such that w0 wk 1 200 300 ) = W1 Gns ( 3 2 1 w−k Let V1 =
0 3 2 1 w−k
w0
wk
00 i
i
2,
00 00 1 2 3
Since Gs is a Ri ht CA, we have Gns (V1 ) =
00 00 0 3 2 1 w−k
w0
wk
0 0 1 2 3
for some 00i i 2 By repeatin the above procedure we are able to construct a sequence of pairs of con urations (Vi Wi ) such that Gn (Vi ) = Wi and Vi (j) = Wi (j) for j = −i − k k + i and i = 1 2 Since AZ is a complete space we have lim Wi = lim Vi = W
i!1
i!1
and Gn (W ) = W
Since w can be arbitrarily chosen, we conclude that G has dense periodic orbits. Finally, from Corollary 1 we conclude that F has dense periodic points. Leftmost and/or Ri htmost Permutive ECA: Topolo ical Chaos. Since boolean CA are based on the alphabet 0 1 which has prime cardinality and from Theorem 1, we have the followin corollary. Corollary 2. All the leftmost and/or ri htmost permutive ECA are D-chaotic. Next result (whose proof will be iven in the full paper) shows that if an ECA is neither leftmost nor ri htmost permutive, then it is not surjective and then not topolo ically transitive.
Theorem 4. Let 0 1 Z F be a non trivial ECA based on the local rule 0 1 If F is surjective, then f is either leftmost or ri htmost f : 0 1 3 permutive.
824
Gianpiero Cattaneo and Luciano Mar ara
We summarize the results of this paper in the followin corollary.
Corollary 3. Let 0 1 Z F be an ECA based on the local rule f . Then, the followin statements are equivalent. 1. f is either leftmost or ri htmost permutive (or both). 2. F is Devaney-chaotic. 3. F is Knudsen-chaotic. 4. F is surjective and non-trivial.
References 1. D. Assaf, IV and W. A. Coppel, De nition of Chaos. The American Mathematical Monthly 99, 865, 1992. 2. J. Banks, J. Brooks, G. Cairns, G. Davis, and P. Stacey, On the Devaney’s De nition of Chaos. The American Mathematical Monthly 99, 332 334, 1992. 3. G. Cattaneo, M. Finelli, L. Mar ara, Topolo ical Chaos for Elementary Cellular Automata. Italian Conference on Al orithm and Complexity (CIAC’97), LNCS n. 1203. 4. G. Cattaneo, E. Formenti, G. Manzini, and L. Mar ara, Er odicity, Transitivity, and Re ularity for Linear Cellular Automata Over Zm . Theoretical Computer Science, to appear. A preliminary version of this paper has been presented to the Symposium of Theoretical Computer Science (STACS’97), LNCS n. 1200. 5. G. Cattaneo, L. Mar ara, Generalized Sub-shifts in Elementary Cellular Automata. The Stran e Case of Chaotic Rule 180. Theoretical Computer Science, to appear. 6. B. Codenotti and L. Mar ara, Transitive Cellular Automata are Sensitive. The American Mathematical Monthly 10 , 58 62, 1996. 7. K. Culik, L. P. Hurd, and S. Yu, Computation Theoretic Aspects of Cellular Automata. Physica D 45, 357 378, 1990. 8. K.Culik and S. Yu, Undecidability of Cellular Automata Classi cation Schemes. Complex Systems 2(2), 177 190, 1988. 9. R. L. Devaney, An Introduction to Chaotic Dynamical Systems. Addison Wesley, 1989. 10. H. A. Gutowitz, A Hierarchical Classi cation of Cellular Automata. Physica D 45, 136 156, 1990. 11. G. A. Hedlund, Endomorphism and Automorphism of the Shift Dynamical System. Mathematical System Theory (4), 320 375, 1970. 12. C. Knudsen, Aspects of Noninvertible Dynamics and Chaos, Ph.D. Thesis, 1994. 13. C. Knudsen, Chaos Without Nonperiodicity, The American Mathematical Monthly 101, 563 565, 1994. 14. P. Favati, G. Lotti and L. Mar ara, Additive One Dimensional Cellular Automata are Chaotic Accordin to Devaney’s De nition of Chaos. Theoretical Computer Science 174(1-2), 157 170, 1997. 15. K. Sutner, Classifyin Circular Cellular Automata. Physica D 45, 386 395, 1990. 16. M. Vellekoop and R. Ber lund, On Intervals, Transitivity = Chaos. The American Mathematical Monthly 101, 353 355, 1994. 17. S. Wolfram, Theory and Application of Cellular Automata. Word Scienti c Publishin Co., Sin apore, 1986.
Characterization of Sensitive Linear Cellular Automata with Respect to the Countin Distance Giovanni Manzini1 2 1
Dipartimento di Scienze e Tecnolo ie Avanzate, Universita Piemonte Orientale, 15100 Alessandria, Italy. 2 Istituto di Matematica Computazionale, CNR, 56126 Pisa, Italy.
Abs rac . In this paper we ive su cient and necessary conditions for a linear 1-dimensional cellular automaton F to be sensitive with respect to the countin distance de ned by Cattaneo et al. in [MFCS ’97, pa . 179 188]. We prove an easy-to-check characterization in terms of the coe cients of the local rule, and an alternative characterization based on the properties of the iterated map F n .
1
Introduction
One-dimensional Cellular Automata (CA) are dynamical systems consistin of a bi-in nite array of cells which can take a nite number of discrete values. The lobal state of the CA, speci ed by the values of all the cells at a iven time, evolves in synchronous discrete time steps accordin to a iven local rule which acts on the value of each sin le cell. CA have been widely studied in a number of disciplines (e. ., computer science, physics, mathematics, biolo y, chemistry) with di erent purposes (e. ., simulation of natural phenomena, pseudo-random number eneration, ima e processin , analysis of universal model of computations, crypto raphy). Since their introduction, CA have been analyzed usin tools derived from the theory of discrete time dynamical systems. That is, the concepts of sensitivity, expansivity, transitivity, er odicity, etc. have been considered for CA, and many e orts have been made to determine when a CA satis es one of these properties. This study has provided many insi hts into the relationship between the local rule overnin the evolution of the CA and its lon term behavior (see for example [1,2,5,6,8,12,10,11,13]). The study of some of the dynamical properties of CA requires the introduction of a distance over the space of con urations. The most commonly used distance is the so-called Tychono distance. Accordin to this distance, two conurations are close if they di er only in cells which are far away from the center of the bi-in nite array. As a result, the study of, say sensitivity or transitivity, with respect to this metric provides useful information on the extent to which di erences far away from the center of the array can influence the central re ion. Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 825 833, 1998. c Sprin er-Verla Berlin Heidelber 1998
826
Giovanni Manzini
If we study the dynamical properties with respect to a di erent distance, we will likely et quite di erent results. Obviously, there is nothin like a true distance for CA: every distance deserves to be investi ated if it provides useful information on the behavior of CA. In [3], the authors introduce a new distance for CA which has many attractive features. This distance, that we call countin distance, wei hts all cells equally. The distance between two con urations x y is based on the asymptotic ratio between the number of cells in which x and y di er and the number of cells in which they coincide. Loosely speakin , when we use this metric the dynamical properties measure the e ects of modifyin a small fraction of the cells, re ardless of where they are located. In this paper we characterize which linear CA over the rin Zm are sensitive with respect to the countin distance. We provide two characterizations. The rst one (Corollary 1) is based on cd computations involvin the coe cients of the local rule. The second one (Corollary 2) is based on the number of nonzero cells enerated by the CA startin with a con uration containin a sin le nonzero cell and executin n iterations. The proofs of these results required techniques which are di erent, and in eneral more complex, from those employed in [10] for the characterization of sensitive CA with respect to the Tychono distance. Comparin the results of this paper with those in [10], we et that linear CA which are sensitive with respect to the countin distance are sensitive with respect to the Tychono distance, whereas the vice versa does not hold. Sensitivity with respect to the countin distance has been studied also in [3]. There the authors prove that the linear CA based on the elementary rules 60 and 90 are sensitive, and conjecture that sensitivity is related to the Hausdor dimension of the CA limit set. We believe that the results obtained in this paper can be useful to prove or disprove this conjecture. Due to the limited space we omit the proof of some of the technical lemmas. Full details are iven in [9].
2
Cellular Automata
For m 2, let Zm = 0 1 m − 1 denote the rin of inte ers modulo m. We Zm which consists of all consider the space of con urations Cm = c c: Z functions from Z into Zm . Each element of Cm can be visualized as a bi-in nite array in which each cell contains an element of Zm . Cm de ned Let r 0. A (1-dimensional) CA of radius r is a map F : Cm as follows [F (c)](i) = f (c(i − r) c(i − r + 1)
c(i + r − 1) c(i + r))
c
Cm i
Z
In other words, the content of cell i in the con uration F (c) is a function of the contents of cells i − r i + r in the con uration c. Note that the same local rule f determines the new value [F (c)](i) for all i Z. In this paper we consider xr ) = linear CA, that is, CA which have a local rule of the form f (x−r
Characterization of Sensitive Linear Cellular Automata
827
Pr
mod m where at least one of a−r and ar is nonzero. Usin this =−r a x notation, the lobal map F becomes [F (c)](i) =
r X
aj c(i + j) mod m
c
Cm i
Z
j=−r
Throu hout the paper, F (c) will denote the result of the application of the map F to the con uration c and c(i) will denote the value assumed by c in i. For n 0, we recursively de ne F n (c) by F n (c) = F (F n−1 (c)), where F 0 (c) = c. Given two con urations a b Cm we de ne their sum a + b by the rule (a + b)(i) = a(i) + b(i) mod m. If F is linear we have F (a + b) = F (a) + F (b). A special con uration is the null con uration 0 which has the property that 0(i) = 0 for all i Z. In the followin we use (F ) to denote the radius of a CA F . Note that (F n ) n (F ). The equality always holds when m is prime, but does not hold in eneral. For example, if m = 4 and f (x0 x1 ) = x0 + 2x1 we have (F ) = 1 and (F 2 ) = 0. Example 1. An important CA is the ri ht shift map (Cm ) de ned by [ (c)](i) = c(i − 1) The map corresponds to the local rule f (x−1 x0 x1 ) = x−1 . The inverse of is the left shift map de ned by [ −1 (c)](i) = c(i+1) which corresponds to the local rule f (x−1 x0 x1 ) = x1 . For j 0 the iterated map j is such that [
j
(c)](i) = c(i − j)
c
Cm i
Z
(1)
In the followin we use j with j 0 to denote the map −1 iterated j times. Note that, usin this notation, (1) holds for any j Z. A fundamental property of the shift map is that it commutes with any other CA (Cm F ). That is, for F =F . any i Z, we have A convenient notation for the study of linear CA, is the formal power series (fps) representation of the con uration space Cm (see [7, Sec. 3] for P details) in which to each con uration c Cm we associate the fps Pc (X) = 2Z c(i)X The advanta e of this representation is that the computation of a linear map is Cm be a linear map with equivalent to power series multiplication. Let F : Cm Pr xr ) = a x We associate to F the nite fps A(X) = local rule f (x−r =−r Pr − a X . Then, for any c C we have P (X) = Pc (X)A(X) mod m m F (c) =−r
3
Sensitivity and the Countin Distance over Cm
Sensitivity is a central notion in the study of the qualitative behavior of discrete time dynamical systems (see for example [4]). The eneral de nition of sensitivity to initial conditions is iven for a metric space (X d) and a map F : X X continuous on X accordin to the topolo y induced by d: X X R+ . De nition 1 (Sensitivity). A dynamical system (X F ) is sensitive to initial conditions if and only if there exists > 0 such that for any y X and for any > 0 there exist z X and n > 0, such that d(y z) and d(F n (y) F n (z)) > . The value is called the sensitivity constant.
828
Giovanni Manzini
For CA, sensitivity, as well as other metric properties such as expansivity and transitivity, have been studied with respect to the Tychono distance dT (as de ned for example in [1]). A CA is sensitive with respect to dT if we can modify cells which are arbitrarily far away from the center of the array in such a way that the iteration of the map F will eventually move this perturbation close to the center. In other words, a map is sensitive if there exist perturbations which propa ate for an arbitrarily lar e distance (the speed of these perturbations have been analyzed in [5]). Linear CA which are sensitive with respect to dT have been characterized in [10] Pr where it is shown that a linear CA (Cm F ), with xr ) = local rule f (x−r =−r a x , is sensitive if and only if there exists a a−1 a1 ar ). prime p such that p m and p cd(a−r In this paper we characterize CA which are sensitive with respect to the countin distance over Cm introduced in [3]. This distance is de ned as follows. For any pair of con urations x y Cm and n > 0 let [n] (x
y) = # i
[−n n] x(i) = y(i)
n, in which The value [n] (x y) ives the number of cells with an index i, i the con urations x and y di er. The countin distance d(x y) is de ned by d(x y) = lim sup n!1
[n] (x y) 2n + 1
(2)
and measures the asymptotic ratio between the number of di erences and the number of cells. In [3] the authors have shown that d is a pseudo-metric which makes Cm a non-compact perfect space. In addition, CA are uniformly continuous with respect to d. One of the main reason for introducin the countin distance is that d wei hts all cells equally, whereas this is not true for the Tychono distance dT . One can easily prove that, for all i Z, d(x y) = d (x) (y) , where is the shift map de ned in Example 1. We say that d is shift invariant. Note that d is also translation invariant, that is, for all a b c Cm we have d(a b) = d(a + c b + c). Loosely speakin , a CA F is sensitive with respect to the countin distance if we can modify each con uration in an arbitrarily small fraction of the cells in such a way that the repeated iteration of F will increase the number of di erences up to a constant fraction of the total number of cells (this fraction bein determined by the sensitivity constant ). Let m = pq, with cd(p q) = 1. It is well known that the rin Zm is isomorphic to the direct product Zp ⊗Zq . That is, each element a Zm can be replaced by the pair a mod p a mod q with sums and products done componentwise. We can extend this isomorphism to Cm which can be seen as the direct product Cp ⊗ Cq . To each con uration x Cm we associate the pair xp xq such that, Cp for all i Z, xp (i) = x(i) mod p, and xq (i) = x(i) mod q. De ne Fp : Cp (resp. Fq : Cq Cq ) by Fp (x) = F (x) mod p (resp. Fq (x) = F (x) mod q). The above discussion su ests that the properties of (Cm F ) can be inferred by the properties of the two CA (Cp Fp ), and (Cq Fq ). The followin lemma shows that this is indeed the case for sensitivity.
Characterization of Sensitive Linear Cellular Automata
829
Lemma 1. Let (Cm F ) denote a linear CA. Let m = pq with cd(p q) = 1. Then, (Cm F ) is sensitive if and only if at least one of (Cp Fp ) and (Cq Fq ) is sensitive. Note that by the above lemma, in order to characterize sensitive linear CA it su ces to consider the case in which the alphabet size is a prime power. We conclude this section with a characterization of sensitive linear CA that will be used to establish our main results. Lemma 2. Let (Cm F ) denote a linear CA. The map F is sensitive to initial conditions if and only if there exists a constant c and a sequence x n 2N , Cm , n N such that x lim d(x 0) = 0 !1
4
and
d(F ni (x ) 0)
c
(3)
Characterization of Sensitive 1-Dimensional Linear CA
Let z0 Cm denote the con uration such that z0 (0) = 1, and z0 (i) = 0 for i = 0. For any x Cm we denote by x # the number of nonzero cells in the con uration x (assumin this number is nite). That is, x # = limn!1 [n] (x 0). With a little abuse of notation, in the followin we use A(X) # to denote the number of nonzero coe cients in the nite fps A(X). The followin lemma is equivalent to Theorem 6 in [3]. Lemma . Let (Cm F ) denote a linear CA. If lim
n!1
(F n ) =
and
lim sup n!1
F n (z0 ) (F n )
#
>0
then F is sensitive to initial conditions. The next lemma is the main technical result of this section. It essentially establishes a su cient condition for sensitivity for linear CA over Zp with p prime. Lemma 4. P Let (Cp F ) denote a linear CA over Zp , p prime, with radius r > 0. r − denote the nite fps associated with F . If A(X) # Let A(X) = =−r a X 2 then F n (z0 ) # >0 lim sup (F n ) n!1 Proof. Note that, since the nite fps associated with F n is An (X), we have F n (z0 ) # = An (X) # . In addition, since p is prime, we have (F n ) = nr. 2, we write A(X) as A(X) = X h B(X) where B(X) = Assumin A(X) # Pm n n =0 b X with b0 = 0 and bm = 0. Obviously, A (X) # = B (X) # for all n 1.
830
Giovanni Manzini
We prove the lemma considerin the sequence n = p − 1. If B(X) = bm−1 = 0, we have that is, b1 = b2 = ni X n ni m ni bn0 i −j bjm X jm B (X) = (b0 + bm X ) = j j=0 ni j
n,p
We claim that, for j = 0
#
= 2,
. We have
p −1 (p − 1)(p − 2) (p − j) n = = j 1 2 j j i) and hence, pt (p − h) implies pt h (for t every factor p in the numerator appears also in the denominator and p nji as claimed. Thus, nji bn0 i −j bjm 0 (mod p). This yields F ni (z0 ) (F ni )
#
Ani (X) nr
=
#
B ni (X) nr
=
#
=
n +1 nr
(4)
and the lemma follows. If A(X) # > 2 we can prove a result analo ous to (4) usin a sli htly more complex ar ument. Bein B(X) # > 2 there exists an index i, with 0 i m, such that b = 0. Let bd be such that bd = 0 and bd−1 = 0. It is well known that, workin modulo p, for all a b Zp , we b1 = have pk k X k k k p pk a b p − = ap + b p = a + b (a + b) = i =0 This yields B(X)B ni (X) = (b0 + bd X d + = (b0 + bd X
dpi
i
+ bm X m )p
+
+ bm X
mpi
(5) )
In other words, B ni +1 (X) # = B(X) #. In addition, in B ni +1 (X) all powj dp have a zero coe cient. We show that this implies ers X j with 0 B ni (X) # (d m)n − 1 for all i such that p > m. More precisely, we claim cannot have a sequence that amon the rst dp − m coe cients of B ni (X) Pwe mn of m consecutive zero coe cients. Let B ni (X) = j=0i cj X j . Assume by contradiction there exist j k, with 0
j
dp − m
and
k >j+m
such that cj = 0
= ck−1 = 0 (6) P m The coe cient of X j+m in B ni +1 (X) is iven by h=0 bh cj+m−h , which, by (6), is equal to bm cj and is therefore nonzero. This is impossible by (5) since j + m dp . Since c0 = bn0 i = 0, we conclude that B ni (X) must have the form B ni (X) = c0 + c 1 X
1
cj+1 =
+ c 2X
2
+
+ c kX
k
+
+ cmni X mni
Characterization of Sensitive Linear Cellular Automata
831
where i1
m
ij
Hence, B ni (X) in (4) we et
#
ij−1 + m
for j = 2
k
(dp − m) m = (d m)p − 1 F ni (z0 ) (F ni )
#
=
B ni (X) nr
#
dp − m
ik
(d m)n − 1. Reasonin as
(d m)n − 1 nr
and the lemma follows. The followin lemma establishes a necessary condition for sensitivity in terms of the radius of the map F n . Lemma 5. Let (Cm F ) denote a linear CA. If there exists a constant M such that (F n ) M for all n > 0, the map F is not sensitive. Proof. We use the characterization of Lemma 2. Assume by contradiction that there exist a constant c and a sequence x n 2N for which (3) holds. Let y = F ni (x ), c0 = c 2. Since d(y 0) c, there exists a sequence mk such that lim mk =
k!1
and
[mk ] (y
0)
c0 (2mk + 1)
Since F ni is linear and (F ni ) M , it follows that y (j) = 0 implies there exists M such that x (j 0 ) = 0. Hence, j 0 with j 0 − j [mk ] (y
0)
c0 (2mk + 1)
=
[mk +M] (x
0)
c0 (2mk + 1) 2M + 1
By (2) we have d(x 0)
[mk +M] (x 0) 2(mk + M ) + 1 2mk + 1 c0 lim k!1 2M + 1 2(mk + M ) + 1 0 c = 2M + 1
lim
k!1
Hence d(x 0) does not conver e to zero, and F is not sensitive. We are now able to prove a necessary and su cient condition for sensitivity in terms of the coe cients of the local rule when m is a prime power. Theorem 1. Let P (Cpk F ) denote a linear CA over Zpk , p prime, with local rule r xr ) = f (x−r =−r a x . The map F is sensitive if and only if there exist two coe cients a aj such that cd(a p) = cd(aj p) = 1.
832
Giovanni Manzini
Proof. We rst prove the if part. Let (Cp FpP ) denote the linear CA over Zp r 0 0 associated to the local rule f 0 (x−r xr ) = =−r a x where a = a mod p. By hypothesis at least two coe cients a0 a0j are nonzero. Hence, (Fp ) > 0, and by Lemma 4 we have Fpn (z0 ) # >0 (7) lim sup (Fpn ) n!1 We show that F is sensitive usin the characterization of Lemma 3. The nite fps Pr associated with F n (resp. Fpn ), is [A(X)]n = ( =−r a X − )n (resp. [A0 (X)]n = P ( r=−r a0 X − )n ). Since [A0 (X)]n = [A(X)]n mod p we have (F n )
n (F )
(Fpn ) = n (Fp )
(8)
where the last equality holds since p is prime. Since Fpn (z0 ) = F n (z0 ) mod p, we have Fpn (z0 ) # (9) F n (z0 ) # From (8) it follows that limn!1 (F n ) = F n (z0 ) (F n )
Fpn (z0 ) n (F )
#
. Combinin (8), and (9) we et
#
Fpn (z0 ) (Fpn )
#
(Fp ) (F )
By (7), lim supn!1 ( F n (z0 ) # ) ( (F n )) > 0 and the map F is sensitive by Lemma 3. r To prove the only if part we use Lemma 5. If cd(a p) > 1 for i = −r then, for all x Cpk we have F k (x) = 0. Hence, for all n > 0, (F n ) k (F ) and F is not sensitive. Assume now there exists a unique coe cient a such that cd(a p) = 1, and assume by contradiction that F is sensitive. Since d is shift invariant, usin for example Lemma 2 it is strai htforward to verify that F 0 = F should be sensitive as well. By construction, the nite fps associated to F 0 is B(X) = X A(X). Hence, B(X) has the form B(X) = a + pB 0 (X). A simple proof by j j ap (mod pj+1 ). Hence, induction shows that for j 1 we have (a + pb)p k−1
[B(X)]p
k−1
ap
(mod pk )
which implies sup (( F )n ) n1
max
1npk−1
(( F )n )
hence, (( F )n ) is bounded by a constant. By Lemma 5, is not sensitive. This completes the proof.
F , and therefore F ,
Combinin the above result with Lemma 1 we et the followin characterization of linear sensitive CA for an arbitrary alphabet size. xr ) = Corollary 1. Let (Cm F ) denote the linear CA with local rule f (x−r P r a x . The map F is sensitive if and only if there exist a prime p and two =−r coe cients a aj such that p m, and cd(a p) = cd(aj p) = 1.
Characterization of Sensitive Linear Cellular Automata
833
Finally, we are able to prove that the su cient condition for sensitivity iven by Lemma 3 is also a necessary condition. Corollary 2. Let (Cm F ) denote a linear CA. The map F is sensitive if and only if F n (z0 ) # >0 and lim sup lim (F n ) = n!1 (F n ) n!1 Proof. The if part is precisely Lemma 3. If F is sensitive, by Corollary 1 we know there exists p and two coe cients a aj of the local rule f such that p m and cd(a p) = cd(aj p) = 1. The thesis follows repeatin verbatim the proof of the if part of Theorem 1.
References 1. F. Blanchard, P. Kurka, and A. Maass. Topolo ical and measure-theoretic properties of one-dimensional cellular automata. Physica D, 103:86 99, 1997. 2. G. Cattaneo, E. Formenti, G. Manzini, and L. Mar ara. Er odicity, transitivity, and re ularity for additive cellular automata over Zm . Theoretical Computer Science. To appear. 3. G. Cattaneo, E. Formenti, L. Mar ara, and J. Mazoyer. A shift-invariant metric on S Z inducin a non-trivial topolo y. Technical Report 97-21, LIP Ecole Normale Superieure de Lyon, 1997. A preliminary version appeared in Proc. MFCS ’97, LNCS n. 1295, Sprin er Verla . 4. R. L. Devaney. An Introduction to Chaotic Dynamical Systems. Addison-Wesley, Readin , MA, USA, second edition, 1989. 5. M. Finelli, G. Manzini, and L. Mar ara. Lyapunov exponents vs expansivity and sensitivity in cellular automata. Journal of Complexity. To appear. 6. M. Hurley. Attractors in cellular automata. Er odic Theory and Dynamical Systems, 10:131 140, 1990. 7. M. Ito, N. Osato, and M. Nasu. Linear cellular automata over Zm . Journal of Computer and System Sciences, 27:125 140, 1983. 8. P. Kurka. Lan ua es, equicontinuity and attractors in cellular automata. Er odic theory and dynamical systems, 17:417 433, 1997. 9. G. Manzini. Characterization of sensitive linear cellular automata with respect to the countin distance. Technical Report B4-98-05, Istituto di Matematica Computazionale, CNR, Pisa, Italy, 1998. 10. G. Manzini and L. Mar ara. A complete and e ciently computable topolo ical classi cation of D-dimensional linear cellular automata over Zm . In 24th International Colloquium on Automata Lan ua es and Pro rammin (ICALP ’97). LNCS n. 1256, Sprin er Verla , 1997. 11. G. Manzini and L. Mar ara. Attractors of D-dimensional linear cellular automata. In 15th Annual Symposium on Theoretical Aspects of Computer Science (STACS ’98), pa es 128 138. LNCS n. 1373, Sprin er Verla , 1998. 12. G. Manzini and L. Mar ara. Invertible linear cellular automata over Zm : Al orithmic and dynamical aspects. Journal of Computer and System Sciences, 56:60 67, 1998. 13. T. Sato. Er odicity of linear cellular automata over Zm . Information Processin Letters, 61(3):169 172, 1997.
Additive Cellular Automata over ZZ p and the Bottom of (CA,≤) Jacques Mazoyer and Ivan Rapaport LIP-Ecole Normale Superieure de Lyon 46 Allee d’Italie, 69364 Lyon Cedex 07, France Jacques.Mazoyer,Ivan.Rapapor @ens-lyon.fr
Abs rac . In a previous work we began to study the question of how to compare cellular automata (CA). In that context it was introduced a preorder (CA, ) admitting a global minimum and it was shown that all the CA satisfying very simple dynamical properties as nilpotency or periodicity are located on the bottom of (CA, ) . Here we prove that also the (algebraically amenable) additive CA over ZZ p are located on the bottom of (CA, ). This result encourages our conjecture that says that the distance from the minimum could represent a measure of complexity on CA. We also prove that the additive CA over ZZ p with p prime are pairwise incomparable. This fact improves our understanding of (CA, ) because it means that the minimum, even in the canonical order compatible with , has in nite outdegree.
1
Introduction
One-dimensional cellular automata with radius 1, or simply CA, are in nite arrays of nite-state machines called cells and indexed by ZZ. These identical cells evolve synchronously at discrete time steps following a local rule by which the state of a cell is determined as a function of its own state together with the states of its two neighbors. These devices, despite their simplicity, may exhibit very complex behavior. In order to understand these CA one should nd some criteria capable of structuring them into natural classes or hierarchies. In this direction, the classi cation of S. Wolfram [11], though heuristical and coarse, corresponds to the best-known attempt. Wolfram, by observing the long-term behavior of arbitrary periodic con gurations, distinguishes four CA classes. Some e orts have been made in order to formalize this classi cation [6] or, typically by dynamical systems arguments, to introduce new classi cation schemes [5, 4]. Unfortunately, this last approach yields to some paradoxes: the shift CA, for instance, appears to be chaotic. CA may also be seen as computational devices. In fact, it is easy to exhibit a CA that simulates any Turing machine [7]. In other words, the CA model is Turing-universal. The question whether the CA model is intrinsic-universal or, in other words, whether there exists a CA capable of simulating any other, remained open for some years. Notice that the CA can not be simulated by Lubos Brim et al. (Eds.): MFCS’98, LNCS 1450, pp. 834 843, 1998. c Sprin er-Verla Berlin Heidelber 1998
Additive Cellular Automata over ZZ p and the Bottom of (CA, )
835
a Turing machine because the latter have a unique head which obviously will never visit the whole tape. J. Albert and K. Culik II exhibited in [1] an intrinsicuniversal CA. The intrinsic-reducibility notion induces a preorder on the set of CA. Unfortunetly, the study of this preorder structure is very di cult: it is based on the evolution of all the possible con gurations (which are uncountable) and it does not take explicitly into account the CA transition tables. In addition, the simulation notion is so broad that a pair of CA with extremely di erent dynamics could appear to be equivalent . Another approach is to consider CA as algebraic objects. In this context, with the purpose of endowing the set of CA with an order relation, it would be su cient to say that A is a subautomaton of B if the transition table of A is contained (after a suitable relabeling of the states) in the transition table of B. This notion is extremely restrictive. In fact, if A is a subautomaton of B then the space-time diagrams of A are cell by cell equivalent to the corresponding space-time diagrams of B (space-time diagrams are representations of a CA from a particular initial con guration in ZZ 2 ). In other words, A and B may not be associated by the subautomaton relation even with their respective space-time diagrams being identical after suitable changes of scale . It seems therefore very natural to try to replace the subautomaton relation by a new one which could take into account potential changes of scale. This can be done by de ning the powers of a CA. More precisely, let us denote by X the CA that generates the -scaled space-time diagram of X and which is simply obtained by grouping cells (or states) into blocks and by considering as transitions the interactions of neighbor blocks. Let us also note A B when some power of A is a subautomaton of some power of B or, equivalently, when the space-time diagrams of A are block by block equivalent to the corresponding space-time diagrams of B. In [9] it was shown that (CA, ) is a preorder with no maximum. It was also proved that (CA, ) admits a global minimum and that all the CA satisfying very simple dynamical properties (nilpotents, periodics, shift-like) are located on the bottom of (CA, ) . In addition, the fact that an algorithmically nontrivial synchronization CA was separated from the minimum by an in nite chain led us to conjecture that the distance from the minimum could represent a measure of complexity on CA. In this paper we give more evidence supporting the intuitive expectation that says that the simplest CA should be located on the bottom of (CA, ) or, more precisely, that the simplest CA should be located immediately above the global minimum. By following an algebraic criterion of simplicity we decide to study the class of additive CA over ZZ p . In fact, these CA have been extensively studied because of their amenability to algebraic analysis [8, 2]. We prove that, for p prime, the additive CA over ZZ p are located on the bottom of (CA, ). We also show that the additive CA over ZZ p with p prime are pairwise incomparable. Therefore, if we note by CA the set of CA modulo the canonical equivalence relation induced by , then the minimum of the order (CA , ) has in nite outdegree. Until now, we had no examples of unbounded outdegrees in (CA , ).
836
2
Jacques Mazoyer and Ivan Rapaport
Preliminaries
In this section we formally introduce the preorder (CA, ) and we recall some already known results. First, a CA is de ned by a couple (Q ) where Q is a Q is a transition function. We say that (Q1 1 ) nite set of states and : Q3 is a subautomaton of (Q2 2 ), and we note (Q1 1 ) (Q2 2 ), if there exists an Q2 such that for all x y z Q1 : injection : Q1 ( 1 (x y z)) =
2(
(x)
(y)
(z))
When the function is a bijection we say that (Q1 1 ) and (Q2 2 ) are isomorphic and we note (Q1 1 ) = (Q2 2 ). Let IN = IN − 0 . For any CA (Q ) the evolution of a nite block of states looks like a light-cone (see Figure 1-i). This basic fact inspires the notion of the Q, which is recursively de ned for all n-block evolution function n : Q2n+1 n IN as follows: 1 n
(w−n
(w−1 w0 w1 ) = (w−1 w0 w1 ) w0 wn ) = n−1 ( (w−n w−n+1 w−n+2 )
(wn−2 wn−1 wn ))
By grouping several states into blocks and by letting interact triplets of blocks as schematically appears in Figure 1-ii, we generate CA with (exponentially) more states. Formally, the n-power of a CA (Q ) is the CA (Q )n = (Qn Gn ), qn ) and for all − x − y − z Qn : where − q Qn is denoted by (q1 (
n − G( x
− y − z )) =
n
(x
xn y1
y
yn z 1
(i)
z)
(ii)
Fi . 1. (i) Dependencies diagram representing a block of states evolution as a light-cone. (ii) Interaction of three blocks. We relate two CA by when some power of the rst is a subautomaton of some power of the second. More precisely, for (Q1 1 ) and (Q2 2 ): (Q1
1)
(Q2
2)
n m
IN : (Q1
n 1)
(Q2
m 2)
In [9] it was shown that (CA, ) is a preorder. In addition, it was proved that (CA, ) admits a global minimum corresponding to the (set of isomorphic)
Additive Cellular Automata over ZZ p and the Bottom of (CA, )
837
CA having a single state. This fact allows us to de ne the bottom of (CA, ) . More precisely, a CA is said to belong to the bottom of (CA, ) if there is no other CA located strictly between the minimum and itself. In other words, (Q ) belongs to the bottom of (CA, ) if for any other non-singleton CA (Q ) Finally, the following lemma is (Q ), (Q ) (Q ) = (Q ) going to be used later: Lemma 1. If (Q ) (Q ) then there exist q0 − q0 − q0 ) = − q0 that (Q ) 0 (Q )j0 and G0 (−
0
IN and − q0
j0
Q 0 such
Proof. Let (Q ) (Q ). By de nition, there exist j IN such that (Q ) q) = (Q )j . By the niteness of Q there exist q Q and k IN such that k (q (Q )jk [9], the lemma is concluded for q. Considering the fact that (Q ) k − q). 0 = k j0 = jk and q0 = (q
3
Permutive CA
The notion of permutive CA has been extensively used (see for instance [10]). A given CA (Q ) is said to be right permutive if for all a b Q the function (a b ) : Q Q is bijective. A CA (Q ) is said to be left permutive if for all a b Q the function ( a b) : Q Q is bijective. A CA (Q ) is said to be permutive if it is right and left permutive. Here we prove that all the subautomata and all the powers of a given permutive CA are permutive. Lemma 2. Let (Q2 2 ) be a permutive CA. If (Q1 (Q2 2 ) then (Q1 1 ) is also permutive.
1)
is such that (Q1
1)
Proof. Direct. Lemma 3. Let (Q ) be a CA and let n if (Q )n is permutive.
IN . (Q ) is permutive if and only
Proof. We prove the equivalence for the right permutivity. For the left permutivity the proof is identical. Let us therefore assume (Q ) to be right permutive. a Q2m , and for all It is easy to prove by induction that for all m IN , for all − − − − m − m − − ( a x) = ( a y) x = y Let a b x y Qn . If − x =− y then x y Q: there is an index 1 n such that = min j 1 n : xj = yj an b 1 bn x1 x ) = n (a an b 1 bn x1 y ) and It follows that n (a n − − − n − − − therefore ( G ( a b x )) = ( G ( a b y )) Let us assume now that (Q )n is right permutive (notice that the non-trivial case is when n > 1). Let a b x y Q. If (a b x) = (a b y) then: n G (a
a a
a a
a bx) =
n−2
and therefore (a
a bx) = (a n−2
n G (a
a a
a a
a by)
n−2
a by), which implies that x = y.
n−2
838
4
Jacques Mazoyer and Ivan Rapaport
Additive Cellular Automata over ZZ p
This section is the core of the present work. Here we prove that, for p prime, the additive CA over ZZ p are pairwise incomparable (Corollary 1) and that they are all located on the bottom of (CA, ) (Corollary 2). Let us start by denoting, for each p IN p > 1, the additive abelian group IN we denote the canonical of integers modulo p by (ZZ p +). For each n n xn ) (y1 yn ) : product group by (ZZ p +). More precisely, for all (x1 (x1
xn ) + (y1
yn ) = (x1 + y1
xn + zn )
Stated for arbitrary groups of nite order, the following proposition appears in any introductory textbook of Algebra (see for instance [3]). ZZ np be a nonempty set. If Proposition 1. Let p n IN p > 1, and let X − − − − (X +) is such that for all x y X : x + y X , then (X +) is a sub roup of (ZZ np +) and X pn . Moreover, if p is prime then: X =
n
Xk with Xk = ZZ p or Xk = 0 for all k
k=1
1
n
To the abelian group (ZZ p +) we associate in the canonical way the CA (ZZ p ) such that for all x y z ZZ p : (x y z) = x + y + z Similarly, to the product group (ZZ np +) we associate the CA (ZZ np ) in such a way that for all − x − y − z)=− x +− y +− z Finally, the n-power of the CA x − y − z ZZ np : (− (ZZ p ) corresponds, by de nition, to (ZZ p )n = (ZZ np nG ) and Remark 1. Notice that in ZZ np the operations 4 instance, if we consider the set ZZ 3 (see Figure 2):
n G
are not the same. For
((2 2 1 2) (1 1 0 2) (0 1 2 1)) = (0 1 0 2) and 2 1 2) (1 1 0 2) (0 1 2 1)) = (2 1 1 1)
4 G ((2
2
Fi . 2.
1
1
1
1
2
2
0
2
2
2
1
1
0
1
2
2
1
2
2
1
1
2
0
2
0
0
1
2
1
2
1
1
0
2
0
1
2
4 G ((2
Lemma 4. For all p n
2
1
2 1 2) (1 1 0 2) (0 1 2 1)) = (2 1 1 1).
IN p > 1, the CA (ZZ p
)n is permutive.
Proof. By Lemma 3 together with the permutivity of (ZZ p
).
Additive Cellular Automata over ZZ p and the Bottom of (CA, )
839
The following (and easy to prove) superposition principle [8] reflects why additive CA are so amenable to algebraic analysis. Proposition 2 (The superposition principle). Let p n − x2 ,− y1 ,− y2 ,− z1 ,− z2 ZZ np it holds the followin : x1 ,− n − G (x1
+− x2 − y1 + − y2 − z1 + − z2 ) =
n − G (x1
− y1 − z1 ) +
IN p > 1 For all
n − G (x2
− y2 − z2 )
− ZZ np with 0 = (0 0) Proposition 3. Let p n IN p > 1, and let X n n n X . It holds that if (X G ) (ZZ p G ) then (X +) is a sub roup of (ZZ np +) (ZZ np nG ) and let − x0 − y0 X . Considering Lemma 2 toProof. Let (X nG ) gether with Lemma 4, it follows that (X nG ) is permutive and therefore there − x0 − x0 ) = 0 By the superposition principle: exists −0 X such that nG (−0 − n − G( 0
− x0 − x0 + − y0 ) = =
n − G( 0 n − G( 0
− x0 − 0
− − − x0 ) + nG ( 0 0 − y0 ) − − y0 ) = y X
x X On the other hand, again by permutivity of (X nG ), there exists − x0 − x ) = − y Finally, now by permutivity of (ZZ np nG ), − x = such that nG (−0 − y0 ) X . (− x0 + − Proposition 4. Let (Q ) be a CA and let p IN p > 1. If (Q ) ZZ jp such that: then there exist j IN and an injection : Q (Q ) = ( (Q )
j G)
(ZZ jp
(ZZ p
)
j G)
with ( (Q ) +) bein a sub roup of (ZZ jp +) Proof. Let us suppose that (Q ) (ZZ p ). By de nition, there exist j IN such that (Q ) (ZZ p )j by some injection . Moreover, by Lemma 1, we q0 − q0 − q0 ) = − q0 and therefore can assume that there exists − q0 Q such that G (− j − − − − ( q0 ) ( q0 )) = ( q0 ) Let us de ne the injection : Q ZZ jp G ( ( q0 ) − − − − in such a way that, for all q Q : ( q ) = ( q ) − ( q0 ) Let us denote − − 0) X because 0 = (− q0 ) − (− q0 ) X = (Q ). Notice that 0 = (0 j j j In order to prove that (Q ) = (X G ) (ZZ p G ) it su ces to prove that X be ( (Q ) jG ) = (X jG ) because (Q ) = ( (Q ) jG ). Let : (Q ) such that (− x) = − x − (− q0 ). The function is obviously a bijection and, in addition, for all − x − y − z (Q ): (
j − G( x
− y − z )) = =
j − − G( x y j − G( ( x )
− z ) − jG ( (− q0 ) − − ( y ) ( z ))
(− q0 )
(− q0 ))
From Proposition 3, it follows that ( (Q ) +) is a subgroup of (ZZ jp +).
840
Jacques Mazoyer and Ivan Rapaport
Remark 2. The process of searching additive CA (ZZ p ) located on the bottom of (CA, ) may be restricted to p prime because if a b IN are such that a b then (ZZ a ) (ZZ b ). In fact, it su ces to notice that (ZZ a ) (ZZ b ) by the ZZ b which assigns to each x ZZ a the value (x) = bx ZZ b . injection : ZZ a a Corollary 1. Let p q > 1 be prime numbers. If p = q then (ZZ p
) (ZZ q
)
Proof. Let us suppose that (ZZ p ) (ZZ q ) Then, by Proposition 4, there : ZZ p ZZ jq such that ( (ZZ p ) +) is a exist j IN and an injection j j subgroup of (ZZ q +). By Proposition 1, p q . This is a contradiction.
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 1 0 0 0 0 0
0 0 0 0 0 0 0
Fi . 3.
Proposition 5. For all
2 0 2 1 0 0 0 0
0 2 2 0 1 1 0 0 0
0 1 2 0 0 1 0 1 0 0
0 2 0 0 0 1 0 2 1 0
1 0 0 0 0 1 1 0 1 1
0 2 0 0 0 1 0 2 1 0
0 1 2 0 0 1 0 1 0 0
0 0 2 2 0 1 1 0 0 0
0 2 2 0 2 1 0 0 0 0
0 1 1 0 1 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0
2 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 2 1 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0
0 1 1 0 1 0 0 0 0 0
0 2 2 0 2 1 0 0 0 0
0 0 2 2 0 1 1 0 0 0
1 2 0 0 1 0 1 0 0
0 0 0 1 0 2 1 0
0 0 1 1 0 1 1
0 1 0 2 1 0
1 0 1 0 0
1 0 0 0 0 0 0 0 0 0
32 − G (0
− − e3 0 ) =
32 − G (0
− − 0 e3 ) = − e3
IN and p > 1 prime it holds that: (ZZ pp
) = (ZZ p
)p
On the other hand, for every X ZZ pp such that X > 1 and (X pG ) p p ) (ZZ pp G ) with (X +) bein a sub roup of (ZZ p +) it holds that (ZZ p p (X G )
Additive Cellular Automata over ZZ p and the Bottom of (CA, )
841
Proof. By using the well-known dipolynomial representation of additive CA that appears in [8], together with the fact that a dipolynomial over ZZ p of the x p , it can be proved that (see Figform x satis es that ( x )p = − − p − − − p − − − ek ) = − ek with − ek = ure 3): G (ek 0 0 ) = G ( 0 ek 0 ) = pG ( 0 0 − − p 0) ZZ p and 0 = (0 0). (0 0 1 0 k2f1 p g
The previous result, together with the superposition principle, allows us to ) = (ZZ p )p conclude, as it appears in the example of Figure 4, that (ZZ pp p p p (ZZ pp Finally, let X ZZ p be such that X > 1 and (X G ) G ) with p (X +) being a subgroup of (ZZ p +). By considering Proposition 1 we conclude 1 p such that Xk0 = ZZ p It follows that the existence of an index k0 X that assigns, to each x ZZ p , (ZZ p ) (X pG ) by the injection : ZZ p 0) the image (x) = (0 0 x k0
1 1 2 1 0 0 2 0 2 1
1 2 1 2 0
1 1 1 2 2 1
1 1 2 1 1 1 1
1 2 2 1 0 1 1 2
1 1 1 2 2 0 1 2 1
1 1 2 1 0 2 2 1 1 2
2 2 1 0 2 2 0 0 1 1
1 2 2 0 1 1 0 2 1 1
0 0 2 2 0 1 1 1 0 2 2
Fi . 4. (ZZ 33
2 1 2 0 1 1 0 1 0 0
0 1 0 0 2 2 0 1 1 1
1 1 2 0 0 2 2 1 0 0
2 2 2 2 1 2 0 0 0 2
) = (ZZ 3
1 2 1 0 1 0 0 2 0 1
0 2 2 1 2 0 1 2 0
0 0 0 2 2 0 2 1
1 2 2 0 1 2 1
2 1 0 2 0 0
2 1 0 0 2
1 2 2 0 2 0 1 0 1 2
2
)3
ZZ np is such that Proposition 6. Let n IN and let p > 1 be prime. If X n X > 1 and (X nG ) (ZZ p nG ) with (X +) bein a sub roup of (ZZ np +) then m (X nG ) there exists m IN satisfyin (ZZ m p G) IN and IN Proof. Let us consider the decomposition n = p with such that p Let us assume rst that = 1. If = 0 then, considering that (X +) is a subgroup of (ZZ p +) together with the fact that X > 1 it can be concluded by Proposition 1 that X = ZZ p and therefore (X ) = (ZZ p ). On the other hand, if > 0 then, by considering Proposition 5, we conclude that (ZZ p ) (X pG ) Let us assume now that > 1. By Proposition 1: X =
p k=1
Xk with Xk = ZZ p or Xk = 0 for all k
1
p
842
Jacques Mazoyer and Ivan Rapaport
Let us suppose that there exist k1 k2 1 ek2 = (0 that Xk1 = 0 and Xk2 = ZZ p . Let −
p with k2 − k1 = p such 0 1 0 0) It follows, as it k2
− − (− ek2 0 0 ))k1 = mod p = 0 is schematically shown in Figure 5, that ( − − ek2 0 0 ))k1 Xk1 , which is a contradiction. We can therefore and then ( Gp (− 1 p satisfying assume that X is such that for any pair of indexes k1 k2 1 p be such that that k2 − k1 = p it holds that Xk1 = Xk2 . Let k Xk = ZZ p This k does exist because X > 1 It follows, as it is shown in the (X Gp ) In fact, it su ces to consider example of Figure 6, that (ZZ p ) X such that for all − x = (x1 x ) ZZ p and for all the injection : ZZ p 1 p : (− x ) −k +1 if = k mod p p ( (− x )) = 0 otherwise. p G
0
2
1
0
0 0 0
0 1 0
0 λ 0
0 1 0
0
1
1
0 0
0 0
0
k1 k2
Fi . 5. (
n − G (ek2
− − 0 0 ))k1 =
mod p
Corollary 2. Let (Q ) be a CA with Q > 1 and let p > 1 be prime. It holds that if (Q ) (ZZ p ) then (ZZ p ) (Q ). Proof. Let us suppose that (Q ) (ZZ p ). From Proposition 4 there exist : Q ZZ jp such that (Q ) = ( (Q ) jG ) j IN and an injection (ZZ jp jG ) with ( (Q ) +) being a subgroup of (ZZ jp +) Then, by Proposition 6, there exists m IN such that (ZZ p )m ( (Q ) jG ) = (Q ) . Remark 3. If we denote by the canonical equivalence relation induced by then the minimum of the canonical order (CA/ , ) has in nite outdegree.
,
Additive Cellular Automata over ZZ p and the Bottom of (CA, )
843
0 1 0 0 0 0 0 0 0 1 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0
Fi . 6. (ZZ 2
5
)3
(X
322 ) G
with the index k = 2
1
22 .
Concludin Remarks
We have shown that, according to (CA, ), all the additive CA over ZZ p with p prime have the same complexity : they are all incomparable and located immediately above the minimum. Moreover, for nding the position of any additive CA in (CA, ) one should follow simple number divisibility considerations. Nevertheless, one question remains open: given x y j IN with x y j , is it true or false that (ZZ x ) (ZZ y ) ?
References [1] J. Albert and K. Culik II. A simple universal cellular automaton and its one-way and totalistic version. Complex Systems, 1:1 16, 1987. [2] J.-P. Allouche, F. von Haeseler, H.-O. Peitgen, and G. Skordev. Linear cellular automata, nite automata and Pascal’s triangle. Discrete Applied Mathematics, 66:1 22, 1996. [3] G. Birkho and S. Mac Lane. A survey of modern al ebra, chapter VI. MacMillan, New York, 1953. (Theorem 15, Theorem 18). [4] F. Blanchard, A.Maass, and P.Kurka. Topological and measure-theoretic properties of one-dimensional cellular automata. Physica D, 103:86 99, 1997. [5] G. Braga, G. Cattaneo, P. Flocchini, and C. Quaranta Vogliotti. Pattern growth in elementary cellular automata. Theoretical Computer Science, 45:1 26, 1995. [6] K. Culik II and S. Yu. Undecidability of CA classi cation schemes. Complex Systems, 2:177 190, 1988. [7] A.R. Smith III. Simple computation-universal cellular spaces. Journal ACM, 18:339 353, 1971. [8] O. Martin, O. Odlyzko, and S. Wolfram. Algebraic properties of cellular automata. Communications in Mathematical Physics, 93:219 258, 1984. [9] J. Mazoyer and I. Rapaport. Inducing an order on cellular automata by a grouping operation. In STACS’98, volume 1373 of Lecture Notes in Computer Science, pages 116 127, 1998. [10] C. Moore. Predicting nonlinear cellular automata quickly by decomposing them into linear ones. Physica D, 111:27 41, 1998. [11] S. Wolfram. Universality and complexity in cellular automata. Physica D, 10:1 35, 1984.
Author Index
Aldaz M., 167 Alekhnovich M., 176 Amano K., 399 Ambainis A., 409 Ambos-Spies K., 465 Auletta V., 771 Ausiello G., 1 Baaz M., 203 Barrington D.M., 409 Barthe G., 316 Barthelmann K., 543 Benke M., 326 Bentzien L., 474 Bezrukov S.L., 693 Bierman G.M., 336 Bodlaender H.L, 702 Bonnet R., 213 B5rger E., 17 Broersma H., 713 Buchholz Th., 807 Buss S., 176 Caragiannis I., 771 Cattaneo G., 816 Chavez J.D., 693 Choffrut Ch., 656 Chrobak M., 185 Chrz~szcz J., 346 Ciabattoni A., 203 Clerbout M., 533 Courcelle B., 616 Crauser A., 722 Crochemore M., 665 Damm C., 780 Di Pierro A., 446 Durand B., 732 Diir~ Ch, 185 Emerson E.A., 427 Fermiiller Ch., 203 Fernau H., 740 Ferreira M.C.F., 239 Freivalds R., 213 FiilSp F., 248
Gastin P., 356 Giacobazzi R., 366 Goldsmith J., 483 Grohe M., 437 Grot~e-Rhode M, 553 Hagenah Ch., 277 Hagerup T., 702 Harel D., 36 Harju T., 503 Harper L.H., 693 Heintz J., 167 Hemaspaandra L.A., 418 Hermann M., 257 Hofmeister Th., 562 Horvath S., 656 Hromkovi~., 789 Huck A., 713 Hune Th., 378 Italiano G.F., 1 Iwama K., 580, 625 Iwamoto Ch., 580 Jurvanen E., 248 Kaklamanis Ch., 771 Karhum~ki J., 674 Kesner D , 239 Kesten Y., 54 Klein A., 807 Kloks T., 713 KSbler J., 493 Kolpakov R., 683 Koppius O., 713 Kratsch D., 713 Kucherov G.~ 683 Kuich W., 512 Kutrib M., 807 Kuzjurin N., 194 L a p i ~ J., 213 Lapoire D., 616 La Torte S., 571 Latteux M., 286
846
Author Index
Lefmann H., 562 Lempp S., 465 L~Thanh H., 409 Lopez L.-M., 522 Lukjanska A., 213 Maass W., 72 Mainhardt G., 465 Mafiuch J., 674 Manzini G., 825 Margara L., 816 Maruoka A., 399 Mateescu A., 503 Matera G., 167 Matz O., 751 Mazoyer J., 834 Mehlhorn K., 84, 722 Meyer R., 356 Meyer U., 722 Micali S., 94 Mielniczuk P., 589 Mignosi F., 665 Montafia J.L., 167 Moran S., 176 Miiller H., 713 Muscholl A., 277 N~iher S., 84 Nanni U., 1 Napoli M., 571 Narbel P., 522 Nielsen M., 117, 378 Nielson F., 220 Nielson H.R., 220 Nozoe M., 625 Ogihara M., 483 Pacholski L., 589 Pardo L.M., 167 Parisi-Presicce F., 553 Persiano P., 771 Petersen H., 296 Petit A., 356 Pitassi T., 176 Plandowski W., 674 Pnueli A., 54 Porrot S., 732 Preus H., 636
Pudl~k P., 129 Puel L., 239 Rabinovich A., 229 Ranzato F., 366 Rapaport I., 834 Reinhardt K., 760 Restivo A., 665 Roos Y., 533 Rothe J., 418, 483 RSttger M., 693 Ryl I., 533 Salomaa A., 503 Salzer G., 257 Sanders P., 722 Schroeder U.-P., 693 Schuler R., 493 Schulte W., 17 Schwentick T., 437 Scozzari F., 366 S~nizergues G., 305 Simeoni M., 553 Simplot D., 286 Simpson A.K., 456 Slobodovh A., 645 Srba J., 388 Srivastav A., 636 Staiger L., 740 Steinby M., 248 Stirling C., 142 Tarannikov Y, 683 Terlutte A., 286 Touzet H., 267 Trefler R.J., 427 Tuinstra H., 713 V~gvSlgyi S., 248 Veith H., 203 Vorobyov S., 597 Weihrauch K , 798 Wiedermann J., 152, 607 Wiklicky H., 446 Yajima S., 625 Zheng X., 798
Lecture Notes in Computer Science For information about Vols. 1-1376 please contact your bookseller or Springer-Verlag
Vol. 1377: H -J Schek, F. Saltor, I. Ramos, G. Alonso (Eds.), Advances m Database Technology - EDBT'98. Proceedings, 1998. XII, 515 pages. 1998. Vol 1378: M Nlvat (Ed.), FoundaUons of Software Science and Computation Structures. Proceedings, 1998. X, 289 pages. 1998
Vol. 1395. H. Kitano (Ed.), RoboCup-97' Robot Soccer World Cup I. XIV, 520 pages. 1998. (Subsenes LNAI) Vol. 1396: E. Okamoto, G Davlda, M Mambo (Eds.), InformaUon Security. Proceedings, 1997. XII, 357 pages 1998
Vol. 1379 T Nipkow (Ed.), Rewriting Techmques and Apphcanons Proceedings, 1998. X, 343 pages. 1998.
Vol 1397. H. de Swart (Ed.), Automated Reasoning with Analytic Tableaux and Related Methods. Proceedings, 1998. X, 325 pages 1998. (Subseries LNAI).
Vol 1380: C.L. Lucchesl, A.V. Moura (Eds), LATIN'98: Theoretical Informatlcs Proceedings, 1998. XI, 391 pages 1998.
Vol 1398" C. N6dellec, C. Rouveirol (Eds.), Machine Learning: ECML-98. Proceedings, 1998. XII, 420 pages. 1998. (Subseries LNAI).
Vol 138t- C. Hankin (Ed.), Programmlng Languages and Systems Proceedings, 1998 X, 283 pages. 1998.
Vol. 1399: O. Etzion, S Jajodla, S. Snpada (Eds), Temporal Databases. Research and Practice. X, 429 pages. 1998.
Vol 1382: E. Astesiano (Ed.), Fundamental Approaches to Software Engineering. Proceedings, 1998 XII, 331 pages. 1998. Vol. 1383 K Kosklmies (Ed), Compiler Construction Proceedmgs, 1998. X, 309 pages 1998. Vol 1384 B. Steffen (Ed), Tools and Algorithms for the Construction and Analysis of Systems Proceedings, 1998. XIII, 457 pages 1998. Vol. 1385: T. Margarla, B. Steffen, R. Ruckert, J. Posegga (Eds), Services and Visualization. Proceedings, 1997/ 1998 XII, 323 pages. 1998 Vol. 1386: T.A Henzinger, S. Sastry (Eds), Hybrid Systems: Computauon and Control. Proceedings, 1998. VIII, 417 pages 1998. Vol 1387: C. Lee Giles, M. Gon (Eds.), Adaptive Processing of Sequences and Data Structures. Proceedings, 1997. XII, 434 pages 1998. (Subseries LNAI). Vol 1388: J Rolim ( E d ) , Parallel and Distributed Processing. Proceedings, 1998. XVII, 1168 pages. 1998 Vol. 1389: K Tombre, A.K. Chhabra (Eds), Graphics Recogniuon. Proceedings, 1997 XII, 421 pages 1998. Vot. 1390. C Scheideler, Universal Routing Strategies for Interconnection Networks. XVII, 234 pages. 1998. Vol 1391 W. Banzhaf, R Poll, M. Schoenauer, T C. Fogarty (Eds.), Genetic Programming. Proceedings, 1998. X, 232 pages. 1998. Vol 1392 A Barth, M. Breu, A. Endres, A. de Kemp (Eds), Digital Libraries in Computer Science: The MeDoc Approach. VIII, 239 pages. 1998. Vol 1393. D. Bert (Ed.), B'98: Recent Advances m the Development and Use of the B Method. Proceedings, 1998. VIII, 313 pages. 1998. Vol. 1394: X Wu. R. Kotagm, K B Korb (Eds.), Research and Development in Knowledge Discovery and Data Mining Proceedings, 1998 XVI, 424 pages. 1998. (Subserles LNAI).
Vol. 1400 M. Lenz, B. Bartsch-Sporl, H.-D. Burkhard, S Wess (Eds.), Case-Based Reasoning Technology. XVIII, 405 pages. 1998 (Subseries LNAI). Vol. 1401: P. Sloot, M Bubak, B Hertzberger (Eds.), High-Performance Computing and Networking. Proceedings, 1998. XX, 1309 pages. 1998. Vol. 1402. W. Lamersdorf, M Merz (Eds.), Trends in Distributed Systems for Electronic Commerce. Proceedlngs, 1998 XII, 255 pages. 1998 Vol. 1403: K Nyberg (Ed), Advances in Cryptology EUROCRYPT '98. Proceedings, 1998 X, 607 pages. 1998 Vol. 1404. C Freksa, C Habel. K.F. Wender (Eds.), Spaual Cognition. VIII, 491 pages 1998 (Subseries LNAI). Vol 1405 S.M. Embury, N.J. Fiddian, W A Gray, A.C. Jones (Eds.), Advances in Databases Proceedings, 1998 XII, 183 pages. 1998. Vol. 1406: H. Burkhardt, B Neumann (Eds.), Computer Vision - E C C V ' 9 8 Vol. I Proceedings, 1998. XVI, 927 pages 1998. Vol. 1407: H Burkhardt, B. Neumann (Eds), Computer V i s i o n - ECCV'98, Vol. II. Proceedings, 1998 XVI, 881 pages. 1998 Vol. 1409: T. Schaub, The Automation of Reasoning with Incompletelnformatlon XI, 159 pages 1998 (Subseries LNAI). Vol 1411. L. Asplund (Ed), Reliable Software Technologies - Ada-Europe. Proceedings, 1998. XI, 297 pages 1998. Vol. 1412: R.E. Blxby, E.A Boyd, R.Z. Rlos-Mercado (Eds.), Integer Programming and Combinatorial Optimization. Proceedings, 1998 IX, 437 pages. 1998. Vol 1413: B. Permcl, C Thanos (Eds.), Advanced Information Systenas Engineering Proceedings, 1998 X, 423 pages. 1998.
Vol. 1414. M. Nielsen, W. Thomas (Eds.), Computer Sclence Logic. Selected Papers, 1997. VIII, 511 pages. 1998. Vol. 1415" J Mira, A.P. del Pobll, M.Ah (Eds.), Methodology and Tools in Knowledge-Based Systems. Vol. I. Proceedings, 1998. XXIV, 887 pages. 1998. (Subseries LNAI) Vol. 1416. A.P. del Pobil, J Mira, M.Ali (Eds.), Tasks and Methods in Applied Artificial Intelhgence. Vol.I1 Proceedings, 1998. XXIII, 943 pages. 1998. (Subseries LNAI) Vol. 1417 S. Yalamanchili, J Duato (Eds.), Parallel Computer Routing and Communication Proceedings, 1997. XII, 309 pages. 1998 Vol. 1418. R. Mercer, E. Neufeld (Eds.), Advances in Artificial Intelligence. Proceedings, 1998. XII, 467 pages. 1998 (Subseries LNAI). Vol. 1419 G Vigna (Ed.), Mobile Agents and Security, XII, 257 pages 1998. Vol 1420: J Desel, M Silva (Eds.), Application and Theory of Petri Nets 1998. Proceedings, 1998. VIII, 385 pages. 1998. Vol 142l C. Kirchner, H Kirchner (Eds.), Automated Deduction - CADE-15. Proceedings, 1998, XIV, 443 pages. 1998 (Subserles LNAI). Vol, 1422: J. Jeuring (Ed.), Mathematics of Program Constructlon. Proceedings, 1998. X, 383 pages 1998. Vol. 1423: J.P. Buhler (Ed), Algorithmic Number Theory Proceedings, 1998. X, 640 pages 1998, Vol 1424: L. Polkowski, A Skowron (Eds), Rough Sets and Current Trends in Computing Proceedings, 1998 XIII, 626 pages. 1998. (Subserles LNAI) Vol 1425: D Hutchison, R. Schafer (Eds.), Multlme&a Apphcatmns, Services and Techniques - ECMAST'98. Proceedings, 1998. XVI, 532 pages 1998. Vol. 1427: A J Hu, M.Y. Vardi (Eds), Computer Aided Verification Proceedings, 1998. IX, 552 pages. 1998 Vol. 1430. S. Tngila, A. Mullery, M. Campolargo, H. Vanderstraeten, M. Mampaey (Eds.), Intelligence in Services and Networks: Technology for Ubiquitous Telecom Services. Proceedings, 1998. XII, 550 pages. 1998. Vo/ 1431: H. Imai, Y. Zheng (Eds.), Pubhc Key Cryptography. Proceedings, 1998. XI, 263 pages. 1998. Vol. 1432: S. Arnborg, L. Ivansson (Eds), Algorithm Theory - SWAT '98. Proceedings, 1998. IX, 347 pages. 1998 Vol. 1433. V. Honavar, G. Slutzki (Eds.), Grammatical Inference. Proceedings, 1998. X, 271 pages 1998. (Subseries LNAI). Vol 1434. J -C. Heudin (Ed.), Virtual Worlds Proceedrags, 1998 XII, 412 pages. 1998. (Subseries LNAI). Vol. 1435. M Klusch, G. Weig (Eds.), Cooperative Information Agents II. Proceedings, 1998. IX, 307 pages. 1998. (Subseries LNAI).
Vol. 1438 C. Boyd, E. Dawson (Eds.), Information Security and Privacy. Proceedings, 1998. XI, 423 pages. 1998. Vol, 1439: B. Magnusson (Ed,), System Configuration Management. Proceedings, 1998 X, 207 pages. 1998, Vol 1441: W. Wobcke, M. Pagnucco, C. Zhang (Eds.), Agents and Multi-Agent Systems. Proceedings, 1997 XII, 241 pages. 1998. (Subseries LNAI) Vo/ 1443: K G. Larsen, S. Skyum, G Winskel (Eds.), Automata, Languages and Programming. Proceedings, 1998 XVI, 932 pages. 1998. Vol 1444: K Jansen, J. Rohm (Eds.), ApproxLmatlon Algorithms for Combinatorial Opt~mizatlon. Proceedings, 1998 VIII, 201 pages. 1998 Vol. 1445. E. Jul (Ed), ECOOP'98 - Object-Oriented Programming. Proceedings, 1998. XII, 635 pages 1998 Vol. 1446: D. Page (Ed.), Inductive Logic Programming Proceedings, 1998 VIII, 301 pages 1998. (Subserles LNAI) Vol. 1447 V W, Porto, N. Saravanan, D. Waagen, A.E. Elben (Eds), Evolutionary Programming VII. Proceedings, 1998. XVI, 840 pages. 1998. Vol. 1448: M. Farach-Colton (Ed), Combinatorial Pattern Matching. Proceedings, 1998. VIII, 251 pages 1998. Vol. 1449 W.-L. Hsu, M.-Y. Kao (Eds.), Computing and Combinatorics. Proceedings, 1998. XII, 372 pages. 1998. Vol 1450" L. Brim, F. Gruska, J. Zlatu gka (Eds.), Mathematical Foundations of Computer Science 1998. Proceedings, 1998. XVII, 846 pages. 1998. Vol 1451: A. Amm, D, Dori, P Pudll, H, Freeman (Eds.), Advances in Pattern Recognition. Proceedings, 1998. XXI, 1048 pages. 1998. Vol. 1452. B P. Goettl, H.M Halff, C.L. Redfield, V.J. Shute (Eds), Intelligent Tutonng Systems. Proceedings, 1998. XIX, 629 pages. 1998 Vol 1453: M.-L. Mugnier, M. Chem (Eds), Conceptual Structures: Theory,Tools and Applications Proceedings, 1998. XIII, 439 pages. (Subseries LNAI). Vol. 1454: I. Smith (Ed.), Art~ficlal Intelligence in Structural Engineering. X1,497 pages. 1998. (Subserles LNAI). Vol. 1456: A. Drogoul, M. Tambe, T Fukuda (Eds), Collective Robotics, Proceedings, 1998. VII, 161 pages 1998 (Subseries LNAI). Vol. 1457: A. Ferrelra, J, Rolim, H. Simon, S.-H. Tong (Eds.), Solwng Irregularly Structured Problems in Prallel Proceedmgs, 1998. X, 408 pages 1998 Vol 1458' V.O. Mittal, H.A Yanco, J. Aronis, RSimpson (Eds.), Assistive Technology m Arttflclal Intelligence X, 273 pages. 1998 (Subseries LNAI). Vol. 1459: D.G. Feitelson, L. Rudolph (Eds), Job Scheduling Strategies for Parallel Processing, Proceedings. 1998. VII, 257 pages 1998
Vol. 1436' D. Wood, S. Yu (Eds), Automata Implementation Proceedings, 1997. VIII, 253 pages. 1998.
Vol 1461: G Bllardi, G F. ltahano, A. Pletracaprma, G. Pucei (Eds), Algorithms - ESA'98 Proceedings, 1998 XI1, 516 pages 1998.
Vol. 1437: S. Albayrak, F.J. Garilo (Eds.), Intelligent Agents for Telecommunication Apphcatmns. Proceedings, 1998 XII, 251 pages. 1998 (Subseries LNAI).
Vol. 1464. I-I H.S. Ip, A.W.M Smeulders (Eds), Multimedia Information Analysis and Retrieval. Proceedings, 1998 VIII, 264 pages. 1998.