Inference of User-Defined Type Qualifiers and Qualifier Rules
In previous work, we described a new approach to supporting user-defined type qualifiers, which augment existing types to specify and check additional properties of interest. For each qualifier, users define a set of rules that are enforced during static typechecking of programs. Separately, these rules are automatically validated with respect to a user-defined predicate that formalizes the qualifier’s intended run-time invariant. We instantiated this approach as a framework for user-defined type qualifiers in C programs, called Clarity.
In this paper, we extend our earlier approach by resolving two usability issues. First, we show how to perform qualifier inference in the presence of user-defined rules by generating and solving a system of conditional set constraints, thereby relieving users of the burden of explicitly annotating programs. Second, we show how to automatically infer rules that respect a given user-defined invariant, thereby relieving qualifier designers of the burden of manually producing such rules. We have formalized both qualifier and rule inference and proven their correctness. We have also extended Clarity to support qualifier and rule inference, and we illustrate their utility in practice through experiments with several type qualifiers and open-source C programs.
KeywordsPartial Order Rule Inference Decision Procedure Proof Obligation Type Inference
- 3.Chin, B., Markstrum, S., Millstein, T., Palsberg, J.: Inference of user-defined type qualifiers and qualifier rules. Technical Report CSD-TR-050041, UCLA Computer Science Department (October 2005)Google Scholar
- 4.Davies, R., Pfenning, F.: Intersection types and computational effects. In: ICFP 2000: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pp. 198–208. ACM Press, New York (2000)Google Scholar
- 5.Detlefs, D., Nelson, G., Saxe, J.B.: Simplify: A theorem prover for program checking. Technical Report HPL-2003-148, HP Labs (2003)Google Scholar
- 6.Foster, J.S., Fähndrich, M., Aiken, A.: A Theory of Type Qualifiers. In: Proceedings of the 1999 ACM SIGPLAN Conference on Programming Language Design and Implementation, Atlanta, Georgia, pp. 192–203 (May 1999)Google Scholar
- 12.Reps, T.W., Sagiv, S., Yorsh, G.: Symbolic implementation of the best transformer. In: 5th International Conference on Verification, Model Checking, and Abstract Interpretation, pp. 252–266 (2004)Google Scholar
- 13.Yorsh, G., Reps, T.W., Sagiv, S.: Symbolically computing most-precise abstract operations for shape analysis. In: 10th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, pp. 530–545 (2004)Google Scholar