A Constraint Logic Programming Approach for Computing Ordinal Conditional Functions
In order to give appropriate semantics to qualitative conditionals of the form "if A then normally B", ordinal conditional functions (OCFs) ranking the possible worlds according to their degree of plausibility can be used. An OCF accepting all condit…
Authors: Christoph Beierle, Gabriele Kern-Isberner, Karl S"odler
A Constrain t Logic Programming Approac h for Computing Ordinal Conditional F unctions Christoph Beierle 1 , Gabriele Kern-Isb erner 2 , Karl S¨ odler 1 1 Dept. of Computer Science, F ernUniv ersit¨ at in Hagen, 5808 4 Hagen, Germany 2 Dept. of Computer Science , TU Dortmund, 44221 Dortm und, German y Abstract. In order to giv e appropriate semantics to qualitativ e conditionals of the form if A then normal ly B , ordinal conditional functions (OCFs) ranking the possible worlds according to their degree of plausibility can b e used. An OCF accepting all conditionals of a kno wledge base R can b e c haracterized as the solution of a constrain t satisfaction problem. W e presen t a high-lev el, declarativ e approac h using constrain t logic programming techniques for solving this constraint satisfaction problem. In particular, the approac h dev elop ed here supp orts the generation of all minimal solutions; these minimal solutions are of sp ecial in terest as they pro vide a basis for mo del-based inference from R. 1 In tro duction In kno wledge representation, rules pla y a prominent role. Default rules of the form If A then normal ly B are b eing in vestigated in nonmonotonic reasoning, and v arious semantical approaches ha ve been proposed for such rules. Since it is not possible to assign a simple Bo olean truth v alue to such default rules, a seman tical approac h is to define when a rational agent accepts such a rule. W e could say that an agent accepts the rule Bir ds normal ly fly if she considers a world with a flying bird to be less surprising than a w orld with a nonflying bird. At the same time, the agen t can also accept the rule Penguin bir ds normal ly do not fly ; this is the case if she considers a world with a nonflying p enguin bird to b e less surprising than a world with a flying penguin bird. The informal notions just used can be made precise b y formalizing the underlying concepts lik e default rules, epistemic state of an agent, and the acceptance relation b etw een epistemic states and default rules. In the following, we deal with qualitative default rules and a corresp onding seman tics mo delling the epistemic state of an agent. While a full epistemic state could compare p ossible worlds according to their possibility , their probability , their degree of plausibility , etc. (cf. [18,9,10]), w e will use ordinal conditional functions (OCFs), which are also called ranking functions [18]. T o eac h possible w orld ω , an OCF κ assigns a natural n umber κ ( ω ) indicating its degree of surprise: The higher κ ( ω ), the greater is the surprise for observing ω . In [12,13] a criterion when a ranking function resp ects the conditional structure of a set R of conditionals is defined, leading to the notion of c-representation for R , and it is argued that ranking functions defined b y c-representations are of particular interest for mo del-based inference. In [3] a system that computes a c-representation for any suc h R that is consisten t is describ ed, but this c-representation ma y not be minimal. An algorithm for computing a minimal ranking function is given in [5], but this algorithm fails to find all minimal ranking functions if there is more than one minimal one. In [15] an extension of that algorithm b eing able to compute all minimal c-representations for R is presen ted. The algorithm dev elop ed in [15] uses a non- declarativ e approach and is implemen ted in an imp erativ e programming language. While the problem of sp ecifying all c-representations for R is formalized as an abstract, problem-oriented constrain t satisfaction problem CR ( R ) in [2], no solving metho d is giv en there. In this paper, we present a high-lev el, declarativ e approac h using constraint logic programming tec hniques for solving the constraint satisfaction problem CR ( R ) for any consisten t R . In partic- ular, the approac h dev eloped here supp orts the generation of all minimal solutions; these minimal The research rep orted here was partially supp orted b y the Deutsche F orsch ungsgemeinschaft – DF G (gran ts BE 1700/7-2 and KE 1413/2-2). solutions are of special interest as they pro vide a preferred basis for mo del-based inference from R . The rest of this pap er is organized as follows: After recalling the formal background of con- ditional logics as it is given in [1] and as far as it is needed here (Section 2), w e elab orate the birds-p enguins scenario sketc hed ab ov e as an illustration for a conditional kno wledge base and its semantics in Section 3. The definition of the constrain t satisfaction problem CR ( R ) and its solution set denoting all c-representations for R is given in Sec. 4. In Section 5, a declarative, high-lev el CLP program solving CR ( R ) is developed, observing the ob jective of b eing as close as p ossible to CR ( R ), and its realization in Prolog is describ ed in detail; in Section 6, it is ev aluated with resp ect to a series of some first example applications. Section 7 concludes the paper and p oin ts out further work. 2 Bac kground W e start with a prop ositional language L , generated b y a finite set Σ of atoms a, b, c, . . . . The form ulas of L will b e denoted b y upp ercase Roman letters A, B , C, . . . . F or conciseness of notation, w e will omit the logical and -connectiv e, writing AB instead of A ∧ B , and o verlining formulas will indicate negation, i.e. A means ¬ A . Let Ω denote the set of possible worlds o v er L ; Ω will be taken here simply as the set of all prop ositional interpretations ov er L and can b e iden tified with the set of all complete conjunctions o ver Σ . F or ω ∈ Ω , ω | = A means that the propos itional formula A ∈ L holds in the p ossible world ω . By in tro ducing a new binary op erator | , w e obtain the set ( L | L ) = { ( B | A ) | A, B ∈ L} of c on- ditionals ov er L . ( B | A ) formalizes “ if A then (normal ly) B ” and establishes a plausible, probable, p ossible etc connection b etw een the ante c e dent A and the c onse quenc e B . Here, conditionals are supp osed not to b e nested, that is, an tecedent and consequen t of a conditional will be propositional form ulas. A conditional ( B | A ) is an ob ject of a three-v alued nature, partitioning the set of w orlds Ω in three parts: those worlds satisfying AB , th us verifying the conditional, those worlds satisfying AB , thus falsifying the conditional, and those w orlds not fulfilling the premise A and so which the conditional may not b e applied to at all. This allows us to represent ( B | A ) as a gener alize d indic ator function going back to [7] (where u stands for unknown or indeterminate ): ( B | A )( ω ) = 1 if ω | = AB 0 if ω | = AB u if ω | = A (1) T o give appropriate seman tics to conditionals, they are usually considered within richer struc- tures suc h as epistemic states . Besides certain (logical) knowledge, epistemic states also allow the represen tation of preferences, b eliefs, assumptions of an in telligent agent. Basically , an epistemic state allows one to compare form ulas or worlds with resp ect to plausibility , possibility , necessit y , probabilit y , etc. W ell-known qualitativ e, ordinal approaches to represen t epistemic states are Spohn’s or dinal c onditional functions, OCFs , (also called r anking functions ) [18], and p ossibility distributions [4], assigning degrees of plausibility , or of possibility , respectively , to form ulas and possible w orlds. In suc h qualitativ e framew orks, a conditional ( B | A ) is v alid (or ac c epte d ), if its confirmation, AB , is more plausible, possible, etc. than its refutation, AB ; a suitable degree of acceptance is calculated from the degrees asso ciated with AB and AB . In this pap er, w e consider Sp ohn’s OCFs [18]. An OCF is a function κ : Ω → N expressing degrees of plausibility of propositional formulas where a higher degree denotes “less plausible” or “more suprising”. At least one world must be regarded as b eing normal; therefore, κ ( ω ) = 0 for at least one ω ∈ Ω . Eac h suc h ranking function can be tak en as the representation of a full epistemic state of an agent. Each such κ uniquely extends to a function (also denoted b y κ ) mapping sen tences and rules to N ∪ {∞} and b eing defined by κ ( A ) = ( min { κ ( ω ) | ω | = A } if A is satisfiable ∞ otherwise (2) for sen tences A ∈ L and by κ (( B | A )) = ( κ ( AB ) − κ ( A ) if κ ( A ) 6 = ∞ ∞ otherwise (3) for conditionals ( B | A ) ∈ ( L | L ). Note that κ (( B | A )) > 0 since an y ω satisfying AB also satisfies A and therefore κ ( AB ) > κ ( A ). The b elief of an agent b eing in epistemic state κ with resp ect to a default rule ( B | A ) is determined b y the satisfaction relation | = O defined b y: κ | = O ( B | A ) iff κ ( AB ) < κ ( AB ) (4) Th us, ( B | A ) is b elieved in κ iff the rank of AB (verifying the conditional) is strictly smaller than the rank of AB (falsifying the conditional). W e sa y that κ ac c epts the conditional ( B | A ) iff κ | = O ( B | A ). 3 Example In order to illustrate the concepts presen ted in the previous section we will use a scenario in volving a set of some default rules represen ting common-sense knowledge. Example 1. Supp ose w e ha ve the propositional atoms f - flying , b - bir ds , p - p enguins , w - winge d animals, k - kiwis . Let the set R consist of the follo wing conditionals: R r 1 : ( f | b ) bir ds fly r 2 : ( b | p ) p enguins ar e bir ds r 3 : ( f | p ) p enguins do not fly r 4 : ( w | b ) bir ds have wings r 5 : ( b | k ) kiwis ar e bir ds Figure 1 shows a ranking function κ that accepts all conditionals given in R . Th us, for any i ∈ { 1 , 2 , 3 , 4 , 5 } it holds that κ | = O R i . ω κ ( ω ) ω κ ( ω ) ω κ ( ω ) ω κ ( ω ) pbf wk 2 pbf wk 5 pbf wk 0 pbf wk 1 pbf wk 2 pbf wk 4 pbf wk 0 pbf wk 0 pbf wk 3 pbf wk 5 pbf wk 1 pbf wk 1 pbf wk 3 pbf wk 4 pbf wk 1 pbf wk 0 pbf wk 1 pbf wk 3 pbf wk 1 pbf wk 1 pbf wk 1 pbf wk 2 pbf wk 1 pbf wk 0 pbf wk 2 pbf wk 3 pbf wk 2 pbf wk 1 pbf wk 2 pbf wk 2 pbf wk 2 pbf wk 0 Fig. 1. Ranking function κ accepting the rule set R given in Example 1 F or the conditional ( f | p ) ( “Do p enguins fly?” ) that is not con tained in R , we get κ ( pf ) = 2 and κ ( pf ) = 1 and therefore κ / | = O ( f | p ) so that the conditional ( f | p ) is not accepted by κ . This is in accordance with the b ehaviour of a rational agent b elieving R since the kno wledge base R used for building up κ explicitly con tains the opp osite rule ( f | p ). On the other hand, for the conditional ( w | k ) ( “Do kiwis have wings?” ) that is also not con tained in R , w e get κ ( k w ) = 0 and κ ( k w ) = 1 and therefore κ | = O ( w | k ) i.e., the conditional ( w | k ) is accepted b y κ . Thus, from their sup erclass bir ds , kiwis inherit the prop ert y of having wings. 4 Sp ecification of Ranking F unctions as Solutions of a Constrain t Satisfaction Problem Giv en a set R = { R 1 , . . . , R n } of conditionals, a ranking function κ that accepts every R i rep esen ts an epistemic state of an agent accepting R . If there is no κ that accepts every R i then R is inc onsistent . F or the rest of this pap er, we assume that R is consisten t. F or any consisten t R there ma y b e many differen t κ accepting R , each represen ting a complete set of beliefs with resp ect to ev ery p ossible formula A and every conditional ( B | A ). Th us, every suc h κ inductiv ely completes the knowledge given by R , and it is a vital question whether some κ 0 is to b e preferred to s ome other κ 00 , or whether there is a unique “b est” κ . Different w ays of determining a ranking function are given b y system Z [9,10] or its more sophisticated extension system Z ∗ [9], see also [6]; for an approach using rational w orld rankings see [19]. F or quan titative kno wledge bases of the form R x = { ( B 1 | A 1 )[ x 1 ] , . . . , ( B n | A n )[ x n ] } with probabilit y v alues x i and with mo dels being probability distributions P satisfying a probabilistic conditional ( B i | A i )[ x i ] iff P ( B i | A i ) = x i , a unique mo del can be choosen by employing the principle of maxim um en tropy [16,17,11]; the maximum entrop y model is a b est mo del in the sense that it is the most un biased one among all mo dels satisfying R x . Using the maximum en trop y idea, in [13] a generalization of system Z ∗ is suggested. Based on an algebraic treatment of conditionals, the notion of c onditional indiffer enc e of κ with respect to R is defined and the follo wing criterion for conditional indifference is given: An OCF κ is indifferen t with respect to R = { ( B 1 | A 1 ) , . . . , ( B n | A n ) } iff κ ( A i ) < ∞ for all i ∈ { 1 , . . . , n } and there are rational n umbers κ 0 , κ + i , κ − i ∈ Q , 1 6 i 6 n, such that for all ω ∈ Ω , κ ( ω ) = κ 0 + X 1 6 i 6 n ω | = A i B i κ + i + X 1 6 i 6 n ω | = A i B i κ − i . (5) When starting with an epistemic state of complete ignorance (i.e., eac h w orld ω has rank 0), for eac h rule ( B i | A i ) the v alues κ + i , κ − i determine how the rank of eac h satisfying w orld and of eac h falsifying w orld, resp ectively , should b e changed: – If the world ω v erifies the conditional ( B i | A i ), – i.e., ω | = A i B i –, then κ + i is used in the summation to obtain the v alue κ ( ω ). – Lik ewise, if ω falsifies the conditional ( B i | A i ), – i.e., ω | = A i B i –, then κ − i is used in the summation instead. – If the conditional ( B i | A i ) is not applicable in ω , – i.e., ω | = A i –, then this conditional does not influence the v alue κ ( ω ). κ 0 is a normalization constan t ensuring that there is a smallest world rank 0. Employing the p ostulate that the ranks of a satisfying world should not b e changed and requiring that changing the rank of a falsifying w orld may not result in an increase of the w orld’s plausibility leads to the concept of a c-r epr esentation [13,12]: Definition 1. L et R = { ( B 1 | A 1 ) , . . . , ( B n | A n ) } . Any r anking function κ satisfying the c onditional indiffer enc e c ondition (5) and κ + i = 0 , κ − i > 0 (and thus also κ 0 = 0 sinc e R is assume d to b e c onsistent) as wel l as κ ( A i B i ) < κ ( A i B i ) (6) for al l i ∈ { 1 , . . . , n } is c al le d a (sp ecial) c-representation of R . Note that for i ∈ { 1 , . . . , n } , condition (6) expresses that κ accepts the conditional R i = ( B i | A i ) ∈ R (cf. the definition of the satisfaction relation in (4)) and that this also implies κ ( A i ) < ∞ . Th us, finding a c-representation for R amoun ts to choosing appropriate v alues κ − 1 , . . . , κ − n . In [2] this situation is form ulated as a constraint satisfaction problem CR ( R ) whose solutions are v ectors of the form ( κ − 1 , . . . , κ − n ) determining c-representations of R . The dev elopment of CR ( R ) exploits (2) and (5) to reformulate (6) and requires that the κ − i are natural num b ers (and not just rational n umbers). In the following, w e set min( ∅ ) = ∞ . Definition 2. [CR ( R ) ] L et R = { ( B 1 | A 1 ) , . . . , ( B n | A n ) } . The c onstr aint satisfaction pr oblem for c-r epr esentations of R , denote d by CR ( R ) , is given by the c onjunction of the c onstr aints κ − i > 0 (7) κ − i > min ω | = A i B i X j 6 = i ω | = A j B j κ − j − min ω | = A i B i X j 6 = i ω | = A j B j κ − j (8) for al l i ∈ { 1 , . . . , n } . A solution of CR ( R ) is an n -tup el ( κ − 1 , . . . , κ − n ) of natural n um b ers, and with Sol CR ( R ) w e denote the set of all solutions of CR ( R ). Prop osition 1. F or R = { ( B 1 | A 1 ) , . . . , ( B n | A n ) } let ( κ − 1 , . . . , κ − n ) ∈ Sol CR ( R ) . Then the func- tion κ define d by κ ( ω ) = X 1 6 i 6 n ω | = A i B i κ − i (9) ac c epts R . All c-representations built from (7), (8), and (9) pro vide an excellen t basis for mo del-based inference [13,12]. How ever, from the p oint of view of minimal sp ecificity (see e.g. [4]), those c- represen tations with minimal κ − i yielding minimal degrees of implausibilit y are most interesting. While different orderings on Sol CR ( R ) can b e defined, leading to differen t minimalit y notions, in the follo wing w e will fo cus on the ordering on Sol CR ( R ) induced b y taking the sum of the κ − i , i.e. ( κ − 1 , . . . , κ − n ) 6 ( κ 0 − 1 , . . . , κ 0 − n ) iff X 1 6 i 6 n κ − i 6 X 1 6 i 6 n κ 0 − i . (10) As we are in terested in minimal κ − i -v ectors, an important question is whether there is alwa ys a unique minimal solution. This is not the case; the follo wing example that is also discussed in [15] illustrates that Sol CR ( R ) ma y hav e more than one minimal element. Example 2. Let R bir ds = { R 1 , R 2 , R 3 } b e the follo wing set of conditionals: R 1 : ( f | b ) bir ds fly R 2 : ( a | b ) bir ds ar e animals R 3 : ( a | f b ) flying bir ds ar e animals F rom (8) we get κ − 1 > 0 κ − 2 > 0 − min { κ − 1 , κ − 3 } κ − 3 > 0 − κ − 2 and since κ − i > 0 according to (7), the t wo v ectors sol 1 = ( κ − 1 , κ − 2 , κ − 3 ) = (1 , 1 , 0) sol 2 = ( κ − 1 , κ − 2 , κ − 3 ) = (1 , 0 , 1) are t wo differen t solutions of CR ( R bir ds ) with P 1 6 i 6 n κ − i = 2 that are b oth minimal in Sol CR ( R bir ds ) with resp ect to 6 . 5 A Declarative CLP Program for CR ( R ) In this section, w e will dev elop a CLP program GenOCF solving CR ( R ). Our main ob jective to obtain a declarativ e program that is as close as p ossible to the abstract form ulation of CR ( R ) while exploiting the concepts of constraint logic programming. W e will emplo y finite domain constrain ts, and from (7) w e immediately get a lo w er b ound for κ − i . Considering that w e are in terested mainly in minimal solutions, due to (8) w e can safely restrict ourselv es to n as an upp er bound for κ − i , yielding 0 6 κ − i 6 n (11) for all i ∈ { 1 , . . . , n } with n b eing the num b er of conditionals in R . 5.1 Input F ormat and Preliminaries Since we w ant to fo cus on the constraint solving part, we do not consider reading and parsing a kno wledge base R = { ( B 1 | A 1 ) , . . . , ( B n | A n ) } . Instead, we assume that R is already given as a Prolog co de file providing the follo wing predicates variables/1 , conditional/3 and indices/1 : variables([ a 1 ,..., a m ]) % list of atoms in Σ conditional( i , h A i i , h B i i ) % represen tation of i th conditional ( B i | A i ) indices([1,..., n ]) % list of indices { 1 , . . . , n } If Σ = { a 1 , . . . , a m } is the set of atoms, we assume a fixed ordering a 1 < a 2 < . . . < a m on Σ giv en by the predicate variables([ a 1 ,..., a m ]) . In the representation of a conditional, a propositional form ula A , constituting the an- teceden t or the consequence of the conditional, is represen ted by h A i where h A i is a Prolog list [ h D 1 i ,..., h D l i ] . Each h D i i represen ts a conjunction of literals suc h that D 1 ∨ . . . ∨ D l is a disjunctiv e normal form of A . Eac h h D i , represen ting a conjunction of literals, is a Prolog list [ b 1 ,..., b m ] of fixed length m where m is the n um b er of atoms in Σ and with b k ∈ { 0, 1, _ } . Such a list [ b 1 ,..., b m ] represents the conjunctions of atoms obtained from ˙ a 1 ∧ ˙ a 2 ∧ . . . ∧ ˙ a m b y eliminating all o ccurrences of > , where ˙ a k = a k if b k = 1 a k if b k = 0 > if b k = Example 3. The in ternal representation of the knowledge base presen ted in Example 1 is sho wn in Figure 2. As further preliminaries, using conditional/3 and indices/1 , we ha ve implemen ted the predi- cates verifying worlds/2 , falsifying worlds/2 , and falsify/2 , realising th e ev aluation of the indicator function (1) giv en in Sec. 2: verifying worlds( i , Ws ) % Ws list of worlds v erifying i th conditional falsifying worlds( i , Ws ) % Ws list of worlds falsifying i th conditional falsify( i , W ) % w orld W falsifies i th conditional variables([p,b,f,w,k]). % p b f w k p b f w k conditional(1,[[_,1,_,_,_]],[[_,_,1,_,_]]). % (f | b) birds fly conditional(2,[[1,_,_,_,_]],[[_,1,_,_,_]]). % (b | p) penguins are birds conditional(3,[[1,_,_,_,_]],[[_,_,0,_,_]]). % (-f | p) penguins do not fly conditional(4,[[_,1,_,_,_]],[[_,_,_,1,_]]). % (w | b) birds habe wings conditional(5,[[_,_,_,_,1]],[[_,1,_,_,_]]). % (b | k) kiwis are birds indices([1,2,3,4,5]). Fig. 2. Internal represen tation of the knowledge base from Example 1 where worlds are represen ted as complete conjunctions of literals o ver Σ , using the representation describ ed ab o ve. Using these predicates, in the follo wing subsections w e will presen t the complete source code of the constrain t logic program GenOCF solving CR ( R ). 5.2 Generation of Constrain ts The particular program code given here uses the SICStus Prolog system 1 and its clp(fd) library implemen ting constraint logic programming o ver finite domains [14]. The main predicate kappa/2 exp ecting a knowledge base KB of conditionals and yielding a v ector K of κ − i v alues as sp ecified by (8) is presen ted in Fig. 3. kappa(KB, K) :- % K is kappa vector of c-representation for KB consult(KB), indices(Is), % get list of indices [1,2,...,N] length(Is, N), % N number of conditionals in KB length(K, N), % generate K = [Kappa_1,...,Kappa_N] of free var. domain(K, 0, N), % 0 <= kappa_I <= N for all I according to (11) constrain_K(Is, K), % generate constraints according to (8) labeling([], K). % generate solution Fig. 3. Main predicate kappa/2 After reading in the kno wledge base and getting the list of indices, a list K of free constraint v ariables, one for eac h conditional, is generated. In the tw o subsequen t subgoals, the constrain ts corresp onding to the formulas (11) and (8) are generated, constraining the elements of K accord- ingly . Finally , labeling([], K) yields a list of κ − i v alues. Upon backtrac king, this will en umerate all p ossible solutions with an upp er b ound of n as in (11) for eac h κ − i . Later on, w e will demonstrate ho w to mo dify kappa/2 in order to take minimalit y into accoun t (Sec. 5.3). Ho w the subgoal constrain K(Is, K) in kappa/2 generates a constraint for each index i ∈ { 1 , . . . , n } according to (8) is defined in Fig. 4. Giv en an index I , constrain Ki(I,K) determines all w orlds v erifying and falsifying the I -th conditional; ov er these tw o sets of worlds the tw o min expressions in (8) are defined. Two lists VS and FS of sums corresp onding exactly to the first and the second sum, repectively , in (8) are generated (ho w this is done is defined in Fig. 5 and will b e explained b elow). With the constraint v ariables Vmin and Fmin denoting the minimum of these t wo lists, the constrain t Ki #> Vmin - Fmin 1 http://www.sics.se/isl/sicstuswww/site/index.html constrain_K([],_). % generate constraints for constrain_K([I|Is],K) :- % all kappa_I as in (8) constrain_Ki(I,K), constrain_K(Is,K). constrain_Ki(I,K) :- % generate constraint for kappa_I as in (8) verifying_worlds(I, VWorlds), % all worlds verifying I-th conditional falsifying_worlds(I, FWorlds), % all worlds falsifying I-th conditional list_of_sums(I, K, VWorlds, VS), % VS list of sums for verifying worlds list_of_sums(I, K, FWorlds, FS), % FS list of sums for falsifying worlds minimum(Vmin, VS), % Vmin minium for verifying worlds minimum(Fmin, FS), % Fmin minium for falsifying worlds element(I, K, Ki), % Ki constraint variable for kappa_I Ki #> Vmin - Fmin. % constraint for kappa_I as in (8) Fig. 4. Constraining the vector K represen ting κ − 1 , . . . , κ − n as in (8) giv en in the last line of Fig. 4 reflects precisely the restriction on κ − i giv en by (8). F or an index I , a k appa vector K , and a list of w orlds Ws , the goal list of sums(I, K, Ws, Ss) (cf. Fig. 5) yields a list Ss of sums suc h that for each world W in Ws , there is a sum S in Ss that is generated by sum kappa j(Js, I, K, W, S) where Js is the list of indices { 1 , . . . , n } . In the goal sum kappa j(Js, I, K, W, S) , S corresp onds exactly to the resp ective sum expression in (8), i.e., it is the sum of all Kj such that J 6 = I and W falsifies the j -th conditional. Example 4. Supp ose that kb birds.pl is a file containing the conditionals of the knowledge base R bir ds giv en in Ex. 2. Then the first five solutions generated b y the program given in Figures 3 – 5 are: | ?- kappa(’kb_birds.pl’, K). K = [1,0,1] ? ; K = [1,0,2] ? ; K = [1,0,3] ? ; K = [1,1,0] ? ; K = [1,1,1] ? Note that the first and the fourth solution are the minimal solutions. Example 5. If kb penguins.pl is a file containing the conditionals of the kno wledge base R given in Ex. 1, the first six solutions generated by kappa/2 are: | ?- kappa(’kb_penguins.pl’, K). K = [1,2,2,1,1] ? ; K = [1,2,2,1,2] ? ; K = [1,2,2,1,3] ? ; K = [1,2,2,1,4] ? ; K = [1,2,2,1,5] ? ; K = [1,2,2,2,1] ? 5.3 Generation of Minimal Solutions The enumeration predicate labeling/2 of SICStus Prolog allows for an option that minimizes the v alue of a cost v ariable. Since w e are aiming at minimizing the sum of all κ − i , the constrain t sum(K, #=, S) in tro duces such a cost v ariable S . Th us, exploiting the SICStus Prolog minimiza- tion feature, w e can easily modify kappa/2 to generate a minimal solution: W e just ha ve to replace the last subgoal labeling([], K) in Fig. 3 b y the tw o subgoals: % list_of_sums(I, K, Ws, Ss) generates list of sums as in (8): % I index from 1,...,N % K kappa vector % Ws list of worlds % Ss list of sums: % for each world W in Ws there is S in Ss s.t. % S is sum of all kappa_J with % J \= I and W falsifies J-th conditional list_of_sums(_, _, [], []). list_of_sums(I, K, [W|Ws], [S|Ss]) :- indices(Js), sum_kappa_j(Js, I, K, W, S), list_of_sums(I, K, Ws, Ss). % sum_kappa_j(Js, I, K, W, S) generates a sum as in (8): % Js list of indices [1,...,N] % I index from 1,...,N % K kappa vector % W world % S sum of all kappa_J s.t. % J \= I and W falsifies J-th conditional sum_kappa_j([], _, _, _, 0). sum_kappa_j([J|Js], I, K, W, S) :- sum_kappa_j(Js, I, K, W, S1), element(J, K, Kj), ((J \= I, falsify(J, W)) -> S #= S1 + Kj; S #= S1). Fig. 5. Generating list of sums of κ − i as in (8) sum(K, #=, S), % introduce constraint variable S % for sum of kappa_I minimize(labeling([],K), S). % generate single minimal solution With this modification, w e obtain a predicate kappa min/2 that returns a single minimal solution (and fails on backtrac king). Hence calling ?- kappa min(’kb birds.pl’, K). similar as in Ex. 4 yields the minimal solution K = [1,0,1] . Ho wev er, as pointed out in Sec. 4, there are go o d reasons for considering not just a single min- imal solution, but all minimal solutions. W e can ac hieve the computation of all minimal solutions b y another slight mo dification of kappa/2 . This time, the enumeration subgoal labeling([], K) in Fig. 3 is preceded b y tw o new subgoals as in kappa min all/2 in Fig. 6. kappa_min_all(KB, K) :- % K is minimal vector for KB, all solutions consult(KB), indices(Is), % get list of indices [1,2,...,N] length(Is, N), % N number of conditionals in KB length(K, N), % generate K = [Kappa_1,...,Kappa_N] of free var. domain(K, 0, N), % 0 <= kappa_I <= N for all I according to (11) constrain_K(Is, K), % generate constraints according to (8) sum(K, #=, S), % constraint variable S for sum of kappa_I min_sum_kappas(K, S), % determine minimal value for S labeling([], K). % generate all minimal solutions min_sum_kappas(K, Min) :- % Min is sum of a minimal solution for K once((labeling([up],[Min]), \+ \+ labeling([],K))). Fig. 6. Predicate kappa min all/2 generating exactly all minimal solutions The first new subgoal sum(K, #=, S) introduces a constrain t v ariable S just as in kappa min/2 . In the subgoal min sum kappas(K, S) , this v ariable S is constrained to the sum of a minimal so- lution as determined by min sum kappas(K, Min) . These tw o new subgoals ensure that in the generation caused b y the final subgoal labeling([], K) , exactly all minimal solutions are en u- merated. Example 6. Contin uing Example 4, calling | ?- kappa_min_all(’kb_birds.pl’, K). K = [1,0,1] ? ; K = [1,1,0] ? ; no yields the t wo minimal solutions for R bir ds . Example 7. F or the situation in Ex. 5, kappa min all/2 reveals that there is a unique minimal solution: | ?- kappa_min_all(’kb_penguins.pl’, K). K = [1,2,2,1,1] ? ; no Determining the OCF κ induced by the v ector ( κ − 1 , κ − 2 , κ − 3 , κ − 4 , κ − 5 ) = (1 , 2 , 2 , 1 , 1) according to (9) yields the ranking function giv en in Fig. 1. 6 Example Applications and First Ev aluation Although the ob jectiv e in developing GenOCF was on b eing as close as p ossible to the abstract form ulation of the constraint satisfaction problem CR ( R ), w e will presen t the results of some first example applications w e hav e carried out. F or n > 1, we generated syn thetic knowledge bases kb synth< n > c< 2 n − 1 >.pl according to the follo wing sc hema: Using the v ariables { f } ∪ { a 1 , . . . , a n } , kb synth< n > c< 2 n − 1 >.pl contains the 2 ∗ n − 1 conditionals giv en b y:: ( f | a i ) if i is o dd, i ∈ { 1 , . . . , n } ( f | a i ) if i is ev en, i ∈ { 1 , . . . , n } ( a i | a i +1 ) if i ∈ { 1 , . . . , n − 1 } F or instance, kb synth4 c7.pl uses the fiv e v ariables { f , a 1 , a 2 , a 3 , a 4 } and contains the seven conditionals: ( f | a 1 ) ( f | a 2 ) ( f | a 3 ) ( f | a 4 ) ( a 1 | a 2 ) ( a 2 | a 3 ) ( a 3 | a 4 ) The basic idea underlying the construction of these syn thetic kno wledge bases kb synth< n > c< 2 n − 1 >.pl is to establish a kind of sub class relationship b etw een a i +1 and a i for eac h i ∈ { 1 , . . . , n − 1 } on the one hand, and to state that every a i +1 is exceptional to a i with resp ect to its behaviour regarding f , again for each i ∈ { 1 , . . . , n − 1 } . This sequence of pairwise exceptional elements will force an y minimal solution of CR ( kb synth< n > c< 2 n − 1 >.pl ) to ha ve at least one κ − i v alue of size greater or equal to n . F rom kb synth< n > c< m >.pl , the knowledge bases kb synth< n > c< m − j >.pl are generated for j ∈ { 1 , . . . , m − 1 } by removing the last j conditionals. F or instance, kb synth4 c5.pl is obtained from kb synth4 c7.pl by remo ving the t wo conditionals { ( a 2 | a 3 ), ( a 3 | a 4 ) } . Figure 7 shows the time needed by GenOCF for computing all minimal solutions for v arious kno wledge bases. The execution time is given in seconds where the v alue 0 stands for any v alue less than 0.5 seconds. Measurements w ere tak en for the following environmen t: SICStus 4.0.8 (x86-lin ux-glib c2.3), Intel Core 2 Duo E6850 3.00GHz. While the num b er of v ariables determines the set of p ossible worlds, the num b er of conditionals induces the n umber of contrain ts. The v alues in the table in Fig. 7 give some indication on the influence of both v alues, the num b er of v ariables and the n umber of conditionals in a kno wledge base. F or instance, comparing the kno wledge base kb synth7 c10.pl , having 8 v ariables and 10 conditionals, to the knowledge base kb synth8 c10.pl , ha ving 9 v ariables and also 10 conditionals, w e see an increase of the com- putation time by a factor 2.3. Increasing the num b er of conditionals, leads to no time increase from kb synth7 c10.pl to kb synth7 c11.pl , and to a time increase factor of ab out 1.6 when mo ving from kb synth8 c10.pl to kb synth8 c11.pl , while for moving from kb synth8 c10.pl to kb synth9 c10.pl and kb synth10 c10.pl , we get time increase factors of 3.3 and 11.0, re- sp ectiv ely . Of course, these kno wledge bases are by no means representativ e, and further ev aluation is needed. In particular, inv estigating the complexity dep ending on the n umber of v ariables and conditionals and determining an upp er b ound for w orst-case complexit y has still to b e done. F urthermore, while the co de for GenOCF given abov e uses SICStus Prolog, w e also hav e a v ariant of GenOCF for the SWI Prolog system 2 [20]. In our further inv estigations, w e wan t to ev aluate GenOCF also using SWI Prolog, to elab orate the changes required and the options provided when moving b et ween SICStus and SWI Prolog, and to study whether there are an y significant differences in execution that migh t dep end on the tw o different Prolog systems and their options. 2 http://www.swi- prolog.org/index.html variables 3 3 [[1,0,1],[ 1,1,0]] 0 5 5 [[1,2,2,1,1]] 0 7 1 [[1]] 0 7 2 [[1,1]] 0 7 3 [[1,1,1]] 0 7 4 [[1,1,1,1]] 0 7 5 [[1,1,1,1,1]] 0 7 6 [[1,1,1,1,1,1] ] 1 7 7 [[1,1,1,1,1,1, 1]] 0 7 8 [[1,2,1,1,1,1, 1,2]] 1 7 9 [[1,2,2,1,1,1, 1,2,3]] 2 7 10 [[1,2,2,2,1,1,1,2,3,4] ] 3 7 11 [[1,2,2,2,2,1,1,2,3,4, 5]] 3 7 12 [[1,2,2,2,2,2,1,2,3,4, 5,6]] 6 7 13 [[1,2,2,2,2,2,2,2,3,4, 5,6,7]] 8 8 1 [[1]] 0 8 2 [[1,1]] 0 8 3 [[1,1,1]] 1 8 4 [[1,1,1,1]] 0 8 5 [[1,1,1,1,1]] 1 8 6 [[1,1,1,1,1,1] ] 1 8 7 [[1,1,1,1,1,1, 1]] 2 8 8 [[1,1,1,1,1,1, 1,1]] 3 8 9 [[1,2,1,1,1,1, 1,1,2]] 4 8 10 [[1,2,2,1,1,1,1,1,2,3] ] 8 8 11 [[1,2,2,2,1,1,1,1,2,3, 4]] 11 8 12 [[1,2,2,2,2,1,1,1,2,3, 4,5]] 17 8 13 [[1,2,2,2,2,2,1,1,2,3, 4,5,6]] 27 8 14 [[1,2,2,2,2,2,2,1,2,3, 4,5,6,7]] 38 8 15 [[1,2,2,2,2,2,2,2,2,3, 4,5,6,7,8]] 60 9 1 [[1]] 0 9 2 [[1,1]] 0 9 3 [[1,1,1]] 0 9 4 [[1,1,1,1]] 2 9 5 [[1,1,1,1,1]] 2 9 6 [[1,1,1,1,1,1] ] 4 9 7 [[1,1,1,1,1,1, 1]] 6 9 8 [[1,1,1,1,1,1, 1,1]] 9 9 9 [[1,1,1,1,1,1, 1,1,1]] 14 9 10 [[1,2,1,1,1,1,1,1,1,2] ] 26 9 11 [[1,2,2,1,1,1,1,1,1,2, 3]] 41 9 12 [[1,2,2,2,1,1,1,1,1,2, 3,4]] 61 9 13 [[1,2,2,2,2,1,1,1,1,2, 3,4,5]] 88 9 14 [[1,2,2,2,2,2,1,1,1,2, 3,4,5,6]] 127 9 15 [[1,2,2,2,2,2,2,1,1,2, 3,4,5,6,7]] 173 9 16 [[1,2,2,2,2,2,2,2,1,2, 3,4,5,6,7,8]] 256 9 17 [[1,2,2,2,2,2,2,2,2,2, 3,4,5,6,7,8,9]] 361 10 1 [[1]] 0 10 2 [[1,1]] 1 10 3 [[1,1,1]] 1 10 4 [[1,1,1,1]] 4 10 5 [[1,1,1,1,1]] 8 10 6 [[1,1,1,1,1,1] ] 15 10 7 [[1,1,1,1,1,1, 1]] 25 10 8 [[1,1,1,1,1,1, 1,1]] 40 10 9 [[1,1,1,1,1,1, 1,1,1]] 61 10 10 [[1,1,1,1,1,1,1,1,1,1] ] 88 10 11 [[1,2,1,1,1,1,1,1,1,1, 2]] 155 10 12 [[1,2,2,1,1,1,1,1,1,1, 2,3]] 232 10 13 [[1,2,2,2,1,1,1,1,1,1, 2,3,4]] 333 10 14 [[1,2,2,2,2,1,1,1,1,1, 2,3,4,5]] 465 10 15 [[1,2,2,2,2,2,1,1,1,1, 2,3,4,5,6]] 644 10 16 [[1,2,2,2,2,2,2,1,1,1, 2,3,4,5,6,7]] 929 10 17 [[1,2,2,2,2,2,2,2,1,1, 2,3,4,5,6,7,8]] 1.174 10 18 [[1,2,2,2,2,2,2,2,2,1, 2,3,4,5,6,7,8,9]] 1.642 10 19 [[1,2,2,2,2,2,2,2,2,2, 2,3,4,5,6,7,8,9,10] ] 2.248 knowle dge base conditionals minimal solutions time kb_birds.pl kb_penguins.p l kb_synth7_c1.p l kb_synth7_c2.p l kb_synth7_c3.p l kb_synth7_c4.p l kb_synth7_c5.p l kb_synth7_c6.p l kb_synth7_c7.p l kb_synth7_c8.p l kb_synth7_c9.p l kb_synth7_c10. pl kb_synth7_c11. pl kb_synth7_c12. pl kb_synth7_c13. pl kb_synth8_c1.p l kb_synth8_c2.p l kb_synth8_c3.p l kb_synth8_c4.p l kb_synth8_c5.p l kb_synth8_c6.p l kb_synth8_c7.p l kb_synth8_c8.p l kb_synth8_c9.p l kb_synth8_c10. pl kb_synth8_c11. pl kb_synth8_c12. pl kb_synth8_c13. pl kb_synth8_c14. pl kb_synth8_c15. pl kb_synth9_c1.p l kb_synth9_c2.p l kb_synth9_c3.p l kb_synth9_c4.p l kb_synth9_c5.p l kb_synth9_c6.p l kb_synth9_c7.p l kb_synth9_c8.p l kb_synth9_c9.p l kb_synth9_c10. pl kb_synth9_c11. pl kb_synth9_c12. pl kb_synth9_c13. pl kb_synth9_c14. pl kb_synth9_c15. pl kb_synth9_c16. pl kb_synth9_c17. pl kb_synth10_c1. pl kb_synth10_c2. pl kb_synth10_c3. pl kb_synth10_c4. pl kb_synth10_c5. pl kb_synth10_c6. pl kb_synth10_c7. pl kb_synth10_c8. pl kb_synth10_c9. pl kb_synth10_c10.p l kb_synth10_c11.p l kb_synth10_c12.p l kb_synth10_c13.p l kb_synth10_c14.p l kb_synth10_c15.p l kb_synth10_c16.p l kb_synth10_c17.p l kb_synth10_c18.p l kb_synth10_c19.p l Fig. 7. Execution times of GenOCF under SICStus Prolog for v arious knowledge bases 7 Conclusions and F urther W ork While for a set of probabilistic conditionals ( B i | A i )[ x i ] the principle of maximum entrop y yields a unique mo del, for a set R of qualitative default rules ( B i | A i ) there ma y b e several minimal ranking functions. In this pap er, w e developed a CLP approach for solving CR ( R ), realized in the Prolog program GenOCF . The solutions of the constrain t satisfaction problem CR ( R ) are v ectors of natural num b ers # » κ = ( κ − 1 , . . . , κ − n ) that uniquely determine an OCF κ # » κ accepting all conditionals in R . The program GenOCF is also able to generate exactly all minimal solutions of CR ( R ); the minimal solutions of CR ( R ) are of sp ecial interest for model-based inference. Among the extentions of the approac h describ ed here w e are curren tly working on, is the in vestigation and ev aluation of alternative minimality criteria. Instead of ordering the v ectors # » κ b y the sum of their comp onen ts, w e could define a component wise order on Sol CR ( R ) b y defining ( κ − 1 , . . . , κ − n ) ( κ 0 − 1 , . . . , κ 0 − n ) iff κ − i 6 κ 0 − i for i ∈ { 1 , . . . , n } , yielding a partial order on Sol CR ( R ). Still another alternative is to compare the full OCFs κ # » κ induced b y # » κ = ( κ − 1 , . . . , κ − n ) according to (9), yielding the ordering 4 on Sol CR ( R ) defined b y κ # » κ 4 κ # » κ 0 iff κ # » κ ( ω ) 6 κ # » κ 0 ( ω ) for all ω ∈ Ω . In general, it is an open problem ho w to strengthen the requiremen ts defining a c-represen tation so that a unique solution is guaranteed to exist. The declarativ e nature of constraint logic program- ming supports easy constraint modification, enabling the exp erimen tation and practical ev aluation of differen t notions of minimalit y for Sol CR ( R ) and of additional requirements that migh t be im- p osed on a ranking function. F urthermore, in [8] the framework of default rules concidered here is extended b y allowing not only default rules in the kno wledge base R , but also strict knowledge, rendering some w orlds completely imp ossib e. This can yield a reduction of the problem’s complex- it y , and it will be interesting to see which effects the incorp oration of strict knowledge will hav e on the CLP approac h presented here. References 1. C. Beierle and G. Kern-Isb erner. A v erified AsmL implemen tation of b elief revision. In E. B¨ orger, M. Butler, J. P . Bow en, and P . Boca, editors, A bstr act State Machines, B and Z, First International Confer enc e, ABZ 2008, L ondon, UK, Septemb er 16-18, 2008. Pr o c e edings , v olume 5238 of LNCS , pages 98–111. Springer, 2008. 2. C. Beierle and G. Kern-Isb erner. On the computation of ranking functions for default rules – a c hallenge for constraint programming. In Pr o c. Deklar ative Mo del lierung und effiziente Optimierung mit Constr aint-T e chnolo gie. Workshop at GI Jahr estagung 2011 , 2011. (to app ear). 3. C. Beierle, G. Kern-Isb erner, and N. Ko ch. A high-level implementation of a system for automated reasoning with default rules (system description). In A. Armando, P . Baumgartner, and G. Do w ek, ed- itors, Pr o c. of the 4th International Joint Confer ence on Automate d R e asoning (IJCAR-2008) , volume 5195 of LNCS , pages 147–153. Spring er, 2008. 4. S. Benferhat, D. Dubois, and H. Prade. Represen ting default rules in p ossibilistic logic. In Pr o c e e dings 3th International Confer enc e on Principles of Know le dge R epr esentation and R e asoning KR’92 , pages 673–684, 1992. 5. R. A. Bourne. Default r e asoning using maximum entr opy and variable str ength defaults . PhD thesis, Univ. of London, 1999. 6. R.A. Bourne and S. P arsons. Maxim um en tropy and v ariable strength defaults. In Pr o c e e dings Sixte enth International Joint Confer enc e on Artificial Intel ligenc e, IJCAI’99 , pages 50–55, 1999. 7. B. DeFinetti. The ory of Pr ob ability , v olume 1,2. John Wiley & Sons, 1974. 8. T. Eiter and T. Luk asiewicz. Complexit y results for structure-based causalit y . Artif. Intel l. , 142(1):53– 89, 2 002. 9. M. Goldszmidt, P . Morris, and J. Pearl. A maxim um entrop y approach to nonmonotonic reasoning. IEEE T r ansactions on Pattern A nalysis and Machine Intel ligenc e , 15(3):220–232, 1993. 10. M. Goldszmidt and J. Pearl. Qualitativ e probabilities for default reasoning, b elief revision, and causal mo deling. Artificial Intell igenc e , 84:57–112, 1996. 11. G. Kern-Isb erner. Characterizing the principle of minimum cross-entrop y within a conditional-logical framew ork. A rtificial Intel ligenc e , 98:169–208, 1998. 12. G. Kern-Isb erner. Conditionals in nonmonotonic re asoning and b elief r evision . Springer, Lecture Notes in Artificial In telligence LNAI 2087, 2001. 13. G. Kern-Isberner. Handling conditionals adequately in uncertain reasoning and belief revision. Journal of Applie d Non-Classic al L o gics , 12(2):215–237, 2002. 14. M.Carlsson, G. Ottosson, and B. Carlson. An op en-ended finite domain constraint solver. In H. Glaser, P . H. Hartel, and H. Kuch en, editors, Pr o gr amming L anguages: Implementations, L o gics, and Pr o- gr ams, (PLILP’97) , volume 1292 of LNCS , pages 191–206. Springer, 1997. 15. C. M¨ uller. Implementierung von Default-Regeln durch optimale konditionale Rangfunktionen. Ab- sc hlussarb eit Bac helor of Science in Informatik, F ernUniversit¨ at in Hagen, 2004. 16. J.B. Paris. The unc ertain r e asoner’s c omp anion – A mathematic al p ersp e ctive . Cambridge Universit y Press, 1994. 17. J.B. Paris and A. V encovsk a. In defence of the maximum entrop y inference pro cess. International Journal of Appr oximate R e asoning , 17(1):77–103, 1997. 18. W. Sp ohn. Ordinal conditional functions: a dynamic theory of epistemic states. In W.L. Harp er and B. Skyrms, editors, Causation in De cision, Belief Change, and Statistics, II , pages 105–134. Klu wer Academic Publishers, 1988. 19. E. W eydert. System JZ - How to build a canonical ranking mo del of a default knowledge base. In Pr o c ee dings KR’98 . Morgan Kaufmann, 1998. 20. J. Wielemaker, T. Sc hrijvers, M. T risk a, and T. Lager. SWI-Prolog. CoRR , abs/1011.5332, 2010. (to app ear in The ory and Pr actic e of L o gic Pr o gr amming ).
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment