In: Proc. Seventeenth International Joint Conference on Artificial Intelligence (IJCAI-01), 2001.

A Framework for Declarative Update Specifications in Logic Programs

Thomas Eiter and Michael Fink and Giuliana Sabbatini and Hans Tompits Institut für Informationssysteme, Abteilung Wissensbasierte Systeme 184/3, Technische Universität Wien, Favoritenstrasse 9-11, A-1040 Vienna, Austria

E-mail:{eiter,michael,giuliana,tompits}@kr.tuwien.ac.at

Abstract

Recently, several approaches for updating knowledge bases represented as logic programs have been proposed. In this paper, we present a generic framework for declarative specifications of update policies, which is built upon such approaches. It extends the LUPS language for update specifications and incorporates the notion of events into the framework. An update policy allows an agent to flexibly react upon new information, arriving as an event, and perform suitable changes of its knowledge base. The framework compiles update policies to logic programs by means of generic translations, and can be instantiated in terms of different concrete update approaches. It thus provides a flexible tool for designing adaptive reasoning agents.

1 Introduction

Updating knowledge bases is an important issue for the realization of intelligent agents, since, in general, an agent is situated in a changing environment and must adjust its knowledge base when new information is available. While for classical knowledge bases this issue has been well-studied, approaches to update nonmonotonic knowledge bases, like, e.g., updates of logic programs [Alferes et al., 2000; Eiter et al., 2000; Zhang and Foo, 1998; Inoue and Sakama, 1999] or of default theories [Williams and Antoniou, 1998], are more recent.

The problem of updating logic programs, on which we focus here, deals with the incorporation of an update P, given by a rule or a set of rules, into the current knowledge base KB. Accordingly, sequences P_{1}, …, P_{n} of updates lead to sequences (KB, P_{1}, …, P_{n}) of logic programs, which are given a declarative semantics. To broaden this approach, Alferes et al. [1999a] have proposed the LUPS update language, in which updates consist of sets of update commands. Such commands permit to specify changes to KB in terms of adding or removing rules from it. For instance, a typical command is assert a ← b when c, stating that rule a ← b should be added to KB if c is currently true in it. Similarly, retract b expresses that b must be eliminated from KB, without any further condition.

However, a certain limitation of LUPS and the above mentioned formalisms is that while they handle ad hoc changes of KB, they are not conceived for handling a yet unknown update, which will arrive as the environment evolves. In fact, these approaches lack the possibility to specify how an agent should react upon the arrival of such an update. For example, we would like to express that, on arrival of the fact best buy(shop_{1} ), this should be added to KB, while bestbuy information about other shops is removed from KB.

In this paper, we address this issue and present a declarative framework for specifying update behavior of an agent. The agent receives new information in terms of a set of rules (which is called an event), and adjusts its KB in accord to a given update policy, consisting of statements in a declarative language. Our main contributions are summarized as follows:

(1) We present a generic framework for specifying update behavior, which can be instantiated with different update approaches to logic programs. This is facilitated by a layered approach: At the top level, the update policy is evaluated, given an event and the agent’s current belief set, to single out the update commands U which need to be performed on KB. At the next layer, U is compiled to a set P of rules to be incorporated to KB; at the bottom level, the updated knowledge base is represented as a sequence of logic programs, serving as input for the underlying update semantics for logic programs, which determines the new current belief set.

(2) We define a declarative language for update policies, generalizing LUPS by various features. Most importantly, access to incoming events is facilitated. For example, retract(best buy(shop_{1} )) [[E : best buy(shop_{2} )]] states that if best buy(shop_{2} ) is told, then best buy(shop_{1} ) is removed from the knowledge base. Statements like this may involve further conditions on the current belief set, and other commands to be executed (which is not possible in LUPS). The language thus enables the flexible handling of events, such as simply recording changes in the environment, skipping uninteresting updates, or applying default actions.

(3) We analyze some properties of the framework, using the update answer set semantics of Eiter et al. [2000] as a representative of similar approaches. In particular, useful properties concerning KB maintenance are explored, and the complexity of the framework is determined. Moreover, we describe a possible realization of the framework in the agent system IMPACT [Subrahmanian et al., 2000], providing evidence that our approach is a viable tool for developing adaptive reasoning agents.

2 Preliminaries

We assume the reader familiar with extended logic programs (ELPs) [Gelfond and Lifschitz, 1991]. For a rule r, we write H(r) and B(r) to denote the head and body of r, respectively. Furthermore, not stands for default negation and ¬ for strong negation. Lit_{A} is the set of all literals over a set of atoms A, and L_{A} is the set of all rules constructible from Lit_{A}.

An update program, P, is a sequence (P_{1}, …, P_{n}) of ELPs, where n ≥ 1. We adopt an abstract view of the semantics of ELPs and update programs, given as a mapping Bel(·), which associates with every sequence P a set Bel(P) ⊆ L_{A} of rules; intuitively, Bel(P) are the consequences of P. Different instantiations of Bel(·) are possible, according to various proposals for update semantics. We only assume that Bel(·) satisfies some elementary properties which any “reasonable” semantics satisfies. In particular, we assume that P_{n} ⊆ Bel(P) holds, and that the following property is satisfied: given A ← ∈ Bel(P) and A ∈ B(r), then r ∈ Bel(P) iff H(r) ← B(r) \ {A} ∈ Bel(P).

We use here the semantics of Eiter et al. [2000], which coincides with the semantics of inheritance programs due to Buccafurri et al. [1999]. The semantics of ELPs P and update sequences P with variables is defined as usual through their ground versions G(P) and G(P) over the Herbrand universe, respectively. In what follows, let A, P, P, etc. be ground.

An interpretation is a set S ⊆ Lit_{A} which contains no complementary pair of literals. S is a (consistent) answer set of an ELP P iff it is a minimal model of the reduct P^{S}, which results from P by deleting all rules whose body contains some default literal not L with L ∈ S, and by removing all default literals in the bodies of the remaining rules [Gelfond and Lifschitz, 1991]. By AS(P) we denote the collection of all answer sets of P. The rejection set, Rej (S, P), of P with respect to the interpretation S is given by Rej (S, P) = ⋃_{i=1}^{n} Rej_{i}(S, P), where Rej_{n}(S, P) = ∅, and, for n > i ≥ 1, Rej_{i}(S, P) contains every rule r ∈ P_{i} such that H(r′) = ¬H(r) and B(r) ∪ B(r′) ⊆ S, for some r′ ∈ P_{j} \ Rej_{j}(S, P) with j > i. Then, S is an answer set of P = (P_{1}, …, P_{n}) iff S is an answer set of ⋃_{i} P_{i} \ Rej (S, P). We denote the collection of all answer sets of P by AS(P). Since n = 1 implies Rej (S, P) = ∅, the semantics extends the answer set semantics. [Eiter et al., 2000] describes a characterization of the update semantics in terms of single ELPs. Example 1 Let P_{0} = {b ← not a, a ← }, P_{1} = {¬a ← , c ← }, and P_{2} = {¬c ← }. Then, P_{0} has the single answer set S_{0} = {a} with Rej (S_{0}, P_{0}) = ∅; (P_{0}, P_{1}) has answer set S_{1} = {¬a, c, b} with Rej (S_{1}, (P_{0}, P_{1})) = {a ← }; and (P_{0}, P_{1}, P_{2}) possesses S_{2} = {¬a, ¬c, b} as unique answer set with Rej (S_{2}, (P_{0}, P_{1}, P_{2})) = {c ← , a ←}.

The belief set Bel_{A}(P) is the set of all rules r ∈ L_{A} such that r is true in each S ∈ AS(P). We shall drop the subscript “A ” if no ambiguity can arise. With a slight abuse of notation, for a literal L, we write L ∈ Bel_{A}(P) if L ← ∈ Bel_{A}(P).

3 Update Policies

We first describe our generic framework for event-based updating, and afterwards the EPI language (“the language

Bel(KS_{i−1})  Belief set at step i − 1
KB E_{1} … E_{i−1} E_{i}  Knowledge state KS_{i}
⇓ U  update policy
KB U_{1} … U_{i−1} U_{i}  Executable commands
⇓ tr  compilation
P_{0} P_{1} … P_{i−1} P_{i}  Update sequence
⇓ Bel  update semantics
Bel(KS_{i}) = Bel((P_{0}, …, P_{i}))  Belief set at step i

Figure 1: From knowledge state to belief set at step i.

around”) for specifying update policies.

3.1 Basic Framework

We start with the formal notions of an event and of the knowledge state of an agent.

Definition 1 An event class is a collection EC ⊆ 2^{L_{A}} of finite sets of rules. The members E ∈ EC are called events.

Informally, EC describes the possible events (i.e., sets of communicated rules) an agent may witness. For example, the collection F of all sets of facts from a subset A′ ⊆ A of atoms may be an event class. In what follows, we assume that an event class EC has been fixed.

Definition 2 A knowledge state KS = ⟨KB; E_{1}, …, E_{n}⟩ consists of an ELP KB (the initial knowledge base) and a sequence E_{1}, …, E_{n} of events E_{i} ∈ EC, i ∈ {1, …, n}. For i ≥ 0, KS_{i} = ⟨KB; E_{1}, …, E_{i}⟩ is the projection of KS to the first i events.

Intuitively, KS describes the evolution of the agent’s knowledge, starting from its initial knowledge base. When a new event E_{i} occurs, the current knowledge state KS_{i−1} changes to KS_{i} = ⟨KB; E_{1}, …, E_{i−1}, E_{i}⟩, which requests the agent to incorporate the event E_{i} into its knowledge base and adapt its belief set.

The procedure for adapting the belief set Bel(KS_{i−1}) on arrival of E_{i} is illustrated in Figure 1. Informally, at step i of the knowledge evolution, we are given the belief set Bel(KS_{i−1}) and the knowledge state KS_{i−1} = ⟨KB; E_{1}, …, E_{i−1}⟩, together with the new event E_{i}, and we want to compute Bel(KS_{i}) in terms of the update policy U. First, a set U_{i} of executable commands is determined from U. Afterwards, given the previously computed sets U_{1}, …, U_{i−1}, the sequence (KB; U_{1}, …, U_{i}) is compiled by the transformation tr into the update sequence P = (P_{0}, P_{1}, …, P_{i}). Then, Bel(KS_{i}) is given by Bel(P).

⟨stat⟩  ::= ⟨comm⟩ [if⟨cond1⟩] [[[⟨cond2⟩]]];
⟨c name⟩ ::= assert[ event] | retract[ event] |

always[ event] | cancel | ignore ;

⟨r id⟩  ::= ⟨rule⟩ | ⟨r var⟩;
⟨lit id⟩ ::= ⟨literal⟩ | ⟨lit var⟩;
⟨comm⟩ ::= ⟨c name⟩(⟨r id⟩) ;
⟨cond1⟩ ::= [not] ⟨comm⟩ | [not] ⟨comm⟩, ⟨cond1⟩ ;
⟨cond2⟩ ::= ⟨kb conds⟩ | E : ⟨ev conds⟩ |

⟨kb conds⟩ , E : ⟨ev conds⟩;

⟨kb conds⟩ ::= ⟨kb cond⟩ | ⟨kb cond⟩ , ⟨kb conds⟩;
⟨kb cond⟩ ::= ⟨r id⟩ | ⟨lit id⟩ ;
⟨ev conds⟩ ::= ⟨ev cond⟩ | ⟨ev cond⟩ , ⟨ev conds⟩;
⟨ev cond⟩ ::= ⟨lit id⟩ | ⟨r id⟩ ;

Table 1: Syntax of an update statement in EPI.

3.2 Language EPI: Syntax

The language EPI generalizes the update specification language LUPS [Alferes et al., 1999a], by allowing update statements to depend on other update statements in the same EPI program, and more complex conditions on both the current belief set and the actual event (note that LUPS has no provision to support external events). These features make it suitable for implementing rational reactive agents, capable, e.g., of filtering incoming information.

The syntax of EPI is given in Table 1. In what follows, we use cmd to denote update commands and ρ to refer to rules or rule variables. In general, an EPI statement may have the form

cmd_{1}(ρ_{1}) if [not]cmd_{2}(ρ_{2}), …, [not]cmd_{m}(ρ_{m})[[c_{1}, E :c_{2}]]

which states conditional assertion or retraction of a rule ρ_{1}, expressed by cmd_{1}(ρ_{1}), depending on other commands [not]cmd_{2}(ρ_{2}), …,[not]cmd_{m}(ρ_{m}), and conditioned with the proviso whether c_{1} belongs to the current belief set and whether c_{2} is in the actual event. The basic EPI commands are the same as those in LUPS (for their meaning, cf. [Alferes et al., 1999a]), plus the additional command ignore, which allows to skip unintended updates from the environment, which otherwise would be incorporated into the knowledge base. Each condition in [[·]], both of the form c_{1} and E :c_{2}, can be substituted by a list of such conditions. Note that in LUPS no conditions on rules and external events can be explicitly expressed, nor dependencies between update commands. We also extend the language by permitting variables for rules and literals in the update commands, ranging over the universe of the current belief set and of the current event (syntactic safety conditions can be easily checked). By convention, variable names start with capital letters.

Definition 3 An update policy U is a finite set of EPI statements.

For instance, the EPI statement

assert(R) if not ignore(R)[[E : R]]  (1)

means that all rules in the event have to be incorporated into the new knowledge base, except if it is explicitly specified that the rule is to be ignored. Similarly, the command retract forces a rule to be deactivated. The option event states that an assertion or retraction has only temporary value and is not supposed to persist by inertia in subsequent steps. The precise meaning of the different update commands will be made clear in the next section. Example 2 Consider a simple agent selecting Web shops in search for some specific merchandise. Suppose its knowledge base, KB, contains the rules

r_{1} : query(S) ← sale(S), up(S), not ¬query(S);
r_{2} : try query ← query(S);
r_{3} :  notify ← not try query;

and a fact r_{0} : date(0) as an initial time stamp. Here, r_{1} expresses that a shop S, which has a sale and whose Web site is up, is queried by default, and r_{2}, r_{3} serve to detect that no site is queried, which causes ‘notify’ to be true. Assume that an event, E, might be any consistent set of facts or ground rules of the form sale(s) ← date(t), stating that shop s has a sale on date t, such that E contains at most one time stamp date(·).

An update policy U may be defined as follows. Assume it contains the incorporate-by-default statement (1), as well as:

always(sale(S) ← date(T)) if assert(sale(S) ← date(T)); cancel(sale(S) ← date(T))[[date(T), T ≠ T′, E:date(T′)]]; retract(sale(S) ← date(T))[[date(T), T ≠ T′, E:date(T′)]].

Informally, the first statement repeatedly confirms the information about a future sale, which guarantees that it is effective on the given date, while the second statement revokes this. The third one removes information about a previously ended sale (assuming the time stamps increase). Furthermore, U includes also the following statements:

retract(date(T))[[date(T), T ≠ T′, E : date(T′)]]; ignore(sale(s_{1}))[[E : sale(s_{1})]]; ignore(sale(s_{1}) ← date(T))[[E : sale(s_{1}) ← date(T)]].

The first statement keeps the time stamp date(t) in KB unique, and removes the old value. The other statements simply state that sales information about shop s_{1} is ignored.

3.3 Language EPI: Semantics

According to the overall structure of the semantics of EPI, as depicted in Figure 1, at step i, we first determine the executable command U_{i} given the current knowledge state KS_{i−1} = ⟨KB; E_{1}, …, E_{i−1}⟩ and its associated belief set Bel(KS_{i−1}) = Bel(P_{i−1}), where P_{i−1} = (P_{0}, …, P_{i−1}). To this end, we evaluate the update policy U over the new event E_{i} and the belief set Bel(P_{i−1}).

Let G(U) be the grounded version of U over the language A underlying the given update sequence and the received events. Then, the set G(U)^{i} of reduced update statements at step i is given by

G(U)^{i} = { cmd(ρ) if C_{1} | cmd(ρ) if C_{1}[[C_{2}]] ∈ G(U), where
C_{2} = c_{1}, …, c_{l}, E : r_{1}, …, r_{m}, and such that
c_{1}, …, c_{l} ∈ Bel(P_{i−1}) and r_{1}, …, r_{m} ∈ E_{i} }.

The update statements in G(U)^{i} are thus of the form cmd_{1}(ρ_{1}) if [not] cmd_{2}(ρ_{2}), …, [not] cmd_{m}(ρ_{m}). Semantically, we interpret them as ordinary logic program rules cmd_{1}(ρ_{1}) ← [not ]cmd_{2}(ρ_{2}), …, [not ]cmd_{m}(ρ_{m}). The program Π_{i}^{U} is the collection of all these rules, given G(U)^{i}, together with the following constraints, which exclude contradictory commands:

← assert[ event](R), retract[ event](R);
← always[ event](R), cancel(R).

Definition 4 Let KS = ⟨KB; E_{1}, …, E_{n}⟩ be a knowledge state and U an update policy. Then, U_{i} is a set of executable update commands at step i (i ≤ n) iff U_{i} is an answer set of the grounding G(Π_{i}^{U}) of Π_{i}^{U}.

Since update statements do not contain strong negation, executable update commands are actually stable models of G(Π_{i}^{U}) [Gelfond and Lifschitz, 1988]. Furthermore, since programs may in general have more than one answer set, or no answer set at all, and the agent must commit itself to a single set of update commands, we assume a suitable selection function, Sel(·), returning a particular U_{i} if an answer set exists, or, otherwise, returning U_{i} = {assert(⊥_{i} ← )}, where ⊥_{i} is a reserved atom. These atoms are used for signaling that the update policy encountered inconsistency. They can easily be filtered out from Bel(·), if needed, restricting the outcomes of the update to the original language.

Next we compile the executable commands U_{1}, …, U_{i} into an update sequence (P_{0}, …, P_{i}), serving as input for the belief function Bel(·). This is realized by means of a transformation tr(·), which is a generic and adapted version of a similar mapping introduced by Alferes et al. [1999a]. In what follows, we assume a suitable naming function for rules in the update sequence, enforcing that each rule r is associated with a unique name n_{r}.

Definition 5 Let KS = ⟨KB; E_{1}, …, E_{n}⟩ be a knowledge state and U an update policy. Then, for i ≥ 0, tr(KB; U_{1}, …, U_{i}) = (P_{0}, P_{1}, …, P_{i}) is inductively defined as follows, where U_{1}, …, U_{i} are the executable commands according to Definition 4: i = 0 : Set P_{0} = {H(r) ← B(r), on(n_{r}) | r ∈ KB} ∪

{on(n_{r}) ← | r ∈ KB}, where on(·) are new atoms. Furthermore, initialize the sets P C_{0} of persistent commands and EC_{0} of effective commands to ∅.

i ≥ 1 : EC_{i}, P C_{i} and P_{i} are as follows:

EC_{i} = {cmd(r) | cmd(r) ∈ U_{i} ∧ ignore(r) ∉ U_{i}}; P C_{i} = P C_{i−1} ∪ {always(r) | always(r) ∈ EC_{i}}

∪ {always event(r) | always event(r) ∈ EC_{i}

∧ always(r) ∉ EC_{i} ∪ P C_{i−1}}
\ ({always event(r) | always(r) ∈ EC_{i}}
∪ {always[ event](r) | cancel(r) ∈ EC_{i}});

P_{i} = {on(n_{r}) ← , H(r) ← B(r), on(n_{r}) | assert[ event](r) ∈ EC_{i}

∨ always[ event](r) ∈ P C_{i}}
∪ {on(n_{r}) ← | retract event(r) ∈ EC_{i−1}
∧ retract[ event](r) ∉ EC_{i}}
∪ {¬on(n_{r}) ← | (retract[ event](r) ∈ EC_{i}
∧ always[ event](r) ∉ P C_{i})
∨ (always event(r) ∈ P C_{i−1}
∧ cancel(r) ∈ EC_{i}
∧ assert[ event](r) ∉ EC_{i})

∨(assert event(r) ∈ EC_{i−1}
∧ always[ event](r) ∉ P C_{i}
∧ assert[ event](r) ∉ EC_{i})}.

On the basis of this compilation, we can define the belief set for a knowledge state KS: Definition 6 Let KS and U be as in Definition 5, and let U_{1}, …, U_{n} be the corresponding executable commands obtained from Definition 4. Then, the belief set of KS is given by Bel(KS) = Bel(tr(KB; U_{1}, …, U_{n})). Example 3 Reconsider Example 2 and suppose the event E_{1} = {sale(s_{0}), date(1)} occurs at KS = ⟨KB⟩. Then, G(U)^{1} = {assert(sale(s_{0})) if not ignore(sale(s_{0})),

assert(date(1)) if not ignore(date(1)), retract(date(0))}.

The corresponding program Π_{1}^{U} has the single answer set {assert(sale(s_{0})), assert(date(1)), retract(date(0))}, which is compiled, via function tr(·), to P C_{1} = P C_{0} \ {assert [event](date(0))} = ∅ and P_{1} = {sale(s_{0}) ← on(r′_{1}); on(r′_{1}) ← ; date(1) ← on(r′_{2}); on(r′_{2}) ← ; ¬on(r_{0}) ← }. As easily seen, the belief set Bel(⟨KB; E_{1}⟩) = Bel((P_{0}, P_{1})) contains sale(s_{0} ) and query(s_{0}).

4 Properties

In this section, we discuss some properties of Bel(KS) for particular update policies, using the definition of Bel(·) based on the update answer sets approach of Eiter et al. [2000], as explained in Section 2. We stress that the properties given below are also satisfied by similar instantiations of Bel(·), like, e.g., dynamic logic programming [Alferes et al., 2000].

First, we note some basic properties:

• If U = ∅ (called empty policy), then KB will never be updated; the belief set is independent of E_{1}, …, E_{n}, and thus static. Hence, Bel(KS_{i}) = Bel(KB), for each i = 1, …, n.

• If U = {assert(R)[[E :R]]} (called unconditional assert policy), then all rules contained in the received events are directly incorporated into the update sequence. Thus, Bel(KS_{i}) = Bel((KB, E_{1}, …, E_{i})), for each i = 1, …, n.

• If U_{i} is empty, then the knowledge is not updated, i.e., P_{i} = ∅. We thus have Bel(KS_{i}) = Bel(KS_{i−1}).

• Similarly, if U_{i} = {assert(⊥_{i}) ← }, then Bel(KS_{i}) = Bel(KS_{i−1}).

Physical removal of rules

An important issue is the growth of the agent’s knowledge base, as the modular construction of the update sequence through transformation tr(·) causes some rules and facts to be repeatedly inserted. This is addressed next, where we discuss the physical removal of rules from the knowledge base. Lemma 1 Let P = (P_{0}, …, P_{n}) be an update sequence. For every r ∈ P_{i}, r′ ∈ P_{j} with i < j, the following holds: if (i) r = r′, or (ii) r = L ← and r′ = ¬L ← , or (iii) r′ = L ← such that no rule r′′ ∈ P_{k} with H(r′′) = ¬L exists, where k ∈ {j + 1, …, n}, and ¬L ∈ B(r), then Bel_{A}(P) = Bel_{A}(P_{0}, …, P_{i−1}, P_{i} \ {r}, P_{i+1}, …, P_{n}).

The following property holds: Theorem 1 Let KS be a knowledge state and Bel(KS) = Bel(P), where P = (P_{0}, …, P_{n}). Furthermore, let P^{∗} result from P after repeatedly removing rules as in Lemma 1, and let P^{−} = (P_{0}^{−}, …, P_{n}^{−}), where

\begin{aligned}P_{i}^{−} & = & \{H(r) ← B(r) \ \{on(n_{r})\} | r ∈ P_{i}^{∗}, on(n_{r}) ← ∈ P^{∗}\}\ \\ & & \{on(n_{s}) ←| on(n_{s}) ←∈ P\}. \end{aligned}

Then, Bel_{A}(KS) = Bel_{A}(P^{−}).

Thus, we can purge the knowledge base and remove duplicates of rules, as well as all deactivated (retracted) rules.

History Contraction Another relevant issue is the possibility, for some special case, to contract the agent’s update history, and compute its belief set at step i merely based on information at step i−1. Let us call U a factual assert policy if all assert[ event] and always[ event] statements in U involve only facts. In this case, the compilation tr(·) for a knowledge state KS = ⟨KB; E_{1}, …, E_{n}⟩ can be simplified thus: (1) P_{0} = KB, and (2) the construction of each P_{i} involves facts L ← and ¬L ← instead of on(n_{r}) ← and ¬on(n_{r}) ← , respectively.

For such sequences, the following holds:

Lemma 2 Let P = (P_{0}, …, P_{n}) be an update sequence such that P_{i} contains only facts, for 1 ≤ i ≤ n. Then, Bel_{A}(P) = Bel_{A}(P_{0}, P_{u_{n}}), where P_{u_{1}} = P_{1}, and P_{u_{i+1}} = P_{i+1}∪(P_{u_{i}} \ {L ← | ¬L ← ∈ P_{i+1}}).

We can thus assert the following proposition for history contraction:

Theorem 2 Let U be a factual assert policy and P = (P_{1}, …, P_{n}) be the compiled sequence obtained from KS by the simplified method described above. Then, Bel_{A}(KS) = Bel_{A}((KB, P_{u_{n}})), where P_{u_{n}} is as in Lemma 2.

Simple examples show that Theorem 2 does not hold in general. The investigation of classes of policies for which similar results hold are a subject for further research.

Computational Complexity Finally, we briefly address the complexity of reasoning about a knowledge state KS. An update policy U is called stratified iff, for all EPI statements cmd(ρ) if C_{1}[[C_{2}]] ∈ U, the associated rules cmd_{1}(ρ) ← C′_{1} form a stratified logic program, where C′_{1} results from C_{1} by replacing the EPI declaration not by default negation not .

For stratified U, any Π_{i}^{U} has at most one answer set. Thus, the selection function Sel(·) is redundant. Otherwise, the complexity cost of Sel(·) must be taken into account. If Sel(·) is unknown, we consider all possible return values (i.e., all answer sets of Π_{i}^{U}) and thus, in a cautious reasoning mode, all possible Bel(KS) = Bel((P_{0}, …, P_{n})) from Figure 1. Clearly, for update answer sets, deciding r′ ∈ Bel((Q_{0}, …, Q_{m})) is in coNP; it is polynomial, if Q_{0} is stratified and each Q_{i}, 1 ≤ i ≤ m, contains only facts.

Theorem 3 Let Bel(·) be the update answer set semantics, and Sel(·) polynomial-time computable with an NP oracle. Then, given a ground rule r and ground KS = ⟨KB; E_{1}, …, E_{n}⟩, the complexity of deciding whether r ∈ Bel(KS) is as follows (entries denote completeness results; the case of unknown Sel(·) is given at the right of “/”):

KB \ U fact. assert & strat. stratified general
stratified  P  P^{NP}  P^{NP}/ Π_{2}^{P}
general  P^{NP}  P^{NP}  P^{NP}/ Π_{2}^{P}

Similar results hold, e.g., for dynamic logic programming. The results can be intuitively explained as follows. Each

U_{i} and P_{i} as in Figure 1 can be computed iteratively (1 ≤ i ≤ n), where at step i polynomially many problems r′ ∈ Bel((P_{0}, …, P_{i−1})) must be solved to construct Π_{i}^{U}. From U_{i} = Sel(Π_{i}^{U}) and previous results, P_{i} is easily computed in polynomial time. Since P_{i} contains less than |U| rules, step i is feasible in polynomial time with an NP oracle. Thus, P = (P_{0}, …, P_{n}) is polynomially computable with an NP oracle, and r ∈ Bel(P) is decided with another oracle call. Updating a stratified P_{0} such that only sets of facts P_{1}, P_{2}, … may be added preserves polynomial decidability of r′ ∈ Bel((P_{0}, …, P_{i−1})); this explains the polynomial decidability result. In all other cases, P^{NP}-hard problems such as computing the lexicographically maximal model of a CNF formula are easily reduced to the problem.

If Sel(·) is unknown, each possible result of Sel(Π_{i}^{U}) can be nondeterministically guessed and verified in polynomial time. This leads to coNP^{NP} = Π_{2}^{P} complexity.

5 Implementational Issues

An elegant and straightforward realization of update policies is possible through IMPACT agent programs. IMPACT [Subrahmanian et al., 2000] is a platform for developing software agents, which allows to build agents on top of legacy code, i.e., existing software packages, that operates on arbitrary data structures. Thus, in accordance with our approach, we can design a generic implementation of our framework, without committing ourselves to a particular update semantics Bel(·).

Since every update policy U is semantically reduced to a logic program, the corresponding executable commands can be computed using well-known logic programming engines like smodels, DLV, or DeRes. Hence, we may assume that a software package, SP, for updating and querying a knowledge base KB is available, and that KB can be accessed through a function bel() returning the current belief set Bel(KS). Moreover, we assume that SP has a function event(), which lists all rules of a current event. Then, an update policy U can be represented in IMPACT as follows.

(1) Conditions on the belief set and the event can be modeled by IMPACT code call atoms, i.e. atoms in(t, bel()), not in(t, bel()), and in(t, event()), where t is a constant r or a variable R. In IMPACT, in(r, f()) is true if constant r is in the result returned by f(); a variable R is bound to all r such that in(r, f()) is true; “not in” is negation.

(2) Update commands can be easily represented as IM-PACT actions. An action is implemented by a body of code in any programming language (e.g., C); its effects are specified in terms of add and delete lists (sets of code call atoms). Thus, actions like assert(R), retract(R), etc., where R is a parameter, are introduced.

(3) EPI statements are represented as IMPACT action rules

Do(cmd_{1}(ρ_{1})) ← [¬]Do(cmd_{2}(ρ′)), …, [¬]Do(cmd_{m}(ρ′)),

code call atoms(cond),

where code call atoms(cond) is the list of the code call atoms for the conditions on the belief set and the event in cond as described above.

The semantics of IMPACT agent programs is defined through status sets. A reasonable status set S is equivalent to a stable model of a logic program, and prescribes the agent to perform all actions α where Do(α) is in S. Thus, S represents the executable commands U_{i} of Figure 1 in accord with U, and the respective action execution affects the computation of P_{i} via tr(·). For more details, cf. [Eiter et al., 2001].

6 Related Work and Conclusion

Our approach is similar in spirit to the work in active databases (ADBs), where the dynamics of a database is specified through event-condition-action (ECA) rules triggered by events. However, ADBs have in general no declarative semantics, and only one rule at a time fires, possibly causing successive events. In [Baral and Lobo, 1996], a declarative characterization of ADBs is given, in terms of a reduction to logic programs, by using situation calculus notation.

Our language for update policies is also related to action languages, which can be compiled to logic programs as well (cf., e.g., [Lifschitz and Turner, 1999]). A change to the knowledge base may be considered as an action, where the execution of actions may depend on other actions and conditions. However, action languages are tailored for planning and reasoning about actions, rather than reactive behavior specification; events would have to be emulated. Furthermore, a state is, essentially, a set of literals rather than a belief set as we define it. Investigating the relationships of our framework to these languages in detail—in particular concerning embeddings—is an interesting issue for further research.

A development in the area of action languages, with purposes similar to those of EPI, is the policy description language PDL [Lobo et al., 1999]. It extends traditional action languages with the notion of event sequences, and serves for specifying actions as reactive behavior in response to events. A PDL policy is a collection of ECA rules, interpreted as a function associating with an event sequence a set of actions. PDL seems thus to be more expressive than EPI; possible embeddings of EPI into PDL remain to be explored.

The EPI language could be extended with several features:

(1) Special atoms in(r) telling whether r is actually part of KB (i.e., activated by on(n_{r})), allowing to access the “extensional” part of KB.

(2) Rule terms involving literal constants and variables, e.g., “H ← up(s_{1}), B”, where H, B are variables and up(s_{1}) is a fixed atom, providing access to the structure of rules. Combined with (1), commands such as “remove all rules involving up(s_{1})” can thus be conveniently expressed.

(3) More expressive conditions on the knowledge base are conceivable, requesting for more complex reasoning tasks, and possibly taking the temporal evolution into account. E.g., “prev(a)” expressing that a was true at the previous stage.

In concluding, our generic framework, which extends other approaches to logic program updates, represents a convenient platform for declarative update specifications and could also be fruitfully used in several applications. Exploring these issues is part of our ongoing research.

Acknowledgements

This work was partially supported by the Austrian Science Fund (FWF) under grants P13871-INF and N Z29-INF.

References

[Alferes et al., 1999a] J. Alferes, L. Pereira, H. Przymusinska, and T. Przymusinski. LUPS - A language for updating logic programs. In Proc. LPNMR’99, LNAI 1730, pp. 162-176. Springer, 1999.

[Alferes et al., 2000] J. Alferes, J. Leite, L. Pereira, H. Przymusinska, and T. Przymusinski. Dynamic updates of nonmonotonic knowledge bases. J. Logic Programming, 45(1-3):43-70, 2000.

[Baral and Lobo, 1996] C. Baral and J. Lobo. Formal characterization of active databases. In Proc. LID’96, LNCS 1154, pp. 175-195. Springer, 1996.

[Buccafurri et al., 1999] F. Buccafurri, W. Faber, and N. Leone. Disjunctive logic programs with inheritance. In Proc. ICLP’99, pp. 79-93. MIT Press, 1999.

[Eiter et al., 2000] Th. Eiter, M. Fink, G. Sabbatini, and H. Tompits. Considerations on updates of logic programs. In Proc. JELIA’00, LNAI 1919, pp. 2-20. Springer, 2000. [Eiter et al., 2001] Th. Eiter, M. Fink, G. Sabbatini, and H. Tompits. Declarative knowledge updates through agents. In Proc. AISB’01 Symp. on Adaptive Agents and Multi-Agent Systems, York, UK, pp. 79-84. AISB, 2001. [Gelfond and Lifschitz, 1988] M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In Proc. ICSLP’88, pp. 1070-1080. MIT Press, 1988. [Gelfond and Lifschitz, 1991] M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365-386, 1991. [Inoue and Sakama, 1999] K. Inoue and C. Sakama. Updating extended logic programs through abduction. In Proc. LPNMR’99, LNAI 1730, pp. 147-161. Springer, 1999. [Lifschitz and Turner, 1999] V. Lifschitz and H. Turner. Representing transition systems by logic programs. In Proc. LPNMR’99, LNAI 1730, pp. 92-106. Springer, 1999. [Lobo et al., 1999] J. Lobo, R. Bhatia, and S. Naqvi. A policy description language. In Proc. AAAI/IAAI’99, pp. 291-298. AAAI Press / MIT Press, 1999.

[Marek and Truszczyński, 1998] W. Marek and M. Truszczyński. Revision programming. Theoretical Computer Science, 190:241-277, 1998.

[Subrahmanian et al., 2000] V.S. Subrahmanian, J. Dix, Th. Eiter, P. Bonatti, S. Kraus, F. Ozcan, and R. Ross. Heterogeneous Agent Systems. MIT Press, 2000.

[Williams and Antoniou, 1998] M.-A. Williams and G. Antoniou. A strategy for revising default theory extensions. In Proc. KR’98, pp. 24-35. Morgan Kaufmann, 1998. [Zhang and Foo, 1998] Y. Zhang and N. Foo. Updating logic

programs. In Proc. ECAI’98, pp. 403-407. 1998.