This simple example shows a system holding a set of nodes that communicate
in a token ring fashion, hence they are connected circularly and they are either
idle and waiting for the token or active while holding the token. Being active in
this case just means that they are able to exit the system or pass along the token.
The structure of the system is determined by the names that are shared between the
nodes, being these processes responsible for updating the links when they intend to
leave the system. Each node receives information in one channel - the input channel -
and emits in another - the output channel. Getting the token is represented by the
reception while emitting stands for passing the token to the next node.
We start off by defining the exit procedure for the nodes. There are two possible
alternate behaviors: if the output channel is the same as the input channel that means
that this is the only node in the ring and therefore there is nothing left to be done;
the other possibility occurs when there is a node waiting for the token, so there is
a possible communication. The emitted information consists of the entry link of the
node that is exiting so that the next node can update it's entry point, something like
a short circuit in the links that existed for the exiting node.
defproc Exit(inCh,outCh) = select {[outCh=inCh].0; outCh!(inCh).0};We now define the behavior of the nodes starting by the IdleNode that consists
defproc IdleNode(inCh,outCh) = inCh?(newInCh).TokenOwner(newInCh,outCh) and TokenOwner(inCh,outCh) = select { tau.Exit(inCh,outCh); outCh!(outCh).IdleNode(inCh,outCh)};Finally we define the system consisting in a set of five nodes, four idle and
defproc System = (new l1,l2,l3,l4,l5 in (IdleNode(l1,l2) | IdleNode(l2,l3) | IdleNode(l3,l4) | IdleNode(l4,l5) | TokenOwner(l5,l1)));On the verification side, we start off by checking to see if our system, for every
check System |= always eventually 0;We now intend to verify that the set of nodes in our system are always connected
defprop exiting(inl,outl) = 1 and (((inl != outl) or <>0) and < outl!(inl) > 0);We now characterize a node by saying that it is a single point in space and it
defprop node(inl,outl) = 1 and (exiting(inl,outl) or (maxfix X(inLnk). ((< inLnk?(newInLnk) > X(newInLnk)) or ((<> exiting(inLnk,outl)) and (< outl!(outl) > X(inLnk))))) (inl));Finally we define the circularity property by stating that it is either the empty system
defprop ring = 0 or (hidden lnk. (minfix Y(x). (node(x,lnk) or (hidden y. (node(x,y) | Y(y))))) (lnk));We then check to see if the system holds this property in all possible configurations.
check System |= always ring;