Constraint-Based Synthesis of Datalog Programs

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10416)


We study the problem of synthesizing recursive Datalog programs from examples. We propose a constraint-based synthesis approach that uses an smt solver to efficiently navigate the space of Datalog programs and their corresponding derivation trees. We demonstrate our technique’s ability to synthesize a range of graph-manipulating recursive programs from a small number of examples. In addition, we demonstrate our technique’s potential for use in automatic construction of program analyses from example programs and desired analysis output.


Datalog Program Constraint-based Synthesis Clause Templates Simulation Constraints Derivation Sequence 
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.



This work is supported by NSF awards 1566015, 1652140, and a Google Faculty Research Award.


  1. 1.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases: The Logical Level. Addison-Wesley Longman Publishing Co., Inc., Boston (1995)Google Scholar
  2. 2.
    Albarghouthi, A., Gulwani, S., Kincaid, Z.: Recursive program synthesis. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 934–950. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-39799-8_67 CrossRefGoogle Scholar
  3. 3.
    Andersen, L.O.: Program analysis and specialization for the C programming language. Ph.D. thesis, University of Cophenhagen (1994)Google Scholar
  4. 4.
    Aref, M., ten Cate, B., Green, T.J., Kimelfeld, B., Olteanu, D., Pasalic, E., Veldhuizen, T.L., Washburn, G.: Design and implementation of the logicblox system. In: Proceedings of 2015 ACM SIGMOD International Conference on Management of Data, pp. 1371–1382. ACM (2015)Google Scholar
  5. 5.
    Bradley, A.R., Manna, Z.: The Calculus of Computation: Decision Procedures with Applications to Verification. Springer Science and Business Media, Heidelberg (2007). doi: 10.1007/978-3-540-74113-8 zbMATHGoogle Scholar
  6. 6.
    Cropper, A., Muggleton, S.H.: Learning efficient logical robot strategies involving composable objects. In: Proceedings of 24th International Joint Conference Artificial Intelligence (IJCAI 2015), pp. 3423–3429 (2015)Google Scholar
  7. 7.
    Cropper, A., Tamaddoni-Nezhad, A., Muggleton, S.H.: Meta-interpretive learning of data transformation programs. In: Proceedings of 24th International Conference on Inductive Logic Programming (2015)Google Scholar
  8. 8.
    De Raedt, L.: Logical and Relational Learning. Springer Science and Business Media, Heidelberg (2008)CrossRefzbMATHGoogle Scholar
  9. 9.
    Flener, P., Yilmaz, S.: Inductive synthesis of recursive logic programs: achievements and prospects. JLP 41, 141–195 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Frankle, J., Osera, P.M., Walker, D., Zdancewic, S.: Example-directed synthesis: a type-theoretic interpretation. In: POPL. ACM (2016)Google Scholar
  11. 11.
    Gulwani, S., Harris, W.R., Singh, R.: Spreadsheet data manipulation using examples. CACM 55, 97–105 (2012)CrossRefGoogle Scholar
  12. 12.
    Gulwani, S., Jha, S., Tiwari, A., Venkatesan, R.: Synthesis of loop-free programs. In: PLDI (2011)Google Scholar
  13. 13.
    Hoder, K., Bjørner, N., De Moura, L.: \(\mu Z\)–an efficient engine for fixed points with constraints. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 457–462. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-22110-1_36 CrossRefGoogle Scholar
  14. 14.
    Jha, S., Gulwani, S., Seshia, S.A., Tiwari, A.: Oracle-guided component-based program synthesis. In: ICSE (2010)Google Scholar
  15. 15.
    Kitzelmann, E., Schmid, U.: Inductive synthesis of functional programs: an explanation based generalization approach. JMLR 7, 429–454 (2006)MathSciNetzbMATHGoogle Scholar
  16. 16.
    Kneuss, E., Kuraj, I., Kuncak, V., Suter, P.: Synthesis modulo recursive functions. In: OOPSLA (2013)Google Scholar
  17. 17.
    Lin, D., Dechter, E., Ellis, K., Tenenbaum, J.B., Muggleton, S.: Bias reformulation for one-shot function induction. In: ECAI, pp. 525–530 (2014)Google Scholar
  18. 18.
    McCarthy, J.: Towards a mathematical science of computation. In: Colburn, T.R., Fetzer, J.H., Rankin, T.L. (eds.) Program Verification. SCS, vol. 14, pp. 35–56. Springer, Dordrecht (1993)CrossRefGoogle Scholar
  19. 19.
    De Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-78800-3_24 CrossRefGoogle Scholar
  20. 20.
    Muggleton, S.: Inductive logic programming. N. Gener. Comput. 8, 295–318 (1991)CrossRefzbMATHGoogle Scholar
  21. 21.
    Muggleton, S.H., Lin, D., Pahlavi, N., Tamaddoni-Nezhad, A.: Meta-interpretive learning: application to grammatical inference. Mach. Learn. 94, 25–49 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  22. 22.
    Osera, P., Zdancewic, S.: Type-and-example-directed program synthesis. In: PLDI (2015)Google Scholar
  23. 23.
    Perelman, D., Gulwani, S., Grossman, D., Provost, P.: Test-driven synthesis. In: PLDI (2014)Google Scholar
  24. 24.
    Polikarpova, N., Kuraj, I., Solar-Lezama, A.: Program synthesis from polymorphic refinement types. In: Proceedings of 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 522–538. ACM (2016)Google Scholar
  25. 25.
    Reynolds, A., Deters, M., Kuncak, V., Tinelli, C., Barrett, C.: Counterexample-guided quantifier instantiation for synthesis in SMT. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9207, pp. 198–216. Springer, Cham (2015). doi: 10.1007/978-3-319-21668-3_12 CrossRefGoogle Scholar
  26. 26.
    Seo, J., Guo, S., Lam, M.S.: Socialite: datalog extensions for efficient social network analysis. In: 2013 IEEE 29th International Conference on Data Engineering (ICDE), pp. 278–289. IEEE (2013)Google Scholar
  27. 27.
    Shaw, M., Koutris, P., Howe, B., Suciu, D.: Optimizing large-scale semi-naïve datalog evaluation in hadoop. In: Barceló, P., Pichler, R. (eds.) Datalog 2.0 2012. LNCS, vol. 7494, pp. 165–176. Springer, Heidelberg (2012). doi: 10.1007/978-3-642-32925-8_17 CrossRefGoogle Scholar
  28. 28.
    Shen, W., Doan, A., Naughton, J.F., Ramakrishnan, R.: Declarative information extraction using datalog with embedded extraction predicates. In: Proceedings of 33rd international conference on Very large data bases, pp. 1033–1044. VLDB Endowment (2007)Google Scholar
  29. 29.
    Smaragdakis, Y., Balatsouras, G., et al.: Pointer analysis. Found. Trends Program. Lang. 2, 1–69 (2015)CrossRefGoogle Scholar
  30. 30.
    Solar-Lezama, A., Tancau, L., Bodík, R., Seshia, S.A., Saraswat, V.A.: Combinatorial sketching for finite programs. In: ASPLOS (2006)Google Scholar
  31. 31.
    Suter, P., Köksal, A.S., Kuncak, V.: Satisfiability modulo recursive programs. In: Yahav, E. (ed.) SAS 2011. LNCS, vol. 6887, pp. 298–315. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-23702-7_23 CrossRefGoogle Scholar
  32. 32.
    Wang, J., Balazinska, M., Halperin, D.: Asynchronous and fault-tolerant recursive datalog evaluation in shared-nothing engines. Proc. VLDB Endow. 8, 1542–1553 (2015)CrossRefGoogle Scholar
  33. 33.
    Whaley, J., Lam, M.S.: Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In: PLDI, pp. 131–144. ACM (2004)Google Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.University of Wisconsin–MadisonMadisonUSA
  2. 2.Unviersity of PennsylvaniaPhiladelphiaUSA

Personalised recommendations