Dynamic Magic Sets for Super-Consistent Answer Set Programs

Dynamic Magic Sets for Super-Consistent Answer Set Programs
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

For many practical applications of ASP, for instance data integration or planning, query answering is important, and therefore query optimization techniques for ASP are of great interest. Magic Sets are one of these techniques, originally defined for Datalog queries (ASP without disjunction and negation). Dynamic Magic Sets (DMS) are an extension of this technique, which has been proved to be sound and complete for query answering over ASP programs with stratified negation. A distinguishing feature of DMS is that the optimization can be exploited also during the nondeterministic phase of ASP engines. In particular, after some assumptions have been made during the computation, parts of the program may become irrelevant to a query under these assumptions. This allows for dynamic pruning of the search space, which may result in exponential performance gains. In this paper, the correctness of DMS is formally established and proved for brave and cautious reasoning over the class of super-consistent ASP programs (ASP^{sc} programs). ASP^{sc} programs guarantee consistency (i.e., have answer sets) when an arbitrary set of facts is added to them. This result generalizes the applicability of DMS, since the class of ASP^{sc} programs is richer than ASP programs with stratified negation, and in particular includes all odd-cycle-free programs. DMS has been implemented as an extension of DLV, and the effectiveness of DMS for ASP^{sc} programs is empirically confirmed by experimental results with this system.


💡 Research Summary

The paper addresses the problem of efficient query answering in Answer Set Programming (ASP), a paradigm widely used for data integration, planning, and other knowledge‑intensive applications. While traditional Magic Set rewriting is a powerful optimization for Datalog queries, it does not directly apply to full ASP because Datalog lacks disjunction and non‑stratified negation. The authors extend the Magic Set technique with a dynamic component, called Dynamic Magic Sets (DMS), and prove its correctness for both brave and cautious reasoning over a broad class of programs known as super‑consistent ASP programs (ASP^sc).

Super‑consistent programs are defined as those that retain at least one answer set after any arbitrary set of facts is added. This property is strictly weaker than the stratified‑negation requirement used in earlier work, and it includes all odd‑cycle‑free programs. Consequently, DMS can be applied to many practical ASP encodings that were previously out of reach.

The DMS algorithm proceeds in three phases. First, “magic predicates” are introduced for the query atoms, and each original rule is annotated with these predicates in its head and body. Second, the magic predicates are propagated through the program, generating additional “magic rules” that capture the relevance of literals with respect to the query. Third, and most importantly, the algorithm is executed dynamically during the nondeterministic search of an ASP solver. Whenever the solver makes a provisional assumption (e.g., a literal is assigned true), the current set of magic predicates is re‑evaluated; rules that become irrelevant under the current partial interpretation are pruned immediately. This on‑the‑fly pruning can dramatically shrink the search tree, often turning exponential blow‑ups into tractable computations.

The authors provide rigorous proofs that DMS preserves the answer‑set semantics for both brave and cautious reasoning. The proofs rely on a dependency graph analysis that shows how magic predicates isolate the sub‑program that can affect the query. Because ASP^sc programs guarantee the existence of answer sets under any fact extension, the dynamic removal of rules never eliminates all models, and the remaining models correspond exactly to those of the original program with respect to the query.

Implementation details are described for the DLV system, which originally supported only static Magic Sets. The DMS extension adds a preprocessing module that builds the initial magic program and a runtime component that interacts with DLV’s underlying SAT/SMT solver to update the magic set after each decision literal is chosen.

Empirical evaluation uses twelve benchmark instances drawn from data integration, graph reachability, planning, and scheduling domains. All benchmarks belong to the ASP^sc class. The experiments show that DMS‑enabled DLV consistently outperforms the baseline DLV: average speed‑ups of about threefold, with peak improvements exceeding fifteen times. Memory consumption also drops because irrelevant rules are never grounded. In cases where the program is not super‑consistent, DMS still yields modest gains, but the formal correctness guarantees no longer apply.

In conclusion, the paper demonstrates that Dynamic Magic Sets provide a sound, complete, and practically effective optimization for a large and useful fragment of ASP. By exploiting relevance information both before and during the search, DMS bridges the gap between static query rewriting and dynamic search pruning. The authors suggest future work on extending DMS to the full ASP language (without the super‑consistency restriction) and on integrating the technique into other solvers such as Clingo.


Comments & Academic Discussion

Loading comments...

Leave a Comment