i-neighbourhood abstraction in graph transformation arend rensink university of twente based on work...

29
i-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus Kurban AHA, Berlin, July 2007

Upload: delilah-henderson

Post on 04-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

i-Neighbourhood Abstraction in

Graph TransformationArend Rensink

University of Twente

Based on work with:Jörg Bauer, Iovka Boneva, Dino Distefano,

Marcus Kurban

AHA, Berlin, July 2007

Page 2: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation2

Outline

• Setting– Graphs, rules, productions

• Abstraction– Quotients, neighbourhoods, shapes

• Logic– Modalities, preservation

• Framework– Extraction, transformation, normalization

• Conclusion– Future work

Page 3: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation3

Setting

• System specification: Graph grammar– Graph transformation rules + start graph– May be generated from specification or

programming language, or given directly• Requirements: LTL properties– Propositions are predicates over graphs

• Verification: model checking– States = graphs, transitions = productions

• Problem: the usual– Very large or infinite state spaces– Genericity of analysis

Page 4: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation4

Graph formalism

• Graphs in this presentation:– Directed, edge-labelled– Simple (no parallel identically labelled

edges)– Flat (not hierarchical)

• Formally: G = (N,E) with– L universe of labels– N finite set of nodes– E N L N? finite set of labelled edges

((v,a,?) is effectively a node label)• Morphisms (partial/total)– Structure-preserving node mappings

Page 5: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation5

LHS

Rule formalism

• LHS is matched to host graph• Matched elements outside

morphism domain are deleted• Elements outside morphism

codomain are added• NACs are forbidden

1:Customer

2:Cart

RHS

1:Customer

2:Cart

cart

partia

l morp

hism

NAC

1:Customer

3:Cart

NAC

3:Customer

2:Cart

Page 6: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation6

Single-graph view on rules

Red dashed:

NAC \ LHS

Black: LHS Å RHS

Green: RHS \ LHS

Page 7: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation7

forbidden

Graph Productions

Production rule

host graph

matching

Graph transition

src(t) tgt(t)morph(t) result

graph

pushout

NACNACNACs

(SPO = Single Pushout Approach)

LHS RHSrule morphism

(partial)

Page 8: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation8

Outline

• Setting– Graphs, rules, productions

• Abstraction– Quotients, neighbourhoods, shapes

• Logic– Modalities, preservation

• Framework– Extraction, transformation, normalization

• Conclusion– Future work

Page 9: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation9

Abstraction: Requirements

• Productions should be preservedG -p-> H implies (G) –p-> (H)

• No spurious productionsX–p->Y implies G –p-> H– for some G 2 -1(X) and some H 2 -1(Y) – for all G 2 -1(X), for some H 2 -1(Y)

(i.e., rule applicability is reflected)

• Properties should be reflected– (G) ² implies G ² – Inductively carries over to LTL operators

Method suitable for liveness properties

(But few liveness properties hold

on abstract model)

Page 10: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation10

Abstraction: Idea

• Quotient the graph w.r.t. similarity:G/» = (N/», E/», mult) with

N/» = { [v]» | v 2 N }E/» = { ([v]», a, [w]») | (v,a,w) 2 E }mult: V |V|M for V 2 N/»

(bounded multiplicities: M = {0,1,…,})

• Similarity should preserve structure:– v » w implies in(v) = in(w) with

• in(v) = { a | 9 v’: (v’,a,v) 2 E }, or• in(v) = { (a,|V|M) | V = {v’|(v’,a,v)2E} ; }

– Analogous for out and node labels

Page 11: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation11

Examples

• Similarity without edge multiplicities– all Objects similar

• Similarity with edge multiplicities– sharing information preserved

List Cell Cell Cell Cell

Object Object Object

next next next next

val val val val

Page 12: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation12

Abstraction: Neighbourhoods

Family (»i)i of refining similarity relations

• Basis »0: node label equality

• v »i+1 w iff v »i w and for all U 2 N/»i: – inM(v,U) = inM(w,U)

– outM(v,U) = outM(w,U)

whereinM(v,U) = { (a,|V|M) | V = {v’2U|(v’,a,v)2E} ; }

(and analogous for outM(v,U))

• Intuition: (enriched) bisimilarity – More general: partition refinement

Page 13: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation13

Example

List Cell Cell Cell Cell

Object Object Object

next next next next

val val val val

List Cell Cell Cell Cell

Object Object Object

next next next next

val val val val

List Cell Cell Cell Cell

Object Object Object

next next next next

val val val val

»0

»1

»2

Page 14: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation14

Shapes

• Graph quotient has no edge multiplicities – Not suitable for canonical abstraction

• Shape: (G,',multn,multin,multout) with– G: (quotiented) graph– ' µ NG£ NG: grouping relation

– multn: NG ! M: node multiplicity function

– multin: NG £ L £ (NG/') ! M: incoming edge multiplicity function

– multout: analogous to multin

• Edge multiplicities measured w.r.t. '

Page 15: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation15

Shape of a graph

• S shapes G if there is a morphism s with– s a morphism from G to GS

– for all v 2 NS: multn(v) = |s-1(v)|M

– for all v = s(w), a 2 L and U 2 NS/'S:multin(v,a,U) = | {w’2s-1(U)|(w’,a,w)2ES} |M

• Shape constructed from G using two equivalences: S = G/´,' (with ´ µ ') – Quotienting done w.r.t. ´– Grouping relation derived from '

• i-neighbourhood shape: SGi = G/»i,»i-1

Page 16: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation16

Canonical names

• i-neighbourhood shapes have a canonical representation– Unique up to isomorphism– Good for join & symmetry reduction

• i-Level canonical names (L finite):– Node names: CN0 = 2L (node labels) CNi+1 = CNi £ (CNi £ L ! M)2

– Edge names: CEi = CNi £ L £ CNi

– Ci(G) = (nameGi(NG), nameG

i(EG), mult)

• Theor: SGi SH

i if and only if Ci(G) = Ci(H)

Canonical name construction for G,

also defined inductively

Page 17: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation17

Outline

• Setting– Graphs, rules, productions

• Abstraction– Quotients, neighbourhoods, shapes

• Logic– Modalities, preservation

• Framework– Extraction, transformation, normalization

• Conclusion– Future work

Page 18: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation18

Logic

• Modal fragment ML of FOL ::= True | p | : | Ç | iai¢ | hah¢ – p stands for a node label– iai¢ : there are (at least) outgoing a-

edges of which the target satisfies ( 2 M)– Other operators standard

• Satisfaction for graphs straightforward– Predicate G, v ² (where v 2 N

G)

– G,v ² iai¢ iff · | {v’|(v,a,v’)2E, G,v’² } |M

• ML[i]: modalities nested up to i deep

Page 19: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation19

Example properties

• For the shopping example:– An item is owned by a shop or a customer:

Item ) hownsh ¢ (Shop Ç Customer)– All items on a shop rack are shop-owned:

Shop ) ]rack] ¢ ]contains] ¢ hownsh ¢ Shop

– A customer has at most one cart:Customer ) : icarti ¢ true

• For the list example:– There is no list with exactly 1 element:

List ) : inexti ¢ : inexti ¢ True– Objects are not shared:

Object ) : hvalh ¢ true

Not necessaryly the same shop!

Page 20: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation20

Result: Property preservation

• Extend satisfaction to shapes– S,v ² iai ¢ iff · U2X multout(v,a,U)

where X = { U 2 NS/' | 8 v2U: S,v ² }

• Theorem: for all 2 ML[i], all G and all v 2 NG: G,v ² iff SG

i, s(v) ²

• In words: All properties in i-nested modal logic are preserved and reflected by i-neighbourhood abstraction

Page 21: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation21

Outline

• Setting– Graphs, rules, productions

• Abstraction– Quotients, neighbourhoods, shapes

• Logic– Modalities, preservation

• Framework– Extraction, transformation, normalization

• Conclusion– Future work

Page 22: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation22

Framework

• Basic idea: build a LTS based on shapes– Define “shape transformation”

• Concepts:– p: LHS ! S is a pre-matching if p = s ± m

for some shaping s: G ! S and matchingm: LHS ! G

– p is concrete if for all v2 NLHS, multn(p(v)) = 1 and [p(v)]' = { p(v) }

• If p is concrete, construct S –p-> S’– for all p = s ± m as above, G –p-> G’ such

that S’ shapes G’

Page 23: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation23

Extraction (Materialization)

• Given a pre-matching p: LHS ! S, the materialization of S is a family {Tk}k – For all k, 9 ak: Tk ! S (abstraction morphism)– For all k, 9 concrete ck: LHS ! Tk – For all s: G ! S, 9 t: G! Tk with s = ak ± t (for

some k)

• Construction of {Tk}k for i-neighbourhood shapes– For all v 2 NLHS, copy p(v) and its i-radius

neighbourhood– Guess the edges and multiplicities

Page 24: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation24

GCGC

GPGP

Proposed construction

LHS RHS

G G’

S S’

ss’

Tk

T’materialization normalization

pre-matching

concretepre-matching

transformation

sk

p cm

Page 25: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation25

Customer 1 Cart 1cart

Customer Cart

Customer Cart

transformationmaterialization

Example

Customer Cart Customer Cartcart

Customer 1 Cart 1cart

Customer Cart

LHS RHS

S

T0

s0

p

cart

cartCustomer 1 Cart 1

Customer Cart

Customer Cart T’0

cartCustomer Cart

Customer Cart

S’

guessed multiplicities;

3 other possibilities normalization

Page 26: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation26

Outline

• Setting– Graphs, rules, productions

• Abstraction– Quotients, neighbourhoods, shapes

• Logic– Modalities, preservation

• Framework– Extraction, transformation, normalization

• Conclusion

Page 27: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation27

Evaluation: Neighbourhood shapes• Pros– Powerful basic framework (arbitrary

graphs)– Finite (canonical) abstraction– Unique representation up to isomorphism– Preservation and reflection of modal logic– Automatic transformation

• Cons– Modal logic limited (no cyclic structures) – Materialization expensive– Abstraction not property-driven

Page 28: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation28

Future work

• Refined notion of neighbourhood– Regular language– Words up to bounded length (¼ radius)– Derived from properties & rules

• Integration with 3-valued logic• Implementation in GROOVE

Page 29: I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus

AHA, Berlin, July 2007Abstraction in Graph

Transformation29

Legacy research

• Refine notion of neighbourhood– Bauer & Wilhelm (partner abstraction)– Distefano & Katoen (list abstraction)– Distefano (abstract graph

transformation)

• Inspired by work by – Sagiv, Reps, Wilhelm et al. (shape

analysis)