Abstract:
A computer implemented program analysis method employing a set of new abstract domains applicable to non-convex invarients. The method analyzes programs statically using abstract interpretation while advantageously considering non-convex structures and in particular those situations in which an internal region of an unreachable state exists within a larger region of reachable states. The method employs a new set of non-convex domains (donut domains) based upon the notion of an outer convex region of reachable states (Domain D1) and an inner region of unreachable states (Domain D2) which advantageously permits capture of non-convex properties by using convex regions and operations.

Description:
CROSS REFERENCE TO RELATED APPLICATION 
       [0001]    This application claims the benefit of U.S. Provisional Patent Application Ser. No. 61/466,522 filed Mar. 23, 2011 which is incorporated by reference as if set forth at length herein. 
     
    
     TECHNICAL FIELD 
       [0002]    This disclosure relates generally to the field of computer software and in particular to a method of program analysis using abstract interpretation which advantageously expresses non-convex properties. 
       BACKGROUND 
       [0003]    Efficient program analysis using abstract interpretation typically uses convex domains such as intervals, octagons, zonotopes or polyhedral. However, certain properties of interest require reasoning about non-convex structures. Accordingly, program analysis methods that address these non-convex structures would represent an advance in the art. 
       SUMMARY 
       [0004]    An advance in the art is made according to an aspect of the present disclosure directed a computer implemented method of program analysis employing a set of new non-convex domains based on the notion of an outer convex region of reachable states and an inner region of unreachable states. Advantageously, this allows the capture of non-convex properties by reasoning completely using convex regions and operations. 
         [0005]    In sharp contrast to the prior art, methods according to the present disclosure will over-approximate reachable states of a program under analysis and under-approximate unreachable states of that program. In that manner, a more precise analysis is performed. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWING 
         [0006]    A more complete understanding of the present disclosure may be realized by reference to the accompanying drawings in which: 
           [0007]      FIG. 1  shows a program excerpt providing a motivating example according to an aspect of the present disclosure; 
           [0008]      FIG. 2  is a schematic diagram depicting the concretization of a typical non-convex abstract object according to an aspect of the present disclosure; 
           [0009]      FIG. 3  is a schematic diagram depicting the relaxation of the hole (0,0) to x≧0 according to an aspect of the present disclosure; 
           [0010]      FIG. 4  is a schematic diagram depicting join and meet operators using interval component domains showing (a) two initial abstract objects; (b) concrete union of the objects; (c) abstract object representing ∪ 1/2 ; (d) the concrete intersection of the objects; and  9   e ) the abstract object representing ∩ 1/2 , according to an aspect of the present disclosure; 
           [0011]      FIG. 5  shows the evaluation of a linear expression [[x 2 &lt;−x 1 +x 2 ]]# 1/2  according to an aspect of the present disclosure; 
           [0012]      FIG. 6  shows the evaluation, of a non-linear expression [[x 2 &lt;−x 1 ×x21/2# according to an aspect of the present disclosure; 
           [0013]      FIG. 7  shows the under-approximation of randomly generated polyhedral with octagons according to an aspect of the present disclosure; 
           [0014]      FIG. 8  is a schematic block diagram depicting a high-level depiction of abstract interpretation based upon program analysis according to an aspect of the present disclosure; 
           [0015]      FIG. 9  is a schematic block diagram depicting several exemplary operations performed on donut domains according to an aspect of the present disclosure; and 
           [0016]      FIG. 10  shows a block diagram of an exemplary computer system on which methods according to the present disclosure may be implemented. 
       
    
    
     DETAILED DESCRIPTION 
       [0017]    The following merely illustrates the principles of the disclosure. It will thus be appreciated that those skilled in the art will be able to devise various arrangements which, although not explicitly described or shown herein, embody the principles of the disclosure and are included within its spirit and scope. 
         [0018]    Furthermore, all examples and conditional language recited herein are principally intended expressly to be only for pedagogical purposes to aid the reader in understanding the principles of the disclosure and the concepts contributed by the inventor(s) to furthering the art, and are to be construed as being without limitation to such specifically recited examples and conditions. 
         [0019]    Moreover, all statements herein reciting principles, aspects, and embodiments of the disclosure, as well as specific examples thereof, are intended to encompass both structural and functional equivalents thereof. Additionally, it is intended that such equivalents include both currently-known equivalents as well as equivalents developed in the future, i.e., any elements developed that perform the same function, regardless of structure. 
         [0020]    Thus, for example, it will be appreciated by those skilled in the art that the diagrams herein represent conceptual views of illustrative structures embodying the principles of the invention. 
         [0021]    In addition, it will be appreciated by those skilled in art that any flow charts, flow diagrams, state transition diagrams, pseudocode, and the like represent various processes which may be substantially represented in computer readable medium and so executed by a computer or processor, whether or not such computer or processor is explicitly shown. 
         [0022]    In the claims hereof any element expressed as a means for performing a specified function is intended to encompass any way of performing that function including, for example, a) a combination of circuit elements which performs that function or b) software in any form, including, therefore, firmware, microcode or the like, combined with appropriate circuitry for executing that software to perform the function. The invention as defined by such claims resides in the fact that the functionalities provided by the various recited means are combined and brought together in the manner which the claims call for. Applicant thus regards any means which can provide those functionalities as equivalent as those shown herein. Finally, and unless otherwise explicitly specified herein, the drawings are not drawn to scale. 
         [0023]    Thus, for example, it will be appreciated by those skilled in the art that the diagrams herein represent conceptual views of illustrative structures embodying the principles of the disclosure. 
         [0024]    By way of some additional background, it is noted that prior approach to non-convex reasoning is to utilize powerset domains of elementary convex domains. In general, it has proved to be difficult to provide satisfactory improvements over elementary convex domains with powerset domains while maintaining small enough performance degradation. Furthermore, it would be difficult to maintain enough disjunctions in the powerset depending on the particular non-convex shape being approximated. Note, however, that the recently proposed B OXES  domain can potentially represent exponentially many interval constraints compactly. It utilizes a BDD-like extension to elementary range constraints called LDD. However, we are interested in relational domains such as octagons, zonotopes or polyhedra as well. 
         [0025]    Additional non-convex domains based on congruence analysis (either linear or trapezoid have been developed. Such domains capture a congruence relation that variables satisfy and are suitable for the analysis of indexes of arrays for instance. Recent work by Chen et al. considered a polyhedral abstract domain with interval coefficients. This abstract domain has the ability to express certain non-convex invariants. For example, in this domain some multiplications can be evaluated precisely. Other interesting non-convex abstract domains were introduced to capture specific invariants such as min-max invariants and quadratic templates. 
         [0026]    We address a different type of non-convexity commonly occurring in software, which relates to small sub-regions of instability within a normal operating (convex) region of interest. The non-convex region of values that may cause the bug is (under-)approximated using a convex inner region (or hole) that is subtracted from a convex outer region. We call this representation donut domains. Our approach relies on the usual operations defined on (convex) sub-domains, except for the need to compute under-approximations in the inner domain. The donut domains give a convenient framework to reason about disequality constraints in abstract domains such as in. It can be considered as a generalization of the work on signed types domain introduced in. There, we start with a finite set of types, and allow a set-minus operation only from the universal set. 
       Under-Approximations of Polyhedral 
       [0027]    Under-approximations have been utilized for applications such as test vector generation and counterexample generation, by providing must-reach sets. Bemporad et al. introduced the notion of inner-approximations of polyhedra using intervals in. In, polyhedra are under-approximated for test vector generation of Simulink/Stateflow models using a bounded vertex representation (BVR). Goubault and Putot describe a method to compute an under-approximating zonotope using modal intervals for non-linear operations. 
         [0028]    Herein, we describe a technique to find under-approximations of polyhedra based on a fixed template. We first re-formulate the problem by introducing an auxiliary matrix. This matrix represents the fact that we are looking for an inner polyhedral object of a particular shape. Using this auxiliary matrix re-formulation, we can then use standard convex analysis techniques to characterize an under-approximations of polyhedra. 
       MOTIVATING EXAMPLE  
       [0029]      FIG. 1  highlights a code snippet taken froth XT IDE.  The XT IDE  package provides accurate tide and current predictions in a number of formats based on algorithms. Similar patterns may exist in controller-related software to avoid regions of controller or numerical instability. 
         [0030]    After the step marked initializations, (dx, dy) could be any point in            2  except the origin (0,0). In our analysis, this particular point is kept and propagated forward as a “hole”. After the i f-statement, the set of reachable values is: (dy&gt;dx         dy&gt;−dx)          (−dy&gt;dx         −dy&gt;−dx). The above region is non-convex; therefore, a classical abstract domain will end up at this control point with T for both variables. Moreover, here, the interpretation of the strict inequality of the test is required to prove that dx≠0. The else case is even harder: in addition to the non-convexity of the set of possible values, one needs to consider the full-zero-test together with the negation of |dy|&gt;|dx|, to prove that the division by dy is safe. 
       Donut Abstract Domains 
       [0031]    In this section we introduce donut domains, and define the operation on donut domains based on operations in the component domains. 
       Lattice Structure 
       [0032]    Let (           1 , ≦ 1 , ∪ 1 , ∩ 1 , ⊥ 1 , T 1 , γ 1 ) and (           2 , ≦ 2 , ∪ 2 , ∩ 2 , ⊥ 2 , T 2 , γ 2 ) denote two classical numerical abstract domains, where ≦*, ∪*, ∩*, ⊥*, T*, γ* denote the partial order, the join and meet operations, the bottom and top elements and the concretization function of the classical abstract domain for *∈ {1,2}, respectively. 
         [0033]    In this disclosure, we extend a given abstract domain with an under-approximation operator {hacek over (α)}, such that for any concrete object X, we have y ∘{hacek over (α)}(X)  ⊂ X. An abstract object X# 1\2  of the domain            1 \           2  is defined by a pair of objects (X# 1 , X# 2 ), such that X# 1  ∈            1  an X# 2  ∈            2 . The object X# 1\2  abstracts the set of possible values reached by the variables as follows:
       The object X# 1  ∈            1  represents an over-approximation of the set of reachable values; and   The object X# 2  ∈            2  represents an under-approximation of the set of unreachable values (usually within γ 1 (X# 1 )).       
 
         [0036]    The concretization function is defined as follows. 
         [0000]    
       
         
           
             
               γ 
               
                 1 
                  
                 \2 
               
             
              
             
               = 
               def 
             
              
             
               
                 
                   γ 
                   
                     1 
                      
                     \2 
                   
                 
                  
                 
                   ( 
                   
                     
                       X 
                       1 
                       # 
                     
                     , 
                     
                       X 
                       2 
                       # 
                     
                   
                   ) 
                 
               
                
               
                 = 
                 def 
               
                
               
                 
                   
                     
                       γ 
                       . 
                     
                     1 
                   
                    
                   
                     ( 
                     
                       X 
                       1 
                       # 
                     
                     ) 
                   
                 
                  
                 \ 
                  
                 
                   
                     
                       γ 
                       2 
                     
                      
                     
                       ( 
                       
                         X 
                         2 
                         # 
                       
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
         [0037]      FIG. 2  depicts a concretization of a typical donut object where the domain            1  is the affine sets domain and            2  is the octagons domain. 
         [0038]    At this point, one should keep in mind the implicit set of unreachable values implied by γ 1 (X# 1 )—namely            p \γ 1 (X# 1 ) denoted in the sequel by  γ   1 (X# 1 ). Indeed, the set of unreachable values is actually  γ   X#   1 ) ∩ γ 2 (X# 2 ). As said earlier, γ 2 (X# 2 ) is a (convex) under-approximation of the set of unreachable values. The fact that the intersection γ 1  (X# 1 ) ∩ γ 2  (X# 2 ) is not empty permits to encode a hole inside γ 1  (X# 1 ) (see  FIG. 2 ). 
       Interval Concretization 
       [0039]    The interval concretization of the variable x k , 1≦k≦p, denoted by [x k ], is defined by π k  (γ 1  (X# 1 )\γ 2  (X# 2 )), where π k  denotes the orthogonal projection of a given set onto dimension k. Note that [x k ] ⊃ π k (γ 1 (X# 1 ))\π k (γ 2 (X# 2 )). For instance in ([−2,2]×[−2,2], [−1,1]×[− 28  , +∞]) , we have [x 2 ]=[−2,2], whereas [−2,2]\[−∞, +∞]=Ø. 
         [0040]    We embed            1 \           2  with a binary relation and prove that it is a pre-order. 
         [0041]    Definition 1. Given X# 1 , Y# 1  ∈            1  and X# 2 , Y# 2  ∈            2 , we say that (X# 1 , X# 2 ) is less than or equal to (Y# 1 , Y# 2 ) denoted by (X# 1 , X# 2 )≦ 1\2  (Y# 1 , Y# 2 ) if and only if X# 1 ≦ 1  Y# 1  and 
         [0000]        γ   1 (X# 1 )∪γ 2 (X# 2 ) ⊃   γ   1 (Y# 1 )∪γ 2 (Y# 2 ).   (1)
 
         [0042]    Proposition 1. The binary relation ≦ 1\2  is a pre-order over            1 \           2 . It defines an equivalence relation ˜ defined by (X# 1 , X# 2 )≦ 1\2  (Y# 1 , Y# 2 ) and (Y# 1 , Y# 2 )≦ 1\2  (X# 1 , X# 2 ) and characterized by X# 1 =Y# 1  (X# 1 ≦ 1  Y# 1  and Y# 1 ≦ 1  X# 1 ), γ 2 (X# 2 ) ⊂ γ 2 (Y# 2 )∪  γ   1 (Y# 1 ) and γ 2 (Y# 22 ) ⊂ γ 2 (X# 2 ∪  γ   1 (X# 1 ). We reuse the symbol ≦ 1\2  to also denote the partial order quotiented by the equivalence relation ˜. 
         [0043]    With respect to ≦ 1\2 , we have 
         [0000]      (⊥ 1 , ⊥ 2 )˜(⊥ 1   , T   2 )≦ 1\2  ( T   1   , T   2 )≦ 1\2  ( T   1 , ⊥ 2 );
 
         [0000]    therefore, we define the bottom and top elements of            1 \           2  by 
         [0000]      ⊥ 1\2  def=(⊥ 1 , −)  T   1\2  def=( T   1 , ⊥ 2 ).
 
       Decidability of the Order 
       [0044]    Despite the non-convexity of  γ , the equivalence class introduced in Proposition 1 suggests particular representatives of objects (X# 1 , X# 2 ) which are easily comparable. Indeed,  y  is no longer involved when the concretization of the hole X# 2  is included in the concretization of X# 1 . Moreover, observe that the definition of the order relation ≦ 1\2  allows comparing two abstract objects having their holes in two different abstract domains, since only the concretization functions are involved in (1). 
         [0045]    Proposition 2. Let (X# 1 , X# 2 ) and (Y# 1 , Y# 2 ) be two elements of            1 \           2  such that γ 2  (X# 2 ) ⊂ γ 1 (X# 1 ), and γ 2 (Y# 2 ) ⊂ γ 1 (Y# 1 ). Therefore, (X# 1 , X# 2 )≦ 1\2  (Y# 1 , Y# 2 ) if and only if X# 1 ≦ 1  Y# 1  and γ 1 (X# 1 )∩γ 2  (Y# 2 ) ⊂ γ 2 (X# 2 ). 
         [0046]    The condition γ 1 (X# 1 )∩γ 2 (Y# 2 ) ⊂ γ 2 (X# 2 ), can be checked in the abstract world rather than in the concrete domain up to the use of an expressive enough domain for both            12  and            1 : for instance a box and an octagon can be seen as special polyhedra and the meet operation of the Polyhedra abstract domain can be used. 
         [0047]    Let           denote the abstract representation in the Polyhedra domain of the abstract object X# 1 , that is          (γ 1 (X# 1 )). To decide whether (X# 1 , X# 2 ) is less than or equal to (Y# 1 , Y# 2 ), we proceed as follows:
       1. First, we “upgrade” X# 2 and Y# 2  to the Polyhedra domain. We denote by (X# 1 ,          ) and (Y# 1 ,          ) the newly obtained abstract objects.   2. Then, we derive our particular representatives, namely (X# 1 ,          ∩ p           ) for (X# 1 ,          ) and (Y# 1 ,                              ) for (Y# 1 ,          ) (∩ p  being the meet operation in the Polyhedra domain).   3. Finally, we use Proposition 2 by checking for the inequalities X# 1 ≦ 1  Y# 1  and                            
 
       Meet and Join Operations 
       [0051]    We start with a simple example to clarify the intuition behind the formal definition given later. 
         [0052]    Example 1. Consider a one-dimensional donut domain where            1  and            2  are Intervals domains. Assume we are interested in computing
       ([0,3], [1,2])∪([1,6], [2,5]).       
 
         [0054]    The above join yields the following union of four intervals: [0,1)∪(2,3]∪[1,2)∪(5,6], which can be combined without loss of precision into [0,2)∪(2,3]∪(5,6], or equivalently
       [0,6]\([2]∪(3,5]).       
 
         [0056]    What the example suggests is that when computing a join of two elements (X# 1 , X# 2 ) and (Y# 1 , Y# 2 ), we often end up with multiple (not necessarily convex nor connex) holes defined by (γ 2 (X# 2 )∪  γ   1 (X# 1 ))∩(γ 2 (Y# 2 )∪  γ   1 (Y# 1 )). By distributing the meet over the join, we obtain:
       (γ 2 (X# 2 )∩γ 2 (Y# 2 ))∪(γ 2 (X# 2 )∩  γ   1 (Y# 1 ))∪(γ 2 (Y# 2 )∩  γ   1 (X# 1 ))∪(  γ   1 (X# 1 )∩  γ   1 (Y# 1 )).       
 
         [0058]    An under-approximation of the final element  γ   1 (X# 1 )∩  γ   1 (Y# 1 ) is implicit since the over-approximation of reachable values is given by X# 1  ∪ 1  Y# 1 . Thus, only the intersection of the first Three sets will be considered (which is sound). In our example,  γ ([1,6])=[−∞, 1)∪(6, +∞], and  γ ([0,3])=[−∞, 0)∪(3, +∞], this gives [1,2]∩[2,5]=[2,2] and 
         [0000]      [1,2]∪([−∞, 1)∪(6, +∞])=ø
 
         [0000]      [2,5]∩([−∞, 0)∪(3, +∞])=(3,5].
 
         [0059]    As noted previously, the intersection ([−∞, 1)∪(6, +∞])∩([−∞, 0)∪(3, +∞]) is implicit since it is covered by  γ   1 ([0,3]∪[1,6]). We now formalize the join operator: 
         [0000]    
       
         
           
             
               
                 
                   ( 
                   
                     
                       X 
                       1 
                       # 
                     
                     , 
                     
                       X 
                       2 
                       # 
                     
                   
                   ) 
                 
                  
                 
                   ⋃ 
                   
                     1 
                      
                     \2 
                   
                 
                  
                 
                   ( 
                   
                     
                       Y 
                       1 
                       # 
                     
                     , 
                     
                       Y 
                       2 
                       # 
                     
                   
                   ) 
                 
               
                
               
                 = 
                 def 
               
                
               
                 ( 
                 
                   
                     
                       X 
                       1 
                       # 
                     
                      
                     
                       ⋃ 
                       1 
                     
                      
                     
                       Y 
                       1 
                       # 
                     
                   
                   , 
                   
                     
                       ( 
                       
                         
                           X 
                           1 
                           # 
                         
                         , 
                         
                           X 
                           2 
                           # 
                         
                       
                       ) 
                     
                      
                     
                       ⋂ 
                       ⋓ 
                     
                      
                     
                       ( 
                       
                         
                           Y 
                           1 
                           # 
                         
                         , 
                         
                           Y 
                           2 
                           # 
                         
                       
                       ) 
                     
                   
                 
                 ) 
               
             
             , 
           
         
       
     
         [0000]    where  ∩  is defined by: 
         [0000]    
       
         
           
             
               
                 ( 
                 
                   
                     X 
                     1 
                     ♯ 
                   
                   , 
                   
                     X 
                     2 
                     ♯ 
                   
                 
                 ) 
               
                
               
                 ⋂ 
                 ˘ 
               
                
               
                 ( 
                 
                   
                     Y 
                     1 
                     ♯ 
                   
                   , 
                   
                     Y 
                     2 
                     ♯ 
                   
                 
                 ) 
               
             
              
             
               = 
               def 
             
              
             
               
                 
                   α 
                   ˘ 
                 
                  
                 
                   ( 
                   
                     
                       ( 
                       
                         
                           
                             γ 
                             2 
                           
                            
                           
                             ( 
                             
                               X 
                               2 
                               ♯ 
                             
                             ) 
                           
                         
                         ⋂ 
                         
                           
                             γ 
                             2 
                           
                            
                           
                             ( 
                             
                               Y 
                               2 
                               ♯ 
                             
                             ) 
                           
                         
                       
                       ) 
                     
                     ⋃ 
                     
                       ( 
                       
                         
                           
                             γ 
                             2 
                           
                            
                           
                             ( 
                             
                               X 
                               2 
                               ♯ 
                             
                             ) 
                           
                         
                         ⋂ 
                         
                           
                             
                               γ 
                               _ 
                             
                             1 
                           
                            
                           
                             ( 
                             
                               Y 
                               1 
                               ♯ 
                             
                             ) 
                           
                         
                       
                       ) 
                     
                     ⋃ 
                     
                       ( 
                       
                         
                           
                             γ 
                             2 
                           
                            
                           
                             ( 
                             
                               Y 
                               2 
                               ♯ 
                             
                             ) 
                           
                         
                         ⋂ 
                         
                           
                             
                               γ 
                               _ 
                             
                             1 
                           
                            
                           
                             ( 
                             
                               X 
                               1 
                               ♯ 
                             
                             ) 
                           
                         
                       
                       ) 
                     
                   
                   ) 
                 
               
               . 
             
           
         
       
     
         [0060]    We may perform heuristic checks to prioritize which hole (if many) to keep, which may also depend on the under-approximation abstraction function {hacek over (α)}. For instance we may choose an inner approximation (if working with closed domains) of the hole (3,5] instead of choosing the hole [2,2]. Notice also that we have a straightforward fallback operator {hacek over (∩)} fb , that involves only X# 2  and Y# 2 : 
         [0000]    
       
         
           
             
               
                 X 
                 2 
                 ♯ 
               
                
               
                 
                   ⋂ 
                   ˘ 
                 
                 fb 
               
                
               
                 Y 
                 2 
                 ♯ 
               
             
              
             
               = 
               def 
             
              
             
               
                 
                   α 
                   ˘ 
                 
                  
                 
                   ( 
                   
                     
                       
                         γ 
                         2 
                       
                        
                       
                         ( 
                         
                           X 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                     ⋂ 
                     
                       
                         γ 
                         2 
                       
                        
                       
                         ( 
                         
                           Y 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                   
                   ) 
                 
               
               . 
             
           
         
       
     
         [0061]    The operator is sound with respect to under-approximation. It focuses only on a particular hole, namely γ 2 (X# 2 )∩γ 2 (Y# 2 ), instead of considering all possibilities. In our current implementation, we use this fallback operator in a smart manner: before computing the meet of both holes, we relax, whenever possible, in a convex way, these holes. This relaxation is performed by removing all constraints that could be removed while preserving γ 1 (X# 1 ). For instance, if the hole is the point (0,0), and the abstraction of X# 1  is given by the conjunction γ≧x{circumflex over ( 0 )}−γ≧x, then the hole (0,0) is relaxed to x≧0 (see  FIG. 3 ). 
         [0062]    For the meet operation, we proceed in a similar manner. If the domain            2  is closed under the meet operation (almost all polyhedra-like abstract domains), it is possible to replace {hacek over (α)} by α, and {hacek over (∩)} fb  by ∩ 2 . In our example, the fallback operator gives the box [2,2]. 
         [0063]    The meet operator ∩ 1\2  is defined in a similar manner: 
         [0000]    
       
         
           
             
               
                 ( 
                 
                   
                     X 
                     1 
                     ♯ 
                   
                   , 
                   
                     X 
                     2 
                     ♯ 
                   
                 
                 ) 
               
                
               
                 ⋂ 
                 
                   1 
                    
                   \2 
                 
               
                
               
                 ( 
                 
                   
                     Y 
                     1 
                     ♯ 
                   
                   , 
                   
                     Y 
                     2 
                     ♯ 
                   
                 
                 ) 
               
             
              
             
               = 
               def 
             
              
             
               
                 ( 
                 
                   
                     
                       X 
                       1 
                       ♯ 
                     
                      
                     
                       ⋂ 
                       1 
                     
                      
                     
                       Y 
                       1 
                       ♯ 
                     
                   
                   , 
                   
                     
                       X 
                       2 
                       ♯ 
                     
                      
                     
                       ⋃ 
                       ˘ 
                     
                      
                     
                       Y 
                       2 
                       ♯ 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               where 
             
           
         
       
       
         
           
             
               
                 X 
                 2 
                 ♯ 
               
                
               
                 ⋃ 
                 ˘ 
               
                
               
                 Y 
                 2 
                 ♯ 
               
             
              
             
               = 
               def 
             
              
             
               
                 
                   
                     α 
                     ˘ 
                   
                   2 
                 
                  
                 
                   ( 
                   
                     
                       
                         γ 
                         2 
                       
                        
                       
                         ( 
                         
                           X 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                     ⋃ 
                     
                       
                         γ 
                         2 
                       
                        
                       
                         ( 
                         
                           Y 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                   
                   ) 
                 
               
               . 
             
           
         
       
     
         [0064]    We deliberately omit  γ   1 (X# 1 )∪  γ   1 (Y# 1 ) in the above definition of {hacek over (∪)} because it is implicit from X# 1 ∩ 1 Y# 1 . If the domain            2  is closed under the join operation, then {hacek over (∪)} is exactly equal to ∪ 2 . Very often, however, the join operation leads to an over-approximation. Therefore the detection of an exact join as in is of particular interest. In our current implementation, if X# 2  and Y# 2  overlap, we soundly extend, in a convex way, the non-empty intersection. For instance, if X# 2 =[−2,1]×[−1,1] and Y# 2 =[−1,2]×[−2,0], the intersection gives the box [−1,1]×[−1,0], and the extension we compute gives the box [−2,2]×[−1,0]. If, however, the holes are disjoint, we randomly pick up one of them. 
         [0065]    Example 2. Consider 2 -dim simple abstract objects.  FIG. 4  shows a graphical representation of two overlapping objects. The remaining sub-figures highlight some of the pertinent steps with respect to the computation of ∪ 1\2  and ∩ 1\2  for such overlapping objects. 
       Loop Widening 
       [0066]    When processing loop elements in abstract interpretation, we may require widening to guarantee termination of the analysis. For donut domains, we extend the widening operations defined on the component abstract domains. We use the pair-wise definition of widening operators ∇. We thus define widening of donut domains as: 
         [0000]      ( X#   1   , X#   2 )∇ 1\2 ( Y#   1   , Y#   2 )=( X#   1 ∇ 1   Y#   1   ,X#   2 ∩ 2   Y#   2 ).
 
         [0067]    We use the standard widening operator ∇ 1  for abstract domain            1 . Similarly, we use the standard meet operator ∩ 2  of abstract domain            2  for the inner region, which ensures the soundness of ∇ 1\2 . The convergence of the first component is guaranteed by the widening operator ∇ 1 . The convergence of the second component needs however more attention. 
         [0068]    Note that the simple use of narrowing operator of            2  is unsound as it may give a donut object which is not an upper bound. To ensure the termination we add a parameter k which will encode the maximal number of allowed iterations. If the donut object does not converge within those k iterations, the hole component is reduced to ⊥ 2 . Note that the use of the narrowing operator of            2  instead of ∩ 2  does not give in general an upper bound of (X# 1 , X# 2 ) and (Y# 1 , Y# 2 ). 
       Interpretation of Tests 
       [0069]    The ability to express holes allows us to better handle a wide range of non-convex tests such as the ≠ test or the strict inequality test. We start with classical tests. For ⋄∈ {=, ≦}: 
         [0000]    
       
         
           
             
               
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       ⋄ 
                       0 
                     
                     〛 
                   
                   ♯ 
                 
                  
                 
                   ( 
                   
                     
                       X 
                       1 
                       ♯ 
                     
                     , 
                     
                       X 
                       2 
                       ♯ 
                     
                   
                   ) 
                 
               
                
               
                 = 
                 def 
               
                
               
                 ( 
                 
                   
                     
                       
                         〚 
                         
                           
                             x 
                             k 
                           
                           ⋄ 
                           0 
                         
                         〛 
                       
                       1 
                       ♯ 
                     
                      
                     
                       ( 
                       
                         X 
                         1 
                         ♯ 
                       
                       ) 
                     
                   
                   , 
                   
                     
                       
                         〚 
                         
                           
                             x 
                             k 
                           
                           ⋄ 
                           0 
                         
                         〛 
                       
                       1 
                       ♮ 
                     
                      
                     
                       ( 
                       
                         X 
                         2 
                         ♯ 
                       
                       ) 
                     
                   
                 
                 ) 
               
             
             , 
           
         
       
     
         [0000]    where 
         [0000]    
       
         
           
             
               
                 〚 
                 · 
                 〛 
               
               2 
               ♮ 
             
              
             
               = 
               def 
             
              
             
               
                 
                   
                     α 
                     ˘ 
                   
                   2 
                 
                 ∘ 
                 
                   
                     〚 
                     · 
                     〛 
                   
                   2 
                 
               
               . 
             
           
         
       
     
         [0000]    Such under-approximation is required so that the newly computed (exact) hole can be encoded in            2 . Therefore, if the exact hole fits naturally in            2  (say we have a linear constraint and            2  is the Polyhedra domain), there is no need to under-approximate ([[·]]# 2 =[[·]]# 2 ). In Section 3, we detail how we compute such an under-approximation, whenever needed. If no algorithm is available for the under-approximation, we keep the object n unchanged, which is sound. 
         [0070]    The non-equality test is defined as follows: 
         [0000]    
       
         
           
             
               
                 
                   〚 
                   
                     
                       x 
                       k 
                     
                     ≠ 
                     0 
                   
                   〛 
                 
                 ♯ 
               
                
               
                 ( 
                 
                   
                     X 
                     1 
                     ♯ 
                   
                   , 
                   
                     X 
                     2 
                     ♯ 
                   
                 
                 ) 
               
             
              
             
               = 
               def 
             
              
             
               
                 ( 
                 
                   
                     
                       
                         〚 
                         
                           
                             x 
                             k 
                           
                           ≠ 
                           0 
                         
                         〛 
                       
                       ♯ 
                     
                      
                     
                       ( 
                       
                         X 
                         1 
                         ♯ 
                       
                       ) 
                     
                   
                   , 
                   
                     
                       α 
                       ˘ 
                     
                      
                     
                       ( 
                       
                         
                           
                             
                               γ 
                               2 
                             
                              
                             
                               ( 
                               
                                 X 
                                 2 
                                 ♯ 
                               
                               ) 
                             
                           
                           ⋃ 
                           
                             〚 
                             
                               
                                 x 
                                 k 
                               
                               = 
                               0 
                             
                             〛 
                           
                         
                          
                         
                           ⊤ 
                           2 
                         
                       
                       ) 
                     
                   
                 
                 ) 
               
               . 
             
           
         
       
     
         [0071]    Although [[χ k ≠0]]#(X# 1 ) is interpreted as the identity function in standard implementations, nothing prevents the use of any available enhancement proposed by the used analyzer. For the hole, we compute the join of the new hole implied by the constraint x k ≠0 together with the already existing hole X# 2 . If holes γ 2 (X# 2 ) and [[χ k =0]]T 2  do not overlap, we discard X# 2 . In fact, very often (as will be seen in experiments), the hole induced by the constraint x k ≠0 is mandatory in order to prove the safety of subsequent computations. 
         [0072]    Finally, our approach offers, for free, an interesting abstraction of the strict inequality tests. A comparison with Not Necessarily Closed domains is planned as future work. 
         [0000]    
       
         
           
             
               
                 
                   〚 
                   
                     
                       x 
                       k 
                     
                     &lt; 
                     0 
                   
                   〛 
                 
                 ♯ 
               
                
               
                 ( 
                 
                   
                     X 
                     1 
                     ♯ 
                   
                   , 
                   
                     X 
                     2 
                     ♯ 
                   
                 
                 ) 
               
             
              
             
               = 
               def 
             
              
             
               
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       ≠ 
                       0 
                     
                     〛 
                   
                   ♯ 
                 
                 ∘ 
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       ≤ 
                       0 
                     
                     〛 
                   
                   ♯ 
                 
               
                
               
                 
                   ( 
                   
                     
                       X 
                       1 
                       ♯ 
                     
                     , 
                     
                       X 
                       2 
                       ♯ 
                     
                   
                   ) 
                 
                 . 
               
             
           
         
       
     
       Abstract Assignment 
       [0073]    We define in this section the abstraction of the assignment transfer function in            1 \           2 . We first give an abstraction of the forget transfer function (non-deterministic assignment): 
         [0000]    
       
         
           
             
               
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       ← 
                       ? 
                     
                     〛 
                   
                   
                     1 
                      
                     \2 
                   
                   ♯ 
                 
                  
                 
                   ( 
                   
                     
                       X 
                       1 
                       ♯ 
                     
                     , 
                     
                       X 
                       2 
                       ♯ 
                     
                   
                   ) 
                 
               
                
               
                 = 
                 def 
               
                
               
                 ( 
                 
                   
                     Y 
                     1 
                     ♯ 
                   
                   , 
                   
                     Y 
                     2 
                     ♯ 
                   
                 
                 ) 
               
             
             , 
             where 
           
         
       
       
         
           
             
               Y 
               1 
               ♯ 
             
              
             
               = 
               def 
             
              
             
               
                 
                   〚 
                   
                     
                       x 
                       k 
                     
                     ← 
                     ? 
                   
                   〛 
                 
                 1 
                 ♯ 
               
                
               
                 ( 
                 
                   X 
                   1 
                   ♯ 
                 
                 ) 
               
             
           
         
       
       
         
           
             
               Y 
               2 
               ♯ 
             
              
             
               = 
               def 
             
              
             
               { 
               
                 
                   
                     
                       
                         
                           〚 
                           
                             
                               x 
                               k 
                             
                             ← 
                             ? 
                           
                           〛 
                         
                         2 
                         ♯ 
                       
                        
                       
                         ( 
                         
                           X 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                   
                   
                     
                       
                         
                           if 
                            
                           
                               
                           
                            
                           
                             
                               γ 
                               1 
                             
                              
                             
                               ( 
                               
                                 X 
                                 1 
                                 ♯ 
                               
                               ) 
                             
                           
                         
                         ⋂ 
                         
                           
                             γ 
                             2 
                           
                            
                           
                             ( 
                             
                               
                                 
                                   〚 
                                   
                                     
                                       x 
                                       k 
                                     
                                     ← 
                                     ? 
                                   
                                   〛 
                                 
                                 2 
                                 ♯ 
                               
                                
                               
                                 ( 
                                 
                                   X 
                                   2 
                                   ♯ 
                                 
                                 ) 
                               
                             
                             ) 
                           
                         
                       
                       ⊆ 
                       
                         
                           γ 
                           2 
                         
                          
                         
                           ( 
                           
                             X 
                             2 
                             ♯ 
                           
                           ) 
                         
                       
                     
                   
                 
                 
                   
                     
                       ⊥ 
                       2 
                     
                   
                   
                     
                       otherwise 
                       . 
                     
                   
                 
               
             
           
         
       
     
         [0074]    For Y# 2 , we basically check whether applying the forget operator to X# 2  intersects γ 1\2 (X# 1 , X# 2 ), by checking if this newly computed hole is included in the original hole, that is γ 2 (X# 2 ). If yes, Y# 2  is set to ⊥ 2 . For instance, forgetting x 2  in 
         [0000]    
       
         
           
             
               
                 ( 
                 
                   
                     X 
                     1 
                     ♯ 
                   
                   , 
                   
                     X 
                     2 
                     ♯ 
                   
                 
                 ) 
               
                
               
                 = 
                 def 
               
                
               
                 
                   
                     
                       ( 
                       
                         
                           
                             [ 
                             
                               
                                 - 
                                 2 
                               
                               , 
                               2 
                             
                             ] 
                           
                           × 
                           
                             [ 
                             
                               
                                 - 
                                 2 
                               
                               , 
                               2 
                             
                             ] 
                           
                         
                         , 
                         
                           
                             [ 
                             
                               
                                 - 
                                 1 
                               
                               , 
                               1 
                             
                             ] 
                           
                           × 
                           
                             [ 
                             
                               
                                 - 
                                 ∞ 
                               
                               , 
                               
                                 + 
                                 ∞ 
                               
                             
                             ] 
                           
                         
                       
                       ) 
                     
                      
                     
                         
                     
                      
                     
                       gives 
                        
                       
                         
 
                       
                       ( 
                       
                         
                           
                             [ 
                             
                               
                                 - 
                                 2 
                               
                               , 
                               2 
                             
                             ] 
                           
                           × 
                           
                             [ 
                             
                               
                                 - 
                                 ∞ 
                               
                               , 
                               
                                 + 
                                 ∞ 
                               
                             
                             ] 
                           
                         
                         , 
                         
                           
                             [ 
                             
                               
                                 - 
                                 1 
                               
                               , 
                               1 
                             
                             ] 
                           
                           × 
                           
                             [ 
                             
                               
                                 - 
                                 ∞ 
                               
                               , 
                               
                                 + 
                                 ∞ 
                               
                             
                             ] 
                           
                         
                       
                       ) 
                     
                   
                   : 
                   
                     
 
                   
                    
                   
                     
                       
                         since 
                          
                         
                           
 
                         
                         〚 
                         
                           
                             x 
                             2 
                           
                           ← 
                           ? 
                         
                         〛 
                       
                       2 
                       ♯ 
                     
                      
                     
                       ( 
                       
                         X 
                         2 
                         ♯ 
                       
                       ) 
                     
                   
                 
                 = 
                 
                   
                     [ 
                     
                       
                         - 
                         1 
                       
                       , 
                       1 
                     
                     ] 
                   
                   × 
                   
                     [ 
                     
                       
                         - 
                         ∞ 
                       
                       , 
                       
                         + 
                         ∞ 
                       
                     
                     ] 
                   
                 
               
             
             , 
             
               
 
             
              
             
               
                 
                   
                     γ 
                     1 
                   
                    
                   
                     ( 
                     
                       X 
                       1 
                       ♯ 
                     
                     ) 
                   
                 
                 ⋂ 
                 
                   
                     γ 
                     2 
                   
                    
                   
                     ( 
                     
                       
                         
                           〚 
                           
                             
                               x 
                               2 
                             
                             ← 
                             ? 
                           
                           〛 
                         
                         2 
                         ♯ 
                       
                        
                       
                         ( 
                         
                           X 
                           2 
                           ♯ 
                         
                         ) 
                       
                     
                     ) 
                   
                 
               
               = 
               
                 
                   [ 
                   
                     
                       - 
                       1 
                     
                     , 
                     1 
                   
                   ] 
                 
                 × 
                 
                   [ 
                   
                     
                       - 
                       2 
                     
                     , 
                     2 
                   
                   ] 
                 
               
             
           
         
       
     
         [0000]    which is included in γ 2 (X# 2 ). Forgetting x 1 , however, makes Y# 2 =⊥ 2 . 
         [0075]    The assignment could be seen as a sequence of multiple basic, already defined, operations. We distinguish two kind of assignments x←e, where e is an arithmetic expression: (I) non-invertible assignments, where the old values of x are lost, such as x←c, c ∈          , and (II) invertible assignments, such as x←x+y. For non-invertible assignment, we have: 
         [0000]    
       
         
           
             
               
                 〚 
                 
                   
                     x 
                     k 
                   
                   ← 
                   e 
                 
                 〛 
               
               
                 1 
                  
                 \2 
               
               ♯ 
             
              
             
               = 
               def 
             
              
             
               
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       = 
                       e 
                     
                     〛 
                   
                   
                     1 
                      
                     \2 
                   
                   ♯ 
                 
                 ∘ 
                 
                   
                     〚 
                     
                       
                         x 
                         k 
                       
                       ← 
                       ? 
                     
                     〛 
                   
                   
                     1 
                      
                     \2 
                   
                   ♯ 
                 
               
               . 
             
           
         
       
     
         [0076]    Invertible assignments are defined in a similar manner. It augments first the set of variables by a new fresh variable, say ν, then enforces the test ν=e, and finally forgets x and (syntactically) renames ν to x. Notice that augmenting the set of variables in            1 \           2  makes the newly added variable, ν, unconstrained in both components, X# 1  and X# 2 . We can suppose that such a variable v already exists, and used whenever we have an invertible assignment; hence, we obtain: 
         [0000]    
       
         
           
             
               
                 〚 
                 
                   
                     x 
                     k 
                   
                   ← 
                   e 
                 
                 〛 
               
               
                 1 
                  
                 \2 
               
               ♯ 
             
              
             
               = 
               def 
             
              
             
               
                 swap 
                  
                 
                   ( 
                   
                     
                       x 
                       k 
                     
                     , 
                     v 
                   
                   ) 
                 
               
                
               
                   
               
                
               
                 
                   
                     
                       in 
                        
                       
                           
                       
                       〚 
                       
                         
                           x 
                           k 
                         
                         ← 
                         ? 
                       
                       〛 
                     
                     
                       1 
                        
                       \2 
                     
                     ♯ 
                   
                   ∘ 
                   
                     
                       〚 
                       
                         v 
                         = 
                         e 
                       
                       〛 
                     
                     
                       1 
                        
                       \2 
                     
                     ♯ 
                   
                 
                 . 
               
             
           
         
       
     
       Template-Based Under-Approximations of Polyhedral 
       [0077]    We now develop a new technique to under-approximate holes obtained after linear tests. Holes obtained after non-linear tests are so far reduced to ⊥ 2 , which is sound. We plan to improve this as a future work. Consider for instance the object ([−2,3]×[−2,2], [−1,1]×[0,1]) .  FIG. 5  depicts the exact evaluation of a linear assignment. If we use boxes to encode holes, we need to compute a box inside the white polytope. In  FIG. 6 , an under-approximation is needed for all convex domains, whereas a non-convex domain such as Interval Polyhedra can express exactly this kind of pattern. 
         [0078]    The problem can be seen as follows: given a polyhedron          , we seek to compute a maximal (in a sense to define) inner polyhedron           (could be boxes, zones, octagons, linear-templates, etc. depending on            2 ), which obeys the template pattern matrix T. 
         [0079]    Let          ={x ∈          |Zx≦b} be a non-empty polyhedron, where A is a known m×p matrix, b a known vector of            m , and x a vector of            p . The inner polyhedron           is expressed in a similar manner:          ={x ∈            p |Tx≦c}, where T is a known n×p matrix, and c and x are unknown vectors within            n  and            p , respectively. The inclusion            ⊂            holds if and only if
       ∃c ∈            n  , such that           is consistent, and ∀x ∈           p : Tx≦cAx≦b.       
 
         [0081]    The consistency of           (that is the system admits a solution in            p ) discards the trivial (and unwanted) cases where the polyhedron           is empty. For the non-trivial cases, the existence of the vector c and the characterization of the set of its possible values are given by Proposition 3. 
         [0082]    Proposition 3. Let           be the set of c such that           is consistent. There exists a vector c ∈           such that            ⊂            if and only if there exists an n×m matrix Λ, such that λ i,j , the elements of the matrix Λ, are non-negative and ΛT=A. For a given possible Λ, the set c Λ   ⊂            is characterized by
       {c ∈            n |Λc≦b}.       
 
         [0084]    Proof. Let x denote a vector of            p , and b denote a known vector of            m . Let A and T be two known matrices with p columns and m and n rows, respectively. Suppose that c is such that           is consistent. Therefore, we can assume that
       &lt;t i , x&gt;≦c i , 1≦i≦n,
 
where t i  denotes the ith row of the matrix T, is consistent. For a fixed j, 1≦j≦m, the inequality &lt;a j , x&gt;≦b j , is then a consequence of the system Tx≦c if and only if there exist non-negative real numbers λ i,j , 1≦i≦n, such that
       
 
         [0000]    
       
         
           
             
               
                 ∑ 
                 
                   i 
                   = 
                   1 
                 
                 n 
               
                
               
                 
                   λ 
                   
                     i 
                     , 
                     j 
                   
                 
                  
                 
                   t 
                   i 
                 
               
             
             = 
             
               
                 
                   a 
                   j 
                 
                  
                 
                     
                 
                  
                 and 
                  
                 
                     
                 
                  
                 
                   
                     ∑ 
                     
                       i 
                       = 
                       1 
                     
                     n 
                   
                    
                   
                     
                       λ 
                       
                         i 
                         , 
                         j 
                       
                     
                      
                     
                       c 
                       i 
                     
                   
                 
               
               ≤ 
               
                 
                   b 
                   j 
                 
                 . 
               
             
           
         
       
     
         [0086]    The previous claim of the existence of the non-negative λ i,j  is a generalization of the classical Farkas&#39; Lemma. The matrix Λ is then constructed column by column using the elements λ i,j , 1≦i≦n for the j th column. Of course, by construction, such a Λ has non-negative elements, and satisfies ΛT=A, and Λc≦b. 
         [0087]    On the other hand, if such a matrix exists, and the set {c ∈            n |Λc≦b} is not empty, we have by the fact that Λ has non-negative elements 
         [0000]      Tχ≦c         ΛTχ≦Λc.
 
         [0000]    Therefore, ΛT=A and Λc≦b, gives Ax≦b. 
       On the Consistency of Tx≦c. 
       [0088]    It not obvious in general, given a matrix T, to characterize the set of c such that           is consistent. However, given a vector c, we can efficiently check whether the system is consistent or not using its dual form and a LP solver. Indeed, the system Tx≦c is inconsistent if and only if there exists a non-negative vector λ ∈            n  such that T t λ=0 and &lt;λ, c&gt;&lt;0, where T t  denotes the transpose of T. Therefore, given a vector c, if the objective value of the following problem: 
         [0000]      min          λ,  c             s.t. T′λ= 0   (2)
 
         [0000]    is non-negative, the system is consistent. Observe that, for simple patterns such as boxes, the characterization of the set of c that makes the system consistent is immediate. 
       Computing A. 
       [0089]    The matrix Λ is built column by column. Let us denote by λ —,j  ∈            n  the jth column of Λ, by a j  ∈            p , 1≦j≦m, the jth row of A, by b j  ∈           the jth component of b, and by t i  ∈            p , 1≦i≦m, the ith row of T. The vector λ —,j  satisfies Σ i=1   n λ i,j t i =a j . To each feasible λ —,j  corresponds a pattern 
         [0000]    
       
         
           
             
               
                 
                   
                     λ 
                     - 
                   
                   , 
                   j 
                 
               
               := 
               
                 { 
                 
                   
                     
                       x 
                       ∈ 
                       
                         p 
                       
                     
                     | 
                     
                       
                          
                         
                           
                             λ 
                             
                               i 
                               , 
                               j 
                             
                           
                           &gt; 
                           0 
                         
                       
                        
                       
                         &lt; 
                         
                           t 
                           i 
                         
                       
                     
                   
                   , 
                   
                     x 
                     &gt; 
                     ≤ 
                     0 
                   
                 
                 } 
               
             
             , 
           
         
       
     
         [0000]    which is included in the affine subspace 
         [0000]    
       
         
           
             
               j 
             
              
             
               = 
               def 
             
              
             
               
                 { 
                 
                   
                     x 
                     ∈ 
                     
                       p 
                     
                   
                   | 
                   
                     
                       〈 
                       
                         
                           α 
                           j 
                         
                         , 
                         x 
                       
                       〉 
                     
                     ≤ 
                     0 
                   
                 
                 } 
               
               . 
             
           
         
       
     
         [0000]    The maximal pattern (with respect to set inclusion) corresponds to  λ  defined as the solution of the following linear program. 
         [0000]    
       
         
           
             
               
                 
                   
                     min 
                      
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         n 
                       
                        
                       
                         
                           λ 
                           
                             i 
                             , 
                             j 
                           
                         
                          
                         
                            
                           
                             t 
                             i 
                           
                            
                         
                       
                     
                   
                    
                   
                     
 
                   
                    
                   
                     
                       s 
                       . 
                       t 
                       . 
                       
                           
                       
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           n 
                         
                          
                         
                           
                             λ 
                             
                               i 
                               , 
                               j 
                             
                           
                            
                           
                             t 
                             i 
                           
                         
                       
                     
                     = 
                     
                       a 
                       j 
                     
                   
                    
                   
                     
 
                   
                    
                   
                     
                       ∀ 
                       
                         0 
                         ≤ 
                         i 
                         ≤ 
                         n 
                       
                     
                     , 
                     
                       
                         λ 
                         
                           i 
                           , 
                           j 
                         
                       
                       ≥ 
                       0 
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0000]    Therefore, computing Λ needs solving p instances of the LP (3). 
       Computing c. 
       [0090]    We have already established (Proposition 3) that the vector c verifies Λc≦b. Since A is known, any feasible c (that is such that Λc≦b) that makes the system Tx≦c consistent (the objective value of the LP (2) is non-negative) gives an under-approximation of           that respects our initial template T. Of course, it is immediate to see that the set of c that lies on the boundaries of the feasible region (that is by making Λc=b) gives, in general, a “better” under-approximation than the strict feasible solutions since the saturation makes some of the facets of the inner pattern (         ) included in those of the under-approximated polyhedron          . Moreover, in some cases, the saturation gives a unique consistent solution for c. For instance, when we under-approximate a shape           which respects already the pattern          , c is uniquely determined and gives actually b using our technique. In other words, under-approximating an octagon (for instance) with an octagonal pattern gives exactly the first octagon. 
       Implementation 
       [0091]    We have implemented donut domains on top of the known A PRON  library. The domains            1  and            2  are parameters of the analysis and can be specified by the user among already existing APRON domains. The current version uses an enhanced implementation of the set-theoretic operators, mainly based on already existing routines of the underlying abstract domains, as described earlier, and relies on {hacek over (∪)} fb  and {hacek over (∩)} fb  as fallback operators. This very simple approach allows to build the donut domain without additional effort on top of already existing domains. The analyzed examples (see Table 1) use mainly the absolute value function to avoid the division by zero (widely used technique). The motiv example is the motivating example with its two branches. The gpc code is extracted from the Generic Polygon Clipper project. The examples xcor, goc and x2 are extracted from a geometric object contact detection library. 
         [0092]    Division-by-Zero Analysis Results 
         [0000]    
       
         
               
               
               
               
             
               
               
               
               
             
           
               
                   
                 TABLE 1 
               
               
                   
                   
               
               
                   
                 WCfS 
                 boxes (hole) 
                 false alarms 
               
               
                   
                   
               
             
             
               
                   
               
             
          
           
               
                 motiv(if) 
                 dy ≠ 0 
                 dy = 0 
                 0 
               
               
                 motiv(else) 
                 dx ≠ 0 
                 dx = 0 
                 0 
               
               
                 gpc 
                 den ≠ 0 
                 den ∈ [−0.1, 0.1] 
                 0 
               
               
                 goc 
                 d ≠ 0 
                 d ∈ [−0.09, 0.09] 
                 0 
               
               
                 x2 
                 Dx ≠ 0 
                 Dx = 0 
                 0 
               
               
                 xcor 
                 usemax ≠ 0 
                 usemax ∈ [1, 10] 
                 1 
               
               
                   
               
             
          
         
       
     
         [0093]    The WCfS column (above) indicates the weakest condition that we need to infer to prove the safety of the program. Whenever the negation of this condition is verified by (included in) the donut hole, the program is proved to be safe. The third column shows the inferred donut holes when using a non-relational domain (boxes) to encode holes. As Table 1 shows, our approach permits to catch almost all division-by-zero false positives that classical domains (even non-convex) fail to prove. Here, the use of boxes is sufficient to eliminate almost all false alarms here. In the last example, among the two possible holes, namely usemax ∈ [1,10] and usemax ∈ {0}, we choose by default the one created immediately after the test (usemax&gt;10 or usemax&lt;1). Here the safety property can not be proved with this hole and relies on an earlier (disjoint) hole created by a former test, namely usemax ∈ {0}. We could also choose systematically (as a heuristic) the hole that contains “zero”, which is sufficient here to discard the remaining false alarm. Such a property-driven hole behavior would be an interesting direction for future research. 
         [0094]    The proof of the motivating example is really challenging as it requires to handle both the hole that comes from the full-zero-test, together with strict inequality tests and the over-approximation that comes from the join operation. Our technique that consists of relaxing the hole in a convex way before using the fallback operator works here and is able to prove that in both branches the division is safe. In goc example, we can see one interesting ability of donuts domain: when we compute a convex join of two non-overlapping objects, the hole in between is directly captured which permits a better precision. Finally, example x2 needs a precise interpretation of strict inequalities. 
       Under-Approximation. 
       [0095]    We have implemented our technique of Section 3 using the GLPK solver. Some experiments, obtained for randomly generated polyhedra with octagonal template, are shown in  FIG. 7 . Although all shown polyhedra are bounded, our technique works perfectly well for unbounded shapes. The rate of volume, 
         [0000]    
       
         
           
             
               volT 
               volP 
             
             , 
           
         
       
     
         [0000]    is used as a metric for the quality of the under-approximation (shown near each pattern in  FIG. 7 ). 
         [0096]    All obtained octagons are maximal with respect to set inclusion. It is not clear which choice among many (see the left graph), is the best. Indeed, such a choice depends on the future computations and the properties one would like to prove. 
         [0097]    With reference now to  FIG. 8 , there is shown a schematic block diagram depicting an overview of abstract interpretation applicable to and according to an aspect of the present disclosure. As depicted there, a program under analysis is modeled and an abstract interpretation program analysis is performed. As those skilled in the art now readily appreciate, such abstract interpretation computes an over-approximation of reachable states. Stated alternatively, it computes an over-approximated set of those states that may be reached when the program is executed. Of course, even an over-approximation may be useful to highlight potential errors in the program, such as a null-pointer, buffer overruns, division-by-zero, etc. 
         [0098]    While not specifically shown in  FIG. 8 , to realize an efficient computation , abstraction interpretation generally utilizes computations in convex domains such as intervals, octagons, or polyhedra to compute this over-approximation of the reachable states. 
         [0099]    However, and as may be appreciated by those skilled in the art, certain properties of interest sometimes require reasoning over non-convex regions of reachable states. Turning now to  FIG. 9 , there is shown a schematic which is useful to illustrate certain aspects of the analysis according to the present disclosure. 
         [0100]    Notably, sub-figure (a) shows an actual reachable state space as a solid shade. Note that the reachable state space excludes a particular inner unshaded region (maybe an ε-ball around 0 to avoid division-by-zero, for example). 
         [0101]    Sub-figure (b) shows an over-approximation of reachable state space as computed by the interval domain (depicted as region in box). Note that the inner region (hole) is within the box and therefore treated as reachable. 
         [0102]    Sub-figure (c) shows a more precise over-approximation (that is, the over-approximation is tighter), using the polyhedral domain (depicted within polyhedria). However, even here, the inner region (hole) is regarded as reachable. 
         [0103]    Sub-figure (d) highlights one particular incarnation of donut domains according to an aspect of the present disclosure. In particular, it shows an example where both D 1  and D 2  are the interval domain. Notably, we have under-approximateed the inner region (hole) of unreachable states (rectangle in center circle). This allows us to potentially prove the division by 0 as safe, as long as the under-approximation includes 0. Similar to the degree of precision allowed in defining an over-approximation using different domains, we can also trade-off precision of the under-approximation by choosing various domains for the inner region of ‘unreachable states. 
         [0104]    In summary, our method over-approximates reachable states, and under approximates unreachable states. Advantageously, we have defined and described a generic donut domain template that can be instantiated appropriately with various domains. 
         [0105]      FIG. 10  is a schematic block diagram illustrating an exemplary computer system that when so programmed may execute instructions for performing methods according to aspects of the present disclosure. 
       Conclusions and Future Work 
       [0106]    The donut domains can be viewed as an effort to make some Boolean structure in the underlying concrete space visible at the level of abstract domains as a “set-minus” operator. This allows optimization of the related abstract operators (such as meet and join) to take full advantage of its semantics in terms of excluded states. While powerset domains allow handling non-convex sets, this comes at significant cost. In practice, the full expressiveness may not be needed. We exploit the set-minus operator, which is quite versatile in capturing many problems of interest—division by zero, instability regions in numeric computations, sets excluded by contracts in a modular setting, etc. In the future, we wish to expand the experiments performed using donut domains. Furthermore, other non-convexity issues may be addressed by trying to combine the work on LDDs with insights gained here to allow handling many holes in an efficient manner. Accordingly, the disclosure should be viewed as limited only by the scope of the claims that follow.