Difference bound matrix

From HandWiki

In model checking, a field of computer science, a difference bound matrix (DBM) is a data structure used to represent some convex polytopes called zones. This structure can be used to efficiently implement some geometrical operations over zones, such as testing emptyness, inclusion, equality, and computing the intersection and the sum of two zones. It is, for example, used in the Uppaal model checker; where it is also distributed as an independent library.[1] More precisely, there is a notion of canonical DBM; there is a one-to-one relation between canonical DBMs and zones and from each DBM a canonical equivalent DBM can be efficiently computed. Thus, equality of zone can be tested by checking for equality of canonical DBMs.

Zone

A difference bound matrix is used to represents some kind of convex polytopes. Those polytopes are called zone. They are now defined. Formally, a zone is defined by equations 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.

Zones have originally be called region,[2] but nowadays this name usually denote region, a special kind of zone. Intuitively, a region can be considered as a minimal non-empty zones, in which the constants used in constraint are bounded.

Given [math]\displaystyle{ n }[/math] variables, there are exactly [math]\displaystyle{ n(n+1) }[/math] different non-redundant constraints possible, [math]\displaystyle{ n }[/math] constraints which use a single variable and an upper bound, [math]\displaystyle{ n }[/math] constraints which uses a single variable and a lower bound, and for each of the [math]\displaystyle{ n^2 }[/math] ordered pairs of variable [math]\displaystyle{ (x,y) }[/math], an upper bound on [math]\displaystyle{ x-y }[/math]. However, an arbitrary convex polytope in [math]\displaystyle{ \mathbb R^n }[/math] may require an arbitrarily great number of constraints. Even when [math]\displaystyle{ n=2 }[/math], there can be an arbitrary great number of non-redundant constraints [math]\displaystyle{ (x\lt iy+c_i)_{i\in\mathbb N} }[/math], for [math]\displaystyle{ c_i }[/math] some constants. This is the reason why DBMs can not be extended from zones to convex polytopes.

Example

As stated in the introduction, we consider a zone defined by a set of statements of the form [math]\displaystyle{ x_1\le c }[/math], [math]\displaystyle{ x_1\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. However some of those constraints are either contradictory or redundant. We now give such examples.

  • the constraints [math]\displaystyle{ x_1\le3 }[/math] and [math]\displaystyle{ x_1\ge4 }[/math] are contradictory. Hence, when two such constraints are found, the zone defined is empty.
    Figure in [math]\displaystyle{ \mathbb R^2 }[/math] showing [math]\displaystyle{ x_1\le 3 }[/math], [math]\displaystyle{ x_1\ge4 }[/math] which are disjoint
  • the constraints [math]\displaystyle{ x_1\le3 }[/math] and [math]\displaystyle{ x_1\le 4 }[/math] are redundant. The second constraint being implied by the first one. Hence, when two such constraints are found in the definition of the zone, the second constraint may be removed.
    Figure in [math]\displaystyle{ \mathbb R^2 }[/math] showing [math]\displaystyle{ x_1\le 3 }[/math] and [math]\displaystyle{ x_1\le 4 }[/math] which contains the first figure

We also give example showing how to generate new constraints from existing constraints. For each pair of clocks [math]\displaystyle{ x_1 }[/math] and [math]\displaystyle{ x_2 }[/math], the DBM has a constraint of the form [math]\displaystyle{ x_1\prec x_2+c }[/math], where [math]\displaystyle{ \prec }[/math] is either < or ≤. If no such constraint can be found, the constraint [math]\displaystyle{ x_1\prec x_2+\infty }[/math] can be added to the zone definition without loss of generality. But in some case, a more precise constraint can be found. Such an example is now going to be given.

  • the constraints [math]\displaystyle{ x_1\le 3 }[/math], [math]\displaystyle{ x_2\ge-3 }[/math] implies that [math]\displaystyle{ x_1\le x_2+6 }[/math]. Thus, assuming that no other constraint such as [math]\displaystyle{ x_1\le x_2+5 }[/math] or [math]\displaystyle{ x_1\lt x_2+6 }[/math] belongs to the definition, the constraint [math]\displaystyle{ x_1\le x_2+6 }[/math] is added to the zone definition.
    Figure in [math]\displaystyle{ \mathbb R^2 }[/math] showing [math]\displaystyle{ x_1\le 3 }[/math], [math]\displaystyle{ x_2\ge-3 }[/math] and their intersections
  • the constraints [math]\displaystyle{ x_2\le 3 }[/math], [math]\displaystyle{ x_1\le x_2+3 }[/math] implies that [math]\displaystyle{ x_1\le 6 }[/math]. Thus, assuming that no other constraint such as [math]\displaystyle{ x_1\le 5 }[/math] or [math]\displaystyle{ x_1\lt 6 }[/math] belongs to the definition, the constraint [math]\displaystyle{ x_1\le 6 }[/math] is added to the zone definition.
    Figure in [math]\displaystyle{ \mathbb R^2 }[/math] showing [math]\displaystyle{ x_1\le 3 }[/math], [math]\displaystyle{ x_1\le x_2+3 }[/math] and their intersections
  • the constraints [math]\displaystyle{ x_1\le x_2+3 }[/math], [math]\displaystyle{ x_2\le x_3+3 }[/math] implies that [math]\displaystyle{ x_1\le x_3+6 }[/math]. Thus, assuming that no other constraint such as [math]\displaystyle{ x_1\le x_3+5 }[/math] or [math]\displaystyle{ x_1\lt x_3+6 }[/math] belongs to the definition, the constraint [math]\displaystyle{ x_1\le x_3+6 }[/math] is added to the zone definition.

Actually, the two first cases above are particular cases of the third cases. Indeed, [math]\displaystyle{ x_1\le3 }[/math] and [math]\displaystyle{ x_2\ge-3 }[/math] can be rewritten as [math]\displaystyle{ x_1\le 0+3 }[/math] and [math]\displaystyle{ 0\le x_2+3 }[/math] respectively. And thus, the constraint [math]\displaystyle{ x_1\le x_2+6 }[/math] added in the first example is similar to the constraint added in the third example.

Definition

We now fix a monoid [math]\displaystyle{ (M,0,+) }[/math] which is a subset of the real line. This monoid is traditionally the set of integers, rationals, reals, or their subset of non-negative numbers.

Constraints

In order to define the data structure difference bound matrix, it is first required to give a data structure to encode atomic constraints. Furthermore, we introduce an algebra for atomic constraints. This algebra is similar to the tropical semiring, with two modifications:

  • An arbitrary ordered monoid may be used instead of ℝ.
  • In order to distinguish between "[math]\displaystyle{ \lt m }[/math]" and "[math]\displaystyle{ \le m }[/math]", the set of elements of the algebra must contain information stating whether the order is strict or not.

Definition of constraints

The set of satisfiable constraints is defined as the set of pairs of the form:

  • [math]\displaystyle{ (\le,m) }[/math], with [math]\displaystyle{ m\in M }[/math], which represents a constraint of the form [math]\displaystyle{ \le m }[/math],
  • [math]\displaystyle{ (\lt ,m) }[/math], with [math]\displaystyle{ m\in M }[/math], where [math]\displaystyle{ m }[/math] is not a minimal element of [math]\displaystyle{ M }[/math], which represents a constraint of the form [math]\displaystyle{ \lt m }[/math],
  • [math]\displaystyle{ (\lt ,\infty) }[/math], which represents the absence of constraint.

The set of constraint contains all satisfiable constraints and contains also the following unsatisfiable constraint:

  • [math]\displaystyle{ (\lt ,-\infty) }[/math].

The subset [math]\displaystyle{ \{q\in\mathbb Q\mid q\le\sqrt2\} }[/math] can not be defined using this kind of constraints. More generally, some convex polytopes can not be defined when the ordered monoid does not have the least-upper-bound property, even if each of the constraints in its definition uses at most two variables.

Operation on constraints

In order to generate a single constraint from a pair of constraints applied to the same (pair of) variable, we formalize the notion of intersection of constraints and of order over constraints. Similarly, in order to define a new constraints from existing constraints, a notion of sum of constraint must also be defined.

Order on constraints

We now define an order relation over constraints. This order symbolize the inclusion relation.

First, the set [math]\displaystyle{ \{\lt ,\le\} }[/math] is considered as an ordered set, with < being inferior to ≤. Intuitively, this order is chosen because the set defined by [math]\displaystyle{ x\lt c }[/math] is strictly included in the set defined by [math]\displaystyle{ x\le c }[/math]. We then state that the constraint [math]\displaystyle{ (\prec_1,m_1) }[/math] is smaller than [math]\displaystyle{ (\prec_2,m_2) }[/math] if either [math]\displaystyle{ m_1\lt m_2 }[/math] or ([math]\displaystyle{ m_1=m_2 }[/math] and [math]\displaystyle{ \prec_1 }[/math] is less than [math]\displaystyle{ \prec_2 }[/math]). That is, the order on constraints is the lexicographical order applied from right to left. Note that this order is a total order. If [math]\displaystyle{ M }[/math] has the least-upper-bound property (or greatest-lower-bound property) then the set of constraints also have it.

Intersection of constraints

The intersection of two constraints, denoted as [math]\displaystyle{ (\prec_1,m_1)\sqcap(\prec_2,m_2) }[/math], is then simply defined as the minimum of those two constraints. If [math]\displaystyle{ M }[/math] has the greatest-lower bound property then the intersection of an infinite number of constraints is also defined.

Sum of constraints

Given two variables [math]\displaystyle{ x_1 }[/math] and [math]\displaystyle{ x_2 }[/math] to which are applied constraints [math]\displaystyle{ (\prec_1,m_1) }[/math] and [math]\displaystyle{ (\prec_2,m_2) }[/math], we now explain how to generate the constraint satisfied by [math]\displaystyle{ x_1+x_2 }[/math]. This constraint is called the sum of the two above-mentioned constraint, is denoted as [math]\displaystyle{ (\prec_1,m_1)+(\prec_2,m_2) }[/math] and is defined as [math]\displaystyle{ (\min(\prec_1,\prec_2),m_1+m_2) }[/math].

Constraints as an algebra

Here is a list of algebraic properties satisfied by the set of constraints.

  • Both operations are associative and commutative,
  • Sum is distributive over intersection, that is, for any three constraints, [math]\displaystyle{ ((\prec_1,m_1)\sqcap(\prec_2,m_2))+(\prec_3,m_3) }[/math] equals [math]\displaystyle{ ((\prec_1,m_1)+(\prec_3,m_3))\sqcap((\prec_2,m_2)+(\prec_3,m_3)) }[/math],
  • The intersection operation is idempotent,
  • The constraint [math]\displaystyle{ (\lt ,\infty) }[/math] is an identity for the intersection operation,
  • The constraint [math]\displaystyle{ (\le,0) }[/math] is an identity for the sum operation,

Furthermore, the following algebraic properties holds over satisfiable constraints:

  • The constraint [math]\displaystyle{ (\lt ,\infty) }[/math] is a zero for the sum operation,
  • It follows that the set of satisfiable constraints is an idempotent semiring, with [math]\displaystyle{ (\lt ,\infty) }[/math] as zero and [math]\displaystyle{ (\le,0) }[/math] as unity.
  • If 0 is the minimum element of [math]\displaystyle{ M }[/math], then [math]\displaystyle{ (\le,0) }[/math] is a zero for the intersection constraints over satisfiable constraints.

Over non-satisfiable constraints both operations have the same zero, which is [math]\displaystyle{ (\lt ,-\infty) }[/math]. Thus, the set of constraints does not even form a semiring, because the identity of the intersection is distinct from the zero of the sum.

DBMs

Given a set of [math]\displaystyle{ n }[/math] variables, [math]\displaystyle{ x_1,\dots,x_n }[/math], a DBM is a matrix with column and rows indexed by [math]\displaystyle{ 0,x_1,\dots,x_n }[/math] and the entries are constraints. Intuitively, for a column [math]\displaystyle{ C }[/math] and a row [math]\displaystyle{ R }[/math], the value [math]\displaystyle{ m }[/math] at position [math]\displaystyle{ (C,R) }[/math] represents [math]\displaystyle{ C\prec R+m }[/math]. Thus, the zone defined by a matrix [math]\displaystyle{ D((\prec_{C,R},m_{C,R}))_{C,R\in\{0,x_1,\dots,x_n}\} }[/math], denoted by [math]\displaystyle{ \mathcal R(D) }[/math], is [math]\displaystyle{ \{(x_1,\dots,x_n)\in\mathbb R\mid \bigwedge_{C,R\in\{0,x_1,\dots,x_n\}}C\prec_{C,R}R+m_{C,R}\} }[/math].

Note that [math]\displaystyle{ C\prec R+m }[/math] is equivalent to [math]\displaystyle{ C-R\prec m }[/math], thus the entry [math]\displaystyle{ (\prec,m) }[/math] is still essentially an upper bound. Note however that, since we consider a monoid [math]\displaystyle{ M }[/math], for some values of [math]\displaystyle{ C }[/math] and [math]\displaystyle{ R }[/math] the real [math]\displaystyle{ C-R }[/math] does not actually belong to the monoid.

Before introducing the definition of a canonical DBM, we need to define and discuss an order relation on those matrices.

Order on those matrices

A matrix [math]\displaystyle{ D }[/math] is considered to be smaller than a matrix [math]\displaystyle{ D' }[/math] if each of its entries are smaller. Note that this order is not total. Given two DBMs [math]\displaystyle{ D }[/math] and [math]\displaystyle{ D' }[/math], if [math]\displaystyle{ D }[/math] is smaller than or equal to [math]\displaystyle{ D' }[/math], then [math]\displaystyle{ \mathcal R(D)\subseteq\mathcal R(D') }[/math].

The greatest-lower-bound of two matrices [math]\displaystyle{ D }[/math] and [math]\displaystyle{ D' }[/math], denoted by [math]\displaystyle{ D\sqcap D' }[/math], has as its [math]\displaystyle{ (a,b) }[/math] entry the value [math]\displaystyle{ (\prec_{a,b},m_{a,b})\sqcap(\prec'_{a,b},m'_{a,b}) }[/math]. Note that since [math]\displaystyle{ \sqcap }[/math] is the «sum» operation of the semiring of constraints, the operation [math]\displaystyle{ \sqcap }[/math] is the «sum» of two DBMs where the set of DBMs is considered as a module.

Similarly to the case of constraints, considered in section "Operation on constraints" above, the greatest-lower-bound of an infinite number of matrices is correctly defined as soon as [math]\displaystyle{ M }[/math] satisfies the greatest-lower-bound property.

The intersection of matrices/zones is defined. The union operation is not defined, and indeed, a union of zone is not a zone in general.

For an arbitrary set [math]\displaystyle{ \mathcal D }[/math] of matrices which all defines the same zone [math]\displaystyle{ Z }[/math], [math]\displaystyle{ \sqcap_{D\in\mathcal D}D }[/math] also defines [math]\displaystyle{ Z }[/math]. It thus follow that, as long as [math]\displaystyle{ M }[/math] has the greatest-lower-bound property, each zone which is defined by at least a matrix has a unique minimal matrix defining it. This matrix is called the canonical DBM of [math]\displaystyle{ Z }[/math].

First definition of canonical DBM

We restate the definition of a canonical difference bound matrix. It is a DBM such that no smaller matrix defines the same set. It is explained below how to check whether a matrix is a DBM, and otherwise how to compute a DBM from an arbitrary matrix such that both matrices represents the same set. But first, we give some examples.

Examples of matrices

We first consider the case where there is a single clock [math]\displaystyle{ x_1 }[/math].

The real line

We first give the canonical DBM for [math]\displaystyle{ \mathbb R }[/math]. We then introduce another DBM which encode the set [math]\displaystyle{ \mathbb R }[/math]. This allow to find constraints which must be satisfied by any DBM.

The canonical DBM of the set of real is [math]\displaystyle{ \left(\begin{array}{ll}(\le,0)&(\lt ,\infty)\\(\lt ,\infty)&(\le,0)\end{array}\right) }[/math]. It represents the constraints [math]\displaystyle{ 0\le 0+0 }[/math], [math]\displaystyle{ x_1\le 0+\infty }[/math], [math]\displaystyle{ 0\le x_1+\infty }[/math] and [math]\displaystyle{ 0\le0+0 }[/math]. All of those constraints are satisfied independently of the value assigned to [math]\displaystyle{ x_1 }[/math]. In the remaining of the discussion, we will not explicitly describe constraints due to entries of the form [math]\displaystyle{ (\lt ,\infty) }[/math], since those constraints are systematically satisfied.

The DBM [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,\infty)&(\lt ,\infty)\\(\lt ,\infty)&(\lt ,\infty)\end{array}\right) }[/math] also encodes the set of real. It contains the constraints [math]\displaystyle{ 0\lt 0+\infty }[/math] and [math]\displaystyle{ x_1\lt x_1+\infty }[/math] which are satisfied independently on the value of [math]\displaystyle{ x_1 }[/math]. This show that in a canonical DBM [math]\displaystyle{ D }[/math], a diagonal entry is never greater than [math]\displaystyle{ (\le,0) }[/math], because the matrix obtained from [math]\displaystyle{ D }[/math] by replacing the diagonal entry by [math]\displaystyle{ (\le,0) }[/math] defines the same set and is smaller than [math]\displaystyle{ D }[/math].

The empty set

We now consider many matrices which all encodes the empty set. We first give the canonical DBM for the empty set. We then explain why each of the DBM encodes the empty set. This allow to find constraints which must be satisfied by any DBM.

The canonical DBM of the empty set, over one variable, is [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,-\infty)&(\lt ,-\infty)\\(\lt ,-\infty)&(\lt ,-\infty)\end{array}\right) }[/math]. Indeed, it represents the set satisfying the constraint [math]\displaystyle{ 0\lt 0-\infty }[/math], [math]\displaystyle{ 0\lt x_1-\infty }[/math], [math]\displaystyle{ x_1\lt 0-\infty }[/math] and [math]\displaystyle{ x_1\lt x_1-\infty }[/math]. Those constraints are unsatisfiable.

The DBM [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,\infty)&(\lt ,-\infty)\\(\lt ,\infty)&(\lt ,\infty)\end{array}\right) }[/math] also encodes the empty set. Indeed, it contains the constraint [math]\displaystyle{ x_1\lt 0-\infty }[/math] which is unsatisfiable. More generally, this show that no entry can be [math]\displaystyle{ (\lt ,-\infty) }[/math] unless all entries are [math]\displaystyle{ (\lt ,-\infty) }[/math].

The DBM [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,\infty)&(\lt ,\infty)\\(\lt ,\infty)&(\lt ,-1)\end{array}\right) }[/math] also encodes the empty set. Indeed, it contains the constraint [math]\displaystyle{ x_1\lt x_1-1 }[/math] which is unsatisfiable. More generally, this show that the entry in the diagonal line can not be smaller than [math]\displaystyle{ (\le,0) }[/math] unless it is [math]\displaystyle{ (\lt ,-\infty) }[/math].

The DBM [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,\infty)&(\lt ,1)\\(\le,-1)&(\lt ,\infty)\end{array}\right) }[/math] also encodes the empty set. Indeed, it contains the constraints [math]\displaystyle{ 0\lt x_1+1 }[/math] and [math]\displaystyle{ x_1\le -1 }[/math] which are contradictory. More generally, this show that, for each [math]\displaystyle{ C,R\in\{0,x_1,\dots,x_n\} }[/math], if [math]\displaystyle{ m_{C,R}=-m_{R,C} }[/math], then [math]\displaystyle{ \prec_{R,C} }[/math] and [math]\displaystyle{ \prec_{C,R} }[/math] are both equal to ≤.

The DBM [math]\displaystyle{ \left(\begin{array}{ll}(\lt ,\infty)&(\le,1)\\(\le,-2)&(\lt ,\infty)\end{array}\right) }[/math] also encodes the empty set. Indeed, it contains the constraints [math]\displaystyle{ 0\le x_1+1 }[/math] and [math]\displaystyle{ x_1\le -2 }[/math] which are contradictory. More generally, this show that for each [math]\displaystyle{ C,R\in\{0,x_1,\dots,x_n\} }[/math], [math]\displaystyle{ -m_{C,R}\le m_{R,C} }[/math], unless [math]\displaystyle{ m_{C,R} }[/math] is [math]\displaystyle{ -\infty }[/math].

Strict constraints

The examples given in this section are similar to the examples given in the Example section above. This time, they are given as DBM.

The DBM [math]\displaystyle{ \left(\begin{array}{lll}(\le,0)&(\lt ,\infty)&(\lt ,\infty)\\(\lt ,\infty)&(\le,0)&(\le,3)\\(\le,3)&(\lt ,\infty)&(\le,0)\end{array}\right) }[/math] represents the set satisfying the constraints [math]\displaystyle{ x_2\le 3 }[/math] and [math]\displaystyle{ x_1\le x_2+3 }[/math]. As mentioned in the Example section, both of those constraints implies that [math]\displaystyle{ x_1\le 6 }[/math]. It means that the DBM [math]\displaystyle{ \left(\begin{array}{lll}(\le,0)&(\le,6)&(\lt ,\infty)\\(\lt ,\infty)&(\le,0)&(\le,3)\\(\le,3)&(\lt ,\infty)&(\le,0)\end{array}\right) }[/math] encodes the same zone. Actually, it is the DBM of this zone. This shows that in any DBM [math]\displaystyle{ ((\prec_{C,R},m_{C,R}))_{c,r\in\{0,x_1,\dots,x_n\}} }[/math], for each [math]\displaystyle{ 1\le i,j\le n }[/math], the constraint [math]\displaystyle{ (\prec_{x_i,0},m_{x_i,0}) }[/math] is smaller than the constraint [math]\displaystyle{ (\prec_{x_j,0},m_{x_j,0})+(\prec_{x_i,x_j},m_{x_i,x_j}) }[/math].

As explained in the Example section, the constant 0 can be considered as any variable, which leads to the more general rule: in any DBM [math]\displaystyle{ ((\prec_{C,R},m_{C,R}))_{c,r\in\{0,x_1,\dots,x_n\}} }[/math], for each [math]\displaystyle{ a,b,c\in\{0,x_1,\dots,x_n\} }[/math], the constraint [math]\displaystyle{ (\prec_{a,b},m_{a,b}) }[/math] is smaller than the constraint [math]\displaystyle{ (\prec_{c,b},m_{c,b})+(\prec_{a,c},m_{a,c}) }[/math].

Three definition of canonical DBM

As explained in the introduction of the section Difference Bound Matrix, a canonical DBM is a DBM whose rows and columns are indexed by [math]\displaystyle{ (0,x_1,\dots,x_n) }[/math], whose entries are constraints. Furthermore, it follows one of the following equivalent properties.

  • there are no smaller DBM defining the same zone,
  • for each [math]\displaystyle{ a,b,c\in\{0,x_1,\dots,x_n\} }[/math], the constraint [math]\displaystyle{ (\prec_{a,b},m_{a,b}) }[/math] is smaller than the constraint [math]\displaystyle{ (\prec_{c,b},m_{c,b})+(\prec_{a,c},m_{a,c}) }[/math]
  • given the directed graph [math]\displaystyle{ G }[/math] with edges [math]\displaystyle{ \{0,x_1,\dots,x_n\} }[/math] and arrows [math]\displaystyle{ (a,b) }[/math] labelled by [math]\displaystyle{ (\prec_{a,b},m_{a,b}) }[/math], the shortest path from any edge [math]\displaystyle{ a }[/math] to any edge [math]\displaystyle{ b }[/math] is the arrow [math]\displaystyle{ (a,b) }[/math]. This graph is called the potential graph of the DBM.

The last definition can be directly used to compute the canonical DBM associated to a DBM. It suffices to apply the Floyd–Warshall algorithm to the graph and associates to each entry [math]\displaystyle{ (a,b) }[/math] the shortest path from [math]\displaystyle{ a }[/math] to [math]\displaystyle{ b }[/math] in the graph. If this algorithm detects a cycle of negative length, this means that the constraints are not satisfiable, and thus that the zone is empty.

Operations on zones

As stated in the introduction, the main interest of DBMs is that they allow to easily and efficiently implements operations on zones.

We first recall operations which were considered above:

  • testing for the inclusion of a zone [math]\displaystyle{ Z_1 }[/math] in a zone [math]\displaystyle{ Z_2 }[/math] is done by testing whether the canonical DBM of [math]\displaystyle{ Z_1 }[/math] is smaller than or equal to the DBM of [math]\displaystyle{ Z_2 }[/math],
  • A DBM for the intersection of a set of zones is the greatest-lower-bound of the DBM of those zones,
  • testing for zone emptiness consists in checking whether the canonical DBM of the zone consists only of [math]\displaystyle{ (\lt ,-\infty) }[/math],
  • testing whether a zone is the entire space consists in checking whether the DBM of the zone consists only of [math]\displaystyle{ (\lt ,\infty) }[/math].

We now describe operations which were not considered above. The first operations described below have clear geometrical meaning. The last ones become corresponds to operations which are more natural for clock valuations.

Sum of zones

The Minkowski sum of two zones, defined by two DBMs [math]\displaystyle{ D }[/math] and [math]\displaystyle{ D' }[/math], is defined by the DBM [math]\displaystyle{ D+D' }[/math] whose [math]\displaystyle{ (a,b) }[/math] entry is [math]\displaystyle{ D_{a,b}+D'_{a,b} }[/math]. Note that since [math]\displaystyle{ + }[/math] is the «product» operation of the semiring of constraints, the operation [math]\displaystyle{ + }[/math] over DBMs is not actually an operation of the module of DBM.

In particular, it follows that, in order to translate a zone [math]\displaystyle{ Z }[/math] by a direction [math]\displaystyle{ v }[/math], it suffices to add the DBM of [math]\displaystyle{ \{v\} }[/math] to the DBM of [math]\displaystyle{ Z }[/math].

Projection of a component to a fixed value

Let [math]\displaystyle{ d\in M }[/math] a constant.

Given a vector [math]\displaystyle{ \vec x=(x_1,\dots,x_n) }[/math], and an index [math]\displaystyle{ 1\le i\le n }[/math], the projection of the [math]\displaystyle{ i }[/math]-th component of [math]\displaystyle{ \vec x }[/math] to [math]\displaystyle{ d }[/math] is the vector [math]\displaystyle{ (x_1,\dots,x_{i-1},d,x_{i+1},\dots,x_n) }[/math]. In the language of clock, for [math]\displaystyle{ d=0 }[/math], this corresponds to resetting the [math]\displaystyle{ i }[/math]-th clock.

Projecting the [math]\displaystyle{ i }[/math]-th component of a zone [math]\displaystyle{ Z }[/math] to [math]\displaystyle{ d }[/math] consists simply in the set of vectors of [math]\displaystyle{ Z }[/math] with their [math]\displaystyle{ i }[/math]-th component to [math]\displaystyle{ d }[/math]. This is implemented on DBM by setting the components [math]\displaystyle{ (x_{i},a) }[/math] to [math]\displaystyle{ (\le,d)+D(0,a) }[/math] and the components [math]\displaystyle{ (a,x_{i}) }[/math] to [math]\displaystyle{ (\le,-d)+D(0,a) }[/math]

Future and past of a zone

Let us call the future the zone [math]\displaystyle{ F=\{(t,\dots,t)\mid t\in\mathbb R_{\ge0}\} }[/math] and the past the zone [math]\displaystyle{ P=\{(-t,\dots,-t)\mid t\in\mathbb R_{\ge0}\} }[/math]. Given a point [math]\displaystyle{ \vec x=(x_1,\dots,x_n)\in\mathbb R^n }[/math], the future of [math]\displaystyle{ \vec x }[/math] is defined as [math]\displaystyle{ \{(x_1+t,\dots,x_n+t)\mid t\in\mathbb R_{\ge0}\}=F+\{\vec x\} }[/math], and the past of [math]\displaystyle{ \vec x }[/math] is defined as [math]\displaystyle{ P+\{\vec x\} }[/math].

The names future and past comes from the notion of clock. If a set of [math]\displaystyle{ n }[/math] clocks are assigned to the values [math]\displaystyle{ x_1 }[/math], [math]\displaystyle{ x_2 }[/math], etc. then in their future, the set of assignment they'll have is the future of [math]\displaystyle{ \vec x }[/math].

Given a zone [math]\displaystyle{ Z }[/math], the future of [math]\displaystyle{ Z }[/math] are the union of the future of each points of the zone. The definition of the past of a zone is similar. The future of a zone can thus be defined as [math]\displaystyle{ F+Z }[/math], and hence can easily be implemented as a sum of DBMs. However, there is even a simpler algorithm to apply to DBM. It suffices to change every entries [math]\displaystyle{ (x_i,0) }[/math] to [math]\displaystyle{ (\lt ,\infty) }[/math]. Similarly, the past of a zone can be computed by setting every entries [math]\displaystyle{ (0,x_i) }[/math] to [math]\displaystyle{ (\lt ,\infty) }[/math].

See also

References

  1. "UPPAAL DBM Library". 16 July 2021. https://github.com/UPPAALModelChecker/UDBM. 
  2. Dill, David L (1990). "Timing assumptions and verification of finite-state concurrent systems". Automatic Verification Methods for Finite State Systems. Lecture Notes in Computer Science. 407. pp. 197–212. doi:10.1007/3-540-52148-8_17. ISBN 978-3-540-52148-8.