Type soundness proofs with definitional interpreters

While type soundness proofs are taught in every graduate PL class, the gap between realistic languages and what is accessible to formal proofs is large. In the case of Scala, it has been shown that its formal model, the Dependent Object Types (DOT) calculus, cannot simultaneously support key metatheoretic properties such as environment narrowing and subtyping transitivity, which are usually required for a type soundness proof. Moreover, Scala and many other realistic languages lack a general substitution property. The first contribution of this paper is to demonstrate how type soundness proofs for advanced, polymorphic, type systems can be carried out with an operational semantics based on high-level, definitional interpreters, implemented in Coq. We present the first mechanized soundness proofs in this style for System F and several extensions, including mutable references. Our proofs use only straightforward induction, which is significant, as the combination of big-step semantics, mutable references, and polymorphism is commonly believed to require coinductive proof techniques. The second main contribution of this paper is to show how DOT-like calculi emerge from straightforward generalizations of the operational aspects of F, exposing a rich design space of calculi with path-dependent types inbetween System F and DOT, which we dub the System D Square. By working directly on the target language, definitional interpreters can focus the design space and expose the invariants that actually matter at runtime. Looking at such runtime invariants is an exciting new avenue for type system design.

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

[2]  Gordon D. Plotkin,et al.  A structural approach to operational semantics , 2004, J. Log. Algebraic Methods Program..

[3]  Olivier Danvy,et al.  On inter-deriving small-step and big-step semantics: A case study for storeless call-by-need evaluation , 2012, Theor. Comput. Sci..

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

[5]  Mira Mezini,et al.  Dependent classes , 2007, OOPSLA.

[6]  Andrew W. Appel,et al.  An indexed model of recursive types for foundational proof-carrying code , 2001, TOPL.

[7]  Norman Ramsey,et al.  Engineering definitional interpreters , 2013, PPDP.

[8]  Benjamin C. Pierce,et al.  Mechanized Metatheory for the Masses: The PoplMark Challenge , 2005, TPHOLs.

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

[10]  Nada Amin,et al.  Type soundness for dependent object types (DOT) , 2016, OOPSLA.

[11]  Dana S. Scott,et al.  Some Domain Theory and Denotational Semantics in Coq , 2009, TPHOLs.

[12]  Samson Abramsky,et al.  Handbook of logic in computer science. , 1992 .

[13]  Claudio V. Russo,et al.  F-ing modules , 2010, TLDI '10.

[14]  Olivier Danvy,et al.  A functional correspondence between evaluators and abstract machines , 2003, PPDP '03.

[15]  Martin Steffen,et al.  Polarized higher-order subtyping , 1998 .

[16]  Martin Odersky,et al.  A Nominal Theory of Objects with Dependent Types , 2003, ECOOP.

[17]  Philip Wadler,et al.  Propositions as types , 2015, Commun. ACM.

[18]  Andrew C. Myers,et al.  Scalable extensibility via nested inheritance , 2004, OOPSLA.

[19]  Martin Odersky,et al.  Safe type-level abstraction in Scala , 2008 .

[20]  John C. Reynolds Definitional Interpreters for Higher-Order Programming Languages , 1998, High. Order Symb. Comput..

[21]  Martin Odersky,et al.  A Core Calculus for Scala Type Checking , 2006, MFCS.

[22]  Ramana Kumar,et al.  Functional Big-Step Semantics , 2016, ESOP.

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

[24]  David B. MacQueen Using dependent types to express modular structure , 1986, POPL '86.

[25]  Nicholas Robert Cameron,et al.  Tribal ownership , 2010, OOPSLA.

[26]  Xavier Leroy,et al.  Manifest types, modules, and separate compilation , 1994, POPL '94.

[27]  Erik Ernst,et al.  Family Polymorphism , 2001, ECOOP.

[28]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[29]  Olivier Danvy,et al.  Inter-deriving semantic artifacts for object-oriented programming , 2008, J. Comput. Syst. Sci..

[30]  Xavier Leroy,et al.  Coinductive big-step operational semantics , 2006, Inf. Comput..

[31]  Carl A. Gunter,et al.  The machine-assisted proof of programming language properties , 1996 .

[32]  William R. Cook,et al.  A virtual class calculus , 2006, POPL '06.

[33]  Amal Ahmed,et al.  Semantics of types for mutable state , 2004 .

[34]  Andreas Rossberg 1ML – core and modules united (F-ing first-class modules) , 2015, ICFP.

[35]  Nada Amin,et al.  Dependent Object Types , 2016 .

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

[37]  Nada Amin Type Soundness for Dependent Object Types ( DOT ) Tiark Rompf , 2016 .

[38]  Andreas Abel Polarised subtyping for sized types , 2008, Math. Struct. Comput. Sci..

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

[40]  Carl A. Gunter A Proof-Theoretic Assessment of Runtime Type Errors , 1993 .

[41]  Eelco Visser,et al.  A Theory of Name Resolution , 2015, ESOP.

[42]  Karl Crary,et al.  Towards a mechanized metatheory of standard ML , 2007, POPL '07.

[43]  Matthew Flatt Binding as sets of scopes , 2016, POPL.

[44]  Mark Lillibridge,et al.  A type-theoretic approach to higher-order modules with sharing , 1994, POPL '94.

[45]  Martin Odersky,et al.  Foundations of path-dependent types , 2014, OOPSLA.

[46]  Martin Odersky,et al.  The Essence of Dependent Object Types , 2016, A List of Successes That Can Change the World.

[47]  Nils Anders Danielsson Operational semantics using the partiality monad , 2012, ICFP '12.

[48]  Arthur Charguéraud,et al.  The Locally Nameless Representation , 2012, Journal of Automated Reasoning.

[49]  Philip Wadler,et al.  The essence of functional programming , 1992, POPL '92.

[50]  Erik Ernst,et al.  Higher-Order Hierarchies , 2003, ECOOP.

[51]  Sophia Drossopoulou,et al.  Tribe: a simple virtual class calculus , 2007, AOSD.

[52]  Derek Dreyer,et al.  Mixin’ Up the ML Module System , 2013, TOPL.

[53]  Gordon D. Plotkin,et al.  The origins of structural operational semantics , 2004, J. Log. Algebraic Methods Program..

[54]  Robert Harper,et al.  A Simplified Account of Polymorphic References , 1994, Inf. Process. Lett..

[55]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[56]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.