link.springer.com

Code Generation via Higher-Order Rewrite Systems

Abstract

We present the meta-theory behind the code generation facilities of Isabelle/HOL. To bridge the gap between the source (higher-order logic with type classes) and the many possible targets (functional programming languages), we introduce an intermediate language, Mini-Haskell. To relate the source and the intermediate language, both are given a semantics in terms of higher-order rewrite systems (HRSs). In a second step, type classes are removed from Mini-Haskell programs by means of a dictionary translation; we prove the correctness of this step. Building on equational logic also directly supports a simple but powerful algorithm and data refinement concept.

Preview

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Berghofer, S., Bulwahn, L., Haftmann, F.: Turning inductive into equational specifications. In: Urban, C. (ed.) TPHOLs 2009. LNCS, vol. 5674, pp. 131–146. Springer, Heidelberg (2009)

    Google Scholar 

  2. Berghofer, S., Nipkow, T.: Executing higher order logic. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, pp. 24–40. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  3. Berghofer, S., Nipkow, T.: Random testing in Isabelle/HOL. In: Second International Conference on SEFM 2004: Proc. of the Software Engineering and Formal Methods. IEEE Computer Society, Los Alamitos (2004)

    Google Scholar 

  4. Crow, J., Owre, S., Rushby, J., Shankar, N., Stringer-Calvert, D.: Evaluating, testing, and animating PVS specifications. Tech. rep., Computer Science Laboratory, SRI International (2001)

    Google Scholar 

  5. Greve, D.A., Kaufmann, M., Manolios, P., Moore, J.S., Ray, S., Ruiz-Reina, J.L., Sumners, R., Vroon, D., Wilding, M.: Efficient execution in an automated reasoning environment. Journal of Functional Programming 18(1), 15–46 (2007)

    Google Scholar 

  6. Haftmann, F.: Code generation from specifications in higher order logic. Ph.D. thesis, Technische Universität München (2009)

    Google Scholar 

  7. Hall, C., Hammond, K., Peyton Jones, S., Wadler, P.: Type classes in Haskell. ACM Transactions on Programming Languages and Systems 18(2) (1996)

    Google Scholar 

  8. Jones, C.B.: Systematic Software Development using VDM, 2nd edn. Prentice Hall International, Englewood Cliffs (1990)

    MATH  Google Scholar 

  9. Jones, M.P.: Qualified types: Theory and practice. Ph.D. thesis, University of Nottingham (1994)

    Google Scholar 

  10. Letouzey, P.: Programmation fonctionnelle certifiée – l’extraction de programmes dans l’assistant Coq. Ph.D. thesis, Université Paris-Sud (2004)

    Google Scholar 

  11. Letouzey, P.: Coq Extraction, an Overview. In: Beckmann, A., Dimitracopoulos, C., Löwe, B. (eds.) CiE 2008. LNCS, vol. 5028, pp. 359–369. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  12. Lochbihler, A.: Formalising FinFuns - generating code for functions as data from Isabelle/HOL. In: Urban, C. (ed.) TPHOLs 2009. LNCS, vol. 5674, pp. 310–326. Springer, Heidelberg (2009)

    Google Scholar 

  13. Mayr, R., Nipkow, T.: Higher-order rewrite systems and their confluence. Theor. Comput. Sci. 192, 3–29 (1998)

    Article  MATH  MathSciNet  Google Scholar 

  14. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL. LNCS, vol. 2283. Springer, Heidelberg (2002)

    MATH  Google Scholar 

  15. Nipkow, T., Prehofer, C.: Type checking type classes. In: Proc. 20th ACM Symp. Principles of Programming Languages. ACM Press, New York (1993)

    Google Scholar 

  16. Nipkow, T., Prehofer, C.: Type reconstruction for type classes. J. Functional Programming 5(2), 201–224 (1995)

    Article  MATH  MathSciNet  Google Scholar 

  17. Okasaki, C.: Catenable double-ended queues. In: Proc. Int. Conf. Functional Programming (ICFP 1997). ACM Press, New York (1997)

    Google Scholar 

  18. Schmidt-Schauß, M.: Computational aspects of an order-sorted logic with term declarations. LNAI 395. Springer (1989)

    MATH  Google Scholar 

  19. Thiemann, R., Sternagel, C.: Certification of termination proofs using CeTA. In: Urban, C. (ed.) TPHOLs 2009. LNCS, vol. 5674, pp. 452–468. Springer, Heidelberg (2009)

    Google Scholar 

  20. Wehr, S.: ML modules and Haskell type classes: A constructive comparison. Master’s thesis, Albert-Ludwigs-Universität, Freiburg (2005)

    Google Scholar 

  21. Wehr, S., Chakravarty, M.M.T.: ML modules and Haskell type classes: A constructive comparison. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 188–204. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

  1. Institut für Informatik, Technische Universität München,  

    Florian Haftmann & Tobias Nipkow

Authors

  1. Florian Haftmann

    You can also search for this author in PubMed Google Scholar

  2. Tobias Nipkow

    You can also search for this author in PubMed Google Scholar

Editor information

Editors and Affiliations

  1. Google, 20 West Kinzie Street, 60610, Chicago, IL, USA

    Matthias Blume

  2. Department of Computer and Mathematical Sciences, Tohoku University, 6-3-9 Aoba, Aramaki, Aoba-ku, Sendai-shi, 980-8579, Miyagi, Japan

    Naoki Kobayashi

  3. DSIC, MiST, Technical University of Valencia, Camino de Vera, S/N, 46022, Valencia, Spain

    Germán Vidal

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Haftmann, F., Nipkow, T. (2010). Code Generation via Higher-Order Rewrite Systems. In: Blume, M., Kobayashi, N., Vidal, G. (eds) Functional and Logic Programming. FLOPS 2010. Lecture Notes in Computer Science, vol 6009. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-12251-4_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-12251-4_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-12250-7

  • Online ISBN: 978-3-642-12251-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us