difference bound matrix
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.{{Cite web|url=https://github.com/UPPAALModelChecker/UDBM|title=UPPAAL DBM Library|website=GitHub |date=16 July 2021}}
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 , , and , with and some variables, and a constant.
Zones have originally be called region,{{cite book |last1=Dill |first1=David L|title=Automatic Verification Methods for Finite State Systems |chapter=Timing assumptions and verification of finite-state concurrent systems |series=Lecture Notes in Computer Science |date=1990|volume=407 |pages=197–212|isbn=978-3-540-52148-8| doi=10.1007/3-540-52148-8_17|doi-access=free}} 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 variables, there are exactly different non-redundant constraints possible, constraints which use a single variable and an upper bound, constraints which uses a single variable and a lower bound, and for each of the ordered pairs of variable , an upper bound on . However, an arbitrary convex polytope in may require an arbitrarily great number of constraints. Even when , there can be an arbitrary great number of non-redundant constraints
Example
As stated in the introduction, we consider a zone defined by a set of statements of the form
- the constraints
x_1\le3 andx_1\ge4 are contradictory. Hence, when two such constraints are found, the zone defined is empty. File:X incompatible.png - the constraints
x_1\le3 andx_1\le 4 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. File:Showing x 1 less than 3 and 4.png
We also give example showing how to generate new constraints from existing constraints. For each pair of clocks
- the constraints
x_1\le 3 ,x_2\ge-3 implies thatx_1\le x_2+6 . Thus, assuming that no other constraint such asx_1\le x_2+5 orx_1 belongs to the definition, the constraint x_1\le x_2+6 is added to the zone definition. File:X(3 y)-3.png - the constraints
x_2\le 3 ,x_1\le x_2+3 implies thatx_1\le 6 . Thus, assuming that no other constraint such asx_1\le 5 orx_1<6 belongs to the definition, the constraintx_1\le 6 is added to the zone definition. File:X less than 3, x less than y+3.png - the constraints
x_1\le x_2+3 ,x_2\le x_3+3 implies thatx_1\le x_3+6 . Thus, assuming that no other constraint such asx_1\le x_3+5 orx_1< x_3+6 belongs to the definition, the constraintx_1\le x_3+6 is added to the zone definition.
Actually, the two first cases above are particular cases of the third cases. Indeed,
Definition
= 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
\mathbb{R} . - In order to distinguish between "
< m " and "\le m ", 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:
(\le,m) , withm\in M , which represents a constraint of the form\le m ,(<,m) , withm\in M , wherem is not a minimal element ofM , which represents a constraint of the form< m ,(<,\infty) , which represents the absence of constraint.
The set of constraint contains all satisfiable constraints and contains also the following unsatisfiable constraint:
(<,-\infty) .
The subset
== 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
=== Intersection of constraints ===
The intersection of two constraints, denoted as
=== Sum of constraints ===
Given two variables
== 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,
((\prec_1,m_1)\sqcap(\prec_2,m_2))+(\prec_3,m_3) equals((\prec_1,m_1)+(\prec_3,m_3))\sqcap((\prec_2,m_2)+(\prec_3,m_3)) , - The intersection operation is idempotent,
- The constraint
(<,\infty) is an identity for the intersection operation, - The constraint
(\le,0) is an identity for the sum operation,
Furthermore, the following algebraic properties holds over satisfiable constraints:
- The constraint
(<,\infty) is a zero for the sum operation, - It follows that the set of satisfiable constraints is an idempotent semiring, with
(<,\infty) as zero and(\le,0) as unity. - If 0 is the minimum element of
M , then(\le,0) is a zero for the intersection constraints over satisfiable constraints.
Over non-satisfiable constraints both operations have the same zero, which is
=== DBMs ===
Given a set of
Note that
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
The greatest-lower-bound of two matrices
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
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
== 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
=== The real line ===
We first give the canonical DBM for
The canonical DBM of the set of real is
The DBM
=== 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
The DBM
The DBM
The DBM
The DBM
=== 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
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
= 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
- there are no smaller DBM defining the same zone,
- for each
a,b,c\in\{0,x_1,\dots,x_n\} , the constraint(\prec_{a,b},m_{a,b}) is smaller than the constraint(\prec_{c,b},m_{c,b})+(\prec_{a,c},m_{a,c}) - given the directed graph
G with edges\{0,x_1,\dots,x_n\} and arrows(a,b) labelled by(\prec_{a,b},m_{a,b}) , the shortest path from any edgea to any edgeb is the arrow(a,b) . 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
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
Z_1 in a zoneZ_2 is done by testing whether the canonical DBM ofZ_1 is smaller than or equal to the DBM ofZ_2 , - 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
(<,-\infty) , - testing whether a zone is the entire space consists in checking whether the DBM of the zone consists only of
(<,\infty) .
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
In particular, it follows that, in order to translate a zone
= Projection of a component to a fixed value =
Let
Given a vector
Projecting the
= Future and past of a zone =
Let us call the future the zone
The names future and past comes from the notion of clock. If a set of
Given a zone
See also
- Region (model checking) – a zone, minimal under inclusion, satisfying some properties
References
- [https://moves.rwth-aachen.de/wp-content/uploads/WS1617/amc/amc16_lec20_reduced.pdf Difference Bound Matrices Lecture #20 of Advanced Model Checking Joost-Pieter Katoen]
- {{cite book |last1=Péron |first1=Mathias|last2=Halbwachs|first2=Nicolas|title=Verification, Model Checking, and Abstract Interpretation |chapter=An Abstract Domain Extending Difference-Bound Matrices with Disequality Constraints |series=Lecture Notes in Computer Science |date=2008|volume=4349 |pages=268–282|isbn=978-3-540-69735-0| doi=10.1007/978-3-540-69738-1_20|chapter-url=http://hal.archives-ouvertes.fr/docs/00/26/24/22/PDF/PeronHalbwachsVMCAI07.pdf|doi-access=free}}
{{Data structures}}
{{DEFAULTSORT:Data Structure}}