Mechanical elimination of commutative redundancy

  • Hessam Khoshnevisan
  • Mohamad Afshar
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 864)


A technique to eliminate computational redundancy from a large and automatically detectable class of non-linear functions is introduced. It combines the advantages of existing memoisation and source-to-source program transformation techniques whilst greatly reducing the major disadvantages that are commonly associated with these two approaches. The method presented here uses a variant of memo-functions in which, regardless of the size of the memo-tables, the cost of table insertion and lookup operations are almost entirely eliminated. When compared to contemporary program transformation schemes, the technique presented achieves comparable improvements in efficiency whilst being mechanical. In addition, this technique is more generally applicable and require less compile-time deductive capacity than the corresponding program transformation schemes.

More precisely, the paper outlines a new technique for eliminating commutative redundancy from bilinear functions using local transient memo-lists instead of global memo-tables. Function evaluation is carried out in a bottom-up manner in which the results of inner nodes of the dependency graph are calculated first, and then only passed to those nodes higher-up in the graph that require them. In this way memo-lists “ripple” out from the inner nodes, and are subsequently used to generate new memo-lists for the next ripple. This technique overcomes the management cost of memo-tables, since table insertions and look-ups are now replaced by a single list cons and head operations respectively. Furthermore, it has some scope for parallel evaluation.


function level reasoning memoisation program transformation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    J W Backus. Can programming be liberated from the von neumann style? Communications of the ACM, 21(8):613–641, 1978.CrossRefGoogle Scholar
  2. 2.
    J W Backus. The algebra of functional programs: function level reasoning, linear equations and extended definitions, volume 107, chapter 1, pages 1–43. Springer-Verlag, 1981.Google Scholar
  3. 3.
    R Bailey, A J Field, and H Khoshnevisan. Efficient implementation of functional programs. Research Report, Imperial College, 1986.Google Scholar
  4. 4.
    R S Bird. Tabulation techniques for recursive programs. ACM Computing Surveys, 12(4):403–417, 1980.CrossRefGoogle Scholar
  5. 5.
    R S Bird. Improving programs by the introduction of recursion. Communications of the ACM, 20(1):856–863, 77.Google Scholar
  6. 6.
    R M Burstall and J D Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1), 1977.Google Scholar
  7. 7.
    N H Cohen. Eliminating redundant recursive calls. ACM Transactions on Programming Languages and Systems, 5:265–269, 1983.CrossRefGoogle Scholar
  8. 8.
    J Darlington. A synthesis of several sorting programs. Acta Informatica, 11(1), 1978.Google Scholar
  9. 9.
    P G Harrison, and H Khoshnevisan. The mechanical transformation of data types. The Computer Journal, 35(2):138–146, 1992.CrossRefGoogle Scholar
  10. 10.
    P G Harrison, and H Khoshnevisan. A new approach to recursion removal. Theoretical Computer Science, 93:91–113, 1992.CrossRefGoogle Scholar
  11. 11.
    P G Harrison, and H Khoshnevisan. On the synthesis of function inverses. Acta Informatica, 29:211–239, 1992.CrossRefGoogle Scholar
  12. 12.
    H Khoshnevisan. Efficient memo-table management strategies. Acta Informatica, 28:43–81, 1990.Google Scholar
  13. 13.
    M S Paterson, and C E Hewitt. Comparative schematology, record of project mac. In Proceedings: Conference on Concurrent Systems and Parallel Computation, Woods Hole, Mass, pages 119–127, June 1970.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  • Hessam Khoshnevisan
    • 1
  • Mohamad Afshar
    • 2
  1. 1.Department of ComputingImperial CollegeLondon
  2. 2.University of Cambridge Computer LaboratoryCambridge

Personalised recommendations