An Unfolding-Based Semantics for Logic Programming with Aggregates

Tran Cao Son, Enrico Pontelli, Islam ElkabaniarXiv 2006

Introduction

Answer Set Programming (ASP) has emerged as a powerful declarative paradigm for solving complex combinatorial problems. In ASP, users describe the properties of a valid solution rather than the specific steps required to compute it. While standard ASP is highly effective, real-world applications frequently require the use of aggregates—functions such as SUM, COUNT, MIN, and MAX that operate over sets of data.

A significant challenge in the field involves the semantics of recursive aggregates. For instance, in a business context, determining if Company A controls Company B might depend on a SUM of shares, which in turn depends on which other companies Company A controls. Defining a stable model for such recursive dependencies is mathematically complex. Previous approaches often restricted recursion or produced results that lacked intuitive alignment with core logic programming principles. This paper introduces a novel "unfolding-based" semantics to provide a rigorous mathematical foundation for aggregates that supports recursion and non-monotonicity while remaining computationally practical.

The Unfolding Framework

The core contribution of this work is the concept of unfolding, a process that transforms complex aggregate atoms into sets of simpler logic rules. The authors propose two equivalent definitions for answer sets under this framework:

  1. Aggregate Solutions as Building Blocks: The authors treat an aggregate atom not as an opaque function, but as a collection of "solutions." Each solution is defined as a pair of sets: the atoms that must be true and the atoms that must be false to satisfy the aggregate's condition.
  2. Definition 1: The Unfolding Transformation: This approach translates a program containing aggregates into a "normal" logic program. By replacing each aggregate with its possible solutions, the authors allow the program to be processed by standard, off-the-shelf ASP solvers.
  3. Definition 2: Generate-and-Test Reduct: Similar to the classic Gelfond-Lifschitz reduct, this definition provides a way to check if a specific interpretation is an answer set by producing a positive program and verifying its minimality.

By proving these two definitions are mathematically identical, the authors ensure a robust framework that bridges theoretical stability with practical implementation.

Implementation: The $ASP^A$ System

To validate their semantics, the authors developed $ASP^A$, a prototype system that functions as a sophisticated pre-processor. $ASP^A$ performs the unfolding transformation on programs with aggregates and then passes the resulting simplified program to established solvers such as Smodels or Cmodels.

One of the key advantages of this method is that it is "aggregate-agnostic." The semantics remain consistent regardless of the specific function used (SUM, AVG, etc.), provided the solutions for that function can be computed. Furthermore, the framework naturally supports aggregates in the head of a rule (the "then" part), enabling more declarative "choice" rules, such as assigning students to projects while maintaining a total budget constraint.

Experimental Evaluation

The authors evaluated the $ASP^A$ system using a variety of classic and synthetic benchmarks designed to test the limits of recursive and non-monotonic logic:

  • Company Control: A recursive problem determining corporate control based on share percentages.
  • Shortest Path: Finding the minimum weight path within a graph.
  • Social and Constraint Problems: Including "Party Invitations" (where attendance depends on friends' attendance) and "Group Seating" for restaurant assignments.
  • Synthetic Benchmarks (NM1 & NM2): Specifically designed to test large-scale recursive aggregates.

Key Results

  • Recursive Capability: $ASP^A$ successfully computed answer sets for recursive benchmarks like Company Control and NM1, which were beyond the capabilities of other state-of-the-art systems at the time, such as $DLV^A$.
  • Performance: While $DLV^A$ maintained a speed advantage on simpler "stratified" programs, $ASP^A$ demonstrated competitive timing and provided much broader coverage of complex problem types.
  • Theoretical Alignment: The authors demonstrated that their unfolding semantics coincide with "Ultimate Stable Model" semantics, providing a high degree of theoretical justification.

Limitations and Future Directions

While the unfolding method is powerful, it currently relies on finite domains. Programs involving infinite sequences or continuous mathematics would require significant modifications to the unfolding process. Additionally, while the paper touches on negated aggregates, the primary focus remains on positive aggregate atoms.

Future work suggests that the overhead of the pre-processor could be reduced by integrating the unfolding logic directly into the "branch-and-bound" process of an ASP solver. This would avoid the creation of large intermediate programs and potentially offer significant performance gains in industrial-scale applications.

Summary updated

BibTeX
@misc{son2006unfolding,
  author = {Tran Cao Son and Enrico Pontelli and Islam Elkabani},
  title = {{An Unfolding-Based Semantics for Logic Programming with Aggregates}},
  year = {2006},
  eprint = {cs/0605038},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/cs/0605038},
}
Figure