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.
- A. Ahmed and M. Blume. Typed closure conversion preserves observational equivalence. In 2008 ACM International Conference on Functional Programming, Victoria, Canada, 2008. Google ScholarDigital Library
- 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 Scholar
- 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 Scholar
- D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, School of Computer Science, Pittsburgh, Pennsylvania, May 2005. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- B. Liskov and J. Guttag. Abstraction and Specification in Program Development. The MIT Press, 1986. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. The MIT Press, Cambridge, Massachusetts, 1990. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- L. Paolini and S. R. D. Rocca. Parametric parameter passing lambdacalculus. Information and Computation, 189(1):87–106, 2004. Google ScholarDigital Library
- 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 Scholar
- G. D. Plotkin. Call-by-name, call-by-value, and the lambda calculus. Theoretical Computer Science, 1:125–159, 1975.Google ScholarCross Ref
- G. D. Plotkin. A structural approach to operational semantics. Technical Report DAIMI FN-19, Computer Science Department, Aarhus University, 1981.Google Scholar
- 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 Scholar
- A. Rossberg, C. Russo, and D. Dreyer. F-ing modules. Journal of Functional Programming, 24(5), Sept. 2014.Google ScholarCross Ref
- C. V. Russo. Types for Modules. PhD thesis, Edinburgh University, Mar. 1998.Google Scholar
- 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 ScholarDigital Library
- N. Wirth. Programming in Modula-2. Texts and Monographs in Computer Science. Springer, 1983. Google ScholarDigital Library
Index Terms
- Modules, abstraction, and parametric polymorphism
Recommendations
Modules, abstraction, and parametric polymorphism
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesReynolds'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 ...
Dynamic Translucency with Abstraction Kinds and Higher-Order Coercions
When a module language is combined with forms of non-parametric type analysis, abstract types require an opaque dynamic representation in order to maintain abstraction safety. As an idealisation of such a module language, we present a foundational ...
Logical Relations as Types: Proof-Relevant Parametricity for Program Modules
The theory of program modules is of interest to language designers not only for its practical importance to programming, but also because it lies at the nexus of three fundamental concerns in language design: the phase distinction, computational effects, ...
Comments