Justifications for logic programs under answer set semantics

Enrico Pontelli, Tran Cao Son, Omar El-Khatib

TL;DR

This paper introduces "justifications" – graph-based explanations for why atoms are true or false in Answer Set Programming (ASP). It presents both "off-line" justifications (explaining final answer sets) and "on-line" justifications (explaining intermediate steps during computation), aiming to significantly improve debugging and understanding of ASP programs.

What Problem Does This Paper Address?

Answer Set Programming (ASP) is a powerful declarative programming paradigm, but its "black box" nature makes debugging and understanding program behavior challenging. Unlike imperative languages with step-by-step execution and variable inspection, ASP solvers typically produce a final set of answer sets without detailed explanations of how those sets were derived. This lack of transparency hinders developers in understanding why a program produces unexpected results (e.g., missing or incorrect answer sets) or how specific atoms gain their truth values. This paper aims to bridge this gap by providing formal mechanisms for explaining ASP computations.

Methods

The paper introduces two core concepts:

  • Off-line Justifications: These are graph structures that explain the truth value of an atom with respect to a final answer set. They are built upon the idea of "Local Consistent Explanations" (LCEs), which represent the immediate reasons for an atom's truth or falsity based on program rules and a given interpretation. These LCEs are then composed into larger "explanation graphs" (e-graphs). The paper defines specific properties for these graphs to ensure they are valid explanations, such as avoiding positive cycles for true atoms.
  • On-line Justifications: These are designed to explain atom truth values during the computation of an answer set, when the interpretation is still partial and potentially inconsistent. This is achieved by defining operators (Γ and Δ) that incrementally build up justifiable elements. On-line justifications are essentially sequences of snapshots of these intermediate states, allowing for a "declarative trace" of the computation process. This is particularly useful for debugging systems like SMODELS that use incremental, choice-based computation.

The paper also details how these concepts are integrated into the ASP-PROLOG system, allowing programmers to query and visualize these justifications.

Datasets

Not discussed in the paper. The paper focuses on the theoretical framework and its integration with existing ASP solvers rather than introducing new datasets for evaluation.

Key Insights and Ideas

  • Bridging the Declarative-Algorithmic Divide: The core insight is that by providing justifications, we can offer a "declarative trace" that mirrors the "algorithmic trace" of imperative languages, making ASP more accessible for debugging.
  • Two-Tiered Explanation: The distinction between off-line and on-line justifications is crucial. Off-line explanations are for understanding the final outcome, while on-line explanations are vital for debugging the process of reaching that outcome, especially in complex, non-monotonic systems like ASP.
  • Graph-Based Reasoning: Using graphs as the fundamental data structure for explanations is a powerful way to represent complex dependencies and derivations in a visually intuitive manner.
  • Handling Assumptions: The framework explicitly addresses the role of "assumptions" (atoms whose truth values are guessed during computation) in justifications, providing a way to explain why certain choices were made.

Key Results

  • Formal definitions for off-line and on-line justifications are provided, based on graph structures and local consistent explanations.
  • The paper demonstrates how these justifications can be integrated into existing ASP computation models, specifically SMODELS.
  • A preliminary implementation in ASP-PROLOG is described, enabling programmers to use Prolog to query and visualize justifications.
  • The work lays the groundwork for developing sophisticated debugging tools for ASP.

Limitations and Future Work

  • Implementation Complexity: While a prototype is developed, the paper notes that a full implementation requires handling advanced features of SMODELS (heuristics, lookahead) and potentially other ASP solvers.
  • Scalability: The paper hints at complexity issues related to LCE existence and suggests further investigation.
  • Future Work: The authors propose to:
  • Complete the implementation and refine on-line justification definitions to better leverage SMODELS mechanisms.
  • Develop a comprehensive debugging and visualization environment for ASP.
  • Adapt the framework for language extensions like choice atoms and weight constraints.

Summary updated

BibTeX
@inproceedings{pontelli2006justifications,
  author = {Enrico Pontelli and Tran Cao Son and Omar El-Khatib},
  title = {{Justifications for logic programs under answer set semantics}},
  booktitle = {Theory Pract. Log. Program},
  year = {2006},
  url = {https://openreview.net/forum?id=bS1y5VwLCFn},
}
Figure