Refinement types for ML

Abstract : Programming computers is a notoriously error-prone process. It is the job of the programming language designer to make this process more reliable. One approach to this is to impose some sort of typing discipline on the programs. In doing this, the programming language designer is immediately faced with a tradeoff: if the type system is too simple, it cannot accurately express important properties of the program; if it is too expressive, then mechanically checking or inferring the types becomes impractical. This thesis describes a type system called refinement types, which is an example of a new way to make this tradeoff, as well as a potentially useful system in itself. Refinement type inference requires programs to have types in two type systems: an expressive type inference system (intersection types with subtyping) and a relatively simple type system (basic polymorphic type inference). Refinement type inference inherits some properties from each of these: as in intersection types with subtyping, we can use the type system to do abstract interpretation; as in basic polymorphic type inference, refinement type inference is decidable (preliminary experiments suggest refinement type inference may be practical as well). We have implemented refinement type inference for a subset of Standard ML to test these ideas. We have added new syntax, called rectype declarations, to allow the programmer to specify relevant domains for the abstract interpretation.

[1]  Frank Pfenning,et al.  Types in Logic Programming , 1992, ICLP.

[2]  Benjamin C. Pierce,et al.  A record calculus based on symmetric concatenation , 1991, POPL '91.

[3]  Prateek Mishra,et al.  Type Inference with Subtypes , 1990, Theor. Comput. Sci..

[4]  Edmund M. Clarke,et al.  Symbolic Model Checking: 10^20 States and Beyond , 1990, Inf. Comput..

[5]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[6]  Luca Cardelli,et al.  Subtyping recursive types , 1993 .

[7]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

[8]  John C. Mitchell,et al.  ML with extended pattern matching and subtypes , 1988, LISP and Functional Programming.

[9]  Furio Honsell,et al.  A framework for defining logics , 1993, JACM.

[10]  Didier Rémy,et al.  Type checking records and variants in a natural extension of ML , 1989, POPL '89.

[11]  Benjamin C. Pierce,et al.  A decision procedure for the subtype relation on intersection types with bounded variables , 1989 .

[12]  Frank Pfenning,et al.  Higher-order abstract syntax , 1988, PLDI '88.

[13]  Alan J. Dix,et al.  Finding fixed points in non-trivial domains: Proofs of pending analysis and related algorithms , 1988 .

[14]  Robin Milner,et al.  Co-Induction in Relational Semantics , 1991, Theor. Comput. Sci..

[15]  Jonathan Hood Young,et al.  The theory and practice of semantic program analysis for higher-order functional programming languages , 1989 .

[16]  Prateek Mishra,et al.  Polymorphic Subtype Inference: Closing the Theory-Practice Gap , 1989, TAPSOFT, Vol.2.

[17]  Joyce L. Vedral,et al.  Functional Programming Languages and Computer Architecture , 1989, Lecture Notes in Computer Science.

[18]  Neil D. Jones,et al.  Data flow analysis of applicative programs using minimal function graphs , 1986, POPL '86.

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

[20]  John C. Mitchell,et al.  F-bounded polymorphism for object-oriented programming , 1989, FPCA.

[21]  David B. MacQueen An implementation of standard ML modules , 1988, LISP and Functional Programming.

[22]  Prateek Mishra,et al.  Towards a Theory of Types in Prolog , 1984, SLP.

[23]  Simona Ronchi Della Rocca,et al.  Principal Type Scheme and Unification for Intersection Type Discipline , 1988, Theor. Comput. Sci..

[24]  Paola Giannini,et al.  A Complete Type Inference Algorithm for Simple Intersection Types , 1992, CAAP.

[25]  Thom W. Frühwirth,et al.  Polymorphically Typed Logic Programs , 1991, ICLP.

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

[27]  John S. Baras Systems Research Center. , 1985 .

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

[29]  Justin Zobel,et al.  A Regular Type Language for Logic Programs , 1992, Types in Logic Programming.

[30]  Alan Mycroft,et al.  Polymorphic Type Schemes and Recursive Definitions , 1984, Symposium on Programming.

[31]  Xavier Leroy,et al.  Polymorphic type inference and assignment , 1991, POPL '91.

[32]  Benjamin C. Pierce,et al.  Preliminary Investigation of a Calculus with Intersection and Union Types , 1990 .

[33]  Luca Cardelli,et al.  Typeful Programming , 1989, Formal Description of Programming Concepts.

[34]  Randal E. Bryant,et al.  Graph-Based Algorithms for Boolean Function Manipulation , 1986, IEEE Transactions on Computers.

[35]  Joxan Jaffar,et al.  A decision procedure for a class of set constraints , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[36]  Gopalan Nadathur,et al.  Uniform Proofs as a Foundation for Logic Programming , 1991, Ann. Pure Appl. Log..

[37]  Robin Milner,et al.  Commentary on standard ML , 1990 .

[38]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[39]  Dominique Clément,et al.  A simple applicative language: mini-ML , 1986, LFP '86.

[40]  N. Jagger An inductive approach to finding fixpoints in abstract interpretation , 1989, Fourth IEEE Region 10 International Conference TENCON.

[41]  Mitchell Wand Finding the source of type errors , 1986, POPL '86.

[42]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[43]  Alfred V. Aho,et al.  The Design and Analysis of Computer Algorithms , 1974 .

[44]  Luca Cardelli,et al.  Basic Polymorphic Typechecking , 1987, Sci. Comput. Program..

[45]  Frank Pfenning,et al.  Natural Semantics and Some of Its Meta-Theory in Elf , 1992, ELP.

[46]  WegnerPeter,et al.  On understanding types, data abstraction, and polymorphism , 1985 .

[47]  A. Church,et al.  Some properties of conversion , 1936 .

[48]  B. Pierce Programming with intersection types and bounded polymorphism , 1992 .

[49]  John C. Reynolds,et al.  Preliminary design of the programming language Forsythe , 1988 .