Magic Sets vs. SLD-Resolution
It is by now folklore that the bottom-up evaluation of a program after the “magic set” transformation is “as efficient as” top-down evaluation. There are a number of formalizations of this in the literature. However, the naive formalization is false: As shown by Ross, SLD-resolution can be much more efficient than bottom-up evaluation with magic sets on tail-recursive programs.
We show that this happens only for tail-recursive programs, and that the only problem of magic sets is the materialization of “lemmas”. So magic sets are always “as goal-directed as” SLD-resolution. These results are not surprising, but we believe that the variants given here are especially useful for teaching purposes. We also give rather simple proofs.
Furthermore, we demonstrate that SLD-resolution can be directly simulated by bottom-up evaluable programs if all recursions are tail-recursive. This is based on the meta-interpreter approach of Bry and seems to be very promising.
Unable to display preview. Download preview PDF.
- F. Bancilhon and Ft. Ramakrishnan. An amateur’s introduction to recursive query processing. In C. Zaniolo, editor, Proc. of SIGMOD’86, pages 16–52, 1986.Google Scholar
- S. Greco and C. Zaniolo. Optimization of linear logic programs using counting methods. In A. Pirotte, C. Delobel, and G. Gottlob, editors, Advances in Database Technology — EDBT’92, 3rd Int. Conf., number 580 in LNCS, pages 72–87. Springer-Verlag, 1992.Google Scholar
- L. Kalinichenko and V. Zadorozhny. A generalized information resource query language and basic query evaluation technique. In C. Delobel, M. Kifer, and Y. Masunaga, editors, Deductive and Object-Oriented Databases, 2nd Int. Conf. (DOOD’91), number 566 in LNCS, pages 547–566. Springer, 1991.Google Scholar
- D. B. Kemp, K. Ramamohanarao, and Z. Somogyi. Right-, left- and multi-linear rule transformations that maintain context information. In D. McLeod, R. Sacks-Davis, and H. Schek, editors, Proc. Very Large Data Bases, 16th Int. Conf. (VLDB’90), pages 380–391. Morgan Kaufmann Publishers, 1990.Google Scholar
- R. Ramakrishnan and S. Sudarshan. Top-down vs. bottom-up revisited. In V. Saraswat and K. Ueda, editors, Proc. of the 1991 Int. Symposium on Logic Programming, pages 321–336. MIT Press, 1991.Google Scholar
- K. Ramamohanarao. An implementation overview of the Aditi deductive database system. In S. Ceri, K. Tanaka, and S. Tsur, editors, Deductive and Object-Oriented Databases, Third Int. Conf, (DOOD’93), number 760 in LNCS, pages 184–203. Springer, 1993.Google Scholar
- Y. Sagiv. Is there anything better than magic? In S. Debray and M. Hermenegildo, editors, Proc. of the North American Conf. on Logic Programming, pages 235–254. MIT Press, 1990.Google Scholar
- J. D. Ullman. Principles of Database and Knowledge-Base Systems, Vol. 2. Computer Science Press, 1989.Google Scholar