ABSTRACT
We present a Kripke logical relation for showing the correctness of program transformations based on a type-and-effect system for an ML-like programming language with higher-order store and dynamic allocation.
We show how to use our model to verify a number of interesting program transformations that rely on effect annotations.
Our model is constructed as a step-indexed model over the standard operational semantics of the programming language. It extends earlier work [7, 8]that has considered, respectively, dynamically allocated first-order references and higher-order store for global variables (but no dynamic allocation). It builds on ideas from region-based memory management [21], and on Kripke logical relations for higher-order store [12, 14].
Our type-and-effect system is region-based and includes a region-masking rule which allows to hide local effects. One of the key challenges in the model construction for dynamically allocated higher-order store is that the meaning of a type may change since references, conceptually speaking, may become dangling due to region-masking. We explain how our Kripke model can be used to show correctness of program transformations for programs involving references that, conceptually, are dangling.
Supplemental Material
- A. Ahmed. Semantics of Types for Mutable State. PhD thesis, Princeton University, 2004. Google ScholarDigital Library
- A. Ahmed, D. Dreyer, and A. Rossberg. State-dependent representation independence. In Proceedings of POPL, 2009. Google ScholarDigital Library
- A. J. Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In P. Sestoft, editor, ESOP, volume 3924 of Lecture Notes in Computer Science, pages 69--83. Springer, 2006. ISBN 3-540-33095-X. Google ScholarDigital Library
- A. Aiken, M. Fähndrich, and R. Levien. Better static memory management: Improving region-based analysis of higher-order languages. In Prcoeedings of PLDI, 1995. Google ScholarDigital Library
- N. Benton and P. Buchlovsky. Semantics of an effect analysis for exceptions. In Proceedings of TLDI, 2007. Google ScholarDigital Library
- N. Benton, A. Kenney, M. Hofmann, and L. Beringer. Reading, writing and relations: Towards extensional semantics for effect analyses. In Proceedings of APLAS, 2006. Google ScholarDigital Library
- N. Benton, L. Beringer, M. Hofmann, and A. Kennedy. Relational semantics for effect-based program transformations with dynamic allocation. In Proceedings of PPDP. ACM, 2007. Google ScholarDigital Library
- N. Benton, L. Beringer, M. Hofmann, and A. Kennedy. Relational semantics for effect-based program transformations: Higher-order store. In Proceedings of PPDP. ACM, 2009. Google ScholarDigital Library
- L. Birkedal, M. Tofte, and M. Vejlstrup. From region inference to von Neumann machines via region representation inference. In Proceedings of POPL, 1996. Google ScholarDigital Library
- L. Birkedal, N. Torp-Smith, and H. Yang. Semantics of separation-logic typing and higher-order frame rules for algol-like langauges. Logical Methods in Computer Science, 2 (5:1): 1--33, 2006.Google ScholarCross Ref
- L. Birkedal, K. Støvring, and J. Thamsborg. Realizability semantics of parametric polymorphism, general references, and recursive types. In Proceedings of FOSSACS, 2009. Google ScholarDigital Library
- L. Birkedal, B. Reus, J. Schwinghammer, K. Støvring, J. Thamsborg, and H. Yang. Step-indexed Kripke models over recursive worlds. In Proceedings of POPL, pages 119--132, 2011. Google ScholarDigital Library
- D. Dreyer, A. Ahmed, and L. Birkedal. Logical step-indexed logical relations. In LICS, pages 71--80. IEEE Computer Society, 2009. ISBN 978-0-7695-3746-7. Google ScholarDigital Library
- D. Dreyer, G. Neis, and L. Birkedal. The impact of higher-order state and control effects on local relational reasoning. In Proceedings of ICFP, 2010. Google ScholarDigital Library
- D. Gifford and J. Lucassen. Integrating functional and imperative programming. In ACM Conference of LISP and Functional Programming, 1986. Google ScholarDigital Library
- F. Henglein, M. Makholm, and H. Niss. A direct approach to control-flow sensitive region-based memory management. In Prcoeedings of PPDP, 2001. Google ScholarDigital Library
- F. Henglein, H. Makholm, and H. Niss. Effect types and region-based memory management. In B. Pierce, editor, Advanced Topics in Types and Programming Languages. MIT Press, 2005.Google Scholar
- J. Lucassen and D. Gifford. Polymorphic effect systems. In Proceedings of POPL, 1988. Google ScholarDigital Library
- A. Nanevski, G. Morrisett, and L. Birkedal. Polymorphism and separation in hoare type theory. In J. H. Reppy and J. L. Lawall, editors, ICFP, pages 62--73. ACM, 2006. ISBN 1-59593-309-3. Google ScholarDigital Library
- A. M. Pitts. Relational properties of domains. Inf. Comput., 127 (2): 66--90, 1996.Google ScholarCross Ref
- M. Tofte and J.-P. Talpin. Implementation of the typed call-by-value λ-calculus using a stack of regions. In Proceedings of POPL, 1994. Google ScholarDigital Library
Index Terms
- A kripke logical relation for effect-based program transformations
Recommendations
A kripke logical relation for effect-based program transformations
ICFP '11We present a Kripke logical relation for showing the correctness of program transformations based on a type-and-effect system for an ML-like programming language with higher-order store and dynamic allocation.
We show how to use our model to verify a ...
A Kripke logical relation for effect-based program transformations
We present a Kripke logical relation for showing the correctness of program transformations based on a region-polymorphic type-and-effect system for an ML-like programming language with higher-order store and dynamic allocation. We also show how to use ...
The Impact of seq on Free Theorems-Based Program Transformations
Program Transformation: Theoretical Foundations and Basic Techniques. Part 2Parametric polymorphism constrains the behavior of pure functional programs in a way that allows the derivation of interesting theorems about them solely from their types, i.e., virtually for free. Unfortunately, standard parametricity results - ...
Comments