• Non ci sono risultati.

A glimpse at nuXmv

N/A
N/A
Protected

Academic year: 2021

Condividi "A glimpse at nuXmv"

Copied!
31
0
0

Testo completo

(1)

A glimpse at nuXmv

Luca Geatti

(2)

Introduction

• nuXmv: is a symbolic model checker for the analysis of synchronous finite-state and infinite-state systems

• state-of-the-art algorithms:

• For the finite-state case:

• BDD-based model-checking, like its predecessor nuSMV.

• strong verification engine based on modern SAT-based algorithms

• For the infinite-state case: SMT-based verification techniques, implemented through a tight integration with MathSAT5.

• download it and try it!

https://nuxmv.fbk.eu/

(3)

Short tutorial

Today:

• modeling and specification languages

• simulation

• model checking

Manual: https://es-static.fbk.eu/tools/nuxmv/downloads/

nuxmv-user-manual.pdf

(4)

Modeling and Specification

languages

(5)

Modeling language

• SMV language: Symbolic Model Verifier

• introduced in 1993 in the seminal paper “Symbolic model checking: 1020 states and beyond”

• allows for the description of:

• synchronous and asynchronous systems

• networks/products of subsystems

• non-deterministic behaviors

• modular nature (very close to OO programming)

• SMV file = symbolic representation of a transition system (aka Kripke structure)

(6)

Variables

• State Variables

Boolean: boolean

enum: {item1, item2, . . . , itemn}

• integer : int

• ... a lot of others ...

• Input Variables

• they are variables "controlled" by the environment

• we can observe their value but...

• we can not constrain their value in anyway

(7)

SMV - Transition Relation

• Initial states

• any Boolean formula over the set of state variables

• it is specified by the keywordINIT

• Transition Relation

• any Boolean formula over the following set:

V :={v | v is a state or input variable}

{next(v) | v is a state variable}

• it is specified by the keywordTRANS

(8)

SMV - Transition Relation - cont’d

• SMV allows also:

• all arithmetic operations (addition, multiplication, etc)

• trigonometric functions

• bitwise operations

An alternative way:

• ASSIGN init(v) := ...

• ASSIGN next(v) := ...

(9)

Example - Simple automaton

¬s0 s0

MODULE main VAR

s 0 : b o o l e a n ; INIT

! s 0 ; TRANS

s 0 <−> n e x t ( ! s 0 ) ;

Each of the 2n assignments to the n state variables corresponds to a state of the explicit

transition system.

(10)

Example with input variables

¬a a

¬s0 s0

a

¬a

In this example, you can think of variables as lettersof the alphabet of the automaton.

MODULE main IVAR

a : b o o l e a n ; VAR

s 0 : b o o l e a n ; ASSIGN

i n i t ( s 0 ) := FALSE ; n e x t ( s 0 ) := c a s e

! s 0 & a : TRUE ;

! s 0 & ! a : FALSE ; s 0 & a : TRUE ; s 0 & ! a : FALSE ; e s a c ;

(11)

Specification Language

• Mainly LTLand CTL

• ... but also:

• past operators

• PSL

• real-time CTL

• ...

(12)

LTL Specification Language

• LTL syntax:

φ := p | ¬φ | φ1∨ φ2 | Xφ | φ1U φ2

| Fφ | Gφ | φ1R φ2

• in SMV with the keyword LTLSPEC

• LTLSPEC ltl_expr;

• LTLSPEC NAME name_expr := ltl_expr;

(13)

Example - Simple DFA

A:

¬a a

¬s0 s0

a

¬a

τ |=F(s0) iff τ ∈ L(A).

MODULE main IVAR

a : b o o l e a n ; VAR

s 0 : b o o l e a n ; ASSIGN

i n i t ( s 0 ) := FALSE ; n e x t ( s 0 ) := c a s e

! s 0 & a : TRUE ;

! s 0 & ! a : FALSE ; s 0 & a : TRUE ; s 0 & ! a : FALSE ; e s a c ;

LTLSPEC

NAME f i n a l _ d f a := F(s0)

(14)

Example - Simple Büchi automaton

A:

¬a a

¬s0 s0

a

¬a

MODULE main IVAR

a : b o o l e a n ; VAR

s 0 : b o o l e a n ; ASSIGN

i n i t ( s 0 ) := FALSE ; n e x t ( s 0 ) := c a s e

! s 0 & a : TRUE ;

! s 0 & ! a : FALSE ; s 0 & a : TRUE ; s 0 & ! a : FALSE ; e s a c ;

LTLSPEC

(15)

Simulation

(16)

Simulation

• Simulation generates a trace (or a set of traces) of the SMV model.

• It can be used, for example,

• for exploring different behaviors of the model

• for checking if the model is an accurate representation of reality

• Simulation is different from model checking: it is not exhaustive.

(17)

Generic commands

These commands are prerequisites for all the other commands:

• set_input_file file_name: sets the file containing the model

• go: it parses the model file, it populates all the necessary data structures like BDD, etc.

• go_bmc: similar to the previous command

• reset: undo the effects of all the commands

(18)

Simulation - Commands

Commands:

• pick_state -v -i: it picks an initial state for the trace

• -v: verbose

• -i: interactive mode, the user can choose the state from a set of possibilities

• simulate -v -i -k 5

• -k: length of the trace

(19)

Examples

Without input variables:

¬s0 s0

With input variables:

¬a a

¬s0 s0

a

¬a

(20)

Model Checking

(21)

Model Checking

Plethora of commands for model checking:

• BDD-based model checking:

check_ltlspec

Burch, Jerry R., et al. "Symbolic model checking: 1020states and beyond." (1992)

• SAT-based model checking:

• BMC

check_ltlspec_bmc

Biere, Armin, et al. "Bounded model checking." (2003).

• K-Liveness

check_ltlspec_ic3

Claessen, Koen, and Niklas Sörensson. "A liveness checking algorithm that counts." (2012)

• IC3

check_invar_ic3

Bradley, Aaron R. "SAT-based model checking without unrolling." (2011)

• it is tailored for invariant properties, that is, of type G(α)

(22)

Example - Modulo 4 counter

¬s1

¬s0

¬s1 s0

s1

¬s0

s1 s0

• φ1 := GF(s0 ∧ s1) 3

• φ2 := FG(¬s0 ∧ ¬s1) 7

(23)

Example - Simple Büchi automata

A:

¬a a

¬s0 s0

a

¬a

• we want to check the emptiness of the Büchi automaton A:

L(A)= ∅?

• how can we check it?

• ... with model checking?

• We reduce the emptiness problem to the following model-checking problem:

A|= A(FG¬s0)?

(24)

Example - Simple Büchi automata

A:

¬a a

¬s0 s0

a

¬a

• we want to check the emptiness of the Büchi automaton A:

L(A)= ∅?

• how can we check it?

• ... with model checking?

• We reduce the emptiness problem to the following model-checking problem:

A|= A(FG¬s0)?

(25)

Example - Simple Büchi automata

A:

¬a a

¬s0 s0

a

¬a

• we want to check the emptiness of the Büchi automaton A:

L(A)= ∅?

• how can we check it?

• ... with model checking?

• We reduce the emptiness problem to the following model-checking problem:

A|= A(FG¬s0)?

(26)

Example - Simple Büchi automata

A:

¬a a

¬s0 s0

a

¬a

• we want to check the emptiness of the Büchi automaton A:

L(A)= ∅?

• how can we check it?

• ... with model checking?

• We reduce the emptiness problem to the following model-checking problem:

(27)

Example - Simple Büchi automata

A:

¬a a

¬s0 s0

a

¬a

• it holds that:

A 6|= A(FG¬s0)

A |= E (GFs0)

there exists an accepting run

⇔ L(A) 6= ∅

(28)

Appendix

(29)

A Three-Bit Counter

MODULE  main   VAR  

   bit0  :  counter_cell(TRUE);  

   bit1  :  counter_cell(bit0.carry_out);  

   bit2  :  counter_cell(bit1.carry_out);  

 

SPEC    AG  AF  bit2.carry_out    

MODULE  counter_cell(carry_in)   VAR  

   value  :  boolean;  

ASSIGN  

   init(value)  :=  FALSE;  

   next(value)  :=  value  xor  carry_in;  

DEFINE  

   carry_out  :=  value  &  carry_in;  

value  +  carry_in  mod  2  

(30)

in val out

in out

in out

in out

val

val

val

module instantiations

bit0

bit1

bit2 module declaration

(31)

1 0 0

0 0 0

0 0 0

1 1 1

1 0 0

0 0 0

1 0 0

0 1 0

0 0 0

1 1 1

1 1 1

1 0 0

1 0 0

0 0 0

0 1 0

1 1 1

1 0 0

0 1 0

1 0 0

0 1 0

0 1 0

1 1 1

1 1 1

1 1 1

1 0 0

0 0 0

0 0 0 in

val out bit0

in val out bit1

in val out bit2

bit2.carry_out is ture AG AF bit2.carry_out is true

Riferimenti

Documenti correlati

Aggressive or depressive behaviour is under the control of a genetic network; suicide may be related to alterations of the epi- genetic regulation of specific genes. Also

The method designed in this paper can perform the parking task in any parking scene, but the efficiency is not high because the vehicle needs to move back and forth many times to

For the application of numerical codes regarding shallow landslide stability, such as the commonly used infinite slope stability model, soil depth is often assigned a constant value

By using the term “residents” then the Palestinians of WBGS were treated by the Israeli occupation forces as foreign nationals and aliens, who just happened to be present in

En este contexto, se detiene en los esfuerzos de Felipe González y sus compañeros por hacerse visibles ante los socialistas europeos, y sobre todo los alemanes, para

Risks to media pluralism are examined in four main thematic areas, which are considered to capture the main areas of risk for media pluralism and media freedom: Basic

complete, to solve general model-checking problems over innite runs, for a class C of innite-state systems, when two conditions are satis- ed: (i) the model-checking problem for

To assess the effects of Hpx or HO2 knockout on microglial acti- vation, we immunostained brain sections with Iba1 anti- body to observe microglial activation/morphology around