The Algorithmic Analysis of Hybrid Systems
R.Alur y
C.Courcoub etis z
N. Halbwachs x
T.A.Henzinger {
P.-H.Ho x
X. Nicollin z
A. Olivero z
J. Sifakis z
S.Yovine z
Abstract
We present a general framework for the formal specication and algorithmic analysis of hybrid systems. A hybrid system consists of a discrete program with an analog environment. We model hybrid systems as nite automata equipped with variables that evolve continuously with time according to dynamical laws. For verication purposes, we restrict ourselves to linear hybrid systems, where all variables follow piecewise-linear trajectories. We provide decidability and undecidability results for classes of linear hybrid systems, and we show that standard program- analysis techniques can be adapted to linear hybrid systems. In particular, we consider symbolic model-checking and minimization procedures that are based on the reachability analysis of an innite state space. The procedures iteratively compute state sets that are denable as unions of convex polyhedra in multidimensional real space. We also present approximation techniques for dealing with systems for which the iterative procedures do not converge.
A preliminary version of this paper appeared in theProceedings of the 11th International Conference on Analysis and Optimization of Discrete Event Systems, Lecture Notes in Control and Information Sciences 199, Springer-Verlag, 1994, pp. 331{351, and an extended version appeared in Theoretical Computer Science 138, 1995, pp. 3{34.
yAT&T Bell Laboratories, Murray Hill, NJ, U.S.A.
zUniversity of Crete and ICS, FORTH, Heraklion, Greece. Partially supported by Esprit-BRA 6021 REACT-P.
xVERIMAG-SPECTRE, Grenoble, France. VERIMAG is a joint laboratory of CNRS, INPG, UJF, and VERILOG S.A., associated with the institute IMAG. SPECTRE is an INRIA project. Partially supported by Esprit-BRA 6021 REACT-P.
{Computer Science Department, Cornell University, Ithaca, NY, U.S.A. Supported in part by the National Science
1 Introduction
A hybrid system consists of a discrete program with an analog environment. We assume that a run of a hybrid system is a sequence of steps. Within each step the system state evolves continuously according to a dynamical law until a transition occurs. Transitions are instantaneous state changes that separate continuous state evolutions.
We model a hybrid system as a nite automaton that is equipped with a set of variables. The control locations of the automaton are labeled with evolution laws. At a location the values of the variables change continuously with time according to the associated law. The transitions of the automaton are labeled with guarded sets of assignments. A transition is enabled when the associated guard is true, and its execution modies the values of the variables according to the assignments. Each location is also labeled with an invariant condition that must hold when the control resides at the location. This model for hybrid systems is inspired by the phase transition systems of [MMP92, NSY93], and can be viewed as a generalization of timed safety automata[AD94, HNSY94].
The purpose of this paper is to demonstrate that standard program-analysis techniques can be adapted to hybrid systems. For verication purposes we restrict ourselves to linear hybrid systems. In a linear hybrid system, for each variable the rate of change is constant|though this constant may vary from location to location|and the terms involved in the invariants, guards, and assignments are required to be linear. An interesting special case of a linear hybrid system is a timed automaton [AD94]. In a timed automaton each continuously changing variable is an accurate clock whose rate of change with time is always 1. Furthermore, in a timed automaton all terms involved in assignments are constants, and all invariants and guards only involve comparisons of clock values with constants. Even though the reachability problem for linear hybrid systems is undecidable, it can be solved for timed automata. In this paper, we provide new decidability and undecidability results for classes of linear hybrid systems, and we show that some algorithms for the analysis of timed automata can be extended to linear hybrid systems to obtain semidecision procedures for various verication problems.
In particular, we consider the symbolic model-checking method for timed automata presented in [HNSY94], and the minimization procedure for timed automata presented in [ACD+92]. Both methods perform a reachability analysis over an innite state space. The procedures compute state sets by iterative approximation such that each intermediate result is denable by a linear formula;
that is, each computed state set is a nite union of convex polyhedra in multidimensional real space. The termination of the procedures, however, is not guaranteed for linear hybrid systems.
To cope with this problem, approximate analysis techniques are used to enforce the convergence of iterations by computing upper approximations of state sets. Approximate techniques yield either necessary or sucient verication conditions.
The paper is essentially a synthesis of the results presented in [ACHH93, NOSY93, HPR94].
Section 2 presents a general model for hybrid systems. Section 3 denes linear hybrid systems, and presents decidability and undecidability results for the reachability problem of subclasses of linear hybrid systems. The verication methods are presented in Section 4. Some paradigmatic examples are specied and veried to illustrate the application of our results. These examples are analyzed using the Kronos tool [NSY92, NOSY93] (available from Grenoble) and the HyTech tool [AHH93, HH94] (available from Cornell), two symbolic model checkers for timed and hybrid systems.
2 A Model for Hybrid Systems
We specify hybrid systems by graphs whose edges represent discrete transitions and whose vertices represent continuous activities.
A hybrid system
H
= (Loc;
Var;
Lab;
Edg;Act;
Inv) consists of six components:A nite set Loc of vertices called locations.
A nite set Var of real-valued variables. A valuation
for the variables is a function that assigns a real-value (x
)2R to each variablex
2Var. We writeV
for the set of valuations.A state is a pair (
`;
) consisting of a location`
2Loc and a valuation 2V
. We write for the set of states.A nite set Lab of synchronization labels that contains the stutter label
2Lab.A nite set Edg of edges called transitions. Each transition
e
= (`;a;;`
0) consists of a source location`
2Loc, a target location`
02Loc, a synchronization labela
2Lab, and a transition relationV
2. We require that for each location`
2 Loc, there is a set Con Var of controlled variables and a stutter transition of the form (`;;
IdCon;`
), where (;
0)2IdCon i for all variablesx
2Var, eitherx
62Con or(x
) =0(x
).The transition
e
is enabled in a state (`;
) if for some valuation 0 2V
, (;
0) 2 . The state (`
0;
0), then, is a transition successor of the state (`;
).A labeling function
Act
that assigns to each location`
2Loca set of activities. Each activity is a function from the nonnegative reals R0 toV
. We require that the activities of each location are time-invariant: for all locations`
2Loc, activitiesf
2Act
(`
), and nonnegative realst
2R0, also (f
+t
) 2Act
(`
), where (f
+t
)(t
0) =f
(t
+t
0) for allt
02R0.For all locations
`
2 Loc, activitiesf
2Act
(`
), and variablesx
2 Var, we writef
x the function from R0 to R such thatf
x(t
) =f
(t
)(x
).A labeling function Inv that assigns to each location
`
2Loc an invariant Inv(`
)V
. The hybrid systemH
is time-deterministic if for every location`
2 Loc and every valuation 2V
, there is at most one activityf
2Act
(`
) withf
(0) =. The activityf
, then, is denoted by'
`[].The runs of a hybrid system
At any time instant, the state of a hybrid system is given by a control location and values for all variables. The state can change in two ways:
By a discrete and instantaneous transition that changes both the control location and the values of the variables according to the transition relation;
By a time delay that changes only the values of the variables according to the activities of the current location.
The system may stay at a location only if the location invariant is true; that is, some discrete transition must be taken before the invariant becomes false.
A run of the hybrid system
H
, then, is a nite or innite sequence : 0 7!tf00 1 7!tf11 2 7!tf22
of states
i = (`
i;
i) 2, nonnegative realst
i 2R0, and activitiesf
i 2Act
(`
i), such that for alli
0,1.
f
i(0) =i,2. for all 0
t
t
i,f
i(t
)2Inv(`
i),3. the state
i+1 is a transition successor of the state0i= (`
i;f
i(t
i)).The state
0i is called a time successor of the statei; the statei+1, a successor of i. We write [H
] for the set of runs of the hybrid systemH
.Notice that if we require all activities to be smooth functions, then the run
can be described by a piecewise smooth function whose values at the points of higher-order discontinuity are sequences of discrete state changes. Also notice that for time-deterministic systems, we can omit the subscriptsf
i from the next relation 7!.The run
diverges if is innite and the innite sumPi0t
i diverges. The hybrid systemH
is nonzeno if every nite run ofH
is a prex of some divergent run ofH
. Nonzeno systems can be executed [AH94].Hybrid systems as transition systems
With the hybrid system
H
, we associate the labeled transition system TH = (;
Lab[R0;
!), where the step relation ! is the union of the transition-step relations !a, fora
2Lab,(
`;a;;`
0)2Edg (;
0)2;
02Inv(`
) (`;
)!a(`
0;
0)and the time-step relations !t, for
t
2R0,f
2Act
(`
)f
(0) = 80t
0t: f
(t
0)2Inv(`
) (`;
)!t(`;f
(t
))Notice that the stutter transitions ensure that the transition system TH is re exive.
There is a natural correspondence between the runs of the hybrid system
H
and the paths through the transition systemTH: for all states;
02, where = (`;
), and for allt
2R0,9
f
2Act
(`
);
7!tf 0 i 900 2;a
2Lab:
!t00!a 0:
It follows that for every hybrid system, the set of runs is closed under prexes, suxes, stuttering, and fusion [HNSY94].
For time-deterministic hybrid systems, the rule for the time-step relation can be simplied.
Time can progress by the amount
t
2R0 from the state (`;
) if this is permitted by the invariant of location`
; that is,tcp`[
](t
) i 80t
0t: '
`[](t
0)2Inv(`
):
Now we can rewrite the time-step rule for time-deterministic systems astcp`[
](t
) (`;
)!t(`;'
`[](t
))Example: thermostat
The temperature of a room is controlled through a thermostat, which continuously senses the temperature and turns a heater on and o. The temperature is governed by dierential equations.
When the heater is o, the temperature, denoted by the variable
x
, decreases according to the exponential functionx
(t
) =e
;Kt, wheret
is the time, is the initial temperature, andK
is a constant determined by the room; when the heater is on, the temperature follows the functionx
(t
) =e
;Kt+h
(1;e
;Kt), whereh
is a constant that depends on the power of the heater. We wish to keep the temperature betweenm
andM
degrees and turn the heater on and o accordingly.The resulting time-deterministic hybrid system is shown in Figure 1. The system has two locations: in location
`
0, the heater is turned o; in location`
1, the heater is on. The transition relations are specied by guarded commands; the activities, by dierential equations; and the location invariants, by logical formulas.x
_ =;Kx
x
=m
x
=M x
=M
`
1`
0x
_ =K
(h
;x
)x
M x
m
Figure 1: Thermostat
The parallel composition of hybrid systems
Let
H
1 = (Loc1;
Var;
Lab1;
Edg1;Act
1;
Inv1) andH
2 = (Loc2;
Var;
Lab2;
Edg2;Act
2;
Inv2) be two hybrid systems over a common set Var of variables. The two hybrid systems synchronize on the common set Lab1 \Lab2 of synchronization labels; that is, wheneverH
1 performs a discrete transition with the synchronization labela
2Lab1\Lab2, then so doesH
2.The product
H
1H
2 is the hybrid system (Loc1Loc2;
Var;
Lab1[Lab2;
Edg;Act;
Inv) such that((
`
1;`
2);a;;
(`
01;`
02))2Edg i(1) (
`
1;a
1;
1;`
01)2Edg1 and (`
2;a
2;
2;`
02)2Edg2,(2) either
a
1 =a
2 =a
, ora
1 62Lab2 anda
2=, ora
1 = anda
2 62Lab1, (3)=1\2;
Act
(`
1;`
2) =Act
1(`
1)\Act
2(`
2);Inv(
`
1;`
2) = Inv1(`
1)\Inv2(`
2).It follows that all runs of the product system are runs of both component systems:
[
H
1H
2]Loc1 [H
1] and [H
1H
2]Loc2 [H
2] where [H H
] is the projection of [H H
] on Loci.3 Linear Hybrid Systems
A linear term over the set Var of variables is a linear combination of the variables in Var with integer coecients. A linear formula over Var is a boolean combination of inequalities between linear terms over Var.
The time-deterministic hybrid system
H
= (Loc;
Var;
Lab;
Edg;Act;
Inv) is linear if its activ- ities, invariants, and transition relations can be dened by linear expressions over the set Var of variables:1. For all locations
`
2Loc, the activitiesAct
(`
) are dened by a set of dierential equations of the form _x
=k
x, one for each variablex
2Var, wherek
x 2Z is an integer constant: for all valuations 2V
, variablesx
2Var, and nonnegative realst
2R0,'
x`[](t
) = (x
) +k
xt:
We write
Act
(`;x
) =k
x to refer to the rate of the variablex
at location`
.2. For all locations
`
2Loc, the invariant Inv(`
) is dened by a linear formula over Var: 2Inv(`
) i ( ):
3. For all transitions
e
2Edg, the transition relation is dened by a guarded set of nondeter- ministic assignments) f
x
:= [x;
x]jx
2Varg;
where the guard is a linear formula and for each variable
x
2Var, both interval boundaries x andx are linear terms:(
;
0)2 i ( ) ^ 8x
2Var:
(x)0(x
)(x):
If
x = x, we write (e;x
) = x to refer to the updated value of the variablex
after the transitione
.Notice that every run of a linear hybrid system can be described by a piecewise linear function whose values at the points of rst-order discontinuity are nite sequences of discrete state changes.
Special cases of linear hybrid systems
Various special cases of linear hybrid systems are of particular interest:
If
Act
(`;x
) = 0 for each location`
2 Loc, thenx
is a discrete variable. Thus, a discrete variable changes only when the control location changes. A discrete system is a linear hybrid system all of whose variables are discrete.A discrete variable
x
is a proposition if (e;x
) 2 f0;
1g for each transitione
2 Edg. A nite-state system is a linear hybrid system all of whose variables are propositions.If
Act
(`;x
) = 1 for each location`
and(e;x
)2f0;x
gfor each transitione
, thenx
is a clock.Thus, (1) the value of a clock increases uniformly with time, and (2) a discrete transition either resets a clock to 0, or leaves it unchanged. A timed automaton [AD94] is a linear hybrid system all of whose variables are propositions or clocks, and the linear expressions are boolean combinations of inequalities of the form
x
#c
orx
;y
#c
wherec
is a nonnegative integer and #2f<;
;
=;>;
g.If there is a nonzero integer constant
k
2Z such thatAct
(`;x
) =k
for each location`
and (e;x
)2f0;x
gfor each transitione
, thenx
is a skewed clock. Thus, a skewed clock is similar to a clock except that it changes with time at some xed rate dierent from 1. A multirate timed system is a linear hybrid system all of whose variables are propositions and skewed clocks. An n-rate timed system is a multirate timed system whose skewed clocks proceed atn
dierent rates.If
Act
(`;x
)2f0;
1gfor each location`
and (e;x
)2f0;x
gfor each transitione
, thenx
is an integrator. Thus, an integrator is a clock that can be stopped and restarted; it is typically used to measure accumulated durations. An integrator system is a linear hybrid system all of whose variables are propositions and integrators.A discrete variable
x
is a parameter if (e;x
) =x
for each transitione
2 Edg. Thus, a parameter is a symbolic constant. For each of the subclasses of linear hybrid systems listed above, we obtain parameterized versions by admitting parameters.Notice that linear hybrid systems, and all of the subclasses of linear hybrid systems listed above, are closed under parallel composition.
3.1 Examples of Linear Hybrid Systems A water-level monitor
The water level in a tank is controlled through a monitor, which continuously senses the water level and turns a pump on and o. The water level changes as a piecewise-linear function over time.
When the pump is o, the water level, denoted by the variable
y
, falls by 2 inches per second; when the pump is on, the water level rises by 1 inch per second. Suppose that initially the water level is 1 inch and the pump is turned on. We wish to keep the water level between 1 and 12 inches.But from the time that the monitor signals to change the status of the pump to the time that the change becomes eective, there is a delay of 2 seconds. Thus the monitor must signal to turn the pump on before the water level falls to 1 inch, and it must signal to turn the pump o before the water level reaches 12 inches.
The linear hybrid system of Figure 2 describes a water-level monitor that signals whenever the water level passes 5 and 10 inches, respectively. The system has four locations: in locations 0 and 1, the pump is turned on; in locations 2 and 3, the pump is o. The clock
x
is used to specify the delays: whenever the control is in location 1 or 3, the signal to switch the pump o or on, respectively, was sentx
seconds ago. In the next section, we will prove that the monitor indeed keeps the water level between 1 and 12 inches.A mutual-exclusion protocol
This example describes a parameterized multirate timed system. We present a timing-based algo- rithm that implements mutual exclusion for a distributed system with skewed clocks. Consider an asynchronous shared-memory system that consists of two processes
P
1 andP
2 with atomic read and write operations. Each process has a critical section and at each time instant, at most one of the two processes is allowed to be in its critical section. Mutual exclusion is ensured by a version of Fischer's protocol [Lam87], which we describe rst in pseudocode. For each processP
i, wherei
= 1;
2:y
= 10x
:= 0y
= 1x
= 2x
= 2y
= 5x
:= 0x
_= 10
3
2
x
_ = 1x
_ = 1y
_= 1y
_= 1y
10x
2x
_ = 1y
_=;2x
2y
_=;2y
5 Figure 2: Water-level monitorrepeat repeat
await k
= 0k
:=i delay b until k
=i
Critical sectionk
:= 0forever
The two processes
P
1 andP
2 share a variablek
and processP
i is allowed to be in its critical section ik
=i
. Each process has a private clock. The instructiondelay b
delays a process for at leastb
time units as measured by the process's local clock. Furthermore, each process takes at mosta
time units, as measured by the process's clock, for a single write access to the shared memory (i.e., for the assignmentk
:=i
). The values ofa
andb
are the only information we have about the timing behavior of instructions. Clearly, the protocol ensures mutual exclusion only for certain values ofa
andb
. If both private processor clocks proceed at precisely the same rate, then mutual exclusion is guaranteed ia < b
.To make the example more interesting, we assume that the two private clocks of the processes
P
1 andP
2 proceed at dierent rates, namely, the local clock ofP
2 is 1:
1 times faster than the clock ofP
1. The resulting system can be modeled by the product of the two hybrid systems presented in Figure 3.Each of the two graphs models one process, with the two critical sections being represented by the locations 4 and
D
. The private clocks of the processesP
1 andP
2 determine the rate of change of the two skewed-clock variablesx
andy
, respectively.A leaking gas burner
Now we consider an integrator system. In [CHR91], the duration calculus is used to prove that a gas burner does not leak excessively. It is assumed that (1) any leakage can be detected and
1
2
3
4
x
_ = 1x
_ = 1x
_= 1k
= 0x
:= 0x < a x k
:= 1:= 0x > b
^k
6= 1k
= 0A
B
C
D
y
:= 0y > b
^k
6= 2k
:= 2y < a
k
:= 0k
:= 0k
= 1k
= 2^x > b
^
y
_= 1:
1y
_= 1:
1x
_ = 1y
_ = 1:
1y
_ = 1:
1y > b
y
:= 0Figure 3: Mutual-exclusion protocol
stopped within 1 second and (2) the gas burner will not leak for 30 seconds after a leakage has been stopped. We wish to prove that the accumulated time of leakage is at most one twentieth of the time in any interval of at least 60 seconds. The system is modeled by the hybrid system of Figure 4. The system has two locations: in location 1, the gas burner leaks; location 2 is the nonleaking location. The integrator
z
records the cumulative leakage time; that is, the accumulated amount of time that the system has spent in location 1. The clockx
records the time the system has spent in the current location; it is used to specify the properties (1) and (2). The clocky
records the total elapsed time. In the next section, we will prove thaty
60 ) 20z
y
is an invariant of the system.1
x
:= 0 2x
30x
:= 0x
= 0z
= 0y
= 0x
_ = 1y
_= 1z
_= 1x
1x
_ = 1y
_= 1z
_= 0 Figure 4: Leaking gas burnerA temperature control system
This example appears in [JLHM91]. The system controls the coolant temperature in a reactor tank by moving two independent control rods. The goal is to maintain the coolant between the temperatures
m and M. When the temperature reaches its maximum value M, the tank must be refrigerated with one of the rods. The temperature rises at a ratev
r and decreases at ratesv
1 andv
2 depending on which rod is being used. A rod can be moved again only ifT
time units have elapsed since the end of its previous movement. If the temperature of the coolant cannot decrease because there is no available rod, a complete shutdown is required. Figure 5 shows the hybrid system of this example: variable measures the temperature, and the values of clocksx
1 andx
2 represent the times elapsed since the last use of rod 1 and rod 2, respectively. =M ^x
1T
x
1=:= 0mshutdown x
2T
x
2:= 0 =m =M^ =M ^x
1< T
^x
2< T x
1=T
x
2=T
1
x
_2 = 1 m0
2 3
_=;v
2x
_1= 1x
_2 = 1 m _=v
rx
_1 = 1x
_2 = 1 M _=;v
1x
_1 = 1Figure 5: Temperature control system
A game of billiards
Consider a billiard table of dimensions
l
andh
, with a grey ball and a white ball (Figure 6).Initially, the balls are placed at positions
b
g = (x
g;y
g) andb
w = (x
w;y
w). The grey ball is knocked and starts moving with constant velocityv
. If the ball reaches a vertical side then it rebounds, i.e., the sign of the horizontal velocity componentv
x changes. The same occurs with the vertical velocity componentv
y when the ball reaches a horizontal side. The combination of signs of velocity components gives four dierent directions of movement.The hybrid system shown in Figure 7 describes the movement of the grey ball for the bil- liards game. Each possible combination of directions is represented by a location. The rebounds correspond to the execution of transitions between locations.
v
yv
v
xx
gx
wl x
h y
wy
gy
Figure 6: Billiards game
x
=l
_ 1x
=v
xx
l
^y
h
_ 2
x
=;v
xy
_=v
yx
0 ^y
h y
_=v
yy
= 0y
=h y
=h y
= 03
y
_x
_==;v
xv
y4
x
_=;v
xx
= 0x
l
^y
0x
y
_0=^;y v
y0x
=x
gy
=y
gx
=l x
= 0Figure 7: Movement of the grey ball
3.2 The Reachability Problem for Linear Hybrid Systems
Let
and0be two states of a hybrid systemH
. The state0is reachable from the state, written 7!0, if there is a run ofH
that starts in and ends in0. The reachability question asks, then, if 7! 0for two given states and 0of a hybrid systemH
.The reachability problem is central to the verication of hybrid systems. In particular, the verication of invariance properties is equivalent to the reachability question: a set
R
of states is an invariant of the hybrid systemH
i no state in ;R
is reachable from an initial state ofH
.A decidability result
A linear hybrid system is simple if all linear atoms in location invariants and transition guards are of the form
x
k
ork
x
, for a variablex
2Var and an integer constantk
2Z. In particular, for multirate timed systems the simplicity condition prohibits the comparison of skewed clocks with dierent rates.Theorem 3.1
The reachability problem is decidable for simple multirate timed systems.Proof.
LetH
be a simple multirate timed system. We translateH
into a timed automa- ton sc(H
): (1) adjust the rates of all skewed clocks to 1, and (2) replace all occurrences of each skewed clockx
in location invariants and transition guards withk
xx
. Given a valuation ofH
, let the valuation sc() be such that sc()(x
) =k
x(x
) for all skewed clocksx
and sc()(p
) =(p
) for all propositionsp
; moreover, sc(`;
) = (`;
sc()). It is not dicult to check that there is a run ofH
from to 0 i there is a run of sc(H
) from sc() to sc(0). The reachability problem for timed automata is solved in [ACD93].Two undecidability results
Theorem 3.2
The reachability problem is undecidable for 2-rate timed systems.Proof.
The theorem follows from the undecidability of the halting problem for nondeterministic 2-counter machines. Given any two distinct clock rates, a 2-rate timed system can encode the computations of the given 2-counter machineM
. For the 2-rate timed systemH
, we use \accurate"clocks of rate 1 and skewed clocks of rate 2. We use an accurate clock
y
to mark intervals of length 1: the clocky
is zero initially, and is reset whenever it reaches 1. Thei
-th conguration of the machineM
is encoded by the state ofH
at timei
. The location ofH
encodes the program counter ofM
, and the values of two accurate clocksx
1 andx
2 encode the counter values: the counter valuen
is encoded by the clock value 1=
2n.Encoding the program counter, setting up the initial conguration, and testing a counter for being 0, is straightforward. Hence it remains to be shown how to update the counter values.
Suppose at time
i
the value of an accurate clockx
is 1=
2n, that is, suppose that the clockx
is reset to 0 at timei
;1=
2n. Suppose the value of the counter encoded byx
stays unchanged. Then simply resetx
to 0 when its value reaches 1 (that is, at time (i
+ 1;1=
2n)); the value ofx
at timei
+ 1 will then be 1=
2n. To increment the counter represented byx
, reset an accurate clockz
when the value ofx
reaches 1, then nondeterministically reset bothx
and a skewed clockz
0in the interval (i
+ 1;1=
2n;i
+ 1) and testz
=z
0 at timei
+ 1. The equality test ensures that the value of the skewed clockz
0 is 1=
2n at timei
+ 1, and hence, the value ofx
is 1=
2n+1 at timei
+ 1.To decrement the counter represented by
x
, nondeterministically reset an accurate clockz
in the interval (i
;1;i
;1=
2n), reset a skewed clockz
0 simultaneously withx
at timei
;1=
2n, and testthe condition
z
=z
0at timei
. This ensures that the value ofz
at timei
is 1=
2n;1. Then resetting the clockx
when the value ofz
reaches 1 ensures that the value ofx
is 1=
2n;1 at timei
+ 1.Thus, the runs of
H
encode the runs ofM
, and the halting problem forM
is reduced to a reachability problem forH
.Theorem 3.3
The reachability problem is undecidable for simple integrator systems.Proof.
This is proved in [Cer92].4 The Verication of Linear Hybrid Systems
We present a methodology for analyzing linear hybrid systems that is based on predicate transform- ers for computing the step predecessors and the step successors of a given set of states. Throughout this section, let
H
= (Loc;
Var;
Lab;
Edg;Act;
Inv) be a linear hybrid system.4.1 Forward Analysis
Given a location
`
2Loc and a set of valuationsP
V
, the forward time closure hP
i%` ofP
at`
is the set of valuations that are reachable from some valuation 2P
by letting time progress: 02hP
i%` i 9 2V;t
2R0:
2P
^ tcp`[](t
) ^ 0='
`[](t
):
Thus, for all valuations
0 2hP
i%` , there exist a valuation 2P
and a nonnegative realt
2R0 such that (`;
)!t(`;
0).Given a transition
e
= (`;a;;`
0) and a set of valuationsP
V
, the postcondition poste[P
] ofP
with respect toe
is the set of valuations that are reachable from some valuation 2P
by executing the transitione
: 02poste[P
] i 9 2V:
2P
^ (;
0)2:
Thus, for all valuations
02poste[P
], there exists a valuation 2P
such that (`;
)!a(`
0;
0).A set of states is called a region. Given a set
P
V
of valuations, by (`;P
) we denote the regionf(
`;
)j 2P
g; we write (`;
)2(`;P
) i 2P
. The forward time closure and the postcondition can be naturally extended to regions: forR
=S`2Loc(`;R
`),h
R
i% = [`2Loc(
`;
hR
`i%` ) post[R
] = [e=(`;`0)2Edg(
`
0;
poste[R
`])A symbolic run of the linear hybrid system
H
is a nite or innite sequence%
: (`
0;P
0)(`
1;P
1):::
(`
i;P
i):::
of regions such that for all
i
0, there exists a transitione
i from`
i to`
i+1 andP
i+1 = postei[hP
ii%`i];that is, the region (
` ;P
) is the set of states that are reachable from a state (` ;
) (` ;P
)the runs and the symbolic runs of the linear hybrid system
H
. The symbolic run%
represents the set of all runs of the form(
`
0;
0)7!t0 (`
1;
1)7!t1such that (
`
i;
i) 2(`
i;P
i) for alli
0. Besides, every run ofH
is represented by some symbolic run ofH
.Given a region
I
, the reachable region (I
7!) ofI
is the set of all states that are reachable from states inI
: 2(I
7!) i 902I:
07!:
Notice that
I
(I
7!).The following proposition suggests a method for computing the reachable region (
I
7!) ofI
.Proposition 4.1
LetI
= S`2Loc(`;I
`) be a region of the linear hybrid systemH
. The reachable region (I
7!) =S`2Loc(`;R
`) is the least xpoint of the equationX
= hI
[post[X
]i%or, equivalently, for all locations
`
2Loc, the setR
` of valuations is the least xpoint of the set of equationsX
` = hI
`[ [e=(`0;`)2Edgposte[
X
`0]i%`:
Let be a linear formula over Var. By [[ ]] we denote the set of valuations that satisfy . A set
P
V
of valuations is linear ifP
is denable by a linear formula; that is,P
= [[ ]] for some linear formula . If Var containsn
variables, then a linear set of valuations can be thought of as a union of polyhedra inn
-dimensional space.Lemma 4.1
For all linear hybrid systemsH
, ifP
V
is a linear set of valuations, then for all locations`
2Loc and transitionse
2Edg, both hP
i%` and poste[P
] are linear sets of valuations.Given a linear formula , we write h i%` and poste[ ] for the linear formulas that dene the sets of valuations h[[ ]]i%` and poste[[[ ]]], respectively.
Let pc 62 Var be a control variable that ranges over the set Loc of locations and let
R
=S`2Loc(
`;R
`) be a region. The regionR
is linear if for every location`
2 Loc, the setR
` of valuations is linear. If the setsR
` are dened by the linear formulas `, then the regionR
is dened by the linear formula= _
`2Loc(pc =
`
^ `);that is, [[ ]] =
R
. Hence, by Lemma 4.1, for all linear hybrid systems, ifR
is a linear region, then so are bothhR
i% and post[R
].Using Proposition 4.1, we compute the reachable region (
I
7!) of a regionI
by successive approximation. Lemma 4.1 ensures that all regions computed in the process are linear. Since the reachability problem for linear hybrid systems is undecidable, the successive-approximation procedure does not terminate in general. The procedure does terminate for simple multirate timed systems (Theorem 3.1) and for the following example.Example: the leaking gas burner
Let
I
be the set of initial states dened by the linear formulaI = (pc = 1 ^
x
=y
=z
= 0):
The set (
I
7!) of reachable states is characterized by the least xpoint of the two equations1 = h
x
=y
=z
= 0_ post(2;1)[ 2]i%12 = hfalse_ post(1;2)[ 1]i%2 which can be iteratively computed as
1;i = 1;i;1_ hpost(2;1)[ 2;i;1]i%1
2;i = 2;i;1_ hpost(1;2)[ 1;i;1]i%2
where 1;0 =h
x
=y
=z
= 0i%1 = (x
1 ^y
=x
=z
) and 2;0 = false. Fori
= 1, we have1;1 = 1;0_ hpost(2;1)[ 2;0]i%1
= 1;0
2;1 = 2;0_ hpost(1;2)[ 1;1]i%2
= hpost(1;2)[
x
1 ^y
=x
=z
= 0]i%2= h(
x
= 0 ^y
1 ^z
=y
)i%2= (
z
1 ^y
=z
+x
) Now, it is easy to show by induction that for alli
2,1;i= 1;i;1_
x
1 ^ 0z
;x
i
^ 30i
+z
y
and2;i= 2;i;1_
y
i
+ 1 ^ 30i
+x
+z
y
Hence, the least solution of the equations above is the linear formulaR = (pc = 1 ^ 1)_ (pc = 2 ^ 2) where
1 =
x
1 ^x
=y
=z
_ 9i
1:
(x
1 ^ 0z
;x
i
^ 30i
+z
y
)= (
x
1 ^x
=y
=z
)_ (x
1 ^x
z
^y
+ 30x
31z
)2 =
z
1 ^y
=x
+z
^x
0_ 9i
1:
(z
i
+ 1 ^ 30i
+x
+z
y
)= (
z
1 ^y
=x
+z
^x
0)_y
x
+ 31z
;30This characterization of the reachable states can be used to verify invariance properties of the gas burner system ( Ris the strongest invariant of the system). For instance, the formula R implies the design requirement
y
60 ) 20z
y
.4.2 Backward Analysis
The forward time closure and the postcondition dene the successor of a region
R
. Dually, we can compute the predecessor ofR
.Given a location
`
2 Loc and a set of valuationsP
V
, the backward time closure ofP
at`
is the set of valuations from which it is possible to reach some valuation 2P
by letting time progress: 02hP
i.` i 9 2V;t
2R0:
='
`[0](t
) ^ 2P
^ tcp`[0](t
):
Thus, for all valuations
0 2hP
i.` , there exist a valuation 2P
and a nonnegative realt
2R0 such that (`;
0)!t(`;
).Given a transition
e
= (`;a;;`
0) and a set of valuationsP
V
, the precondition pree[P
] ofP
with respect toe
is the set of valuations from which it is possible to reach a valuation 2P
by executing the transitione
: 02pree[P
] i 9 2V:
2P
^ (0;
)2:
Thus, for all valuations
02pree[P
], there exists a valuation 2P
such that (`;
0)!a(`
0;
).The backward time closure and the precondition can be naturally extended to regions: for
R
=S`2Loc(
`;R
`),h
R
i. = [`2Loc(
`;
hR
`i.` ) pre[R
] = [e=(`0;`)2Edg(
`
0;
pree[R
`])Given a region
R
, the initial region (7!R
) ofR
is the set of all states from which a state inR
is reachable: 2(7!R
) i 902R:
7! 0:
Notice thatR
(7!R
).The following proposition suggests a method for computing the initial region (7!
R
) ofR
.Proposition 4.2
LetR
= S`2Loc(`;R
`) be a region of the linear hybrid systemH
. The initial regionI
=S`2Loc(`;I
`) is the least xpoint of the equationX
= hR
[pre[X
]i.or, equivalently, for all locations
`
2Loc, the setI
` of valuations is the least xpoint of the setX
` = hR
`[ [e=(`;`0)2Edgpree[
X
`0]i.` of equations.Lemma 4.2
For all linear hybrid systemsH
, ifP
V
is a linear set of valuations, then for all locations`
2Loc and transitionse
2Edg, both hP
i.` and pree[P
] are linear sets of valuations.It follows that for all linear hybrid systems, if