Automating Derivations of Abstract Machines from Reduction Semantics:

A Generic Formalization of Refocusing in Coq
  • Filip Sieczkowski
  • Małgorzata Biernacka
  • Dariusz Biernacki
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6647)


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.


Module Type Syntactic Category Abstract Machine Proof Assistant Functional Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 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
  2. 2.
    Biernacka, M., Danvy, O.: A concrete framework for environment machines. ACM Transactions on Computational Logic 9(1), 1–30 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Biernacka, M., Danvy, O.: A syntactic correspondence between context-sensitive calculi and abstract machines. Theoretical Computer Science 375(1-3), 76–108 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 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
  5. 5.
    Chrząszcz, J.: Implementing modules in the Coq system. In: Basin, D.A., Wolff, B. (eds.) TPHOLs 2003. LNCS, vol. 2758, pp. 270–286. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  6. 6.
    Curien, P.-L.: An abstract framework for environment machines. Theoretical Computer Science 82, 389–402 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 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
  8. 8.
    Danvy, O.: From reduction-based to reduction-free normalization. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 66–164. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  9. 9.
    Danvy, O., Johannsen, J.: Inter-deriving semantic artifacts for object-oriented programming. Journal of Computer and System Sciences 76, 302–323 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Danvy, O., Millikin, K.: On the equivalence between small-step and big-step abstract machines: a simple application of lightweight fusion. Information Processing Letters 106(3), 100–109 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Danvy, O., Millikin, K., Munk, J., Zerny, I.: Defunctionalized interpreters for call-by-need evaluation. In: Blume, M., Kobayashi, N., Vidal, G. (eds.) FLOPS 2010. LNCS, vol. 6009, pp. 240–256. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  12. 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
  13. 13.
    Danvy, O., Zerny, I.: Three syntactic theories for combinatory graph reduction. In: Alpuente, M. (ed.) LOPSTR 2010. LNCS, vol. 6564, pp. 1–20. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  14. 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. 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
  16. 16.
    Garcia, R., Lumsdaine, A., Sabry, A.: Lazy evaluation and delimited control. Logical Methods in Computer Science 6(3:1), 1–39 (2010)MathSciNetzbMATHGoogle Scholar
  17. 17.
    Krivine, J.-L.: A call-by-name lambda-calculus machine. Higher-Order and Symbolic Computation 20(3), 199–207 (2007)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Filip Sieczkowski
    • 1
  • Małgorzata Biernacka
    • 1
  • Dariusz Biernacki
    • 1
  1. 1.Institute of Computer ScienceUniversity of WrocławPoland

Personalised recommendations