skip to main content
10.1145/2908080.2908096acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

From Datalog to flix: a declarative language for fixed points on lattices

Published:02 June 2016Publication History

ABSTRACT

We present Flix, a declarative programming language for specifying and solving least fixed point problems, particularly static program analyses. Flix is inspired by Datalog and extends it with lattices and monotone functions. Using Flix, implementors of static analyses can express a broader range of analyses than is currently possible in pure Datalog, while retaining its familiar rule-based syntax. We define a model-theoretic semantics of Flix as a natural extension of the Datalog semantics. This semantics captures the declarative meaning of Flix programs without imposing any specific evaluation strategy. An efficient strategy is semi-naive evaluation which we adapt for Flix. We have implemented a compiler and runtime for Flix, and used it to express several well-known static analyses, including the IFDS and IDE algorithms. The declarative nature of Flix clearly exposes the similarity between these two algorithms.

References

  1. L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, University of Copenhagen, 1994.Google ScholarGoogle Scholar
  2. K. R. Apt, H. A. Blair, and A. Walker. Towards a Theory of Declarative Knowledge. In Foundations of Deductive Databases and Logic Programming. 1988. doi: 10.1016/ B978-0-934613-40-8.50006-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. F. Bancilhon, D. Maier, Y. Sagiv, and J. D. Ullman. Magic Sets and Other Strange Ways to Implement Logic Programs. In Proc. Principles of Database Systems (PODS), 1985. doi: 10. 1145/6012.15399. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W. C. Benton and C. N. Fischer. Interactive, Scalable, Declarative Program Analysis: From Prototype to Implementation. In Proc. Principles and Practice of Declarative Programming (PPDP), 2007. doi: 10.1145/1273920.1273923. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. N. Bjørner, K. McMillan, and A. Rybalchenko. On Solving Universally Quantified Horn Clauses. In Proc. Symposium on Static Analysis (SAS), 2013.Google ScholarGoogle ScholarCross RefCross Ref
  6. doi: 10.1007/ 978-3-642-38856-9_8.Google ScholarGoogle Scholar
  7. S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanovi´c, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java Benchmarking Development and Analysis. In Proc. Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2006. doi: 10.1145/1167473. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 1167488.Google ScholarGoogle Scholar
  9. M. Bravenboer and Y. Smaragdakis. Strictly Declarative Specification of Sophisticated Points-To Analyses. In Proc. Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2009. doi: 10.1145/1640089.1640108. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. G. Brewka, T. Eiter, and M. Truszczy´nski. Answer Set Programming at a Glance. Communications of the ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. doi: 10.1145/2043174.2043195.Google ScholarGoogle Scholar
  12. S. Ceri, G. Gottlob, and L. Tanca. What You Always Wanted to Know About Datalog (and Never Dared to Ask). IEEE Transactions on Knowledge and Data Engineering (TKDE), 1989. doi: 10.1109/69.43410. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. W. Clocksin and C. S. Mellish. Programming in Prolog. Springer Berlin Heidelberg, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  14. doi: 10.1007/ 978-3-642-55481-0.Google ScholarGoogle Scholar
  15. M. Codish, A. Mulkers, M. Bruynooghe, M. G. De La Banda, and M. Hermenegildo. Improving Abstract Interpretations by Combining Domains. ACM Transactions on Programming Languages and Systems (TOPLAS), 1995. doi: 10.1145/ 200994.200998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Cohen. Constraint Logic Programming Languages. Communications of the ACM, 1990. doi: 10.1145/79204.79209. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Conway, W. R. Marczak, P. Alvaro, J. M. Hellerstein, and D. Maier. Logic and Lattices for Distributed Programming. In Proc. Symposium on Cloud Computing (SoCC), 2012. doi: 10. 1145/2391229.2391230. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Cortesi, G. Costantini, and P. Ferrara. A Survey on Product Operators in Abstract Interpretation. In Proc. Festschrift for David Schmidt, 2013. doi: 10.4204/EPTCS.129.19.Google ScholarGoogle ScholarCross RefCross Ref
  19. P. Cousot and R. Cousot. Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In Proc. Principles of Programming Languages (POPL), 1977. doi: 10.1145/512950. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 512973.Google ScholarGoogle Scholar
  21. P. Cuoq, F. Kirchner, N. Kosmatov, V. Prevosto, J. Signoles, and B. Yakobowski. Frama-C – A Software Analysis Perspective. In Software Engineering and Formal Methods (SEFM), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. doi: 10.1007/978-3-642-33826-7_16.Google ScholarGoogle Scholar
  23. E. Dantsin, T. Eiter, G. Gottlob, and A. Voronkov. Complexity and Expressive Power of Logic Programming. ACM Computing Surveys (CSUR), 2001. doi: 10.1145/502807.502810. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Dawson, C. Ramakrishnan, and D. Warren. Practical Program Analysis Using General Purpose Logic Programming Systems – A Case Study. In Proc. Programming Language Design and Implementation (PLDI), 1996. doi: 10.1145/ 231379.231399. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. O. de Moor, G. Gottlob, T. Furche, and A. Sellers, editors. Datalog Reloaded – First International Workshop, Datalog 2010, 2011. doi: 10.1007/978-3-642-24206-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. T. Eiter, G. Gottlob, and H. Mannila. Adding Disjunction to Datalog. In Proc. Principles of Database Systems (PODS), 1994. doi: 10.1145/182591.182639. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. T. Eiter, G. Gottlob, and H. Mannila. Disjunctive Datalog. ACM Transactions on Database Systems (TODS), 1997. doi: 10. 1145/261124.261126. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. S. Fink and J. Dolby. WALA – The TJ Watson Libraries for Analysis, 2012.Google ScholarGoogle Scholar
  29. M. Fitting. Fixpoint Semantics for Logic Programming a Survey. Theoretical Computer Science (TCS), 2002. doi: 10. 1016/S0304-3975(00)00330-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. C. Flanagan. Automatic Software Model Checking Using CLP. In Proc. European Symposium on Programming (ESOP), 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. doi: 10.1007/3-540-36575-3_14.Google ScholarGoogle Scholar
  32. M. Gelfond and V. Lifschitz. The Stable Model Semantics for Logic Programming. In Proc. International Conference on Logic Programming (ICLP/SLP), 1988.Google ScholarGoogle Scholar
  33. M. Gelfond and V. Lifschitz. Classical Negation in Logic Programs and Disjunctive Databases. New Generation Computing, 1991. doi: 10.1007/BF03037169.Google ScholarGoogle ScholarCross RefCross Ref
  34. G. Graefe. Query Evaluation Techniques for Large Databases. ACM Computing Surveys (CSUR), 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. doi: 10.1145/ 152610.152611.Google ScholarGoogle Scholar
  36. S. Gregory. Parallel Logic Programming in PARLOG: The Language and its Implementation. Addison-Wesley, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. S. Gulwani and A. Tiwari. Combining Abstract Interpreters. In Proc. Programming Language Design and Implementation (PLDI), 2006. doi: 10.1145/1133981.1134026. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. E. Hajiyev, M. Verbaere, and O. D. Moor. codeQuest: Scalable Source Code Queries with Datalog. In Proc. European Conference on Object-Oriented Programming (ECOOP), 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. doi: 10.1007/11785477_2.Google ScholarGoogle Scholar
  40. M. Hind. Pointer Analysis: Haven’t We Solved This Problem Yet? In Proc. Program Analysis for Software Tools and Engineering (PASTE), 2001. doi: 10.1145/379605.379665. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. S. S. Huang, T. J. Green, and B. T. Loo. Datalog and Emerging Applications: An Interactive Tutorial. In Proc. Management of Data (SIGMOD), 2011. doi: 10.1145/1989323.1989456. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. J. Jaffar and J.-L. Lassez. Constraint Logic Programming. In Proc. Principles of Programming Languages (POPL), 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. doi: 10.1145/41625.41635.Google ScholarGoogle Scholar
  44. J. Jaffar and M. J. Maher. Constraint Logic Programming: A Survey. Journal of Logic Programming, 1994. doi: 10.1016/ 0743-1066(94)90033-7.Google ScholarGoogle Scholar
  45. J. B. Kam and J. D. Ullman. Monotone Data Flow Analysis Frameworks. Acta Informatica, 1977. doi: 10.1007/ BF00290339. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. K. Kunen. Negation in Logic Programming. Journal of Logic Programming, 1987. doi: 10.1016/0743-1066(87) 90007-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. M. S. Lam, J. Whaley, V. B. Livshits, M. C. Martin, D. Avots, M. Carbin, and C. Unkel. Context-sensitive Program Analysis as Database Queries. In Proc. Principles of Database Systems (PODS), 2005. doi: 10.1145/1065167.1065169. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. N. Leone, G. Pfeifer, W. Faber, T. Eiter, G. Gottlob, S. Perri, and F. Scarcello. The DLV System for Knowledge Representation and Reasoning. ACM Transactions on Computational Logic (TOCL), 2006. doi: 10.1145/1149114.1149117. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. O. Lhoták and K.-C. A. Chung. Points-To Analysis with Efficient Strong Updates. In Proc. Principles of Programming Languages (POPL), 2011. doi: 10.1145/1925844.1926389.Google ScholarGoogle Scholar
  50. O. Lhoták and L. Hendren. Scaling Java Points-To Analysis using Spark. In Proc. Compiler Construction (CC), 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. doi: 10.1007/3-540-36579-6_12.Google ScholarGoogle Scholar
  52. N. Li and J. C. Mitchell. Datalog with Constraints: A Foundation for Trust Management Languages. In Proc. Practical Aspects of Declarative Languages (PADL), 2003. doi: 10. 1007/3-540-36388-2_6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. V. Lifschitz. Answer Set Planning. In Proc. Logic Programming and Nonmonotonic Reasoning (LPNMR), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. doi: 10.1007/3-540-46767-X_28.Google ScholarGoogle Scholar
  55. V. Lifschitz. What Is Answer Set Programming? In Proc. Artificial Intelligence (AAAI), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. F. Martin. PAG – An Efficient Program Analyzer Generator. Journal on Software Tools for Technology Transfer (STTT), 1998. doi: 10.1007/s100090050017.Google ScholarGoogle Scholar
  57. M. Méndez-Lojo, J. Navas, and M. Hermenegildo. A Flexible, (C)LP-Based Approach to the Analysis of Object-Oriented Programs. In Proc. Logic-Based Program Synthesis and Transformation (LOPSTR), 2007.Google ScholarGoogle Scholar
  58. doi: 10.1007/ 978-3-540-78769-3_11.Google ScholarGoogle Scholar
  59. K. Muthukumar and M. Hermenegildo. Compile-time Derivation of Variable Dependency Using Abstract Interpretation. Journal of Logic Programming, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. doi: 10.1016/ 0743-1066(92)90035-2.Google ScholarGoogle Scholar
  61. N. A. Naeem and O. Lhoták. Typestate-like Analysis of Multiple Interacting Objects. In Proc. Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. doi: 10.1145/1449764.1449792.Google ScholarGoogle Scholar
  63. N. A. Naeem, O. Lhoták, and J. Rodriguez. Practical Extensions to the IFDS Algorithm. In Proc. Compiler Construction (CC), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. F. Nielson, H. R. Nielson, and H. Seidl. A Succinct Solver for ALFP. Nordic Journal of Computing (NJC), 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. F. Nielson, H. R. Nielson, H. Sun, M. Buchholtz, R. R. Hansen, H. Pilegaard, and H. Seidl. The Succinct Solver Suite. In Proc. Tools and Algorithms for the Construction and Analysis of Systems (TACAS), 2004. doi: 10.1007/978-3-540-24730-2_ 21.Google ScholarGoogle ScholarCross RefCross Ref
  66. N. Ramsey, J. Dias, and S. P. Jones. Hoopl: A Modular, Reusable Library for Dataflow Analysis and Transformation. In Proc. Haskell Symposium, 2010. doi: 10.1145/1863523. Google ScholarGoogle ScholarDigital LibraryDigital Library
  67. 1863539.Google ScholarGoogle Scholar
  68. T. Reps, S. Horwitz, and M. Sagiv. Precise Interprocedural Dataflow Analysis via Graph Reachability. In Proc. Principles of Programming Languages (POPL), 1995. doi: 10.1145/ 199448.199462. Google ScholarGoogle ScholarDigital LibraryDigital Library
  69. M. Sagiv, T. Reps, and S. Horwitz. Precise Interprocedural Dataflow Analysis with Applications to Constant Propagation. Theoretical Computer Science (TCS), 1996. doi: 10.1016/ 0304-3975(96)00072-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  70. Y. Smaragdakis and M. Bravenboer. Using Datalog for Fast and Easy Program Analysis. In Datalog Reloaded, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  71. doi: 10.1145/1926385.1926390.Google ScholarGoogle Scholar
  72. Y. Smaragdakis, M. Bravenboer, and O. Lhoták. Pick Your Contexts Well: Understanding Object-Sensitivity. In Proc. Principles of Programming Languages (POPL), 2011. doi: 10. 1145/1925844.1926390. Google ScholarGoogle ScholarDigital LibraryDigital Library
  73. L. Sterling and E. Y. Shapiro. The Art of Prolog: Advanced Programming Techniques. MIT Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  74. T. Swift and D. S. Warren. XSB: Extending Prolog with Tabled Logic Programming. Theory and Practice of Logic Programming (TPLP), 2012. doi: 10.1017/S1471068411000500. Google ScholarGoogle ScholarDigital LibraryDigital Library
  75. J. D. Ullman. Principles of Database Systems. Galgotia publications, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  76. J. D. Ullman. Principles of Database and Knowledge-Base Systems, Volume I. Computer Science Press, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  77. R. Vallée-Rai, P. Co, E. Gagnon, L. Hendren, P. Lam, and V. Sundaresan. Soot – A Java Bytecode Optimization Framework. In Proc. Centre for Advanced Studies on Collaborative Research (CASCON), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  78. A. Van Gelder, K. A. Ross, and J. S. Schlipf. The Well-Founded Semantics for General Logic Programs. Journal of the ACM (JACM), 1991. doi: 10.1145/116825.116838. Google ScholarGoogle ScholarDigital LibraryDigital Library
  79. P. Wadler and S. Blott. How to Make Ad-hoc Polymorphism Less Ad Hoc. In Proc. Principles of Programming Languages (POPL), 1989. doi: 10.1145/75277.75283. Google ScholarGoogle ScholarDigital LibraryDigital Library
  80. J. Whaley and M. S. Lam. Cloning-based Context-sensitive Pointer Alias Analysis using Binary Decision Diagrams. In Proc. Programming Language Design and Implementation (PLDI), 2004. doi: 10.1145/996893.996859. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. From Datalog to flix: a declarative language for fixed points on lattices

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      PLDI '16: Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation
      June 2016
      726 pages
      ISBN:9781450342612
      DOI:10.1145/2908080
      • General Chair:
      • Chandra Krintz,
      • Program Chair:
      • Emery Berger
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 6
        PLDI '16
        June 2016
        726 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2980983
        • Editor:
        • Andy Gill
        Issue’s Table of Contents

      Copyright © 2016 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 2 June 2016

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate406of2,067submissions,20%

      Upcoming Conference

      PLDI '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader