Refined typechecking with Stardust

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 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.

[1]  Frank Pfenning,et al.  Type Assignment for Intersections and Unions in Call-by-Value Languages , 2003, FoSSaCS.

[2]  Daan Leijen,et al.  Domain specific embedded compilers , 1999, DSL '99.

[3]  David Walker,et al.  An effective theory of type refinements , 2003, ACM SIGPLAN Notices.

[4]  Jeffrey S. Foster,et al.  Type qualifiers: lightweight specifications to improve software quality , 2002 .

[5]  Chiyan Chen,et al.  Combining programming with theorem proving , 2005, ICFP '05.

[6]  Roberto M. Amadio,et al.  Domains and Lambda-Calculi (Cambridge Tracts in Theoretical Computer Science) , 2008 .

[7]  STEFAN KAHRS Red-black trees with types , 2001, J. Funct. Program..

[8]  Gang Chen,et al.  Guarded recursive datatype constructors , 2003, POPL '03.

[9]  Natarajan Shankar,et al.  The ICS Decision Procedures for Embedded Deduction , 2004, IJCAR.

[10]  Daniel R. Licata,et al.  A Formulation of Dependent ML with Explicit Equality Proofs , 2005 .

[11]  John C. Reynolds,et al.  Design of the programming language FORSYTHE , 1997 .

[12]  Tim Sheard,et al.  WHAT IS A PROOF , 2005 .

[13]  Roberto M. Amadio,et al.  Domains and lambda-calculi , 1998, Cambridge tracts in theoretical computer science.

[14]  K. Rustan M. Leino,et al.  Extended Static Checking: A Ten-Year Perspective , 2001, Informatics.

[15]  David L. Dill,et al.  CVC: A Cooperating Validity Checker , 2002, CAV.

[16]  Andrew John Kennedy,et al.  Programming languages and dimensions , 1995 .

[17]  Hongwei Xi,et al.  Applied Type System: Extended Abstract , 2003, TYPES.

[18]  David L. Dill,et al.  Validity Checking for Combinations of Theories with Equality , 1996, FMCAD.

[19]  Frank Pfenning,et al.  Practical refinement-type checking , 2005 .

[20]  Frank Pfenning,et al.  Dependent types in practical programming , 1999, POPL '99.

[21]  Frank Pfenning,et al.  Intersection types and computational effects , 2000, ICFP '00.

[22]  Simon L. Peyton Jones,et al.  Calling hell from heaven and heaven from hell , 1999, ICFP '99.

[23]  Jens Palsberg,et al.  From polyvariant flow information to intersection and union types , 1998, POPL '98.

[24]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[25]  Mariangiola Dezani-Ciancaglini,et al.  Functional Characters of Solvable Terms , 1981, Math. Log. Q..

[26]  Joshua Dunfield,et al.  A unified system of type refinements , 2007 .

[27]  B. Pierce Programming with intersection types, union types, and polymorphism , 1991 .

[28]  Benjamin C. Pierce,et al.  Local type inference , 1998, POPL '98.

[29]  James Cheney,et al.  First-Class Phantom Types , 2003 .

[30]  VytiniotisDimitrios,et al.  Simple unification-based type inference for GADTs , 2006 .

[31]  W. V. Quine,et al.  Natural deduction , 2021, An Introduction to Proof Theory.

[32]  Andrew P. Tolmach,et al.  From ML to Ada: Strongly-typed language interoperability via source translation , 1998, Journal of Functional Programming.

[33]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[34]  Sergey Berezin,et al.  CVC Lite: A New Implementation of the Cooperating Validity Checker Category B , 2004, CAV.

[35]  P. Medawar A view from the left , 1984, Nature.

[36]  Lennart Augustsson,et al.  Cayenne—a language with dependent types , 1998, ICFP '98.

[37]  Benjamin C. Pierce,et al.  Local type inference , 2000, TOPL.

[38]  Frank Pfenning,et al.  Tridirectional typechecking , 2004, POPL.

[39]  Matthias Blume No-Longer-Foreign: Teaching an ML compiler to speak C "natively" , 2001, Electron. Notes Theor. Comput. Sci..

[40]  Robin Milner,et al.  Definition of standard ML , 1990 .

[41]  Assaf J. Kfoury,et al.  Inferring Intersection Typings that are Equivalent to Call-by-Name and Call-by-Value Evaluations , 2005 .

[42]  Riccardo Pucella,et al.  Phantom types and subtyping , 2002, Journal of Functional Programming.

[43]  Frank Pfenning,et al.  Refinement types for ML , 1991, PLDI '91.

[44]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[45]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.