🤖 AI Summary
This work addresses the lack of effective static analysis techniques for goal-directed Answer Set Programming (ASP), which hinders compile-time verification and optimization. It introduces abstract interpretation to this paradigm for the first time, proposing a top-down analysis algorithm based on PLAI fixpoints and designing a novel Shared-Constraints abstract domain to precisely capture variable relationships induced by constraints. Implemented as a preprocessor in Ciao Prolog and integrated into the s(CASP) system, the approach enables efficient detection of spurious odd loops, optimized forall evaluation, and global constraint simplification. These capabilities substantially enhance both the compile-time analyzability and runtime performance of goal-directed ASP programs.
📝 Abstract
Abstract Interpretation infers and verifies program properties by over-approximating program semantics. It has been highly successful for (Constraint) Logic Programming, enabling the analysis of determinism, types, aliasing, and resource usage, as well as application in verification and program optimization. However, Abstract Interpretation has not yet been studied in the context of Goal Directed Answer Set Programming (ASP). In this work, we take a first step in this direction. We present a top-down algorithm based on the PLAI fixpoint, implemented in the abstract interpreter of the Ciao Prolog Preprocessor, to perform abstract interpretation of goal-directed ASP. We also introduce the Shared-Constraints abstract domain, designed to capture potential relations among variables induced by constraints. Finally, we study the practicality of the approach in s(CASP) through three applications: detection of false odd loops over negation, efficient forall evaluation enabled by the Shared-Constraints domain, and abstract specialization (including the simplification of required global constraints). Our results show that compile-time static analysis can improve the evaluation of goal-directed ASP programs.