A Local Algorithm for Incremental Evaluation of Tabled Logic Programs

  • Diptikalyan Saha
  • C. R. Ramakrishnan
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4079)


This paper considers the problem of efficient incremental maintenance of memo tables in a tabled logic programming system. Most existing techniques for this problem consider insertion and deletion of facts as primitive changes, and treat update as deletion of the old version followed by insertion of the new version. They handle insertion and deletion using independent algorithms, consequently performing many redundant computations when processing updates. In this paper, we present a local algorithm for handling updates to facts. The key idea is to interleave the propagation of deletion and insertion operations generated by the updates through a dynamic (and potentially cyclic) dependency graph. The dependency graph used in our algorithm is more general than that used in algorithms previously proposed for incremental evaluation of attribute grammars and functional programs. Nevertheless, our algorithm’s complexity matches that of the most efficient algorithms built for these specialized cases. We demonstrate the effectiveness of our algorithm using data-flow analysis and parsing examples.


Logic Program Dependency Graph Local Algorithm Topological Order Incremental Evaluation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Acar, U.A., Blelloch, G.E., Harper, R.: Adaptive functional programming. In: POPL, pp. 247–259. ACM Press, New York (2002)Google Scholar
  2. 2.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: principles, techniques, and tools, pp. 585–718. Addison-Wesley, Reading (1986)Google Scholar
  3. 3.
    Alpern, B., Hoover, R., Rosen, B.K., Sweeney, P.F., Zadeck, F.K.: Incremental evaluation of computational circuits. In: Symposium on Discrete algorithms, pp. 32–42 (1990)Google Scholar
  4. 4.
    Bol, R., Degerstadt, L.: Tabulated resolution for well-founded semantics. In: ILPS (1993)Google Scholar
  5. 5.
    Chen, W., Swift, T., Warren, D.S.: Efficient implementation of general logical queries. In: JLP (1995)Google Scholar
  6. 6.
    Chen, W., Warren, D.S.: Tabled evaluation with delaying for general logic programs. JACM 43(1), 20–74 (1996)MATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Conway, C.L., Namjoshi, K.S., Dams, D., Edwards, S.A.: Incremental Algorithms for Inter-procedural Analysis of Safety Properties. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 449–461. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    Demers, A., Reps, T., Teitelbaum, T.: Incremental evaluation for attribute grammars with application to syntax-directed editors. In: POPL, pp. 105–116. ACM Press, New York (1981)Google Scholar
  10. 10.
    Dietz, P., Sleator, D.: Two algorithms for maintaining order in a list. In: STOC, pp. 365–372. ACM Press, New York (1987)Google Scholar
  11. 11.
    Gupta, A., Mumick, I.: Maintenance of materialized views: Problems, techniques, and applications. IEEE Data Engineering Bulletin 18(2), 3–18 (1995)Google Scholar
  12. 12.
    Gupta, A., Mumick, I.S., Subrahmanian, V.S.: Maintaining views incrementally. In: SIGMOD, pp. 157–166 (1993)Google Scholar
  13. 13.
    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)CrossRefGoogle Scholar
  14. 14.
    Jones, L.G.: Efficient evaluation of circular attribute grammars. ACM Trans. Program. Lang. Syst. 12(3), 429–462 (1990)CrossRefGoogle Scholar
  15. 15.
    Mayol, E., Teniente, E.: A survey of current methods for integrity constraint maintenance and view updating. In: ER Workshops, pp. 62–73 (1999)Google Scholar
  16. 16.
    Paige, R., Koenig, S.: Finite differencing of computable expressions. TOPLAS 4(3), 402–454 (1982)MATHCrossRefGoogle Scholar
  17. 17.
    Pearce, D.J., Kelly, P.H.J.: Online algorithms for topological order and strongly connected components. Technical report, Imperial College, London (2003)Google Scholar
  18. 18.
    Pollock, L.L., Soffa, M.L.: An incremental version of iterative data flow analysis. IEEE Trans. Softw. Eng. 15(12), 1537–1549 (1989)CrossRefGoogle Scholar
  19. 19.
    Puebla, G., Hermenegildo, M.V.: Optimized algorithms for incremental analysis of logic programs. In: SAS, pp. 270–284 (1996)Google Scholar
  20. 20.
    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)CrossRefGoogle Scholar
  21. 21.
    Reps, T.: Optimal-time incremental semantic analysis for syntax-directed editors. In: POPL, pp. 169–176. ACM Press, New York (1982)Google Scholar
  22. 22.
    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)CrossRefGoogle Scholar
  23. 23.
    Saha, D., Ramakrishnan, C.R.: Incremental and demand-driven points-to analysis using logic programming. In: PPDP. ACM Press, New York (2005)Google Scholar
  24. 24.
    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)CrossRefGoogle Scholar
  25. 25.
    Saha, D., Ramakrishnan, C.R.: Incremental Evaluation of Tabled Prolog: Beyond Pure Logic Programs. In: Van Hentenryck, P. (ed.) PADL 2006. LNCS, vol. 3819, pp. 215–229. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  26. 26.
    Saha, D., Ramakrishnan, C.R.: A local algorithm for incremental evaluation of logic programs. Technical report, Stony Brook University (2006); available at:
  27. 27.
    Seljee, R., de Swart, H.: Three types of redundancy in integrity checking; an optimal solution. Journal of Data and Knowledge Enigineering 30, 135–151 (1999)MATHCrossRefGoogle Scholar
  28. 28.
    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)Google Scholar
  29. 29.
    Tamaki, H., Sato, T.: OLDT resolution with tabulation. In: ICLP, pp. 84–98 (1986)Google Scholar
  30. 30.
    Walz, J.A., Johnson, G.F.: Incremental evaluation for a general class of circular attribute grammars. In: PLDI, pp. 209–221. ACM Press, New York (1988)Google Scholar
  31. 31.
    XSB. The XSB logic programming system. available at:
  32. 32.
    Yang, G., Kifer, M.: FLORA: Implementing an Efficient DOOD System Using a Tabling Logic Engine. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1078–1093. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  33. 33.
    Yur, J., Ryder, B.G., Landi, W.: An incremental flow- and context-sensitive pointer aliasing analysis. In: ICSE, pp. 442–451 (1999)Google Scholar
  34. 34.
    Yur, J., Ryder, B.G., Landi, W., Stocks, P.: Incremental analysis of side effects for C software system. In: ICSE, pp. 422–432 (1997)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Diptikalyan Saha
    • 1
  • C. R. Ramakrishnan
    • 1
  1. 1.Dept. of Computer ScienceStony Brook UniversityStony BrookUSA

Personalised recommendations