Abstract
Reasoning about imperative programs requires the ability to track aliasing and ownership properties. We present a type system that provides this ability, by using regions, capabilities, and singleton types. It is designed for a high-level calculus with higher-order functions, algebraic data structures, and references (mutable memory cells). The type system has polymorphism, yet does not require a value restriction, because capabilities act as explicit store typings.
We exhibit a type-directed, type-preserving, and meaning-preserving translation of this imperative calculus into a pure calculus. Like the monadic translation, this is a store-passing translation. Here, however, the store is partitioned into multiple fragments, which are threaded through a computation only if they are relevant to it. Furthermore, the decomposition of the store into fragments can evolve dynamically to reflect ownership transfers.
The translation offers deep insight about the inner workings and soundness of the type system. If coupled with a semantic model of its target calculus, it leads to a semantic model of its imperative source calculus. Furthermore, it provides a foundation for our long-term objective of designing a system for specifying and certifying imperative programs with dynamic memory allocation.
Supplemental Material
Available for Download
Supplemental material for: Functional translation of a calculus of capabilities
- Arthur Chargu´eraud and François Pottier. Technical appendix. http://arthur.chargueraud.org/research/2008/icfp/.Google Scholar
- Amal Ahmed, Matthew Fluet, and Greg Morrisett. L3: A linear language with locations. Fundamenta Informaticæ, 77(4), 2007. Google Scholar
Digital Library
- Mike Barnett, Rob DeLine, Manuel Fähndrich, K. Rustan M. Leino, and Wolfram Schulte. Verification of object-oriented programs with invariants. Journal of Object Technology, 3(6), 2004.Google Scholar
Cross Ref
- John Tang Boyland and William Retert. Connecting effects and uniqueness with adoption. In POPL, pages 283--295, January 2005. Google Scholar
Digital Library
- Michael Brandt and Fritz Henglein. Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticæ, 33:309--338, 1998. Google Scholar
Digital Library
- Chih-Ping Chen and Paul Hudak. Rolling your own mutable ADT-a connection between linear types and monads. In POPL, 1997. Google Scholar
Digital Library
- Karl Crary, David Walker, and Greg Morrisett. Typed memory management in a calculus of capabilities. In POPL, 1999. Google Scholar
Digital Library
- Jean-Christophe Filliâtre. Verification of non-functional programs using interpretations in type theory. JFP, 13(4), 2003. Google Scholar
Digital Library
- Jean-Christophe Filliâtre and Claude Marché. TheWhy/Krakatoa/Caduceus platform for deductive program verification. In CAV, volume 4590 of LNCS, 2007. Google Scholar
Digital Library
- Matthew Fluet and Greg Morrisett. Monadic regions. JFP, 16(4-5):485--545, 2006. Google Scholar
Digital Library
- Matthew Fluet, Greg Morrisett, and Amal Ahmed. Linear regions are all you need. In ESOP, volume 3924 of LNCS, March 2006. Google Scholar
Digital Library
- Manuel Fähndrich and Robert DeLine. Adoption and focus: practical linear types for imperative programming. In PLDI, 2002. Google Scholar
Digital Library
- Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, University of Edinburgh, 1989.Google Scholar
- Aleksandar Nanevski, Amal Ahmed, Greg Morrisett, and Lars Birkedal. Abstract predicates and mutable ADTs in Hoare type theory. In ESOP, LNCS, March 2007. Google Scholar
Digital Library
- Peter W. O'Hearn and John C. Reynolds. From Algol to polymorphic linear lambda-calculus. Journal of the ACM, 47(1):167--223, 2000. Google Scholar
Digital Library
- Benjamin C. Pierce. Types and Programming Languages. MIT Press, 2002. Google Scholar
Digital Library
- François Pottier. Hiding local state in direct style: a higher-order anti-frame rule. In LICS, 2008.Google Scholar
Digital Library
- John C. Reynolds. Separation logic: A logic for shared mutable data structures. In LICS, 2002. Google Scholar
Digital Library
- Frederick Smith, David Walker, and Greg Morrisett. Alias types. In ESOP, volume 1782 of LNCS, 2000. Google Scholar
Digital Library
- Mads Tofte and Jean-Pierre Talpin. Region-based memory management. Information and Computation, 132(2):109--176, 1997. Google Scholar
Digital Library
- Philip Wadler. The essence of functional programming. In POPL, 1992. Google Scholar
Digital Library
- David Walker and Greg Morrisett. Alias types for recursive data structures. In TIC, volume 2071 of LNCS, 2000. Google Scholar
Digital Library
- Dengping Zhu and Hongwei Xi. Safe programming with pointers through stateful views. In PADL, volume 3350 of LNCS, 2005. Google Scholar
Digital Library
Index Terms
Functional translation of a calculus of capabilities
Recommendations
Functional translation of a calculus of capabilities
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programmingReasoning about imperative programs requires the ability to track aliasing and ownership properties. We present a type system that provides this ability, by using regions, capabilities, and singleton types. It is designed for a high-level calculus with ...
Recovering purity with comonads and capabilities
In this paper, we take a pervasively effectful (in the style of ML) typed lambda calculus, and show how to extend it to permit capturing pure expressions with types. Our key observation is that, just as the pure simply-typed lambda calculus can be ...
Substructural typestates
PLPV '14: Proceedings of the ACM SIGPLAN 2014 Workshop on Programming Languages meets Program VerificationFinding simple, yet expressive, verification techniques to reason about both aliasing and mutable state has been a major challenge for static program verification. One such approach, of practical relevance, is centered around a lightweight typing ...







Comments