# Parallel algorithms for term matching

## Abstract

We present a new randomized parallel algorithm for term matching. Let n be the number of nodes of the directed acyclic graphs (dags) representing the terms to be matched, then our algorithm uses O(log^{2}n) parallel time and M(n) processors, where M(n) is the complexity of n by n matrix multiplication. The number of processors is a significant improvement over previously known bounds. Under various syntactic restrictions on the form of the input dags only O(n^{2}) processors are required in order to achieve deterministic O(log^{2}n) parallel time. Furthermore, we reduce directed graph reachability to term matching using constant parallel time and O(n^{2}) processors. This is strong evidence that in practice, taking M(n) to be n^{3}, no deterministic algorithm can beat the processor bound of our randomized algorithm. We also improve the lower bound of [DKM] on the unification problem. We show that unification is logspace-complete in PTIME even if both input terms are linear, i.e., no variable appears more than once in each term.

## Keywords

Span Tree Matrix Multiplication Parallel Algorithm Function Symbol Parallel Time## Preview

Unable to display preview. Download preview PDF.

## 5. References

- [A]Aggarwal, A., Chazelle, B., Guibas, L., O'Dunlaing, C., and Yap, C., "Parallel computational geometry",
*Proc. 26th IEEE FOCS*, 1985, pp. 468–478.Google Scholar - [CM]Clocksin, W.F., Mellish, C.S.,
*Programming in Prolog*, Springer-Verlag, 1981.Google Scholar - [CW]Coppersmith, D., and Winograd, S., "On the asymptotic complexity of matrix multiplication",
*SIAM J. Comput. 11*(1982), pp. 472–492.CrossRefGoogle Scholar - [DKM]Dwork, C., Kanellakis, P., Mitchell, J., "On the Sequential Nature of Unification",
*J. of Logic Programming 1*(1), pp.35–50.Google Scholar - [FW]Fortune, S., Wyllie, J., "Parallelism in Random Access Machines",
*Proc. 10th ACM STOC*, 1978, pp. 114–118.Google Scholar - [Ga]Galil, Z., "Optimal parallel algorithms for string matching",
*Proc. 16th ACM STOC*, 1984, pp. 240–248.Google Scholar - [GP]Galil, Z., and Pan., V., "Improved processor bounds for algebraic and combinatorial problems in RNC",
*Proc. 26th IEEE FOCS*, 1985, pp. 490–496.Google Scholar - [Go]Goldschlager, L.M., "The Monotone and Planar Circuit Value Problems are Log Space Complete for P",
*SIGACT News 9*(2), 1977, pp. 25–29.CrossRefGoogle Scholar - [HO]G. Huet, D. Oppen, "Equations and Rewrite Rules: A Survey", in:
*Formal Language Theory: Perspectives and Open Problems*, R.V. Book (ed), Academic Press, 1980.Google Scholar - [KUW]Karp, R. M., Upfal, E., and Wigderson, A., "Constructing a perfect matching is in random NC",
*Proc. 17th ACM STOC*, 1985, pp. 22–32.Google Scholar - [Ko]Kowalski, R., "Predicate Logic as a Programming Language".
*Proceedings IFIP 74*, 1974, pp. 569–574.Google Scholar - [MK]Maluszynski J., Komorowski H.J., "Unification-free Execution of Horn-clause Programs",
*Proc. 2nd Logic Programming Symposium*, IEEE, July 1985.Google Scholar - [M]Milner, R., "A Theory of Type Polymorphism in Programming",
*JCSS 17*, 1978, pp. 348–375.Google Scholar - [PR]Pan, V., and Reif, J., "Efficient parallel solution of linear systems",
*Proc. 17th ACM STOC*, 1985, pp. 143–152.Google Scholar - [PW]Paterson, M.S., Wegman, M.N., "Linear Unification",
*JCSS 16*, 1978, pp.158–167.Google Scholar - [Ra]Rabin, M.O., "Probabilistic algorithm for testing primality",
*J. Number Theory 12*(1980), pp. 128–138.CrossRefGoogle Scholar - [Re]Reif, J., "Optimal parallel algorithms for integer sorting and graph connectivity",
*Proc. 26th IEEE FOCS*, 1985, pp.496–505.Google Scholar - [R]Robinson, J.A., "A Machine Oriented Logic Based on the Resolution Principle",
*JACM 12*(1), 1965, pp. 23–41.CrossRefGoogle Scholar - [S]Schwartz, J.T., "Fast Probabilistic Algorithms for Verification of Polynomial Identities",
*JACM 27*(4), 1980, pp. 701–717.CrossRefGoogle Scholar - [St]Strassen, V., "Gaussian elimination is not optimal",
*Numerische Mathematik 13*(1969), pp. 354–356.Google Scholar - [TV]Tarjan, R.E., and Vishkin, U., "Finding biconnected components and computing tree functions in logarithmic parallel time",
*Proc. 25th IEEE FOCS*, 1984, pp. 12–20.Google Scholar - [Vi]Vishkin, U., "Randomized speed-ups in parallel computation",
*Proc. 16th ACM STOC*, 1984, pp. 230–239.Google Scholar - [VS]Vitter, J.S., and Simons, R., "New classes for parallel complexity: a study of unification and other complete problems for P",
*IEEE Trans. on Computers*, to appear.Google Scholar - [Ya]Yasuura, H., "On the Parallel Computational Complexity of Unification", Yajima Lab., Research Report, ER 83-01, Oct. 1983.Google Scholar