Term matching on parallel computers

  • R. Ramesh
  • R. M. Verma
  • T. Krishnaprasad
  • I. V. Ramakrishnan
Parallel And Distributed Computing
Part of the Lecture Notes in Computer Science book series (LNCS, volume 267)


Term matching is an important problem that arises very often in term rewriting and in functional and equational programming. In this paper, we present a new parallel algorithm for the term-matching problem on the EREW (Exclusive Read Exclusive Write) model of parallel computation. Our algorithm assumes a string representation of the two terms as its input. The string representation is first transformed into two labeled ordered trees and term matching is then performed on these two trees. If n is the length of the input terms then for any constant , (0<#x2208;≤1) our algorithm uses O(n1−∈) processors and takes O(nεlog n) time. If ε=0 the same algorithm will run in O(log2n) time. The only other known parallel algorithm for this problem is due to Dwork, Kanellakis and Stockmeyer that requires O(n2) processors and takes either O(log n) or O(log2n) time. However, their algorithm uses the stronger CREW (Concurrent Read Exclusive Write) model of parallel computation and assumes a DAG (Directed Acyclic Graph) representation of the two terms as its input. The techniques used in our algorithm are novel and have wide applicability.


Parallel Algorithm Function Symbol Label Tree Input Term Term Match 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. V. Aho and M. V. Ganapathi, Efficient Tree Pattern Matching: an Aid to Code Generation, Proceedings of the Eleventh Annual ACM Symposium on Principles of, Programming Languages pp. 334–340.Google Scholar
  2. [2]
    A. V. Aho, J. E. Hopcroft and J. D. Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley Reading, MA, 1974.Google Scholar
  3. [3]
    I. Bar-On and U. Vishkin, Optimal Parallel Generation of a Computation Tree Form, ACM Transactions on Programming Languages and Systems, Vol 7, No 2, April 1985, pp. 348–357.Google Scholar
  4. [4]
    R. P. Brent, The Parallel Evaluation of General Arithmetic Expressions, JACM 21,2 (1974), pp. 201–206.CrossRefGoogle Scholar
  5. [5]
    David R. Chase, An Improvement to Bottom-up Tree Pattern Matching, Fourteenth Annual ACM Symposium on Principles of Programming Languages Munich, West Germany, Jan 1987.Google Scholar
  6. [6]
    E. Dekel and S. Sahni, Parallel Generation of Postfix and Tree Forms, ACM Transactions on Programming Languages and Systems, Vol 5, No 3, (1983) pp. 300–317.Google Scholar
  7. [7]
    C. Dwork, P. Kanellakis and J. C. Mitchell, On the Sequential Nature of Unification, Journal of Logic Programming, 1, (1984) pp. 35–50.CrossRefGoogle Scholar
  8. [8]
    C. Dwork, P. Kanellakis and L. Stockmeyer, Parallel Algorithm for Term Matching, Eighth Conference on Automated Deduction July 1986, Oxford University, July 1986.Google Scholar
  9. [9]
    S. Fortune and J. Wyllie, Parallelism in Random Access Machines, Proceedings of Tenth ACM STOC, 1978 pp. 114–118.Google Scholar
  10. [10]
    C. M. Hoffman and M. J. O'Donnell, Pattern Matching in Trees, JACM 29, 1, 1982 pp. 68–95.CrossRefGoogle Scholar
  11. [11]
    D. S. Hirschberg, A. K. Chandra and D. V. Sarwate, Computing Connected Components on Parallel Computers, CACM, 22, 8 (1979), pp. 461–464.Google Scholar
  12. [12]
    C. P. Kruskal, L. Rudolph and M. Snir, Efficient Parallel Algorithms for Graph problems, Proceeding 1986 International Conference on Parallel Processing, pp. 180–185.Google Scholar
  13. [13]
    J. Maluszynski and H. J. Komorowski, Unification-Free Execution of Horn-Clause Programs, Proceedings of Second Logic Symposium, July 1985, pp. 78–86.Google Scholar
  14. [14]
    G. Miller and J. H. Reif, Parallel Tree Contraction and its Application, Proceedings of 26th IEEE FOCS Oct 1985, pp. 478–489.Google Scholar
  15. [15]
    D. Nath and S. N. Maheshwari, Parallel Algorithms for The Connected Components and Minimal Spanning Tree Problems, Information Processing Letters 12, 1 pp. 7–11.Google Scholar
  16. [16]
    M. S. Paterson and M. N. Wegman, Linear Unification JCSS, 16, (1978) pp. 158–167.Google Scholar
  17. [17]
    J. A. Robinson, A Machine Oriented Logic Based on The Resolution Principle, JACM, 12, (1965) pp. 23–41.CrossRefGoogle Scholar
  18. [18]
    R. E. Tarjan and U. Vishkin, Finding Bi-Connected Components and Computing Tree Functions in Logarithmic Parallel Time, Proceedings 25th IEEE FOCS 1984 pp. 12–20.Google Scholar
  19. [19]
    R. M. Verma, T. Krishnaprasad, I.V. Ramakrishnan, An Efficient Parallel Algorithm for Term Matching, Sixth International Conference on Foundations of Software Technology and Theoretical Computer Science, Lecture notes in Computer Science 241, Springer-Verlag, December 1986, pp. 504–518Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1987

Authors and Affiliations

  • R. Ramesh
    • 1
  • R. M. Verma
    • 1
  • T. Krishnaprasad
    • 1
  • I. V. Ramakrishnan
    • 1
  1. 1.Department of Computer ScienceState University of New York at Stony BrookStony Brook

Personalised recommendations