skip to main content
research-article

Modules, abstraction, and parametric polymorphism

Published:01 January 2017Publication History
Skip Abstract Section

Abstract

Reynolds's Abstraction theorem forms the mathematical foundation for data abstraction. His setting was the polymorphic lambda calculus. Today, many modern languages, such as the ML family, employ rich module systems designed to give more expressive support for data abstraction than the polymorphic lambda calculus, but analogues of the Abstraction theorem for such module systems have lagged far behind.

We give an account of the Abstraction theorem for a modern module calculus supporting generative and applicative functors, higher-order functors, sealing, and translucent signatures. The main issues to be overcome are: (1) the fact that modules combine both types and terms, so they must be treated as both simultaneously, (2) the effect discipline that models the distinction between transparent and opaque modules, and (3) a very rich language of type constructors supporting singleton kinds. We define logical equivalence for modules and show that it coincides with contextual equivalence. This substantiates the folk theorem that modules are good for data abstraction. All our proofs are formalized in Coq.

References

  1. A. Ahmed and M. Blume. Typed closure conversion preserves observational equivalence. In 2008 ACM International Conference on Functional Programming, Victoria, Canada, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. L. Cardelli, J. Donahue, L. Glassman, M. Jordan, B. Kalsow, and G. Nelson. Modula-3 report (revised). Technical Report 52, Digital Equipment Corporation, Systems Research Center, Nov. 1989.Google ScholarGoogle Scholar
  3. K. Crary. A simple proof of call-by-value standardization. Technical Report CMU-CS-09-137, Carnegie Mellon University, School of Computer Science, 2009.Google ScholarGoogle Scholar
  4. D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, School of Computer Science, Pittsburgh, Pennsylvania, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Dreyer, K. Crary, and R. Harper. A type system for higher-order modules. In Thirtieth ACM Symposium on Principles of Programming Languages, pages 236–249, New Orleans, Louisiana, Jan. 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J.-Y. Girard. Interprétation fonctionelle et élimination des coupures de l’arithmétique d’ordre supérieur. PhD thesis, Université Paris VII, 1972.Google ScholarGoogle Scholar
  7. R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In Twenty-First ACM Symposium on Principles of Programming Languages, pages 123–137, Portland, Oregon, Jan. 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. Harper and C. Stone. A type-theoretic interpretation of Standard ML. In Proof, Language and Interaction: Essays in Honour of Robin Milner. The MIT Press, 2000. Extended version published as CMU technical report CMU-CS-97-147. R. Harper, D. MacQueen, and R. Milner. Standard ML. Technical Report ECS-LFCS-86-2, Department of Computer Science, University of Edinburgh, Mar. 1986.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. Harper, J. C. Mitchell, and E. Moggi. Higher-order modules and the phase distinction. In Seventeenth ACM Symposium on Principles of Programming Languages, pages 341–354, San Francisco, Jan. 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. D. K. Lee, K. Crary, and R. Harper. Towards a mechanized metatheory of Standard ML. In Thirty-Fourth ACM Symposium on Principles of Programming Languages, Nice, France, Jan. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. X. Leroy. Manifest types, modules and separate compilation. In Twenty-First ACM Symposium on Principles of Programming Languages, pages 109–122, Portland, Oregon, Jan. 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. X. Leroy. Applicative functors and fully transparent higher-order modules. In Twenty-Second ACM Symposium on Principles of Programming Languages, San Francisco, Jan. 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. X. Leroy, D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. The OCaml system, release 4.03, Documentation and user’s manual. Institut National de Recherche en Informatique et Automatique (INRIA), 2016.Google ScholarGoogle Scholar
  14. B. Liskov and J. Guttag. Abstraction and Specification in Program Development. The MIT Press, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. B. MacQueen and M. Tofte. A semantics for higher-order functors. In Fifth European Symposium on Programming, volume 788 of Lecture Notes in Computer Science, pages 409–423. Springer, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. P. Martin-Löf. An intuitionistic theory of types: Predicative part. In Proceedings of the Logic Colloquium, 1973, volume 80 of Studies in Logic and the Foundations of Mathematics, pages 73–118. North-Holland, 1975.Google ScholarGoogle Scholar
  17. R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. The MIT Press, Cambridge, Massachusetts, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. J. C. Mitchell. On the equivalence of data representations. In V. Lifschitz, editor, Artificial Intelligence and Mathematical Theory of Computation: Papers in Honor of John McCarthy, pages 305–330. Academic Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. C. Mitchell and G. D. Plotkin. Abstract types have existential type. ACM Transactions on Programming Languages and Systems, 10(3):470–502, July 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. L. Paolini and S. R. D. Rocca. Parametric parameter passing lambdacalculus. Information and Computation, 189(1):87–106, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. A. Pitts. Typed operational reasoning. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 7, pages 245– 289. The MIT Press, 2005.Google ScholarGoogle Scholar
  22. G. D. Plotkin. Call-by-name, call-by-value, and the lambda calculus. Theoretical Computer Science, 1:125–159, 1975.Google ScholarGoogle ScholarCross RefCross Ref
  23. G. D. Plotkin. A structural approach to operational semantics. Technical Report DAIMI FN-19, Computer Science Department, Aarhus University, 1981.Google ScholarGoogle Scholar
  24. J. C. Reynolds. Types, abstraction and parametric polymorphism. In Information Processing ’83, pages 513–523. North-Holland, 1983. Proceedings of the IFIP 9th World Computer Congress. A. Rossberg. 1ML — core and modules united. In 2015 ACM International Conference on Functional Programming, Vancouver, Canada, 2015.Google ScholarGoogle Scholar
  25. A. Rossberg, C. Russo, and D. Dreyer. F-ing modules. Journal of Functional Programming, 24(5), Sept. 2014.Google ScholarGoogle ScholarCross RefCross Ref
  26. C. V. Russo. Types for Modules. PhD thesis, Edinburgh University, Mar. 1998.Google ScholarGoogle Scholar
  27. C. A. Stone and R. Harper. Extensional equivalence and singleton types. ACM Transactions on Computational Logic, 7(4), Oct. 2006. An earlier version appeared in the 2000 Symposium on Principles of Programming Languages. P. Wadler. Theorems for free! In Fourth Conference on Functional Programming Languages and Computer Architecture, London, Sept. 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. N. Wirth. Programming in Modula-2. Texts and Monographs in Computer Science. Springer, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Modules, abstraction, and parametric polymorphism

      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

        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 ACM 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: 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