--> **************************************************************** --> QLOCK System Specification --> **************************************************************** --> ---------------------------------------------------------------- --> require seq require seq --> require set require set --> ---------------------------------------------------------------- --> AID: agent identifiers with equality _=a_ --> ---------------------------------------------------------------- mod* AID= { [Aid] op _=a_ : Aid Aid -> Bool {comm} . eq (A:Aid =a A) = true . } --> ---------------------------------------------------------------- --> AID-QU: Queues of Aid (agent identifiers) --> ---------------------------------------------------------------- mod! AID-QU (X :: AID=) { pr(SEQ=hd(X{sort Elt -> Aid, op _=e_ -> _=a_}) *{sort Seq -> Aq, op emp -> empQ, op (__) -> (_|_)}) } ** AID-QU is defined by instantiating formal parameter X of SEQ=hd ** with AID= by viewing sort Elt as sort Aid and op _=e_ as _=a_, ** 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,op _=e_ -> _=a_}) *{sort Set -> As, op empty -> empS}) } --> ---------------------------------------------------------------- --> STATE: states of qlock --> ---------------------------------------------------------------- mod! STATE (X :: AID=) { pr(AID-QU(X)*{op _=s_ -> _=aq_} + AID-SET(X)*{op _=s_ -> _=as_}) [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 =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] . }