Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen University of Dortmund, Germany Madhu Sudan Massachusetts Institute of Technology, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Moshe Y. Vardi Rice University, Houston, TX, USA Gerhard Weikum Max-Planck Institute of Computer Science, Saarbruecken, Germany
4207
Zoltán Ésik (Ed.)
Computer Science Logic 20th International Workshop, CSL 2006 15th Annual Conference of the EACSL Szeged, Hungary, September 25-29, 2006 Proceedings
13
Volume Editor Zoltán Ésik University of Szeged, Department of Computer Science Arpad ter 2, 6720 Szeged, Hungary E-mail:
[email protected] Library of Congress Control Number: 2006932724 CR Subject Classification (1998): F.4.1, F.4, I.2.3-4, F.3 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues ISSN ISBN-10 ISBN-13
0302-9743 3-540-45458-6 Springer Berlin Heidelberg New York 978-3-540-45458-8 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. Springer is a part of Springer Science+Business Media springer.com © Springer-Verlag Berlin Heidelberg 2006 Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper SPIN: 11874683 06/3142 543210
Preface
Computer Science Logic (CSL) is the annual conference of the European Association for Computer Science Logic. The conference series started as a programme of International Workshops on Computer Science Logic, and then from its sixth meeting became the Annual Conference of the EACSL. The 15th Annual Conference (and 20th International Workshop), CSL 2006, took place during September 25–29, 2006. It was organized by the Department of Computer Science, University of Szeged. Previous CSL conferences were held in Karlsruhe (1987), Duisburg (1988), Kaiserslautern (1989), Heidelberg (1990), Bern (1991), San Miniato (1992), Swansea (1993), Kazimierz (1994), Padernborn (1995), Utrecht (1996), Aarhus (1997), Brno (1998), Madrid (1999), Fischbachau (2000), Paris (2001), Edinburgh (2002), Vienna (2003), Karpacz (2004) and Oxford (2005). The suggested topics of the conference included automated deduction and interactive theorem proving, constructive mathematics and type theory, equational logic and term rewriting, automata and formal logics, modal and temporal logic, model checking, logical aspects of computational complexity, finite model theory, computational proof theory, logic programming and constraints, lambda calculus and combinatory logic, categorical logic and topological semantics, domain theory, database theory, specification, extraction and transformation of programs, logical foundations of programming paradigms, verification of security protocols, linear logic, higher-order logic, nonmonotonic reasoning, logics and type systems for biology. In response to the Call for Papers, a total of 132 abstracts were submitted of which 108 were accompanied by a full paper. The International Programme Committee accepted 37 papers for presentation and inclusion in these proceedings. The Programme Committee invited lectures from Mart´ın Escard´ o (Birmingham), Paul-Andr´e Melli`es (Paris), Luke Ong (Oxford), Luc Segoufin (Orsay) and Miroslaw Truszczy´ nski (Lexington, KY). The Ackermann Award is the EACSL Outstanding Dissertation Award for Logic in Computer Science. The 2006 Ackermann Award was presented to Balder ten Cate and Stefan Milius at the conference. These proceedings contain the texts of 4 invited lectures and the 37 accepted papers and the report of the Ackermann Award Committee whose members were J. Makowsky (President of EACSL), D. Niwi´ nski (Vice-President of EACSL), S. Abramsky, B. Courcelle, E. Gr¨ adel, M. Hyland, and A. Razborov. I would like to thank everybody who submitted a paper to the conference and all members of the Programme Committee and their subreferees for their excellent cooperation in the evaluations of the papers. Finally, I would like to thank my colleagues Zsolt Gazdag, Szabolcs Iv´ an and Zolt´ an L. N´emeth for their technical assistance during the preparation of these proceedings.
VI
Preface
The conference was sponsored by the Department of Computer Science, University of Szeged, the Hungarian Academy of Science, the Fund for Research and Education in Informatics, the Fund for Szeged and the Nokia Hungary, Ltd.
Szeged, July 2006
´ Zolt´an Esik
Organization
Programme Committee Krzysztof Apt (Amsterdam/Singapore) Matthias Baaz (Vienna) Michael Benedikt (Chicago) Pierre-Louis Curien (Paris) Rocco De Nicola (Florence) ´ Zolt´an Esik (Szeged, Chair) Dov Gabbay (London) Fabio Gadducci (Pisa) Neil Immerman (Amherst)
Michael Kaminski (Haifa) Bakhadyr Khoussainov (Auckland) Ulrich Kohlenbach (Darmstadt) Marius Minea (Timi¸soara) Damian Niwi´ nski (Warsaw) Ramaswamy Ramanujam (Chennai) Philip Scott (Ottawa) Philippe Schnoebelen (Cachan) Alex Simpson (Edinburgh)
Additional Referees Luca Aceto Marco Aiello Roberto Amadio Christel Baier Patrick Baillot Paolo Baldan Matteo Baldoni Bruno Barras David A. Mix Barrington Arnold Beckmann Gianluigi Bellin Ulrich Berger Dietmar Berwanger Lars Birkedal Roderick Bloem Stephen L. Bloom Richard Blute Mikolaj Bojanczyk Maria Paola Bonacina Filippo Bonchi Guillamue Bonfante Michele Boreale Paolo Bottoni Pierre Boudes Roberto Bruni Glenn Bruns
Antonio Bucciarelli Pedro Cabalar Andrea Cantini Venanzio Capretta Franck Cassez Maria Luisa Dalla Chiara Juliusz Chroboczek Vincenzo Ciancia Gabriel Ciobanu Thierry Coquand Flavio Corradini Bruno Courcelle Olivier Danvy St´ephane Demri Mariangiola Dezani-Ciancaglini Roy Dyckhoff Maribel Fern´ andez Wan Fokkink Nissim Francez David de Frutos-Escrig Murdoch James Gabbay Marco Gaboardi Blaise Genest Giorgio Ghelli Silvio Ghilardi
Hugo Gimbert Jean Goubault-Larrecq Stefano Guerrini Esfandiar Haghverdi Masahiro Hamano Jerry den Hartog Masahito Hasegawa Rolf Hennicker Claudio Hermida Daniel Hirschkoff Pieter Hofstra Doug Howe Yuval Ishai Radha Jagadeesan Petr Janˇcar Alan Jeffrey Roope Kaivola Yechiel M. Kimchi Leszek Aleksander Kolodziejczyk Beata Konikowska Eryk Kopczy´ nski K. Narayan Kumar Orna Kupferman Dietrich Kuske Anna Labella
VIII
Organization
James Laird Ivan Lanese Slawomir Lasota St´ephane Lengrand Leonardo Lesmo Laurent¸iu Leu¸stean Steven Lindell Kamal Lodaya ´ Etienne Lozes Bas Luttik Parthasarathy Madhusudan Johann A. Makowsky Giulio Manzonetto Annalisa Marcja Wim Martens Fabio Martinelli Simone Martini Andrea Masini Ralph Matthes Richard Mayr Hern´an Melgratti Markus Michelbrink Marino Miculan Joseph S. Miller Grigori Mints Yoram Moses Madhavan Mukund Filip Murlak Peter Møller Neergaard Linh Anh Nguyen Hans de Nivelle
Mitsu Okada Fr´ed´eric Olive C.-H. L. Ong Jaap van Oosten Simona Orzan Eric Pacuit Vincent Padovani Valeria de Paiva Prakash Panangaden Thomas Perst Adolfo Piperno Nir Piterman Andrew Pitts Jan von Plato John Power Christophe Raffalli Michael Rathjen Brian Redmond Colin Riba Eike Ritter Jir´ı Rosick´ y Luca Roversi Antonino Salibra Ivano Salvo Luigi Santocanale Henning Schnoor Matthias Schr¨ oeder R.A.G. Seely Jonathan P. Seldin G´eraud S´enizergues Sharon Shoham Sunil Easaw Simon
Local Organizing Committee ´ Zolt´an Esik (Szeged, Co-chair) Zsolt Gazdag (Szeged) ´ Gomb´ Eva as (Szeged, Co-chair) Szabolcs Iv´an (Szeged) Zsolt Kakuk (Szeged) Lor´ and Muzamel (Szeged) Zolt´an L. N´emeth (Szeged) S´ andor V´ agv¨ olgyi (Szeged, Workshop Chair)
Alan Smaill Viorica Sofronie-Stokkermans Jiˇr´ı Srba Ian Stark Frank Stephan Colin Stirling Kristian Støevring Howard Straubing Ross Street Thomas Streicher S. P. Suresh Ryo Takemura Tony Tan Hayo Thielecke Wolfgang Thomas Michael Tiomkin Ralf Treinen Sergei Tupailo Christian Urban Pawel Urzyczyn Tarmo Uustalu Betti Venneri Aymeric Vincent Heinrich Wansing Andreas Weiermann Freek Wiedijk Thomas Wilke Bo˙zena Wo´zna Shmuel Zaks Artur Zawlocki Konrad Zdanowski
Table of Contents
Invited Presentations Functorial Boxes in String Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Paul-Andr´e Melli`es
1
Some Results on a Game-Semantic Approach to Verifying Finitely-Presentable Infinite Structures (Extended Abstract) . . . . . . . . . . . C.-H.L. Ong
31
Automata and Logics for Words and Trees over an Infinite Alphabet . . . . Luc Segoufin
41
Nonmonotonic Logics and Their Algebraic Foundations . . . . . . . . . . . . . . . . Miroslaw Truszczy´ nski
58
Contributions Semi-continuous Sized Types and Termination . . . . . . . . . . . . . . . . . . . . . . . . Andreas Abel
72
Visibly Pushdown Automata: From Language Equivalence to Simulation and Bisimulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jiˇr´ı Srba
89
A Finite Semantics of Simply-Typed Lambda Terms for Infinite Runs of Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Klaus Aehlig The Power of Linear Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Sandra Alves, Maribel Fern´ andez, M´ ario Florido, Ian Mackie Logical Omniscience Via Proof Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Sergei Artemov, Roman Kuznets Verification of Ptime Reducibility for System F Terms Via Dual Light Affine Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Vincent Atassi, Patrick Baillot, Kazushige Terui MSO Queries on Tree Decomposable Structures Are Computable with Linear Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Guillaume Bagan
X
Table of Contents
Abstracting Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Nick Benton Collapsibility in Infinite-Domain Quantified Constraint Satisfaction . . . . . 197 Manuel Bodirsky, Hubie Chen Towards an Implicit Characterization of N C k . . . . . . . . . . . . . . . . . . . . . . . . 212 G. Bonfante, R. Kahle, J.-Y. Marion, I. Oitavem On Rational Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Arnaud Carayol, Christophe Morvan Reasoning About States of Probabilistic Sequential Programs . . . . . . . . . . 240 R. Chadha, P. Mateus, A. Sernadas Concurrent Games with Tail Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Krishnendu Chatterjee Nash Equilibrium for Upward-Closed Objectives . . . . . . . . . . . . . . . . . . . . . 271 Krishnendu Chatterjee Algorithms for Omega-Regular Games with Imperfect Information . . . . . . 287 Krishnendu Chatterjee, Laurent Doyen, Thomas A. Henzinger, Jean-Fran¸cois Raskin Relating Two Standard Notions of Secrecy . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 V´eronique Cortier, Micha¨el Rusinowitch, Eugen Z˘ alinescu Jump from Parallel to Sequential Proofs: Multiplicatives . . . . . . . . . . . . . . . 319 Paolo Di Giamberardino, Claudia Faggian First-Order Queries over One Unary Function . . . . . . . . . . . . . . . . . . . . . . . . 334 Arnaud Durand, Fr´ed´eric Olive Infinite State Model-Checking of Propositional Dynamic Logics . . . . . . . . . 349 Stefan G¨ oller, Markus Lohrey Weak Bisimulation Approximants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Will Harwood, Faron Moller, Anton Setzer Complete Problems for Higher Order Logics . . . . . . . . . . . . . . . . . . . . . . . . . . 380 Lauri Hella, Jos´e Mar´ıa Turull-Torres Solving Games Without Determinization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Thomas A. Henzinger, Nir Piterman
Table of Contents
XI
Game Quantification on Automatic Structures and Hierarchical Model Checking Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 L ukasz Kaiser An Algebraic Point of View on the Crane Beach Property . . . . . . . . . . . . . . 426 Clemens Lautemann, Pascal Tesson, Denis Th´erien A Sequent Calculus for Type Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 St´ephane Lengrand, Roy Dyckhoff, James McKinna Universality Results for Models in Locally Boolean Domains . . . . . . . . . . . . 456 Tobias L¨ ow, Thomas Streicher Universal Structures and the Logic of Forbidden Patterns . . . . . . . . . . . . . . 471 Florent Madelaine On the Expressive Power of Graph Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 Jerzy Marcinkowski Hoare Logic in the Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Ursula Martin, Erik A. Mathiesen, Paulo Oliva Normalization of IZF with Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 Wojciech Moczydlowski Acyclicity and Coherence in Multiplicative Exponential Linear Logic . . . . 531 Michele Pagani Church Synthesis Problem with Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 546 Alexander Rabinovich Decidable Theories of the Ordering of Natural Numbers with Unary Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562 Alexander Rabinovich, Wolfgang Thomas Separation Logic for Higher-Order Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 Bernhard Reus, Jan Schwinghammer Satisfiability and Finite Model Property for the Alternating-Time µ-Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 Sven Schewe, Bernd Finkbeiner Space-Efficient Computation by Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . 606 Ulrich Sch¨ opp
XII
Table of Contents
Appendix The Ackermann Award 2006 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 S. Abramsky, E. Gr¨ adel, J. Makowsky Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
Functorial Boxes in String Diagrams Paul-Andr´e Melli`es Equipe Preuves, Programmes, Syst`emes CNRS — Universit´e Paris 7 Denis Diderot
Abstract. String diagrams were introduced by Roger Penrose as a handy notation to manipulate morphisms in a monoidal category. In principle, this graphical notation should encompass the various pictorial systems introduced in proof-theory (like Jean-Yves Girard’s proof-nets) and in concurrency theory (like Robin Milner’s bigraphs). This is not the case however, at least because string diagrams do not accomodate boxes — a key ingredient in these pictorial systems. In this short tutorial, based on our accidental rediscovery of an idea by Robin Cockett and Robert Seely, we explain how string diagrams may be extended with a notion of functorial box depicting a functor transporting an inside world (its source category) to an outside world (its target category). We expose two elementary applications of the notation: first, we characterize graphically when a faithful balanced monoidal functor F : C −→ D transports a trace operator from the category D to the category C, and exploit this to construct well-behaved fixpoint operators in cartesian closed categories generated by models of linear logic; second, we explain how the categorical semantics of linear logic induces that the exponential box of proof-nets decomposes as two enshrined boxes.
1
Introduction
The origins. Although the process was already initiated in the late 1960s and early 1970s, very few people could have foreseen that Logic and Computer Science would converge so harmoniously and so far in the two areas of proof theory and programming language design. Today, about fourty years later, the two research fields are so closely connected indeed, that any important discovery in one of them will have, sooner or later, an effect on the other one. The very existence of the conference Computer Science Logic bears witness of this important and quite extraordinary matter of fact. The convergence would not have been as successful without the mediation of category theory — which made an excellent matchmaker between the two subjects, by exhibiting the algebraic properties underlying the mathematical models (or denotational semantics) of both proof systems and programming languages. At the end of the 1970s, a few people were already aware that:
Research partially supported by the ANR Project INVAL “Invariants alg´ebriques des syst`emes informatiques”.
´ Z. Esik (Ed.): CSL 2006, LNCS 4207, pp. 1–30, 2006. c Springer-Verlag Berlin Heidelberg 2006
2
P.-A. Melli`es
– intuitionistic logic as articulated in proof theory, – the λ-calculus as implemented in programming languages, – cartesian closed categories as investigated in category theory are essentially the same object in three different guises — see for instance Jim Lambek and Phil Scott’s monograph [34]. The idea circulated widely in the community, so that a few years later, in the mid-1980s, the following trilogy of concepts has become prominent: Cartesian-Closed Categories
λ-calculus
Intuitionistic Logic
A linear world opens. The year 1985 was then a turning point, with the discovery of linear logic by Jean-Yves Girard. This single discovery had the quite extraordinary effect of refurbishing every part of the subject with new tools, new ideas, and new open problems. In particular, each of the three concepts above was reunderstood in a linear fashion. In effect, Jean-Yves Girard [18,19] introduced simultaneously: 1. a sequent calculus for linear logic, which refines the sequent calculus for Intuitionistic Logic defined by Gerhard Gentzen in the 1930s — in particular, every derivation rule in intuitionistic logic may be translated as a series of more “atomic” derivation rules in linear logic, 2. a graphical syntax of proofs, called proof-nets, which refines the term syntax provided by λ-terms — in particular, every simply-typed λ-term may be translated as a proof-net, in such a way that a β-reduction step on the original λ-term is mirrored as a series of more “atomic” cut-elimination steps in the associated proof-net, 3. a denotational semantics of linear logic, based on coherence spaces and cliques, which refines the model of dI-domains and stable functions defined by G´erard Berry [7] for the purely functional language PCF, a simply-typed λcalculus extended with a fixpoint operator, a conditional test on booleans, and the main arithmetic operations. People like Robert Seely [45], Yves Lafont [31] and Fran¸cois Lamarche [33] realized very early that the construction amounts to replacing a cartesian closed category (of dI-domains and stable maps) by a monoidal closed category (of coherence spaces and cliques) equipped with a particular kind of comonad to interpret the exponential modality (noted !) of linear logic. From this followed a new and refined “linear” trilogy, which became prominent in the early 1990s:
Functorial Boxes in String Diagrams
3
Monoidal-Closed Categories
Proof-Nets
Linear Logic
A puzzle in string diagrams. I started my PhD thesis exactly at that time, but in a quite different topic: Rewriting Theory, with Jean-Jacques L´evy at INRIA Rocquencourt. Although I devoted all my energies to exploring the arcanes of my own subject, this culminating in [38,39], I was astonished by the elegance of linear logic, and by the extraordinary perspectives opened by its discovery. Indeed, our emerging field: the semantics of proofs and programs, was suddenly connected to something like mainstream mathematics: linear algebra, representation theory, low-dimensional topology, etc. My interest was reinforced after a discussion with Yves Lafont, who revealed suddenly to me that multiplicative proof-nets, and more generally, his own notion of interaction nets [32] are specific instances of a graphical notation invented by Roger Penrose [43,44] to manipulate morphisms in monoidal categories; and that this notation is itself connected to the works by Jean B´enabou on bicategories [4], by Ross Street on computads [47], and by Albert Burroni on polygraphs and higher-dimensional rewriting [13]. Then, Andr´e Joyal and Ross Street published at about the same time two remarkable papers [27,28] devoted to braided monoidal categories and string diagrams. This elegant work finished to convince me... Indeed, I will start this tutorial on string diagrams by giving a very brief and partial account of the two articles [27,28] in Section 2. Now, it is worth recalling that a proof-net is called multiplicative when it describes a proof limited to the multiplicative fragment of linear logic. Since multiplicative proof-nets are instances of string diagrams... there remains to understand the “stringy” nature of general proof-nets — that is, proof-nets not limited to the multiplicative fragment. A serious difficulty arises at this point: general proof-nets admit exponential boxes which depict the action of the exponential modality ! on proofs, by encapsulating them. Recall that the purpose of the modality ! is to transform a “linear” proof which must be used exactly once, into a “multiple” proof which may be repeated or discarded during the reasoning. So, by surrounding a proof, the exponential box indicates that this proof may be duplicated or erased. The trouble is that, quite unfortunately, string diagrams do not admit any comparable notion of “box”. Consequently, one would like to extend string diagrams with boxes... But how to proceed? The lessons of categorical semantics. Interestingly, the solution to this puzzle appears in the categorical semantics of linear logic, in the following way. In the early 1990s, Martin Hyland and Gordon Plotkin initiated together with their students and collaborators Andrew Barber, Nick Benton, Gavin Bierman, Valeria de Paiva, and Andrea Schalk, a meticulous study of the categorical structure
4
P.-A. Melli`es
defining a model of linear logic [6,8,5,9,3,23]. The research was fruitful in many ways. In particular, it disclosed a common pattern behind the various categorical axiomatizations of linear logic. Indeed, every different axiomatization of linear logic generates what appears to be a symmetric monoidal adjunction L
Mf
⊥
&
L
(1)
M
between a symmetric monoidal closed category L and a cartesian category M. This important notion was introduced and called a Linear-Non-Linear model by Nick Benton [5,37]. Here, it will be simply called a linear adjunction. The notations L and M are mnemonics for Linearize and Multiply. Intuitively, a proof of linear logic is interpreted as a morphism in the category L or in the category M, depending whether it is “linear” or “multiple”. Then, • the functor M transports a “linear” proof into a “multiple” proof, which may be then replicated or discarded inside the cartesian category M, • conversely, the functor L transports a “multiple” proof into a “linear” proof, which may be then manipulated inside the symmetric monoidal closed category L. To summarize: there are two “worlds” or “universes of discourse” noted L and M, each of them implementing a particular policy, and two functors L and M designed to transport proofs from one world to the other. An early illustration. Interestingly, this pattern traces back to the very origin of linear logic: coherence spaces. Indeed, Max Kelly notices [25,24] that what one calls “symmetric monoidal adjunction” in (1) is simply an adjunction L M in the usual sense, in which one requires moreover that the left adjoint functor L transports the cartesian structure of M to the symmetric monoidal structure of L. The detailed proof of this fact appears in my recent survey on the categorical semantics of linear logic [40]. Such a functor L is called strong monoidal in the litterature — the precise definition is recalled in Section 4. Now, the practiced reader will recognize that the linear adjunction (1) describes precisely how the category M of dI-domains and stable functions is related to the category L of coherence spaces and cliques. Recall indeed that a coherence space is simply a reflexive graph, and that the functor L transforms every dI-domain D into a coherence space L(D) whose nodes are the elements of D, and in which two nodes x ∈ D and y ∈ D are connected by an edge (that is, are coherent) precisely when there exists an element z ∈ D such that x ≤ z ≥ y. Since the tensor product of coherence spaces is the same thing as the usual product of graphs, the equality follows: L(D × E)
=
L(D) ⊗ L(E).
Although one should check carefully the conditions of Section 4, it is quite immediate that the functor L is strict monoidal — hence strong monoidal. At this
Functorial Boxes in String Diagrams
5
point, there only remains to define a right adjoint functor M to the functor L in the way exposed in [18,19,1] in order to find oneself in the situation of a linear adjunction (1). The exponential modality decomposed. Although the pattern of linear adjunction (1) looks familiar from a semantic point of view, it appears quite unexpected from the point of view of proof-nets — because the exponential modality ! is not a primitive anymore: it is deduced instead as the comonad !
=
L ◦ M
(2)
generated by the linear adjunction (1) in the category L. In other words, the exponential modality ! factors into a pair of more atomic modalities L and M . Nick Benton [5] mirrors this semantic decomposition into a logic and a term language, which he calls Linear-Non-Linear logic. The decomposition may be transposed instead into the pictorial language of proof-nets: it tells then that the exponential box should decompose into a pair of “boxes” interpreting the two modalities L and M . This pictorial decomposition of the box ! should follow the principles of string diagrams, and be nothing more, and nothing less, than a handy graphical notation for the categorical equality (2). Functorial boxes. Now, the two modalities L and M in the linear adjunction (1) are monoidal functors between the monoidal categories L and M — where the monoidal structure of M is provided by its cartesian structure. Hence, monoidal functors are precisely what one wants to depict as “boxes” in string diagrams. The task of Sections 3 and 4 is precisely to explain how monoidal functors are depicted as functorial boxes in string diagrams — and what kind of box depicts a lax, a colax or a strong monoidal functor. I rediscover in this way, ten years later, an idea published by Robin Cockett and Richard Seely [15] in their work on linearly distributive categories and functors. See also the related article written in collaboration with Rick Blute [11]. Obviously, all the credit for the idea should go to them. On the other hand, I find appropriate to promote here this graphical notation which remained a bit confidential; and to illustrate how this handy notation for monoidal functors may be applied in other contexts than linear logic or linearly distributive categories. So, I will discuss briefly in Section 7 how the exponential box ! of linear logic decomposes into a functorial box M enshrined inside a functorial box L. Categorical semantics indicates that the functor L is strong monoidal whereas the functor M is lax monoidal — see Section 4 for a definition. Consequently, the two functorial boxes are of a different nature. One benefit of using string diagrams instead of proof-nets is that the graphical notation mirrors exactly the underlying categorical semantics. In particular, I will illustrate how the typical cut-elimination steps in proof-nets are themselves decomposed into sequences of more atomic rewrite steps in string diagrams. Each of these rewrite steps depicts a step in the proof of soundness of the categorical semantics of linear logic implemented by Linear-Non-Linear models.
6
P.-A. Melli`es
Trace operators in linear logic. In order to interpret recursive calls in a programming language like PCF, one needs a cartesian closed category equipped with a fixpoint operator. Recall that a parametric fixpoint operator Fix in a cartesian category C is a family of functions FixU A : C(A × U, U ) −→ C(A, U ) making the diagram below commute FixU A (f )
A
/U O
ΔA
f
A×A
idA ×FixU A (f )
/ A×U
for every morphism f : A × U −→ U . The diagram expresses that FixU A is a parametric fixpoint of the morphism f . A fixpoint operator should also satisfy a series of naturality properties described in Theorem 3.1 of [20]. A few years ago, Martin Hyland and Masahito Hasegawa [20] have pointed out independently that the notion of fixpoint operator is closely related to the notion of trace introduced by Andr´e Joyal, Ross Street and Dominic Verity [29] in the context of balanced monoidal categories — a mild refinement of braided monoidal categories, see Section 5 for a definition of trace. More precisely, Martin Hyland and Masahito Hasegawa show that a trace in a cartesian category C is the same thing as a particularly well-behaved notion of parametric fixpoint, see [20]. Now, it appears that in many existing models of linear logic, formulated here as a linear adjunction (1), the symmetric monoidal closed category L has a trace. This happens typically when the category L is autonomous, like the category Rel of sets and relations (with the usual product of sets as tensor product) or variants recently studied by Nicolas Tabareau [49] of the category of Conway games introduced by Andr´e Joyal [26]. An interesting question thus is to understand when a trace in the category L may be transported to a trace, and thus a fixpoint operator, in the cartesian category M. A nice example, suggested to me by Masahito Hasegawa, shows that this is not possible in general. Consider the powerset monad T on the usual category Set of sets and functions: the monad associates to every set X the set T X of its subsets. The monad T induces an adjunction L
Set h
⊥
(
Rel
(3)
M
between the category Set and its kleisli category Set T — which is isomorphic to the category Rel of sets and relations. The lifting monad T being commutative, or equivalently, symmetric monoidal (in the lax sense), the adjunction (3) is
Functorial Boxes in String Diagrams
7
symmetric monoidal, see [30]. In particular, the kleisli category Set T inherits its monoidal structure from the cartesian structure of the category Set; and the functor L which sends the category Set to the subcategory of functions in Rel , is strict monoidal. So, the adjunction (3) is linear, and defines a model of linear logic, in which the category L = Rel is autonomous, and thus has a trace. On the other hand, there is no fixpoint operator, and thus no trace, in the cartesian category M = Set. At this point, it is worth noticing that the functor L is faithful in the typical models of linear logic, because the category M is either equivalent to a subcategory of commutative comonoids in L, or equivalent to a subcategory of coalgebras of the comonad ! = L ◦ M — in particular to the category of free coalgebras when M is the co-kleisli category associated to the comonad. Another equivalent statement is that every component of the unit η of the monad M ◦L is a monomorphism. This observation motivates to characterize in Section 6 when a faithful balanced monoidal functor C
F
/D
(4)
between balanced monoidal categories transports a trace in the target category D to a trace in the source category C. The proof of this result is perfectly elementary, and offers a nice opportunity to demonstrate how string diagrams and functorial boxes may be manipulated in order to produce purely diagrammatic proofs. Of course, the result specializes then to the strong monoidal functor L involved in a typical model of linear logic. This enables to transport a trace in the category L to a well-behaved parametric fixpoint operator in the category M in several models of interest — including the relational model of linear logic, and the categories of Conway games mentioned earlier. String diagrams in computer science and logic: a few perspectives. My ambition in writing this elementary tutorial is to demonstrate in a few pictures that categorical semantics is also of a diagrammatic nature. Proof-nets were invented by a genial mind, but they remain an ad’hoc and slightly autarchic artefact of proof-theory. On the other hand, string diagrams flourished in the middle of algebra. Categorical semantics is precisely here to connect the two subjects, with benefits on both sides: logic and computer science on the one hand, categorical algebra on the other hand. Obviously, much work remains to be done in the area. In many respects, the three concepts appearing in the first trilogy (intuitionistic logic, λ-calculus, cartesian closed categories) were more tightly connected in the mid-1980s than the three concepts appearing in the second trilogy (linear logic, proof-nets, monoidal closed categories) are connected today. The article published recently by Maria Emilia Maietti, Paola Maneggia, Valeria de Paiva, Eike Ritter [37] is extremely clarifying from that point of view: it is established there that the Linear-Non-Linear term language introduced
8
P.-A. Melli`es
by Nick Benton [5] is the internal language of the category of linear adjunctions (1). Note that the idea of reformulating this result using string diagrams (extended with functorial boxes) instead of a term language motivates implicitly the discussion in Section 7. Another key work in the area was published by Rick Blute, Robin Cockett, Robert Seely and Todd Trimble [12] about coherence in linearly distributive categories. The article describes the free linearly distributive category and the free ∗-autonomous over a given category C, using equations on a variant of Jean-Yves Girard’s multiplicative proof-nets. I am confident that a broader picture will emerge at some point from the current work at the interface of linear logic and categorical algebra. In the near future, we will certainly find natural to extract a language or a logic as the internal language of a particular categorical pattern, similar to the linear adjunction (1) and possibly formulated as a 2-dimensional version of Lawvere theory [35,47,13,10,46]. The languages would be expressed alternatively with string diagrams, for handy manipulation, or with terms, for easy implementation. The resulting trilogy of concepts: Categorical Semantics
String Diagrams
Logic and Language
would be broader in scope and more tightly connected than the current one. It would also integrate the algebraic and pictorial systems formulated for concurrency theory, like Robin Milner’s bigraphs [41]. The existing categorical semantics of action calculi [22,42,2] indicate a close relationship with the notion of fibred functor between fibred categories, and with the models of linear logic based on linear adjunctions (1). I should conclude this introduction by observing that functorial boxes in string diagrams offer a handy 2-dimensional notation for what could be depicted alternatively using Ross Street’s 3-dimensional surface diagrams [48]. Surface diagrams are more perspicuous in many ways: for instance, a functor is depicted there as a string, instead of a box. However, the two notations are not extremely different: the practiced reader will easily translate the string diagrams appearing in the tutorial into surface diagrams — in which strings are replaced by ribbons, in order to accomodate the twists. In that respect, this tutorial should be also understood as incentive to carry on in the diagrammatic path, and to depict proofs as surface diagrams. The resulting 3-dimensional notation, added to the observation [16] that a ∗-autonomous category is essentially the same thing as a Frobenius algebra in the autonomous category of small categories and “profunctors” or “distributors” — will certainly offer a revitalizing point of view on linear logic, which remains to be investigated.
Functorial Boxes in String Diagrams
2
9
String Diagrams
In a series of two remarkable papers, Andr´e Joyal and Ross Street introduce the notion of balanced monoidal category [27] and develop a graphical notation, based on string diagrams, to denote morphisms in these categories [28]. Note that from a purely topological point of view, these string diagrams are embedded in the 3-dimensional space. The main task of the second paper [28] is precisely to justify the notation, by showing that any two string diagrams equal modulo continuous deformation denote the same morphism in the balanced monoidal category. The interested reader will find the argument in [28]. Recall that a monoidal category [36] is a category C equipped with a functor ⊗ : C × C −→ C called the tensor product, and an object I called the unit object ; as well as three natural isomorphisms αA,B,C : (A ⊗ B) ⊗ C −→ A ⊗ (B ⊗ C) λA : I ⊗ A −→ A,
ρA : A ⊗ I −→ A
called the associativity, the left and the right unit constraints respectively; such that, for all objects A, B, C and D of the category, the following two diagrams called MacLane’s associativity pentagon and triangle for unit, commute: (A ⊗ B) ⊗ (C ⊗ D) XXXXαXX α ff2 XX, ffffff ((A ⊗ B) ⊗ C) ⊗ D A ⊗ (B ⊗ (C ⊗ D)) O α⊗idD
idA ⊗α
(A ⊗ (B ⊗ C)) ⊗ D
α
/ A ⊗ ((B ⊗ C) ⊗ D)
α
/ A ⊗ (I ⊗ B) (A ⊗ I) ⊗ B MMM q MMM qqq q M q q ρ⊗idB MMM & xqqq idA ⊗λ A⊗B A braiding is a natural isomorphism γA,B : A ⊗ B −→ B ⊗ A such that, for all objects A, B and C of the category, the two hexagonal diagrams below commute: A ⊗ (B ⊗ C)
γ
α kkk5
kkkk (A ⊗ B) ⊗ C SSSS SSS) γ⊗C (B ⊗ A) ⊗ C
α
/ (B ⊗ C) ⊗ A SSSSα SSS) B ⊗ (C ⊗ A) kk5 k k k kk B⊗γ / B ⊗ (A ⊗ C)
10
P.-A. Melli`es γ
(A ⊗ B) ⊗ C
α−1kkk5
kkkk A ⊗ (B ⊗ C) SSSS SSS) A⊗γ A ⊗ (C ⊗ B)
α−1
/ C ⊗ (A ⊗ B) SSSαS−1 SSS) (C ⊗ A) ⊗ B kk5 k k k kk γ⊗B / (A ⊗ C) ⊗ B
Finally, a twist is a natural isomorphism θA : A −→ A such that θI = idI and, for all objects A and B of the category, the diagram below commutes: A⊗B
γA,B
/ B⊗A
θA⊗B
θA ⊗θB
A⊗B o
γB,A
B⊗A
Definition 1. A balanced monoidal category is a monoidal category equipped with a braiding and a twist. Note that a symmetric monoidal category is a balanced category in which, for all objects A and B of the category, the morphism A⊗B
γA,B
γB,A
/ B⊗A
/ A⊗B
is equal to the identity morphism idA⊗B ; and the twist morphism θA coincides with the identity morphism idA . From now on, we suppose for legibility that our balanced monoidal category is strict : this means that, for all objects A, B and C of the category, the component αA,B,C , λA and ρA of the the associativity and unit isomorphisms, are identity morphisms. We follow the conventions used in [28] and thus depict a morphism f : A ⊗ B ⊗ C −→ D ⊗ E in string diagrams as: D
E
f
A
B
C
We depict the composite g ◦ f : A −→ C of two morphisms f : A −→ B and g : B −→ C as:
Functorial Boxes in String Diagrams C
11
C g
g◦f
B
= f A
A
and the tensor product f ⊗ g : A ⊗ C −→ B ⊗ D of two morphisms f : A −→ B and g : C −→ D as: D
B
B⊗D
f ⊗g
g
f
=
C
A
A⊗C
−1 −1 Then, the braiding γA,B and its inverse γA,B , the twist θA and its inverse θA are depicted respectively as: B
A
A
B
B
A
A
B
A
A
A
A
A
A
Note that the third dimension of string diagrams enables to depict the braidings, and that drawing ribbons (instead of strings) is convenient to depict the twists.
3
Functors in String Diagrams
Here, we recall the graphical notation introduced by Robin Cockett and Robert Seely [15] in order to depict a usual functor F : C −→ D between balanced monoidal categories. The functor applied to a morphism f : A −→ B of the category C is represented as a box tagged by the label F , and drawn around the morphism f in the following way: FB
FB
B Ff
f
= F FA
A
FA
12
P.-A. Melli`es
Like any box, the functorial box F is designed to separate an inside world from an outside world: in that case, the inside world is the source category C and the outside world is the target category D. This explains why a string typed F A outside the box (thus, in the category D) becomes a string typed A (thus, in the category C) when it crosses the frontier and enters the box; and that a string typed B inside the box (in the category C) becomes a string typed F B (in the category C) when it crosses the frontier and leaves the box. Given a pair of morphisms f : A −→ B and g : B −→ C, one depicts the two functorial equalities F (g ◦ f ) = F g ◦ F f
F (idA ) = idF A
in the following way: FC C
FC
FA
C
A
FA
g
g
B
F B
FB
=
=
B f F
f A
F
FA
A FA
A
F
FA
FA
Note that exactly one string enters and exits each functorial box F .
4
Monoidal Functors in String Diagrams
In this section, we recall how the graphical notation for functors introduced in the previous section specializes to monoidal functors, see [15] again. It will appear that a monoidal functor (in the lax sense) implements a particular kind of functorial box in which several strings (possibly none) may enter simultaneously, and from which exactly one string exits. Recall that a lax monoidal functor (F, m) : C −→ D between two monoidal categories is a functor F equipped with a morphism m[−] : I −→ F I and a natural morphism m[A,B] : F A ⊗ F B −→ F (A ⊗ B) such that, for all objects A, B and C, the three “coherence” diagrams below commute:
Functorial Boxes in String Diagrams α
(F A ⊗ F B) ⊗ F C
/ F A ⊗ (F B ⊗ F C)
m⊗F C
F A⊗m
F (A ⊗ B) ⊗ F C
F A ⊗ F (B ⊗ C)
m
m
F ((A ⊗ B) ⊗ C) FA ⊗ I
ρ
FA ⊗ FI
I ⊗ FB
Fρ m
/ F (A ⊗ (B ⊗ C)
Fα
/ FA O
F A⊗m
13
λ
/ FB O
m⊗F B
FI ⊗ FB
/ F (A ⊗ I)
Fλ m
/ F (I ⊗ B)
The notion of colax monoidal functor (F, n) is defined in just the same way, except that the coercion morphisms n go in the other direction: n[−] : F I −→ I
n[A,B] : F (A ⊗ B) −→ F A ⊗ F B
A strong monoidal functor is a lax monoidal functor (F, m) in which the coercion maps m are all isomorphisms; equivalently, it is a colax monoidal functor (F, n) in which the coercion maps n are all isomorphisms. Let us explain now how we depict monoidal functors in string diagrams. We will suppose for legibility that the two monoidal categories C and D are strict. Given k objects in the category C, there may be several ways to construct a morphism m[A1 ,···,Ak ] : F A1 ⊗ · · · ⊗ F Ak −→ F (A1 ⊗ · · · ⊗ Ak ) by applying a series of structural morphisms m. Then, the definition of a lax monoidal functor, and more specifically the coherence diagrams recalled above, are designed to ensure that these various ways define the same morphism m[A1 ,···,Ak ] in the end. This morphism is depicted in string diagrams as a box F in which k strings labelled A1 , · · · , Ak enter simultaneously, join together into a unique string labelled A1 ⊗ · · · ⊗ Ak which then exits the box. For instance, the two structural morphisms m[A1 ,A2 ,A3 ] and m[−] are depicted as follows: FI
F (A1 ⊗ A2 ⊗ A3 ) A1 ⊗ A2 ⊗ A3
I
(5) F
A1
A2
A3
F A1
F A2
F A3
F
14
P.-A. Melli`es
More generally, given a morphism f : A1 ⊗ · · · ⊗ Ak −→ B in the source category C, one depicts as the functorial box with k inputs and exactly one output: FB
B f F
(6)
Ak
A1
F A1
F Ak
the morphism F (f ) ◦ m[A1 ,···,Ak ] : F A1 ⊗ · · · ⊗ F Ak −→ F B obtained by precomposing the image of f by the functor F in the target category D, with the morphism m[A1 ,···,Ak ] . Remark. The definition of lax monoidal functor would permit a more general and delayed form of fusion between boxes (think of surface diagrams [48] here). Here, we limit ourselves to the specific pattern (5) of k boxes F , each one encapsulating a unique string labelled Ai , for 1 ≤ i ≤ k, and joining together simultaneously in a box F encapsulating a unique string labelled A1 ⊗ · · · ⊗ Ak . This specific pattern generates boxes of the shape (6) which are easy to understand and to manipulate, and sufficient to the purpose of this tutorial. The coherence properties required by the definition of a monoidal functor ensure that we may safely “merge” two monoidal boxes in a string diagram: FC
FC
C
C
g
g
Ak
A1 F
B
FB
B
=
(7) B f
f
F A1
F Ai
F Aj
F
Ak
Aj
Ai
A1
F
F Ak
F A1
Aj
Ai
F Ai
F Aj
F Ak
Functorial Boxes in String Diagrams
15
Note that a colax monoidal functor may be depicated in a similar fashion, as a functorial box in which exactly one string enters, and several strings (possibly none) exit. Now, a strong monoidal functor is at the same time a lax monoidal functor (F, m) and a colax monoidal functor (F, n). It is thus depicted as a functorial box in which several strings may enter, and several strings may exit. Besides, the coercion maps m are inverse to the coercion maps n. Two diagrammatic equalities follow, which enable to split a “strong monoidal” box horizontally: F Ck
F C1 C1
F C1
Ck
F Ck
C1
Ck
g
g F
B1
Bj
F B1
=
F Bj
f
f
A1
F
(8)
Ai
F A1
A1
F
Ai
F A1
F Ai
F Ai
as well as vertically: F B1
F Bk
B1
Bj
F D1
A1 F A1
=
g Ai F Ai
C1 F C1
Ck F Ck
F D1
F Bk
B1
Dl
f F
F B1
F Dl
D1
A1 F A1
Dl
(9)
g
f F
F Dl
D1
Bj
Ai F Ai
F
C1 F C1
Ck F Ck
These equalities will be illustrated in the series of diagrammatic manipulations exposed in Sections 6 and 7.
5
Traced Monoidal Categories
In a remarkable article, Andr´e Joyal, Ross Street and Dominic Verity [29] define a trace in a balanced monoidal category C as a natural family of functions TrU A,B : C(A ⊗ U, B ⊗ U ) −→ C(A, B) satisfying three axioms: vanishing (monoidality in U ) U V TrU⊗V A,B (g) = TrA,B (TrA⊗U,B⊗U (g)),
TrIA,B (f ) = f.
16
P.-A. Melli`es
superposing U −1 TrU A,B (f ) ⊗ g = TrA⊗C,B⊗D ((idB ⊗ γD,U ) ◦ (f ⊗ g) ◦ (idA ⊗ γC,U )) U −1 = TrA⊗C,B⊗D ((idB ⊗ γD,U ) ◦ (f ⊗ g) ◦ (idA ⊗ γC,U ))
yanking −1 −1 TrU ⊗ idU )) = idU = TrU U,U (γU,U ◦ (θ U,U (γU,U ◦ (θ ⊗ idU )).
A balanced monoidal category equipped with a trace is then called a traced monoidal category. String diagrams for balanced monoidal categories extend to traced monoidal categories by depicting the trace as follows: B
TrU A,B
B
U
(
)
f
f
=
U
A
U
A
The small arrow embroidered on the ribbon recalls that this part of the string diagram depicts a trace, which expresses intuitively a notion of feedback. Thanks to this ingenious notation for traces, the algebraic axioms of a trace are depicted as a series of elementary topological deformations on ribbons, recalled here from [29]: sliding (naturality in U ) B
B u
V
V f
=
f U
U
u A
A
tightening (naturality in A, B) b b f
=
f
a a
Functorial Boxes in String Diagrams
17
vanishing (monoidality in U ) U
U ⊗V
I
V f
=
f
=
f
f
superposing
g
f
=
f
g
f
=
g
yanking
=
U
6
=
U
U
Transport of Trace Along a Faithful Functor
Recall [29] that a balanced monoidal functor F : C −→ D between balanced monoidal categories is a strong monoidal functor satisfying that, for all objects A and B, the diagram below commutes FA ⊗ FB
γA,B
mA,B
F (A ⊗ B)
/ FB ⊗ FA mB,A
F (γA,B )
/ F (B ⊗ A)
and the equality F θA = θF A holds. This may be depicted as the two equalities: FB
FA
FB
FA
FA
=
FA
=
F F FA
FB
FA
FB
FA
FA
18
P.-A. Melli`es
When C and D are traced monoidal, one says that F : C −→ D is traced monoidal when F is balanced monoidal, and preserves traces in the expected sense that, for all objects A, B and U and for all morphism f : A ⊗ U −→ B ⊗ U of the category C, the following equality holds: FU −1 F (TrU A,B (f )) = TrF A,F B (m[A,B] ◦ F f ◦ m[A,B] ).
This equality is depicted as follows: FB
FB FU U f
=
F
f F
FA
FA
An elementary exercise in string diagrams with functorial boxes follows. It consists in establishing in a purely diagrammatic fashion a mild but useful generalization of a statement (Proposition 2.4) appearing in [29]. Proposition 1 (Characterization of transport along a faithful functor). Suppose that F : C −→ D is a faithful, balanced monoidal functor with D traced monoidal. Then, there exists a trace on C for which F is a traced monoidal functor iff for all objects A, B, U of the category C, and all morphism f : A ⊗ U −→ B ⊗ U there exists a morphism g : A −→ B such that U −1 F (g) = TrF F A,F B (m[A,B] ◦ F (f ) ◦ m[A,B] )
(10)
where Tr denotes the trace in D. The equality is depicted as follows: FB FB
FU
B g
=
f
A F
F FA
FA
Moreover, if this trace on C exists, it is unique: it is called the trace on the category C transported from the category D along the functor F .
Functorial Boxes in String Diagrams
19
Proof. The direction (⇒) follows immediately from the very definition of a traced monoidal functor. Hence, we only establish here the converse direction (⇐). We suppose from now on that for every morphism f : A ⊗ U −→ B ⊗ U there exists a morphism g : A −→ B satisfying Equation (10). Note that the morphism g is unique because the functor F is faithful. This defines a family of functions noted trU A,B : C(A ⊗ U, B ⊗ U ) −→ C(A, B). We establish that tr satisfies the equational axioms of a trace. To that purpose, we introduce a handy notation for the morphism trU A,B (f ): B
trU A,B
U
(
B
)
f
A
=
U
f
A
U
By definition, trU A,B satisfies the diagrammatic equality: FB
FB FU U f
=
f
F
F
FA
FA
We establish each of the equations by a series of elementary manipulations on string diagrams. Although the proof is diagrammatic, it is absolutely rigorous, and works for weak monoidal categories C and D as well as strict ones. Sliding (naturality in U ). We want to show the equality B
B u V
f
V =
f
U
U u
A
A
Because the functor F is faithful, it is sufficient to establish that the two morphisms A −→ B have the same image F A −→ F B in the target category D:
20
P.-A. Melli`es FB
FB
u V
f
=
V
f
U
U
u F
F
FA
FA
Once the definition of tr applied, we separate the box in two parts, using Equation (7) for the lax monoidal functor F : FB
FB
FV
FB
FV f U
=
V
f
=
f
U
F
U
u F FA
FU
u
F
u F
FA FA
Then, after applying the sliding axiom of the trace Tr in the target category D, we reunify the two separate boxes, using the variant of Equation (7) satisfied by colax monoidal functors. The definition of tr concludes the proof. FB
FU
u
FB
F
FB
FU
FV
u
u V
=
V
=
f
f
V
U
f
F
F
F
FA
FA FA
Tightening (Naturality in A and B). The proof is very similar to the proof of the sliding equality. Because the functor F is faithful, we will deduce the equality b b f
=
f
a a
from the equality by F of the image of the two morphisms in the target category:
Functorial Boxes in String Diagrams FB
21
FB b b f
=
f a F
F
FA
FA
a
This is established as follows. Once the definition of tr applied, we separate the box in three parts, using Equation (7) for lax monoidal functors, and its colax variant: FB
b
FB
F
FB
b
b
=
f a
f
=
f
F
a F
F FA
a
FA F FA
Then, we apply the tightening axiom of the trace Tr in the category D, followed by the definition of tr, and finally reunify the three boxes together, using Equation (7) for lax monoidal functors, and its colax variant. FB
FB b
b F
F
FB b
f
f
=
F
=
f
F
F a
a
F
a
FA
F
FA
FA
Vanishing (monoidality in U ). We will proceed here as in the previous proofs, and deduce the two equalities formulated in the source category C,
f
U ⊗V
=
f
V
U
f
I
=
f
22
P.-A. Melli`es
from the two equalities below, formulated in the target category D,
U ⊗V
f
=
f
V
=
f
F
F
F
I
f
U
F
The first equation is established as follows. After applying the definition of tr, we split the string U ⊗ V in two strings U and V , then separate the box in two parts, using Equation (8) for the strong monoidal functor F :
F (U ⊗ V )
f
F (U ⊗ V )
f
F (U ⊗ V ) U ⊗V
U ⊗V
=
U ⊗V
f
=
f
=
V
U
F
F FU
FV
F
U ⊗V
F
U ⊗V
F
Then, we apply the sliding and vanishing axioms of the trace Tr in the category D, and reunify the two boxes using Equation (8), before concluding by applying the definition of tr twice.
U ⊗V
F
FV
f
= f
FU
U ⊗V
FU
U ⊗V
=
f
f
V
U
F
U ⊗V
F
FV
=
F
F
The second equation is established exactly as the previous one, except that we are dealing now with the nullary case instead of the binary one. After applying the definition of tr, we split the string I, and separate the box in two parts, using Equation (8) for the strong monoidal functor F :
f
FI
f
F
I
=
f
I
=
=
F (U ⊗ V )
f
F (I)
I F
F I F
F
I
Functorial Boxes in String Diagrams
23
Then, just as for the binary case, we apply the sliding and vanishing axioms of the trace Tr and reunify the two boxes, before concluding. I
F
I
f
=
f
f
= I
I
F
F
F
Note that we need the hypothesis that the functor F is strong monoidal in order to perform the manipulations for vanishing — while we needed only that it is lax and colax monoidal in the arguments devoted to sliding and tightening. Superposing. We will establish only the first of the two equalities below — since the second one is proved in exactly the same way.
g
f
f
=
g
f
=
g
Because the functor F is faithful, this reduces to showing that the two morphisms have the same image in the category D — which we establish by the series of equalities below. First, we separate the box in two parts, using Equation (9) for the strong monoidal functor F ; and apply the definition of tr in one of the two boxes.
=
g
f
F
=
g
f
F
g
f
F
F
F
Then, after applying the superposing axiom of the trace Tr in the target category D, we merge the two boxes, using again Equation (9) for the strong monoidal functor F ; we insert the two braidings inside the box, using the hypothesis that the functor F is balanced; and finally conclude using the definition of tr.
g
f
F
F
=
f
g
=
f
g
=
f
F F
F
g
24
P.-A. Melli`es
Yanking. The diagrammatic proof follows easily from the hypothesis that the functor F is faithful, and balanced monoidal. The proof is left to the reader as exercise. From this, we conclude that tr defines a trace in the source category C. The fact that the functor F is traced monoidal follows then immediately from the very definition of tr. This concludes the proof of Proposition 1. Application to models of linear logic. In a typical model of linear logic based on a linear adjunction (1) the category M is a full subcategory of the category of Eilenberg-Moore coalgebras of the comonad ! = L ◦ M in the category L — and the functor L is the associated forgetful functor. In that case, Proposition 1 ensures that the category M is traced when the category L is traced, and when, moreover, the trace : LA −→ LB (11) TrLU LA,LB (f ) of every coalgebraic morphism f
:
LA ⊗ LU −→ LB ⊗ LU
(12)
is coalgebraic. This is precisely what happens in the relational model of linear logic, where: – L is the category Rel of sets and relations, with tensor product defined as usual set-theoretic product, – M is the co-kleisli category of the comonad ! which transports every set A to the free commutative comonoid !A with finite multisets of elements of A as elements, and multiset union as coproduct. Note that the co-kleisli category M is understood here as the full subcategory of free coalgebras of the exponential comonad. This establishes that the category M has a well-behaved fixpoint operator. A similar method applies to construct well-behaved fixpoint operators in categories of games and strategies [49]. Another application: Masahito Hasegawa observed (private communication) that the category M is traced whenever it is the co-kleisli category of an idempotent comonad ! = L ◦ M . This interesting fact may be explained (and mildly generalized) by applying Proposition 1 in the following way. Let η and denote the unit of the monad M ◦ L and the counit of the comonad L ◦ M respectively. For general reasons related to adjunctions, it appears that for every morphism f : A × U −→ B × U
(13)
in the category M, the morphism h
=
−1 TrLU LA,LB (m[A,B] ◦ Lf ◦ m[A,B] )
:
/ LB
LA
is equal in the category L to the morphism LA
Lη
/ LM LA
LMh
/ LM LB
The equality is nicely depicted in string diagrams:
LB
/ LB.
(14)
Functorial Boxes in String Diagrams
25
LB LM LB
LB
LB
LU
LU f
=
f
L
L
LA
M
LA
M LA η A
L LA
Here, Proposition 1 applies, and the category M is thus traced, whenever the functor L is faithful, and for every morphism f in (13), the morphism (14) is the image L(g) in the category L of a morphism g : A −→ B in the category M. This is precisely what happens when the category M is defined as the cokleisli category associated to an idempotent comonad ! = L ◦ M . In that case, indeed, the morphism LB : LM LB −→ LB is the identity, and the morphism g is defined as: g
=
A
η
Mh
/ M LA
/ M LB.
A nice problem remains open. A few years ago, Ryu Hasegawa [21] constructed a trace related to the Lagrange-Good inversion formula, in a category of analytic functors. This category, which is cartesian, is the co-kleisli category associated to a specific model of linear logic. Interestingly, the diagrammatic account exposed in this tutorial does not seem to apply (at least directly) to Ryu Hasegawa’s construction. It would be extremely satisfactory to devise alternative algebraic conditions to cover this important example. We leave this open here.
7
Decomposing the Exponential Box of Linear Logic
The decomposition ! = L◦M of the exponential modality of linear logic illustrates the general diagrammatic principle that every functorial box separates an inside world from an outside world, each world implementing his own (eg. cartesian, monoidal closed) policy. We take the freedom of considering here a “balanced” version of linear logic, whose categorical model is defined as a balanced monoidal adjunction L
Mf
⊥ M
&
L
(15)
26
P.-A. Melli`es
between a balanced monoidal category L and a cartesian category M. Note that in such an adjunction, the functor L is balanced monoidal. In that setting, the exponential box ! with its auxiliary doors labelled by the formulas !A1 , ..., !Ak and with its principal door labelled by the formula !B is translated as a lax monoidal box M enshrined inside a strong monoidal box L, in the following way: !B
LM B
B
MB B f
f
= M A1 !
Ak
A1
M A1
L
LM Ak
LM A1
!Ak
!A1
Ak M Ak
Now, the category M enshrined “inside” the functorial box L is cartesian, with binary product noted × here. Hence, every object X of the category M induces a diagonal morphism ΔX : X −→ X × X. In particular, every object A of the category L induces a diagonal morphism ΔMA : M A −→ M A × M A. The contraction of linear logic is defined as the morphism L(ΔMA ) depicted as the diagonal string ΔMA inside the strong monoidal box L: !A
LM A
!A
LM A MA
MA c
=
Δ L
!A
MA LM A
If one translates in string diagrams the usual cut-elimination step of linear logic between a contraction rule and an introduction rule of the exponential box, this decomposes the step in a series of more atomic steps. First, the box L which encapsulates the diagonal ΔMA merges with the box L which encapsulates the content f of the exponential box. This releases the diagonal ΔMA inside the cartesian category M enshrined in the exponential box.
Functorial Boxes in String Diagrams LM B
LM B
LM B
MB
MB
LM B MB
MB
Δ L
Δ
MB
MB
LM B MB
=
B
B
f
f M A1 L
27
M A1
Ak
L
M Ak
M A1
LM Ak
LM A1
LM Ak
LM A1
Ak M Ak
M A1
Then, the diagonal ΔMA replicates the content f of the exponential box — or more precisely the morphism f encapsulated by the lax monoidal box M . Note that the duplication step is performed in the cartesian category M enshrined by the functorial box L. LM B
LM B
MB
MB
B
B f
f Ak
M A1 M A1
M A1
Δ
Δ L
Ak M Ak
M A1
M Ak
M A1
M Ak
LM A1
LM Ak
Once the duplication finished, the strong monoidal box is split in three horizontal parts using Equation (8). LM B
LM B MB
MB
B
B
f
f M L
A1
Ak
M A1
M Ak
M
A1
Ak M Ak
M A1
M A1
M Ak
L
Δ L
Δ
M A1
M Ak
LM A1
LM Ak
The intermediate box may be removed, because the functor L is balanced.
28
P.-A. Melli`es LM B
LM B
MB
MB
B
B f
f M L
A1
Ak
M A1
M
A1
Ak M Ak
M A1
M Ak
LM Ak
LM A1
Δ
Δ M A1
M Ak
LM A1
LM Ak
L
Finally, the remaining monoidal boxes L are split vertically, using Equation (9). LM B
LM B MB
MB
B
B f M A1 L
f
A1
Ak
Ak
M
M A1
M Ak
L
LM A1
LM Ak
Δ
Δ L
M A1 LM A1
L
M Ak LM Ak
This completes the categorical and diagrammatical transcription of this particular cut-elimination step. The other cut-elimination steps of linear logic involving the exponential box ! are decomposed in a similar fashion. Acknowledgments. This short tutorial was stimulated and inspired by discussions with Martin Hyland and Masahito Hasegawa on trace operators in models of linear logic, held during the summer 2005 and onwards. I thank them for their precious insights and advice. I am also grateful to Nicolas Tabareau for motivating this work by his ongoing study of trace operators in game semantics. Finally, I thank the Research Institute for Mathematical Science (RIMS) in Kyoto, for hosting me when I wrote this tutorial.
References 1. R. Amadio and P.-L. Curien. Domains and Lambda-Calculi. Cambridge University Press, 1998. 2. A. Barber, P. Gardner, M. Hasegawa, G. Plotkin. From action calculi to linear logic. Proceedings of Computer Science Logic ’97, Aarhus, Denmark. Volume 1414 of Lecture Notes in Computer Science, Springer Verlag. 1997. 3. A. Barber. Linear Type Theories, Semantics and Action Calculi. PhD Thesis of the University of Edinburgh. LFCS Technical Report CS-LFCS-97-371. 1997.
Functorial Boxes in String Diagrams
29
4. J. B´enabou. Introduction to bicategories. Reports of the Midwest Category Seminar. Volume 47 of Lecture Notes in Mathematics, Springer Verlag. 1967. 5. N. Benton. A Mixed Linear and Non-Linear Logic: Proofs, Terms and Models. Proceedings of Computer Science Logic ’94, Kazimierz, Poland. Volume 933 of Lecture Notes in Computer Science, Springer Verlag. June 1995. 6. N. Benton, G. Bierman, V. de Paiva, M. Hyland. Term assignment for intuitionistic linear logic. Technical Report 262, Computer Laboratory, University of Cambridge, 1992. 7. G. Berry. Stable models of typed lambda-calculi. Proceedings of the 5th International Colloquium on Automatas, Languages and Programming, number 62 in Lecture Notes in Computer Science. Springer Verlag 1978. 8. G. Bierman. On intuitionistic linear logic. PhD Thesis. University of Cambridge Computer Laboratory, December 1993. 9. G. Bierman. What is a categorical model of intuitionistic linear logic? Proceedings of the Second International Conference on Typed Lambda Calculus and Applications. Volume 902 of Lecture Notes in Computer Science, Springer Verlag. Edinburgh, Scotland, April 1995. Pages 73-93. 10. H. Blackwell, M. Kelly, and A. J. Power. Two dimensional monad theory. Journal of Pure and Applied Algebra, 59:1–41, 1989. 11. R. Blute, R. Cockett, R. Seely. The logic of linear functors. Mathematical Structures in Computer Science,12 (2002)4 pp 513-539. 12. R. Blute, R. Cockett, R. Seely, T. Trimble. Natural Deduction and Coherence for Weakly Distributive Categories. Journal of Pure and Applied Algebra, 113(1996)3, pp 229-296. 13. A. Burroni. Higher Dimensional Word Problem, Category Theory and Computer Science, Lecture Notes in Computer Science 530, Springer-Verlag, 1991. 14. R. Cockett, R. Seely. Linearly Distributive Categories. Journal of Pure and Applied Algebra, 114(1997)2, pp 133-173. 15. R. Cockett, R. Seely. Linear Distributive Functors. In The Barrfestschrift, Journal of Pure and Applied Algebra, Volume 143, Issue 1-3, 10 November 1999. 16. B. J. Day and R. Street. Quantum categories, star autonomy, and quantum groupoids. Galois Theory, Hopf Algebras, and Semiabelian Categories. Fields Institute Communications 43 (American Math. Soc. 2004) 187-226. 17. G. Gentzen. Investigations into logical deduction (1934). An english translation appears in The Collected Papers of Gerhard Gentzen. Edited by M. E. Szabo, North-Holland 1969. 18. J.-Y. Girard. Linear logic. Theoretical Computer Science, 50: 1-102, 1987. 19. J.-Y. Girard. Linear logic: its syntax and semantics. In Advances in Linear Logic, London Mathematical Society Lecture Note Series 222, pp. 1–42, Cambridge University Press, 1995. 20. M. Hasegawa. Recursion from cyclic sharing: traced monoidal categories and models of cyclic lambda-calculi. Proceeding of the 3rd International Conference on Typed Lambda-Calculi and Applications, Springer Verlag, Lecture Notes in Computer Science 1210, (1997). 21. R. Hasegawa. Two applications of analytic functors. Theoretical Computer Science 272 (2002) 113-175. 22. C. Hermida and J. Power. Fibrational control structures. Proceedings of CONCUR 1995. Springer Lecture Notes in Computer Science 962. pp 117–129, 1995. 23. M. Hyland and A. Schalk. Glueing and orthogonality for models of linear logic. Theoretical Computer Science 294(1/2): 183-231, 2003.
30
P.-A. Melli`es
24. G. B. Im and M. Kelly. A universal property of the convolution monoidal structure, J. Pure Appl. Algebra 43, pp. 75-88, 1986. 25. M. Kelly. Doctrinal adjunction. Lecture Notes in Math. 420, pp. 257-280, 1974. 26. A. Joyal. Remarques sur la th´eorie des jeux ` a deux personnes. Gazette des Sciences Math´ematiques du Qu´ebec, volume 1, number 4, pp 46–52, 1977. 27. A. Joyal and R. Street. Braided Tensor Categories, Advances in Mathematics 102, 20–78, 1993. 28. A. Joyal and R. Street. The geometry of tensor calculus, I. Advances in Mathematics 88, 55–112, 1991. 29. A. Joyal, R. Street and D. Verity. Traced monoidal categories. Math. Proc. Camb. Phil. Soc. 119, 447–468, 1996. 30. S. Lack. Limits for lax morphisms. Applied Categorical Structures. 13(3):189-203, 2005. 31. Y. Lafont. Logiques, cat´egories et machines. PhD thesis, Universit´e Paris 7, 1988. 32. Y. Lafont. From Proof Nets to Interaction Nets, In Advances in Linear Logic, London Mathematical Society Lecture Note Series 222, pp. 225–247, Cambridge University Press, 1995. 33. F. Lamarche Sequentiality, games and linear logic, Unpublished manuscript. 1992. 34. J. Lambek and P. Scott. Introduction to Higher Order Categorical Logic. Cambridge Studies in Advanced Mathematics Vol. 7. Cambridge University Press, 1986. 35. F. W. Lawvere. Ordinal sums and equational doctrines. Springer Lecture Notes in Mathematics No. 80, Springer, Berlin, 1969, pp. 141-155. 36. S. Mac Lane. Categories for the working mathematician. Graduate Texts in Mathematics 5. Springer Verlag 2nd edition, 1998. 37. M. Maietti, P. Maneggia, V. de Paiva, E. Ritter Relating categorical semantics for intuitionistic linear logic. Applied Categorical Structures 13(1): 1-36, 2005. 38. P.-A. Melli`es, Typed lambda-calculi with explicit substitutions may not terminate Proceedings of the Second International Conference on Typed Lambda Calculi and Applications, Edinburgh, Lecture Notes in Computer Science 902, pp. 328-334, Springer, 1995. 39. P.-A. Melli`es, Axiomatic Rewriting 4: a stability theorem in rewriting theory. Proceedings of Logic in Computer Science 1998, IEEE Computer Society Press, 1998. 40. P.-A. Melli`es, Categorical semantics of linear logic: a survey. To appear in Panoramas et Synth`eses, Soci´et´e Math´ematique de France, 2007. 41. R. Milner, Pure bigraphs: structure and dynamics. Information and Computation, Volume 204, Number 1, January 2006. 42. D. Pavlovic, Categorical logic of names and abstraction in action calculi. Mathematical Structures in Computer Science, 7 (6) (1997) 619–637. 43. R. Penrose, Applications of negative dimensional tensors, in Combinatorial Mathematics and its Applications, D. J. A. editor, pp. 221-244, Academic Press, New York, 1971. 44. R. Penrose, Spinors and Space-Time, Vol. 1, pp. 68-71, 423-434, Cambridge University Press, Cambridge, U. K., 1984. 45. R. Seely. Linear logic, ∗-autonomous categories and cofree coalgebras. Applications of categories in logic and computer science, Contemporary Mathematics, 92, 1989. 46. S. Schanuel and R. Street. The free adjunction. Cahiers topologie et g´eom´etrie diff´erentielle cat´egoriques 27 (1986) pp. 81-83. 47. R. Street. Limits indexed by category-valued 2-functors. J. Pure Appl. Algebra 8 (1976) 149-181. 48. R. Street. Functorial calculus in monoidal bicategories. Applied Categorical Structures 11 (2003) 219-227. 49. N. Tabareau. De l’op´erateur de trace dans les jeux de Conway. M´emoire de Master 2. Master Parisien de Recherche en Informatique, Universit´e Paris 7, Septembre 2005.
Some Results on a Game-Semantic Approach to Verifying Finitely-Presentable Infinite Structures (Extended Abstract) C.-H.L. Ong Oxford University Computing Laboratory http://users.comlab.ox.ac.uk/luke.ong/
Abstract. We present some results on a game-semantic approach to verifying infinite structures that are generated by higher-order recursion schemes. The key idea is a certain Transference Principle from the structure generated by a given recursion scheme to an auxiliary computation tree, which is itself generated by a related order-0 recursion scheme. By a structural analysis of the computation tree based on the innocent game semantics of the recursion scheme, we can infer certain properties of the generated structure by appropriate algorithmic analysis of the computation tree.
1
Introduction
A basic problem in Verification is to identify classes of finitely-presentable infinitestate systems that have decidable monadic second-order (MSO) theories. This is a question of practical importance because MSO logic is highly expressive: temporal logics that are widely used in computer-aided verification such as LTL, CTL and CTL∗ are embeddable in the modal mu-calculus, and hence, embeddable in MSO logic. Indeed MSO logic is a kind of gold standard in Verification because it is virtually as strong (a specification language) as can be, in the sense that any obvious extension of the logic would render it undecidable. Perhaps one of the best known examples of such MSO-decidable structures is the class of regular trees, as studied by Rabin [1] in 1969. A notable advance occurred some fifteen years later, when Muller and Shupp [2] proved that the configuration graphs of pushdown systems have decidable MSO theories. In the 1990s, as finite-state technologies matured, researchers embraced the challenges of software verification. A highlight in this period was Caucal’s result [3] that prefix-recognisable graphs have decidable MSO theories. Prefix-recognisable graphs may have unbounded out-degrees; they can be characterized [4] as graphs that are obtained from the configuration graphs of pushdown systems by factoring out the -transitions. In 2002 a flurry of discoveries significantly extended and unified earlier developments. In a FOSSACS 2002 paper [5], Knapik, Niwi´ nski and Urzyczyn introduced an infinite hierarchy of (possibly infinite) Σ-labelled trees (i.e. ranked and ordered trees whose nodes are labelled by symbols of a ranked alphabet Σ): ´ Z. Esik (Ed.): CSL 2006, LNCS 4207, pp. 31–40, 2006. c Springer-Verlag Berlin Heidelberg 2006
32
C.-H.L. Ong
the nth level of the hierarchy, SafeRecTreen Σ, consists of Σ-labelled trees generated by order-n recursion schemes that are homogeneously typed 1 and satisfy a syntactic constraint called safety 2 . They showed that for every n ≥ 0, trees in SafeRecTreen Σ have decidable MSO theories; further SafeRecTreen Σ = PushdownTreen Σ i.e. Σ-labelled trees generated by order-n safe recursion schemes are exactly those that are generated by order-n (deterministic) pushdown automata. Thus SafeRecTree0 Σ, the order-0 trees, are the regular trees (i.e. trees generated by finite-state transducers); and SafeRecTree1 Σ, the order1 trees, are those generated by deterministic pushdown automata. Later in the year, Caucal [6] introduced an infinite hierarchy of Σ-labelled trees, the nth level of which, CaucalTreen Σ, consists of Σ-labelled trees that are obtained from regular Σ-labelled trees by iterating n-times the operation of inverse deterministic rational mapping followed by unravelling. A major result in Caucal’s work [6, Theorem 3.5] is that SafeRecTreen Σ = CaucalTreen Σ. To summarize: Theorem 1 (Knapik, Niwinski, Urzyczyn and Caucal 2002). For any ranked alphabet Σ, and for every n ≥ 0, we have SafeRecTreen Σ = PushdownTreen Σ = CaucalTreen Σ; further, trees from the class have decidable MSO theories. Though a rather awkward syntactic constraint, safety plays an important algorithmic rˆ ole. Knapik et al. have asked [5] if the safety assumption is really necessary for their decidability result. In other words, let RecTreen Σ be the class of Σ-labelled trees generated by order-n recursion schemes (whether safe or not, and whether homogeneously typed or not), the question is: For which n ≥ 2 do trees in RecTreen Σ have decidable MSO theories? A partial answer to the question has recently been obtained by Aehlig, de Miranda and Ong at TLCA 2005 [7]; they showed that all trees in RecTree2 Σ have decidable MSO theories. Independently, Knapik, Niwi´ nski, Urzyczyn and Walukiewicz obtained a somewhat sharper result (see their ICALP 2005 paper [8]); they proved that the modal mu-calculus model checking problem for trees generated by order-2 homogeneously-typed recursion schemes (whether safe or not) is 2-EXPTIME complete. 1
2
The base type o is homogeneous; a function type A1 → (A2 → · · · → (An → o) · · ·) is homogeneous just if each Ai is homogeneous, and ord(A1 ) ≥ ord(A2 ) ≥ · · · ≥ ord(An ). A term (or a rewrite rule or a recursion scheme) is homogeneously typed just if all types that occur in it are homogeneous. A homogeneously-typed term of order k > 0 is said to be unsafe if it contains an occurrence of a parameter of order strictly less than k, otherwise the term is safe. An occurrence of an unsafe term t, as a subexpression of a term t , is safe if it occurs in an operator position (i.e. it is in the context · · · (ts) · · ·), otherwise the occurrence is unsafe. A recursion scheme is safe if no unsafe term has an unsafe occurrence in the righthand side of any rewrite rule.
Some Results on a Game-Semantic Approach
33
In this extended abstract, we explain a game-semantic approach to verifying infinite structures that are generated by higher-order recursion schemes. As a major case study, we extend the result of Knapik et al. [8] by proving that for all n ≥ 0, trees in RecTreen Σ have decidable MSO theories; we give an outline of the proof in Section 2. In Section 3 we give an automata-theoretic characterization of trees in RecTreen Σ where n ≥ 0. We show that for the purpose of generating Σ-labelled tree, recursion schemes are equi-expressive with a new kind of automata called collapsible pushdown automata. The same game-semantic approach can be extended to verify certain classes of finitely-presentable infinite graphs. In Section 4, we briefly consider the solution of parity games on configuration graphs of collapsible pushdown automata. Finally we mention a couple of further directions in Section 5. Technical Preliminaries Types are generated from the base type o using the arrow constructor →. Every type A can be written uniquely as A1 → · · · → An → o (by convention arrows associate to the right), for some n ≥ 0 which is called its arity. We define the order of a type by: ord(o) = o and ord(A → B) = max(ord(A) + 1, ord(B)). Let Σ be a ranked alphabet i.e. each Σ-symbol f has an arity ar (f ) ≥ 0 which determines its type o → · · · → o → o. Further we shall assume that each symbol ar (f )
f ∈ Σ is assigned a finite set Dir(f ) = { 1, · · · , ar (f ) } of directions, and we define Dir(Σ) = f ∈Σ Dir(f ). Let D be a set of directions; a D-tree is just a prefix-closed subset of D∗ , the free monoid of D. A Σ-labelled tree is a function t : Dom(t) −→ Σ such that Dom(t) is a Dir(Σ)-tree, and for every node α ∈ Dom(t), the Σ-symbol t(α) has arity k if and only if α has exactly k children and the set of its children is { α 1, · · · , α k } i.e. t is a ranked (and ordered) tree. For each type A, we assume an infinite collection Var A of variables of type A. A (deterministic) recursion scheme is a tuple G = Σ, N , R, S where Σ is a ranked alphabet of terminals; N is a set of non-terminals, each of a fixed type; S ∈ N is a distinguished start symbol of type o; R is a finite set of rewrite rules – one for each non-terminal F : (A1 , · · · , An , o) – of the form F ξ1 · · · ξn → e where each ξi is in Var Ai , and e is an applicative term 3 of type o constructed from elements of Σ ∪ N ∪ { ξ1 , · · · , ξn }. The order of a recursion scheme is the highest order of its non-terminals. We use recursion schemes as generators of Σ-labelled trees. The value tree of (or the tree generated by) a recursion scheme G is a possibly infinite applicative term, but viewed as a Σ-labelled tree, constructed from the terminals in Σ, that 3
Applicative terms are terms constructed from the generators using the application rule: if d : A → B and e : A then (de) : B. Standardly we identify finite Σ-labelled trees with applicative terms of type o generated from Σ-symbols endowed with 1storder types as given by their arities.
34
C.-H.L. Ong
is obtained by unfolding the rewrite rules of G ad infinitum, replacing formal by actual parameters each time, starting from the start symbol S. For n ≥ 0 we define RecTreen Σ to be the class of Σ-labelled value trees of (arbitrary) order-n recursion schemes. Plainly we have SafeRecTreen Σ ⊆ RecTreen Σ for every n ≥ 0. It follows from the definition of safety that SafeRecTreen Σ = RecTreen Σ for n = 0 and 1, but it is not known whether the inclusion is strict for n ≥ 2 (see Conjecture 1). Example 1. Let G be the order-2 (unsafe) recursion scheme with rewrite rules: S →Ha H z o → F (g z) F ϕ(o,o) → ϕ (ϕ (F h)) where the arities of the terminals g, h, a are 2, 1, 0 respectively. The value tree [[ G ]] is the Σ-labelled tree defined by the infinite term g a (g a (h (h (h · · ·)))): gQ mmmm QQQQ m gQ a mmm QQQ m a
h h .. .
The only infinite path in the tree is the node-sequence · 2 · 22 · 221 · 2211 · · · (with the corresponding trace g g h h h · · · ∈ Σ ω ).
2
Trees Generated by Recursion Schemes Have Decidable MSO Theories
We state our first main result as follows: Theorem 2. For every n ≥ 0 the modal mu-calculus model-checking problem for trees in RecTreen Σ is n-EXPTIME complete. Since MSO logic and the modal mu-calculus are equi-expressive over trees (see e.g. [9]), it follows that these trees have decidable MSO theories. Our proof of Theorem 2 relies on a certain Transference Principle from the value tree of a recursion scheme G to an auxiliary computation tree, which is itself a tree generated by a related order-0 recursion scheme G, called the long transform of G. By exploiting a structural analysis of the computation tree made possible by the innocent game semantics (in the sense of Hyland and Ong [12]) of the scheme G, we can infer certain properties of the value tree [[ G ]] (e.g. acceptance by a given tree automaton) by appropriate algorithmic analysis of the computation tree. A full account of the result can be found in the preprint [10]; see also the summary at LICS 2006 [11].
Some Results on a Game-Semantic Approach
35
Removing the safety assumption: a game-semantic approach Here we briefly explain our approach. First we note that it would be futile to analyse directly the value tree [[ G ]] since it has no useful structure for our purpose: by definition [[ G ]] is the extensional outcome of a potentially infinite process of rewriting. Rather it is the algorithmics of this computational process that one should seek to understand. Given an order-(n+1) safe recursion scheme G, the approach taken in [5] was to consider an associated tree that is obtained by contracting only (and all) the order-1 (i.e. lowest ordered) β-redexes in the rewrite rules of G. The tree thus generated, written G , coincides with the value tree of a related order-n recursion scheme Gα (i.e. G = [[ Gα ]]); further the MSO theory of the order-(n+ 1) tree [[ G ]] is reducible to that of the order-n tree [[ Gα ]] in the sense that there is a recursive mapping of MSO sentences ϕ → ϕ such that [[ G ]] ϕ iff [[ Gα ]] ϕ [5, Theorem 3.3]. The safety assumption is crucial to the reduction argument. Roughly speaking, the point is that β-redexes in a safe term can be contracted using capture-permitting substitution (i.e. without renaming bound variables). It follows that one can construct the tree G using only the original variables of the recursion schemes G. Without the safety assumption, the same construction would require an unbounded supply of names! Our approach to removing the safety assumption stems from an observation due to Klaus Aehlig [7]: by considering the long transform of a recursion scheme (which is obtained by expanding the RHS of each rewrite rule to its η-long form, inserting explicit application operators, and then currying the rule), the two constituent actions of the rewriting process, namely, unfolding and β-reduction, can be teased out and hence analysed separately. Given an order-n recursion scheme G: – We first construct the long transform G, which is an order-0 recursion scheme. – We then build an auxiliary computation tree λ(G) which is the outcome of performing all of the unfolding4 , but none of the β-reduction, in the G-rules. As no substitution is performed, no variable-renaming is needed. – We can now analyse the β-reductions locally (i.e. without the global operation of substitution) by considering traversals over the computation tree, based on innocent game semantics [12]. Note that we do not (need to) assume that the recursion scheme G is safe or typehomogeneous. Formally the computation tree λ(G) is defined to be the value tree of the long transform G; the tree λ(G) is regular, since G is an order-0 recursion scheme. Correspondence between paths in [[ G ]] and traversals over λ(G) We sketch an outline of the proof of Theorem 2. We are concerned with the decision problem: Given a modal mu-calculus formula ϕ and an order-n recursion scheme G, does [[ G ]] satisfy ϕ (at the root )? The problem is equivalent [14] 4
I.e. rewriting the LHS of a rule to the RHS with no parameter passing - since the G rules, being order-0, have no formal parameters.
36
C.-H.L. Ong
to deciding whether a given alternating parity tree automaton (APT) B has an accepting run-tree over the Σ-labelled tree [[ G ]]. Recall that an accepting runtree of B over [[ G ]] is a certain set of state-annotated paths in [[ G ]] that respect the transition relation of B, such that every infinite path in the set satisfies the parity condition. Instead of analysing paths in [[ G ]] directly, we use game semantics to establish a strong correspondence between paths in the value tree and traversals over the computation tree. Theorem 3 (Correspondence). Let G be a recursion scheme. There is a oneone correspondence, p → tp , between maximal paths p in the value tree [[ G ]] and maximal traversals tp over the computation tree λ(G). Further for every maximal path p in [[ G ]], we have tp Σ − = p Σ − , where s Σ − denotes the subsequence of s consisting of only Σ − -symbols with Σ − = Σ \ { ⊥ }. The proof of the Theorem is an application of the innocent game semantics of the recursion scheme G (see [13] for a proof of the statement in a more general setting). In the language of game semantics, paths in the value tree correspond exactly to plays in the strategy-denotation of the recursion scheme; a traversal is then (a representation of) the uncovering [12] of such a play. The path-traversal correspondence (Theorem 3) allows us to prove the following useful transference result: Corollary 1. A given property5 APT has an accepting run-tree over the value tree if and only if it has an accepting traversal-tree over the computation tree. Relative to a property APT B over Σ-labelled trees, an (accepting) traversal-tree of B over λ(G) plays the same rˆole as an (accepting) run-tree of B over [[ G ]]. A path in a traversal-tree is a traversal in which each node is annotated by a state of B. Simulating traversals over λ(G) by paths in λ(G) Our problem is thus reduced to finding an effective method of recognising certain sets of infinite traversals (over a given computation tree) that satisfy the parity condition. This requires a new idea as a traversal is a sequence of nodes that is most unlike a path; it can jump all over the tree and may even visit certain nodes infinitely often. Our solution again exploits the game-semantic connexion. It is a property of traversals that their P-views (in the sense of [12]) are paths (in the computation tree). This allows us to simulate a traversal over a computation tree by (the P-views of its prefixes, which are) annotated paths of a certain kind in the same tree. The simulation is made precise in the notion of traversalsimulating APT (associated with a given property APT and a recursion scheme G). We establish the correctness of the simulation by the following result: Theorem 4 (Simulation). A given property APT has an accepting traversaltree over the computation tree λ(G) if and only if the associated traversalsimulating APT has an accepting run-tree over the computation tree. 5
Property APT because the APT corresponds to the property described by a given modal mu-calculus formula.
Some Results on a Game-Semantic Approach
37
Note that decidability of the modal mu-calculus model-checking problem for trees in RecTreen Σ follows at once since computation trees are regular, and the APT acceptance problem for regular trees is decidable [1,14]. To prove n-EXPTIME decidability of the model-checking problem, we first establish a certain succinctness property for traversal-simulating APT C: If C has an accepting run-tree, then it has one with a reduced branching factor. The desired time bound is then obtained by analysing the complexity of solving an associated (finite) acceptance parity game, which is an appropriate product of the traversal-simulating APT and a finite deterministic graph that unravels to the computation tree in question. n-EXPTIME hardness of the model-checking problem follows from a result of Engelfriet [15] (see also [16]).
3
Collapsible Pushdown Automata and Recursion Schemes
In their ICALP 2005 paper [8], Knapik et al. showed that order-2 homogeneouslytyped recursion schemes are equi-expressive with a variant class of order-2 pushdown automata called panic automata. In view of their result, it is natural to ask if there is a corresponding automata-theoretic characterization of arbitrary recursion schemes for all finite orders. In recent joint work with A. S. Murawski [17], we have shown that for the purpose of generating Σ-labelled trees, recursion schemes are equi-expressive with collapsible pushdown automata. Precisely: Theorem 5 (Equi-expressivity). For each n ≥ 0, a Σ-labelled tree is generated by an order-n (deterministic) recursion scheme iff it is generated by an order-n (deterministic) collapsible pushdown automaton. An order-n collapsible pushdown automaton (CPDA) is just an order-n pushdown automaton in which every symbol a in the n-stack S may have a link to a necessarily lower-ordered stack situated below a in S, if there is such a stack at that point; if the stack pointed to is of order j, the link is called a (j +1)-link. For 2 ≤ j ≤ n, j-links are introduced by the order-1 push operation pusha1,j where a is a stack symbol: when pusha1,j is applied to an n-stack S, a link is first attached from a copy of a to the (j − 1)-stack that lies just below the top (j − 1)-stack of S; the symbol a, together with its link, is then pushed onto the top of the top 1-stack of S. Whenever the top (j − 1)-stack is duplicated by the order-j operation pushj , the link-structure of the top (j − 1)-stack is preserved. There is a new stack operation called collapse, whose effect is to cause the stack S to collapse up to the point indicated by the link emanating from the t op1 -element of S i.e. the top (j − 1)-stack of collapse(S) is the (j − 1)-stack pointed to by the link emanating from the t op1 -element of S. An outline proof of Theorem 5 Given an order-n recursion scheme G, we construct an order-n collapsible pushdown automaton CPDA(G) whose stack symbols are given by the (ranked) symbols that label the nodes of the computation tree λ(G). We then show that
38
C.-H.L. Ong
CPDA(G) can compute any given traversal over the computation tree λ(G), and hence, by the path-traversal correspondence (Theorem 3), it can compute any path in the value tree [[ G ]] as required. In the other direction, given an order-n CPDA A with state-set { 1, · · · , m }, we construct an order-n recursion scheme GA whose non-terminals are Fpa,e : (n − e)m → (n − 1)m → · · · → 0m → 0 where a ranges over the stack alphabet, 1 ≤ p ≤ m, 2 ≤ e ≤ n, 0 is the base type (of order 0), and the types (n + 1) = nm → n (of order n + 1) are defined by recursion. We use ground-type terms Fpa,e L Mn−1 · · · M0 : 0 to represent (reachable) configurations (p, S) of A, where S is the n-stack. The idea is that the t op1 -element of S – a with an e-link (say) – (more precisely the pair (p, t op1 S)) is coded as Fpa,e L : n; further for each 1 ≤ j ≤ n and 1 ≤ p ≤ m, we have – (p, t opj S) is coded as Fpa,e L Mn−1 · · · Mn−j+1 : n − j + 1 – (p, popj S) is coded as Mn−j,p Mn−j−1 · · · M0 : 0 – (p, collapse S) is coded as Lp Mn−e−1 · · · M0 : 0. Restricted to order-2, CPDA coincide with second-order pushdown automata with links (in the sense of Aehlig et al. [18]), which are essentially the same as panic automata (in the sense of Knapik et al. [8]). Our CPDA-to-scheme transformation specialises to exactly the same transformation in [8], when restricted to order-2 CPDA. Our result in this section will be presented elsewhere; a full account can be found in the preprint [17].
4
Parity Games over Configuration Graphs of CPDA
The same game-semantic approach can be carried over to certain classes of finitely-presented graphs such as those given by (non-deterministic) collapsible pushdown automata. Fix an order-n CPDA A and a parity game over its configuration graph CG A , and let GA be the recursion scheme determined by A (as given by the CPDA-to-scheme transformation in Theorem 5). Paths in the configuration graph correspond exactly to traversals over the computation tree λ(GA ) (or equivalently, traversals over the finite directed graph Gr(GA ) that unravels to λ(GA )). For any parity game over CG A , accepting traversal-trees over Gr(GA ) can be recognised by a traversal-simulating APT C (i.e. a version of Theorem 4); it follows that there is an equivalent finite acceptance parity game, which is an appropriate product of Gr(GA ) and C. Hence parity games over the configuration graphs of order-n CPDA are solvable. We intend to extend the approach to the solution of games with ω-regular and non-regular winning conditions. Another interesting problem is the computation of winning regions of these games.
Some Results on a Game-Semantic Approach
5
39
Further Directions
Does safety constrain expressiveness? This is the most pressing open problem. In a FOSSACS 2005 paper [18], we have shown that there is no inherently unsafe word language at order 2. More precisely, for every word language that is generated by an order-2 unsafe recursion scheme, there is a safe (but in general non-deterministic) recursion scheme that generates the same language. However it is conjectured that the result does not hold at order 3. Further, for trees, we conjecture that there are already inherently unsafe trees at order 2 i.e. Conjecture 1. SafeRecTree2 Σ ⊂ RecTree2 Σ i.e. there is an unsafe order-2 deterministic recursion scheme whose value tree is not the value tree of any safe deterministic recursion scheme. The Conjecture is closely related to a word language, which we call Urzyczyn’s language [18]. The language can be generated by a deterministic, unsafe order2 recursion scheme (and hence, by a non-deterministic, safe order-2 recursion scheme). The Conjecture is equivalent to the statement: Urzyczyn’s language cannot be generated by any deterministic, safe order-2 recursion scheme (or equivalently any order-2 deterministic pushdown automaton). Semantic vs verification games We would like to develop further the pleasing mix of Semantics (games) and Verification (games) in the work. A specific project, pace [19], is to give a denotational semantics of the lambda calculus “relative to an APT”. More generally, construct a cartesian closed category, parameterized by APTs, whose maps are witnessed by the variable profiles (see [10]).
References 1. Rabin, M.O.: Decidability of second-order theories and automata on infinite trees. Trans. Amer. Maths. Soc 141 (1969) 1–35 2. Muller, D.E., Schupp, P.E.: The theory of ends, pushdown automata, and secondorder logic. Theoretical Computer Science 37 (1985) 51–75 3. Caucal, D.: On infinite transition graphs having a decidable monadic theory. In: Proceedings 23rd ICALP, Springer (1996) 194–205 LNCS Vol. 1099. 4. Stirling, C.: Decidability of bisimulation equivalence for pushdown processes. Submitted for publication (2000) 5. Knapik, T., Niwi´ nski, D., Urzyczyn, P.: Higher-order pushdown trees are easy. In: FOSSACS’02, Springer (2002) 205–222 LNCS Vol. 2303. 6. Caucal, D.: On infinite terms having a decidable monadic theory. In: Proc. MFCS’02. Volume 2420 of Lecture Notes in Computer Science. (2002) 165– 176 7. Aehlig, K., de Miranda, J.G., Ong, C.H.L.: The monadic second order theory of trees given by arbitrary level two recursion schemes is decidable. In: Proceedings of the 7th International Conference on Typed Lambda Calculi and Applications (TLCA’05). (2005) 39–54 LNCS 3461.
40
C.-H.L. Ong
8. Knapik, T., Niwi´ nski, D., Urzyczyn, P., Walukiewicz, I.: Unsafe grammars and panic automata. In: ICALP’05. Volume 3580 of Lecture Notes in Computer Science., Springer-Verlag (2005) 1450–1461 9. Janin, D., Walukiewicz, I.: On the expressive completeness of the propositional mu-calculus with respect to msol. In: Proceedings of CONCUR’96. (1996) 263–277 LNCS 1119. 10. Ong, C.H.L.: On model-checking trees generated by higher-order recursion schemes. Preprint 42 pages (2006) 11. Ong, C.H.L.: On model-checking trees generated by higher-order recursion schemes. In: Proceedings of IEEE Symposium on Logic in Computer Science, Computer Society Press (2006) 12. Hyland, J.M.E., Ong, C.H.L.: On Full Abstraction for PCF: I. Models, observables and the full abstraction problem, II. Dialogue games and innocent strategies, III. A fully abstract and universal game model. Information and Computation 163 (2000) 285–408 13. Ong, C.H.L.: Local computation of beta-reduction by game semantics. Preprint (2006) 14. Emerson, E.A., Jutla, C.S.: Tree automata, mu-calculus and determinacy. In: Proceedings of FOCS’91. (1991) 368–377 15. Engelfriet, J.: Interated stack automata and complexity classes. Information and Computation (1991) 21–75 16. Cachat, T.: Higher order pushdown automata, the Caucal hierarchy of graphs and parity games. In: Proceedings of ICALP 2003. (2003) 556–569 LNCS 2719. 17. Murawski, A.S., Ong, C.H.L.: Collapsible pushdown automata and recursion schemes. Preprint (2006) 18. Aehlig, K., de Miranda, J.G., Ong, C.H.L.: Safety is not a restriction at level 2 for string languages. In: Proceedings of the 8th International Conference on Foundations of Software Science and Computational Structures (FOSSACS’05). (2005) 490–501 LNCS 3411. 19. Aehlig, K.: A finite semantics for simply-typed lambda terms for infinite runs of automata. In: Proceedings of CSL 2006. (2006) LNCS. To appear.
Automata and Logics for Words and Trees over an Infinite Alphabet Luc Segoufin INRIA and Universit´e Paris 11 http://www-rocq.inria.fr/∼ segoufin
Abstract. In a data word or a data tree each position carries a label from a finite alphabet and a data value from some infinite domain. These models have been considered in the realm of semistructured data, timed automata and extended temporal logics. This paper survey several know results on automata and logics manipulating data words and data trees, the focus being on their relative expressive power and decidability.
1
Introduction
In many areas there is a need for good abstract models manipulating explicitly data values. We mention two of them here. In program verification one has to decide statically whether a program satisfies some given specification. Programs may contain several procedures calling each other recursively. Procedures may have parameters and data could be exchanged via the parameters. In program verification, variables over unbounded domains such as integers, arrays, parameters etc. are usually abstracted to finite range domains and configuration graphs of pushdown automata have been used quite successfully in order to model recursive dependencies between procedures. It is then possible to check properties expressed by temporal logics such as LTL or CTL. The modelization using a finite domain has some obvious limitations but it is hard to avoid while remaining decidable. One notable exception is [8] where procedures can have one parameter whose value can range over the integers and the procedures can perform limited arithmetic on that parameter. In the database context also, most theoretical work on XML and its query languages models XML documents by labeled ordered unranked trees, where the labels are from a finite set. Attribute values are usually ignored. This has basically two reasons, which are not independent. First, the modeling allows to apply automata based techniques, as automata operate on trees of this kind. Second, extending the model by attribute values (data values) quickly leads to languages with undecidable static analysis (see, for instance [1,4,18,27]). Nevertheless, there are examples of decidable static reasoning tasks involving attribute values. One of them is validation of schema design. A schema contains a structural part and integrity constraints such as keys and inclusion constraints. In ´ Z. Esik (Ed.): CSL 2006, LNCS 4207, pp. 41–57, 2006. c Springer-Verlag Berlin Heidelberg 2006
42
L. Segoufin
a semistructured model such as XML the structural part is mainly a mechanism for assigning types to nodes of the document tree. It is then natural to ask whether a specification is consistent and whether a set of integrity constraints is minimal or not (implication problem). Decidable cases were proposed for XML schemas in [2]. Another one is query optimization and checking whether one query is included into or equivalent to another one. Each of these inclusion tests could be relativized by the presence of a schema. In the context of XML and one of its most popular language XPath several decidable fragments were proposed in [27,4,18,6]. Each of the papers cited above propose a decidable framework where data values are explicitly manipulated. In each of them the decidability was obtained using a non-trivial ad-hoc argument. It is natural to wonder whether there exists a general decidable suitable theoretical framework which could be used to infer all this kind of results. This framework is yet to be discovered and this paper is a modest attempt to gather known results in this direction. We tried to group here interesting models of automata and logical frameworks which could be used in order to code some of the problems mentioned above. To make this survey finite size we have restricted our attention to an approach that, in our opinion, deserves more attention from the theoretical community. All over this survey we model data values using an infinite domain (like the integers). Moreover our structures have a very simple shape as they are either finite strings or finite trees. More precisely we are given two alphabets over strings and trees, one which is finite and can be used to code names and constants appearing in the programs, in the schemas, or in the queries, and another one which is infinite and which can be used to code data values. We call such structures data words or data trees. We present several models of automata and several logics which are evaluated on data words and data trees. We focus on their relative expressive power and on decidability. When dealing with an infinite domain, like the integers for instance, the allowed arithmetic is a central issue in order to obtain decidability. We avoid this problem here by allowing only the simplest arithmetical operation which is equality test: The only operation that can be performed in our infinite domain is checking whether to values are equal. We will see that this is already enough to make the story interesting. We have modified slightly several known concepts so that we could present each of them within a uniform framework in order to compare them. We hope that the reader familiar with one of them will not be too much disturbed by this. This survey contains no proof at all. Those can be found in the references provided all over the paper. We wish we had time to include more references, especially in the verification context.
Automata and Logics for Words and Trees over an Infinite Alphabet
2
43
Some Notations
In this paper we consider two kinds of model: data words and data trees. Let Σ be a finite alphabet of labels and D an infinite set of data values. A data word w = w1 · · · wn is a finite sequence over Σ × D, i.e., each wi is of the form (ai , di ) with ai ∈ Σ and di ∈ D. A data word language is a set of data words. A data tree t is a finite unranked, ordered tree where each node is of the form (ai , di ) with ai ∈ Σ and di ∈ D. As above a data tree language is a set of data trees. Given a node x of a data tree or a position x of a data word, we denote respectively by x.d and x.l the data value of D and the label of Σ associated to x. The idea is that the alphabet Σ is accessed directly, while data values can only be tested for equality. This amounts to considering words and trees over the finite alphabet Σ endowed with an equivalence relation on the set of positions. With this in mind, given a data word or a data tree w, we will call class of w a set of positions/nodes of w having the same data value. Finally, given a data word w (or a data tree t), the string projection of w (the tree projection of t), denoted by str(w) (tree(t)), is the word (tree) constructed from w (t) by keeping only the label in Σ and projecting out all the data values. For each integer n ∈ N we note [n] the set of all integers from 1 to n. Given a data word w we denote its length by |w|.
3
Automata
In this section we present several models of automata over data words and data trees. We present them in details in the word case and only briefly discuss the extension to trees. 3.1
Register Automata
Register automata are finite state machines equiped with a finite number of registers. These registers can be used to store temporarily values from D. When processing a string, an automaton compares the data value of the current position with values in the registers; based on this comparison, the current state and the label of the position it can decide on its action. We stress that the only allowed operation on registers (apart from assignment) is a comparison with the symbol currently being processed. The possible actions are storing the current data value in some register and specifying the new state. This model has been introduced in [20] and was later studied more extensively in [28]. We give here an equivalent formalism that fits with data words. Definition 3.1. A k-register automaton A is a tuple (Q, q0 , F, τ0 , T ) where – Q is a finite set of states; q0 ∈ Q is the initial state; F ⊆ Q is the set of final states;
44
L. Segoufin
– τ0 : {1, . . . , k} → D is the initial register assignment; and, – T is a finite set of transitions of the forms (q, a, E) → q or (q, a, E) → (q , i). Here, i ∈ {1, . . . , k}, q, q ∈ Q, a ∈ Σ and E ⊆ {1, . . . , k}. Given a data word w, a configuration of A on w is a tuple [j, q, τ ] where 0 ≤ j ≤ |w| is the current position in the word, q ∈ Q is the current state, and τ : {1, . . . , k} → D is the current register assignment. The initial configuration is γ0 := [1, q0 , τ0 ]. A configuration [j, q, τ ] with q ∈ F is accepting. Given γ = [j, q, τ ], the transition (p, a, E) → β applies to γ iff p = q, wj .l = a and E = {l | wj .d = τ (l)} is the set of registers having the same data value as the current position. A configuration γ = [j , q , τ ] is a successor of a configuration γ = [j, q, τ ] iff there is a transition (q, a, E) → q that applies to γ, τ = τ , and j = j + 1; or there is a transition (q, a, E) → (q , i) that applies to γ, j = j + 1, and τ is obtained from τ by setting τ (i) to wj .d. Based on this, reachable configuration and acceptance of a data word is defined in the standard way. We denote by L(A) the language of data words accepted by the register automata A. Example 3.2. There exists a 1-register automata which checks whether the input data words contains two positions labeled with a with the same data value (a is not a key): it non-deterministically moves to the first position labeled with a with a duplicated data value, stores the data value in its register and then checks that this value appears again under another position labeled with a. The complement of this language, all node labeled with a have different data values, which would be useful for key integrity constraints in the database context is not expressible with register automata. To prove this, one can show that for each data word accepted by a given register automata, there exists another accepted data word that have the same string projection but uses a number of data values depending only on the automaton (see [20] for more details). This shows that register automata are not closed under complementation. They are also not closed under determinization as the first example cannot be achieved with a deterministic register automata. The main result for register automata is that emptiness is decidable. Theorem 3.3. [20] Emptiness of register automata is decidable. In term of complexity the problem is PSpace-complete [14]. Without labels it was shown to be NP-complete in [30]. As illustrated with the examples above, register automata are quite limited in expressive power. This limitation can also be formalized with the following proposition which should be contrasted with the similar one in the case of data automata presented later (Proposition 3.14). Proposition 3.4. [20,9] Given a language L of data words accepted by a register automata the language of strings str(L) is regular. There exist many obvious extensions of register automata. For instance one could add alternation or 2-wayness. Unfortunately those extensions are undecidable.
Automata and Logics for Words and Trees over an Infinite Alphabet
45
Theorem 3.5. 1. Universality of register automata is undecidable [28]. 2. Emptiness of 1-register 2-way automata is undecidable [12]. An immediate corollary of Theorem 3.5 is: Corollary 3.6. [28] Inclusion and equivalence of register automata is undecidable. There are several variants that weaken or strengthen the model of register automata as presented above without affecting much the results. We only briefly mention two of them. One possible extension is to allow the automata to store a non-deterministically chosen value from D in one of the register. With this extension the language of data words such that the data value of the last position of the word is different from all the other positions can be accepted. Without it the language is not accepted by a register automata. This model was studied in [11,22] and is a little bit more robust than the one presented here. In the model presented above the automata knows the equality type of the current data value with all the registers. One possible weakening of the model is to allow only an equality test of the current data value with a fix register. That is the transitions are of the form (q, a, i) −→ q or (q, a, i) −→ (q , j). This setting was studied in [32]. The language of data words such that the first two data values are distinct can no longer be accepted [21]. On the other hand this model has equivalent regular expressions [21]. Another notable property of this weaker model is that inclusion becomes decidable [32]. To conclude this discussion one should mention that the model of the register automata as presented above have algebraic characterizations, see [9,17] for more details. Trees. To extend this model to binary trees the technical difficulty is to specify how registers are splited (for the top-down variants) or merged (for the bottomup variant). In the top-down case the natural solution is to propagate the content of the registers to the children of the current node. In the bottom-up case a function can be included into the specification of the transitions of the automata which specify, for each register, whether the new value should come from some register of the left child or from some register of the right one. It is possible to do this so that the family obtained is decidable and robust in the sense that the bottom-up variant correspond to the top-down variant. This model has all the properties of register automata over data words: emptiness is decidable and the tree projection is regular. We refer to [21] for more details. 3.2
Pebble Automata
Another model of automata uses pebbles instead of registers. The automata can drop and lift pebbles on any position in the string and eventually compare the current value with the ones marked by the pebbles. To ensure a “regular” behavior, the use of pebbles is restricted by a stack discipline. That is, pebbles are numbered from 1 to k and pebble i + 1 can only be placed when pebble i is present on the string. A transition depends on the current state, the current
46
L. Segoufin
label, the pebbles placed on the current position of the head, and the equality type of the current data value with the data values under the placed pebbles. The transition relation specifies change of state, and possibly whether the last pebble is removed or a new pebble is placed. In the following more formal definition we follow [28] and assume that the head of the automata is always the last pebble. This does not make much difference in term of expressive power, at least in the 2-way case which is the most natural for this model, but simplifies a lot the notations: Definition 3.7. A k-pebble automaton A is a tuple (Q, q0 , F, T ) where – Q is a finite set of states; q0 ∈ Q is the initial state; F ⊆ Q is the set of final states; and, – T is a finite set of transitions of the form α → β, where • α is of the form (q, a, i, P, V, q), where i ∈ {1, . . . , k}, a ∈ Σ, P, V ⊆ {1, . . . , i − 1}, and • β is of the form (q, d) with q ∈ Q and d is either drop of lift. Given a data word w, a configuration of A on w is of the form γ = [q, j, θ] where i is the current position in w, q ∈ Q the current state, j ∈ {1, . . . , k} the number of pebbles already dropped, and θ : {1, . . . , j} → [|w|] the positions of the pebbles. Note that the current position always correspond to θ(j). We call θ a pebble assignment. The initial configuration is γ0 := [q0 , 1, θ0 ], with θ0 (1) = 1. A configuration [q, j, θ] with q ∈ F is accepting. A transition (p, a, i, P, V, p) → β applies to a configuration γ = [q, j, θ], if 1. i = j, p = q, 2. V = {l < j | wθ(l) .d = wθ(j) .d} is the set of pebbles placed on a position which has the same data value than the current position. 3. P = {l < j | θ(l) = θ(j)} is the set of pebbles placed at the current position, and 4. wj = a. Intuitively, (p, a, i, P, V ) → β applies to a configuration if pebble i is the current head, p is the current state, V is the set of pebbles that see the same data value as the top pebble, P is the set of pebbles that sit at the same position as the top pebble, and the current label seen by the top pebble is a. A configuration [q , j , θ ] is a successor of a configuration γ = [q, j, θ] if there is a transition α → (p, d) that applies to γ such that q = p and θ (i) = θ(i), for all i < j, and – if d=drop, then j = j + 1, θ (j) = θ(j) = θ (j + 1), – if d=lift, then j = i − 1. Note that this implies that when a pebble is lifted, the computation resumes at the position of the previous pebble. Example 3.8. The languages of data words such that all nodes labeled with a have different data values is accepted by a 2-pebble automata as follows. At each
Automata and Logics for Words and Trees over an Infinite Alphabet
47
position labeled with a the automata drops pebble 1 and then check that the data value never occurs under a position labeled with a to the right of the pebble. When this is done it comes back to pebble 1 and move to the next position. Register automata and pebble automata are likely to be incomparable in expressive power. The example above can be expressed by a pebble automata but not by a register automata. On the other hand, pebble automata have a stack discipline constraint on the use of pebbles while register automata can update their register in an arbitrary order. Based on this, examples of languages expressible with register automata but not with pebble automata are easy to construct but we are not aware of any formal proof of this fact. Strictly speaking the model presented above is not really 1-way as when it lifts a pebble the automata proceed at the position of previous pebble. It is also immediate to extends this model in order to make it 2-way. The advantage of this definition is that the model is robust: Theorem 3.9. [28] Pebble automata are determinizable and the 2-way variant has the same expressive power than its 1-way variant. But unfortunately the model is too strong in expressive power. In the result below, recall that with our definition the head of the automata counts as 1 pebble. Therefore in a sense the result is optimal. Theorem 3.10. [28,12] Emptiness of 2-pebble automata over data words is undecidable. Trees. The most natural way to extend this model to trees is to consider tree walking automata with pebbles on trees. This model extend the 2-way variant of pebble automata as presented here in a natural way with moves allowing to “walk” the tree in all possible directions (up, down, left right). Of course, this model remains undecidable. 3.3
Data Automata
This model was introduced in [6,7]. It extends the model of register automata, remains decidable and has better connections with logic. Data automata runs on data words in two passes. During the first one a letter-to-letter transducers is run. This transducers does not have access to the data values and change the label of each position. During the second pass, an automata is run on each sequence of letters having the same data value, in other words, on each class. A data automaton D = (A, B) consists of – a non-deterministic letter-to-letter string transducer A (the base automaton) with input alphabet Σ, for some output alphabet Γ (letter-to-letter means that each transition reads and writes exactly one symbol), and – a non-deterministic string automaton B (the class automaton) with input alphabet Γ .
48
L. Segoufin
A data word w = w1 · · · wn is accepted by D if there is an accepting run of A on the string projection of w, yielding an output string b1 · · · bn , such that, for each class {x1 , . . . , xk } ⊆ {1, . . . , n}, x1 < · · · < xk , the class automaton accepts bx1 , . . . , bxk . Example 3.11. The language of data words such that all positions labeled with a have different data values can be accepted by a data automaton as follows. The base automaton does nothing and only copy its input. The class automata accepts only words containing only one a. The complement of the above language, the set of all data words containing two positions labeled with a with the same data value, is done as follows. The base automata non-deterministically selects two positions labeled with a and output 1 on each of them and 0 everywhere else. The class automata checks that each class contains either no 1 or exactly 2. The language of data words such that there exists two positions labeled with a and having the same data value but with no positions labeled with b (no matter what the data value is) in between is accepted by a data automaton. The base automata outputs 0 on all positions excepts two, labeled with a, that it selects non-deterministically and on which it outputs 1. It also checks that between the two selected positions no b occurs. The class automata checks that each class contains either no 1 or exactly 2. It is not clear how to do the complement of this language using a data automata. This suggest that data automata are not closed under complementation but we are not aware of any formal proof of this result. It will follow from the results of Section 4 that if they would be closed under complementation then they would not be effectively closed under complementation, by this we mean that there would be no algorithm computing the complement of a data automata. By just looking at the definitions it is not immediate that data automata extends the model of register automata presented in Section 3.1. But it is indeed the case. Proposition 3.12. [5] For each register automata there exists a data automaton accepting the same language. The main result on data automata is that emptiness remains decidable. We will use this fact to show decidability of several logics in Section 4. Theorem 3.13. [7] Emptiness of data automata is decidable. In order to better understand the expressive power of data automata we show that the string projection of languages accepted by data automata correspond to languages accepted to multicounter automata. Recall that for register automata the string projection remains regular (Proposition 3.4). We first briefly review the definition of multicounter automata. An -free multicounter automaton is a finite automaton extended by a finite set C = {1, . . . , n} of counters. It can be described as a tuple (Q, Σ, C, δ, qI , F ). The set of states Q, finite alphabet Σ, initial state qI ∈ Q and final states F ⊆ Q are
Automata and Logics for Words and Trees over an Infinite Alphabet
49
as in a usual finite automaton. The transition relation δ is a finite subset of Q × Σ × (dec∗ (i) inc∗ (i))i∈C × Q. The idea is that in each step, the automaton can change its state and modify the counters, by incrementing or decrementing them, according to the current state and the current letter on the input. In a step, the automaton can apply to each counter i ∈ C a sequence of decrements, followed by a sequence of increments. Whenever it tries to decrement a counter of value zero the computation stops. Besides this, the transition of a multicounter automaton does not depend on the value of the counters. In particular, it cannot test whether a counter is exactly zero (otherwise the model would be undecidable). Nevertheless, by decrementing a counter k times and incrementing it again afterward it can test whether the value of that counter is at least k. A configuration of such an automaton is a tuple c = (q, (ci )i∈C ) ∈ Q × Nn , where q is the current state and ci is the value of the counter i. A transition (q, a, (decki (i)incli (i))i∈C , q ) ∈ δ can be applied if the current state is q, the current letter is a and for every counter i ∈ C, the value ci is at least ki . The successor configuration is d = (q , (c(i) − ki + li )i∈C ). A run over a word w is a sequence of configurations that is consistent with the transition function δ. The acceptance condition is given by a subset R of the counters C and the final states. A run is accepting if it starts in the state qI with all counters empty and ends in a configuration where all counters in R are empty and the state is final. Emptiness of multicounter automata is known to be decidable [26,23]. Proposition 3.14. [7] • If L is a language of data words accepted by a data automata then str(L) a language of strings accepted by a multicounter automata. • If L is a language of strings accepted by a multicounter automata then there exists a language L of data words accepted by a data automata such that h(str(L )) = L, where h is an erasing morphism. The constructions of Proposition 3.14 are constructive (the time complexity requires a tower of 3 exponentials in the first case and is only polynomial in the second case) and thus Proposition 3.14 implies Theorem 3.13. Therefore the emptiness problem of data automata is elementary equivalent to the emptiness problem of multicounter automata which is not yet known to be elementary (the best known lower-bound being ExpSpace [24] and the best known upperbound being non-elementary [26,23]). The precise complexity of Theorem 3.13 is therefore still an open issue. Trees. This model can be extended to unranked ordered trees as follows. Both the base automaton and the class automaton are bottom-up tree automaton. The base automata works as in the word case and reassigns a label to each node. Each class can now be viewed as an unranked ordered tree by contracting the initial
50
L. Segoufin
tree edges which contains a node not in the class. The class automata is then run on the resulting trees. Unfortunately decidability of data tree automata remains an open issue. Data tree automata still have some connection with multicounter tree automata. It is not clear yet whether the first part of Proposition 3.14 holds or not, but the second one does hold. Therefore showing decidability of data automata would implies showing decidability of multicounter tree automata which has eluded all efforts so far (see [13] and the references therein). 3.4
Other Generalizations
We have consider so far only automata for data words or data trees that are based on the classical notion of finite state automata. It is also possible to consider more powerful devices for manipulating data words such as pushdown automata. Historically the first models of pushdown automata over infinite alphabet were presented in [3] and [19]. Those models extend the notions of Context-Free grammars and of pushdown automata in the obvious way by allowing infinitely many rules and infinitely many transition functions, one for each letter in D. Hence the models are not even finitely presented and decidability does not make much sense. In term of expressive power, with some technical constraints on the pushdown automata models (see [19]), both the context-free grammars and pushdown automata defines the same class of languages. The most robust decidable notion so far was given in [11] using ideas similar to register automata. We describe it next. Intuitively the automata has k registers and makes its choices given, the current state, the label of the current node, and the equality type of the current data value with the values present in the registers. The possible actions are: change the current state, update some of the registers with the current data value, push the values stored into some registers into the stack together with some finite content, pop the top of the stack. Moreover, in order to have a robust model with an equivalent context-free grammar, the model allows transition which can store into one of the registers a new, nondeterministically chosen, data value. Definition 3.15. A k-register pushdown automaton A is a tuple (Q, q0 , F, Γ, τ0 , T ) where – Q is a finite set of states; q0 ∈ Q is the initial state; F ⊆ Q is the set of final states; – Γ is a finite set of labels for stack symbols; – τ0 : {1, . . . , k} → D is the initial register assignment; and, – T is a finite set of transitions of the form (q, a, E, γ) → (q , i, s) or (q, , E, γ) → (q , i). Here, i ∈ {1, . . . , k}, q, q ∈ Q, a ∈ Σ, γ ∈ Γ , s ∈ (Γ × {1, . . . , k})∗ and E ⊆ {, 1, . . . , k}. Given a stack symbol s we denote by s.l and s.d respectively the label in Γ and the data value in D of s. Given a data word w, a configuration of A on w is a tuple [j, q, τ, μ] where 1 ≤ j ≤ |w| is the current position in the data words,
Automata and Logics for Words and Trees over an Infinite Alphabet
51
q ∈ Q is the current state, τ : {1, . . . , k} → D is the current register assignment, and μ ∈ (γ × D)∗ is the current stack content. The initial configuration is ν0 := [1, q0 , τ0 , ]. A configuration [j, q, τ, μ] with q ∈ F is accepting. Given ν = [j, q, τ, μ] with top stack symbol s, the transition (p, a, E, γ) → β applies to ν iff p = q, wj .l = a, s.l = γ, and E = {l | wj .d = τ (l)} ∪ S with S is empty if wj .d = s.d and is {} otherwise. A configuration ν = [j , q , τ , μ ] is a successor of a configuration ν = [j, q, τ, μ] iff there is a transition (q, a, E, γ) → (q , i, s) that applies to ν, τ (l) = τ (l) for all l = i, τ (i) = wj .d, j = j + 1 and μ is μ with the top of the stack removed and replaced by (a1 , di1 ) · · · (am , dim ) where s = (a1 , i1 ) · · · (am , im ) and dl is the current value of register l; or there is a transition (q, a, E, γ) → (q , i) that applies to ν, j = j, μ = μ , and τ is obtained from τ by setting τ (i) to some arbitrary value of D. Based on this, reachable configuration and acceptance of a data word is defined in the standard way. Note that we allow transitions which can introduce non-deterministically a new symbol in some register. This make the model more robust. Example 3.16. The language of data words such that the data values form a sequence wwR where wR is the reverse sequence of w is accepted by a register data automata in the obvious way by first pushing the data values into the stack and then poping them one by one. The language of data words such that all positions labeled with a have different data values is not accepted by a register pushdown automata. This uses argument similar than for register automata. See [11] for more details and more example. This model of register pushdown automata extends in a natural way the classical notion of pushdown automata. It can be shown that the good properties of Context-Free languages can be extended to this model. In particular we have: Theorem 3.17. [11] Emptiness of register pushdown automata is decidable. This model is also robust and has an equivalent presentation in term of ContextFree grammar that we don’t present here. The interested reader will find in [11] more details and more properties of the model. We conclude with a characterization of the projection languages defined by register pushdown automata similar to Proposition 3.4. Proposition 3.18. If L is a language accepted by a register pushdown automata then str(L) is Context-Free.
4
Logics
The previous section was concerned with finding decidable automata for manipulating words and trees containing data values. In this section we are looking for declarative decidable tools such as logics. Data words and data trees can be seen as models for a logical formula.
52
L. Segoufin
In the case of data words, the universe of the model is the set of positions in the word and we have the following built-in predicates: x ∼ y, x < y, x = y + 1, and a predicate a(x) for every a ∈ Σ. The interpretation of a(x) is that the label in position x is a. The order < and successor +1 are interpreted in the usual way. Two positions satisfy x ∼ y if they have the same data value. Given a formula φ over this signature, we write L(φ) for the set of data words that satisfy the formula φ. A formula satisfied by some data word is satisfiable. In the case of data trees, the universe of the structure is the set of nodes of the tree with the following predicates available: – For each possible label a ∈ Σ, there is a unary predicate a(x), which is true for all nodes that have the label a. – The binary predicate x ∼ y holds for two nodes if they have the same data value. – The binary predicate E→ (x, y) holds for two nodes if x and y have the same parent node and y is the immediate successor of x in the order of children of that node. – The binary predicate E↓ (x, y) holds if y is a child of x. – The binary predicates E⇒ and E⇓ are the transitive closures of E→ and E↓ , respectively. For both words and trees, we write FO(∼,