towards typechecking for model transformations by monadic 2 nd -order logic
DESCRIPTION
Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic. Kazuhiro Inaba ( 稲葉 一浩 ) @ NII, BiG Team Nov 16, 2009 Changsha 3 rd Bi-Trans in ABC. Checking Models Every Time. Model Transformation F. Model A. Model F(A). Typechecking. Typechecking. Metamodel M1. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/1.jpg)
Towards Typechecking for Model Transformations by Monadic 2nd-Order Logic
Kazuhiro Inaba ( 稲葉 一浩 ) @ NII, BiG Team
Nov 16, 2009Changsha3rd Bi-Trans in ABC
![Page 2: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/2.jpg)
Typechecking
Checking Models Every Time
ModelA
MetamodelM1
ModelTransformation
F
Typechecking
ModelF(A)
MetamodelM2
![Page 3: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/3.jpg)
Checking Transformation Only Once!
Checkingof
ModelTransformationMetamodel
M1
ModelTransformation
F
MetamodelM2
“Any model satisfying M1 always outputs by F a model of M2!”
![Page 4: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/4.jpg)
MetamodelM2
Our Approach: Use Logic
MetamodelM1
ModelTransformation
F
Valid! (True for any model!)Solver
Covert toLogicFormula
“input satisfies M1”
“Input and Output are related by F”& ⇒
“output satisfies M2”
![Page 5: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/5.jpg)
Agenda
From Model Transformation to LogicMSO Logic, Graphs, Schemas and UnCAL
Validation of MSO Logic Formula
Conclusion and Future WorkApplication to Bidirectional Transformation
![Page 6: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/6.jpg)
Monadic 2nd-Order Logic (MSO)
MSO is aUsual 1st order predicate logic
Boolean ops and quantifiers: ¬ , ∧ , , , ∨ ∀ ∃…extended with “set-quantifications”: ∀set∃set
E,g,., connected(x,y) := ∃set P. (x P & y P &∈ ∈ u,v.(u P & edge(u,v)∀ ∈ v P) & …)⇒ ∈
![Page 7: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/7.jpg)
Graph (Model)
We regard models as edge-labeled graphs i.e., we consider the problem of
typechecking for graph transformation
a a
bc d
c
![Page 8: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/8.jpg)
Schema (Metamodel)
Subset of KM3 [Jouault&Bezivin ‘06]class Customer { reference email [1-*] : String; reference order [0-*] : Order;}class Order { reference no [1-*] : Int; reference order_of [1-*] : Customer;}
Only [0-*] and
[1-*] is allowed
![Page 9: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/9.jpg)
Converting Schema to MSOCustomer
order
Order
order
class Customer { reference email [1-*] : String; reference order [0-*] : Order; }
Order
∀e: label_Customer(e) ⇒ ∃set C1, C2. outgoing(e, C1 C2)∪ & |C1| 1 & f C1. (label_≧ ∀ ∈ email(f) & …) & |C2| 0 & f C2. (label_≧ ∀ ∈ order(f) & g. outgoing(f, {g}) & label_∃ Order(g))
![Page 10: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/10.jpg)
Transformation Language
UnCAL [Buneman&Fernandez&Suiciu ‘00]Internal Graph Algebra of GRoundTramBased on “Structural Recursion” on graphs
rec(λ($L, _). // for each edge if $L = a then {d: &} // if label=a change to d else if $L = c then & // if label=c, delete else {$L: &} // otherwise, keep unchanged)
![Page 11: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/11.jpg)
Converting UnCAL to MSO
outgraph_label_d(e) ⇔ ingraph_label_a(e) ingraph_label_d(e)∨
outgraph_label_a(e) ⇔ false∧ ∧ outgraph_label_b(e) ⇔ ingraph_label_b(e) ∧ outgraph_label_c(e) ⇔ false ∧ outgraph_label_ε(e) ⇔ ingraph_label_c(e)
rec(λ($L, _). if $L = a then {d: &} else if $L = c then & else {$L: &} )
a b
c
d
d b
ε
d
![Page 12: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/12.jpg)
MetamodelM2
[Revisited] Our Approach
MetamodelM1
ModelTransformation
F
Valid! (True for any graph!)Solver
Covert toLogicFormula
“input satisfies M1”
“Input and Output are related by F”& ⇒
“output satisfies M2”
![Page 13: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/13.jpg)
Bad News
Theorem [Trakhtenbrot 50]:Validness property is undecidable on graphs, even for 1st-order logic.
Valid! (True for any graph!)
![Page 14: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/14.jpg)
Not-so-bad News
MSO validness is decidable on trees. [Thatcher&Wright68]
Also decidable on tree-likegraphs (bounded tree-width),but it’s too tree-like
Models are general graphs!
![Page 15: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/15.jpg)
Good News
UnCAL is bisimulation-generic. [BFS ‘00]c
UnCAL Transformation
a
・・・ ∞
c c c
Unfolding Unfolding
・・・ ∞
a a a
![Page 16: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/16.jpg)
Our Approach: Infinite Trees
UnCAL and our schema do not distinguish a graph and its unfolded infinite tree
Our MSO formulas are valid (true on all graphs) iff true on all infinite trees
Decidable!
![Page 17: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/17.jpg)
Our Approach:Infinite Trees to Finite Trees
Bad: Deciding MSO on infinite trees is costyGood: Considering only Finite Cuts suffices
・・・ ∞
c c c✂
c ✂
c c ✂
c c c ✂
・・・
![Page 18: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/18.jpg)
MetamodelMetamodel Transformation
Checked by the Well-known Solver MONA
ΦM1 & ΦF ⇒ ΦM2
Type Correctness
Validness of MSO Formula on Graphs
ΦM1 & ΦF ⇒ ΦM2
Validness of MSO Formula on Infinite Trees
Φ’M1 & Φ’F ⇒ Φ’M2
Validness of MSO Formula on Finite Trees
![Page 19: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/19.jpg)
Demo
(For showing the taste of the system)
![Page 20: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/20.jpg)
Summary
Typechecking is reduced to MSO Validness
Not by restricting to tree-like graphs, butby exploiting the Bisimulation-Genericity of UnCAL
![Page 21: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/21.jpg)
Ongoing Work
To Finish Implementation Performance ImprovementsSupporting larger class of translation
Application to Bidirectional Transformation“Updatability”: the following formula
defines the set of outputs having corresponding inputs
Φ’M1 & Φ’F & Φ’M2
![Page 22: Towards Typechecking for Model Transformations by Monadic 2 nd -Order Logic](https://reader035.vdocuments.mx/reader035/viewer/2022081517/568164a1550346895dd69575/html5/thumbnails/22.jpg)
THANK YOU FOR LISTENING!