In Principles of Knowledge Representation and Reasoning: Proceedings of the Third International Conference (KR'92), Pages 393{402, Cambridge, Massachusetts, October 1992.
Tractable Deduction in Knowledge Representation Systems Mukesh Dalal
Rutgers University Computer Science Department New Brunswick, NJ 08903, U.S.A.
Abstract A widely-used way to deal with the intractability of various deduction problems is based on identifying their tractable cases. Current techniques for this are highly problem speci c. We present a new technique that obtains powerful tractability results for many dierent problems. Our technique is based on a notion of partial consistency for logical theories. Any set of theories for which a xed level of partial consistency can guarantee logical consistency provides a tractable class of deduction problems. We apply this technique to obtain tractability results in the areas of constraint satisfaction problems, databases with incomplete information and disjunctive logic programming.
1 INTRODUCTION It is well known that deductive reasoning in a knowledge representation system becomes more dicult as the representation language becomes more expressive [Levesque and Brachman, 1985]. Deductive reasoning (or deduction) is intractable1 even for the very weak representation language of propositional logic [Cook, 1971]. Since practical knowledge representation systems need more expressive representation languages [Doyle and Patil, 1991], this intractability of deduction is a serious problem. A widely-used approach to deal with this intractability is based on identifying those representation languages for which deduction is provably tractable. For example, the frame description language FL? that allows only AND, OR, and SOME operators has a polynomial Email:
[email protected] For the purpose of this paper, a problem is \intractable" if the corresponding decision problem is either NP-Hard or CoNP-Hard [Garey and Johnson, 1979], otherwise the problem is \tractable", \easy" or \simple". 1
time algorithm for detecting subsumption between descriptions [Brachman and Levesque, 1984]. Another well known example is the relational data model that allows only positive atomic facts to be explicitly represented, such that querying such databases is tractable [Codd, 1970]. Although many such tractable cases have been independently identi ed for various kinds of deduction problems, their descriptions are highly problem-speci c and do not seem to apply to one another. In this paper we present a very general characterization that can be used for identifying tractable cases of many dierent kinds of deduction problems. We also present some new tractable cases that have been obtained using our characterization. We also present three widely-diering applications to illustrate the power and generality of our approach. The basic idea behind our approach is as follows. The problem of deduction in knowledge representation is a variant of the consistency problem, i.e., determining whether any given logical theory is consistent. Consistency can be determined easily in absence of any disjunctive information. One way to deal with disjunctions is to use some form of case-analysis, i.e., assuming that some particular proposition is true and then propagating its consequences. It is possible to determine whether a theory is consistent by allowing unlimited nesting of assumptions. By restricting the depth of such nesting, we obtain a notion of partial consistency for logical theories. Any collection of theories for which a xed level of partial consistency can guarantee logical consistency provides a tractable class of deduction problems. Our notion of partial consistency for logical theories is similar to but much more general than that for constraint satisfaction problems [Freuder, 1978]. The plan of rest of the paper is as follows. In the next section we give some basic de nitions and terminology. In Section 3, we present tractable, but incomplete, methods to detect inconsistency and to propagate facts in logical theories. These methods are used
1: 2: 3: 4: 9: 10: 11: 12:
f^ ) f 5: ^ ) ^ [ ]t f_ ) 6: _ ) _ [ ]f t^ ) 7: x 6= x ) f t_ ) t 8: x = x ) t ^ (( ^ ) _ ( ^ ) _ : : :) ) ^ ^ ( _ _ : : :) _ (( _ ) ^ ( _ ) ^ : : :) ) _ _ ( ^ ^ : : :) p(v; x; w) ^ :p(v; y; w) ) p(v; x; w) ^ :p(v; y; w) ^ x 6= y x = y ^ ) x = y ^ [ ]xy (x y) 1
2
1
2
1
2
1
2
Figure 1: Rewrite rules for FPF in Section 4 to obtain levels of partial consistency. We also present an algorithm for achieving higher levels of consistency. In Section 5, we de ne a notion of intricacy and use it to characterize tractable cases of deduction. The next three sections contain applications. In Section 9, we generalize the notion of partial consistency to directional consistency. We also generalize the entire framework in the next section. Due to space limitations, detailed discussion and all the proofs have been relegated to [Dalal, 1992b].
2 PRELIMINARIES We restrict to rst-order predicate calculus with equality but without functions symbols (other than constants) and variables [Mendelson, 1964]. Let L denotes the set of all formulas in this language. Without loss of any generality, we assume that the only logical connectives are _; ^, and :, and that all formulas are in negation normal form, i.e., all negation symbols are in front of the atoms. For technical reasons, we assume a total ordering among all the constants in L. We denote constant symbols by a; b; etc., predicate symbols by p; q; etc., literals (atoms and their negations) by ; ; etc., formulas by ; ; etc., and theories by ?; ; etc. The complement operator on literals is de ned as follows: if = p(a1 ; : : :; ak ) then = :p(a1; : : :; ak ), and if = :p(a1; : : :; ak ) then = p(a1 ; : : :; ak ). We assume that there are two special literals, t (true) and f (false), that are complements of each other. For any set, A, of literals, A denotes the set containing the complement of each literal in A. For any theory ?, we use lits(?) to denote the set of all atoms (and their negations) that occur in ?; facts(?) to denote the set of all unit formulas in ?; and nf(?) to denote the set of all non-unit formulas in ?, i.e., the set (? ? facts(?)). For example, if ? = fp(a); :q(b); p(b) _ :q(a)g, then lits(?) = fp(a); :p(a); p(b); :p(b); q(a); :q(a); q(b); :q(b)g, and facts(?) = fp(a); :q(b)g. Following the usual conventions, we denote a singleton set f g by , the empty set fg by ;, and the limit ordinal for natural numbers by 1. 2
3 FACT PROPAGATION We rst present a simple way to detect some inconsistent theories. Consider a boolean function BI, called the basic inconsistency function, that returns true for a theory i the set of facts (i.e., unit formulas) in the theory is inconsistent. BI detects some, but not all, logical inconsistencies. For instance, although both the theories fp(a); :p(a)g and fp(a) _ q(b); p(a) _ :q(b); :p(a) _ q(b); :p(a) _ :q(b)g are logically inconsistent, BI can detect the inconsistency in only the former. However, it can be determined in linear time whether BI returns true for any given theory. We now describe a tractable algorithm FPF, called the fact propagation function [Dalal, 1992a; Dalal, 1992b] that simpli es any given logical theory by propagating its literals to other formulas in it. Any new literals that are generated are also propagated until no more new literals can be generated or a basic inconsistency is detected. For example, given the theory fp(a); :p(a) _ :q(a); q(a) _ r(a) _ s(a)g, FPF obtains a logically equivalent theory fp(a); :q(a); r(a) _ s(a)g. For theories in conjunctive normal form (CNF), FPF is identical to unit resolution [Chang and Lee, 1973] as well as boolean constraint propagation [McAllester, 1980; McAllester, 1990]. For arbitrary formulae, FPF is more powerful than BCP applied to their CNF form. FPF can also be viewed as a generalization of a lineartime algorithm for testing propositional Horn satis ability [Dowling and Gallier, 1984]. Given any theory ? in L, FPF applies the rewrite rules of Figure 1, each of which is a logical identity, in any sequence until no more changes are possible. Note that x and y are any constants, v and w are any sequences of constants, is any literal, ; 1 ; : : : are any subformulas, and [ ]zy denotes the result obtained from by substituting each occurrence of y by z.2 For another example, consider the theory ? = A theory is viewed as a (possibly in nite) conjunction of all its formulas. Rule 9 is a simpli ed version of the correct rule in which all the 's are required only to be equivalent under renaming of equivalent constants. Rule 12 uses the total ordering of constants in L. 2
fp(a; b); :p(c; b); a = c _ b = cg. FPF rst obtains a= 6 c using Rule 11, and then uses rules 5, 7 and 2 to obtain b = c. Assuming b c, Rule 12 simpli es the theory further to nally obtain FPF(?) = fp(a; b); :p(b; b); a = 6 bg.
By maintaining proper data structures, FPF(?) for any theory ? can be computed in time O(n(l + 1)), where n is the size of ? and l is the maximum number of alternations of connectives ^ and _ in any formula of ?. In general, FPF maintains logical equivalence, i.e., for any theory ?, ? FPF(?). For any theory ? and set A of literals, we abbreviate FPF(? [ A) by ?A . In particular, FPF(?) is denoted by ?; .
4 PARTIAL CONSISTENCY We now combine BI and FPF to obtain stronger methods to detect more subtle inconsistencies in theories. In particular, we de ne levels of partial consistency based on the result of assuming and propagating literals in a given theory. Consider the following logically equivalent theories: = fp(a) _ q(a); p(a) _ :q(a); :p(a) _ q(a) _ r(a)g and = fp(a); q(a) _ r(a)g. It can be veri ed that :p(a) is basic inconsistent, but there is no literal in nf( ) that causes such basic inconsistency.3 Thus, in some sense is \more consistent" than . This notion is formalized below: De nition 1 Any theory ? is (?1)-consistent. For any natural number k, a theory ? is k-consistent i :BI(?; ) and for each literal 2 lits(nf(?; )), ? is (k ? 1)-consistent. A theory ? is 1-consistent i it is k-consistent for all k < 1. The consistency level of any theory ? is the maximum k such that ? is k-
consistent.
Intuitively, a theory is k-consistent i propagating any sequence of k assumptions, each of which occurs in the non-facts of the theory after the propagation of earlier assumptions, does not lead to basic inconsistency. In the previous example, while the theory is not even 1-consistent, is 1-consistent. Lemma 1 For any theory ? and any natural number k, if ? is k-consistent then it is also (k ? 1)-consistent. A theory is basic inconsistent i it is not 0-consistent. Any 1-consistent theory is logically consistent.
Any consistent theory can be transformed into a logically equivalent theory with an arbitrary high level of consistency, by rst adding a number of clauses and then doing fact propagation. In the previous example, applying FPF to [ fp(a)g produces , which is an 1-consistent theory. Thus, adding p(a) and propagating it changes the consistency level of from 0 to 1 without changing its logical content. The algorithm 3
Note that nf( ) = fq(a) _ r(a)g.
make-k-consistent(?): finput: any theory ?; output: a theory s.t. = ; ?, and either BI() or is k-consistentg begin := mconsistent(?; k); return (? [ ); end. mconsistent(?;k): if k < 0 then return ;; := ;; ? := ?; ;
repeat if then return ; select an ; 0 mconsistent( ); 0; if then add to both and 0 else if then 0 for each add to and until no more changes; return
BI(?)
2 lits(nf(?)) := ? ;k? 1 BI((? [ ) ) ? = 6 ; 2 _ ?
end.
Figure 2: An Algorithm for achieving k-Consistency
make-k-consistent, given in Figure 2, performs this transformation for any input theory ?. Note that for an inconsistent theory, this transformation may produce ff g. For example, consider a theory, = fp(a) _ q(a); p(a) _ :q(a); :p(a) _ :q(a) _ r(a); :p(a) _ :q(a) _ :r(a)g. is not 1-consistent, since :p(a) is basic inconsistent. However, make-1-consistent() produces the theory fp(a); :q(a)g, that is 1consistent. Consider another theory, = fp(a) _ q(a); p(a) _ :q(a); r(a) _ s(a) _ t(a); r(a) _ s(a) _ :t(a)g. Make-1-consistent( ) produces a 1-consistent theory fp(a); r(a) _ s(a) _ t(a); r(a) _ s(a) _ :t(a)g, while make-2-consistent( ) produces an 1-consistent theory fp(a); r(a) _ s(a)g. Consider the inconsistent theory, = fp(a) _ q(a); p(a) _ :q(a); :p(a) _ q(a); :p(a) _:q(a)g. It can be veri ed that make-1-consistent() produces a basic inconsistent theory. Lemma 2 For any theory ? and any natural number k, make-k-consistent(?) always halts and produces a logically equivalent theory such that either BI() or is k-consistent. In [Dalal, 1992b], we show that although there are other algorithms for achieving k-consistency, make-kconsistent is special since it makes minimal changes 3 in the input theory. In particular, if BI(?) or ? is k-
k
1
S S S
k
2
k
3
Figure 3: Network for C
(1:1 ^ 2:3) _ (1:1 ^ 2:4) _ (1:2 ^ 2:3) _ (1:2 ^ 2:4) (1:1 ^ 3:6) _ (1:2 ^ 3:5) _ (1:2 ^ 3:6) (2:3 ^ 3:5) _ (2:4 ^ 3:5) _ (2:4 ^ 3:6) 1:1 _ 1:2 :1:1 _ :1:2 2:3 _ 2:4 :2:3 _ :2:4 3:5 _ 3:6 :3:5 _ :3:6
consistent, then make-k-consistent(?) = ?. We also show that a straightforward implementation of this algorithm takes O(mk2 nl) time and O(n + mk ) space, where n is the size of ?, m is the number of distinct symbols in ?, and l is the maximum number of alternations of connectives ^ and _ in any formula of ?. However, by using some additional data structures, the time complexity can be reduced to O(mk nl), without any increase in the space complexity. Thus, for a xed k, this algorithm runs in polynomial time.
5 TRACTABLE DEDUCTION The algorithm make-k-consistent of the previous section transforms any theory into a logically equivalent theory that is either basic inconsistent or kconsistent. As we saw in some examples there, sometimes the result may be 1-consistent even for a small value of k. In such cases it is trivial to determine whether the given theory is consistent. Dierent theories may require dierent values of k to achieve this condition. De nition 2 The intricacy of a theory, ?, is the minimum k such that make-k-consistent(?) is either basic inconsistent or 1-consistent. The intricacy of a collection, S , of theories is the minimum of the following two: (1) the maximum intricacy of all consistent theories in S , and (2) the maximum intricacy of all inconsistent theories in S .
In the previous example, the intricacy4 of , , and are 1, 2, and 1, respectively. In some sense, the intricacy of a theory is a measure of the diculty of determining its consistency. The next theorem shows that the same holds for collections of theories. Theorem 1 If the intricacy of a collection, S, of theories in L is nite, then the consistency problem for S can be solved in polynomial time.
Thus, intricacy is a parameter which can be used to identify tractable cases for determining consistency. [Dalal, 1992b] presents an algorithm, which is a variant of make-k-consistent, that determines consistency for such theories in polynomial time. Note that the 4 In [Dalal, 1992c], the term \cryptness" was used for the notion of intricacy.
Figure 4: (C) above theorem gives only a sucient condition, that may not be necessary, i.e., there may exist a tractable collection of theories with unbounded intricacy. However, [Dalal, 1992c] shows that the two most wellknown tractable cases of propositional satis ability | Horn clauses and 2-SAT | have nite intricacy.
6 CONSTRAINT SATISFACTION A constraint satisfaction problem [Mackworth, 1987] is speci ed by a nite set, X, of variables fx1; : : :; xng and a set of constraints on subsets of these variables limiting the values they can take. A solution is an assignment of a value to each variable such that all the constraints are satis ed. As is customary in the CSP literature, we restrict our attention to those CSPs where all the constraints are either unary or binary and are explicitly provided as sets of tuples. It is well-known that the general problem of determining whether a CSP has a solution is intractable. The network representing a CSP problem is a graph whose nodes represent variables and unary constraints, and arcs represent binary constraints. Current eorts [Dechter and Pearl, 1987] to characterize tractable CSPs rely either on the topology of the underlying constraint network or the semantics of the constraints [Deville and Hentenryck, 1991]. In this section, we present an overview of how intricacy has been used to develop a new and much more powerful characterization of tractable CSPs [Dalal, 1992c]. In addition to the topology of the constraint network, this characterization also uses the semantics and the syntactic forms of various constraints in the network. Any CSP problem C can be directly translated into a theory (C) in L such that the size of (C) is polynomial in the size of C, and that C has a solution i (C) is logically consistent. For example, consider a CSP problem, C, with the network shown in Figure 3, and where the unary constraints for x1, x2, and x3 are f1; 2g, f3; 4g, and f5; 6g respectively; and the binary constraints for the pairs fx1; x2g, fx1; x3g, and fx2; x3g are f(1; 3); (1; 4); (2;3);(2; 4)g, f(1; 6); (2; 5); (2;6)g, and f(3; 5); (4; 5); (4; 6)g respectively. The formulas of the mapping, (C), are shown in Figure 4, where an atom i:j intuitively denotes that variable xi is assigned value j. Note that (C) is not 4
in CNF. Although there are other ways to map CSPs to propositional satis ability [de Kleer, 1989], many of them lead to an exponential increase in size. Notions of k-consistency and strong k-consistency have been de ned for CSP problems [Freuder, 1978]. We show in [Dalal, 1992b] that, in a certain sense, our notion of k-consistency of (C) is stronger than either of these notions for C. In particular, we prove the following lemma: Lemma 3 If a CSP problem, C , with n variables is strong n-consistent then (C) is 1-consistent. For any k > 2, there is a CSP problem, C , that is not strong k-consistent, but (C) is 1-consistent. For any k > 1, there is a CSP problem, C , that is strong k-consistent, but (C) is not even 1-consistent. For example, the network, C, of Figure 3 is not 3consistent, since the consistent partial assignment f1: 1; 2:3g can't be extended to a consistent assignment of x3 . However, (C) is 1-consistent, since 2:4 holds in (C)1:1, and 1:2 holds in (C)2:3. Intuitively, the inconsistencies are detected and corrected earlier in (C). The next theorem shows that intricacy of (C) is bounded by each of the topological parameters that are currently used for identifying tractable CSPs. Theorem 2 For any CSP problem, C , the intricacy of (C) is less than each of the following parameters of the network for C : induced-width, the size of the largest non-separable component, the minimum depth of a DFS spanning tree, and the size of the smallest cycle-cutset.
It follows that the worst-case time complexity of determining whether a solution exists is polynomially bounded by any of these parameters, a result that's already known. This theorem is signi cant, considering the following last line in the survey [Dechter, 1991]: \We conclude, therefore, that : : : (induced-width) : : : is the most informative graph-parameter of all, and it can be regarded, therefore, as an intrinsic measure of the worst-case complexity of any constraint network.". Intricacy can also be used to identify tractable classes of CSPs based on the semantics of the constraints. A functional constraint [Deville and Hentenryck, 1991] is de ned to be a binary constraint such that for each value of one variable, at most one value of the other variable is allowed. A CSP is called functional if its constraint network contains a spanning tree in which each edge corresponds to a functional constraint. For any xed number k, it is easy to construct a functional CSP for which each of the topological parameters listed above is greater than k. Since none of these parameters can be bounded, topological criteria alone fail to identify functional CSPs as a tractable class. However, it follows from the next theorem [Dalal, 1992b] that it can be determined in polynomial time whether any functional network has a solution. 5
Theorem 3 The intricacy of (C) is 1 for any functional CSP problem C . We conclude, therefore, that our characterization of tractable CSPs based on intricacy is a signi cant improvement over any such characterization based either on the topology of the underlying network or the semantics of the constraints alone.
7 QUERYING DATABASES WITH INCOMPLETE INFORMATION Recent results [Vardi, 1986; Abiteboul et al., 1987] have shown that allowing representation of even very simple kinds of incomplete information in relational databases makes it intractable (CoNP-Complete) to query them. Although there have been some attempts (c.f. [Abiteboul et al., 1987; Imielinski and Vadaparty, 1989]) to identify tractable cases of querying, they are applicable only to databases with very restricted kinds of incomplete information. For example, the only kind of incompleteness allowed in [Imielinski and Vadaparty, 1989] is the presence of certain variables, each of which can take a value from a pre-speci ed set of constants. In this section, we de ne a very general model of relational databases with incomplete information, and use intricacy to obtain tractable cases of querying. We pay no penalty for the generality of our model, since our tractability results subsume those known previously.
The Data Model: Consider a rst-order logical language Ld with equality but without function symbols
(other than constants). A database DB consists of two parts | an intensional database IDB and an extensional database EDB. An IDB is a theory in Ld that does not contain any existential quanti er. An EDB is a theory in Ld that contains only ground formulas. Although we denote a DB by a tuple hIDB; EDB i , logically it is the union of the two theories. The domain D of a database is the set of all constants that occur in it. This data model is more powerful than Datalog [Ullman, 1988] and can represent various kinds of incomplete information | simple, restricted and conditional null values [Codd, 1979; Imielinski and Lipski, 1984], uniform disjunctions [Imielinski and Vadaparty, 1989; Borgida and Etherington, 1989], conditional tuples [Abiteboul et al., 1987], disjunctive rules [Gallaire et al., 1984], etc. It can also represent restricted forms of explicit negative information, and integrity constraints of various kinds. However, this model cannot represent information which involves functions, or which involves an existential quanti er in the scope of a universal quanti er. Although the closed-world assumption [Reiter, 1984] is ignored in this section, [Dalal, 1992b] shows that it can be easily incorporated.
P 1 x 2 y 3 x
R 1 1 2 1 1 2
Figure 5: An OR-database A query Q is an expression of the form (x): (x), where is a formula that does not contain any universal quanti er, and x is a sequence of all free variables that occur in . The answer Q(DB) is the set fa 2 Djxj : DB j= (a)g. The data complexity of a query Q for an intensional database IDB is the complexity of their graph, which is de ned as: Gr(IDB; Q) = f(EDB; a) j a 2 Q(hIDB; EDBi)g Since IDB and Q are kept xed, this measures the complexity of query evaluation in terms of the size of EDB. Given any database DB, query Q, and a tuple a, [Dalal, 1992b] presents a polynomial time algorithm that obtains a theory Tr(DB; Q; a) in L, which is unsatis able i a 2 Q(DB). It follows that the problem of querying databases with incomplete information can be polynomially reduced to the deduction problem in L. Thus, we can use the notion of intricacy to identify tractable cases of querying. For any query Q = (x): (x) and any intensional database IDB, consider the following set: ?(IDB; Q) = fTr(hIDB; EDBi ; Q; a) j a 2 Djxj and EDB is any extensional databaseg
Theorem 4 The data complexity of query Q for an
intensional database IDB is in polynomial time if the intricacy of ?(IDB; Q) is nite.
Consider the following three special kinds of incompleteness and queries: 1. The DB is in CNF, any clause contains at most two literals, equality predicate is not used (though inequality is allowed), and the query is a conjunctive formula with at most two literals. 2. The DB contains marked nulls (i.e., null values that can be shared), and conditions that involves only inequality. The query could be any conjunctive formula. 3. Similar to the case 1 above, except that equality is also allowed. Querying is tractable in the rst two cases, since the intricacy is nite [Dalal, 1992b]. However, intricacy is not nite in the third case, for which the data complexity is indeed CoNP-Complete. 6
P(1; x) P(2; y) P(3; x)
Q(1; 1) Q(2; 1) Q(1; 2)
x= 1_x= 2 y = 1_y = 2 :P(X; Y ) _ :Q(Y; X)
Figure 6: Tr(DB; Q; ())
OR-databases: OR-databases extend relational data model by allowing explicit representation of disjunctive information [Imielinski and Vadaparty, 1989]. A tuple may contain OR-objects | variables each of which is associated with a set of constants, called its domain. Each OR-database corresponds to potentially many relational databases, obtained by substituting each OR-object by some value in its domain. A query, which is any existentially quanti ed conjunctive formula with no free variables, is true for an OR-database i it is true in all the relational databases associated with it. Three kinds of OR-databases are considered in [Imielinski and Vadaparty, 1989]: Type-I (all ORobjects are distinct), Type-II (an OR-object can be repeated only in the same column), and Type-III (no restrictions). Databases are further grouped by associating a typing function which speci es the columns that can have OR-objects. For any kind of OR databases, and any typing function, tractability of any query can be determined using a syntactic marking property. For example, a query is tractable with respect to Type-II databases i it is acyclic. Similar results are proved for Type-I and Type-III databases. Since OR-databases can be represented in our data model (where IDB is always empty), the translation Tr(DB; Q; ()) can be de ned for any database DB and query Q. Consider the OR-database of Figure 5, where both the OR-objects x and y have the same domain f1; 2g, and the query 9x9y(P(x; y) ^ R(y; x)). Their translation contains the formulas given in Figure 6, where the last schema represents all formulas obtained by substituting each of X and Y by a value in f1; 2g in all possible ways. In this particular case, the query is true since Tr(DB; Q; ()) is inconsistent. As an abbreviation, we de ne the intricacy of a query Q to be the intricacy of the set ?(;; Q) of logical theories. The following theorem shows that all the tractability results presented in [Imielinski and Vadaparty, 1989] could be explained using the notion of intricacy: Theorem 5 The intricacy of any acyclic query for
Type-II OR-databases, or any strongly acyclic query for Type-I OR-databases, or any simple query for Type-III OR-databases is bounded by the number of OR-arguments in the query.
A binary query contains at most two literals. Using the notion of intricacy, we now obtain a new tractability
result for OR-databases of Type I, where no sharing of OR-objects is allowed:
Theorem 6 The intricacy of any binary query for Type-I OR-databases, in which the domain of each ORobject contains at most two constants and each relation has at most one OR-column, is 1. Thus, such databases can also be queried in polynomial time. In [Dalal, 1992b] we consider some other data models that allow explicit representation of incomplete information (for instance, see [Abiteboul et al., 1987]) and obtain tractable cases of querying them.
8 QUERYING DISJUNCTIVE LOGIC PROGRAMS For the purpose of this section, we restrict to propositional calculus. A disjunctive logic program consists of a nite set of program clauses of the form 1 ; : : :; k (k 0) where ; 1; : : :; k are disjunctions of atoms (called wfds). is called the head and 1 ; : : :; k is called the body of the program clause. Similarly, a goal clause (or a query) is an expression of the form 1 ; : : :; k (k 0) A query Q is true in a program P i Q is a logical consequence of P. It is known that the complexity of querying disjunctive logic programs is CoNP-Complete [Lobo, 1990]. In this section, we use the notion of intricacy to identify cases of tractable querying. Since we are only interested in positive wfds that are logically entailed by a disjunctive logic program, the de nition of partialconsistency is modi ed so that is required to be a negative literal. The same change is made in the algorithm make-k-consistent. The de nition of intricacy, etc. remains the same. As in the case of de nite logic programs, where each disjunction contains exactly one atom, a declarative semantics can be provides to capture the intended meaning of a disjunctive logic program [Minker and Rajasekar, 1990; Lobo, 1990; Dalal, 1992b]. The Herbrand base HB(P) of any program P is the set of all atoms that occur in P. The extended Herbrand base EHB(P) is the set of all wfds that can be formed using the atoms in HB(P), i.e., EHB(P) = 2HB(P ) . A state S is a subset of EHB(P) that is closed wrt supersets, i.e., 8; 2 EHB(P); ( 2 S ^ ) ! 2 S A state S is a model-state of a program clause 1 ; : : :; k i 81 ; : : :; k 2 S, [ (1 ? 1 ) [ : : : [ (k ? k ) 2 S. A state is a model-state of a disjunctive 7
program i it is a model-state of each clause in the program. Intuitively, the notion of a state (or model-state) is analogous to the notion of a Herbrand interpretation (model) for de nite programs. For instance, the intersection of model-states produces a model-state (modelstate intersection property). Thus, the intersection of all model-states of a program P is also a model-state, called the least model-state, of P. Following the usual convention, we denote this model-state by MP . The wfds in MP are precisely those that are logical consequences of the program. Thus, MP can be regarded as the natural interpretation of the program. It follows that a query is true for a program i each wfd in the query is also in the least model-state of the program. For example, consider the program P = fa _ b ; c a; c bg containing only three clauses. The Herbrand base of P is fa; b; cg, whose power set is the extended Herbrand base. P has four model-states: M1 = fc; a _ b; a _ c; b _ c; a _ b _ cg M2 = fa; c; a _ b; a _ c; b _ c; a _ b _ cg M3 = fb; c; a _ b; a _ c; b _ c; a _ b _ cg M4 = fa; b; c; a _ b; a _ c; b _ c; a _ b _ cg Note that M1 , which is the least model-state of P, captures the intended meaning of the program. The least model-state of any program P can be alternatively characterized as the least xed-point of a mapping TP : 2EHB(P ) ! 2EHB(P ) that is de ned as follows: TP (S) = f0 2 EHB(P) : 1 ; : : :; k is a program clause in P; [ (1 ? 1 ) [ (k ? k ) 0; and f1 ; : : :; k g S g Intuitively, this mapping extends the mapping TP for de nite programs [van Emden and Kowalski, 1976] to disjunctive programs by explicitly enforcing the logical dependencies among the wfds. [Dalal, 1992b] shows that TP is continuous (and monotonic) for any disjunctive program P, and hence TP "! is its least xed-point. It also shows that this least xed-point is identical to the least model-state of the program, which is its intended meaning. For any program P, let head(P) denote the set of heads of all program clauses whose bodies are empty. The next lemma shows that for any 1-consistent program P, its least model-state can be generated using head(P). It then follows that achieving a consistency level of intricacy is sucient to generate the least model-state of a program.
Lemma 4 For any disjunctive program P 1. if P is 1-consistent then MP = [head(P)]; and 2. if the intricacy of P is k then MP [head(make-k-consistent(P))].
=
Since any query can be answered using the least modelstate of the program, we obtain the next theorem which shows that querying programs of nite intricacy is tractable.
Theorem 7 If the intricacy of a set S of programs is
nite, then the programs in S can be queried in polynomial time.
Thus, intricacy is a parameter which can be used to identify tractable cases of querying. We illustrate its use by showing two simple examples. Consider a de nite program P. Propagating its facts, without making any assumptions, produces the theory P; , which is 1consistent. Thus, the intricacy of P is 0. Note that head(P; ) is also the least Herbrand model of P. It follows that any de nite program can be queried in linear time. Consider another program P, such that each program clause in P contains at most two atoms. As shown in the example above, such a P may not be a de nite program. In [Dalal, 1992b], we show that intricacy of any such program is 1, and hence can also be queried in polynomial time. In [Dalal, 1992b], we use intricacy to de ne a notion of approximating the least model-state of a program. In contrast to the approximations in [Lobo, 1990], our approximations are always sound.
9 DIRECTIONAL CONSISTENCY In this section we improve the results of Sections 4 and 5 by relaxing the notion of k-consistency. In particular, we require that the literals are selected in some xed order. For simplicity of presentation, we restrict to propositional calculus. De nition 3 For any theory ?, an ordering, o, of symbols is a sequence in which each symbol in ? occurs exactly once. For any literal p, the ordering op is obtained from o by removing p and all the symbols that occur before it.
For example, o = [P; Q; R; S] is an ordering for the theory f:P _ Q _ R; R _ :S g. For this ordering, oQ = o:Q = [R; S].5 Directional consistency can be de ned as follows: De nition 4 Let o be any ordering for a theory ?. Any ? is (?1)-consistent wrt o. For any natural number k, ? is k-consistent wrt o i :bi(? ) and for each literal p 2 lits(nf(? )) such that p is in o, ?p is (k ? 1)consistent wrt op . Intuitively, directional consistency does not allow the selection of literals in an order that violates the given ordering. In the above example, literal P can't be selected after selecting literal :R. For any k, a theory
may not be k-consistent, but it may be k-consistent wrt some particular ordering. Consider the theory = f:P _ Q; :P _ :Q _ :R; :R _ P _ Qg. Since fR;:Qg is basic inconsistent, R is not 1-consistent, and thus is not 2-consistent. However, it can be veri ed that is 2-consistent wrt the ordering [P; Q; R]. Intuitively, this ordering precludes selecting the literal :Q in R, while :R already holds in :Q . However, the following lemma holds: Lemma 5 For any k, a theory is k-consistent i it is k-consistent wrt every ordering. In [Dalal, 1992b], we show that the notions of 1consistent, consistency level, and intricacy of a theory can be analogously de ned wrt a given ordering. The directional intricacy of a theory is the minimum intricacy wrt any ordering. Directional consistency can be achieved by modifying the algorithm mconsistent of Figure 2. The modi ed algorithm keeps track of the literals selected so far, and does not allow them to violate the given ordering. We also show that directional counterparts of Lemmas 1 and 2 hold. Theorem 1 can also be further strengthened by introducing a new notion: an ordering function, of, is a polynomial function from the set of theories to the set of orderings. Intuitively, for any theory, it generates an ordering of symbols for which it is easier to achieve either 1-consistency or basic inconsistency. The intricacy of a set of theories is now de ned wrt a particular ordering function, of, so that the intricacy of each theory, ?, in the set is considered wrt to the ordering of(?). The directional version of Theorem 1 is as follows: Theorem 8 For any collection, S, of propositional theories, if the intricacy of S wrt to some ordering function is nite, then consistency problem for S can be solved in polynomial time.
Since the directional counterpart of Lemma 3 holds for constraint satisfaction problems, it follows that this notion of directional consistency of (C) is stronger than the notion of adaptive consistency [Dechter and Pearl, 1987].
10 A GENERAL THEORY
Until now we have been using speci c basic inconsistency and fact propagation functions. In this section, we generalize our results by using any such functions which satis es certain properties. A basic inconsistency function is any polynomial time boolean function on the set of all theories. A basic inconsistency function, bi, is sound i for any theory ?, if bi(?) is true then ? is unsatis able. bi is complete wrt facts i for any theory ?, if facts(?) is unsatis able then bi(?) is true. A theory, ?, is said to be basic 5 We abuse the notation a little bit by ignoring the dis- inconsistent i bi(?) holds. It can be veri ed that BI tinction between a symbol and its negation, and say that is a basic inconsistency function which is both sound :R is in the sequence [P; Q; R; S ]. 8 and complete wrt facts.
A fact propagation function is any polynomial time function on the set of all theories. A fact propagation function, fpf, is sound i for any theory ?, ? j= fpf(?). fpf is lossless i any theory ?, fpf(?) j= ?. fpf is separable i for any theory ?, the sets of symbols occurring in facts(fpf(?)) and nf(fpf(?)) are disjoint. fpf is monotonic i for any theory ?, either bi(fpf(?)) or facts(?) facts(fpf(?)). A fact propagation function, fpf, is said to be complete wrt clauses i for any theory ? containing a clause C, if p is a literal in C then ?p is either basic inconsistent or there is clause D in it such that p does not occur in D, and all the literals of D occur in C. For example, if ? contains the clause P _ Q _ R, then ?:P should be either basic inconsistent or should contain Q, R, or Q _ R. It can be veri ed that FPF is sound, lossless, separable, monotonic, and complete wrt clauses. The results in this paper hold for any basic inconsistency function that is sound and complete wrt facts, and any fact propagation function that is sound, lossless, separable, monotonic, and complete wrt clauses.
plete information and disjunctive logic programming. In [Dalal, 1992b], we use the techniques presented here to obtain tractability results for several other problems like propositional planning, default reasoning, and subsumption in concept languages. The techniques presented in this paper have been introduced only as theoretical tools to study complexity; we do not suggest that they be used for actual problem solving. Thus, nding ecient algorithms for the tractable cases identi ed in this paper remains a useful direction for future research.
11 OTHER RELATED RESEARCH
References
Gallo and Scutella [1988] develop a hierarchy of classes of instances of SAT, such that for each class, satis ability can be determined in polynomial time. Our characterization is stronger than theirs since we can identify all the tractable classes in their hierarchy. In particular, the kth class of their hierarchy has intricacy (k+1). They also restrict the formulas to clauses, and none of their classes contain all the 2CNF formulas. Ben-Eliyahu and Dechter [1991] introduce the notion of a \primal constraint graph" for a propositional theory | the nodes of the graph correspond to the propositional symbols, and the arcs connect any two nodes whose symbols appear in the same formula. They determine the tractability of a class of theories by the topological parameters, like the induced-width, of such graphs. As we have shown in Section 6, this characterization is weaker than ours since it does not take into account the semantics of the formulas. Our approach of obtaining higher consistency levels of a theory has some similarities to the process of identifying \nogood" sets in an ATMS [de Kleer, 1986]. However, we are not aware of any extension of that process that achieves results similar to ours.
12 CONCLUSIONS We de ned notions of partial consistency and intricacy for logical theories, and used them to identify many cases of tractable deduction. To the best of our knowledge, our tractability results are the most powerful that have ever been obtained in the areas of constraint satisfaction problems, databases with incom-
Acknowledgements I would like to thank Alex Borgida, David Etherington, Bart Selman, Hari Hampapuram, Kumar Vadaparty and Vipul Kashyap for helpful discussions and comments on the earlier drafts of this paper. I also wish to thank AT&T Bell Laboratories for partial support during this research. (Abiteboul et al., 1987) Abiteboul, S.; Kanellakis, P.; and Grahne, G. 1987. On the representation and querying of sets of possible worlds. In Proceedings ACM SIGMOD International Conference on Management of Data, San Francisco, California. 34{48.
(Ben-Eliyahu and Dechter, 1991) BenEliyahu, R. and Dechter, R. 1991. Default logic, propositional logic and constraints. In Proceedings Ninth National Conference on Arti cial Intelligence (AAAI-91). 379{385.
(Borgida and Etherington, 1989) Borgida, A. and Etherington, D.W. 1989. Hierarchical knowledge bases and ecient disjunctive reasoning. In Brachman, R.J.; Levesque, H.J.; and Reiter, R., editors 1989, Proceedings First International Conference on Principles of Knowledge Representation and Reasoning. Morgan Kaufmann. 33{43.
(Brachman and Levesque, 1984) Brachman, R.J. and Levesque, H.J. 1984. The tractability of subsumption in frame based description languages. In Pro-
ceedings National Conference on Arti cial Intelligence (AAAI-84). 34{37.
(Chang and Lee, 1973) Chang, C. and Lee, R.C. 1973. Symbolic Logic and Mechanical Theorem Proving. Academic Press, London. (Codd, 1970) Codd, E.F. 1970. A relational model for large shared data banks. Communications of ACM 13(6):377{387. (Codd, 1979) Codd, E.F. 1979. Extending the relational database to capture more meaning. ACM Transactions of Database Systems 4(4):397{434. 9
(Cook, 1971) Cook, S.A. 1971. The complexity of theorem proving procedures. In Proceedings Third Annual ACM Symposium on the Theory of Computing. 151{158. (Dalal, 1992a) Dalal, M. 1992a. Ecient propositional constraint propagation. In Proceedings Tenth National Conference on Arti cial Intelligence (AAAI-92), San Jose, California. American Associ-
ation for Arti cial Intelligence. 409{414. (Dalal, 1992b) Dalal, M. 1992b. Tractable deduction in knowledge representation systems. Ph.D. thesis (in preparation). (Dalal, 1992c) Dalal, M. 1992c. Tractable instances of some hard deduction problems. In Proceedings Tenth European Conference on Arti cial Intelligence (ECAI '92), Vienna, Austria.
(de Kleer, 1986) de Kleer, J. 1986. An assumptionbased truth maintenance system. Arti cial Intelligence 28:127{162. (de Kleer, 1989) de Kleer, J. 1989. A comparison of ATMS and CSP techniques. In Proceedings Eleventh
International Joint Conference on Arti cial Intelligence (IJCAI-89). 290{296.
(Dechter and Pearl, 1987) Dechter, R. and Pearl, J. 1987. Network-based heuristics for constraint satisfaction problems. Arti cial Intelligence 34(1):1{38. (Dechter, 1991) Dechter, R. 1991. Constraint satisfaction. In Shapiro, S.C., editor 1991, Encyclopedia of AI (2nd Edition). John Wiley and Sons. (Deville and Hentenryck, 1991) Deville, Y. and Hentenryck, P.V. 1991. An ecient arc consistency algorithm for a class of CSP problems. In Proceedings
Twelveth International Joint Conference on Arti cial Intelligence (IJCAI-91). 325{330.
(Dowling and Gallier, 1984) Dowling, W.F. and Gallier, J.H. 1984. Linear-time algorithms for testing the satis ability of propositional Horn formulae. Journal of Logic Programming 1(3):267{284. (Doyle and Patil, 1991) Doyle, J. and Patil, R. 1991. Two theses of knowledge representation: language restrictions, taxanomic classi cation, and the utility of representation services. Arti cial Intelligence 48(3):261{297. (Freuder, 1978) Freuder, E.C. 1978. Synthesizing constraint expressions. Communications of the ACM 21(11):958{966. (Gallaire et al., 1984) Gallaire, H.; Minker, J.; and Nicolas, J.M. 1984. Logic and databases: A deductive approach. ACM Computing surveys 16(2):153{ 185. (Gallo and Scutella, 1988) Gallo, G. and Scutella, M.G. 1988. Polynomially solvable satis ability problems. Information Processing Letters 29:221{ 227. 10
(Garey and Johnson, 1979) Garey, M. and Johnson, D. 1979. Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, W. H., NY. (Imielinski and Lipski, 1984) Imielinski, T. and Lipski, W. 1984. Incomplete information in relational databases. Journal of the ACM 31(4):761{791. (Imielinski and Vadaparty, 1989) Imielinski, T. and Vadaparty, K. 1989. Complexity of query processing in databases with OR-objects. In Proceedings ACM Symposium on Principles of Database Systems, Philedelphia, Pennsylvania. 51{65. Full ver-
sion, co-authored with R. v. d. Meyden, submitted to JCSS. (Levesque and Brachman, 1985) Levesque, H.J. and Brachman, R.J. 1985. A fundamental tradeo in knowledge representation and reasoning (revised version). In Brachman, R.J. and Levesque, H.J., editors 1985, Readings in Knowledge Representation. Morgan Kaufmann, Los Altos, California. 41{70. (Lobo, 1990) Lobo, J. 1990. Semantics for Normal Disjunctive Logic Programs. Ph.D. Dissertation, Department of Computer Science, University of Maryland, College Park. (Mackworth, 1987) Mackworth, A.K. 1987. Constraint satisfaction. In Shapiro, S.C., editor 1987, Encyclopedia of AI. John Wiley and Sons. 205{211. (McAllester, 1980) McAllester, D. 1980. An outlook on truth maintenance. Memo 551, MIT AI Lab. (McAllester, 1990) McAllester, D. 1990. Truth maintenance. In Proceedings Eight National Conference on Arti cial Intelligence (AAAI-90). 1109{1116. (Mendelson, 1964) Mendelson, E. 1964. Introduction to Mathematical Logic. Van Nostrand, Princeton, N.J. (Minker and Rajasekar, 1990) Minker, J. and Rajasekar, A. 1990. A xpoint semantics for disjunctive logic programs. Journal of Logic Programming 9(1):45{74. (Reiter, 1984) Reiter, R. 1984. Towards a logical reconstruction of relational database theory. In Brodie, M.L.; Mylopoulos, J.; and Schmidt, J.W., editors 1984, On Conceptual Modelling. SpringerVerlag, New York. chapter 8, 191{233. (Ullman, 1988) Ullman, J.D. 1988. Principles of Database and Knowledge-Base Systems, volume 1. computer science press, Rockville, MD. (van Emden and Kowalski, 1976) Emden, M.H.van and Kowalski, R.A. 1976. The semantics of predicate logic as a programming language. Journal of the ACM 23(4):733{742. (Vardi, 1986) Vardi, M. Y. 1986. Querying logical databases. Journal of Computer and System Sciences 33(2):142{160.