By lncs04
By lncs04
By lncs04
Uppsala University
Email: {johanb,yi}@it.uu.se
Abstract. This chapter is to provide a tutorial and pointers to results and related
work on timed automata with a focus on semantical and algorithmic aspects of
verification tools. We present the concrete and abstract semantics of timed au-
tomata (based on transition rules, regions and zones), decision problems, and
algorithms for verification. A detailed description on DBM (Difference Bound
Matrices) is included, which is the central data structure behind several verifica-
tion tools for timed systems. As an example, we give a brief introduction to the
tool U PPAAL.
1 Introduction
Timed automata is a theory for modeling and verification of real time systems. Exam-
ples of other formalisms with the same purpose, are timed Petri Nets, timed process
algebras, and real time logics [BD91,RR88,Yi91,NS94,AH94,Cha99]. Following the
work of Alur and Dill [AD90,AD94], several model checkers have been developed with
timed automata being the core of their input languages e.g. [Yov97,LPY97]. It is fair
to say that they have been the driving force for the application and development of the
theory. The goal of this chapter is to provide a tutorial on timed automata with a focus
on the semantics and algorithms based on which these tools are developed.
In the original theory of timed automata [AD90,AD94], a timed automaton is a finite-
state Büchi automaton extended with a set of real-valued variables modeling clocks.
Constraints on the clock variables are used to restrict the behavior of an automaton, and
Büchi accepting conditions are used to enforce progress properties. A simplified ver-
sion, namely Timed Safety Automata is introduced in [HNSY94] to specify progress
properties using local invariant conditions. Due to its simplicity, Timed Safety Au-
tomata has been adopted in several verification tools for timed automata e.g. U PPAAL
[LPY97] and Kronos [Yov97]. In this presentation, we shall focus on Timed Safety Au-
tomata, and following the literature, refer them as Timed Automata or simply automata
when it is understood from the context.
The rest of the chapter is organized as follows: In the next section, we describe the syn-
tax and operational semantics of timed automata. The section also addresses decision
problems relevant to automatic verification. In the literature, the decidability and unde-
cidability of such problems are often considered to be the fundamental properties of a
computation model. Section 3 presents the abstract version of the operational semantics
based on regions and zones. Section 4 describes the data structure DBM (Difference
Bound Matrices) for the efficient representation and manipulation of zones, and opera-
tions on zones, needed for symbolic verification. Section 5 gives a brief introduction to
the verification tool U PPAAL. Finally, as an appendix, we list the pseudo-code for the
presented DBM algorithms.
2 Timed Automata
The first example Fig. 1(a) is an example timed automaton. The timing behavior of
the automaton is controlled by two clocks and . The clock is used to control the
self-loop in the location loop. The single transition of the loop may occur when .
Clock controls the execution of the entire automaton. The automaton may leave start
at any time point when is in the interval between 10 and 20; it can go from loop to
end when is between 40 and 50, etc.
start start
y<=20
10<=y
10<=y<=20 enter
enter x:=0, y:=0
x:=0, y:=0
x==1 loop x==1 loop
10<=y<=20 10<=y
work work y<=50
y:=0 y:=0
x:=0 x:=0
40<=y
40<=y<=50 leave
leave y:=0
y:=0 end
end y<=20
(a) (b)
Timed Safety Automata A more intuitive notion of progress is introduced in timed safety
automata [HNSY94]. Instead of accepting conditions, in timed safety automata, loca-
tions may be put local timing constraints called location invariants. An automaton may
remain in a location as long as the clocks values satisfy the invariant condition of the
location. For example, consider the timed safety automaton in Fig. 1(b), which corre-
sponds to the Büchi automaton in Fig. 1(a) with end marked as an accepting location.
The invariant specifies a local condition that start and end must be left when is at
most 20 and loop must be left when is at most 50. This gives a local view of the
timing behavior of the automaton in each location.
In the rest of this chapter, we shall focus on timed safety automata and refer such au-
tomata as Timed Automata or simply automata without confusion.
Assume a finite set of real-valued variables ranged over by etc.standing for clocks
and a finite alphabet ranged over by etc.standing for actions.
– if and
The operational semantics is the basis for verification of timed automata. In the follow-
ing, we formalize decision problems in timed automata based on transition systems.
Language Inclusion A timed action is a pair , where is an action taken by
an automaton after time units since has been started. The absolute time
is called a time-stamp of the action . A timed trace is a (possibly infinite) sequence of
timed actions where for all .
Definition 3 A run of a timed automaton with initial state
over a timed trace is a sequence of transitions:
Reachability Analysis Perhaps, the most useful question to ask about a timed automa-
ton is the reachability of a given final state or a set of final states. Such final states may
be used to characterize safety properties of a system.
Definition 5 We shall write if for some .
For an automaton with initial state , , is reachable iff .
More generally, given a constraint we say that the configuration is
reachable if is reachable for some satisfying .
The notion of reachability is more expressive than it appears to be. We may specify
invariant properties using the negation of reachability properties, and bounded liveness
properties using clock constraints in combination with local properties on locations
[LPY01] (see Section 5 for an example).
The reachability problem is decidable. In fact, one of the major advances in verification
of timed systems is the symbolic technique [Dil89,YL93,HNSY94,YPD94,LPY95], de-
veloped in connection with verification tools. It adopts the idea from symbolic model
checking for untimed systems, which uses boolean formulas to represent sets of states
and operations on formulas to represent sets of state transitions. It is proven that the
infinite state-space of timed automata can be finitely partitioned into symbolic states
using clock constraints known as zones [Bel57,Dil89]. A detailed description on this is
given in Section 3 and 4.
As clocks are real-valued, the transition system of a timed automaton is infinite, which
is not an adequate model for automated verification.
The foundation for the decidability results in timed automata is based on the notion of
region equivalence over clock assignments [AD94,ACD93].
Definition 6 (Region Equivalence) Let be a function, called a clock ceiling, map-
ping each clock to a natural number (i.e. the ceiling of ). For a real
number , let denote the fractional part of , and denote its integer part. Two
clock assignments are region-equivalent, denoted , iff
1. for all , either or both and ,
2. for all , if then iff and
3. for all if and then iff
Note that the region equivalence is indexed with a clock ceiling . When the clock ceil-
ing is given by the maximal clock constants of a timed automaton under consideration,
we shall omit the index and write instead. An equivalence class induced by is
called a region, where denotes the set of clock assignments region-equivalent to .
The basis for a finite partitioning of the state-space of a timed automaton is the follow-
ing facts. First, for a fixed number of clocks each of which has a maximal constant, the
number of regions is finite. Second, implies and are bisimilar w.r.t.
the untimed bisimulation for any locaton of a timed automaton. We use the equivalence
classes induced by the untimed bisimulation as symbolic (or abstract) states to construct
a finite-state model called the region graph or region automaton of the original timed
automaton. The transition relation between symbolic states is defined as follows:
off
off
off
x>10
press?
press? dim
x:=0
dim press?
bright dim
x<=10
press? off bright
bright
bright
A zone is a clock constraint. Strictly speaking, a zone is the solution set of a clock
constraint, that is the maximal set of clock assignments satisfying the constraint. It
is well-known that such sets can be efficiently represented and stored in memory as
DBMs (Difference Bound Matrices) [Bel57]. For a clock constraint , let denote
the maximal set of clock assignments satisfying . In the following, to save notation,
we shall use to stand for without confusion. Then denotes the set of zones.
A symbolic state of a timed automaton is a pair representing a set of states of the
automaton, where is a location and is a zone. A symbolic transition describes all
the possible concrete transitions from the set of states.
Definition 7 Let be a zone and a set of clocks. We define
and . Let denote the symbolic transition relation
over symbolic states defined by the following rules:
–
– if
We shall study these operations in details in Section 4 where is written as up
and as reset . It will be shown that the set of zones is closed un-
der these operations, in the sense that the result of the operations is also a zone. Another
important property of zones is that a zone has a canonical form. A zone is closed un-
der entailment or just closed for short, if no constraint in can be strengthened without
reducing the solution set. The canonicity of zones means that for each zone ,
there is a unique zone such that and have exactly the same solution set
and is closed under entailment. Section 4 describes how to compute and represent
the canonical form of a zone. It is the key structure for the efficient implementation of
state-space exploration using the symbolic semantics.
The symbolic semantics corresponds closely to the operational semantics in the sense
that implies for all , for some . More
generally, the symbolic semantics is a correct and full characterization of the operational
semantics given in Definition 2.
Theorem 1 Assume a timed automaton with initial state .
1. (soundness) implies for all .
2. (Completeness) implies for some
such that
The soundness means that if the initial symbolic state may lead to a set of
final states according to , all the final states should be reachable according to
the concrete operational semantics. The completeness means that if a state is reachable
according to the concrete operational semantics, it should be possible to conclude this
using the symbolic transition relation.
Unfortunately, the relation is infinite, and thus the zone-graph of a timed automaton
may be infinite, which can be a problem to guarantee termination in a verification pro-
cedure. As an example, consider the automaton in Fig. 4. The value of clock drifts
away unboundedly, inducing an infinite zone-graph.
The solution is to transform (i.e. normalize) zones that may contain arbitrarily large
constants to their representatives in a class of zones whose constants are bounded by
fixed constants e.g. the maximal clock constants appearing in the automaton, using an
abstraction technique similar to the widening operation [Hal93]. The intuition is that
once the value of a clock is larger than the maximal constant in the automaton, it is no
longer important to know the precise value of the clock, but only the fact that it is above
the constant.
In the original theory of timed automata [AD94], difference constraints are not allowed
to appear in the guards. Such automata (whose guards contain only atomic constraints in
start
start
loop
x:=0,
y:=0
loop
loop x==10
x<=10 x:=0 loop
y>=20 loop
x:=0,
y:=0 .
.
end . end
the form ) are known as diagonal-free automata in the literature in [BDGP98]. For
diagonal-free automata, a well-studied zone-normalization procedure is the so-called
-normalization operation on zones [Rok93,Pet99]. It is implemented in several verifi-
cation tools for timed automata e.g. U PPAAL to guarantee termination.
Definition 8 ( -Normalization) Let be a zone and a clock ceiling. The semantics
of the -normalization operation on zones is defined as follows:
norm
loop
loop
loop
loop
end
For the class of diagonal-free timed automata is sound, complete and finite in the
following sense.
Theorem 2 Assume a timed automaton with initial state , whose maximal clock
constants are bounded by a clock ceiling . Assume that the automaton has no guards
containing difference constraints in the form of .
Unfortunately the soundness will not hold for timed automata whose guards contain
difference constraints. We demonstrate this by an example. Consider the automaton
shown in Fig. 6. The final location of the automaton is not reachable according to the
operational semantics. This is because in location , the clock zone is ( and
) and the guard on the outgoing edge is which is equivalent
to . Obviously the zone at can never enable the
guard, and thus the last transition will never be possible. However, because the maximal
constants for clock is (and for ), the zone in location : will
be normalized to by the maximal constant for , which enables
the guard and thus the symbolic reachability analysis based on
the above normalization algorithm would incorrectly conclude that the last location is
reachable.
The zones in canonical forms, generated in exploring the state-space of the counter
example are given in Fig. 7. The implicit constraints that all clocks are non-negative
are not shown.
S0 S1 y>2 S2 S3
z:=0 y:=0
x<z+1, z<y+1
Note that at and , the normalized and un-normalized zones are identical. The
problem is at where the intersection of the guard (on the only outgoing edge) with
the un-normalized zone is empty and non-empty with the normalized zone.
Our definition of timed automata (Definition 1) allows any clock constraint to appear in
a guard, which may be a difference constraint in the form of . Such automata
are indeed needed in many applications e.g. to model scheduling problems [FPY02].
It is shown that an automaton containing difference constraints can be transformed to
an equivalent diagonal-free automaton [BDGP98]. However, the transformation is not
applicable since it is based on the region construction. Besides, it is impractical to im-
plement such an approach in a tool. Since the transformation modifies the model before
analysis, it is difficult to trace debugging information provided by the tool back to the
original model.
In [Ben02,BY03], a refined normalization algorithm is presented for automata that may
have guards containing difference constraints. The algorithm transforms DBMs accord-
ing to not only the maximal constants of clocks but also difference constraints appearing
in the automaton under consideration. Note that the difference constraints correspond to
the diagonal lines which split the entire space of clock assignments. A finer partitioning
is needed.
We present the semantical characterization for the refined normalization operation based
on a refined version of the region equivalence from Definition 6.
Definition 10 (Normalization Using Difference Constraints) Let stand for a finite
set of difference constraints of the form for , and
, and for a clock ceiling. Two clock assignments are equivalent, denoted
if the following holds:
– and
– for all , iff .
The semantics of the refined -normalization operation on zones is defined as follows:
norm
Note that the refined region equivalence is indexed by both a clock ceiling and a finite
set of difference constraints , and so is the normalization operation.
Since the number of regions induced by is finite and there are only finitely many
constraints in , induces finitely many equivalence classes. Thus for any given
zone , norm is well-defined in the sense that it contains only a finite set of
equivalence classes though the set may not be a convex zone, and it can be computed
effectively according to the refined regions. In general, norm is a non-convex
zone, which can be implemented as the union of a finite list of convex zones. The next
section will show how to compute this efficiently.
The refined zone-normalization gives rise to a finite characterization for .
Definition 11 norm if .
The following states the correctness and finiteness of .
Theorem 3 Assume a timed automaton with initial state , whose maximal clock
constants are bounded by a clock ceiling , and whose guards contain only a finite set
of difference constraints denoted .
1. (soundness) implies for all
such that for all .
2. (Completeness) with for all implies
for some such that
3. (Finiteness) The transition relation is finite.
3.4 Symbolic Reachability Analysis
Model-checking concerns two types of properties liveness and safety. The essential
algorithm of checking liveness properties is loop detection, which is computationally
expensive. The main effort on verification of timed systems has been put on safety
properties that can be checked using reachability analysis by traversing the state-space
of timed automata.
Reachability analysis can be used to check properties on states. It consists of two basic
steps, computing the state-space of an automaton under consideration, and searching for
states that satisfy or contradict given properties. The first step can either be performed
prior to the search, or done on-the-fly during the search process. Computing the state-
space on-the-fly has an obvious advantage over pre-computing, in that only the part of
the state-space needed to prove the property is generated. It should be noted though, that
even on-the-fly methods will generate the entire state-space to prove certain properties,
e.g. invariant properties.
Several model-checkers for timed systems are designed and optimized for reachability
analysis based on the symbolic semantics and the zone-representation (see Section 4).
As an example, we present the core of the verification engine of U PPAAL (see Algo-
rithm 1).
Assume a timed automaton with a set of initial states and a set of final states (e.g.
the bad states) characterized as and respectively. Assume that is the
clock ceiling defined by the maximal constants appearing in and , and denotes
the set of difference constraints appearing in and . Algorithm 1 can be used to
check if the initial states may evolve to any state whose location is and whose clock
assignment satisfies . It computes the normalized zone-graph of the automaton on-
the-fly, in search for symbolic states containing location and zones intersecting with
.
The algorithm computes the transitive closure of step by step, and at each step,
checks if the reached zones intersect with . From Theorem 2, it follows that the algo-
rithm will return with a correct answer. It is also guaranteed to terminate because
is finite. As mentioned earlier, for a given timed automaton with a fixed set of clocks
whose maximal constants are bounded by a clock ceiling , and a fixed set of diago-
nal constraints contained in the guards, the number of all possible normalized zones is
bounded because a normalized zone can not contain arbitrarily large or arbitrarily small
constants. In fact the smallest possible zones are the refined regions. Thus the whole
state-space of a timed automaton can only be partitioned into finitely many symbolic
states and the worst case is the size of the region graph of the automaton, induced by
the refined region equivalence. Therefore, the algorithm is working on a finite structure
and it will terminate.
Algorithm 1 also highlights some of the issues in developing a model-checker for timed
automata. Firstly, the representation and manipulation of states, primarily zones, is cru-
cial to the performance of a model-checker. Note that in addition to the operations to
compute the successors of a zone according to , the algorithm uses two more op-
erations to check the emptiness of a zone as well as the inclusion between two zones.
Thus, designing efficient algorithms and data-structures for zones is a major issue in
developing a verification tool for timed automata, which is addressed in Section 4. Sec-
ondly, PASSED holds all encountered states and its size puts a limit on the size of sys-
tems we can verify. This raises the research challenges e.g. state compression [Ben02],
state-space reduction [BJLY98] and approximate techniques [Bal96].
The preceding section presents the key elements needed in symbolic reachability anal-
ysis. Recall that the operations on zones are all defined in terms of sets of clock assign-
ments. It is not clear how to compute the result of such an operation. In this section, we
describe how to represent zones, compute the operations and check properties on zones.
Pseudo code for the operations is given in the appendix.
Recall that a clock constraint over is a conjunction of atomic constraints of the form
and where , and . A zone
denoted by a clock constraint is the maximal set of clock assignments satisfying .
The most important property of zones is that they can can be represented as matrices
i.e. DBMs (Difference Bound Matrices) [Bel57,Dil89], which have a canonical repre-
sentation. In the following, we describe the basic structure and properties of DBMs.
To have a unified form for clock constraints we introduce a reference clock with the
constant value 0. Let . Then any zone can be rewritten as a
conjunction of constraints of the form for , and .
Naturally, if the rewritten zone has two constraints on the same pair of variables only the
intersection of the two is significant. Thus, a zone can be represented using at most
atomic constraints of the form such that each pair of clocks is mentioned
only once. We can then store zones using matrices where each element in
the matrix corresponds to an atomic constraint. Since each element in such a matrix
represents a bound on the difference between two clocks, they are named Difference
Bound Matrices (DBMs). In the following presentation, we use to denote element
in the DBM representing the zone .
To construct the DBM representation for a zone , we start by numbering all clocks
in as and the index for is 0. Let each clock be denoted by one row in the
matrix. The row is used for storing lower bounds on the difference between the clock
and all other clocks, and thus the corresponding column is used for upper bounds. The
elements in the matrix are then computed in three steps.
– For each constraint of , let .
– For each clock difference that is unbounded in , let . Where
is a special value denoting that no bound is present.
– Finally add the implicit constraints that all clocks are positive, i.e. , and
that the difference between a clock and itself is always 0, i.e. .
As an example, consider the zone
. To construct the matrix representation of , we number the clocks
in the order . The resulting matrix representation is shown below:
Canonical DBMs Usually there are an infinite number of zones sharing the same solu-
tion set. However, for each family of zones with the same solution set there is a unique
constraint where no atomic constraint can be strengthened without losing solutions.
To compute the canonical form of a given zone we need to derive the tightest constraint
on each clock difference. To solve this problem, we use a graph-interpretation of zones.
A zone may be transformed to a weighted graph where the clocks in are nodes
and the atomic constraints are edges labeled with bounds. A constraint in the form of
will be converted to an edge from node to node labeled with ,
namely the distance from to is bounded by .
(a) (b)
Fig. 8. Graph interpretation of the example zone and its closed form
Minimal Constraint Systems A zone may contain redundant constraints. For example,
a zone contains constraints and . The constraint
is obviously redundant because it may be derived from the first two. It is desirable to
remove such constraints to store only the minimal number of constraints. Consider, for
instance, the zone . This
is a zone in a minimal form containing only five constraints. The closed form of this
zone contains more than 12 constraints. It is known, e.g. from [LLPY97], that for each
zone there is a minimal constraint system with the same solution set. By computing this
minimal form for all zones and storing them in memory using a sparse representation
we might reduce the memory consumption for state-space exploration. This problem
has been thoroughly investigated in [LLPY97,Pet99,Lar00].
In graphs without zero cycles we can remove all redundant edges without affecting the
shortest path closure [LLPY97]. Further, if the input graph is in shortest path form (as
for closed DBMs) all redundant edges can be located by considering alternative paths
of length two.
As an example, consider Fig. 9. The figure shows the shortest path closure for a zero-
cycle free graph (a) and its minimal form (b). In the graph we find that is
made redundant by the path and can thus be removed. Further, the edge
is redundant due to . Note that we consider edges marked
as redundant when searching for new redundant edges. The reason is that we let the
redundant edges represent the path making them redundant, thus allowing all redundant
edges to be located using only alternative paths of length two. This procedure is repeated
until no more redundant edges can be found.
5 5
15
7
12
8
6
2
13
7
13
1 1
(a) (b)
This gives the procedure for removing redundant edges presented in Algo-
rithm 3. The algorithm can be directly applied to zero-cycle free DBMs to compute
the minimal number of constraints needed to represent a given zone.
However, this algorithm will not work if there are zero-cycles in the graph. The reason
is that the set of redundant edges in a graph with zero-cycles is not unique. As an
example, consider the graph in Fig. 10(a). Applying the above reasoning on this graph
would remove based on the path . It would also remove the
edge based on the path . But if both these edges are removed
it is no longer possible to construct paths leading into . In this example there is a
dependence between the edges and such that only one of them can
be considered redundant.
-2 -2
2 2
3
3
3
5
(a) (b)
The solution to this problem is to partition the nodes according to zero-cycles and build
a super-graph where each node is a partition. The graph from Fig. 10(a) has two parti-
tions, one containing and and the other containing . To compute the edges in
the super-graph we pick one representative for each partition and let the edges between
the partitions inherit the weights from edges between the representatives. In our exam-
ple, we choose and as representatives for their equivalence classes. The edges in
the graph are then and . The super-graph is clearly
zero-cycle free and can be reduced using Algorithm 3. This small graph can not be
reduced further. The relation between the nodes within a partition is uniquely defined
by the zero-cycle and all other edges may be removed. In our example all edges within
each equivalence class are part of the zero-cycle and thus none of them can be removed.
Finally the reduced super-graph is connected to the reduced partitions. In our example
we end up with the graph in Fig. 10(b). Pseudo-code for the reduction-procedure is
shown in Algorithm 4.
Now we have an algorithm for computing the minimal number of edges to represent
a given shortest path closure that can be used to compute the minimal number of con-
straints needed to represent a given zone.
This subsection presents all the basic operations on DBMs except the ones for zone-
normalization, needed in symbolic state space exploration of timed automata, both for
forwards and backwards analysis. The two operations for zone-normalization are pre-
sented in the next subsection.
First note that even if a verification tool only explores the state space in one direction
all operations are still useful for other purposes, e.g. for generating diagnostic traces.
The operations are illustrated graphically in Fig. 11.
To simplify the presentation we assume that the input zones are consistent and in canon-
ical form. The basic operations on DBMs can be divided into two classes:
up( ) down( )
Fig. 11. DBM operations applied to the same zone where for norm , is defined by
and
1. Property-Checking: This class includes operations to check the consistency of a
DBM, the inclusion between zones, and whether a zone satisfies a given atomic
constraint.
Property-Checking
For a zone to be inconsistent there must be at least one pair of clocks where the up-
per bound on their difference is smaller than the lower bound. For DBMs this can be
checked by searching for negative cycles in the graph interpretation. However, the most
efficient way to implement a consistency check is to detect when an upper bound is set
to lower value than the corresponding lower bound and mark the zone as inconsistent by
setting to a negative value. For a zone in canonical form this test can be performed
locally. To check if a zone is inconsistent it will then be enough to check whether
is negative.
Transformations
up( ) The up operation computes the strongest postcondition of a zone with respect
to delay, i.e. up( ) contains the clock assignments that can be reached from by
delay. Formally, this operation is defined as up .
Algorithmically, up is computed by removing the upper bounds on all individual clocks
(In a DBM all elements are set to ). This is the same as saying that any clock
assignment in a given zone may delay an arbitrary amount of time. The property that
all clocks proceed at the same speed is ensured by the fact that constraints on the dif-
ferences between clocks are not altered by the operation.
This operation preserves the canonical form, i.e. applying up to a canonical DBM will
result in a new canonical DBM. The up operation is also presented in Algorithm 6.
(a) (b)
To compute the lower bound for a clock , start by assuming that all other clocks have
the value 0. Then examine all difference constraints and compute a new lower
bound for under this assumption. The new bound on will be the minimum bound
on found in the DBM. Pseudo-code for down is presented in Algorithm 7.
free( ) The free operation removes all constraints on a given clock, i.e. the
clock may take any positive value. Formally this is expressed as free
. In state-space exploration this operation is used in combination
with conjunction, to implement reset operations on clocks. It can be used in both for-
wards and backwards exploration, but since forwards exploration allows other more
efficient implementations of reset, free is only used when exploring the state-space
backwards.
A simple algorithm for this operation is to remove all bounds on in the DBM and
set . However, the result may not be on canonical form. To obtain an
algorithm preserving the canonical form, we change how new difference constraints
regarding are derived. We note that the constraint can be combined with
constraints of the form to compute new bounds for . For instance,
if we can derive that . To obtain a DBM on canonical form we
derive bounds for based on instead of setting .In Algorithm 9 this
is presented as pseudo code.
4.3 Zone-Normalization
The operations for zone-normalization are to transform zones which may contain arbi-
trarily large constants to zones containing only bounded constants in order to obtain a
finite zone-graph.
norm For a timed automaton and a safety property to be checked, that contain
no difference constraints, the -normalization norm is needed, and it can be com-
puted based on the canonical form of (see Section 3). It is to remove all upper bounds
higher than the maximal constants and lower all lower bounds higher than the maximal
constants down to the maximal constants. The result of norm is illustrated graph-
ically in Fig. 11.
In the canonical DBM representation of a zone, the operation consists of two steps:
first, remove all bounds such that and second, set all
bounds such that to . Pseudo-code for
-normalization is given in Algorithm 13 where denotes .
The -normalization will not preserve the canonical form of a DBM, and the best way
to put the result back on canonical form is to use Algorithm 2.
Zone (a) above does not contain any clock assignments satisfying and thus it will not
be split further. Zone (b) however needs to be split into two parts satisfying and .
This gives us the following zones to normalize by the core normalization procedure.
(a) and (b) and (c) and
The sets of difference constraints not satisfied by the zones (a), (b) and (c) shown above
are: respectively. We
apply -normalization to each of them, giving:
Since the -normalized zones (A), (B) and (C) shown above do not enable any con-
straint in , we need not to subtract the corresponding difference constraints from
the zones. Finally, we note that, as the un-normalized zones (a), (b) and (c), none of the
normalized zones (A), (B) and (C) intersects with ; the transition from to
is not enabled by the normalization procedure.
This section describes a number of techniques for storing zones in computer memory.
The section starts by describing how to map DBM elements on machine words. It con-
tinues by discussing how to place two-dimensional DBMs in linear memory and ends
by describing how to store zones using a sparse representation.
Storing DBM Elements To store a DBM element in memory we need to keep track
of the integer limit and whether it is strict or not. The range of the integer limit is
typically much lower than the maximum value of a machine word and the strictness can
be stored using just one bit. Thus, it is possible to store both the limit and the strictness in
different parts of the same machine word. Since comparing and adding DBM elements
are frequently used operations it is crucial for the performance of a DBM package that
they can be efficiently implemented for the chosen encoding. Fortunately, it is possible
to construct an encoding of bounds in machine words, where checking if is less than
can be performed by checking if the encoded is smaller than the encoded .
The encoding we propose is to use the least significant bit (LSB) of the machine word
to store whether the bound is strict or not. Since strict bounds are smaller than non-
strict we let a set (1) bit denote that the bound is non-strict while an unset (0) bit denote
that the bound is strict. The rest of the bits in the machine word are used to store the
integer bound. To encode we use the largest positive number that fit in a machine
word (denoted MAX_INT).
For good performance we also need an efficient implementation of addition of bounds.
For the proposed encoding Algorithm 17 adds two encoded bounds and . The sym-
bols and in the algorithm are used to denote bitwise-and and bitwise-or, respectively.
if
otherwise
This adds at least two instructions (one comparison and one conditional jump) to the
transformation. This may not seem such a huge overhead, but it is clearly noticeable.
The cache performance is also worse when using this layout than when storing the
DBMs row-wise. This layout is illustrated in Fig. 13(b).
The conclusion is that unless the tool under construction supports adding and removing
clocks dynamically the row-wise mapping should be used. On the other hand, if the tool
supports local clocks the layered mapping may be preferable since no reordering of the
DBM is needed when entering or leaving a clock scope.
Storing Sparse Zones In most verification tools, the majority of the zones are kept
in the set of states already visited during verification. They are used as a reference to
ensure termination by preventing states from being explored more than once. For the
(a) Row wise (b) Layered
states in this set we may benefit from storing only the minimal number of constraints
using a sparse representation.
A nice feature of the sparse representation is that checking whether a zone repre-
sented as a full DBM is included in a sparse zone may be implemented without
computing the full DBM for . It suffices to check for all constraints in that the
corresponding bound in is tighter. However, to check if we have to com-
pute the full DBM for .
5 U PPAAL
In the last decade, there have been a number of tools developed based on timed automata
to model and verify real time systems, notably Kronos [Yov97] and U PPAAL [LPY97].
As an example, we give a brief introduction to the U PPAAL tool (www.uppaal.com).
U PPAAL is a tool box for modeling, simulation and verification of timed automata,
based on the algorithms and data-structures presented in previous sections. The tool was
released for the first time in 1995, and since then it has been developed and maintained
in collaboration between Uppsala University and Aalborg University.
The core of the U PPAAL modeling language is networks of timed automata. In addition,
the language has been further extended with features to ease the modeling task and to
guide the verifier in state space exploration. The most important of these are shared
integer variables, urgent channels and committed locations.
Networks of Timed Automata A network of timed automata is the parallel compo-
sition of a set of timed automata , called processes, combined
into a single system by the CCS parallel composition operator with all external actions
hidden. Synchronous communication between the processes is by hand-shake synchro-
nization using input and output actions; asynchronous communication is by shared vari-
ables as described later. To model hand-shake synchronization, the action alphabet is
assumed to consist of symbols for input actions denoted , output actions denoted ,
and internal actions represented by the distinct symbol .
An example system composed of two timed automata is shown in Fig. 14. The network
models a time-dependent light-switch (to the left) and its user (to the right). The user
and the switch communicate using the label press. The user can press the switch (press!)
and the switch waits to be pressed (press?). The product automaton, i.e. the automaton
describing the combined system is shown in Fig. 15.
t press! study
off
y<5
x>10
press? press! press!
press?
x:=0 y:=0
idle
dim press?
x<=10
press!
press? y>10
y:=0
press!
bright relax
The semantics of networks is given as for single timed automata in terms of transition
systems. A state of a network is a pair where denotes a vector of current locations
of the network, one for each process, and is as usual a clock assignment remembering
the current values of the clocks in the system. A network may perform two types of
transitions, delay transitions and discrete transitions. The rule for delay transitions is
similar to the case of single timed automata where the invariant of a location vector
is the conjunction of the location invariants of the processes. There are two rules for
discrete transitions defining local actions where one of the processes makes a move on
its own, and synchronizing actions where two processes synchronize on a channel and
move simultaneously.
Let stand for the th element of a location vector and for the vector with
being substituted with . The transition rules are as follows:
– if and , where
– if ,
bright, study
off,idle dim,relax
x:=0, y:=0
x<=10,y>10
x<=10
dim,t x>10, y>10
x:=0, y:=0
y<5 x>10
x>10
x>10
1. , and , and
2. and .
Note that a network is a closed system which may not perform any external action. In
fact, the CCS hiding operator is embedded in the above rules.
Shared Integer Variables Clocks may be considered as typed variables with type
clock. In U PPAAL, one may also use integer variables and arrays of integers, each with
a bounded domain and an initial value. Predicates over the integer variables can be
used as guards on the edges of an automaton process and the integer variables may
be updated using resets on the edges. In the current version of U PPAAL, the syntax
related to integer variables resembles the standard C syntax. Both integer guards and
integer resets are standard C expressions with the restriction that guards can not have
side-effects.
The semantics of networks can be defined accordingly. The clock assignment in the
state configuration can be extended to store the values of integer variables in ad-
dition to clocks. Since delay does not affect the integer variables, the delay transitions
are the same as for networks without integer variables. The action transitions are ex-
tended in the natural way, i.e. for an action transition to be enabled the extended clock
assignment must also satisfy all integer guards on the corresponding edges and when a
transition is taken the assignment is updated according to the integer and clock resets.
There is a problem with variable updating in a synchronizing transition where one of the
processes participating in the transition updates a variable used by the other. In U PPAAL,
for a synchronization transition, the resets on the edge with an output-label is performed
before the resets on the edge with an input-label. This destroys the symmetry of input
and output actions. But it gives a natural and clear semantics for variable updating. The
transition rule for synchronization is modified accordingly:
– if there exist such that
1. , and , and
2. and
S0 x:=0 S1 x>=10 S2
u!
T0 y:=0 T1 y>=5 T2
u?
For this example, the problem can be solved by splitting the non-convex zone into two
convex ones. But in general, the splitting is a computationally expensive operation. In
U PPAAL, we decided to avoid such operations for the sake of efficiency. So only integer
guards are allowed on edges involving synchronizations on urgent channels.
Committed Locations To model atomic sequences of actions, e.g. atomic broadcast or
multicast, U PPAAL supports a notion of committed locations. A committed location is
a location where no delay is allowed. In a network, if any process is in a committed lo-
cation then only action transitions starting from such a committed location are allowed.
Thus, processes in committed locations may be interleaved only with processes in a
committed location.
Syntactically, each process in a network may have a subset of loca-
tions marked as committed locations. Let denote the set of locations in , that are
committed. For the same reason as in the case of urgent channels, as a syntactical re-
striction, no clock constraints but predicates over integer variables are allowed to appear
in a guard on an outgoing edge from a committed location.
The transition rules are given in the following, where denotes the transition relation
for a network with committed locations and denotes the transition relation for the
same network without considering the committed locations.
– if and
– if
1. , and
2. Either or
– if
1. , and
2. Either , or
The model checking engine of U PPAAL is designed to check a subset of TCTL formula
[ACD90] for networks of timed automata. The formulas should be one of the following
forms:
– A[] — Invariantly .
– E<> — Possibly .
– A<> — Always Eventually .
– E[] — Potentially Always .
– - -> — always leads to . This is the shorthand for A[] ( A<> .
where are local properties that can be checked locally on a state, i.e. boolean ex-
pressions over predicates on locations and integer variables, and clock constraints in
.
(a) A[] (b) E<>
The transition system of a network may be unfolded into an infinite tree containing
states and transitions. The semantics of the formulas are defined over such a tree. The
letters A and E are used to quantify over paths. A is used to denote that the given prop-
erty should hold for all paths of the tree while E denotes that there should be at least
one path of the tree where the property holds. The symbols [] and <> are used to quan-
tify over states within a path. [] denotes that all states on the path should satisfy the
property, while <> denotes that at least one state in the execution satisfies the property.
In Fig. 17 the four basic property types are illustrated using execution trees, where the
dashed arrows are used to denote repetitions in the trees. The states satisfying are
denoted by filled nodes and edges corresponding to the paths are highlighted using bold
arrows.
The two types of properties most commonly used in verification of timed systems are
E<> and A[] . They are dual in the sense that E<> is satisfied if and only if A[]
is not satisfied. This type of properties are often classified as safety properties, i.e. mean-
ing that the system is safe in the sense that a specified hazard can not occur. It is also
possible to transform so called bounded liveness properties, i.e. properties stating that
some desired state will be reached within a given time, into safety properties using ob-
server automata [ABL98] or by annotating the model [LPY98]. For example, to check
if an automaton will surely reach a location within 10 time units, we use one clock
(set to initially) and introduce a boolean variable (set to false initially). For each
incoming edge to in the automaton, set to true. Then if the automaton satisfies the
invariant property " ", it will surely reach within 10 time units provided that
the automaton contains no zeno loops which stop time to progress.
The other three types of properties are commonly classified as unbounded liveness prop-
erties, i.e. they are used to express and check for global progress. These properties are
not commonly used in U PPAAL case-studies. It seems to be the case that bounded live-
ness properties are more important for timed systems.
To provide a system that is both efficient, easy to use and portable, U PPAAL is split into
two components, a graphical user interface written in Java and a verification engine
written in C++. The engine and the GUI communicate using a protocol, allowing the
verification to be performed either on the local workstation or on a powerful server in a
network.
To implement the reachability analysis algorithm 1, the U PPAAL verification engine is
organized as a pipeline that incarnates the natural data flow in the algorithm. A sketch
of this pipeline is shown in Fig. 18. This architecture simplifies both activating and
deactivating optimizations at runtime by inserting and removing stages dynamically,
and introducing new optimizations and features in the tool by implementing new or
changing existing stages.
In addition to the zone-manipulation algorithms described in Section 4 and the pipeline
architecture, in U PPAAL a number of optimizations have been implemented:
– Minimal constraint systems [LLPY97] and CDDs [LPWY99,BLP 99], to reduce
memory consumption by removing redundant information in zones before storing
them.
– Selective storing of states in PASSED [LLPY97], where static analysis is used to
detect states that can be omitted safely from PASSED without losing termination.
– Compression [Ben01] and sharing [BDLY03,DBLY03] of state data, to reduce the
memory consumption of PASSED and WAIT.
– Active clock reduction [DY96], that use live-range analysis to determine when the
value of a clock is irrelevant. This does not only reduce the size of individual states
but also the perceived state-space.
– Supertrace [Hol91] and Hash Compaction [WL93,SD95] where already visited
states are stored only as hash signatures, and Convex-hull approximation [Bal96]
where convex hulls are used to approximate unions of zones, for reducing memory
consumption at a risk of inconclusive results.
Acknowledgements:
We would like to thank Pavel Krcal for pointing out an error in an early version of this
document.
end for
end for
end for
for to do
for to do
for to do
if then
Mark edge as redundant
end if
end for
end for
end for
Remove all edges marked as redundant.
Algorithm 4 Reduction of negative-cycle free graph with nodes
for to do
if Node is not in a partition then
for to do
if then
Node
end if
end for
end if
end for
Let be a graph without nodes.
for each do
Pick one representative Node
Add Node to
Connect Node to all nodes in using weights from .
end for
Reduce
for each do
Add one zero cycle containing all nodes in to
end for
Algorithm 5 relation( )
tt
tt
for to do
for to do
end for
end for
return
Algorithm 6 up( )
for to do
end for
Algorithm 7 down( )
for to do
for to do
if then
end if
end for
end for
Algorithm 8 and( )
if then
else if then
for to do
for to do
if then
end if
if then
end if
end for
end for
end if
Algorithm 9 free( )
for to do
if then
end if
end for
Algorithm 10 reset(
for to do
end for
Algorithm 11 copy( )
for to do
if then
end if
end for
Algorithm 12 shift( )
for to do
if then
end if
end for
Algorithm 13 norm )
for to do
for to do
if and then
end if
end for
end for
close( )
Algorithm 14 Core normalization: Core-Norm
for all do
if then
end if
if then
end if
end for
norm
for all do
end for
return
for all do
for all do
if and then
else
end if
end for
end for
return