Counting Answer Sets of Disjunctive Answer Set Programs

Mohimenul Kabir, Supratik Chakraborty, Kuldeep S. Meel

Abstract

Counting the answer sets of disjunctive logic programs is a computationally intensive task, classified as #·co-NP complete. Traditional approaches relying on enumeration fail when solution sets are large. This paper introduces sharpASP-SR, a framework that utilizes a subtractive reduction technique to transform the counting problem into a projected model counting problem. By focusing on loop atoms and leveraging high-performance #SAT solvers, sharpASP-SR can handle programs with massive solution sets, significantly outperforming existing state-of-the-art solvers.

Introduction

Answer Set Programming (ASP) is a prominent paradigm in knowledge representation and reasoning. While finding a single answer set is a common task, many applications—such as probabilistic reasoning and network reliability analysis—require counting the total number of valid answer sets. For disjunctive logic programs, which allow disjunctions in rule heads (e.g., "A or B is true if C is true"), this counting task is particularly challenging. The complexity of counting answer sets for these programs is #·co-NP complete, making it significantly harder than counting for normal logic programs.

The Challenge of Disjunctive ASP

Existing ASP solvers typically employ enumeration-based methods. While effective for programs with a small number of solutions, these methods are impractical for problems with trillions of answer sets. Alternative approaches that translate disjunctive programs into normal programs often result in an exponential explosion in the size of the logic formula, rendering them unusable for complex real-world instances.

Methodology: The sharpASP-SR Framework

The proposed sharpASP-SR system addresses these limitations through three primary innovations:

1. Subtractive Reduction

Rather than counting answer sets directly, sharpASP-SR employs a "subtractive reduction" strategy. It first counts a superset of solutions—specifically, the models of the program's Clark Completion, which are easier to identify. It then identifies and subtracts the "surplus" models—those that satisfy the completion but do not qualify as valid answer sets.

2. Loop-Atom Characterization

To prevent the exponential growth of logic formulas during translation, the authors developed a new mathematical characterization of answer sets. This definition focuses exclusively on loop atoms—variables involved in circular dependencies. By introducing "copy variables" only for these loop atoms, the framework maintains a polynomial-sized Boolean formula, keeping the problem manageable for modern solvers.

3. Projected Model Counting

The task of counting the surplus models is reduced to projected propositional model counting. This reduction allows the framework to utilize highly optimized, off-the-shelf #SAT solvers like GANAK.

4. Hybrid Execution

Recognizing that enumeration is more efficient for small solution sets, the authors implemented a hybrid approach. The tool initially uses a standard solver (clingo) to enumerate solutions. If the count exceeds a threshold (10,000), it automatically transitions to the sharpASP-SR algorithm.

Experimental Evaluation

The framework was evaluated using a comprehensive benchmark of 1,125 instances across domains including Strategic Companies, Abstract Argumentation, PC Configuration, and Minimal Trap Spaces in systems biology.

Key Results

  • Scalability: While traditional solvers like clingo and Wasp timed out on instances with more than $2^{30}$ solutions, sharpASP-SR successfully processed instances with up to $2^{127}$ answer sets.
  • Performance: sharpASP-SR solved 825 out of 1,125 instances, compared to 708 for clingo and 432 for Wasp.
  • Hybrid Success: The hybrid version achieved the highest performance, solving 918 instances and maintaining the lowest PAR2 score, demonstrating the effectiveness of combining enumeration with subtractive reduction.

Conclusion and Future Work

The sharpASP-SR framework represents a significant advancement in the scalability of answer set counting for disjunctive programs. By leveraging subtractive reduction and projected model counting, it bypasses the limitations of enumeration and exponential formula growth. However, performance remains sensitive to the degree of cyclicity in the program; highly cyclic programs with many loop atoms still pose a challenge. Future research will explore the applicability of subtractive methods to other complex counting problems in logic and automated reasoning.

Summary updated

BibTeX
@article{kabir2025counting,
  author = {Mohimenul Kabir and Supratik Chakraborty and Kuldeep S. Meel},
  title = {{Counting Answer Sets of Disjunctive Answer Set Programs}},
  journal = {Theory Pract. Log. Program.},
  year = {2025},
  doi = {10.1017/s1471068425100124},
}
Figure