+ All Categories
Home > Documents > LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling...

LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling...

Date post: 26-Jul-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
21
F ORMAL M ETHODS L ECTURE II: M ODELING S YSTEMS Alessandro Artale Faculty of Computer Science – Free University of Bolzano Room 2.03 [email protected] http://www.inf.unibz.it/artale/ Some material (text, figures) displayed in these slides is courtesy of: M. Benerecetti, A. Cimatti, M. Fisher, F. Giunchiglia, M. Pistore, M. Roveri, R.Sebastiani. Alessandro Artale (FM – Second Semester – 2010/2011) – p. 1/21
Transcript
Page 1: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

FORMAL METHODS

LECTURE II: MODELING SYSTEMS

Alessandro Artale

Faculty of Computer Science – Free University of Bolzano

Room 2.03

[email protected] http://www.inf.unibz.it/∼artale/

Some material (text, figures) displayed in these slides is courtesy of:

M. Benerecetti, A. Cimatti, M. Fisher, F. Giunchiglia, M. Pistore, M. Roveri, R.Sebastiani.Alessandro Artale (FM – Second Semester – 2010/2011) – p. 1/21

Page 2: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Summary of Lecture II

Types of Systems.

Modeling Systems as Kripke Models.

Languages for Describing Kripke Models.

Properties of Systems.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 2/21

Page 3: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Concurrent Reactive Systems

We describe here Concurrent Reactive systems.

Reactive Systems: Systems that interact with theirenvironment and usually do not terminate (e.g.communication protocols, hardware circuits).

Concurrent Systems consist of a set of components thatexecute together.

We distinguish two types of Concurrent Systems:

1. Asynchronous or Interleaved Systems. Only onecomponent makes a step at a time;

2. Synchronous Systems. All components make a step atthe same time.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 3/21

Page 4: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Modeling Systems

We need to construct a Formal Specification of thesystem which abstract from irrelevant details.

• State: Snapshot of the system that captures thevalues of the variables at a particular point in time.

• System Transition: How the state of the systemevolves as the result of some action.

• Computation: Infinite sequence of states along thedifferent transitions.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 4/21

Page 5: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Summary

Types of Systems.

Modeling Systems as Kripke Models.

Languages for Describing Kripke Models.

Properties of Systems.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 5/21

Page 6: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Modeling Systems with Kripke Structures

Kripke Structures are transition diagrams that representthe dynamic behavior of a reactive system.

Kripke Structures consist of a set of states, a set oftransitions between states, and a set of propertieslabeling each state.

A path in a Kripke structure represents a computation ofthe system.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 6/21

Page 7: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Kripke model: definition

⊲ Formally, a Kripke model 〈S, I,R,AP,L〉 consists of

• a set of states S;• a set of initial states I ⊆ S;• a set of transitions R ⊆ S×S;• a set of atomic propositions AP;• a labeling function L : S 7→ 2AP. p

q

1

2

3

4

p

⊲ A path in a Kripke model M from a state s0 is an infinite

sequence of states

π = s0,s1,s2, . . .

such that (si,si+1) ∈ R, for all i ≥ 0.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 7/21

Page 8: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Example: Kripke model for mutual exclusion

We model two concurrent asynchronous processes

sharing a resource ensuring they do not access it at thesame time.

Each process has critical sections in its code and onlyone process can be in its critical section at a time.

We want to find a protocol for mutual exclusion which,for example, guarantee the following properties:

Safety: Only one process is in its critical section at atime.

Liveness: Whenever any process requests to enter itscritical section it will eventually be permitted to do so.

Non-Blocking: A process can always request to enterits critical section.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 8/21

Page 9: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Example: a Kripke model for mutual exclusion

Each process can be in its non-critical state (N), or trying toenter its critical state (T), or in its critical state (C). Thevariable turn considers the first process that went into itstrying state.

N1, N2

turn=0

turn=1

turn=2

turn=2

turn=2turn=1 turn=1

turn=1

turn=2

T1, C2

N1, C2T1, T2T1, T2

N1, T2

C1, T2

C1, N2

T1, N2

N = noncritical, T = trying, C = critical User 1 User 2

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 9/21

Page 10: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Composing Kripke Models

Complex Kripke Models are tipically obtained bycomposition of smaller ones

Components can be combined via

• synchronous composition

• asynchronous composition.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 10/21

Page 11: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Synchronous Composition

⊲ Components evolve in parallel.⊲ At each time instant, every component performs a

transition.

y = by = a

x = 1x = 0synchronous

composition

x = 0

y = a

x = 1x = 0

x = 1

y = a

y = b y = b

⊲ Typical example: sequential hardware circuits.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 11/21

Page 12: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Asynchronous Composition

⊲ Interleaving of evolution of components.⊲ At each time instant, one component is selected to

perform a transition.

x = 1x = 0

y = b y = b

x = 0

y = a

x = 1

y = a

y = by = a

x = 1x = 0asynchronous

composition

⊲ Typical example: communication protocols.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 12/21

Page 13: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Summary

Types of Systems.

Modeling Systems as Kripke Models.

Languages for Describing Kripke Models.

Properties of Systems.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 13/21

Page 14: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Description languages for Kripke Model

Tipically a Kripke model is not given explicitly, rather it isusually presented in a structured language(e.g., NuSMV, SDL, PROMELA, StateCharts, VHDL, ...)Each component is presented by specifying:

A set of system variables

Initial values for state variables

Instructions

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 14/21

Page 15: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Description languages for Kripke Model

The correspondence between a description language andthe Kripke Model is the following:

1. States: all possible assignments for system variables;

2. Initial States: Initial values for system variables;

3. Transitions: Instructions;

4. Atomic Propositions: Propositions associated to thevalues of the system variables;

5. Labeling: Set of atomic propositions true at a state.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 15/21

Page 16: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

The NuSMV language

The NuSMV (New Symbolic Model Verifier)model-checking system is an Open Source product(nusmv.irst.itc.it).

NuSMV programs consist of:

• Type declarations of the system variables;

• Assignments that define the valid initial states(e.g., init(b0) := 0).

• Assignments that define the transition relation(e.g., next(b0) := !b0).

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 16/21

Page 17: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

NuSMV: The modulo 4 counter with reset

MODULE mainVAR

b0 : boolean;b1 : boolean;reset : boolean;out : 0..3;

ASSIGNinit(b0) := 0;next(b0) := case

reset = 1: 0;reset = 0: !b0;

esac;

init(b1) := 0;next(b1) := case

reset: 0;1 : ((!b0 & b1)|(b0 & !b1));

esac;out := b0 + 2*b1;

2

0 1

3

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 17/21

Page 18: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Summary

Types of Systems.

Modeling Systems as Kripke Models.

Languages for Describing Kripke Models.

Properties of Systems.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 18/21

Page 19: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Safety Properties

Nothing Bad Ever Happens.

• Deadlock: two processes waiting for input from eachother, the system is unable to perform a transition.

• No reachable state satisfies a “bad” condition,e.g. never two processes in critical section at thesame time

It is expressed by a temporal formula saying that“it’s never the case that p”.

p

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 19/21

Page 20: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Liveness Properties

Something Desirable Will Eventually Happen.

• Whenever a subroutine takes control, it will alwaysreturn it (sooner or later).

It is expressed by a temporal formula saying that“at each state it will be the case that p”.

Can be refuted by infinite behaviour (represented as aloop)

p

p

p

p

p

p

p

p

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 20/21

Page 21: LECTURE II: MODELING YSTEMSartale/FM/slide2.pdf · Summary of Lecture II Types of Systems. Modeling Systems as Kripke Models. Languages for Describing Kripke Models. Properties of

Summary of Lecture II

Types of Systems.

Modeling Systems as Kripke Models.

Languages for Describing Kripke Models.

Properties of Systems.

Alessandro Artale (FM – Second Semester – 2010/2011) – p. 21/21


Recommended