--> **************************************************************** --> QLOCK System Specification --> **************************************************************** --> ---------------------------------------------------------------- --> require seq require seq --> require set require set --> ---------------------------------------------------------------- --> AID: agent identifiers --> ---------------------------------------------------------------- mod* AID {[Aid]} ** Aid is declared to be any set of agent identifiers --> ---------------------------------------------------------------- --> AID-QU: Queues of Aid (agent identifiers) --> ---------------------------------------------------------------- mod! AID-QU (X :: AID) { pr(SEQ(X{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 --> ---------------------------------------------------------------- --> AID-SET: Sets of Aid --> ---------------------------------------------------------------- mod! AID-SET (X :: AID) { pr(SET(X{sort Elt -> Aid}) *{sort Set -> As, op empty -> empS}) } --> ---------------------------------------------------------------- --> STATE: states of qlock --> ---------------------------------------------------------------- mod! STATE (X :: AID) { pr(AID-QU(X) + AID-SET(X)) [State] op [_r_w_c_] : Aq As As As -> State {constr} } --> ---------------------------------------------------------------- --> WT: want transition --> ---------------------------------------------------------------- mod WT { inc(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 { inc(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 { inc(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) . } --> ---------------------------------------------------------------- --> QLOCKsys: system specification of QLOCK --> ---------------------------------------------------------------- mod QLOCKsys{inc(WT + TY + EXC)} --> ---------------------------------------------------------------- --> provide qlock-sys provide qlock-sys --> **************************************************************** --> enf of file eof --> **************************************************************** --> ---------------------------------------------------------------- --> EX: exit transition --> ---------------------------------------------------------------- mod EX {inc(STATE) tr[ex]: [(A:Aid | AQ:Aq) r AS1:As w AS2:As c (A:Aid AS3:As)] => [AQ r (A AS1) w AS2 c AS3] }