Logic Program Based Updates Yan Zhang
School of Computing and Information Technology University of Western Sydney, Nepean Kingswood, NSW 2747, Australia E-mail:
[email protected] Abstract
We investigate two types of logic program based updates: simple fact updates and program updates. In the simple fact update, a knowledge base is speci ed as a set of facts and can be updated by a logic program, while in the program update, a knowledge base is speci ed as a logic program and can be updated by another logic program. The former is usually viewed as a special case of the latter. It is observed that the con ict resolution is a key issue in these logic program based updates. Our approach to the logic program based update has the following features: (1) a prioritized logic programming is developed for providing a formal basis of formalizing logic program based updates; (2) con icts occurring in updates are explicitly solvable in our framework; and (3) splitting theorems on extended logic programs and prioritized logic programs are provided for simplifying the computation and inference of logic program based updates. We also investigate various properties embedded in the logic program based update. In addition, we analyze the computational complexity for both simple fact and program updates. We show that for the simple fact update, the model check is co-NP-complete, and the corresponding inference problem is P2 -complete. For the program update, on the other hand, the check for contradiction elimination is coNP-complete, while the associated model check and inference problem are not harder than that in the simple fact update. Furthermore, we also characterize particular classes of update speci cations where the inference problem in updates has a lower computational complexity.
Key words: arti cial intelligence, logic programming, update, knowledge representation, nonmonotonic reasoning, complexity
1
Contents
1 Introduction 1.1 1.2 1.3 1.4 1.5
Marek and Truszczynski's Proposal . . . . . . . . . . . . . A Generalized Marek and Truszczynski's Update Problem Updating A Logic Program . . . . . . . . . . . . . . . . . Why Priority . . . . . . . . . . . . . . . . . . . . . . . . . Organization of This Paper . . . . . . . . . . . . . . . . .
2 Prioritized Logic Programs 2.1 2.2 2.3 2.4
Syntax . . . . . . . . . . . . . . . . . . . . . . . Answer Set Semantics . . . . . . . . . . . . . . Basic Properties of Prioritized Logic Programs The Unique Answer Set Theorem . . . . . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
1
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
1 2 2 4 5
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. 5 . 7 . 11 . 14
5
3 Simple Fact Update
19
4 Properties of Simple Fact Update
23
5 Restricted Monotonicity
29
6 Program Update
37
7 Characterizing Program Update
42
8 Analysis of Computational Complexity
50
9 Related Work 10 Concluding Remarks
60 67
3.1 Limitation of Marek and Truszczynski's Approach . . . . . . . . . . . . . 19 3.2 Generalized Simple Fact Update . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 Minimal Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2 Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.1 The Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.2 A Generalization of Splitting Theorem . . . . . . . . . . . . . . . . . . . . 31 5.3 Proofs of Restricted Monotonicity Theorems . . . . . . . . . . . . . . . . . 34 6.1 The Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.2 Formal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.1 Basic Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 7.2 Splitting Theorems on Prioritized Logic Programs . . . . . . . . . . . . . 44 7.3 Simplifying the Inference in Program Update . . . . . . . . . . . . . . . . 48 8.1 Complexity Results for Simple Fact Update . . . . . . . . . . . . . . . . . 51 8.2 Complexity Results for Program Update . . . . . . . . . . . . . . . . . . . 57
2
1 Introduction In the context of logic program based updates, a knowledge base can be updated in terms of a logic program, while the knowledge base is speci ed either as a set of facts or a logic program. We call an update on a knowledge base a simple fact update or logic program update if the knowledge base is represented as a set of facts or a logic program respectively.
1.1 Marek and Truszczynski's Proposal
The rst work on the simple fact update was due to Marek and Truszczynski [25]. Generally, Marek and Truszczynski addressed the following problem: given an initial knowledge base B which is a nite a set of ground atoms, and a set of update rules of the forms1: in(A) in(B1 ); ; in(Bm ); out(C1); ; out(Cn); (1) out(A) in(B1 ); ; in(Bm); out(C1); ; out(Cn ); (2) where A; B1 ; ; Bm ; C1; ; Cn are ground atoms, what is the resulting knowledge base B0 after updating B with ? The intuitive meaning of (1) (or (2)) is that if B1; ; Bm are in the current knowledge base, and C1; ; Cn are not, then A should be (or not be) in the resulting knowledge base. For example, given a knowledge base B = fA; Dg and a set of update rules : in(C ) in(A); out(B), out(D) in(C ); out(B), where A; B; C and D are ground atoms, then after updating B with , according to Marek and Truszczynski's approach, we would expect to have a resulting knowledge base B0 = fA; C g. Relationships between this simple fact update and extended logic programs have been studied by Baral [5] and Przymusinski and Turner [29]. In particular, they showed that Marek and Truszczynski's formal procedure of specifying B0 can be reduced to a computation of the answer set of a corresponding extended logic program (we will review this procedure in section 3). Two assumptions were made on Marek and Truszczynski's simple fact update: the initial knowledge base should be complete, i.e. any ground atom not in the initial knowledge base is treated as its negation; and update rules only contain classical negations. While the rst assumption was released in Baral's work [5], the second assumption still held. For instance, following the ideas of [5] and [29], rules (1) and (2) are translated into the following inference rules respectively in the corresponding extended logic program: A B1 ; ; Bm; :C1; ; :Cn, :A B1; ; Bm; :C1; ; :Cn. 1 was called
a revision program in [25].
1
1.2 A Generalized Marek and Truszczynski's Update Problem
Now we consider a generalization of Marek and Truszczynski's update: a knowledge base is allowed to be incomplete, e.g. a consistent set of ground literals, and update rules may contain both classical negation and negation as failure (weak negation). This kind of update rule is of the form:
L0
L1; ; Lm ; notLm+1 ; ; notLn;
(3)
where L0 ; L1; ; Ln are literals. Note that the set of update rules, that we call the update program, is actually an extended logic program. Such generalized update is important in many applications. For example, in a secure computer system, a formal speci cation of users' access rights is usually required, and the initial state of access policies of the system can be represented by a knowledge base. An update of this knowledge base must be performed whenever new access control rules are applied to the system. Generally, two types of negations are needed to specify access control rules. For instance, let B = fMember(A; G), Member(B; G), Access(A; F ), :Access(B; F )g represent the current access policy of the system, in which Member(x; y ) means that user x belongs to group y, and Access(x; y) indicates that user x can access le y. Suppose that new users C and D are added into group G and a global access control rule is now applied to each member of group G: Access(x; F ) Member(x; G),not :Access(x; F ). This rule actually says that any user belonging to group G can access le F unless it is explicitly stated that the user is not allowed to access F . Updating B with , where is an extended logic program consisting of the following rules: Member(C; G) , Member(D; G) , Access(x; F ) Member(x; G),not :Access(x; F ), we would expect that Access(C; F ) and Access(D; F ) are obtained, while facts Access(A; F ) and :Access(B; F ) remain persistent.
1.3 Updating A Logic Program
In our above discussion, a knowledge base is represented by a nite set of ground literals. However, in the real world domain, it would be more convenient and exible to represent a knowledge base as a rule based system. This kind of knowledge bases, in principle, consists of two components: facts and rules. Traditionally, facts express the current state of the knowledge base and are usually changeable, while rules express constraints about the domain and hence are usually unchangeable [17, 19]. In many applications associated with dynamic domains, nevertheless, a knowledge base may have to be updated not only because some new facts occur, but also because some old rules are no longer suitable to characterize new domain constraints (e.g. the domain is evolved). Therefore, it is 2
important to have a more powerful update mechanism to maintain a knowledge base to a stable status whenever some new information, which may be a set of simple facts as well as a set of rules, is combined into the current knowledge base. The logic program update deals with this problem. In particular, our problem can be described as follows: given two extended logic programs 0 and 1 , where 0 is viewed as the knowledge base and 1 is viewed as the update program, what is the resulting extended logic program 00 after updating 0 with 1 ? From general update principles (e.g. [20]), we argue that a good resulting extended logic program 00 should satisfy the following basic conditions: (a) Each rule of 1 should be presented in 00 , i.e. 1 00 , since 1 expresses the agent's latest knowledge about the domain. (b) If a rule in 0 contradicts program 1 , then this rule should be excluded from 00. Informally, we say that a rule contradicts a program if adding this rule into the program will lead to an inconsistent program with respect to some semantics2 . (c) To deal with defeasible information, if some rule r in 0 con icts with a rule r0 in 1 3, during the evaluation of the resulting program 00 , we would expect r to be overridden by r0 since we usually agree that the agent's latest knowledge about the domain is more preferable than its previous knowledge. (d) Under the above conditions, the resulting program 00 should retain as many rules of 0 as possible (i.e. minimal change). To illustrate these key issues associated with our update problem, let us consider a modi ed domain of secure computer system that we discussed earlier. Suppose the access control policy base for a computer system is represented by an extended logic program 0 consisting of the following rules: Member(A; G) , Member(B; G) , Access(A; F2) , Access(x; F1) Member(x; G), :Access(x; F2) Member(x; G),not Access(x; F2). Under Gelfond and Lifschitz's answer set semantics, it is clear that implicit facts Access(A; F1), Access(B; F1 ) and :Access(B; F2 ) are entailed from 0. Now suppose we want to update this policy base 0 with the following extended logic program 1 : Member(C; G) , :Access(x; F1) Member(x; G), Access(x; F2) Member(x; G),not :Access(x; F2). 2 We will formally describe this concept in the following section. 3 As rules in an extended logic program can be viewed as kinds of default rules, con icts
rules may occur in the program.
3
between two
Our question is: what is the resulting policy base 00 after updating 0 with 1 ? Since 1 represents the agent's new knowledge about the domain, according to condition (a) above, it is obvious that 1 should be included in 00, i.e. 1 00 . It is also clear that rule Access(x; F1) Member(x; G) in 0 represents a contradictory meaning compared to the rule :Access(x; F1) Member(x; G) in 1 , and if we specify 00 = 0 [ 1 , 00 is inconsistent under the answer set semantics. Hence, Access(x; F1) Member(x; G) should be excluded from 00 according to condition (b). On the other hand, although rule :Access(x; F2 ) Member(x; G),not Access(x; F2) in 0 does not contradict any rules in 1 , it indeed con icts with rule Access(x; F2) Member(x; G),not :Access(x; F2) in 1 since retaining it in 00 will lead 00 to have different answer sets showing that Access(B; F2) (or Access(C; F2)) is true in one case and Access(B; F2 ) (or Access(C; F2)) is not true in the other. From condition (c) presented above, it suggests that the rule :Access(x; F2) Member(x; G), not Access(x; F2) in 0 should be overridden by rule Access(x; F2) Member(x; G), not :Access(x; F2) in 1 . Finally, all other rules in 0 are consistent and con ict-free with each rule in 1, and then should be kept in 00 from a general principle of minimal change in update (i.e. condition (d)). From the above discussion, we may get a resulting policy base 00 after updating 0 with 1 as follows: Member(A; G) , Member(B; G) , Member(C; G) , Access(A; F2) , :Access(x; F1) Member(x; G), Access(x; F2) Member(x; G),not :Access(x; F2), from which implicit facts :Access(A; F1), :Access(B; F1 ), :Access(C; F1), Access(B; F2 ), and Access(C; F2) are entailed.
1.4 Why Priority
As mentioned earlier, in the generalized Marek and Truszczynski's simple fact update, we allow an update rule to have both classical negation and negation as failure. This may cause a potential problem in this kind of update. Traditionally, most theories of reasoning about change usually have inertia rules to specify things that persist during the change. In the context of our simple fact updates, however, a possible con ict may occur between an inertia rule and an update rule since both rules can be defeasible. If this situation occurs, we will have a diculty to derive persistent facts. For instance, we may fail to derive a fact to be persistent although it should be persistent from our intuition. Section 3 illustrates this diculty in detail. In the logic program update, on the other hand, a similar diculty also exists. From our discussions in section 1.3, we can see that the con ict is one of the possible eects in logic program updates since both programs involved in an update may include defeasible rules. As con icts occur in both the generalized Marek and Truszczynski's update problem and the logic program update as we described above, the con ict resolution then becomes a key issue in the formalization of logic program based updates. A natural idea of 4
solving con icts in logic reasoning is to assign dierent priorities to dierent rules so that con icts can be solved by applying these priority preferences. Our approach, that will be presented in this paper, is to propose a priority theory from a general ground and then use this theory to solve the problems of logic program based updates. In particular, we rst develop a theory of prioritized logic programming where a notion of priority is explicitly introduced into a logic program. Then we use the prioritized logic program as a basis to formalize our update problems. In a prioritized logic program, a proper priority preference on rules is speci ed so that for two con icting rules, the rule having a higher priority will defeat the rule with a lower priority when the program is evaluated.
1.5 Organization of This Paper
This paper is organized as follows. Section 2 proposes a prioritized logic programming theory which provides a formal basis for our formulation of logic program based updates. Section 3 develops a generalized simple fact update approach which improves Marek and Truszczynski's approach. Section 4 examines semantic properties of the generalized simple fact update. Speci cally, minimal change and persistence properties of the simple fact update are addressed in detail. Section 5 further investigates restricted monotonicity properties for the simple fact update which can be used to simplify an update evaluation. Section 6 extends our update framework to deal with logic program updates. Section 7 studies properties of logic program updates. Speci cally, this section proves new splitting theorems for prioritized logic programs and shows how these results are used to simplify the inference problem related to a logic program update. Section 8 analyzes the computational complexity of both simple fact and logic program updates. Section 9 discusses related work, and nally section 10 concludes this paper with some further discussions.
2 Prioritized Logic Programs In this section, we propose a framework of prioritized logic programs. A prioritized logic program is an extended logic program associating to a preference ordering on rules in the program. The semantics of prioritized logic programs will be de ned based on Gelfond and Lifschitz's answer set semantics for extended logic programs [16].
2.1 Syntax
The language L of prioritized logic programs has the following vocabulary: - Variables: x, y, z, . - Constants: C , C1 , C2 , , including logical constants True and False. - Predicates: P; Q; R; . - Function Symbols: f; f1 ; f2; . - Names: N; N1; N2; . 5
- A strict partial ordering (i.e. antire exive, antisymmetric and transitive) < on names. - A naming function N , which maps a rule (see below) to a name. - A symbol , which is used to represent a rule. - Connectives : and not, where : represents the classical negation (strong negation), and not represents negation as failure (weak negation). We also require that the sets of variables, constants, predicates and names be disjoint. A term is de ned in an inductive way: a constant or a variable is a term; if t is a term and f is a function symbol, then f (t) is also a term. An atom is of the form P (t1 ; ; tk ), where P is a predicate of arity k and t1 ; ; tk are terms. A literal is either an atom or a negation of an atom. A rule is n expression of the form L0 L1 ; ; Lm,not Lm+1 ; , not Ln, where Li (0 i n) is a literal. L0 is the head of the rule, while L1; ; Lm,not Lm+1 ; , not Ln is the body of the rule. Obviously, the body of a rule could be empty. A term, an atom, a literal, or a rule is ground if no variable occurs in it. For the naming function N , we require that for any rules r and r0 in a prioritized logic program (see the following de nition), N (r) = N (r0) i r and r0 indicate the same rule. An extended logic program is a collection of rules [16]. A prioritized logic program (PLP) P is a triplet (; N ;