Skip to main content
Log in

A Provably Correct Translation of the λ-Calculus into a Mathematical Model of C++

  • Published:
Theory of Computing Systems Aims and scope Submit manuscript

Abstract

We introduce a translation of the simply typed λ-calculus into C++, and give a mathematical proof of the correctness of this translation. For this purpose we develop a suitable fragment of C++ together with a denotational semantics. We introduce a formal translation of the λ-calculus into this fragment, and show that this translation is correct with respect to the denotational semantics. We show as well a completeness result, namely that by translating λ-terms we obtain essentially all C++ terms in this fragment. We introduce a mathematical model for the evaluation of programs of this fragment, and show that the evaluation computes the correct result with respect to this semantics.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Abelson, H., Sussman, G.J., Sussman, J.: Structure and Interpretation of Computer Programs. MIT Press, Cambridge (1985)

    Google Scholar 

  2. Goubault-Larrecq, J., Lasota, S., Nowak, D.: Logical relations for monadic types. In: Bradfield, J.C. (ed.) Proceedings of the 16th International Workshop on Computer Science Logic (CSL’02), Edinburgh, Scotland, UK, September 2002. Lecture Notes in Computer Science, vol. 2471, pp. 553–568. Springer, Berlin (2002)

    Google Scholar 

  3. Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. In: Meissner L. (ed.) Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA’99). ACM SIGPLAN Not. 34(10), 132–146 (1999)

  4. Jung, A., Tiuryn, J.: A new characterization of lambda definability. In: Bezem, M., Groote, J.F. (eds.) Typed Lambda Calculi and Applications. Lecture Notes in Computer Science, vol. 664, pp. 245–257. Springer, Berlin (1993)

    Chapter  Google Scholar 

  5. Kiselyov, O.: Functional style in C++: Closures, late binding, and lambda abstractions. In: ICFP ’98: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, pp. 337–440. ACM, New York (1998)

    Chapter  Google Scholar 

  6. Läufer, K.: A framework for higher-order functions in C++. In: COOTS (1995)

  7. McNamara, B., Smaragdakis, Y.: Functional programming in C++. In: ICFP’00: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pp. 118–129. ACM, New York (2000)

    Chapter  Google Scholar 

  8. Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  9. Ong, L.: Correspondence between operational and denotational semantics: the full abstraction problem for PCF. In: Abramsky, S., Gabbay, D.M., Maibaum, T.S.E. (eds.) Semantic Modelling. Handbook of Logic Comput. Sci., vol. 4, pp. 269–356. Clarendon, Oxford (1995)

    Google Scholar 

  10. Pitts, A.M.: Evaluation logic. In: Birtwistle, G. (ed.) IVth Higher Order Workshop, Banff 1990. Workshops in Computing, pp. 162–189. Springer, Berlin (1991)

    Google Scholar 

  11. Plotkin, G.D.: LCF considered as a programming language. Theor. Comput. Sci. 5, 223–255 (1977)

    Article  MathSciNet  Google Scholar 

  12. Plotkin, G.D.: Lambda definability in the full type hierarchy. In: Hindley, R., Seldin, J. (eds.) To H.B. Curry: Essays in Combinatory Logic, Lambda Calculus and Formalisms, pp. 363–373. Academic Press, New York (1980)

    Google Scholar 

  13. Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP’83, pp. 513–523. North-Holland, Amsterdam (1983)

    Google Scholar 

  14. Stärk, R., Schmid, J., Börger, E.: Java and the Java Virtual Machine—Definition, Verification, Validation. Springer, Berlin (2001)

    MATH  Google Scholar 

  15. Statman, R.: Logical relations and the typed lambda-calculus. Inf. Control 65, 85–97 (1985)

    Article  MATH  MathSciNet  Google Scholar 

  16. Striegnitz, J.: FACT!—the functional side of C++. http://www.fz-juelich.de/zam/FACT (2003)

  17. Tait, W.W.: Intensional interpretation of functionals of finite type. J. Symb. Log. 32, 198–212 (1967)

    Article  MATH  MathSciNet  Google Scholar 

  18. Winskel, G.: The Formal Semantics of Programming Languages: An Introduction. MIT Press, Cambridge (1993)

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Rose H. Abdul Rauf.

Additional information

Supported by EPSRC grant GR/S30450/01.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Abdul Rauf, R.H., Berger, U. & Setzer, A. A Provably Correct Translation of the λ-Calculus into a Mathematical Model of C++. Theory Comput Syst 43, 298–321 (2008). https://doi.org/10.1007/s00224-007-9062-1

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00224-007-9062-1

Keywords

Navigation