On the complexity of unification sequences

Extended abstract
  • Heikki Mannila
  • Esko Ukkonen
Session 1b: Theory And Complexity
Part of the Lecture Notes in Computer Science book series (LNCS, volume 225)


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.

Unable to display preview. Download preview PDF.


  1. [AHU74]
    A.V. Aho, J.E. Hopcroft and J.D. Ullman: The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. [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
  3. [Ho84]
    C.J. Hogger: Introduction to Logic Programming. Academic Press, 1984.Google Scholar
  4. [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
  5. [PW78]
    M.S. Paterson and M.N. Wegman: Linear unification. Journal of Computer and System Sciences 16, 158–167.Google Scholar
  6. [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
  7. [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
  8. [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
  9. [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
  10. [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

Copyright information

© Springer-Verlag Berlin Heidelberg 1986

Authors and Affiliations

  • Heikki Mannila
    • 1
  • Esko Ukkonen
    • 1
  1. 1.Department of Computer ScienceUniversity of HelsinkiHelsinkiFinland

Personalised recommendations