16
Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations ? Oleg Botchkarev ?? and Stavros Tripakis The University of California at Berkeley 195M Cory Hall Berkeley CA 94720 Phone: (510) 642-5649, Fax: (510) 642-6330 {olegb,stavros}@eecs.berkeley.edu Abstract. A general verification algorithm is described. It is then shown how ellipsoidal methods developed by A. B. Kurzhanski and P. Varaiya can be adapted to the algorithm. New numerical algorithms that com- pute approximations of unions of ellipsoids and intersections of ellip- soids and polyhedra were developed. The presented techniques were im- plemented in the verification tool called VeriSHIFT and some practical results are discussed. Keywords: hybrid systems, verification, reachability analysis, ellipsoidal approximations. 1 Introduction A number of application domains, such as car manufacturing, robotics, chem- ical process control, or avionics, involve controllers , consisting of: (a) a set of sensors and actuators , representing the interface between the controller and its environment; (b) a control logic (implemented as one or more circuits or as one or more pieces of software running concurrently), which represents the way the controller should act on the environment. A promising model for describing such systems is hybrid automata [8]. Hybrid automata are finite-state machines equipped with continuous variables. Each discrete state of an automaton has a system of differential equations that govern its continuous variables. Most correctness criteria for such systems can be stated as a safety property: the system must never reach an “unsafe” (or a “bad”) state. Ensuring correctness of the model is often not a trivial task. Simulation of the system is not adequate, since it can only help examine a limited number of tra- jectories. Analytical methods are often not applicable, considering the complex interaction of continuous and discrete dynamics. An alternative is reachability analysis . It consists of computing the set of all reachable states of the system and ? Research supported by National Science Foundation Grant ECS 9725148 and ONR Contract 11 ?? Corresponding author. N. Lynch and B. Krogh (Eds.): HSCC 2000, LNCS 1790, pp. 73–88, 2000. c Springer-Verlag Berlin Heidelberg 2000

[Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

  • Upload
    bruce-h

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems

with Linear Differential InclusionsUsing Ellipsoidal Approximations ?

Oleg Botchkarev?? and Stavros Tripakis

The University of California at Berkeley195M Cory Hall Berkeley CA 94720

Phone: (510) 642-5649, Fax: (510) 642-6330{olegb,stavros}@eecs.berkeley.edu

Abstract. A general verification algorithm is described. It is then shownhow ellipsoidal methods developed by A. B. Kurzhanski and P. Varaiyacan be adapted to the algorithm. New numerical algorithms that com-pute approximations of unions of ellipsoids and intersections of ellip-soids and polyhedra were developed. The presented techniques were im-plemented in the verification tool called VeriSHIFT and some practicalresults are discussed.

Keywords: hybrid systems, verification, reachability analysis, ellipsoidalapproximations.

1 Introduction

A number of application domains, such as car manufacturing, robotics, chem-ical process control, or avionics, involve controllers, consisting of: (a) a set ofsensors and actuators, representing the interface between the controller and itsenvironment; (b) a control logic (implemented as one or more circuits or as oneor more pieces of software running concurrently), which represents the way thecontroller should act on the environment.

A promising model for describing such systems is hybrid automata [8]. Hybridautomata are finite-state machines equipped with continuous variables. Eachdiscrete state of an automaton has a system of differential equations that governits continuous variables. Most correctness criteria for such systems can be statedas a safety property: the system must never reach an “unsafe” (or a “bad”) state.

Ensuring correctness of the model is often not a trivial task. Simulation of thesystem is not adequate, since it can only help examine a limited number of tra-jectories. Analytical methods are often not applicable, considering the complexinteraction of continuous and discrete dynamics. An alternative is reachabilityanalysis . It consists of computing the set of all reachable states of the system and? Research supported by National Science Foundation Grant ECS 9725148 and ONR

Contract 11?? Corresponding author.

N. Lynch and B. Krogh (Eds.): HSCC 2000, LNCS 1790, pp. 73–88, 2000.c© Springer-Verlag Berlin Heidelberg 2000

Page 2: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

74 O. Botchkarev and S. Tripakis

then checking that no “bad” state belongs to the reachable set. The reachabilityproblem has been shown to be undecidable, even for models of hybrid automatawith simple dynamics (e.g., x ∈ [a, b]). Moreover, the so-called state explosionproblem (the machine representation of the set of reachable states is too large)often limits the applicability of the method, even for decidable sub-classes of themodel.

Approximations have been used as a remedy to both the undecidability andthe state-explosion problems. Computing an over- or under-approximation (i.e.,external or internal approximation) of the exact set of reachable states can be,first, decidable, and second, less expensive, in terms of time and memory. Theprice to pay is accuracy: what does it mean for a “bad” state to be reachable inthe approximative analysis?

This paper presents a new reachability technique for systems of hybrid au-tomata with linear dynamics, expressed as differential inclusions : x ∈ Ax + U .The basic model of hybrid automaton and its semantics are presented in sec-tion 2.

The algorithm performs reachability analysis for bounded time. Reachabil-ity for bounded time means that the set of states reachable in ∆ time units iscomputed, where ∆ is a parameter supplied by the user. The skeleton of the algo-rithm, correctness, and trade-offs between accuracy and efficiency are discussedin section 3. A generalization of the algorithm is presented in [1].

The algorithm is based on the ability to approximate: (a) the reachable setof a linear differential inclusion (time propagation); (b) intersections of convexsets; (c) unions of convex sets; (d) linear transformations and geometric sums ofconvex sets.

Among methods of reachability analysis are those based on ellipsoidal tech-niques. The presented work is an attempt to use some of the methods describedin [5,6].

New methods for computing over-approximations of unions of ellipsoids andintersections of ellipsoids and polyhedrons have also been devised. They arepresented in section 4.

These reachability techniques have been implemented in a prototype toolcalled VeriSHIFT (section 5). The tool accepts systems of hybrid automata,communicating by input/output variables and synchronous message passing.Dynamic creation and reconfiguration of automata is also supported.

2 The Model

In this section we present the model of a single hybrid automaton. We considerthe extension to systems of communicating hybrid automata in [1].

Preliminaries Let R be the set of real numbers, Rm×n the set of m × n realmatrices, Cn the set of convex closed subsets of Rn, and Cb

n the set of convexcompact subsets of Rn. Bn

ε (x), the ball of dimension n with center x and radiusε, is defined to be the convex set {y ∈ Rn | |x − y| ≤ ε}.

Page 3: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 75

Given a set P ∈ Cn and a matrix A ∈ Rm×n, AP is the linear transformationof P , that is, a set from Cm defined as AP = {Ax | x ∈ P}.

Given two sets P1, P2 ∈ Cn, let P1 + P2 denote the geometric (Minkowski)sum of P1, P2, defined as:

P1 + P2 = {x | ∃x1 ∈ P1, x2 ∈ P2, x = x1 + x2}.

A flow in Rn is defined as a triple F : (A, I, U), where A ∈ Rn,n and I ∈C, U ∈ Cb

n. F defines the following system of differential equations:

x(t) = Ax(t) + u(t)x(t) ∈ I, u(t) ∈ U.

Given points x0, x1 ∈ Rn, we say that x1 is F -reachable from x0 at time t,denoted x0

t F x1, if there exist functions of time x(·) and u(·) such that x(0) =x0, x(t) = x1, and for all τ ∈ [0, t], x(τ) ∈ I, u(τ) ∈ U and x(τ) = Ax(τ)+u(τ).

Given a set X0 ∈ Cbn, the reachable set of flow F from X0 at time t, denoted

XF (X0, t), is the set of all points that are F -reachable from points of X0 at timet.

A Hybrid Automaton. We define a hybrid automaton A with linear differentialinclusions to be a tuple (Q, X, F, T, G, R), where:

– Q is a finite set of discrete states (or locations , or modes).– X is a set of n continuous variables taking values in R.– F : Q → Rn×n×Cn×Cb

n associates with each discrete state q a flow (A, I, U).I is called the invariant of q and will be denoted as I(q).

– T ⊆ Q × Q is a set of discrete transitions .– G : T → Cn associates with each discrete transition a guard .– R : T → Rn×n ×Cb

n associates with each transition a pair (B, P ). This pairdefines the reset of the continuous variables1: x := Bx + P .

Given a discrete state q, let out(q) be its set of out-going transitions , {(q, q′) ∈T }.

We now turn to the semantics of a hybrid automaton like A. A state of A isa pair (q, x) ∈ Q × Rn such that x ∈ I(q).

Given a state (q, x) and a delay δ ∈ R, we say that there is a time transitionfrom (q, x) to a state (q, y), denoted (q, x) δ (q, y), if x

δ F (q) y.Given a state (q, x) and a discrete transition a = (q, q′) ∈ T , such that

R(a) = (B, P ), we say that there is a discrete jump from (q, x) to a state (q′, y),denoted (q, x) a−→ (q′, y), if x ∈ G(a), y ∈ I(q′) and y ∈ Bx + P .

1 If P contains a single point, P = {y} the reset is deterministic, that is, each x ismapped to a unique x′ = Bx + y. If P is not a singleton, then the reset is non-deterministic.

Page 4: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

76 O. Botchkarev and S. Tripakis

Reachability. Given a set of initial states S0, we say that a state s is reachablefrom S0 if there exists s0 ∈ S0 and a sequence

s0δ1 s′1

a1−→ s1δ2 s′2

a2−→ · · · δk s′k (1)

such that s′k = s. The sequence (1) and the corresponding trajectory of continu-ous variables x(·) is called an execution of the hybrid automaton, and k is calledthe length of the execution. We say that s is reachable from S0 in time ∆ if

δ1 + δ2 + · · · + δk ≤ ∆.

Given a discrete state q, we say that q is reachable from S0 (in time ∆) ifthere exists a state (q, x) which is reachable from S0 (in time ∆).

3 Reachability Using Convex Approximations

Given an automaton A and a set S0 of initial states, we want to verify whethera discrete state qbad is not reachable from S0 in time ∆.

In this section we describe the skeleton of the reachability algorithm. Thealgorithm is based on the ability to: (a) effectively represent convex compactsets X ∈ Cb

n; (b) compute an over-approximation X+F (X0, t) ⊇ XF (X0, t) of

the reachable set of a linear flow F from a convex compact set X0 at time t;(c) check whether the intersection of two convex sets is non-empty; (d) computeover-approximations of intersections, unions and geometric sums2 of convex sets;(e) compute linear transformations of convex sets. Section 4 deals with points(a) – (d) in detail. In this section, we assume that an effective representation ofconvex sets and the above operations are available. First we present the basicstructure of the reachability algorithm. Then we discuss alternatives and theirimpact on accuracy and efficiency.

3.1 The Basic Algorithm

The algorithm maintains a table T of tuples of the form: (q, X, τ), where q ∈ Q,X ∈ Cb

n and τ ∈ [0, ∆]. (q, X, τ) is supposed to represent a set of unexploredstates (q, x), x ∈ X . A state s = (q, x) is unexplored in the sense that qbad mightbe reachable from s in time ∆ − τ . An invariant of the algorithm is that if astate (q, y) is reachable in time ∆ then at some point the table will contain atuple (q, X, τ), where τ ≤ ∆ and, either y ∈ X , or there exist x ∈ X and t ∈ R

such that xt F (q) y.

T is initialized to S0 (the set of initial states), such that for all (q, X, τ) ∈T , τ = 0. The algorithm essentially repeats three steps. First, it chooses anunexplored tuple (q, X, τ). Second, it propagates X in time, until time reaches2 The geometric sum P1 + P2 can be computed exactly if at least one of P1, P2 is a

singleton. Consequently, the reset of a set X, BX + P , can be computed exactly ifthe reset is deterministic (i.e., P is a singleton).

Page 5: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 77

∆; meanwhile, it computes the intersection of the reachable tube from X witheach of the out-going guards of q. Third, for each intersection V with a guard,the algorithm computes the reset of V with respect to the corresponding discretetransition, and adds a new (unexplored) tuple to the table.

The second step involves computing the reachable set of F (q) from X attime t, for t ∈ [0, ∆− τ ]. Since it is not possible to compute this set for infinitelymany time values, we have to discretize time, that is, we compute X+

F (X0, t) fort = kδ, where k = 0, ..., d∆−τ

δ e. The time step δ is a parameter of the algorithm,given by the user. In order not to “miss” a guard during the propagation of Xin discrete time steps, we “enlarge” the reachable set at each time step by a ballof radius ε (see step 2, below). ε can be effectively computed as a function ofF (q) and δ, so that correctness of the over-approximation is ensured:

Lemma 1. The following estimate is true for all t ∈ [0, δ]:

XF (X0, t) ⊆ X0 + Bε(0) (2)

where XF (X0, t) denotes the reachable set of differential inclusion

F : x ∈ Ax + U, U ∈ Cbn,

Bε(0) ∈ Cbn is a ball of radius ε with the center in 0, and

ε = (eNAδ − 1)D + eNAδNUδ,

NA = ‖A‖ = max‖x‖=1

‖Ax‖,

D = maxx∈X0

‖x‖, NU = maxu∈U

‖u‖.

Proof To ensure that inclusion (2) holds it is enough to take ε equal to theHausdorff semidistance between X0 and XF (X0, t):

ε = h+(XF (X0, t), X0) = maxy∈XF (X0, t)

minx∈X0

‖x − y‖.

Then it is not difficult to see that h+(XF (X0, t), X0 + Bε(0)) = 0 which impliesXF (X0, t) ⊆ X0 + Bε(0).

Let us estimate this Hausdorff distance:

h+(XF (X0, t), X0) = maxy∈XF (X0, t)

minx∈X0

‖y − x‖

= maxy∈X0

maxu(·)∈U

minx∈X0

‖xF (y, t, u(·)) − x‖

≤ maxy∈X0

maxu(·)∈U

‖xF (y, t, u(·)) − y‖

= maxy∈X0

maxu(·)∈U

‖eAty − y +∫ t

0

eA(t−s)u(s)ds‖

≤ maxy∈X0

‖(eAt − I)y‖ + maxu(·)∈U

‖∫ t

0

eA(t−s)u(s)ds‖

Page 6: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

78 O. Botchkarev and S. Tripakis

≤ maxy∈X0

‖(eAt − I)y‖ +∫ t

0

maxu∈U

‖eA(t−s)u‖ds

≤ (eNA∆ − 1)D + eNA∆NU∆.

Now we are ready to detail the steps of the algorithm:

1. If the table T is empty, stop and announce that qbad is unreachable in time∆. Otherwise, if there exists a tuple (qbad, , ) ∈ T , stop and announce thatqbad is possibly reachable in time ∆. Otherwise, choose a tuple (q, X, τ) ∈ Twith minimal τ , remove it from the table and proceed to step 2.

2. Let (q, X, τ) be the tuple chosen in step 1, F =F (q) and out(q) = {a1, ..., al}.Also, for i = 1, ..., l, let ai = (q, qi), R(ai) = (Bi, Pi) and Gi = G(ai).(a) Compute X+

F (X0, kδ)+Bnε (0), for k = 0, ..., m, where m is the minimum

between d∆−τδ e and the smallest k ≤ d∆−τ

δ e such that(X+

F (X0, kδ) +Bn

ε (0))∩ I(q) = ∅.

(b) For each i = 1, ..., l, let ki be the first time the reachable set intersects theguard Gi, that is, ki = min{k | (0 ≤ k ≤ m) ∧ ((X+

F (X0, kδ) + Bnε (0)) ∩

Gi 6= ∅)}. If the reachable set never intersects Gi, we set ki = m + 1.Let τi = kiδ. If Bi 6= 0 (i.e., the reset is not constant), then we compute:

Vi ⊇m⋃

j=ki

((X+

F (X0, kδ) + Bnε (0)) ∩ Gi

). (3)

That is, Vi is (an over-approximation of) the union of intersections of thereachable set and the guard at times t ≥ τi. If Bi = 0 the computationof Vi is unnecessary.

3. For each τi ≤ ∆, computed at step 2, we add a tuple (qi, X ′i, τ + τi) to the

table T , where,X ′

i = Pi, if Bi = 0,X ′

i ⊇ BiVi + Pi, otherwise. (4)

Go back to step 1.

We should point out that in step 2(b), we do not need to compute (an over-approximation of) the intersection of the reachable set and the guard at eachtime step to check whether it is non-empty. Instead, we can have a procedurethat checks, given two convex sets, whether their intersection is non-empty. If itis, then we can compute it.

Correctness and Termination We now state the main properties of the algorithm.

Lemma 2. Let X0 ∈ Cn, G ∈ Cn, F : x(t) ∈ Ax + U - some linear flow andδ > 0. If ε is choosen accordingly to lemma (1), then

∆⋃τ=0

(X+F (X0, τ) ∩ G) ⊂

k⋃i=0

((X+F (X0, iδ) + Bε(0)) ∩ G), (5)

Page 7: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 79

wherek ∈ Z, (k − 1)δ < ∆ ≤ kδ.

The proof is a consequence of lemma (1).

Theorem 1. If the algorithm terminates doing reachability analysis of a hybridautomaton A for time horizon ∆ and reports that the state qbad is unreachable(step 1), and a state (q∗, x∗) is reachable at time t ≤ ∆ as result of a sequenceof time and discrete transitions ending with a discrete transition, then at somestep of execution the table T contained a tuple (q∗, X, τ) such that x∗ ∈ X andτ ≤ t.

Proof Let us suppose that

s0δ1

F (q0)s′1

a1−→ s1δ2

F (q1)· · · s′N−1

aN−1−→ sN−1δN

F (qN−1)s′N

aN−→ sN , (6)

sN−1 = (q′, x′), s′N = (q′, x′′), sN = (q∗, x∗), δ1 + δ2 + · · · + δN = t,

is an execution of length N that leads to the state (q∗, x∗) at time t. Let Gi

and Ri = (Bi, Pi) denote the guard set and the reset relation that correspondto transition q′ −→ q∗ in sequence (6).

The theorem is obviously true for the states that can be reached by executionsof length 0.

Suppose that the theorem is true for states that can be reached in time ∆ byexecutions of length N −1. Let us prove that it is true for executions of length Nas well. If the theorem is true for executions of length N − 1, then at some stepof execution the table T must contain a tuple r′ = (q′, X ′, τ ′) such that x′ ∈ X ′

and τ ′ ≤ δ1 + δ2 + · · ·+ δN−1 = t′. Since the tuple r′ appeared in the table, step2 of the algorithm was applied to it. Using lemma (2) we can conclude that theset Vi constucted by (3) contains the point x′′. Hence, the set X ′

i resulting fromthe reset relation (4) contains the point x∗. That proves the theorem.

Theorem 2. If the algorithm terminates and reports that the state qbad is un-reachable in time ∆ (step 1), then the state qbad is unreachable in time ∆.

The proof is a direct consequence of theorem (1).

Termination of the algorithm is not guaranteed for systems that may presentso-called zeno behavior: an infinite number of discrete jumps in a finite amount oftime. The following theorem states that termination is guaranteed when the time“consumed” by each loop of discrete transitions of the automaton is boundedfrom below by a positive number (in our case, at least by δ).

Theorem 3. If, for any loop a1 = (q1, q2), a2 = (q2, q3), ..., ak = (qk, q1) ∈ T ,there exists i ∈ [1, k] such that the following conditions are satisfied:

Page 8: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

80 O. Botchkarev and S. Tripakis

1. R(ai) = (0, P ), that is, the reset of ai is constant.2.

(P + Bn

ε (0))∩ G(ai+1) = ∅ (by convention, ak+1 is taken to be a1).

then the algorithm terminates.

The proof is quite obvious and is based in the fact that any cycle in the transitiongraph takes at least one intergration step δ.

3.2 Possible Modifications

Alternative choices could be made at some points in the algorithm. We discussthese possibilities below and comment on their impact on the accuracy and theefficiency of the algorithm.

1. If the table contains two tuples (q, X1, τ1) and (q, X2, τ2) with the samediscrete state, then we replace these tuples by a single tuple (q, X1 ∪ X2,min{τ1, τ2}). This decreases the size of the table and results in fewer tuplesto be explored. On the other hand, since we can only compute an over-approximation of the union X1 ∪ X2, the accuracy of the algorithm mightbe compromised. Correctness is not affected.

2. At step 1, instead of removing the chosen tuple (q, X, τ) from the tableT we mark the tuple explored . Only unexplored tuples are chosen in step1. Moreover, before adding to T a new (unexplored) tuple (q, X ′, τ ′), T issearched for a tuple (q, X ′′, τ ′′) such that X ′ ⊆ X ′′ and τ ′ ≥ τ ′′. If such atuple exists then (q, X ′, τ ′) is not added. The status of (q, X ′′, τ ′′) (exploredor not) is not changed. The correctness of the algorithm is not affected. Thesize of T could increase since explored tuples are not removed. On the otherhand, new tuples are not added to the table when not necessary, which resultsin fewer tuples to explore and shorter running time.

4 Ellipsoidal Approximations

The reachability algorithm described in the previous section can work with anyrepresentation of convex compact sets, as long as the operations used by thealgorithm can be performed effectively on the chosen representation.

The verification tool described here uses ellipsoidal techniques for approxi-mation and reachability analysis. One of the advantages of ellipsoidal methodsis that an ellipsoid in Cb

n can be described as a pair (x, P ) ∈ Rn ×Rn×n, that is,using only O(n2) space. Time complexity of ellipsoidal operations is also poly-nomial.3 The numerical methods that have been used are directly taken from orbased on the results described in publications [5,6].

In these works it is shown that ellipsoidal over-approximations of reachablesets can be expressed through ordinary differential equations with coefficientsgiven in explicit analytical form. Other results include parametric representa-tion of ellipsoidal over-approximations of geometric sums and intersections of3 As a comparison, the worst-case complexity of polyhedral operations is exponential.

Page 9: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 81

ellipsoids. The reader is referred to the above-mentioned publications for thedetails of the methods.

Here, we present new techniques that we have developed for operations onellipsoids and polyhedra and for unions of ellipsoids.

Definition of Ellipsoids Let 〈l, x〉, l, x ∈ Rn, denote the inner product of l andx. An ellipsoid E(p, P ), p ∈ Rn, P ∈ Rn×n, P = P ′ ≥ 0 4 is a convex compactset described by the support function5

ρ(l| E(p, P )) = 〈l, p〉 + 〈l, P l〉1/2.

If the matrix P is non-degenerate, the ellipsoid E(p, P ) can alternatively bedefined as a level set of a quadratic function:

E(p, P ) = {x | 〈x − p, P−1(x − p)〉 ≤ 1}.

Approximation of Unions of Ellipsoids The reachability algorithm of section 3uses union of convex sets in step 2(b), equation (3). Union is needed also iftuples (q, X1, τ1), (q, X2, τ2) ∈ T are replaced by a single tuple (q, X1 ∪ X2,min{τ1, τ2}), as described in one of the alternative heuristics. Here we describethe algorithm for over-approximating the union of two ellipsoids by an ellipsoid.Such an algorithm should be efficient, since it is likely to be the bottle neck ofthe basic verification algorithm. It should also exploit the fact that the reachableset changes only slightly in one time-propagation step.

Let us suppose that we want to approximate E(p, P )∪E(r, R), where P andR are non-degenerate matrices.

The algorithm builds an increasing sequence of ellipsoids:

E(p, P ) = E(p0, P0), E(p1, P1), ..., E(pk, Pk), (7)

until E(pk, Pk) ⊇ E(r, R).E(pi+1, Pi+1) is obtained from E(pi, Pi) as follows. Given Pi and R, we com-

pute matrices Li, Vi, Di and Si. Li is a lower triangular matrix that is theresult of Cholesky decomposition of the matrix P−1

i : LiL′i = P−1

i . Vi is amatrix of eigenvectors and Di is a diagonal matrix of eigenvalues of matrixCi = L−1

i R−1i L′

i−1 such that Ci = ViDiV

′i . We denote

Si = LiVi (8)

and yi = S′i(r − pi).

Then we find a vector x∗i that is the solution to the non-convex optimization

problemJi(x) = 〈x − yi, Di(x − yi)〉 → max

4 P ′ is the transpose of matrix P . Similarly, x′ is the transpose of vector x.5 The support function ρ(l|X) of X ∈ Cb

n is defined as ρ(l|X) = maxx∈X

〈l, x〉. Inversely,

a support function uniquely defines a convex compact set.

Page 10: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

82 O. Botchkarev and S. Tripakis

with the constraint ‖x‖ ≤ 1. In [12] it is shown how the problem can be solvedand it is proved that the result is the global maximum.

We will denote l∗i = S−1i

′x∗

i

‖S−1i

′x∗

i ‖.

If Ji(x∗i ) ≥ 1, it means that E(pi, Pi) ⊇ E(r, R) and the algorithm terminates.

If Ji(x∗i ) < 1, we compute:

pi+1 = S′i−1

(yi +

di

2x∗

i

)+ pi, (9)

and

Pi+1 = S′i−1

((1 + α−1

i )D−1i + (1 + αi)

d2i

4x∗

i x∗i′)

S−1i , (10)

wheredi = 1 −

√⟨x∗

i , D−1i x∗

i

⟩− 〈x∗

i , yi〉 + ε, (11)

αi =2√⟨

x∗i , D−1

i x∗i

⟩di 〈x∗

i , x∗i 〉

2 , (12)

and ε is any non-negative number.

Lemma 3. (See [5]) Let E1 = E(q1, Q1) and E2 = E(q2, Q2).

1. The ellipsoid E = E(q1 + q2, Q(β)), where β > 0 and

Q(β) = (1 + β−1)Q1 + (1 + β)Q2,

is properly defined and is an external approximation of the geometrical sumE1 + E2, i.e.

E1 + E2 ⊆ E(q1 + q2, Q(β))

for any β > 0.2. With vector l ∈ Rn, ‖l‖ = 1, given, the equality

p =

√〈Q1l, l〉〈Q2l, l〉

defines a scalar parameter p, such that

ρ(l| E(q1 + q2, Q(β))) = ρ(l| E(q1, Q1) + E(q2, Q2)).

(The approximation E(q1 + q2, Q(β)) touches the exact sum in direction l.)

Lemma 4. Given any ε > 0, for the ellipsoid E(pi+1, Pi+1) in sequence (7) thefollowing holds:

1.E(pi, Pi) ⊂ E(pi+1, Pi+1); (13)

Page 11: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 83

2.ρ(l∗i | E(pi+1, Pi+1)) = ρ(l∗i | E(r, R)) + ε. (14)

Proof The linear transformation

x′ = S′i(x − pi),

transforms the ellipsoid E(pi, Pi) into the unit ball E(0, In) = k{x| 〈x, x〉 ≤ 1}6, and transforms the ellipsoid E(r, R) into the ellipsoid E(yi, Di). The nextellipsoid in the sequence E(pi+1, Pi+1) as specified by (9) and (10) is the resultof the reverse transformation applied to the ellipsoid

E ′ = E(

yi +di

2x∗

i , (1 + α−1i )D−1

i + (1 + αi)d2

i

4x∗

i x∗i′)

which, according to lemma (3), is an external approximation of the sum

E(yi, Di) + E(

di

2x∗

i ,d2

i

4x∗

i x∗i′)

It is not difficult to see that 0 ∈ E(

di

2 x∗i ,

d2i

4 x∗i x

∗i′), which ensures that E ′ ⊇

E(yi, Di), and x∗i ∈ E

(di

2 x∗i ,

d2i

4 x∗i x

∗i′). Also, the choice of parameters αi and di

ensures that

ρ(x∗i | E(0, In)) + ε = ρ

(x∗

i

∣∣∣∣ E(yi, Di) + E(

di

2x∗

i ,d2

i

4x∗

i x∗i′))

= ρ(x∗i | E ′).

The later implies (14).

Theorem 4. For any ε > 0 the algorithm always terminates in a finite numberof steps.

Proof Because the support functions ρ(l| E(pi+1, Pi+1)) and ρ(l| E(r, R)) arecontinuous, for any ε > 0 there is δ > 0 such that for any l : ‖l − l∗i ‖ ≤ δ thefollowing inequality holds

ρ(l| E(pi+1, Pi+1)) > ρ(l| E(r, R)),

which means that no lj can belong to the set {l| ‖l− l∗i ‖ ≤ δ}. If at some step ljbelongs to this set, Jj(x∗

j ) > 1 and the algorithm terminates.There can be only a finite number of li : ‖li‖ = 1 such that for any i, j:

‖li − lj‖ > δ. Therefore, the algorithm always terminates in a finite number ofsteps.

In practice, if the ellipsoid E(p, P ) has to be extended just “slightly” in orderto contain E(r, R), which is the case when approximating the union of reachablesets at successive time steps, it is likely that the union algorithm terminatesafter a single step, i.e., E(p1, P1) ⊇ E(r, R).6 Here In ∈ Rn×n denotes the identity matrix

Page 12: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

84 O. Botchkarev and S. Tripakis

Intersections of Ellipsoids and Polyhedra Guards of discrete transitions are usu-ally given in terms of conjunctions of linear inequalities, which define a polyhe-dron. Here we discuss a method for approximating intersections of ellipsoids andpolyhedra.

In order to approximate the intersection of an ellipsoid E and a polyhedronH , we first compute ellipsoidal over-approximations of the intersection of E witheach of the facets of H . Then, we compute the intersection of the resultingellipsoids. Since each facet of H is a half-space, we now show how to approximatethe intersection of an ellipsoid and a half-space.

Theorem 5. Suppose that the ellipsoid

E(q, Q) = {x| 〈x − q, Q−1(x − q)〉 ≤ 1},

where Q = QT > 0, and the half-space

S = {x| 〈b, x〉 ≥ α}

have a non-empty intersection.

1. Then for any p ∈ [0, α′+12 ) the ellipsoid

E(q+(p), Q+(p)) = {x| 〈x − q+(p), Q−1+ (p)(x − q+(p))〉 ≤ 1}

is an external approximation of the intersection E(q, Q) ∩ S, where

q+(p) = q + pP−1e1, Q−1+ (p) = PCPT ,

andP = V D1/2B, e1 = (1, 0, ..., 0)T ,

C =

β1 0 · · · 00 β · · · 0...

.... . .

...0 0 · · · β

,

β1 =1

(p − 1)2, β =

α′ + 1 − 2p

(α′ + 1)(p − 1)2, α′ =

α − 〈b, q〉√〈b, b〉

, (15)

D =

λ1 0 · · · 00 λ2 · · · 0...

.... . .

...0 0 · · · λn

, V = (v1 v2 ... vn),

where λ1, ..., λn are eigenvalues of matrix Q−1 and v1, ..., vn are correspond-ing eigenvectors that are linearly independent and ‖vi‖ = 1, i = 1, n,

B = (b′ b2 b3 ... bn), b′ =1√〈b, b〉

D−1/2V T b,

{b2, b3, ..., bn} is an orthonormal basis of subspace {x| 〈x, b′〉 = 0}.

Page 13: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 85

2. The ellipsoid E(q+(p), Q+(p)) touches E(q, Q) at point

x∗ = BT D1/2V T (e1 − q). (16)

3. ⋂p∈[0, α′+1

2 )

E(q+(p), Q+(p)) = E(q, Q) ∩ S. (17)

Proof The fact that matrix Q (and Q−1 as well) is self-adjoint and positivedefinite gives us the following equalities:

V T V = V V T = I, BT B = BBT = I.

Also note thatQ−1 = V DV T .

Let us apply a linear transformation:

x = V D−1/2Bx′ + q, (18)

then the following holds:

〈x − q, Q−1(x − q)〉 =〈V D−1/2Bx′, Q−1V D−1/2Bx′〉 =〈x′, BT D−1/2V T Q−1V D−1/2Bx′〉 = 〈x′, x′〉.

Thus, transformation (18) converts the ellipsoid E(q, Q) to the unit ball

B0 = {x| 〈x, x〉 = 1}.

At the same time transformation (18) converts the half-space S to the half-space

S′={x′| 〈x′, BT D−1/2V T b〉≤ α−〈b, q〉}={x′| 〈x′, 1√〈b, b〉B

T D−1/2V T b〉≤ α′}.

Due to the selection of the matrix B:

1√〈b, b〉

BT D−1/2V T b = e1,

thusS′ = {x′| 〈x′, e1〉 ≥ α′}.

Now we take an ellipsoid that is defined by the matrix

C−1(p) =

β1 0 · · · 00 β · · · 0...

.... . .

...0 0 · · · β

,

Page 14: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

86 O. Botchkarev and S. Tripakis

where β1 and β are determined by (15) and center

c(p) = (p, 0, 0, ..., 0).

If p ∈ [0, α′+12 ) the ellipsoid is defined and it is not difficult to see that

E(c(p), C(p)) ⊃ B0 ∩ S′.

Moreover,E(c(p), C(p)) ∩ S′ = B0 ∩ S′

and the ellipsoid E(c(p), C(p)) touches B0 at point e1 = (1, 0, 0, ..., 0).It is not difficult to see also that

E(c(p), C(p)) ⊂ {(x1, 0, 0, ..., 0)|x1 ≥ 2p − 1}.

If p → α′+12 then 2p − 1 → α′. Also notice that if p = 0, E(c(p), C(p)) = B0.

Therefore ⋂p∈[0, α′+1

2 )

E(c(p), C(p)) = B0 ∩ S′.

If we apply the reverse transformation

x′ = BT D1/2V T (x − q),

to the ellipsoid E(c(p), C(p)), we will get the ellipsoid E(q+(p), Q+(p)) as de-fined above. Properties (16) and (17) will be satisfied and point e1 at whichE(c(p), C(p)) touches B0 will be converted to point x∗ as defined by (16) andellipsoids will touch each other at the point x∗.

Intersection Check The problem of checking whether two non-degenerate el-lipsoids E(p1, P1) and E(p2, P2) intersect is equivalent to a convex quadraticoptimization problem:

J(x) =⟨x − p1, P−1

1 (x − p1)⟩→ min

with constraint ⟨x − p2, P−1

2 (x − p2)⟩≤ 1.

If x∗ is the solution to the problem and J(x∗) > 1, then the ellipsoids do notintersect. Otherwise, they do intersect.

In order to check whether an ellipsoid and a polyhedron intersect, it is possibleto check whether the ellipsoid intersects with all half-spaces that form the facesof the polyhedron. If it does not intersect at least with one of them, the ellipsoiddoes not intersect the polyhedron. Of course, this method is quite coarse but itis simple and effective. If the intersection is actually empty and the above checkdid not find that out, that still can be discovered during computation of theintersection.

Page 15: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

Verification of Hybrid Systems with Linear Differential Inclusions 87

5 Implementaion of the Tool

The techniques are implemented in the verification tool called VeriSHIFT 7.The tool is a C++ library that consists of all necessary numerical algorithms:ellipsoidal and polyhedral 8 representation of convex sets and operations onthem, reachability algorithms, verification algorithms described in this paper,etc. The user of the tool writes C++ code in order to describe a model: foreach class of hybrid automaton the user writes a definition of a C++ classderived from the special class HybridObject provided by the library. The modelcan be defined in terms of high level notions such as discrete states, transitions,input/output continuous variables, events, bound convex sets, as described in [1].Each of above notions is defined as a class in the library. Actions taken upondiscrete transitions can be described as C++ functions.

The library provides the notion of discrete configuration also implementedas a class. A discrete configuration contains a set of objects with their discretestates, dataflow and configuration connections and is accompanied by a boundconvex set containing possible valuations of the continuous variables.

Together with discrete states, continuous variables and events classes describ-ing hybrid automata can contain variables of any possible C++ type includingother hybrid automata classes. There is only one requirement: classes have toable to create their copies in other discrete configurations. Objects within thesame discrete configuraion can use any mechanism provided by C++ for commu-nicating with each other as long as that does not interfere with the mechanismprovided by the VeriSHIFT library. In a function called upon a discrete tran-sition of an object the object can modify its private data, can create/destroyother objects or can call methods of other objects.

Execution of a typical program using VeriSHIFT starts with creating aninitial discrete configuration: creating an empty configuration, creating new ob-jects within the configuration, setting up connections between objects. Once theinitial configuration is set up, verification is started by calling a special libraryfunction.

In order to verify the properties of the model, the user can observe whatdiscrete states the objects enter or can assign special actions to transitions theyare interested in. Also it is possible to examine reachable sets of continuousvariables at any phase of the execution.

Acknowledgements

We would like to thank Alexander B. Kurzhanski and Pravin Varaiya for makingthis work possible.

7 The source code of the tool along with the documentation and examples can befound at http://robotics.EECS.Berkeley.EDU/~olegb/VeriSHIFT/

8 The Polyhedral Library 2.0 by Doran Wilde and Herve Le Verge has been used.

Page 16: [Lecture Notes in Computer Science] Hybrid Systems: Computation and Control Volume 1790 || Verification of Hybrid Systems with Linear Differential Inclusions Using Ellipsoidal Approximations

88 O. Botchkarev and S. Tripakis

References

1. Botchkarev O., Ellipsoidal Techniques for Verification of Hybrid Systems, 2000.Available at: http://robotics.eecs.berkeley.edu/~olegb/VeriSHIFT/.

2. Dang T. and Maler O., Reachability Analysis via Face Lifting. In T.A. Henzingerand S. Sastry (Eds), Hybrid Systems: Computation and Control , 96-109, LNCS1386, Springer, 1998.

3. Henzinger T, Ho P. and Wong-Toi H., HyTech: A Model Checker for Hybrid Sys-tems. In Software Tools for Technology Transfer, 1, 1997.

4. Kurzhanski A. B. and Filippova T. F., On the Theory of Trajectory Tubes: a Math-ematical Formalism for Uncertain Dynamics, Viability and Control, in: Advances inNonlinear Dynamics and Control, ser. PSCT 17, pp.122 - 188, Birkhauser, Boston,1993.

5. Kurzhanski A. B. and Valyi I. Ellipsoidal Calculus for Estimation and Control,Birkhauser, Boston, ser.SCFA, 1996.

6. Kurzhanski A. B. and Varaiya P., Ellipsoidal Techniques for Reachability Analysis,2000. Proceedings of this conference.

7. Puri A., Borkar V. and Varaiya P., ε-Approximations of Differential Inclusions,in: R.Alur, T.A.Henzinger, and E.D.Sonntag eds., Hybrid Systems, pp. 109 – 123,LNCS 1201, Springer, 1996.

8. Puri A. and Varaiya P., Decidability of Hybrid Systems with Rectangular Differ-ential Inclusions, in D.Dill ed., Proc. CAV’94, LNCS 1066, Springer, 1966.

9. Rockafellar, R. T., Convex Analysis, Princeton University Press, 1970.10. Varaiya P., Reach Set Computation Using Optimal Control, in Proc.of KIT Work-

shop on Verification of Hybrid Systems, Verimag, Grenoble, 1998.11. VeriSHIFT Home Page. http://robotics.EECS.Berkeley.EDU/~olegb/

VeriSHIFT/.12. Ye Y., On Affine Scaling Algorithms for Non-Convex Quadratic Programming. In

Mathematical Programming, 56(1992), pp. 285 – 300.