Abstract
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.
- A. Abel. Polarised subtyping for sized types. Mathematical Structures in Computer Science, 18:797–822, 10 2008.Google Scholar
Cross Ref
- M. S. Ager, D. Biernacki, O. Danvy, and J. Midtgaard. A functional correspondence between evaluators and abstract machines. In PPDP, 2003. Google Scholar
Digital Library
- A. J. Ahmed. Semantics of types for mutable state. PhD thesis, Princeton University, 2004. Google Scholar
Digital Library
- A. J. Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In ESOP, 2006. Google Scholar
Digital Library
- N. Amin, S. Grütter, M. Odersky, T. Rompf, and S. Stucki. The essence of dependent object types. In WadlerFest, A List of Successes That Can Change the World: Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday, 2016.Google Scholar
Cross Ref
- N. Amin, A. Moors, and M. Odersky. Dependent object types. In FOOL, 2012.Google Scholar
- N. Amin, T. Rompf, and M. Odersky. Foundations of path-dependent types. In OOPSLA, 2014. Google Scholar
Digital Library
- A. W. Appel and D. A. McAllester. An indexed model of recursive types for foundational proof-carrying code. ACM Trans. Program. Lang. Syst., 23(5):657–683, 2001. Google Scholar
Digital Library
- D. Aspinall and A. Compagnoni. Subtyping dependent types. Theoretical Computer Science, 266(1):273–309, 2001. Google Scholar
Digital Library
- B. E. Aydemir, A. Bohannon, M. Fairbairn, J. N. Foster, B. C. Pierce, P. Sewell, D. Vytiniotis, G. Washburn, S. Weirich, and S. Zdancewic. Mechanized metatheory for the masses: The PoplMark Challenge. In TPHOLs, 2005. Google Scholar
Digital Library
- H. P. Barendregt. Handbook of logic in computer science. chapter Lambda Calculi with Types. Oxford University Press, 1992. Google Scholar
Digital Library
- N. R. Cameron, J. Noble, and T. Wrigstad. Tribal ownership. In OOPSLA, 2010. Google Scholar
Digital Library
- L. Cardelli, S. Martini, J. C. Mitchell, and A. Scedrov. An extension of system F with subtyping. Inf. Comput., 109(1/2):4–56, 1994. Google Scholar
Digital Library
- A. Charguéraud. The locally nameless representation. J. Autom. Reasoning, 49(3):363–408, 2012.Google Scholar
Cross Ref
- D. Clarke, S. Drossopoulou, J. Noble, and T. Wrigstad. Tribe: a simple virtual class calculus. In AOSD, 2007. Google Scholar
Digital Library
- V. Cremet, F. Garillot, S. Lenglet, and M. Odersky. A core calculus for Scala type checking. In MFCS, 2006. Google Scholar
Digital Library
- N. A. Danielsson. Operational semantics using the partiality monad. In ICFP, 2012. Google Scholar
Digital Library
- O. Danvy and J. Johannsen. Inter-deriving semantic artifacts for object-oriented programming. J. Comput. Syst. Sci., 76(5):302–323, 2010. Google Scholar
Digital Library
- O. Danvy, K. Millikin, J. Munk, and I. Zerny. On inter-deriving smallstep and big-step semantics: A case study for storeless call-by-need evaluation. Theor. Comput. Sci., 435:21–42, 2012. Google Scholar
Digital Library
- D. Dreyer and A. Rossberg. Mixin’ up the ML module system. In ICFP, 2008.Google Scholar
Digital Library
- E. Ernst. Family polymorphism. In ECOOP, 2001. Google Scholar
Digital Library
- E. Ernst. Higher-order hierarchies. In ECOOP, 2003.Google Scholar
Cross Ref
- E. Ernst, K. Ostermann, and W. R. Cook. A virtual class calculus. In POPL, 2006. Google Scholar
Digital Library
- M. Flatt. Binding as sets of scopes. In POPL, 2016. Google Scholar
Digital Library
- V. Gasiunas, M. Mezini, and K. Ostermann. Dependent classes. In OOPSLA, 2007. Google Scholar
Digital Library
- C. A. Gunter and D. Rémy. A proof-theoretic assesment of runtime type errors. Technical Report Technical Memo 11261-921230-43TM, AT&T Bell Laboratories, 1993.Google Scholar
- R. Harper. A simplified account of polymorphic references. Information Processing Letters, 51(4):201 – 206, 1994. Google Scholar
Digital Library
- R. Harper. A simplified account of polymorphic references – followup. https://www.cs.cmu.edu/~rwh/papers/refs/ipl-followup.pdf, 1995.Google Scholar
- R. Harper and M. Lillibridge. A type-theoretic approach to higherorder modules with sharing. In POPL, 1994. Google Scholar
Digital Library
- G. Kahn. Natural semantics. In STACS, 1987. Google Scholar
Digital Library
- D. K. Lee, K. Crary, and R. Harper. Towards a mechanized metatheory of standard ML. In POPL, pages 173–184. ACM, 2007. Google Scholar
Digital Library
- X. Leroy. Manifest types, modules and separate compilation. In POPL, 1994. Google Scholar
Digital Library
- X. Leroy and H. Grall. Coinductive big-step operational semantics. Inf. Comput., 207(2):284–304, 2009. Google Scholar
Digital Library
- D. Macqueen. Using dependent types to express modular structure. In POPL, 1986. Google Scholar
Digital Library
- J. Midtgaard, N. Ramsey, and B. Larsen. Engineering definitional interpreters. In PPDP, 2013. Google Scholar
Digital Library
- E. Moggi. Notions of computation and monads. Inf. Comput., 93(1):55–92, 1991. Google Scholar
Digital Library
- A. Moors, F. Piessens, and M. Odersky. Safe type-level abstraction in Scala. In FOOL, 2008.Google Scholar
- P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A theory of name resolution. In ESOP, 2015.Google Scholar
Cross Ref
- N. Nystrom, S. Chong, and A. C. Myers. Scalable extensibility via nested inheritance. In OOPSLA, 2004. Google Scholar
Digital Library
- M. Odersky, V. Cremet, C. Röckl, and M. Zenger. A nominal theory of objects with dependent types. In ECOOP, 2003.Google Scholar
Cross Ref
- S. Owens, M. O. Myreen, R. Kumar, and Y. K. Tan. Functional bigstep semantics. In ESOP, 2016.Google Scholar
- B. C. Pierce. Programming with Intersection Types and Bounded Polymorphism. PhD thesis, Carnegie Mellon University, December 1991. Google Scholar
Digital Library
- G. D. Plotkin. A structural approach to operational semantics. J. Log. Algebr. Program., 60-61:17–139, 2004.Google Scholar
Cross Ref
- J. C. Reynolds. Definitional interpreters for higher-order programming languages. Higher-Order and Symbolic Computation, 11(4):363–397, 1998. Google Scholar
Digital Library
- T. Rompf and N. Amin. Type soundness for dependent object types. In OOPSLA, 2016. Google Scholar
Digital Library
- A. Rossberg. 1ML - core and modules united (f-ing first-class modules). In ICFP, 2015. Google Scholar
Digital Library
- A. Rossberg, C. V. Russo, and D. Dreyer. F-ing modules. J. Funct. Program., 24(5):529–607, 2014.Google Scholar
Cross Ref
- D. S. Scott. Domains for denotational semantics. In Automata, Languages and Programming, 1982. Google Scholar
Digital Library
- J. Siek. Type safety in three easy lemmas. http://siek.blogspot. com/2013/05/type-safety-in-three-easy-lemmas.html, 2013.Google Scholar
- M. Steffen. Polarized higher-order subtyping. PhD thesis, University of Erlangen-Nuremberg, 1997.Google Scholar
- M. Tofte. Operational Semantics and Polymorphic Type Inference. PhD thesis, 1988.Google Scholar
- M. VanInwegen. The Machine-Assisted Proof of Programming Language Properties. PhD thesis, May 1996. Google Scholar
Digital Library
- D. von Oheimb. Re: Subject reduction fails in java. http://www.seas.upenn.edu/~sweirich/types/archive/1997-98/ msg00452.html, 1998.Google Scholar
- P. Wadler. The essence of functional programming. In POPL, pages 1–14. ACM Press, 1992. Google Scholar
Digital Library
- P. Wadler. Propositions as types. Presentation at Strange Loop, 2015.Google Scholar
- A. K. Wright and M. Felleisen. A syntactic approach to type soundness. Inf. Comput., 115(1):38–94, 1994. Google Scholar
Digital Library
Index Terms
Type soundness proofs with definitional interpreters
Recommendations
Type soundness proofs with definitional interpreters
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesWhile 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) ...
Type soundness for dependent object types (DOT)
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsScala’s type system unifies aspects of ML modules, object- oriented, and functional programming. The Dependent Object Types (DOT) family of calculi has been proposed as a new theoretic foundation for Scala and similar expressive languages. ...
Intrinsically-typed definitional interpreters for imperative languages
A definitional interpreter defines the semantics of an object language in terms of the (well-known) semantics of a host language, enabling understanding and validation of the semantics through execution. Combining a definitional interpreter with a ...







Comments