 
Summary: Program Analysis Using Mixed Term and Set Constraints
Manuel F¨ahndrich ? and Alexander Aiken ?
EECS Department
University of California, Berkeley ??
Abstract. There is a tension in program analysis between precision and efficiency. In constraintbased
program analysis, at one extreme methods based on unification of equality constraints over terms are
very fast but often imprecise. At the other extreme, methods based on the resolution of inclusion
constraints over set expressions are quite precise, but are often inefficient in practice. We describe
a parameterized framework for constraintbased program analyses that allows the analysis designer
to embed terms and set expressions within each other. Constraints over these mixed expressions are
partially between equality and inclusion, which enables an entire spectrum of program analyses with
varying degrees of precision and efficiency to be expressed. We also show that there are interesting
analyses that take advantage of this mixture. In particular, we report on the design and implementation
of an uncaught exception analysis for core ML. Our results show that the analysis approaches the
efficiency of algorithm W.
1 Introduction
The HindleyMilner polymorphic type inference system [Mil78] is the classical example of a constraintbased
program analysis. It uses equality constraints over a term algebra to infer types for functional programming
languages such as ML [MTH90]. This system has inspired many other analyses based on equality constraints
(e.g. [Hen92, Ste96]). Such systems are appealing because they yield concise results and because the equality
