On the complexity of unification sequences
The execution of a Prolog program can be viewed as a sequence of unifications and backtracks over unifications. We study the time requirement of executing a sequence of such operations (the unify-deunify problem). It is shown that the well-known set union problem is reducible to this problem. As the set union problem requires nonlinear time on large class of algorithms, the same holds for the unify-deunify problem. Thus the linearity of single unifications does not give a complete picture of the time complexity of Prolog primitives. We discuss the methods for executing sequences of unifications used in Prolog interpreters and show that many of them require even quadratic time in the worst case. We also outline some theoretically better methods.
Unable to display preview. Download preview PDF.
- [AHU74]A.V. Aho, J.E. Hopcroft and J.D. Ullman: The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
- [GT83]H.N. Gabow and R.E. Tarjan: A linear-time algorithm for a special case of disjoint set union. STOC '83, 246–251.Google Scholar
- [Ho84]C.J. Hogger: Introduction to Logic Programming. Academic Press, 1984.Google Scholar
- [MU86]H. Mannila and E. Ukkonen: The set union problem with backtracking. Thirteenth International Colloquium on Automata, Languages, and Programming, Rennes, France, July 15–19, 1986 (ICALP 86), to appear.Google Scholar
- [PW78]M.S. Paterson and M.N. Wegman: Linear unification. Journal of Computer and System Sciences 16, 158–167.Google Scholar
- [Ta75]R.E. Tarjan: Efficiency of a good but not linear disjoint set union algorithm. J. ACM 22, 2 (April 1975), 215–225.Google Scholar
- [Ta79]R.E. Tarjan: A class of algorithms which require nonlinear time to maintain disjoint sets. J. Computer and System Sciences 18 (1979), 110–127.Google Scholar
- [TvL84]R.E. Tarjan and J. van Leeuwen: Worst-case analysis of set union algorithms. J. ACM 31, 2 (April 1984), 245–281.Google Scholar
- [vLvW77]J. van Leeuwen and T. van der Weide: Alternative path compression techniques. Technical Report RUU-CS-77-3, Rijksuniversiteit Utrecht, Utrecht, The Netherlands.Google Scholar
- [VS84]J.S. Vitter and R.A. Simons: New classes for parallel complexity: a study of unification and other complete problems in P. Technical Report CS-84-06, Department of Computer Science, Brown University, 1984.Google Scholar