A Relation-Algebraic Approach to Graph Structure Transformation
Total Page:16
File Type:pdf, Size:1020Kb
A Relation-Algebraic Approach to Graph Structure Transformation WOLFRAM KAHL u0 PhiL PhiR ChiL Xi Chi PsiL Psi Bericht Nr. 2002-03 June 2002 Universität der Bundeswehr München Fakultät für . INFORMATIK Werner-Heisenberg-Weg 39 • 85577 Neubiberg • Germany A Relation-Algebraic Approach to Graph Structure Transformation Wolfram Kahl1 Abstract Graph transformation is a rapidly expanding ¯eld of research, motivated by a wide range of applications. Such transformations can be speci¯ed at di®erent levels of abstraction. On one end, there are \programmed" graph transformation systems with very ¯ne control over manip- ulation of individual graph items. Di®erent flavours of rule-based graph transformation systems match their patterns in more generic ways and therefore interact with the graph structure at slightly higher levels. A rather dominant approach to graph transformation uses the abstractions of cate- gory theory to de¯ne matching and replacement almost on a black-box level, using easily understandable basic category-theoretic concepts, like pushouts and pullbacks. However, some details cannot be covered on this level, and most authors refrain from resorting to the much more advanced category-theoretic tools of topos theory that are available for graphs, too | topos theory is not felt to be an appropriate language for specifying graph transformation. In this thesis we show that the language of relations can be used very naturally to cover all the problems of the categoric approach to graph transformation. Although much of this follows from the well-known fact that every graph-structure category is a topos, very little of this power has been exploited before, and even surveys of the categoric approach to graph transformation state essential conditions outside the category-theoretic framework. One achievement is therefore the capability to provide descriptions of all graph trans- formation e®ects on a suitable level of abstraction from the concrete choice of graph structures. Another important result is the de¯nition of a graph rewriting approach where rela- tional matchings can match rule parameters to arbitrary subgraphs, which then can be copied or deleted by rewriting. At the same time, the rules are still as intuitive as in the double-pushout approach, and there is no need to use complicated encodings as in the pullback approaches. In short: A natural way to achieve a double-pushout-like rewriting concept that incorpo- rates some kind of \graph variable" matching and replication is to amalgamate pushouts and pullbacks, and the relation-algebraic approach o®ers appropriate abstractions that allow to formalise this in a fully component-free yet intuitively accessible manner. 1 Current e-mail address: [email protected]. This habilitation thesis was completed during the author's appointment at the Institute for Software Technology of UniversitÄat der Bundeswehr MuncÄ hen. Acknowledgements Although my interest in graphs and structures may have been \hard-wired" in my brain, it was Gunther Schmidt who led me on the one hand to applications of graph transformation in software development, and on the other hand to relation-algebraic formalisations in general, and to their applications to graphs in particular. Besides guiding me with his deep understanding of the calculus of relations as a valuable tool for formalisation and reasoning, he also alerted me to the importance of being aware of the axiomatic basis underlying one's work, and refraining from assuming more than necessary for the task at hand. Another important influence has been Yasuo Kawahara, who introduced me to Dede- kind categories and to working in weaker axiomatisations of relation categories, and whose pioneering work on \pushout-complements in toposes" provided an important stepping stone for the current thesis. I wish to thank many friends and colleagues for discussions on more or less directly related topics that considerably helped to shape my ideas, let me only mention Andrea Corradini, Jules Desharnais, Hitoshi Furusawa, Fabio Gadducci, H¶el`ene Jacquet, Bernhard MÄoller, John Pfaltz, and Michael Winter. Finally, I am in¯nitely grateful to my wife Liping and daughter Cynthia for their patience, understanding and support during the genesis of this thesis. Contents 1 Introduction 1 1.1 Graph Grammars and Graph Transformation . 1 1.2 The Categoric Approaches to Graph Transformation . 3 1.2.1 Pushouts . 4 1.2.2 More About Pushouts in Graphs . 7 1.2.3 The Double-Pushout Approach . 7 1.2.4 The Gluing Condition . 9 1.2.5 Restricting Derivations . 12 1.2.6 The Single-Pushout Approach . 13 1.2.7 Shortcomings of the Pushout Approaches . 15 1.2.8 The Pullback Approach . 15 1.3 Graph Transformation with Relational Matching . 21 1.4 Relation Algebras and Generalisations . 24 1.5 Contrasting the Relational and the Categoric Approaches . 26 1.6 Overview . 27 1.7 Eddi . 29 2 Graph Structures and Their Parts 30 2.1 Preliminaries: Sets, Lattices . 31 2.2 Signatures . 34 2.3 Algebras and Subalgebras . 36 2.4 Subalgebras in Graph Structures . 41 2.5 Partial Algebras and Weak Partial Subalgebras . 44 2.6 Pseudo-Complements . 46 2.7 Semi-Complements . 50 2.8 Naijve Graph Rewriting . 56 2.9 Discreteness in Graph Structures . 57 2.10 Coregular Parts and Base Elements . 63 3 Allegories of §-Algebras 66 3.1 Preliminaries: Categories and Allegories . 66 3.2 Abstract §-Algebras and Relational Homomorphisms . 73 3.3 Constructions in §-AlgD . 77 4 Dedekind Categories of Graph Structures 84 4.1 Preliminaries: Distributive Allegories and Dedekind Categories . 84 4.2 Joins in General §-Algebra Allegories . 88 4.3 Relational Homomorphisms Between Graph Structures . 90 4.4 Pseudo- and Semi-Complements in §-GSD . 93 4.5 Constructions in §-GSD . 94 4.6 Discrete Relations . 95 iii iv CONTENTS 5 Categoric Rewriting in a Relational Setting 98 5.1 Pullbacks . 99 5.2 Transitive and Difunctional Closures . 102 5.3 Pushouts . 103 5.4 Pushout Complements . 107 5.5 Pullback Complements . 116 5.6 Pushouts of Partial Functions . 120 5.7 Summary . 129 6 Relational Rewriting in Dedekind Categories 131 6.1 Gluing Setup . 131 6.2 Amalgamating Pushouts and Pullbacks to Pullouts . 134 6.3 Pullout Complements . 138 6.4 Pullout Rewriting . 140 6.5 The Weak Pullout Construction . 143 7 Conclusion and Outlook 151 Bibliography 153 A Proofs of Auxiliary Properties 165 A.1 Allegory Properties . 165 A.2 Partial Identities . 167 A.3 Dedekind Category Properties . 169 A.4 Semi-Complements and Partial Identities in Dedekind Categories . 170 A.5 Symmetric Quotients . 172 B Proofs for Relational Rewriting, Chapter 6 173 B.1 Correctness of the Glued Tabulation Construction . 173 B.2 Correctness of the Pullout Complement Construction . 179 B.3 Monomorphy of Weak Pullouts . 184 B.4 Correctness of the Direct Result Construction . 190 B.5 The Straight Host Construction Yields Weak Pullout Complements . 199 Index 201 Chapter 1 Introduction We start this introductory chapter with an overview over graph transformation, followed by a more detailed presentation of the categoric approaches to graph transformation. In Sect. 1.3 we sketch the problem of relational matching and shortly sketch our solution. All this serves as introduction into the problem area of the present thesis. The solutions rely on axiomatisations of categories of relations, and we present some historical background for this in Sect. 1.4. Although categories of relations are still cat- egories, the style of relational formalisations is frequently very di®erent from the style of category-theoretic formalisations; we discuss this e®ect in Sect. 1.5. Finally, we present an overview over the remainder of this thesis in Sect. 1.6. 1.1 Graph Grammars and Graph Transformation Research on graph grammars started in the late 1960s [PR69, Sch70, EPS73] and has since evolved into a very active area, as documented by a gradually increasing number of conference series devoted to the topic [CER78, ENR82, ENRR87, FK87, EKR91, CR93b, SE93, C+96, EEKR00, ET00]. Given the fact that graphs are a useful means for modelling many di®erent kinds of complex systems, graph grammars and graph replacement was, from the beginning, strongly motivated by applications in computer science, such as networks, and also in biology, such as modelling the growth of plants [LC79, PL90]. Important areas of applications currently include applied software systems and systems modelling [Jon90, Jon91, Jon92, EB94], many aspects of parallelism, distributed systems and synchronisation mechanisms [BFH85, Kre87, KW87, Sch90], implementation of term rewriting and operational semantics of functional (and logic) programming [Pad82, HP91, CR93a, PvE93, SPvE93, Kah96, Plu99, BS99], operational semantics of object oriented languages [WG96, WG99], and many aspects of visual programming languages [BMST99]. A survey of the foundations of graph transformation is contained in the ¯rst volume [Roz97] of a three-volume handbook. The second volume [EEKR99] concentrates on ap- plications, languages, and tools, and there already has been a ¯rst international workshop on \Applications of Graph Transformations with Industrial Relevance" [NSM00]. In recent years, there has been a shift of attention, accompanied by a shift of terminology, from \graph grammars" to \graph transformation", from \productions" to \(transfor- mation) rules", as problems of describing, generating, and parsing classes of graphs (as \graph languages") are nowadays overshadowed by problems of using graph transformation to specify or describe complex system behaviour and step-wise adaptation or re¯nement of systems or abstract entities represented by graphs. Accordingly, we shall use the following nomenclature for the essential items involved in an individual graph transformation step: 1 2 1. Introduction ² A rule usually contains at least a left-hand side and a right-hand side, which usually both are graphs, and some indication of how instances of the right-hand side are going to replace matched instances of the left-hand side. ² Rule application to some application graph requires identi¯cation of a redex in the application graph, usually via some kind of matching from the rule's left-hand side to the application graph.