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:
INIT
the set of initial statesDEAD
the set of deadlock statesHULL
the convex hull of strongly connected components (globally to the state-space)ALL
the set of all the reachable states
Then, for a specific component graph:
Cn
, wheren
is 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"]
, whereact
is the name if an action, is the set of states from whichact
can fireLTS["var+"]
, wherevar
is the name of a variable, is the set of states wherevar
is on- similarly,
LTS["var-"]
is the set of states wherevar
is off
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 froms
through a single transitionpred(s)
is the set of all states from whichs
can be reached through a single transitionLTS.succ["act"](s)
is the set of states that can be reached froms
through one firing of actionact
LTS.pred["act"](s)
is the set of states from whichs
can be reached through one firing ofact
past(s)
is the set of states that allow to reachs
, which includess
itselffuture(s)
is the set of states that can be reached froms
, which includess
itselfbasin(s)
is the subset ofpast(s)
from which it cannot be avoided to reachs
, which includes
itself. Note that any SCC inpast(s) - s
is not part ofbasin(s)
because an infinite pathway that would stay in the SCC is a way to avoid reachings
hull(s)
returns the convex hull of the SCCs included ins
, which may be empty. Compared toHULL
above, that is global to the state-space, this function performs a computation that is local tos
scc(s)
returns the strongly connected component includings
, which may bes
itself whens
is actually not within an SCCentries(s)
is the subset ofs
that can be reached through a single transition from its outsideexits(s)
is the subset ofs
from which the outside ofs
can 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.