# singleshot_epistemic_logic_program_solving__77b0a0b2.pdf Single-Shot Epistemic Logic Program Solving Manuel Bichler, Michael Morak, and Stefan Woltran TU Wien, Vienna, Austria {bichler,morak,woltran}@dbai.tuwien.ac.at Epistemic Logic Programs (ELPs) are an extension of Answer Set Programming (ASP) with epistemic operators that allow for a form of meta-reasoning, that is, reasoning over multiple possible worlds. Existing ELP solving approaches generally rely on making multiple calls to an ASP solver in order to evaluate the ELP. However, in this paper, we show that there also exists a direct translation from ELPs into non-ground ASP with bounded arity. The resulting ASP program can thus be solved in a single shot. We then implement this encoding method, using recently proposed techniques to handle large, non-ground ASP rules, into a prototype ELP solving system. This solver exhibits competitive performance on a set of ELP benchmark instances. 1 Introduction Epistemic Logic Programs (ELPs) are an extension of the well-established formalism of Answer Set Programming (ASP), a generic, fully declarative logic programming language that allows us to encode problems in such a way that the resulting answers (called answer sets) directly correspond to solutions of the encoded problem [Brewka et al., 2011]. Negation in ASP is generally interpreted according to the stable model semantics [Gelfond and Lifschitz, 1988], that is, as negation-as-failure, also called default negation. The default negation a of an atom a is true if there is no justification for a in the same answer set, making it a local operator in the sense that it is defined relative to the same answer set. ELPs, on the other hand, extend ASP with the epistemic negation operator not that allows for a form of meta-reasoning, that is, reasoning over multiple answer sets. Intuitively, an epistemically negated atom not a expresses that a cannot be proven true, that is, it is false in at least one answer set. Thus, epistemic negation is defined relative to a collection of answer sets, referred to as a world view. The main reasoning task for ELPs, namely checking that a world view exists, is Σ3 Pcomplete [Shen and Eiter, 2016], one level higher on the polynomial hierarchy than solving ground ASP programs [Eiter and Gottlob, 1995]. Michael Gelfond [1991; 1994] recognized epistemic negation as a desired construct for ASP early on and introduced the modal operators K ( known or provably true ) and M ( possible or not provably false ) to address this. Ka and Ma stand for not a and not a, respectively. Example 1. A classical example for the use of epistemic negation is the presumption of innocence rule innocent(X ) not guilty(X ), namely: a person is innocent if they cannot be proven guilty. Renewed interest in recent years has revealed several flaws in the original semantics, and several approaches (cf. e.g. [Gelfond, 2011; Truszczynski, 2011; Kahl, 2014; del Cerro et al., 2015; Shen and Eiter, 2016]) aimed to refine them in such a way that unintended world views are eliminated. In this work, we will settle on the semantics proposed by Shen and Eiter [2016]. The flurry of new research also led to the development of ELP solving systems [Kahl et al., 2015; Son et al., 2017]. Such solvers employ readily available, highly efficient ASP systems like clingo [Gebser et al., 2012a; 2014] and WASP [Alviano et al., 2013], especially making use of the former solver s multi-shot solving functionality. However, these ELP solving systems rely on ground ASP programs when calling the ASP solver, which, for complexitytheoretic reasons, generally requires multiple calls in order to check for world view existence. Contributions. Our contributions in this paper are twofold: Firstly, we propose a novel translation from ELPs to ASP programs using large non-ground ASP rules, such that the ELP can be solved by an ASP solving system in a single shot. This is done via a recently proposed encoding technique [Bichler et al., 2016b] that uses large ASP rules to formulate complex checks. This technique builds on a result by Eiter et al. [2007] that states that evaluating non-ground ASP programs with bounded predicate arity is Σ3 P-complete, which matches the complexity of evaluating ELPs. Our proposed translation is therefore optimal from a complexity-theoretic point of view. From a practical point of view, such an encoding avoids multiple calls to the ASP solver. State-of-the-art systems use sophisticated heuristics and learning, and multiple calls might result in a loss of knowledge about the problem instance, which the solver has already learned. We further discuss how our encoding needs to be constructed in order to be useful in practice. In particular, in current ASP systems, non-ground ASP programs first need Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) to be grounded, that is, all variables need to be replaced by all allowed combinations of constants. Since our encoding makes use of large non-ground rules, a naive grounding will often not terminate, since there may be hundreds or thousands of variables in a rule. However, as proposed in [Bichler et al., 2016b], we make use of the lpopt rule decomposition tool [Bichler et al., 2016a] that splits such large rules into smaller ones that are more easily grounded, by making use of the concept of treewidth and tree decompositions [Bodlaender, 1993]. To use this tool to its full potential, the large rules we use in our encoding must be constructed carefully, in order for lpopt to split them up optimally. Secondly, we propose a prototype implementation of our ELP-to-ASP rewriting approach and combine it with the state-of-the-art ASP solving system clingo [Gebser et al., 2014] in order to evaluate its performance. We compare our system against EP-ASP [Son et al., 2017] on different benchmarks found in the literature. Our system shows competitive performance on these benchmarks, in particular on instances with good structural properties. 2 Preliminaries Answer Set Programming (ASP). A ground logic program (also called answer set program, ASP program, or simply program) is a pair Π = (A, R), where A is a set of propositional (i.e. ground) atoms and R is a set of rules of the form a1 al al+1, . . . , am, am+1, . . . , an; (1) where the comma symbol stands for conjunction, n m l and ai A for all 1 i n. Each rule r R of form (1) consists of a head H (r) = {a1, . . . , al} and a body given by B+(r) = {al+1, . . . , am} and B (r) = {am+1, . . . , an}. A literal ℓis either an atom a or its (default) negation a. A literal ℓis true in a set of atoms I A if ℓ= a and a I, or ℓ= a and a I; otherwise ℓis false in I. A set M A is a called a model of r if B+(r) M together with B (r) M = implies that H (r) M = . We denote the set of models of r by models(r) and the models of a logic program Π = (A, R) are given by models(Π) = T r R models(r). The GL-reduct ΠI of a ground logic program Π with respect to a set of atoms I A is the program ΠI = (A, {H (r) B+(r) | r R, B (r) I = }). Definition 2. [Gelfond and Lifschitz, 1988; 1991] M A is an answer set of a program Π if (1) M models(Π) and (2) there is no subset N M such that N models(ΠM). The set of answer sets of a program Π is denoted AS(Π). The consistency problem of ASP (decide whether, given Π, AS(Π) = ) is Σ2 P-complete [Eiter and Gottlob, 1995]. General non-ground logic programs differ from ground logic programs in that variables may occur in rules. Such rules are -quantified first-order implications of the form H1 Hk P1, . . . , Pn, N1, . . . , Nm where Hi, Pi and Ni are (non-ground) atoms. A non-ground atom A is of the form p(X, c) and consists of a predicate name p, as well as a sequence of variables X and constants c from a domain , with |X| + |c| being the arity of p. Let var(A) denote the set of variables X in a non-ground atom A. This notation naturally extends to sets. We will denote variables by capital letters, constants and predicates by lower-case words. A nonground rule can be seen as an abbreviation for all possible instantiations of the variables with domain elements from . This step is usually explicitly performed by a grounder that transforms a (non-ground) logic program into a set of ground rules of the form (1). Note that in general, such a ground program can be exponential in the size of the non-ground program. However, for non-ground programs of bounded arity, the consistency problem is Σ3 P-complete [Eiter et al., 2007]. Epistemic Logic Programs. A ground epistemic logic program (ELP) is a pair Π = (A, R), where A is a set or propositional atoms and R is a set of rules of the following form: a1 ak ℓ1, . . . , ℓm, ξ1, . . . , ξj, ξj+1, . . . , ξn, where each ai is an atom, each ℓi is a literal, and each ξi is an epistemic literal, that is, a formula not ℓ, where not is the epistemic negation operator, and ℓis a literal. W.l.o.g. we assume that no atom appears twice in a rule. Let elit(r) denote the set of all epistemic literals occurring in a rule r R. This notation naturally extends to programs. Let H (r) = {a1, . . . , ak}, and let B(r) = {ℓ1, . . . , ℓm, ξ1, . . . , ξj, ξj+1, . . . , ξn}, that is, the set of elements appearing in the rule body. In order to define the main reasoning tasks for ELPs, we recall the notion of the epistemic reduct [Shen and Eiter, 2016]. Let Φ elit(Π) (called a guess). The epistemic reduct ΠΦ of the program Π = (A, R) w.r.t. Φ consists of the rules {r | r R}, where r is defined as the rule r with all epistemic literals not ℓin Φ (resp. in elit(Π) \ Φ) replaced by (resp. ℓ). Note that ΠΦ is a logic program without epistemic negation1. This leads to the following, central definition. Definition 3. Let Φ be a guess. The set M = AS(ΠΦ) is called a candidate world view of Π iff 2. for each epistemic literal not ℓ Φ, there exists an answer set M M wherein ℓis false, and 3. for each epistemic literal not ℓ elit(Π) \ Φ, it holds that ℓis true in each answer set M M. Example 4. Let Π be the following ELP, with R = {r1, r2}: r1 : p not q r2 : q not p ELP Π has two candidate world views: (1) Φ = {not q} with AS(ΠΦ) = {{p}}; (2) Φ = {not p} with AS(ΠΦ) = {{q}}. The main reasoning task we treat in this paper is the world view existence problem (or ELP consistency), that is, given an ELP Π, decide whether a candidate world view exists. This problem is known to be ΣP 3 -complete [Shen and Eiter, 2016]. Tree Decompositions. A tree decomposition of a graph G = (V, E) is a pair T = (T, χ), where T is a rooted tree and χ is a labelling function over nodes t, with χ(t) V , such that the following holds: (i) for each v V there is a node t in T 1We interpret double negation according to [Faber et al., 2011]. Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) such that v χ(t); (ii) for each {v, w} E there is a node t in T such that {v, w} χ(t); and (iii) for all nodes r, s, and t in T, where s lies on the path from r to t, χ(r) χ(t) χ(s). The width of a tree decomposition is defined as the maximum cardinality of χ(t) minus one. The treewidth of a graph G is the minimum width over all tree decompositions of G. Trees have treewidth 1, cliques of size k have treewidth k. Finding a tree decomposition of minimal width is NP-hard in general. 3 Single-Shot ELP Solving In this section, we provide our novel translation for solving ELPs via a single call to an ASP solving system. The goal is to transform a given ELP Π to a non-ground ASP program Π with predicates of bounded arity, such that Π is consistent (i.e. it has a candidate world view) iff Π has at least one answer set. A standard ASP solver can then decide the consistency problem for the ELP Π in a single call, by solving Π . 3.1 Reducing ELPs to ASP Programs The reduction is based on an encoding technique proposed in [Bichler et al., 2016b], which uses large, non-ground rules. Given an ELP Π, the ASP program Π will roughly be constructed as follows. Π contains a guess part that chooses a set of epistemic literals from elit(Π), representing a guess Φ for Π. Then, the check part verifies that, for Φ, a candidate world exists. In all, the ASP program Π consists of five parts: Π = Π facts Π guess Π check 1 Π check 2 Π check 3, where the sub-program Π facts is a set of facts representing the ELP Π, and Π check i represents the part of the program that checks Condition i of Definition 3. We now proceed to the construction of the program Π . Let Π = (A, R) be the ELP to reduce from. To ease notation, let A = {a1, . . . , an}. The set of facts Π facts. Π facts represents basic knowledgeabout the ELP Π, plus some auxiliary facts, and is given as: atom(a), for each atom a A; elit(ℓ), for each epistemic literal not ℓ elit(Π)2; leq(0, 0), leq(0, 1), and leq(1, 1), representing the less or equal relation for Boolean values; and or(0, 0, 0), or(0, 1, 1), or(1, 0, 1), and or(1, 1, 1), representing the Boolean relation or. Sub-Program Π guess. This part of the program consists of a single, non-ground rule that guesses a subset of the epistemic literals (stored in predicate g) as follows: g(L, 1) g(L, 0) elit(L). Shorthands. Before defining the three check parts of the program, we will introduce some useful shorthands which will be used at several occasions. To this end, we use a context identifier C. We first define the following: HC val(A) v C(A, 1) v C(A, 0), 2Note that we use the literal ℓas an ASP constant. that is, HC val(A) guesses a truth assignment for some variable A and stores it in relation v C. We will often use variables X = {X1, . . . , Xn} or Y = {Y1, . . . , Yn} to represent a subset M of A, where assigning Xi to 1 characterizes ai M, and Xi = 0 otherwise. Let ai A v C(ai, Xi), that is, BC val(X) extracts the truth assignment from relation v C into the variables X as described above. Finally, for some rule r in Π, we define a formula Br sat(X, Y, S) that checks whether the rule r is satisfied in the epistemic reduct ΠΦ w.r.t. the guess Φ encoded in the relation g, when the negative body (resp. positive body and head) is evaluated over the set of atoms encoded by X (resp. Y). If the rule is satisfied, Br sat(X, Y, 1) should hold, and Br sat(X, Y, 0) otherwise. This is done as follows. Let r contain the variables {ai1, . . . , aim} (recall that no atom appears twice in a rule), where i1, . . . , im {1, . . . , n}. For ease of notation, we will use a four-ary or relation, which can easily be split into two of our three-ary or atoms using a helper variable T: or(W , X , Y , Z) or(W , X , T), or(T, Y , Z). The following is the central building block of our reduction: Br sat(X, Y, Rm) R0 = 0, aij H(r) or(Rj 1, Yij, Rj), aij B(r) or(Rj 1, 1 Yij, Rj), aij B(r) or(Rj 1, Xij, Rj), not aij B(r) g(aij, Nj), or(Nj, 1 Xij, Tj), or(Rj 1, 1 Tj, Rj), not aij B(r) g( aij, Nj), or(Nj, Yij, Tj), or(Rj 1, 1 Tj, Rj), not aij B(r) g(aij, Nj), or(Rj 1, Nj, 1 Yij, Rj), not aij B(r) g( aij, Nj), or(Rj 1, Nj, Xij, Rj). For a rule r, each big conjunction in the above formula encodes a reason for r to be satisfied. For example, the fifth line encodes the fact that rule r is true if the disjunct not aij is not satisfied, that is, if the epistemic literal not aij is part of the guess Φ, or the atom aij is false (represented by 1 Yij). Each disjunct of rule r is evaluated in this way, and the results are connected via the or relation. Therefore, Rm will be 1 if r is satisfied, and 0 otherwise, as desired. Finally, we define Bss(X, Y), which makes sure that the variables Y identify a strict subset of the atoms identified by X. Let Bss(X, Y) N0 = 0, Nn = 1, ai A leq(Yi, Xi), or(Ni 1, Xi Yi, Ni). We can now proceed with the remainder of our reduction. Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) Sub-Program Π check 1. This part of the program needs to check that, given the guess Φ made in Π guess, there exists at least one answer set of the epistemic reduct ΠΦ, as per Definition 3(1). Therefore, according to Definition 2, we need to find a set M A, such that (1) M is a model of ΠΦ, and (2) there is no proper subset of M that is a model of the GLreduct (ΠΦ)M. Π check 1 contains the following rules: Hcheck 1 val (A) atom(A); Bcheck 1 val (X), Br sat(X, X, 0), for each r R; and Bcheck 1 red . The first rule guesses a truth assignment for all atoms. The second rule verifies that there is no rule in ΠΦ that is violated by the candidate answer set M, represented by the variables X, guessed by the first rule. BC red checks whether a subset of M is a model of the GL-reduct (ΠΦ)M. To this end, let BC red BC val(X), Bss(X, Y), r R Br sat(X, Y, 1). The last big conjunction in BC red makes sure that the subset N M identified by the variables Y is indeed a model of every rule in the GL-reduct (ΠΦ)M. This completes Π check 1. Sub-Program Π check 2. This part needs to check that, for every epistemic literal not ℓ Φ, the epistemic reduct ΠΦ has some answer set wherein ℓis false. Π check 2 contains the following rules and facts, for each epistemic literal not ℓ elit(Π) (used as the context C so guesses are independent): Hℓ val(A) atom(A), g(ℓ, 1); vℓ(a, η), where η = 1 if ℓ= a, or η = 0 if ℓ= a; Bℓ val(X), Br sat(X, X, 0), for each r R; and Bℓ red. These rules guess, for each epistemic literal not ℓ Φ, a candidate answer set M wherein ℓis false, and then verify that M is indeed an answer set, using the same technique as in Π check 1. This ensures Condition 2 of Definition 3. Sub-Program Π check 3. Finally, this part needs to check that, for every epistemic literal not ℓ elit(Π) \ Φ, every answer set of ΠΦ satisfies ℓ. The construction makes use of the technique of saturation [Eiter and Gottlob, 1995]: Hcheck 3 val (A) atom(A); vcheck 3 (A, 0) sat, atom(A); vcheck 3 (A, 1) sat, atom(A); and sat. This setup checks that, for every candidate answer set M guessed in the first rule, the atom sat is derived. Since we are only interested in answer sets, we first check that M is indeed one, using the following rules, similarly to Π check 1: sat Bcheck 3 val (X), Br sat(X, X, 0), for each r R; and sat Bcheck 3 red . It now remains to check that in each answer set M (that is, where sat has not been derived yet) all epistemic literals not ℓare either in Φ, or otherwise ℓis true in M. This is done by adding the following rule to Π check 3: not a elit(Π) g(a, Na), vcheck3 (a, Xa), or(Na, Xa, 1), not a elit(Π) g( a, N a ), vcheck3 (a, X a ), or(N a , 1 X a , 1). This completes the reduction. The following result states that the above reduction is polynomial and correct. Theorem 5. Given an ELP Π, the reduction above runs in time O(e n), where n is the size of Π and e = |elit(Π)|, uses predicates of arity at most three, and is correct. Proof. (Idea). Correctness follows by construction; it can be verified that each of the three parts of the constructed program Π ensures precisely one of the three conditions that define a candidate world view. Each answer set A of Π is a witness for the fact that a guess Φ elit(Π) encoded in A indeed gives rise to a candidate world view. Predicates of arity at most three are used if the four-ary or relation is not materialized as an actual relation in ASP, but viewed as a shorthand for two connected ternary or relations. The reduction s runtime (and output size) can be shown to be in O(e n) by noting the fact that the construct Bred is of size linear in n (it precisely encodes each rule using the or predicates). Bred is then used once for each epistemic literal in Π (cf. check 2). Note that the above theorem shows that our reduction is indeed worst-case optimal as claimed in Section 1: checking consistency of non-ground, fixed-arity ASP programs is Σ3 Pcomplete, as is checking world-view existence for ELPs. Example 6. Recall program Π = (A, R) from Example 4. Let A = {a1, a2}, where a1 = p and a2 = q. Let rule r2 R contain the atoms {ai1, ai2}, where i1 = 2 and i2 = 1. We give the core construct, Br sat( , , ) for rule r2: Br2 sat(X1, X2, Y1, Y2, R2) or(0, Y2, R1), g(p, N2), or(N2, 1 X1, T2), or(R1, 1 T2, R2). 3.2 Using the Reduction in Practice As we have seen, using the construction in the previous subsection, we can solve the consistency problem for a given ELP via a single call to an ASP solving system. However, when trying this in practice, the performance is less than optimal, mainly for the following reason. At several points in the construction, large non-ground rules are used (i.e. where BC red appears in a rule body). As noted in Section 2, these rules need to be grounded, but may contain hundreds or thousands of variables, which need to be replaced by all possible combinations of constants; a hopeless task for ASP grounders. However, as noted in [Bichler et al., 2016b], such large rules can often be decomposed into smaller, more manageable rules, using the lpopt tool [Bichler et al., 2016a]. This tool roughly works as follows: (1) compute a rule graph Gr for each non-ground rule r, where there is a vertex for each Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) Figure 1: Creating a grid from chains. variable V in r, and there is an edge between V1 and V2, if the two variables appear together in an atom of r; then (2) compute a tree decomposition of Gr of minimal width; and finally, (3) in a bottom-up manner, output a rule for each node in the tree decomposition. The resulting rules each contain only as many variables as the treewidth of Gr (plus one), and, together, are equivalent to the original rule r. After this rule decomposition step, grounding now becomes much easier, since the number of variables in each rule is reduced. Note that, since finding optimal tree decompositions is NPhard, lpopt employs heuristics to find good decompositions. In our construction, BC red stands for a long rule body that basically encodes the entire input ELP Π. Each atom ai in Π is represented by the two variables Xi and Yi. If we represent Π as a graph GΠ, where each atom ai is a vertex, and there is an edge between two atoms if they appear together in a rule in Π, then this graph structure can be found (as a minor) in the rule graph of BC red. However, in addition, BC red also adds a series of or( , , ) atoms (via Bss(X, Y)), that introduce additional connections in the rule graph of BC red. These connections may increase the treewidth substantially. In fact, even if GΠ has a treewidth of 1, by introducing the additional connections in a bad way, the treewidth may increase arbitrarily: imagine that GΠ is a chain, depicted in black in Figure 1, and imagine the or( , , )-chain from Bss(X, Y) is inserted into GΠ, illustrated in pink. The treewidth now depends on the chain s length, and lpopt can no longer split the rule well. The solution to this problem is the following. Instead of constructing Bss(X, Y) as given in the construction above, first perform a tree decomposition on GΠ. Then, construct Bss(X, Y) along this tree decomposition in such a way that the or( , , ) atoms do not introduce additional edges into GΠ, therefore preserving the treewidth of GΠ. With this technique, the treewidth of BC red only depends on the treewidth of GΠ (and thus on the actual structure of Π), and not on the size of Π. This in turn allows lpopt to work efficiently. 3.3 Discussion As we have seen, the reduction proposed above allows us to solve ELPs via a single call to an ASP solving system. However, our encoding also has several other properties, which make it very flexible for use with, for example, different ASP semantics, or harder problems. A brief discussion follows. Other ASP Semantics. Apart from the original semantics for ASP (called stable model semantics, [Gelfond and Lifschitz, 1988; 1991]), several different semantics have been proposed that investigate how to interpret more advanced constructs in ASP, like double negation, aggregates, optimization, and more [Lifschitz et al., 1999; Pearce, 2006; Pelov et al., 2007; Ferraris et al., 2011; Faber et al., 2011; Shen et al., 2014]. Epistemic reducts may contain double negation, and we have opted to use the FLP semantics of [Faber et al., 2011], as used in [Shen and Eiter, 2016], to interpret this. The actual interpretation of double negation is encoded in the Br sat( , ) shorthand defined in our reduction. This construction is very flexible and can easily be modified to use different ASP semantics (e.g. [Lifschitz et al., 1999]). Enumeration of World Views. Modern ASP systems like clasp [Gebser et al., 2012b] contain several advanced features. One such feature is projection: given a set of atoms (or relations), the solver will output answer sets where all other atoms are projected away, and will also guarantee that there are no repetitions (even if multiple answer sets with the same assignment on the projected atoms exist), while still maintaining efficiency. This can be used to enumerate candidate world views by projecting away all relations in our encoding, except for g( ) and vcheck 1 ( ). When enumerating all projected answer sets in this way, our encoding yields all guesses together with their candidate world views (when grouped by g( )). 4 The selp System We implemented the reduction in the previous section as part of the single shot ELP solving toolbox selp, available at dbai.tuwien.ac.at/proj/selp. In addition, the toolbox features a grounder for ELPs and a grouping script which groups answer sets of the reduction into candidate world views (allowing for enumeration). The tools are implemented in python and depend on the parser generator LARK3, the rule decomposition tool lpopt [Bichler et al., 2016a], the tree decomposition tool htd_main [Abseher et al., 2017], and the ASP grounder gringo [Gebser et al., 2011]. Input Formats. The selp solver reads the EASP-not file format, which is a restriction of the ASP input language of gringo to plain ground logic programs as defined in Section 2, extended with the $not$ operator for epistemic negation. This allows us to encode ELPs as defined in Section 2. selp also supports EASP-KM, defined by adding the operators K$ and M$ instead of $not$. By allowing variables in body elements, both formats also have a non-ground version. The toolbox offers scripts to translate between the two formats. Toolbox. We briefly present the main building blocks of selp. easp Grounder.py takes as input a non-ground EASP-not program and outputs its equivalent ground form by rewriting it into an ASP program that the gringo grounder can understand and ground. This is done by encoding epistemic negation as predicate names and, after grounding, re-introducing epistemic negation where a placeholder predicate appears. Additionally, easp Grounder.py supports arithmetics and the sorts format [Kahl et al., 2015] as input. easp2asp.py is selp s key component. It takes a ground EASP-not program, and performs the reduction given in Section 3.1, also adhering to the practical considerations presented in Section 3.2, and finally outputs the resulting nonground logic program in the syntax of gringo. Optionally, additional clasp directives are generated to allow for enumeration as described in Section 3.3. group World Views.py takes as input clasp s output in JSON format, groups the answer sets into candidate world 3Available here: https://github.com/erezsh/lark Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) 5 10 15 20 25 10 2 number of students selp EP-ASP (a) Scholarship Eligibility 5 10 15 20 25 10 1 plan length selp EP-ASP (b) Yale Shooting Figure 2: Benchmark results. Missing points indicate timeouts. views according to their g( ) atoms, and outputs them in a human-readable format. Usage. Suppose the file problem.easp contains a nonground ELP encoding of a problem of interest and the file instance.easp contains a problem instance. In order to output all candidate world views, one would use the following command (flags -pas and --project enable projection of answer sets onto relevant predicates only. -n0 tells clasp to compute all answer sets, and --outf=2 to print in JSON format. lpopt is used to decompose long rule bodies. The --sat-prepro=3 flag is recommended by lpopt): cat problem.easp instance.easp | easp Grounder.py -s ELP | easp2asp.py -pas | lpopt | gringo | clasp -n0 --outf=2 --project --sat-prepro=3 | group World Views.py 5 Experimental Evaluation We tested our system selp against the state-of-the-art ELP solver, EP-ASP [Son et al., 2017], using three test sets. For every test set, we measured the time it took to solve the consistency problem. For selp, clasp was stopped after finding the first answer set. For EP-ASP, search was terminated after finding the first candidate world view4. Note that a single answer set of the selp system is enough to establish consistency of an input ELP. EP-ASP needs to compute a full candidate world view to be able to prove consistency. Experiments were run on a 2.1GHz AMD Opteron 6272 system with 224 GB of memory. Each process was assigned a maximum of 14 GB of RAM. For EP-ASP, we used the required clingo 4.5.3, since newer versions are incompatible with the solver. For selp, we used clingo 5.2.2, htd_main 1.2.0, and lpopt 2.2. The time it took EP-ASP to rewrite the input to its own internal format was not measured. EP-ASP was called with the preprocessing option for brave and cautious consequences on, since it always ran faster this way. The selp time is the sum of running times of its components. Benchmark Instances. We used three types of benchmarks, two coming from the ELP literature and one from the QSAT domain that contains structures of low treewidth5. Scholarship Eligibility (SE). This set of non-ground ELP programs is shipped together with EP-ASP. Its instances encode the scholarship eligibility problem for 1 to 25 students. 4Note that to have a fair comparison we disabled the subsetmaximality check on the guess that EP-ASP performs by default. 5Benchmark archive: dbai.tuwien.ac.at/proj/selp Yale Shooting (YS). This test set consists of 25 nonground ELP programs encoding a simple version of the Yale Shooting Problem, a conformant planning problem: the only uncertainty is whether the gun is initially loaded or not, and the only fluents are the gun s load state and whether the turkey is alive. Instances differ in the time horizon. We follow the ELP encoding by Kahl et al. [2015]. Tree QBFs (TQ). The hardness proof for ELP consistency [Shen and Eiter, 2016] relies on a reduction from certain QBFs with three quantifier blocks. We apply this reduction to the 14 Tree instances of QBFEVAL 16 [Pulina, 2016], available at http://www.qbflib.org/ family_detail.php?id Family=56, splitting each instance s variables into three random quantifier blocks. Results. The results for the first two sets are shown in Figure 2. selp solves all instances from (SE) within 30 seconds, while EP-ASP only solves 17 within the time limit of 8 hours. For (YS), on the other hand, selp is able to solve only 6 instances within the time limit of 30 minutes, whereas EP-ASP can solve 17. Finally, for (TQ), selp can solve 6 of the 14 instances within the time limit of 12 hours, whereas EP-ASP was unable to solve any instances at all. These results confirm that selp is highly competitive on well-structured problems: in the (SE) instances, knowledge about students is not interrelated, and hence the graph GΠ of the ground ELP Π consists of one component for each student, thus having constant treewidth. The (TQ) instances keep their constant treewidth thanks to the fact that both the reduction from QBF to ELP and from ELP to non-ground ASP (cf. Section 3.2) preserve the low treewidth of the original QBF instance. Different from selp, EP-ASP is not designed to exploit such structural information of ELPs and, consequently, performs worse than selp in these benchmarks. On the other hand, (YS) contains instances of high treewidth, even though it does not depend on the horizon. EP-ASP is therefore able to outperform selp on such instances. A similar observation can be made for the Bomb in the Toilet problem, as benchmarked by Son et al. [2017], which inherently contains a huge clique structure. selp is not designed to solve such instances, and is therefore most suited for ELPs of low treewidth, where it efficiently exploits the problem structure. 6 Conclusions In this paper, we have seen that ELPs can be encoded into ASP programs using long non-ground rules, such that a single call to an ASP solver is sufficient to evaluate them. A prototype ELP solver implementation, selp, performs particularly well on problems whose internal structure is of low treewidth. A combined solver that either calls selp or another state-of-the-art solver based on the treewidth of the input may therefore lead to even better overall performance. Another topic for future work is that, under the FLP semantics, checking whether a given atom a is true in all candidate world views with a subset-maximal guess Φ is known to be Σ4 P-complete [Shen and Eiter, 2016]. To solve this problem, advanced optimization features of state-of-the-art ASP solvers could allow us to encode this subset-maximality condition, while leaving the core of our encoding unchanged. Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18) Acknowledgements This work was funded by the Austrian Science Fund (FWF), grant number Y698. [Abseher et al., 2017] Michael Abseher, Nysret Musliu, and Stefan Woltran. htd - A free, open-source framework for (customized) tree decompositions and beyond. In Proc. CPAIOR, pages 376 386, 2017. [Alviano et al., 2013] Mario Alviano, Carmine Dodaro, Wolfgang Faber, Nicola Leone, and Francesco Ricca. WASP: A native ASP solver based on constraint learning. In Proc. LPNMR, pages 54 66, 2013. [Bichler et al., 2016a] Manuel Bichler, Michael Morak, and Stefan Woltran. lpopt: A rule optimization tool for answer set programming. In Proc. LOPSTR, pages 114 130, 2016. [Bichler et al., 2016b] Manuel Bichler, Michael Morak, and Stefan Woltran. The power of non-ground rules in answer set programming. TPLP, 16(5-6):552 569, 2016. [Bodlaender, 1993] Hans L. Bodlaender. A tourist guide through treewidth. Acta Cybern., 11(1-2):1 21, 1993. [Brewka et al., 2011] Gerhard Brewka, Thomas Eiter, and Miroslaw Truszczynski. Answer set programming at a glance. Commun. ACM, 54(12):92 103, 2011. [del Cerro et al., 2015] Luis Fariñas del Cerro, Andreas Herzig, and Ezgi Iraz Su. Epistemic equilibrium logic. In Proc. IJCAI, pages 2964 2970, 2015. [Eiter and Gottlob, 1995] Thomas Eiter and Georg Gottlob. On the computational cost of disjunctive logic programming: Propositional case. Ann. Math. Artif. Intell., 15(34):289 323, 1995. [Eiter et al., 2007] Thomas Eiter, Wolfgang Faber, Michael Fink, and Stefan Woltran. Complexity results for answer set programming with bounded predicate arities and implications. Ann. Math. Artif. Intell., 51(2-4):123 165, 2007. [Faber et al., 2011] Wolfgang Faber, Gerald Pfeifer, and Nicola Leone. Semantics and complexity of recursive aggregates in answer set programming. Artif. Intell., 175(1):278 298, 2011. [Ferraris et al., 2011] Paolo Ferraris, Joohyung Lee, and Vladimir Lifschitz. Stable models and circumscription. Artif. Intell., 175(1):236 263, 2011. [Gebser et al., 2011] Martin Gebser, Roland Kaminski, Arne König, and Torsten Schaub. Advances in gringo series 3. In Proc. LPNMR, pages 345 351, 2011. [Gebser et al., 2012a] Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub. Answer Set Solving in Practice. Morgan & Claypool, 2012. [Gebser et al., 2012b] Martin Gebser, Benjamin Kaufmann, and Torsten Schaub. Conflict-driven answer set solving: From theory to practice. Artif. Intell., 187:52 89, 2012. [Gebser et al., 2014] Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub. clingo = ASP + control: Preliminary report. In ICLP Tech.Comm., 2014. [Gelfond and Lifschitz, 1988] Michael Gelfond and Vladimir Lifschitz. The stable model semantics for logic programming. In Proc. ICLP/SLP, pages 1070 1080, 1988. [Gelfond and Lifschitz, 1991] Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Comput., 9(3/4):365 386, 1991. [Gelfond, 1991] Michael Gelfond. Strong introspection. In Proc. AAAI, Volume 1, pages 386 391, 1991. [Gelfond, 1994] Michael Gelfond. Logic programming and reasoning with incomplete information. Ann. Math. Artif. Intell., 12(1-2):89 116, 1994. [Gelfond, 2011] Michael Gelfond. New semantics for epistemic specifications. In Proc. LPNMR, pages 260 265, 2011. [Kahl et al., 2015] Patrick Thor Kahl, Richard Watson, Evgenii Balai, Michael Gelfond, and Yuanlin Zhang. The language of epistemic specifications (refined) including a prototype solver. J. Log. Comput., 25, 2015. [Kahl, 2014] Patrick Thor Kahl. Refining the Semantics for Epistemic Logic Programs. Ph D thesis, Texas Tech University, Texas, USA, 2014. [Lifschitz et al., 1999] Vladimir Lifschitz, Lappoon R. Tang, and Hudson Turner. Nested expressions in logic programs. Ann. Math. Artif. Intell., 25(3-4):369 389, 1999. [Pearce, 2006] David Pearce. Equilibrium logic. Ann. Math. Artif. Intell., 47(1-2):3 41, 2006. [Pelov et al., 2007] Nikolay Pelov, Marc Denecker, and Maurice Bruynooghe. Well-founded and stable semantics of logic programs with aggregates. TPLP, 7(3):301 353, 2007. [Pulina, 2016] Luca Pulina. The ninth QBF solvers evaluation - preliminary report. In Proc. QBF, 2016. [Shen and Eiter, 2016] Yi-Dong Shen and Thomas Eiter. Evaluating epistemic negation in answer set programming. Artif. Intell., 237:115 135, 2016. [Shen et al., 2014] Yi-Dong Shen, Kewen Wang, Thomas Eiter, Michael Fink, Christoph Redl, Thomas Krennwallner, and Jun Deng. FLP answer set semantics without circular justifications for general logic programs. Artif. Intell., 213:1 41, 2014. [Son et al., 2017] Tran Cao Son, Tiep Le, Patrick Thor Kahl, and Anthony P. Leclerc. On computing world views of epistemic logic programs. In Proc. IJCAI, pages 1269 1275, 2017. [Truszczynski, 2011] Miroslaw Truszczynski. Revisiting epistemic specifications. In Logic Programming, Knowledge Representation, and Nonmonotonic Reasoning - Essays Dedicated to Michael Gelfond on the Occasion of His 65th Birthday, 2011. Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18)