ecco provides a simple subset of the Python language to express properties matching sets of states.
As its most basic elements, it defines names that correspond to predefined sets of states (for instance the initial states of the system).
These sets can then be transformed through functions or combined using sets operations, which provides a whole grammar of sets expressions.
Basic sets
The most basic sets are:
INITthe set of initial statesDEADthe set of deadlock statesHULLthe convex hull of strongly connected components (globally to the state-space)ALLthe set of all the reachable states
Then, for a specific component graph:
Cn, wherenis the number of a component, is the set of states of this component
Finally, for a specific RR model, name LTS is a presentation of the model itself with dedicated attributes and methods.
In particular:
LTS["act"], whereactis the name if an action, is the set of states from whichactcan fireLTS["var+"], wherevaris the name of a variable, is the set of states wherevaris on- similarly,
LTS["var-"]is the set of states wherevaris off LTS["x+,y-"]is the set of states where variablexis on andyis off, and more generally any sequence of valuations can be provided
Functions and operations
The usual Python sets operations are supported: union |, intersection &, difference -, and symmetric difference ^.
This is complemented with several functions:
succ(s)is the set of all states reachable fromsthrough a single transitionpred(s)is the set of all states from whichscan be reached through a single transitionLTS.succ["act"](s)is the set of states that can be reached fromsthrough one firing of actionactLTS.pred["act"](s)is the set of states from whichscan be reached through one firing ofactpast(s)is the set of states that allow to reachs, which includessitselffuture(s)is the set of states that can be reached froms, which includessitselfbasin(s)is the subset ofpast(s)from which it cannot be avoided to reachs, which includesitself. Note that any SCC inpast(s) - sis not part ofbasin(s)because an infinite pathway that would stay in the SCC is a way to avoid reachingshull(s)returns the convex hull of the SCCs included ins, which may be empty. Compared toHULLabove, that is global to the state-space, this function performs a computation that is local tosscc(s)returns the strongly connected component includings, which may besitself whensis actually not within an SCCentries(s)is the subset ofsthat can be reached through a single transition from its outsideexits(s)is the subset ofsfrom which the outside ofscan be reached through a single transitionspick(s)returns one arbitrary state froms
Fixed point operations
Then, there are also fixed point operations.
The least fixed point of a function \(f\) is obtained by applying repeatedly \(f \cup id\), where \(id\) is the identity, until a fixed point is reached.
For instance, take succ for \(f\), consider the following state-space, and start from \(s = \{3\}\):
The fixed point is thus obtained after three applications of the function: \(\{3\} \mapsto \{3, 6\} \mapsto \{3, 6, 8\} \mapsto \{3, 6, 8, 5, 9\}\).
Note how this least fixed point make its argument grow through the succ function.
This fixed point function is available as succ_s, it can be intuitively understood as computing the set of states reachable from \(s\).
Similarly, function pred_s is available and computes the least fixed point of pred.
Combined with succ_s it allows defining the function scc presented above as the intersection of succ_s and pred_s.
On the example above, pred_s would build: \(\{3\} \mapsto \{3, 1, 5\} \mapsto \{3, 1, 5, 0, 8\} \mapsto \{3, 1, 5, 0, 8, 6\}\).
Intersecting this final set with the one obtained from succ_s would indeed yield the SCC that contains state \(3\).
Similarly, the greatest fixed point of a function \(f\) is obtained by applying repeatedly \(f \cap id\) until a fixed point is reached.
On the same example, we may start from \(s = \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\) and apply the greatest fixed point of succ:
The fixed point is obtained by two applications of the function: \(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\} \mapsto \{1, 2, 3, 4, 5, 6, 7, 8, 9\} \mapsto \{3, 4, 5, 6, 7, 8, 9\}\), at each step, the states that are not reachable through succ are removed, which shrinks the set until all its states are reachable through succ from another one in the set.
This fixed point is available as succ_o, as well as pred_o that is the greatest fixed point of pred.
The intersection of them defines function hull: in the example above, pred_o would build \(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\} \mapsto \{0, 1, 2, 3, 4, 5, 6, 7, 8\}\) which, intersected with the result of succ_o, would indeed yield the convex hull of the two SCCs present in this state-space.