SlideShare a Scribd company logo
Isabelle: Not Only a Proof Assistant
Achim D. Brucker
achim@brucker.ch http://www.brucker.ch/
joint work with Lukas BrĆ¼gger, Delphine Longuet, Yakoub Nemouchi, FrĆ©dĆ©ric Tuong, Burkhart Wolff
Proof Assistants and Related Tools - The PART Project
Technical University of Denmark, Kgs. Lyngby, Denmark
September 24, 2015
Isabelle: Not Only a Proof Assistant
Abstract
The Isabelle homepage describes Isabelle as ā€œa generic proof assistant. It allows mathematical
formulas to be expressed in a formal language and provides tools for proving those formulas in a
logical calculus.ā€ While this, without doubts, what most users of Isabelle are using Isabelle for,
there is much more to discover: Isabelle is also a framework for building formal methods tools.
In this talk, I will report on our experience in using Isabelle for building formal tools for high-level
speciļ¬cations languages (e.g., OCL, Z) as well as using Isabelleā€™s core engine for new applications
domains such as generating test cases from high-level speciļ¬cations.
Motivation
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 4
Motivation
This is only the tip of the iceberg
Isar
jEdit auto
define Isar
command
datatype packages own code
generators
Isabelle
kernel
tactic implementation
generate
codesledgehammer
ML Interface
Scala interface
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 5
Outline
1 Motivation
2 Isabelle tools on top of Isabelle (Add-on)
HOL-OCL 1.x
HOL-OCL 2.x
HOL-TestGen
3 Conclusion
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
UML/OCL in a nutshell
UML
Visual modeling language
Object-oriented development
Industrial tool support
OMG standard
Many diagram types, e.g.,
activity diagrams
class diagrams
. . .
OCL
Textual extension of the UML
Allows for annotating UML diagrams
In the context of classā€“diagrams:
invariants
preconditions
postconditions
Account
balance:Integer
id:Integer
getId():Integer
getBalance():Integer
deposit(a:Integer):Boolean
withdraw(a:Integer):Boolean
accounts
1..*
context Account
inv: 0 <= id
context Account::deposit(a:Integer):Boolean
pre: 0 < a
post: balance = balance@pre+a
and id = id@pre
context Account
inv: 0 <= id
context Account::deposit(a:Integer):Boolean
pre: 0 < a
post: balance = balance@pre+a
and id = id@pre
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 7
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Developing formals tools for UML/OCL?
Turning UML/OCL into a formal method
1 A formal semantics of object-oriented data models (UML)
typed path expressions
inheritance
. . .
2 A formal semantics of object-oriented constraints (OCL)
a logic reasoning over path expressions
large libraries
three-valued logic
. . .
3 And of course, we want a tool (HOL-OCL)
a formal, machine-checked semantics for OO speciļ¬cations,
an interactive proof environment for OO speciļ¬cations.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 8
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Challenges (for a shallow embedding)
Challenge 1:
Can we ļ¬nd a injective, type preserving mapping of
an object-oriented language (and datatypes) into HOL
e:T āˆ’ā†’ e :: T
(including subtyping)?
Challenge 2:
Can we support veriļ¬cation in a modular way
(i.e., no replay of proof scripts after extending speciļ¬cations)?
Challenge 3:
Can we ensure consistency of our representation?
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 9
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
O
A
s:String
B
b:Integer
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
B :=
O
A
s:String
B
b:Integer
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
B := (Otag Ɨoid)
O
A
s:String
B
b:Integer
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
B := (Otag Ɨoid) Ɨ (Atag ƗString)
O
A
s:String
B
b:Integer
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
B := (Otag Ɨoid) Ɨ (Atag ƗString) Ɨ (Btag ƗInteger)
O
A
s:String
B
b:Integer
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Representing class types
The ā€œextensible recordsā€ approach
We assume a common superclass (O).
A tag type guarantees uniquenessby (Otag := classO).
Construct class type as tuple along inheritance hierarchy:
Ī± B := (Otag Ɨoid) Ɨ (Atag ƗString) Ɨ (Btag ƗInteger) Ɨ Ī±
O
A
s:String
B
b:Integer
Ī±
Advantages:
it allows for extending class types (inheritance),
subclasses are type instances of superclasses
ā‡’ it allows for modular proofs, i.e.,
a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B.
However, it has a major disadvantage:
modular proofs are only supported for one extension per class
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Idea: a general universe type
A universe type representing all classes of a class model
supports modular proofs with arbitrary extensions
provides a formalization of a extensible typed object store
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 11
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A A Ī²O
Ī±A
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A A Ī²O
Ī±A
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
B B Ī²A
Ī±B
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A A Ī²O
Ī±A
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
B B Ī²A
Ī±B
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„C C Ī²A
Ī±C
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A A Ī²O
Ī±A
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
B B Ī²A
Ī±B
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„C C Ī²A
Ī±C
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„
Uļ˜»
(Ī±B ,Ī±C ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + (C Ɨ Ī±C
āŠ„ + Ī²A
))āŠ„ + Ī²O
)āŠ„
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
An extensible object store
O O
Ī±O
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
A A Ī²O
Ī±A
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
B B Ī²A
Ī±B
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„C C Ī²A
Ī±C
Uļ˜¹
(Ī±O) = O Ɨ Ī±O
āŠ„
Uļ›œ
(Ī±A,Ī²O)
= O Ɨ (A Ɨ Ī±A
āŠ„ + Ī²O
)āŠ„
Uļ˜ŗ
(Ī±B ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + Ī²A
)āŠ„ + Ī²O
)āŠ„
Uļ˜»
(Ī±B ,Ī±C ,Ī²O,Ī²A)
= O Ɨ (A Ɨ (B Ɨ Ī±B
āŠ„ + (C Ɨ Ī±C
āŠ„ + Ī²A
))āŠ„ + Ī²O
)āŠ„
U3
(Ī±B,Ī±C,Ī²O,Ī²A) U2
(Ī±B,Ī²O,Ī²A) U1
(Ī±A,Ī²O) U0
(Ī±O)
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Merging universes
Uļ›œ
:
A
Uļ˜ŗa
:
A
C
Uļ˜ŗb
:
A B
D
Uļ˜»
:
A B
C D
Non-conļ¬‚icting Merges
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 13
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Merging universes
Uļ›œ
:
A
Uļ˜ŗa
:
A
C
Uļ˜ŗb
:
A B
D
Uļ˜»
:
A B
C D
Non-conļ¬‚icting Merges
Uļ›œ
:
A
Uļ˜ŗa
:
A
C
Uļ˜ŗb
:
A
B
Uļ˜»
:
A
BC
Conļ¬‚icting Merges
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 13
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Operations accessing the object store
injections
mkO o = Inl o with type Ī±O
O ā†’ U0
Ī±O
projections
getO u = u with type U0
Ī±O ā†’ Ī±O
O
type casts
A[O] = getO ā—¦ mkA with type Ī±A
A ā†’ (A Ɨ Ī±A
āŠ„ + Ī²O
) O
O[A] = getA ā—¦ mkO with type (A Ɨ Ī±A
āŠ„ + Ī²O
) O ā†’ Ī±A
A
. . .
All deļ¬nitions are generated automatically
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 14
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
ā€œCheckingā€ subtyping
For each UML model, we have to show several properties:
O
A
s:String
B
b:Integer
subclasses are of the superclasses kind:
isTypeB self
isKindA self
ā€œre-castingā€:
isTypeB self
self[A][B] = āŠ„ āˆ§ isTypeB (self[A][B][A]
)
monotonicity of invariants, . . .
All rules are derived automatically
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 15
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
HOL-OCL
HOL-OCL provides:
a formal, machine-checked semantics for OO speciļ¬cations,
an interactive proof environment for OO speciļ¬cations.
HOL-OCL is integrated into a toolchain providing:
extended well-formedness checking,
proof-obligation generation,
methodology support for UML/OCL,
a transformation framework (including PO generation),
code generators,
support for SecureUML.
HOL-OCL is publicly available:
http://www.brucker.ch/projects/hol-ocl/.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 16
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
The HOL-OCL architecture
Standard ML (PolyML, sml/NJ)
HOL-OCL
Isabelle/HOL
suļœ“sml
HOL-OCL User Interface (extended Proof General)
Repository
UML/OCL
PO-Manager
Encoder
Code-Gen.
WF-Checks
Model-Trans.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 17
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
The HOL-OCL user interface
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 18
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
The HOL-OCL high-level language
The HOL-OCL proof language is an extension of Isabelleā€™s Isar language:
importing UML/OCL:
import_model "SimpleChair.zargo" "AbstractSimpleChair.ocl"
include_only "AbstractSimpleChair"
check well-formedness and generate proof obligations for reļ¬nement:
analyze_consistency [data_reļ¬nement] "AbstractSimpleChair"
starting a proof for a generated proof obligation:
po "AbstractSimpleChair.ļ¬ndRole_enabled"
generating code:
generate_code "java"
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 19
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
The encoder
The model encoder is the main interface between su4sml and the Isabelle based part of
HOL-OCL. The encoder
declarers HOL types for the classiļ¬ers of the model,
encodes
type-casts,
attribute accessors, and
dynamic type and kind tests implicitly declared in the imported data model,
encodes the OCL speciļ¬cation, i.e.,
class invariants
operation speciļ¬cations
and combines it with the core data model, and
proves (automatically) methodology and analysis independent properties of the model.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 20
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Tactics (proof procedures)
OCL, as logic, is quite different from HOL (e.g., three-valuedness)
Major Isabelle proof procedures, like simp and auto,
cannot handle OCL efļ¬ciently.
HOL-OCL provides several UML/OCL speciļ¬c proof procedures:
embedding speciļ¬c tactics (e.g., unfolding a certain level)
a OCL speciļ¬c context-rewriter
a OCL speciļ¬c tableaux-prover
. . .
These language speciļ¬c variants increase the degree of proof for OCL.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 21
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x
Proof obligation generator
A framework for proof obligation generation:
Generates proof obligation in OCL plus minimal meta-language.
Only minimal meta-language necessary:
Validity: |= _, _ |= _
Meta level quantiļ¬ers: āˆƒ_. _, āˆƒ_. _
Meta level logical connectives: _ āˆØ _, _ āˆ§ _, Ā¬_
Examples for proof obligations are:
(semantical) model consistency
Liskovā€™s substitution principle
reļ¬nement conditions
. . .
Can be easily extended (at runtime).
Builds, together with well-formedness checking, the basis for tool-supported methodologies.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 22
Outline
1 Motivation
2 Isabelle tools on top of Isabelle (Add-on)
HOL-OCL 1.x
HOL-OCL 2.x
HOL-TestGen
3 Conclusion
Isabelle tools on top of Isabelle (Add-on) HOL-OCL 2.x
HOL-OCL 2.0 (Featherweight OCL)
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 24
Outline
1 Motivation
2 Isabelle tools on top of Isabelle (Add-on)
HOL-OCL 1.x
HOL-OCL 2.x
HOL-TestGen
3 Conclusion
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
How to ensure system correctness, security, and safety?
(Inductive) Veriļ¬cation Testing
Formal (mathematical) proof
Can show absence of all
failures relative to speciļ¬cation
Speciļ¬cation of based on
abstractions
Requires expertise in Formal
Methods
In industry:
only for highly critical systems
(regulations, certiļ¬cation)
Execution of test cases
Can show failures on real
system
Only shows failures for the
parts of the system
Requires less skills in Formal
Methods
In industry:
widely used
(often > 40% of dev. effort)
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 26
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Is testing a ā€œpoor manā€™s veriļ¬cation?ā€
Or: Why should I test if I did a veriļ¬cation and vice versa?
ā€œ
Program testing can be used to show the presence of bugs,
but never to show their absence! (Dijkstra)
Assume you can choose between two aircraft for you next travel:
Aircraft A:
Fully formally veriļ¬ed
Total number of ļ¬‚ights: 0
Aircraft B:
Fully tested
Total number of ļ¬‚ights: 1 000
Which aircraft would you take for your next trip?
Which aircraft would Dijkstra take?
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 27
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
What should we do?
Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach
Infrastructure&Conļ¬guration
Application
Operating System
Hypervisor
Server Application
Runtime Container
Operating System
Backend Systems
Observation:
Both methods have their unique advantages
Recommendation:
Use a combination of veriļ¬cation and testing
Our Vision:
An integrated approach for test and veriļ¬cation
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
What should we do?
Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach
Infrastructure&Conļ¬guration
Application
Operating System
Hypervisor
Server Application
Runtime Container
Operating System
Backend Systems
Separation Properties
Safety Properties
Observation:
Both methods have their unique advantages
Recommendation:
Use a combination of veriļ¬cation and testing
Our Vision:
An integrated approach for test and veriļ¬cation
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
What should we do?
Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach
Infrastructure&Conļ¬guration
Application
Operating System
Hypervisor
Server Application
Runtime Container
Operating System
Backend Systems
Separation Properties
Safety Properties
Sep.Prop.
Spec.-basedTestingofSafetyProperties
TestServerApp.
IntegrationTest
Observation:
Both methods have their unique advantages
Recommendation:
Use a combination of veriļ¬cation and testing
Our Vision:
An integrated approach for test and veriļ¬cation
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Implementing our vision in Isabelle: HOL-TestGen
An interactive model-based test tool
built upon the theorem prover Isabelle/HOL
speciļ¬cation language: HOL
unique combination of test and proof
veriļ¬cation environment
user controllable test-hypotheses
veriļ¬ed transformations
supports the complete MBT workļ¬‚ow
basis for domain-speciļ¬c extensions
successfully used in large case-studies
freely available at:
http://www.brucker.ch/projects/hol-testgen/
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 29
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
The HOL-TestGen architecture
Execution Environment
HOL-TestGen
Isabelle/HOL
Specification
Test Generation
Test SpecificationSystem Specification
Verification and Transformation
Test Executable
System under
Test
Test Case Generation
Test Data Generation
Test Script (incl. Test
Oracle) Generation
Inductive
Verification
Verified Model
Transformation
Test Harness
Generated Test Script
and Test Oracle
Test Adapter
Scheduler
Control
Scheduler
Mapping
Seamless combination of
testing and veriļ¬cation
Black-box vs. white-box:
Speciļ¬cation-based black-box test as default
White-box and Grey-box also possible
Unit vs. sequence testing
Unit testing straight forwards
Sequence testing via monadic construction
Coverage:
Path Coverage (on the speciļ¬cation) as default
Scalability:
Veriļ¬ed test transformations can increase testability
by several orders of magnitude
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 30
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Excursus: test hypothesis ā€“ the difference between test and proof
Idea: We introduce formal test hypothesis ā€œon the ļ¬‚yā€
Technically, test hypothesis are marked using the following predicate:
THYP : bool ā‡’bool
THYP(x) ā‰”x
Two test hypotheses are common:
Regularity hypothesis: captures inļ¬nite data structures (splits), e.g., for lists
x = []
Ā·
Ā·
Ā·
P a
x = [a]
Ā·
Ā·
Ā·
P a b h
x = [a, b]
Ā·
Ā·
Ā·
P THYP āˆ€x.k < size x āˆ’ā†’ P x
P
Uniformity hypothesis: captures test data selection
ā€œOnce a system under test behaves correct for one test case, it behaves correct for all test casesā€
n) [[ C1 ?x; ...; Cm ?x]] =ā‡’TS ?x
n+1) THYP((āˆƒ x. C1 x ... Cm x āˆ’ā†’TS x) āˆ’ā†’(āˆ€ x. C1 x ... Cm x āˆ’ā†’TS x))
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 31
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Test case generation: an example
theory TestPrimRec
imports Main
begin
primrec
x mem [] = False
x mem (y#S) = if y = x
then True
else x mem S
test_spec:
"x mem S =ā‡’prog x S"
apply(gen_testcase)
Result:
1. prog ?x1 [?x1]
2. prog ?x2 [?x2,?b2]
3. ?a3=?x3 =ā‡’prog ?x3 [?a3,?x3]
4. THYP(āˆƒ x.prog x [x] āˆ’ā†’prog x [x]
...
7. THYP(āˆ€ S. 3 ā‰¤size S āˆ’ā†’x mem S āˆ’ā†’prog x S)
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 32
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Use case: testing ļ¬rewall policies
DMZ
Internet (extern)
Intranet (intern)
000000
00
111111
11
source destination protocol port action
Internet dmz udp 25 allow
Internet dmz tcp 80 allow
dmz intranet tcp 25 allow
intranet dmz tcp 993 allow
intranet Internet udp 80 allow
any any any any deny
Our goal: Show correctness of the
conļ¬guration and
implementation
of active network components
Today: ļ¬rewalls are stateless packet ļ¬lters
Our approach also supports (not considered in this talk):
network address translation (NAT)
port translation, port forwarding
stateful ļ¬rewalls
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 33
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
HOL model of a ļ¬rewall policy
A ļ¬rewall makes a decision based on single packets.
types (Ī±,Ī²) packet
= id Ɨ(Ī±::adr) src Ɨ(Ī±::adr) dest ƗĪ²content
Different address and content representations are possible.
A policy is a mapping from packets to decisions (allow, deny, . . . ):
types Ī±ā†’Ī²= Ī± Ī²decision
types (Ī±,Ī²) Policy = (Ī±,Ī²) packet ā†’unit
Remark: for policies with network address translation:
types (Ī±,Ī²) NAT_Policy = (Ī±,Ī²) packet ā†’(Ī±,Ī²) packet set
Policy combinators allow for deļ¬ning policies:
deļ¬nition
allow_all_from :: (Ī±::adr) net ā‡’(Ī±,Ī²) Policy where
allow_all_from src_net = {pa. src pa src_net} AU
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 34
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
The policy
source destination protocol port action
Internet dmz udp 25 allow
Internet dmz tcp 80 allow
dmz intranet tcp 25 allow
intranet dmz tcp 993 allow
intranet Internet udp 80 allow
any any any any deny
deļ¬nition TestPolicy where
TestPolicy = allow_port udp 25 internet dmz āŠ•
allow_port tcp 80 internet dmz āŠ•
allow_port tcp 25 dmz intranet āŠ•
allow_port tcp 993 intranet dmz āŠ•
allow_port udp 80 intranet internet āŠ•
DU
where DU is the policy that denies all trafļ¬c
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 35
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Testing stateless ļ¬rewalls
The test speciļ¬cation:
test_spec test: ā€œP x =ā‡’FUT x = Policy xā€™ā€™
FUT: Placeholder for Firewall Under Test
Predicate P restricts packets we are interested in, e.g.,
wellformed packets which cross some network boundary
Core test case generation algorithm:
compute conjunctive-normal form
ļ¬nd satisfying assignments for each clause (partition)
Generates test data like (simpliļ¬ed):
FUT(1,((8,13,12,10),6,tcp),((172,168,2,1),80,tcp),data)= (deny()
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 36
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Problems with the direct approach
The direct approach does not scale:
R1 R2 R3 R4
Networks 3 3 4 3
Rules 12 9 13 13
TC Generation Time (sec) 26382 187 59364 1388
Test Cases 1368 264 1544 470
Reason:
Large cascades of case distinctions over input and output
=ā‡’ However, many of these case splits are redundant
Many combinations due to subnets
=ā‡’ Pre-partitioning of test space according to subnets
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 37
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Model transformations for TCG
Idea is fundamental to model-based test case generation. E.g.:
if x < āˆ’10 then if x < 0 then P else Q else Q
if x < āˆ’10 then P else Q
lead to different test cases
The following two policies produce a different set of test cases:
AllowAll dmz internet āŠ• DenyPort dmz internet 21 āŠ• DU
AllowAll dmz internet āŠ• DU
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 38
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
A typical transformation
Remove all rules
allowing a port between two networks,
if a former rule already denies all the rules between these two networks
fun removeShadowRules2::
where
removeShadowRules2 ((AllowPortFromTo x y p)#z) =
if (DenyAllFromTo x y) āˆˆ (set z)
then removeShadowRules2 z
else (AllowPortFromTo x y p)#(removeShadowRules2 z)
| removeShadowRules2 (x#y) = x#(removeShadowRules2 y)
| removeShadowRules2 [] = []
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 39
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Correctness of the normalisation
Correctness
of the normalization must hold for arbitrary input policies, satisfying certain preconditions
As HOL-TestGen is built upon the theorem prover Isabelle/HOL, we can prove formally the
correctness of such normalisations:
theorem C_eq_normalize:
assumes member DenyAll p
assumes allNetsDistinct p
shows C (list2policy (normalize p)) = C p
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 40
Isabelle tools on top of Isabelle (Add-on) HOL-TestGen
Empirical results
R1 R2 R3 R4
Not Normalized Networks 3 3 4 3
Rules 12 9 13 13
TC Generation Time (sec) 26382 187 59364 1388
Test Cases 1368 264 1544 470
Normalized Rules 14 14 24 26
Normalization (sec) 0.6 0.4 1.1 0.8
TC Generation Time (sec) 0.9 0.6 1.2 0.7
Test Cases 20 20 34 22
The normalization of policies decreases
the number of test cases and
the required test case generation time
by several orders of magnitude.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 41
Outline
1 Motivation
2 Isabelle tools on top of Isabelle (Add-on)
HOL-OCL 1.x
HOL-OCL 2.x
HOL-TestGen
3 Conclusion
Conclusion
Conclusion
Modern interactive theorem provers can be used as
frameworks for building formal methods tools.
If you ā€œprototypeā€ formal methods tools, consider
to reuse the infrastructure of your theorem prover of choice
Isabelle provides a lot of features:
deļ¬ning nice syntax for DSLs
deļ¬ning new top-level commands
developing own tactics
generate code
. . .
There is another nice example: attend the next talk by Sebastian!
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 43
Thank you for your attention!
Any questions or remarks?
Conclusion
Related Publications I
Achim D. Brucker, Lukas BrĆ¼gger, Paul Kearney, and Burkhart Wolff.
Veriļ¬ed ļ¬rewall policy transformations for test-case generation.
In Third International Conference on Software Testing, Veriļ¬cation, and Validation (ICST), pages 345ā€“354. IEEE Computer Society, 2010.
http://www.brucker.ch/bibliography/abstract/brucker.ea-firewall-2010.
Achim D. Brucker, Lukas BrĆ¼gger, and Burkhart Wolff.
HOL-TestGen/FW: An environment for speciļ¬cation-based ļ¬rewall conformance testing.
In Zhiming Liu, Jim Woodcock, and Huibiao Zhu, editors, International Colloquium on Theoretical Aspects of Computing (ICTAC), number 8049 in Lecture Notes in Computer Science,
pages 112ā€“121. Springer-Verlag, 2013.
http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-testgen-fw-2013.
Achim D. Brucker, Lukas BrĆ¼gger, and Burkhart Wolff.
Formal ļ¬rewall conformance testing: An application of test and proof techniques.
Software Testing, Veriļ¬cation & Reliability (STVR), 25(1):34ā€“71, 2015.
http://www.brucker.ch/bibliography/abstract/brucker.ea-formal-fw-testing-2014.
Achim D. Brucker, Delphine Longuet, FrƩdƩric Tuong, and Burkhart Wolff.
On the semantics of object-oriented data structures and path expressions.
In Jordi Cabot, Martin Gogolla, IstvƔn RƔth, and Edward D. Willink, editors, Proceedings of the MoDELs 2013 OCL Workshop (OCL 2013), volume 1092 of CEUR Workshop Proceedings,
pages 23ā€“32. ceur-ws.org, 2013.
http://www.brucker.ch/bibliography/abstract/brucker.ea-path-expressions-2013.
Achim D. Brucker, Frank Rittinger, and Burkhart Wolff.
hol-z 2.0: A proof environment for Z-speciļ¬cations.
Journal of Universal Computer Science, 9(2):152ā€“172, February 2003.
http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-z-2003.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 45
Conclusion
Related Publications II
Achim D. Brucker and Burkhart Wolff.
hol-ocl ā€“ A Formal Proof Environment for UML/OCL.
In JosĆ© Fiadeiro and Paola Inverardi, editors, Fundamental Approaches to Software Engineering (FASE), number 4961 in Lecture Notes in Computer Science, pages 97ā€“100.
Springer-Verlag, 2008.
http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-ocl-2008.
Achim D. Brucker and Burkhart Wolff.
Extensible universes for object-oriented data models.
In Jan Vitek, editor, ECOOP 2008 ā€“ Object-Oriented Programming, number 5142 in Lecture Notes in Computer Science, pages 438ā€“462. Springer-Verlag, 2008.
http://www.brucker.ch/bibliography/abstract/brucker.ea-extensible-2008.
Achim D. Brucker and Burkhart Wolff.
Semantics, calculi, and analysis for object-oriented speciļ¬cations.
Acta Informatica, 46(4):255ā€“284, July 2009.
ISSN 0001-5903.
http://www.brucker.ch/bibliography/abstract/brucker.ea-semantics-2009.
Achim D. Brucker and Burkhart Wolff.
On theorem prover-based testing.
Formal Aspects of Computing, 25(5):683ā€“721, 2013.
ISSN 0934-5043.
http://www.brucker.ch/bibliography/abstract/brucker.ea-theorem-prover-2012.
Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 46

More Related Content

What's hot

What's hot (10)

Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
Ā 
Ios development
Ios developmentIos development
Ios development
Ā 
38 object-concepts (1)
38 object-concepts (1)38 object-concepts (1)
38 object-concepts (1)
Ā 
Pi j2.2 classes
Pi j2.2 classesPi j2.2 classes
Pi j2.2 classes
Ā 
OOPS
OOPSOOPS
OOPS
Ā 
Building a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoBuilding a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot Potato
Ā 
Basic object oriented concepts (1)
Basic object oriented concepts (1)Basic object oriented concepts (1)
Basic object oriented concepts (1)
Ā 
Python - OOP Programming
Python - OOP ProgrammingPython - OOP Programming
Python - OOP Programming
Ā 
Cats in Scala
Cats in ScalaCats in Scala
Cats in Scala
Ā 
Best Guide for Javascript Objects
Best Guide for Javascript ObjectsBest Guide for Javascript Objects
Best Guide for Javascript Objects
Ā 

Viewers also liked

Tg discussion guide90
Tg discussion guide90Tg discussion guide90
Tg discussion guide90
lschmidt1170
Ā 
Geog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt friGeog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt fri
lschmidt1170
Ā 
CV_SANJAY SOHIL
CV_SANJAY SOHILCV_SANJAY SOHIL
CV_SANJAY SOHIL
Sanjay Sohil
Ā 
CV_Jeeshan CPE
CV_Jeeshan CPECV_Jeeshan CPE
CV_Jeeshan CPE
Zeeshan UMer
Ā 
Pi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassPi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision Class
Ana Menezes
Ā 
Audio in linux embedded
Audio in linux embeddedAudio in linux embedded
Audio in linux embedded
trx2001
Ā 

Viewers also liked (20)

Tg discussion guide90
Tg discussion guide90Tg discussion guide90
Tg discussion guide90
Ā 
å­øē”Ÿå­øēæ’ę­·ē؋ē°”å ±
å­øē”Ÿå­øēæ’ę­·ē؋ē°”å ±å­øē”Ÿå­øēæ’ę­·ē؋ē°”å ±
å­øē”Ÿå­øēæ’ę­·ē؋ē°”å ±
Ā 
Geog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt friGeog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt fri
Ā 
CV_SANJAY SOHIL
CV_SANJAY SOHILCV_SANJAY SOHIL
CV_SANJAY SOHIL
Ā 
Grouping objects
Grouping objectsGrouping objects
Grouping objects
Ā 
į„‹į…©į„‘į…³į†«į„‰į…¦į„†į…µį„‚į…” į„‘į…³į†Æį„…į…„į„€į…³į„‹į…µį†«į„†į…”į†«į„ƒį…³į†Æį„€į…µ(ķ•œė²ˆė”)
į„‹į…©į„‘į…³į†«į„‰į…¦į„†į…µį„‚į…” į„‘į…³į†Æį„…į…„į„€į…³į„‹į…µį†«į„†į…”į†«į„ƒį…³į†Æį„€į…µ(ķ•œė²ˆė”)į„‹į…©į„‘į…³į†«į„‰į…¦į„†į…µį„‚į…” į„‘į…³į†Æį„…į…„į„€į…³į„‹į…µį†«į„†į…”į†«į„ƒį…³į†Æį„€į…µ(ķ•œė²ˆė”)
į„‹į…©į„‘į…³į†«į„‰į…¦į„†į…µį„‚į…” į„‘į…³į†Æį„…į…„į„€į…³į„‹į…µį†«į„†į…”į†«į„ƒį…³į†Æį„€į…µ(ķ•œė²ˆė”)
Ā 
CV_Jeeshan CPE
CV_Jeeshan CPECV_Jeeshan CPE
CV_Jeeshan CPE
Ā 
Brain maturation
Brain maturationBrain maturation
Brain maturation
Ā 
Heap and Partners
Heap and PartnersHeap and Partners
Heap and Partners
Ā 
Rreflexion cuento
Rreflexion cuentoRreflexion cuento
Rreflexion cuento
Ā 
Tutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareTutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshare
Ā 
r3-4-2009f_xts5000_new
r3-4-2009f_xts5000_newr3-4-2009f_xts5000_new
r3-4-2009f_xts5000_new
Ā 
Kpi publikovani 2
Kpi publikovani 2Kpi publikovani 2
Kpi publikovani 2
Ā 
Pi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassPi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision Class
Ā 
Device driver
Device driverDevice driver
Device driver
Ā 
UDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIIUDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIII
Ā 
2014 April 17- Fox Valley Program
2014 April 17- Fox Valley Program2014 April 17- Fox Valley Program
2014 April 17- Fox Valley Program
Ā 
Java Thread
Java ThreadJava Thread
Java Thread
Ā 
Audio in linux embedded
Audio in linux embeddedAudio in linux embedded
Audio in linux embedded
Ā 
EIA FINAL
EIA FINALEIA FINAL
EIA FINAL
Ā 

More from Achim D. Brucker

Usable Security for Developers: A Nightmare
Usable Security for Developers: A NightmareUsable Security for Developers: A Nightmare
Usable Security for Developers: A Nightmare
Achim D. Brucker
Ā 
Using Third Party Components for Building an Application Might be More Danger...
Using Third Party Components for Building an Application Might be More Danger...Using Third Party Components for Building an Application Might be More Danger...
Using Third Party Components for Building an Application Might be More Danger...
Achim D. Brucker
Ā 
Service Compositions: Curse or Blessing for Security?
Service Compositions: Curse or Blessing for Security?Service Compositions: Curse or Blessing for Security?
Service Compositions: Curse or Blessing for Security?
Achim D. Brucker
Ā 

More from Achim D. Brucker (20)

Usable Security for Developers: A Nightmare
Usable Security for Developers: A NightmareUsable Security for Developers: A Nightmare
Usable Security for Developers: A Nightmare
Ā 
Formalizing (Web) Standards: An Application of Test and Proof
Formalizing (Web) Standards: An Application of Test and ProofFormalizing (Web) Standards: An Application of Test and Proof
Formalizing (Web) Standards: An Application of Test and Proof
Ā 
Your (not so) smart TV is currently busy with taking down the Internet
Your (not so) smart TV is currently busy  with taking down the InternetYour (not so) smart TV is currently busy  with taking down the Internet
Your (not so) smart TV is currently busy with taking down the Internet
Ā 
Combining the Security Risks of Native and Web Development: Hybrid Apps
Combining the Security Risks of Native and Web Development: Hybrid AppsCombining the Security Risks of Native and Web Development: Hybrid Apps
Combining the Security Risks of Native and Web Development: Hybrid Apps
Ā 
The Evil Friend in Your Browser
The Evil Friend in Your BrowserThe Evil Friend in Your Browser
The Evil Friend in Your Browser
Ā 
How to Enable Developers to Deliver Secure Code
How to Enable Developers to Deliver Secure CodeHow to Enable Developers to Deliver Secure Code
How to Enable Developers to Deliver Secure Code
Ā 
Developing Secure Software: Experiences From an International Software Vendor
Developing Secure Software: Experiences From an International Software VendorDeveloping Secure Software: Experiences From an International Software Vendor
Developing Secure Software: Experiences From an International Software Vendor
Ā 
Using Third Party Components for Building an Application Might be More Danger...
Using Third Party Components for Building an Application Might be More Danger...Using Third Party Components for Building an Application Might be More Danger...
Using Third Party Components for Building an Application Might be More Danger...
Ā 
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
Ā 
Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...
Ā 
Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...
Ā 
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Ā 
Industrial Challenges of Secure Software Development
Industrial Challenges of Secure Software DevelopmentIndustrial Challenges of Secure Software Development
Industrial Challenges of Secure Software Development
Ā 
SAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial ToolsSAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial Tools
Ā 
A Collection of Real World (JavaScript) Security Problems: Examples from 2 1/...
A Collection of Real World (JavaScript) Security Problems: Examples from 2 1/...A Collection of Real World (JavaScript) Security Problems: Examples from 2 1/...
A Collection of Real World (JavaScript) Security Problems: Examples from 2 1/...
Ā 
Deploying Static Application Security Testing on a Large Scale
Deploying Static Application Security Testing on a Large ScaleDeploying Static Application Security Testing on a Large Scale
Deploying Static Application Security Testing on a Large Scale
Ā 
Model-based Conformance Testing of Security Properties
Model-based Conformance Testing of Security PropertiesModel-based Conformance Testing of Security Properties
Model-based Conformance Testing of Security Properties
Ā 
Service Compositions: Curse or Blessing for Security?
Service Compositions: Curse or Blessing for Security?Service Compositions: Curse or Blessing for Security?
Service Compositions: Curse or Blessing for Security?
Ā 
Encoding Object-oriented Datatypes in HOL: Extensible Records Revisited
Encoding Object-oriented Datatypes in HOL: Extensible Records RevisitedEncoding Object-oriented Datatypes in HOL: Extensible Records Revisited
Encoding Object-oriented Datatypes in HOL: Extensible Records Revisited
Ā 
A Framework for Secure Service Composition
A Framework for Secure Service CompositionA Framework for Secure Service Composition
A Framework for Secure Service Composition
Ā 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
Ā 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
Ā 

Recently uploaded (20)

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Ā 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
Ā 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Ā 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
Ā 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
Ā 
Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.
Ā 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdf
Ā 
Exploring UiPath Orchestrator API: updates and limits in 2024 šŸš€
Exploring UiPath Orchestrator API: updates and limits in 2024 šŸš€Exploring UiPath Orchestrator API: updates and limits in 2024 šŸš€
Exploring UiPath Orchestrator API: updates and limits in 2024 šŸš€
Ā 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Ā 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
Ā 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
Ā 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
Ā 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Ā 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Ā 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
Ā 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Ā 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
Ā 
Intro in Product Management - ŠšŠ¾Ń€Š¾Ń‚ŠŗŠ¾ ŠæрŠ¾ ŠæрŠ¾Ń„ŠµŃŃ–ŃŽ ŠæрŠ¾Š“Š°Šŗт Š¼ŠµŠ½ŠµŠ“Š¶ŠµŃ€Š°
Intro in Product Management - ŠšŠ¾Ń€Š¾Ń‚ŠŗŠ¾ ŠæрŠ¾ ŠæрŠ¾Ń„ŠµŃŃ–ŃŽ ŠæрŠ¾Š“Š°Šŗт Š¼ŠµŠ½ŠµŠ“Š¶ŠµŃ€Š°Intro in Product Management - ŠšŠ¾Ń€Š¾Ń‚ŠŗŠ¾ ŠæрŠ¾ ŠæрŠ¾Ń„ŠµŃŃ–ŃŽ ŠæрŠ¾Š“Š°Šŗт Š¼ŠµŠ½ŠµŠ“Š¶ŠµŃ€Š°
Intro in Product Management - ŠšŠ¾Ń€Š¾Ń‚ŠŗŠ¾ ŠæрŠ¾ ŠæрŠ¾Ń„ŠµŃŃ–ŃŽ ŠæрŠ¾Š“Š°Šŗт Š¼ŠµŠ½ŠµŠ“Š¶ŠµŃ€Š°
Ā 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
Ā 
Server-Driven User Interface (SDUI) at Priceline
Server-Driven User Interface (SDUI) at PricelineServer-Driven User Interface (SDUI) at Priceline
Server-Driven User Interface (SDUI) at Priceline
Ā 

Isabelle: Not Only a Proof Assistant

  • 1. Isabelle: Not Only a Proof Assistant Achim D. Brucker achim@brucker.ch http://www.brucker.ch/ joint work with Lukas BrĆ¼gger, Delphine Longuet, Yakoub Nemouchi, FrĆ©dĆ©ric Tuong, Burkhart Wolff Proof Assistants and Related Tools - The PART Project Technical University of Denmark, Kgs. Lyngby, Denmark September 24, 2015
  • 2. Isabelle: Not Only a Proof Assistant Abstract The Isabelle homepage describes Isabelle as ā€œa generic proof assistant. It allows mathematical formulas to be expressed in a formal language and provides tools for proving those formulas in a logical calculus.ā€ While this, without doubts, what most users of Isabelle are using Isabelle for, there is much more to discover: Isabelle is also a framework for building formal methods tools. In this talk, I will report on our experience in using Isabelle for building formal tools for high-level speciļ¬cations languages (e.g., OCL, Z) as well as using Isabelleā€™s core engine for new applications domains such as generating test cases from high-level speciļ¬cations.
  • 3.
  • 4.
  • 5.
  • 6. Motivation Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 4
  • 7. Motivation This is only the tip of the iceberg Isar jEdit auto define Isar command datatype packages own code generators Isabelle kernel tactic implementation generate codesledgehammer ML Interface Scala interface Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 5
  • 8. Outline 1 Motivation 2 Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x HOL-OCL 2.x HOL-TestGen 3 Conclusion
  • 9. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x UML/OCL in a nutshell UML Visual modeling language Object-oriented development Industrial tool support OMG standard Many diagram types, e.g., activity diagrams class diagrams . . . OCL Textual extension of the UML Allows for annotating UML diagrams In the context of classā€“diagrams: invariants preconditions postconditions Account balance:Integer id:Integer getId():Integer getBalance():Integer deposit(a:Integer):Boolean withdraw(a:Integer):Boolean accounts 1..* context Account inv: 0 <= id context Account::deposit(a:Integer):Boolean pre: 0 < a post: balance = balance@pre+a and id = id@pre context Account inv: 0 <= id context Account::deposit(a:Integer):Boolean pre: 0 < a post: balance = balance@pre+a and id = id@pre Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 7
  • 10. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Developing formals tools for UML/OCL? Turning UML/OCL into a formal method 1 A formal semantics of object-oriented data models (UML) typed path expressions inheritance . . . 2 A formal semantics of object-oriented constraints (OCL) a logic reasoning over path expressions large libraries three-valued logic . . . 3 And of course, we want a tool (HOL-OCL) a formal, machine-checked semantics for OO speciļ¬cations, an interactive proof environment for OO speciļ¬cations. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 8
  • 11. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Challenges (for a shallow embedding) Challenge 1: Can we ļ¬nd a injective, type preserving mapping of an object-oriented language (and datatypes) into HOL e:T āˆ’ā†’ e :: T (including subtyping)? Challenge 2: Can we support veriļ¬cation in a modular way (i.e., no replay of proof scripts after extending speciļ¬cations)? Challenge 3: Can we ensure consistency of our representation? Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 9
  • 12. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: O A s:String B b:Integer Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 13. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: B := O A s:String B b:Integer Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 14. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: B := (Otag Ɨoid) O A s:String B b:Integer Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 15. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: B := (Otag Ɨoid) Ɨ (Atag ƗString) O A s:String B b:Integer Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 16. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: B := (Otag Ɨoid) Ɨ (Atag ƗString) Ɨ (Btag ƗInteger) O A s:String B b:Integer Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 17. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Representing class types The ā€œextensible recordsā€ approach We assume a common superclass (O). A tag type guarantees uniquenessby (Otag := classO). Construct class type as tuple along inheritance hierarchy: Ī± B := (Otag Ɨoid) Ɨ (Atag ƗString) Ɨ (Btag ƗInteger) Ɨ Ī± O A s:String B b:Integer Ī± Advantages: it allows for extending class types (inheritance), subclasses are type instances of superclasses ā‡’ it allows for modular proofs, i.e., a statement Ļ†(x : : (Ī± B)) proven for class B is still valid after extending class B. However, it has a major disadvantage: modular proofs are only supported for one extension per class Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 10
  • 18. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Idea: a general universe type A universe type representing all classes of a class model supports modular proofs with arbitrary extensions provides a formalization of a extensible typed object store Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 11
  • 19. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 20. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 21. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A A Ī²O Ī±A Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 22. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A A Ī²O Ī±A Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ B B Ī²A Ī±B Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„ Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 23. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A A Ī²O Ī±A Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ B B Ī²A Ī±B Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„C C Ī²A Ī±C Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 24. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A A Ī²O Ī±A Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ B B Ī²A Ī±B Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„C C Ī²A Ī±C Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„ Uļ˜» (Ī±B ,Ī±C ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + (C Ɨ Ī±C āŠ„ + Ī²A ))āŠ„ + Ī²O )āŠ„ Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 25. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x An extensible object store O O Ī±O Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ A A Ī²O Ī±A Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ B B Ī²A Ī±B Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„C C Ī²A Ī±C Uļ˜¹ (Ī±O) = O Ɨ Ī±O āŠ„ Uļ›œ (Ī±A,Ī²O) = O Ɨ (A Ɨ Ī±A āŠ„ + Ī²O )āŠ„ Uļ˜ŗ (Ī±B ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + Ī²A )āŠ„ + Ī²O )āŠ„ Uļ˜» (Ī±B ,Ī±C ,Ī²O,Ī²A) = O Ɨ (A Ɨ (B Ɨ Ī±B āŠ„ + (C Ɨ Ī±C āŠ„ + Ī²A ))āŠ„ + Ī²O )āŠ„ U3 (Ī±B,Ī±C,Ī²O,Ī²A) U2 (Ī±B,Ī²O,Ī²A) U1 (Ī±A,Ī²O) U0 (Ī±O) Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 12
  • 26. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Merging universes Uļ›œ : A Uļ˜ŗa : A C Uļ˜ŗb : A B D Uļ˜» : A B C D Non-conļ¬‚icting Merges Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 13
  • 27. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Merging universes Uļ›œ : A Uļ˜ŗa : A C Uļ˜ŗb : A B D Uļ˜» : A B C D Non-conļ¬‚icting Merges Uļ›œ : A Uļ˜ŗa : A C Uļ˜ŗb : A B Uļ˜» : A BC Conļ¬‚icting Merges Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 13
  • 28. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Operations accessing the object store injections mkO o = Inl o with type Ī±O O ā†’ U0 Ī±O projections getO u = u with type U0 Ī±O ā†’ Ī±O O type casts A[O] = getO ā—¦ mkA with type Ī±A A ā†’ (A Ɨ Ī±A āŠ„ + Ī²O ) O O[A] = getA ā—¦ mkO with type (A Ɨ Ī±A āŠ„ + Ī²O ) O ā†’ Ī±A A . . . All deļ¬nitions are generated automatically Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 14
  • 29. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x ā€œCheckingā€ subtyping For each UML model, we have to show several properties: O A s:String B b:Integer subclasses are of the superclasses kind: isTypeB self isKindA self ā€œre-castingā€: isTypeB self self[A][B] = āŠ„ āˆ§ isTypeB (self[A][B][A] ) monotonicity of invariants, . . . All rules are derived automatically Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 15
  • 30. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x HOL-OCL HOL-OCL provides: a formal, machine-checked semantics for OO speciļ¬cations, an interactive proof environment for OO speciļ¬cations. HOL-OCL is integrated into a toolchain providing: extended well-formedness checking, proof-obligation generation, methodology support for UML/OCL, a transformation framework (including PO generation), code generators, support for SecureUML. HOL-OCL is publicly available: http://www.brucker.ch/projects/hol-ocl/. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 16
  • 31. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x The HOL-OCL architecture Standard ML (PolyML, sml/NJ) HOL-OCL Isabelle/HOL suļœ“sml HOL-OCL User Interface (extended Proof General) Repository UML/OCL PO-Manager Encoder Code-Gen. WF-Checks Model-Trans. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 17
  • 32. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x The HOL-OCL user interface Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 18
  • 33. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x The HOL-OCL high-level language The HOL-OCL proof language is an extension of Isabelleā€™s Isar language: importing UML/OCL: import_model "SimpleChair.zargo" "AbstractSimpleChair.ocl" include_only "AbstractSimpleChair" check well-formedness and generate proof obligations for reļ¬nement: analyze_consistency [data_reļ¬nement] "AbstractSimpleChair" starting a proof for a generated proof obligation: po "AbstractSimpleChair.ļ¬ndRole_enabled" generating code: generate_code "java" Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 19
  • 34. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x The encoder The model encoder is the main interface between su4sml and the Isabelle based part of HOL-OCL. The encoder declarers HOL types for the classiļ¬ers of the model, encodes type-casts, attribute accessors, and dynamic type and kind tests implicitly declared in the imported data model, encodes the OCL speciļ¬cation, i.e., class invariants operation speciļ¬cations and combines it with the core data model, and proves (automatically) methodology and analysis independent properties of the model. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 20
  • 35. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Tactics (proof procedures) OCL, as logic, is quite different from HOL (e.g., three-valuedness) Major Isabelle proof procedures, like simp and auto, cannot handle OCL efļ¬ciently. HOL-OCL provides several UML/OCL speciļ¬c proof procedures: embedding speciļ¬c tactics (e.g., unfolding a certain level) a OCL speciļ¬c context-rewriter a OCL speciļ¬c tableaux-prover . . . These language speciļ¬c variants increase the degree of proof for OCL. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 21
  • 36. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x Proof obligation generator A framework for proof obligation generation: Generates proof obligation in OCL plus minimal meta-language. Only minimal meta-language necessary: Validity: |= _, _ |= _ Meta level quantiļ¬ers: āˆƒ_. _, āˆƒ_. _ Meta level logical connectives: _ āˆØ _, _ āˆ§ _, Ā¬_ Examples for proof obligations are: (semantical) model consistency Liskovā€™s substitution principle reļ¬nement conditions . . . Can be easily extended (at runtime). Builds, together with well-formedness checking, the basis for tool-supported methodologies. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 22
  • 37. Outline 1 Motivation 2 Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x HOL-OCL 2.x HOL-TestGen 3 Conclusion
  • 38. Isabelle tools on top of Isabelle (Add-on) HOL-OCL 2.x HOL-OCL 2.0 (Featherweight OCL) Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 24
  • 39. Outline 1 Motivation 2 Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x HOL-OCL 2.x HOL-TestGen 3 Conclusion
  • 40. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen How to ensure system correctness, security, and safety? (Inductive) Veriļ¬cation Testing Formal (mathematical) proof Can show absence of all failures relative to speciļ¬cation Speciļ¬cation of based on abstractions Requires expertise in Formal Methods In industry: only for highly critical systems (regulations, certiļ¬cation) Execution of test cases Can show failures on real system Only shows failures for the parts of the system Requires less skills in Formal Methods In industry: widely used (often > 40% of dev. effort) Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 26
  • 41. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Is testing a ā€œpoor manā€™s veriļ¬cation?ā€ Or: Why should I test if I did a veriļ¬cation and vice versa? ā€œ Program testing can be used to show the presence of bugs, but never to show their absence! (Dijkstra) Assume you can choose between two aircraft for you next travel: Aircraft A: Fully formally veriļ¬ed Total number of ļ¬‚ights: 0 Aircraft B: Fully tested Total number of ļ¬‚ights: 1 000 Which aircraft would you take for your next trip? Which aircraft would Dijkstra take? Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 27
  • 42. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen What should we do? Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach Infrastructure&Conļ¬guration Application Operating System Hypervisor Server Application Runtime Container Operating System Backend Systems Observation: Both methods have their unique advantages Recommendation: Use a combination of veriļ¬cation and testing Our Vision: An integrated approach for test and veriļ¬cation Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
  • 43. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen What should we do? Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach Infrastructure&Conļ¬guration Application Operating System Hypervisor Server Application Runtime Container Operating System Backend Systems Separation Properties Safety Properties Observation: Both methods have their unique advantages Recommendation: Use a combination of veriļ¬cation and testing Our Vision: An integrated approach for test and veriļ¬cation Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
  • 44. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen What should we do? Vision: Use the Optimal Combination of Veriļ¬cation and Testing in an Integrated Approach Infrastructure&Conļ¬guration Application Operating System Hypervisor Server Application Runtime Container Operating System Backend Systems Separation Properties Safety Properties Sep.Prop. Spec.-basedTestingofSafetyProperties TestServerApp. IntegrationTest Observation: Both methods have their unique advantages Recommendation: Use a combination of veriļ¬cation and testing Our Vision: An integrated approach for test and veriļ¬cation Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 28
  • 45. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Implementing our vision in Isabelle: HOL-TestGen An interactive model-based test tool built upon the theorem prover Isabelle/HOL speciļ¬cation language: HOL unique combination of test and proof veriļ¬cation environment user controllable test-hypotheses veriļ¬ed transformations supports the complete MBT workļ¬‚ow basis for domain-speciļ¬c extensions successfully used in large case-studies freely available at: http://www.brucker.ch/projects/hol-testgen/ Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 29
  • 46. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen The HOL-TestGen architecture Execution Environment HOL-TestGen Isabelle/HOL Specification Test Generation Test SpecificationSystem Specification Verification and Transformation Test Executable System under Test Test Case Generation Test Data Generation Test Script (incl. Test Oracle) Generation Inductive Verification Verified Model Transformation Test Harness Generated Test Script and Test Oracle Test Adapter Scheduler Control Scheduler Mapping Seamless combination of testing and veriļ¬cation Black-box vs. white-box: Speciļ¬cation-based black-box test as default White-box and Grey-box also possible Unit vs. sequence testing Unit testing straight forwards Sequence testing via monadic construction Coverage: Path Coverage (on the speciļ¬cation) as default Scalability: Veriļ¬ed test transformations can increase testability by several orders of magnitude Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 30
  • 47. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Excursus: test hypothesis ā€“ the difference between test and proof Idea: We introduce formal test hypothesis ā€œon the ļ¬‚yā€ Technically, test hypothesis are marked using the following predicate: THYP : bool ā‡’bool THYP(x) ā‰”x Two test hypotheses are common: Regularity hypothesis: captures inļ¬nite data structures (splits), e.g., for lists x = [] Ā· Ā· Ā· P a x = [a] Ā· Ā· Ā· P a b h x = [a, b] Ā· Ā· Ā· P THYP āˆ€x.k < size x āˆ’ā†’ P x P Uniformity hypothesis: captures test data selection ā€œOnce a system under test behaves correct for one test case, it behaves correct for all test casesā€ n) [[ C1 ?x; ...; Cm ?x]] =ā‡’TS ?x n+1) THYP((āˆƒ x. C1 x ... Cm x āˆ’ā†’TS x) āˆ’ā†’(āˆ€ x. C1 x ... Cm x āˆ’ā†’TS x)) Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 31
  • 48. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Test case generation: an example theory TestPrimRec imports Main begin primrec x mem [] = False x mem (y#S) = if y = x then True else x mem S test_spec: "x mem S =ā‡’prog x S" apply(gen_testcase) Result: 1. prog ?x1 [?x1] 2. prog ?x2 [?x2,?b2] 3. ?a3=?x3 =ā‡’prog ?x3 [?a3,?x3] 4. THYP(āˆƒ x.prog x [x] āˆ’ā†’prog x [x] ... 7. THYP(āˆ€ S. 3 ā‰¤size S āˆ’ā†’x mem S āˆ’ā†’prog x S) Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 32
  • 49. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Use case: testing ļ¬rewall policies DMZ Internet (extern) Intranet (intern) 000000 00 111111 11 source destination protocol port action Internet dmz udp 25 allow Internet dmz tcp 80 allow dmz intranet tcp 25 allow intranet dmz tcp 993 allow intranet Internet udp 80 allow any any any any deny Our goal: Show correctness of the conļ¬guration and implementation of active network components Today: ļ¬rewalls are stateless packet ļ¬lters Our approach also supports (not considered in this talk): network address translation (NAT) port translation, port forwarding stateful ļ¬rewalls Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 33
  • 50. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen HOL model of a ļ¬rewall policy A ļ¬rewall makes a decision based on single packets. types (Ī±,Ī²) packet = id Ɨ(Ī±::adr) src Ɨ(Ī±::adr) dest ƗĪ²content Different address and content representations are possible. A policy is a mapping from packets to decisions (allow, deny, . . . ): types Ī±ā†’Ī²= Ī± Ī²decision types (Ī±,Ī²) Policy = (Ī±,Ī²) packet ā†’unit Remark: for policies with network address translation: types (Ī±,Ī²) NAT_Policy = (Ī±,Ī²) packet ā†’(Ī±,Ī²) packet set Policy combinators allow for deļ¬ning policies: deļ¬nition allow_all_from :: (Ī±::adr) net ā‡’(Ī±,Ī²) Policy where allow_all_from src_net = {pa. src pa src_net} AU Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 34
  • 51. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen The policy source destination protocol port action Internet dmz udp 25 allow Internet dmz tcp 80 allow dmz intranet tcp 25 allow intranet dmz tcp 993 allow intranet Internet udp 80 allow any any any any deny deļ¬nition TestPolicy where TestPolicy = allow_port udp 25 internet dmz āŠ• allow_port tcp 80 internet dmz āŠ• allow_port tcp 25 dmz intranet āŠ• allow_port tcp 993 intranet dmz āŠ• allow_port udp 80 intranet internet āŠ• DU where DU is the policy that denies all trafļ¬c Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 35
  • 52. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Testing stateless ļ¬rewalls The test speciļ¬cation: test_spec test: ā€œP x =ā‡’FUT x = Policy xā€™ā€™ FUT: Placeholder for Firewall Under Test Predicate P restricts packets we are interested in, e.g., wellformed packets which cross some network boundary Core test case generation algorithm: compute conjunctive-normal form ļ¬nd satisfying assignments for each clause (partition) Generates test data like (simpliļ¬ed): FUT(1,((8,13,12,10),6,tcp),((172,168,2,1),80,tcp),data)= (deny() Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 36
  • 53. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Problems with the direct approach The direct approach does not scale: R1 R2 R3 R4 Networks 3 3 4 3 Rules 12 9 13 13 TC Generation Time (sec) 26382 187 59364 1388 Test Cases 1368 264 1544 470 Reason: Large cascades of case distinctions over input and output =ā‡’ However, many of these case splits are redundant Many combinations due to subnets =ā‡’ Pre-partitioning of test space according to subnets Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 37
  • 54. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Model transformations for TCG Idea is fundamental to model-based test case generation. E.g.: if x < āˆ’10 then if x < 0 then P else Q else Q if x < āˆ’10 then P else Q lead to different test cases The following two policies produce a different set of test cases: AllowAll dmz internet āŠ• DenyPort dmz internet 21 āŠ• DU AllowAll dmz internet āŠ• DU Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 38
  • 55. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen A typical transformation Remove all rules allowing a port between two networks, if a former rule already denies all the rules between these two networks fun removeShadowRules2:: where removeShadowRules2 ((AllowPortFromTo x y p)#z) = if (DenyAllFromTo x y) āˆˆ (set z) then removeShadowRules2 z else (AllowPortFromTo x y p)#(removeShadowRules2 z) | removeShadowRules2 (x#y) = x#(removeShadowRules2 y) | removeShadowRules2 [] = [] Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 39
  • 56. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Correctness of the normalisation Correctness of the normalization must hold for arbitrary input policies, satisfying certain preconditions As HOL-TestGen is built upon the theorem prover Isabelle/HOL, we can prove formally the correctness of such normalisations: theorem C_eq_normalize: assumes member DenyAll p assumes allNetsDistinct p shows C (list2policy (normalize p)) = C p Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 40
  • 57. Isabelle tools on top of Isabelle (Add-on) HOL-TestGen Empirical results R1 R2 R3 R4 Not Normalized Networks 3 3 4 3 Rules 12 9 13 13 TC Generation Time (sec) 26382 187 59364 1388 Test Cases 1368 264 1544 470 Normalized Rules 14 14 24 26 Normalization (sec) 0.6 0.4 1.1 0.8 TC Generation Time (sec) 0.9 0.6 1.2 0.7 Test Cases 20 20 34 22 The normalization of policies decreases the number of test cases and the required test case generation time by several orders of magnitude. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 41
  • 58. Outline 1 Motivation 2 Isabelle tools on top of Isabelle (Add-on) HOL-OCL 1.x HOL-OCL 2.x HOL-TestGen 3 Conclusion
  • 59. Conclusion Conclusion Modern interactive theorem provers can be used as frameworks for building formal methods tools. If you ā€œprototypeā€ formal methods tools, consider to reuse the infrastructure of your theorem prover of choice Isabelle provides a lot of features: deļ¬ning nice syntax for DSLs deļ¬ning new top-level commands developing own tactics generate code . . . There is another nice example: attend the next talk by Sebastian! Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 43
  • 60. Thank you for your attention! Any questions or remarks?
  • 61. Conclusion Related Publications I Achim D. Brucker, Lukas BrĆ¼gger, Paul Kearney, and Burkhart Wolff. Veriļ¬ed ļ¬rewall policy transformations for test-case generation. In Third International Conference on Software Testing, Veriļ¬cation, and Validation (ICST), pages 345ā€“354. IEEE Computer Society, 2010. http://www.brucker.ch/bibliography/abstract/brucker.ea-firewall-2010. Achim D. Brucker, Lukas BrĆ¼gger, and Burkhart Wolff. HOL-TestGen/FW: An environment for speciļ¬cation-based ļ¬rewall conformance testing. In Zhiming Liu, Jim Woodcock, and Huibiao Zhu, editors, International Colloquium on Theoretical Aspects of Computing (ICTAC), number 8049 in Lecture Notes in Computer Science, pages 112ā€“121. Springer-Verlag, 2013. http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-testgen-fw-2013. Achim D. Brucker, Lukas BrĆ¼gger, and Burkhart Wolff. Formal ļ¬rewall conformance testing: An application of test and proof techniques. Software Testing, Veriļ¬cation & Reliability (STVR), 25(1):34ā€“71, 2015. http://www.brucker.ch/bibliography/abstract/brucker.ea-formal-fw-testing-2014. Achim D. Brucker, Delphine Longuet, FrĆ©dĆ©ric Tuong, and Burkhart Wolff. On the semantics of object-oriented data structures and path expressions. In Jordi Cabot, Martin Gogolla, IstvĆ”n RĆ”th, and Edward D. Willink, editors, Proceedings of the MoDELs 2013 OCL Workshop (OCL 2013), volume 1092 of CEUR Workshop Proceedings, pages 23ā€“32. ceur-ws.org, 2013. http://www.brucker.ch/bibliography/abstract/brucker.ea-path-expressions-2013. Achim D. Brucker, Frank Rittinger, and Burkhart Wolff. hol-z 2.0: A proof environment for Z-speciļ¬cations. Journal of Universal Computer Science, 9(2):152ā€“172, February 2003. http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-z-2003. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 45
  • 62. Conclusion Related Publications II Achim D. Brucker and Burkhart Wolff. hol-ocl ā€“ A Formal Proof Environment for UML/OCL. In JosĆ© Fiadeiro and Paola Inverardi, editors, Fundamental Approaches to Software Engineering (FASE), number 4961 in Lecture Notes in Computer Science, pages 97ā€“100. Springer-Verlag, 2008. http://www.brucker.ch/bibliography/abstract/brucker.ea-hol-ocl-2008. Achim D. Brucker and Burkhart Wolff. Extensible universes for object-oriented data models. In Jan Vitek, editor, ECOOP 2008 ā€“ Object-Oriented Programming, number 5142 in Lecture Notes in Computer Science, pages 438ā€“462. Springer-Verlag, 2008. http://www.brucker.ch/bibliography/abstract/brucker.ea-extensible-2008. Achim D. Brucker and Burkhart Wolff. Semantics, calculi, and analysis for object-oriented speciļ¬cations. Acta Informatica, 46(4):255ā€“284, July 2009. ISSN 0001-5903. http://www.brucker.ch/bibliography/abstract/brucker.ea-semantics-2009. Achim D. Brucker and Burkhart Wolff. On theorem prover-based testing. Formal Aspects of Computing, 25(5):683ā€“721, 2013. ISSN 0934-5043. http://www.brucker.ch/bibliography/abstract/brucker.ea-theorem-prover-2012. Achim D. Brucker Isabelle: Not Only a Proof Assistant September 24, 2015 46