Inference of User-Defined Type Qualifiers and Qualifier Rules

  • Brian Chin
  • Shane Markstrum
  • Todd Millstein
  • Jens Palsberg
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3924)


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.


Partial Order Rule Inference Decision Procedure Proof Obligation Type Inference 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Ball, T., Majumdar, R., Millstein, T., Rajamani, S.K.: Automatic predicate abstraction of C programs. In: Proceedings of the ACMSIGPLAN 2001 conference on Programming language design and implementation, pp. 203–213. ACM Press, New York (2001)CrossRefGoogle Scholar
  2. 2.
    Chin, B., Markstrum, S., Millstein, T.: Semantic type qualifiers. In: PLDI 2005: Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 85–95. ACM Press, New York (2005)CrossRefGoogle Scholar
  3. 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. 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. 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. 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
  7. 7.
    Foster, J.S., Terauchi, T., Aiken, A.: Flow-sensitive type qualifiers. In: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pp. 1–12. ACM Press, New York (2002)CrossRefGoogle Scholar
  8. 8.
    Freeman, T., Pfenning, F.: Refinement types for ML. In: PLDI 1991: Proceedings of the ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation, pp. 268–277. ACM Press, New York (1991)CrossRefGoogle Scholar
  9. 9.
    Graf, S., Saïdi, H.: Construction of abstract state graphs with PVS. In: Grumberg, O. (ed.) CAV 1997. LNCS, vol. 1254, pp. 72–83. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  10. 10.
    Mandelbaum, Y., Walker, D., Harper, R.: An effective theory of type refinements. In: Proceedings of the eighth ACMSIGPLAN international conference on Functional programming, pp. 213–225. ACM Press, New York (2003)CrossRefGoogle Scholar
  11. 11.
    Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theor. Pract. Object Syst. 5(1), 35–55 (1999)CrossRefGoogle Scholar
  12. 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. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Brian Chin
    • 1
  • Shane Markstrum
    • 1
  • Todd Millstein
    • 1
  • Jens Palsberg
    • 1
  1. 1.University of CaliforniaLos Angeles

Personalised recommendations