Abstract
Tabling, or memoization, enables incremental evaluation of logic programs. When the rules or facts of a program change, we need to recompute only those results that are affected by the changes. The current algorithms for incrementally maintaining memo tables treat insertion of facts/rules differently from their deletion. Hence these techniques cannot be directly applied for incremental evaluation of arbitrary tabled programs, especially those involving Prolog builtins such as findall, other aggregation operations, or non-stratified negation. In this paper, we explore a simpler incremental evaluation algorithm that, based on the dynamic call graph, invalidates and re-evaluates entire calls. The algorithm is agnostic to whether a dependency adds or removes answers from tables, and hence can be applied uniformly to programs with negation, even when the negation is implicit (as is the case with certain aggregation operations). We find that the call-based algorithm is very effective in examples where the call dependencies are largely acyclic (e.g. dynamic programming examples) and is moderately effective when the dependencies contain independent cyclic components (e.g. data flow analysis problems). This is the first practical algorithm to handle all legal tabled logic programs for which incremental evaluation is meaningful.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Acar, U.A., Blelloch, G.E., Harper, R.: Adaptive functional programming. In: POPL, pp. 247–259. ACM Press, New York (2002)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: principles, techniques, and tools, pp. 585–718. Addison-Wesley, Reading (1986)
Anderson, L.O.: Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, Unversity of Copenhagen (1994)
Balmin, A., Papakonstantinou, Y., Vianu, V.: Incremental validation of xml documents. ACM Trans. Database Syst. 29(4), 710–751 (2004)
Chen, W., Swift, T., Warren, D.S.: Efficient implementation of general logical queries. JLP (1995)
Chen, W., Warren, D.S.: Tabled evaluation with delaying for general logic programs. JACM 43(1), 20–74 (1996)
Dawson, S., Ramakrishnan, C.R., Warren, D.S.: Practical program analysis using general purpose logic programming systems — a case study. In: ACM PLDI, pp. 117–126 (1996)
Freire, J., Swift, T., Warren, D.S.: Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. In: PLILP, pp. 243–258 (1996)
Guo, H., Gupta, G.: A simple scheme for implementing tabled logic programming systems based on dynamic reordering of alternatives. In: ICLP, pp. 181–196. Springer, Heidelberg (2001)
Gupta, A., Mumick, I.: Maintenance of materialized views: Problems, techniques, and appfications. IEEE Data Engineering Bulletin 18(2), 3–18 (1995)
Gupta, A., Mumick, I.S., Subrahmanian, V.S.: Maintaining views incrementally. In: SIGMOD, pp. 157–166 (1993)
Hermenegildo, M., Puebla, G., Marriott, K., Stuckey, P.J.: Incremental analysis of constraint logic programs. ACM Trans. Program. Lang. Syst. 22(2), 187–223 (2000)
Hermenegildo, M.V., Puebla, G., Marriott, K., Stuckey, P.J.: Incremental evaluation of tabled logic programs. In: ICLP, pp. 797–811. MIT Press, Cambridge (1995)
Mayol, E., Teniente, E.: A survey of current methods for integrity constraint maintenance and view updating. In: ER Workshops, pp. 62–73 (1999)
PAF. Prolangs analysis framework. Available at, http://www.prolangs.rutgers.edu/public.html
Pollock, L.L., Soffa, M.L.: An incremental version of iterative data flow analysis. IEEE Trans. Softw. Eng. 15(12), 1537–1549 (1989)
Puebla, G., Hermenegildo, M.V.: Optimized algorithms for incremental analysis of logic programs. In: SAS, pp. 270–284 (1996)
Ramakrishnan, C.R., et al.: XMC: A logic-programming-based verification toolset. In: Emerson, E.A., Sistla, A.P. (eds.) CAV 2000. LNCS, vol. 1855, pp. 576–580. Springer, Heidelberg (2000)
Reps, T., Teitelbaum, T., Demers, A.: Incremental context-dependent analysis for language-based editors. TOPLAS 5(3), 449–477 (1983)
Rocha, R., Silva, F., Costa, V.S.: YapTab: A Tabling Engine Designed to Support Parallelism. In: Workshop on Tabling in Parsing and Deduction (2000)
Saha, D., Ramakrishnan, C.R.: Incremental evaluation of tabled logic programs. In: Palamidessi, C. (ed.) ICLP 2003. LNCS, vol. 2916, pp. 392–406. Springer, Heidelberg (2003)
Saha, D., Ramakrishnan, C.R.: Incremental and demand-driven points-to analysis using logic programming. In: Principles and Practice of Declarative Programming (2005)
Saha, D., Ramakrishnan, C.R.: A practical framework for incremental evaluation (2005), Available at http://www.lmc.cs.sunysb.edu/~dsaha/callg
Saha, D., Ramakrishnan, C.R.: Symbolic support graph: A space efficient data structure for incremental tabled evaluation. In: Gabbrielli, M., Gupta, G. (eds.) ICLP 2005. LNCS, vol. 3668, pp. 235–249. Springer, Heidelberg (2005)
Sharir, M.: A strong connectivity algorithm and its application in data flow analysis. Computer and Mathemetics with Applications 7(1), 67–72 (1981)
Sokolsky, O.V., Smolka, S.A.: Incremental model checking in the modal mu-calculus. In: Dill, D.L. (ed.) CAV 1994. LNCS, vol. 818, pp. 351–363. Springer, Heidelberg (1994)
Tamaki, H., Sato, T.: OLDT resolution with tabulation. In: ICLP, pp. 84–98 (1986)
XSB. The XSB logic programming system, Available at http://xsb.sourceforge.net
Yur, J., Ryder, B.G., Landi, W.: An incremental flow- and context-sensitive pointer aliasing analysis. In: ICSE, pp. 442–451 (1999)
Zhou, N., Shen, Y., Yuan, L., You, J.: Implementation of a linear tabling mechanism. Journal of Functional and Logic Programming 2001(10) (October 2001)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Saha, D., Ramakrishnan, C.R. (2005). Incremental Evaluation of Tabled Prolog: Beyond Pure Logic Programs. In: Van Hentenryck, P. (eds) Practical Aspects of Declarative Languages. PADL 2006. Lecture Notes in Computer Science, vol 3819. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11603023_15
Download citation
DOI: https://doi.org/10.1007/11603023_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-30947-5
Online ISBN: 978-3-540-31685-5
eBook Packages: Computer ScienceComputer Science (R0)