33
Towards Domain Refinement for UML/OCL Bounded Verification Robert Clarisó Universitat Oberta de Catalunya - Spain Carlos A. González AtlanMod team - Inria, Mines Nantes, LINA - France Jordi Cabot ICREA - Spain 13th Int. Conf on SW Enginerering and Formal Methods 8-11 September 2015, York, UK

Towards Domain Refinement for UML/OCL Bounded Verification

Embed Size (px)

Citation preview

Page 1: Towards Domain Refinement for UML/OCL Bounded Verification

Towards Domain Refinement for UML/OCL Bounded Verification

Robert Clarisó Universitat Oberta de Catalunya - Spain

Carlos A. González AtlanMod team - Inria, Mines Nantes, LINA - France

Jordi Cabot ICREA - Spain

13th Int. Conf on SW Enginerering and Formal Methods8-11 September 2015, York, UK

Page 2: Towards Domain Refinement for UML/OCL Bounded Verification

Motivation

Who? The reader

What?

Where?

Find Wally

Inside the page

Page 3: Towards Domain Refinement for UML/OCL Bounded Verification

Motivation

Who? The reader

What?

Where?

Find Wally

Inside the page

Page 4: Towards Domain Refinement for UML/OCL Bounded Verification

Motivation

Who? A solver

What?

Where?

Find faults

In a bounded state space

Page 5: Towards Domain Refinement for UML/OCL Bounded Verification

1. Bounded verification

2. Related work

Outline

2. Related work

3. Solution: refinement

4. Experimental results

5. Conclusions

Page 6: Towards Domain Refinement for UML/OCL Bounded Verification

Model M

Model-Based Verification

A B

C

Consistent

No contradictionsA

1

2

Property P

UML

Class diagram

Non-redundant

Lack of duplicities

A B

C

context C inv:

self.a->

excludes(self)

OCL

Invariants

Does model M satisfy correctness property P?

Page 7: Towards Domain Refinement for UML/OCL Bounded Verification

VERIFICATION TOOL

Model-based verification: overview

?

Model

A B

C

Correctness

Formal Notation

SAT / CP

?Correctness

Property

FiniteBounds

Designer

Feedback

Example or ? Counterexample or ?

Reasoning Engine

Page 8: Towards Domain Refinement for UML/OCL Bounded Verification

Bound selection

Choose “suitable” verification bounds for the solver

Goal

CONFIDENCE

EFFICIENCY

BOUNDSSmall Large

Fast Slow

Less More

Page 9: Towards Domain Refinement for UML/OCL Bounded Verification

Bound selection: heuristics

Small bounds are sufficient to detect most faults

Small scope hypothesis

Repeat analysis progressively increasing bounds

Incremental scoping

Page 10: Towards Domain Refinement for UML/OCL Bounded Verification

Our approach: bound refinement

VERIFICATION TOOLModel

A B

C Formal Notation

SAT / CP

CorrectnessProperty

Finite Bounds

Reasoning Engine

Feedback

Example or ?Countexample or ?

Page 11: Towards Domain Refinement for UML/OCL Bounded Verification

Our approach: bound refinement

VERIFICATION TOOLModel

A B

C Formal Notation

SAT / CP

CorrectnessProperty

Finite Bounds

Reasoning Engine

TighterboundsBound

refinement

Feedback

Example or ?Countexample or ?

Page 12: Towards Domain Refinement for UML/OCL Bounded Verification

Related work

Abstract size-related info toreason about size properties

Size abstraction

Bound propagation

Yu et al (FSE’2007)

CP solvers e.g. Remove improductive values from verification bounds

CP solvers e.g.

Interval Constraint Solver in eCLiPSe

This work:

Size abstraction + Bound propagation

Size properties CP solversArbitrary SAT

Page 13: Towards Domain Refinement for UML/OCL Bounded Verification

Running example: production facility

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Property : Strong satisfiability

“It should be possible to populate of each non-abstract class while satisfying all integrity constraints”

Page 14: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Running example: size abstraction

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Multiplicities

“4 Parts per Machine”

Generalizations

“All Cutters are Machines”

Invariants

“There is at least one Grinder ”

Page 15: Towards Domain Refinement for UML/OCL Bounded Verification

Size abstraction for OCL

OCL Expression Abstract OCL Expression

Refers to the values in an instance of the model

Refers to the size of the model instance

OCL expression Abstraction

col->including( object ) Col <= Exp <= Col + 1

col->exists( var | cond ) (0 <= Exp <= 1) ∧

(Col = 0) -> (Exp = 0)

Page 16: Towards Domain Refinement for UML/OCL Bounded Verification

V = { x ∈ [0,5], y ∈ [0,7] }

C = { x + y = 7, x + 1 ≥ 2y }y

(x ≤ 5) ∧ (x + 1 ≥ 2y)

Integer Bound Propagation

xz

=> y ≤ 3

(x ≤ 5) ∧ (x + y = 7)

=> y ≥ 2

(y ≤ 3) ∧ (x + y = 7)

=> x ≥ 4

Page 17: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (1/4)

Domain bounds Source

Machine

Cutter

Grinder

Part

Uses

Serial

Number of objects of type Machine

Number of objects of type Cutter

Number of objects of type Grinder

Number of objects of type Part

Number of links in association Uses

Number of distinct values of attribute Serial

Page 18: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (1/4)

Domain bounds Source

Machine

Cutter

Grinder

Part

Uses

Serial

Number of objects of type Machine

Number of objects of type Cutter

Number of objects of type Grinder

Number of objects of type Part

Number of links in association Uses

Number of distinct values of attribute Serial

Page 19: Towards Domain Refinement for UML/OCL Bounded Verification

Constraint Source

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (2/4)

Constraint Source

Machine = Cutter + Grinder

Uses ≤ Part * Machine

Uses = 4 * Machine

Uses ≤ Part

Part ≤ Serial

Cutter ≥ 1

Grinder ≥ 1

Generalization + Abstract class

Associaton Uses

Association end pieces

Association end device

Invariant UniqueSerials

Invariant MachineAvailability

Invariant MachineAvailability

Page 20: Towards Domain Refinement for UML/OCL Bounded Verification

Constraint Source

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (2/4)

Constraint Source

Machine = Cutter + Grinder

Uses ≤ Part * Machine

Uses = 4 * Machine

Uses ≤ Part

Part ≤ Serial

Cutter ≥ 1

Grinder ≥ 1

Generalization + Abstract class

Associaton Uses

Association end pieces

Association end device

Invariant UniqueSerials

Invariant MachineAvailability

Invariant MachineAvailability

Page 21: Towards Domain Refinement for UML/OCL Bounded Verification

Constraint Source

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (2/4)

Constraint Source

Machine = Cutter + Grinder

Uses ≤ Part * Machine

Uses = 4 * Machine

Uses ≤ Part

Part ≤ Serial

Cutter ≥ 1

Grinder ≥ 1

Generalization + Abstract class

Associaton Uses

Association end pieces

Association end device

Invariant UniqueSerials

Invariant MachineAvailability

Invariant MachineAvailability

Page 22: Towards Domain Refinement for UML/OCL Bounded Verification

Constraint Source

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (2/4)

Constraint Source

Machine = Cutter + Grinder

Uses ≤ Part * Machine

Uses = 4 * Machine

Uses ≤ Part

Part ≤ Serial

Cutter ≥ 1

Grinder ≥ 1

Generalization + Abstract class

Associaton Uses

Association end pieces

Association end device

Invariant UniqueSerials

Invariant MachineAvailability

Invariant MachineAvailability

Page 23: Towards Domain Refinement for UML/OCL Bounded Verification

Constraint Source

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (2/4)

Constraint Source

Machine = Cutter + Grinder

Uses ≤ Part * Machine

Uses = 4 * Machine

Uses ≤ Part

Part ≤ Serial

Cutter ≥ 1

Grinder ≥ 1

Generalization + Abstract class

Associaton Uses

Association end pieces

Association end device

Invariant UniqueSerials

Invariant MachineAvailability

Invariant MachineAvailability

Page 24: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (3/4)

Domain bounds Initial Bound Inferred Bound

Machine

Cutter

Grinder

Part

Uses

Serial

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

Page 25: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (3/4)

Domain bounds Initial Bound Inferred Bound

Machine

Cutter

Grinder

Part

Uses

Serial

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[2, ∞)

[1, ∞)

[1, ∞)

[8, ∞)

[8, ∞)

[8, ∞)

Inferred bounds with no user input

Page 26: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (4/4)

Domain bounds Initial Bound Inferred Bound

Machine

Cutter

Grinder

Part

Uses

Serial

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, 10]

[2, 2]

[1, 1]

[1, 1]

[8, 8]

[8, 8]

[8, 8]

Page 27: Towards Domain Refinement for UML/OCL Bounded Verification

context Part inv UniqueSerials :

Part::allInstances()->isUnique(serial)

context Machine inv MachineAvailability :

Cutter::allInstances()->exists(c|c:idle) and

Grinder::allInstances()->exists(g|g:idle)

Refinement (4/4)

Domain bounds Initial Bound Inferred Bound

Machine

Cutter

Grinder

Part

Uses

Serial

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, ∞)

[0, 10]

[2, 2]

[1, 1]

[1, 1]

[8, 8]

[8, 8]

[8, 8]

One choice is sufficient to bind the state space

Page 28: Towards Domain Refinement for UML/OCL Bounded Verification

Designer

UML Model

A B

C

Domain BoundsX = [1,20], Y = [2, 15], ...

Experimental set-up

KodKod Model Finder

Sat4j SAT Solver

UML-based Specification Environment (USE)

Page 29: Towards Domain Refinement for UML/OCL Bounded Verification

Designer

Domain BoundsX = [1,20], Y = [2, 15], ...

UML Model

A B

CBound refinement

Experimental set-up

KodKod Model Finder

Sat4j SAT Solver

Bound refinement

UML-based Specification Environment (USE)

Page 30: Towards Domain Refinement for UML/OCL Bounded Verification

Experimental results: Summary (1/2)

Lightly constrained

(“Easy”)

Satisfiable Unsatisfiable–

Seconds Seconds

(“Easy”)

Highly constrained

(“Hard”)

Difficulty +–

+

Minutes Hours

Page 31: Towards Domain Refinement for UML/OCL Bounded Verification

Experimental results: Summary (1/2)

Lightly constrained

(“Easy”)

Satisfiable Unsatisfiable

No improvement No improvement

(“Easy”)

Highly constrained

(“Hard”)

Speed-ups from 1,7x to 11x

Speed-ups from2x to 50x

Overhead of bound tightening: <1 second

Page 32: Towards Domain Refinement for UML/OCL Bounded Verification

Conclusions… in 140 chars

Quick preprocessing to

make SAT-based verification

faster and more usable

Target: UML/OCL

Up to 50x speed-up

TODO: further experiments

Tweet0

Page 33: Towards Domain Refinement for UML/OCL Bounded Verification

Thank you for

your attention!

Robert Clarisó

[email protected]

@robertclariso