skip to main content

Scala step-by-step: soundness for DOT with step-indexed logical relations in Iris

Published:03 August 2020Publication History
Skip Abstract Section

Abstract

The metatheory of Scala’s core type system—the Dependent Object Types (DOT) calculus—is hard to extend, like the metatheory of other type systems combining subtyping and dependent types. Soundness of important Scala features therefore remains an open problem in theory and in practice. To address some of these problems, we use a semantics-first approach to develop a logical relations model for a new version of DOT, called guarded DOT (gDOT). Our logical relations model makes use of an abstract form of step-indexing, as supported by the Iris framework, to model various forms of recursion in gDOT. To demonstrate the expressiveness of gDOT, we show that it handles Scala examples that could not be handled by previous versions of DOT, and prove using our logical relations model that gDOT provides the desired data abstraction. The gDOT type system, its semantic model, its soundness proofs, and all examples in the paper have been mechanized in Coq.

Skip Supplemental Material Section

Supplemental Material

Presentation at ICFP '20

References

  1. Amal Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. Princeton University.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Pierre America and Jan J. M. M. Rutten. 1989. Solving reflexive domain equations in a category of complete metric spaces. JCSS 39, 3 ( 1989 ), 343-375.Google ScholarGoogle Scholar
  3. Nada Amin. 2016. Dependent Object Types. Ph.D. Dissertation. EPFL.Google ScholarGoogle Scholar
  4. Nada Amin, Samuel Grütter, Martin Odersky, Tiark Rompf, and Sandro Stucki. 2016. The essence of dependent object types. In WadlerFest (LNCS, Vol. 9600 ). 249-272.Google ScholarGoogle ScholarCross RefCross Ref
  5. Nada Amin, Adriaan Moors, and Martin Odersky. 2012. Dependent object types. In FOOL.Google ScholarGoogle Scholar
  6. Nada Amin and Tiark Rompf. 2017. Type soundness proofs with definitional interpreters. In POPL. 666-679.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Andrew W. Appel and David A. McAllester. 2001. An indexed model of recursive types for foundational proof-carrying code. TOPLAS 23, 5 ( 2001 ), 657-683.Google ScholarGoogle Scholar
  8. Andrew W. Appel, Paul-André Melliès, Christopher D. Richards, and Jérôme Vouillon. 2007. A very modal model of a modern, major, general type system. In POPL. 109-122.Google ScholarGoogle Scholar
  9. Lars Birkedal, Bernhard Reus, Jan Schwinghammer, Kristian Støvring, Jacob Thamsborg, and Hongseok Yang. 2011. Stepindexed Kripke models over recursive worlds. In POPL. 119-132.Google ScholarGoogle Scholar
  10. Lars Birkedal, Kristian Støvring, and Jacob Thamsborg. 2010. The category-theoretic solution of recursive metric-space equations. TCS 411, 47 ( 2010 ), 4102-4122.Google ScholarGoogle Scholar
  11. Michael Brandt and Fritz Henglein. 1998. Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticae 33, 4 ( 1998 ), 309-338.Google ScholarGoogle Scholar
  12. Dave Clarke, Sophia Drossopoulou, James Noble, and Tobias Wrigstad. 2007. Tribe: a simple virtual class calculus. In AOSD, Vol. 208. 121-134.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Karl Crary. 2017. Modules, abstraction, and parametric polymorphism. In POPL. 100-113.Google ScholarGoogle Scholar
  14. Karl Crary, Robert Harper, and Sidd Puri. 1999. What is a recursive module?. In PLDI. 50-63.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Vincent Cremet, François Garillot, Sergueï Lenglet, and Martin Odersky. 2006. A core calculus for Scala type checking. In MFCS (LNCS, Vol. 4162 ). 1-23.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Erik Ernst, Klaus Ostermann, and William R. Cook. 2006. A virtual class calculus. In POPL. 270-282.Google ScholarGoogle Scholar
  17. Dan Frumin, Robbert Krebbers, and Lars Birkedal. 2018. ReLoC: A Mechanised Relational Logic for Fine-Grained Concurrency. In LICS. 442-451.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Dan Frumin, Robbert Krebbers, and Lars Birkedal. 2020. Compositional Non-Interference for Fine-Grained Concurrent Programs. To appear in S&P' 21.Google ScholarGoogle Scholar
  19. Peng Fu and Aaron Stump. 2014. Self types for dependently typed lambda encodings. In RTA-TLCA (LNCS, Vol. 8560 ). 224-239.Google ScholarGoogle ScholarCross RefCross Ref
  20. Paolo G. Giarrusso. 2019. Can we prove that type constructors are “distributive”? Github issue, https://web.archive.org/ web/20200304175526/https://github.com/lampepfl/dotty-feature-requests/issues/51, archived on 04 March 2020.Google ScholarGoogle Scholar
  21. Paolo G. Giarrusso, Léo Stefanesco, Amin Timany, Lars Birkedal, and Robbert Krebbers. 2020. Scala Step-by-Step : Soundness for DOT with Step-Indexed Logical Relations in Iris-Extended Version and Coq Mechanization. Available online at https://dot-iris.github.io/, archived version of the Coq development available at https://doi.org/10.5281/zenodo.3926703. Google ScholarGoogle ScholarCross RefCross Ref
  22. Robert Harper and Mark Lillibridge. 1994. A type-theoretic approach to higher-order modules with sharing. In POPL. 123-137.Google ScholarGoogle Scholar
  23. Robert Harper and John C. Mitchell. 1993. On the type structure of Standard ML. TOPLAS 15, 2 ( 1993 ), 211-252.Google ScholarGoogle Scholar
  24. Jason Z. S. Hu and Ondřej Lhoták. 2020. Undecidability of D<: and its decidable fragments. PACMPL 4, POPL ( 2020 ), 9 : 1-9 : 30.Google ScholarGoogle Scholar
  25. DeLesley S. Hutchins. 2010. Pure subtype systems. In POPL. 287-298.Google ScholarGoogle Scholar
  26. Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. 2018a. RustBelt: Securing the foundations of the Rust programming language. PACMPL 2, POPL ( 2018 ), 66 : 1-66 : 34.Google ScholarGoogle Scholar
  27. Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. 2020. Safe systems programming in Rust: The promise and the challenge. To appear in CACM.Google ScholarGoogle Scholar
  28. Ralf Jung, Robbert Krebbers, Lars Birkedal, and Derek Dreyer. 2016. Higher-order ghost state. In ICFP. 256-269.Google ScholarGoogle Scholar
  29. Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Ales Bizjak, Lars Birkedal, and Derek Dreyer. 2018b. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. JFP 28 ( 2018 ), e20.Google ScholarGoogle Scholar
  30. Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and invariants as an orthogonal basis for concurrent reasoning. In POPL. 637-650.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Ifaz Kabir and Ondřej Lhoták. 2018. DOT: Scaling DOT with mutation and constructors. In [email protected]. 40-50.Google ScholarGoogle Scholar
  32. Alexei Kopylov. 2003. Dependent intersection: A new way of defining records in type theory. In LICS. 86-95.Google ScholarGoogle Scholar
  33. Robbert Krebbers, Jacques-Henri Jourdan, Ralf Jung, Joseph Tassarotti, Jan-Oliver Kaiser, Amin Timany, Arthur Charguéraud, and Derek Dreyer. 2018. MoSeL: A general, extensible modal framework for interactive proofs in separation logic. PACMPL 2, ICFP ( 2018 ), 77 : 1-77 : 30.Google ScholarGoogle Scholar
  34. Robbert Krebbers, Ralf Jung, Ales Bizjak, Jacques-Henri Jourdan, Derek Dreyer, and Lars Birkedal. 2017a. The essence of higher-order concurrent separation logic. In ESOP (LNCS, Vol. 10201 ). 696-723.Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017b. Interactive proofs in higher-order concurrent separation logic. In POPL. 205-217.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Morten Krogh-Jespersen, Kasper Svendsen, and Lars Birkedal. 2017. A relational model of types-and-efects in higher-order concurrent separation logic. In POPL. 218-231.Google ScholarGoogle Scholar
  37. Robin Milner. 1978. A theory of type polymorphism in programming. JCSS 17, 3 ( 1978 ), 348-375.Google ScholarGoogle Scholar
  38. Hiroshi Nakano. 2000. A Modality for Recursion. In LICS. 255-266.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Abel Nieto. 2017. Towards algorithmic typing for DOT (short paper). In [email protected]. 2-7.Google ScholarGoogle Scholar
  40. Martin Odersky. 2016. DOT with higher-kinded types. Github discussion, https://web.archive.org/web/20200304175613/https: //gist.github. com/odersky/36aee4b7fe6716d1016ed37051caae95, archived on 04 March 2020.Google ScholarGoogle Scholar
  41. Martin Odersky, Guillaume Martres, and Dmitry Petrashko. 2016. Implementing higher-kinded types in Dotty. In [email protected]. 51-60.Google ScholarGoogle Scholar
  42. Marianna Rapoport, Ifaz Kabir, Paul He, and Ondřej Lhoták. 2017. A simple soundness proof for dependent object types. PACMPL 1, OOPSLA ( 2017 ), 46 : 1-46 : 27.Google ScholarGoogle Scholar
  43. Marianna Rapoport and Ondřej Lhoták. 2016. Mutable WadlerFest DOT. Technical Report. University of Waterloo. http://arxiv.org/abs/1611.07610Google ScholarGoogle Scholar
  44. Marianna Rapoport and Ondřej Lhoták. 2019. A path to DOT: formalizing fully path-dependent types. PACMPL 3, OOPSLA ( 2019 ), 145 : 1-145 : 29.Google ScholarGoogle Scholar
  45. Tiark Rompf and Nada Amin. 2016. Type soundness for dependent object types (DOT). In OOPSLA. 624-641.Google ScholarGoogle Scholar
  46. Steven Schäfer, Tobias Tebbi, and Gert Smolka. 2015. Autosubst: reasoning with de Bruijn terms and parallel substitutions. In ITP (LNCS, Vol. 9236 ). 359-374.Google ScholarGoogle ScholarCross RefCross Ref
  47. Paula Severi. 2019. A light modality for recursion. LMCS 15, 1 ( 2019 ).Google ScholarGoogle Scholar
  48. Kathrin Stark, Steven Schäfer, and Jonas Kaiser. 2019. Autosubst 2: reasoning with multi-sorted de Bruijn terms and vector substitutions. In CPP. 166-180.Google ScholarGoogle Scholar
  49. Sandro Stucki. 2016. DOT with higher-kinded types-A sketch. Github discussion, https://web.archive.org/web/ 20200304175148/https://gist.github. com/sstucki/3fa46d2c4ce6f54dc61c3d33fc898098, archived on 04 March 2020.Google ScholarGoogle Scholar
  50. Sandro Stucki. 2017. Higher-Order Subtyping with Type Intervals. Ph.D. Dissertation. School of Computer and Communication Sciences, École polytechnique fédérale de Lausanne, Lausanne, Switzerland. https://doi.org/10.5075/epfl-thesis-8014 EPFL thesis no. 8014. Google ScholarGoogle ScholarCross RefCross Ref
  51. David Swasey, Deepak Garg, and Derek Dreyer. 2017. Robust and compositional verification of object capability patterns. PACMPL 1, OOPSLA ( 2017 ), 89 : 1-89 : 26.Google ScholarGoogle Scholar
  52. Joseph Tassarotti, Ralf Jung, and Robert Harper. 2017. A Higher-Order Logic for Concurrent Termination-Preserving Refinement. In ESOP (LNCS, Vol. 10201 ). 909-936.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Amin Timany, Léo Stefanesco, Morten Krogh-Jespersen, and Lars Birkedal. 2018. A logical relation for monadic encapsulation of state: Proving contextual equivalences in the presence of runST. PACMPL 2, POPL ( 2018 ), 64 : 1-64 : 28.Google ScholarGoogle Scholar
  54. Fei Wang and Tiark Rompf. 2017. Towards strong normalization for dependent object types (DOT). In ECOOP (LIPIcs, Vol. 74 ). 27 : 1-27 : 25.Google ScholarGoogle Scholar
  55. Yanpeng Yang and Bruno C. d. S. Oliveira. 2017. Unifying typing and subtyping. PACMPL 1, OOPSLA ( 2017 ), 47 : 1-47 : 26.Google ScholarGoogle Scholar

Index Terms

  1. Scala step-by-step: soundness for DOT with step-indexed logical relations in Iris

          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

          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!