progetto gr 2016-17 verifca formale di modelli e programmi ...€¦ · emanuele de angelis, fabio...

23
Emanuele De Angelis Università degli Studi `G. d'Annunzio' Chieti-Pescara joint work with F. Fioravanti (UdA), M. C. Meo (UdA), A. Pettorossi (U. Tor Vergata), and M. Proietti (IASI-CNR) Convegno GNCS – Montecatini Terme, 14–16 febbraio 2018 Emanuele De Angelis Università degli Studi `G. d'Annunzio' Chieti-Pescara joint work with F. Fioravanti (UdA), M. C. Meo (UdA), A. Pettorossi (U. Tor Vergata), and M. Proietti (IASI-CNR) Convegno GNCS – Montecatini Terme, 14–16 febbraio 2018 Progetto GR 2016-17 Verifca formale di modelli e programmi basata sulla trasformazione di clausole di Horn con vincoli Progetto GR 2016-17 Verifca formale di modelli e programmi basata sulla trasformazione di clausole di Horn con vincoli

Upload: others

Post on 30-Apr-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Emanuele De AngelisUniversità degli Studi `G. d'Annunzio' Chieti-Pescara

joint work with F. Fioravanti (UdA), M. C. Meo (UdA), A. Pettorossi (U. Tor Vergata), and M. Proietti (IASI-CNR)

Convegno GNCS – Montecatini Terme, 14–16 febbraio 2018

Emanuele De AngelisUniversità degli Studi `G. d'Annunzio' Chieti-Pescara

joint work with F. Fioravanti (UdA), M. C. Meo (UdA), A. Pettorossi (U. Tor Vergata), and M. Proietti (IASI-CNR)

Convegno GNCS – Montecatini Terme, 14–16 febbraio 2018

Progetto GR 2016-17

Verifca formale di modelli e programmi basata sulla trasformazione di clausole di Horn con vincoli

Progetto GR 2016-17

Verifca formale di modelli e programmi basata sulla trasformazione di clausole di Horn con vincoli

Automatic Verifcation of (software) artifacts

Providing a proof that an artifact (for instance, a model or a program) satisfes its specifcation.

Use a mathematical formalism to:● model artifacts, and● derive specifcations as theorems.

Constrained Horn Clauses (CHCs)

First order formulas of the form

where:● ,…, , and are atomic formulas, and● c is a formula in a theory of constraints.

Formulas are universally quantifed in front.

We use the syntax of Logic Programming

( Head Body )

B1∧…∧Bn∧c→H

H←c ,B1 ,… ,Bn

B1 BnB1B1 H

Relational VerifcationProving relations between programs

?

Program Equivalence

If P1 terminates on the input i

1 producing o

1 &

P2 terminates on the input i

2 producing o

2 &

i1 equals to i

2

then o

1 equals to o

2

P1 P2

CHC encoder CHCs

Programs

Rule-basedCHC transformer

Transformed CHCs

Specifcation

Verifcation of Relational Properties using transformation of CHCs

Transformationstrategy

unfolddefnefold

1

2

3

1

23 CHC solver

InterpreterSemantics of C &Specifcation Logic

I

CP2

CP1

φ

φ

φ

\

Example

global variables of P1: {x1, z1}

non-tail recursive

global variables of P2: {x2, y2, z2}

iterative

z1=∑i=0

x1

i z2=x2×y2

P1 P2

Relationalproperty

Specifying relational properties using CHCs

The relational property is translated into the clause

pre-relation

input/output relation

input/output relation

post-relation

P1 P2

P1

P2

CHC translation:

Relational property:

LinearIntegerArithmeticconstraints

Interpreter (a glimpse)Operational semantics of the programming language

input/output relation

initial C and fnal C' confgurations

cf(cmd(Label,Command),Environment)

x=e;S

SV

Interpreters &CHC specialization

Take advantage of static information, that is,● actual programs● relational property

to customize the interpreter.

By specializing the interpreter w.r.t. the static input, we get CHCs with no references to

● reach ● tr ● complex terms representing confgurations

void sum_upto() { z1 = f(x1);}int f(int n1) { int r1; if (n1<=0) { r1 = 0; } else { r1 = f(n1-1) + n1; } return r1;}

su(X,Z’) ← f(X,Z’)

f(X,Z) ← N≤0, Z=0

f(N,Z) ← N≥1, N1=N-1, Z=R+N, f(N1,R)

input/outputrelation

Input/Output relation of P1

P1 P2

P2

P1

prove the validity of a relational property reduces to

prove the satisfability of CHCs

Satisfability of CHCs

Satisfability of CHCs

State-of-the-art solvers for CHCs with Linear Integer Arithmetic(LIA) look for models of single atoms: and

Hence, LIA solvers should discover quadratic relations:

Predicate pairing transformation

“Solution 1”: use a solver for non-linear integer arithmetic

drawback: satisfability of constraints is undecidable

(decide satisfability of Diophantine equations)

Solution 2: predicate pairing transformation

● composes the predicates f and g into a new predicate

fg equivalent to their conjunction

● objective: discover linear relations among variables

occurring in f and g may help solvers in proving the

satisfability of CHCs

Transformed CHCs

Predicate Pairing makes it possible to infer linear relations

among variables in the conjunction fg of predicates f and g

Whenever the conjunction fg enforces the linear constraint

Satisfability of CHCs

Hence the satisfability of the frst clause

*

Implementation

CHC solver

CHCs (encoding the verifcation problem)

false

true

unknownTransformed CHCs

VeriMAP

Transformationstrategy

unfolddefnefold

11

23 2

3

Interpreter

http://map.uniroma2.it/VeriMAP

Z3

I

Results Equivalence p1(X,X’), p2(Y,Y’), X = Y → X’ = Y’

Monotonicity p(X,X’), p(Y,Y’), X ≤ Y X’ → ≤ Y’

Injectivity p(X,X’), p(Y,Y’), X’= Y’ X = Y→

Functionality p(X,f(X),X’), p(Y,f(Y),Y’), X = Y X→ ’ = Y’

Relational properties

equivalence monotonicity injectivity functionality0

5

10

15

20

25

30

35

40

45

encoding

predicate pairing

predicate pairing + constraint propagation

CHC encoder CHCs

Rule-basedCHC transformer

Transformed CHCs

Specifcation

Transformationstrategy

unfolddefnefold

1

2

3

1

23 CHC solver I

M

φ

φ

φ

InterpreterSemantics BPMN &Specifcation Logic

BPMN

BP Model

Verifcation of Modelsusing transformation of CHCs

Business ProcessA Business Process (BP) coordinates the activities of an organization towards a business goal.

A BP can be represented using the Business Process Modeling Notation.

Purchase Order A customer adds one or more items to the shopping cart and pays. Then, the vendor sends the invoice and delivers the order.

No quantitative time information (such as the durations of tasks).

XOR merge XOR branch

AND branch AND mergeevent

task

Specify intervals of task duration

Time-aware Business Process

[1,6] [1,2]

[1,2] [1,3]

[1,2]

[2,4]

[1,3]

Properties● Reachability

The time to reach ‘end’ from ‘start’ is less than T.● Controllability

It is possible to determine the durations of some (controllable) tasks so that a given reachability property holds.

D∈[dmin ,dmax ]⊂ℕ

Reachability

where tr encodes the semantics of BPMN ( Interpeter I ).

Reachability Property

where c(T,U,C) is a constraint.

Controllability Property

Weak

Strong

where adm(U) if the durations in U belong to the given intervals.

Interpreter (a glimpse)Semantics of Business Process Modeling Notation

Applying CHCs solvers

Validity of weak and strong controllability properties ● cannot be proved by CHC solvers over LIA (such as Z3),

because of complex terms occurring in the interpreter● cannot be proved by CLP systems,

because of and ∃∀ ∀∃● CHC solvers and CLP system may not terminate,

because of recursive defnition of reach

Transformation techniques can be applied● to get CHCs with no complex terms, and● to avoid expensive quantifer elimination by reducing the problem

of verifying controllability to the problem of verifying simpler properties where quantifcation is restricted to LIA constraints

Conclusions

A method for proving correctness of (software) artifacts

● Independent of the formalism used to represent the artifact and its specifcation

The only language specifc element is the interpreter

● Improves efectiveness of state-of-the art CHC solvers

Future work:

● more formalisms (programming and modeling languages)

● more properties

Publications● Emanuele De Angelis, Fabio Fioravanti, Alberto Pettorossi, Maurizio Proietti:

Program Verifiation using Constraint Handling Rules and Array Constraint Generalizations. Fundamenta Informaticae, vol. 150(1): 73-117 (2017)

● Emanuele De Angelis, Fabio Fioravanti, Alberto Pettorossi, Maurizio Proietti: Semantiis-based generation of verifiation ionditions via program speiialization. Science of Computer Programming, 2017, 147: 78-108

● Emanuele De Angelis, Fabio Fioravanti, Maria Chiara Meo, Alberto Pettorossi, Maurizio Proietti: Verifiation of ime-Aware Business Proiesses using Constrained Horn Clauses. LOPSTR 2016: 38-55

● Emanuele De Angelis, Fabio Fioravanti, Maria Chiara Meo, Alberto Pettorossi, Maurizio Proietti: Verifying Controllability of ime-Aware Business Proiesses. RuleML+RR 2017: 103-118

● Emanuele De Angelis, Fabio Fioravanti, Alberto Pettorossi, Maurizio Proietti: Prediiate Pairing for Program Verifiation. TPLP (2017 – in press)

● Emanuele De Angelis, Fabio Fioravanti, Alberto Pettorossi, Maurizio Proietti: Enhaniing Prediiate Pairing with Abstraition for Relational Verifiation. LOPSTR 2017 (to appear)