Integrating the Specication Techniques of Graph Transformation and Temporal Logic ? Reiko Heckel1 , Hartmut Ehrig1, Uwe Wolter1, Andrea Corradini2?? 1 TU Berlin, FR 6-1, Franklinstrasse 28/29, 10587 Berlin, Germany freiko, ehrig, [email protected] 2 CWI, Kruislaan 413, 1098 SJ Amsterdam, The Netherlands [email protected] Abstract. The aim of this paper is an integration of graph grammars with dierent kinds of behavioural constraints, in particular with temporal logic constraints. Since the usual algebraic semantics of graph transformation systems is not able to express constrained behaviour we introduce - in analogy to other approaches - a coalgebraic semantics which associates with each system a category of models (deterministic transition systems). Such category has a nal object, which includes all nite and innite transition sequences. The coalgebraic framework makes it possible to introduce a general notion of `logic of behavioural constraints'. Instances include, for example, graphical consistency constraints and temporal logic constraints. We show that the considered semantics can be restricted to a nal coalgebra semantics for systems with behavioural constraints. This result can be instantiated in order to obtain a nal coalgebra semantics for graph grammars with temporal logic constraints. 1 Introduction The theory of graph transformation basically studies a variety of formalisms which extend the theory of formal languages in order to deal with structures more general than strings, like graphs and maps. A graph transformation system allows one to describe nitely a (possibly innite) collection of graphs, i.e., those which can be obtained from a start graph through repeated applications of graph productions. Each production can be applied to a graph by replacing an occurrence of its left-hand side with its right-hand side. The form of graph productions and the mechanisms stating how a production can be applied to a graph and what the resulting graph is, depend on the specic formalism. In this paper we use the \algebraic, Double Pushout (DPO) approach" [1,2]. The classical theory of the DPO approach is mainly concerned with structural properties and the sequential and parallel composition of transformation Research partially supported by the German Research Council (DFG) and the TMR network GETRATS ?? A. Corradini is on leave from Dipartimento di Informatica, Pisa. He is also supported by the EC Fixed Contribution Contract n. EBRFMBICT960840 ? steps. More recently, also distributed graph transformations and means of synchronisation have been investigated, see [2] for a recent survey. It has been shown that graph transformations are well-suited for modelling the state transformation aspect of software systems. In a purely rule-based framework, however, it is dicult to control the order and frequency of rule applications. Such control aspects are most important for the specication of software systems, in particular of concurrent and distributed ones. For this reason we study behavioural constraints for graph grammars. Instead of inventing new techniques for specifying the behavioural aspects of a system we shall provide an interface for the integration of graph transformation with existing specication techniques. In this paper we shall elaborate in some detail a temporal logic for graph grammars, extending the approach of [3]. The advantage of this approach is two-fold. First, it combines graphical (visual) and logical means which makes it much easier to work with than purely textual expressions (at least for non-experts). Second, all graph-specic aspects are formulated categorically, which makes the approach applicable also to other kinds of structures. The integration of graph grammars and behavioural constraints is done both syntactically and semantically. On the syntactical level, a notion of behavioural constraint is assumed together with a satisfaction relation for derivation sequences. On the semantical level, a coalgebraic semantics of graph grammars provides a model for the restricted behaviour of systems. This coalgebraic semantics is dened in analogy to a recently developed coalgebraic semantics for graph grammars in [4], where graph transitions are used as a kind of \loose transformation step". Since, the coalgebraic idea is orthogonal to the kind of transformation one considers, we may reuse the constructions of [4] without additional eort. The proofs for the results of this paper can also be found there. The coalgebraic loose semantics allows us to handle in a natural way a large class of constraints imposed on the behaviour of a graph transformation system: It is shown that for each set of behavioural constraints, the restriction to the behaviours that satisfy these constraints is a cofree construction. This implies the existence of a nal (maximal) model for each graph grammar with behavioural constraints. 2 Basic Notions This section reviews basic notions and denitions of the algebraic double-pushout (DPO) approach to the transformation of typed graphs [2,5]. Let Graph be the category of graphs and graph morphisms. Given a graph TG 2 jGraphj, the category GraphTG of typed graphs over TG and typed graph morphisms is the comma category (Graph # TG). If not stated otherwise, graphs and graph morphisms will be assumed to be typed over TG in the following. A graph production p : s is composed of a production name p and of a span r of injective graph morphisms s = (L l? K ?! R), called production span. A (typed) graph transformation system G = hTG; P; i consists of a type graph TG, a set of production names P, and a mapping associating with each production name p a production span (p). A (typed) graph grammar GG = hG; G0i is a typed graph transformation system G = hTG; P; i together with a start graph G0 2 jGraphTG j. Derivation steps in the DPO approach are dened as double pushout constructions: A double-pushout d is a diagram like below, where top and bottom r are production spans and (1) and (2) are pushouts. If p : (L l? K ?! R) is a p=d production, a derivation step from G to H is denoted by G =) H. We also write p=d if G and H are understood, and denote by In; Out, and pn the projections In(p=d) = G; Out(p=d) = H, and pn(p=d) = p. The set of all derivation steps in G is G). L l (1) dL G l K dK D r R (2) dR r H A derivation in a graph transformation system G is a nite or innite se=d2 =d1 G2 : : : where p1; p2; : : : are producG1 p=2 ) quence of derivation steps G0 p=1 ) tion names of G. A derivation in a grammar GG = hG; G0i is a derivation in G that starts in G0. HookOn ☎ L1 K1 ☎ ☎ (1) TG Ph ☎ Ring Ring R1 ☎ K2 R2 Ring HookOff Ring HookOff ☎ ☎ G1 ☎ ☎ L2 (2) HookOn Phone HookOn HookOff HookOff D2 Ring HookOff ☎ G2 ☎ D3 H3 Fig. 1. Telephone example. Our sample graph transformation system GPh = hTGPh ; fHookOff; Muteg; Ph i models (part of) the user's interaction with a telephone (see [6] for the full case study). Type graph TGPh and productions HookOff : (L1 K1 ! R1 ) and Mute : (L2 K2 ! R2) are shown in Figure 1. The typing is indicated by the inscription of vertices and the phone icon. Using production HookOff, the user may change the hook status of the phone, while Mute models the phone's reaction of turning the bell o. A derivation step using HookOff is given by the pushout diagrams (1) and (2). 3 Coalgebraic Semantics of Graph Grammars In analogy to [4] we present now a coalgebraic loose semantics for graph grammars. A model for a graph grammar GG is a deterministic transition system with terminal states that at each step outputs a derivation step. Such models are dened as coalgebras over a suitable functor, and they form a category having a nal object, the full transition system over G, that includes all nite and innite derivation sequences. Let T be an endofunctor on a category C. A T-coalgebra (see e.g., [7]) is a pair hC; i consisting of an object C and a morphism : C ! T(C) in C. A morphism f : hC; i ! hC 0; 0i of coalgebras is a morphism f : C ! C 0 in C such that T(f) = f 0. This denes category CT , called the category of T-coalgebras. Denition 1 (category of graph transition systems). Let TG : Set ! Set be the endofunctor dened for each graph transformation system G by TG (S) = (G) S) + 1 on objects and TG (f) = (idG) f) + id1 on arrows (recall that G) is the set of all derivation steps in G, while 1 denotes the nal object f?g in Set). For each TG -coalgebra T = hS; step : S ! (G) S)+1i, the partial functions first and next are dened for all states s 2 S where step(s) = ht; s0 i, and in this case next(s) = s0 and first(s) = t. The ith iteration nexti of next is dened by next0 = idS and nexti+1 = next nexti. A graph transition system over G is a TG -coalgebra such that for all s 2 S, Out(first(s)) = In(first(next(s))), i.e., the output graph of the rst step equals the input graph of the second, etc. If GG = hG; G0i is graph grammar, a graph transition system over GG is a transition system over G where for all s 2 S there is n 2 IlN (including zero) and s0 2 S such that In(first(s0 )) = G0 and nextn(s0 ) = s, i.e., all sequences are reachable from the start graph G0. The category GraTS(GG) of graph transition systems over GG is the full subcategory of the category SetTG of TG -coalgebras having all graph transition systems over GG as objects. 4 Intuitively, a graph transition system T = hS; stepi is a deterministic automaton with nal states hS; next : S ! S; first : S ! G) i where step(s) = ? represents the case where both next(s) and first(s) are undened, i.e., the termination of the automaton [7]. A state transition from s to s0 in S requires no input, but produces a derivation step in G) as output (observation). Due to the absence of input, the future behaviour of the system is fully determined by its current state. Theorem 2 (nal coalgebra semantics). For each graph grammar GG, the category GraTS(GG) has a nal object, the full transition system T S (GG). The unique morphism for some T 2 jGraTS(GG)j is denoted by T : T ! T S (GG). The category GraTS(GG) of all graph transition systems over the grammar GG is regarded as the category of its \models". In contrast to this loose semantics, the full transition system T S (GG) is the canonical model of GG representing all nite and innite derivation sequences in GG. For any transition system T, the morphism induced by the nality of T S (GG) is denoted by T : T ! T S (GG). If s0 2 S 0 is a state of T, then T(s0 ) is a derivation sequence representing the behaviour of s0 . Two states with the same behaviour are bisimilar [8]. For the full transition system T S (GG) this means that if two derivation sequences are bisimilar, then they are already equal, i.e., T S (GG) provides a minimal representation of all possible behaviours of GG. It is worth summarising here some advantages of having dened the category of models GraTS(GG) via coalgebraic instead of algebraic techniques, obtaining for example an initial model by a free construction, as in [9,10]. First of all, the free construction in the mentioned papers only generates nite sequences, while the full transition system contains both nite and innite sequences. But more importantly, in the algebraic approach all models have to include a homomorphic image of all the computations of the initial model, thus there are no models corresponding to some kind of restriction of behaviour. On the contrary, it is wellknown (see e.g., [7,8]) that the coalgebraic framework allows for the denition of various expressive techniques for considering models that realize only part of the behaviours of the nal model. Such techniques, based on various kinds of constraints, will be described in more detail in the next section. 4 Behavioural Constraints for Graph Grammars In this section we introduce logics of behavioural constraints as syntactical interfaces for the integration of graph grammars with behavioural specication techniques. The main result of this section (see Theorem 4) shows that the full transition system can be restricted to those derivation sequences satisfying the constraints, such that we obtain a nal coalgebra semantics with behavioural constraints. Particular instances of behavioural constraints, like graphical consistency constraints and temporal logic constraints are studied in the next section. Denition 3 (logic of behavioural constraints). A logic of behavioural constraints for graph grammars LOBC = hConstr; j=i is given by a class Constr(GG) of behavioural constraints and a satisfaction relation j=GG jGraTS(GG)j Constr(GG) for each graph grammar GG, such that for each c 2 Constr(GG) the empty graph transition system satises c, and satisfaction is closed under homomorphic images and union of subcoalgebras.1 The satisfaction relation is extended to sets of behavioural constraints C Constr(GG) in the obvious way. 4 A graph grammar with behavioural constraints GC = hGG; C i consists of a graph grammar GG together with a set of behavioural constraints 1 A transition system T0 = h 0 0 i is a subcoalgebra of T = h i, written 0 0 0 to . The homomorphic T T, if and = jS0 is the restriction of image of a coalgebra T under a morphism : T ! T0 is the subcoalgebra (T) T0 S ; step S S step S; step step step f S f determined by f (S ), the set-theoretical image of S . Coalgebras are closed under settheoretical union just like algebras are closed under set-theoretical intersection. It has been shown in [4] that this also holds for transition systems over grammars. C Constr(GG). The category of (constrained) graph transition systems GraTS(GC) over GC is the full subcategory of GraTS(GG) where for each T 2 jGraTS(GC)j we have that T j=GG C. The nal coalgebra semantics can be lifted to graph grammars with constraints: Theorem 4 (nal coalgebra semantics with beh. constraints). For each graph grammar with constraints GC = hGG; C i, the inclusion functor EGC : GraTS(GC) ! GraTS(GG) has a right adjoint jC : GraTS(GG) ! GraTS(GC). Consequently, GraTS(GC) has a nal object, the constrained transition system T S (GG)jC . 4 Roughly speaking, T S (GG)jC is obtained as the largest subcoalgebra of T S (GG) where all derivation sequences satisfy the constraints C. In the next section, examples of behavioural constraints are dened following a generic scheme: Given a graph grammar GG = hG; G0i, constraints and their satisfaction are dened for derivation sequences in G rst. Then, a logic of behavioural constraints is derived from this in one of three possible ways, by universal quantication either (I) over all sequences, (II) over runs (i.e., maximal sequences), or (III) over initial runs (i.e., runs that start in the start graph of a grammar). Hence, the same constraint may become more and more \permissive" when the logic is dened according to II or III instead of I. Let for each graph transformation system v S S denote the usual prex order on derivation sequences in G. If T = hST ; stepT i is a transition system over G, some s 2 ST is called run if for all s0 2 ST , T(s) v T(s0 ) implies that s and s0 are bisimilar, i.e., T (s) = T (s0 ). Let GG = hG; G0i be a graph grammar and T 2 jGraTS(GG)j. Then, a run s in T is initial if In(first(s)) = G0. Proposition 5 (constraints for derivation sequences). Assume for each graph transformation system G a class of behavioural constraints Constr(G) together with a satisfaction relation j=seq G S Constr(G) for derivation sequences (i.e., S is the set of all derivation sequences in G). Then, there is a logic of behavioural constraints for graph grammars LOBC I = hConstrI ; j=I i where ConstrI (GG) = Constr(G) and j=IGG jGraTS(GG)j ConstrI (GG) is dened by T j=IGG c () for all s 2 ST : T (s) j=seq G c. Moreover, LOBC II = hConstrII ; j=II i forms a logic of behavioural con(GG)j straints where ConstrII (GG) = Constr(G) and j=II GG jGraTSseq Constr(GG) is given by T j=II c () for all runs r in T : (r) j = T GG G c. III Finally, a logic of behavioural constraints LOBC = hConstrIII ; j=III i is dened by ConstrIII (GG) = Constr(G) and j=III GG)j GG jGraTS(seq Constr(GG) where T j=III GG c () for all initial runs r in T: T(r) j=G c. 4 In order to dene a particular logic it is now sucient to provide a notion of constraints and satisfaction for derivation sequences and to specify if the logic shall be of type I, II, or III. 5 Temporal Logic Constraints and Other Examples In this section several logics of behavioural constraints, especially temporal logic constraints, are dened and illustrated by the telephone example. Denition 6 (graphical consistency constraints). Assume a graph transformation system G = hTG; P; i and denote by S the set of all derivation sequences in G. Let Constr(G) be the set of all graphical consistency constraints [11], i.e., injective morphisms c : X ! Y 2 GraphTG . An assignment for X in a graph G is an injective morphism a : X ! G. It is a solution for c if there is an injective b : Y ! G such that b c = a. Now, dene j=seq G S Constr(G) by s j=seq c i each assignment a : X ! In(first(s)) is a solution for c. Then, G the logic of consistency constraints is dened by CC = hConstrI ; j=I i according to Proposition 5. 4 For the condition c on the left of Figure 2, a graph satises c if for each occurrence of X there is also an occurrence of Y , i.e., if a phone is ringing then the hook must be on. Hence, c is satised by the graph G1 of Figure 1 but not by the derived graph G2. c HookOn ☎ Ring ☎ c P* Ph Ring X Y ☎ Ring ☎ X Gn c ☎ L Y Y l (1) an +1 Dn k r +1 Gn +1 an Ring X Fig.2. Graphical consistency constraint, temporal logic constraint with ; (2) , and derivation step (bottom span) with assignments. L = H ookOf f M ute Another logic of behavioural constraints of type I could be dened by positive and negative application conditions for graph productions in the sense of [12], where all steps in a derivation sequence would have to satisfy the application conditions of their corresponding productions. In the rest of this section we dene temporal logic [13] as a logic of behavioural constraints using case II and III of Proposition 5. Therefore, let G = hTG; P; i be a graph transformation system and GG = hG; G0i be a graph grammar. If Q is a set of atomic propositions, the language of propositional temporal formulas over a graph transformation system G has the form ::= Q j : j 1 ^ 2 j [L] j hLi where Q 2 Q, and L P is a set of sequences over production names. As usual, we abbreviate : _ as ) . The intended meaning of [L] is, that after every application of a sequence of productions w 2 L, holds. Dually, hLi means that there exists an application of a production sequence w 2 L such that holds. This propositional language is, of course, not able to express any property of the graphs in a derivation sequences. Hence, we have to combine it with a calculus like graphical consistency constraints. The resulting language shall be a graphical temporal logic where consistency constraints for graphs are connected by the propositional temporal operators dened above. Assume an interpretation I of all atomic propositions Q 2 Q into graphical consistency constraints I(Q) over G (cf. Denition 6). Then, for each graph X 2 jGraphTG j the class ConstrX (G) of interpreted temporal formulas over X is given by all those formulas of the propositional temporal language where for all atomic proposition Q in the interpretation of Q is a constraint I(Q) : X ! Y with domain X. A sample temporal logic constraint is shown in Figure 2 in the middle. It says that every state reachable from the initial state by productions in PPh has to satisfy the following condition: If the phone is ringing, then HookO is applied before Mute and the phone will stop ringing. In this way we are able to specify, in a loose, axiomatic way, the eect of the application of a production and the order in which productions shall be applied. Temporal formulas are evaluated over transition systems. For each graph transformation system G = hTG; P; i and each graph X 2 jGraphTG j, the w labelled transition system TX (G) = (AX ; (?! )w2P ) of G over X consists of { the set AX of all pairs hs; a0i of a derivation sequence s of G and an assignment (i.e., an injective morphisms) a0 : X ! G0 into the rst graph of the sequence. w { for each sequence of production names w 2 P a transition relation ?! AX AX , which is dened inductively by hs; a0 i ?! hs; a0i (where denotes n+1 the empty sequence) for all hs; a0i 2 AX , and hs; a0 i wp?! hs0 ; an+1i for w 00 w = p0 : : :pn 2 P i hs; a0i ?! hs ; ani and for step n + 1 of the sequence there exists k : X ! Dn+1 such that (1) and (2) in Figure 2 on the right commute. Notice that the assignment an+1, if it exists, is uniquely determined by a0 and the commutativity of (1) and (2). Now we are able to dene the satisfaction of interpreted temporal formulas by derivation sequences in G: w Denition 7 (logic of temporal constraints). Let TX (G) = (AX ; (?! )w2P ) be the labelled transition system of a graph transformation system G over X 2 jGraphTG j and let I be an interpretation of the atomic propositions Q 2 Q. We dene the satisfaction of X-interpreted temporal formulas 2 ConstrX (G) by hs; a0i 2 AX inductively as { hs; a0i j=G;I Q i a0 is a solution for I(Q) (cf. Denition 6), { hs; a0i j=G;I : i hs; a0i 6j=G;I , { hs; a0i j=G;I 1 ^ 2 i hs; a0 i j=G;I 1 and hs; a0 iwj=G;I 2, { hs; a0i j=G;I [L] i for all hs0 ; ani 2 AX , hs; a0i ?! hs0; ani for some w 2 L implies that hs0 ; ani j=G;I , w { hs; a0i j=G;I hLi i there exists hs0 ; ani 2 AX with hs; a0i ?! hs0 ; ani for 0 some w 2 L and hs ; ani j=G;I . Now, a derivation sequence s satises an X-interpreted temporal formula , written s j=seq G;I , i hs; a0i j=G;I for all assignments a : X ! G0 into the rst graph of s. According to Proposition 5, this satisfaction relation denes two logics of behavioural constraints TempII = hConstrII ; j=II i and TempIII = hConstrIII ; j=III i. 4 By Denition 7 and Theorem 4 this implies that for each graph grammar with temporal logic constraints GC = hGG; C i, the restriction T S (GG)jC of the full transition system T S (GG) is a nal object in GraTS(GC). In TempII the constraints are evaluated w.r.t. behaviours of maximal length only. It can be shown that this property is closed under reachability, i.e., if s is maximalin a transition system T, then also next(s) is maximal in T. This means that all formulas are implicitly quantied over all subsequent states, i.e., there is the sound inference rule that T j=II implies [P ]T j=II . Contrastingly for logic TempIII , the evaluation of formulas is restricted to those maximal sequences that begin in the start graph G0 of a grammar, i.e., the constraints are less restrictive than in TempII . 6 Conclusion In this paper graph grammars have been integrated with behavioural constraints. A nal coalgebraic semantics for graph transformation systems with constraints in general has been developed and specialised to temporal logic constraints. It shall be stressed that these notions and results can be generalised to arbitrary HLR categories [14] in order to transfer them to the transformation other kinds of objects like hypergraphs, attributed graphs, and relational structures. Behavioural constraints, as an abstract framework, are comparable to control conditions in GRACE, a graph and rule based specication language that is being developed independent of the particular graph transformation approach [15]. It could be an interesting future topic to extend our approach of coalgebraic semantics to this language. Moreover, the coalgebraic semantics has still to be extended to graph grammar morphisms. There are various notions of such morphisms to contend with in literature ([9,16,10,6]). We only mention that in the category proposed in [6], pullbacks are used for describing a sort of parallel composition with synchronisation of systems. Since the nal coalgebra semantics can be characterised via a cofree construction (that preserves pullbacks) this semantics would be compositional with respect to such parallel composition. The authors are greatful to Fabio Gadducci, Martin Groe-Rhode and Manuel Koch for their valuable remarks and contributions. References 1. H. Ehrig, M. Pfender, and H. Schneider, \Graph grammars: an algebraic approach," in 14th Annual IEEE Symposium on Switching and Automata Theory, pp. 167{180, IEEE, 1973. 2. A. Corradini, U. Montanari, F. Rossi, H. Ehrig, R. Heckel, and M. Lowe, \Algebraic approaches to graph transformation I: Basic concepts and double pushout approach," in Handbook of Graph Grammars and Computing by Graph transformation, Volume 1: Foundations (G. Rozenberg, ed.), World Scientic, 1997. 3. M. Koch, \Modellierung und Nachweis der Konsistenz von verteilten Transaktionsmodellen fur Datenbanksysteme mit algebraischen Graphgrammatiken," Master's thesis, TU Berlin, 1996. 4. R. Heckel, H. Ehrig, U. Wolter, and A. Corradini, \Loose semantics and constraints for graph transformation systems," Tech. Rep. 97-07, TU Berlin, 1997. http://www.cs.tu-berlin.de/cs/ifb/TechnBerichteListe.html. 5. A. Corradini, U. Montanari, and F. Rossi, \Graph processes," Special issue of Fundamenta Informaticae, vol. 26, no. 3,4, pp. 241{266, 1996. 6. L. Ribeiro, Parallel Composition and Unfolding Semantics of Graph Grammars. PhD thesis, TU Berlin, 1996. 7. H. Reichel, \An approach to object semantics based on terminal co-algebras," Math. Struc. in Comp. Science, vol. 5, pp. 129{152, 1995. 8. J. Rutten, \Universal coalgebra: a theory of systems," Tech. Rep. CS-R9652, CWI, 1996. 9. A. Corradini, H. Ehrig, M. Lowe, U. Montanari, and J. Padberg, \The category of typed graph grammars and their adjunction with categories of derivations," in 5th Int. Workshop on Graph Grammars and their Application to Computer Science, Williamsburg '94, LNCS 1073, 1996. 10. R. Heckel, A. Corradini, H. Ehrig, and M. Lowe, \Horizontal and vertical structuring of typed graph transformation systems," Math. Struc. in Comp. Science, vol. 6, no. 6, pp. 613{648, 1996. 11. R. Heckel and A. Wagner, \Ensuring consistency of conditional graph grammars { a constructive approach," Proc. of SEGRAGRA'95 "Graph Rewriting and Computation", Electronic Notes of TCS, vol. 2, 1995. http://www.elsevier.nl/locate/entcs/volume2.html. 12. A. Habel, R. Heckel, and G. Taentzer, \Graph grammars with negative application conditions," Special issue of Fundamenta Informaticae, vol. 26, no. 3,4, 1996. 13. Z. Manna and A. Pnueli, The Temporal Logic of Reactive and Concurrent Systems, Specication. Springer-Verlag, 1992. 14. H. Ehrig, A. Habel, H.-J. Kreowski, and F. Parisi-Presicce, \Parallelism and concurrency in High Level Replacement Systems," Math. Struc. in Comp. Science, vol. 1, pp. 361{404, 1991. 15. M. Andries, G. Engels, A. Habel, B. Homann, H.-J. Kreowski, S. Kuske, D. Plump, A. Schurr, and G. Taentzer, \Graph transformation for specication and programming", Tech. Rep. 7/96, University of Bremen, 1996. 16. F. Parisi-Presicce, \Transformation of graph grammars," in 5th Int. Workshop on Graph Grammars and their Application to Computer Science, Williamsburg '94, LNCS 1073, 1996.
© Copyright 2026 Paperzz