Verifying Linear Duration Constraints of Timed Automata - CiteSeerX

9 downloads 8064 Views 352KB Size Report
to strengthen all aspects of computer science teaching in universities in developing countries,. 5. .... We do this by introducing the different classes of Duration.
UNU/IIST International Institute for Software Technology

Verifying Linear Duration Constraints of Timed Automata Pham Hong Thai and Dang Van Hung June 2004

UNU-IIST Report No. 306

R

UNU-IIST and UNU-IIST Reports UNU-IIST (United Nations University International Institute for Software Technology) is a Research and Training Centre of the United Nations University (UNU). It is based in Macau, and was founded in 1991. It started operations in July 1992. UNU-IIST is jointly funded by the Governor of Macau and the governments of the People’s Republic of China and Portugal through a contribution to the UNU Endownment Fund. As well as providing two-thirds of the endownment fund, the Macau authorities also supply UNU-IIST with its office premises and furniture and subsidise fellow accommodation. The mission of UNU-IIST is to assist developing countries in the application and development of software technology. UNU-IIST contributes through its programmatic activities: 1. Advanced development projects, in which software techniques supported by tools are applied, 2. Research projects, in which new techniques for software development are investigated, 3. Curriculum development projects, in which courses of software technology for universities in developing countries are developed, 4. University development projects, which complement the curriculum development projects by aiming to strengthen all aspects of computer science teaching in universities in developing countries, 5. Schools and Courses, which typically teach advanced software development techniques, 6. Events, in which conferences and workshops are organised or supported by UNU-IIST, and 7. Dissemination, in which UNU-IIST regularly distributes to developing countries information on international progress of software technology. Fellows, who are young scientists and engineers from developing countries, are invited to actively participate in all these projects. By doing the projects they are trained. At present, the technical focus of UNU-IIST is on formal methods for software development. UNU-IIST is an internationally recognised center in the area of formal methods. However, no software technique is universally applicable. We are prepared to choose complementary techniques for our projects, if necessary. UNU-IIST produces a report series. Reports are either Research R , Technical T , Compendia C or Administrative A . They are records of UNU-IIST activities and research and development achievements. Many of the reports are also published in conference proceedings and journals. Please write to UNU-IIST at P.O. Box 3058, Macau or visit UNU-IIST’s home page: http://www.iist.unu.edu, if you would like to know more about UNU-IIST and its report series.

Chris George, Acting Director

UNU/IIST International Institute for Software Technology

P.O. Box 3058 Macau

Verifying Linear Duration Constraints of Timed Automata Pham Hong Thai and Dang Van Hung

Abstract This report aims at developing a technique for checking if a timed automaton satisfies a linear duration constraint on the automaton states. The constraints are represented in the form of linear duration invariants - a simple class of Chop-free Duration Calculus (DC) formulas. We prove that linear duration invariants of timed automata are discretisable, and reduce checking if a timed automaton satisfies a linear duration invariant to checking if the integer timed region graph of the original automaton satisfies the same linear duration invariant. The latter can be done with exhausted search on graphs. In comparison to the techniques in the literatures, our one is more powerful: it works for the standard semantics of DC and general form of timed automata while the others cannot be applied.

Pham Hong Thai is currently a PhD student at the faculty of Technology, Hanoi National University. He was a fellow of UNU-IIST from December 2003 to February 2004, and from September 1996 to May 1997. The topic for his PhD study is model checking for real-time systems. E-mail: [email protected]. Dang Van Hung is a Research Fellow at UNU/IIST. His research interests include Formal Techniques of Programming, Concurrent and Distributed Systems, Real-Time Systems. E-mail: [email protected]

c 2004 by UNU-IIST, Pham Hong Thai and Dang Van Hung Copyright °

Contents

i

Contents 1 Introduction

1

2 Preliminaries 2.1 Timed Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Linear Duration Invariants and Duration Properties . . . . . . . . 2.2.1 Models in Duration Calculus . . . . . . . . . . . . . . . . . 2.2.2 Linear Duration Properties and Linear Duration Invariants

. . . .

3 3 5 5 6

3 Discretisability of Linear Duration Invariants w.r.t. Timed Automata 3.1 ²-Digitising . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Discretisability of LDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7 7 11

4 Checking Linear Duration Invariants of Timed Automata with Graph Search 4.1 Integral Reachability Graph of Timed Automata . . . . . . . . . . . . . . . . . . 4.2 Relationship between Muv (A) ∩ MI (A) and Reachability Graph RG w.r.t. LDI D 4.3 Weighted Graph for Checking LDI . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Algorithm for Checking LDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12 12 15 18 21

5 Conclusion

22

Report No. 306, June 2004

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

UNU-IIST, P.O. Box 3058, Macau

Introduction

1

1

Introduction

Constraints on the durations of system states form a class of important properties of real-time systems. They can be formalised R by a class of simple chop-free Duration Calculus formulas of P the form a ≤ ` ≤ b ⇒ s∈S cs s ≤ M . This class was first introduced with the name linear duration invariants and investigatedR in [13]. The duration of a state s is a mapping from time R intervals to reals and is denoted by s. s, when applied to an observation time interval [b, e] is the accumulated time for the presence of state s over [b, e]; and the term ` when applied to an observation time interval [b, R e] returns the length e − b of the interval. A linear duration P invariant a ≤ ` ≤ b ⇒ s∈S cs s ≤ M simply says that for any observation time interval [b, e], if the length ` of the interval satisfies the constraint aP≤ ` ≤ bR then the durations of the system states over that interval should satisfy the constraint s∈S cs s ≤ M . A desired property for a simple gas burner “for any observation interval that is longer than 60 seconds, the ratio between the duration of the state leak and the length of the R interval should R not beR more than 5%” is represented as a linear duration invariant ` ≥ 60 ⇒ leak ≤ 5% ∗ ( leak + nonleak) (here we R R have used the equation leak + nonleak = `). A system safety saying that an unsafe state s R should not occur can also be represented by a linear duration invariant as ` ≥ 0 ⇒ s ≤ 0. The relative fairness of two R R processes p1 and p2 can be RrepresentedR by two linear duration invariants ` ≥ 0 ⇒ p1 .run − p2 .run ≤ 1 and ` ≥ 0 ⇒ p2 .run − p1 .run ≤ 1. This says that the running time of processes p1 and p − 2 are almost the same for any observation interval. Since timed automata are good models of real-time systems, and since linear duration invariants are important properties of real-time systems, it is interesting if verifying a linear duration invariant of a timed automata can be done automatically. In fact, this problem has attracted a great deal of attention during last decade, since the introduction of Duration Calculus in [12]. Many algorithms have been proposed in the literatures, but all of them have high complexity and do not work for the general case. Some restrictions are needed either on timed automata, or on linear duration invariants or on the meaning of the satisfaction of linear duration invariants by automata in order for those algorithms to apply. For example, in [5], a solution for checking a LDP of a timed automaton LDI is given using mixed integer and linear programming techniques. The authors have to put restrictions on both linear duration invariants and the meaning of satisfaction: the premise of LDIs should be true, i.e. there is no constraint on the length of the observation intervals, the coefficients in LDIs should be integral, and the observation intervals should start at time 0. In [13], a nice solution to the problem is given using linear programming technique only, but the authors had to restrict themselves on the real-time automata, i.e. timed automata with one clock which is reset by every transition. This solution is generalised in [7] and in [9] to a wider subclass of timed automata, but still cannot be used for the whole class of timed automata, and the restriction on the meaning of satisfaction still applied. In [3] the authors considered checking LDI for timed automata with observation intervals started at time 0 only, which is a restriction on the meaning of satisfaction. In general, these algorithms are based on symbolic representation of the behavior of the systems by extended time regular expressions, and hence, reduce the problem to a number of linear programming problems. In practice, the number of linear programming problems which

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Introduction

2

have to be solved is very large, so the time complexity of these algorithms is very high. For reducing the complexity of the problem, some other papers use a different approach. The authors of these papers considered those properties which are discretisable, i.e. they are satisfied by all the behaviours of a timed automata if and only if they are satisfied by all integral behaviors only. That means, we can check such kind of properties of a timed automaton by exploring the integral region graph of the automaton as in [11]. This technique is combined with linear programming technique in [8] for checking some other classes of discretisable properties. In these papers, the authors also had to enforce some restrictions on linear duration invariants and on observation intervals. In this paper, we study if we can remove the restrictions mentioned as above and develop a general technique to solve the problem for the general case. The idea on discretisability of LDPs in [11] is the motivation for the discretisability of LDIs in this paper. We prove that LDI is also a discretisable property for timed automata. However, the discretisability of LDI is used in this paper in a manner that is different from the one in [11]. In the sequel, we call a LDI having the premise equivalent to “true” (i.e. the premise can be removed) a linear duration property (LDP). In [11] the discretisability of LDP is used to reduce a region graph to an integral region graph, but in this paper the discretisability of LDI is used to approximate a real-time interval by integral-time interval as well. Our results are summarised as follows. We first define the different semantics for the satisfaction of a LDI by a timed automaton. We do this by introducing the different classes of Duration Calculus models defined by a timed automaton A: M0 (A) is the set of DC models generated by A with the observation intervals of the form [0, t], where t is a non negative real; M(A) is the set of DC models generated by A with no restriction on the observation intervals; Muv (A) is the set of DC models generated by A with the observation intervals of the form [tp , tq ], where tp and tq are the times the automaton enters states p and q, respectively, in the corresponding behaviour; and MI (A) is the set of DC models corresponding to the integral behaviours A with the integral observation intervals. Then, we prove that given a LDI D, M(A) |= D if and only if MI (A) |= D. Based on these results we reduce the problem of checking M(A) |= P to the one of checking p |= P for all path p in the zone graph of A, and we reduce the problem of checking M(A) |= D to the one of checking p |= D for all path p in the integral region graph of A. The resulting problem can be solved by standard exhausted search techniques. The paper is organized as follows. In the next section we recall some basic notions of timed automata and Duration Calculus formulas. In Section 3 we prove the discretisability of LDIs for timed automata. In Section 4, we propose an algorithm for checking a LDI of a timed automata by searching on the weighted graph constructed from the integral region graph of the automaton. Finally, Section 5 is the conclusion of this paper.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Preliminaries

2

3

Preliminaries

In this section, we recall some notions that will play the basic role in defining the problem in this paper. They are timed automata, region graphs, and Duration Calculus formulas in the form of Linear Duration Invariants (LDI).

2.1

Timed Automata

Timed automata was introduced in [1, 2] as formal models for real-time systems. Here we only give a brief description for timed automata and their behavior. Readers are referred to [1] for their more details. As usual, we denote by R+ and N the sets of nonnegative real numbers and natural numbers, respectively. For a a finite set of clock variables X, let Φ(X) be the set of clock constraints on X, which are conjunctions of the formulas of the form x ≤ c or c ≤ x, where x ∈ X and c ∈ N. A timed automaton is a finite state machine equipped with the set of clock variables X, and is defined as follows.

Definition 1 A timed automaton A is a tuple hL, s0 , Σ, X, E, Ii, where • L is a finite set of locations, • s0 ∈ L is an initial location, • Σ is a finite set of symbols (action names), • X is a finite set of clocks, • I is a mapping that assigns to each location s ∈ L a clock constraint I(s) ∈ Φ(X) which is called invariant of location s. Intuitively, the timed automaton only stays at s when the values of the clocks satisfy the invariant I(s). • E ⊆ L × Φ(X) × Σ × 2X × L is a set of switches. A switch hs, ϕ, a, λ, s0 i represents a transition from location s to location s0 with symbol a, where ϕ is a clock constraint over X that specifies the enabling condition of the switch, and λ ⊆ X gives the set of clocks to be reset with this switch.

A clock interpretation ν for the set of clock X is a mapping that assigns a nonnegative real value to each clock. For δ ∈ R, let ν + δ denote the clock interpretation which maps every clock x ∈ X to the value ν(x) + δ. For λ ⊆ X, let ν[λ := 0] denote the clock interpretation which assigns 0 to each x ∈ λ and agrees with ν over the rest of the clocks.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Preliminaries

4

Figure 1: A timed automaton.

A state of automaton A is a pair (s, ν) where s is a location of A and ν is a clock interpretation which satisfies invariant I(s). State (s0 , ν0 ) is initial state where s0 is initial location of A and ν0 is the clock interpretation for which ν0 (x) = 0 for all clocks x. A transition of A can: • change state by letting time elapse: For a state (s, ν) and a real-valued time increment δ

δ ≥ 0, (s, ν) → (s, ν + δ) if for all 0 ≤ δ 0 ≤ δ, ν + δ 0 satisfies invariant I(s). • change state by taking location switch : For a state (s, ν) and a switch hs, ϕ, a, λ, s0 i such a that ν satisfies ϕ and ν[λ := 0] satisfies I(s0 ) then (s, ν) → (s0 , ν[λ := 0]). A time elapsing transition and a following location switching transition can be combined into δ,a

one transition and denoted by (s, ν) → (s0 , ν 0 ). That means the system stays at location s with the current clock interpretation ν, after δ time units, the clock interpretation ν + δ satisfies the enabling condition (time constraint) ϕ of switch e = hs, ϕ, a, λ, s0 i, and the system transits to location s0 by taking e with label a and resets the clocks in the λ to 0, and the new state of the system is (s0 , ν 0 ). In this paper we consider only nonZeno behaviours of automata ([1, 2]), that is those behaviours for which in any finite time interval there is only a finite number of transition occurrences. Example 1 The timed automaton in Figure 1, taken from [4], have two clocks x and y. The set of locations is {s0 , s1 }, where invariants are I(s0 ) = (y ≤ 5) and I(s1 ) = (x ≤ 8 ∧ y ≤ 10). The set of switches is {hs0 , y ≥ 3, , a, {y}, s1 i , hs1 , x ≥ 6 ∧ y ≥ 4, b, {x}, s0 i}. The clock y is reset to 0 each time the automaton transits from s0 to s1 and the clock x is reset to 0 when the automaton transits from s1 to s0 . Definition 2 Let A be timed automaton. δ1 ,a1

1. A run or an execution r of A is an infinite sequence of state transitions: (s0 , ν0 ) → δ2 ,a2

(s1 , ν1 ) → . . ., where (s0 , ν0 ) is initial state of A.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Preliminaries

5

2. A behavior ρ correspondents to above run r, is the infinite sequence of timed locations ρ : (s0 , t0 )(s1 , t1 ) . . . (sm , tm ) . . . that satisfies following conditions • t0 = 0. • for any T ∈ R, there is some i ≥ 0 such that ti ≥ T . • ti is the moment that system enters to si , for all i ≥ 0. That means, δi = ti − ti−1 and A stays in state si−1 for ti − ti−1 time units and then transits to si in the run r. Note that in this paper, a behavior of a timed automaton is a sequence of time stamped locations instead of sequence of timed stamped switches as in other papers. However the semantics of timed automata is not changed. This way of representation of behaviours shows the DC models generated by them more explicitly. A run or a behavior is said to be integral iff for all i ≥ 0, the values of clock variables in νi , the time delay δi , and time stamps ti are integral.

2.2 2.2.1

Linear Duration Invariants and Duration Properties Models in Duration Calculus

Duration Calculus (DC) was introduced by Zhou Chaochen et al. in [12] as a logics to reason about the state duration of real-time systems. A comprehensive introduction to DC can be found in recent monograph [14]. In DC, a state is viewed as a boolean-valued function of the continuous time that has the value true (denoted by 1) at time t iff the state is present at t. Otherwise it take the value 0. An interpretation I of the system is an assignment that assigns to each system state s a boolean-valued function Is . A DC model consists an interpretation I and a time interval [b, e]. It represents an observation of the behavior of the system states in an interval of timeR[b, e]. Given an interpretation I, the duration of a state s over time interval e [b, e] is defined as b Is (t)dt, which is exactly the accumulated present time of s in the interval [b, e] by the interpretation I. In this paper we consider the set of DC models that express all the observations of the behaviours of a timed automaton. Each behavior ρ = (s0 , t0 )(s1 , t1 )(s2 , t2 ) . . . of timed automaton A defines uniquely an interpretation I in DC by: for any s ∈ L, Is (t) = 1 iff ∃i • (si = s ∧ t ∈ [ti , ti+1 )). We also denote such I by (s, t) in which s, t express sequence of si and ti from behaviour ρ. Hence, (s, t, [b, e]) is a DC model representing the observation of ρ in the interval [b, e], which is an observation of the timed automaton A over interval [b, e]. We also call (s, t, [b, e]) a DC model of A. Fig. 2 illustrates a DC model of a timed automaton. Let M(A) denote set of DC models of A. To cope with the different meanings of the satisfaction of a DC formula by A as said in the introduction of the paper, we introduced the following classes of DC models of A:

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Preliminaries

6

Figure 2: A DC model of timed automaton.

M0 (A) = {σ | σ = (s, t, [0, T ]) ∈ M(A), T ≥ 0}, Muv (A) = {σ | σ = (s, t, [tp , tq ]) ∈ M(A), tp , tq occur in t and tu ≤ tv }, MI (A) = {σ | σ = (s, t, [b, e]) ∈ M(A) and ti , b, e ∈ N, ∀i ≥ 0}. In the other word, M0 (A) is the set of models representing the observations starting from 0 and ending at any time point. Muv (A) consists of models that representing the observations starting and ending at those time points at which the automaton transits to a location, i.e. the observations between two location switching transitions. A DC model of A in MI (A) represents an observation of an integral behavior of A from an integer time point to an integer time point.

2.2.2

Linear Duration Properties and Linear Duration Invariants

Given a timed automaton A = hL, s0 , Σ, X, E, Ii. A linear duration invariant over L is a DC formula of the form Z m X D:A≤`≤B⇒ cs s ≤ M. s∈L

R where cs , A, B and M are real numbers, A ≤ B (B may be ∞). In D DC term s is a duration term denoting the duration of location s, and ` is a DC term denoting the interval length. P LDI RDe evaluates over a DC model I, [b, e] as tt and denoted by I, [b, e] |= D iff b − e ⇒ s∈L cs b Is (t)dt ≤ M evaluates to true (in the predicate calculus). Here we define the satisfaction of D by A directly on the behaviours of A as follows.

Definition 3 Let D be a LDI as above. For each σ = (s, t, [b, e]) ∈ M(A) we define l(σ) and θ(σ) as X l(σ) = e − b and θ(σ) = cs Ps s∈L

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Discretisability of Linear Duration Invariants w.r.t. Timed Automata

7

where Ps is the accumulated time for the presence of location s in the interval [b, e] and is calculated as follows. Let u and vPbe the indexes in t such that tu−1

0, (1 ≤ v ≤ n − 1). Then we have n X

1.

Ai ≤ 0 ⇒

i=1 n X

2.

n X

αi Ai ≤ 0

i=1

Ai ≥ 0 ⇒

i=1

n X

βi Ai ≥ 0

i=1

Proof:

1. Assume that

n X

Ai ≤ 0. Let Λ =

i=1

n X

αi Ai = α1 A1 + α2 A2 + . . . + αn An . As α1 ≤ α2 and

i=1

A1 > 0 so Λ ≤ α2 A1 + α2 A2 + . . . + αn An = α2 (A1 + A2 ) + α3 A3 + . . . + αn An . Similarly, as α2 ≤ α3 and A1 + A2 > 0 so Λ ≤ α3 (A1 + A2 + A3 ) + α4 A4 + . . . + αn An , and so on. Finally, we have Λ ≤ αn (A1 + A2 + . . . + An ) ≤ 0.

2. Assume that

n X

Ai ≥ 0. Let Λ =

i=1 ≥ β2 A1

n X

βi Ai = β1 A1 + β2 A2 + . . . + βn An . As β1 i=1 + βn An = β2 (A1 + A2 ) + β3 A3 + . . . + βn An .

≥ β2 and

A1 > 0 so Λ + β2 A2 + . . . Similarly, as β2 ≥ β3 and A1 + A2 > 0 so Λ ≥ β3 (A1 + A2 + A3 ) + β4 A4 + . . . + βn An , and so on. Finally we have Λ ≥ βn (A1 + A2 + . . . + An ) ≥ 0.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Discretisability of Linear Duration Invariants w.r.t. Timed Automata

9

2

Lemma 3 Let {ai }, {ti }, (i = 1..m) be two sequences of real numbers, where ti ≥ 0 for all i = 1, . . . , m. Then we can always find a real number ² ∈ [0, 1) such that m X i=1

ai ti ≤

m X

ai ti²

i=1

Proof: Let {f0 , f1 , f2 , . . . , fq } be a set of fractions of real numbers ti (i ∈ I = {1, 2, . . . , m}), such that 0 = f0 < f1 < f2 < . . . < fq < 1. Let Ik , (k = 0..q) be a set of indexes of ti ’s such that fraction X of ti equals to fk , that is Ik = {i ∈ I | δi = fk }, where δi stands for the fraction of ti . Let Ak = ai , (k = 0, 1, . . . , q). i∈Ik

Now let us partition the sequence {Ak }qk=1 into d + 1 successive segments {A1 , A2 , . . . , Ak1 }, {Ak1 +1 , Ak1 +2 , . . . , Ak2 }, . . . , {Akd−1 +1 , Akd−1 +2 , . . . , Akd }, {Akd +1 , Akd +2 , . . . , Aq } such that for each segment {Ai } (i = kj + 1..kj+1 ), the assumption on Ai ’s in Lemma 2 is satisfied. That is, the indexes k1 , k2 , . . . , kd are defined such that the sum of Ai ’s in each proper prefix of each segment is greater than 0 and the sum of all Ai ’s in each segment is less than or equal to 0. In general, the sum of all Ai ’s in the last segment (the (d + 1)th segment) is greater than 0. It is easily to see that the indexes k1 , k2 , . . . , kd can be found by the following procedure. i = 1; sum = 0; for (k = 1; k ≤ q; k++) { sum + = Ak ; if (sum ≤ 0){ki = k; sum = 0; i++; } } For simplicity, let p = kd . Let us consider the general case first, i.e. p (0 < p < q) divides sequence {Ak }qk=1 into two parts (none of them is empty). The first one consists of d segments, and the sum of Ai ’s of each segment is less than or equal to 0. The second one consists of rest Ai ’s (from Ap+1 to Aq ) and has the sum is a positive number. That is: ki+1

X

k=ki +1

Ak ≤ 0 (i = 0..d − 1), (ky convention k0 = 0) and

q X

Ak > 0

k=p+1

.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Discretisability of Linear Duration Invariants w.r.t. Timed Automata

10

ki+1

By applying Lemma 2 for all i = 0..d − 1 we have

X

fk Ak ≤ 0. Hence,

k=ki +1 d−1 kX i+1 X

q X

fk Ak ≤ 0, and

i=0 k=ki +1

(1 − fk )Ak > 0. This implies −

k=p+1

p X

fk Ak =

k=1 p X

q X

fk Ak +

k=1

(1 − fk )Ak > 0.

k=p+1

For proving the lemma, let ² = fp , we have • ti² = bti c = ti − δi if δi ≤ ² = fp , i.e. if i ∈ I1 ∪ I2 ∪ . . . ∪ Ip , and • ti² = dti e = ti − δi + 1 if δi > ² = fp , i.e. if i ∈ Ip+1 ∪ Ip+2 ∪ . . . ∪ Iq Therefore, m X

ai ti² −

i=1

= −f1

X

m X i=1

ai − . . . − fp

= −

X

fk Ak +

k=1

X

ai + +(1 − fp+1 )

ai + . . . + (1 − fq )

i∈Ip+1

X

ai

i∈Iq

(1 − fk )Ak > 0.

k=p+1

For the rest cases, if p = 0, we can see easily that if p = q, we have

ai (1 − δi )

i∈Ip+1 ∪...∪Iq

i∈Ip q X

X

ai δi +

i∈I1 ∪...∪Ip

i∈I1 p X

X

ai ti = −

m X

ai ti² −

i=1

So, finally we have

m X i=1

m X

a i ti = −

i=1

ai ti² ≥

m X

q X

m X i=1

ai ti² −

m X

q X (1 − fk )Ak > 0, and ai ti =

i=1

k=1

fk Ak > 0.

k=1

ai ti for all cases. The proof is complete.

2

i=1

Lemma 4 Let σ = (s, t, [b, e]) ∈ M(A) be a DC model of timed automaton A. Let s = s0 , s1 , . . . ; t = t0 , t1 . . . and tu−1 < b ≤ tu , tv ≤ e < tv+1 . Then for all ² ∈ [0, 1), σ² = (s, t² , [b² , e² ]) is an integral model of A, i.e. σ² ∈ MI (A), where t² = t0² , t1² , . . . . Proof: To prove that σ² is also a DC model of A we have to prove that (s0 , t0² )(s1 , t1² ) . . . is a behaviour of A.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Discretisability of Linear Duration Invariants w.r.t. Timed Automata

11

Figure 3: A case of discretising model σ

• Monotonicity of time: Let j ≥ i. As σ is a DC model of automaton A, we have tj ≥ ti . From Lemma 1, this implies tj² − ti² ≥ 0. • Progress of time: Let T be any integer. As σ is a behavior, it holds that ∃ti : ti ≥ T . This implies ti² ≥ T . • Consecutive Transitions: For all i > 0, we have to prove that ti² is a time point at which the automaton transits to si . In fact, due to the fact that σ is a model, at time point ti the automaton transits to si by some switch hsi−1 , ϕ, a, λ, si i. By induction, we can prove that hsi−1 , ϕ, a, λ, si i is also the switch A takes to transit to to si at time ti² in σ² . The proof is based on the following observation. Assume that ϕ consists of time constraints of the form a ≤ x ≤ b, and assume that tj is the time for the last reset of clock x before the automaton transits to state si in the model σ. Then, the value of x at time point ti is ti − tj in σ, and hence a ≤ ti − tj ≤ b. By Lemma 1, we also have a ≤ ti² − tj² ≤ b. Hence, by inductive hypothesis, tj² is also the time for the last reset of x in σ² , and the value of x at ti² is ti² − tj² which satisfies time constraint ϕ. 2 Of course, σ² is an integral behavior of A. Figure 3 illustrates digitising σ to σ² .

3.2

Discretisability of LDIs

Definition 6 Given a timed automaton A and a linear duration invariant D. D is said to be discretisable with respect to A if A |= D exactly when MI (A) |= D. Theorem 1 Any linear duration invariant D which has the premise A ≤ ` ≤ B in which A and B are integral, is discretisable with respect to timed automaton A (here we consider ∞ as an integer by our convention).

Proof: We have to prove that M(A) |= D ⇔ MI (A) |= D.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

12

The “only if” part is obvious because MI (A) ⊆ M(A). The “if” part is proved as follows. Let σ ∈ M(A) such that σ 6|= D. We prove that there exists ² ∈ [0, 1) such that σ² 6|= D, where σ² is the digitisation of σ w.r.t. ². Assume that σ = (s, t, [b, e]) with s = s0 , s1 , . . . and t = t0 , t1 , . . .. Let indexes u and v be such that tu−1 < b ≤ tu , tv ≤ e < tv+1 . σ 6|= D implies that A ≤ e − b ≤ B and θ(σ) > M . By the definition of LDI, it follows from equation (2): θ(σ) =

v X

ai ti + csv e − csu−1 b > M

i=u

From Lemma 3, ∃² ∈ [0, 1) such that follows from A ≤ e − b ≤ B that A ≤ σ² is an integral DC model of A, and

v X

ai ti² + csv e² − csu−1 b² ≥ θ(σ) > M . By Lemma 1 it i=u e² − b² ≤PB (notice that A, B are integers). By Lemma 4 θ(σ² ) = vi=u ai ti² + csv e² − csu−1 b² . Hence, θ(σ² ) > M .

Thus, we have obtained an integral model σ² which does not satisfy D.

2

Now that the assumption that two integral bounds A and B in the premise of LDIs is not too restricted, and the result can be extended to the case that A and B are rationals using the well-known technique. From this theorem, from now on we will consider only the integral DC models of timed automaton A, i.e. models σ = (s, t, [b, e]) ∈ MI (A).

4

4.1

Checking Linear Duration Invariants of Timed Automata with Graph Search Integral Reachability Graph of Timed Automata

In this section, we present a technique for partitioning the space of clock interpretations into regions. This technique was proposed by Alur and Dill in [1] and has become well-known. The main idea of the technique is to group clock interpretations into regions such that all interpretations in one region satisfy the same set of clock constraints. Hence, the states of system are also grouped into equivalence classes which are also called regions. The number of regions is finite. We will build a reachability region graph with vertices being regions, and equip vertices and edges with weight defined from D and A. By exploring the graph we can decide the satisfaction of a LDI by the original timed automata. Let Kx be the largest constant compared with the clock x ∈ X in the time constraints and the invariants of A and let K = max {Kx | x ∈ X} + 1. An equivalence relation restricted into the

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

13

set of all integral clock interpretations of A is defined as follows.

Definition 7 Let ν1 , ν2 be two integer clock interpretations. We say that ν1 is equivalent to ν2 and denoted by ν1 ∼ = ν2 iff for all x ∈ X either ν1 (x) = ν2 (x) or ν1 (x) ≥ Kx +1 ∧ ν2 (x) ≥ Kx +1. It is obvious that ∼ = is an equivalence relation on the set of integer clock interpretations of A. The equivalence class containing ν is denoted by [ν] and is called integral clock region. Every clock region can be characterized by a set of simple clock constraints of the form x = c or x ≥ Kx + 1, where c ≤ Kx . For our convenience, we assume that the clocks are enumerated as X = b {x1 , x2 , . . . , xk }, and we represent a clock region by a tuple [c1 , c2 , . . . , ck ], where ci is either the integral number in the constraint xi = ci or the symbol 0 ∗0 if the constraint for xi is xi ≥ Ki + 1 for that region. That means, a clock region [c1 , c2 , . . . , ck ] represents the set of clock interpretations ν = (v1 , v2 , . . . , vk ), where vi = ci if ci 6= 0 ∗0 and vi ≥ Ki + 1 if ci = 0 ∗0 . For example, [2, 0, ∗, 1] expressed a region containing clock interpretations of the form (2, 0, a, 1), where a ≥ K3 + 1. Similarly, [1, ∗, ∗] = {ν = (1, a, b) | a ≥ K2 + 1 ∧ b ≥ K3 + 1}. It is easy to see that number of integral clock regions is bounded by (K + 1)k (recall that k is number of clocks). Let us denote π0 = [0, 0, . . . , 0], and πK = [∗, ∗, . . . , ∗], i.e. π0 is the clock region containing the clock interpretation that assigns all clock variables to 0, and a πK contains infinite number of clock interpretations that assigns each clock variable xi to a value greater than Ki . Given a clock region π = [c1 , c2 , . . . , ck ] and an integer d ≥ 0. We define: • π + d is a clock region [c01 , c02 , . . . , c0k ], where c0i = ci + d if ci 6= 0 ∗0 and ci + d ≤ Ki , otherwise c0i = 0 ∗0 , for all i = 1..k. • π[λ := 0] is a clock region [c01 , c02 , . . . , c0k ], where c0i = 0 if xi ∈ λ and otherwise c0i = ci . ∼ ν2 then ν1 + d ∼ Note that, if ν1 = = ν2 + d for all d ≥ 0 and ν1 [λ := 0] ∼ = ν2 [λ := 0], for all 0 of time constraints λ. Hence, we can easily prove that if ν = ν + d then [ν 0 ] = [ν] + d and if ν 0 = ν[λ := 0] then [ν 0 ] = [ν][λ := 0], thus if ν 0 = (ν + d)[λ := 0] then [ν 0 ] = ([ν] + d)[λ := 0]. Besides, if there exists d ≥ 0 such that π + d = πK then π + d0 = πK for all d0 ≥ d. Due to π + K = πK for all π so π + d = πK for all π and d ≥ K. i.e. πK + d = πK with any d ≥ 0. For example, assume that K1 = 4, K2 = 1, K3 = 7, π = [1, ∗, 3], then π + 4 = [∗, ∗, 7], π + 5 = π + 6 = . . . = [∗, ∗, ∗]. Due to K = 8, for any π, π + 8 = π + 9 = . . . = [∗, ∗, ∗]. With λ = {x2 , x3 } we have π[λ := 0] = [1, 0, 0]. A region π is said to satisfy the time constraints ϕ iff every clock interpretation in it satisfies ϕ and is denoted by π |= ϕ. By the definition of ∼ =, π |= ϕ iff there is ν ∈ π such that ν |= ϕ.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

14

The equivalence relation ∼ = on the set of clock interpretations is extended to equivalence relation ≡ on the space of states of A as follows. Definition 8 Two states q1 = (s1 , ν1 ) and q2 = (s2 , ν2 ) of timed automaton A are regionequivalent (denoted by q1 ≡ q2 ) iff ν1 ∼ = ν2 and s1 = s2 . The equivalence relation ≡ partitions space of states of A into classes of states, each class is characterized by a couple of a location s and a clock region π and is denoted by hs, πi. We also call hs, πi a region. It is obvious that the number of regions is bounded by |L|(K + 1)k . Example 2 With timed automaton A in Figure 1, we have that the set of clock is X = {x, y}, and Kx = 8 and Ky = 10. Clock interpretations ν1 = (6, 11) and ν2 = (6, 15) are equivalent, and they are in the same region characterized by the tuple [6, ∗]. There are infinite number of elements in this region. Each element (a clock interpretation) is a tuple (6, a), where a ≥ Ky + 1 = 11. Hence, states (s0 , ν1 ) and (s0 , ν2 ) are equivalent, and their location is s0 . Given a region hs, πi and a switch e = hs, ϕ, a, λ, s0 i, we can calculate all of successor regions of hs, πi as follows. For each d = 0..K, if π + d |= (I(s) ∧ ϕ) and π 0 = (π + d)[λ := 0] |= I(s0 ) then d,a

hs0 , π 0 i will be successor of hs, πi and we denote this by hs, πi → hs0 , π 0 i. The property of equivalence relation ∼ = is translated into the following property for equivalence relation ≡, which says the correspondence between the integral behaviours of timed automaton A and the paths in the integral region graph of A: d,a

d,a

d,a

Lemma 5 If (s, ν) → (s0 , ν 0 ) then hs, [ν]i → hs0 , [ν 0 ]i, and reversely, if hs, πi → hs0 , π 0 i then for d,a

each ν ∈ π, there exists ν 0 ∈ π 0 such that (s, ν) → (s0 , ν 0 ). Based on the equivalence relation ≡, the integral reachability graph RG = (V, E) of the timed automaton A is built as follows. Each vertex v ∈ V is an region hs, πi. E is initialised to ∅, and V is initialised to {hs0 , π0 i}, where s0 is initial location of A and π0 is region with 0 as the value of all of clocks. Then, V is expanded as follows. If a vertex hs, πi ∈ V has a successor hs0 , π 0 i then hs0 , π 0 i is added into V and e = (hs, πi , hs0 , π 0 i) is an edge in E. Besides, each edge e is labelled by an interval [l(e), u(e)], where l(e) and u(e) are minimal and maximal integer time delay that automaton can stay at location s before transits into location s0 . l(e) and u(e) are defined as: n o d,a l(e) = inf d ≥ 0 | d ∈ N, hs, πi → hs0 , π 0 i , n o d,a u(e) = inf d ≥ 0 | d ∈ N, hs, πi → hs0 , π 0 i . From the definition of hs, πi and hs0 , π 0 i, either l(e) = u(e) or u(e) = ∞. We will denote a labeled edge e by (v, v 0 , [l, u]).

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

15

More precisely, graph RG can be built by the algorithm in Table 1.

Procedure Integral-Reachability-Graph; begin V := {hs0 , π0 i}; E := ∅; mark hs0 , π0 i as unexplored; while (true) do begin if all of vertexes in V are marked with “explored” then exit; let unexplored vertex v = hs, πi ∈ V; for each transition e = (s, ϕ, a, λ, s0 ) do for d = 0 to K do begin if (π + d) 6|= I(s) ∧ ϕ then goto loop; if (π + d)[λ := 0] 6|= I(s0 ) then goto loop; π 0 := (π + d)[λ := 0]; if hs0 , π 0 i 6∈ V then begin add hs0 , π 0 i into V; mark hs0 , π 0 i as unexplored end; if (hs, πi , hs0 , π 0 i) 6∈ E then begin add e = (hs, πi , hs0 , π 0 i) into E; if π + d 6= πK then l(e) := u(e) := d; else begin l(e) := d; u(e) := ∞; end; end; loop end; mark hs, πi as explored; end; end.

Table 1: Algorithm for building integral reachability graph of timed automata Figure 4 shows an integral reachability region graph of the timed automata in Figure 1. In this figure, labels of all of edges have lower bounds (l) equal to upper bounds (u), and hence, [l, u] in figure are replaced by l for short.

4.2

Relationship between Muv (A) ∩ MI (A) and Reachability Graph RG w.r.t. LDI D

As mentioned above, in this section we consider only integral models. The restriction of Muv (A) and M(A) on the integral DC models for A are Muv (A)I = b Muv (A) ∩ MI (A) and MI (A), respectively. Let RG be the reachability graph of A.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

16

Figure 4: An integral reachability region graph of timed automaton

Definition 9 Let p = v1 v2 . . . vm be a path in RG, and let d = d1 , d2 , . . . , dm−1 be a sequence of integers, where di ∈ [l(vi , vi+1 ), u(vi , vi+1 )], for i = 1..m − 1. The sequence ℘ = v1 d1 v2 d2 . . . vm−1 dm−1 vm (written as ℘ = (p, d) for short) is called weighted interpretation of p.

Definition 10 Pm−1 • Let ℘ = (p, d) be a weighted interpretation of path p. We define l(℘) = b b i=1 di and θ(℘) = Pm−1 i=0 cvi di and call them length and cost of ℘ respectively, where cvi is the coefficient csi in formula D when si is the location of vi . • A weighted interpretation ℘ is said to satisfy D, denoted by ℘ |= D, iff A ≤ l(℘) ≤ B ⇒ θ(℘) ≤ M • The graph RG is said to satisfy LDI D and is denoted by RG |= D iff ℘ |= D for all weighted interpretations ℘ of RG.

The following lemma plays a key role for our checking technique. Lemma 6 For any DC model σ ∈ Muv (A)I , there exists a weighted interpretation ℘ of RG such that l(σ) = l(℘) and θ(σ) = θ(℘), and vice versa.

Proof:

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

17

• Let σ = (s, t, [tu , tv ]) ∈ Muv (A)I . Then,  s = s0 . . . su . . . sv . . . ,      t = t0 . . . tu . . . tv . . . ,    v−1  X   l(σ) = t − t = (ti+1 − ti ), v u i=u   m v−1  X X    θ(σ) = c (tj+1 − tj ).  s i    i=1 j=u  sj =si

δu ,au

From the definition of model σ, σ corresponds to the sequence of transitions (su , νu ) → (su+1 , νu+1 )

δu+1 ,au+1



...

δv−1 ,av−1



(sv , νv ), where δi = ti+1 − ti , for all i = u..v − 1. δu+1 ,au+1

δu ,au

δv−1 ,av−1

By Lemma 5 we have: hsu , [νu ]i → hsu+1 , [νu+1 ]i → ... → hsv , [νv ]i. Consequently, the weighted interpretation ℘ = (p, d), where p = hsu , [νu ]i hsu+1 , [νu+1 ]i . . . hsv , [νv ]i and d = δ1 , δ2 , . . . , δv , satisfies the requirement of the lemma, i.e. l(℘) = l(σ), θ(℘) = θ(σ). • To prove the reverse direction, assume that ℘ = (p, d) is a weighted interpretation of RG, where p = vu vu+1 . . . vv , d is a sequence of integers du , du+1 . . . , dv , and vi = hs, πi i for i = u..v. Due to the fact that RG is a reachability graph of A, there exists sequence of δu+1 ,au+1

δu ,au

δv−1 ,av−1

switches ei (i = u..v − 1) such that hsu , πu i → hsu+1 , πu+1 i → ... → hsv , πv i. By Lemma 5 we can find model σ ∈ Muv (A), i.e sequence of clock interpretations νi ∈ πi δu ,au

such that (su , νu ) → (su+1 , νu+1 ) θ(σ) = θ(℘).

δu+1 ,au+1



...

δv−1 ,av−1



(sv , νv ). Hence, l(σ) = l(℘) and

2 This lemma allows us, instead of checking Muv (A) |= D, to check RG |= D which can be done by using popular searching techniques. Removing infinitive edges We now give some lemmas to simplify RG before doing search. Lemmas 7 and 8 say that the label [l, ∞) of an edge in RG either makes RG not satisfy D or can be replaced by a finite label [l, u] without any change to the result of checking RG |= D. Recall that the premise of LDI D is A ≤ ` ≤ B. Lemma 7 Assume that e = ((v, v0 ), [l, ∞)) is an infinite edge of region graph RG. Then if B = ∞ and cv > 0 then RG 6|= D. Proof: Let ℘ = (p, d) be a weighted interpretation where p contains only the edge e = ((v, v0 ), [l, ∞)), and d = max {A, d(M + 1)/cv e}. Therefore, we have l(℘) = d and θ(℘) = cv d. By the definition of d, we have A ≤ l(℘) < ∞ and θ(℘) ≥ M + 1 > M , i.e ℘ 6|= D, which implies RG 6|= D. 2

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

18

Lemma 8 Assume that e = ((v, v0 , [l, ∞)) is an infinite edge of RG. Then label [l, ∞) can be replaced as follows without any change to the result of checking RG |= D. • If B = ∞ and cv < 0, replace [l, ∞) by [l, u] with u = max{l, A}. • If B < ∞, replace [l, ∞) by [l, u] with u = max{l, B}.

Proof: We only have to prove that if there exists a weighted interpretation ℘ of RG such that ℘ contains edge (v, v0 , [l, ∞)) with weight d ∈ [l, ∞) and ℘ 6|= D then we can construct a weighted interpretation ℘0 such that it contains edge (v, v0 , [l, u]) with weight d0 ∈ [l, u] and ℘0 6|= D. It follows from ℘ 6|= D that A ≤ l(℘) ≤ B and θ(℘) > M . • When B < ∞, from A ≤ l(℘) ≤ B it follows d ≤ B, i.e. l ≤ d ≤ u. Thus, take ℘0 = ℘. • If B = ∞ and cv < 0 then u = max{l, A} ≥ A. If d ≤ u then take ℘0 = ℘. If d > u, let d0 = u, and let ℘0 be ℘ with d being replaced by d0 . We have d0 ∈ [l, u] and from d0 ≥ A we have A ≤ l(℘0 ) < ∞. Besides, because θ(℘0 ) = θ(℘) − cv (d − d0 ) with cv < 0 and d > d0 , θ(℘0 ) > θ(℘) > M holds. Hence ℘0 6|= D.

2 In summary, for checking Muv (A) |= D, we can apply the above lemmas first and either we discover Muv (A) 6|= D early or we can convert the infinite edges of RG into finite ones. From now on, we assume that RG does not contain infinitive edges.

4.3

Weighted Graph for Checking LDI

Similarly to checking LDP, we can also construct a weighted graph G from reachability graph RG (not containing infinitive edges) such that RG |= D if and only if G |= D. Weighted graph G = (V, E, ω) is constructed from RG = (VR , ER ) by the following procedure: Step 1. V := VR , E := ER . Step 2. For each edge e = ((vi , vj ), [lij , uij ]) ∈ ER , n o 1 , v2 , . . . , vuij −1 and ω(vk ) := c for all k = 0..u − 1 (where v0 = v and 1. V := V ∪ vij vi ij i ij ij ij ij u

vijij = vj ),

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

19

Figure 5: ”Discretising” graph of region graph.

2. E := E \ {e}, n o k+1 k k , vk+1 ) := 1 for all k = 0..u − 1, 3. E := E ∪ (vij , vij ) | k = 0..uij − 1 , and ω(vij ij ij n o k , v ) | k = l ..u − 1 , and ω(vk , v ) := 0 for all k = l ..u − 1. 4. E := E ∪ (vij j ij ij ij ij ij j Roughly speaking, G is built by ”splitting” each edge e = (v, v0 , [l, u]) of RG into u small edges with the length (weight) 1 by adding u − 1 sub-vertices. All of these sub-vertices and v are assigned a weight as the coefficient cs in LDI, where s is location of vertex v (s ∈ v). On the other hand, from sub-vertices vl to vu−1 there are edges joining these sub-vertexes to v0 of the edge e with length 0. Hence, from v we can reach v0 of the edge e through path passing through only sub-vertexes in G with the integer lengths between l and u. For the simplicity of presentation we call vertices v and v0 of edge e mother vertices and call the sub-vertexes in e child vertices. Besides, all the paths joining v and v0 that go through only child vertices of e (in RG) are also called paths belongs to e. Figure 5 gives an example how to build graph G from simple graph G0 with 2 edges. In order to make use of G, we have to show that G is compatible to RG w.r.t checking LDI. First, we define length, cost and satisfaction of a path p in G w.r.t LDI D.

Definition 11 Let p = v1 v2 . . . vm be a path in G. The length l(p) and the cost θ(p) of p are defined as m−1 m−1 X X l(p) = b ω(vi , vi+1 ), θ(p) = b ω(vi )ω(vi , vi+1 ). i=1

i=1

A path p satisfies D iff A ≤ l(p) ≤ B ⇒ θ(p) ≤ M . Lemma 9 Each integral weighted interpretation ℘ = (p, d) of RG corresponds to a path p0 in G such that l(℘) = l(p0 ), θ(℘) = θ(p0 ), and reversely, each path p0 in G corresponds to an integral weighted interpretation ℘ = (p, d) of RG such that l(℘) = l(p0 ), θ(℘) = θ(p0 ).

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

20

Proof: It is obvious from the definition of G that for each edge (vi , vj , [l, u]) of RG and an integer 1 . . . vd v of G such that l(p) = d, θ(p) = c d and vice-versa. d ∈ [l, u] there exists a path p = vi vij vi ij j Hence, the lemma is correct. 2 From Lemma 9 we can conclude that if there exists an integral model σ ∈ Muv (A) not satisfying LDI D then there exists a path that joins mother vertexes of G and does not satisfy LDI and reversely. A similar result for any integral model of A and any path (joining two child vertexes) of G is formulated by following lemma. Lemma 10 Given timed automaton A, a LDI D and weighted graph G as above. Then if there exists a path p ∈ P(G) such that p 6|= LDI then there exists an integral model σ ∈ MI (A) such that σ 6|= LDI and vice-versa. Proof: Assume that there exists a path p ∈ P(G) (from child vertex x to child vertex y) and p 6|= LDI. Let vu and vv be the mother vertexes that respectively appear first and last in p. In general a path p is of the form p1 p2 p3 where p1 is a path consisting of child vertexes joining x to vu and belongs to edge (vu−1 , vu ) in G, p2 is a path from vu to vv and p3 is a path joining vv to y and belongs to edge (vv , vv+1 ) in G (see figure 6). From Lemmas 5 and 9 for p2 there exists integral model σ 0 = (s, t, [tu , tv ]) ∈ MI (A), such that l(σ 0 ) = l(p2 ) and θ(σ 0 ) = θ(p2 ). Integral model σ = (s, t, [b, e]) is obtained from σ 0 by extending observation bounds tu , tv to b = tu −l(p1 ) and e = tv +l(p3 ), we have l(σ) = e−b = tv −tu +l(p1 )+l(p3 ) = l(p1 )+l(p2 )+l(p3 ) = l(p). Similarly, we can prove that θ(σ) = (tu −b)csu−1 +θ(σ 0 )+(e−tv )csv = θ(p1 )+θ(p2 )+θ(p3 ) = θ(p). Hence if p 6|= LDI then we have σ 6|= LDI. Reversely, let σ = (s, t, [b, e]) ∈ MI (A) be a integral model that does not satisfy LDI. So, σ expresses the observation interval from time point b to e of sequences of time-stamped locations (s0 , t0 ), (s1 , t1 ) . . ., where δi = ti+1 − ti , i ≥ 0 is time duration automaton stays at si before transits to si+1 . Moreover, there exist indexes u, v such that tu−1 < b ≤ tu and tv ≤ e < tv+1 . Let σ 0 be integral model (s, t, [tu , tv ]) (see figure 6). By the definition of l(σ) and θ(σ), from the assumption σ 6|= D, we have ½

A ≤ (tu − b) + l(σ 0 ) + (e − tv ) ≤ B csu−1 (tu − b) + θ(σ 0 ) + csv (e − tv ) > M

(3)

The above constraints are equivalent to ½

A − (tu − b) − (e − tv ) ≤ l(σ 0 ) ≤ B − (tu − b) − (e − tv ) θ(σ 0 ) > M − csu−1 (tu − b) − csv (e − tv )

(4)

By Lemmas 5 and 9, there exists a weighted interpretation ℘ = vu du vu+1 du+1 . . . dv−1 vv in G, where vi 3 si , di ∈ N (i = u..v − 1) such that:

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Checking Linear Duration Invariants of Timed Automata with Graph Search

21

Figure 6: A path in weighted graph G.

½

A − (tu − b) − (e − tv ) ≤ l(℘) ≤ B − (tu − b) − (e − tv ) θ(℘) ≥ θ(σ 0 ) > M − csu−1 (tu − b) − csv (e − tv )

(5)

By Lemma 9 there exists a path in G corresponding to ℘, i.e there exists path p2 joins vu and vv such that l(p2 ) = l(℘), θ(p2 ) = θ(℘). Hence: ½

A − (tu − b) − (e − tv ) ≤ l(p2 ) ≤ B − (tu − b) − (e − tv ) θ(p2 ) > M − csu−1 (tu − b) − csv (e − tv )

(6)

From the sequence of locations s in model σ we can easily prove that there exist edge (vu−1 , vu ) and (vv , vv+1 ) in RG (vu−1 3 su−1 , vv+1 3 sv+1 ). Let path p1 belongs to edge (vu−1 , vu ) joining to vu and have the length tu − b, and let p3 belongs to edge (vv , vv+1 ) from vv and have the length e − tv in G. The remaining that we have to prove is the existence of p1 , p3 . In fact, p1 , p3 are sequence of tu − b + e − tv edges with length 1. We have tu − b ≤ tu − tu−1 ≤ uu−1 and similarly e − tv ≤ tv+1 − tv ≤ uv , where uu−1 and uv are upper bounds of edges (vu−1 , vu ) and (vv , vv+1 ) respectively. Hence, from the construction of G, both p1 and p3 exist. In summary, we have l(p) = l(p1 ) + l(p2 ) + l(p3 ) and θ(p) = θ(p1 ) + θ(p2 ) + θ(p3 ). It easily to see l(p1 ) = tu − b, θ(p1 ) = csu−1 (tu − b), l(p3 ) = e − tv and θ(p3 ) = csv (e − tv ). Combining with equalities in 6 we have A ≤ l(p) ≤ B and θ(p) > M , i.e. p 6|= D. 2 Theorem 2 Checking the satisfaction of LDI D by timed automaton A is equivalent to checking the satisfaction of LDI D by the set of paths P(G). That is, A |= D if and only if P(G) |= D. This theorem follows immediately Lemma 10 and the discretisability of LDI w.r.t timed automata A.

4.4

Algorithm for Checking LDI

In this section we present the idea an algorithm for checking A |= D based on traversing the weighted graph G. The algorithm uses procedure Traverse(vstart) and procedure Checking-

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Conclusion

22

LDI. The procedure Traverse(vstart) explores every path starting from fixed vertex vstart to see if it satisfies D, and the procedure Checking-LDI calls procedure Traverse(vstart) for all vertices vstart ∈ V for deciding satisfaction of D by A. The procedure Traverse(vstart) uses back tracking technique to explore the graph. Starting from vertex vstart of G, the procedure constructs the current path p (l(p) and θ(p) = 0 initialised to 0) while going along out-going edges to their destination vertexes at which l(p) and θ(p) are re-calculated and A ≤ l(p) ≤ B ⇒ θ(p) < M is verified. The procedure goes back when the current path p cannot be expanded (see the next paragraph how a path can be expanded) or the length of current path exceeds B, and terminates when either A ≤ l(p) ≤ B ⇒ θ(p) < M is violated or it goes back to the starting vertex vstart with no more out-going edge to go. The current path p cannot be expanded when there is no new out-going edge to go when the number of repetitions of cycles has reached the limit. This applies only when B = ∞. When a positive cycle is discovered, i.e. a cycle p0 (which is a sub-path of p) with θ(p0 ) > 0, the procedure returns A 6|= D. When there is no positive cycle in p, p cannot be expanded when the number of cycle repetitions has reached k = d A−c 4c e, where c is the length of the shortest cycles in p. Any more repetition of a cycle will make θ(p) smaller. So, there is no need to check with expansion of p by more repetitions of cycles. So, either there is a positive cycle in G, or eventually, either p will become not expandable, or l(p) > B will be reached for a path p starting from vstart. So, the procedure Traverse(vstart) will terminate eventually. The detailed technical construction of the algorithm can be worked out easily, and is omitted here.

5

Conclusion

Exploring reachability graphs is one of popular methods for checking reachability property and some properties concerning time instants of real time systems. However, paths in the reachability graph do not preserve time durations of system locations, and hence, cannot be used for checking duration properties. By equipping edges of reachability graphs with the minimal and maximal bounds of state transitions, we are able to use this technique for checking duration properties. We have proposed an algorithm for checking LDI of timed automata using this technique. our algorithm has the same time-complexity as the algorithm presented in [11]. In this paper we have proved the discretisability of LDI, and proposed an algorithm based on this result to check if a timed automaton satisfies a IDI in the general semantics. Although the complexity of this algorithm is high, it can serve, at least, for showing that checking LDI of time automata is decidable. We do believe that checking is feasible for some specific LDI and abstract timed automata.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

References

23

References [1] R. Alur and D.L. Dill. A Theory of Timed Automata. Theoretical Computer Science, pp. 183–235, 1994. [2] R. Alur. Timed Automata. Proceedings of 11th International Conference on ComputerAided Verification, LNCS 1633, pp. 8–22, Springer-Verlag, 1999. [3] Victor A. Braberman and Dang Van Hung. On Checking Timed Automata for Linear Duration Invariants. Technical Report 135, UNU/IIST, P.O.Box 3058, Macau, February 1998. Proceedings of the 19th Real-Time Systems Symposium RTSS’98, December 2–4, 1998, Madrid, Spain, IEEE Computer Society Press 1998, pp. 264–273. [4] E. Clarke, O. Grumberg, and D. Peled. Model Checking. The MIT Press, Cambridge, Massachusetts, 1999. [5] Y. Kesten, A. Pnueli, J Sifakis, and S. Yovine. Integration Graphs: A Class of Decidable Hybrid Systems. In Hybrid Systems, volume 736 of Lecture Notes in Computer Science, pages 179–208. Springer Verlag, 1994. [6] Thomas A. Henzinger, Zohar Manna and Amir Pneuli. Towards Refining Temporal Specifications into Hybrid Systems, Hybrid Systems I, LNCS 736,Springer-Verlag, 1993. [7] Li Xuan Dong and Dang Van Hung. Checking Linear Duration Invariants by Linear Programming. Research Report 70, UNU/IIST, P.O.Box 3058, Macau, May 1996. Published in Joxan Jaffar and Roland H. C. Yap (Eds.), Concurrency and Parallelism, Programming, Networking, and Security LNCS 1179, Springer-Verlag, Dec 1996, pp. 321–332. [8] Li Yong and Dang Van Hung. Checking Temporal Duration Properties of Timed Automata. Technical Report 214, UNU/IIST, P.O.Box 3058, Macau, October 2001. Published in Journal of Computer Science and Technology, Vol. 17, No. 6, Nov. 2002. pp. 689 – 698. [9] Pham Hong Thai and Dang Van Hung. Checking a Regular Class of Duration Calculus models for Linear Duration Invariants. Technical Report 118, UNU/IIST, P.O.Box 3058, Macau, July 1997. Proceedings of the International Symposium on Software Engineering for Parallel and Distributed Systems (PDSE’98), Kyoto, Japan, 20 – 21, April 1998. Bernd Kramer, Naoshi Uchihira, Peter Croll and Stefano Russo (Eds). IEEE Press 1998, pp. 61 – 71. [10] S. Tripakis, S. Yovine. Analysis of timed systems based on time-abstracting bisimulations. Formal Methods in System Design, 18, 25–68, 2001. Kluwer Academic Publishers, Boston. [11] Zhao Jianhua and Dang Van Hung. Checking Timed Automata for Some Discretisable Duration Properties. Technical Report 145, UNU/IIST, P.O.Box 3058, Macau, August 1998. Published in Journal of Computer Science and Technology, Volume 15, Number 5, September 2000, pp. 423–429. [12] Zhou Chaochen , C.A.R. Hoare, and Anders P. Ravn. A calculus of durations. Information Processing Letters, 40(5):269–276, 1991.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

References

24

[13] Zhou Chaochen, Zhang Jingzhong, Yang Lu, and Li Xiaoshan. Linear Duration Invariants. Research Report 11, UNU/IIST, P.O.Box 3058, Macau, July 1993. Published in: Formal Techniques in Real-Time and Fault-Tolerant systems, LNCS 863, 1994. [14] Zhou Chaochen and Hansen M. R., Duration Calculus. A Formal Approach to Real-Time Systems, Springer, 2004.

Report No. 306, June 2004

UNU-IIST, P.O. Box 3058, Macau

Suggest Documents