Single-world counterfactual reasoning in ProbLog
Saimun Habib, Vaishak Belle, Fengxiang HeAbstract
Probabilistic logic programming (PLP) languages such as ProbLog naturally support reasoning under uncertainty while maintaining a declarative and interpretable framework. Counterfactual reasoning (i.e. answering ‘what if’ questions) is important for explanation, diagnosis and causal reasoning in probabilistic logic models. However, integrating this capability into PLP can be computationally prohibitive. This paper addresses this challenge by proposing an efficient programme transformation for counterfactuals as single-world intervention programmes in ProbLog. By systematically splitting ProbLog clauses into observed and fixed components relevant to a counterfactual, we obtain a transformation with the same worst-case asymptotic construction order as existing methods but a strictly smaller representation under the stated assumptions. We formally prove the correctness of our approach, which avoids the additional cross-world independence commitments induced by duplicated twin-network representations and is consistent with conditional independencies, showing that the resulting marginal probabilities match the counterfactual distributions of the underlying structural causal model across a broad class of domains. Our method achieves a 35% reduction in inference time versus existing methods in extensive experiments. This work makes complex counterfactual reasoning more computationally tractable and reliable, providing a crucial step towards developing more robust and explainable AI systems. The code is at https://github.com/EVIEHub/swip.