290 likes | 441 Views
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. Outline. Setting Graphs, rules, productions Abstraction Quotients, neighbourhoods, shapes Logic
E N D
i-Neighbourhood Abstraction in Graph Transformation Arend RensinkUniversity of Twente Based on work with:Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus Kurban AHA, Berlin, July 2007
Outline • Setting • Graphs, rules, productions • Abstraction • Quotients, neighbourhoods, shapes • Logic • Modalities, preservation • Framework • Extraction, transformation, normalization • Conclusion • Future work Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
NAC RHS 1:Customer 1:Customer cart partial morphism 2:Cart 3:Cart NAC 3:Customer 2:Cart Rule formalism • LHS is matched to host graph • Matched elements outside morphism domain are deleted • Elements outside morphism codomain are added • NACs are forbidden LHS 1:Customer 2:Cart Abstraction in Graph Transformation
Single-graph view on rules Black: LHS Å RHS Red dashed: NAC \ LHS Green: RHS \ LHS Abstraction in Graph Transformation
Production rule rule morphism LHS RHS NAC NAC (partial) NACs forbidden matching host graph morph(t) result graph src(t) tgt(t) Graph transition pushout Graph Productions (SPO = Single Pushout Approach) Abstraction in Graph Transformation
Outline • Setting • Graphs, rules, productions • Abstraction • Quotients, neighbourhoods, shapes • Logic • Modalities, preservation • Framework • Extraction, transformation, normalization • Conclusion • Future work Abstraction in Graph Transformation
Abstraction: Requirements • Productions should be preserved G -p-> H implies(G) –p->(H) • No spurious productions X–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) Abstraction in Graph Transformation
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|Mfor 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 Abstraction in Graph Transformation
next next next next List Cell Cell Cell Cell val val val val Object Object Object Examples • Similarity without edge multiplicities • all Objects similar • Similarity with edge multiplicities • sharing information preserved Abstraction in Graph Transformation
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) where inM(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 Abstraction in Graph Transformation
next next next next next next next next next next next next List List List Cell Cell Cell Cell Cell Cell Cell Cell Cell Cell Cell Cell val val val val val val val val val val val val Object Object Object Object Object Object Object Object Object Example »0 »1 »2 Abstraction in Graph Transformation
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. ' Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
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), nameGi(EG), mult) • Theor: SGi SHi if and only if Ci(G) = Ci(H) Canonical name construction for G, also defined inductively Abstraction in Graph Transformation
Outline • Setting • Graphs, rules, productions • Abstraction • Quotients, neighbourhoods, shapes • Logic • Modalities, preservation • Framework • Extraction, transformation, normalization • Conclusion • Future work Abstraction in Graph Transformation
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 NG) • G,v²iai ¢ iff · | {v’|(v,a,v’)2E, G,v’²} |M • ML[i]: modalities nested up to i deep Abstraction in Graph Transformation
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! Abstraction in Graph Transformation
Result: Property preservation • Extend satisfaction to shapes • S,v ²iai¢ iff · U2Xmultout(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 SGi, s(v) ² • In words: All properties in i-nested modal logic are preserved and reflected by i-neighbourhood abstraction Abstraction in Graph Transformation
Outline • Setting • Graphs, rules, productions • Abstraction • Quotients, neighbourhoods, shapes • Logic • Modalities, preservation • Framework • Extraction, transformation, normalization • Conclusion • Future work Abstraction in Graph Transformation
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’ Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
Proposed construction LHS RHS m p c pre-matching G G’ GC GC concretepre-matching s’ s S S’ materialization sk normalization Tk T’ GP GP transformation Abstraction in Graph Transformation
cart Customer Cart Customer Cart Customer 1 Cart 1 Customer Cart cart cart Customer Cart Customer 1 Cart 1 T’0 Customer 1 Cart 1 Customer 1 Cart 1 cart Customer Cart 1 Customer 1 Cart 1 cart cart Customer 1 Cart 1 Customer 1 Cart 1 Example LHS RHS p S’ S guessed multiplicities;3 other possibilities materialization s0 transformation normalization T0 Abstraction in Graph Transformation
Outline • Setting • Graphs, rules, productions • Abstraction • Quotients, neighbourhoods, shapes • Logic • Modalities, preservation • Framework • Extraction, transformation, normalization • Conclusion Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
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 Abstraction in Graph Transformation
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) Abstraction in Graph Transformation