ASP-PROLOG: a system for reasoning about answer set programs in prolog

Omar El-Khatib, Enrico Pontelli, Tran Cao Son

Abstract

ASP-PROLOG is a hybrid logic programming system that integrates Answer Set Programming (ASP) with Prolog. By treating ASP programs as dynamic, first-class objects, it enables Prolog to perform meta-reasoning over multiple stable models. This paper details the architecture, interface layer, and evaluation of the system using planning benchmarks.

Introduction

Presented at the 2004 International Symposium on Practical Aspects of Declarative Languages, ASP-PROLOG merges the strengths of ASP and Prolog. While ASP is ideal for solving difficult combinatorial problems like planning and scheduling, Prolog provides the necessary meta-programming and procedural control to manage complex reasoning tasks. This integration transforms ASP from a static "batch-process" solver into a flexible tool for interactive development.

Problem Statement

Traditional ASP systems often operate in isolation, suffering from three major limitations:

  1. Monolithic Execution: Solvers typically run in "batch mode," where rules are fixed before execution, lacking interactivity.
  2. Lack of Meta-Reasoning: Comparing or selecting between different stable models based on user-defined preferences is difficult within pure ASP.
  3. Integration Barriers: ASP solvers are often hard to embed into larger software systems without complex, low-level APIs.

System Architecture and Methods

ASP-PROLOG introduces a multi-sorted logic to distinguish between Prolog sorts (Sort P) and ASP sorts (Sort A). The system architecture is designed around a preprocessor and a robust interface layer.

The ASP-PROLOG system architecture, illustrating the transformation of modules into CIAO Prolog and the interaction with the Smodels solver.

Key components of the system include:

  • Interface Constraints: Special predicates like assert/1, retract/1, and model/2 allow Prolog to inject or remove rules from an ASP module dynamically.
  • Model Classes: Each stable model is represented as a CIAO class instance, enabling Prolog to query a specific model's contents using standard predicate calls (e.g., Model:predicate(X)).
  • Back-end Solver: The system utilizes Smodels, a popular ASP inference engine, for the actual computation of stable models.

A key technical feature is the distinction between backtrackable and non-backtrackable updates. Using assert, changes to the ASP program are undone if Prolog backtracks, whereas assert_nb makes permanent changes.

Evaluation: The Block World Problem

The system's utility is demonstrated through a classic Block World planning problem. ASP-PROLOG allows Prolog to act as a meta-manager, iteratively adjusting parameters—such as the plan length—in an ASP module until a valid solution is found. This automates what is usually a manual process in standard ASP solvers.

A visualization of the Block World problem, used as a benchmark to demonstrate iterative planning and meta-reasoning in ASP-PROLOG.

Key Insights

  • ASP as a Dynamic Data Structure: The most significant shift is treating an ASP program not as a static text file, but as a dynamic data structure that a meta-program can manipulate.
  • Reasoning About Models: By representing models as objects, Prolog can perform complex filtering, such as finding the shortest plan or applying soft constraints across different models.
  • Interactive Development: The integration supports a development style similar to the Prolog REPL, where users can explore the consequences of logic changes in real-time.

Results and Future Work

ASP-PROLOG successfully integrates CIAO Prolog and Smodels, providing a powerful environment for meta-level tasks. While the system shows high expressive power, future research will focus on reducing the computational overhead of model recomputation and exploring "reverse communication," where ASP modules can proactively request information from Prolog during the grounding phase. Additionally, the authors plan to integrate Constraint Logic Programming (CLP) to handle numerical constraints more efficiently.

Summary updated

BibTeX
@inproceedings{elkhatib2004asp,
  author = {Omar El-Khatib and Enrico Pontelli and Tran Cao Son},
  title = {{ASP-PROLOG: a system for reasoning about answer set programs in prolog}},
  booktitle = {NMR},
  year = {2004},
}
Figure