90
Lecture 4: Checking properties in NuSMV B. Srivathsan Chennai Mathematical Institute Model Checking and Systems Verification January - April 2016 1/43

Lecture 4: Checking properties in NuSMVsri/Courses/MCSV/Slides/lecture4.pdf · Lecture 4: Checking properties in NuSMV ... É Next lecture:Answer to the above question ... fp1 g fp1,p2

Embed Size (px)

Citation preview

Lecture 4: Checking properties in NuSMV

B. Srivathsan

Chennai Mathematical Institute

Model Checking and Systems Verification

January - April 2016

1/43

Outline

É Module 1: Synchronous Vs Asynchronous composition

É Module 2: More examples of NuSMV models andproperties

É Module 3: A problem in concurrency

É Module 4: What is a property?

2/43

Module 1:Synchronous Vs Asynchronous

composition

3/43

Acknowledgements:

Content in this part of module taken from lecture slides of

Prof. Supratik Chakraborty, IIT Bombay

4/43

L2

L1

L2.red

L1

L1.red

L2

If a light is red, it can stay red for an arbitrary period

If it goes yellow, it should become green within one cycle

If it is green, it can stay green for an arbitrary period

5/43

L2

L1

L2.red

L1

L1.red

L2

If a light is red, it can stay red for an arbitrary period

If it goes yellow, it should become green within one cycle

If it is green, it can stay green for an arbitrary period

5/43

Synchronous composition

MODULE light(other)VAR

state: {r,y,g};ASSIGN

init(state) := r;next(state) := case

state=r & other=r : {r, y};state=y : g;state=g : {g, r};TRUE : state;

esac;

MODULE mainVAR

tl1: light(tl2.state); tl2: light(tl1.state);

6/43

Synchronous composition

MODULE light(other)VAR

state: {r,y,g};ASSIGN

init(state) := r;next(state) := case

state=r & other=r : {r, y};state=y : g;state=g : {g, r};TRUE : state;

esac;

MODULE mainVAR

tl1: light(tl2.state); tl2: light(tl1.state);

6/43

Synchronous composition

Both lights can simultaneously become green!

7/43

Synchronous composition

Both lights can simultaneously become green!

7/43

Asynchronous compositionMODULE light(other)VAR

state: {r,y,g};ASSIGN

init(state) := r;next(state) := case

state=r & other=r : {r, y};state=y : g;state=g : {g, r};TRUE : state;

esac;

MODULE mainVAR

tl1: process light(tl2.state);tl2: process light(tl1.state);

8/43

Asynchronous composition

. . .

Only one light can become green at a time

9/43

Asynchronous composition

. . .

Only one light can become green at a time

9/43

É Synchronous:

É all assignments to all modules made simultaneously

É suitable when all modules are synchronized to a globalclock

É Asynchronous:

É execution of modules is interleaved

É at a time, only one module executes

É choice of next module to be executed isnon-deterministic

É suitable when no assumptions can be made aboutcommunication delay between modules

10/43

Synchronousvs.

Asynchronous

systems

11/43

Module 2:More examples

12/43

SHARED

RESOURCE

P1 P2 Pn. . .

(variable, printer, . . . )

Mutual Exclusion: No two processes can access the resourcesimultaneously

13/43

loop forever...request

critical section

release...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P1

PG1 noncrit1

wait1

crit1

y>0:y:=y-1

y:= y+1

loop forever...request

critical section

release...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P2

PG2 noncrit2

wait2

crit2

y>0:y:=y-1

y:= y+1

atomic

NuSMV demo: mutex-demo.smv

14/43

loop forever...request

critical section

release...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P1

PG1 noncrit1

wait1

crit1

y>0:y:=y-1

y:= y+1

loop forever...request

critical section

release...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P2

PG2 noncrit2

wait2

crit2

y>0:y:=y-1

y:= y+1

atomic

NuSMV demo: mutex-demo.smv

14/43

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P1

PG1 noncrit1

wait1

crit1

y>0:y:=y-1

y:= y+1

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P2

PG2 noncrit2

wait2

crit2

y>0:y:=y-1

y:= y+1

atomic

NuSMV demo: mutex-demo.smv

14/43

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P1

PG1 noncrit1

wait1

crit1

y>0:y:=y-1

y:= y+1

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P2

PG2 noncrit2

wait2

crit2

y>0:y:=y-1

y:= y+1

atomic

NuSMV demo: mutex-demo.smv

14/43

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P1

PG1 noncrit1

wait1

crit1

y>0:y:=y-1

y:= y+1

loop forever...

request

critical section

release

...end loop

*non-critical actions*

*non-critical actions*

*request*

*release*

⟨ if y>0: y:=y-1 ⟩

y:=y+1

P2

PG2 noncrit2

wait2

crit2

y>0:y:=y-1

y:= y+1

atomic

NuSMV demo: mutex-demo.smv14/43

Coming next: A slight modification of previous mutualexclusion protocol

15/43

non-crit wait

critexiting

y>0:y:=y-1y:=y+1PG1

non-crit wait

critexiting

y>0:y:=y-1y:=y+1PG2

NuSMV demo: mutex-demo1.smv

16/43

non-crit wait

critexiting

y>0:y:=y-1y:=y+1PG1

non-crit wait

critexiting

y>0:y:=y-1y:=y+1PG2

NuSMV demo: mutex-demo1.smv16/43

Synchronousvs.

Asynchronous

systems

Mutual Exclusion

17/43

while x < 200

x := x+1

l1

l2

x < 200x := x+1

while x>0

x := x-1

m1

m2

x > 0x:=x-1

while x=200

x := 0

n1

n2

x = 200x:=0

Is the value of x always between 0 and 200?

14/30

NuSMV demo: three-program-demo.smv

18/43

while x < 200

x := x+1

l1

l2

x < 200x := x+1

while x>0

x := x-1

m1

m2

x > 0x:=x-1

while x=200

x := 0

n1

n2

x = 200x:=0

Is the value of x always between 0 and 200?

14/30

NuSMV demo: three-program-demo.smv18/43

Synchronousvs.

Asynchronous

systems

Mutual Exclusion

Concurrent programs

example

19/43

Module 3:A problem in concurrency

20/43

P0 . . . P3 : processes

S0 . . . S3 : resources

Process Pi can execute

only if

it has access to resources

S(i−1)

mod 4

and Si

mod 4

P0

P1

P2

P3

S0

S1

S3

S2

How should the processes be scheduled so that every process can executeinfinitely often?

21/43

P0 . . . P3 : processes

S0 . . . S3 : resources

Process Pi can execute

only if

it has access to resources

S(i−1)

mod 4

and Si

mod 4

P0

P1

P2

P3

S0

S1

S3

S2

How should the processes be scheduled so that every process can executeinfinitely often?

21/43

P0 . . . P3 : processes

S0 . . . S3 : resources

Process Pi can execute

only if

it has access to resources

S(i−1) mod 4 and Si mod 4

P0

P1

P2

P3

S0

S1

S3

S2

How should the processes be scheduled so that every process can executeinfinitely often?

21/43

P0 . . . P3 : processes

S0 . . . S3 : resources

Process Pi can execute

only if

it has access to resources

S(i−1) mod 4 and Si mod 4

P0

P1

P2

P3

S0

S1

S3

S2

How should the processes be scheduled so that every process can executeinfinitely often?

21/43

Dining philosophers problem (Dijkstra)

P0 . . . P3 : philosophers

S0 . . . S3 : chop-sticks

Philosopher Pi can eat

only if

he has access to chop-sticks

S(i−1) mod 4 and Si mod 4

P0

P1

P2

P3

S0

S1

S3

S2

What should the protocol be so that every philosopher can eat infinitelyoften?

22/43

Dining philosophers problem (Dijkstra)

P0 . . . P3 : philosophers

S0 . . . S3 : chop-sticks

Philosopher Pi can eat

only if

he has access to chop-sticks

S(i−1) mod 4 and Si mod 4

P0

P1

P2

P3

S0

S1

S3

S2

What should the protocol be so that every philosopher can eat infinitelyoften?

22/43

Coming next: A protocol for the dining philosophers

23/43

Philosopher ithink

req_left req_right

have_left have_right

eat

return

sticks[i]=freesticks[i]:=i

sticks[i-1]=freesticks[i-1]:=i

sticks[i-1]=freesticks[i-1]:=i

sticks[i]=freesticks[i]:=i

sticks[i]=freesticks[i-1]=free

NuSMV demo

24/43

Philosopher ithink

req_left req_right

have_left have_right

eat

return

sticks[i]=freesticks[i]:=i

sticks[i-1]=freesticks[i-1]:=i

sticks[i-1]=freesticks[i-1]:=i

sticks[i]=freesticks[i]:=i

sticks[i]=freesticks[i-1]=free

NuSMV demo24/43

A deadlock

⟨ think, think, think, think ⟩

⟨ have_left, have_left, have_left, have_left ⟩

0 1 2 3

Sticks

25/43

Question: What properties should be checked to detectdeadlocks?

É Next module: Attach a mathematical meaning to properties

É Next lecture: Classification of properties into various types

É Next lecture: Answer to the above question

26/43

Question: What properties should be checked to detectdeadlocks?

É Next module: Attach a mathematical meaning to properties

É Next lecture: Classification of properties into various types

É Next lecture: Answer to the above question

26/43

Question: What properties should be checked to detectdeadlocks?

É Next module: Attach a mathematical meaning to properties

É Next lecture: Classification of properties into various types

É Next lecture: Answer to the above question

26/43

Question: What properties should be checked to detectdeadlocks?

É Next module: Attach a mathematical meaning to properties

É Next lecture: Classification of properties into various types

É Next lecture: Answer to the above question

26/43

Module 4:What is a “property”?

27/43

Goal: Attach a mathematical meaning to “property”

28/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 }

{ p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }

{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

29/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

Trace

{ }

{ p2 }

{ }

{ p1,p2 }

{ p1,p2 }

Execution

request=0ready

request=0busy

request=0ready

request=1busy

request=1busy

...

Trace

{ p1 }

{ p1,p2 }

{ p2 }

{ p1,p2 }

{ p2 }

Execution

request=1ready

request=1busy

request=0busy

request=1busy

request=0busy

...

30/43

AP = { p1,p2, . . . ,pk }

PowerSet(AP) = { { }, {p1}, . . . , {pk},{ p1,p2 }, { p1,p3 }, . . . , { pk−1,pk },

. . .{ p1,p2, . . . , pk } }

Trace(Execution) is an infinite word over PowerSet(AP)

Traces(TS) is the { Trace(σ ) | σ is an execution of the TS }

31/43

AP = { p1,p2, . . . ,pk }PowerSet(AP) = { { }, {p1}, . . . , {pk},

{ p1,p2 }, { p1,p3 }, . . . , { pk−1,pk },. . .

{ p1,p2, . . . , pk } }

Trace(Execution) is an infinite word over PowerSet(AP)

Traces(TS) is the { Trace(σ ) | σ is an execution of the TS }

31/43

AP = { p1,p2, . . . ,pk }PowerSet(AP) = { { }, {p1}, . . . , {pk},

{ p1,p2 }, { p1,p3 }, . . . , { pk−1,pk },. . .

{ p1,p2, . . . , pk } }

Trace(Execution) is an infinite word over PowerSet(AP)

Traces(TS) is the { Trace(σ ) | σ is an execution of the TS }

31/43

AP = { p1,p2, . . . ,pk }PowerSet(AP) = { { }, {p1}, . . . , {pk},

{ p1,p2 }, { p1,p3 }, . . . , { pk−1,pk },. . .

{ p1,p2, . . . , pk } }

Trace(Execution) is an infinite word over PowerSet(AP)

Traces(TS) is the { Trace(σ ) | σ is an execution of the TS }

31/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . ....

Traces:

32/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . ....

Traces:

32/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . ....

Traces:

32/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . ....

Traces:

32/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . .

...

Traces:

32/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

{ } { } { } { } { } { } { } { } . . .

{ } { p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . .

{ p1 } { p1,p2 } { p2 } { p1,p2 } { p2 } { p1,p2 } . . .

{} { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } { p1,p2 } . . ....

Traces:

32/43

Traces of a TS describe its behaviour with respect to the atomicpropositions

33/43

Behaviour of TS

Atomic propositions

Set of its traces

34/43

Coming next: What is a property?

35/43

AP-INF = set of infinite words over PowerSet(AP)

Property 1: p1 is always true

{ A0A1A2 · · · ∈AP-INF | each Ai contains p1 }

{ p1 } { p1 } { p1 } { p1 } { p1 } { p1 } { p1 } . . .

{ p1 } { p1,p2 } { p1 } { p1,p2 } { p1 } { p1,p2 } . . ....

Property 2: p1 is true at least once and p2 is always true

{ A0A1A2 · · · ∈AP-INF | exists Ai containing p1 and every Aj contains p2 }

{ p2 } { p1,p2 } { p2 } { p2 } { p2 } { p1,p2 } { p2 } . . .

{ p1,p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . ....

36/43

AP-INF = set of infinite words over PowerSet(AP)

Property 1: p1 is always true

{ A0A1A2 · · · ∈AP-INF | each Ai contains p1 }

{ p1 } { p1 } { p1 } { p1 } { p1 } { p1 } { p1 } . . .

{ p1 } { p1,p2 } { p1 } { p1,p2 } { p1 } { p1,p2 } . . ....

Property 2: p1 is true at least once and p2 is always true

{ A0A1A2 · · · ∈AP-INF | exists Ai containing p1 and every Aj contains p2 }

{ p2 } { p1,p2 } { p2 } { p2 } { p2 } { p1,p2 } { p2 } . . .

{ p1,p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . ....

36/43

AP-INF = set of infinite words over PowerSet(AP)

Property 1: p1 is always true

{ A0A1A2 · · · ∈AP-INF | each Ai contains p1 }

{ p1 } { p1 } { p1 } { p1 } { p1 } { p1 } { p1 } . . .

{ p1 } { p1,p2 } { p1 } { p1,p2 } { p1 } { p1,p2 } . . ....

Property 2: p1 is true at least once and p2 is always true

{ A0A1A2 · · · ∈AP-INF | exists Ai containing p1 and every Aj contains p2 }

{ p2 } { p1,p2 } { p2 } { p2 } { p2 } { p1,p2 } { p2 } . . .

{ p1,p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . ....

36/43

AP-INF = set of infinite words over PowerSet(AP)

Property 1: p1 is always true

{ A0A1A2 · · · ∈AP-INF | each Ai contains p1 }

{ p1 } { p1 } { p1 } { p1 } { p1 } { p1 } { p1 } . . .

{ p1 } { p1,p2 } { p1 } { p1,p2 } { p1 } { p1,p2 } . . ....

Property 2: p1 is true at least once and p2 is always true

{ A0A1A2 · · · ∈AP-INF | exists Ai containing p1 and every Aj contains p2 }

{ p2 } { p1,p2 } { p2 } { p2 } { p2 } { p1,p2 } { p2 } . . .

{ p1,p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . ....

36/43

AP-INF = set of infinite words over PowerSet(AP)

Property 1: p1 is always true

{ A0A1A2 · · · ∈AP-INF | each Ai contains p1 }

{ p1 } { p1 } { p1 } { p1 } { p1 } { p1 } { p1 } . . .

{ p1 } { p1,p2 } { p1 } { p1,p2 } { p1 } { p1,p2 } . . ....

Property 2: p1 is true at least once and p2 is always true

{ A0A1A2 · · · ∈AP-INF | exists Ai containing p1 and every Aj contains p2 }

{ p2 } { p1,p2 } { p2 } { p2 } { p2 } { p1,p2 } { p2 } . . .

{ p1,p2 } { p2 } { p2 } { p2 } { p2 } { p2 } . . ....

36/43

AP-INF = set of infinite words over PowerSet(AP)

A property over AP is a subset of AP-INF

37/43

Behaviour of TS

Atomic propositions

Set of its traces

Property over AP

Subset of AP-INF

38/43

When does a transition system satisfy a property?

39/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

Transition System

AP = { p1, p2 }

Property

G p1

Transition system TS satisfies property P if

Traces(TS) ⊆ P

40/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

Transition System

AP = { p1, p2 }

Property

G p1

Transition system TS satisfies property P if

Traces(TS) ⊆ P

40/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

Transition System

AP = { p1, p2 }

Property

G p1

Transition system TS satisfies property P if

Traces(TS) ⊆ P

40/43

p1: (request=1) p2: (status=busy)

Atomic propositions

{ p1 } { p1,p2 }

{ p2 }{}

request=1ready

request=1busy

request=0ready

request=0busy

MODULE main

VARrequest: boolean;

status: {ready, busy}

ASSIGN

init(status) := ready;

next(status) := caserequest : busy;

TRUE : {ready,busy};

esac;

4/7

Transition System

AP = { p1, p2 }

Property

G p1

Transition system TS satisfies property P if

Traces(TS) ⊆ P

40/43

A property over AP is a subset of AP-INF

−→ hence also called Linear-time property

41/43

A property over AP is a subset of AP-INF

−→ hence also called Linear-time property

41/43

Behaviour of TS

Atomic propositions

Set of its traces

Property over AP

Subset of AP-INF

When does system

satisfy

property?

42/43

Take-away

É Use of MODULE in NuSMV

É Synchronous Vs Asynchronous composition ofmodules

É Mutual exclusion: checked some kind of safety property

É What properties do we check for detecting deadlocks?

É Definition of property

43/43