Data Representation and Efficient Solution: A Decision Diagram Approach
Data Representation and Efficient Solution: A Decision Diagram Approach
Gianfranco Ciardo
Dept. of Computer Science and Engineering, UC Riverside, CA 92521, USA
[email protected]
Abstract. Decision diagrams are a family of data structures that can
compactly encode many functions on discrete structured domains, that
is, domains that are the cross-product of nite sets. We present some
important classes of decision diagrams and show how they can be eec-
tively employed to derive symbolic algorithms for the analysis of large
discrete-state models. In particular, we discuss both explicit and sym-
bolic algorithms for state-space generation, CTL model-checking, and
continuous-time Markov chain solution. We conclude with some sugges-
tions for future research directions.
Key words: binary decision diagrams, multi-valued decision diagrams,
edge-valued decision diagrams, state-space generation, symbolic model
checking, Kronecker algebra.
1 Introduction
Discrete-state models are useful to describe and analyze computer-based and
communication systems, or distributed software, and many other man-made ar-
tifacts. Due to the inherent combinatorial nature of their interleaving behav-
ior, such models can easily have enormous state spaces, which can make their
computer-supported analysis very dicult. Of course, high-level formalisms such
as Petri nets, queueing networks, communicating sequential processes, and spe-
cialized languages can be eectively used to describe these enormous underlying
state space. However, when a model described in one of these formalisms needs
to be analyzed, the size of the state space remains a major obstacle.
In this contribution, we present decision diagrams, a class of data structures
that can compactly encode functions (or set and relations, or vectors and ma-
trices) on very large but structured domains. Then, we briey summarize some
of the main computational tasks involved in the traditional explicit analysis
of systems, both in a strictly logical setting and in a Markovian setting. Putting
the two together, we then show how these tasks can be eectively performed
symbolically using decision diagrams. We conclude by listing some research
challenges lying ahead.
Work supported in part by the National Science Foundation under grants CNS-
0501747 and ATM-0428880
x
4
x
3
x
2
x
1
+ (x
4
+ x
3
) (x
2
+ x
1
)
0 1
0 1
0 1
0 1 0 1
0 1
x
3
x
2
x
1
+ x
3
(x
2
+ x
1
)
x
2
x
1 x
2
+ x
1
x
1
1 0
x
1
x
2
x
3
x
4
x
4
x
3
x
2
x
1
+ (x
4
+ x
3
) (x
2
+ x
1
)
0 1
0 1
0 1
0 1 0 1
0 1
x
3
x
2
x
1
+ x
3
(x
2
+ x
1
)
x
2
x
1 x
2
+ x
1
x
1
1 0
0 1
0 1 0 1
0 1
x
2
+ x
1
Fig. 1. Fully-reduced vs. quasi-reduced BDDs.
In the following, calligraphic letters (e.g., /, A) denote sets or relations,
lowercase bold letters (e.g., i, j) indicate global state of the system, and lowercase
italic letters (e.g., i, x
k
) indicate local components of the state. Also, B, N, Z,
and R indicate the set 0, 1 of boolean values, the natural numbers, the integers,
and the real numbers, respectively.
2 Decision diagrams: a data structure for structured data
Many classes of decision diagrams have been dened in the literature. This sec-
tion presents some of the most common ones, which will be used in Section 4 to
improve the eciency of discrete-state system analysis.
2.1 Binary decision diagrams
The most widely known and used class of decision diagrams is by far the binary
decision diagrams (BDDs) [3], which provide a compact representation for
functions of the form f : B
L
B, for some nite L N. In particular, if the
BDDs are reduced and ordered [3, 4], properties we assume from now on for all
classes of decision diagrams we discuss, they enjoy several important advantages.
Such BDDs are canonical, thus testing for satisability, i.e.,
is there an i B
L
such that f(i) = 1?
or equivalence, i.e.,
given functions f and g, is f(i) = g(i) for all i B
L
?
can be done in constant time, while important binary operations such as con-
junction, disjunction, and relational product (described in detail later) require
time and memory proportional to the product of the size (number of nodes) of
the argument BDDs, in the worst case.
Formally, an L-variable BDD is an acyclic directed edge-labeled graph where
each of its nodes encodes a function of the form f : B
L
B. The nodes of
the graph are assigned to a level, we let p.lvl denote the level of node p. A
non-terminal node at level k, with L k 1, corresponds to a choice for the
value of the boolean variable x
k
, the k
th
argument to the function, while the two
terminal nodes 0 and 1 correspond to the two possible values of the function. A
node p at level k has two edges, labeled with the possible values of x
k
, 0 and
1. The edge labeled 0, or 0-edge, points to node p[0] while the 1-edge point to
node p[1], where both nodes are at levels below k (this is the ordered property:
nodes are found along any path in an order consistent with the order x
L
, ..., x
1
of the argument variables). Also, nodes must be unique (thus, no node can be a
duplicate of another node at the same level, i.e., have have the same 0-child and
the same 1-child) and non-redundant, i.e., p[0] and p[1] must dier (this is the
fully reduced property). A node p at level k encodes the function v
p
: B
L
B
dened recursively by
v
p
(x
L
, ..., x
1
) =
p if k = 0
x
k
v
p[0]
(x
L
, ..., x
1
) x
k
v
p[1]
(x
L
, ..., x
1
) if k > 0.
Thus, given a constant vector i = (i
L
, ..., i
1
) B
L
, we can evaluate v
p
(i) in O(L)
time. Fig. 1 on the left shows an example of BDD and the boolean functions
encoded by its nodes. On the right, the same set of functions are encoded using
a quasi-reduced version of BDDs , where duplicate nodes are not allowed, but
redundant nodes (shown in gray in the gure) may have to be present, since
edges can only span one level. Such BDDs are still canonical, and, while they
may use more nodes, all their edges connect nodes at adjacent levels, resulting
in simpler manipulation algorithms.
Strictly speaking, a BDD encoding a given function f has a specic root p
such that f = v
p
. In practice, BDD algorithms need to manage multiple functions
on the same domain B
L
, and this is done by storing (without duplicates) all the
roots of these functions, as well as the nodes reached by them, in a single BDD,
often referred to as a BDD forest.
2.2 Multi-valued, multi-terminal, and multi-dimensional extensions
Many variants of BDDs have been dened to extend their applicability or to tar-
get specic applications. This section discusses several terminal-valued vari-
ants, that is, decision diagrams where the value of function f evaluated on ar-
gument i is given by the the terminal node reached when following the path
corresponding to i, just as is the case for BDDs.
Multi-valued decision diagrams (MDDs) [24] encode functions of the form
k
for columns, or to variables. Furthermore, the manipulation
0 1
0 1 2
0 1 2 3
0 1 2 0 1 2
0 1 0 1
0 1 2 0 1 2
5 7 8
x
1
x
2
x
3
x
4
0 1 2
0 1 2 3
0 1 2 0 1 2
0 1 0 1
0 1 2 0 1 2
0 1 0 1 0 1
0 1 0 1
0 1 5 7 8
2 2
Fig. 3. Fully-reduced vs. quasi-reduced MTMDD.
algorithms are more easily written, and usually much more ecient, if the levels
are interleaved, that is, the order of the function parameters is (x
L
, x
L
, ..., x
1
, x
1
).
A similar, but more direct, way to encode such matrices is to use a (boolean-
valued) matrix diagrams (MxDs) [13, 27], where a non-terminal node P at
level k, for Lk 1, has n
k
n
k
edges, so that P[i
k
, i
k
] points to the node to
be reached when x
k
= i
k
and x
k
= i
k
. The top left of Fig. 4 shows a 2L-level
MDD, where L = 2, in sparse format. The encoded (3 2)(3 2) matrix has zero
entries in all but seven positions (the rows and columns of the resulting matrix
are indexed by x
2
2 + x
1
and x
2
2 + x
1
, respectively):
0 1 2 3 4 5
0 0 0 0 0 0 0 0 (x
2
= 0, x
1
= 0)
1 0 0 0 0 1 0 1 (x
2
= 0, x
1
= 1)
2 0 0 0 0 0 0 where 2 (x
2
= 1, x
1
= 0)
3 1 1 1 1 0 0 3 (x
2
= 1, x
1
= 1)
4 0 0 1 0 0 0 4 (x
2
= 2, x
1
= 0)
5 0 0 0 1 0 0 5 (x
2
= 2, x
1
= 1)
MxDs, however, where not introduced just to stress the natural interleav-
ing of unprimed and primed variables, but to exploit a much more fundamental
property often present in large asynchronous systems: the large number of iden-
tity patterns. The top right of Fig. 4 show the MxD encoding the same matrix,
and the gray node in it is an example of an identity: its diagonal edges points
to the same node, the terminal node 1 in this case, while its o-diagonal entries
point to node 0. The bottom left of Fig. 4 shows the identity-reduced version of
MxDs which is commonly employed, where long edges signify skipped identity
nodes; on the right is the sparse format representation, which just lists explicitly
the row-column pairs of indices corresponding to non-zero node entries.
2.3 Edge-valued extensions
Further edge-valued variants of decision diagrams have been dened to rep-
resent functions with a non-boolean range, as MTMDDs and ADDs can, but
0 1 2
2
1 0 1
0 1
0 1 1
1
0 1 1
1
x
/
1
x
1
x
/
2
x
2
x
1
x
2
0 1
0
1
2
2
0 1
0
1
0 1
0
1
0 1
0
1
1
0 1
0
1
2
2
0 1
0
1
0 1
0
1
1
x
1
x
2
x
/
1
x
1
x
/
2
x
2
1
1 1
0 1
1
1
0 1 1 2
2 0 1 1
Fig. 4. Representing a boolean matrix with 2L-level MDDs or with MxDs.
in such a way that the value of the function is not found in a terminal node,
but is distributed over the edges found along a path. The manipulation algo-
rithms are generally more complex, but these classes of decision diagrams can
be exponentially more compact than their respective terminal-valued versions.
Edge-valued BDDs (EVBDDs) [26] encode functions of the form B
L
Z,
by having a single terminal node , which carries no value, and associating
integer values to the edges of the diagram. The value of the function is obtained
by adding the values encountered along the path to corresponding the the
functions argument; the result is a possibly exponentially smaller diagram than
with an MTBDD. Nodes are normalized by scaling their edge values so that the
0-edge has an associated value of 0 (this fact can be used to save storage in a
practical implementation, but is also one way to enforce canonicity), and the root
node has a dangling arc whose associated value is summed to the path value
when evaluating the function, thus it is the value of the function being encoded
when the argument is (0, ..., 0). The EVMDD shown in Fig. 5 on the left is
f (0,...,0)
1 2 3 0
0 18 36 54
1 2 0
0 6
1 2 0
0 1 2
1 0
0 3
12
x
1
x
2
x
3
x
4
1 2 3 0
1 0 2 2
1 2 0
3 0
1 0
0
1 2 0
0 1 6
1 0
4 0
min f
x
1
x
2
x
3
x
4
min f
1 2 3 0
1 0 2 2
1 2 0
3 0
1 0
0
1 2 0
0 1 6
1 0
4 0
1 2 0
0 0 0
1 2 0
0 0 0
Fig. 5. EVMDDs, fully-reduced EV
+
MDDs, and quasi-reduced EV
+
MDDs.
the corresponding version with multi-way choices, it encodes f(x
4
, x
3
, x
2
, x
1
) =
Lk1
x
k
k>h1
n
h
, i.e., the value of (x
4
, x
3
, x
2
, x
1
) interpreted as a mixed-
base integer; the same function would require a full tree, thus exponential space,
if encoded with an MTMDD. Formally, the function v
(,p)
:
A Z encoded by
edge (, p), where Z and p is a node at level k, is dened recursively as
v
(,p)
(x
L
, ..., x
1
) =
if k = 0
+ v
p[x
k
]
(x
L
, ..., x
1
) if k > 0.
The positive edge-valued MDDs (EV
+
MDDs) [14] use a dierent normal-
ization rule where all edge values leaving a node are non-negative or (positive)
, but at least one of them is zero, so that the value associated with the dan-
gling edge is the minimum of the function. To ensure canonicity, an edge with
an associated value of can only point to . EV
+
MDDs can encode arbitrary
partial functions of the form
A N . For example, the function encoded
by the EV
+
MDD in the middle of Fig. 5 cannot be encoded by an EVMDD
because f(0, ..., 0) = , but f is not identically . Furthermore, if the dangling
arc of the EV
+
MDD is allowed to be an arbitrary integer, then , arbitrary partial
functions of the form
A Z can be encoded. The EV
+
MDD shown on
the right of Fig. 5 shows the equivalent quasi-reduced version: the condition for a
node to be redundant (as the additional gray nodes in the gure are) is now that
all of its edges point to the same node and have the same associated value, which
must then be 0, given the normalization requirement. In the gure, long edges
with an associated value of can still exist; alternatively, even those could be
required to span only one level through the introduction of further redundant
node, but this would not further simplify the manipulation algorithms.
We already saw boolean MxDs, but, originally, (real-valued) matrix dia-
grams (MxDs) [13, 27] were introduced to overcome some of the applicability
min f
0 1
0
1
2
2
0 1
0
1
0 1
0
1
7
6
2
1 1
1
1
x
1
x
2
min f
0 1
0
1
2
2
0 1
0
1
0 1
0
1
0 1
0
1
7
6
2
1 1
1
1
1
1
x
/
1
x
1
x
/
2
x
2
min f
1 1
0 1
1
1
0 1 1 2
2 0 1 1
1 2 1 7
1 6 1
2
, x
1
, x
1
) is 7 when x
2
= 2,
x
2
= 1, x
1
= x
1
, and it is 0 when x
2
= 2, x
2
= 1, x
1
,= x
1
. The center of the
same gure shows the quasi-reduced version of this MxD, where the only long
edges are those with an associated value of 0, thus are not shown, while the right
shows its sparse representation.
2.4 Decision diagram manipulation algorithms
So far we have discussed static aspects of various classes of decision diagrams,
i.e., we have seen how decision diagrams can compactly encode functions over
large structured domains. However, their time eciency is just as important as
their ability to save memory. Thus, we now turn to dynamic aspects of their
manipulation. Decision diagram algorithms can usually be elegantly expressed
in a recursive style. Two data structures are essential to achieve the desired
eciency. First, a unique table is required to enforce canonicity. This is a hash
table that can be searched based on the level and the pattern of edges (and
values, in the edge-valued case) of a node, to avoid creating duplicate nodes.
Second, an operation cache is used to look up whether a needed result of some
operation on some nodes has been previously computed. Also this is a hash table,
this time searched on the argument nodes unique identier (e.g., their memory
address) and the operation code.
For example, Fig. 7 shows two BDD algorithms. The rst one, Or, computes
the disjunction of its arguments, i.e., given two functions v
a
, v
b
: B
L
B,
encoded by the two nodes a and b, it computes the node r encoding function v
r
satisfying v
r
(i) = v
a
(i) v
b
(i), for all i B
L
. This algorithm assumes that these
function are encoded in a fully-reduced BDD forest, thus, after testing for trivial
cases that can be directly answered without recursion, it must test the level of
a and b and proceed accordingly. Note that checking whether Cache contains
already a result r for the Or of a and b is essential to eciency; without it, the
complexity would be proportional to the number of paths in the BDDs, not to
the number of nodes in them.
The second algorithm in Fig. 7 computes the so-called relational product r of
an L-level BDD x with a 2L-level BDD t, i.e., v
r
(j)=1 i, v
x
(i)=1v
t
(i, j)=1.
Note that, as the BDDs are assumed to be quasi-reduced, the recursion on x and
t proceeds in lockstep, i.e., level k of x is processed with levels k and k
of t to
compute level k (conceptually k
A, A
init
, T ), where
A is a nite set of states,
A
init
A is the set of initial states, and T
A
A is a transition relation. We
bdd Or(bdd a, bdd b) is fully-reduced version
local bdd r, r0, r1;
local level k;
1 if a = 0 or b = 1 then return b;
2 if b = 0 or a = 1 then return a;
3 if a = b then return a;
4 if Cache contains entry ORcode, |a, b : r) then return r;
5 if a.lvl < b.lvl then compare the levels of nodes a and b
6 k b.lvl ;
7 r0 Or(a, b[0]);
8 r1 Or(a, b[1]);
9 else if a.lvl > b.lvl then
10 k a.lvl ;
11 r0 Or(a[0], b);
12 r1 Or(a[1], b);
13 else a.lvl = b.lvl
14 k a.lvl ;
15 r0 Or(a[0], b[0]);
16 r1 Or(a[1], b[1]);
17 r UniqueTableInsert(k, r0, r1);
18 enter ORcode, |a, b : r) in Cache;
19 return r;
bdd RelProd(bdd x, bdd2 t) is quasi-reduced version
local bdd r, r0, r1;
1 if x = 0 or t = 0 then return 0;
2 if x = 1 and t = 1 then return 1;
3 if Cache contains entry RELPRODcode, x, t : r) then return r;
4 r0 Or(RelProd(x[0], t[0][0]), RelProd(x[1], t[1][0]));
5 r1 Or(RelProd(x[0], t[0][1]), RelProd(x[1], t[1][1]));
6 r UniqueTableInsert(x.lvl, r0, r1);
7 enter RELPRODcode, x, t : r) in Cache;
Fig. 7. Examples of recursive algorithms on fully-reduced and quasi-reduced BDDs.
assume the global model state to be of the form (x
L
, ..., x
1
), where, for L k 1,
each local state variable x
k
takes value from a set A
k
= 0, 1, ..., n
k
1, with
n
k
> 0. Thus,
A = A
L
A
1
and we write T (i
L
, ..., i
1
, i
K
, ..., i
1
), or T (i, i
),
if the model can move from the current state i to a next state i
in one step.
The rst step in system analysis is often the computation of the reachable
state space. The goal is to nd the set A
reach
of states reachable from the initial
set of states A
init
according to the transition relation T . Let ii
mean that
state i can reach state i
T (i) with a slight abuse of notation. Then, the reachable state space is
A
reach
= j : d > 0, i
(1)
i
(2)
i
(d)
i
(1)
A
init
j = i
(d)
.
Further logic analysis might involve searching for deadlocks or proving certain
liveness properties. In general, such questions can be expressed in some temporal
evmdd Min(level k, evmdd (, a), evmdd (, b)) is quasi-reduced version
local evmdd (, r), r0, ..., rn
k
1, (
, a
), (
, b
);
1 if = then return (, b);
2 if = then return (, a);
3 min(, );
4 if k = 0 then return (, ); the only node at level 0 is
5 if Cache contains entry MINcode, a, b, : (, r)) then return ( + , r);
6 for i = 0 to n
k
1 do
7 a
a[i].child;
8
+ a[i].val ;
9 b
b[i].child;
10
+ b[i].val ;
11 ri Min(k1, (
, a
), (
, b
, and p p
, pRp
, ii
T,
A
EpUq
= i : d>0, i
(1)
i
(d)
i =i
(1)
i
(d)
Q c, 1c<d, i
(c)
T,
A
EGp
= i : d>0, i
(1)
i
(d)
i =i
(1)
c, 1cd, i
(c)
T.
Fig. 9 shows the pseudocode to compute the set of states satisfying EXp,
EpUq, and EGp, or, more precisely, to label these states, assuming that the
states satisfying the CTL formulas p and q have already been labeled. In other
words, the labels corresponding to the subformulas of a CTL formulas are as-
signed rst; of course, at the innermost level, the labeling corresponding to
atomic propositions is just given by the labeling function L of the Kripke struc-
ture. Unlike state-space generation, these algorithms walk backwards in the
transition relation, thus use the inverse transition relation T
1
instead of T .
3.2 Markov system description and analysis
A discrete-state model or a Kripke structure can be extended by associating
timing information to each state-to-state transition. If the time required for
each transition is an exponentially distributed random variable independently
sampled every time the state is entered and if all the transitions out of each state
are racing concurrently, this denes an underlying continuous-time Markov
chain (CTMC). Formally, a CTMC is a stochastic process X
t
: t R with a
discrete state space A
reach
satisfying the memoryless property, that is:
r 1, t >t
(r)
> >t
(1)
, i, i
(1)
, ..., i
(r)
A
reach
,
PrX
t
= i [ X
t
(r) = i
(r)
, ..., X
t
(1) = i
(1)
= PrX
t
= i [ X
t
(r) = i
(r)
.
We limit our discussion to homogeneous CTMCs, where the above probability
depends on t and t
(r)
only through the dierence t t
(r)
, i.e.,
PrX
t
= i [ X
t
(r) = i
(r)
= PrX
tt
(r) = i [ X
0
= i
(r)
.
Let
t
be the probability vector denoting the probability
t
[i] = PrX
t
= i
of each state i A
reach
at time t 0. A homogeneous CTMC is then described
by its initial probability vector
0
, satisfying
0
[i] > 0 i A
init
and by its transition rate matrix R, dened by
i, j A
reach
, R[i, j] =
0 if i = j
lim
h0
PrX
h
= j[X
0
= i/h if i ,= j
ExplicitBuildEX(p) is
1 . |i .
reach
: p labels(i); initialize . with the states satisfying p
2 while . ,= do
3 pick and remove a state i
from .;
4 for each i T
1
(i
from .;
6 for each i T
1
(i
from };
8 for each i T
1
(i
l=i
R[i, l] if i = j
R[i, j] if i ,= j.
The short-term, or transient, behavior of the CTMC is found by computing
the transient probability vector
t
, which is the solution of the ordinary dier-
ential equation d
t
/dt =
t
Q with initial condition
0
, thus it is given by the
matrix exponential expression
t
=
0
e
Qt
. The long-term, or steady-state, be-
havior is found by computing the steady-state probability vector = lim
t
t
;
if the CTMC is irreducible (since we assume that A
reach
is nite, this implies
that A
reach
is a single strongly-connected component), is independent of
0
and is the unique solution of the homogeneous linear system Q = 0 subject to
iX
reach
[i] = 1. The probability vectors and
t
are typically used to eval-
real[n] Jacobi (real[n]
(old)
, h, real[n, n] R) is
local real[n]
(new)
;
1 repeat
2 for j = 1 to [.
reach
[
3
(new)
[j] h[j]
P
i:R[i,j]>0
(old)
[i] R[i, j];
4
(new)
(new)
/(
(new)
1);
5
(old)
(new)
;
6 until converged;
7 return
(new)
;
real[n] GaussSeidel (real[n] , h, real[n, n] R) is
1 repeat
2 for j = 1 to [.
reach
[
3 [j] h[j]
P
i:R[i,j]>0
[i] R[i, j];
4 /( 1);
5 until converged;
6 return ;
real[n] Uniformization(real[n] 0, real[n, n] P, real q, t, natural M) is
local real[n] t;
1 t 0;
2 0;
3 Poisson e
qt
;
4 for k = 1 to M do
5 t t + Poisson;
6 P;
7 Poisson Poisson q t/k;
8 return t;
Fig. 10. Numerical solution algorithms for CTMCs (n = [.
reach
[).
uate expected instantaneous reward measures. For example, a reward function
r : A
reach
R species the rate at which a reward is generated in each state,
and its expected value in steady state is computed as
iX
reach
[i]r(i).
It is also possible to evaluate accumulated reward measures over a time inter-
val [t
1
, t
2
], in either the transient (t
1
< t
2
< ) or the long term (t
1
< t
2
= ).
The numerical algorithms and the issues they raise are similar to those for in-
stantaneous rewards discussed above, thus we omit them for brevity.
In practice, for exact steady-state analysis, the linear systemQ = 0 is solved
using iterative methods such as Jacobi or Gauss-Seidel, since the matrix Q is
typically extremely large and quite sparse. If Q is stored by storing matrix R, in
sparse row-wise or column-wise format, and the diagonal of Q, as a full vector,
the operations required for these iterative solution methods are vector-matrix
multiplications, i.e., vector-column (of a matrix) dot products. In addition to Q,
the solution vector must be stored, and most iterative methods (such as Jacobi)
require one or more auxiliary vectors of the same dimension as , [A
reach
[. For
extremely large CTMCs, these auxiliary vectors may impose excessive memory
requirements.
If matrix R is stored in sparse column-wise format, and vector h contains the
expected holding time for each state, where h[i] = 1/Q[i, i], then the Jacobi
method can be written as in Fig. 10, where
(new)
is an auxiliary vector and
the matrix R is accessed by columns, although the algorithm can be rewritten
to access matrix R by rows instead. The method of Gauss-Seidel, also shown in
Fig. 10, is similar to Jacobi, except the newly computed vector entries are used
immediately; thus only the solution vector is stored, with newly computed
entries overwriting the old ones. The Gauss-Seidel method can also be rewritten
to access R by rows, but this is not straightforward, requires an auxiliary vector,
and adds more computational overhead [19].
For transient analysis, the uniformization method is most often used, as it
is numerically stable and uses straightforward vector-matrix multiplications as
its primary operations (Fig. 10). The idea is to uniformize the CTMC with a
rate q max
iX
reach
[Q[i, i][ and obtain a discrete-time Markov chain with
transition probability matrix P = Q/q + I. The number of iterations M must
be large enough to ensure that
M
k=0
e
qt
(qt)
k
/k! is very close to 1.
4 Putting it all together: structured system analysis
We are now ready to show how the logical and numerical analysis algorithms of
the previous section can be implemented symbolically using appropriate classes
of decision diagrams. Most of these algorithms compute the xpoint of some
functional, i.e., a function transformer, where the xpoint is a function encoded
as a decision diagram.
4.1 Symbolic state space generation
State space generation is one of the simplest examples of symbolic xpoint com-
putation, and arguably the most important one. The reachable state space A
reach
can be characterized as the smallest solution of the xpoint equation
A A
init
T (A).
Algorithm Bfs in Fig. 11 implements exactly this xpoint computation, where
sets and relations are stored using L-level and 2L-level MDDs, respectively, i.e.,
node p encodes the set A
p
having characteristic function v
p
satisfying
v
p
(i
L
, ..., i
1
) = 1 (i
L
, ..., i
1
) A
p
.
The union of sets is simply implemented by applying the Or operator of Fig.
7 to their characteristic functions, and the computation of the states reachable in
one step is implemented by using function RelProd, also from Fig. 7 (of course,
the MDD version of these functions must be employed if MDDs are used instead
of BDDs). Since it performs a breadth-rst symbolic search, algorithm Bfs halts
in exactly as many iterations as the maximum distance of any reachable state
from the initial states.
Many high-level formalisms can be used to implicitly describe the state space
by specifying the initial state or states, thus A
init
, and a rule to generate the
states reachable in one step form each state, thus T . Most formalisms are not
only structured in the sense that they dene the model state through L vari-
ables (x
L
, . . . , x
1
), which is of course required for any symbolic approach, but also
asynchronous, in the sense that they disjunctively partition [8] the transition
relation T according to a set c of events. When T is expressed as T =
eE
T
e
,
it is usually more ecient to deviate from a strict breadth-rst approach. Al-
gorithm BfsChaining in Fig. 11 implements a chaining approach [31] where the
eect of applying each event is immediately accumulated as soon as it is com-
puted. Chaining is based on the observation that the number of symbolic itera-
tions might be reduced if the application of asynchronous events is compounded
sequentially. While the search order is not strictly breadth-rst anymore when
chaining is used, the number of iterations of the repeat loop is at most as large
as for breadth-rst search, and usually much smaller. However, the eciency of
symbolic state-space generation is determined not just by the number of itera-
tions but also by their cost, i.e., by the size of the MDDs involved. In practice,
chaining has been shown to be quite eective in many models, but its eective-
ness can be greatly aected by the order in which events are applied.
Much larger eciency improvements, however, can be usually achieved with
the Saturation algorithm [12, 16]. Saturation is motivated by the observation
that, in many distributed systems, interleaving semantic implies that multiple
events may occur, each exhibiting a strong locality, i.e., aecting only a few state
variables. We associate two sets of state variables with each event e:
1
M
(e)=x
k
: i =(i
L
, ..., i
1
), i
=(i
L
, ..., i
1
), i
T
e
(i) i
k
,=i
k
and
1
D
(e)=x
k
: i =(i
L
, ..., i
1
), j =(j
L
, ..., j
1
), h,=k, i
h
=j
h
T
e
(i),= T
e
(j)=,
the state variables that can be modied by e or that can disable e, respectively.
Then, we let
Top(e) = maxk : x
k
1
M
(e) 1
D
(e)
be the highest state variable, thus MDD level, aected by event e, and we par-
tition the event set c into c
k
= e : Top(e) = k, for L k 1.
Saturation computes multiple lightweight nested xpoints Starting from
the quasi-reduced MDD encoding A
init
, Saturation begins by exhaustively ap-
plying events e c
1
to each node p at level 1, until it is saturated, i.e., until
eE1
T
e
(A
p
) A
p
. Then, it saturates nodes at level 2 by exhaustively applying
to them all the events e c
2
, with the proviso that, if any new node at level 1
is created in the process, it is immediately saturated (by ring the events in c
1
on it). The approach proceeds in bottom-up order, until the events in c
L
have
been applied exhaustively to the topmost node r. At this point, the MDD is
saturated,
eE
T
e
(A
r
) A
r
, and r encodes the reachable state space A
reach
.
Experimentally, Saturation has been shown to be often several orders of
magnitude more ecient than symbolic breadth-rst iterations in both memory
and time, when employed on asynchronous systems. Extensions of the Saturation
algorithm have also been presented, where the size and composition of the local
mdd Bfs(mdd .init) is
local mdd p;
1 p .init;
2 repeat
3 p Or(p, RelProd(p, T ));
4 until p does not change;
5 return p;
mdd BfsChaining(mdd .init) is
local mdd p;
1 p .init;
2 repeat
3 for each e c do
4 p Or(p, RelProd(p, Te));
5 until p does not change;
6 return p;
mdd Saturation(mdd .init) is assumes quasi-reduced MDDs
1 return Saturate(L, .init);
mdd Saturate(level k, mdd p) is
local mdd r, r0, ..., rn
k
1;
1 if p = 0 then return 0;
2 if p = 1 then return 1;
3 if Cache contains entry SATcode, p : r) then return r;
4 for i = to n
k
1 do
5 ri Saturate(k 1, p[i]); rst, be sure that the children are saturated
6 repeat
7 choose e c
k
, i, j .
k
, such that ri ,= 0 and Te[i][j] ,= 0;
8 rj Or(rj, RelProdSat(k 1, ri, Te[i][j]));
9 until r0, ..., rn
k
1 do not change;
10 r UniqueTableInsert(k, r0, ..., rn
k
1);
11 enter SATcode, p : r) in Cache;
12 return r;
mdd RelProdSat(level k, mdd q, mdd2 f) is
local mdd r, r0, ..., rn
k
1;
1 if q = 0 or f = 0 then return 0;
2 if Cache contains entry RELPRODSATcode, q, f : r) then return r;
3 for each i, j .
k
such that q[i] ,= 0 and f[i][j] ,= 0 do
4 rj Or(rj, RelProdSat(k 1, q[i], f[i][j]));
5 r Saturate(k, UniqueTableInsert(k, r0, ..., rn
k
1));
6 enter RELPRODSATcode, q, f : r) in Cache;
7 return r.
Fig. 11. Symbolic breadth-rst, chaining, and Saturation state-space generation.
state spaces A
k
is not known prior to generating the state space; rather, the local
state spaces are built on-the-y alongside the (global) reachable state space
during the symbolic iterations [11, 16].
4.2 Symbolic CTL model checking
Moving now to symbolic CTL model checking, we need MDD-based algorithms
for the EX, EU, and EG operators. The rst requires no xpoint computation,
as it can be computed in one step:
A
EXp
= T
1
(T)
The set of states satisfying EpUq can instead be characterized as the smallest
solution of the xpoint equation
A Q (T T
1
(A)),
while the set of states satisfying EGp can be characterized as the largest solution
of the xpoint equation
A T T
1
(A).
Fig. 12 shows the pseudocode for a breadth-rst-style symbolic implemen-
tation of these three operators. Again, all sets and relations are encoded using
L-level and 2L-level MDDs, respectively. Chaining and Saturation versions of the
symbolic EU algorithm are possible when T is disjunctively partitioned. These
are usually much more ecient in terms of both memory and time [15].
4.3 Symbolic Markov analysis
Approaches that exploit the structured representation of the transition rate ma-
trix R of a CTMC have been in use for over two decades, based on Kronecker
algebra [18]. Formally, such approaches require R to be the submatrix corre-
sponding to the reachable states of a matrix
R R
|
b
X
b
X|
expressed as a sum of
Kronecker products:
R =
R[A
reach
, A
reach
] where
R =
eE
R
e
and
R
e
=
Lk1
R
e,k
.
R
e
is the transition rate matrix due to event e and can be decomposed as
the Kronecker product of L matrices R
e,k
R
|
b
X
b
X|
, each expressing the con-
tribution of the local state x
k
to the rate of event e [20, 30]. Recall that the
Kronecker product of two matrices A R
nrnc
and B R
mrmc
is a matrix
AB R
nrmrncmc
satisfying
i
a
0, ..., n
r
1, j
a
0, ..., n
c
1, i
b
0, ..., m
r
1, j
b
0, ..., m
c
1,
(AB)[i
a
m
r
+ i
b
, j
a
m
c
+ j
b
] = A[i
a
, j
a
] B[i
b
, j
b
].
The algorithms for the numerical solution of CTMCs shown in Fig. 10 essen-
tially perform a sequence of vector-matrix multiplications at their core. Thus,
the ecient computation of y x A or y y+x A, when A, or, rather,
A, is
encoded as a Kronecker product
Lk1
A
k
, has been studied at length [6]. The
mdd SymbolicBuildEX(mdd 1, mdd2 T
1
) is
local mdd .;
1 . RelProd(1, T
1
); perform one backward step in the transition relation
2 return .;
mdd SymbolicBuildEU(mdd 1, mdd Q, mdd2 T
1
) is
local mdd O, ., }, :;
1 . Q; initialize the currently known result with the states satisfying q
2 repeat
3 O .; save the old set of states
4 } RelProd(., T
1
); perform one backward step in the transition relation
5 : And(}, 1); perform set intersection to discard states not satisfying p
6 . Or(:, .); add to the currently known result
7 until O = .;
8 return .;
mdd SymbolicBuildEG(mdd 1, mdd2 T
1
) is
local mdd O, ., };
1 . 1; initialize . with the states satisfying p
2 repeat
3 O .; save the old set of states
4 } RelProd(., T
1
); perform one backward step in the transition relation
5 . And(., });
6 until O = .;
7 return .;
Fig. 12. Symbolic CTL model checking algorithms for the EX, EU, and EG operators.
well-known shue algorithm [18, 20] or other algorithms presented in [6] can be
employed to compute this product, but their eciency stems from two properties
common to all algorithms for decision diagram manipulation. First, the object
being encoded (A, in this case) can be structured into L levels (the matrices
A
k
, in this case). Second, some kind of caching is used to avoid recomputing the
result of operations already performed.
One disadvantage of earlier Kronecker-based approaches for the steady-state
or transient solution of a CTMC was that the probability vector R
|X
reach
|
was actually stored using a possibly much larger probability vector R
|
b
X|
,
to simplify state indexing. Correctness was achieved by ensuring that [i] = 0
for all i
A A
reach
, but the additional computational and, especially, memory
overhead was substantial. Decision diagrams helped rst by providing an e-
cient encoding for state indices. Given the MDD for A
reach
A, an EV
+
MDD
encoding the lexicographic state indexing function :
A N can be
easily built. Its denition is such that (i) is the number of reachable states pre-
ceding i in lexicographic order, if i A
reach
, and is otherwise. This EV
+
MDD
has exactly the same number of nodes and edges as the MDD encoding A
reach
.
For example, Fig. 13 shows a reachable state space A
reach
, the MDD encoding
it, and the EV
+
MDD encoding . To compute the index of a state, sum the
.
reach
=
8
<
:
0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3
2 0 0 1 1 2 0 0 1 1 2 0 1 2 2 2 2 2 2
, , , , , , , , , , , , , , , , , ,
1 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 1 2
9
=
;
.4 = |0, 1, 2, 3
.3 = |0, 1, 2
.2 = |0, 1
.1 = |0, 1, 2
1
1 2 3
0 1 2 0 1 2
0 1 1 0 1
0 1 2 0
0
2
1 2 3
0 1 2 0 1 2
0 1 1 0 1
0 1 2 0
0
2
0 1 6 11
0 1 2 0 2 4
0 1 3
0 3 0 1
0
0
0
0