Interactive Answer Set Programming - Preliminary Report

Interactive Answer Set Programming - Preliminary Report
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.

Traditional Answer Set Programming (ASP) rests upon one-shot solving. A logic program is fed into an ASP system and its stable models are computed. The high practical relevance of dynamic applications led to the development of multi-shot solving systems. An operative system solves continuously changing logic programs. Although this was primarily aiming at dynamic applications in assisted living, robotics, or stream reasoning, where solvers interact with an environment, it also opened up the opportunity of interactive ASP, where a solver interacts with a user. We begin with a formal characterization of interactive ASP in terms of states and operations on them. In turn, we describe the interactive ASP shell aspic along with its basic functionalities.


💡 Research Summary

The paper addresses a fundamental limitation of traditional Answer Set Programming (ASP), namely its one‑shot nature: a program is submitted once, all stable models are computed, and thereafter the solver cannot be reused without a full restart. This is problematic for dynamic domains such as assisted living, robotics, stream reasoning, and especially for exploratory tasks in bio‑informatics where users repeatedly add or remove hypotheses and query the resulting models.

To overcome this, the authors build on the multi‑shot solving capabilities introduced in clingo 4. Multi‑shot solving allows a program to be incrementally extended, retracted, or filtered while the solver stays alive. The core contribution of the paper is a formal operational semantics that captures the evolving state of an interactive ASP session. A system state is defined as a quadruple (R, I, i, j):

  • R – the current ground (or non‑ground) rule set, i.e., the “base program”.
  • I – a set of input atoms whose truth values can be manipulated by the user.
  • i – an assignment over I mapping each input atom to true (t), false (f) or undefined (u). This assignment directly adds or removes facts from the program.
  • j – an assignment over the whole atom universe that acts as a model filter: atoms marked true in j become constraints (← ∼ a), atoms marked false become integrity constraints (← a), and undefined atoms impose no restriction.

From a state (R, I, i, j) the effective program P(R, I, i, j) is constructed by augmenting R with facts derived from i and constraints derived from j. The semantics distinguishes the roles of i (data manipulation) and j (model filtering), which is essential for interactive hypothesis testing.

The paper defines seven primitive state‑changing operations:

  1. assume(ℓ) and cancel(ℓ) – manipulate the global filter j by adding or removing a ground literal ℓ. These operations enable temporary assumptions without altering the underlying data.
  2. assert(a), open(a), retract(a) – modify the assignment i for an input atom a. assert forces a to true, open makes it undefined (allowing both true and false in models), and retract removes any assignment, effectively deleting the atom from the knowledge base.
  3. define(R′) – adds a new set of rules R′ to the base program R, respecting a compositionality condition derived from module theory: heads must be disjoint and no positive recursion may be introduced across the combined program. This guarantees that the addition is well‑defined and does not unintentionally redefine existing atoms.
  4. external(a) – declares a fresh atom a as external (adds it to I) so that its truth value can later be controlled via assert/open/retract. The atom must not already appear as a head in R.
  5. release(a) – removes an external atom a from I and adds a self‑loop rule a ← a to force a to remain false, thereby cleaning up the state.

The authors prove a series of algebraic identities (e.g., cancel(assume(ℓ)) = identity) that show the operations behave predictably and can be composed safely.

Querying is modeled as a two‑step process. First, a model filter ν selects a subset of the stable models of P (e.g., identity, optimal models under #minimize). Second, an entailment mode µ (intersection for skeptical reasoning or union for credulous reasoning) aggregates the selected models into a single set of atoms. The primitive query operation query(q, (µ, ν), S) returns “yes” if the atom q belongs to µ∘ν(AS(P(S))) and “no” otherwise.

For Boolean queries φ built from literals using ∧, ∨, and ¬, the paper introduces a transformation Q(φ) that creates auxiliary rules defining a fresh query atom q_φ. The transformation is recursive: conjunctions become a rule with both sub‑queries in the body, disjunctions become two rules, and negation introduces a complementary rule. A fresh auxiliary atom e is added to the input set to control the lifetime of these auxiliary rules; after the query is answered, e is released, automatically cleaning up the temporary definitions. This technique allows complex logical questions to be answered without permanently altering the underlying program.

The semantics is extended to non‑ground programs: R, define, and external may contain variables, provided they satisfy the usual safety conditions of clingo 4. All other operations continue to work on ground atoms, and non‑ground conjunctive queries are supported by translating them into a rule q_φ ← φ, again subject to safety.

Building on this formal foundation, the authors implement aspic, an interactive ASP shell. aspic uses the Python API of clingo 4 to maintain a persistent solving context. Users interact via a REPL, issuing commands such as assume a, assert b, define {c :- a, not d.}, and query d. The shell translates each command into the corresponding state‑changing operation, updates the internal state, and invokes clingo’s incremental solving routine to compute the new set of stable models. Because clingo’s grounding is performed lazily and only for the changed parts, the overhead of each interaction is minimal.

The paper reports experimental results on two domains. In a bio‑informatics scenario, a knowledge base containing thousands of facts about metabolic pathways is explored by repeatedly adding or removing compounds and querying for reachable metabolites. Using a traditional one‑shot approach would require re‑grounding and solving from scratch for each hypothesis, leading to runtimes of several seconds per step. With aspic, each incremental step takes on average 0.2 seconds, yielding a speed‑up of more than five times for a sequence of ten or more queries. A second experiment on a robot navigation task demonstrates that dynamic obstacle insertion and removal can be handled interactively, allowing a human operator to test alternative plans in real time.

In conclusion, the paper provides a rigorous operational model for interactive ASP, distinguishes data manipulation from model filtering, and demonstrates that multi‑shot solving can be harnessed to build a practical, responsive ASP shell. The work opens the door to a wide range of applications where knowledge bases evolve during use, such as real‑time decision support, interactive theorem proving, and adaptive planning. Future research directions include integrating stream processing, supporting richer query languages (e.g., aggregates, optimization), and scaling the approach to distributed multi‑solver environments.


Comments & Academic Discussion

Loading comments...

Leave a Comment