## 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

)^{2}R to each variable

### x

^{2}Var. We write

### V

for the set of valuations.A state is a pair (

### `;

) consisting of a location### `

^{2}Loc and a valuation

^{2}

### V

. We write for the set of states.A nite set Lab of synchronization labels that contains the stutter label

^{2}Lab.

A nite set Edg of edges called transitions. Each transition

### e

= (### `;a;;`

^{0}) consists of a source location

### `

^{2}Loc, a target location

### `

^{0}

^{2}Loc, a synchronization label

### a

^{2}Lab, and a transition relation

^{}

### V

^{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 (

### `;;

Id^{Con}

### ;`

), where (### ;

^{0})

^{2}Id

^{Con}i for all variables

### x

^{2}Var, either

### x

^{62}Con or(

### x

) =^{0}(

### x

).The transition

### e

is enabled in a state (### `;

) if for some valuation^{0}

^{2}

### V

, (### ;

^{0})

^{2}. The state (

### `

^{0}

### ;

^{0}), then, is a transition successor of the state (

### `;

).A labeling function

### Act

that assigns to each location### `

^{2}Loca set of activities. Each activity is a function from the nonnegative reals R

^{0}to

### V

. We require that the activities of each location are time-invariant: for all locations### `

^{2}Loc, activities

### f

^{2}

### Act

(### `

), and nonnegative reals### t

^{2}R

^{0}, also (

### f

+### t

)^{2}

### Act

(### `

), where (### f

+### t

)(### t

^{0}) =

### f

(### t

+### t

^{0}) for all

### t

^{0}

^{2}R

^{0}.

For all locations

### `

^{2}Loc, activities

### f

^{2}

### Act

(### `

), and variables### x

^{2}Var, we write

### f

^{x}the function from R

^{0}to R such that

### f

^{x}(

### t

) =### f

(### t

)(### x

).A labeling function Inv that assigns to each location

### `

^{2}Loc an invariant Inv(

### `

)^{}

### V

. The hybrid system### H

is time-deterministic if for every location### `

^{2}Loc and every valuation

^{2}

### V

, there is at most one activity### f

^{2}

### Act

(### `

) with### f

(0) =. The activity### f

, 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!}

^{t}

_{f}

^{0}0

^{1}

^{7!}

^{t}

_{f}

^{1}1

^{2}

^{7!}

^{t}

_{f}

^{2}2

of states

i = (### `

i### ;

i)^{2}, nonnegative reals

### t

i^{2}R

^{0}, and activities

### f

i^{2}

### Act

(### `

i), such that for all### i

^{}0,

1.

### f

i(0) =i,2. for all 0^{}

### t

^{}

### t

i,### f

i(### t

)^{2}Inv(

### `

i),3. the state

i^{+1}is a transition successor of the state

^{0}

_{i}= (

### `

i### ;f

i(### t

i)).The state

^{0}

_{i}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 system### H

.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 subscripts### f

i from the next relation^{7!}.

The run

diverges if is innite and the innite sum^{P}

_{i}

^{0}

### t

i diverges. The hybrid system### H

is nonzeno if every nite run of### H

is a prex of some divergent run of### H

. Nonzeno systems can be executed [AH94].### Hybrid systems as transition systems

With the hybrid system

### H

, we associate the labeled transition system^{T}H = (

### ;

Lab^{[}R

^{0}

### ;

^{!}), where the step relation

^{!}is the union of the transition-step relations

^{!}

^{a}, for

### a

^{2}Lab,

(

### `;a;;`

^{0})

^{2}Edg (

### ;

^{0})

^{2}

### ;

^{0}

^{2}Inv(

### `

) (### `;

)^{!}

^{a}(

### `

^{0}

### ;

^{0})

and the time-step relations ^{!}^{t}, for

### t

^{2}R

^{0},

### f

^{2}

### Act

(### `

)### f

(0) =^{8}0

^{}

### t

^{0}

^{}

### t: f

(### t

^{0})

^{2}Inv(

### `

) (### `;

)^{!}

^{t}(

### `;f

(### t

))Notice that the stutter transitions ensure that the transition system ^{T}H is re
exive.

There is a natural correspondence between the runs of the hybrid system

### H

and the paths through the transition system^{T}H: for all states

### ;

^{0}

^{2}, where = (

### `;

), and for all### t

^{2}R

^{0},

9

### f

^{2}

### Act

(### `

)### ;

^{7!}

_{tf}

^{0}i

^{9}

^{00}

^{2}

### ;a

^{2}Lab

### :

^{!}

^{t}

^{00}

^{!}

^{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

^{2}R

^{0}from the state (

### `;

) if this is permitted by the invariant of location### `

; that is,tcp_{`}[

### t

) i^{8}0

^{}

### t

^{0}

^{}

### t: '

`[](### t

^{0})

^{2}Inv(

### `

)### :

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 function### x

(### t

) =### e

^{;}

^{Kt}, where

### t

is the time, is the initial temperature, and### K

is a constant determined by the room; when the heater is on, the temperature follows the function### x

(### t

) =### e

^{;}

^{Kt}+

### h

(1^{;}

### e

^{;}

^{Kt}), where

### h

is a constant that depends on the power of the heater. We wish to keep the temperature between### m

and### M

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}

### `

^{0}

### x

_ =### K

(### h

^{;}

### x

)### x

^{}

### M x

^{}

### m

Figure 1: Thermostat

### The parallel composition of hybrid systems

Let

### H

^{1}= (Loc

^{1}

### ;

Var### ;

Lab^{1}

### ;

Edg^{1}

### ;Act

^{1}

### ;

Inv^{1}) and

### H

^{2}= (Loc

^{2}

### ;

Var### ;

Lab^{2}

### ;

Edg^{2}

### ;Act

^{2}

### ;

Inv^{2}) be two hybrid systems over a common set Var of variables. The two hybrid systems synchronize on the common set Lab

^{1}

^{\}Lab

^{2}of synchronization labels; that is, whenever

### H

^{1}performs a discrete transition with the synchronization label

### a

^{2}Lab

^{1}

^{\}Lab

^{2}, then so does

### H

^{2}.

The product

### H

^{1}

^{}

### H

^{2}is the hybrid system (Loc

^{1}

^{}Loc

^{2}

### ;

Var### ;

Lab^{1}

^{[}Lab

^{2}

### ;

Edg### ;Act;

Inv) such that((

### `

^{1}

### ;`

^{2})

### ;a;;

(### `

^{0}

^{1}

### ;`

^{0}

^{2}))

^{2}Edg i

(1) (

### `

^{1}

### ;a

^{1}

### ;

^{1}

### ;`

^{0}

^{1})

^{2}Edg

^{1}and (

### `

^{2}

### ;a

^{2}

### ;

^{2}

### ;`

^{0}

^{2})

^{2}Edg

^{2},

(2) either

### a

^{1}=

### a

^{2}=

### a

, or### a

^{1}

^{62}Lab

^{2}and

### a

^{2}=, or

### a

^{1}= and

### a

^{2}

^{62}Lab

^{1}, (3)=

^{1}

^{\}

^{2};

### Act

(### `

^{1}

### ;`

^{2}) =

### Act

^{1}(

### `

^{1})

^{\}

### Act

^{2}(

### `

^{2});

Inv(

### `

^{1}

### ;`

^{2}) = Inv

^{1}(

### `

^{1})

^{\}Inv

^{2}(

### `

^{2}).

It follows that all runs of the product system are runs of both component systems:

[

### H

^{1}

^{}

### H

^{2}]

^{Loc}

^{1}

^{}[

### H

^{1}] and [

### H

^{1}

^{}

### H

^{2}]

^{Loc}

^{2}

^{}[

### 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

### `

^{2}Loc, the activities

### Act

(### `

) are dened by a set of dierential equations of the form _### x

=### k

x, one for each variable### x

^{2}Var, where

### k

x^{2}Z is an integer constant: for all valuations

^{2}

### V

, variables### x

^{2}Var, and nonnegative reals

### t

^{2}R

^{0},

### '

_{x`}[](

### t

) = (### x

) +### k

x^{}

### t:

We write

### Act

(### `;x

) =### k

x to refer to the rate of the variable### x

at location### `

.2. For all locations

### `

^{2}Loc, the invariant Inv(

### `

) is dened by a linear formula over Var:^{2}Inv(

### `

) i ( )### :

3. For all transitions

### e

^{2}Edg, the transition relation is dened by a guarded set of nondeter- ministic assignments

) f

### x

:= [x### ;

x]^{j}

### x

^{2}Var

^{g}

### ;

where the guard is a linear formula and for each variable

### x

^{2}Var, both interval boundaries x andx are linear terms:

(

### ;

^{0})

^{2}i ( )

^{^}

^{8}

### x

^{2}Var

### :

(x)^{}

^{0}(

### x

)^{}(x)

### :

If

x = x, we write (### e;x

) = x to refer to the updated value of the variable### x

after the transition### e

.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, then

### x

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}

^{f}0

### ;

1^{g}for each transition

### e

^{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

)^{2}

^{f}0

### ;x

^{g}for each transition

### e

, then### x

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

or### x

^{;}

### y

#### c

where### c

is a nonnegative integer and #^{2}

^{f}

### <;

^{}

### ;

=### ;>;

^{g}.

If there is a nonzero integer constant

### k

^{2}Z such that

### Act

(### `;x

) =### k

for each location### `

and (### e;x

)^{2}

^{f}0

### ;x

^{g}for each transition

### e

, then### x

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 at### n

dierent rates.If

### Act

(### `;x

)^{2}

^{f}0

### ;

1^{g}for each location

### `

and (### e;x

)^{2}

^{f}0

### ;x

^{g}for each transition

### e

, then### x

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 transition### e

^{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 sent### x

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}and

### P

^{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 process

### P

i, where### i

= 1### ;

2:### y

= 10### x

:= 0### y

= 1### x

= 2### x

= 2### y

= 5### x

:= 0### x

_= 10

3

2

### x

_ = 1### x

_ = 1### y

_= 1### y

_= 1### y

^{}10

### x

^{}2

### x

_ = 1### y

_=^{;}2

### x

^{}2

### y

_=^{;}2

### y

^{}5 Figure 2: Water-level monitor

### repeat repeat

### await k

= 0### k

:=### i delay b until k

=### i

Critical section### k

:= 0### forever

The two processes

### P

^{1}and

### P

^{2}share a variable

### k

and process### P

i is allowed to be in its critical section i### k

=### i

. Each process has a private clock. The instruction### delay b

delays a process for at least### b

time units as measured by the process's local clock. Furthermore, each process takes at most### a

time units, as measured by the process's clock, for a single write access to the shared memory (i.e., for the assignment### k

:=### i

). The values of### a

and### b

are the only information we have about the timing behavior of instructions. Clearly, the protocol ensures mutual exclusion only for certain values of### a

and### b

. If both private processor clocks proceed at precisely the same rate, then mutual exclusion is guaranteed i### a < b

.To make the example more interesting, we assume that the two private clocks of the processes

### P

^{1}and

### P

^{2}proceed at dierent rates, namely, the local clock of

### P

^{2}is 1

### :

1 times faster than the clock of### P

^{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 processes### P

^{1}and

### P

^{2}determine the rate of change of the two skewed-clock variables

### x

and### y

, 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

_ = 1### x

_ = 1### x

_= 1### k

= 0### x

:= 0### x < a x k

:= 1:= 0### x > b

^{^}

### k

^{6}= 1

### k

= 0A

B

C

D

### y

:= 0### y > b

^{^}

### k

^{6}= 2

### k

:= 2### y < a

### k

:= 0### k

:= 0### k

= 1### k

= 2^{^}

### x > b

^

### y

_= 1### :

1### y

_= 1### :

1### x

_ = 1### y

_ = 1### :

1### y

_ = 1### :

1### y > 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 clock### x

records the time the system has spent in the current location; it is used to specify the properties (1) and (2). The clock### y

records the total elapsed time. In the next section, we will prove that### y

^{}60

^{)}20

### z

^{}

### y

is an invariant of the system.1

### x

:= 0 2### x

^{}30

### x

:= 0### x

= 0### z

= 0### y

= 0### x

_ = 1### y

_= 1### z

_= 1### x

^{}1

### x

_ = 1### y

_= 1### z

_= 0 Figure 4: Leaking gas burner### A 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 rate### v

r and decreases at rates### v

^{1}and

### v

^{2}depending on which rod is being used. A rod can be moved again only if

### T

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 clocks### x

^{1}and

### x

^{2}represent the times elapsed since the last use of rod 1 and rod 2, respectively. =M

^{^}

### x

^{1}

^{}

### T

### x

^{1}=:= 0m

### shutdown x

^{2}

^{}

### T

### x

^{2}:= 0 =m =M

^{^}=M

^{^}

### x

^{1}

### < T

^{^}

### x

^{2}

### < T x

^{1}=

### T

### x

^{2}=

### T

1

### x

_^{2}= 1

^{}m

0

2 3

_=^{;}

### v

^{2}

### x

_^{1}= 1

### x

_^{2}= 1

^{}m _=

### v

r### x

_^{1}= 1

### x

_^{2}= 1

^{}M _=

^{;}

### v

^{1}

### x

_^{1}= 1

Figure 5: Temperature control system

### A game of billiards

Consider a billiard table of dimensions

### l

and### h

, with a grey ball and a white ball (Figure 6).Initially, the balls are placed at positions

### b

g = (### x

g### ;y

g) and### b

w = (### x

w### ;y

w). The grey ball is knocked and starts moving with constant velocity### v

. If the ball reaches a vertical side then it rebounds, i.e., the sign of the horizontal velocity component### v

x changes. The same occurs with the vertical velocity component### v

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

y### v

### v

x### x

g### x

w### l x

### h y

w### y

g### y

Figure 6: Billiards game

### x

=### l

_ 1### x

=### v

x### x

^{}

### l

^{^}

### y

^{}

### h

_ 2

### x

=^{;}

### v

x### y

_=### v

y### x

^{}0

^{^}

### y

^{}

### h y

_=### v

y### y

= 0### y

=### h y

=### h y

= 03

### y

_### x

_==^{;}

### v

x### v

y4

### x

_=^{;}

### v

x### x

= 0### x

^{}

### l

^{^}

### y

^{}0

### x

^{}

### y

_0=^{^}

^{;}

### y v

y^{}0

### x

=### x

g### y

=### y

g### x

=### l x

= 0Figure 7: Movement of the grey ball

### 3.2 The Reachability Problem for Linear Hybrid Systems

Let

and^{0}be two states of a hybrid system

### H

. The state^{0}is reachable from the state, written

^{7!}

^{}

^{0}, if there is a run of

### H

that starts in and ends in^{0}. The reachability question asks, then, if

^{7!}

^{}

^{0}for two given states and

^{0}of a hybrid system

### H

.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 system

### H

i no state in^{;}

### R

is reachable from an initial state of### H

.### 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

or### k

^{}

### x

, for a variable### x

^{2}Var and an integer constant

### k

^{2}Z. 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.

Let### H

be a simple multirate timed system. We translate### H

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 clock### x

in location invariants and transition guards with### k

x^{}

### x

. Given a valuation of### H

, let the valuation sc() be such that sc()(### x

) =### k

x^{}(

### x

) for all skewed clocks### x

and sc()(### p

) =(### p

) for all propositions### p

; moreover, sc(### `;

) = (### `;

sc()). It is not dicult to check that there is a run of### H

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 machine### M

. For the 2-rate timed system### H

, 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 clock### y

is zero initially, and is reset whenever it reaches 1. The### i

-th conguration of the machine### M

is encoded by the state of### H

at time### i

. The location of### H

encodes the program counter of### M

, and the values of two accurate clocks### x

^{1}and

### x

^{2}encode the counter values: the counter value

### n

is encoded by the clock value 1### =

2^{n}.

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 clock### x

is 1### =

2^{n}, that is, suppose that the clock

### x

is reset to 0 at time### i

^{;}1

### =

2^{n}. Suppose the value of the counter encoded by

### x

stays unchanged. Then simply reset### x

to 0 when its value reaches 1 (that is, at time (### i

+ 1^{;}1

### =

2^{n})); the value of

### x

at time### i

+ 1 will then be 1### =

2^{n}. To increment the counter represented by

### x

, reset an accurate clock### z

when the value of### x

reaches 1, then nondeterministically reset both### x

and a skewed clock### z

^{0}in the interval (

### i

+ 1^{;}1

### =

2^{n}

### ;i

+ 1) and test### z

=### z

^{0}at time

### i

+ 1. The equality test ensures that the value of the skewed clock### z

^{0}is 1

### =

2^{n}at time

### i

+ 1, and hence, the value of### x

is 1### =

2^{n}

^{+1}at time

### i

+ 1.To decrement the counter represented by

### x

, nondeterministically reset an accurate clock### z

in the interval (### i

^{;}1

### ;i

^{;}1

### =

2^{n}), reset a skewed clock

### z

^{0}simultaneously with

### x

at time### i

^{;}1

### =

2^{n}, and test

the condition

### z

=### z

^{0}at time

### i

. This ensures that the value of### z

at time### i

is 1### =

2^{n}

^{;1}. Then resetting the clock

### x

when the value of### z

reaches 1 ensures that the value of### x

is 1### =

2^{n}

^{;1}at time

### i

+ 1.Thus, the runs of

### H

encode the runs of### M

, and the halting problem for### M

is reduced to a reachability problem for### H

.### 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

### `

^{2}Loc and a set of valuations

### P

^{}

### V

, the forward time closure^{h}

### P

^{i}

^{%}

_{`}of

### P

at### `

is the set of valuations that are reachable from some valuation^{2}

### P

by letting time progress:^{0}

^{2}

^{h}

### P

^{i}

^{%}

_{`}i

^{9}

^{2}

### V;t

^{2}R

^{0}

### :

^{2}

### P

^{^}tcp

_{`}[](

### t

)^{^}

^{0}=

### '

`[](### t

)### :

Thus, for all valuations

^{0}

^{2}

^{h}

### P

^{i}

^{%}

_{`}, there exist a valuation

^{2}

### P

and a nonnegative real### t

^{2}R

^{0}such that (

### `;

)^{!}

^{t}(

### `;

^{0}).

Given a transition

### e

= (### `;a;;`

^{0}) and a set of valuations

### P

^{}

### V

, the postcondition post_{e}[

### P

] of### P

with respect to### e

is the set of valuations that are reachable from some valuation^{2}

### P

by executing the transition### e

:^{0}

^{2}post

_{e}[

### P

] i^{9}

^{2}

### V:

^{2}

### P

^{^}(

### ;

^{0})

^{2}

### :

Thus, for all valuations

^{0}

^{2}post

_{e}[

### P

], there exists a valuation^{2}

### P

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}

^{2}

### P

^{g}; we write (

### `;

)^{2}(

### `;P

) i^{2}

### P

. The forward time closure and the postcondition can be naturally extended to regions: for### R

=^{S}

_{`}

^{2Loc}(

### `;R

`),h

### R

^{i}

^{%}=

^{[}

`^{2L}^{oc}(

### `;

^{h}

### R

`^{i}

^{%}` ) post[

### R

] =^{[}

e^{=(}`;`^{0}^{)2Edg}(

### `

^{0}

### ;

post_{e}[

### 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 transition

### e

i from### `

i to### `

i^{+1}and

### P

i^{+1}= post

_{e}

^{i}[

^{h}

### P

i^{i}

^{%}`

^{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!}

^{t}

^{0}(

### `

^{1}

### ;

^{1})

^{7!}

^{t}

^{1}

^{}

^{}

^{}

such that (

### `

i### ;

i)^{2}(

### `

i### ;P

i) for all### i

^{}0. Besides, every run of

### H

is represented by some symbolic run of### H

.Given a region

### I

^{}, the reachable region (

### I

^{7!}

^{})

^{}of

### I

is the set of all states that are reachable from states in### I

:^{2}(

### I

^{7!}

^{}) i

^{9}

^{0}

^{2}

### I:

^{0}

^{7!}

^{}

### :

Notice that

### I

^{}(

### I

^{7!}

^{}).

The following proposition suggests a method for computing the reachable region (

### I

^{7!}

^{}) of

### I

.### Proposition 4.1

Let### I

=^{S}

_{`}

^{2Loc}(

### `;I

`) be a region of the linear hybrid system### H

. The reachable region (### I

^{7!}

^{}) =

^{S}

_{`}

^{2Loc}(

### `;R

`) is the least xpoint of the equation### X

=^{h}

### I

^{[}post[

### X

]^{i}

^{%}

or, equivalently, for all locations

### `

^{2}Loc, the set

### R

` of valuations is the least xpoint of the set of equations### X

` =^{h}

### I

`^{[}

^{[}

e^{=(}`^{0};`^{)2Edg}post_{e}[

### 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 if### P

is denable by a linear formula; that is,### P

= [[ ]] for some linear formula . If Var contains### n

variables, then a linear set of valuations can be thought of as a union of polyhedra in### n

-dimensional space.### Lemma 4.1

For all linear hybrid systems### H

, if### P

^{}

### V

is a linear set of valuations, then for all locations### `

^{2}Loc and transitions

### e

^{2}Edg, both

^{h}

### P

^{i}

^{%}

_{`}and post

_{e}[

### P

] are linear sets of valuations.Given a linear formula , we write ^{h} ^{i}^{%}_{`} and post_{e}[ ] for the linear formulas that dene the
sets of valuations ^{h}[[ ]]^{i}^{%}_{`} and post_{e}[[[ ]]], respectively.

Let pc ^{62} Var be a control variable that ranges over the set Loc of locations and let

### R

=S`^{2L}^{oc}(

### `;R

`) be a region. The region### R

is linear if for every location### `

^{2}Loc, the set

### R

` of valuations is linear. If the sets### R

` are dened by the linear formulas `, then the region### R

is dened by the linear formula= ^{_}

`^{2Loc}(pc =

### `

^{^}`);

that is, [[ ]] =

### R

. Hence, by Lemma 4.1, for all linear hybrid systems, if### R

is a linear region, then so are both^{h}

### R

^{i}

^{%}and post[

### R

].Using Proposition 4.1, we compute the reachable region (

### I

^{7!}

^{}) of a region

### I

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 equations

1 = ^{h}

### x

=### y

=### z

= 0^{_}post

^{(2}

_{;}

^{1)}[

^{2}]

^{i}

^{%}

^{1}

2 = ^{h}false^{_} post^{(1}_{;}^{2)}[ ^{1}]^{i}^{%}^{2}
which can be iteratively computed as

1;i = ^{1};i^{;1}^{_} ^{h}post^{(2}_{;}^{1)}[ ^{2};i^{;1}]^{i}^{%}^{1}

2;i = ^{2};i^{;1}^{_} ^{h}post^{(1}_{;}^{2)}[ ^{1};i^{;1}]^{i}^{%}^{2}

where ^{1};^{0} =^{h}

### x

=### y

=### z

= 0^{i}

^{%}

^{1}= (

### x

^{}1

^{^}

### y

=### x

=### z

) and^{2};

^{0}= false. For

### i

= 1, we have1;^{1} = ^{1};^{0}^{_} ^{h}post^{(2}_{;}^{1)}[ ^{2};^{0}]^{i}^{%}^{1}

= ^{1};^{0}

2;^{1} = ^{2};^{0}^{_} ^{h}post^{(1}_{;}^{2)}[ ^{1};^{1}]^{i}^{%}^{2}

= ^{h}post^{(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 all### i

^{}2,

1;i= ^{1};i^{;1}^{_}

### x

^{}1

^{^}0

^{}

### z

^{;}

### x

^{}

### i

^{^}30

### i

+### z

^{}

### y

and2;i= ^{2};i^{;1}^{_}

### y

^{}

### i

+ 1^{^}30

### i

+### 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

^{_}

^{9}

### i

^{}1

### :

(### x

^{}1

^{^}0

^{}

### z

^{;}

### x

^{}

### i

^{^}30

### i

+### z

^{}

### y

)= (

### x

^{}1

^{^}

### x

=### y

=### z

)^{_}(

### x

^{}1

^{^}

### x

^{}

### z

^{^}

### y

+ 30### x

^{}31

### z

)2 =

### z

^{}1

^{^}

### y

=### x

+### z

^{^}

### x

^{}0

^{_}

^{9}

### i

^{}1

### :

(### z

^{}

### i

+ 1^{^}30

### i

+### x

+### z

^{}

### y

)= (

### z

^{}1

^{^}

### y

=### x

+### z

^{^}

### x

^{}0)

^{_}

### y

^{}

### x

+ 31### z

^{;}30

This 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

^{)}20

### z

^{}

### 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 of### R

.Given a location

### `

^{2}Loc and a set of valuations

### P

^{}

### V

, the backward time closure of### P

at### `

is the set of valuations from which it is possible to reach some valuation^{2}

### P

by letting time progress:^{0}

^{2}

^{h}

### P

^{i}

^{.}

_{`}i

^{9}

^{2}

### V;t

^{2}R

^{0}

### :

=### '

`[^{0}](

### t

)^{^}

^{2}

### P

^{^}tcp

_{`}[

^{0}](

### t

)### :

Thus, for all valuations

^{0}

^{2}

^{h}

### P

^{i}

^{.}

_{`}, there exist a valuation

^{2}

### P

and a nonnegative real### t

^{2}R

^{0}such that (

### `;

^{0})

^{!}

^{t}(

### `;

).Given a transition

### e

= (### `;a;;`

^{0}) and a set of valuations

### P

^{}

### V

, the precondition pre_{e}[

### P

] of### P

with respect to### e

is the set of valuations from which it is possible to reach a valuation^{2}

### P

by executing the transition### e

:^{0}

^{2}pre

_{e}[

### P

] i^{9}

^{2}

### V:

^{2}

### P

^{^}(

^{0}

### ;

)^{2}

### :

Thus, for all valuations

^{0}

^{2}pre

_{e}[

### P

], there exists a valuation^{2}

### P

such that (### `;

^{0})

^{!}

^{a}(

### `

^{0}

### ;

).The backward time closure and the precondition can be naturally extended to regions: for

### R

=S`^{2L}^{oc}(

### `;R

`),h

### R

^{i}

^{.}=

^{[}

`^{2L}^{oc}(

### `;

^{h}

### R

`^{i}

^{.}` ) pre[

### R

] =^{[}

e^{=(}`^{0};`^{)2Edg}(

### `

^{0}

### ;

pre_{e}[

### R

`])Given a region

### R

^{}, the initial region (

^{7!}

^{}

### R

)^{}of

### R

is the set of all states from which a state in### R

is reachable:^{2}(

^{7!}

^{}

### R

) i^{9}

^{0}

^{2}

### R:

^{7!}

^{}

^{0}

### :

Notice that### R

^{}(

^{7!}

^{}

### R

).The following proposition suggests a method for computing the initial region (^{7!}^{}

### R

) of### R

.### Proposition 4.2

Let### R

=^{S}

_{`}

^{2Loc}(

### `;R

`) be a region of the linear hybrid system### H

. The initial region### I

=^{S}

_{`}

^{2Loc}(

### `;I

`) is the least xpoint of the equation### X

=^{h}

### R

^{[}pre[

### X

]^{i}

^{.}

or, equivalently, for all locations

### `

^{2}Loc, the set

### I

` of valuations is the least xpoint of the set### X

` =^{h}

### R

`^{[}

^{[}

e^{=(}`;`^{0}^{)2Edg}pre_{e}[

### X

`^{0}]

^{i}

^{.}

_{`}of equations.

### Lemma 4.2

For all linear hybrid systems### H

, if### P

^{}

### V

is a linear set of valuations, then for all locations### `

^{2}Loc and transitions

### e

^{2}Edg, both

^{h}

### P

^{i}

^{.}

_{`}and pre

_{e}[

### P

] are linear sets of valuations.It follows that for all linear hybrid systems, if

### R

is a linear region, then so are both^{h}

### R

^{i}

^{.}and pre[

### R

]. Given a linear formula , we write^{h}

^{i}

^{.}

_{`}and pre

_{e}[ ] for the linear formulas that dene the sets of valuations

^{h}[[ ]]

^{i}

^{.}

_{`}and pre

_{e}[[[ ]]], respectively.