+ All Categories
Home > Documents > Introduction to Spin and Promela

Introduction to Spin and Promela

Date post: 30-Jan-2016
Category:
Upload: yoland
View: 62 times
Download: 0 times
Share this document with a friend
Description:
Introduction to Spin and Promela. Sagar Chaki CMU. Roadmap. Historical perspective Overview of Spin Overview of Promela Simulation with Spin Overview of LTL Verification with Spin. Part III Overview of LTL. Basic concepts. Set of propositions: P P = {a,b,c} - PowerPoint PPT Presentation
36
Introduction to Spin and Promela Sagar Chaki CMU
Transcript
Page 1: Introduction to Spin and Promela

Introduction to Spin and Promela

Sagar Chaki

CMU

Page 2: Introduction to Spin and Promela

Roadmap Historical perspective Overview of Spin Overview of Promela Simulation with Spin Overview of LTL Verification with Spin

Page 3: Introduction to Spin and Promela

Part IIIOverview of LTL

Page 4: Introduction to Spin and Promela

Basic concepts Set of propositions: P

P = {a,b,c} Infinite trace over P

t0,t1,t2, … ti subset of P for i ≥ 0 i denotes infinite trace ti,ti+1, … {b},{a,c},{},{a,b,c},{a}, …

Set of all infinite traces over P: (P)

Page 5: Introduction to Spin and Promela

LTL syntax := p proposition

| true

| false

| ()

| binop | unop

Page 6: Introduction to Spin and Promela

LTL syntax unop := [] always (G)

| <> eventually (F)| X next time| ! logical negation

binop := U strong until| && logical AND| || logical OR| -> implication| <-> equivalence

Page 7: Introduction to Spin and Promela

LTL semantics

An infinite trace (over P) either satisfies or does not satisfy an LTL formula (over P)

Satisfaction denoted by ²

Page 8: Introduction to Spin and Promela

LTL semantics Given an infinite trace = t0,t1,t2, … and

a LTL formula we can decide if

² depending on the structure of ² p iff p belongs to t0

Always ² true Never ² false ² () iff ²

Page 9: Introduction to Spin and Promela

LTL semantics ² [] iff i ² forall i ≥ 0

² <> iff exists i ≥ 0 s.t. i ² ² X iff 1 ² ² ! iff NOT( ² )

² 1 U 2 iff exists i ≥ 0 s.t. j ² 1 for 0 ≤ j < i and i ² 2

Page 10: Introduction to Spin and Promela

LTL semantics ² 1 && 2 iff ² 1 AND ² 2

² 1 || 2 iff ² 1 OR ² 2

² 1 -> 2 iff ² 1 IMPLIES ² 2

² 1 <-> 2 iff ² 1 IFF ² 2

Page 11: Introduction to Spin and Promela

LTL semantics An LTL formula can also be looked at

as the set of infinite traces that satisfy it Note the striking similarity with the case

of regular expressions and finite strings over an alphabet

If S is the set of traces that satisfy then (P)\S is the set of traces that satisfy !

Page 12: Introduction to Spin and Promela

Examples {a},{b},{a},{b}, … [](a -> Xb)[](a <-> Xb) [](b -> Xa)[](b <-> Xa) [](a -> (b U a)) [](a -> (a U b))

Page 13: Introduction to Spin and Promela

Things to remember

Every LTL formula represents the set of infinite traces which satisfy it

Page 14: Introduction to Spin and Promela

Buchi automata Recall the similarity of LTL with regular

expressions Regular languages are accepted by

finite automata Are there automata for LTL

Turns out there are They are called Buchi automata

Page 15: Introduction to Spin and Promela

Buchi automata Fix an alphabet Buchi automaton is a 4-tuple : <Q,I,,F>

Q : set of states I : initial state : transition relation: subset of QX XQ F : set of accepting states

In our case is 2P

Page 16: Introduction to Spin and Promela

Example

S0 S1

a

I = S0 , F = {S0}

b

Page 17: Introduction to Spin and Promela

Buchi automata A run is an infinite sequence of state

s0,s1,s2, … such that s0 = I

Exists ai є s.t. (si,ai,si+1) є for i ≥ 0

A run is an accepting run iff it visits some accepting state infinitely often

Page 18: Introduction to Spin and Promela

Buchi automata Given a run = s0,s1,s2, …a trace =

0,1,2, …is said to correspond to iff (si,i,si+1) є for i ≥ 0

The language of a Buchi automaton is the set of traces corresponding to its accepting runs LTL also corresponds to a set of traces

Page 19: Introduction to Spin and Promela

Example Traces : {{a},{b},{a},{b},…}

S0 S1

a

I = S0 , F = {S0}

b

Page 20: Introduction to Spin and Promela

Cute results BA are closed under complementation

For every Buchi automaton A there exists another Buchi automaton B such that the language of A is the complement of the language of B

Here complement means set difference from (P)

Page 21: Introduction to Spin and Promela

Cute results BA are closed under intersection and

union

Checking if the language of a Buchi automaton is empty is decidable Can check if the langauges of two Buchi

automata have a non-empty intersection

Page 22: Introduction to Spin and Promela

Cute results Buchi automata are not always

determinisable There exists a non-deterministic Buchi

automaton A such that there is no deterministic Buchi automaton with the same language as A

Non-deterministic means some states have multiple outgoing transitions with same label

Page 23: Introduction to Spin and Promela

Cute results The set of languages accepted by

Buchi automata is called the set of

-regular languages This is a strict superset of LTL Every LTL corresponds to some BA There exists a BA whose language does

not correspond to any LTL formula

Page 24: Introduction to Spin and Promela

Things to remember Every LTL formula represents the set of

infinite traces which satisfy it

Every LTL formula has a corresponding Buchi automaton

Page 25: Introduction to Spin and Promela

Kripke structure

Is a 4-tuple : <S,I,,L> S : set of states I : initial state : transition relation: subset of S X S L : labeling function : S -> 2P

Page 26: Introduction to Spin and Promela

Computations and Traces A computation is an infinite sequence

of states s0,s1,s2, … s0 = I

(si,si+1) є for i ≥ 0

Given a computation s0,s1,s2, … the corresponding trace is

L(s0), L(s1), L(s2), …

Page 27: Introduction to Spin and Promela

Kripke and Buchi Kripke looks different from Buchi

Labels are on states not transitions No accepting states Nevertheless …

For every Kripke structure K there exists a Buchi automaton which accepts exactly the set of traces corresponding to computations of K

Page 28: Introduction to Spin and Promela

Kripke to Buchi

a b c

S0 S1 S2

I = S0

Page 29: Introduction to Spin and Promela

Kripke to Buchi

S0 S1 S2

a

b c

Page 30: Introduction to Spin and Promela

Kripke to Buchi

S0 S1 S2

a

b c

S3

a

I = S3, F = {S0,S1,S2,S3}

Page 31: Introduction to Spin and Promela

Things to remember Every LTL formula represents the set of

infinite traces which satisfy it Every LTL formula has a corresponding

Buchi automaton Every Kripke structure has a

corresponding Buchi automaton

Page 32: Introduction to Spin and Promela

What do we really want? Kripke (M) ² LTL () Traces of M contained in traces of Language of Buchi of M contained in

language of Buchi of Language of Buchi of M has empty

intersection with language of Buchi of ! This is decidable

Page 33: Introduction to Spin and Promela

LTL model checking Two ways to do it Convert Kripke to Buchi

Convert claim (LTL) to Buchi Check language inclusion

OR Convert ~Claim (LTL) to Buchi Check empty intersection

Page 34: Introduction to Spin and Promela

What Spin does Checks non-empty intersection

Requires very little space in best case

Works directly with Promela No conversion to Kripke or Buchi

Must provide Spin with negation of property you want to prove

Page 35: Introduction to Spin and Promela

Time for example 5

Page 36: Introduction to Spin and Promela

References

http://cm.bell-labs.com/cm/cs/what/spin/

http://cm.bell-labs.com/cm/cs/what/spin/Man/Manual.html

http://cm.bell-labs.com/cm/cs/what/spin/Man/Quick.html


Recommended