Refined typechecking with Stardust

Jana Dunfield
2007 Proceedings of the 2007 workshop on Programming languages meets program verification - PLPV '07  
We present Stardust, an implementation of a type system for a subset of ML with type refinements, intersection types, and union types, enabling programmers to legibly specify certain classes of program invariants that are verified at compile time. This is the first implementation of unrestricted intersection and union types in a mainstream functional programming setting, as well as the first implementation of a system with both datasort and index refinements. The system-with the assistance of
more » ... the assistance of external constraint solvers-supports integer, Boolean and dimensional index refinements; we apply both value refinements (to check red-black tree invariants) and invaluable refinements (to check dimensional consistency). While typechecking with intersection and union types is intrinsically complex, our experience so far suggests that it can be practical in many instances. • datasort refinements (also called refinement types) (Davies and Pfenning 2000; Davies 2005) and index refinements (so-called limited dependent types) (Xi and Pfenning 1999; Xi 1998) for atomic properties of data structures; • intersection types and union types that combine properties by conjunction and disjunction, respectively (Davies and Pfenning 2000; Dunfield and Pfenning 2004). The StardustML language Syntactically, StardustML is a subset of core (module-free) Standard ML (Milner et al. 1997) . A StardustML program consists sort ::= id |´sort µ | sort ( ¶ sort) * | ß id sort proposition proposition ::= index-exp | proposition and proposition index-exp ::= id | index-exp (+ | − | · · · ) index-exp | index-aexp index-aexp ::= integer-literal´index-exp µ | integer-literal |´index-exp (¸index-exp) * µ texp : Figure 1. Concrete syntax of index sorts, propositions, index expressions, and types in StardustML of SML datatype declarations followed by a sequence of blocks.
doi:10.1145/1292597.1292602 dblp:conf/plpv/Dunfield07 fatcat:2yyj7xgczzeqpm2uissj47lhcu