Automating Derivations of Abstract Machines from Reduction Semantics:
We present a generic formalization of the refocusing transformation for functional languages in the Coq proof assistant. The refocusing technique, due to Danvy and Nielsen, allows for mechanical transformation of an evaluator implementing a reduction semantics into an equivalent abstract machine via a succession of simple program transformations. So far, refocusing has been used only as an informal procedure: the conditions required of a reduction semantics have not been formally captured, and the transformation has not been formally proved correct.
The aim of this work is to formalize and prove correct the refocusing technique. To this end, we first propose an axiomatization of reduction semantics that is sufficient to automatically apply the refocusing method. Next, we prove that any reduction semantics conforming to this axiomatization can be automatically transformed into an abstract machine equivalent to it. The article is accompanied by a Coq development that contains the formalization of the refocusing method and a number of case studies that serve both as an illustration of the method and as a sanity check on the axiomatization.
KeywordsModule Type Syntactic Category Abstract Machine Proof Assistant Functional Language
Unable to display preview. Download preview PDF.
- 1.Biernacka, M., Biernacki, D.: Formalizing constructions of abstract machines for functional languages in Coq. In: Giesl, J. (ed.) Preliminary proceedings of the Seventh International Workshop on Reduction Strategies in Rewriting and Programming (WRS 2007), Paris, France (June 2007)Google Scholar
- 4.Biernacka, M., Danvy, O.: Towards compatible and interderivable semantic specifications for the Scheme programming language, Part II: Reduction semantics and abstract machines. In: Palsberg, J. (ed.) Semantics and Algebraic Specification. LNCS, vol. 5700, pp. 186–206. Springer, Heidelberg (2009)CrossRefGoogle Scholar
- 7.Danvy, O.: Defunctionalized interpreters for programming languages. In: Thiemann, P. (ed.) Proceedings of the 2008 ACM SIGPLAN International Conference on Functional Programming (ICFP 2008), Victoria, British Columbia. SIGPLAN Notices, vol. 43(9), ACM Press, New York (September 2008) Google Scholar
- 12.Danvy, O., Nielsen, L.R.: Refocusing in reduction semantics. Research Report BRICS RS-04-26, DAIMI, Department of Computer Science, Aarhus University, Aarhus, Denmark, A preliminary version appeared in the informal proceedings of the Second International Workshop on Rule-Based Programming (RULE 2001). Electronic Notes in Theoretical Computer Science, Vol. 59(4) (November 2004)Google Scholar
- 14.Danvy, O., Zerny, I., Johannsen, J.: A walk in the semantic park. In: Proceedings of the 2011 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 2011), Austin, USA. ACM Press, New York (January 2011) Invited talkGoogle Scholar
- 15.Felleisen, M., Friedman, D.P.: Control operators, the SECD machine, and the λ-calculus. In: Wirsing, M. (ed.) Formal Description of Programming Concepts III, pp. 193–217. Elsevier Science Publishers B.V., North-Holland (1986)Google Scholar