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.
Similar content being viewed by others
References
Abelson, H., Sussman, G.J., Sussman, J.: Structure and Interpretation of Computer Programs. MIT Press, Cambridge (1985)
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)
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)
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)
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)
Läufer, K.: A framework for higher-order functions in C++. In: COOTS (1995)
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)
Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991)
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)
Pitts, A.M.: Evaluation logic. In: Birtwistle, G. (ed.) IVth Higher Order Workshop, Banff 1990. Workshops in Computing, pp. 162–189. Springer, Berlin (1991)
Plotkin, G.D.: LCF considered as a programming language. Theor. Comput. Sci. 5, 223–255 (1977)
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)
Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP’83, pp. 513–523. North-Holland, Amsterdam (1983)
Stärk, R., Schmid, J., Börger, E.: Java and the Java Virtual Machine—Definition, Verification, Validation. Springer, Berlin (2001)
Statman, R.: Logical relations and the typed lambda-calculus. Inf. Control 65, 85–97 (1985)
Striegnitz, J.: FACT!—the functional side of C++. http://www.fz-juelich.de/zam/FACT (2003)
Tait, W.W.: Intensional interpretation of functionals of finite type. J. Symb. Log. 32, 198–212 (1967)
Winskel, G.: The Formal Semantics of Programming Languages: An Introduction. MIT Press, Cambridge (1993)
Author information
Authors and Affiliations
Corresponding author
Additional information
Supported by EPSRC grant GR/S30450/01.
Rights 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
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-007-9062-1