The where clause specifies a condition that can be applied to a variable or transition(edge).
where <expression>;
The expression here must be a boolean expression.
A where clause can only be used with the declaration of a variable or an edge.
A where can be used in the following two ways:
int a;
int c where c>=0 && c<=a; //illegal: a is another variable
const int LEN=5;
const int PAD=1;
/* okay: the following where clause contains only c itself
* and other constants: LEN and PAD */
int c where c>=LEN+PAD;
//t1 can only happen when coin is true.
trans t1 {Locked -> Unlocked where coin==true;}
//t2 can only happen when push is true.
trans t2 {Unlocked -> Locked where push==true;}
//t3 can only happen when coin is not true.
trans t3 {Locked -> Locked} //implicitly push==false
//t4 can only happen when push is not true.
trans t4 {Unlocked -> Locked} //implicitly push==false
int a where a>=0;
The variable a must satisfy the condition a>=0 before, during and after each computation in the specification.
IMPORTANT: a where clause checks the initializer of an variable. See the following example:
const int LOWER_BOUND = 10;
int a = 0 where a >= LOWER_BOUND;
Cyclone cannot find a path to satisfy the condition specified by the where clause since variable a is initialized with 0 here.
The following example shows a where clause is used with a transition.
trans t {In -> Out where door_open==true;}
The transition In -> Out can only happen when the condition door_open==true is met.
@2020-2022 Hao Wu. All rights reserved. Last update: January 29, 2022