Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / test / src / kind_fmcad08 / simulation / PRODUCER_CONSUMER_vt_e3_507.lus @ 22fe1c93

History | View | Annotate | Download (1.46 KB)

1
node First( X : int ) returns ( First : int );
2
let
3
    First = X -> pre First;
4
tel
5
node FirstB( X : bool ) returns ( First : bool );
6
let
7
    First = X -> pre First;
8
tel
9
node Sofar( X : bool ) returns ( Sofar : bool );
10
let
11
    Sofar = X -> X and pre Sofar;
12
tel
13
node excludes3( X1, X2, X3 : bool ) returns ( excludes : bool );
14
let
15
    excludes = not ( X1 and X2 or X1 and X3 or X2 and X3 );
16
tel
17
node PRODUCER_CONSUMMER(etat1, etat2, etat3 : bool; a_init : int
18
) returns(i, b, a, o1, o2 : int);
19
var
20
	garde1, garde2, garde3 : bool;
21
let
22
	garde1 = pre i >= 1;
23
	garde2 = pre b >= 1;
24
	garde3 = pre b >= 1;
25
	i = a ->
26
	if(etat1) then if(garde1) then pre i -1 else pre i else 
27
	pre i;
28
	b = 0 -> 
29
	if(etat1) then if(garde1) then pre b+1 else pre b else 
30
	if(etat2) then if(garde2) then pre b-1 else pre b else 
31
	if(garde3) then pre b-1 else pre b;
32
	a = a_init -> pre a;
33
	o1 = 0 -> 
34
	if(etat2) then if(garde2) then pre o1+1 else pre o1 else 
35
	pre o1;
36
	o2 = 0 -> 
37
	if(etat3) then if(garde3) then pre o2+1 else pre o2 else
38
	pre o2;
39
tel
40
node top(etat1, etat2, etat3 : bool; a_init : int) returns ( OK : bool );
41
    var i, b, a, o1, o2 : int;
42
        env : bool;
43
let
44
   ( i, b, a, o1, o2 ) = PRODUCER_CONSUMMER(etat1, etat2, etat3, a_init );
45
   env = Sofar( excludes3( etat1, etat2, etat3 ) or
46
                not ( etat1 or etat2 or etat3 ) ) and
47
         FirstB( not ( etat1 or etat2 or etat3 ) ) and
48
         First( a_init ) > 0;
49
   OK = env => o1 - o2 <= First( a );
50
  --%MAIN;
51
  --%PROPERTY  OK=true;
52
tel