Technical Communications of ICLP 2015. Copyright with the Authors. 1 Markov Logic Style Weighted Rules under the Stable Model Semantics JOOHYUNG LEE Arizona State University, Tempe, AZ, USA (e-mail: joolee@asu.edu) YUNSONG MENG Samsung Research America, Mountain View, CA, USA (e-mail: yunsong.m@samsung.com) YI WANG Arizona State University, Tempe, USA (e-mail: ywang485@asu.edu) submitted 29 April 2015; accepted 5 June 2015 Abstract MLN We introduce the language LP that extends logic programs under the stable model semantics to al- low weighted rules similar to the way Markov Logic considers weighted formulas. LPMLN is a proper extension of the stable model semantics to enable probabilistic reasoning, providing a way to handle in- consistency in answer set programming. We also show that the recently established logical relationship between Pearl’s Causal Models and answer set programs can be extended to the probabilistic setting via LPMLN . KEYWORDS: Answer Set Programming, Markov Logic Networks, Probabilistic Causal Models, Prob- abilistic Logic Programming 1 Introduction Logic programs under the stable model semantics is the language for Answer Set Program- ming (ASP). Many useful knowledge representation constructs are introduced into ASP, and several efficient ASP solvers are available. However, like many “crisp” logic approaches, adding a single rule may easily introduce inconsistency. Also, ASP is not well suited for handling probabilistic reasoning. Markov Logic is a successful approach to combining first-order logic and probabilistic graphical models in a single representation. Syntactically, a Markov Logic Network (MLN) is a set of weighted first-order logic formulas. Semantically, the probability of each possible world is derived from the sum of the weights of the formulas that are true under the possi- ble world. Markov Logic has shown to formally subsume many other SRL languages and has been successfully applied to several challenging applications, such as natural language processing and entity resolution. However, the logical component of Markov Logic is the standard first-order logic semantics, which does not handle the concept of rules as in ASP. We introduce a simple approach to combining the two successful formalisms, which allows for logical reasoning originating from the stable model semantics as well as probabilistic reasoning originating from Markov Logic. LPMLN is a proper extension of the standard stable model semantics, and as such embraces the rich body of research in answer set programming. 2 J. Lee and Y. Meng and Y. Wang Interestingly, the relationship between LPMLN and Markov Logic is analogous to the well- known relationship between ASP and SAT (Lin and Zhao 2004; Lee 2005). This allows many useful results known in the deterministic case to be carried over to the probabilistic setting. In particular, an implementation of Markov Logic can be used to compute “tight” LPMLN programs, similar to the way “tight” ASP programs can be computed by SAT solvers. LPMLN provides a viable solution to inconsistency handling with ASP knowledge bases. For example, consider ASP knowledge base KB1 that states that Man and Woman are disjoint subclasses of Human. Human(x) ← Man(x), Human(x) ← Woman(x), ← Man(x), Woman(x) One data source KB2 says that Jo is a Man: Man(Jo) while another data source KB3 states that Jo is a Woman: Woman(Jo). The data about Jo is actually inconsistent, so under the (deterministic) stable model seman- tics, the combined knowledge base KB = KB1 ∪ KB2 ∪ KB3 is inconsistent, and may derive any conclusion. On the other hand, it is intuitive to view that one of the data sources may be wrong, and we still want to conclude that Jo is a Human. The same conclusion is obtained under the LPMLN semantics. For another aspect of LPMLN , we consider how it is related to Pearl’s Probabilistic Causal Models. Both answer set programs and Probabilistic Causal Models allow for represent- ing causality, but a precise relationship between them is established only in a recent pa- per (Bochman and Lifschitz 2015) limited to the deterministic case.1 Generalizing this result to the probabilistic case is straightforward once we refer to LPMLN in place of answer set programs, which illustrates that LPMLN is a natural probabilistic extension of answer set programs. 2 Preliminaries Throughout this paper, we assume a first-order signature σ that contains no function constants of positive arity. There are finitely many Herbrand interpretations of σ. 2.1 Review: Stable Model Semantics A rule over σ is of the form A1 ; . . . ; Ak ← Ak+1 , . . . , Am , not Am+1 , . . . , not An , not not An+1 , . . . , not not Ap (1) (0 ≤ k ≤ m ≤ n ≤ p) where all Ai are atoms of σ possibly containing object variables. We write {A1 }ch ← Body to denote the rule A1 ← Body, not not A1 . This expression is called a “choice rule” in ASP. 1 Strictly speaking, the relationship shown in that paper is between Pearl’s causal models and nonmonotonic causal theories (McCain and Turner 1997). The close relationship between nonmonotonic causal theories and answer set programs is shown in (Ferraris et al. 2012). Markov Logic Style Weighted Rules under the Stable Model Semantics 3 We will often identify (1) with the implication: A1 ∨ · · · ∨ Ak ← Ak+1 ∧. . .∧Am ∧¬Am+1 ∧. . .∧¬An ∧¬¬An+1 ∧. . .∧¬¬Ap . (2) A logic program is a finite set of rules. A logic program is called ground if it contains no variables. We say that an Herbrand interpretation I is a model of a ground program Π if I satisfies all implications (2) in Π (as in classical logic). Such models can be divided into two groups: “stable” and “non-stable” models, which are distinguished as follows. The reduct of Π rela- tive to I, denoted ΠI , consists of “A1 ∨ · · · ∨ Ak ← Ak+1 ∧ · · · ∧ Am ” for all rules (2) in Π such that I |= ¬Am+1 ∧ · · · ∧ ¬An ∧ ¬¬An+1 ∧ · · · ∧ ¬¬Ap . The Herbrand interpreta- tion I is called a (deterministic) stable model of Π if I is a minimal Herbrand model of ΠI . (Minimality is in terms of set inclusion. We identify an Herbrand interpretation with the set of atoms that are true in it.) The definition is extended to any non-ground program Π by identifying it with grσ [Π], the ground program obtained from Π by replacing every variable with every ground term of σ. The semantics was extended in many ways, e.g., allowing some useful constructs, such as aggregates and abstract constraints (e.g., (Niemelä and Simons 2000; Faber et al. 2004; Ferraris 2005; Son et al. 2006; Pelov et al. 2007)). The probabilistic extension defined in this paper is orthogonal to such extensions and can easily incorporate them as well. 3 Language LPMLN 3.1 Syntax of LPMLN The syntax of LPMLN defines a set of weighted rules. More precisely, an LPMLN program P is a finite set of weighted rules w : R, where R is a rule of the form (1) and w is either a real number or the symbol α denoting the “infinite weight.” We call rule w : R soft rule if w is a real number, and hard rule if w is α. We say that an LPMLN program is ground if its rules contain no variables. We identify any LPMLN program P of signature σ with a ground LPMLN program grσ [P], whose rules are obtained from the rules of P by replacing every variable with every ground term of σ. The weight of a ground rule in grσ [P] is the same as the weight of the rule in P from which the ground rule is obtained. By P we denote the logic program obtained from P by dropping the weights, i.e., P = {R | w : R ∈ P}. By PI we denote the set of rules in P which are satisfied by I. 3.2 Semantics of LPMLN A model of an MLN does not have to satisfy all formulas in the MLN. For each model, there is a unique maximal subset of the formulas that are satisfied by the model, and the weights of the formulas in that subset determine the probability of the model. Likewise, a stable model of an LPMLN program does not have to be obtained from the whole program. Instead, each stable model is obtained from some subset of the program, and the weights of the rules in that subset determine the probability of the stable model. At first, it may not seem obvious if there is a unique maximal subset that derives such a stable model. Nevertheless, it follows from the following proposition that this is indeed the case, and that the subset is exactly PI . 4 J. Lee and Y. Meng and Y. Wang Proposition 1 For any logic program Π and any subset Π0 of Π, if I is a (deterministic) stable model of Π0 and I satisfies Π, then I is a (deterministic) stable model of Π as well. The proposition tells us that if I is a stable model of a program, adding additional rules to this program does not affect that I is a stable model of the resulting program as long as I satisfies the rules added. On the other hand, it is clear that I is no longer a stable model if I does not satisfy at least one of the rules added. Thus we define the weight of an interpretation I w.r.t. P, denoted WP (I), as ! X WP (I) = exp w . w:R ∈ P I|=R Let SM[P] be the set {I | I is a stable model of PI }. Notice that SM[P] is never empty be- cause it always contains the empty set. It is easy to check that the set ∅ always satisfies P ∅ , and it is the smallest set that satisfies the reduct (P ∅ )∅ . Using this notion of a weight, we define the probability of an interpretation I under P, denoted PrP [I], as follows. For any interpretation I,   lim PWP (I) if I ∈ SM[P]; α→∞ WP (J) PrP [I] = J∈SM[P] 0 otherwise.  We omit the subscript P if the context is clear. We say that I is a (probabilistic) stable model of P if PrP [I] 6= 0. The intuition here is similar to that of Markov Logic. For each interpretation I, we try to find a maximal subset (possibly empty) of P for which I is a stable model (under the standard stable model semantics). In other words, the LPMLN semantics is similar to the MLN semantics except that the possible worlds are the stable models of some maximal subset of P, and the probability distribution is over these stable models. For any proposition A, PrP [A] is defined as: X PrP [A] = PrP [I]. I: I|=A (In place of “I |= A,” one might expect “I is a stable model of P that satisfies A.” The change does not affect the definition.) Conditional probability under P is defined as usual. For propositions A and B, PrP [A ∧ B] PrP [A | B] = . PrP [B] The following example illustrates how inconsistency can be handled in LPMLN . Example 1 (handling inconsistency) Consider the example in Section 1. Recall that there are no deterministic stable models of KB. However, when we identify each rule as a hard rule under the LPMLN semantics (i.e., having α as the weight), there are 3 probabilistic stable models (with non-zero probabilities) assuming that Jo is the only element in the domain. Let Z = 3e4α + 3e3α + e2α . • I0 = ∅ with probability limα→∞ e3α /Z = 0. Markov Logic Style Weighted Rules under the Stable Model Semantics 5 • I1 = {Man(Jo)} with probability limα→∞ e3α /Z = 0. • I2 = {Woman(Jo)} with probability limα→∞ e3α /Z = 0. • I3 = {Human(Jo)} is not a stable model of KBI3 , so its probability is 0. • I4 = {Man(Jo), Human(Jo)} with probability limα→∞ e4α /Z = 13 . • I5 = {Woman(Jo), Human(Jo)} with probability limα→∞ e4α /Z = 31 . • I6 = {Man(Jo), Woman(Jo)} with probability limα→∞ e2α /Z = 0. • I7 = {Man(Jo), Woman(Jo), Human(Jo)} with probability limα→∞ e4α /Z = 13 . Thus we can check that • Pr[Human(Jo) = t] = Pr[I4 ] + Pr[I5 ] + Pr[I7 ] = 1: for I4 , KB3 is disregarded; for I5 , KB2 is disregarded; for I7 , the last rule of KB1 is disregarded. P r[I4 ]+P r[I7 ] • Pr[Human(Jo) = t | Man(Jo) = t] = P r[I1 ]+P r[I4 ]+P r[I6 ]+P r[I7 ] = 1. • Pr[Man(Jo) = t | Human(Jo) = t] = P r[IP4 ]+P r[I4 ]+P r[I7 ] 2 r[I5 ]+P r[I7 ] = 3 . Often an LPMLN program P consists of the set Ps of soft rules and the set of Ph of hard rules together, and there exists at least one stable model that is obtained from all hard rules plus some subset of soft rules. In this case, we may simply consider the weights of soft rules only in computing the probabilities of stable models. Let SM0 [P] be the set {I | I is a stable model of Ph ∪ (Ps )I }, and let PWPs (I)   WPs (J) if I ∈ SM0 [P]; Pr0P [I] = J∈SM0 [P] 0 otherwise.  Note the absence of lim in the definition of Pr0P [I]. Also unlike PrP [I], SM0 [P] may be α→∞ empty, in which case Pr0P [I] is not defined. Proposition 2 Let P = Ps ∪ Ph be an LPMLN program where Ps consists of soft rules and Ph consists of hard rules. If SM0 [P] is not empty, for every interpretation I, PrP [I] coincides with Pr0P [I]. Thus the presence of at least one interpretation in SM0 [P] implies that every other stable model of P (with non-zero probability) should also satisfy all hard rules in P. Note that Example 1 does not satisfy the nonemptiness condition of SM0 [P], whereas the following example does. Example 2 (LPMLN vs. MLN) Consider a variant of the main example from (Bauters et al. 2010). We are certain that we booked a concert and that we have a long drive ahead of us unless the concert is cancelled. However, there is a 20% chance that the concert is indeed cancelled. This example can be formalized in LPMLN program P as α : ConcertBooked ← α: LongDrive ← ConcertBooked, not Cancelled ln 0.2 : Cancelled ← ln 0.8 : ← Cancelled. Since SM0 [P] is not empty, in view of Proposition 2, the probability of the two stable models are as follows: 6 J. Lee and Y. Meng and Y. Wang ln0.2 e • I1 = {ConcertBooked, Cancelled}, with PrP [I1 ] = eln0.2 +eln0.8 = 0.2. ln0.8 e • I2 = {ConcertBooked, LongDrive}, with PrP [I2 ] = eln0.2 +eln0.8 = 0.8. If this program is understood under the MLN semantics, say in the syntax α: ConcertBooked α: ConcertBooked ∧ ¬Cancelled → LongDrive ln 0.2 : Cancelled ln 0.8 : ¬Cancelled, there are three MLN models with non-zero probabilities: • I1 = {ConcertBooked, Cancelled} with Pr[I1 ] = 0.2/1.4 ' 0.1429. • I2 = {ConcertBooked, LongDrive} with Pr[I2 ] = 0.8/1.4 ' 0.5714. • I3 = {ConcertBooked, Cancelled, LongDrive} with Pr[I3 ] = 0.2/1.4 ' 0.1429. The presence of I3 is not intuitive (why have a long drive when the concert is cancelled?) Remark. In some sense, the distinction between soft rules and hard rules in LPMLN is simi- lar to the distinction between consistency-restoring rules (CR-rules) and standard ASP rules under CR-Prolog (Balduccini and Gelfond 2003): CR-rules are added to the standard ASP program part until the resulting program has a stable model. CR-Prolog also allows a pref- erence on selecting which CR-rules to be added in order to obtain consistency. In LPMLN a similar effect can be obtained by adding soft rules with different weights. On the other hand, CR-Prolog has little to say when there is no stable model no matter what CR-rules are added (c.f. Example 1). Remark. This example also illustrates a correspondence between LPMLN and probabilistic logic programming languages based on the distribution semantics (Sato 1995). The use of soft rules in the example simulates the probabilistic choices under the distribution semantics. However, this correspondence is only valid when there is only one stable model per the probabilistic choice induced by the selection of such soft rules. Example 3 It is well known that Markov Logic does not properly handle inductive definitions,2 while LPMLN gives an intuitive representation. For instance, consider that x may influence y if x is a friend to y, and the influence relation is a minimal relation that is closed under transitivity. α: Friend(A, B) α: Friend(B, C) 1: Influences(x, y) ← Friend(x, y) α: Influences(x, y) ← Influences(x, z), Influences(z, y). Note that the third rule is soft: a person does not always influence his/her friend. The fourth rule says if x influences z, and z influences y, we can say x influences y. On the other hand, we do not want this relation to be vacuously true. Assuming that there are only three people A, B, C in the domain (thus there are 1 + 1 + 9 + 27 ground rules), there are four stable models with non-zero probabilities. Let Z = e9 + 2e8 + e7 . 2 “Markov Logic has the drawback that it cannot express (non-ground) inductive definitions.” (Fierens et al. 2013) Markov Logic Style Weighted Rules under the Stable Model Semantics 7 • I1 = {Friend(A, B), Friend(B, C), Influence(A, B), Influence(B, C), Influence(A, C)} with probability e9 /Z. • I2 = {Friend(A, B), Friend(B, C), Influence(A, B)} with probability e8 /Z. • I3 = {Friend(A, B), Friend(B, C), Influence(B, C)} with probability e8 /Z. • I4 = {Friend(A, B), Friend(B, C)} with probability e7 /Z. Thus we get • PrP [Influence(A, B) = t] = PrP [Influence(B, C) = t] = (e9 + e8 )/Z = 0.7311. • PrP [Influence(A, C) = t] = e9 /Z = 0.5344. Increasing the weight of the soft rule yields higher probabilities for Influence(A, B) = t, Influence(B, C) = t, Influence(A, C) = t. Still, the first two have the same probability, and the third has less probability than the first two. Note that the minimality of the influence relation is not expressible under the MLN se- mantics. 3.3 Relating LPMLN to ASP Any logic program under the stable model semantics can be turned into an LPMLN pro- gram by assigning the infinite weight to every rule. That is, for any logic program Π = {R1 , . . . , Rn }, the corresponding LPMLN program PΠ is {α : R1 , . . . , α : Rn }. Theorem 1 For any logic program Π, the (deterministic) stable models of Π are exactly the (probabilistic) stable models of PΠ whose weight is ekα , where k is the number of all (ground) rules in Π. If Π has at least one stable model, then all stable models of PΠ have the same probability, and are thus the stable models of Π as well. The idea of softening rules in LPMLN is similar to the idea of “weak constraints” in ASP, which is used for certain optimization problems. A weak constraint has the form “ :∼ Body [Weight : Level].” The answer sets of a program Π plus a set of weak constraints are the answer sets of Π which minimize the penalty calculated from Weight and Level of violated weak con- straints. However, weak constraints are more restrictive than weighted rules in LPMLN , and do not have a probabilistic semantics. 3.4 Completion: Turning LPMLN to MLN It is known that the stable models of a tight logic program coincide with the models of the program’s completion. This yielded a way to compute stable models using SAT solvers. The method can be extended to LPMLN so that their stable models along with the probabil- ity distribution can be computed using existing implementations of MLNs, such as Alchemy (http://alchemy.cs.washington.edu) and Tuffy (http://i.stanford.edu/ hazy/hazy/tuffy). We define the completion of P, denoted Comp(P), to be the MLN which is the union of P and the hard rules ! _ ^ 0 α: A→ Body ∧ ¬A w:A1 ,...,Ak ←Body ∈ P A0 ∈{A1 ,...,Ak }\{A} A∈{A1 ,...,Ak } 8 J. Lee and Y. Meng and Y. Wang for each ground atom A. This is a straightforward extension of the completion from (Lee and Lifschitz 2003) simply assigning the infinite weight α to the completion formulas. Likewise, we say that LPMLN program P is tight if P is tight according to (Lee and Lifschitz 2003). Theorem 2 For any tight LPMLN program P such that SM0 [P] is not empty, P (under the LPMLN seman- tics) and Comp(P) (under the MLN semantics) have the same probability distribution over all interpretations. 4 Embedding Pearl’s Probabilistic Causal Models in LPMLN 4.1 Review: Pearl’s Causal Models Notation: Following (Pearl 2000), we use capital letters (e.g., X, Y , Z, U , V ) for (lists of) atoms and lower case letters (x, y, z, u, v) for generic symbols for specific (lists of) truth values taken by the corresponding (lists of) atoms. When X is a list, we use subscripts, such as Xi , to denote an element in X. As usual, a propositional formula is constructed from atoms, t, f, and propositional con- nectives, ¬, ∧, ∨, →. Definition 1 (structural theory) Assume that a finite set of propositional atoms is partitioned into a set of exogenous atoms U and a set of endogenous atoms V = {V1 , . . . , Vn }. A Boolean structural theory is hU, V, F i, where F is a finite set of equations Vi = Fi , one for each endogenous atom Vi , and Fi is a propositional formula. Definition 2 (causal diagram) The causal diagram of a Boolean structural theory hU, V, F i is the directed graph whose vertices are the atoms in U ∪ V and an edge goes from Vj to Vi if there is an equation Vi = Fi in the structural theory such that Vj occurs in Fi . We say that the structural theory is acyclic if its causal diagram is acyclic. For any interpretation I and J of U ∪ V , we say that J 6=V I if J and I agree on all atoms in U and do not agree on some atoms in V . Definition 3 (solution) Given a Boolean causal theory hU, V, F i, a solution (or a causal world) I is any interpretation of U ∪ V such that • I satisfies the equivalences Vi ↔ Fi for all equations Vi = Fi in F , and • no other interpretation J such that J 6=V I satisfies all such equivalences Vi ↔ Fi . Definition 4 (causal model) A (Boolean) causal model hU, V, F i is an acyclic Boolean structural theory that has a unique solution for each realization (i.e., truth assignment) of U ; in other words, each truth assign- ment of U has a unique expansion to U ∪ V that is a solution. Markov Logic Style Weighted Rules under the Stable Model Semantics 9 Definition 5 (probabilistic causal model) A probabilistic (Boolean) structural theory is a pair hhU, V, F i, P (U )i (3) where hU, V, F i is a Boolean structural theory, and P (U ) is a probability distribution over U . We assume that exogenous atoms are independent of each other. A Probabilisitic (Boolean) Causal Model (PCM) is a probabilistic structural theory (3) such that hU, V, F i is a causal model. The solutions of PCM (3) are the solutions of hU, V, F i. The probability of a solution I under the PCM M, denoted PM (I), is defined as P (U = I(U )). Given a PCM M = hhU, V, F i, P (U )i, for any subset Y of V , we write YM (u) to denote the truth assignment of Y in the solution of M induced by u. The probability of Y = y is defined as P PM (Y = y) = {u | YM (u)=y} P (u). For any subset Y , Z of V , PM (Y = y | Z = z) is defined as P {u | YM (u) = y and ZM (u) = z} P (u) PM (Y = y | Z = z) = P . {u | ZM (u)=z} P (u) Consider, for example, the probabilistic causal model MF S for the Firing Squad exam- ple (Pearl 2000, Sec 7.1.2): MF S = hh{U, W }, {C, A, B, D}, F i, P (U, W )i F : C=U A=C ∨W B=C D =A∨B P (U = t) = p P (W = t) = q U denotes “The court orders the execution,” C denotes “The captain gives a signal,” A denotes “Rifleman A shoots,” B denotes “Rifleman B shoots,” D denotes “The prisoner dies,” and W denotes “Rifleman A is nervous.” There is a probability p that the court has ordered the execution; rifleman A has a probability q of pulling the trigger out of nervousness. The PCM has four solutions for each realization of U and W . Solutions Probability {U = f , W = f , C = f , A = f , B = f , D = f } (1−p)(1−q) {U = f , W = t, C = f , A = t, B = f , D = t} (1−p)q {U = t, W = f , C = t, A = t, B = t, D = t} p(1−q) {U = t, W = t, C = t, A = t, B = t, D = t} pq 4.2 Embedding PCM in LPMLN Since causal models assume propositional formulas, it is convenient to discuss the result by first extending the syntax of LPMLN to weighted propositional formulas, that is of the form 10 J. Lee and Y. Meng and Y. Wang w : F where F is a propositional formula and w is either a real number or the symbol α. We refer the reader to (Ferraris 2005) for the definition of a stable model for propositional formulas. Extending LPMLN to this general syntax is straightforward, which we skip due to lack of space. Definition 6 (LPMLN representation) For any PCM M = hhU, V, F i, P (U )i, PM is the LPMLN program consisting of • α : Vi ← Fi for each equation Vi = Fi in M, and, • for each exogenous atom Ui of M such that P (Ui = t) = p: (i) ln(p) : Ui and ln(1 − p) : ← Ui if 0 < p < 1; (ii) α : Ui if p = 1; (iii) α : ← Ui if p = 0. For the Firing Squad example, assuming 0 < p, q < 1, PMF S is as follows: ln(p) : U α: C←U ln(1 − p) : ← U α : A←C ∨W ln(q) : W α: B←C ln(1 − q) : ← W α : D ← A ∨ B. Theorem 3 The solutions of a probabilistic causal model M are identical to the stable models of PM and their probability distributions coincide. Note that the acyclicity condition in PCM implies the tightness condition of its LPMLN program representation. Thus, using the completion method in Section 3.4, we can automate query answering for this domain using Alchemy. 4.3 Review: Counterfactuals in PCM Definition 7 (submodel) Given a Boolean causal model M = hU, V, F i, and a subset X of V , the submodel MX=x of M is the Boolean causal model obtained from M by replacing every equation Xi = Fi in the theory, where Xi ∈ X, with Xi = xi . Given a PCM M = hM, P (U )i, MX=x = hMX=x , P (U )i. For any PCM M = hhU, V, F i, P (U )i, let X, Y , Z be subsets of V . The probability of a counterfactual statement, represented as YX=x = y, is defined as X PM (YX=x = y) = P (u). {u | YMX=x (u)=y} The probability of a conditional counterfactual statement “Given Z is z, Y would have been y had X been x”, represented as YX=x = y | Z = z, is defined as P {u | YM (u) = y and ZM (u) = z} P (u) X=x PM (YX=x = y | Z = z) = P . {u|ZM (u)=z} P (u) For example, given that the prisoner is dead, what is the probability that the prisoner were (1−p)q not dead if rifleman A had not shot? This is asking: PM (DA=f = f | D = t) = 1−(1−p)(1−q) . Markov Logic Style Weighted Rules under the Stable Model Semantics 11 4.4 PCM Counterfactuals in LPMLN Counterfactual reasoning in PCM can be turned into LPMLN reasoning. The program LPMLN Ptwin M consists of • all rules in PM ; • rule α: Vi∗ ← Fi∗ ∧ ¬Do(Vi = t) ∧ ¬Do(Vi = f) for each equation Vi = Fi in M, where Vi∗ is a new symbol corresponding to Vi , and Fi∗ is a formula obtained from F by replacing every occurrence of endogenous atoms W with W ∗ . • rule α: Vi∗ ← Do(Vi = t) (4) for every Vi ∈ V . (Note that Do(Vi = t) is an atom, containing “=” as a part of the string.) Theorem 4 For any PCM M = hhU, V, F i, P (U )i and any subsets X, Y , Z of V , which are not neces- sarily disjoint from each other, ∗ PM (YX=x = y | Z = z) = PrPtwin M ∪Do(X=x) [Y = y | Z = z], where Do(X = x) is {α : Do(Xi = xi ) | i = 1, . . . , |X|}. Readers who are familiar with the twin network method for counterfactual reasoning (Balke and Pearl 1994) would notice that Ptwin M ∪ Do(X = x) represents the twin network obtained from M, where starred atoms represent the counterfactual world. For the Firing Squad example, Ptwin MF S is the union of PMF S and the set of rules α : C ∗ ← U, not Do(C = t), not Do(C = f) α : A∗ ← C ∗ , not Do(A = t), not Do(A = f) α : A∗ ← W, not Do(A = t), not Do(A = f) α : B ∗ ← C ∗ ∧ ¬Do(B = t) ∧ ¬Do(B = f) α : D∗ ← (A∗ ∨ B ∗ ) ∧ ¬Do(D = t) ∧ ¬Do(D = f) and rules (4) for Vi ∈ {C, A, B, D}. In accordance with Theorem 4, ∗ (1 − p)q PrPtwin ∪{α:Do(A=f )} [D = f | D = t] = . M FS 1 − (1 − p)(1 − q) The LPMLN representation is similar to the one in (Baral and Hunsaker 2007), which turns PCM into P-log. However, the LPMLN representation is simpler; we require neither auxiliary predicates, such as intervene and obs, nor strong negation. 4.5 Other Related Work In (Lee and Wang 2015) it is shown that a version of ProbLog from (Fierens et al. 2013) can be embedded in LPMLN . This result can be extended to embed Logic Programs with Annotated Disjunctions (LPAD) in LPMLN based on the fact that any LPAD program can be 12 J. Lee and Y. Meng and Y. Wang further turned into a ProbLog program by eliminating disjunctions in the heads (Gutmann 2011, Section 3.3). It is known that LPAD is related to several other languages. In (Vennekens et al. 2004), it is shown that Poole’s ICL (Poole 1997) can be viewed as LPAD, and that acyclic LPAD pro- grams can be turned into ICL. This indirectly tells us how ICL can be embedded in LPMLN . CP-logic (Vennekens et al. 2009) is a probabilistic extension of FO(ID) (Denecker and Ternovska 2007). It is shown in (Vennekens et al. 2006), that CP-logic “almost completely coincides” with LPAD. P-log (Baral et al. 2009) is another language whose logical foundation is answer set pro- grams. Like LPMLN , it considers the possible worlds to be answer sets, which represent an agent’s rational beliefs, rather than any interpretations. The difference is that P-log’s proba- bilistic foundation is Causal Bayesian Networks, whereas Markov Logic serves as the prob- abilistic foundation of LPMLN . P-log is distinct from other earlier work in that it allows for expressing probabilistic nonmonotonicity, the ability of the reasoner to change its probabilis- tic model as a result of new information. However, inference in the implementation of P-log is not scalable as it has to enumerate all stable models. PrASP (Nickles and Mileo 2014) is a recent language similar to LPMLN in that the proba- bility distribution is obtained from the weights of the formulas. In addition, (Ng and Subrah- manian 1994) and (Saad and Pontelli 2005) introduce other probabilistic extensions of stable model semantics. While the study of more precise relationships between LPMLN and the above languages is future work, one notable distinction is that LPMLN uses Markov Logic as a monotonic basis, similar to the way ASP uses SAT as a monotonic basis. Most of the languages are meaning- ful only when the knowledge base is consistent, and thus do not address the inconsistency handling as in LPMLN . 5 Conclusion LPMLN is a simple, intuitive approach to combine both ASP and MLNs. LPMLN provides a simple solution to inconsistency handling in ASP, especially when ASP knowledge bases are combined from different sources. While MLN is an undirected approach, LPMLN is a directed approach, where the direc- tionality comes from the stable model semantics. This makes LPMLN closer to Pearl’s causal models and ProbLog. The work presented here calls for more future work. Obviously, there are many existing languages that we did not formally compare with LPMLN . While a fragment of LPMLN can be computed by existing implementations of and MLNs, one may design a native computation method for the general case. The close relationship between LPMLN and MLNs may tell us how to apply machine learning methods developed for MLNs to work with LPMLN programs. Acknowledgements We are grateful to Michael Bartholomew, Amelia Harrison, and the anonymous referees for their useful comments. This work was partially supported by the Na- tional Science Foundation under Grant IIS-1319794, South Korea IT R&D program MKE/KIAT 2010-TD-300404-001, and ICT R&D program of MSIP/IITP 10044494 (WiseKB). Markov Logic Style Weighted Rules under the Stable Model Semantics 13 References BALDUCCINI , M. AND G ELFOND , M. 2003. Logic programs with consistency-restoring rules3 . In Working Notes of the AAAI Spring Symposium on Logical Formalizations of Commonsense Reason- ing. BALKE , A. AND P EARL , J. 1994. Counterfactual probabilities: Computational methods, bounds and applications. In Proceedings of the Tenth international conference on Uncertainty in artificial intel- ligence. Morgan Kaufmann Publishers Inc., 46–54. BARAL , C., G ELFOND , M., AND RUSHTON , J. N. 2009. Probabilistic reasoning with answer sets. TPLP 9, 1, 57–144. BARAL , C. AND H UNSAKER , M. 2007. Using the probabilistic logic programming language P-log for causal and counterfactual reasoning and non-naive conditioning. In IJCAI. 243–249. BAUTERS , K., S CHOCKAERT, S., D E C OCK , M., AND V ERMEIR , D. 2010. Possibilistic answer set programming revisited. In 26th Conference on Uncertainty in Artificial Intelligence (UAI 2010). B OCHMAN , A. AND L IFSCHITZ , V. 2015. Pearl’s causality in a logical setting. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI). D ENECKER , M. AND T ERNOVSKA , E. 2007. Inductive situation calculus. Artificial Intelli- gence 171, 5-6, 332–360. FABER , W., L EONE , N., AND P FEIFER , G. 2004. Recursive aggregates in disjunctive logic programs: Semantics and complexity. In Proceedings of European Conference on Logics in Artificial Intelli- gence (JELIA). F ERRARIS , P. 2005. Answer sets for propositional theories. In Proceedings of International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR). 119–131. F ERRARIS , P., L EE , J., L IERLER , Y., L IFSCHITZ , V., AND YANG , F. 2012. Representing first-order causal theories by logic programs. TPLP 12, 3, 383–412. F IERENS , D., VAN DEN B ROECK , G., R ENKENS , J., S HTERIONOV, D., G UTMANN , B., T HON , I., JANSSENS , G., AND D E R AEDT, L. 2013. Inference and learning in probabilistic logic programs using weighted boolean formulas. Theory and Practice of Logic Programming, 1–44. G UTMANN , B. 2011. On continuous distributions and parameter estimation in probabilistic logic programs. Ph.D. thesis, KU Leuven. L EE , J. 2005. A model-theoretic counterpart of loop formulas. In Proceedings of International Joint Conference on Artificial Intelligence (IJCAI). Professional Book Center, 503–508. L EE , J. AND L IFSCHITZ , V. 2003. Loop formulas for disjunctive logic programs. In Proceedings of the 19th International Conference on Logic Programming (ICLP). 451–465. L EE , J. AND WANG , Y. 2015. A probabilistic extension of the stable model semantics. In International Symposium on Logical Formalization of Commonsense Reasoning, AAAI 2015 Spring Symposium Series. To appear. L IN , F. AND Z HAO , Y. 2004. ASSAT: Computing answer sets of a logic program by SAT solvers. Artificial Intelligence 157, 115–137. M C C AIN , N. AND T URNER , H. 1997. Causal theories of action and change. In Proceedings of National Conference on Artificial Intelligence (AAAI). 460–465. N G , R. AND S UBRAHMANIAN , V. 1994. Stable semantics for probabilistic deductive databases. In- formation and computation 110, 1, 42–83. N ICKLES , M. AND M ILEO , A. 2014. Probabilistic inductive logic programming based on answer set programming. N IEMEL Ä , I. AND S IMONS , P. 2000. Extending the Smodels system with cardinality and weight constraints. In Logic-Based Artificial Intelligence, J. Minker, Ed. Kluwer, 491–521. P EARL , J. 2000. Causality: models, reasoning and inference. Vol. 29. Cambridge Univ Press. 3 http://www.krlab.cs.ttu.edu/papers/download/bg03.pdf 14 J. Lee and Y. Meng and Y. Wang P ELOV, N., D ENECKER , M., AND B RUYNOOGHE , M. 2007. Well-founded and stable semantics of logic programs with aggregates. TPLP 7, 3, 301–353. P OOLE , D. 1997. The independent choice logic for modelling multiple agents under uncertainty. Arti- ficial Intelligence 94, 7–56. S AAD , E. AND P ONTELLI , E. 2005. Hybrid probabilistic logic programming with non-monotoic negation. In Proceedings of the 21st International Conference on Logic Programming (ICLP). S ATO , T. 1995. A statistical learning method for logic programs with distribution semantics. In Pro- ceedings of the 12th International Conference on Logic Programming (ICLP). 715–729. S ON , T. C., P ONTELLI , E., AND T U , P. H. 2006. Answer sets for logic programs with arbitrary abstract constraint atoms. In Proceedings, The Twenty-First National Conference on Artificial Intelligence (AAAI). V ENNEKENS , J., D ENECKER , M., AND B RUYNOOGHE , M. 2006. Representing causal information about a probabilistic process. In Logics In Artificial Intelligence. 452–464. V ENNEKENS , J., D ENECKER , M., AND B RUYNOOGHE , M. 2009. CP-logic: A language of causal probabilistic events and its relation to logic programming. TPLP 9, 3, 245–308. V ENNEKENS , J., V ERBAETEN , S., B RUYNOOGHE , M., AND A, C. 2004. Logic programs with an- notated disjunctions. In Proceedings of the 20th International Conference on Logic Programming (ICLP). 431–445.