Computer Supported Modeling and Reasoning
David Basin, Achim D. Brucker, Jan-Georg Smaus, and Burkhart Wolff April 2005
http://www.infsec.ethz.ch/education/permanent/csmr/
Computer Supported Modeling and Reasoning David Basin, Achim D. - - PowerPoint PPT Presentation
Computer Supported Modeling and Reasoning David Basin, Achim D. Brucker, Jan-Georg Smaus, and Burkhart Wolff April 2005 http://www.infsec.ethz.ch/education/permanent/csmr/ Higher-Order Logic Applications: HOL-OCL Achim D. Brucker
http://www.infsec.ethz.ch/education/permanent/csmr/
Higher-Order Logic Applications: HOL-OCL 1143
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Motivation 1144
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Motivation 1145
architecture and components.
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Motivation 1146
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Motivation 1147
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1148
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1149
Customer name : String + getName(): String + netValue(): Real 1.. ∗ Role Account balance : Real + getBalance(): Real + makeDeposit(a: Real) + makeWithdrawal(a: Real) : Account : Customer getBalance()
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1150
reasoning over specifications.
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1151
+ makeWithdrawal(amount:Real):Boolean − balance:Real + makeDeposit(amount:Real):Boolean + getBalance():Real context Account::makeDeposit(amount:Real):Boolean pre: amount >= 0 post: balance = balance@pre + amount accounts 1..99 Account
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1152
context Account inv: Account.allInstances->forAll(a1,a2 | a1.id = a2.id implies a1 = a2)
context Account inv: Account.owner->size = 1
context Account::makeDeposit(amount:Real):Boolean pre: amount >= 0 post: balance = balance@pre + amount OCL keywords Path expressions from UML model
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1153
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
An Introduction to UML/OCL 1154
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1155
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1156
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1157
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1158
i: Integer i: Integer s: String i: Integer
1..∗ a
s: String
1..∗ a
i: Integer
A A C D A B C B D A
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1159
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1159
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1159
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1159
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1159
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1160
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1160
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1160
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1161
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1161
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1161
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1162
i: Integer s: String j: Integer
mkC mkB getB
C2B B2C
getC
B2A
getA/OclAny2A mkA/A2OclAny
A2B
A C OclAny B Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1162
i: Integer s: String j: Integer
mkC mkB getB
C2B B2C
getC
B2A
getA/OclAny2A mkA/A2OclAny
A2B
A C OclAny B
i: Integer s: String j: Integer r: Real
mkC mkB getB
C2B B2C
getC
B2A
getA/OclAny2A mkA/A2OclAny
A2B
A C OclAny B D Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1163
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1163
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1163
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1163
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1163
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1164
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1165
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1165
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1165
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Formalizing Class Diagrams 1165
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1166
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics Textbook Semantics
+ Communication
OCL Semantics
+ Easy to Read
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics Textbook Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics Textbook Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read Language Research Analysis of Language Consistency Checked
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics Textbook Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read Language Research Analysis of Language Consistency Checked
Textbook Semantics Machine Checkable Semantics
Application + Communication
OCL Semantics
Verification Refinement Test Data Generation + Easy to Read Language Research Analysis of Language Consistency Checked
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1167
OCL Semantics Textbook Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read
Textbook Semantics Machine Checkable Semantics
+ Communication
OCL Semantics
+ Easy to Read Language Research Analysis of Language Consistency Checked
Textbook Semantics Machine Checkable Semantics
Application + Communication
OCL Semantics
Verification Refinement Test Data Generation + Easy to Read Language Research Analysis of Language Consistency Checked
Textbook Semantics Machine Checkable Semantics
Application + Communication
OCL Semantics
Reuseability Analyze Structure of the Semantics Verification Refinement Test Data Generation + Easy to Read Language Research Analysis of Language Consistency Checked
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1168
L
L
L
L
L
L
L
L
L
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1169
L and Y = ⊥ L
L
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1170
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1171
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1172
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Excursus: Defining Semantics 1173
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1174
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1175
L})
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1176
L and Y = ⊥ L
L
constdefs union :: ” [(’ a ,(’ b::bot) Set) VAL, (’a ,’ b Set) VAL] ⇒ (’a ,’ b Set) VAL” (” −>union’( ’)” [66,65]65) ”union ≡ lift2 ( strictify (λX. strictify (λY. Abs Set (⌊ Lifting .drop (Rep Set X) ∪ Lifting .drop (Rep Set Y)⌋) )))”
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1177
Not X = lift1 not’ X = lift1 ⌊ ⌋ ◦ strictify (¬ ◦ ⌈ ⌉) X = λSt. if DEF(X St) then ⌊ ¬ ⌈X St⌉ ⌋ else ⊥
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1177
Not X = lift1 not’ X = lift1 ⌊ ⌋ ◦ strictify (¬ ◦ ⌈ ⌉) X = λSt. if DEF(X St) then ⌊ ¬ ⌈X St⌉ ⌋ else ⊥
Sem[ [Not X] ] St = if DEF(Sem[ [X] ] St) then ⌊ ¬ ⌈Sem[ [X] ] St⌉ ⌋ else ⊥
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1178
L
L
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1178
L
L
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1179
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1179
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1179
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1179
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Int Set X ∧ Y = Y ∧ X ∧, ∨, = ...
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Int Set X ∧ Y = Y ∧ X ∧, ∨, = ...
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Logic Int Set Integer SSet X ∧ Y = Y ∧ X ∧, ∨, = ... BOOL and, or, ... X and Y = Y and X
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Logic Int Set Integer SSet X ∧ Y = Y ∧ X ∧, ∨, = ... BOOL and, or, ... X and Y = Y and X
Data Type Adaption
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Logic Int Set Integer SSet X ∧ Y = Y ∧ X ∧, ∨, = ... BOOL and, or, ... X and Y = Y and X
Data Type Adaption Functional Adaption
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1180
bool HOL Logic Int Set Integer SSet X ∧ Y = Y ∧ X ∧, ∨, = ... BOOL and, or, ... X and Y = Y and X
Data Type Adaption Embedding Adaption Functional Adaption
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1181
DEF( strictify f X) = ⇒ DEF f ∧DEF X
( x y. f x y = f y x) = ⇒ ( strictify (λx. strictify (f x))) X Y = ( strictify (λx. strictify (f x)) Y X)
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1182
context : C o l l e c t i o n . count ( o b j e c t :T) : i n t e g e r post : r e s u l t = s e l f → i t e r a t e ( elem ; acc : i n t e g e r = 0 | i f elem = o b j e c t then acc
lemma ”((self ::(’ a, ’b::bot Set)VAL)−>count((obj::(’a, ’b)VAL))) = ( if self −>includes(obj) then 1 else 0 endif)”
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1183
lemma ”((self ::(’ a, ’b::bot Set)VAL)−>count((obj::(’a, ’b)VAL))) = ( if self −>includes(obj) then 1 else 0 endif)” apply (rule ext) apply (simp add: count def includes def
weak eq def OCL Integer. Zero ocl int def OCL Integer. One ocl int def ) apply (simp only: lift0 def lift1 def lift2 def lift3 def strictify def
RUE def) apply ( simp all (no asm use) add: UU fun def DEF def strictify def split add: split if
done
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Embedding OCL into Isabelle/HOL 1184
level
embedding into Isabelle/HOL
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1185
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1186
Isabelle/HOL
Isabelle Instance for HOL
Proof General
(X)Emacs−based User Interface SML−based User Interface UML/OCL specifications
Standard ML (SML) Isabelle
Implementation Language Generic Theorem Prover
HOL−OCL
Isabelle Instance for OCL/UML
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1187
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1187
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1187
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1187
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1187
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1188
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1189
introduction of new classes.
semantical essence (e.g. lifting and strictness).
Brucker: HOL Applications: HOL-OCL; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1190
[BW02a] Achim D. Brucker and Burkhart Wolff. HOL-OCL: Experiences, consequences and design choices. In Jean-Marc J´ ez´ equel, Heinrich Hussmann, and Stephen Cook, editors, UML 2002: Model Engineering, Concepts and Tools, number 2460, pages 196–211. Springer-Verlag, Dresden, 2002. [BW02b] Achim D. Brucker and Burkhart Wolff. A proposal for a formal OCL semantics in Isabelle/HOL. In C´ esar Mu˜ noz, Sophi` ene Tahar, and V´ ıctor Carre˜ no, editors, Theorem Proving in Higher Order Logics, number 2410, pages 99–
[BW03] Achim D. Brucker and Burkhart Wolff. Using theory morphisms for imple- menting formal methods tools. In Herman Geuvers and Freek Wiedijk, editors, Types for Proof and Programs, number 2646, pages 59–77. Springer-Verlag, Nijmegen, 2003. [omg01] OMG Unified Modeling Language Specification, September 2001.
Brucker: HOL Applications: Other; http://www.infsec.ethz.ch/education/permanent/csmr/ (rev. 16802)
Conclusion 1191
[omg03] Uml 2.0 ocl specification, October 2003.
Basin, Brucker, Smaus, and Wolff: Computer Supported Modeling and Reasoning; April 2005http://www.infsec.ethz.ch/education/permanent/csmr/