13
CS269: HW/SW Engineering of Embedded Systems, Winter02
Example of Quantitative Constraints
Final class Gtime extends Quantity {
   double gtime;
   static double A(event e, int i){}   //the annotation of this quantity
  
   //axioms
   constraint {
      event e1, e2;
      int i, j;
      forall e1, e2, i, j: GXI.A(e1, i) == GXI.A(e2, j) -> A(e1, i ) == A(e2, j);
      forall e1, e2, i, j : GXI.A(e1, i) < GXI.A(e2, j) -> A(e1, i ) <= A(e2, j);
   }
}
i, j are implicitly universally quantified
1st “forall”: same GXI, then same time
2nd “forall”: smaller GXI, smaller or equal time