Generating Specialized Rules and Programs for Demand-Driven Analysis

  • K. Tuncay Tekle
  • Katia Hristova
  • Yanhong A. Liu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5140)


Many complex analysis problems can be most clearly and easily specified as logic rules and queries, where rules specify how given facts can be combined to infer new facts, and queries select facts of interest to the analysis problem at hand. However, it has been extremely challenging to obtain efficient implementations from logic rules and to understand their time and space complexities, especially for on-demand analysis driven by queries.

This paper describes a powerful method for generating specialized rules and programs for demand-driven analysis from Datalog rules and queries, and further for providing time and space complexity guarantees. The method combines recursion conversion with specialization of rules and then uses a method for program generation and complexity calculation from rules. We compare carefully with the best prior methods by examining many variants of rules and queries for the same graph reachability problems, and show the application of our method in implementing graph query languages in general.


Model Check Logic Programming Transitive Closure Partial Evaluation Logic Rule 
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.
    Afrati, F.N., Gergatsoulis, M., Toni, F.: Linearisability on datalog programs. Theoretical Computer Science 308(1-3), 199–226 (2003)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Bancilhon, F., Ramakrishnan, R.: An amateur’s introduction to recursive query processing strategies. In: Proc. of the 1986 ACM SIGMOD Intl. Conf. on Management of Data, pp. 16–52 (1986)Google Scholar
  3. 3.
    Barker, S., Leuschel, M., Varea, M.: Efficient and flexible access control via logic program specialisation. In: Proc. of the 2004 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation, pp. 190–199 (2004)Google Scholar
  4. 4.
    Beeri, C., Ramakrishnan, R.: On the power of magic. J. Logic Programming 10(1/2/3&4), 255–299 (1991)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Brough, D.R., Hogger, C.J.: Grammar-related transformations of logic programs. New Generation Computing 9(2), 115–134 (1991)zbMATHCrossRefGoogle Scholar
  6. 6.
    Ceri, S., Gottlob, G., Tanca, L.: Logic Programming and Databases. Springer, Heidelberg (1990)Google Scholar
  7. 7.
    Chen, W., Warren, D.S.: Tabled evaluation with delaying for general logic programs. J. ACM 43(1), 20–74 (1996)zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Consens, M.P., Mendelzon, A.O.: GraphLog: a visual formalism for real life recursion. In: Proc. of the 9th ACM SIGMOD-SIGACT-SIGART Symp. on Principles of Database Systems, pp. 404–416 (1990)Google Scholar
  9. 9.
    Gottlob, G., Koch, C.: Monadic datalog and the expressive power of languages for web information extraction. J. ACM 51(1), 74–113 (2004)CrossRefMathSciNetGoogle Scholar
  10. 10.
    Greco, S., Saccà, D., Zaniolo, C.: Grammars and automata to optimize chain logic queries. Intl. J. Foundations of Computer Science 10(3), 349 (1999)CrossRefGoogle Scholar
  11. 11.
    Hristova, K., Liu, Y.A.: Improved algorithm complexities for linear temporal logic model checking of pushdown systems. In: Proc. of 7th Intl. Conf. on Verification, Model Checking and Abstract Interpretation, pp. 190–206 (2006)Google Scholar
  12. 12.
    Hristova, K., Rothamel, T., Liu, Y.A., Stoller, S.D.: Efficient type inference for secure information flow. In: Technical Report DAR 07-35, Computer Science Department, SUNY Stony Brook (May 2007); A preliminary version of this work appeared in Proc. of the 2006 ACM SIGPLAN Workshop on Programming Languages and Analysis for SecurityGoogle Scholar
  13. 13.
    Hristova, K., Tekle, K.T., Liu, Y.A.: Efficient trust management policy analysis from rules. In: Proc. of the 9th ACM SIGPLAN Intl. Conf. on Principles and Practice of Declarative Programming (July 2007)Google Scholar
  14. 14.
    Kifer, M., Lozinskii, E.L.: A framework for an efficient implementation of deductive database systems. In: Proc. of the Advanced Database Symposium (1986)Google Scholar
  15. 15.
    Kifer, M., Lozinskii, E.L.: On compile-time query optimization in deductive databases by means of static filtering. ACM Trans. Database Systems 15(3), 385–426 (1990)CrossRefMathSciNetGoogle Scholar
  16. 16.
    Lam, M.S., Whaley, J., Livshits, V.B., Martin, M.C., Avots, D., Carbin, M., Unkel, C.: Context-sensitive program analysis as database queries. In: Proc. of the 24th ACM SIGACT-SIGMOD-SIGART Symp. on Principles of Database Systems, pp. 1–12 (2005)Google Scholar
  17. 17.
    Leuschel, M.: Logic program specialisation. In: Hatcliff, J., Mogensen, T.Æ., Thiemann, P. (eds.) DIKU 1998. LNCS, vol. 1706, pp. 155–188. Springer, Heidelberg (1999)Google Scholar
  18. 18.
    Liu, Y.A., Rothamel, T., Yu, F., Stoller, S.D., Hu, N.: Parametric regular path queries. In: Proc. of the ACM SIGPLAN 2004 Conf. on Programming Language Design and Implementation, pp. 219–230 (2004)Google Scholar
  19. 19.
    Liu, Y.A., Stoller, S.D.: From datalog rules to efficient programs with time and space guarantees. In: Proc. of the 5th Intl. ACM SIGPLAN Conf. on Principles and Practice of Declarative Programming, pp. 172–183 (2003)Google Scholar
  20. 20.
    Liu, Y.A., Stoller, S.D.: Querying complex graphs. In: Proc. of the 7th Intl. Symp. on Practical Aspects of Declarative Languages, pp. 199–214 (2006)Google Scholar
  21. 21.
    Maier, D., Warren, D.S.: Computing with logic: logic programming with Prolog. Benjamin-Cummings Publishing Co. Inc., Redwood City (1988)zbMATHGoogle Scholar
  22. 22.
    Melski, D., Reps, T.W.: Interconvertibility of a class of set constraints and context-free-language reachability. Theoretical Computer Science 248(1-2), 29–98 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Ramakrishnan, R., Sagiv, Y., Ullman, J.D., Vardi,: Proof-tree transformation theorems and their applications. In: Proc. of the 8th ACM SIGACT-SIGMOD-SIGART Symp. on Principles of Database Systems, pp. 172–181 (1989)Google Scholar
  24. 24.
    Sagonas, K.F., Swift, T., Warren, D.S.: XSB as a deductive database. In: Proc. of the 1994 ACM SIGMOD Intl. Conf. on Management of Data, p. 512 (1994)Google Scholar
  25. 25.
    Zhang, W., Yu, C.T., Troy, D.: Necessary and sufficient conditions to linearize double recursive programs in logic databases. ACM Trans. on Database Systems 15(3), 459–482 (1990)CrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • K. Tuncay Tekle
    • 1
  • Katia Hristova
    • 1
  • Yanhong A. Liu
    • 1
  1. 1.SUNY Stony BrookNYUSA

Personalised recommendations