Advertisement

Certifying CPS Transformation of Let-Polymorphic Calculus Using PHOAS

  • Urara YamadaEmail author
  • Kenichi Asai
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11275)

Abstract

This paper formalizes the correctness of a one-pass CPS transformation for the lambda calculus extended with let-polymorphism. We prove in Agda that equality is preserved through the CPS transformation. Parameterized higher-order abstract syntax is used to represent binders both at the term level and the type level. Unlike the previous work based on denotational semantics, we use small-step operational semantics to formalize the equality. Thanks to the small-step formalization, we can establish the correctness without any hypothesis on the well-formedness of input terms. The resulting formalization is simple enough to serve as a basis for more complex CPS transformations such as selective one for a calculus with delimited control operators.

Keywords

One-pass CPS transformation Parameterized higher-order abstract syntax Let-polymorphism Agda 

Notes

Acknowledgements

We would like to thank the reviewers for useful and constructive comments. This work was partly supported by JSPS KAKENHI under Grant No. JP18H03218.

References

  1. 1.
    Appel, A.W.: Compiling with Continuations. Cambridge University Press, New York (2007)Google Scholar
  2. 2.
    Asai, K., Kameyama, Y.: Polymorphic delimited continuations. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 239–254. Springer, Heidelberg (2007).  https://doi.org/10.1007/978-3-540-76637-7_16CrossRefGoogle Scholar
  3. 3.
    Asai, K., Uehara, C.: Selective CPS transformation for shift and reset. In: Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2018), pp. 40–52 (2018)Google Scholar
  4. 4.
    Aydemir, B.E., et al.: Mechanized metatheory for the masses: the PoplMark challenge. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 50–65. Springer, Heidelberg (2005).  https://doi.org/10.1007/11541868_4CrossRefGoogle Scholar
  5. 5.
    de Bruijn, N.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. In: Indagationes Mathematicae, Proceedings, vol. 75, no. 5, pp. 381–392 (1972)Google Scholar
  6. 6.
    Chlipala, A.: Parametric higher-order abstract syntax for mechanized semantics. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 2008), pp. 143–156, September 2008Google Scholar
  7. 7.
    Chlipala, A.: Certified Programming with Dependent Types. MIT Press, Cambridge (2013)zbMATHGoogle Scholar
  8. 8.
    Danvy, O.: Back to Direct Style. Sci. Comput. Program. 22, 183–195 (1994)CrossRefGoogle Scholar
  9. 9.
    Danvy, O., Filinski, A.: Abstracting control. In: Proceedings of the ACM Conference on LISP and Functional Programming (LFP 1990), pp. 151–160 (1990)Google Scholar
  10. 10.
    Danvy, O., Filinski, A.: Representing control: a study of the CPS transformation. Math. Struct. Comput. Sci. 2(4), 361–391 (1992)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Dargaye, Z., Leroy, X.: Mechanized verification of CPS transformations. In: Proceedings of the International Conference on Logic for Programming Artificial Intelligence and Reasoning (LPAR 2005), pp. 211–225 (2007)Google Scholar
  12. 12.
    Minamide, Y., Okuma, K.: Verifying CPS transformations in Isabelle/HOL. In: Proceedings of the 2003 ACM SIGPLAN Workshop on Mechanized Reasoning About Languages with Variable Binding (MERLIN 2003), pp. 1–8 (2003)Google Scholar
  13. 13.
    Nielsen, L.R.: A selective CPS transformation. Electron. Notes Theor. Comput. Sci. 45, 311–331 (2001)CrossRefGoogle Scholar
  14. 14.
    Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  15. 15.
    Tian, Y.H.: Mechanically verifying correctness of CPS compilation. In: Proceeding of the Twelfth Computing: The Australasian Theory Symposium (CATS 2006), vol. 51, pp. 41–51 (2006)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.Ochanomizu UniversityTokyoJapan

Personalised recommendations