skip to main content
article
Open access

An abstract machine for tabled execution of fixed-order stratified logic programs

Published: 01 May 1998 Publication History

Abstract

SLG resolution uses tabling to evaluate nonfloundering normal logic pr ograms according to the well-founded semantics. The SLG-WAM, which forms the engine of the XSB system, can compute in-memory recursive queries an order of magnitute faster than current deductive databases. At the same time, the SLG-WAM tightly intergrates Prolog code with tabled SLG code, and executes Prolog code with minimal overhead compared to the WAM. As a result, the SLG-WAM brings to logic programming important termination and complexity properties of deductive databases. This article describes the architecture of the SLG-WAM for a powerful class of programs, the class of fixed-order dynamically stratified programs. We offer a detailed description of the algorithms, data structures, and instructions that the SLG-WAM adds to the WAM, and a performance analysis of engine overhead due to the extensions.

References

[1]
AYT-I(ACI, H. 1991. Warren's Abstract Machine: A Tutorial Reconstruction. The HIT Press, Cambridge, Mass.
[2]
CHEN, W., SWIFT, T., AND WARREN, D. S. 1995. Efficient top-down computation of queries under the well-founded semantics. J. Logic Program. 24, 3 (Sept.), 161-199.
[3]
CHEN, W. AND WARREN, D. S. 1996. Tabled evaluation with delaying for general logic programs. J. ACM 43, 1 (Jan.), 20-74.
[4]
CODISH, M., DEMOEN, B., AND SAGONAS, I~. 1996. Semantics-based program analysis for logicbased languages using XSB. Tech. Rep. CW 245, Katholieke Universiteit Leuven, Heverlee Belgium.
[5]
CORMEN, W., LEISERSON, C., AND RIVEST, R. 1990. Introduction to Algorithms. The HIT Press, Cambridge, Mass.
[6]
DAWSON, S., RAMAKRISHNAN, C. R., AND WARREN, D. S. 1996. Practical program analysis using general purpose logic programming systems--A case study. In Proceedings of the A CM SIG- PLAN Conference on Programming Language Design and Implementation. ACM Press, New York, 117-126.
[7]
DIETRICH, S. 1987. Extension tables for recursive query evaluation. Ph.D. thesis, Dept. of Computer Science, SUNY at Stony Brook, Stony Brook, New York.
[8]
FREIRE, J., SWIFT, T., AND WARREN, D. S. 1996. Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. In Proceedings of the 8th International Symposium on PLILP, H. Kuchen and S. D. Swierstra, Eds. Lecture Notes in Computer Science, vol. 1140. Springer-Verlag, Berlin, Germany, 243-258.
[9]
FREIRE, J., SWIFT, T., AND WARREN, D. S. 1997. Treating I/O seriously: Resolution reconsidered for disk. In Proceedings of the 14th International Conference on Logic Programming, L. Naish, Ed. The MIT Press, Cambridge, Mass., 198-212.
[10]
LARSON, R., WARREN, D. S., FREIRE, J., GOMEZ, O. P., AND SAGONAS, K. 1997. Semantica. The MIT Press, Cambridge, Mass.
[11]
LARSON, R., WARREN, D. S., FREIRE, J., AND SAGONAS, K. 1996. Syntactica. The MIT Press, Cambridge, Mass.
[12]
LLOYD, J. W. 1987. Foundations of Logic Programming, 2nd ed. Springer-Verlag, Berlin, Germany.
[13]
PRZYMUSINSKI, T. C. 1989. Every logic program has a natural stratification and an iterated least fixed point model. In Proceedings of the 8th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems. ACM Press, New York, 11-21.
[14]
RAMAKRISHNA, Y. S., RAMAKRISHNAN, C. R., RAMAKRISHNAN, I. V., SMOLKA, S. A., SWIFT, T., AND WARREN, D. S. 1997. Efficient model checking using tabled resolution. In Proceedings of the 9th International Conference on Computer-Aided Verification, O. Grumberg, Ed. Lecture Notes in Computer Science, vol. 1254. Springer-Verlag, Berlin, Germany, 143-154.
[15]
RAMAKRISHNAN, I. V., RAO, P., SAGONAS, K., SWIFT, T., AND WARREN, D. S. 1995. Efficient tabling mechanisms for logic programs. In Proceedings of the 12th International Conference on Logic Programming, L. Sterling, Ed. The MIT Press, Cambridge, Mass., 687-711.
[16]
RAMAKRISHNAN, R., SRIVASTAVA, D., AND SUDARSHAN, S. 1992a. Controlling the search in bottomup evaluation. In Proceedings of the Joint International Conference and Symposium on Logic Programming, K. Apt, Ed. The MIT Press, Cambridge, Mass., 273-287.
[17]
RAMAKRISHNAN, R., SRIVASTAVA, D., AND SUDARSHAN, S. 1992b. CORAL--Control, Relations, and Logic. In Proceedings of the 18th Conference on Very Large Data Bases. Morgan-Kaufmann, San Mateo, Calif., 238-249.
[18]
RAMESH, R. AND CHEN, W. 1997. Implementation of tabled evaluation with delaying in Prolog. IEEE Trans. on Knowl. and Data Eng. 9, 4 (July/Aug.), 559-574.
[19]
RAO, P., RAMAKRISHNAN, C. R., AND RAMAKRISHNAN, I. V. 1996. A thread in time saves tabling time. In Proceedings of the Joint International Conference and Symposium on Logic Programruing, M. Maher, Ed. The MIT Press, Cambridge, Mass., 112-126.
[20]
Ross, K. A. 1994. Modular stratification and magic sets for Datalog programs with negation. J. ACM 41, 6 (Nov.), 1216-1266.
[21]
SAGONAS, K., SWIFT, T., AND WARREN, D. S. 1994. XSB as an efficient deductive database engine. In Proceedings of the A CM SIGMOD International Conference on the Management of Data. ACM Press, New York, 442-453.
[22]
SAGONAS, K., SWIFT, T., AND WARREN, D. S. 1996a. An abstract machine for computing the wellfounded semantics. In Joint International Conference and Symposium on Logic Programming, M. Maher, Ed. The MIT Press, Cambridge, Mass., 274-288.
[23]
SAGONAS, K., SWIFT, T., AND WARREN, D. S. 1996b. The limits of fixed-order computation. In Proceedings of the International Workshop on Logic in Databases, D. Pedreschi and C. Zaniolo, Eds. Lecture Notes in Computer Science, vol. 1154. Springer-Verlag, Berlin, Germany, 343-363.
[24]
SWIFT, T. 1994. Efficient evaluation of normal logic programs. Ph.D. thesis, Dept. of Computer Science, SUNY at Stony Brook, Stony Brook, New York.
[25]
SWIFT, T. AND WARREN, D. S. 1994. Analysis of SLG-WAM evaluation of definite programs. In Proceedings of the 1994 International Symposium on Logic Programming, M. Bruynooghe, Ed. The MIT Press, Cambridge, Mass., 219-235.
[26]
TAMAKI, H. AND SATO, T. 1986. OLD resolution with tabulation. In Proceedings of the 3rd International Conference on Logic Programming, E. Shapiro, Ed. Lecture Notes in Computer Science, vol. 225. Springer-Verlag, Berlin Germany, 84-98.
[27]
TAYLOR, t. 1991. High performance Prolog implementation. Ph.D. thesis, Dept. of Computer Science, University of Sidney, Sidney, Australia.
[28]
WICK, E. 1988. Memory Performance of Prolog Architectures. Kluwer Academic Publishers.
[29]
VAN GELDER, t. 1989. Negation as failure using tight derivations for general logic programs. J. Logic Program. 6, 1/2 (Jan./Mar.), 109-134.
[30]
VAN GELDER, A., Ross, K. A., AND SCHLIPF, J. S. 1991. The well-founded semantics for general logic programs. J. ACM 38, 3 (July), 620-650.
[31]
VAN ROY, P. 1990. Can logic programming execute as fast as imperative programming? Ph.D. thesis, Computer Science Division, University of California at Berkeley.
[32]
VAN ROY, P. 1994. 1983-1993: The wonder years of sequential Prolog implementation. J. Logic Program. 19/20, 385-441.
[33]
VARDI, M. 1982. The complexity of relational query languages. In Proceedings of the l~th Annual ACM Symposium on the Theory of Computing. ACM, New York, 137-146.
[34]
VIEILLE, L. 1989. Recursive query processing: The power of logic. Theor. Comput. Sci. 69, 1 (Dec.), 1-53.
[35]
WARREN, D. H. D. 1983. An Abstract Prolog instruction set. Tech. Rep. 309, SRI International, Menlo Park, Calif.
[36]
WARREN, D. H. D. 1987. The SRI model for or-parallel execution of Prolog--abstract design and implementation issues. In Proceedings of the 1987 Symposium on Logic Programming. IEEE Computer Science Press, Los Alamitos, Calif., 92-102.
[37]
WARREN, D. S. 1984. Efficient Prolog memory management for flexible control strategies. In Proceedings of the 1984 Symposium on Logic Programming. IEEE Computer Science Press, Los Alamitos, Calif., 198-202.

Cited By

View all
  • (2022)Parallel Logic Programming: A SequelTheory and Practice of Logic Programming10.1017/S147106842200005922:6(905-973)Online publication date: 28-Mar-2022
  • (2020)Frame-level Bit Allocation Optimization Based on Video Content Characteristics for HEVCACM Transactions on Multimedia Computing, Communications, and Applications10.1145/338082716:1(1-20)Online publication date: 4-Mar-2020
  • (2020)Exploring Deep Learning for View-Based 3D Model RetrievalACM Transactions on Multimedia Computing, Communications, and Applications10.1145/337787616:1(1-21)Online publication date: 17-Feb-2020
  • Show More Cited By

Recommendations

Reviews

Hans J. Schneider

The standard implementation of Prolog by SLDNF resolution results in lack of termination and also results in exponential complexity. SLG resolution (linear resolution with a selection function for general logic programs) is an alternative approach that uses tables to store intermediate results. This paper reports on such a system, which brings the termination and complexity properties of deductive databases to logic programming. The system is based on Warren's abstract machine (WAM). After motivating the approach, the authors present terminology and basic definitions of SLG resolution in section 2. The tabling technique is explained using an example. Operations to implement definite programs are introduced on an intuitive level. Section 3 starts by presenting the operations to implement tabling. Next, the authors consider the interfaces between table space and runtime stacks and discuss a special evaluation strategy, batched evaluation. The main part of the paper ends by defining the extension to WAM's instruction set formally and describing some implementation aspects in detail. Sections 4 through 6 extend the previous results to a rather powerful class of programs allowing negation, that is, fixed-order (left-to-right) dynamically stratified programs. The authors show that this class can be efficiently evaluated with small modifications of the definite machine model. Finally, some benchmark tests show that the overhead imposed on Prolog programs that do not include tabled predicates is small. This clearly written research contribution assumes that readers have some knowledge of implementing logic programming languages.

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 20, Issue 3
May 1998
248 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/291889
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 May 1998
Published in TOPLAS Volume 20, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. SLG
  2. WAM
  3. memoing
  4. prolog
  5. stratification theories
  6. tabling

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)66
  • Downloads (Last 6 weeks)8
Reflects downloads up to 19 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2022)Parallel Logic Programming: A SequelTheory and Practice of Logic Programming10.1017/S147106842200005922:6(905-973)Online publication date: 28-Mar-2022
  • (2020)Frame-level Bit Allocation Optimization Based on Video Content Characteristics for HEVCACM Transactions on Multimedia Computing, Communications, and Applications10.1145/338082716:1(1-20)Online publication date: 4-Mar-2020
  • (2020)Exploring Deep Learning for View-Based 3D Model RetrievalACM Transactions on Multimedia Computing, Communications, and Applications10.1145/337787616:1(1-21)Online publication date: 17-Feb-2020
  • (2020)A Deep Learning Approach for Face Hallucination Guided by Facial Boundary ResponsesACM Transactions on Multimedia Computing, Communications, and Applications10.1145/337787416:1(1-23)Online publication date: 4-Mar-2020
  • (2020)Spatio-temporal Segmentation Based Adaptive Compression of Dynamic Mesh SequencesACM Transactions on Multimedia Computing, Communications, and Applications10.1145/337747516:1(1-24)Online publication date: 4-Mar-2020
  • (2018)Table space designs for implicit and explicit concurrent tabled evaluationTheory and Practice of Logic Programming10.1017/S147106841800039X18:5-6(950-992)Online publication date: 27-Jul-2018
  • (2017)On the Implementation of a Cloud-Based Computing Test Bench Environment for Prolog SystemsInformation10.3390/info80401298:4(129)Online publication date: 19-Oct-2017
  • (2015)Forest logging: A trace-based analysis of�large rule-based computationsSemantic Web10.3233/SW-1401446:5(427-449)Online publication date: 7-Aug-2015
  • (2015)Batched Evaluation of Full-Sharing Multithreaded TablingLanguages, Applications and Technologies10.1007/978-3-319-27653-3_11(113-124)Online publication date: 24-Dec-2015
  • (2014)Terminating Evaluation of Logic Programs with Finite Three-Valued ModelsACM Transactions on Computational Logic10.1145/262933715:4(1-38)Online publication date: 12-Sep-2014
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media