Seamless deductive inference via macros

Arash Sahebolamri, Thomas Gilray, Kristopher Micinski
2022 Proceedings of the 31st ACM SIGPLAN International Conference on Compiler Construction  
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 userdefined components written in Rust, addressing a challenge in real-world use of logic programming languages: the fact that logical programs are
more » ... 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.
doi:10.1145/3497776.3517779 fatcat:fkotic4oszeqhan2imae6c6h3e