skip to main content
research-article
Public Access

Type soundness proofs with definitional interpreters

Published:01 January 2017Publication History
Skip Abstract Section

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.

References

  1. A. Abel. Polarised subtyping for sized types. Mathematical Structures in Computer Science, 18:797–822, 10 2008.Google ScholarGoogle ScholarCross RefCross Ref
  2. M. S. Ager, D. Biernacki, O. Danvy, and J. Midtgaard. A functional correspondence between evaluators and abstract machines. In PPDP, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. J. Ahmed. Semantics of types for mutable state. PhD thesis, Princeton University, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. J. Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In ESOP, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarCross RefCross Ref
  6. N. Amin, A. Moors, and M. Odersky. Dependent object types. In FOOL, 2012.Google ScholarGoogle Scholar
  7. N. Amin, T. Rompf, and M. Odersky. Foundations of path-dependent types. In OOPSLA, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. Aspinall and A. Compagnoni. Subtyping dependent types. Theoretical Computer Science, 266(1):273–309, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. H. P. Barendregt. Handbook of logic in computer science. chapter Lambda Calculi with Types. Oxford University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. N. R. Cameron, J. Noble, and T. Wrigstad. Tribal ownership. In OOPSLA, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Charguéraud. The locally nameless representation. J. Autom. Reasoning, 49(3):363–408, 2012.Google ScholarGoogle ScholarCross RefCross Ref
  15. D. Clarke, S. Drossopoulou, J. Noble, and T. Wrigstad. Tribe: a simple virtual class calculus. In AOSD, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. V. Cremet, F. Garillot, S. Lenglet, and M. Odersky. A core calculus for Scala type checking. In MFCS, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. A. Danielsson. Operational semantics using the partiality monad. In ICFP, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. O. Danvy and J. Johannsen. Inter-deriving semantic artifacts for object-oriented programming. J. Comput. Syst. Sci., 76(5):302–323, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Dreyer and A. Rossberg. Mixin’ up the ML module system. In ICFP, 2008.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. Ernst. Family polymorphism. In ECOOP, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. E. Ernst. Higher-order hierarchies. In ECOOP, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  23. E. Ernst, K. Ostermann, and W. R. Cook. A virtual class calculus. In POPL, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Flatt. Binding as sets of scopes. In POPL, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. V. Gasiunas, M. Mezini, and K. Ostermann. Dependent classes. In OOPSLA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle Scholar
  27. R. Harper. A simplified account of polymorphic references. Information Processing Letters, 51(4):201 – 206, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Harper. A simplified account of polymorphic references – followup. https://www.cs.cmu.edu/~rwh/papers/refs/ipl-followup.pdf, 1995.Google ScholarGoogle Scholar
  29. R. Harper and M. Lillibridge. A type-theoretic approach to higherorder modules with sharing. In POPL, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. G. Kahn. Natural semantics. In STACS, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. K. Lee, K. Crary, and R. Harper. Towards a mechanized metatheory of standard ML. In POPL, pages 173–184. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. X. Leroy. Manifest types, modules and separate compilation. In POPL, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. X. Leroy and H. Grall. Coinductive big-step operational semantics. Inf. Comput., 207(2):284–304, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. D. Macqueen. Using dependent types to express modular structure. In POPL, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. J. Midtgaard, N. Ramsey, and B. Larsen. Engineering definitional interpreters. In PPDP, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. E. Moggi. Notions of computation and monads. Inf. Comput., 93(1):55–92, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. A. Moors, F. Piessens, and M. Odersky. Safe type-level abstraction in Scala. In FOOL, 2008.Google ScholarGoogle Scholar
  38. P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A theory of name resolution. In ESOP, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  39. N. Nystrom, S. Chong, and A. C. Myers. Scalable extensibility via nested inheritance. In OOPSLA, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. M. Odersky, V. Cremet, C. Röckl, and M. Zenger. A nominal theory of objects with dependent types. In ECOOP, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  41. S. Owens, M. O. Myreen, R. Kumar, and Y. K. Tan. Functional bigstep semantics. In ESOP, 2016.Google ScholarGoogle Scholar
  42. B. C. Pierce. Programming with Intersection Types and Bounded Polymorphism. PhD thesis, Carnegie Mellon University, December 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. G. D. Plotkin. A structural approach to operational semantics. J. Log. Algebr. Program., 60-61:17–139, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  44. J. C. Reynolds. Definitional interpreters for higher-order programming languages. Higher-Order and Symbolic Computation, 11(4):363–397, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. T. Rompf and N. Amin. Type soundness for dependent object types. In OOPSLA, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. A. Rossberg. 1ML - core and modules united (f-ing first-class modules). In ICFP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. A. Rossberg, C. V. Russo, and D. Dreyer. F-ing modules. J. Funct. Program., 24(5):529–607, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  48. D. S. Scott. Domains for denotational semantics. In Automata, Languages and Programming, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. J. Siek. Type safety in three easy lemmas. http://siek.blogspot. com/2013/05/type-safety-in-three-easy-lemmas.html, 2013.Google ScholarGoogle Scholar
  50. M. Steffen. Polarized higher-order subtyping. PhD thesis, University of Erlangen-Nuremberg, 1997.Google ScholarGoogle Scholar
  51. M. Tofte. Operational Semantics and Polymorphic Type Inference. PhD thesis, 1988.Google ScholarGoogle Scholar
  52. M. VanInwegen. The Machine-Assisted Proof of Programming Language Properties. PhD thesis, May 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. D. von Oheimb. Re: Subject reduction fails in java. http://www.seas.upenn.edu/~sweirich/types/archive/1997-98/ msg00452.html, 1998.Google ScholarGoogle Scholar
  54. P. Wadler. The essence of functional programming. In POPL, pages 1–14. ACM Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. P. Wadler. Propositions as types. Presentation at Strange Loop, 2015.Google ScholarGoogle Scholar
  56. A. K. Wright and M. Felleisen. A syntactic approach to type soundness. Inf. Comput., 115(1):38–94, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Type soundness proofs with definitional interpreters

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 52, Issue 1
      POPL '17
      January 2017
      901 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/3093333
      Issue’s Table of Contents
      • cover image ACM Conferences
        POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
        January 2017
        901 pages
        ISBN:9781450346603
        DOI:10.1145/3009837

      Copyright © 2017 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 January 2017

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!