Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Public Access

Type soundness proofs with definitional interpreters

Published: 01 January 2017 Publication History

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

Cited By

View all
  • (2024)Definitions and Computational Properties of OCL: A Systematic ReviewIEEE Access10.1109/ACCESS.2024.342886512(99704-99738)Online publication date: 2024
  • (2023)Recursive Subtyping for AllProceedings of the ACM on Programming Languages10.1145/35712417:POPL(1396-1425)Online publication date: 11-Jan-2023
  • (2022)A conceptual framework for safe object initialization: a principled and mechanized soundness proof of the Celsius modelProceedings of the ACM on Programming Languages10.1145/35633146:OOPSLA2(729-757)Online publication date: 31-Oct-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 January 2017
Published in SIGPLAN Volume 52, Issue 1

Check for updates

Author Tags

  1. DOT
  2. Definitional interpreters
  3. Scala
  4. dependent object types
  5. type soundness

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)147
  • Downloads (Last 6 weeks)22
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Definitions and Computational Properties of OCL: A Systematic ReviewIEEE Access10.1109/ACCESS.2024.342886512(99704-99738)Online publication date: 2024
  • (2023)Recursive Subtyping for AllProceedings of the ACM on Programming Languages10.1145/35712417:POPL(1396-1425)Online publication date: 11-Jan-2023
  • (2022)A conceptual framework for safe object initialization: a principled and mechanized soundness proof of the Celsius modelProceedings of the ACM on Programming Languages10.1145/35633146:OOPSLA2(729-757)Online publication date: 31-Oct-2022
  • (2021)Safe object initialization, abstractlyProceedings of the 12th ACM SIGPLAN International Symposium on Scala10.1145/3486610.3486895(33-43)Online publication date: 17-Oct-2021
  • (2021)Reachability types: tracking aliasing and separation in higher-order functional programsProceedings of the ACM on Programming Languages10.1145/34855165:OOPSLA(1-32)Online publication date: 15-Oct-2021
  • (2020)Syntax vs SemanticsProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427083(9-16)Online publication date: 19-Oct-2020
  • (2020)An Intrinsically-Typed Solution for the List-Machine BenchmarkProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427082(1-8)Online publication date: 19-Oct-2020
  • (2019)Safer smart contract programming with ScillaProceedings of the ACM on Programming Languages10.1145/33606113:OOPSLA(1-30)Online publication date: 10-Oct-2019
  • (2019)Precise reasoning with structured time, structured heaps, and collective operationsProceedings of the ACM on Programming Languages10.1145/33605833:OOPSLA(1-30)Online publication date: 10-Oct-2019
  • (2019)An Inherently-Typed Formalization for Featherweight JavaProceedings of the XXIII Brazilian Symposium on Programming Languages10.1145/3355378.3355385(11-18)Online publication date: 23-Sep-2019
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media