A New Encoding of Not Necessarily Closed Convex Polyhedra^{⋆}

Extended Abstract

Roberto Bagnara^{1}, Patricia M. Hill^{2}, and Enea Zaffanella^{1}

1 Department of Mathematics, University of Parma, Italy

                     {bagnara,zaffanella}@cs.unipr.it

2 School of Computing, University of Leeds, UK

                          hill@comp.leeds.ac.uk

1 Introduction

Many applications of static analysis and verification compute on some abstract domain based on convex polyhedra. Traditionally, most of these applications are restricted to convex polyhedra that are topologically closed. When adopting the Double Description (DD) method [8], a closed convex polyhedron can be specified in two ways, using a constraint system or a generator system: the constraint system contains a finite set of linear non-strict inequality constraints; the generator system contains two finite sets of vectors, collectively called generators, which are rays and points of the polyhedron.

Some applications of static analysis and verification, including recent proposals such as [3], need to compute on the domain of not necessarily closed (NNC) convex polyhedra. By definition, any NNC polyhedron can be represented by a so-called mixed constraint system, that is, a constraint system where a further finite set of linear strict inequality constraints is allowed to occur. The usual approach for implementing NNC polyhedra is to embed them into closed polyhedra in a vector space with one extra dimension. While this idea, originally proposed in [6] and also described in [7], proved to be quite effective, its direct application results in a low-level user interface where most of the geometric intuition of the DD method gets lost under the “implementation details”.

A much cleaner approach was proposed in [1, 2], where the concept of generator of an NNC polyhedron is extended to also account for the closure points of the polyhedron. In particular, it is shown that any NNC polyhedron can be elegantly and intuitively represented by means of extended generator systems. The combined use of mixed constraint systems and extended generator systems provides a higher level interface to the domain of NNC polyhedra, allowing for simpler definitions of some of the corresponding operators.

⋆ This work has been partly supported by MURST projects “Abstract interpretation, type systems and control-flow analysis” and “Aggregate- and number-reasoning for computing: from decision algorithms to constraint programming with multisets, sets, and maps”.

The use of closure points in the approach proposed in [1, 2] provides a twofold improvement over the proposal in [6, 7]: first, an NNC polyhedron can be presented to the client application directly in terms of its defining strict and non-strict constraints or its generating rays, points and closure points; second, the implementation becomes separate from the user interface.

In this paper we exploit the latter possibility by introducing an alternative class of closed polyhedra for representing the NNC polyhedra. The basis of this representation is a simple generalization of the class of polyhedra used in [6, 7] and also in [2]. The new class continues to employ an additional dimension to encode whether or not each affine half-space defining the NNC polyhedron is closed and rely on the same semantic function given in [2] for extracting the NNC polyhedron it embeds. We describe two alternative specializations of this class for representing the NNC polyhedra. One of these, shown to be biased for the use of the constraint representation, corresponds to the embedding defined in [2] while the other, which is biased for the use of the generator representation, is new to this paper.

An interesting and potentially useful consequence of having the option of these alternative implementations is that, depending on the number of strict constraints in the constraint system compared with the number of closure points that are also points in the generator system, the choice of representation will affect the efficiency of the polyhedral operations.

2 Preliminaries

We first define some necessary terminology. The reader is referred to [2] for a more formal introduction to the required concepts and notations.

In the paper, all topological arguments refer to the usual topological space ℝ^{n} where n ∈ ℕ. The set of non-negative reals is denoted by ℝ_{+}. For each i ∈ {1, …, n}, v_{i} denotes the i-th component of the (column) vector v ∈ ℝ^{n}. We denote by 0 the vector of ℝ^{n} having all components equal to zero. The scalar product of v, w ∈ ℝ^{n} is denoted by ⟨v, w⟩.

A subset P of ℝ^{n} is called a closed polyhedron if either P can be expressed as the intersection of a finite number of closed affine half-spaces of ℝ^{n} or n = 0 and P = ∅. The set of all closed polyhedra on ℝ^{n} is denoted by ℂℙ_{n}.

A subset P of ℝ^{n} is called an NNC polyhedron if either P can be expressed as the intersection of a finite number of (not necessarily closed) affine half-spaces of ℝ^{n} or n = 0 and P = ∅. The set of all NNC polyhedra on ℝ^{n} is denoted by ℙ_{n}. Obviously, we have ℂℙ_{n} ⊆ ℙ_{n} (note that ℂℙ_{n} = ℙ_{n} if and only if n = 0).

The set ℙ_{n}, when partially ordered by subset inclusion, is a lattice and ℂℙ_{n} is a sublattice of ℙ_{n}. The binary meet operation is given by set-intersection, whereas the binary join operation, denoted ⊎, is called convex polyhedral hull.

For each vector a ∈ ℝ^{n} and scalar b ∈ ℝ, where a ≠ 0, the linear inequality constraint ⟨a, x⟩ ≥ b (resp., ⟨a, x⟩ > b) defines a topologically closed (resp., open) affine half-space of ℝ^{n}. A mixed constraint system C is a finite set of linear inequality constraints and we will write con(C) to denote the polyhedron described by C.

A vector r ∈ ℝ^{n} such that r ≠ 0 is a ray of a non-empty polyhedron P ∈ ℙ_{n} if, for every point p ∈ P and every μ ∈ ℝ_{+}, it holds p + μr ∈ P; a vector c ∈ ℝ^{n} is a closure point of P ∈ ℙ_{n} if c ∈ ℂ(P). Given three finite sets of vectors R, P, C ⊆ ℝ^{n}, where R = {r_{1}, …, r_{k}} and 0 ∉ R, P = {p_{1}, …, p_{ℓ}} and C = {c_{1}, …, c_{m}}, then the triple G = (R, P, C) is called an extended generator system for the NNC polyhedron

gen(G) =^{def} \{ ∑_{i=1}^{k} μ_{i}r_{i} + ∑_{i=1}^{ℓ} ν_{i}p_{i} + ∑_{i=1}^{m} η_{i}c_{i} | \begin{matrix}μ ∈ ℝk_{+}, ν ∈ ℝℓ_{+}, η ∈ ℝm_{+}, \\ ν ≠ 0, ∑_{i=1}^{ℓ} ν_{i} + ∑_{i=1}^{m} η_{i} = 1 \end{matrix} \}.

The polyhedron gen(G) is empty if and only if P = ∅. For a non-empty polyhedron, vectors in R, P, and C are rays, points and closure points, respectively. When C = ∅, we will omit it from the generator system and simply write G = (R, P).

3 Representing NNC Polyhedra

We will define two alternative representations for NNC polyhedra. The two classes of closed polyhedra used for these representations are instances of a more general class of closed polyhedra. In the following, we denote by ϵ the variable corresponding to the (n + 1)-st Cartesian axis of ℝ^{n+1}.

Definition 1. (ϵ-polyhedron.) A polyhedron R ∈ ℂℙ_{n+1} is said to be an ϵpolyhedron if and only if

∃δ ∈ ℝ . (δ > 0 ∧ R ⊆ con({ϵ ≤ δ}));  (1)
∀v ∈ ℝ^{n}, e ∈ ℝ : (v^{T}, e)^{T} ∈ R ⟹ (v^{T}, 0)^{T} ∈ R.  (2)

Condition (2) that every point in the ϵ-polyhedron R has a projection on the hyperplane defined by the constraint (ϵ = 0) corresponds to a dual property concerning the constraints for R.

Proposition 1. Let R ∈ ℂℙ_{n+1} be such that, for some δ ∈ ℝ with δ > 0, R ⊆ con({ϵ ≤ δ}). Then R is an ϵ-polyhedron if and only if, for each s ∈ ℝ,

R ⊆ con({⟨a, x⟩ + s · ϵ ≥ b}) ⟹ R ⊆ con({⟨a, x⟩ ≥ b}).

Each ϵ-polyhedron in ℂℙ_{n+1} denotes an NNC polyhedron in ℙ_{n}. In particular, points in an ϵ-polyhedron with a strictly positive ϵ-coordinate, correspond to points in the NNC polyhedron.

Definition 2. (Represented NNC polyhedron.) Let R ∈ ℂℙ_{n+1} be a closed polyhedron. R is said to represent the NNC polyhedron P ∈ ℙ_{n} if and only if

P = [[R]] =^{def} { v ∈ ℝ^{n} | ∃e ∈ ℝ . (e > 0 ∧ (v^{T}, e)^{T} ∈ R) }.  (3)

The polyhedron R is said to be an ϵ-polyhedron for P ∈ ℙ_{n}, denoted R ⇛_{ϵ} P, if R is an ϵ-polyhedron and P = [[R]].

We now consider two special subclasses of the class of ϵ-polyhedra. The first of these assumes the presence of the constraint (ϵ ≥ 0) providing a lower bound for the ϵ dimension.

Definition 3. (C-ϵ-polyhedron.) An ϵ-polyhedron R ∈ ℂℙ_{n+1} is said to be constraint-biased and called a C-ϵ-polyhedron if and only if

R ⊆ con({ϵ ≥ 0}).

We write R ⇛_{C} P if R is a C-ϵ-polyhedron and R ⇛_{ϵ} P.

Thus the set of constraint-biased ϵ-polyhedra is the subset of ϵ-polyhedra on the vector space ℝ^{n+1} that, when adopting the proposal of [6, 7], represent an NNC polyhedron on the vector space ℝ^{n}. Note that, in [2], a constraint-biased ϵpolyhedron is called an ϵ-representation. Thus many of the definitions and results below concerning C-ϵ-polyhedra and the embedding of the NNC polyhedra in them are taken from [2].

In [2], we have shown how a C-ϵ-polyhedron for an NNC polyhedron P may be constructed directly from the constraint and generator systems for P.

Definition 4. (con repr_{C}.) Let C be a generic mixed constraint system on the vector space ℝ^{n}, that is,

C = { ⟨a_{i}, x⟩ ▷◁_{i} b_{i} | i ∈ {1, …, m}, a_{i} ∈ ℝ^{n}, ▷◁_{i} ∈ {≥, >}, b_{i} ∈ ℝ }

The function con repr_{C} associates C with the constraint system on the vector space ℝ^{n+1}

con repr_{C}(C) =^{def} {0 ≤ ϵ} ∪ {ϵ ≤ 1}
∪ { ⟨a_{i}, x⟩ − 1 · ϵ ≥ b_{i} | i ∈ {1, …, m}, ▷◁_{i} ∈ {>} }
∪ { ⟨a_{i}, x⟩ + 0 · ϵ ≥ b_{i} | i ∈ {1, …, m}, ▷◁_{i} ∈ {≥} }.

Definition 5. (gen repr_{C}.) Let G = (R, P, C) be an extended generator system on the vector space ℝ^{n}. The function gen repr_{C} associates to G the generator system gen repr_{C}(G) =^{def} (R′, P′) on the vector space ℝ^{n+1}, where

R′ = { (r^{T}, 0)^{T} | r ∈ R },
P′ = { (p^{T}, 1)^{T} | p ∈ P } ∪ { (q^{T}, 0)^{T} | q ∈ P ∪ C }.

Observe that, in the mapping defined by the generator representation function gen repr_{C} and using the notation in Definition 5, each point in P corresponds to two distinct points in P′. In general, the above encodings require a constant number of additional constraints versus a linear number of additional generators: this is the reason why ϵ-polyhedra in this subclass are called “constraint-biased”.

The second special subclass of ϵ-polyhedra assumes the presence of the ray −e_{ϵ} =^{def} (0^{T}, −1)^{T}, so that there is no lower bound for the ϵ dimension.

Definition 6. (G-ϵ-polyhedron.) An ϵ-polyhedron R = gen(R, P) ∈ ℂℙ_{n+1} is said to be generator-biased and called a G-ϵ-polyhedron if and only if

R ⊇ gen({−e_{ϵ}}, P ).

We write R ⇛_{G} P if R is a G-ϵ-polyhedron and R ⇛_{ϵ} P.

As for the constraint-biased case, generator-biased ϵ-polyhedra can also be used for representing any NNC polyhedra. In particular, the generator and constraint systems for a G-ϵ-polyhedron for an NNC polyhedron P may be constructed directly from the constraint and generator systems for P.

Definition 7. (con repr_{G}.) Let C be a mixed constraint system as in Definition 4. The function con repr_{G} associates C with the constraint system on the vector space ℝ^{n+1}

con repr_{G}(C) =^{def} {ϵ ≤ 1}
∪ { ⟨a_{i}, x⟩ − 1 · ϵ ≥ b_{i} | i ∈ {1, …, m}, ▷◁_{i} ∈ {>} }
∪ { ⟨a_{i}, x⟩ + 0 · ϵ ≥ b_{i} | i ∈ {1, …, m}, ▷◁_{i} ∈ {≥, >} }.

Definition 8. (gen repr_{G}.) Let G = (R, P, C) be an extended generator system on the vector space ℝ^{n}. The function gen repr_{G} associates to G the generator system gen repr_{G}(G) =^{def} (R′, P′) on the vector space ℝ^{n+1}, where

R′ = {−e_{ϵ}} ∪ { (r^{T}, 0)^{T} | r ∈ R },
P′ = { (p^{T}, 1)^{T} | p ∈ P } ∪ { (q^{T}, 0)^{T} | q ∈ C }.

It can be seen that, for each strict inequality contained in C, the representation function con repr_{G} adds both the strict and the non-strict inequality encodings. This ensures that condition (2) of Definition 1 is met.

In contrast, for each point in the generator system, the function gen repr_{G} no longer adds the corresponding closure point. As a matter of fact, these closure points are no longer needed, because they can be generated by combining the corresponding point with the ray −e_{ϵ}, which is always added. As a consequence, the G-ϵ-polyhedron for a non-empty NNC polyhedron is always unbounded. Since the encodings for ϵ-polyhedra in this subclass require a linear number of additional constraints versus a constant number of additional generators, they are called “generator-biased”.

The following result states the correctness of the four encoding functions.

Proposition 2. Let (C, G) ≡ P ∈ ℙ_{n}. Then

1. con(con repr_{C}(C)) ⇛_{C} P, gen(gen repr_{C}(G)) ⇛_{C} P;

2. con(con repr_{G}(C)) ⇛_{G} P, gen(gen repr_{G}(G)) ⇛_{G} P.

Any ϵ-polyhedron included in the half-space defined by ϵ ≤ 0 actually encodes the empty NNC polyhedron. Operations such as the intersection of NNC polyhedra and the application of affine transformations can be safely performed on any of the constraint-biased or generator-biased ϵ-polyhedra for the arguments; the same holds for the convex polyhedral hull operation, provided neither of the arguments is empty.

Proposition 3. Let ⇛_{Y} ∈ {⇛_{C}, ⇛_{G}}. Suppose R ⇛_{Y} P, and R_{1} ⇛_{Y} P_{1} and R_{2} ⇛_{Y} P_{2}. Then

1. P = ∅ if and only if R ⊆ con({ϵ ≤ 0});

2. R_{1} ∩ R_{2} ⇛_{Y} P_{1} ∩ P_{2};

3. (P_{1} ≠ ∅ ∧ P_{2} ≠ ∅) ⟹ (R_{1} ⊎ R_{2} ⇛_{Y} P_{1} ⊎ P_{2});

4. let f =^{def} λx ∈ ℝ^{n} . Ax + b be any affine transformation defined on ℙ_{n}; then g(R) ⇛_{Y} f(P), where

g =^{def} λ (\begin{matrix}x \\ ϵ \end{matrix}) ∈ ℝ^{n+1} . (\begin{matrix}A & 0 \\ 0^{T} & 1 \end{matrix}) (\begin{matrix}x \\ ϵ \end{matrix}) + (\begin{matrix}b \\ 0 \end{matrix})

is the corresponding affine transformation on ℂℙ_{n+1}.

4 Discussion and Future Work

The encoding based on G-ϵ-polyhedra has dual properties with respect to the one based on C-ϵ-polyhedra. In particular, using a C-ϵ-polyhedron, the encoding of an NNC polyhedron may require a similar number of constraints but about twice the number of generators, while, using a G-ϵ-polyhedron, it may require a similar number of generators but twice the number of constraints.

Increasing the number of constraints or generators, besides affecting the space efficiency, will have an impact on the running time of many of the various polyhedral operations required by applications in data-flow analysis and verification. In implementations based on the double description method, the most expensive operation is deriving a constraint (generator) representation from a generator (constraint) representation: this is, in the worst case, exponential in the number of generators (constraints). These conversions are performed because some of the other operations are more efficiently expressed and implemented on constraint systems (imposing new constraints and computing the relation between a polyhedron and a generator), some are better done on generator systems (adding new generators, convex polyhedral hull, projection onto a lower dimensional space, computing the relation between a polyhedron and a generator, testing for finiteness, time-elapse [6, 7]), and some require both the constraint and the generator systems (such as testing for inclusion and widenings [5, 4]). For these reasons, it seems likely that the performance of one encoding with respect to the other will depend on the particular application and, more specifically, on the kind of polyhedra and operations that are more common in that application. An implementation of the proposed techniques is ongoing and this will be useful to conduct experiments on realistic examples. It would also be interesting to investigate whether efficient techniques can be devised so as to use both constraintand generator-biased encodings, switching dynamically from one to the other in an attempt to maximize performance.

As pointed out in [2], even if a constraint or generator system defining the constraint-biased ϵ-polyhedron is minimized (using the usual minimization for closed polyhedra), the system may still encode redundant strict inequality constraints or redundant points, respectively. The solution proposed in [2] is the definition of a stronger form of minimization, ensuring that no subset of the constraint/generator system still defines a constraint-biased ϵ-polyhedron for the same NNC polyhedron. It would be interesting to define the same notion of strong minimal form, but this time for any ϵ-polyhedron being careful that if it is constraint- or generator-biased before minimization, it remains constraint- or generator-biased, respectively, after the minimization.

References

1. R. Bagnara, P. M. Hill, E. Ricci, and E. Zaffanella. The Parma Polyhedra Library User’s Manual. Department of Mathematics, University of Parma, Parma, Italy, release 0.4 edition, July 2002. Available at http://www.cs.unipr.it/ppl/.

2. R. Bagnara, E. Ricci, E. Zaffanella, and P. M. Hill. Possibly not closed convex polyhedra and the Parma Polyhedra Library. In M. Hermenegildo and G. Puebla, editors, Static Analysis: 9th International Symposium, SAS 2002, volume 2477 of Lecture Notes in Computer Science, Madrid, Spain, 2002. Springer-Verlag, Berlin. To appear.

3. M. A. Colón and H. B. Sipma. Synthesis of linear ranking functions. In T. Margaria and W. Yi, editors, Proceedings of the 7th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2001), volume 2031 of Lecture Notes in Computer Science, pages 67–81, Genova, Italy, 2001. Springer-Verlag, Berlin.

4. 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.

5. 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.

6. 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.

7. 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.

8. 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.