Confluence up to Garbage in Graph Transformation
CConfluence up to Garbage in Graph Transformation
Graham Campbell a,1 , Detlef Plump b a School of Mathematics, Statistics and Physics, Newcastle University, Newcastle uponTyne, United Kingdom b Department of Computer Science, University of York, York, United Kingdom
Abstract
The transformation of graphs and graph-like structures is ubiquitous in com-puter science. When a system is described by graph-transformation rules, it isoften desirable that the rules are both terminating and confluent so that ruleapplications in an arbitrary order produce unique resulting graphs. However,there are application scenarios where the rules are not globally confluent butconfluent on a subclass of graphs that are of interest. In other words, non-resolvable conflicts can only occur on graphs that are considered as “garbage”.In this paper, we introduce the notion of confluence up to garbage and generalisePlump’s critical pair lemma for double-pushout graph transformation, providinga sufficient condition for confluence up to garbage by non-garbage critical pairanalysis. We apply our results in two case studies about efficient language recog-nition: we present backtracking-free graph reduction systems which recognise aclass of flow diagrams and a class of labelled series-parallel graphs, respectively.Both systems are non-confluent but confluent up to garbage. We also give acritical pair condition for subcommutativity up to garbage which, together withclosedness, implies confluence up to garbage even in non-terminating systems.
Keywords:
Graph Transformation, Confluence, Subcommutativity, CriticalPair Analysis, Graph Languages
1. Introduction
Rule-based graph transformation and graph grammars date back to the late1960s. The best developed theoretical framework is the so-called double-pushout(DPO) approach to graph transformation [1, 2]. When specifying systems incomputer science by DPO graph transformation rules, it is often desirable thatthe rules are both terminating and confluent so that rule applications in an
Email addresses: [email protected] (Graham Campbell), [email protected] (Detlef Plump) Supported by a Vacation Internship and a Doctoral Training Grant No. (2281162) fromthe Engineering and Physical Sciences Research Council (EPSRC) in the UK, while at Uni-versity of York and Newcastle University, respectively. a r X i v : . [ c s . L O ] J a n rbitrary order produce unique resulting graphs. For example, [3] contains 23case studies of confluent and terminating graph reductions systems which specifypointer structures such as cyclic lists, balanced binary trees and red-black trees.Confluence is also important in the context of evaluating functional expressionsby graph reduction, see for example [4].However, there are application scenarios where the rules are not confluentbut confluent on a subclass of graphs that are of interest. In other words, non-resolvable conflicts can only occur on graphs that are considered as “garbage”.An example is the class of so-called extended flow diagrams discussed in Sub-section 5.3. The reduction rules for these graphs give rise to ten critical pairs,nine of which are strongly joinable. But a single pair is not joinable and hencethe rules are not confluent. The non-joinable pair represents a conflict in graphscontaining a type of cycle that cannot occur in extended flow diagrams. Hencethese graphs can be considered as garbage which in this case consists of allgraphs that are not extended flow diagrams.In this paper, we introduce the notions of confluence up to garbage andtermination up to garbage in graph transformation. We generalise Plump’sCritical Pair Lemma [5, 6] and Newmann’s Lemma [7] and thereby allow to checkconfluence up to garbage via non-garbage critical pair analysis. We apply ourresults to language recognition by backtracking-free graph reduction, showinghow to establish that a graph language can be decided by a system which isconfluent up to garbage. We present two case studies with backtracking-freegraph reduction systems which recognise a class of labelled series-parallel graphsand a class flow diagrams, respectively. Both systems are non-confluent butconfluent up to garbage.This paper an extended version of the ICGT 2020 paper [8], which was inturn partly developed from Campbell’s BSc Thesis [9]. In this paper, we are ableto afford a proper treatment of isomorphism of critical pairs, and provide moredetail and examples than previously, throughout. Section 3 is now presented atthe level of abstract reduction systems, with a new subsection the relationshipbetween confluence up to garbage and confluence modulo garbage. In Section 4we additionally discuss generation of non-garbage critical pairs, giving sufficientconditions for this process to be completely automatic. We also explicitly discussjoinability checking for pairs of direct derivations. Section 5 has been revisedwith less confusing terminology and more details of the critical pair analysesincluded. Section 6 is entirely new, looking at subcommutativity up to garbage.We give a second version of our generalised critical pair lemma in this setting,showing how critical pair analysis can be used to check for subcommutativityup to garbage. This property implies confluence up to garbage even in non-terminating systems, provided that non-garbage is closed under reduction. Thisis relevant for applications because confluence up to garbage in such systemsimplies that non-garbage graphs can be reduced to at most one irreduciblegraph. 2 . Preliminaries We review some terminology for binary relations, the DPO approach tograph transformation, graph languages, and confluence checking. An abstract reduction system (ARS) is a pair ( A , → ) where A is a class and → a binary relation on A . Write = −→ for the reflexive closure of → , + −→ for the transitive closure, and ∗ −→ for the reflexive transitive closure. Given x, x i , y, y , y ∈ A ( i ≥ y is a successor to x if x + −→ y , and a direct successor if x → y ;2. x and y are joinable if there is a z such that x ∗ −→ z ∗ ←− y ;3. x and y are subcommutative if there is a z such that x = −→ z = ←− y ;4. → is confluent if y ∗ ←− x ∗ −→ y implies y , y are joinable;5. → is locally confluent if y ← x → y implies y , y are joinable;6. → is subcommutative if y ← x → y implies y , y are subcommutative;7. → is terminating if there is no infinite sequence x → x → . . . .The principle of Noetherian Induction is: ∀ x ∈ A , ( ∀ y ∈ A , x + −→ y ⇒ P ( y )) ⇒ P ( x ) ∀ x ∈ A , P ( x ) Theorem 2.1 (Noetherian Induction [10]) . Given an ARS ( A , → ), the principleof Noetherian induction holds if and only if → is terminating . Lemma 2.2.
Subcommutativity implies confluence, and confluence implies lo-cal confluence.
Theorem 2.3 (Newman’s Lemma [7]) . Let → be a terminating relation. Then → is confluent if and only if it is locally confluent. We will be working with directed labelled graphs [11]. A signature is a pairΣ = (Σ V , Σ E ) of finite sets of node and edge labels from which a graph can belabelled. A graph over Σ is a tuple G = ( V, E, s, t, l, m ) where V is a finite set ofnodes, E is a finite set of edges, s : E → V is the source function, t : E → V isthe target function, l : V → Σ V is the node labelling function, and m : E → Σ E is the edge labelling function. We may write the components of G as V G , E G , s G , t G , l G , and m G .A graph morphism g : G → H is a pair g = ( g V , g E ) of functions g V : V G → V H and g E : E G → E H such that g V ◦ s G = s H ◦ g E , g V ◦ t G = t H ◦ g E , l G = l H ◦ g V and m G = m H ◦ g E . We say g is injective ( surjective , bijective )if both functions g V and g E are. A graph H is a subgraph of G , denoted by H ⊆ G , if there exists an inclusion i : H → G with i ( x ) = x for all items x .It is well known that graphs and morphisms over a fixed signature Σ forma category. Graph morphisms are injective (surjective, bijective) if and onlyif they are monomorphisms (epimorphisms, isomorphisms) in the categoricalsense. We denote by G (Σ) the class of all graphs over Σ.3 .3. Double-Pushout Graph Transformation A rule is a pair of inclusions r = (cid:104) L ← K → R (cid:105) , where L is the left-handside (LHS), K the interface, and R the right-hand side (RHS). A match of r in a graph G is an injective morphism L → G . An application of rule r to G with match g : L → G requires to construct two pushouts as in Figure 1. Wewrite G ⇒ r,g H for this application and call the diagram in Figure 1 a directderivation . L K RG D Hg d h
Figure 1: A direct derivation
Given r and the match g : L → G , the direct derivation of Figure 1 exists ifand only if the dangling condition is satisfied: nodes in g ( L − K ) must not beincident to edges in G − g ( L ). In this case the graphs D and H are determineduniquely up to isomorphism [2]. We call the injective morphism h the comatch of the rule application.Given a set of rules R , we write G ⇒ R H if H is obtained from G byapplying any of the rules from R . Note that ⇒ R is isomorphism-compatible.We write G ⇒ + R H if H is obtained from G by one or more rule applications, and G ⇒ ∗R H if G ∼ = H or G ⇒ + R H . We can view a graph transformation systemas ARS ( G (Σ) , ⇒ R ), giving us the definition of local confluence, confluence,subcommutativity, and termination for graph transformation systems. A graph language is an isomorphism-closed class of graphs, and the size ofa graph language is defined to be the number of non-isomorphic graphs in thelanguage. Just like we can define string languages using string grammars, wecan define graph languages using graph grammars, where we rewrite some startgraph using a set of graph transformation rules. Derived graphs are then definedto be in the language exactly when they are terminally labelled.Given a graph transformation system T = (Σ , R ), a subsignature of non-terminals N , and a start graph S over Σ, then a graph grammar is a tuple G = (Σ , N, R , S ). We say that a graph G is terminally labelled if l ( V ) ∩ N V = ∅ and m ( E ) ∩ N E = ∅ . Thus, we can define the graph language generated by G :L( G ) = { G | S ⇒ ∗R G, G terminally labelled } . Given G = (Σ , N, R , S ), we have G ⇒ r H if and only if H ⇒ r − G , for some r ∈ R , by using the comatch . Moreover, G ∈ L( G ) if and only if G ⇒ ∗R − S and G is terminally labelled. So we have a non-deterministic membership checkingalgorithm, by running the rules in reverse.4 .5. Confluence Checking In 1970, Knuth and Bendix showed that confluence checking of terminatingterm rewriting systems is decidable [12]. Moreover, it suffices to compute all critical pairs and check their joinability [13, 10]. Unfortunately, for terminatinggraph transformation systems, confluence is not decidable in general, and join-ability of critical pairs does not imply local confluence. In 1993, Plump showedthat strong joinability of all critical pairs is sufficient but not necessary to showlocal confluence [5, 6].In order to define critical pairs and critical pair isomorphism, we first mustdefine what we mean by an instance of a derivation based on a morphism andwhat it means for two derivations to be parallelly independent.Let the derivation ∆ : G ⇒ ∗ G n be given by pushouts (1) , (1 (cid:48) ) , . . . , ( n ) , ( n (cid:48) )and suppose there are pushouts (1) , (1 (cid:48) ) , . . . , ( n ) , ( n (cid:48) ) whose vertical morphismsare injective (Figure 2). Then, the derivation ∆ (cid:48) : G (cid:48) ⇒ ∗ G (cid:48) n consisting ofthe composed pushouts (1 + 1) , . . . , ( n (cid:48) + n (cid:48) ) is an instance of ∆ based on themorphism G → G (cid:48) . Moreover, we define the subgraph Use ∆ to be all items x such that there is some i ≥ G ⇒ ∗ G i ( x ) ∈ Match( G i ⇒ G i +1 ) whereMatch( G i ⇒ G i +1 ) is the image of the associated rule’s left hand side graphunder the match L → G i . L K R L K R (1) (2) (3) (4) G D G D G · · · (1 (cid:48) ) (2 (cid:48) ) (3 (cid:48) ) (4 (cid:48) ) G (cid:48) D (cid:48) G (cid:48) D (cid:48) G (cid:48) Figure 2: Derivation instances
We say two direct derivations H ⇐ r ,g G ⇒ r ,g H are parallelly inde-pendent if ( g ( L ) ∩ g ( L )) ⊆ ( g ( K ) ∩ g ( K )), or equivalently, if there aremorphisms L → D and L → D such that L → D → G = L → G and L → D → G = L → G (Figure 3). R K L L K R H D G D H Figure 3: Parallelly independent direct derivations
We say two parallelly independent direct derivations H ⇐ r ,g G ⇒ r ,g H are a critical pair if additionally G = g ( L ) ∪ g ( L ), and if r = r then5 (cid:54) = g . It is easy to see that every graph transformation system has only finitelymany critical pairs. We call two critical pairs H ⇐ r ,g G ⇒ r ,g H and H (cid:48) ⇐ r ,g (cid:48) G (cid:48) ⇒ r ,g (cid:48) H (cid:48) isomorphic if there is a isomorphism f : G → G (cid:48) suchthat G (cid:48) ⇒ H (cid:48) is an instance of G ⇒ H based on f and G (cid:48) ⇒ H (cid:48) is an instance of G ⇒ H based on f . Equivalently, the critical pairs H ⇐ r ,g G ⇒ r ,g H and H (cid:48) ⇐ r ,g (cid:48) G (cid:48) ⇒ r ,g (cid:48) H (cid:48) are isomorphic if there is an isomorphism f : G → G (cid:48) such that g (cid:48) = f ◦ g and g (cid:48) = f ◦ g (Figure 4). L L = = GG (cid:48) g g g (cid:48) g (cid:48) f Figure 4: Isomorphism of critical pairs
The track morphism of a direct derivation G ⇒ H is defined to be thepartial morphism tr G ⇒ H = in (cid:48) ◦ in − , where in and in (cid:48) are the bottom left andright morphisms in Figure 1, respectively. We define tr G ⇒ ∗ H inductively as thecomposition of track morphisms. The set of persistent nodes of a critical pairΦ : H ⇐ G ⇒ H is Persist Φ = { v ∈ G V | tr G ⇒ H ( { v } ) , tr G ⇒ H ( { v } ) (cid:54) = ∅} .That is, those nodes that are not deleted by the application of either rule.A critical pair Φ : H ⇐ G ⇒ H is strongly joinable ( strongly subcommu-tative ) if it is joinable ( subcommutative ) without deleting any of the persistentnodes, and the persistent nodes are identified when joining. That is, there existsa graph M and derivations H ⇒ ∗R M ⇐ ∗R H ( H ⇒ = R M ⇐ = R H ) such that ∀ v ∈ Persist Φ , tr G ⇒ H ⇒ ∗ M ( { v } ) = tr G ⇒ H ⇒ ∗ M ( { v } ) (cid:54) = ∅ . Theorem 2.4 (Critical Pair Lemma [5, 6]) . A graph transformation system T is locally confluent if all its critical pairs are strongly joinable .It’s easy to see that the result also holds if one only considers non-isomorphiccritical pairs, which can result in a large speedup in practice, since for large rules,there can often be many isomorphic critical pairs.The original proof of the Critical Pair Lemma needs the Commutativity,Clipping and Embedding Theorems, which we shall now provide, and use in theproof of our Generalised Critical Pair Lemma (Theorem 4.8). Theorem 2.5 (Commutativity [14]) . If H ⇐ r ,g G ⇒ r ,g H are parallellyindependent , then there is a graph G (cid:48) and derivations H ⇒ r G (cid:48) ⇐ r H . Theorem 2.6 (Clipping [15]) . Given a derivation ∆ (cid:48) : G (cid:48) ⇒ ∗ H (cid:48) and an injec-tive morphism h : G → G (cid:48) such that Use∆ (cid:48) ⊆ h ( G ), there exists a derivation∆ : G ⇒ ∗ H such that ∆ (cid:48) is an instance of ∆ based on h .Given a derivation ∆ : G ⇒ ∗ H , the subgraph of G , Persist ∆ , consists of allitems x such that tr G ⇒ ∗ H ( x ) is defined.6 heorem 2.7 (Embedding [15]) . Let ∆ : G ⇒ ∗ H be a derivation, h : G → G (cid:48) an injective graph morphism, B ∆ be the discrete subgraph of G consisting of allnodes x such that h ( x ) is incident to an edge in G (cid:48) \ h ( G ). If B ∆ ⊆ Persist ∆ , thenthere exists a derivation ∆ (cid:48) : G (cid:48) ⇒ ∗ H (cid:48) such that ∆ (cid:48) is an instance of ∆ basedon h . Moreover, there exists a pushout of t : B ∆ → H along h (cid:48) : B ∆ → C ∆ where C ∆ = ( G (cid:48) \ h ( G )) ∪ h ( B ∆ ) and t is the restriction of tr G ⇒ ∗ H to B ∆ .
3. Closedness and Confluence up to Garbage
The purpose of this section is to introduce the notion of “up to garbage”and lay some foundations that we can use in the remainder of the paper. Wedivide the section into three subsections, finishing by relating “up to garbage”with the existing notion of “modulo garbage”.
We start with the definition of closedness, and what it means for an item tobe considered garbage.
Definition 3.1.
Let T = ( A , → ) be an ARS and D ⊆ A . Then an object x ∈ A is called garbage if x (cid:54)∈ D and D is closed under T if for all x, y ∈ A such that x → y , if x ∈ D then y ∈ D .The idea is that D represents the good input , and the garbage is the objectsthat are not in this class. In the context of graph transformation, D will bea graph language, but need not be explicitly generated by a graph grammar.For example, it could be defined by some (monadic second-order [16]) logicalformula, a finite listing of graphs, or a type graph language (Subsection 4.3).Finite languages and type graph languages will be of particular interest to us dueto the fact they they have decidable subgraph membership problem (Subsection4.3). Example 3.2.
Consider the reduction rules in Figure 5. The language of acyclicgraphs is closed under the GT system (( { (cid:3) } , { (cid:3) } ) , { r } ), and the language oftrees (forests) and its complement are both closed under (( { (cid:3) } , { (cid:3) } ) , { r } ). r : ← → r : ← → Figure 5: Reduction rules for Example 3.2
The closedness problem is defined in the obvious way:
Definition 3.3 (Closedness Problem) .Instance:
A GT system T = (Σ , R ) and a graph grammar G over Σ. Question:
Is L( G ) closed under T ?7t turns out that this is undecidable in general, even if we restrict to recursivelanguages and terminating GT systems. In 1998, Fradet and Le M´etayer showedthe following result: Theorem 3.4 (Undecidable Closedness [17]) . The closedness problem is unde-cidable in general, even for terminating GT systems T with only one rule, and G an edge replacement grammar. In this subsection, we generalise the familiar definitions of local confluence,confluence, subcommutativity, and termination to permit ignoring garbage . Definition 3.5.
Given an ARS ( A , → ), D ⊆ A , x, x ∈ D , and x i , y , y ∈ A ( i ≥ → is confluent up to garbage on D if y ∗ ←− x ∗ −→ y implies y , y arejoinable;2. → is locally confluent up to garbage on D if y ← x → y implies y , y are joinable;3. → is subcommutative up to garbage on D if y ← x → y implies y , y aresubcommutative;4. → is terminating up to garbage on D if there is no infinite sequence x → x → . . . .The following is an immediate consequence of inclusion: Lemma 3.6.
Let ( A , → ) be an ARS, D ⊆ A , E ⊆ D , and P be the propertyof confluence up to garbage , local confluence up to garbage , subcommutativity upto garbage , or termination up to garbage . Then P on D implies P on E .Our next two examples show that confluence up to garbage need not corre-spond to confluence. That is, a system can be non-confluent, but confluent upto garbage. Example 3.7.
Consider again the rules in Figure 5. It is easy to see that the GTsystem containing both rules is terminating, but not confluent. It is, however,both confluent up to garbage on the language of unlabelled discrete graphs andsubcommutative up to garbage on the language of unlabelled discrete graphs.
Example 3.8.
Consider the rules in Figure 6. They are terminating, since theyare size reducing. Moreover, the language of all linked lists with edge labels a or b and its complement (over the same signature) are closed under the rules.These rules are confluent up to garbage on linked lists, since any non-triviallinked list is necessarily reduced to the length one linked list labelled by a , andthe length zero and one linked lists are already in normal form. By comparison,the rules are not locally confluent due to the counter example in Figure 7.8 : ← → a a a s : ← → a b a s : ← → b a a s : ← → b b a Figure 6: Reduction rules for Example 3.8 ⇐ s ⇒ s
21 2 1 2 3 1 3 aa a ab ab
Figure 7: Non-joinable derivations for Example 3.8
It is easy to see that confluence up to garbage always implies local confluenceup to garbage, and subcommutativity up to garbage implies local confluence upto garbage, however subcommutativity up to garbage need not imply conflu-ence up to garbage. Similarly, in the presence of termination, local confluenceup to garbage need not imply confluence up to garbage. Our next exampledemonstrates this.
Example 3.9.
Let D be the language of linked lists containing at least twoedges and T be the GT system with rules from Figure 8. Then r and r cannotbe applied to any graph in D , and r will always be applicable in a unique way,with the effect of deleting the last node and its edge. It is thus immediate that T is subcommutative up to garbage on D , and thus also locally confluent upto garbage on D . T is not, however, confluent up to garbage on D due to thefollowing two-step counter example in Figure 9. r : ← → r : ← ∅ → r : ← ∅ → Figure 8: Rules for Example 3.9 ⇐ r ⇐ r ⇒ r ⇒ r
31 1 2 1 2 3 1 2 1
Figure 9: Non-joinable derivations for Example 3.9
Lemma 3.10.
Let ( A , → ) be an ARS and D ⊆ A .1. If D is closed under → and → is subcommutative up to garbage on D , then → is confluent up to garbage on D ;2. If → is confluent up to garbage on D , then → is locally confluent up togarbage on D . Proof.
The first part can be seen by Noetherian Induction, due to the fact thatclosedness ensures applicability of the induction hypothesis, and the second partfollows immediately from the definitions.
Theorem 3.11 (Generalised Newman’s Lemma) . Let ( A , → ) be an ARS and D ⊆ A . If → is terminating up to garbage on D and D is closed under → , then → is confluent up to garbage on D if and only → it is locally confluent up togarbage on D . Proof.
One direction can be seen by Noetherian Induction (Figure 10), due tothe fact that closedness ensures applicability of the induction hypothesis, andthe other follows from the second part of Lemma 3.10. xy y z z z z z LocalConfluenceInductionHypothesis InductionHypothesis * * * ** * **
Figure 10: Diagram for the proof of Theorem 3.11
In this subsection, we show that our notion of confluence up to garbage canbe related to the existing notion of confluence modulo.First, we recall the definition of local confluence (confluence, subcommuta-tivity) modulo an equivalence relation. If the relation is the identity relation,then we recover the standard definitions of local confluence (confluence, sub-commutativity).
Definition 3.12.
Given an ARS ( A , → ), an equivalence ∼ on A , and x, x i , y,y , y ∈ A ( i ≥ x and y are ∼ - joinable if there is are z , z ∈ A such that x ∗ −→ z ∼ z ∗ ←− y ;2. x and y are ∼ - subcommutative if there are z , z ∈ A such that x = −→ z ∼ z ←− y ;3. → is confluent modulo ∼ if y ∗ ←− x ∗ −→ y implies y , y are ∼ -joinable;4. → is locally confluent modulo ∼ if y ← x → y implies y , y are ∼ -joinable;5. → is subcommutative modulo ∼ if y ← x → y implies y , y are ∼ -subcommutative.We now show that confluence up to garbage as confluence up to garbage,and vice versa. Theorem 3.13 (Encoding Confluence up to Garbage) . Let ( A , → ) be an ARS, D ⊆ A , and define the equivalence ∼ on A by x ∼ y exactly when x = y or x, y ∈ A \ D . Then:1. if A \ D is closed under → and → is P up to garbage on D , then → is P modulo ∼ ;2. if D is closed under → and → is P modulo ∼ , then → is P up to garbageon D .where P is the property confluence , local confluence , or subcommutativity . Proof.
We deal only with confluence. Local confluence and subcommutativityare trivial modifications of the same argument.Suppose
A \ D is closed under → and → is confluent up to garbage on D .Then, for all derivations x ∗ −→ y , x ∗ −→ z such that x ∈ D , there is a t ∈ A suchthat y ∗ −→ t and z ∗ −→ t . Clearly t ∼ t , so all such derivations are ∼ -joinable.Suppose now that x (cid:54)∈ D . Then by closedness, y, z (cid:54)∈ D too, so y ∼ z , so allsuch derivations are ∼ -joinable. Thus → is confluent modulo ∼ , as required.Suppose D is closed under → and → is confluent modulo ∼ . Then, for allall derivations x ∗ −→ y , x ∗ −→ z such that x ∈ D , there are t , t ∈ A such that y ∗ −→ t , z ∗ −→ t , and t ∼ t . Due to closedness, we have y, t , z, t D . Puttingthis together with the fact that t ∼ t tells us that in fact t = t . Thus all suchderivations are joinable. Finally, if x (cid:54)∈ D , we don’t need to consider joinability.Thus, → is confluent up to garbage on D , as required.Thus, if both A\D and D are closed under → , then the notions of confluence(local confluence, subcommutativity) up to garbage and modulo garbage exactlycorrespond: Corollary 3.14.
Let ( A , → ) be an ARS, D ⊆ A , and define the equivalence ∼ on A by x ∼ y exactly when x = y or x, y ∈ A \ D . If A \ D and D are closedunder → , then → is P up to garbage on D if and only if → is P modulo ∼ ,where P is the property confluence , local confluence , or subcommutativity .11 . Generalised Critical Pair Lemma Recall that strong joinability of all critical pairs is a sufficient condition forlocal confluence (Theorem 2.4). This was first shown by Plump in 1993 [5].Combining this with Newman’s Lemma (Theorem 2.3), we have a checkablecondition for confluence of a GT system. Unlike for string and term rewriting,joinability is not sufficient to show local confluence, as demonstrated by thefollowing example due to Plump [6]:
Example 4.1.
Consider the terminating GT system with the rules from Figure11. The only critical pair (Figure 12) is joinable, but not strongly, and thesystem is not locally confluent due to the counter example in Figure 13. r : ← → a b r : ← → a b Figure 11: Rules for Example 4.1 ⇐ r ⇒ r
21 2 1 2 1 2 b a b
Figure 12: Critical pair for Example 4.1 ⇐ r ⇒ r
21 2 1 2 1 2 b b ab b b
Figure 13: Non-strongly joinable pair for Example 4.1
In this section, we generalise Plump’s critical pair analysis for confluenceup to garbage. We delay the treatment of subcommutativity up to garbage toSection 6, for ease of reading.
In the original proof of the Critical Pair Lemma for (hyper)graphs [5], theargument is that if a pair of derivations is not parallelly independent, then itmust be the case that a critical pair can be embedded within it. In our newsetting, the possible start graphs will be restricted, since some of the graphs willbe garbage . We are only interested in those critical pairs with start graphs thatcan be embedded in non-garbage graphs. This is exactly the statement thatthe start graph of the critical pair is in the subgraph closure of the non-garbagegraphs. We start this subsection by defining subgraph closure.12 efinition 4.2.
Let
D ⊆ G (Σ) be a language over some signature Σ. Then D is subgraph closed if for all graphs G , H , such that H ⊆ G , if G ∈ D , then H ∈ D . The subgraph closure of D , denoted (cid:98) D , is the smallest language (withrespect to inclusion) containing D that is subgraph closed . Lemma 4.3.
Given a language
D ⊆ G (Σ), (cid:98) D always exists , and is unique .Moreover, D = (cid:98) D if and only if D is subgraph closed . Proof.
The key observations are that the subgraph relation is transitive, andeach graph has only finitely many subgraphs. Clearly, the smallest possible setcontaining D is just the union of all subgraphs of the elements of D , up toisomorphism. This is the unique subgraph closure of D . (cid:98) D always exists, however it need not be decidable, even when D is! It isnot obvious what conditions on D ensure that (cid:98) D is decidable. If we moveto the setting of string rewriting, there are some known cases where this canbe solved. The classes of regular and context-free string languages are closedunder substring closure, and the substring membership problem is decidable forcontext-free grammars [18] due to the fact that showing closure is constructive.We return to the issue of deciding subgraph membership in Subsection 4.3. Example 4.4.
The following graph languages are subgraph closed, over anysignature Σ:1. the empty language ∅ and the language of all graphs G (Σ);2. the language of discrete graphs;3. the language of acyclic graphs;4. the language of planar graphs;5. the language of k -colourable graphs for any fixed k ≥ Example 4.5.
The subgraph closure of the language of trees is the languageof forests. The subgraph closure of the language of connected graphs is thelanguage of all graphs.
We now define non-garbage critical pairs, which allow us to ignore certainpairs, which if all are strongly joinable, will allow us to conclude local confluenceup to garbage, even in the presence of (local) non-confluence on all graphs.
Definition 4.6.
Let T = (Σ , R ) be a GT system and D ⊆ G (Σ) a language. A critical pair H ⇐ G ⇒ H is D - non-garbage if G ∈ (cid:98) D . Lemma 4.7.
Given a GT system T = (Σ , R ) and a language D ⊆ G (Σ), thenthere are only finitely many D - non-garbage critical pairs (up to isomorphism).13 roof. Recall from Subsection 2.5 that any GT system has only finitely manycritical pairs. Filtering out those that are garbage or isomorphic is certainlyonly going to leave us with a finite number of critical pairs.Of course, just because there are only finitely many non-garbage criticalpairs, it doesn’t mean that generation of them is effective, in general. In orderto avoid interrupting the flow, we will discuss this further in Subsection 4.3. Wenow proceed to present the main result:
Theorem 4.8 (Generalised Critical Pair Lemma) . Let T = (Σ , R ) be a GTsystem and D ⊆ G (Σ) a language. If all T ’s D - non-garbage critical pairs are strongly joinable , then T is locally confluent up to garbage on D . Proof.
Our proof is a generalisation of Plump’s original proof of the CriticalPair Lemma for (hyper)graph transformation systems (Theorem 2.4). We needto show that every pair of derivations H ⇐ r ,g G ⇒ r ,g H such that G is non-garbage can be joined. There are two cases to consider. Firstly, if thederivations are parallelly independent, then by Theorem 2.5, the result is im-mediate. Otherwise, we must consider the case that they are not parallellyindependent.By Theorem 2.6, we can factor out a pair T ⇐ S ⇒ T . Since critical pairsare, by construction, the overlaps of rule left hand sides, it must be the case thatthis pair is actually a critical pair. Moreover, since G ∈ D , then S ∈ (cid:98) D and sothe critical pair must be non-garbage, and must be strongly joinable to U . Wecan now apply Theorem 2.7 to T ⇒ ∗ U and T ⇒ ∗ U , separately, giving resultgraphs M and M (applicability of the theorem is a consequence of strongjoinability). To see that M and M are isomorphic follows from elementaryproperties of pushouts along monomorphisms [6]. Figure 14: Diagram for the proof of Theorem 4.8
Just as with the original Critical Pair Lemma in Subsection 2.5, it is suffi-cient to only check the non-isomorphic critical pairs for strong joinability dueto the fact that derivations based on a critical pair can be reset as derivationsbased on any other isomorphic critical pair simply by passing through the iso-morphism. Thus, if all T ’s non-isomorphic D -non-garbage critical pairs arestrongly joinable, then T is locally confluent up to garbage on D .14he most common use case of this generalised critical pair will be the fol-lowing corollary, where the aim is not to show local confluence up to garbage,but confluence up to garbage, given termination up to garbage: Corollary 4.9.
Let T = (Σ , R ) be a GT system and D ⊆ G (Σ) a language.If D is closed under T , T is terminating up to garbage on D , and all T ’s non-isomorphic D - non-garbage critical pairs are strongly joinable , then T is confluentup to garbage on D . Proof.
By the above theorem, T is locally confluent up to garbage , so by theGeneralised Newman’s Lemma (Theorem 3.11), T is confluent up to garbage . Example 4.10.
Recall from Subsection 3.2, the non-confluent GT system fromExample 3.8 (Figure 6). We can use Corollary 4.9 to show that this system isconfluent up to garbage on the language of acyclic graphs with edge labels a and b , D . First, we observe that the rules (Figure 3.8) are terminating, andthat D is closed under the rules. Next, we observe that the system has 16non-isomorphic critical pairs. Figure 15 shows, for each of the pairs, if they arejoinable, strongly joinable, or D -non-garbage. From this, we can see that everynon-garbage critical pair is strongly joinable, and so the system is confluent upto garbage on D .Checking for local confluence up to garbage is undecidable in general, evenwhen (cid:98) D is decidable and the system is terminating and closed. Moreover, localconfluence up to garbage is actually undecidable in general for a terminatingnon-length-increasing string rewriting systems and D a regular string language[19]. The following (corrected) example due to Plump [6] demonstrates that aGT system can be confluent and terminating, with all critical pairs joinable,and at least one not strongly joinable: Example 4.11.
The GT system with rules in Figure 16 is terminating andconfluent, and all its critical pairs are strongly joinable apart from the pair inFigure 17 which is only joinable.We now extend this even further, showing that there is a GT system T thatis not confluent and an infinite language of graphs D such that D is closed under T , T is terminating on D , T is confluent on D , all T ’s D -non-garbage criticalpairs are joinable, and at least one of them is not strongly joinable: Example 4.12.
Let D be the language of all graphs that are trees with exactlyone looped edge added to one of the nodes, and T be the GT system withrules in Figure 18. Figure 19 shows the four non-isomorphic critical pairs of thesystem. We can see there is a garbage pair which is non-joinable, which tellsus that T is not locally confluent. By direct argument, one can see that D isclosed under T , T is terminating on D , and T is confluent on D , however thereis a non-strongly joinable non-garbage critical pair.In Subsection 4.3, we will discuss generation of the set of non-isomorphicnon-garbage critical pairs of a given GT system, discussing sufficient conditionson D for this process to be effective. In Subsection 4.4 we discuss testing forstrong joinability of a given non-garbage critical pair.15 air/Property Joinable StronglyJoinable Non-Garbage ⇐ s ⇒ s
11 2 1 2 3 1 3 aa a aa aa (cid:51) (cid:51) (cid:55) ⇐ s ⇒ s
11 2 4 1 2 3 4 1 3 4 a a a a a a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
21 3 1 2 3 1 2 ab a ab aa (cid:55) (cid:55) (cid:55) ⇐ s ⇒ s
21 3 4 1 2 3 4 1 2 4 a b a a b a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
31 3 1 2 3 2 3 ab a ab aa (cid:55) (cid:55) (cid:55) ⇐ s ⇒ s
31 2 4 1 2 3 4 1 3 4 b a b a a a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
31 2 1 2 3 2 3 aa a ab aa (cid:51) (cid:51) (cid:55) ⇐ s ⇒ s
31 3 4 1 2 3 4 1 2 4 b a a b a a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
31 3 1 2 3 2 3 ab a bb ba (cid:51) (cid:55) (cid:55) ⇐ s ⇒ s
31 2 4 1 2 3 4 1 3 4 b a b a b a b (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
41 3 1 2 3 1 2 ab a bb aa (cid:55) (cid:55) (cid:55) ⇐ s ⇒ s
41 3 4 1 2 3 4 1 2 4 a b a b b a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
42 3 1 2 3 1 2 ba a bb aa (cid:55) (cid:55) (cid:55) ⇐ s ⇒ s
41 2 4 1 2 3 4 1 3 4 b a b b a a a (cid:51) (cid:51) (cid:51) ⇐ s ⇒ s
41 3 1 2 3 1 2 ab b bb ba (cid:51) (cid:55) (cid:55) ⇐ s ⇒ s
41 2 4 1 2 3 4 1 3 4 b a b b b a b (cid:51) (cid:51) (cid:51)
Figure 15: Critical pair analysis for Example 4.10 : ← → r : ← → r : ← → Figure 16: Rules for Example 4.11 ⇐ r ⇒ r
11 2 1 2 1 2
Figure 17: Non-strongly joinable pair for Example 4.11 r : ← → r : ← → Figure 18: Rules for Example 4.12
Pair/Property Joinable StronglyJoinable Non-Garbage ⇐ r ⇒ r
212 12 12 (cid:51) (cid:51) (cid:55) ⇐ r ⇒ r
212 12 12 (cid:51) (cid:51) (cid:55) ⇐ r ⇒ r
112 3 12 3 12 3 (cid:51) (cid:55) (cid:51) ⇐ r ⇒ r
212 12 1 (cid:55) (cid:55) (cid:55)
Figure 19: Critical pair analysis for Example 4.12
In general, there is no algorithm that, when given a DPO grammar and agraph, can decide if the graph is contained in the language generated by thegrammar. That is, the universal membership problem is undecidable. It is easyto see that similar problem of whether a graph is in the subgraph closure of thelanguage generated by a DPO grammar is undecidable in general too.This means that, unlike for critical pairs, generation of all the non-garbagecritical pairs is not possible in general, due the impossibility of deciding subgraphmembership. Though, if we are provided with an algorithm for testing if a graph17s a subgraph of a graph of D , then we can generate the set of non-isomorphic D - non-garbage critical pairs . Definition 4.13 (Universal Subgraph Membership Problem) .Instance:
A graph grammar G over Σ and a graph G over Σ. Question: Is G ∈ (cid:91) L( G )? Lemma 4.14.
The universal subgraph membership problem is undecidable.
Proof.
By reduction of undecidability of the emptiness problem, since ∅ (cid:54)∈ (cid:91) L( G )if and only if L( G ) = ∅ .In practice, it is often the case that one can determine if graph is containedin the subgraph closure of a language, and so undecidability is not too much ofa concern. For example, if a graph language is known to only contain acyclicgraphs, critical pairs with start graphs containing a cycle can be discarded asgarbage. Moreover, it may not even be necessary to decide if a critical pair isgarbage, if one can show that it is strongly joinable instead.Here are some types of graph languages for which membership in the sub-graph closure is decidable:1. If D is finite, then membership in the subgraph closure can be decidedsimply by checking if the given graph is a subgraph of any graph in thelanguage.2. If D is subgraph-closed, then membership in the subgraph closure is thesame as membership in D . Hence, membership is decidable if D is theclass of discrete graphs, bounded degree graphs for some fixed bound,acyclic graphs, k -colourable graphs or planar graphs (see [20] for how todecide membership in the latter three classes). If D is the class of boundedtreewidth graphs, for a fixed bound, membership can be decided by thealgorithm in [21].3. If D is specified by a so-called type graph (see below), then D is alsosubgraph-closed and membership is decidable. Type graph languages arestudied by Corradini, K¨onig, and Nolte in [22]. Definition 4.15 (Type Graph Language) . Given a signature Σ and a graph G ∈ G (Σ), define the type graph language L Σ ( G ) = { H ∈ G (Σ) | H → G } . Example 4.16.
It is easy to see that the language of 2-colourable unlabelledgraphs, D , can be specified by the type graph in Figure 20. Consider the GTsystem with the two rules in Figure 21. It is easy to see that D is closedunder these rules (due to the fact that they are never applicable), that they areterminating (due to the fact that they are size reducing), and that there are fivenon-isomorphic critical pairs (Figure 22, where the third pair is repeated twicemore, formally with different matches), all of which are garbage (which we canmachine check because D is specified by a type graph). Thus, by Corollary 4.9,the rules are confluent up to garbage on D .18 igure 20: Type graph for Example 4.16 r : ← ∅ → r : ← ∅ → Figure 21: Rules for Example 4.16 ⇐ r ⇒ r
11 2 3 ⇐ r ⇒ r
21 2 3 ⇐ r ⇒ r
21 2 3
Figure 22: Critical pairs for Example 4.16
We are not aware of any other general families of grammars, or otherwise, forwhich we can solve the subgraph membership problem. We do not believe thisproblem is even decidable for hyperedge replacement grammars. This conjectureis not incompatible with this problem being easy for type graph languages, sincethe the class of graph languages generated by hyperedge replacement grammarsis incomparable with the class of graph languages specified by type graphs.
We briefly, explicitly discuss the process for checking if a pair of direct deriva-tions is strongly joinable in a given GT system.If a GT system is terminating, then it is easy to check if a pair of directderivations is joinable or strongly joinable due to the fact that GT systemsare finitely branching up to isomorphism, so there can only be finitely manysuccessor graphs, up to isomorphism. It is then simply a matter of checkingif there is an isomorphism between any of the successor graphs which behavescorrectly with respect to the preserved nodes, as in the definition of strongjoinability.Alternatively, if a GT system is only terminating up to garbage on somelanguage D and D is closed under T , then similarly, one can test joinability19nd strong joinability due to the fact that closedness ensures only finitely manysuccessor graphs, as above. We have presented our Generalised Critical Pair Lemma and GeneralisedNewman’s Lemma, which together, allow one to check for confluence up togarbage on some language D in the presence of termination and closedness. Ifthere is an algorithm for solving the subgraph membership problem of D , thenwe can effectively generate the set of non-isomorphic D -non-garbage criticalpairs and effectively test each of them for strong joinability. This process willalways terminate, however may not provide a conclusive answer.If the analysis completes with all the non-isomorphic D -non-garbage criticalpairs being strongly joinable, then we can conclude the system is confluent upto garbage on D . If the analysis completes with a non-joinable D -non-garbagecritical pair that has its start graph in D , then we can conclude the system isnot confluent up to garbage on D . In any other scenario, we cannot directlymake a conclusion.Finally, sometimes one might want to show confluence of a GT system T on a language D which is not necessarily closed under T . That is, either D isnot closed under T , or indeed closure is simply unknown. In this scenario, oneshould attempt to show confluence on some larger language E containing D .For example, if D contains only acyclic graphs, a good choice for E could be thelanguage of acyclic graphs over the same signature. Transitivity of confluenceup to garbage (Lemma 3.6) tells us that if we establish that T is confluent upto garbage on E , then it is also confluent up to garbage on D .
5. Backtracking-Free Language Recognition
In this section, we introduce a general notion of what it means to recognisea language, and what it means to be a backtracking-free specification. Wethen demonstrate the applicability of our earlier results by showing that thereare backtracking-free specifications for the languages of labelled series-parallelgraphs and extended flow diagrams, even in the absence of confluence. We thushave algorithms, specified by reduction rules, that can check membership ofthese languages without needing to backtrack.
Given a graph transformation system and a start graph, we can think ofthe pair as a graph grammar, generating a graph language. If the reversedsystem is terminating, then membership testing is decidable, but in general,non-deterministic in the sense that a deterministic algorithm must backtrack ifit produces a normal form not equal to the start graph, to determine if anotherderivation sequence could have reached it. It is easy to see that confluence is asufficient condition to give determinism, however confluence is often not easily20btainable in practice. For this reason, we will consider the weaker property ofconfluence up to garbage on the generated language.Using the results from the last section, it is often possible to prove local con-fluence up to garbage using the Generalised Critical Pair Lemma, and then, inthe presence of termination and closure, use the Generalised Newman’s Lemmato show confluence up to garbage. Language recognition by confluent graphreduction has been considered before by Bakewell, Plump, and Runciman, inthe context of pointer structures [3, 23], but without the concept of confluenceup to garbage.Before continuing, we must provide a formal definition of what it means torecognise a language, and that grammars satisfy our definition by consideringtheir rules in reverse, abstracting away from grammars, with a more generaldefinition that accounts for the fact that reduction systems may need auxiliarysymbols, not in the input, in the same way grammars can use non-terminals.
Definition 5.1 (Language Recognition) . Let T = (Σ , R ) be a GT system, A ⊆ Σ an input signature, and S a finite set of graphs over Σ. Then we saythat ( T, S ) recognises a language L over A if for all graphs G over A , [ G ] ∈ L ifand only if G ⇒ ∗R S for some S ∈ S . Theorem 5.2 (Membership Checking) . Given a grammar G = (Σ , N, R , S ),[ G ] ∈ L( G ) if and only if G ⇒ ∗R − S and G is terminally labelled. That is,((Σ , R − ) , { S } ) recognises L( G ) over Σ \ N . Proof.
The key is that rules and derivations are invertible, which means that if S can be derived from G using the reverse rules, then G can be derived from S using the original rules so is in the language. If S cannot be derived from G ,then G cannot be in the language since that would imply there was a derivationsequence from S to G which we could invert to give a contradiction.We are now ready to define backtracking-free specifications , and show thatsuch systems can test for language membership without backtracking. Definition 5.3 (Backtracking-Free Specification) . Let T = (Σ , R ) be a GTsystem, A ⊆ Σ an input signature, and S a finite set of graphs over Σ. Thenwe say that ( T, S ) is a backtracking-free specification for a language L over A if( T, S ) recognises L over A , T is terminating on G ( A ), and T is confluent on L . Theorem 5.4.
Given a backtracking-free specification ( T, S ) for a language L over A ⊆ Σ and an input graph G over A , the following algorithm is correct:Compute a normal form of G by deriving successor graphs using T as long aspossible. If the result graph is isomorphic to some S ∈ S , the input graph is inthe language. Otherwise, the graph is not in the language. Proof.
Suppose G is not in L . Then, since T is terminating on G ( A ) our algo-rithm must be able to find a normal form of G , say H , and because T recognises L , it must be the case that H is not isomorphic to S , and so the algorithm cor-rectly decides that G is not in L . 21ow, suppose that G is in L . Then, because T is terminating, as before,we must be able to derive some normal form, H . But then, since T is bothconfluent on L and recognises L , it must be the case that H is isomorphic to S ,and so the algorithm correctly decides that G is in L .For the remainder of this section, we look at two examples that demonstratehow we can use our Generalised Newman’s Lemma and Generalised Critical PairLemma to verify if we have a backtracking-free specification for a language, givena grammar that generates the language. Series-parallel graphs were introduced by Duffin [24] as a model of electricalnetworks. A more general version of the class was introduced by Lawler [25]and Monma and Sidney [26] as a model for scheduling problems.
Definition 5.5.
Series-parallel graphs are inductively defined:1. P is a series-parallel graph where s is the source and t the sink .2. The class of series-parallel graphs is closed under parallel composition and sequential composition .where P = s t , parallel composition identifies the two sources and the twosinks, and sequential composition identifies the sink of one with the source ofanother. Figure 23 shows an example series-parallel graph. Figure 23: Example series-parallel graph
Duffin showed that a graph is series-parallel if and only if it can be reducedto P by a sequence of series and parallel reductions. We can rephrase this,giving a graph grammar that generates the language: Theorem 5.6 (SP Recognition [27]) . The class of series-parallel graphs is thelanguage generated by grammar SP = (( { (cid:3) } , { (cid:3) } ) , ( ∅ , ∅ ) , { s, p } , P ).By traditional critical pair analysis, one can establish that the reversed rulesare confluent (Figure 25), however, we run into a problem if we want to considerarbitrarily labelled graphs. Consider the case where the edge alphabet is ofsize 2, rather than size 1. The obvious modification to the rules is to use allcombinations of labels in LHS graphs (Figures 6 and 26), however Hristakievand Plump [28] observed that when doing the equivalent of this in GP 2, we nolonger have confluence. 22 : ← → p : ← → Figure 24: Series-parallel graph generation rules
Pair/Property Joinable StronglyJoinable ⇐ p − ⇒ p −
11 2 1 2 1 2 (cid:51) (cid:51) ⇐ p − ⇒ p −
11 2 1 2 1 2 (cid:51) (cid:51) ⇐ s − ⇒ s −
11 2 1 2 3 1 3 (cid:51) (cid:51) ⇐ s − ⇒ s −
11 3 4 1 2 3 4 1 2 4 (cid:51) (cid:51)
Figure 25: Series-parallel critical pair analysis
Definition 5.7.
The class of labelled series-parallel graphs (LSPs) is all series-parallel graphs, but with arbitrary edge labels chosen from Σ E = { a, b } .The GT system with the 7 rules from Figures 6 and 26 has 26 non-isomorphiccritical pairs. 16 of the critical pairs are conflicts between the sequential reduc-tion rules (Figure 15) and the remaining 10 are conflicts between the parallelreduction rules (Figure 27). The non-joinable pairs confirm we no longer haveconfluence, however the fact that the language of labelled series-parallel graphs is closed under the rules, the rules are terminating, and all the non-garbagecritical pairs are strongly joinable, allows us to conclude the rules are confluentup to garbage on the language of labelled series-parallel graphs . p : ← → aa a p : ← → ab a p : ← → bb a Figure 26: Parallel LSP reduction rules air/Property Joinable StronglyJoinable Non-Garbage ⇐ p ⇒ p
11 2 1 2 1 2 a aa a (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
11 2 1 2 1 2 aa aaa aa (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
21 2 1 2 1 2 ab aab aa (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
21 2 1 2 1 2 ab aab aa (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
21 2 1 2 1 2 ab abb ab (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
21 2 1 2 1 2 ab abb ab (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
31 2 1 2 1 2 ab abb aa (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
31 2 1 2 1 2 ab abb aa (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
31 2 1 2 1 2 a bb a (cid:51) (cid:51) (cid:51) ⇐ p ⇒ p
31 2 1 2 1 2 ab bbb ba (cid:51) (cid:51) (cid:51)
Figure 27: Critical pair analysis of parallel rules
Theorem 5.8 (Backtracking-Free LSP Specification) . Let Σ = ( { (cid:3) } , { a, b } ), T = (Σ , { s , s , s , s , p , p , p } ), P a = a and P b = b . Then ( T, { P a , P b } )is a backtracking-free specification for the labelled series-parallel graphs over Σ. Proof.
We denote by L the language of all labelled series-parallel graphs. Ourrules are structurally the same as the unlabelled rules, so because our LHSgraphs are arbitrarily labelled, language recognition of L over Σ follows fromTheorem 5.6. Formally, our above discussion used Corollary 4.9 to establishthat T is confluent up to garbage on L , as required.Finally, we remark that this construction generalises for arbitrary edge labelalphabets, and not just those of size 2. The number of conflicts is simplymuch larger, however the critical pair analysis will always conclude in the sameway. Thus, we have shown that the obvious generalisation of the series-parallelreduction rules to a non-trivial edge labelling set admits a back-tracking freespecification, even though the system is not confluent.24 .3. Backtracking-Free Specification of Extended Flow Diagrams In 1976, Farrow, Kennedy and Zucconi presented semi-structured flow graphs ,defining a grammar with confluent reduction rules [29]. Plump has considereda restricted version of this language: extended flow diagrams (EFDs) [6]. Thereduction rules for extended flow diagrams are a backtracking-free specificationfor the EFDs, despite not being confluent.Throughout this subsection, we will use a shorthand notation for rules, wherewe assume all interface graphs contain no edges, and any node that appears inthe interface graph will be labelled by a subscript number on both sides ofthe rule, writing only the left-hand side and right-hand side graphs. We alsohighlight persistent nodes within critical pairs in blue, for ease of reading. Thecolouring has no special meaning, other than that.We now define extended flow diagrams using a grammar:
Definition 5.9.
The language of extended flow diagrams is generated by thegrammar EFD = (Σ , N, R , S ) where Σ V = {• , (cid:3) , ♦ } , Σ E = { t, f, (cid:3) } , N V = N E = ∅ (Figure 28), R = { seq, while, ddec, dec , dec } , and S = . Figure 28: EFD grammar rules
Before we show that reversing these rules admits a backtracking-free speci-fication, we first need the following fact:
Lemma 5.10.
Every directed cycle in an EFD contains a t -labelled edge Proof.
By induction.
Theorem 5.11 (Backtracking-Free EFD Specification) . Let T = (Σ , R − ).Then ( T, { S } ) is a backtracking-free specification for L(EFD) over Σ. Proof.
By Theorem 5.2, T recognises L(EFD) over Σ, and one can see that itis terminating since each rule is size reducing. We now proceed by performingcritical pair analysis on T . 25here are ten non-isomorphic critical pairs:1. The pair exactly as in Figure 29;2. The pair in Figure 29 with nodes 1 and 4 identified;3. The pair exactly as in Figure 30;4. The pair in Figure 30 with nodes 1 and 5 identified;5. The pair in Figure 30 with nodes 2 and 5 identified;6. The pair exactly as in Figure 31;7. The pair exactly as in Figure 32;8. The pair in Figure 32 with nodes 1 and 5 identified;9. The pair exactly as in Figure 33;10. The pair exactly as in Figure 34;Pairs 1 through 9 are strongly joinable, and pair 10 is not joinable. Nowobserve that Lemma 5.10 tells us that EFDs cannot contain such cycles. Withthis knowledge, we define D to be all graphs such that directed cycles containat least one t -labelled edge (over Σ).Clearly, D is subgraph closed, and then by our Generalised Critical PairLemma (Theorem 4.8), we have that T is locally confluent on D . Next, it iseasy to see that D is closed under T , so we can use Generalised Newman’sLemma (Theorem 3.11) to conclude confluence on D and thus, by Lemma 3.6, T is confluent on L(EFD).Thus, T is a backtracking-free specification for L(EFD) over Σ, as required. Figure 29: EFD critical pair 1Figure 30: EFD critical pair 3 igure 31: EFD critical pair 6Figure 32: EFD critical pair 7Figure 33: EFD critical pair 9Figure 34: EFD critical pair 10
6. Subcommutativity
In this section, we study critical pair analysis with a view to establish sub-commutativity up to garbage, rather than confluence up to garbage, as previ-ously in Section 3. We have already introduced subcommutativity in Section 2and subcommutativity up to garbage in Section 3.We start by giving the main result of this section:
Theorem 6.1.
Let T = (Σ , R ) and D ⊆ G (Σ). If all T ’s D - non-garbage criticalpairs are strongly subcommutative , then T is subcommutative up to garbage on D . 27 roof. Easy modification of the proof of the original theorem (Theorem 4.8).
Corollary 6.2.
Let T = (Σ , R ) and D ⊆ G (Σ). If all T has no D - non-garbagecritical pairs , then T is subcommutative up to garbage on D .Just as before, it suffices to only analyse the non-isomorphic critical pairs. Anotable difference, however, is that closure and termination are no longer neededto check for joinability, since we are only looking for strong subcommutativityof critical pairs. As noted in Subsection 3.2 however, closedness is required inorder for subcommutativity up to garbage to imply confluence up to garbage.Revisiting our examples in Section 5, all 4 of the critical pairs of the series-parallel reduction system area actually strongly subcommutative, all 18 non-garbage critical pairs of the labelled series-parallel reduction rules are stronglysubcommutative, and so are the 9 non-garbage critical pairs of the extendedflow diagram reduction system.We finish this subsection with a simple example demonstrating terminationis not a requirement to establish subcommutative up to garbage. Example 6.3.
Let D be the language of discrete graphs and T be the GT systemwith the three rules in Figure 35. There are two non-isomorphic critical pairs,all of which are garbage (Figure 36), which allow us to immediately concludesubcommutativity of T up to garbage on D (Theorem 6.1). Notice D is closedunder T , which means T is also confluent to garbage on D (Lemma 3.10).Notice these rules aren’t terminating, even up to garbage on discrete graphs,thus naive machine checking for strong joinability of these pairs would not ter-minate, however we only need to check for subcommutativity. r : ← → r : ← ∅ → r : ← ∅ → ∅ Figure 35: Rules for Example 6.3
Pair/Property Strongly Sub-commutative Non-Garbage ⇐ r ⇒ r
21 1 (cid:51) (cid:51) ⇐ r ⇒ r ∅ (cid:55) (cid:55) Figure 36: Critical pair analysis for Example 6.3 . Conclusion and Future Work In this paper we have introduced local confluence, confluence, subcommuta-tivity, and termination up to garbage for DPO graph transformation systems,and shown that Newmann’s Lemma and Plump’s Critical Pair Lemma can begeneralised, providing us with checkable conditions for confluence and subcom-mutativity up to garbage, using only critical pairs. Of course, confluence up togarbage of terminating graph transformation systems is undecidable in general,however, now we can detect more positive cases of confluence up to garbageusing non-garbage critical pair analysis, where we previously would have beenunable to draw a conclusion due to non-strong joinability of some critical pairs.We have directly applied our results to recognition of languages, lookingspecifically at the class of extended flow diagrams and the class of labelled series-parallel graphs. We have backtracking-free algorithms that apply reductionrules as long as possible, with correctness established via non-garbage criticalpair analysis. We also anticipate there to be other applications, since there aremany other reasons one would want to show confluence up to garbage, such asconsidering GT systems as computing functions where we restrict the domain[11]. Indeed, one might only be interested in the non-garbage critical pairsthemselves, and classification of conflicts [30, 31].
Our results also work if we relax the injectivity requirement of the K → R morphism in rules. One should note that the two equivalent definitions ofparallel independence we have in Subsection 2.5 were specialised for injectiverules only. More generally, two direct derivations H ⇐ r ,g G ⇒ r ,g H are parallelly independent if there are morphisms L → D and L → D such that L → D → G = L → G , L → D → G = L → G , L → D → H isinjective, and L → D → H is injective [11].Our results also work in the setting of hypergraph transformation, as wellas just graph transformation, with almost identical proofs. We think it is ex-tremely likely our results hold for any M -adhesive system with the usual re-strictions [32], by modification of the original proof of the Generalised CriticalLemma from Campbell’s BSc Thesis [9], which operates by showing complete-ness of the non-garbage critical pairs. In an unpublished report, we have alsoshown that these results hold for graph transformation with relabelling [33],which is important, since the setting is not M -adhesive [34] and is the graphtransformation framework used by GP 2 [35, 36]. Confluence analysis of GT systems (and related systems) still remains a gen-erally under-explored area. One obvious piece of future work is to investigate theconnection to the work by Lambers, Ehrig and Orejas on essential critical pairs [37] and the continued work by others including Born and Taentzer [30]. Thatsaid, all of our examples exhibit only essential critical pairs, so non-essentialcritical pair analysis only has the effect of slowing down the analysis.29t is also not obvious if there is a relation between confluence up to garbageand graphs satisfying negative constraints [38]. Moreover, developing a strongerversion of the Generalised Critical Pair Lemma that allows for the detectionof persistent nodes that need not be identified in the joined graph would allowconclusions of confluence up to garbage where it was previously not determined.Future work also includes developing further checkable sufficient conditionsunder which one can decide if a graph is in the subgraph closure of a language,beyond those in Subsection 4.3. Finally, applying our theory in a rooted contextand to GP 2 is future work [36]. It is likely that the theory will be applicablethere, since program preconditions correspond exactly to non-garbage input,and so it is only natural to be interested in confluence up to garbage, ratherthan confluence. We would also expect there to be analogues of our results forother kinds of rewriting systems such as string and term rewriting.
References [1] H. Ehrig, M. Pfender, H. Schneider, Graph-grammars: An algebraic ap-proach, in: Proc. 14th Annual Symposium on Switching and AutomataTheory (SWAT 1973), IEEE, 1973, pp. 167–180. doi:10.1109/SWAT.1973.11 .[2] H. Ehrig, K. Ehrig, U. Prange, G. Taentzer, Fundamentals of AlgebraicGraph Transformation, Monographs in Theoretical Computer Science. AnEATCS Series, Springer, 2006. doi:10.1007/3-540-31188-2 .[3] A. Bakewell, D. Plump, C. Runciman, Specifying pointer structures bygraph reduction, Tech. rep., Department of Computer Science, Universityof York, UK (2003).URL [4] D. Plump, Term Graph Rewriting, World Scientific, 1999, pp. 3–61. doi:10.1142/9789812815149_0001 .[5] D. Plump, Hypergraph rewriting: Critical pairs and undecidability of con-fluence, in: Term Graph Rewriting, John Wiley and Sons, 1993, pp. 201–213.[6] D. Plump, Confluence of Graph Transformation Revisited, Vol. 3838 ofLecture Notes in Computer Science, Springer, 2005, pp. 280–308. doi:10.1007/11601548_16 .[7] M. Newman, On theories with a combinatorial definition of ”equivalence”,Annals of Mathematics 43 (2) (1942) 223–243. doi:10.2307/1968867 .[8] G. Campbell, D. Plump, Confluence up to garbage, in: F. Gadducci,T. Kehrer (Eds.), Proc. 13th International Conference on Graph Trans-formation (ICGT 2020), Vol. 12150 of Lecture Notes in Computer Science,Springer, 2020, pp. 20–37. doi:10.1007/978-3-030-51372-6_2 .309] G. Campbell, Efficient graph rewriting, BSc thesis, Department of Com-puter Science, University of York, UK (2019).URL https://arxiv.org/abs/1906.05170 [10] F. Baader, T. Nipkow, Term Rewriting and All That, Cambridge UniversityPress, 1998.[11] A. Habel, J. M¨uller, D. Plump, Double-pushout graph transformation revis-ited, Mathematical Structures in Computer Science 11 (5) (2001) 637–688. doi:10.1017/S0960129501003425 .[12] D. Knuth, P. Bendix, Simple word problems in universal algebras, in: Com-putational Problems in Abstract Algebras, Pergamon Press, 1970, pp. 263–297. doi:10.1016/B978-0-08-012975-4.50028-X .[13] G. Huet, Confluent reductions: Abstract properties and applications toterm rewriting systems, Journal of the ACM 27 (4) (1980) 797–821. doi:10.1145/322217.322230 .[14] H. Ehrig, H.-J. Kreowski, Parallelism of manipulations in multidimensionalinformation structures, in: Proc. 5th Symposium on Mathematical Founda-tions of Computer Science (MFCS 1976), Vol. 45 of Lecture Notes in Com-puter Science, Springer, 1976, pp. 284–293. doi:10.1007/3-540-07854-1_188 .[15] D. Plump, Computing by graph rewriting, Habilitation thesis, Universit¨atBremen, Fachbereich Mathematik und Informatik (1999).[16] B. Courcelle, The monadic second-order logic of graphs: Definable sets offinite graphs, in: Proc. 14th International Workshop on Graph-TheoreticConcepts in Computer Science (WG ’88), Vol. 344 of Lecture Notes in Com-puter Science, Springer, 1989, pp. 30–53. doi:10.1007/3-540-50728-0_34 .[17] P. Fradet, D. L. M´etayer, Structured Gamma, Science of ComputerProgramming 31 (2–3) (1998) 263–289. doi:10.1016/S0167-6423(97)00023-3 .[18] J. Berstel, Transductions and Context-Free Languages, Vieweg+Teubner,1979. doi:10.1007/978-3-663-09367-1 .[19] A.-C. Caron, Linear bounded automata and rewrite systems: Influence ofinitial configurations on decision properties, in: Proc. International JointConference on Theory and Practice of Software Development (TAPSOFT’91). CAAP 1991, Vol. 493 of Lecture Notes in Computer Science, Springer,1991, pp. 74–89. doi:10.1007/3-540-53982-4_5 .[20] S. Skiena, The Algorithm Design Manual, 2nd Edition, Springer, 2008. doi:10.1007/978-1-84800-070-4 .3121] H. Bodlaender, A linear-time algorithm for finding tree-decompositions ofsmall treewidth, SIAM Journal on Computing 25 (6) (1996) 1305–1317. doi:10.1137/S0097539793251219 .[22] A. Corradini, B. K¨onig, D. Nolte, Specifying graph languages with typegraphs, Journal of Logical and Algebraic Methods in Programming 104(2019) 176–200. doi:10.1016/j.jlamp.2019.01.005 .[23] A. Bakewell, D. Plump, C. Runciman, Specifying pointer structures bygraph reduction, in: Proc. Second International Workshop on Applicationsof Graph Transformations with Industrial Relevance (AGTIVE 2003), Vol.3062 of Lecture Notes in Computer Science, Springer, 2004, pp. 30–44. doi:10.1007/978-3-540-25959-6_3 .[24] R. J. Duffin, Topology of series-parallel networks, Journal of Mathemat-ical Analysis and Applications 10 (2) (1965) 303–318. doi:10.1016/0022-247X(65)90125-3 .[25] E. Lawler, Sequencing jobs to minimize total weighted completion timesubject to precedence constraints, Annals of Discrete Mathematics 2 (1978)75–90. doi:10.1016/S0167-5060(08)70323-6 .[26] C. Monma, J. Sidney, Sequencing with series-parallel precedence con-straints, Mathematics of Operations Research 4 (3) (1979) 215–224. doi:10.1287/moor.4.3.215 .[27] D. Plump, Reasoning about graph programs, in: Proc. 9th InternationalWorkshop on Computing with Terms and Graphs (TERMGRAPH 2016),Vol. 225 of Electronic Proceedings in Theoretical Computer Science, OpenPublishing Association, 2016, pp. 35–44. doi:10.4204/EPTCS.225.6 .[28] I. Hristakiev, D. Plump, Checking graph programs for confluence, in:Software Technologies: Applications and Foundations – STAF 2017 Col-located Workshops, Revised Selected Papers, Vol. 10748 of LectureNotes in Computer Science, Springer, 2018, pp. 92–108. doi:10.1007/978-3-319-74730-9_8 .[29] R. Farrow, K. Kennedy, L. Zucconi, Graph grammars and global programdata flow analysis, in: Proc. 17th Annual Symposium on Foundations ofComputer Science (SFCS 1976), IEEE, 1976, pp. 42–56. doi:10.1109/SFCS.1976.17 .[30] L. Lambers, K. Born, F. Orejas, D. Str¨uber, G. Taentzer, Initial Con-flicts and Dependencies: Critical Pairs Revisited, Vol. 10800 of LectureNotes in Computer Science, Springer, 2018, pp. 105–123. doi:10.1007/978-3-319-75396-6_6 .[31] L. Lambers, J. Kosiol, D. Str¨uber, G. Taentzer, Exploring conflict rea-sons for graph transformation systems, in: Proc. 12th International Con-ference on Graph Transformation (ICGT 2019), Vol. 11629 of Lecture32otes in Computer Science, Springer, 2019, pp. 75–92. doi:10.1007/978-3-030-23611-3_5 .[32] H. Ehrig, U. Golas, A. Habel, L. Lambers, F. Orejas, M -adhesive transfor-mation systems with nested application conditions. Part 2: Embedding,critical pairs and local confluence, Fundamenta Informaticae 118 (1–2)(2012) 35–63. doi:10.3233/FI-2012-705 .[33] G. Campbell, D. Plump, Efficient recognition of graph languages, Tech.rep., Department of Computer Science, University of York, UK (2019).URL https://arxiv.org/abs/1911.12884 [34] A. Habel, D. Plump, M , N -adhesive transformation systems, in: H. Ehrig,G. Engels, H.-J. Kreowski, G. Rozenberg (Eds.), Proc. 6th InternationalConference on Graph Transformation (ICGT 2012), Vol. 7562 of LectureNotes in Computer Science, Springer, 2012, pp. 218–233. doi:10.1007/978-3-642-33654-6_15 .[35] D. Plump, The design of GP 2, in: S. Escobar (Ed.), Proc. 10th In-ternational Workshop on Reduction Strategies in Rewriting and Pro-gramming (WRS 2011), Vol. 82 of Electronic Proceedings in Theoret-ical Computer Science, Open Publishing Association, 2012, pp. 1–16. doi:10.4204/EPTCS.82.1 .[36] C. Bak, GP 2: Efficient implementation of a graph programming language,Ph.D. thesis, Department of Computer Science, University of York, UK(2015).URL https://etheses.whiterose.ac.uk/12586/ [37] L. Lambers, H. Ehrig, F. Orejas, Efficient conflict detection in graph trans-formation systems by essential critical pairs, in: Proc. Fifth InternationalWorkshop on Graph Transformation and Visual Modeling Techniques (GT-VMT 2006), Vol. 211 of Electronic Notes in Theoretical Computer Science,Elsevier, 2008, pp. 17–26. doi:10.1016/j.entcs.2008.04.026 .[38] L. Lambers, Certifying rule-based models using graph transformation,Ph.D. thesis, Technical University of Berlin, Elektrotechnik und Informatik(2009).URL https://dx.doi.org/10.14279/depositonce-2348https://dx.doi.org/10.14279/depositonce-2348