Skip to main content
Log in

Unifications, deunifications, and their complexity

  • Part I Computer Science
  • Published:
BIT Numerical Mathematics Aims and scope Submit manuscript

Abstract

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, even in the case when no function symbols are allowed (the Datalog unify-deunify problem). As the set union problem requires nonlinear time on a 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 Datalog unifications used in Prolog interpreters and show that some of them require even quadratic time in the worst case. Complementing these results, we show that if the number of variables occurring in one clause is bounded by a constant, then the Datalog unify-deunify problem can be solved in linear time.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. A. V. Aho, J. E. Hopcroft and J. D. Ullman:The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.

  2. J. R. Driscoll, N. Sarnak, D. D. Sleator and R. E. Tarjan:Making data structures persistent. Journal of Computer and System Sciences 38, 1 (February 1989), 86–124.

    Google Scholar 

  3. M. L. Fredman and M. E. Saks:The cell probe complexity of dynamic data structures. In: Proceedings of the 21st ACM Symposium on Theory of Computing, 1989, p. 345–354.

  4. H. N. Gabow and R. E. Tarjan:A linear-time algorithm for a special case of disjoint set union. Journal of Computer and System Sciences 30 (1985), 205–221.

    Google Scholar 

  5. C. J. Hogger:Introduction to Logic Programming. Academic Press, 1984.

  6. H. Mannila and E. Ukkonen:The set union problem with backtracking. In:Automata, Languages, and Programming, Thirteenth International Colloquium, Rennes, France, July 1986, Lecture Notes in Computer Science 226, Springer-Verlag 1986, p. 236–243.

  7. K. Mehlhorn, S. Näher and H. Alt:A lower bound for the complexity of the union/split/find problem. In:Automata, Languages, and Programming, Fourteenth International Colloquium, Karlsruhe, FRG, July 1987, Lecture Notes in Computer Science 267, Springer-Verlag 1987, p. 479–488.

  8. M. S. Paterson and M. N. Wegman:Linear unification. Journal of Computer and System Sciences 16 (1978), 158–167.

    Google Scholar 

  9. R. E. Tarjan:Efficiency of a good but not linear disjoint set union algorithm, J. ACM 22, 2 (April 1975), 215–225.

    Google Scholar 

  10. 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 

  11. R. E. Tarjan and J. van Leeuwen:Worst-case analysis of set union algorithms. J. ACM 31, 2 (April 1984), 245–281.

    Google Scholar 

  12. J. van Leeuwen and T. van der Weide:Alternative path compression techniques. Technical Report RUU-CS-77-3, Rijksuniversiteit Utrecht, Utrecht, The Netherlands.

  13. J. S. Vitter and R. A. Simons:New classes for parallel complexity: a study of unification and other complete problems for P. IEEE Transactions on Computers C-35, 5 (May 1986), 403–418.

    Google Scholar 

  14. D. H. D. Warren:Implementing Prolog — Compiling predicate logic programs. Research Reports 39 and 40, Department of Artificial Intelligence, University of Edinburgh, 1977.

  15. J. Westbrook and R. E. Tarjan:Amortized analysis for set union with backtracking. SIAM Journal of Computing 18, 1 (February 1989), 1–11.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

A preliminary version of this paper appeared in the Third International Conference on Logic Programming, London, July 1986. This work was supported by the Academy of Finland and by TEKES.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Mannila, H., Ukkonen, E. Unifications, deunifications, and their complexity. BIT 30, 599–619 (1990). https://doi.org/10.1007/BF01933209

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01933209

CR Categories

Navigation