Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence

Handling Uncertainty in Answer Set Programming

Yi Wang and Joohyung Lee School of Computing, Informatics, and Decision Systems Engineering Arizona State University, Tempe, USA {ywang485, joolee}@asu.edu

Abstract Language LPMLN We present a probabilistic extension of logic programs un- Since a Markov Logic Network is based on the standard der the , inspired by the concept of first-order logic semantics, it “has the drawback that it can- Markov Logic Networks. The proposed language takes ad- not express (non-ground) inductive definitions” (Fierens et vantage of both formalisms in a single framework, allowing al. 2013). Consider the following domain description (“α” us to represent commonsense reasoning problems that require denotes “hard weight”). both logical and probabilistic reasoning in an intuitive and w : Edge(1, 2) elaboration tolerant way. 1 w2 : Edge(2, 3) ... Introduction α : Path(x, y) ← Edge(x, y). Answer Set Programming (ASP) is a successful logic pro- α : Path(x, y) ← Path(x, z), Path(z, y). gramming paradigm that takes advantage of nonmonotonic- The above weighted rules are intended to describe proba- ity of the underlying semantics, the stable model semantics. bilistic reachability in a graph, which is induced by the prob- Many useful knowledge representation constructs and ef- abilities of the involved edges. The relation Path, describing ficient solvers allow ASP to handle various commonsense the reachability between two vertices, is supposed to be the reasoning problems elegantly and efficiently. However, dif- transitive closure of the relation Edge. However, under the ficulty still remains when it comes to domains with uncer- MLN semantics, this is not the case. tainty. Imprecise and vague information cannot be handled We propose the language LPMLN, which overcomes such well since the stable model semantics is mainly restricted MLN to Boolean values. Further, probabilistic information cannot a limitation. The syntax of an LP program is essentially be handled since the stable model semantics does not distin- the same as that of an MLN instance, except that weighted guish which stable models are more likely to be true. formulas are replaced by weighted rules. To address the first aspect of the issue, several approaches Similar to MLN, the weight of each rule can be either to incorporating fuzzy logic into ASP have been proposed, a real number, or the symbol α that marks a rule a “hard such as (Lukasiewicz 2006). However, most of the work rule.” The weight of each interpretation is obtained from the is limited to simple rules. In our previous work (Lee and weights of the rules that form the maximal subset of the pro- Wang 2014), we proposed a stable model semantics for gram for which the interpretation is a stable model. fuzzy propositional formulas, which properly generalizes More precisely, we assume a finite first-order signature σ that contains no function constants of positive arity, so that both fuzzy logic and the Boolean stable model semantics, MLN as well as many existing approaches to combining them. any non-ground LP program can be identified with The resulting language combines the many-valued nature of its ground instance. Without loss of generality, we con- fuzzy logic and the nonmonotonicity of stable model seman- sider ground (i.e., variable-free) LPMLN programs. For any MLN tics, and consequently shows competence in commonsense ground LP program P of signature σ, consisting of a set reasoning involving fuzzy values. of weighted rules w : R, and any Herbrand interpretation I In this work, we focus on the other aspect of the is- of σ, we define PI to be the set of rules in P which are sat- sue, namely handling probabilistic information in common- isfied by I. The weight of I, denoted by WP(I), is defined sense reasoning. We adapt the idea of Markov Logic Net- as ! works (MLN) (Richardson and Domingos 2006), a well- X known approach to combining first-order logic and proba- WP(I) = exp w bilistic graphical models in a single framework, to the con- w:R ∈ P R∈PI text of . The resulting language LPMLN if I is a stable model of ; otherwise W (I) = 0. The combines the attractive features of each of the stable model PI P probability of I under , denoted P r [I], is defined as semantics and MLN. P P W (I) Copyright c 2015, Association for the Advancement of Artificial P r [I] = lim P Intelligence (www.aaai.org). All rights reserved. P α→∞ P J∈PW WP(J)

4218 the elaboration has a new minimal plan containing 11 ac- tions only, including two steps in which the wolf does not eat the sheep when the farmer is not around. We formal- ized this domain in LPMLN, and, based on the reduction of LPMLN to MLN, used Alchemy to check that the probability of the success of this plan is p × p and that of the original 17 Figure 1: The transition system with probabilistic effects, step plan is 1. defined by LPMLN semantics (a) and MLN semantics (b) Discussion MLN where PW is the set of all Herbrand interpretations of σ. LP is related to many earlier work. Only a few of them MLN are mentioned here due to lack of space. It is not difficult Inductive definitions are correctly handled in LP to embed ProbLog (Raedt, Kimmig, and Toivonen 2007) in since it adopts the stable model semantics in place of the LPMLN. The language is also closely related to P-log (Baral, standard first-order logic semantics in MLN. For instance, MLN the weighted rules given at the beginning of this section Gelfond, and Rushton 2009). The LP formalization of yields the expected result under the LPMLN semantics. probabilistic transition systems is related to PC+ (Eiter and Lukasiewicz 2003), which extends C+ for Any logic program under the stable model semantics can probabilistic reasoning about actions. be embedded in LPMLN by assigning the hard weight to each MLN The work presented here calls for more future work. rule. MLN can also be embedded in LP via choice for- MLN MLN One may design a native computation algorithm for LP mulas which exempt atoms from minimization. LP pro- which would be feasible to handle certain “non-tight” pro- grams can be turned into MLN instances via the concept of grams. We expect many results established in ASP may loop formulas (Ferraris, Lee, and Lifschitz 2006). This result carry over to MLN, and vice versa, which may provide a allows us to use an existing implementation of MLN, such as new opportunity for probabilistic answer set programming. Alchemy, to effectively compute “tight” LPMLN programs. Acknowledgements We are grateful to Chitta Baral, MLN Michael Bartholomew, Amelia Harrison, Vladimir Lifs- Probabilistic Transitions by LP chitz, Yunsong Meng, and the anonymous referees for their useful comments. This work was partially supported by the LPMLN can be used to model transition systems where ac- National Science Foundation under Grant IIS-1319794 and tions may have probabilistic effects. For example, the tran- by the South Korea IT R&D program MKE/KIAT 2010-TD- sition system shown in Figure 1(a) can be encoded as the 300404-001, and the Brain Pool Korea program. following LPMLN program. References ln(λ): Auxi α : {Pi+1} ← Pi ln(1 − λ): ← Auxi α : {NPi+1} ← NPi Baral, C.; Gelfond, M.; and Rushton, J. N. 2009. Probabilistic α : ← Pi, NPi α : {Ai} reasoning with answer sets. TPLP 9(1):57–144. α : ← not Pi, not NPαi : {P0} Eiter, T., and Lukasiewicz, T. 2003. Probabilistic reasoning α : Pi+1 ← Ai, Auxiα : {NP0} about actions in nonmonotonic causal theories. In Proceedings Here i is a schematic variable ranging over Nineteenth Conference on Uncertainty in Artificial Intelligence (UAI-2003), 192–199. Morgan Kaufmann Publishers. {0, . . . , maxstep − 1}. The atom Auxi represents the Ferraris, P.; Lee, J.; and Lifschitz, V. 2006. A generalization probabilistic choice for the success of action Ai. The 3rd and 4th rules say that P and NP are complementary. of the Lin-Zhao theorem. Annals of Mathematics and Artificial i i Intelligence 47:79–101. The 5th rule defines the probabilistic effect of Ai. The 6th and 7th rules represent the commonsense law of Fierens, D.; Van den Broeck, G.; Renkens, J.; Shterionov, D.; inertia, where we use {H} ← Body to denote the rule Gutmann, B.; Thon, I.; Janssens, G.; and De Raedt, L. 2014. H ← Body, not not H. The last three rules specify that the Inference and learning in probabilistic logic programs using execution of A at each step and the initial value of P are weighted boolean formulas. TPLP, 44 pages. arbitrary. Lee, J., and Wang, Y. 2014. Stable models of fuzzy propo- Under the MLN semantics, the same program specifies a sitional formulas. In Proceedings of European Conference on different probabilistic transition system (Figure 1(b)), which Logics in Artificial Intelligence (JELIA), 326–339. is not aligned with the commonsense understanding of the Lukasiewicz, T. 2006. Fuzzy description logic programs under description. In this transition system, fluents can change ar- the answer set semantics for the semantic web. In Eiter, T.; bitrarily even when no relevant actions are executed. Franconi, E.; Hodgson, R.; and Stephens, S., eds., RuleML, 89– As an application of the idea of using LPMLN to define 96. IEEE Computer Society. probabilistic transition systems, a probabilistic variant of the Raedt, L. D.; Kimmig, A.; and Toivonen, H. 2007. ProbLog: Wolf, Sheep and Cabbage puzzle can be encoded in LPMLN. A probabilistic and its application in link discovery. In We consider an elaboration in which with some probabil- IJCAI, 2462–2467. ity p, eating does not happen even when the farmer is not Richardson, M., and Domingos, P. 2006. Markov logic net- present. While the minimal length plan for the original puz- works. Machine Learning 62(1-2):107–136. zle involves 17 actions of loading, moving and unloading,

4219