Manifest contracts

Eiffel popularized design by contract, a software design philosophy where programmers specify the requirements and guarantees of functions via executable pre- and post-conditions written in code. Findler and Felleisen brought contracts to higher-order programming, inspiring the PLT Racket implementation of contracts. Existing approaches for runtime checking lack reasoning principles and stop short of their full potential—most Racket contracts check only simple types. Moreover, the standard algorithm for higher-order contract checking can lead to unbounded space consumption and can destroy tail recursion. In this dissertation, I develop so-called manifest contract systems which integrate more coherently in the type system, and relate them to Findler-and-Felleisen-style latent contracts. I extend a manifest system with type abstraction and relational parametricity, and also show how to integrate dynamic types and contracts in a space efficient way, i.e., in a way that doesn't destroy tail recursion. I put manifest contracts on a firm type-theoretic footing, showing that they support extensions necessary for real programming. Developing these principles is the first step in designing and implementing higher-order languages with contracts and refinement types.

[1]  Andrew D. Gordon,et al.  Semantic subtyping with an SMT solver , 2010, ICFP '10.

[2]  Benjamin C. Pierce,et al.  Relating Cryptography and Polymorphism , 2000 .

[3]  Juan Chen,et al.  Fully abstract compilation to JavaScript , 2013, POPL.

[4]  David Aspinall,et al.  Subtyping dependent types , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[5]  Robert Bruce Findler,et al.  Relationally-parametric polymorphic contracts , 2007, DLS '07.

[6]  Juan Chen,et al.  Verifying higher-order programs with the dijkstra monad , 2013, PLDI.

[7]  Matthias Felleisen,et al.  Contracts for higher-order functions , 2002, ICFP '02.

[8]  Jeremy G. Siek,et al.  Threesomes, with and without blame , 2009, STOP@ECOOP.

[9]  Cormac Flanagan,et al.  Space-efficient gradual typing , 2010, High. Order Symb. Comput..

[10]  Tom Ridge,et al.  Ott: effective tool support for the working semanticist , 2007, ICFP '07.

[11]  Avraham Shinnar,et al.  Safe and effective contracts , 2011 .

[12]  Ralf Hinze,et al.  Typed Contracts for Functional Programming , 2006, FLOPS.

[13]  Cormac Flanagan,et al.  Temporal higher-order contracts , 2011, ICFP.

[14]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[15]  Cormac Flanagan,et al.  Hybrid type checking , 2006, POPL '06.

[16]  Stephen N. Freund,et al.  Sage: Hybrid Checking for Flexible Specifications , 2006 .

[17]  Amal Ahmed,et al.  Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types , 2006, ESOP.

[18]  Olaf Chitil,et al.  Monadic, Prompt Lazy Assertions in Haskell , 2007, APLAS.

[19]  Didier Rémy,et al.  On the power of coercion abstraction , 2012, POPL '12.

[20]  Gavin M. Bierman,et al.  A theory of typed coercions and its applications , 2009, ICFP.

[21]  Benjamin C. Pierce,et al.  Boomerang: resourceful lenses for string data , 2008, POPL '08.

[22]  David Walker,et al.  Dynamic Typing with Dependent Types , 2004, IFIP TCS.

[23]  Amal Ahmed,et al.  Parametric Polymorphism through Run-Time Sealing or, Theorems for Low, Low Prices! , 2008, ESOP.

[24]  Walid Taha,et al.  Exploring the Design Space of Higher-Order Casts , 2009, ESOP.

[25]  Michael Greenberg,et al.  Space-Efficient Manifest Contracts , 2014, POPL.

[26]  Giuseppe Castagna,et al.  CDuce: an XML-centric general-purpose language , 2003, ICFP '03.

[27]  Satish R. Thatte Quasi-static typing , 1989, POPL '90.

[28]  Na Xu Static contract checking for Haskell , 2009, POPL '09.

[29]  Robert Bruce Findler,et al.  Contracts as Pairs of Projections , 2006, FLOPS.

[30]  Ravi Chugh,et al.  Nested refinements: a logic for duck typing , 2012, POPL '12.

[31]  Anne Rogers,et al.  Lazy Contract Checking for Immutable Data Structures , 2008, IFL.

[32]  Yasuhiko Minamide Runtime Behavior of Conversion Interpretation of Subtyping , 2001, IFL.

[33]  Jeremy G. Siek,et al.  Interpretations of the gradually-typed lambda calculus , 2012, Scheme '12.

[34]  Philip Wadler,et al.  Blame for all , 2011, POPL '11.

[35]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[36]  Ronald Garcia,et al.  Calculating threesomes, with blame , 2013, ICFP.

[37]  Cormac Flanagan,et al.  Unifying Hybrid Types and Contracts , 2007, Trends in Functional Programming.

[38]  Benjamin C. Pierce,et al.  All Your IFCException Are Belong to Us , 2013, 2013 IEEE Symposium on Security and Privacy.

[39]  C. Flanagan,et al.  Gradual Information Flow Typing , 2011 .

[40]  Ravi Chugh,et al.  Dependent types for JavaScript , 2012, OOPSLA '12.

[41]  Fritz Henglein,et al.  Dynamic Typing: Syntax and Proof Theory , 1994, Sci. Comput. Program..

[42]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[43]  Matthias Felleisen,et al.  Correct blame for contracts: no more scapegoating , 2011, POPL '11.

[44]  Stephanie Weirich,et al.  LNgen: Tool Support for Locally Nameless Representations , 2010 .

[45]  Ranjit Jhala,et al.  Low-level liquid types , 2010, POPL '10.

[46]  Atsushi Igarashi,et al.  Polymorphic Contracts , 2011, ESOP.

[47]  Akinori Yonezawa,et al.  Regular Expression Types for Strings in a Text Processing Language , 2002, Electron. Notes Theor. Comput. Sci..

[48]  Thierry Coquand,et al.  Inheritance as Implicit Coercion , 1991, Inf. Comput..

[49]  Philip Wadler,et al.  Well-Typed Programs Can't Be Blamed , 2009, ESOP.

[50]  Jeremy G. Siek Gradual Typing for Functional Languages , 2006 .

[51]  Benjamin C. Pierce,et al.  Contracts made manifest , 2012, J. Funct. Program..

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

[53]  Georg Neis,et al.  Non-parametric parametricity , 2011, J. Funct. Program..

[54]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[55]  Zhong Shao Flexible representation analysis , 1997, ICFP '97.

[56]  Sam Tobin-Hochstadt,et al.  The design and implementation of typed scheme , 2008, POPL '08.

[57]  David A. McAllester,et al.  Sound and complete models of contracts , 2006, Journal of Functional Programming.

[58]  Sam Tobin-Hochstadt,et al.  Higher-order symbolic execution via contracts , 2012, OOPSLA '12.

[59]  Éric Tanter,et al.  Cast insertion strategies for gradually-typed objects , 2013, DLS '13.