一句话:将派生事实视为测试用例、证明树视为执行谱,把 SBFL 迁移到 Datalog,实现无需人工交互的故障规则定位。
Datalog 已被广泛用于程序分析、安全与数据密集型系统,但其声明式语义、缺乏显式控制流以及派生事实规模庞大,使调试极为困难。现有的证明树检查、算法调试与交互式调试都要求开发者手动在深层递归推导中导航,难以应对真实程序。本文提出一种全自动调试思路:从统计视角重新解释 Datalog 执行,不再解释单个事实,而是把派生事实整体当作测试用例、把其证明树当作执行谱,从而将基于谱的故障定位(SBFL)适配到 Datalog,弥合了声明式逻辑程序与面向命令式语言设计的自动调试技术之间的范式鸿沟。为支持系统评估,作者从 Doop 框架的演化历史中挖掘出首个 Datalog 调试基准套件,包含 96 个真实实例、37 个唯一故障,每个实例标注了真实故障规则并按三级故障分类组织。实验表明该方法无需任何用户交互即可有效定位故障,最优可疑度度量在故障规则定位上达到 87.50% 的 Hit@1,故障谓词定位的 Hit@1 为 37.50%–53.12%。
Datalog has become a widely adopted language in program analysis, security, and data-intensive systems. However, debugging Datalog programs remains fundamentally challenging due to their declarative semantics, lack of explicit control flow, and massive scale of derived facts. Existing approaches, such as inspecting proof trees, algorithmic debugging, or interactive debugging, all require developers to manually navigate through deeply recursive derivations, which quickly becomes infeasible for real-world programs. In this paper, we take a step toward fully automated debugging of Datalog programs. Our key insight is to reinterpret Datalog execution through a statistical lens: instead of explaining individual facts, we analyze multiple facts collectively, treating derived facts as test cases and their proof trees as execution spectra. This abstraction enables us to adapt Spectrum-based Fault Localization (SBFL) to Datalog, bridging the paradigm gap between declarative logic programs and automated debugging techniques originally designed for imperative languages. To enable systematic evaluation, we construct, to the best of our knowledge, the first benchmark suite for Datalog debugging, comprising 96 real-world instances (37 unique faults) mined from the evolution history of the Doop framework. Each instance is annotated with ground-truth faulty rules and organized under a three-level fault taxonomy. Experimental results demonstrate that our approach effectively localizes faults without any user interaction. The best suspiciousness metric achieves 87.50% Hit@1 (i.e., top-1 hit rate) for faulty rule localization, while faulty predicate localization reaches 37.50%–53.12% Hit@1.
@article{paperbot12092,
title = {Automated Debugging of Datalog Programs},
author = {Jiashen Wei and Baoyuan Luo and Runshuo Xie and Yun Qi and Yiyu Zhang and Xizao Wang and Xintao Niu and Zhiqiang Zuo},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {OOPSLA2},
year = {2026},
doi = {10.1145/3839516}
}