Set Constraints in Program Analysis

domains employed in abstract interpretation are typically required to satisfy the finite ascending chains condition (or some analogous condition) and this represents a fundamental restriction on the accuracy of domains that can be employed. lines can be routinely analyzed in a few seconds. The main reason for the substantial difference between the results from the two implementations seems to hinge on the fact that intersection is not used in the constraints generated from ML programs. Based on this observation, we are currently investigating ways of constructing constraints for logic programs that provide similar levels of accuracy, but either eliminate or substantially reduce the use of intersection. We also observe that the results from the second implementation appear to out-perform current implementations of comparable abstract interpretation based analyses. We conjecture three possible reasons for this. First, the set constraint approach passes over the program text only once and essentially “pre-compiles” it into a convenient form for computation. In contrast, many abstract interpretation approaches work from the original program text, and so when recomputation of a program fragment is required in a fixed-point computation, the analysis makes a repeated passes over the program fragment. Clearly the technique of pre-compiling a program into a convenient equational/constraint form is equally applicable to abstract interpretation approaches. It appears likely that explicit manipulation of equations/constraints will be more widely used in all areas of program analysis. The second reason is simply that all of aspects of approximation have been performed in the translation of the program into set constraints (and typically, this is a simple, linear-time process). In particular, the set constraint simplification algorithm does not have to perform any approximation operations. In contrast, the iterative fixed-point algorithm of abstract interpretation has to repeatedly perform approximation (abstraction) operations on the fly. The third reason for better performance is based on the observation that set constraint approaches are inherently more incremental than abstract interpretation approaches. We illustrate two aspects of this with examples. First view both the interative fixed-point computation of abstract interpretation and the set constraint solving algorithm as involving the exhaustive propagation of information. Now, suppose the current “information” for X indicates that X is any even length list, and consider updating X with new information that says X may be any odd length list. In the set constraint algorithm, we only propagate the new fragment of information (that X may now be an odd length list) to see if it changes anything depending on X. In contrast5, an abstract interpretation approach updates the information for X to “X is now an arbitrary list”, and then proceeds to fully recompute everything that depends on X. In other words, with set constraints, only new information is propagated. Whereas, in abstract interpretation, it is typically the case that the new information is “lubbed” with the old information, and the result (which is a combination of new information and old information) is then propagated. As another example of the incrementality of the set constraint algorithm, suppose that a collection of constraints contains the constraint Y cons(1;X ) amongst others. Now, in an abstract interpretation approach, Y will be recomputed whenever X changes. In contrast, in the set constraint algorithm, this constraint will not cause Y to be recomputed whenever X changes. To continue the example, suppose that in addition to Y cons(1;X ), the constraints also contain Z cons 1 (2)(Y). Now, in abstract interpretation, any change to X will cause Y to be recomputed and this may then result in a recomputation of Z. Using set constraints, a new constraint Z X will constructed by the set constraint simplification algorithm, and so changes to X will have a Strictly speaking, it is possible to construct an abstract interpretation that behaves like the set constraint approach in this regard. What is required is an abstract domain such that each abstract value can be considered to be the finite union of some collection of abstract values whose concretizations are disjoint. For a variety of reasons, abstract domains are rarely constructed to satisfy this property. direct influence on Z (in effect, Y is removed from the chain of recomputations that are triggered when X is changed). To summarize, the set constraint algorithm computes with implicit or partial descriptions of information.