General Information on the PPL

0.10pre34

The Main Features

The Parma Polyhedra Library (PPL) is a modern C++ library for the manipulation of numerical information that can be represented by points in some $n$-dimensional vector space. For instance, one of the key domains the PPL supports is that of rational convex polyhedra (Section Convex Polyhedra). Such domains are employed in several systems for the analysis and verification of hardware and software components, with applications spanning imperative, functional and logic programming languages, synchronous languages and synchronization protocols, real-time and hybrid systems. Even though the PPL library is not meant to target a particular problem, the design of its interface has been largely influenced by the needs of the above class of applications. That is the reason why the library implements a few operators that are more or less specific to static analysis applications, while lacking some other operators that might be useful when working, e.g., in the field of computational geometry.

The main features of the library are the following:

In addition to the basic domains, we also provide generic support for constructing new domains from pre-existing domains. The following domains and domain constructors are provided by the PPL:

In the following sections we describe these domains and domain constructors together with their representations and operations that are available to the PPL user.

In the final section of this chapter (Section Using the Library), we provide some additional advice on the use of the library.

Kinds of Geometric Descriptors

The PPL supports several kinds of geometric descriptor (GD for short). The top-level components provided by the PPL are called semantic GDs and denote a subset of $ \Rset^n $, while the lower-level components, which are called syntactic GDs, provide a means for describing a semantic GD and its properties in terms that are completely independent from the semantic GD's internal representation.

Semantic Geometric Descriptors

A semantic geometric descriptor is a subset of $ \Rset^n $. The PPL provides several classes of semantic GDs. These are identified by their C++ class name, together with the class template parameters, if any. These classes include the simple classes:

where:

Other semantic GDs, the compound classes, can be constructed (also recursively) from all the GDs classes. These include:

where PS, D1 and D2 can be any semantic GD classes and R is the reduction operation to be applied to the component domains of the product class.

A uniform set of operations is provided for creating, testing and maintaining each of the semantic GDs. However, as many of these depend on one or more syntactic GDs, we first describe the syntactic GDs.

Syntactic Geometric Descriptors

A syntactic geometric descriptor is for defining, modifying and inspecting a semantic GD. There are three kinds of syntactic GDs: basic GDs, constraint GDs and generator GDs. Some of these are generic and some specific; a generic syntactic GD is characterized by having a fixed meaning independent of its use while a specific syntactic GD has a meaning that is dependent on the semantic GD with which it is used.

Basic Geometric Descriptors

The following basic GDs currently supported by the PPL are:

These classes, which are all generic syntactic GDs, are used to build the constraint and generator GDs as well as support many generic operations on the semantic GDs.

Constraint Geometric Descriptors

The PPL currently supports the following classes of constraint GDs:

All these classes are generic syntactic GDs. However, a semantic GD may only capture the precise meaning of a subset of the constraint GDs and any semantic GD operation that cannot capture the semantics of the constraint GD precisely will either indicate its unsuitability or apply an upward approximation semantics.

Generator Geometric Descriptors

The PPL currently supports two classes of generator GDs:

Rays, lines and parameters are specific of the mentioned semantic GDs and, therefore, they cannot be used by other semantic GDs. In contrast, as already mentioned above, points are basic geometric descriptors since they are also used in generic PPL operations.

Generic Operations on Semantic Geometric Descriptors

  1. Constructors of a universe or empty semantic GD with the given space dimension.
  2. Operations on a semantic GD that do not depend on the syntactic GDs.
    • is_empty(), is_universe(), is_topologically_closed(), is_discrete(), is_bounded(), contains_integer_point()

      test for the named properties of the semantic GD.

    • total_memory_in_bytes(), external_memory_in_bytes()

      return the total and external memory size in bytes.

    • OK()

      checks that the semantic GD has a valid internal representation. An optional Boolean argument allows a check for emptiness.

    • space_dimension(), affine_dimension()

      return, respectively, the space and affine dimensions of the GD.

    • add_space_dimensions_and_embed(), add_space_dimensions_and_project(), expand_space_dimension(), remove_space_dimensions(), fold_space_dimensions(), map_space_dimensions()

      modify the space dimensions of the semantic GD; where, depending on the operation, the arguments can include the number of space dimensions to be added or removed a variable or set of variables denoting the actual dimensions to be used and a partial function defining a mapping between the dimensions.

    • contains(), strictly_contains(), is_disjoint_from()

      compare the semantic GD with an argument semantic GD of the same class.

    • topological_closure_assign(), intersection_assign(), upper_bound_assign(), difference_assign(), time_elapse_assign(), widening_assign(), concatenate_assign(), swap()

      modify the semantic GD, possibly with an argument semantic GD of the same class.

    • constrains(), bounds_from_above(), bounds_from_below(), maximize(), minimize().

      These find information about the bounds of the semantic GD where the argument variable or linear expression define the direction of the bound.

    • affine_image(), affine_preimage(), generalized_affine_image(), generalized_affine_preimage(), bounded_affine_image(), bounded_affine_preimage().

      These perform several variations of the affine image and preimage operations where, depending on the operation, the arguments can include a variable representing the space dimension to which the transformation will be applied and linear expressions with possibly a relation symbol and denominator value that define the exact form of the transformation.

    • ascii_load(), ascii_dump()

      are the ascii input and output operations.

  3. Constructors of a semantic GD of one class from a semantic GD of any other class. These constructors obey an upward approximation semantics, meaning that the constructed semantic GD is guaranteed to contain all the points of the source semantic GD, but possibly more. Some of SHOULD WE REPLACE SOME OF WITH ALL HERE? these constructors provide a complexity parameter with which the application can control the complexity/precision trade-off for the construction operation. TO BE COMPLETED
  4. Constructors of a semantic GD from a constraint GD; either a linear constraint system or a linear congruence system. If the semantic GD cannot capture the precise meaning of the constraint GD then it indicates its unsuitability by throwing an "invalid argument" exception to signal that the operation could not be performed.
  5. Other interaction between the semantic GDs and constraint GDs
    • add_constraint(), add_constraints(), add_recycled_constraints(), add_congruence(), add_congruences(), add_recycled_congruences().

      If the argument constraint GD can be completely incorporated into the semantic GD, this is what is done. Otherwise an "invalid argument" exception is thrown to signal that the operation could not be performed. For example: the C_Polyhedron class can incorporate any non-strict linear constraint or equality congruence, but cannot incorporate a strict constraint or a proper congruence. A BD_Shape<T> class can incorporate bounded-difference non-strict constraints, but not more complex linear constraints. An invariant of these methods is that, if they successfully add a constraint GD, then an enquiry for the same constraint GD with a "relation with" method is guaranteed to yield a "definitely implied" result.

      For add_recycled_constraints() and add_recycled_congruences(), the only assumption that can be made after return (successful or exceptional) on the constraint GD is that it can be safely destroyed.

    • refine_with_constraint(), refine_with_constraints(), refine_with_congruence(), refine_with_congruences()

      If the argument constraint GD can be completely incorporated into the semantic GD, this is what is done. Otherwise the constraint GD is used only to a limited extent to refine the semantic GD; possibly not at all. Notice that, while repeating an add operation is pointless, this is not true for the refine operations. For example, in those cases where

            Semantic_GD.add_constraint(c)
      
      raises an exception, a fragment of the form
            Semantic_GD.refine_with_constraint(c)
            // Other add_constraint(s) or refine_with_constraint(s) operations
            // on Semantic_GD.
            Semantic_GD.refine_with_constraint(c)
      
      may give more precise results than a single
            Semantic_GD.refine_with_constraint(c).
            // Other add_constraint(s) or refine_with_constraint(s) operations
            // on Semantic_GD.
      
    • constraints(), minimized_constraints(), congruences(), minimized_congruences()

      returns the indicated system of constraint GDs satisfied by the semantic GD.

    • can_recycle_constraint_systems(), can_recycle_congruence_systems()

      return true if and only if the semantic GD can recycle the indicated constraint GD.

    • relation_with()

      This takes a constraint GD as an argument and returns the relations holding between the semantic GD and the constraint GD. The possible relations are: IS_INCLUDED(), SATURATES(), STRICTLY_INTERSECTS(), IS_DISJOINT() and NOTHING(). This operator also can take a polyhedron generator GD as an argument and returns the relation SUBSUMES() or NOTHING() that holds between the generator GD and the semantic GD.

Upward Approximation

The Parma Polyhedra Library, for those cases where an exact result cannot be computed within the specified complexity limits, computes an upward approximation of the exact result. For semantic GDs this means that the computed result is a possibly strict superset of the set of points of $ \Rset^n $ that constitutes the exact result. Notice that the PPL does not provide direct support to compute downward approximations (i.e., possibly strict subsets of the exact results). While downward approximations can often be computed from upward ones, the required algorithms and the conditions upon which they are correct are outside the current scope of the PPL. Beware, in particular, of the following possible pitfall: the library provides methods to compute upward approximations of set-theoretic difference, which is antitone in its second argument. Applying a difference method to a second argument that is not an exact representation or a downward approximation of reality, would yield a result that, of course, is not an upward approximation of reality. It is the responsibility of the library user to provide the PPL's method with approximations of reality that are consistent with respect to the desired results.

Convex Polyhedra

In this section we introduce convex polyhedra, as considered by the library, in more detail. For more information about the definitions and results stated here see [BRZH02b], [Fuk98], [NW88], and [Wil93].

Vectors, Matrices and Scalar Products

We denote by $\Rset^n$ the $n$-dimensional vector space on the field of real numbers $\Rset$, endowed with the standard topology. The set of all non-negative reals is denoted by $\nonnegRset$. For each $i \in \{0, \ldots, n-1\}$, $v_i$ denotes the $i$-th component of the (column) vector $\vect{v} = (v_0, \ldots, v_{n-1})^\transpose \in \Rset^n$. We denote by $\vect{0}$ the vector of $\Rset^n$, called the origin, having all components equal to zero. A vector $\vect{v} \in \Rset^n$ can be also interpreted as a matrix in $\Rset^{n \times 1}$ and manipulated accordingly using the usual definitions for addition, multiplication (both by a scalar and by another matrix), and transposition, denoted by $\vect{v}^\transpose$.

The scalar product of $\vect{v},\vect{w} \in \Rset^n$, denoted $\langle \vect{v}, \vect{w} \rangle$, is the real number

\[ \vect{v}^\transpose \vect{w} = \sum_{i=0}^{n-1} v_i w_i. \]

For any $S_1, S_2 \sseq \Rset^n$, the Minkowski's sum of $S_1$ and $S_2$ is: $S_1 + S_2 = \{\, \vect{v}_1 + \vect{v}_2 \mid \vect{v}_1 \in S_1, \vect{v}_2 \in S_2 \,\}.$

Affine Hyperplanes and Half-spaces

For each vector $\vect{a} \in \Rset^n$ and scalar $b \in \Rset$, where $\vect{a} \neq \vect{0}$, and for each relation symbol $\mathord{\relsym} \in \{ =, \geq, > \}$, the linear constraint $\langle \vect{a}, \vect{x} \rangle \relsym b$ defines:

Note that each hyperplane $\langle \vect{a}, \vect{x} \rangle = b$ can be defined as the intersection of the two closed affine half-spaces $\langle \vect{a}, \vect{x} \rangle \geq b$ and $\langle -\vect{a}, \vect{x} \rangle \geq -b$. Also note that, when $\vect{a} = \vect{0}$, the constraint $\langle \vect{0}, \vect{x} \rangle \relsym b$ is either a tautology (i.e., always true) or inconsistent (i.e., always false), so that it defines either the whole vector space $\Rset^n$ or the empty set $\emptyset$.

Convex Polyhedra

The set $\cP \sseq \Rset^n$ is a not necessarily closed convex polyhedron (NNC polyhedron, for short) if and only if either $\cP$ can be expressed as the intersection of a finite number of (open or closed) affine half-spaces of $\Rset^n$ or $n = 0$ and $\cP = \emptyset$. The set of all NNC polyhedra on the vector space $\Rset^n$ is denoted $\Pset_n$.

The set $\cP \in \Pset_n$ is a closed convex polyhedron (closed polyhedron, for short) if and only if either $\cP$ can be expressed as the intersection of a finite number of closed affine half-spaces of $\Rset^n$ or $n = 0$ and $\cP = \emptyset$. The set of all closed polyhedra on the vector space $\Rset^n$ is denoted $\CPset_n$.

When ordering NNC polyhedra by the set inclusion relation, the empty set $\emptyset$ and the vector space $\Rset^n$ are, respectively, the smallest and the biggest elements of both $\Pset_n$ and $\CPset_n$. The vector space $\Rset^n$ is also called the universe polyhedron.

In theoretical terms, $\Pset_n$ is a lattice under set inclusion and $\CPset_n$ is a sub-lattice of $\Pset_n$.

Note:
In the following, we will usually specify operators on the domain $\Pset_n$ of NNC polyhedra. Unless an explicit distinction is made, these operators are provided with the same specification when applied to the domain $\CPset_n$ of topologically closed polyhedra. The implementation maintains a clearer separation between the two domains of polyhedra (see Topologies and Topological-compatibility): while computing polyhedra in $\Pset_n$ may provide more precise results, polyhedra in $\CPset_n$ can be represented and manipulated more efficiently. As a rule of thumb, if your application will only manipulate polyhedra that are topologically closed, then it should use the simpler domain $\CPset_n$. Using NNC polyhedra is only recommended if you are going to actually benefit from the increased accuracy.

Bounded Polyhedra

An NNC polyhedron $\cP \in \Pset_n$ is bounded if there exists a $\lambda \in \nonnegRset$ such that

\[ \cP \sseq \bigl\{\, \vect{x} \in \Rset^n \bigm| - \lambda \leq x_j \leq \lambda \text{ for } j = 0, \ldots, n-1 \,\bigr\}. \]

A bounded polyhedron is also called a polytope.

Representations of Convex Polyhedra

NNC polyhedra can be specified by using two possible representations, the constraints (or implicit) representation and the generators (or parametric) representation.

Constraints Representation

In the sequel, we will simply write ``equality'' and ``inequality'' to mean ``linear equality'' and ``linear inequality'', respectively; also, we will refer to either an equality or an inequality as a constraint.

By definition, each polyhedron $\cP \in \Pset_n$ is the set of solutions to a constraint system, i.e., a finite number of constraints. By using matrix notation, we have

\[ \cP \defeq \{\, \vect{x} \in \Rset^n \mid A_1 \vect{x} = \vect{b}_1, A_2 \vect{x} \geq \vect{b}_2, A_3 \vect{x} > \vect{b}_3 \,\}, \]

where, for all $i \in \{1, 2, 3\}$, $A_i \in \Rset^{m_i} \times \Rset^n$ and $\vect{b}_i \in \Rset^{m_i}$, and $m_1, m_2, m_3 \in \Nset$ are the number of equalities, the number of non-strict inequalities, and the number of strict inequalities, respectively.

Combinations and Hulls

Let $S = \{ \vect{x}_1, \ldots, \vect{x}_k \} \sseq \Rset^n$ be a finite set of vectors. For all scalars $\lambda_1, \ldots, \lambda_k \in \Rset$, the vector $\vect{v} = \sum_{j=1}^k \lambda_j \vect{x}_j$ is said to be a linear combination of the vectors in $S$. Such a combination is said to be

We denote by $\linearhull(S)$ (resp., $\conichull(S)$, $\affinehull(S)$, $\convexhull(S)$) the set of all the linear (resp., positive, affine, convex) combinations of the vectors in $S$.

Let $P, C \sseq \Rset^n$, where $P \union C = S$. We denote by $\NNChull(P, C)$ the set of all convex combinations of the vectors in $S$ such that $\lambda_j > 0$ for some $\vect{x}_j \in P$ (informally, we say that there exists a vector of $P$ that plays an active role in the convex combination). Note that $\NNChull(P, C) = \NNChull(P, P \union C)$ so that, if $C \sseq P$,

\[ \convexhull(P) = \NNChull(P, \emptyset) = \NNChull(P, P) = \NNChull(P, C). \]

It can be observed that $\linearhull(S)$ is an affine space, $\conichull(S)$ is a topologically closed convex cone, $\convexhull(S)$ is a topologically closed polytope, and $\NNChull(P, C)$ is an NNC polytope.

Points, Closure Points, Rays and Lines

Let $\cP \in \Pset_n$ be an NNC polyhedron. Then

A point of an NNC polyhedron $\cP \in \Pset_n$ is a vertex if and only if it cannot be expressed as a convex combination of any other pair of distinct points in $\cP$. A ray $\vect{r}$ of a polyhedron $\cP$ is an extreme ray if and only if it cannot be expressed as a positive combination of any other pair $\vect{r}_1$ and $\vect{r}_2$ of rays of $\cP$, where $\vect{r} \neq \lambda \vect{r}_1$, $\vect{r} \neq \lambda \vect{r}_2$ and $\vect{r}_1 \neq \lambda \vect{r}_2$ for all $\lambda \in \nonnegRset$ (i.e., rays differing by a positive scalar factor are considered to be the same ray).

Generators Representation

Each NNC polyhedron $\cP \in \Pset_n$ can be represented by finite sets of lines $L$, rays $R$, points $P$ and closure points $C$ of $\cP$. The 4-tuple $\cG = (L, R, P, C)$ is said to be a generator system for $\cP$, in the sense that

\[ \cP = \linearhull(L) + \conichull(R) + \NNChull(P, C), \]

where the symbol '$+$' denotes the Minkowski's sum.

When $\cP \in \CPset_n$ is a closed polyhedron, then it can be represented by finite sets of lines $L$, rays $R$ and points $P$ of $\cP$. In this case, the 3-tuple $\cG = (L, R, P)$ is said to be a generator system for $\cP$ since we have

\[ \cP = \linearhull(L) + \conichull(R) + \convexhull(P). \]

Thus, in this case, every closure point of $\cP$ is a point of $\cP$.

For any $\cP \in \Pset_n$ and generator system $\cG = (L, R, P, C)$ for $\cP$, we have $\cP = \emptyset$ if and only if $P = \emptyset$. Also $P$ must contain all the vertices of $\cP$ although $\cP$ can be non-empty and have no vertices. In this case, as $P$ is necessarily non-empty, it must contain points of $\cP$ that are not vertices. For instance, the half-space of $\Rset^2$ corresponding to the single constraint $y \geq 0$ can be represented by the generator system $\cG = (L, R, P, C)$ such that $L = \bigl\{ (1, 0)^\transpose \bigr\}$, $R = \bigl\{ (0, 1)^\transpose \bigr\}$, $P = \bigl\{ (0, 0)^\transpose \bigr\}$, and $C = \emptyset$. It is also worth noting that the only ray in $R$ is not an extreme ray of $\cP$.

Minimized Representations

A constraints system $\cC$ for an NNC polyhedron $\cP \in \Pset_n$ is said to be minimized if no proper subset of $\cC$ is a constraint system for $\cP$.

Similarly, a generator system $\cG = (L, R, P, C)$ for an NNC polyhedron $\cP \in \Pset_n$ is said to be minimized if there does not exist a generator system $\cG' = (L', R', P', C') \neq \cG$ for $\cP$ such that $L' \sseq L$, $R' \sseq R$, $P' \sseq P$ and $C' \sseq C$.

Double Description

Any NNC polyhedron $\cP$ can be described by using a constraint system $\cC$, a generator system $\cG$, or both by means of the double description pair (DD pair) $(\cC, \cG)$. The double description method is a collection of well-known as well as novel theoretical results showing that, given one kind of representation, there are algorithms for computing a representation of the other kind and for minimizing both representations by removing redundant constraints/generators.

Such changes of representation form a key step in the implementation of many operators on NNC polyhedra: this is because some operators, such as intersections and poly-hulls, are provided with a natural and efficient implementation when using one of the representations in a DD pair, while being rather cumbersome when using the other.

Topologies and Topological-compatibility

As indicated above, when an NNC polyhedron $\cP$ is necessarily closed, we can ignore the closure points contained in its generator system $\cG = (L, R, P, C)$ (as every closure point is also a point) and represent $\cP$ by the triple $(L, R, P)$. Similarly, $\cP$ can be represented by a constraint system that has no strict inequalities. Thus a necessarily closed polyhedron can have a smaller representation than one that is not necessarily closed. Moreover, operators restricted to work on closed polyhedra only can be implemented more efficiently. For this reason the library provides two alternative ``topological kinds'' for a polyhedron, NNC and C. We shall abuse terminology by referring to the topological kind of a polyhedron as its topology.

In the library, the topology of each polyhedron object is fixed once for all at the time of its creation and must be respected when performing operations on the polyhedron.

Unless it is otherwise stated, all the polyhedra, constraints and/or generators in any library operation must obey the following topological-compatibility rules:

Wherever possible, the library provides methods that, starting from a polyhedron of a given topology, build the corresponding polyhedron having the other topology.

Space Dimensions and Dimension Compatibility

The space dimension of an NNC polyhedron $\cP \in \Pset_n$ (resp., a C polyhedron $\cP \in \CPset_n$) is the dimension $n \in \Nset$ of the corresponding vector space $\Rset^n$. The space dimension of constraints, generators and other objects of the library is defined similarly.

Unless it is otherwise stated, all the polyhedra, constraints and/or generators in any library operation must obey the following (space) dimension-compatibility rules:

While the space dimension of a constraint, a generator or a system thereof is automatically adjusted when needed, the space dimension of a polyhedron can only be changed by explicit calls to operators provided for that purpose.

Affine Independence and Affine Dimension

A finite set of points $\{ \vect{x}_1, \ldots, \vect{x}_k \} \sseq \Rset^n$ is affinely independent if, for all $\lambda_1, \ldots, \lambda_k \in \Rset$, the system of equations

\[ \sum_{i = 1}^k \lambda_i \vect{x}_i = \vect{0}, \quad \sum_{i = 1}^k \lambda_i = 0 \]

implies that, for each $i = 1, \ldots, k$, $\lambda_i = 0$.

The maximum number of affinely independent points in $\Rset^n$ is $n + 1$.

A non-empty NNC polyhedron $\cP \in \Pset_n$ has affine dimension $k \in \Nset$, denoted by $\pdim(\cP) = k$, if the maximum number of affinely independent points in $\cP$ is $k + 1$.

We remark that the above definition only applies to polyhedra that are not empty, so that $0 \leq \pdim(\cP) \leq n$. By convention, the affine dimension of an empty polyhedron is 0 (even though the ``natural'' generalization of the definition above would imply that the affine dimension of an empty polyhedron is $-1$).

Note:
The affine dimension $k \leq n$ of an NNC polyhedron $\cP \in \Pset_n$ must not be confused with the space dimension $n$ of $\cP$, which is the dimension of the enclosing vector space $\Rset^n$. In particular, we can have $\pdim(\cP) \neq \pdim(\cQ)$ even though $\cP$ and $\cQ$ are dimension-compatible; and vice versa, $\cP$ and $\cQ$ may be dimension-incompatible polyhedra even though $\pdim(\cP) = \pdim(\cQ)$.

Rational Polyhedra

An NNC polyhedron is called rational if it can be represented by a constraint system where all the constraints have rational coefficients. It has been shown that an NNC polyhedron is rational if and only if it can be represented by a generator system where all the generators have rational coefficients.

The library only supports rational polyhedra. The restriction to rational numbers applies not only to polyhedra, but also to the other numeric arguments that may be required by the operators considered, such as the coefficients defining (rational) affine transformations.

Operations on Convex Polyhedra

In this section we briefly describe operations on NNC polyhedra that are provided by the library.

Intersection and Convex Polyhedral Hull

For any pair of NNC polyhedra $\cP_1, \cP_2 \in \Pset_n$, the intersection of $\cP_1$ and $\cP_2$, defined as the set intersection $\cP_1 \inters \cP_2$, is the biggest NNC polyhedron included in both $\cP_1$ and $\cP_2$; similarly, the convex polyhedral hull (or poly-hull) of $\cP_1$ and $\cP_2$, denoted by $\cP_1 \uplus \cP_2$, is the smallest NNC polyhedron that includes both $\cP_1$ and $\cP_2$. The intersection and poly-hull of any pair of closed polyhedra in $\CPset_n$ is also closed.

In theoretical terms, the intersection and poly-hull operators defined above are the binary meet and the binary join operators on the lattices $\Pset_n$ and $\CPset_n$.

Convex Polyhedral Difference

For any pair of NNC polyhedra $\cP_1, \cP_2 \in \Pset_n$, the convex polyhedral difference (or poly-difference) of $\cP_1$ and $\cP_2$ is defined as the smallest convex polyhedron containing the set-theoretic difference of $\cP_1$ and $\cP_2$.

In general, even though $\cP_1, \cP_2 \in \CPset_n$ are topologically closed polyhedra, their poly-difference may be a convex polyhedron that is not topologically closed. For this reason, when computing the poly-difference of two C polyhedra, the library will enforce the topological closure of the result.

Concatenating Polyhedra

Viewing a polyhedron as a set of tuples (its points), it is sometimes useful to consider the set of tuples obtained by concatenating an ordered pair of polyhedra. Formally, the concatenation of the polyhedra $\cP \in \Pset_n$ and $\cQ \in \Pset_m$ (taken in this order) is the polyhedron $\cR \in \Pset_{n+m}$ such that

\[ \cR \defeq \Bigl\{\, (x_0, \ldots, x_{n-1}, y_0, \ldots, y_{m-1})^\transpose \in \Rset^{n+m} \Bigm| (x_0, \ldots, x_{n-1})^\transpose \in \cP, (y_0, \ldots, y_{m-1})^\transpose \in \cQ \,\Bigl\}. \]

Another way of seeing it is as follows: first embed polyhedron $\cP$ into a vector space of dimension $n+m$ and then add a suitably renamed-apart version of the constraints defining $\cQ$.

Adding New Dimensions to the Vector Space

The library provides two operators for adding a number $i$ of space dimensions to an NNC polyhedron $\cP \in \Pset_n$, therefore transforming it into a new NNC polyhedron $\cQ \in \Pset_{n+i}$. In both cases, the added dimensions of the vector space are those having the highest indices.

The operator add_space_dimensions_and_embed embeds the polyhedron $\cP$ into the new vector space of dimension $i+n$ and returns the polyhedron $\cQ$ defined by all and only the constraints defining $\cP$ (the variables corresponding to the added dimensions are unconstrained). For instance, when starting from a polyhedron $\cP \sseq \Rset^2$ and adding a third space dimension, the result will be the polyhedron

\[ \cQ = \bigl\{\, (x_0, x_1, x_2)^\transpose \in \Rset^3 \bigm| (x_0, x_1)^\transpose \in \cP \,\bigr\}. \]

In contrast, the operator add_space_dimensions_and_project projects the polyhedron $\cP$ into the new vector space of dimension $i+n$ and returns the polyhedron $\cQ$ whose constraint system, besides the constraints defining $\cP$, will include additional constraints on the added dimensions. Namely, the corresponding variables are all constrained to be equal to 0. For instance, when starting from a polyhedron $\cP \sseq \Rset^2$ and adding a third space dimension, the result will be the polyhedron

\[ \cQ = \bigl\{\, (x_0, x_1, 0)^\transpose \in \Rset^3 \bigm| (x_0, x_1)^\transpose \in \cP \,\bigr\}. \]

Removing Dimensions from the Vector Space

The library provides two operators for removing space dimensions from an NNC polyhedron $\cP \in \Pset_n$, therefore transforming it into a new NNC polyhedron $\cQ \in \Pset_m$ where $m \leq n$.

Given a set of variables, the operator remove_space_dimensions removes all the space dimensions specified by the variables in the set. For instance, letting $\cP \in \Pset_4$ be the singleton set $\bigl\{ (3, 1, 0, 2)^\transpose \bigr\} \sseq \Rset^4$, then after invoking this operator with the set of variables $\{x_1, x_2\}$ the resulting polyhedron is

\[ \cQ = \bigl\{ (3, 2)^\transpose \bigr\} \sseq \Rset^2. \]

Given a space dimension $m$ less than or equal to that of the polyhedron, the operator remove_higher_space_dimensions removes the space dimensions having indices greater than or equal to $m$. For instance, letting $\cP \in \Pset_4$ defined as before, by invoking this operator with $m = 2$ the resulting polyhedron will be

\[ \cQ = \bigl\{ (3, 1)^\transpose \bigr\} \sseq \Rset^2. \]

Mapping the Dimensions of the Vector Space

The operator map_space_dimensions provided by the library maps the dimensions of the vector space $\Rset^n$ according to a partial injective function $\pard{\rho}{\{0, \ldots, n-1\}}{\Nset}$ such that $\rho\bigl(\{0, \ldots, n-1\}\bigr) = \{0, \ldots, m-1\}$ with $m \leq n$. Dimensions corresponding to indices that are not mapped by $\rho$ are removed.

If $m = 0$, i.e., if the function $\rho$ is undefined everywhere, then the operator projects the argument polyhedron $\cP \in \Pset_n$ onto the zero-dimension space $\Rset^0$; otherwise the result is $\cQ \in \Pset_m$ given by

\[ \cQ \defeq \Bigl\{\, \bigl(v_{\rho^{-1}(0)}, \ldots, v_{\rho^{-1}(m-1)}\bigr)^\transpose \Bigm| (v_0, \ldots, v_{n-1})^\transpose \in \cP \,\Bigr\}. \]

Expanding One Dimension of the Vector Space to Multiple Dimensions

The operator expand_space_dimension provided by the library adds $m$ new space dimensions to a polyhedron $\cP \in \Pset_n$, with $n > 0$, so that dimensions $n$, $n+1$, $\ldots$, $n+m-1$ of the result $\cQ$ are exact copies of the $i$-th space dimension of $\cP$. More formally,

\[ \cQ \defeq \sset{ \vect{u} \in \Rset^{n+m} }{ \exists \vect{v}, \vect{w} \in \cP \st u_i = v_i \\ \qquad \mathord{} \land \forall j = n, n+1, \ldots, n+m-1 \itc u_j = w_i \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_k = v_k = w_k }. \]

This operation has been proposed in [GDMDRS04].

Folding Multiple Dimensions of the Vector Space into One Dimension

The operator fold_space_dimensions provided by the library, given a polyhedron $\cP \in \Pset_n$, with $n > 0$, folds a set of space dimensions $J = \{ j_0, \ldots, j_{m-1} \}$, with $m < n$ and $j < n$ for each $j \in J$, into space dimension $i < n$, where $i \notin J$. The result is given by

\[ \cQ \defeq \biguplus_{d = 0}^m \cQ_d \]

where

\[ \cQ_m \defeq \sset{ \vect{u} \in \Rset^{n-m} }{ \exists \vect{v} \in \cP \st u_{i'} = v_i \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_{k'} = v_k } \]

and, for $ d = 0 $, $ \ldots $, $ m-1 $,

\[ \cQ_d \defeq \sset{ \vect{u} \in \Rset^{n-m} }{ \exists \vect{v} \in \cP \st u_{i'} = v_{j_d} \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_{k'} = v_k }, \]

and, finally, for $ k = 0 $, $ \ldots $, $ n-1 $,

\[ k' \defeq k - \card \{\, j \in J \mid k > j \,\}, \]

($\card S$ denotes the cardinality of the finite set $S$).

This operation has been proposed in [GDMDRS04].

Images and Preimages of Affine Transfer Relations

For each relation $\reld{\phi}{\Rset^n}{\Rset^m}$, we denote by $\phi(S) \sseq \Rset^m$ the image under $\phi$ of the set $S \sseq \Rset^n$; formally,

\[ \phi(S) \defeq \bigl\{\, \vect{w} \in \Rset^m \bigm| \exists \vect{v} \in S \st (\vect{v}, \vect{w}) \in \phi \,\bigr\}. \]

Similarly, we denote by $\phi^{-1}(S') \sseq \Rset^n$ the preimage under $\phi$ of $S' \sseq \Rset^m$, that is

\[ \phi^{-1}(S') \defeq \bigl\{\, \vect{v} \in \Rset^n \bigm| \exists \vect{w} \in S' \st (\vect{v}, \vect{w}) \in \phi \,\bigr\}. \]

If $n = m$, then the relation $\phi$ is said to be space dimension preserving.

The relation $\reld{\phi}{\Rset^n}{\Rset^m}$ is said to be an affine relation if there exists $\ell \in \Nset$ such that

\[ \forall \vect{v} \in \Rset^n, \vect{w} \in \Rset^m \itc (\vect{v}, \vect{w}) \in \phi \iff \bigland_{i=1}^{\ell} \bigl( \langle \vect{c}_i, \vect{w} \rangle \relsym_i \langle \vect{a}_i, \vect{v} \rangle + b_i \bigr), \]

where $\vect{a}_i \in \Rset^n$, $\vect{c}_i \in \Rset^m$, $b_i \in \Rset$ and $\mathord{\relsym}_i \in \{ <, \leq, =, \geq, > \}$, for each $i = 1, \ldots, \ell$.

As a special case, the relation $\reld{\phi}{\Rset^n}{\Rset^m}$ is an affine function if and only if there exist a matrix $A \in \Rset^m \times \Rset^n$ and a vector $\vect{b} \in \Rset^m$ such that,

\[ \forall \vect{v} \in \Rset^n, \vect{w} \in \Rset^m \itc (\vect{v}, \vect{w}) \in \phi \iff \vect{w} = A\vect{v} + \vect{b}. \]

The set $\Pset_n$ of NNC polyhedra is closed under the application of images and preimages of any space dimension preserving affine relation. The same property holds for the set $\CPset_n$ of closed polyhedra, provided the affine relation makes no use of the strict relation symbols $<$ and $>$. Images and preimages of affine relations can be used to model several kinds of transition relations, including deterministic assignments of affine expressions, (affinely constrained) nondeterministic assignments and affine conditional guards.

A space dimension preserving relation $\reld{\phi}{\Rset^n}{\Rset^n}$ can be specified by means of a shorthand notation:

As an example, assuming $\reld{\phi}{\Rset^3}{\Rset^3}$, the notation $x'_0 - x'_2 \geq 2 x_0 - x_1$, where the primed variable $x'_1$ does not occur, is meant to specify the affine relation defined by

\[ \forall \vect{v} \in \Rset^3, \vect{w} \in \Rset^3 \itc (\vect{v}, \vect{w}) \in \phi \iff (w_0 - w_2 \geq 2 v_0 - v_1) \land (w_1 = v_1). \]

The same relation is specified by $x'_0 + 0 \cdot x'_1 - x'_2 \geq 2 x_0 - x_1$, since $x'_1$ occurs with coefficient 0.

The library allows for the computation of images and preimages of polyhedra under restricted subclasses of space dimension preserving affine relations, as described in the following.

Single-Update Affine Functions.

Given a primed variable $x'_k$ and an unprimed affine expression $\langle \vect{a}, \vect{x} \rangle + b$, the affine function $\fund{\phi = \bigl(x'_k = \langle \vect{a}, \vect{x} \rangle + b\bigr)} {\Rset^n}{\Rset^n}$ is defined by

\[ \forall \vect{v} \in \Rset^n \itc \phi(\vect{v}) = A\vect{v} + \vect{b}, \]

where

\[ A = \begin{pmatrix} 1 & & 0 & 0 & \cdots & \cdots & 0 \\ & \ddots & & \vdots & & & \vdots \\ 0 & & 1 & 0 & \cdots & \cdots & 0 \\ a_0 & \cdots & a_{k-1} & a_k & a_{k+1} & \cdots & a_{n-1} \\ 0 & \cdots & \cdots & 0 & 1 & & 0 \\ \vdots & & & \vdots & & \ddots & \\ 0 & \cdots & \cdots & 0 & 0 & & 1 \end{pmatrix}, \qquad \vect{b} = \begin{pmatrix} 0 \\ \vdots \\ 0 \\ b \\ 0 \\ \vdots \\ 0 \end{pmatrix} \]

and the $a_i$ (resp., $b$) occur in the $(k+1)$st row in $A$ (resp., position in $\vect{b}$). Thus function $\phi$ maps any vector $(v_0, \ldots, v_{n-1})^\transpose$ to

\[ \Bigl(v_0, \ldots, \bigl(\textstyle{\sum_{i=0}^{n-1}} a_i v_i + b\bigr), \ldots, v_{n-1}\Bigr)^\transpose. \]

The affine image operator computes the affine image of a polyhedron $\cP$ under $x'_k = \langle \vect{a}, \vect{x} \rangle + b$. For instance, suppose the polyhedron $\cP$ to be transformed is the square in $\Rset^2$ generated by the set of points $\bigl\{ (0, 0)^\transpose, (0, 3)^\transpose, (3, 0)^\transpose, (3, 3)^\transpose \bigr\}$. Then, if the primed variable is $x_0$ and the affine expression is $x_0 + 2 x_1 + 4$ (so that $k = 0$, $a_0 = 1, a_1 = 2, b = 4$), the affine image operator will translate $\cP$ to the parallelogram $\cP_1$ generated by the set of points $\bigl\{ (4, 0)^\transpose, (10, 3)^\transpose, (7, 0)^\transpose, (13, 3)^\transpose \bigr\}$ with height equal to the side of the square and oblique sides parallel to the line $x_0 - 2 x_1$. If the primed variable is as before (i.e., $k = 0$) but the affine expression is $x_1$ (so that $a_0 = 0, a_1 = 1, b = 0$), then the resulting polyhedron $\cP_2$ is the positive diagonal of the square.

The affine preimage operator computes the affine preimage of a polyhedron $\cP$ under $x'_k = \langle \vect{a}, \vect{x} \rangle + b$. For instance, suppose now that we apply the affine preimage operator as given in the first example using primed variable $x_0$ and affine expression $x_0 + 2 x_1 + 4$ to the parallelogram $\cP_1$; then we get the original square $\cP$ back. If, on the other hand, we apply the affine preimage operator as given in the second example using primed variable $x_0$ and affine expression $x_1$ to $\cP_2$, then the resulting polyhedron is the stripe obtained by adding the line $(1, 0)^\transpose$ to polyhedron $\cP_2$.

Observe that provided the coefficient $a_k$ of the considered variable in the affine expression is non-zero, the affine function is invertible.

Single-Update Bounded Affine Relations.

Given a primed variable $x'_k$ and two unprimed affine expressions $\mathrm{lb} = \langle \vect{a}, \vect{x} \rangle + b$ and $\mathrm{ub} = \langle \vect{c}, \vect{x} \rangle + d$, the bounded affine relation $\phi = (\mathrm{lb} \leq x'_k \leq \mathrm{ub})$ is defined as

\[ \forall \vect{v} \in \Rset^n, \vect{w} \in \Rset^n \itc (\vect{v}, \vect{w}) \in \phi \iff \bigl( \langle \vect{a}, \vect{v} \rangle + b \leq w_k \leq \langle \vect{c}, \vect{v} \rangle + d \bigr) \land \Bigl( \bigland_{0 \leq i < n, i \neq k} w_i = v_i \Bigr). \]

Generalized Affine Relations.

Similarly, the generalized affine relation $\phi = (\mathrm{lhs}' \relsym \mathrm{rhs})$, where $\mathrm{lhs} = \langle \vect{c}, \vect{x} \rangle + d$ and $\mathrm{rhs} = \langle \vect{a}, \vect{x} \rangle + b$ are affine expressions and $\mathord{\relsym} \in \{ <, \leq, =, \geq, > \}$ is a relation symbol, is defined as

\[ \forall \vect{v} \in \Rset^n, \vect{w} \in \Rset^n \itc (\vect{v}, \vect{w}) \in \phi \iff \bigl( \langle \vect{c}, \vect{w} \rangle + d \relsym \langle \vect{a}, \vect{v} \rangle + b \bigr) \land \Bigl( \bigland_{0 \leq i < n, c_i = 0} w_i = v_i \Bigr). \]

When $\mathrm{lhs} = x_k$ and $\mathord{\relsym} \in \{ = \}$, then the above affine relation becomes equivalent to the single-update affine function $x'_k = \mathrm{rhs}$ (hence the name given to this operator). It is worth stressing that the notation is not symmetric, because the variables occurring in expression $\mathrm{lhs}$ are interpreted as primed variables, whereas those occurring in $\mathrm{rhs}$ are unprimed; for instance, the transfer relations $\mathrm{lhs}' \leq \mathrm{rhs}$ and $\mathrm{rhs}' \geq \mathrm{lhs}$ are not equivalent in general.

Cylindrification Operator

The operator unconstrain computes the cylindrification [HMT71] of a polyhedron with respect to one of its variables. Formally, the cylindrification $\cQ \in \Pset_n$ of an NNC polyhedron $\cP \in \Pset_n$ with respect to variable index $i \in \{ 0, \ldots, n-1 \}$ is defined as follows:

\[ \cQ = \bigl\{\, \vect{w} \in \Rset^n \bigm| \exists \vect{v} \in \cP \st \forall j \in \{0, \ldots, n-1\} \itc j \neq i \implies w_j = v_j \,\bigr\}. \]

Cylindrification is an idempotent operation; in particular, note that the computed result has the same space dimension of the original polyhedron. A variant of the operator above allows for the cylindrification of a polyhedron with respect to a finite set of variables.

Time-Elapse Operator

The time-elapse operator has been defined in [HPR97]. Actually, the time-elapse operator provided by the library is a slight generalization of that one, since it also works on NNC polyhedra. For any two NNC polyhedra $\cP, \cQ \in \Pset_n$, the time-elapse between $\cP$ and $\cQ$, denoted $ \cP \nearrow \cQ$, is the smallest NNC polyhedron containing the set

\[ \bigl\{\, \vect{p} + \lambda \vect{q} \in \Rset^n \bigm| \vect{p} \in \cP, \vect{q} \in \cQ, \lambda \in \nonnegRset \,\bigr\}. \]

Note that, if $\cP,\cQ \in \CPset_n$ are closed polyhedra, the above set is also a closed polyhedron. In contrast, when $\cQ$ is not topologically closed, the above set might not be an NNC polyhedron.

Meet-Preserving Enlargement and Simplification

Let $\cP, \cQ, \cR \in \Pset_n$ be NNC polyhedra. Then:

Notice that an enlargement need not be a simplification, and vice versa; moreover, the identity function is (trivially) a meet-preserving enlargement and simplification.

The library provides a binary operator (simplify_using_context) for the domain of NNC polyhedra that returns a polyhedron which is a meet-preserving enlargement simplification of its first argument using the second argument as context.

The concept of meet-preserving enlargement and simplification also applies to the other basic domains (boxes, grids, BD and octagonal shapes). See below for a definition of the concept of meet-preserving simplification for powerset domains.

Relation-With Operators

The library provides operators for checking the relation holding between an NNC polyhedron and either a constraint or a generator.

Suppose $\cP$ is an NNC polyhedron and $\cC$ an arbitrary constraint system representing $\cP$. Suppose also that $ c = \bigl( \langle \vect{a}, \vect{x} \rangle \relsym b \bigr) $ is a constraint with $\mathord{\relsym} \in \{ =, \geq, > \}$ and $\cQ$ the set of points that satisfy $c$. The possible relations between $\cP$ and $c$ are as follows.

The polyhedron $\cP$ subsumes the generator $g$ if adding $g$ to any generator system representing $\cP$ does not change $\cP$.

Intervals and Boxes

An interval in $\Rset$ is a pair of bounds, called lower and upper. Each bound can be either (1) closed and bounded, (2) open and bounded, or (3) open and unbounded. If the bound is bounded, then it has a value in $\Rset$. An $n$-dimensional box $\cB$ in $\Rset^n$ is a sequence of $n$ intervals in $\Rset$.

The polyhedron $\cP$ represents a box $\cB$ in $\Rset^n$ if $\cP$ is described by a constraint system in $\Rset^n$ that consists of one constraint for each bounded bound (lower and upper) in an interval in $\cB$: Letting $\vect{e}_i = (0, \ldots, 1, \ldots, 0)^\transpose$ be the vector in $\Rset^n$ with 1 in the $i$'th position and zeroes in every other position; if the lower bound of the $i$'th interval in $\cB$ is bounded, the corresponding constraint is defined as $\langle \vect{e}_i, \vect{x} \rangle \relsym b$, where $b$ is the value of the bound and $\mathord{\relsym}$ is $\mathord{\geq}$ if it is a closed bound and $\mathord{>}$ if it is an open bound. Similarly, if the upper bound of the $i$'th interval in $\cB$ is bounded, the corresponding constraint is defined as $\langle\vect{e}_i,\vect{x}\rangle \relsym b$, where $b$ is the value of the bound and $\mathord{\relsym}$ is $\mathord{\leq}$ if it is a closed bound and $\mathord{<}$ if it is an open bound.

If every bound in the intervals defining a box $\cB$ is either closed and bounded or open and unbounded, then $\cB$ represents a closed polyhedron.

Widening Operators

The library provides two widening operators for the domain of polyhedra. The first one, that we call H79-widening, mainly follows the specification provided in the PhD thesis of N. Halbwachs [Hal79], also described in [HPR97]. Note that in the computation of the H79-widening $\cP \widen \cQ$ of two polyhedra $\cP, \cQ \in \CPset_n$ it is required as a precondition that $\cP \sseq \cQ$ (the same assumption was implicitly present in the cited papers).

The second widening operator, that we call BHRZ03-widening, is an instance of the specification provided in [BHRZ03a]. This operator also requires as a precondition that $\cP \sseq \cQ$ and it is guaranteed to provide a result which is at least as precise as the H79-widening.

Both widening operators can be applied to NNC polyhedra. The user is warned that, in such a case, the results may not closely match the geometric intuition which is at the base of the specification of the two widenings. The reason is that, in the current implementation, the widenings are not directly applied to the NNC polyhedra, but rather to their internal representations. Implementation work is in progress and future versions of the library may provide an even better integration of the two widenings with the domain of NNC polyhedra.

Note:
As is the case for the other operators on polyhedra, the implementation overwrites one of the two polyhedra arguments with the result of the widening application. To avoid trivial misunderstandings, it is worth stressing that if polyhedra $\cP$ and $\cQ$ (where $\cP \sseq \cQ$) are identified by program variables p and q, respectively, then the call q.H79_widening_assign(p) will assign the polyhedron $\cP \widen \cQ$ to variable q. Namely, it is the bigger polyhedron $\cQ$ which is overwritten by the result of the widening. The smaller polyhedron is not modified, so as to lead to an easier coding of the usual convergence test ($\cP \Sseq \cP \widen \cQ$ can be coded as p.contains(q)). Note that, in the above context, a call such as p.H79_widening_assign(q) is likely to result in undefined behavior, since the precondition $\cQ \sseq \cP$ will be missed (unless it happens that $\cP = \cQ$). The same observation holds for all flavors of widenings and extrapolation operators that are implemented in the library and for all the foreign language interfaces.

Widening with Tokens

When approximating a fixpoint computation using widening operators, a common tactic to improve the precision of the final result is to delay the application of widening operators. The usual approach is to fix a parameter $k$ and only apply widenings starting from the $k$-th iteration.

The library also supports an improved widening delay strategy, that we call widening with tokens [BHRZ03a]. A token is a sort of wild card allowing for the replacement of the widening application by the exact upper bound computation: the token is used (and thus consumed) only when the widening would have resulted in an actual precision loss (as opposed to the potential precision loss of the classical delay strategy). Thus, all widening operators can be supplied with an optional argument, recording the number of available tokens, which is decremented when tokens are used. The approximated fixpoint computation will start with a fixed number $k$ of tokens, which will be used if and when needed. When there are no tokens left, the widening is always applied.

Extrapolation Operators

Besides the two widening operators, the library also implements several extrapolation operators, which differ from widenings in that their use along an upper iteration sequence does not ensure convergence in a finite number of steps.

In particular, for each of the two widenings there is a corresponding limited extrapolation operator, which can be used to implement the widening ``up to'' technique as described in [HPR97]. Each limited extrapolation operator takes a constraint system as an additional parameter and uses it to improve the approximation yielded by the corresponding widening operator. Note that a convergence guarantee can only be obtained by suitably restricting the set of constraints that can occur in this additional parameter. For instance, in [HPR97] this set is fixed once and for all before starting the computation of the upward iteration sequence.

The bounded extrapolation operators further enhance each one of the limited extrapolation operators described above, by ensuring that their results cannot be worse than the smallest boxes enclosing the two argument polyhedra.

Weakly-Relational Shapes

The PPL provides support for computations on numerical domains that, in selected contexts, can achieve a better precision/efficiency ratio with respect to the corresponding computations on a ``fully relational'' domain of convex polyhedra. This is achieved by restricting the syntactic form of the constraints that can be used to describe the domain elements.

Bounded Difference Shapes

For each vector $\vect{a} \in \Rset^n$ and scalar $b \in \Rset$, and for each relation symbol $\mathord{\relsym} \in \{ =, \geq\}$, the linear constraint $\langle \vect{a}, \vect{x} \rangle \relsym b$ is said to be a bounded difference if there exist two indices $i, j \in \{ 0, \ldots, n-1 \}$ such that:

A convex polyhedron $\cP \in \CPset_n$ is said to be a bounded difference shape (BDS, for short) if and only if either $\cP$ can be expressed as the intersection of a finite number of bounded difference constraints or $n = 0$ and $\cP = \emptyset$.

Octagonal Shapes

For each vector $\vect{a} \in \Rset^n$ and scalar $b \in \Rset$, and for each relation symbol $\mathord{\relsym} \in \{ =, \geq\}$, the linear constraint $\langle \vect{a}, \vect{x} \rangle \relsym b$ is said to be an octagonal if there exist two indices $i, j \in \{ 0, \ldots, n-1 \}$ such that:

A convex polyhedron $\cP \in \CPset_n$ is said to be an octagonal shape (OS, for short) if and only if either $\cP$ can be expressed as the intersection of a finite number of octagonal constraints or $n = 0$ and $\cP = \emptyset$.

Note that, since any bounded difference is also an octagonal constraint, any BDS is also an OS. The name ``octagonal'' comes from the fact that, in a vector space of dimension 2, a bounded OS can have eight sides at most.

Weakly-Relational Shapes Interface

By construction, any BDS or OS is always topologically closed. Under the usual set inclusion ordering, the set of all BDSs (resp., OSs) on the vector space $\Rset^n$ is a lattice having the empty set $\emptyset$ and the universe $\Rset^n$ as the smallest and the biggest elements, respectively. In theoretical terms, it is a meet sub-lattice of $\CPset_n$; moreover, the lattice of BDSs is a meet sublattice of the lattice of OSs. The least upper bound of a finite set of BDSs (resp., OSs) is said to be their bds-hull (resp., oct-hull).

As far as the representation of the rational inhomogeneous term of each bounded difference or octagonal constraint is concerned, several rounding-aware implementation choices are available, including:

The user interface for BDSs and OSs is meant to be as similar as possible to the one developed for the domain of closed polyhedra: in particular, all operators on polyhedra are also available for the domains of BDSs and OSs, even though they are typically characterized by a lower degree of precision. For instance, the bds-difference and oct-difference operators return (the smallest) over-approximations of the set-theoretical difference operator on the corresponding domains. In the case of (generalized) images and preimages of affine relations, suitable (possibly not-optimal) over-approximations are computed when the considered relations cannot be precisely modeled by only using bounded differences or octagonal constraints.

Widening and Extrapolation Operators on Weakly-Relational Shapes

For the domains of BDSs and OSs, the library provides a variant of the widening operator for convex polyhedra defined in [CH78]. The implementation follows the specification in [BHMZ05], resulting in an operator which is well-defined on the corresponding domain (i.e., it does not depend on the internal representation of BDSs or OSs), while still ensuring convergence in a finite number of steps.

The library also implements an extension of the widening operator for intervals as defined in [CC76]. The reader is warned that such an extension, even though being well-defined on the domain of BDSs and OSs, is not provided with a convergence guarantee and is therefore an extrapolation operator.

Rational Grids

In this section we introduce rational grids as provided by the library. See also [BDHMZ05] for a detailed description of this domain.

The library supports two representations for the grids domain; congruence systems and grid generator systems. We first describe linear congruence relations which form the elements of a congruence system.

Congruences and Congruence Relations

For any $a, b, f \in \Rset$, $a \equiv_f b$ denotes the congruence $\exists \mu \in \Zset \st a - b = \mu f$.

Let $\Sset \in \{ \Qset, \Rset \}$. For each vector $\vect{a} \in \Sset^n \setdiff \{\vect{0}\}$ and scalars $b, f \in \Sset$, the notation $\langle \vect{a}, \vect{x} \rangle \equiv_f b$ stands for the linear congruence relation in $\Sset^n$ defined by the set of vectors

\[ \bigl\{\, \vect{v} \in \Rset^n \bigm| \exists \mu \in \Zset \st \langle \vect{a}, \vect{v} \rangle = b + \mu f \,\bigr\}; \]

when $f \neq 0$, the relation is said to be proper; $\langle \vect{a}, \vect{x} \rangle \equiv_0 b$ (i.e., when $f = 0$) denotes the equality $\langle \vect{a}, \vect{x} \rangle = b$. $f$ is called the frequency or modulus and $b$ the base value of the relation. Thus, provided $\vect{a} \neq \vect{0}$, the relation $\langle \vect{a}, \vect{x} \rangle \equiv_f b$ defines the set of affine hyperplanes

\[ \big\{\, \bigl(\langle \vect{a}, \vect{x} \rangle = b + \mu f\bigr) \bigm| \mu \in \Zset \,\bigr\}; \]

if $b \equiv_f 0$, $\langle \vect{0}, \vect{x} \rangle \equiv_f b$ defines the universe $\Rset^n$ and the empty set, otherwise.

Rational Grids

The set $\cL \sseq \Rset^n$ is a rational grid if and only if either $\cL$ is the set of vectors in $\Rset^n$ that satisfy a finite system $\cC$ of congruence relations in $\Qset^n$ or $n = 0$ and $\cL = \emptyset$.

We also say that $\cL$ is described by $\cC$ and that $\cC$ is a congruence system for $\cL$.

The grid domain $\Gset_{n}$ is the set of all rational grids described by finite sets of congruence relations in $\Qset^n$.

If the congruence system $\cC$ describes the $\emptyset$, the empty grid, then we say that $\cC$ is inconsistent. For example, the congruence systems $\bigl\{\langle\vect{0}, \vect{x}\rangle \equiv_0 1\bigr\}$ meaning that $0 = 1$ and $\bigl\{\langle\vect{a}, \vect{x}\rangle \equiv_2 0, \langle\vect{a}, \vect{x}\rangle \equiv_2 1\bigr\}$, for any $\vect{a} \in \Rset^n$, meaning that the value of an expression must be both even and odd are both inconsistent since both describe the empty grid.

When ordering grids by the set inclusion relation, the empty set $\emptyset$ and the vector space $\Rset^n$ (which is described by the empty set of congruence relations) are, respectively, the smallest and the biggest elements of $\Gset_n$. The vector space $\Rset^n$ is also called the universe grid.

In set theoretical terms, $\Gset_n$ is a lattice under set inclusion.

Integer Combinations

Let $S = \{ \vect{x}_1, \ldots, \vect{x}_k \} \sseq \Rset^n$ be a finite set of vectors. For all scalars $\mu_1, \ldots, \mu_k \in \Zset$, the vector $\vect{v} = \sum_{j=1}^k \mu_j \vect{x}_j$ is said to be a integer combination of the vectors in $S$.

We denote by $\inthull(S)$ (resp., $\intaffinehull(S)$) the set of all the integer (resp., integer and affine) combinations of the vectors in $S$.

Points, Parameters and Lines

Let $\cL$ be a grid. Then

The Grid Generator Representation

We can generate any rational grid in $\Gset_n$ from a finite subset of its points, parameters and lines; each point in a grid is obtained by adding a linear combination of its generating lines to an integral combination of its parameters and an integral affine combination of its generating points.

If $L, Q, P$ are each finite subsets of $\Qset^n$ and

\[ \cL = \linearhull(L) + \inthull(Q) + \intaffinehull(P) \]

where the symbol '$+$' denotes the Minkowski's sum, then $\cL \in \Gset_n$ is a rational grid (see Section 4.4 in [Sch99] and also Proposition 8 in [BDHMZ05]). The 3-tuple $(L, Q, P)$ is said to be a grid generator system for $\cL$ and we write $\cL = \ggen(L, Q, P)$.

Note that the grid $\cL = \ggen(L, Q, P) = \emptyset$ if and only if the set of grid points $P = \emptyset$. If $P \neq \emptyset$, then $\cL = \ggen(L, \emptyset, Q_{\vect{p}} \union P)$ where, for some $\vect{p} \in P$, $Q_{\vect{p}} = \{\, \vect{p} + \vect{q} \mid \vect{q} \in Q \,\}$.

Minimized Grid Representations

A minimized congruence system $\cC$ for $\cL$ is such that, if $\cC'$ is another congruence system for $\cL$, then $\card \cC \leq \card \cC'$. Note that a minimized congruence system for a non-empty grid has at most $n$ congruence relations.

Similarly, a minimized grid generator system $\cG = (L, Q, P)$ for $\cL$ is such that, if $\cG' = (L', Q', P')$ is another grid generator system for $\cL$, then $\card L \leq \card L'$ and $\card Q + \card P \leq \card Q' + \card P'$. Note that a minimized grid generator system for a grid has no more than a total of $n+1$ grid lines, parameters and points.

Double Description for Grids

As for convex polyhedra, any grid $\cL$ can be described by using a congruence system $\cC$ for $\cL$, a grid generator system $\cG$ for $\cL$, or both by means of the double description pair (DD pair) $(\cC, \cG)$. The double description method for grids is a collection of theoretical results very similar to those for convex polyhedra showing that, given one kind of representation, there are algorithms for computing a representation of the other kind and for minimizing both representations.

As for convex polyhedra, such changes of representation form a key step in the implementation of many operators on grids such as, for example, intersection and grid join.

Space Dimensions and Dimension-compatibility for Grids

The space dimension of a grid $\cL \in \Gset_n$ is the dimension $n \in \Nset$ of the corresponding vector space $\Rset^n$. The space dimension of congruence relations, grid generators and other objects of the library is defined similarly.

Affine Independence and Affine Dimension for Grids

A non-empty grid $\cL \in \Gset_n$ has affine dimension $k \in \Nset$, denoted by $\pdim(\cG) = k$, if the maximum number of affinely independent points in $\cG$ is $k + 1$. The affine dimension of an empty grid is defined to be 0. Thus we have $0 \leq \pdim(\cG) \leq n$.

Operations on Rational Grids

In this section we briefly describe operations on rational grids that are provided by the library. These are similar to those described in Section Operations on Convex Polyhedra.

Grid Intersection and Grid Join

For any pair of grids $\cL_1, \cL_2 \in \Gset_n$, the intersection of $\cL_1$ and $\cL_2$, defined as the set intersection $\cL_1 \inters \cL_2$, is the largest grid included in both $\cL_1$ and $\cL_2$; similarly, the grid join of $\cL_1$ and $\cL_2$, denoted by $\cL_1 \uplus \cL_2$, is the smallest grid that includes both $\cL_1$ and $\cL_2$.

In theoretical terms, the intersection and grid join operators defined above are the binary meet and the binary join operators on the lattice $\Gset_n$.

Grid Difference

For any pair of grids $\cL_1, \cL_2 \in \Gset_n$, the grid difference of $\cL_1$ and $\cL_2$ is defined as the smallest grid containing the set-theoretic difference of $\cL_1$ and $\cL_2$.

Concatenating Grids

Viewing a grid as a set of tuples (its points), it is sometimes useful to consider the set of tuples obtained by concatenating an ordered pair of grids. Formally, the concatenation of the grids $\cL_1 \in \Gset_n$ and $\cL_2 \in \Gset_m$ (taken in this order) is the grid in $\Gset_{n+m}$ defined as

\[ \Bigl\{\, (x_0, \ldots, x_{n-1}, y_0, \ldots, y_{m-1})^\transpose \in \Rset^{n+m} \Bigm| (x_0, \ldots, x_{n-1})^\transpose \in \cL_1, (y_0, \ldots, y_{m-1})^\transpose \in \cL_2 \,\Bigl\}. \]

Another way of seeing it is as follows: first embed grid $\cL_1$ into a vector space of dimension $n+m$ and then add a suitably renamed-apart version of the congruence relations defining $\cL_2$.

Adding New Dimensions to the Vector Space

The library provides two operators for adding a number $i$ of space dimensions to a grid $\cL \in \Gset_n$, therefore transforming it into a new grid in $\Gset_{n+i}$. In both cases, the added dimensions of the vector space are those having the highest indices.

The operator add_space_dimensions_and_embed embeds the grid $\cL$ into the new vector space of dimension $i+n$ and returns the grid defined by all and only the congruences defining $\cL$ (the variables corresponding to the added dimensions are unconstrained). For instance, when starting from a grid $\cL \sseq \Rset^2$ and adding a third space dimension, the result will be the grid

\[ \bigl\{\, (x_0, x_1, x_2)^\transpose \in \Rset^3 \bigm| (x_0, x_1)^\transpose \in \cL \,\bigr\}. \]

In contrast, the operator add_space_dimensions_and_project projects the grid $\cL$ into the new vector space of dimension $i+n$ and returns the grid whose congruence system, besides the congruence relations defining $\cL$, will include additional equalities on the added dimensions. Namely, the corresponding variables are all constrained to be equal to 0. For instance, when starting from a grid $\cL \sseq \Rset^2$ and adding a third space dimension, the result will be the grid

\[ \bigl\{\, (x_0, x_1, 0)^\transpose \in \Rset^3 \bigm| (x_0, x_1)^\transpose \in \cL \,\bigr\}. \]

Removing Dimensions from the Vector Space

The library provides two operators for removing space dimensions from a grid $\cL \in \Gset_n$, therefore transforming it into a new grid in $\Gset_m$ where $m \leq n$.

Given a set of variables, the operator remove_space_dimensions removes all the space dimensions specified by the variables in the set.

Given a space dimension $m$ less than or equal to that of the grid, the operator remove_higher_space_dimensions removes the space dimensions having indices greater than or equal to $m$.

Mapping the Dimensions of the Vector Space

The operator map_space_dimensions provided by the library maps the dimensions of the vector space $\Rset^n$ according to a partial injective function $\pard{\rho}{\{0, \ldots, n-1\}}{\Nset}$ such that

\[ \rho\bigl(\{0, \ldots, n-1\}\bigr) = \{0, \ldots, m-1\} \]

with $m \leq n$. Dimensions corresponding to indices that are not mapped by $\rho$ are removed.

If $m = 0$, i.e., if the function $\rho$ is undefined everywhere, then the operator projects the argument grid $\cL \in \Gset_n$ onto the zero-dimension space $\Rset^0$; otherwise the result is a grid in $\Gset_m$ given by

\[ \Bigl\{\, \bigl(v_{\rho^{-1}(0)}, \ldots, v_{\rho^{-1}(m-1)}\bigr)^\transpose \Bigm| (v_0, \ldots, v_{n-1})^\transpose \in \cL \,\Bigr\}. \]

Expanding One Dimension of the Vector Space to Multiple Dimensions

The operator expand_space_dimension provided by the library adds $m$ new space dimensions to a grid $\cL \in \Gset_n$, with $n > 0$, so that dimensions $n$, $n+1$, $\ldots$, $n+m-1$ of the resulting grid are exact copies of the $i$-th space dimension of $\cL$. More formally, the result is a grid in $\Gset_m$ given by

\[ \sset{ \vect{u} \in \Rset^{n+m} }{ \exists \vect{v}, \vect{w} \in \cL \st u_i = v_i \\ \qquad \mathord{} \land \forall j = n, n+1, \ldots, n+m-1 \itc u_j = w_i \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_k = v_k = w_k }. \]

Folding Multiple Dimensions of the Vector Space into One Dimension

The operator fold_space_dimensions provided by the library, given a grid $\cL \in \Gset_n$, with $n > 0$, folds a subset $J$ of the set of space dimensions $\{0, \ldots, n-1\}$ into a space dimension $i < n$, where $i \notin J$. Letting $m = \card J$, the result is given by the grid join

\[ \cL_0 \uplus \cdots \uplus \cL_m \]

where

\[ \cL_m \defeq \sset{ \vect{u} \in \Rset^{n-m} }{ \exists \vect{v} \in \cL \st u_{i'} = v_i \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_{k'} = v_k }, \]

for $ d = 0 $, $ \ldots $, $ m-1 $,

\[ \cL_d \defeq \sset{ \vect{u} \in \Rset^{n-m} }{ \exists \vect{v} \in \cL \st u_{i'} = v_{j_d} \\ \qquad \mathord{} \land \forall k = 0, \ldots, n-1 \itc k \neq i \implies u_{k'} = v_k } \]

and, for $ k = 0 $, $ \ldots $, $ n-1 $,

\[ k' \defeq k - \card \{\, j \in J \mid k > j \,\}. \]

Affine Images and Preimages

As for convex polyhedra (see Single-Update Affine Functions), the library provides affine image and preimage operators for grids: given a variable $x_k$ and linear expression $\mathrm{expr} = \langle \vect{a}, \vect{x} \rangle + b$, these determine the affine transformation $\fund{\phi = \bigl(x'_k = \langle \vect{a}, \vect{x} \rangle + b\bigr)} {\Rset^n}{\Rset^n}$ that transforms any point $(v_0, \ldots, v_{n-1})^\transpose$ in a grid $\cL$ to

\[ \Bigl(v_0, \ldots, \bigl(\textstyle{\sum_{i=0}^{n-1}} a_i v_i + b\bigr), \ldots, v_{n-1}\Bigr)^\transpose. \]

The affine image operator computes the affine image of a grid $\cL$ under $x'_k = \langle \vect{a}, \vect{x} \rangle + b$. For instance, suppose the grid $\cL$ to be transformed is the non-relational grid in $\Rset^2$ generated by the set of grid points $\bigl\{ (0, 0)^\transpose, (0, 3)^\transpose, (3, 0)^\transpose \bigr\}$. Then, if the considered variable is $x_0$ and the linear expression is $3x_0 + 2 x_1 + 1$ (so that $k = 0$, $a_0 = 3, a_1 = 2, b = 1$), the affine image operator will translate $\cL$ to the grid $\cL_1$ generated by the set of grid points $\bigl\{ (1, 0)^\transpose, (7, 3)^\transpose, (10, 0)^\transpose \bigr\}$ which is the grid generated by the grid point $(1, 0)$ and parameters $(3, -3), (0, 9)$; or, alternatively defined by the congruence system $\{x \equiv_3 1, x + y \equiv_9 1\}$. If the considered variable is as before (i.e., $k = 0$) but the linear expression is $x_1$ (so that $a_0 = 0, a_1 = 1, b = 0$), then the resulting grid $\cL_2$ is the grid containing all the points whose coordinates are integral multiples of 3 and lie on line $x = y$.

The affine preimage operator computes the affine preimage of a grid $\cL$ under $\phi$. For instance, suppose now that we apply the affine preimage operator as given in the first example using variable $x_0$ and linear expression $3x_0 + 2 x_1 + 1$ to the grid $\cL_1$; then we get the original grid $\cL$ back. If, on the other hand, we apply the affine preimage operator as given in the second example using variable $x_0$ and linear expression $x_1$ to $\cL_2$, then the resulting grid will consist of all the points in $\Rset^2$ where the $y$ coordinate is an integral multiple of 3.

Observe that provided the coefficient $a_k$ of the considered variable in the linear expression is non-zero, the affine transformation is invertible.

Generalized Affine Images

Similarly to convex polyhedra (see Generalized Affine Relations), the library provides two other grid operators that are generalizations of the single update affine image and preimage operators for grids. The generalized affine image operator $\fund{\phi = (\mathrm{lhs}', \mathrm{rhs}, f)}{\Rset^n}{\Rset^n}$, where $\mathrm{lhs} = \langle \vect{c}, \vect{x} \rangle + d$ and $\mathrm{rhs} = \langle \vect{a}, \vect{x} \rangle + b$ are affine expressions and $f \in \Qset$, is defined as

\[ \forall \vect{v} \in \Rset^n, \vect{w} \in \Rset^n \itc (\vect{v}, \vect{w}) \in \phi \iff \bigl( \langle \vect{c}, \vect{w} \rangle + d \equiv_f \langle \vect{a}, \vect{v} \rangle + b \bigr) \land \Bigl( \bigland_{0 \leq i < n, c_i = 0} w_i = v_i \Bigr). \]

Note that, when $\mathrm{lhs} = x_k$ and $f = 0$, so that the transfer function is an equality, then the above operator is equivalent to the application of the standard affine image of $\cL$ with respect to the variable $x_k$ and the affine expression $\mathrm{rhs}$.

Time-Elapse Operator

For any two grids $\cL_1, \cL_2 \in \Gset_n$, the time-elapse between $\cL_1$ and $\cL_2$, denoted $ \cL_1 \nearrow \cL_2$, is the grid

\[ \bigl\{\, \vect{p} + \mu \vect{q} \in \Rset^n \bigm| \vect{p} \in \cL_1, \vect{q} \in \cL_2, \mu \in \Zset \,\bigr\}. \]

Relation-with Operators

The library provides operators for checking the relation holding between a grid and a congruence, a grid generator, constraint or a (polyhedron) generator.

Suppose $\cL$ is a grid and $\cC$ an arbitrary congruence system representing $\cL$. Suppose also that $ \cg = \bigl( \langle \vect{a}, \vect{x} \rangle \equiv_f b \bigr) $ is a congruence relation with $\cL_{\cg} = \gcon\bigl(\{\cg\}\bigr)$. The possible relations between $\cL$ and $\cg$ are as follows.

For the relation between $\cL$ and a constraint, suppose that $ c = \bigl( \langle \vect{a}, \vect{x} \rangle \relsym b \bigr) $ is a constraint with $\mathord{\relsym} \in \{ =, \geq, > \}$ and $\cQ$ the set of points that satisfy $c$. The possible relations between $\cL$ and $c$ are as follows.

A grid $\cL$ subsumes a grid generator $g$ if adding $g$ to any grid generator system representing $\cL$ does not change $\cL$.

A grid $\cL$ subsumes a (polyhedron) point or closure point $g$ if adding the corresponding grid point to any grid generator system representing $\cL$ does not change $\cL$. A grid $\cL$ subsumes a (polyhedron) ray or line $g$ if adding the corresponding grid line to any grid generator system representing $\cL$ does not change $\cL$.

Widening Operators

The library provides grid widening operators for the domain of grids. The congruence widening and generator widening follow the specifications provided in [BDHMZ05]. The third widening uses either the congruence or the generator widening, the exact rule governing this choice at the time of the call is left to the implementation. Note that, as for the widenings provided for convex polyhedra, all the operations provided by the library for computing a widening $\cL_1 \widen \cL_2$ of grids $\cL_1, \cL_2 \in \Gset_n$ require as a precondition that $\cL_1 \sseq \cL_2$.

Note:
As is the case for the other operators on grids, the implementation overwrites one of the two grid arguments with the result of the widening application. It is worth stressing that, in any widening operation that computes the widening $\cL_1 \widen \cL_2$, the resulting grid will be assigned to overwrite the store containing the bigger grid $\cL_2$. The smaller grid $\cL_1$ is not modified. The same observation holds for all flavors of widenings and extrapolation operators that are implemented in the library and for all the foreign language interfaces.

Widening with Tokens

This is as for widening with tokens for convex polyhedra.

Extrapolation Operators

Besides the widening operators, the library also implements several extrapolation operators, which differ from widenings in that their use along an upper iteration sequence does not ensure convergence in a finite number of steps.

In particular, for each grid widening that is provided, there is a corresponding limited extrapolation operator, which can be used to implement the widening ``up to'' technique as described in [HPR97]. Each limited extrapolation operator takes a congruence system as an additional parameter and uses it to improve the approximation yielded by the corresponding widening operator. Note that, as in the case for convex polyhedra, a convergence guarantee can only be obtained by suitably restricting the set of congruence relations that can occur in this additional parameter.

The Powerset Construction

The PPL provides the finite powerset construction; this takes a pre-existing domain and upgrades it to one that can represent disjunctive information (by using a finite number of disjuncts). The construction follows the approach described in [Bag98], also summarized in [BHZ04] where there is an account of generic widenings for the powerset domain (some of which are supported in the pointset powerset domain instantiation of this construction described in Section The Pointset Powerset Domain).

The Powerset Domain

The domain is built from a pre-existing base-level domain $D$ which must include an entailment relation `$\mathord{\entails}$', meet operation `$\mathord{\meet}$', a top element `$\true$' and bottom element `$\false$'.

A set $\cS \in \wp(D)$ is called non-redundant with respect to `$\mathord{\entails}$' if and only if $\false \notin \cS$ and $\forall d_1, d_2 \in \cS \itc d_1 \entails d_2 \implies d_1 = d_2$. The set of finite non-redundant subsets of $D$ (with respect to `$\mathord{\entails}$') is denoted by $\wpfn{D}{\entails}$. The function $\fund{\nonredmap}{\wpf(D)}{\wpfn{D}{\entails}}$, called Omega-reduction, maps a finite set into its non-redundant counterpart; it is defined, for each $\cS \in \wpf(D)$, by

\[ \nonredmap(\cS) \defeq \cS \setdiff \{\, d \in \cS \mid d = \false \text{ or } \exists d' \in \cS \st d \sentails d' \,\}. \]

where $d \sentails d'$ denotes $d \entails d' \land d \ne d'$.

As the intended semantics of a powerset domain element $\cS \in \wpf(D)$ is that of disjunction of the semantics of $D$, the finite set $\cS$ is semantically equivalent to the non-redundant set $\nonredmap(\cS)$; and elements of $\cS$ will be called disjuncts. The restriction to the finite subsets reflects the fact that here disjunctions are implemented by explicit collections of disjuncts. As a consequence of this restriction, for any $\cS \in \wpf(D)$ such that $\cS \neq \{ \false \}$, $\nonredmap(\cS)$ is the (finite) set of the maximal elements of $\cS$.

The finite powerset domain over a domain $D$ is the set of all finite non-redundant sets of $D$ and denoted by $D_{\smallP}$. The domain includes an approximation ordering `$\mathord{\entailsP}$' defined so that, for any $\cS_1$ and $\cS_2 \in D_{\smallP}$, $\cS_1 \entailsP \cS_2$ if and only if

\[ \forall d_1 \in \cS_1 \itc \exists d_2 \in \cS_2 \st d_1 \entails d_2. \]

Therefore the top element is $\{\true\}$ and the bottom element is the emptyset.

Note:
As far as Omega-reduction is concerned, the library adopts a lazy approach: an element of the powerset domain is represented by a potentially redundant sequence of disjuncts. Redundancies can be eliminated by explicitly invoking the operator omega_reduce(), e.g., before performing the output of a powerset element. Note that all the documented operators automatically perform Omega-reductions on their arguments, when needed or appropriate.

Operations on the Powerset Construction

In this section we briefly describe the generic operations on Powerset Domains that are provided by the library for any given base-level domain $D$.

Meet and Upper Bound

Given the sets $\cS_1$ and $\cS_2 \in D_{\smallP}$, the meet and upper bound operators provided by the library returns the set $ \nonredmap \bigl( \{\, d_1 \meet d_2 \mid d_1 \in \cS_1, d_2 \in \cS_2 \,\} \bigr) $ and Omega-reduced set union $\nonredmap(\cS_1 \union \cS_2)$ respectively.

Adding a Disjunct

Given the powerset element $\cS \in D_{\smallP}$ and the base-level element $d \in D$, the add disjunct operator provided by the library returns the powerset element $\nonredmap\bigl(\cS \union \{d\}\bigr)$.

Collapsing a Powerset Element

If the given powerset element is not empty, then the collapse operator returns the singleton powerset consisting of an upper-bound of all the disjuncts.

The Pointset Powerset Domain

The pointset powerset domain provided by the PPL is the finite powerset domain (defined in Section The Powerset Construction) whose base-level domain $D$ is one of the classes of semantic geometric descriptors listed in Section Semantic Geometric Descriptors.

In addition to the operations described for the generic powerset domain in Section Operations on the Powerset Construction, the PPL provides all the generic operations listed in Generic Operations on Semantic Geometric Descriptors. Here we just describe those operations that are particular to the pointset powerset domain.

Meet-Preserving Simplification

Let $\cS_1 = \{ d_1, \ldots, d_m \}$, $\cS_2 = \{ c_1, \ldots, c_n \}$ and $\cS = \{ s_1, \ldots, s_q \}$ be Omega-reduced elements of a pointset powerset domain over the same base-level domain. Then:

The library provides a binary operator (simplify_using_context) for the pointset powerset domain that returns a powerset which is a powerset meet-preserving, powerset simplification and disjunct meet-preserving simplification of its first argument using the second argument as context.

Notice that, due to the powerset simplification property, in general a meet-preserving powerset simplification is not an enlargement with respect to the ordering defined on the powerset lattice. Because of this, the operator provided by the library is only well-defined when the base-level domain is not itself a powerset domain.

Geometric Comparisons

Given the pointset powersets $\cS_1, \cS_2$ over the same base-level domain and with the same space dimension, then we say that $\cS_1$ geometrically covers $\cS_2$ if every point (in some disjunct) of $\cS_2$ is also a point in a disjunct of $\cS_1$. If $\cS_1$ geometrically covers $\cS_2$ and $\cS_2$ geometrically covers $\cS_1$, then we say that they are geometrically equal.

Pairwise Merge

Given the pointset powerset $\cS$ over a base-level semantic GD domain $D$, then the pairwise merge operator takes pairs of distinct elements in $\cS$ whose upper bound (denoted here by $\uplus$) in $D$ (using the PPL operator upper_bound_assign() for $D$) is the same as their set-theoretical union and replaces them by their union. This replacement is done recursively so that, for each pair $c, d$ of distinct disjuncts in the result set, we have $c \uplus d \neq c \union d$.

Extrapolation Operators

The library implements a generalization of the extrapolation operator for powerset domains proposed in [BGP99]. The operator BGP99_extrapolation_assign is made parametric by allowing for the specification of any PPL extrapolation operator for the base-level domain. Note that, even when the extrapolation operator for the base-level domain $D$ is known to be a widening on $D$, the BGP99_extrapolation_assign operator cannot guarantee the convergence of the iteration sequence in a finite number of steps (for a counter-example, see [BHZ04]).

Certificate-Based Widenings

The PPL library provides support for the specification of proper widening operators on the pointset powerset domain. In particular, this version of the library implements an instance of the certificate-based widening framework proposed in [BHZ03b].

A finite convergence certificate for an extrapolation operator is a formal way of ensuring that such an operator is indeed a widening on the considered domain. Given a widening operator on the base-level domain $D$, together with the corresponding convergence certificate, the BHZ03 framework is able to lift this widening on $D$ to a widening on the pointset powerset domain; ensuring convergence in a finite number of iterations.

Being highly parametric, the BHZ03 widening framework can be instantiated in many ways. The current implementation provides the templatic operator BHZ03_widening_assign<Certificate, Widening> which only exploits a fraction of this generality, by allowing the user to specify the base-level widening function and the corresponding certificate. The widening strategy is fixed and uses two extrapolation heuristics: first, the upper bound operator for the base-level domain is tried; second, the BGP99 extrapolation operator is tried, possibly applying pairwise merging. If both heuristics fail to converge according to the convergence certificate, then an attempt is made to apply the base-level widening to the upper bound of the two arguments, possibly improving the result obtained by means of the difference operator for the base-level domain. For more details and a justification of the overall approach, see [BHZ03b] and [BHZ04].

The library provides several convergence certificates. Note that, for the domain of Polyhedra, while Parma_Polyhedra_Library::BHRZ03_Certificate the "BHRZ03_Certificate" is compatible with both the BHRZ03 and the H79 widenings, H79_Certificate is only compatible with the latter. Note that using different certificates will change the results obtained, even when using the same base-level widening operator. It is also worth stressing that it is up to the user to see that the widening operator is actually compatible with a given convergence certificate. If such a requirement is not met, then an extrapolation operator will be obtained.

Using the Library

A Note on the Implementation of the Operators

When adopting the double description method for the representation of convex polyhedra, the implementation of most of the operators may require an explicit conversion from one of the two representations into the other one, leading to algorithms having a worst-case exponential complexity. However, thanks to the adoption of lazy and incremental computation techniques, the library turns out to be rather efficient in many practical cases.

In earlier versions of the library, a number of operators were introduced in two flavors: a lazy version and an eager version, the latter having the operator name ending with _and_minimize. In principle, only the lazy versions should be used. The eager versions were added to help a knowledgeable user obtain better performance in particular cases. Basically, by invoking the eager version of an operator, the user is trading laziness to better exploit the incrementality of the inner library computations. Starting from version 0.5, the lazy and incremental computation techniques have been refined to achieve a better integration: as a consequence, the lazy versions of the operators are now almost always more efficient than the eager versions.

One of the cases when an eager computation might still make sense is when the well-known fail-first principle comes into play. For instance, if you have to compute the intersection of several polyhedra and you strongly suspect that the result will become empty after a few of these intersections, then you may obtain a better performance by calling the eager version of the intersection operator, since the minimization process also enforces an emptiness check. Note anyway that the same effect can be obtained by interleaving the calls of the lazy operator with explicit emptiness checks.

Warning:
For the reasons mentioned above, starting from version 0.10 of the library, the usage of the eager versions (i.e., the ones having a name ending with _and_minimize) of these operators is deprecated; this is in preparation of their complete removal, which will occur starting from version 0.11.

On Pointset_Powerset and Partially_Reduced_Product Domains: A Warning

For future versions of the PPL library all practical instantiations for the disjuncts for a pointset_powerset and component domains for the partially_reduced_product domains will be fully supported. However, for version 0.10, these compound domains should not themselves occur as one of their argument domains. Therefore their use comes with the following warning.

Warning:
The Pointset_Powerset<PS> and Partially_Reduced_Product<D1, D2, R> should only be used with the following instantiations for the disjunct domain template PS and component domain templates D1 and D2: C_Polyhedron, NNC_Polyhedron, Grid, Octagonal_Shape<T>, BD_Shape<T>, Box<T>.

On Object-Orientation and Polymorphism: A Disclaimer

The PPL library is mainly a collection of so-called ``concrete data types'': while providing the user with a clean and friendly interface, these types are not meant to --- i.e., they should not --- be used polymorphically (since, e.g., most of the destructors are not declared virtual). In practice, this restriction means that the library types should not be used as public base classes to be derived from. A user willing to extend the library types, adding new functionalities, often can do so by using containment instead of inheritance; even when there is the need to override a protected method, non-public inheritance should suffice.

On Const-Correctness: A Warning about the Use of References and Iterators

Most operators of the library depend on one or more parameters that are declared ``const'', meaning that they will not be changed by the application of the considered operator. Due to the adoption of lazy computation techniques, in many cases such a const-correctness guarantee only holds at the semantic level, whereas it does not necessarily hold at the implementation level. For a typical example, consider the extraction from a polyhedron of its constraint system representation. While this operation is not going to change the polyhedron, it might actually invoke the internal conversion algorithm and modify the generators representation of the polyhedron object, e.g., by reordering the generators and removing those that are detected as redundant. Thus, any previously computed reference to the generators of the polyhedron (be it a direct reference object or an indirect one, such as an iterator) will no longer be valid. For this reason, code fragments such as the following should be avoided, as they may result in undefined behavior:
// Find a reference to the first point of the non-empty polyhedron `ph'.
const Generator_System& gs = ph.generators();
Generator_System::const_iterator i = gs.begin();
for (Generator_System::const_iterator gs_end = gs.end(); i != gs_end; ++i)
  if (i->is_point())
    break;
const Generator& p = *i;
// Get the constraints of `ph'.
const Constraint_System& cs = ph.constraints();
// Both the const iterator `i' and the reference `p'
// are no longer valid at this point.
cout << p.divisor() << endl;  // Undefined behavior!
++i;                          // Undefined behavior!
As a rule of thumb, if a polyhedron plays any role in a computation (even as a const parameter), then any previously computed reference to parts of the polyhedron may have been invalidated. Note that, in the example above, the computation of the constraint system could have been placed after the uses of the iterator i and the reference p. Anyway, if really needed, it is always possible to take a copy of, instead of a reference to, the parts of interest of the polyhedron; in the case above, one may have taken a copy of the generator system by replacing the second line of code with the following:
Generator_System gs = ph.generators();
The same observations, modulo syntactic sugar, apply to the operators defined in the C interface of the library.

Bibliography

[Bag98]
R. Bagnara. A hierarchy of constraint systems for data-flow analysis of constraint logic-based languages. Science of Computer Programming, 30(1-2):119-155, 1998.

[BGP99]
T. Bultan, R. Gerber, and W. Pugh. Model-checking concurrent systems with unbounded integer variables: Symbolic representations, approximations, and experimental results. ACM Transactions on Programming Languages and Systems, 21(4):747-789, 1999.

[BDHMZ05]
R. Bagnara, K. Dobson, P. M. Hill, M. Mundell, and E. Zaffanella. A Linear Domain for Analyzing the Distribution of Numerical Values. Technical report 2005.06, School of Computing, University of Leeds, UK, 2005. Available at http://www.comp.leeds.ac.uk/research/pubs/reports.shtml.

[BHMZ05]
R. Bagnara, P. M. Hill, E. Mazzi, and E. Zaffanella. Widening Operators for Weakly-Relational Numeric Abstractions. In C. Hankin and I. Siveroni, editors, Static Analysis: Proceedings of the 12th International Symposium, volume 3672 of Lecture Notes in Computer Science, pages 3-18, London, UK, 2005. Springer-Verlag, Berlin.

[BHRZ03a]
R. Bagnara, P. M. Hill, E. Ricci, and E. Zaffanella. Precise widening operators for convex polyhedra. In R. Cousot, editor, Static Analysis: Proceedings of the 10th International Symposium, volume 2694 of Lecture Notes in Computer Science, pages 337-354, San Diego, California, USA, 2003. Springer-Verlag, Berlin.

[BHRZ03b]
R. Bagnara, P. M. Hill, E. Ricci, and E. Zaffanella. Precise widening operators for convex polyhedra. Quaderno 312, Dipartimento di Matematica, Università di Parma, Italy, 2003. Available at http://www.cs.unipr.it/Publications/.

[BHZ02a]
R. Bagnara, P. M. Hill, and E. Zaffanella. A new encoding and implementation of not necessarily closed convex polyhedra. Quaderno 305, Dipartimento di Matematica, Università di Parma, Italy, 2002. Available at http://www.cs.unipr.it/Publications/.

[BHZ02b]
R. Bagnara, P. M. Hill, and E. Zaffanella. A new encoding of not necessarily closed convex polyhedra. In M. Carro, C. Vacheret, and K.-K. Lau, editors, Proceedings of the 1st CoLogNet Workshop on Component-based Software Development and Implementation Technology for Computational Logic Systems, pages 147-153, Madrid, Spain, 2002. Published as TR Number CLIP4/02.0, Universidad Politécnica de Madrid, Facultad de Informática.

[BHZ03a]
R. Bagnara, P. M. Hill, and E. Zaffanella. A new encoding and implementation of not necessarily closed convex polyhedra. In M. Leuschel, S. Gruner, and S. Lo Presti, editors, Proceedings of the 3rd Workshop on Automated Verification of Critical Systems, pages 161-176, Southampton, UK, 2003. Published as TR Number DSSE-TR-2003-2, University of Southampton.

[BHZ03b]
R. Bagnara, P. M. Hill, and E. Zaffanella. Widening operators for powerset domains. In B. Steffen and G. Levi, editors, Proceedings of the Fifth International Conference on Verification, Model Checking and Abstract Interpretation (VMCAI 2004), volume 2937 of Lecture Notes in Computer Science, pages 135-148, Venice, Italy, 2003. Springer-Verlag, Berlin.

[BHZ04]
R. Bagnara, P. M. Hill, and E. Zaffanella. Widening operators for powerset domains. Quaderno 349, Dipartimento di Matematica, Università di Parma, Italy, 2004. Available at http://www.cs.unipr.it/Publications/.

[BJT99]
F. Besson, T. P. Jensen, and J.-P. Talpin. Polyhedral analysis for synchronous languages. In A. Cortesi and G. Filé, editors, Static Analysis: Proceedings of the 6th International Symposium, volume 1694 of Lecture Notes in Computer Science, pages 51-68, Venice, Italy, 1999. Springer-Verlag, Berlin.

[BRZH02a]
R. Bagnara, E. Ricci, E. Zaffanella, and P. M. Hill. Possibly not closed convex polyhedra and the Parma Polyhedra Library. In M. V. Hermenegildo and G. Puebla, editors, Static Analysis: Proceedings of the 9th International Symposium, volume 2477 of Lecture Notes in Computer Science, pages 213-229, Madrid, Spain, 2002. Springer-Verlag, Berlin.

[BRZH02b]
R. Bagnara, E. Ricci, E. Zaffanella, and P. M. Hill. Possibly not closed convex polyhedra and the Parma Polyhedra Library. Quaderno 286, Dipartimento di Matematica, Università di Parma, Italy, 2002. See also [BRZH02c]. Available at http://www.cs.unipr.it/Publications/.

[BRZH02c]
R. Bagnara, E. Ricci, E. Zaffanella, and P. M. Hill. Errata for technical report ``Quaderno 286''. Available at http://www.cs.unipr.it/Publications/, 2002. See [BRZH02b].

[CC76]
P. Cousot and R. Cousot. Static Determination of Dynamic Properties of Programs. In B. Robinet, editor, Proceedings of the 2nd International Symposium on Programming, pages 106-130, Paris, France, 1976.

[CC79]
P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proceedings of the Sixth Annual ACM Symposium on Principles of Programming Languages, pages 269-282, New York, 1979. ACM Press.

[CC92]
P. Cousot and R. Cousot. Comparing the Galois connection and widening/narrowing approaches to abstract interpretation. In M. Bruynooghe and M. Wirsing, editors, Proceedings of the 4th International Symposium on Programming Language Implementation and Logic Programming, volume 631 of Lecture Notes in Computer Science, pages 269-295, Leuven, Belgium, 1992. Springer-Verlag, Berlin.

[CH78]
P. Cousot and N. Halbwachs. Automatic discovery of linear restraints among variables of a program. In Conference Record of the Fifth Annual ACM Symposium on Principles of Programming Languages, pages 84-96, Tucson, Arizona, 1978. ACM Press.

[Che64]
N. V. Chernikova. Algorithm for finding a general formula for the non-negative solutions of system of linear equations. U.S.S.R. Computational Mathematics and Mathematical Physics, 4(4):151-158, 1964.

[Che65]
N. V. Chernikova. Algorithm for finding a general formula for the non-negative solutions of system of linear inequalities. U.S.S.R. Computational Mathematics and Mathematical Physics, 5(2):228-233, 1965.

[Che68]
N. V. Chernikova. Algorithm for discovering the set of all solutions of a linear programming problem. U.S.S.R. Computational Mathematics and Mathematical Physics, 8(6):282-293, 1968.

[Dan63]
G. B. Dantzig. Linear Programming and Extensions. Princeton University Press, Princeton, NJ, 1963.

[FP96]
K. Fukuda and A. Prodon. Double description method revisited. In M. Deza, R. Euler, and Y. Manoussakis, editors, Combinatorics and Computer Science, 8th Franco-Japanese and 4th Franco-Chinese Conference, Brest, France, July 3-5, 1995, Selected Papers, volume 1120 of Lecture Notes in Computer Science, pages 91-111. Springer-Verlag, Berlin, 1996.

[Fuk98]
K. Fukuda. Polyhedral computation FAQ. Swiss Federal Institute of Technology, Lausanne and Zurich, Switzerland, available at http://www.ifor.math.ethz.ch/~fukuda/fukuda.html, 1998.

[GDD+04]
D. Gopan, F. DiMaio, N. Dor, T. Reps, and M. Sagiv. Numeric domains with summarized dimensions. In K. Jensen and A. Podelski, editors, Tools and Algorithms for the Construction and Analysis of Systems, 10th International Conference, TACAS 2004, volume 2988 of Lecture Notes in Computer Science, pages 512-529. Springer-Verlag, Berlin, 2004.

[GJ00]
E. Gawrilow and M. Joswig. polymake: a framework for analyzing convex polytopes. In G. Kalai and G. M. Ziegler, editors, Polytopes - Combinatorics and Computation, pages 43-74. Birkhäuser, 2000.

[GJ01]
E. Gawrilow and M. Joswig. polymake: an approach to modular software design in computational geometry. In Proceedings of the 17th Annual Symposium on Computational Geometry, pages 222-231, Medford, MA, USA, 2001. ACM.

[Hal79]
N. Halbwachs. Détermination Automatique de Relations Linéaires Vérifiées par les Variables d'un Programme. Thèse de 3ème cycle d'informatique, Université scientifique et médicale de Grenoble, Grenoble, France, March 1979.

[Hal93]
N. Halbwachs. Delay analysis in synchronous programs. In C. Courcoubetis, editor, Computer Aided Verification: Proceedings of the 5th International Conference, volume 697 of Lecture Notes in Computer Science, pages 333-346, Elounda, Greece, 1993. Springer-Verlag, Berlin.

[HH95]
T. A. Henzinger and P.-H. Ho. A note on abstract interpretation strategies for hybrid automata. In P. J. Antsaklis, W. Kohn, A. Nerode, and S. Sastry, editors, Hybrid Systems II, volume 999 of Lecture Notes in Computer Science, pages 252-264. Springer-Verlag, Berlin, 1995.

[HKP95]
N. Halbwachs, A. Kerbrat, and Y.-E. Proy. POLyhedra INtegrated Environment. Verimag, France, version 1.0 of POLINE edition, September 1995. Documentation taken from source code.

[HLW94]
V. Van Dongen H. Le Verge and D. K. Wilde. Loop nest synthesis using the polyhedral library. Publication interne 830, IRISA, Campus de Beaulieu, Rennes, France, 1994.

[HMT71]
L. Henkin, J. D. Monk, and A. Tarski. Cylindric Algebras: Part I. North-Holland, Amsterdam, 1971.

[HPR94]
N. Halbwachs, Y.-E. Proy, and P. Raymond. Verification of linear hybrid systems by means of convex approximations. In B. Le Charlier, editor, Static Analysis: Proceedings of the 1st International Symposium, volume 864 of Lecture Notes in Computer Science, pages 223-237, Namur, Belgium, 1994. Springer-Verlag, Berlin.

[HPR97]
N. Halbwachs, Y.-E. Proy, and P. Roumanoff. Verification of real-time systems using linear relation analysis. Formal Methods in System Design, 11(2):157-185, 1997.

[HPWT01]
T. A. Henzinger, J. Preussig, and H. Wong-Toi. Some lessons from the hytech experience. In Proceedings of the 40th Annual Conference on Decision and Control, pages 2887-2892. IEEE Computer Society Press, 2001.

[Jea02]
B. Jeannet. Convex Polyhedra Library, release 1.1.3c edition, March 2002. Documentation of the ``New Polka'' library available at http://www.irisa.fr/prive/Bertrand.Jeannet/newpolka.html.

[Kuh56]
H. W. Kuhn. Solvability and consistency for linear equations and inequalities. American Mathematical Monthly, 63:217-232, 1956.

[Le 92]
H. Le Verge. A note on Chernikova's algorithm. Publication interne 635, IRISA, Campus de Beaulieu, Rennes, France, 1992.

[Loe99]
V. Loechner. PolyLib: A library for manipulating parameterized polyhedra. Available at http://icps.u-strasbg.fr/~loechner/polylib/, March 1999. Declares itself to be a continuation of [Wil93].

[LW97]
V. Loechner and D. K. Wilde. Parameterized polyhedra and their vertices. International Journal of Parallel Programming, 25(6):525-549, 1997.

[Mas92]
F. Masdupuy. Array operations abstraction using semantic analysis of trapezoid congruences. In Proceedings of the 6th ACM International Conference on Supercomputing, pages 226-235, Washington, DC, USA, 1992. ACM Press.

[Mas93]
F. Masdupuy. Array Indices Relational Semantic Analysis Using Rational Cosets and Trapezoids. Thèse d'informatique, École Polytechnique, Palaiseau, France, December 1993.

[MRTT53]
T. S. Motzkin, H. Raiffa, G. L. Thompson, and R. M. Thrall. The double description method. In H. W. Kuhn and A. W. Tucker, editors, Contributions to the Theory of Games - Volume II, number 28 in Annals of Mathematics Studies, pages 51-73. Princeton University Press, Princeton, New Jersey, 1953.

[NR00]
S. P. K. Nookala and T. Risset. A library for Z-polyhedral operations. Publication interne 1330, IRISA, Campus de Beaulieu, Rennes, France, 2000.

[NW88]
G. L. Nemhauser and L. A. Wolsey. Integer and Combinatorial Optimization. Wiley Interscience Series in Discrete Mathematics and Optimization. John Wiley & Sons, 1988.

[Sch99]
A. Schrijver. Theory of Linear and Integer Programming. Wiley Interscience Series in Discrete Mathematics and Optimization. John Wiley & Sons, 1999.

[Sri93]
D. Srivastava. Subsumption and indexing in constraint query languages with linear arithmetic constraints. Annals of Mathematics and Artificial Intelligence, 8(3-4):315-343, 1993.

[SW70]
J. Stoer and C. Witzgall. Convexity and Optimization in Finite Dimensions I. Springer-Verlag, Berlin, 1970.

[Wey35]
H. Weyl. Elementare theorie der konvexen polyeder. Commentarii Mathematici Helvetici, 7:290-306, 1935. English translation in [Wey50].

[Wey50]
H. Weyl. The elementary theory of convex polyhedra. In H. W. Kuhn, editor, Contributions to the Theory of Games - Volume I, number 24 in Annals of Mathematics Studies, pages 3-18. Princeton University Press, Princeton, New Jersey, 1950. Translated from [Wey35] by H. W. Kuhn.

[Wil93]
D. K. Wilde. A library for doing polyhedral operations. Master's thesis, Oregon State University, Corvallis, Oregon, December 1993. Also published as IRISA Publication interne 785, Rennes, France, 1993.

Further Notation and Terminology

Linear Independence

A finite set of points $\{ \vect{x}_1, \ldots, \vect{x}_k \} \sseq \Rset^n$ is linearly independent if, for all $\lambda_1, \ldots, \lambda_k \in \Rset$, the set of equations

\[ \sum_{i = 1}^k \lambda_i \vect{x}_i = \vect{0} \]

implies that, for each $i = 1$, $\ldots$, $k$, $\lambda_i = 0$.

The maximum number of linearly independent points in $\Rset^n$ is $n$. Note that linear independence implies affine independence, but the converse is not true.

Proposition

If $A$ is an $m \times n$ matrix, the maximum number of linearly independent rows of $A$, viewed as vectors of $\Rset^n$, equals the maximum number of linearly independent columns of $A$, viewed as vectors of $\Rset^m$.

Rank

The maximum number of linearly independent rows (columns) of a matrix $A$ is the rank of $A$ and is denoted by $\prank(A)$.

Proposition

A polyhedron is a convex set.

Minkowski's Theorem

Let $\cP = \{\, \vect{x} \in \Rset^n \mid A\vect{x} \geq \vect{b} \,\}$ be a non-empty polyhedron where $\prank(A) = n$. Let $V$ be the set of vertices and $R$ the set of extreme rays of $\cP$. Let also $\mathcal{V}$ be the set of convex combinations of $V$ and $\mathcal{R}$ the set of positive combinations of $R$. Then

\[ \cP = \mathcal{V} + \mathcal{R}. \]

Informally, this theorem states that, whenever a polyhedron $\cP$ has a vertex, there exists a decomposition such that

The conditions that $\cP$ is not empty and $\prank(A) = n$ are equivalent to the condition that $\cP$ has a vertex. (See also Nemhauser and Wolsey - Integer and Combinatorial Optimization - propositions 4.1 and 4.2 on pages 92 and 93).

Proposition

Under the same hypotheses of Minkowski's theorem, if $\cP$ is a rational polyhedron then all the vertices in $V$ have rational coefficients and we can consider a set $R$ of extreme rays having rational coefficients only.

The second theorem, called Weyl's theorem, states that any system of generators having rational coefficients defines a rational polyhedron:

Weyl's Theorem

If $A$ is a rational $m \times n$ matrix, $B$ is a rational $m' \times n$ matrix and

\[ \cQ = \sset{ \vect{x} \in \Rset^n }{ \vect{x}^\transpose = \vect{y}^\transpose A + \vect{z}^\transpose B, \\ \vect{y} = (y_0, \ldots, y_{m-1})^\transpose \in \nonnegRset^{m}, \sum_{k=0}^{m-1} y_k = 1, \\ \vect{z} \in \nonnegRset^{m'} }, \]

then $\cQ$ is a rational polyhedron.

In fact, since $\cQ$ consists of the sum of convex combinations of the rows of $A$ with positive combinations of the rows of $B$, we can think of $A$ as the matrix of vertices and $B$ as the matrix of rays.

Cone

A set $C \sseq \Rset^n$ is a cone if

\[ \vect{x} \in C \Rightarrow \lambda \vect{x} \in C \text{ for all } \lambda \in \nonnegRset. \]

Polyhedral Cone

The polyhedron $\cP = \{\,\vect{x} \in \Rset^n \mid A\vect{x} \geq \vect{0}\,\}$ is a convex cone and is called polyhedral cone.

A polyhedral cone is either pointed, having the origin as its only vertex, or has no vertices at all.

Lineality Space

Given a polyhedron $\cP = \{\,\vect{x} \in \Rset^n \mid A\vect{x} \geq \vect{b}\,\}$, the lineality space of $\cP$ is the set

\[ \{\, \vect{x} \in \cP \mid A\vect{x} = \vect{0} \,\} \]

and it is denoted by $\linspace(\cP)$.

Homogeneous Systems

To simplify the operations on polyhedra, each polyhedron is first transformed to a homogeneous cone in which the original polyhedron is embedded.

Corresponding Polyhedral Cone

The transformation changes the inhomogeneous system of constraints in $n$ variables, representing a polyhedron $\cP \in \Rset^n$, into a homogeneous system in $n + 1$ variables, representing a polyhedral cone $C \in \Rset^{n + 1}$, so that each point $\vect{x} \in \cP$ corresponds to a point $\vect{x}' = (\xi \vect{x}^\transpose, \xi)^\transpose \in C$ where $\xi \geq 0$. That is,

\[ \cP = \{\,\vect{x} \mid A\vect{x} \geq \vect{b}\,\} = \{\,\vect{x} \mid A\vect{x} - \vect{b} \geq \vect{0}\,\} \]

\[ C = \{\, (\xi \vect{x}^\transpose, \xi)^\transpose \mid \xi A\vect{x} - \xi \vect{b} \geq \vect{0}, \xi \geq 0 \,\} = \{\,\vect{x}' \mid A'\vect{x}' \geq \vect{0}\,\} \]

where: $\vect{x}' = (\xi \vect{x}^\transpose, \xi)^\transpose \in \Rset^{n + 1}$; $A'$ is the $(m+1) \times (n+1)$ matrix having, for its first $m$ rows, the submatrix $(A, -\vect{b}) \in \Rset^m \times \Rset^{n + 1}$; and, for the ($m + 1$)'st row, $(\vect{0}^\transpose, 1)$ where $\vect{0} \in \Rset^n$. We call $C$ the corresponding polyhedral cone for $\cP$.

The ($m+1$)'st row $(\vect{0}^\transpose, 1)$ represents the positivity constraint $1 \geq 0$.

Note that $\cP$ is contained in $C$ since the intersection of $C$ with the hyperplane defined by the equality $\xi = 1$ is $\cP$. Therefore, it is always possible to transform a polyhedron $\cP$ to its corresponding polyhedral cone $C$ and then recover $\cP$ by means of this intersection.

As $C$ always includes the origin and, hence, is non-empty, by Minkowski's theorem, it can also be represented by a system of generators.

The systems of generators for $\cP$ and $C$ are such that:

Thus, in the cone $C$, a ray derived from a vertex in $\cP$ differs from a ray derived from a ray in $\cP$ only in that, for a vertex, the ($n+1$)'st term is different from zero and, for a ray, it is zero.

Double Description

Let $\cP \in \Rset^n $ be a polyhedron and $C \in \Rset^{n+1} $ the corresponding polyhedral cone. Then the dual representations, the systems of constraints and generators representing $C$, form the double description for $\cP$.

Note that, in a double description for a non-empty polyhedron, the system of constraints subsumes the positivity constraint $1 \geq 0$ while the system of generators (which has only rays and lines corresponding to the vertices, rays and lines for $\cP$) implicitly assumes the origin in $\Rset^{n+1}$ as a point so that the cone $C$ represented by the generators is non-empty.

PPL Polyhedron Representation

In the PPL, a polyhedron is represented by one or both of the representations in its double description. Thus, in the sequel, by PPL representation of a polyhedra, we are referring to the corresponding representation of its corresponding polyhedral cone.

Valid Linear Inequalities

Let $\cP$ be a convex polyhedron (or polytope) in $\Rset^n$. For a real $n$-vector $\vect{c}$ and a real number $b$, a linear inequality $\langle \vect{c}, \vect{x} \rangle \geq b$ (briefly denoted by $(\vect{c},b)$) is called valid for $\cP$ if it is satisfied by all points $\vect{x} \in \cP$.

Redundancy

  1. In a system of equalities, if an equality is a linear combination of the others, it is said to be dependent upon them; the dependent equality is called redundant. A system containing no redundant equality is called independent.
  2. In a system of inequalities, an inequality is said to be redundant if it can be eliminated from the system obtaining a system equivalent to the previous one, i.e., having the same solutions.

Given a polyhedron $\cP$ generated by $V$ vertices, $R$ rays and $L$ lines, we say that:

  1. $L$ is irredundant if $L$ is a set of linearly independent lines; and
  2. a ray $\vect{r}_1\in R$ is redundant if there exists another ray $\vect{r}_2 \in R$ and there exists $\lambda \in \Rset, \lambda > 0$ such that $\vect{r}_1 = \lambda \vect{r}_2$.

Note that, in the PPL representation of a polyhedron $\cP$, vertices are represented as rays so that this concept of a redundant ray also applies to the vertices of $\cP$.

Face

If $(\vect{c},b)$ is a valid inequality for $\cP$, and $F = \{\,\vect{x} \in \cP \mid \langle \vect{c}, \vect{x} \rangle = b\,\}$, $F$ is called a face of $\cP$ and we say that the inequality represents $F$. A face $F$ is said to be proper if $F \neq \emptyset$ and $F \neq \cP$.

When $F$ is non-empty, we say that $(\vect{c},b)$ supports $\cP$.

The empty polyhedron and the universe polyhedron both have no proper faces, because the only face of an empty polyhedron is itself, while the faces of the universe polyhedron are itself and the emptyset.

Let $\cP$ be a non-empty polyhedron. The set

\[ F = \{ \vect{p} \} + \linspace(\cP), \]

where $\vect{p}$ is a point of $\cP$ and the symbol '$+$' denotes the Minkowski's sum, is a minimal proper face of the polyhedron if $F$ is a proper face of $\cP$.

Facet

A proper face $F$ of $\cP$ is a facet (or maximal proper face) of $\cP$ if it is not strictly included into any other proper face of $\cP$. The affine dimension of a facet is equal to $\pdim(\cP) - 1$.

Proposition

Let $\cP$ a polyhedron in $\Rset^n$. The set of all faces is a lattice under inclusion: the minimal face is the emptyset, while the maximal face is the polyhedron.

Proposition

Let $\cP \neq \emptyset$ be a polyhedron in $\Rset^n$ and $C$ be the polyhedral cone in $\Rset^{n+1}$ obtained from $\cP$ by homogenization, then:

  1. the only minimal proper face of $C$ is $\linspace(C)$;
  2. let $\vect{y} \in C$ be different from $\vect{0}$ and $\cone\{\vect{y}\}$ be defined as $\{\, \lambda \vect{y} \mid \lambda \geq 0 \,\}$. If the set $F = \cone\{\vect{y}\} + \linspace(C)$ is a proper face of $C$, then $\vect{y}$ is an extremal ray of $C$.

Ray Space

Given the decomposition $\mathcal{V} + \mathcal{R} + \mathcal{L}$ of a polyhedron $\cP$ the set $\mathcal{V} + \mathcal{R}$ is called the ray space of $\cP$ and denoted by $\mathop{\mathrm{ray space}}(\cP)$.

Thus a polyhedron $\cP$ can be always decomposed in its $\linspace$ and its $\mathop{\mathrm{ray space}}$.

Note that, since $\linspace(\cP)$ and $\mathop{\mathrm{ray space}}(\cP)$ are polyhedra, their affine dimensions can be computed using the definition of affine dimension given for polyhedra.

The spaces defined are connected by some consistency rules shown below.

Dimensionality Rules

In $\Rset^n$

The proofs of these properties can be obtained considering the definitions of affine dimension and the decomposition of a polyhedron.

Saturation

Let us consider a ray $\vect{r} \in \Rset^n$ and an inequality $(\vect{a}, 0)$ where $\vect{a} \in \Rset^n$. Then we say that:

Similarly, considering an equality $\langle \vect{a}, \vect{x} \rangle = 0$:

A constraint (i.e., an equality or an inequality) is satisfied by a ray if the ray saturates or verifies the constraint.

Proposition

Let $C \sseq \Rset^n$ be a polyhedral cone and $\vect{y}_1, \vect{y}_2 \in C$. If the sets $F_i = \cone\{\vect{y}_i\} + \linspace(C)$ with $i = 1, 2$ are proper faces of $C$, $F_1$ is equal to $F_2$ if and only if the set of constraints that are saturated by $\vect{y}_1$ is equal to the set of constraints that are saturated by $\vect{y}_2$.

Saturation Matrix

A saturation matrix is a bit matrix that represents the connection between constraints and generators of a polyhedron. There are two kinds of saturation matrices, one having rows indexed by constraints and columns indexed by generators (sat_g), and one (that is the transposed version of the previous one) having rows indexed by generators and columns indexed by constraints (sat_c).

For instance, in the saturation matrix sat_g, the elements are defined as follows:

\[ s_{ij} = \begin{cases} 0, \text{if the constraint indexed by } i \text{ is saturated by the generator indexed by } j;\\ 1, \text{if the constraint indexed by } i \text{ is only verified by the generator indexed by } j. \end{cases} \]

For efficiency reasons, the PPL uses both the sat_g and sat_c matrices.

Saturation Rule

In an $n$-dimensional $\mathop{\mathrm{ray space}}$,
  1. Every inequality must be saturated by at least $n$ vertices/rays.
  2. Every vertex must saturate at least $n$ inequalities and a ray must saturate at least $n - 1$ inequalities plus the positivity constraint.
  3. Every equality must be saturated by all lines and vertices/rays.
  4. Every line must saturate all equalities and inequalities.

These rules are a consequence of the saturation concept.

Proposition

Let $C = \{\vect{x} \mid A\vect{x} \geq \vect{0}\}$ be a polyhedral cone. Then the minimal proper face of $C$ in an $n$-dimensional space can also be represented as $ F = \{\,\vect{x} \mid A\vect{x} = \vect{0}\,\}. $

To see this, note that the minimal proper face of a polyhedral cone is equal to its lineality space. This for definition is composed by all $\vect{y}$ of $C$ that satisfies $A \vect{x} = \vect{0}.$

Adjacent Rays

Let $A$ be representing matrix of constraints of a cone $C$ and $Q$ the set of rays that generate $C$. Then two rays $\vect{r}_1$ and $\vect{r}_2$ are adjacent rays if
  1. there exists at least a row of $A$ (i.e., a constraint) that is saturated by both $\vect{r}_1$ and $\vect{r}_2$
  2. and none of the rays of $Q$, except $\vect{r}_1$ and $\vect{r}_2$, saturates all the constraints saturated by both $\vect{r}_1$ and $\vect{r}_2$.

Independence Rule

  1. No inequality is a positive combination of any other two inequalities or equalities.
  2. No ray is a linear combination of any other two rays or lines.
  3. The set of equalities must be linearly independent.
  4. The set of lines must be linearly independent.

To remove redundant constraints/generators we will use the following characterization:

Redundancy Rules

It is useful to note that:

Integers Represented by Floating Point Numbers

Floating point numbers can be used to represent finite families of integer numbers. In this section we collect some closure properties of these families that are exploited in the PPL.

In order not to depend on the particular family of floating point numbers considered, we consider an abstraction that is parametric in the number $b$ of bits in the mantissa and gives no limit to the magnitude of the exponent $e$. For $b \in \Nset \setminus \{ 0 \}$ let

\[ \begin{aligned} F_b^+ &= \bigl\{\, x \in \Nset \bigm| x = (1 + m / 2^b) \cdot 2^e, e \in \Nset, m \in \Nset \cap [0, 2^b - 1] \,\bigr\}, \\ F_b &= F_b^+ \cup \{ 0 \} \cup \{\, -x \mid x \in F_b^+ \,\}. \end{aligned} \]

Let $\phi \colon \Rset \to \Zset$ denote the function defined by

\[ \phi(t) = \begin{cases} \lfloor t \rfloor, & \text{if $t \ge 0$;} \\ \lceil t \rceil, & \text{if $t < 0$.} \end{cases} \]

Notice that $\phi$ is an odd function, that is, it satisfies $\phi(-t) = -\phi(t)$ for all $t \in \Rset$. For $x$, $y \in \Zset$ with $y \ne 0$, we also write

\[ \begin{aligned} x \bdiv y &= \phi(x / y), \\ x \brem y &= x - (x \bdiv y) y. \end{aligned} \]

These are the integer division and remainder function as defined by the C99 standard [ISO/IEC 9899:1999(E), Programming Languages - C (ISO and ANSI C99 Standard)].

Proposition A If $x$, $y \in F_b$ and $y \ne 0$, then $x \brem y \in F_b$.

The proof is given in the next three lemmas.

Lemma 1 Let $G_b = \{\, n \in F_b^+ \mid \text{$n$ is odd} \,\}$. Then $G_b = \{ 1, 3, 5, \ldots, 2^{b + 1} - 1 \}$. Furthermore, if $x \in F_b^+$ then there exist $n \in G_b$ and $f \in \Nset$ such that $x = n \cdot 2^f$.

Proof Let $n \in \{ 1, 3, 5, \ldots, 2^{b + 1} - 1 \}$. There is a non negative integer $\beta \le b$ such that $2^\beta \le n < 2^{\beta + 1}$. Then $n = (1 + m / 2^b) \cdot 2^e$ with $m = (n - 2^\beta) \cdot 2^{b - \beta}$ and $e = \beta$. Here $m < (2^{\beta + 1} - 2^\beta) \cdot 2^{b - \beta} = 2^b$ so that $n \in G_b$. The same argument shows that odd integers larger than $2^{b+1}$ do not in fact belong to $G_b$, since the corresponding value of $m$ would exceed the bound $2^b - 1$ in the definition.

For the second part, let $x = (1 + m / 2^b) \cdot 2^e \in F_b^+$. Let $m = 2^d \cdot m_1$ with $m_1$ odd and $d < b$. Then $n = 2^{b - d} + m_1$ is an odd integer that belongs to $G_b$ since $2^{b - d} + m_1 \le 2^{b - d} + (2^b - 1) / 2^d < 2^{b - d + 1} \le 2^{b + 1}$, using the first part. Hence we may take $f = e + d - b$ which is non negative since otherwise $m \cdot 2^{e - b} = m_1 \cdot 2^{e + d - b}$ would not be an integer as assumed.

Lemma 2 If $x$, $y \in F_b^+$ and $y$ does not divide $x$, then $x \bmod y \in F_b^+$.

Proof By Lemma 1 above we may assume that $x = n \cdot 2^e$ and $y = m \cdot 2^f$ with $n$, $m \in G_b$ odd integers, and $e$, $f \in \Nset$. Let $k = \lfloor x / y \rfloor$. The goal is to prove that $x - k y \in F_b^+$: we may assume that $k > 0$, that is, that $x > y$ for otherwise $x \bmod y = x$ and there is nothing to prove.

In all cases, we wrote $x - k y$ as the product of a power of 2 and an element of $F_b^+$, and this product is another element of $F_b^+$.

Lemma 3 For $x$, $y \in \Zset$ with $y \ne 0$, we have

\[ x \brem y = \begin{cases} x \brem |y|, & \text{if $x \ge 0$;} \\ -(|x| \brem |y|), & \text{if $x < 0$.} \end{cases} \]

Proof Throughout the proof we write $x_0 = |x|$ and $y_0 = |y|$. First, assume that $x \ge 0$ and that $y < 0$. Let $k = \phi(x / y_0) = - \phi(x / y)$, by the property above. We have

\[ x \brem y = x - (x \bdiv y) y = x - (-k) y = x - k (-y) = x - k y_0. \]

Next, assume that $x < 0$ and that $y < 0$. Let $k = \phi(x_0 / y_0) = \phi(x / y)$. We have

\[ x \brem y = x - (x \bdiv y) y = x - k y = -( -x - k (-y)) = -(x_0 - k y_0). \]

Finally, assume that $x < 0$ and that $y > 0$. Let $k = \phi(x_0 / y) = -\phi(x / y)$, again by the property above. We have

\[ x \brem y = x - (x \bdiv y) y = x - (-k) y = -( -x - k y) = -(x_0 - k y). \]

This completes the proof.

Lemma 4 If $x$, $y \in F_b^+$ then $\gcd(x, y) \in F_b^+$.

Proof Let $x = n \cdot 2^e$ and $y = m \cdot 2^f$ with $n$, $m \in G_b$ odd integers, and $e$, $f \in \Nset$. Then $\gcd(x, y) = \gcd(n, m) \cdot 2^{\min(e, f)}$, and therefore it belongs to $F_b^+$, since $\gcd(n, m) \le \min(n, m)$ so that it belongs to $G_b$.

Lemma 5 If $x$, $y \in F_b^+$, then $x / \gcd(x, y) \in F_b^+$.

Proof With the same notation as in the previous Lemma, both $n$ and $\gcd(n, m) \in G_b$: but all positive odd integers up to and including $n$ belong to $G_b$, so that $n / \gcd(n, m)$ does as well. By Lemma 1 $x / \gcd(x, y) = n \cdot 2^e / (\gcd(n, m) \cdot 2^{\min(e, f)}) = (n / \gcd(n, m)) \cdot 2^{e - \min(e, f)} \in F_b^+$.


Generated on Sat Oct 11 10:39:33 2008 for PPL by  doxygen 1.5.6