SlideShare a Scribd company logo
1 of 62
Download to read offline
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
specifications 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 specifications.
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 specifications,
an interactive proof environment for OO specifications.
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 find 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 verification in a modular way
(i.e., no replay of proof scripts after extending specifications)?
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-conflicting 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-conflicting Merges
U
:
A
Ua
:
A
C
Ub
:
A
B
U
:
A
BC
Conflicting 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 definitions 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 specifications,
an interactive proof environment for OO specifications.
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 refinement:
analyze_consistency [data_refinement] "AbstractSimpleChair"
starting a proof for a generated proof obligation:
po "AbstractSimpleChair.findRole_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 classifiers of the model,
encodes
type-casts,
attribute accessors, and
dynamic type and kind tests implicitly declared in the imported data model,
encodes the OCL specification, i.e.,
class invariants
operation specifications
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 efficiently.
HOL-OCL provides several UML/OCL specific proof procedures:
embedding specific tactics (e.g., unfolding a certain level)
a OCL specific context-rewriter
a OCL specific tableaux-prover
. . .
These language specific 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 quantifiers: ∃_. _, ∃_. _
Meta level logical connectives: _ ∨ _, _ ∧ _, ¬_
Examples for proof obligations are:
(semantical) model consistency
Liskov’s substitution principle
refinement 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) Verification Testing
Formal (mathematical) proof
Can show absence of all
failures relative to specification
Specification of based on
abstractions
Requires expertise in Formal
Methods
In industry:
only for highly critical systems
(regulations, certification)
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 verification?”
Or: Why should I test if I did a verification 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 verified
Total number of flights: 0
Aircraft B:
Fully tested
Total number of flights: 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 Verification and Testing in an Integrated Approach
Infrastructure&Configuration
Application
Operating System
Hypervisor
Server Application
Runtime Container
Operating System
Backend Systems
Observation:
Both methods have their unique advantages
Recommendation:
Use a combination of verification and testing
Our Vision:
An integrated approach for test and verification
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 Verification and Testing in an Integrated Approach
Infrastructure&Configuration
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 verification and testing
Our Vision:
An integrated approach for test and verification
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 Verification and Testing in an Integrated Approach
Infrastructure&Configuration
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 verification and testing
Our Vision:
An integrated approach for test and verification
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
specification language: HOL
unique combination of test and proof
verification environment
user controllable test-hypotheses
verified transformations
supports the complete MBT workflow
basis for domain-specific 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 verification
Black-box vs. white-box:
Specification-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 specification) as default
Scalability:
Verified 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 fly”
Technically, test hypothesis are marked using the following predicate:
THYP : bool ⇒bool
THYP(x) ≡x
Two test hypotheses are common:
Regularity hypothesis: captures infinite 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 firewall 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
configuration and
implementation
of active network components
Today: firewalls are stateless packet filters
Our approach also supports (not considered in this talk):
network address translation (NAT)
port translation, port forwarding
stateful firewalls
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 firewall policy
A firewall 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 defining policies:
definition
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
definition 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 traffic
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 firewalls
The test specification:
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
find satisfying assignments for each clause (partition)
Generates test data like (simplified):
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:
defining nice syntax for DSLs
defining 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.
Verified firewall policy transformations for test-case generation.
In Third International Conference on Software Testing, Verification, 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 specification-based firewall 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 firewall conformance testing: An application of test and proof techniques.
Software Testing, Verification & 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-specifications.
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 specifications.
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

Collections and generic class
Collections and generic classCollections and generic class
Collections and generic classifis
 
Ios development
Ios developmentIos development
Ios developmentelnaqah
 
38 object-concepts (1)
38 object-concepts (1)38 object-concepts (1)
38 object-concepts (1)Shambhavi Vats
 
Pi j2.2 classes
Pi j2.2 classesPi j2.2 classes
Pi j2.2 classesmcollison
 
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 PotatoMongoDB
 

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 guide90lschmidt1170
 
學生學習歷程簡報
學生學習歷程簡報學生學習歷程簡報
學生學習歷程簡報Fang-fang
 
Geog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt friGeog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt frilschmidt1170
 
오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)승훈 오
 
Tutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareTutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareAnnie Nitzschke Peña
 
Pi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassPi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassAna Menezes
 
UDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIIUDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIINEEVEE Technologies
 
Audio in linux embedded
Audio in linux embeddedAudio in linux embedded
Audio in linux embeddedtrx2001
 

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 NightmareAchim D. Brucker
 
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 ProofAchim D. Brucker
 
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 InternetAchim D. Brucker
 
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 AppsAchim D. Brucker
 
The Evil Friend in Your Browser
The Evil Friend in Your BrowserThe Evil Friend in Your Browser
The Evil Friend in Your BrowserAchim D. Brucker
 
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 CodeAchim D. Brucker
 
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 VendorAchim 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
 
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...Achim D. Brucker
 
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...Achim D. Brucker
 
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 ...Achim D. Brucker
 
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...Achim D. Brucker
 
Industrial Challenges of Secure Software Development
Industrial Challenges of Secure Software DevelopmentIndustrial Challenges of Secure Software Development
Industrial Challenges of Secure Software DevelopmentAchim D. Brucker
 
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 ToolsAchim D. Brucker
 
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/...Achim D. Brucker
 
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 ScaleAchim D. Brucker
 
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 PropertiesAchim 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
 
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 RevisitedAchim D. Brucker
 
A Framework for Secure Service Composition
A Framework for Secure Service CompositionA Framework for Secure Service Composition
A Framework for Secure Service CompositionAchim 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

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

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 specifications 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 specifications.
  • 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 specifications, an interactive proof environment for OO specifications. 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 find 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 verification in a modular way (i.e., no replay of proof scripts after extending specifications)? 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-conflicting 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-conflicting Merges U : A Ua : A C Ub : A B U : A BC Conflicting 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 definitions 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 specifications, an interactive proof environment for OO specifications. 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 refinement: analyze_consistency [data_refinement] "AbstractSimpleChair" starting a proof for a generated proof obligation: po "AbstractSimpleChair.findRole_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 classifiers of the model, encodes type-casts, attribute accessors, and dynamic type and kind tests implicitly declared in the imported data model, encodes the OCL specification, i.e., class invariants operation specifications 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 efficiently. HOL-OCL provides several UML/OCL specific proof procedures: embedding specific tactics (e.g., unfolding a certain level) a OCL specific context-rewriter a OCL specific tableaux-prover . . . These language specific 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 quantifiers: ∃_. _, ∃_. _ Meta level logical connectives: _ ∨ _, _ ∧ _, ¬_ Examples for proof obligations are: (semantical) model consistency Liskov’s substitution principle refinement 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) Verification Testing Formal (mathematical) proof Can show absence of all failures relative to specification Specification of based on abstractions Requires expertise in Formal Methods In industry: only for highly critical systems (regulations, certification) 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 verification?” Or: Why should I test if I did a verification 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 verified Total number of flights: 0 Aircraft B: Fully tested Total number of flights: 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 Verification and Testing in an Integrated Approach Infrastructure&Configuration Application Operating System Hypervisor Server Application Runtime Container Operating System Backend Systems Observation: Both methods have their unique advantages Recommendation: Use a combination of verification and testing Our Vision: An integrated approach for test and verification 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 Verification and Testing in an Integrated Approach Infrastructure&Configuration 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 verification and testing Our Vision: An integrated approach for test and verification 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 Verification and Testing in an Integrated Approach Infrastructure&Configuration 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 verification and testing Our Vision: An integrated approach for test and verification 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 specification language: HOL unique combination of test and proof verification environment user controllable test-hypotheses verified transformations supports the complete MBT workflow basis for domain-specific 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 verification Black-box vs. white-box: Specification-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 specification) as default Scalability: Verified 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 fly” Technically, test hypothesis are marked using the following predicate: THYP : bool ⇒bool THYP(x) ≡x Two test hypotheses are common: Regularity hypothesis: captures infinite 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 firewall 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 configuration and implementation of active network components Today: firewalls are stateless packet filters Our approach also supports (not considered in this talk): network address translation (NAT) port translation, port forwarding stateful firewalls 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 firewall policy A firewall 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 defining policies: definition 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 definition 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 traffic 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 firewalls The test specification: 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 find satisfying assignments for each clause (partition) Generates test data like (simplified): 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: defining nice syntax for DSLs defining 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. Verified firewall policy transformations for test-case generation. In Third International Conference on Software Testing, Verification, 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 specification-based firewall 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 firewall conformance testing: An application of test and proof techniques. Software Testing, Verification & 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-specifications. 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 specifications. 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