Checking Graph-Transformation Systems for Confluence Detlef Plump
Hypergraphs E TOP Λ TRUE 1 3 PUSH EMPTY? data stack bool 2 FALSE F POP
Hypergraphs E TOP Λ TRUE 1 3 PUSH EMPTY? data stack bool 2 FALSE F POP ◮ Signature Σ = � Σ V , Σ E , Type : Σ E → P (Σ ∗ V ) � where Σ V and Σ E are sets of vertex labels and hyperedge labels
Hypergraphs E TOP Λ TRUE 1 3 PUSH EMPTY? data stack bool 2 FALSE F POP ◮ Signature Σ = � Σ V , Σ E , Type : Σ E → P (Σ ∗ V ) � where Σ V and Σ E are sets of vertex labels and hyperedge labels ◮ Hypergraph G = � V , E , l V : V → Σ V , l E : E → Σ E , att : E → V ∗ � where V , E are finite sets of vertices and hyperedges, and l ∗ V ( att ( e )) ∈ Type ( l E ( e )) for each hyperedge e
Hypergraphs E TOP Λ TRUE 1 3 PUSH EMPTY? data stack bool 2 FALSE F POP ◮ Signature Σ = � Σ V , Σ E , Type : Σ E → P (Σ ∗ V ) � where Σ V and Σ E are sets of vertex labels and hyperedge labels ◮ Hypergraph G = � V , E , l V : V → Σ V , l E : E → Σ E , att : E → V ∗ � where V , E are finite sets of vertices and hyperedges, and l ∗ V ( att ( e )) ∈ Type ( l E ( e )) for each hyperedge e ◮ Graph G : all hyperedges e satisfy | att ( e ) | = 2
Rules (injective case) ◮ Rule : � L ⊇ K ⊆ R � 1 1 1 ⊇ ⊆ 2 2 2
Rules (injective case) ◮ Rule : � L ⊇ K ⊆ R � 1 1 1 ⊇ ⊆ 2 2 2 ◮ Intuition: remove L − K and add R − K
Rules (injective case) ◮ Rule : � L ⊇ K ⊆ R � 1 1 1 ⊇ ⊆ 2 2 2 ◮ Intuition: remove L − K and add R − K ◮ Short notation: L ⇒ R 1 1 ⇒ 2 2
Direct derivation G ⇒ r , g H Given r : � L ⊇ K ⊆ R � and injective morphism g : L → G 1 1 1 ⊇ ⊆ 2 2 2 g ↓ 1 2
Direct derivation G ⇒ r , g H Given r : � L ⊇ K ⊆ R � and injective morphism g : L → G 1 1 1 ⊇ ⊆ 2 2 2 g ↓ 1 2 1. Check dangling condition : nodes in g ( L − K ) are not incident to edges outside g ( L )
Direct derivation G ⇒ r , g H Given r : � L ⊇ K ⊆ R � and injective morphism g : L → G 1 1 1 ⊇ ⊆ 2 2 2 g ↓ ↓ 1 1 ⊇ 2 2 1. Check dangling condition : nodes in g ( L − K ) are not incident to edges outside g ( L ) 2. Remove g ( L − K )
Direct derivation G ⇒ r , g H Given r : � L ⊇ K ⊆ R � and injective morphism g : L → G 1 1 1 ⊇ ⊆ 2 2 2 g ↓ ↓ ↓ 1 1 1 ⊇ ⊆ 2 2 2 1. Check dangling condition : nodes in g ( L − K ) are not incident to edges outside g ( L ) 2. Remove g ( L − K ) 3. Add R − K
Hypergraph-transformation systems Hypergraph-transformation system � Σ , R� ◮ Σ: signature ◮ R : set of rules over Σ Graph-transformation system � Σ , R� ◮ for each label l ∈ Σ E and each w ∈ Type ( l ), | w | = 2
Example: reduction rules for control-flow graphs 1 1 1 1 seq : ⇒ ⇒ while : 2 2 2 2 1 1 1 1 ⇒ ⇒ 2 dec1 : dec2 : 2 3 2 2 3
Confluence A hypergraph-transformation system � Σ , R� is confluent if for all hypergraphs G , H 1 , H 2 over Σ, H 1 ⇐ ∗ R G ⇒ ∗ R H 2 implies that there is a hypergraph M such that H 1 ⇒ ∗ R M ⇐ ∗ R H 2 . G = = ∗ ∗ ⇐ ⇒ R R H 1 H 2 = = ∗ ∗ ⇒ ⇐ R R M
Confluence A hypergraph-transformation system � Σ , R� is confluent if for all hypergraphs G , H 1 , H 2 over Σ, H 1 ⇐ ∗ R G ⇒ ∗ R H 2 implies that there is a hypergraph M such that H 1 ⇒ ∗ R M ⇐ ∗ R H 2 . G = = ∗ ∗ ⇐ ⇒ R R H 1 H 2 = = ∗ ∗ ⇒ ⇐ R R M Note: Confluence implies that every hypergraph can be reduced to at most one irreducible hypergraph (up to isomorphism). The converse does not hold.
Local confluence A hypergraph-transformation system � Σ , R� is locally confluent if for all hypergraphs G , H 1 , H 2 over Σ, H 1 ⇐ R G ⇒ R H 2 implies that there is a hypergraph M such that H 1 ⇒ ∗ R M ⇐ ∗ R H 2 . G = = ⇐ ⇒ R R H 1 H 2 = = ∗ ∗ ⇒ ⇐ R R M
Local confluence does not imply confluence Counterexample: r 1 : a ⇒ b r 2 : a ⇒ c R r 3 : ⇒ c a r 4 : c ⇒ d The system is locally confluent but not confluent: ⇒ ⇐ a c ⇒ r 2 b d r 1 r 4 ⇐ r 3
Termination and confluence A hypergraph-transformation system � Σ , R� is terminating if there is no infinite sequence G 0 ⇒ R G 1 ⇒ R G 2 ⇒ R . . . Theorem (Newman’s lemma) A terminating hypergraph-transformation system is confluent if and only if it is locally confluent.
Critical pairs (for injective rules) Direct derivations T 1 ⇐ r 1 , g 1 S ⇒ r 2 , g 2 T 2 are a critical pair if 1. S = g 1 ( L 1 ) ∪ g 2 ( L 2 ) and 2. the steps are not independent, that is, S ⇒ r 1 , g 1 T 1 removes an item in g 2 ( L 2 ) or S ⇒ r 2 , g 2 T 2 removes an item in g 1 ( L 1 ). Also, if r 1 = r 2 then g 1 � = g 2 must hold.
Critical pairs (for injective rules) Direct derivations T 1 ⇐ r 1 , g 1 S ⇒ r 2 , g 2 T 2 are a critical pair if 1. S = g 1 ( L 1 ) ∪ g 2 ( L 2 ) and 2. the steps are not independent, that is, S ⇒ r 1 , g 1 T 1 removes an item in g 2 ( L 2 ) or S ⇒ r 2 , g 2 T 2 removes an item in g 1 ( L 1 ). Also, if r 1 = r 2 then g 1 � = g 2 must hold. Note: Hypergraph-transformation systems with finitely many rules possess only finitely many critical pairs (up to isomorphism).
Example: critical pairs of control-flow reduction rules (1) w w w x ⇐ ⇒ y x seq seq y z z z x x x y ⇐ ⇒ y z seq seq z
Example: critical pairs of control-flow reduction rules (2) w w w ⇐ ⇒ y x y x z while dec2 ⇒ ⇐ z z while seq w z
Example: critical pairs of control-flow reduction rules (3) v v v ⇒ ⇐ y w w x w x seq dec2 y z z z
Example: critical pairs of control-flow reduction rules (4) v v v ⇒ ⇐ y w w x w x seq dec2 y v v v ⇒ ⇐ y w w x w x seq dec2 y
Joinability Given a hypergraph-transformation system � Σ , R� , a critical pair T 1 ⇐ S ⇒ T 2 is joinable if there is a hypergraph U such that T 1 ⇒ ∗ R U ⇐ ∗ R T 2 . S = = ⇐ ⇒ T 1 T 2 = = ∗ ∗ ⇒ ⇐ R R U
Joinability is insufficient Joinability of all critical pairs does not guarantee local confluence: a a r 1 : r 2 : ⇒ ⇒ b b 1 2 1 2 1 2 1 2 The only critical pair is joinable: a b b ⇐ ⇒ 1 2 1 2 1 2 r 1 r 2 But � Σ , { r 1 , r 2 }� is not locally confluent: a b b b b ⇐ ⇒ 1 2 1 2 1 2 r 1 r 2 b
Strong joinability For a critical pair Γ: T 1 ⇐ S ⇒ T 2 , define Persist (Γ) = { v ∈ S V | S ⇒ T 1 and S ⇒ T 2 preserve v } . Given a hypergraph-transformation system � Σ , R� , a critical pair Γ: T 1 ⇐ S ⇒ T 2 is strongly joinable if there are a hypergraph U and derivations T 1 ⇒ ∗ R U ⇐ ∗ R T 2 such that for each v ∈ Persist (Γ), tr S ⇒ T 1 ⇒ ∗ U ( v ) and tr S ⇒ T 2 ⇒ ∗ U ( v ) are defined and equal. Here tr S ⇒ T 1 ⇒ ∗ U : S → U and tr S ⇒ T 2 ⇒ ∗ U : S → U are partial morphisms that, informally, track the items in S through the derivations S ⇒ T 1 ⇒ ∗ U and S ⇒ T 2 ⇒ ∗ U .
Critical pair lemma Theorem (Critical pair lemma [P 93]) A hypergraph-transformation system is locally confluent if all its critical pairs are strongly joinable. Corollary A terminating hypergraph-transformation system is confluent if all its critical pairs are strongly joinable.
Confluence does not imply strong joinability The system r 1 : ⇒ 1 2 1 2 ⇒ r 2 : 1 2 1 2 is terminating and confluent but the critical pair ⇐ ⇒ 1 2 1 2 1 2 r 1 r 1 is not strongly joinable
Bad news: confluence is undecidable Theorem ([P 93/05]) The following problem is undecidable in general: Instance: A terminating graph transformation system � Σ , R� where Σ V is a singleton and Σ E and R are finite. Question: Is � Σ , R� confluent?
Subhypergraphs G R and G ⊖ Let � Σ , R� be a hypergraph-transformation system and G a hypergraph over Σ. ◮ For e ∈ E G , the pair � l E ( e ) , l ∗ V ( att G ( e )) � is the profile of e . ◮ Prof ( R ) is the set of all hyperedge profiles occurring in R . ◮ VL ( R ) is the set of all vertex labels occurring in R . Define subhypergraphs G R and G ⊖ of G as follows. ◮ G R consists of all hyperedges with profile in Prof ( R ) and all nodes with label in VL ( R ). ◮ G ⊖ consists of all hyperedges in E G − Prof ( R ), all attachment nodes of these hyperedges, and all nodes in V G − VL ( R ). Note that G = G R ∪ G ⊖ , where G R and G ⊖ may share some attachment nodes of hyperedges in G ⊖ .
Covering critical pairs A cover for a critical pair Γ is a hypergraph C such that (1) Persist Γ ⊆ C , (2) C ⊖ = C , and (3) for every homomorphic image ˜ C of C , there is a unique surjective morphism C → ˜ C . Remarks: 1. (1) and (2) imply that each node in Persist Γ is incident to some hyperedge in C . 2. Intuitively, C uniquely identifies the nodes in Persist Γ in that for every image ˜ C of C , each node in Persist Γ corresponds to a unique node in ˜ C . 3. By (3), C does not possess nontrivial automorphisms.
Recommend
More recommend