Region (model checking)

From HandWiki

In model checking, a field of computer science, a region is a convex polytope in [math]\displaystyle{ \mathbb R^d }[/math] for some dimension [math]\displaystyle{ d }[/math], and more precisely a zone, satisfying some minimality property. The regions partition [math]\displaystyle{ \mathbb R^d }[/math].

The set of zones depends on a set [math]\displaystyle{ K }[/math] of constraints of the form [math]\displaystyle{ x\le c }[/math], [math]\displaystyle{ x\ge c }[/math], [math]\displaystyle{ x_1\le x_2+c }[/math] and [math]\displaystyle{ x_1\ge x_2+c }[/math], with [math]\displaystyle{ x_1 }[/math] and [math]\displaystyle{ x_2 }[/math] some variables, and [math]\displaystyle{ c }[/math] a constant. The regions are defined such that if two vectors [math]\displaystyle{ \vec x }[/math] and [math]\displaystyle{ \vec x' }[/math] belong to the same region, then they satisfy the same constraints of [math]\displaystyle{ K }[/math]. Furthermore, when those vectors are considered as a tuple of clocks, both vectors have the same set of possible futures. Intuitively, it means that any timed propositional temporal logic-formula, or timed automaton or signal automaton using only the constraints of [math]\displaystyle{ K }[/math] can not distinguish both vectors.

The set of region allows to create the region automaton, which is a directed graph in which each node is a region, and each edge [math]\displaystyle{ r\to r' }[/math] ensure that [math]\displaystyle{ r' }[/math] is a possible future of [math]\displaystyle{ r }[/math]. Taking a product of this region automaton and of a timed automaton [math]\displaystyle{ \mathcal A }[/math] which accepts a language [math]\displaystyle{ L }[/math] creates a finite automaton or a Büchi automaton which accepts untimed [math]\displaystyle{ L }[/math]. In particular, it allows to reduce the emptiness problem for [math]\displaystyle{ \mathcal A }[/math] to the emptiness problem for a finite or Büchi automaton. This technique is used for example by the software UPPAAL.[1]

Definition

Let [math]\displaystyle{ C=\{x_1,\dots,x_d\} }[/math] a set of clocks. For each [math]\displaystyle{ x\in\mathbb N }[/math] let [math]\displaystyle{ c_x\in\mathbb N }[/math]. Intuitively, this number represents an upper bound on the values to which the clock [math]\displaystyle{ x }[/math] can be compared. The definition of a region over the clocks of [math]\displaystyle{ C }[/math] uses those numbers [math]\displaystyle{ c_x }[/math]'s. Three equivalent definitions are now given.

Given a clock assignment [math]\displaystyle{ \nu }[/math], [math]\displaystyle{ [\nu] }[/math] denotes the region in which [math]\displaystyle{ \nu }[/math] belongs. The set of regions is denoted by [math]\displaystyle{ \mathcal R }[/math].

Equivalence of clocks assignment

The first definition allow to easily test whether two assignments belong to the same region.

A region may be defined as an equivalence class for some equivalence relation. Two clocks assignments [math]\displaystyle{ \nu_1 }[/math] and [math]\displaystyle{ \nu_2 }[/math] are equivalent if they satisfy the following constraints:[2]:{{{1}}}

  • [math]\displaystyle{ \nu_1(x)\sim c }[/math] iff [math]\displaystyle{ \nu_2(x)\sim c }[/math], for each [math]\displaystyle{ x\in C }[/math] and [math]\displaystyle{ 0\le c\le c_x }[/math] an integer, and ~ being one of the following relation =, < or .
  • [math]\displaystyle{ \{\nu_1(x)\}\sim \{\nu_1(y)\} }[/math] iff [math]\displaystyle{ \{\nu_2(x)\}\sim \{\nu_2(y)\} }[/math], for each [math]\displaystyle{ x,y\in C }[/math], [math]\displaystyle{ \nu_1(x)\le c_x }[/math], [math]\displaystyle{ \nu_1(y)\le c_y }[/math], [math]\displaystyle{ \{r\} }[/math] being the fractional part of the real [math]\displaystyle{ r }[/math], and ~ being one of the following relation =, < or .

The first kind of constraints ensures that [math]\displaystyle{ \nu_1 }[/math] and [math]\displaystyle{ \nu_2 }[/math] satisfies the same constraints. Indeed, if [math]\displaystyle{ \nu_1(x)=0.5 }[/math] and [math]\displaystyle{ \nu_2(x)=1 }[/math], then only the second assignment satisfies [math]\displaystyle{ x=1 }[/math]. On the other hand, if [math]\displaystyle{ \nu_1(x)=0.5 }[/math] and [math]\displaystyle{ \nu_2(x)=0.6 }[/math], both assignment satisfies exactly the same set of constraint, since the constraints use only integral constants.

The second kind of constraints ensures that the future of two assignments satisfy the same constraints. For example, let [math]\displaystyle{ \nu_1=\{x\mapsto 0.5, y\mapsto 0.6\} }[/math] and [math]\displaystyle{ \nu_2=\{x\mapsto 0.5, y\mapsto 0.4\} }[/math]. Then, the constraint [math]\displaystyle{ y=1\land x\lt 1 }[/math] is eventually satisfied by the future of [math]\displaystyle{ \nu_1 }[/math] without clock reset, but not by the future of [math]\displaystyle{ \nu_2 }[/math] without clock reset.

Explicit definition of a region

While the previous definition allow to test whether two assignments belong to the same region, it does not allow to easily represents a region as a data structure. The third definition given below allow to give a canonical encoding of a region.

A region can be explicitly defined as a zone, using a set [math]\displaystyle{ S }[/math] of equations and inequations satisfying the following constraints:

  • for each [math]\displaystyle{ x\in C }[/math], [math]\displaystyle{ S }[/math] contains either:
    • [math]\displaystyle{ x=c }[/math] for some integer [math]\displaystyle{ 0\le c\le c_x }[/math]
    • [math]\displaystyle{ x\in(c,c+1) }[/math] for some integer [math]\displaystyle{ 0\le c\lt c_x }[/math],
    • [math]\displaystyle{ x\gt c_x }[/math],
  • furthermore, for each pair of clocks [math]\displaystyle{ x,y\in C }[/math], where [math]\displaystyle{ S }[/math] contains constraints of the form [math]\displaystyle{ x\in (c,c+1) }[/math] and [math]\displaystyle{ y\in (c',c'+1) }[/math], then [math]\displaystyle{ S }[/math] contains an (in) equality of the form [math]\displaystyle{ \{x\}\sim \{y\} }[/math] with [math]\displaystyle{ \sim }[/math] being either =, < or .

Since, when [math]\displaystyle{ c }[/math] and [math]\displaystyle{ c' }[/math] are fixed, the last constraint is equivalent to [math]\displaystyle{ x\sim y+c-c' }[/math].

This definition allow to encode a region as a data structure. It suffices, for each clock, to state to which interval it belongs and to recall the order of the fractional part of the clocks which belong in an open interval of length 1. It follows that the size of this structure is [math]\displaystyle{ O\left(\sum\log(c_k)+|C|\log(|C|)\right) }[/math] with [math]\displaystyle{ |C| }[/math] the number of clocks.

Timed bisimulation

Let us now give a third definition of regions. While this definition is more abstract, it is also the reason why regions are used in model checking. Intuitively, this definition states that two clock assignments belong to the same region if the differences between them are such that no timed automaton can notice them. Given any run [math]\displaystyle{ r }[/math] starting with a clock assignment [math]\displaystyle{ \nu }[/math], for any other assignment [math]\displaystyle{ \nu' }[/math] in the same region, there is a run [math]\displaystyle{ r' }[/math], going through the same locations, reading the same letters, where the only difference is that the time waited between two successive transition may be different, and thus the successive clock variations are different.

The formal definition is now given. Given a set of clock [math]\displaystyle{ C }[/math], two assignments two clocks assignments [math]\displaystyle{ \nu_1 }[/math] and [math]\displaystyle{ \nu_2 }[/math] belongs to the same region if for each timed automaton [math]\displaystyle{ \mathcal A }[/math] in which the guards never compare a clock [math]\displaystyle{ x }[/math] to a number greater than [math]\displaystyle{ c_x }[/math], given any location [math]\displaystyle{ \ell }[/math] of [math]\displaystyle{ \mathcal A }[/math], there is a timed bisimulation between the extended states [math]\displaystyle{ (\ell,\nu_1) }[/math] and [math]\displaystyle{ (\ell,\nu_2) }[/math]. More precisely, this bisimulation preserves letters and locations but not the exact clock assignments.[1]:7

Operation on regions

Some operations are now defined over regions: Resetting some of its clock, and letting time pass.

Resetting clocks

Given a region [math]\displaystyle{ \alpha }[/math] defined by a set of (in)equations [math]\displaystyle{ S }[/math], and a set of clocks [math]\displaystyle{ C'\subseteq C }[/math], the region similar to [math]\displaystyle{ \alpha }[/math] in which the clocks of [math]\displaystyle{ C' }[/math] are restarted is now defined. This region is denoted by [math]\displaystyle{ \alpha[C'\mapsto 0] }[/math], it is defined by the following constraints:

  • each constraints of [math]\displaystyle{ S }[/math] not containing the clock [math]\displaystyle{ x }[/math],
  • the constraints [math]\displaystyle{ x=0 }[/math] for [math]\displaystyle{ x\in C' }[/math].

The set of assignments defined by [math]\displaystyle{ \alpha[C'\mapsto 0] }[/math] is exactly the set of assignments [math]\displaystyle{ \nu[C'\mapsto0] }[/math] for [math]\displaystyle{ \nu\in\alpha }[/math].

Time-successor

Given a region [math]\displaystyle{ \alpha }[/math], the regions which can be attained without resetting a clock are called the time-successors of [math]\displaystyle{ \alpha }[/math]. Two equivalent definitions are now given.

Definition

A clock region [math]\displaystyle{ \alpha' }[/math] is a time-successor of another clock region [math]\displaystyle{ \alpha }[/math] if for each assignment [math]\displaystyle{ \nu\in\alpha }[/math], there exists some positive real [math]\displaystyle{ t_{\nu,\alpha'}\gt 0 }[/math] such that [math]\displaystyle{ \nu+t_{\nu,\alpha'}\in\alpha' }[/math].

Note that it does not mean that [math]\displaystyle{ \alpha+t_{\nu,\alpha'}=\alpha' }[/math]. For example, the region [math]\displaystyle{ \alpha }[/math] defined by the set of constraint [math]\displaystyle{ \{0\lt x\lt 1, 0\lt y\lt 1, x\lt y\} }[/math] has the time-successor [math]\displaystyle{ \alpha' }[/math] defined by the set of constraint [math]\displaystyle{ \{0\lt x\lt 1, y=1\} }[/math]. Indeed, for each [math]\displaystyle{ \nu\in\alpha }[/math], it suffices to take [math]\displaystyle{ t_{\nu,\alpha'}=1-\nu(y) }[/math]. However, there exists no real [math]\displaystyle{ t }[/math] such that [math]\displaystyle{ \alpha+t=\alpha' }[/math] or even such that [math]\displaystyle{ \alpha+t\subseteq\alpha' }[/math]; indeed, [math]\displaystyle{ \alpha }[/math] defines a triangle while [math]\displaystyle{ \alpha' }[/math] defines a segment.

Computable definition

The second definition now given allow to explicitly compute the set of time-successor of a region, given by its set of constraints.

Given a region [math]\displaystyle{ \alpha }[/math] defined as a set of constraints [math]\displaystyle{ S }[/math], let us define its set of time-successors. In order to do so, the following variables are required. Let [math]\displaystyle{ T\subseteq S }[/math] the set of constraints of [math]\displaystyle{ S }[/math] of the form [math]\displaystyle{ x_i=c_i }[/math]. Let [math]\displaystyle{ Y\subseteq C }[/math] the set of clocks [math]\displaystyle{ y }[/math] such that [math]\displaystyle{ S }[/math] contains the constraint [math]\displaystyle{ y\gt c_y }[/math]. Let [math]\displaystyle{ Z\subseteq C\setminus Y }[/math] the set of clocks [math]\displaystyle{ \{z\} }[/math] such that there are no constraints of the form [math]\displaystyle{ \{x\}\lt \{z\} }[/math] in [math]\displaystyle{ S }[/math].

If [math]\displaystyle{ T }[/math] is empty, [math]\displaystyle{ \alpha }[/math] is its own time successor. If [math]\displaystyle{ Y=C }[/math], then [math]\displaystyle{ \alpha }[/math] is the only time-successor of [math]\displaystyle{ \alpha }[/math]. Otherwise, there is a least time-successor of [math]\displaystyle{ \alpha }[/math] not equal to [math]\displaystyle{ \alpha }[/math]. The least time-successor, if [math]\displaystyle{ T }[/math] is non-empty, contains:

  • the constraints of [math]\displaystyle{ S\setminus T }[/math]
  • [math]\displaystyle{ x_i\gt c_i }[/math],
  • [math]\displaystyle{ \{x_i\}=\{x_j\} }[/math], and
  • for each [math]\displaystyle{ y }[/math] such that [math]\displaystyle{ y\gt c_y }[/math] does not belong to [math]\displaystyle{ S }[/math], the constraint [math]\displaystyle{ x_i\lt y }[/math].

If [math]\displaystyle{ T }[/math] is empty, the least time-successor is defined by the following constraints:

  • the constraints of [math]\displaystyle{ S }[/math] not using the clocks of [math]\displaystyle{ Z }[/math],
  • the constraint [math]\displaystyle{ z=c+1 }[/math], for each constraint [math]\displaystyle{ c\lt z\lt c+1 }[/math] in [math]\displaystyle{ S }[/math], with [math]\displaystyle{ z\in Z }[/math].

Properties

There are at most [math]\displaystyle{ |C|!2^{|C|}\prod_{x\in C}(2c_x+2) }[/math] regions, where [math]\displaystyle{ |C| }[/math] is the number of clocks.[2]:203

Region automaton

Given a timed automaton [math]\displaystyle{ \mathcal A }[/math], its region automaton is a finite automaton or a Büchi automaton which accepts untimed [math]\displaystyle{ L }[/math]. This automaton is similar to [math]\displaystyle{ \mathcal A }[/math], where clocks are replaced by region. Intuitively, the region automaton is contructude as a product of [math]\displaystyle{ \mathcal A }[/math] and of the region graph. This region graph is defined first.

Region graph

The region graph is a rooted directed graph which models the set of possible clock valuations during a run of a timed-autoamton. It is defined as follows:

  • its nodes are regions,
  • its root is the initial region [math]\displaystyle{ \alpha_0 }[/math], defined by the set of constraints [math]\displaystyle{ \{x=0\mid x\in C\} }[/math],
  • the set of edges are [math]\displaystyle{ (\alpha,\alpha'[C'\mapsto 0]) }[/math], for [math]\displaystyle{ \alpha' }[/math] a time-successor of [math]\displaystyle{ \alpha }[/math].

Region automaton

Let [math]\displaystyle{ \mathcal A=\langle \Sigma,L,L_0,C,F,E\rangle }[/math] a timed automaton. For each clock [math]\displaystyle{ x\in C }[/math], let [math]\displaystyle{ c_x }[/math] the greatest number [math]\displaystyle{ c }[/math] such that there exists a guard of the form [math]\displaystyle{ x\sim c }[/math] in [math]\displaystyle{ \mathcal A }[/math]. The region automaton of [math]\displaystyle{ \mathcal A }[/math], denoted by [math]\displaystyle{ R(\mathcal A) }[/math] is a finite or Büchi automaton which is essentially a product of [math]\displaystyle{ \mathcal A }[/math] and of the region graph defined above. That is, each state of the region automaton is a pair containing a location of [math]\displaystyle{ \mathcal A }[/math] and a region. Since two clocks assignment belonging to the same region satisfies the same guard, each region contains enough information to decide which transitions can be taken.

Formally, the region automaton is defined as follows:

  • its alphabet is [math]\displaystyle{ \Sigma }[/math],
  • its set of states is [math]\displaystyle{ L\times\mathcal R }[/math],
  • its set of states is [math]\displaystyle{ L_0\times\{\alpha_0\} }[/math] with [math]\displaystyle{ \alpha_0 }[/math] the initial region,
  • its set of accepting states is [math]\displaystyle{ F\times\mathcal R }[/math],
  • its transition relation [math]\displaystyle{ \delta }[/math] contains [math]\displaystyle{ ((\ell,\alpha),a,(\ell',\alpha'[C'\mapsto0])) }[/math], for [math]\displaystyle{ (\ell,a,g,C',\ell')\in E }[/math], such that [math]\displaystyle{ \gamma\models\alpha' }[/math] and [math]\displaystyle{ \alpha' }[/math] is a time-successor of [math]\displaystyle{ \alpha }[/math].

Given any run [math]\displaystyle{ r=(\ell_0,\nu_0)\xrightarrow[t_1]{\sigma_1}(\ell_1,\nu_1)\dots }[/math] of [math]\displaystyle{ \mathcal A }[/math], the sequence [math]\displaystyle{ (\ell_0,[\nu_0])\xrightarrow{\sigma_1}(\ell_1,[\nu_1])\dots }[/math] is denoted [math]\displaystyle{ [r] }[/math], it is a run of [math]\displaystyle{ R(\mathcal A) }[/math] and is accepting if and only if [math]\displaystyle{ r }[/math] is accepting[2]:207. It follows that [math]\displaystyle{ L(R(\mathcal A))=\operatorname{Untime}(L(\mathcal A)) }[/math]. In particular, [math]\displaystyle{ \mathcal A }[/math] accepts a timed-word if and only if [math]\displaystyle{ R(\mathcal A) }[/math] accepts a word. Furthermore, an accepting run of [math]\displaystyle{ \mathcal A }[/math] can be computed from an accepting run of [math]\displaystyle{ R(\mathcal A) }[/math].

References

  1. 1.0 1.1 Bengtsson, Johan; Yi, Wang L (2004). "Timed Automata: Semantics, Algorithms and Tools". Lectures on Concurrency and Petri Nets. Lecture Notes in Computer Science. 3098. pp. 87–124. doi:10.1007/978-3-540-27755-2_3. ISBN 978-3-540-22261-3. http://www.it.uu.se/research/group/darts/papers/texts/by-lncs04.ps. 
  2. 2.0 2.1 2.2 Alur, Rajeev; Dill, David L (April 25, 1994). "A theory of timed automata". Theoretical Computer Science 126 (2): 183–235. doi:10.1016/0304-3975(94)90010-8. https://www.cis.upenn.edu/~alur/TCS94.pdf.