Checking Graph-Transformation Systems for Confluence Detlef Plump - - PowerPoint PPT Presentation

checking graph transformation systems for confluence
SMART_READER_LITE
LIVE PREVIEW

Checking Graph-Transformation Systems for Confluence Detlef Plump - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Checking Graph-Transformation Systems for Confluence

Detlef Plump

slide-2
SLIDE 2

Hypergraphs

data stack bool E F TOP PUSH

1 2 3

Λ POP EMPTY? TRUE FALSE

slide-3
SLIDE 3

Hypergraphs

data stack bool E F TOP PUSH

1 2 3

Λ POP EMPTY? TRUE FALSE

◮ Signature Σ = ΣV, ΣE, Type: ΣE → P(Σ∗ V) where ΣV and

ΣE are sets of vertex labels and hyperedge labels

slide-4
SLIDE 4

Hypergraphs

data stack bool E F TOP PUSH

1 2 3

Λ POP EMPTY? TRUE FALSE

◮ Signature Σ = ΣV, ΣE, Type: ΣE → P(Σ∗ V) where ΣV and

ΣE are sets of vertex labels and hyperedge labels

◮ Hypergraph

G = V, E, lV : V → ΣV, lE : E → ΣE, att: E → V∗ where V, E are finite sets of vertices and hyperedges, and l∗

V(att(e)) ∈ Type(lE(e)) for each hyperedge e

slide-5
SLIDE 5

Hypergraphs

data stack bool E F TOP PUSH

1 2 3

Λ POP EMPTY? TRUE FALSE

◮ Signature Σ = ΣV, ΣE, Type: ΣE → P(Σ∗ V) where ΣV and

ΣE are sets of vertex labels and hyperedge labels

◮ Hypergraph

G = V, E, lV : V → ΣV, lE : E → ΣE, att: E → V∗ where V, E are finite sets of vertices and hyperedges, and l∗

V(att(e)) ∈ Type(lE(e)) for each hyperedge e ◮ Graph G: all hyperedges e satisfy |att(e)| = 2

slide-6
SLIDE 6

Rules (injective case)

◮ Rule: L ⊇ K ⊆ R

2 1

2 1

2 1

slide-7
SLIDE 7

Rules (injective case)

◮ Rule: L ⊇ K ⊆ R

2 1

2 1

2 1

◮ Intuition: remove L − K and add R − K

slide-8
SLIDE 8

Rules (injective case)

◮ Rule: L ⊇ K ⊆ R

2 1

2 1

2 1

◮ Intuition: remove L − K and add R − K ◮ Short notation: L ⇒ R

2 1

2 1

slide-9
SLIDE 9

Direct derivation G ⇒r,g H

Given r : L ⊇ K ⊆ R and injective morphism g : L → G

2 1

2 1

2 1

g ↓

2 1

slide-10
SLIDE 10

Direct derivation G ⇒r,g H

Given r : L ⊇ K ⊆ R and injective morphism g : L → G

2 1

2 1

2 1

g ↓

2 1

  • 1. Check dangling condition: nodes in g(L − K) are not incident

to edges outside g(L)

slide-11
SLIDE 11

Direct derivation G ⇒r,g H

Given r : L ⊇ K ⊆ R and injective morphism g : L → G

2 1

2 1

2 1

g ↓

2 1

1 2

  • 1. Check dangling condition: nodes in g(L − K) are not incident

to edges outside g(L)

  • 2. Remove g(L − K)
slide-12
SLIDE 12

Direct derivation G ⇒r,g H

Given r : L ⊇ K ⊆ R and injective morphism g : L → G

2 1

2 1

2 1

g ↓

↓ ↓

2 1

1 2

1 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
slide-13
SLIDE 13

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

slide-14
SLIDE 14

Example: reduction rules for control-flow graphs

seq:

1 2

2 1

while:

2 1

2 1

dec1:

2 1

2 1

dec2:

2 3 1

2 3 1

slide-15
SLIDE 15

Confluence

A hypergraph-transformation system Σ, R is confluent if for all hypergraphs G, H1, H2 over Σ, H1 ⇐∗

R G ⇒∗ R H2 implies that

there is a hypergraph M such that H1 ⇒∗

R M ⇐∗ R H2.

G H1 H2 M

⇐ =

R ∗

= ⇒

R ∗

= ⇒

R ∗

⇐ =

R

slide-16
SLIDE 16

Confluence

A hypergraph-transformation system Σ, R is confluent if for all hypergraphs G, H1, H2 over Σ, H1 ⇐∗

R G ⇒∗ R H2 implies that

there is a hypergraph M such that H1 ⇒∗

R M ⇐∗ R H2.

G H1 H2 M

⇐ =

R ∗

= ⇒

R ∗

= ⇒

R ∗

⇐ =

R

Note: Confluence implies that every hypergraph can be reduced to at most one irreducible hypergraph (up to isomorphism). The converse does not hold.

slide-17
SLIDE 17

Local confluence

A hypergraph-transformation system Σ, R is locally confluent if for all hypergraphs G, H1, H2 over Σ, H1 ⇐R G ⇒R H2 implies that there is a hypergraph M such that H1 ⇒∗

R M ⇐∗ R H2.

G H1 H2 M ⇐ =

R

= ⇒

R ∗

= ⇒

R ∗

⇐ =

R

slide-18
SLIDE 18

Local confluence does not imply confluence

Counterexample: R            r1 : a ⇒ b r2 : a ⇒ c r3 : c ⇒ a r4 : c ⇒ d The system is locally confluent but not confluent: b ⇐

r1

a ⇒

r2

r3

c ⇒

r4

d

slide-19
SLIDE 19

Termination and confluence

A hypergraph-transformation system Σ, R is terminating if there is no infinite sequence G0 ⇒R G1 ⇒R G2 ⇒R . . .

Theorem (Newman’s lemma)

A terminating hypergraph-transformation system is confluent if and only if it is locally confluent.

slide-20
SLIDE 20

Critical pairs (for injective rules)

Direct derivations T1 ⇐r1,g1 S ⇒r2,g2 T2 are a critical pair if

  • 1. S = g1(L1) ∪ g2(L2) and
  • 2. the steps are not independent, that is, S ⇒r1,g1 T1 removes

an item in g2(L2) or S ⇒r2,g2 T2 removes an item in g1(L1). Also, if r1 = r2 then g1 = g2 must hold.

slide-21
SLIDE 21

Critical pairs (for injective rules)

Direct derivations T1 ⇐r1,g1 S ⇒r2,g2 T2 are a critical pair if

  • 1. S = g1(L1) ∪ g2(L2) and
  • 2. the steps are not independent, that is, S ⇒r1,g1 T1 removes

an item in g2(L2) or S ⇒r2,g2 T2 removes an item in g1(L1). Also, if r1 = r2 then g1 = g2 must hold. Note: Hypergraph-transformation systems with finitely many rules possess only finitely many critical pairs (up to isomorphism).

slide-22
SLIDE 22

Example: critical pairs of control-flow reduction rules (1)

w y z

seq w x y z

seq w x z x z

seq x y z

seq x y

slide-23
SLIDE 23

Example: critical pairs of control-flow reduction rules (2)

w y z

while

seq x y w z z w

dec2

while x z w

slide-24
SLIDE 24

Example: critical pairs of control-flow reduction rules (3)

w y v z

dec2 w x v y z

seq w x v z

slide-25
SLIDE 25

Example: critical pairs of control-flow reduction rules (4)

w y v

dec2 w x v y

seq w x v w y v

dec2 w x v y

seq w x v

slide-26
SLIDE 26

Joinability

Given a hypergraph-transformation system Σ, R, a critical pair T1 ⇐ S ⇒ T2 is joinable if there is a hypergraph U such that T1 ⇒∗

R U ⇐∗ R T2.

S T1 T2 U ⇐ = = ⇒

= ⇒

R ∗

⇐ =

R

slide-27
SLIDE 27

Joinability is insufficient

Joinability of all critical pairs does not guarantee local confluence:

r1 :

1 2

a ⇒

1 2

b r2 :

1 2

a ⇒

1 2

b

The only critical pair is joinable:

1 2

b ⇐

r1

1 2

a ⇒

r2

1 2

b

But Σ, {r1, r2} is not locally confluent:

1 2

b b ⇐

r1

1 2

a b ⇒

r2

1 2

b b

slide-28
SLIDE 28

Strong joinability

For a critical pair Γ: T1 ⇐ S ⇒ T2, define Persist(Γ) = {v ∈ SV | S ⇒ T1 and S ⇒ T2 preserve v}. Given a hypergraph-transformation system Σ, R, a critical pair Γ: T1 ⇐ S ⇒ T2 is strongly joinable if there are a hypergraph U and derivations T1 ⇒∗

R U ⇐∗ R T2 such that for each

v ∈ Persist(Γ), trS⇒T1⇒∗U(v) and trS⇒T2⇒∗U(v) are defined and equal. Here trS⇒T1⇒∗U : S → U and trS⇒T2⇒∗U : S → U are partial morphisms that, informally, track the items in S through the derivations S ⇒ T1 ⇒∗ U and S ⇒ T2 ⇒∗ U.

slide-29
SLIDE 29

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.

slide-30
SLIDE 30

Confluence does not imply strong joinability

The system r1 :

1 2

1 2

r2 :

1 2

1 2

is terminating and confluent but the critical pair

1 2

r1

1 2

r1

1 2

is not strongly joinable

slide-31
SLIDE 31

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?

slide-32
SLIDE 32

Subhypergraphs G R and G ⊖

Let Σ, R be a hypergraph-transformation system and G a hypergraph over Σ.

◮ For e ∈ EG, the pair lE(e), l∗ V(attG(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 EG − Prof(R), all

attachment nodes of these hyperedges, and all nodes in VG − VL(R). Note that G = G R ∪ G ⊖, where G R and G ⊖ may share some attachment nodes of hyperedges in G ⊖.

slide-33
SLIDE 33

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.
slide-34
SLIDE 34

Example: covers

Let Γ be a critical pair such that PersistΓ = {v1, . . . , vn} and lV(vi) = mi.

◮ If there is l ∈ ΣE such that m1 . . . mn ∈ Type(l) and

l, m1 . . . mn ∈ Prof(R), then the following is a cover for Γ: l

1

m1

. . . . . .

n

mn

◮ Alternatively, if there are distinct labels l1, . . . , ln−1 ∈ ΣE such

that for i = 1, . . . , n − 1, mimi+1 ∈ Type(li) and li, mimi+1 ∈ Prof(R), then the following is a graph cover for Γ: m1 m2 l1 l2

. . .

ln−1 mn

slide-35
SLIDE 35

Coverable systems

A hypergraph-transformation system is coverable if for each of its critical pairs there exists a cover.

Theorem

A coverable hypergraph-transformation system is locally confluent if and only if all its critical pairs are strongly joinable. Consider now systems Σ, R in which ΣV, ΣE and R are finite.

Corollary

(1) Confluence is decidable for terminating coverable systems. (2) Confluence is decidable for terminating systems with universal signatures.

slide-36
SLIDE 36

Decision procedure for confluence

Input: a terminating and coverable hypergraph-transformation system Σ, R and its set of critical pairs CP for all Γ: U1 ⇐r1,g1 S ⇒r2,g2 U2 in CP do {let C be a cover for Γ such that S ∩ C = PersistΓ}

  • S := S ∪ C

{for i = 1, 2, let gi be the extension of gi to S} for i = 1 to 2 do construct a derivation S ⇒ri,b

gi

Ui ⇒∗

R Xi such that Xi is

irreducible end for ifX1 ∼ = X2 then return “non-confluent” end if end for return “confluent”

slide-37
SLIDE 37

Example: extended critical pair

w y z

1 2

while

seq x y

1 2

w z

dec2

while x z

1 2

w z w

1 2

slide-38
SLIDE 38

Future work

◮ Extend the checking algorithm to a partial decision procedure

for arbitrary terminating systems: add a hyperedge label to an input system such that all critical pairs can be covered and run the algorithm as before. If all extended pairs are joinable, then the (original) system is confluent. If a non-joinable extended pair is encountered whose underlying pair is joinable, then the procedure has to give up.

◮ Implement critical-pair generation and checking. ◮ How to check confluence for graph programs?!