-- ======================================================================== -- QLOCK System Specification -- ======================================================================== -- ======================================================================== -- a comment starts with '-- ' or '** ' and ends at the end of line -- -- a convention for commenting: -- '-- ' is used before the commented CafeOBJ text -- '** ' is used after the commented CafeOBJ text -- ======================================================================== -- ======================================================================== require seq require set -- ======================================================================== -- agent identifiers mod* AID {[Aid]} ** Aid is declared to be any set of agent identifiers -- ======================================================================== -- Queues of Aid (agent identifiers) mod! AID-QU {pr(SEQ(AID{sort Elt -> Aid}) *{sort Seq -> Aq, op emp -> empQ, op (__) -> (_|_)})} ** AID-QU is defined by instantiating formal parameter X of SEQ ** with AID by viewing sort Elt as sort Aid ** and renaming Seq to Aq, emp to empQ, and (__) to (_|_) ** '{...}' is a CafeOBJ costruct for defining a 'view' ** '*{...}' is a CafeOBJ costruct for renaming -- ======================================================================== -- Sets of Aid (agent identifiers) mod! AID-SET {pr(SET(AID{sort Elt -> Aid}) *{sort Set -> As, op empty -> empS})} -- ======================================================================== -- states of qlock mod! STATE {pr(AID-QU + AID-SET) [State] op [_r_w_c_] : Aq As As As -> State {constr} } -- ======================================================================== -- wt: want transition mod! WT {pr(STATE) tr[wt]: [AQ:Aq r (A1:Aid AS1:As) w AS2:As c AS3:As] => [(AQ | A1) r AS1 w (A1 AS2) c AS3] . } -- ======================================================================== -- ty: try transition mod! TY {pr(STATE) tr[ty]: [(A:Aid | AQ:Aq) r AS1:As w (A AS2:As) c AS3:As] => [(A | AQ) r AS1 w AS2 c (A AS3)] . } -- ======================================================================== -- exc: exit transition by conditional transition rule mod! EXC {pr(STATE) ctr[exc]: [(A:Aid | AQ:Aq) r AS1:As w AS2:As c (A3:Aid AS3:As)] => [AQ r (A3 AS1) w AS2 c AS3] if (A = A3) . } -- ======================================================================== -- system specification of QLOCK mod! QLOCKsys{pr(WT + TY + EXC)} -- ======================================================================== -- this file provides the feature 'qlock-sys' provide qlock-sys -- ======================================================================== eof ** end of file