Abstract
Delaying-based tabling mechanisms, such as the one adopted in XSB, are non-linear in the sense that the computation state of delayed calls has to be preserved. In this paper, we present the implementation of a linear tabling mechanism. The key idea is to let a call execute from the backtracking point of a former variant call if such a call exists. The linear tabling mechanism has the following advantages over non-linear ones: (1) it is relatively easy to implement; (2) it imposes no overhead on standard Prolog programs; and (3) the cut operator works as for standard Prolog programs and thus it is possible to use the cut operator to express negation-as-failure and conditionals in tabled programs. The weakness of the linear mechanism is the necessity of re-computation for computing fix-points. However, we have found that re-computation can be avoided for a large portion of calls of directly-recursive tabled predicates. We have implemented the linear tabling mechanism in B-Prolog. Experimental comparison shows that B-Prolog is close in speed to XSB and outperforms XSB when re-computation can be avoided. Concerning space efficiency, B-Prolog is an order of magnitude better than XSB for some programs.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Bancilhon, F. and Ramakrishnan, R.: An Amateur’s Introduction to Recursive Query Processing Strategies, SIGMOD’86.
Chen, W. and Warren, D.S.: Tabled Evaluation with Delaying for General Logic Programs, J. ACM, Vol.43,No.1, 20–74, 1996.
Demoen, B. and Sagonas, K.: CAT: The Copying Approach to Tabling, Proceedings of PLILP’98, 1998.
Demoen, B. and Sagonas, K.: CHAT: The Copy-Hybrid Approach to Tabling, Proceedings of PADL’99, LNCS 1551, pp.106–121, 1999.
Fa, C.G. and Dietrich, S.W.: Extension Table Built-ins for Prolog, Software Practice and Experience, Vol.22,No.7, 573–597, 1992.
Lloyd, J.W.: Foundations of Logic Programming, Springer-Verlag, 1987.
Parker, D.S., Carey, M. Jarke, M. Sciore, E. and Walker, A.: Logic Programming and Databases, Expert Database Systems, Kersobberg Larry, Ed., The Benjamin/Cummings Pub., 1986.
Sagonas, K. and Swift, T.: An Abstract Machine for Tabled Execution of Fixed-Order Stratified Logic Programs, ACM Transactions on Programming Languages and Systems. Vol.20,No.3, 1998.
Shen, Y.D., Yuan, L., You, J.H. and Zhou, N.F.: Linear Tabulated Resolution Based on Prolog Control Strategy, submitted for publication.
Ramakrishnan, I.V., Rao, P., Sagonas, K., Swift, T., and Warren, D.S.: Efficient Access Mechanisms for Tabled Logic Programs, J. Logic Programming, vol. 38, pp.31–54, 1998.
Tamaki, H. and Sato, T.: OLD Resolution with Tabulation, Proc. of the Third ICLP, LNCS 225, 84–98, 1986.
Warren, D.H.D.: An Abstract Prolog Instruction Set, Technical Report 309, SRI International, 1983.
Warren, D.S.: Memoing for Logic Programs, CACM, Vol.35,No.3, pp.93–111, 1992.
Zhou, N.F.: Parameter Passing and Control Stack Management in Prolog Implementation Revisited, ACM Transactions on Programming Languages and Systems, Vol.18,No.6, 752–779, 1996.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1999 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Zhou, NF., Shen, YD., Yuan, LY., You, JH. (1999). Implementation of a Linear Tabling Mechanism. In: Pontelli, E., Santos Costa, V. (eds) Practical Aspects of Declarative Languages. PADL 2000. Lecture Notes in Computer Science, vol 1753. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-46584-7_8
Download citation
DOI: https://doi.org/10.1007/3-540-46584-7_8
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-66992-0
Online ISBN: 978-3-540-46584-3
eBook Packages: Springer Book Archive