Advertisement

On the use of elements of functional programming in program development by transformations

  • Rudolf Berghammer
  • Herbert Ehler
Part III. Case Studies in Development
  • 112 Downloads
Part of the Lecture Notes in Computer Science book series (LNCS, volume 544)

Abstract

In this paper we have demonstrated the use of elements of functional programming such as currying, tupling, and fusion in the context of transformational program development. Formal transformation rules have been given which allow the introduction (or also the elimination) of such elements into programs that are subject to a development. For the proof of any of these rules computational respectively transformational induction has been applied. These two induction principles have both been formulated on the syntactic level. Very often this eases the application of these induction principles as no reference to the underlying formal semantics is needed. If the program development is supposed to be done in a formal calculus (as e.g., in [Pepper 84] or [Bauer et al. 87]), then this is an essential aspect.

The given transformation rules for currying, tupling, and fusion can, on one side, be used if the development aims at a functional program in an FP-like style (cf. [Backus 78]) but, on the other side, also for pure efficiency reasons. Example 1 and Example 2 of the paper demonstrate the efficiency improvement by tupling. Furthermore, function composition with specific functional expressions, viz. abstraction and representation expressions, has lead to the rule RANGE which expresses a change of data type. Finally, in Example 3 a combination of the various rules is demonstrated.

Keywords

Transformation Rule Functional Programming Fibonacci Number Input Program Output Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Arsac Kodratoff 82]
    Arsac J., Kodratoff Y.: Some techniques for recursion removal for recursive functions. ACM TOPLAS 4, 2, 295–322 (1982)Google Scholar
  2. [Backus 78]
    Backus J. W.: Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. Comm. ACM 21, 8, 613–641 (1978)Google Scholar
  3. [Bauer et al. 85]
    Bauer F. L. et al.: The Munich project CIP. Volume I: The wide spectrum language CIP-L. LNCS 183, Springer: Berlin-Heidelberg-New York (1985)Google Scholar
  4. [Bauer et al. 87]
    Bauer F. L. et al.: The Munich project CIP. Volume II: The transformation system CIP-S. LNCS 292, Springer: Berlin-Heidelberg-New York (1987)Google Scholar
  5. [Bauer Wössner 81]
    Bauer F. L., Wössner H.: Algorithmische Sprache und Programmentwicklung. Springer: Berlin-Heidelberg-New York (1981) Engl. Version: Algorithmic language and program development. Springer: Berlin-Heidelberg-New York (1982)Google Scholar
  6. [Berghammer 85]
    Berghammer R.: On the use of composition in transformational programming. Report TUM-I8512, Institut für Informatik, TU München (1985) Also in: Proc. TC 2 Working Conference on Program Specification and Transformation, April 15–17, 1986, Bad Tölz, F.R.G., North-Holland: Amsterdam, 221–242 (1987)Google Scholar
  7. [Berghammer 86]
    Berghammer R.: A transformational development of several algorithms for testing the existence of cycles in a directed graph. Report TUM-I8615, Institut für Informatik, TU München (1986)Google Scholar
  8. [Berghammer 90]
    Berghammer R.: Transformational programming with non-deterministic and higher-order constructs. In preparationGoogle Scholar
  9. [Bird 84]
    Bird R.: The promotion and accumulation strategies in transformational programming. ACM TOPLAS 6, 4, 487–504 (1984)Google Scholar
  10. [Broy 84]
    Broy M.: Algebraic methods for program construction: the project CIP. Report on a Workshop on Program Transformation and Programming Environments, September 12–16, 1983, Munich, F.R.G., NATO ASI Series F: Computer and System Sciences, Vol 8, Springer: Berlin-Heidelberg-New York, 199–222 (1984)Google Scholar
  11. [Burstall Darlington 77]
    Burstall R. M., Darlington J.: A transformation system for developing recursive programs. Journal ACM 24, 1, 44–67 (1977)Google Scholar
  12. [Curry Feys 58]
    Curry H. B., Feys R.: Combinatoric logic, Volume I. North-Holland: Amsterdam (1958)Google Scholar
  13. [Feather 86]
    Feather M. S.: A survey and classification of some program transformation techniques. Proc. TC 2 Working Conference on Program Specification and Transformation, April 15–17,1986, Bad Tölz, F.R.G., North-Holland: Amsterdam, 165–195 (1987)Google Scholar
  14. [Harrison 88]
    Harrison P. G.: Linearisation: An optimisation for nonlinear functional programs. Science of Computer Programming 10, 281–318 (1988)Google Scholar
  15. [Hoare 72]
    Hoare C. A. R.: Proof of correctness of data representation. Acta Informatica 1, 271–278 (1972)Google Scholar
  16. [Loeckx Sieber 84]
    Loeckx J., Sieber K.: The foundations of program verification. Teubner: Stuttgart (1984)Google Scholar
  17. [Manna 74]
    Manna Z.: Mathematical theory of computation. McGraw-Hill: New York (1974)Google Scholar
  18. [Partsch 85]
    Partsch H.: Transformational program development in a particular problem domain. Habilitationsschrift, Institut für Informatik, TU München (1985) Also in: Science of Computer programming 7, 99–241 (1986)Google Scholar
  19. [Pepper 84]
    Pepper P.: A simple calculus for program transformations (inclusive of induction). Report TUM-I8409, Institut für Informatik, TU München (1984) Also in: Science of Computer Programming 9, 221–262 (1987)Google Scholar
  20. [Pettorossi 84]
    Pettorossi A.: A powerful strategy for deriving efficient programs by transformation. Symp. on LISP and Functional Programming, Austin (Texas), ACM, 273–281 (1984)Google Scholar
  21. [Stoy 77]
    Stoy J. E.: Denotational semantics: The Scott-Strachey approach to programming language theory. MIT Press: Cambridge (1977)Google Scholar
  22. [Zierer 88]
    Zierer H.: Programmierung mit Funktionsobjekten: Konstruktive Erzeugung semantischer Bereiche und Anwendung auf die partielle Auswertung. Dissertation, Institut für Informatik, TU München (1988)Google Scholar
  23. [Zierer Schmidt Berghammer 87]
    Zierer H., Schmidt G., Berghammer R.: An interactive graphical manipulation system for higher objects based on relation algebra. In: Tinhofer G., Schmidt G. (eds.): Proc. 12th Conf. on Graphtheoretic Concepts in Computer Science. Bernried/Starnberger See, June 17–19, 1986, LNCS 246, Springer: Berlin-Heidelberg-New York, 68–81Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Rudolf Berghammer
    • 1
  • Herbert Ehler
    • 2
  1. 1.Fakultät für InformatikUniversität der Bundeswehr MünchenNeubiberg
  2. 2.Institut für InformatikTechnische Universität MünchenMünchen 2

Personalised recommendations