๐ค AI Summary
This work addresses the challenge of concisely expressing Datalog-style logical rules and queries within Lean, a highly expressive yet complex proof assistant based on the Calculus of Inductive Constructions (CIC). To this end, the authors propose a shallowly embedded domain-specific language (DSL) that enables, for the first time, a seamless integration of Datalog into Lean. The DSL supports declarative definitions of facts and rules, backward-chaining queries, andโcruciallyโthe automatic translation of Datalog queries into theorems accompanied by proof scripts, thereby establishing bidirectional interoperability with Leanโs native reasoning framework. The effectiveness of the approach is demonstrated through three representative case studies, which collectively illustrate its expressiveness in rule formulation, readability of queries, and capability to support formal verification.
๐ Abstract
Datalog is a lightweight logic programming language, based on the logic of Horn clauses. Lean, on the other hand, is a proof assistant system and language based on the Calculus of Inductive Constructions (CIC). Datalog is more constrained and less expressive than Lean but has a long history of established deduction algorithms. Writing definitions and queries in the Datalog fragment of Lean would be more succinct and understandable than writing them in Lean itself.
This paper outlines the design and implementation of a shallow embedding of Datalog as a Domain Specific Language (DSL) on top of Lean. Bidirectional interoperability between the Datalog DSL and Lean is a primary goal of this design. In addition to rules and facts, backward chaining queries are automatically translated into theorems with tactic-based proofs. The paper also includes three simple examples of how the DSL can be used.