22
INFSYS R ESEARCH R E P O R T Institut f¨ ur Informationssysteme Abtg. Wissensbasierte Systeme Technische Universit¨ at Wien Treitlstraße 3 A-1040 Wien, Austria Tel: +43-1-58801-18405 Fax: +43-1-58801-18493 [email protected] www.kr.tuwien.ac.at I NSTITUT F ¨ UR I NFORMATIONSSYSTEME ABTEILUNG WISSENSBASIERTE SYSTEME D ISJUNCTIONS OF H ORN T HEORIES AND THEIR C ORES Thomas Eiter Toshihide Ibaraki Kazuhisa Makino INFSYS RESEARCH REPORT 1843-99-02 JANUARY 1999

I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

I N F S Y S

R E S E A R C H

R E P O R T

Institut fur Informationssysteme

Abtg. Wissensbasierte Systeme

Technische Universitat Wien

Treitlstraße 3

A-1040 Wien, Austria

Tel: +43-1-58801-18405

Fax: +43-1-58801-18493

[email protected]

www.kr.tuwien.ac.at

INSTITUT FUR INFORMATIONSSYSTEME

ABTEILUNG WISSENSBASIERTESYSTEME

DISJUNCTIONS OFHORN THEORIES

AND THEIR CORES

Thomas Eiter Toshihide Ibaraki Kazuhisa Makino

INFSYS RESEARCHREPORT1843-99-02

JANUARY 1999

Page 2: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨
Page 3: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RESEARCH REPORT

INFSYS RESEARCHREPORT1843-99-02, JANUARY 1999

DISJUNCTIONS OFHORN THEORIES

AND THEIR CORES

Thomas Eiter1 Toshihide Ibaraki2 Kazuhisa Makino3

Abstract. In this paper, we study issues on disjunctions of propositional Horn theories. In partic-ular, we consider deciding whether a disjunction of Horn theories is Horn, and, if not, computinga Horn core (i.e., a maximal Horn theory included in this disjunction)and Horn envelope (i.e., theminimum Horn theory including the disjunction). The problems areinvestigated for different repre-sentations of Horn theories, namely for Horn CNFs and characteristic models. While the problemsare shown to be intractable in general, in the case of bounded disjunctions, we present polynomialtime algorithms for testing the Horn property in both representations, and for computing a core inthe CNF representation. Even in the case of bounded disjunction, no polynomial algorithm exists(unless P=NP) for computing a core in the characteristic model representation.

1Institut und Ludwig Wittgenstein Labor fur Informationssysteme, Technische Universitat Wien, Treitlstraße 3,A-1040 Wien, Austria. Email: [email protected]

2Department of Applied Mathematics and Physics, Graduate School of Informatics, Kyoto University, Kyoto 606,Japan. Email: [email protected]

3Department of Systems and Human Science, Graduate School of Engineering Science,Osaka University, Toyon-aka, Osaka 560, Japan. Email: [email protected]

Acknowledgements: The authors gratefully acknowledge the partial support of the Scientific Grant in Aidby the Ministry of Education, Science and Culture of Japan. Part of thisresearch was conducted while thefirst author visited Kyoto University in 1995 and 1998, by the support of the Scientific Grant in Aid by theMinistry of Education, Science and Culture of Japan.

An abstract containing some results of this paper appears in: Proceedings Ninth Annual Symposium onAlgorithms and Computation (ISAAC ’98), Taejon, Korea, K.-Y. Chwaand O. H. Ibarra, eds, LNCS 1533,pages 49–58. Springer, 1998. A previous version of this paper containing a subset of the results is availableas RUTCOR Research Report RRR 24-98, September 1998.

Copyright c 1999 by the authors

Page 4: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

2 INFSYS RR 1843-99-02

1 Introduction

Since deduction from a set of propositional clauses is a well-known co-NP-complete problem, differentapproximation methods for reasoning from a clausal theory� have been investigated, e.g., [14, 18, 3, 4, 1].One of these approaches [14] uses agreatest Horn lower bound(also calledHorn core[15]), i.e., if we viewtheories as sets of models, a maximal Horn theory�c � �, and theleast Horn upper bound(Horn envelope[15]), which is the minimal Horn theory�e � � such that� logically implies�e. Note that in general,different Horn cores may exist, while it is known that the Horn envelope is always unique.

Computing Horn envelopes and Horn cores has been investigated in [14, 15, 2, 4, 5, 9, 7, 1]. It has beenshown that a Horn core of a given CNF (conjunctive normal form) ' is computable in polynomial time withan oracle for NP [2], and that all Horn cores can be generated with polynomial delay, if the theory� is givenby the set of its models. However, in the latter setting, computing a maximum (in terms of the numbers ofmodels) Horn core is co-NP-hard [15].

In this paper, we consider the issue of computing Horn cores of the disjunction� = Sli=1 �i of Horntheories�i, represented either by Horn CNFs, or by theircharacteristic models[12]. Characteristic modelshave been proposed as a model-based alternative to the formula-based theory representation. These twoapproaches are orthogonal with respect to space requirements, in the sense that one approach sometimesallows for an exponentially smaller representation than the other; see [13, 17]. Observe that a disjunction� of Horn theories is in general not Horn. Hence, in particular, it is of interest to know whether� is Horn,since in this case the Horn core and the Horn envelope coincide to�.

Disjunctions of Horn theories may be encountered in different applications. For example, suppose thattwo groups have respectively formed logical hypotheses about an application domain (the “world”), e.g.,relationships between medical tests and diseases, and theybelieve that the relationships amount to a Horntheory. The hypotheses�1 and�2 of two groups (amounting to sets of models) may be obtained from actualand conjectured cases, respectively; i.e., concrete measurement data (obtained by experiments) and datawhich are believed to be true. Suppose that the hypotheses�1 and�2 are merged. Then, at the logic level,the disjunction, i.e., union� = �1 [�2 describes the merged hypothesis. It is of particular interest to knowwhether� is Horn; if so, then the original hypotheses are compatible in the the sense that no further caseshave to be adopted in order to preserve the Horn property, which may indicate that the individual hypothesesare sound. However, if� is not Horn, then either further cases have to be added to maintain the Hornproperty (which corresponds to derivation of new case knowledge), or some of the adopted hypotheticalcases have to be abandoned. Applying Occam’s razor, it is natural to add or to abandon a minimal set ofcases. In the former case, this amounts to finding the Horn envelope of�, and in the latter case, to finding aHorn core� of �. In finding a Horn core�, it may be also asked to add such constraint as that� includesall actual cases�1. That is, computing a Horn core� satisfying�1 � � � � can be seen as one of theimportant problems.

Another application concerns inference from knowledge bases. Suppose that Horn theories�1;�2,. . . ,�lrepresent knowledge bases which are located at different sitess1; s2; : : : ; sl, respectively. A formula' isa logical consequence of all�i, for i = 1; 2; : : : ; l, just if ' is a logical consequence of the disjunction� = Sli=1�i. Thus, in order to test whether' is a consequence in all�i, it is equivalent to test whether'is a consequence of�. This may be profitably used if the on-line access to the theories�i at the individualsites is costly or unreliable, for instance. If� is stored at a distinguished sites�, then by accessing this singlesite the query' to all knowledge bases can be answered. In the case where� is Horn, we can store a HornCNF (resp., the characteristic set) of�, which can be more compact then simply mirroring the disjunctionof Horn CNFs (resp., the characteristic sets) of the individual Horn theories�i ats�, since redundancies can

Page 5: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 3

be avoided. For example, if each�i is represented by a Horn CNF'i = ^ (x _ yi), for i = 1; 2; : : : ; l,then the Horn CNF' = ^ (x _ y1 _ y2 _ : : : _ yl) represents the disjunction� = Sli=1 �i. Note that, inthis case, storing the individual'i requires more thanl times space compared to'.

In this paper, we first address the problem of checking if a disjunction� = Sli=1 �i of Horn theories�i,represented either by Horn CNFs or by their characteristic models, becomes a Horn theory. We show that theproblem is in general co-NP-complete for both representations, but is polynomially solvable ifl is boundedby a constant. These results indicate that computing a Horn core is difficult in general. The polynomialityfollows from syntactical and semantical characterizations of a disjunction of Horn theories.

We next deal with the problem of computing a Horn core� of � satisfying�1 � � � �. We show that,if l is bounded by some constant, then the problem is polynomially solvable from Horn CNFs, while it isco-NP-hard from characteristic models, even ifl = 2. For the formula-based representations, we first presenta polynomial time algorithm CORE to compute a Horn core of thedisjunction of two Horn theories�1 and�2. Since the algorithm CORE cannot be generalized directly tothe general casel (� 3), we develop analgorithm CORE� which computes a Horn core of the disjunction ofl (� 3) Horn theories by making usesof algorithm CORE repeatedly. It turns out that algorithm CORE� runs in polynomial time ifl is boundedby some constant. On the other hand, we show that computing a Horn core is not possible in polynomialtime for characteristic models, by exhibiting a family of theories�1 and�2 having small characteristic sets,while every Horn core of�1 [ �2 is exponentially large. We also give structural characterizations of Horncores of a disjunction of Horn theories.

As for the Horn envelope, we show that it can be computed from characteristic models in polynomial time,but cannot be efficiently computed from Horn CNFs, even ifl = 2. The negative result follows from thefact that there exist Horn theories�1 and�2 such that their Horn CNFs are small, but the CNF representingthe Horn envelope of� = �1 [ �2 is exponentially large.

The rest of this paper is organized as follows. In the next section, we recall some basic concepts andintroduce notations. In Sections 3 and 4, we consider Horn cores in both representations of Horn CNFsand characteristic sets. Section 5 considers the Horn envelope. Finally, Section 6 discusses related workand concludes the paper. The complexity results of all the above problems are summarized in Table 1 ofSection 6.

2 Preliminaries

We assume a supply of propositional variables (atoms)x1; x2; : : : ; xn, where eachxi evaluates to either1(true) or0 (false). Negated variables are denoted byxi. Thesexi andxi are called literals. A clause is adisjunctionc = L1 _ � � � _ Lk of literals, while a term is a conjunctiont = L1 ^ � � � ^ Lh of literals. ByP (c) andN(c) (resp.,P (t) andN(t)), we denote the sets of variables occurring positively and negativelyin c (resp.,t). By ? (resp.,>) we denote the empty clause (resp., empty term) representing falsity (resp.,truth). A formula is composed of literals and operators: or (_), and ( ), negation ().

In particular, a conjunction of clauses' = Vi ci (resp., a disjunction of terms' = Wi ti ) is calledconjunctive normal form(CNF) (resp.,disjunctive normal form(DNF)).

A modelis a vectorv 2 f0; 1gn, whosei-th component is denoted byvi, and atheory is any set� �f0; 1gn of models. We denote byv � w the usual componentwise ordering of models, i.e.,vi � wi for alli = 1; 2; : : : ; n, where0 < 1. By min(�) andmax(�) we denote the sets of minimal and maximal modelsin � under<, respectively, wherev 2 � is amaximal(resp.,minimal) model in�, if there is now 2 �such thatw > v (resp.,w < v). ForB � f1; 2; : : : ; ng, we denote byxB the modelv such thatvi = 1 for

Page 6: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

4 INFSYS RR 1843-99-02i 2 B andvi = 0 for i =2 B.For any formula', let T (') = fv 2 f0; 1gn j '(v) = 1g denote the set of models of'. We call that a

formula' represents a theory� if T (') = �. We sometimes do not distinguish a formula from the theory itrepresents, if no confusion arises. For any formulas' and , we write' � (also' j= ) if T (') � T ( )holds. A clausec (resp., termt) is an implicate(resp.,implicant) of a theory� if c(v) = 1 for all v 2 �(i.e.,T (c) � �) (resp.,t(v) = 0 for all v 62 � (i.e.,T (t) � �)); it is prime if no proper sub-clause (resp.,sub-term) is an implicate (resp., implicant) of�.

A theory� is Horn if � = Cl^(�) holds, whereCl^(S) is the closure of a theoryS � f0; 1gn undercomponent-wise AND (i.e., intersection) of modelsv; w, denoted byvVw. Observe that any Horn theory� has the least (unique smallest) model, denotedlm(�), which is given by

Vv2� v.A clausec is Horn if jP (c)j � 1, and a CNF isHorn if it contains only Horn clauses. It is well-known

that a theory� is Horn if and only if it is represented by some Horn CNF, and that all prime implicates ofHorn theory are Horn.

A Horn theory�c is aHorn coreof a theory� if �c � � holds and no Horn theory�0 exists such that�c � �0 � �. Observe that, in general,� has more than one Horn core; e.g.,� = f(110), (101)g hastwo Horn cores�1c = f(110)g and�2c = f(101)g. TheHorn envelopeof � is the Horn theory�e � � forwhich no Horn theory�0 satisfies�e � �0 � �. For the above�, we have�e = f(110); (101); (100)g. Aseasily seen, the Horn envelope is always unique. Let' be a formula representing a theory�, and let'c and'e be formulas representing a Horn core and the Horn envelope of�, respectively. Then'c and'e are alsocalled aHorn coreand theHorn envelopeof ', respectively.

3 CNF Representations

In this section, we deal with the case, in which each Horn theory is represented by a Horn CNF.

3.1 Horn Property of a disjunction of Horn theories

Our first result deals with the Horn property for a disjunction of Horn CNFs.

Theorem 3.1 Given Horn CNFs'1,'2; : : : ; 'l, deciding whether' = Wli=1 'i is Horn isco-NP-complete.

Proof. The problem is in co-NP, since a guess for modelsv andw of ' whethervVw is not a model of'can be verified in polynomial time.

For the hardness part, we reduce the problem of checking whether a DNF = Wmi=1 ti is a tautology(which is known to be co-NP-complete) to our problem. Note that eachti can be seen as a Horn CNF'i.Let xn+1 andxn+2 be two fresh variables, and lettm+1 = xn+1 andtm+2 = xn+2. Then we claim that' = _ tm+1 _ tm+2 (= Wm+2i=1 ti) is Horn if and only if � > (and hence' � >). The if-direction isobvious.

For the only if direction, suppose 6� >. Then there exists a (non-tautological) prime implicatec of . Itis then easy to see thatc0 = c _ xn+1 _ xn+2 is a prime implicate of'. Sincec0 is not Horn and all primeimplicates of a Horn theory are Horn, it follows that no Horn CNF is equivalent to'. This proves the result.2

Observe that the reduction proof of the above theorem makes use of a number of Horn theories. For thecase in whichl is bounded by some constantk, we have a positive result.

Page 7: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 5

Let 'i = mij=1 ci;j ; i = 1; 2; : : : ; l;whereci;j are Horn clauses. We introduce the following set.HC('1; '2; : : : ; 'l): the set of all Horn clausesc defined byN(c) = Sli=1N(ci;ji) andP (c) = P (ci;ji) for somei, where all the choices ofji 2 f1; 2; : : : ;mig for i = 1; 2; : : : ; l are

considered under the constraint that the disjunction of theselected clausesc1;j1_c2;j2_: : :_cl;jlis not tautology.

Example 3.1 Let'1 = (x1 _ x3 _ x4)(x2 _ x5 _ x6)'2 = (x1 _ x2 _ x3)(x1 _ x3 _ x6):Then the setHC is given as follows.HC('1; '2) = f(x1 _ x3 _ x4); (x1 _ x3 _ x6); (x1 _ x2 _ x5 _ x6);(x1 _ x2 _ x3 _ x5); (x1 _ x2 _ x3 _ x5 _ x6)g: 2

The following lemma relates a disjunction of Horn CNFs with clauses fromHC('1; '2; : : : ; 'l).Lemma 3.2 Let '1; '2; : : : ; 'l be Horn CNFs, and let' = Wli=1 'i. Then' represents a Horn the-ory if and only if' � Vc2S c (i.e., ' is equivalent to the right hand side) holds for some subsetS �HC('1; '2; : : : :'l).Proof. The if-part is obvious because all clausesc 2 HC('1; '2; : : : :'l) are Horn. For the only-if-part, let' represent a Horn theory�. Then observe that' is equivalent to the CNF'0 = m1i1=1 m2i2=1 � � � mlil=1(c1;i1 _ c2;i2 _ � � � _ cl;il): (3.1)

Since'0 also represents a Horn theory� and all prime implicates of a Horn theory are Horn, for each non-tautological clausec0 = (c1;i1 _ c2;i2 _ � � � _ cl;il) in '0, there exists a Horn prime implicatec of � satisfying'0 � c � c0. Note thatHC('1; '2; : : : :'l) contains all maximal Horn clausesc� with c� � c0. Therefore,some clausec� in HC('1; '2; : : : ; 'l) satisfies'0 (� ') � c � c� � c0:Thus, replacing eachc0 in '0 by such ac� again produces�, which implies the only-if-part. 2Theorem 3.3 For an integerl bounded by a constantk, the problem in Theorem3.1 can be solved inpolynomial time.

Page 8: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

6 INFSYS RR 1843-99-02

Proof. By Lemma 3.2, for eachc0 in '0 of (3.1), we only find a clausec� in HC('1; '2; : : : ; 'l) such that' � c� � c0. If every c0 has such ac�, we can conclude that' is Horn; otherwise, we can conclude that'is not Horn.

As for the time complexity, since' � c� is equivalent to the condition that'i � c� holds for all i,and since each'i is Horn,' � c� can be checked in polynomial time. Furthermore, ifl is bounded by aconstant, we have at most a polynomial number ofc0 andc�. Thus, the overall time is polynomial. 2

Let us now consider the problem of computing a Horn core. The following proposition, together withTheorem 3.1, implies that this is a difficult problem in general. In particular, a polynomial-time computationof some Horn core is infeasible, as well as the enumeration ofHorn cores. As for enumeration problems,we measure their complexity in the combined size of input andoutput. An algorithm is called ofpolynomialtotal time[11] if its running time is polynomial in the length of input and output.

Proposition 3.4 A theory� has a unique Horn core if and only if� is Horn.

Proof. The if direction is trivial. For the only-if direction, let� be an arbitrary Horn core of�, and letv 2 � n�. Since theoryfvg is Horn, there exists a Horn core�0 such thatv 2 �0, for which�0 6= � holds.2Corollary 3.5 UnlessP=NP, there is no polynomial total time algorithm which, given Horn CNFs'1; '2;: : : ; 'l, computes any numberk (� 1) of Horn cores of' = Wli=1 'i.Proof. Let us assume that there is a polynomial total time algorithm A for generatingk Horn cores of'with polynomial running timep(I;O), whereI is the input length andO is the output length. We then applyAlgorithm A to the instance which is used to prove Theorem 3.1. Recall that, in this case,' is Horn if andonly if � ' � >. Let us executeA until either (i) it halts or (ii) timep(I; 1) is reached. In the case of(i), if A outputs exactly one Horn CNF>, then output “Yes”; otherwise, “No”. In the case of (ii), output“No”, since it implies that the output length is more than1. Therefore, tautology problem can be solved inpolynomial time, implying P=NP. 2Corollary 3.6 Given Horn CNFs'1, '2, . . . ,'l, deciding whether' = Wli=1 'i has a unique Horn core isco-NP-complete.

These are rather negative results. However, the proofs do not apply for the disjunction of a small (boundedby a constant) number of Horn theories, as will be seen in the next subsection.

3.2 Horn cores of the disjunction of two Horn theories

In this subsection, we describe a polynomial time algorithmwhich computes a Horn core of the disjunctionof two Horn theories. We start with the following lemma showing that any Horn core of a disjunction ofHorn CNFs can be represented by a Horn CNF consisting of only clauses fromHC('1; '2; : : : ; 'l). Thisis a generalization of the only-if-part of Lemma 3.2.

Lemma 3.7 Let '1; '2; : : : ; 'l be Horn CNFs, and let be any Horn core of' = Wli=1 'i. Then �Vc2S c holds for some subsetS � HC('1; '2; : : : :'l).

Page 9: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 7

Proof. Recall that' is equivalent to the CNF'0 of (3.1) (which may not be Horn). Since is a Horn coreof ', each nontautological clausec0 in '0 is subsumed by some prime Horn implicatec of (i.e., c � c0).Recall thatHC('1; '2; : : : ; 'l) is the set of all the maximal Horn clauses subsuming at least one of theclauses in'0. Thus we have a clausec� 2 HC('1; '2; : : : ; 'l) such thatc � c� � c0. Let � be the CNFobtained from'0 by replacing eachc0 by such ac�. Then � � � '0 (� ') holds. Since is a Horn coreof ', it then follows � �. 2

Note that the converse is not true in general, even if is a CNF obtained from'0 by replacing each non-tautological clausec0 in '0 by a clausec� 2 HC('1; '2; : : : ; 'l) with c� � c0. The following example givessuch an instance.

Example 3.2 Let'1 and'2 be given in Example3.1. Then'0 of (3.1) is written as'0 = (x1 _ x3 _ x4 _ x6)(x1 _ x2 _ x3 _ x5 _ x6)(x1 _ x2 _ x3 _ x5 _ x6);where we exclude the tautological clauses from'0. Let us consider a Horn CNF = (x1 _ x3 _ x4)(x1 _ x2 _ x3 _ x5)(x1 _ x2 _ x3 _ x5 _ x6):Note that all clauses in are contained inHC('1; '2) (see Example3.1), and that this is obtained from'0 in the desired way, because(x1_x3_x4) � (x1_x3_x4_x6), (x1_x2_x3_x5) � (x1_x2_x3_x5_x6)and(x1 _x2 _x3 _x5 _x6) � (x1 _x2 _x3 _x5 _x6). However, this is not Horn core of' = '1 _'2,since 0 = (x1 _ x3 _ x4)(x1 _ x2 _ x5 _ x6)(x1 _ x2 _ x3 _ x5 _ x6) (3.2)

satisfies < 0 � '0 (� '). In fact, � 0 follows from � (x1 _ x2 _x5 _x6), and this combined with (110111) = 0 and 0(110111) = 1 implies < 0. As will be shown later, 0 of (3.2) is a Horn core of'. 2Now we give an algorithm that obtains a core of the disjunction of two Horn theories.

Algorithm CORE

Input: Horn CNFs'1 = Vm1i=1 c1;i and'2 = Vm2j=1 c2;j .Output: A Horn core of ' = '1 _ '2.

Step 1. SetS := fc�i;j = c1;i [ c2;j j c�i;j 6� >; i = 1; 2; : : : ;m1; j = 1; 2; : : : ;m2g andS2 := fc 2 S j jP (c)j = 2g.For eachc�i;j 2 S, let c1i;j (resp.,c2i;j) denote the Horn clausec such thatN(c) = N(c�i;j) andP (c) = P (c1;i) (resp.,P (c) = P (c2;j)). (Observe thatHC('1; '2) is the set of all non-tautological clausesc1i;j andc2i;j .)

Step 2. Sa := S n S2; Sb := S2;for eachc�i;j 2 S2 do

if '1 � c1i;j and'2 � c1i;j thenbegin Sa := Sa [ fc1i;jg; Sb := Sb n fc�i;jg endelseif '1 � c2i;j and'2 � c2i;j thenbegin Sa := Sa [ fc2i;jg; Sb := Sb n fc�i;jg end;

Page 10: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

8 INFSYS RR 1843-99-02

Step 3. Output := Vc2Sa c ^Vc�i;j2Sb c1i;j. 2Example 3.3 Let us apply algorithmCORE to Horn CNFs'1 and'2 given in Example3.1. In Step 1,we haveS = f(x1 _ x3 _ x4 _ x6); (x1 _ x2 _ x3 _ x5 _ x6); (x1 _ x2 _ x3 _ x5 _ x6)g and S2 =f(x1 _ x3 _ x4 _ x6); (x1 _ x2 _ x3 _ x5 _ x6)g. A clausec�2;1 = (x1 _ x2 _ x3 _ x5 _ x6) satisfies theif-statement of Step2 (i.e.,'1 � c12;1 and'2 � c12;1 holds forc12;1 = (x1 _ x2 _ x5 _ x6)); any other clausein S2 satisfies neither the if- nor elseif-statement. Thus, Step 3outputs the Horn CNF of(3.2). 2

This algorithm runs in polynomial time. Indeed, both implication tests in Step 2 are done in linear timesince'1 and'2 are Horn (cf. [6]), and all other steps are clearly polynomial.

Theorem 3.8 Let'1 and'2 be Horn CNFs. Then, algorithmCOREcomputes a Horn core of' = '1_'2in polynomial time. Moreover,'1 � holds.

Proof. Observe that'1 � � '1 _ '2 (3.3)

obviously holds. Indeed, each clausec in Sa of Step 3 is an implicate of'1, and each clausec1i;j 2 Sbis subsumed by some clause of'1; hence, the first implication holds. The second holds since'1 _ '2 �Vc�i;j2S c�ij holds by definition, and each clausec = c�i;j in '1 _ '2 is subsumed by some clause in .

We claim that this is a Horn core. Towards a contradiction, suppose that there exists a Horn core �such that � > . Then, � � Vc2Sa c ^ Vc�i;j2Sb ch(i;j)i;j must hold for someh(i; j) 2 f1; 2g (the proof is

similar to that of Lemma 3.7). Since 6= �, it follows that � c2i;j holds for somec�i;j 2 Sb, and hence'1 � c2i;j by (3.3). On the other hand, sincec2i;j is subsumed by some clause in'2, '2 � c2i;j also holds.However, this means that the clausec�i;j is removed fromSb in Step 2 and hencec�i;j =2 Sb in Step 3, whichis a contradiction. Consequently, is maximal. 2

An analysis of the algorithm CORE reveals that it bears no nondeterminism in computing a Horn core that satisfies'1 � � '1 _ '2. This may indicate that a Horn core including'1 is unique. This is in factthe case.

Proposition 3.9 Let�1 and�2 be Horn theories, and let� = �1 [ �2. Then, there exists a unique Horncore� that satisfies�1 � � � �.

Proof. We show that for any Horn theories�1 and�2 such that�1 � �1 � � and�1 � �2 � �, it holdsthat�0 = Cl^(�1 [�2) is Horn and satisfies�1;�2 � �0 � �; the uniqueness follows from this.

Letw 2 �0 n (�1 [ �2), and we show thatw 2 �. Note thatw is of the formw = Vu2S1 u ^ Vv2S2 v,whereS1 � �1 andS2 � �2. Since�1 and�2 are Horn,u0 = Vu2S1 u 2 �1, v0 = Vv2S2 v 2 �2 andw = u0V v0. Since�1;�2 � �1 [�2, the following four cases may occur: (1)u0; v0 2 �1, (2)u0; v0 2 �2,(3) u0 2 �1 , v0 2 �2, and (4)u0 2 �2 , v0 2 �1. Clearly,w = u0 ^ v0 2 � holds for the case (1) or (2). Asfor the case (3),u0 2 �2 holds by�1 � �2. This implies thatu0; v0 2 �2, and hencew 2 �2 � � holds.The case (4) is similar to (3). 2

A a consequence, we call the two Horn cores�1 and�2 satisfying�1 � �1 � �1 [ �2 and�2 � �2 ��1 [ �2, respectively, thecanonical Horn coresof �1 and�2 with respect to� = �1 [ �2, and denotethem bycan(�1;�) andcan(�2;�), respectively.

Page 11: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 9

Σ

Σ

Π

Π

Σ ∩ Σ1

1

1

2

2

2

other Horn core

Figure 1: Structure of the family of Horn cores.

Observe that the generalization of Proposition 3.9 to a disjunction ofk(� 3) Horn theories does not hold.To see this, consider� = �1 [ �2 [ �3 and assume that�1 = ; holds. Then, if�1 had the unique Horncore� such that�1 � � � �(= �2[�3), then this� would be the unique Horn core of�2[�3. Clearly,this conflicts Proposition 3.4.

Finally, we have the following structural result.

Proposition 3.10 Let�1;�2; : : : ;�l be Horn theories. Then� = Tli=1 �i is contained in every Horn coreof� = Sli=1�i.Proof. Let� be any Horn core of�. We show that = Cl^(� [�) is contained in�; this completes theproof, since the maximality of� then implies� � � = .

Take any modelw 2 . Since� and� are Horn, we only need to consider the case ofw = uV v forsomeu 2 � andv 2 �. (The same reasoning is used in the proof of Proposition 3.9.) Now, u 2 �i holdsfor somei. Sincev 2 � is also contained in this�i and�i is Horn, it holds thatw 2 �i. Hence,w 2 �holds, implying � �. 2

Figure 1 shows the structure of the family of Horn cores of thedisjunction of two Horn theories.

3.3 Horn cores of the disjunction of more than two Horn theories

In this subsection we develop an algorithm to compute a Horn core of a general disjunction of' = '0 _'1 _ '2 _ : : : _ 'l of Horn CNFs'i. Let us first show that the direct generalization of algorithm COREdoes not produce a Horn core for the casel � 3.

Page 12: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

10 INFSYS RR 1843-99-02

Example 3.4 Let'0 = (x1 _ x2 _ x4)(x2 _ x7)(x3 _ x5 _ x7)'1 = (x3 _ x5)'2 = (x1 _ x3 _ x6);and let' = '0 _ '1 _ '2. Then' is equivalent to the CNF'0 = (x1 _ x2 _ x3 _ x4 _ x5 _ x6)(x1 _ x2 _ x3 _ x5 _ x6 _ x7)(x1 _ x3 _ x5 _ x6 _ x7): (3.4)

Since no clausec� in HC('0; '1; '2) satisfiesjP (c�)j = 1 in this case, theSb in the beginning of Step2 ofthe generalized algorithmCOREbecomes the set of all clauses in'0 of (3.4). Thus, in Step3, we have = (x1 _ x2 _ x3 _ x4)(x1 _ x2 _ x3 _ x7)(x1 _ x3 _ x5 _ x7):However, this is not Horn core of', since 0 = (x1 _ x2 _ x3 _ x5)(x1 _ x3 _ x5 _ x7)satisfies < 0 � '0 (� '). We will show in Example3.5 that this 0 is in fact a Horn core of'. 2

However, by using algorithm CORE repeatedly, we can get an algorithm to compute a Horn core of' = _li=0'i. This algorithm is polynomial ifl is bounded by a constantk. Informally, it constructs asequence of (not necessarily strictly) increasing Horn theories 0 � 1 � 2 � � � � which is contained in'. The sequence converges to �, which is a Horn core of'.

Let '0; '1; : : : ; 'l be Horn CNFs, and let CORE(�1; �2) denote a Horn CNF of the canonical Horn corecan(�1; �1 _ �2). We now define the following sequence k, k � 0. 0 = '0; 1 = CORE( 0; '1); 2 = CORE( 1; '2);...

... l = CORE( l�1; 'l);...

... i�l+j = CORE( i�l+j�1; 'j); i � 0; 1 � j � l...

...

This sequence k monotonically increases from'0 to � = limk!1 k;by first increasing it in'1, then in'2 and so on. However, note that'l is not necessarily a Horn core of'.The reason is that in building 1 from 0, say, some models of'1 may have been excluded which now canbe added to the l such that the Horn property is still preserved. To catch thisaspect, the algorithm cyclesover'1, '2, : : :, 'l, until no further change is possible. Observe that � = k holds for some finitek � 0since there exist only finite models. Now we have the next lemma.

Page 13: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 11

Lemma 3.11 Given Horn CNFs'0; '1; : : : ; 'l, the above � is a Horn core of' = _li=0'i.Proof. By an inductive argument, it is easy to show that every k is a Horn CNF satisfying k � '.Hence, � is a Horn CNF satisfying � � '. Now assuming that � is not a Horn core of', we derive acontradiction.

In this case, by Lemma 4.5 (to be shown later), there exists a model v 2 � n �� such that�� [ fvgis Horn, where�� and� are the theories represented by � and', respectively. This modelv satisfiesv 2 �i for somei, where�i is the Horn theory represented by'i. Let k� be the index such that k� = �.Since � is the limit, k0 = � holds for allk0 > k�. Consider the smallest indexk0 > k� such that k0 = CORE( k0�1; 'i), in which the second argument is'i. Since k0�1 = � holds and�� [ fvg isHorn, this tells that � is not a Horn core of � _ 'i, a contradiction. 2

Based on this lemma, we get the following algorithm.

Algorithm CORE�Input: Horn CNFs'i = Vmij=1 ci;j , for i = 0; 1; : : : ; l.Output: A Horn core � of ' = '0 _ '1 _ � � � _ 'l.

Step 1. Set := '0; i := 0; changes := 0;

Step 2. while changes< l do beginif i < l then i := i+ 1 else i := 1; new := CORE( ;'i);if < new thenbegin := Vc2HC('0;'1;:::;'l) s.t. new�c c;

changes := 0;endelse changes := changes + 1;

endfwhileg;Step 3. Output the Horn CNF � = . 2

Note that, whenever new = CORE( ;'i) increases from during the iteration of Step 2, the algorithmreplaces it by = ^c2HC('0;'1;:::;'l) s.t. new�c c: (3.5)

By Lemma 3.7, this replacement does not affect the correctness of the algorithm. The algorithm halts, if nochange withinl consecutive calls is detected, i.e., CORE( ;'i) = CORE( ;'i+1) = . . . = CORE( ;'i�1)holds, wherei � 1 andi� 1 = l if i = 1.

Example 3.5 Let us apply the algorithmCORE� to the disjunction' = '0 _ '1 _ '2, where'0, '1 and'2 are given in Example3.4.In the first iteration of Step2, by calling algorithmCOREdescribed in Subsection3.2, we have new = CORE('0; '1) = (x1 _ x2 _ x3 _ x5)(x2 _ x3 _ x5)(x3 _ x5 _ x7):

Page 14: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

12 INFSYS RR 1843-99-02

Based onHC('0; '1; '2) = f(x1 _ x2 _ x3 _ x4)(x1 _ x2 _ x3 _ x5); (x1 _ x2 _ x3 _ x6);(x1 _ x2 _ x3 _ x7); (x1 _ x3 _ x5 _ x7); (x1 _ x3 _ x6 _ x7)g;we have 1 = (x1 _ x2 _ x3 _ x5)(x1 _ x3 _ x5 _ x7):In the second iteration, we have new = CORE( 1; '2) = 1, and hence 2 = 1 holds. Sincel (= 2)consecutive members 1 and 2 satisfies 1 = 2, the algorithm outputs 1 and halts. 2Theorem 3.12 AlgorithmCORE� outputs a Horn core of' = '0_'1_ � � � _'l satisfying'0 � � '.Moreover, it runs in polynomial time ifl is bounded by some constant.

Proof. The correctness of the algorithm is established by Lemma 3.11. Notice that in the algorithm, each new = CORE( ;'i) is replaced by the increased Horn theory of (3.5) for which new � � ' holds.The sequence these also converges to �.

It thus remains to show that the algorithm is polynomial inl. Observe that each CNF (except forthe initial '0) contains only clauses fromHC('0; '1; : : : ; 'l). There are at mostl � �li=0mi clauses inHC('0; '1; : : : ; 'l), wheremi is the number of clauses in'i. Clearly, for a constantl, this number is poly-nomial in the input size of'0; '1; : : : ; 'l. Moreover, sinceT ( ) (i.e., its set of models) strictly increasesin everyl iterations, the set of clausesHC('0; '1; : : : ; 'l) which are logically entailed by monotonicallydecreases, if changes. Thus, the number of iterations is bounded byl � jHC('0; '1; : : : ; 'l)j, whichis polynomial if l is bounded by a constant. Since a call to CORE( ;'i) is done in polynomial time byTheorem 3.8, this implies that CORE� requires polynomial time. 2Remarks. (1) To keep of (3.5) small, we may further replace it by a prime CNF. Note that a prime CNFfor any Horn CNF is computable in quadratic time [10].(2) We can use CORE� as a reasonable “any time algorithm” for computing an approximation of some Horncore. In fact, we can interrupt the algorithm at any step, andthe contents of is a Horn theory which implies'. The approximation improves with computation time, and eventually yields a Horn core. 24 Characteristic Models

For a Horn theory�, a modelv 2 � is calledcharacteristic[12], if v 62 Cl^(� n fvg) holds. The setof all characteristic models of�, thecharacteristic set of�, is denoted byC�(�). Note that every Horntheory� has the unique characteristic setC�(�) and thatmax(�) � C�(�). For example, a Horn theory� = f(0101); (1001); (1000); (0001); (0000)g hasC�(�) = f(0101); (1001); (1000)g andmax(�) =f(0101); (1001)g. In the rest of this section, we reconsider the problems in the previous section, assumingthat Horn theories are now represented by their characteristic models.

4.1 Horn property

Like in the case of CNFs, deciding whether a disjunction of Horn theories is Horn is intractable in general.

Page 15: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 13

Theorem 4.1 Given characteristic setsC�(�1), C�(�2), . . . ,C�(�l) of Horn theories�1, �2, . . . , �l,respectively, deciding whether� = Sli=1�i is Horn isco-NP-complete.

Proof. The membership part of co-NP is similar to the proof of Theorem 3.1.For the hardness part, we consider the Horn theory�(t) and its characteristic setC�(�(t)), defined from

a term t whose positive (resp., negative) literals have indices from P (t) � V = f1; 2; : : : ; ng (resp.,N(t) � V ):�(t) = fxV nA j N(t) � A � V n P (t)gC�(�(t)) = fxV nA j N(t) � A � V n P (t); jA nN(t)j � 1g:Clearly,C�(�(t)) is constructible fromt in polynomial time. Hence, the DNFs in the proof of Theorem 3.1can be transformed in polynomial time into equivalent theories�i, i = 1; 2; : : : ; l, and� = Sli=1 �i, givenbyC�(�i) andC�(�), respectively. Thus the argument in the proof of Theorem 3.1proves the result. 2

The next result is immediate from Corollary 3.5.

Corollary 4.2 Unless P=NP, there is no polynomial total time algorithm which, givencharacteristic setsC�(�1), C�(�2), : : :, C�(�l) of Horn theories�1, �2, . . . ,�l � f0; 1gn, computes any numberk (� 1) ofHorn cores of� = Sli=1 �i.

The next result gives a precise semantical characterization of the Horn property of a disjunction.

Lemma 4.3 LetMi � f0; 1gn, i = 1; 2; : : : ; l, be sets of models. Then� = Sli=1 Cl^(Mi) is Horn if andonly ifv2S v 2 � holds for everyS � Sli=1Mi such that1 � jSj � l: (4.1)

Proof. Since a Horn theory is closed under intersection, the only-if part is obvious. For the if-part, we showby induction onk � l that (4.1) impliesv2S v 2 � holds for everyS � Sli=1Mi such that1 � jSj � k, (4.2)

which clearly implies that� = Sli=1Cl^(Mi) is Horn. For the basek = l, the statement holds by (4.1).For the induction step, assume that (4.2) holds for somek � l, and consider the casek + 1.

Take a setS � Sli=1Mi such thatjSj = k + 1 arbitrarily, and consider the modelw 2 Vv2S v. ForeachSj � S such thatjSjj = jSj � 1, we denoteu(j) = Vv2Sj v. All u(j) belong to� by the induction

hypothesis, and there arek + 1 suchSj. If these contain differentSj1 andSj2 such thatu(j1) = u(j2),thenw = u(j1) ^ u(j2) = u(j1) holds, andw 2 � follows from the induction hypothesis. Otherwise, therearek + 1 � l + 1 different modelsu(1); u(2); : : : ; ; u(k+1). Hence, by the pigeonhole principle,u(1) andu(2), say, are both contained inCl^(Mi�) for somei�. Sincew = u(1)V u(2) 2 Cl^(Mi�) by definition, itfollowsw 2 � from the induction hypothesis. 2

As an immediate consequence, we obtain the following result.

Theorem 4.4 If l is bounded by a constant, the problem in Theorem4.1can be solved in polynomial time.2Theorems 4.1 and 4.4, respectively, correspond to their CNFversions Theorems 3.1 and 3.3.

Page 16: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

14 INFSYS RR 1843-99-02

4.2 Computing Horn cores

Assuming Horn CNF representations, we have presented in Section 3 a polynomial time algorithm forcomputing a Horn core satisfying'1 � � '1 _ '2. For characteristic models, a similar algorithmis hard to find. This is suggested by the following theorem (proved after Lemma 4.5), which tells thatrecognizing a Horn core is intractable, even for the case of two Horn theories.

Lemma 4.5 Let �1 be a Horn theory and�2 an arbitrary theory. Then,�1 is not a Horn core of� =�1 [ �2 if and only if there exists some modelv 2 �2 n �1 such thatvVw 2 �1 [ fvg holds for allw 2 C�(�1).Proof. Suppose�1 is not a Horn core, but� is a Horn core such that�1 � � � �1 [ �2. Let v be anyminimal model in� n �1. ThenvVw 2 � holds for allw 2 C�(�1). By the minimality, however, thisimpliesvVw 2 �1[fvg. Conversely, if there is a modelv satisfyingvVw 2 �1[fvg for allw 2 C�(�1),thenv ^ w 2 �1 [ fvg holds for allw 2 �1, since eachw 2 �1 can be represented byw = Vu2S u forsomeS � C�(�1) andvVu 2 �1 for all u 2 S. Hence,�1 [ fvg is Horn by Lemma 4.3, which meansthat�1 is not a Horn core. 2Theorem 4.6 Given characteristic setsC�(�1) andC�(�2) of Horn theories�1;�2 � f0; 1gn, respec-tively, deciding whether�1 is a Horn core of� = �1 [�2 is co-NP-complete.

Proof. By Lemma 4.5,�1 is not a Horn core if and only if somev 2 �2 n �1 exists such thatvVw 2�1 [ fvg holds for everyw 2 C�(�1). Such av can be guessed and verified in polynomial time; hence theproblem is in co-NP.

We then prove the co-NP-hardness by a reduction from 3SAT [8]. For a given 3-CNF formula' =Vmi=1 ci onn variablesx1; x2; : : : ; xn, we now define polynomially computable setsM1 andM2 of modelsin f0; 1g2n+m+1, such thatM1 = C�(�1), M2 = C�(�2) for Horn theories�1 and�2, and�1 is not aHorn core of� = �1 [�2 if and only if' is satisfiable.

Without loss of generality, we assume that all literals inL = fxj ; xj j 1 � j � ng appear in'. Obviously,this restriction on' does not affect the NP-completeness of SAT. DefineV = VL [ VC [ VT , whereVL = f1; 2; : : : ; n; 1; 2; : : : ; ng;VC = fn+ 1; n+ 2; : : : ; n+mg;VT = fn+m+ 1g:Intuitively, the elements inVL correspond to the literals inL, the elementsi in VC to the clausesci in ',andn + m + 1 in VT is a special tag column. Now we define the instance of our problem as follows:M1 =M1;1 [M1;2 [M1;3, whereM1;1 = fx(VCnfn+ig)[(VLnfqg) j n+ i 2 VC ; q 2 cig;M1;2 = fxVLnfj;jg[VT j 1 � j � ng;M1;3 = fxVLnfj;j;qg[VT j 1 � j � n; q 2 VL n fj; jg g;andM2 =M2;1 [M2;2, whereM2;1 = fx(VLnfqg)[VT j q 2 VLg;M2;2 = fxVLnfj;jg j 1 � j � ng:

Page 17: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 15

Intuitively, each model inM1;1 corresponds to the selection of a literalq from a clauseci. The intersectionof such models after choosing at least one model for each clauseci corresponds to a choice of one literalfrom each clause. The models inM1;2 andM1;3 serve to cover all choices in which two opposite literals arechosen for at least onej. The models inM2;1 similarly correspond to the choice of a single literal, but thespecial componentn+m+ 1 is set to 1. The models inM2;2 have a similar role as those inM1;2.

First, it is not hard to see thatMi = C�(Mi) holds, fori = 1; 2, and henceMi is indeed the characteristicset of�i = Cl^(Mi). The setsM1 andM2 are obviously constructible in polynomial time from'.

We claim that�1 is not a Horn core of� if and only if' is satisfiable.Let us first show the only-if-part. Suppose that�1 is not a Horn core of�. By Lemma 4.5, there exists

somev 2 �2 n �1 such thatvVw 2 �1 [ fvg holds for allw 2M1. Consider the following two cases.Case 1: The componentvn+m+1 is 0. Then,v = Vw2S w for someS � M2 such thatS \M2;2 6= ;.

Hence, for somej 2 f1; 2; : : : ; ng, it holds that componentsj andj of v are both0. Thus, the modelv canbe generated in�1 by taking the intersection of a model inM1;2 and models fromM1;1 (recall that everyliteral occurs in some clause). This meansv 2 �1, which is a contradiction.

Case 2: The componentvn+m+1 is 1. Then,v must be the intersection of some models inM2;1. Moreover,for eachj = 1; 2; : : : ; n, at least one ofvj andvj is 1; indeed, any modelv 2 �2 with vn+m+1 = 1 andvj = vj = 0 for somej can be generated by intersections of models inM1;2 [M1;3, which would againimply v 2 �1, a contradiction. Now, by assumption,vVw 2 �1 [ fvg holds for allw 2 M1. Then,for a suitablew 2 M1;1, we obtain thatu = vVw coincides withv on VL, and has all other components(including n + m + 1) being 0. This impliesu 2 �1, and henceu can be generated in�1 only by theintersection of at leastm models fromM1;1 includingv(1), v(2), . . . ,v(m) such thatv(i)n+i = 0 holds for alli. By the definition ofM1;1, this corresponds to a choice of one literal from each clauseci, such that noopposite literals are chosen. It then follows that' is satisfiable.

For the if-part, suppose that' is satisfiable. Then, there exists a choice of one literalqi from each clauseci, i = 1; : : : ;m, such that no opposite literals are chosen. We claim that themodel v = xB, whereB = (VL n fqi j i = 1; : : : ;mg) [ VT , satisfiesv 2 �2 n �1 andvVw 2 �1 for all w 2 �1. Hence, byLemma 4.5, it follows that�1 is not a Horn core of�.

Clearly, such av satisfiesv 2 �2 (i.e., by the intersection of models inM2;1) andv =2 �1. Observe that themodelv0 which results fromv by switching componentn+m+1 to 0 is in�1 (by the intersection of modelsin M1;1). Hence, ifw 2 M1;1, thenvVw = v0Vw 2 �1. On the other hand, ifw 2 M1;2 [M1;3, thenvVw (whose componentn+m+1 takes value 1) is obtainable as the intersection of models inM1;2[M1;3;hence,vVw 2 �1 also holds. 2

Thus, computing a canonical Horn core is presumably difficult in general. We next point out that thedifficulty can be avoided if�2 is restricted in the following sense. Call a Horn theory� sparse, if j�j �p(jC�(�)j) holds for some polynomialp(�). Then, based on the next lemma proved in [7], we have thefollowing theorem.

Lemma 4.7 Given the characteristic setC�(�) of a Horn theory� � f0; 1gn, the models of� can beenumerated withO(n2jC�(�)j) time delay.

Theorem 4.8 Given characteristic setsC�(�1) andC�(�2) of Horn theories�1;�2 � f0; 1gn, respec-tively, computingC�(�1) for �1 = can(�1;�1 [�2) is polynomial, if�2 is known to be sparse.

Proof. We can computeC�(�1) for �1 = can(�1;�1 [ �2) as follows.

Page 18: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

16 INFSYS RR 1843-99-02(1) Using the algorithm in [7], construct�2 from C�(�2). By Lemma 4.7, this is possible in polynomialtime. Set� := C�(�1). (HereCl^(�) will become�1.)(2) Exploiting Lemma 4.5, check whether some modelv 2 �2 n Cl^(�) exists such thatCl^(�) [ fvgis Horn.(3) If such a modelv is found, then set� := � [ fvg and return to (2).(4) ComputeC�(�) and output it as the result.

In Step (2),Cl^(�) [ fvg is Horn if and only ifvVw 2 Cl^(�) [ fvg holds for allw 2 �”; this avoidsthe re-computation ofC�(�) in every iteration. Overall, this procedure is polynomial since�2 is sparse.2

Observe that the Horn theory�2 in the proof of Theorem 4.6 is not sparse, and hence the above algorithmrequires exponential time.

4.3 Exponential sizes of Horn cores

The intractability of recognizing and, as a corollary alongstandard arguments, of computing a canonicalHorn core does not immediately rule out the possibility of computing one of the Horn cores in polynomialtime. However, our next result implies that a polynomial time algorithm for this task is impossible.

Theorem 4.9 For everyn � 1, there exist Horn theories�1;�2 � f0; 1g4n+1 such thatjC�(�1)j =jC�(�2)j = 2n but every Horn core� of� = �1 [�2 has sizejC�(�)j not bounded by a polynomial inn.

Proof. Given a fixedn (� 1), define two sets of modelsS1; S2 � f0; 1g4n+1 as follows. LetVk =f(k � 1) � n+ j j j = 1; 2; : : : ; ng for k = 1; 2; 3; 4, andV = [4k=1Vk [ f4n+ 1g = f1; 2; : : : ; 4n+ 1g.Observe thatV1 = f1; 2; : : : ; ng contains the firstn components,V2 the nextn components, and so on.Then,S1 = fxV n(V3[fi;3n+ig); xV n(V3[fn+i;3n+ig) j 1 � i � ng;S2 = fxV n(V4[fi;2n+i;4n+1g); xV n(V4[fn+i;2n+i;4n+1g) j 1 � i � ng:Informally, each modelv in S1[S2 consists of 4 blocksb1(v); : : : ; b4(v), each of which hasn bits (addressedby V1; : : : ; V4), plus an extra bitv4n+1. The setS1 contains all modelsv such that(1) exactlyn + 2 bitsare0, (2) the i-th bit in eitherb1(v) or b2(v) is 0, (3) the i-th bit in b4(v) is 0, for somei 2 f1; 2; : : : ; ng,and(4) b3(v) is the zero vector (0,0, . . . ,0) (for short,0). Similarly, S2 contains all modelsv such that(1)exactlyn + 3 bits are0, (2) the i-th bit in eitherb1(v) or b2(v) is 0, (3) the i-th bit of b3(v) is 0, and (4)b4(v) is 0 andv4n+1 = 0. Intuitively, eachv 2 S1 represents a choice from two alternatives (eitherb1(v) orb2(v)) for assigning 0 to a positioni. This is similar for eachv 2 S2.

Clearly,jS1j = jS2j = 2n, andSl = C�(Sl) holds forl = 1; 2, since all the models inSl are incomparable.HenceSl is the characteristic set of�l = Cl^(Sl). Note that�1 \ �2 = ; holds.

Let H0 = H0;1 [H0;2; (4.3)

whereH0;1 = fxI1[I2 j I1 � V1; I2 � V2; I1 \ fj � n j j 2 I2g = ; g;H0;2 = fxI1[I2[f4n+1g j I1 � V1; I2 � V2; I1 \ fj � n j j 2 I2g = ; g;

Page 19: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 17

i.e., the set of all modelsv which have (1) eitherb1(v)i = 0 or b2(v)i = 0 or both, for alli = 1; 2; : : : ; n,(2) b3(v) = b4(v) = 0, and (3)v4n+1 is set arbitrarily.

Fact 1: Every Horn core� of � = �1 [ �2 satisfies� � H0.To prove this fact, we note thatH0 � �, and, for eachv 2 H0 andw 2 �, it holds thatvVw 2 H0. Let� be a Horn core of�. Then� [H0 � � holds, and moreover, by Lemma 4.3,� [H0 is Horn. Hence,

the maximality of a Horn core impliesH0 � �.Let us first consider the canonical Horn cores�l = can(�l;�), for l = 1; 2. It follows from Fact 1 thatH0;l � �l holds. Denote, for any modelv,�(v) = fj 2 f1; 2; : : : ; ng j b1(v)j = 0 or b2(v)j = 0g;

i.e.,�(v) contains the positions set to0 in eitherb1(v) or b2(v). Then we obtainmax(H0;l) = fv 2 H0;l j �(v) = f1; 2; : : : ; ngg;whose size is obviously exponential inn. We now claim thatmax(H0;l) � C�(�l) for l = 1; 2; (4.4)

which implies thatjC�(�l)j is exponential inn.We only consider the case ofl = 1, since the case ofl = 2 is similar. Assume that somev 2 max(H0;1)

is not contained inC�(�1). Note thatv4n+1 = 0, and furthermorew4n+1 = 1 holds for everyw 2 �1.HenceC�(�1) must contain at least one modelu 2 �2 such thatu > v. Sinceu 2 �2, there exists an indexj such that eitherb1(u)j = 0 or b2(u)j = 0. Letw 2 S1(� �1) be the vector that satisfiesb1(w)j = 0 ifb1(u)j = 0 (resp.,b2(w)j = 0 if b2(u)j = 0). Then, forx = u^w, we haveb1(x) = b1(u), b2(x) = b2(u),b3(x) = b4(x) = 0, andx4n+1 = 0. Sincex 2 � must hold, it follows thatx 2 �2. Thus,x = Vy2S y forsomeS � S2. Sinceb3(x) = 0, it follows that eitherb1(x)j = b1(u)j = 0 or b2(x)j = b2(u)j = 0 holds forall j = 1; : : : ; n. But this impliesu 2 H0;1, which is a contradiction. Hence (4.4) holds.

As easily seen, besides�1 and�2, further Horn cores exist. Proposition 3.9 and Fact 1 imply that for anysuch Horn core�, the setsH1 = (�1 \ �) nH0 andH2 = (�2 \ �) nH0 are both nonempty. Moreover,� has the following property.

Fact 2. For allv(1) 2 H1 andv(2) 2 H2, it holds thatv(1)V v(2) 2 H0.To see this, letw = v(1) V v(2). Thenb3(w) = b4(w) = 0 holds, sincev(1) 2 �1 andv(2) 2 �2. This andw 2 � � �1 [ �2 imply w 2 H0.By Fact 2,w = v(1) V v(2) satisfies eitherb1(w)j = 0 or b2(w)j = 0 (or both) for allj. Thus the modelsv(1) andv(2) satisfy�(v(1)) [ �(v(2)) = f1; 2; : : : ; ng. Since this holds for all suchv(1) andv(2), every

set�(v(1)) must includef1; 2; : : : ; ng n Tv(2)2H2 �(v(2)), and by symmetry every�(v(2)) must includef1; 2; : : : ; ng n Tv(1)2H1 �(v(1)). This implies the following fact.

Fact 3. There exists a setI � f1; 2; : : : ; ng of size jIj � n=2 such that either(1) I � �(v(1)) holds foreveryv(1) 2 H1, or (2) I � �(v(2)) holds for everyv(2) 2 H2.

Assume that (1) holds; the case (2) is similar. Choosev(1) 2 max(H1) arbitrarily. Then, the maximalityof Horn core� implies that every modelw 2 �1 nH0 such that�(w) = �(v(1)) andw coincides withv(1)on the remaining part (i.e., onV3[V4[f4n+1g) is contained in� (cf. Facts 1 and 2). There exist2j�(v(1))jmaximal such modelsw, each of which chooses 0 either in blockb1(w) or in b2(w), but not in both, for thepositions in�(v(1)). SinceI � �(v(1)), at least2jIj models from�1 n H0 are contained in�. Note that

Page 20: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

18 INFSYS RR 1843-99-02

these models are maximal in�. Sincemax(�) � C�(�), it follows thatjC�(�)j � 2jIj � 2n=2. Thus, thesize ofC�(�) is not bounded by a polynomial inn. This proves the result. 2Corollary 4.10 There is no polynomial time algorithm for computingC�(�) of any Horn core� for �1 [�2, from the characteristic setsC�(�1), C�(�2) of Horn theories�1;�2 � f0; 1gn, respectively.

5 Horn Envelope of a Disjunction of Horn Theories

In this section, we briefly discuss the Horn envelope of a disjunction� = Sli=1�i of Horn theories�i,i = 1; 2; : : : ; l. For model-based representation, we can compute the Horn envelope in polynomial time.Indeed, the characteristic set of� is given byC�(M), whereM = Sli=1 C�(�i). Clearly, C�(M) iscomputable fromM in polynomial time, by removing all modelsv which are represented by the intersectionof other models inM . Thus we have the following theorem.

Theorem 5.1 Given characteristic setsC�(�1), C�(�2), . . . ,C�(�l) of Horn theories�1, �2, . . . , �l,respectively, the Horn envelope of� = Sli=1�i can be computed in polynomial time.

As for the CNF representation, computing the Horn envelope requires in general exponential time (andspace). This is because any Horn CNF that represents the envelope of� may be exponential in the size ofHorn CNFs'1; '2; : : : ; 'l of �1,�2,. . . ,�l, even ifl = 2.

For example, let'1 = x0 and'2 = (x1 _ x2 : : :_ xm)^Vmj=1(xj _ yj). Then' = '1 _'2 is equivalentto the CNF(x0 _ x1 _ x2 : : : _ xm) ^Vmj=1(x0 _ xj _ yj). Thus the envelope of' can be represented by = ^z12fx1;y1g ^z22fx2;y2g � � � ^zm2fxm;ymg(x0 _ m_j=1 zj):This CNF has2m clauses. Since all clauses in are prime and removing some clause in does not producethe envelope, we have the next theorem.

Theorem 5.2 There exist Horn CNFs'i, i = 1; 2; : : : ; l, such that the Horn envelope of' = Wli=1 'i hassize exponential in the size of'i, i = 1; 2; : : : ; l, even ifl = 2. Hence, the Horn envelope of' cannot becomputed in polynomial time.

6 Related Work and Conclusion

In this paper, we have considered the problems on a disjunction � = Sli=1 �i of Horn theories�i. Theresults for the three problems, i.e., recognition of the Horn property, computation of cores and computationof envelope, are shown in Table 1 corresponding to the two representations of CNF and characteristic sets,and also corresponding to the cases in whichl is bounded by a constant and is general.

The computation of a Horn core of a propositional theory� has been considered by several authors, anddifferent algorithms have been proposed for different representations, e.g. [14, 2, 1, 15]. The papers [14, 2, 1]present algorithms for theories represented by CNFs, whichrequire exponential time in the worst case. Itshould be noted that these algorithms are not immediately applicable if� is given by the disjunction of twoHorn CNF formulas'1 and'2. This is because these algorithms require a CNF formula' = '1 _ '2 for

Page 21: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

INFSYS RR 1843-99-02 19

Table 1: Complexity Results for Disjunction� = Sli=1 �iHorn Core Envelope

CNF C� CNF C� CNF C�l is constant P P P NPH EXP Pl is general coNPC coNPC NPH NPH EXP P

P: polynomial time, NPH: NP-hard

EXP: exponential time, coNPC: coNP-complete

the input, but, since a smallest CNF' may be exponential in the sizes of'1 and'2, the resulting procedurerequires exponential time (and space) in general.

Concerning the model based representation, our intractability result on computing a Horn core for a dis-junction� = Sli=1 �i of Horn theories�i represented by their characteristic setsC�(�i), contrasts with apositive result in [15] that all Horn cores of� can be enumerated with polynomial delay, if all models of�are given for input. Intuitively, this is explained by the fact thatC�(�) can be a succinct representation of�, and eliciting all models from it, as needed by the algorithmin [15], is not feasible in polynomial time inthe input size ofC�(�).

Algorithms for computing the Horn envelope restricted to special classes of formulas are contained in[14, 2, 15, 4, 5, 16]. In particular, [14, 2, 4, 5] consider CNFformulas, while [15, 16] cover the caseof theories which are represented by a disjunction of minterms (i.e., terms such that all variables occureither positively or negatively in them). All these algorithms require exponential time. We have shown thatthe Horn envelope of a disjunction of Horn theories�1; : : : ;�l can be computed from their characteristicsetsC�(�1), . . . ,C�(�l) in polynomial time, but it cannot be computed from Horn CNFs in polynomialtime, even ifl = 2. Observe that the results in [15, 16] imply that, for the formula-based representation, apolynomial total-time computation of the Horn envelope of the disjunction of Horn theories�1; : : : ;�l (i.e.,polynomial in the size of the input and the output of any irredundant prime CNF for the envelope) is hard tofind, even if each�i has a single model (which is computable from a Horn CNF in polynomial time).

Some problems remain for further work. One issue is on Horn cores whenl is bounded by some constant;construct an efficient algorithm for generating all Horn cores for both representations, and construct anoutput-efficient computation of a Horn core (under a suitable notion) for the characteristic set representation.Another issue is constructing a polynomial total algorithmfor computing the Horn envelope from HornCNFs.

References

[1] Y. Boufkhad. Algorithms for Propositional KB Approximation. In Proceedings National Conference on AI(AAAI ’98), pages 280–285, Madison, Wisconsin, July 26–30 1998. AAAI Press.

[2] M. Cadoli. Semantical and Computational Aspects of Horn Approximations. InProceedings IJCAI-93, pages39–44, Chambery, France, August 1993. Full version, by M. Cadoli and F. Scarcello, (1997) available from theauthors.

Page 22: I N F S Y S R - pdfs.semanticscholar.org fileI N F S Y S R E S E A R C H R E P O R T Institut fu¨r Informationssysteme Abtg. Wissensbasierte Systeme Technische Universitat Wien¨

20 INFSYS RR 1843-99-02

[3] M. Cadoli and M. Schaerf. Tractable Reasoning via Approximation.Artificial Intelligence, 74(2):249–310,1995.

[4] A. del Val. An Analysis of Approximate Knowledge Compilation. In Proceedings IJCAI ’95, pages 830–836,1995.

[5] A. del Val. Approximate Knowledge Compilation: The First-Order Case. InProceedings AAAI-96, pages 498–503, 1996.

[6] W. Dowling and J. H. Gallier. Linear-time Algorithms for Testing the Satisfiability of Propositional Horn Theo-ries. Journal of Logic Programming, 3:267–284, 1984.

[7] T. Eiter, K. Makino, and T. Ibaraki. Computing Intersections of Horn Theories for Reasoning with Models.Technical Report 9803, Institut fur Informatik, Universitat Gießen, Germany, April 1998. Abstract in: Proc.AAAI-98, pages 292–297, 1998.

[8] M. Garey and D. S. Johnson.Computers and Intractability – A Guide to the Theory of NP-Completeness. W. H.Freeman, New York, 1979.

[9] G. Gogic, C. Papadimitriou, and M. Sideri. Incremental Recompilationof Knowledge. Journal of ArtificialIntelligence Research, 8:23–37, 1998.

[10] P. Hammer and A. Kogan. Horn functions and their DNFs.Information Processing Letters, 44:23–29, 1992.

[11] D. S. Johnson, M. Yannakakis, and C. H. Papadimitriou. On Generating All Maximal Independent Sets.Infor-mation Processing Letters, 27:119–123, 1988.

[12] H. Kautz, M. Kearns, and B. Selman. Reasoning With Characteristic Models. InProceedings AAAI-93, pages34–39, 1993.

[13] H. Kautz, M. Kearns, and B. Selman. Horn Approximations of Empirical Data.Artificial Intelligence, 74:129–245, 1995.

[14] H. Kautz and B. Selman. Knowledge Compilation and Theory Approximation.Journal of the ACM, 43(2):193–224, 1996.

[15] D. Kavvadias, C. Papadimitriou, and M. Sideri. On Horn Envelopesand Hypergraph Transversals. In W. Ng,editor,Proceedings 4th International Symposium on Algorithms and Computation (ISAAC-93), LNCS 762, pages399–405, Hong Kong, December 1993. Springer.

[16] R. Khardon. Translating between Horn Representations and their Characteristic Models. Journal of ArtificialIntelligence Research, 3:349–372, 1995.

[17] R. Khardon and D. Roth. Reasoning with Models.Artificial Intelligence, 87(1/2):187–213, 1996.

[18] D. Roth. On the Hardness of Approximate Reasoning.Artificial Intelligence, 82(1/2):273–302, 1996.