Summary
Using the program transformation technique we derive some algorithms for evaluating linear recurrence relations in logarithmic time. The particular case of the Fibonacci function is first considered and a comparison with the conventional matrix exponentiation algorithm is made. This comparison allows us also to contrast the transformation technique and the stepwise refinement technique underlining some interesting features of the former one. Through the examples given we also explain why those features are interesting for a useful and reliable program construction methodology.
Similar content being viewed by others
References
Arsac, J., Kodratoff, Y.: Some techniques for recursion removal from recursive functions. ACM Trans. Progr. Lang. Syst. 4, 2, 295–322 (1982)
Aubin, A.: Mechanizing structural induction: Part I and II. Theor. Comput. Sci. 9, 3, 329–362 (1979)
Backus, J.: Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. CACM 21, 8, 613–641 (1978)
Bauer, F.L., Broy, M., Partsch, H., Pepper, P., Wössner, H.: Systematics of transformation rules, TUM-INT-BER-77-12-0350. München: Institut für Informatik, Technische Universität, 1978
Bauer, F.L., Partsch, H., Pepper, P., Wössner, H.: Notes on the project CIP: outline of a transformation system, TUM-INFO-7729. München: Institut für Informatik, Technische Universität, 1977
Bauer, F.L. and Wössner, H.: Algorithmic language and program development. Berlin, Heidelberg, New York: Springer 1981
Broy, M., Krieg-Brückner, B.: Derivation of invariant assertions during program development by transformation. ACM Trans. Progr. Lang. Syst. 2, 3, 321–337 (1980)
Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. JACM 24, 1, 44–67 (1977)
Burstall, R.M., Feather, M.: Program development by transformation: an overview. Proc. ‘Les Fondements de la Programmation’. Amirchahy, M., Neel, D. (eds.) Toulouse, pp. 45–55. IRIASEFI, France 1977
Chatelin, P.: Self-redefinition as a program manipulation strategy. Proc. Symp. Artif. Intellig. Progr. Lang. ACM SIGPLAN Notices and SIGART Newsletter, 174–179 (1977)
Cohen, N.H.: Source-to-source improvement of recursive programs. Ph. D. Thesis, Harvard University, TR. 13–80, Aiken Computation Lab., Cambridge, MA, 1980
Dahl, O-J., Dijkstra, E.W., Hoare, C.A.R.: Structured Programming. London: Academic Press 1972
Darlington, J., Burstall, R.M.: A system which automatically improves programs. Acta Informat. 6, 41–60 (1976)
Feather, M.S.: ZAP program transformation system: Primer and user manual, DAI Research Report No. 54, Dept. of Artificial Intelligence, University of Edinburgh, 1978
Feather, M.S.: A system for developing programs by transformation. Ph. D. Thesis, University of Edinburgh, 1979
Feather, M.S.: A system for assisting program transformation. ACM Trans. Progr. Lang. Syst. 4, 1, 1–20 (1982)
Floyd, R.W.: The paradigms of programming. CACM 22, 8, 455–460 (1979)
Gries, D., Levin, G.: Computing Fibonacci Numbers (and similarly defined functions) in log time. Info. Proc. Lett. 10, 68–75 (1980)
Hoggatt, V.E. Jr.: Fibonacci and Lucas Numbers. Boston: Houghton Mifflin Co. 1969
Huet, G., Lang, B.: Proving and applying program transformations expressed with second-order patterns. Acta Informat. 11, 31–55 (1978)
Kott, L.: About transformation system: A theoretical study. 3ème Colloque International sur la Programmation, 232–247, Dunod, Paris 1978
Liu, C.L.: Introduction to Combinatorial Mathematics. McGraw-Hill 1968
Partsch, H., Pepper, P.: Program transformations on different levels of programming, TUM-INFO-7715. München: Institut für Informatik, Technische Universität, 1977
Partsch, H., Steinbrüggen, R.: A comprehensive survey on program transformation systems, TUM 18108. München: Institut für Informatik, Technische Universität, 1981
Pettorossi, A.: Improving memory utilization in transforming programs. MFCS, Zakopane, Poland. Lecture Notes in Computer Science n. 64, 416–425. Berlin-Heidelberg-New York: Springer, 1978
Pettorossi, A.: Transformation of programs and use of “tupling strategy”. Proc. of Informatica '77 Conference, Bled, Yugoslavia, 3-103, 1–6 (1977)
Pettorossi, A.: Derivation of an 0 (k 2log n) algorithm for computing order-k Fibonacci numbers from the 0 (k 3log n) matrix multiplication method. Info. Proc. Lett. 11, 4, 5, 172–179 (1980)
Schwarz, J.: Verifying the safe use of destructive operations in applicative programs. 3ème Colloque International sur la Programmation, pp. 394–410, Dunod, Paris 1978
Steinbrüggen, R.: Equivalent recursive definitions of certain number theoretical functions, TUMINFO-7714. München: Institut für Informatik, Technische Universität, 1977
Urbanek, F.J.: An 0 (log n) algorithm for computing the nth element of the solution of a difference equation. Info. Proc. Lett. 11, 2, 66–67 (1980)
Walker, S.A. and Strong, H.R.: Characterizations of flowchartable recursions. Proc. 4th ACM Conference on Theory of Computing, Denver, Colorado, pp. 18–34, 1972
Wand, M.: Continuation-based program transformation strategies. JACM 27, 1, 164–180 (1980)
Wegbreit, B.: Goal-directed program transformation. IEEE Trans. Software Eng. SE-2, 69–79 (1976)
Wilson, T.C., Shortt, J.: An 0 (log n) algorithm for computing general order-k Fibonacci numbers. Info. Proc. Lett. 10, 2, 68–75 (1980)
Wirth, N.: Program development by stepwise refinement. CACM 14, 4, 221–227 (1971)
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Pettorossi, A., Burstall, R.M. Deriving very efficient algorithms for evaluating linear recurrence relations using the program transformation technique. Acta Informatica 18, 181–206 (1982). https://doi.org/10.1007/BF00264438
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00264438