Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3497776.3517779acmconferencesArticle/Chapter ViewAbstractPublication PagesccConference Proceedingsconference-collections
research-article

Seamless deductive inference via macros

Published: 18 March 2022 Publication History

Abstract

We present an approach to integrating state-of-art bottom-up logic programming within the Rust ecosystem, demonstrating it with Ascent, an extension of Datalog that performs well against comparable systems. Rust’s powerful macro system permits Ascent to be compiled uniformly with the Rust code it’s embedded in and to interoperate with arbitrary user-defined components written in Rust, addressing a challenge in real-world use of logic programming languages: the fact that logical programs are parts of bigger software systems and need to interoperate with other components written in imperative programming languages.
We leverage Rust’s trait system to extend Datalog semantics with non-powerset lattices, much like Flix, and with user-defined data types much like Formulog and Souffle.
We use Ascent to re-implement the Rust borrow checker, a static analysis required by the Rust compiler. We evaluate our performance against Datafrog, Flix, and Soufflé using the borrow checker and other benchmarks, observing comparable performance to Datafrog and Soufflé, and speedups of around two orders of magnitude compared to Flix.

References

[1]
Molham Aref, Balder ten Cate, Todd J. Green, Benny Kimelfeld, Dan Olteanu, Emir Pasalic, Todd L. Veldhuizen, and Geoffrey Washburn. 2015. Design and Implementation of the LogicBlox System. In Proceedings of the 2015 ACM SIGMOD International Conference on Management of Data (SIGMOD ’15). Association for Computing Machinery, New York, NY, USA. 1371–1382. isbn:9781450327589 https://doi.org/10.1145/2723372.2742796
[2]
Michael Arntzenius and Neelakantan R Krishnaswami. 2016. Datafun: a functional Datalog. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming. 214–227. https://doi.org/10.1145/2951913.2951948
[3]
Aaron Bembenek, Michael Greenberg, and Stephen Chong. 2020. Formulog: Datalog for SMT-based static analysis. Proceedings of the ACM on Programming Languages, 4, OOPSLA (2020), 1–31. https://doi.org/10.1145/3428209
[4]
Martin Bravenboer and Yannis Smaragdakis. 2009. Strictly Declarative Specification of Sophisticated Points-to Analyses. In Proceedings of the 24th ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’09). ACM, New York, NY, USA. 243–262. isbn:978-1-60558-766-0 https://doi.org/10.1145/1640089.1640108
[5]
Stefano Ceri, Georg Gottlob, and Letizia Tanca. 1989. What you always wanted to know about Datalog(and never dared to ask). IEEE transactions on knowledge and data engineering, 1, 1 (1989), 146–166. https://doi.org/10.1109/69.43410
[6]
Eunjoon Cho, Seth A Myers, and Jure Leskovec. 2011. Friendship and mobility: user movement in location-based social networks. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining. 1082–1090. https://doi.org/10.1145/2020408.2020579
[7]
The Serde Developers. 2021. serde-rs/serde: Serialization framework for Rust. https://github.com/serde-rs/serde
[8]
R. Kent Dybvig. 1992. Writing Hygienic Macros in Scheme with Syntax-Case.
[9]
Thomas Eiter, Georg Gottlob, and Heikki Mannila. 1997. Disjunctive Datalog. ACM Trans. Database Syst., 22, 3 (1997), sep, 364–418. issn:0362-5915 https://doi.org/10.1145/261124.261126
[10]
Thomas Gilray, Michael D. Adams, and Matthew Might. 2016. Allocation Characterizes Polyvariance: A Unified Methodology for Polyvariant Control-flow Analysis. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP ’16). ACM, New York, NY, USA. 407–420. isbn:978-1-4503-4219-3 https://doi.org/10.1145/2951913.2951936
[11]
Herbert Jordan, Bernhard Scholz, and Pavle Subotić. 2016. Soufflé: On Synthesis of Program Analyzers. In Computer Aided Verification, Swarat Chaudhuri and Azadeh Farzan (Eds.). Springer International Publishing, Cham. 422–430. isbn:978-3-319-41540-6 https://doi.org/10.1007/978-3-319-41540-6_23
[12]
Bryan Klimt and Yiming Yang. 2004. Introducing the Enron corpus. In CEAS.
[13]
Jure Leskovec, Daniel Huttenlocher, and Jon Kleinberg. 2010. Signed networks in social media. In Proceedings of the SIGCHI conference on human factors in computing systems. 1361–1370. https://doi.org/10.1145/1753326.1753532
[14]
Jure Leskovec, Jon Kleinberg, and Christos Faloutsos. 2007. Graph evolution: Densification and shrinking diameters. ACM transactions on Knowledge Discovery from Data (TKDD), 1, 1 (2007), 2–es. https://doi.org/10.1145/1217299.1217301
[15]
Magnus Madsen and Ondřej Lhoták. 2020. Fixpoints for the masses: programming with first-class Datalog constraints. Proceedings of the ACM on Programming Languages, 4, OOPSLA (2020), 1–28. https://doi.org/10.1145/3428193
[16]
Magnus Madsen, Ming-Ho Yee, and Ondřej Lhoták. 2016. From datalog to flix: A declarative language for fixed points on lattices. ACM SIGPLAN Notices, 51, 6 (2016), 194–208. https://doi.org/10.1145/2908080.2908096
[17]
Nicholas Matsakis. 2018. An alias-based formulation of the borrow checker. http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker
[18]
Nicholas Matsakis and The Rust Developers. 2021. Rust-Lang/polonius: Defines the Rust borrow checker. https://github.com/rust-lang/polonius
[19]
Nicholas D. Matsakis and Felix S. Klock. 2014. The Rust Language. Ada Lett., 34, 3 (2014), oct, 103–104. issn:1094-3641 https://doi.org/10.1145/2692956.2663188
[20]
Julian J McAuley and Jure Leskovec. 2012. Learning to discover social circles in ego networks. In NIPS. 2012, 548–56.
[21]
Frank McSherry and The Rust Developers. 2021. Rust-Lang/datafrog: A Lightweight Datalog engine in rust. https://github.com/rust-lang/datafrog
[22]
Matthew Might, Yannis Smaragdakis, and David Van Horn. 2010. Resolving and exploiting the k-CFA paradox: illuminating functional vs. object-oriented program analysis. In Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation. 305–315. https://doi.org/10.1145/1806596.1806631
[23]
Hung Q Ngo, Ely Porat, Christopher Ré, and Atri Rudra. 2018. Worst-case optimal join algorithms. Journal of the ACM (JACM), 65, 3 (2018), 1–40. https://doi.org/10.1145/3180143
[24]
Bernhard Scholz, Herbert Jordan, Pavle Subotić, and Till Westmann. 2016. On Fast Large-scale Program Analysis in Datalog. In Proceedings of the 25th International Conference on Compiler Construction. 196–206. https://doi.org/10.1145/2892208.2892226
[25]
Jiwon Seo, Jongsoo Park, Jaeho Shin, and Monica S. Lam. 2013. Distributed Socialite: A Datalog-Based Language for Large-Scale Graph Analysis. Proc. VLDB Endow., 6, 14 (2013), sep, 1906–1917. issn:2150-8097 https://doi.org/10.14778/2556549.2556572
[26]
Olin Shivers. 1991. Control-Flow Analysis of Higher-Order Languages. Ph. D. Dissertation. Carnegie-Mellon University. Pittsburgh, PA.
[27]
Yannis Smaragdakis and Martin Bravenboer. 2011. Using Datalog for Fast and Easy Program Analysis. In Proceedings of the First International Conference on Datalog Reloaded (Datalog’10). Springer-Verlag, Berlin, Heidelberg. 245–251. isbn:978-3-642-24205-2 https://doi.org/10.1007/978-3-642-24206-9_14
[28]
Pavle Subotić, Herbert Jordan, Lijun Chang, Alan Fekete, and Bernhard Scholz. 2018. Automatic Index Selection for Large-scale Datalog Computation. Proc. VLDB Endow., 12, 2 (2018), Oct., 141–153. issn:2150-8097 https://doi.org/10.14778/3282495.3282500
[29]
David Van Horn and Harry G Mairson. 2008. Deciding k CFA is complete for EXPTIME. ACM Sigplan Notices, 43, 9 (2008), 275–282. https://doi.org/10.1145/1411203.1411243
[30]
David Van Horn and Matthew Might. 2010. Abstracting Abstract Machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP ’10). ACM, New York, NY, USA. 51–62. isbn:978-1-60558-794-3 https://doi.org/10.1145/1863543.1863553
[31]
Kai Wang, Zhiqiang Zuo, John Thorpe, Tien Quang Nguyen, and Guoqing Harry Xu. 2018. RStream: Marrying Relational Algebra with Streaming for Efficient Graph Mining on a Single Machine. In Proceedings of the 13th USENIX Conference on Operating Systems Design and Implementation (OSDI’18). USENIX Association, USA. 763–782. isbn:9781931971478
[32]
Duncan J Watts and Steven H Strogatz. 1998. Collective dynamics of ‘small-world’networks. nature, 393, 6684 (1998), 440–442. https://doi.org/10.1038/30918
[33]
Aaron Weiss, Olek Gierczak, Daniel Patterson, Nicholas D Matsakis, and Amal Ahmed. 2019. Oxide: The essence of rust. arXiv preprint arXiv:1903.00982, https://doi.org/10.48550/arXiv.1903.00982

Cited By

View all
  • (2024)A Typed Multi-level Datalog IR and Its Compiler FrameworkProceedings of the ACM on Programming Languages10.1145/36897678:OOPSLA2(1586-1614)Online publication date: 8-Oct-2024
  • (2024)Making Formulog Fast: An Argument for Unconventional Datalog EvaluationProceedings of the ACM on Programming Languages10.1145/36897548:OOPSLA2(1219-1248)Online publication date: 8-Oct-2024
  • (2024)Separate Compilation and Partial Linking: Modules for Datalog IRProceedings of the 23rd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3689484.3690737(94-106)Online publication date: 21-Oct-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
CC 2022: Proceedings of the 31st ACM SIGPLAN International Conference on Compiler Construction
March 2022
253 pages
ISBN:9781450391832
DOI:10.1145/3497776
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 the author(s) 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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 March 2022

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Ascent
  2. Datalog
  3. Logic Programming
  4. Program Analysis
  5. Rust
  6. Static Analysis

Qualifiers

  • Research-article

Conference

CC '22
Sponsor:

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)37
  • Downloads (Last 6 weeks)2
Reflects downloads up to 18 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)A Typed Multi-level Datalog IR and Its Compiler FrameworkProceedings of the ACM on Programming Languages10.1145/36897678:OOPSLA2(1586-1614)Online publication date: 8-Oct-2024
  • (2024)Making Formulog Fast: An Argument for Unconventional Datalog EvaluationProceedings of the ACM on Programming Languages10.1145/36897548:OOPSLA2(1219-1248)Online publication date: 8-Oct-2024
  • (2024)Separate Compilation and Partial Linking: Modules for Datalog IRProceedings of the 23rd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3689484.3690737(94-106)Online publication date: 21-Oct-2024
  • (2024)Flan: An Expressive and Efficient Datalog Compiler for Program AnalysisProceedings of the ACM on Programming Languages10.1145/36329288:POPL(2577-2609)Online publication date: 5-Jan-2024
  • (2024)Adaptive Recursive Query Optimization2024 IEEE 40th International Conference on Data Engineering (ICDE)10.1109/ICDE60146.2024.00035(368-381)Online publication date: 13-May-2024
  • (2023)Bring Your Own Data Structures to DatalogProceedings of the ACM on Programming Languages10.1145/36228407:OOPSLA2(1198-1223)Online publication date: 16-Oct-2023
  • (2023)Better Together: Unifying Datalog and Equality SaturationProceedings of the ACM on Programming Languages10.1145/35912397:PLDI(468-492)Online publication date: 6-Jun-2023

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media