Theory of Computing Systems

, Volume 43, Issue 3–4, pp 298–321 | Cite as

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

  • Rose H. Abdul Rauf
  • Ulrich Berger
  • Anton Setzer
Article
  • 52 Downloads

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.

Keywords

Functional programming Object-oriented programming Inheritance Simply typed lambda-calculus Denotational semantics Kripke-style logical relation Correctness proof 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abelson, H., Sussman, G.J., Sussman, J.: Structure and Interpretation of Computer Programs. MIT Press, Cambridge (1985) Google Scholar
  2. 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. 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) Google Scholar
  4. 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) CrossRefGoogle Scholar
  5. 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) CrossRefGoogle Scholar
  6. 6.
    Läufer, K.: A framework for higher-order functions in C++. In: COOTS (1995) Google Scholar
  7. 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) CrossRefGoogle Scholar
  8. 8.
    Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991) MATHCrossRefMathSciNetGoogle Scholar
  9. 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. 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. 11.
    Plotkin, G.D.: LCF considered as a programming language. Theor. Comput. Sci. 5, 223–255 (1977) CrossRefMathSciNetGoogle Scholar
  12. 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. 13.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP’83, pp. 513–523. North-Holland, Amsterdam (1983) Google Scholar
  14. 14.
    Stärk, R., Schmid, J., Börger, E.: Java and the Java Virtual Machine—Definition, Verification, Validation. Springer, Berlin (2001) MATHGoogle Scholar
  15. 15.
    Statman, R.: Logical relations and the typed lambda-calculus. Inf. Control 65, 85–97 (1985) MATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Striegnitz, J.: FACT!—the functional side of C++. http://www.fz-juelich.de/zam/FACT (2003)
  17. 17.
    Tait, W.W.: Intensional interpretation of functionals of finite type. J. Symb. Log. 32, 198–212 (1967) MATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Winskel, G.: The Formal Semantics of Programming Languages: An Introduction. MIT Press, Cambridge (1993) MATHGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  • Rose H. Abdul Rauf
    • 1
  • Ulrich Berger
    • 2
  • Anton Setzer
    • 2
  1. 1.Faculty of Information System and Quantitative ScienceUniversity of Technology MARAShah AlamMalaysia
  2. 2.Department of Computer ScienceUniversity of Wales SwanseaSwanseaUK

Personalised recommendations