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.
[1]
Shane Markstrum,et al.
Semantic type qualifiers
,
2005,
PLDI '05.
[2]
David Detlefs,et al.
Simplify: a theorem prover for program checking
,
2005,
JACM.
[3]
Frank Pfenning,et al.
Intersection types and computational effects
,
2000,
ICFP '00.
[4]
Alexander Aiken,et al.
A theory of type qualifiers
,
1999,
PLDI '99.
[5]
Thomas W. Reps,et al.
Symbolically Computing Most-Precise Abstract Operations for Shape Analysis
,
2004,
TACAS.
[6]
Alexander Aiken,et al.
Flow-sensitive type qualifiers
,
2002,
PLDI '02.
[7]
Martin Odersky,et al.
Type Inference with Constrained Types
,
1999,
Theory Pract. Object Syst..
[8]
Thomas W. Reps,et al.
Symbolic Implementation of the Best Transformer
,
2004,
VMCAI.
[9]
David Walker,et al.
An effective theory of type refinements
,
2003,
ACM SIGPLAN Notices.
[10]
Hassen Saïdi,et al.
Construction of Abstract State Graphs with PVS
,
1997,
CAV.
[11]
Frank Pfenning,et al.
Refinement types for ML
,
1991,
PLDI '91.