<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">The SLGAD Procedure for Inference on Logic Programs with Annotated Disjunctions</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author role="corresp">
							<persName><forename type="first">Fabrizio</forename><surname>Riguzzi</surname></persName>
							<email>fabrizio.riguzzi@unife.it</email>
							<affiliation key="aff0">
								<orgName type="laboratory">ENDIF</orgName>
								<orgName type="institution">Università di Ferrara</orgName>
								<address>
									<addrLine>Via Saragat, 1</addrLine>
									<postCode>44100</postCode>
									<settlement>Ferrara</settlement>
									<country key="IT">Italy</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">The SLGAD Procedure for Inference on Logic Programs with Annotated Disjunctions</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">52BA0DEF974ACE0B6EB74CB7455E8F0C</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-19T17:52+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<textClass>
				<keywords>
					<term>Probabilistic Logic Programming</term>
					<term>Well Founded Semantics</term>
					<term>Logic Programs with Annotated Disjunctions</term>
					<term>SLG resolution</term>
				</keywords>
			</textClass>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Logic Programs with Annotated Disjunctions (LPADs) allow to express probabilistic information in logic programming. The semantics of an LPAD is given in terms of well founded models of the normal logic programs obtained by selecting one disjunct from each ground LPAD clause. The paper presents SLGAD resolution that computes the (conditional) probability of a ground query from an LPAD and is based on SLG resolution for normal logic programs. The performances of SLGAD are evaluated on classical benchmarks for normal logic programs under the well founded semantics, namely the stalemate game and the ancestor relation. SLGAD is compared with Cilog2 and SLDNFAD, an algorithm based on SLDNF, on the programs that are modularly acyclic. The results show that SLGAD deals correctly with cyclic programs and, even if it is more expensive than SLDNFAD on problems where SLDNFAD succeeds, is faster than Cilog2 when the query is true in an exponential number of instances.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>The combination of logic and probability is a long standing problem in philosophy and artificial intelligence, dating back to <ref type="bibr" target="#b1">[2]</ref>. Recently, the work on this topic has thrived leading to the proposal of novel languages that combine relational and statistical aspects, such as Independent Choice Logic, ProbLog, Stochastic Logic Programs, Bayesian Logic Programs, PRISM and CLP(BN ). Each of these languages has a different semantics that makes it suitable for different domains: the identification of the best setting for each language is currently under study.</p><p>When we are reasoning about actions and effects and we have causal independence among different causes for the same effect, Logic Programs with Annotated Disjunctions (LPADs) <ref type="bibr" target="#b14">[15]</ref> seem particularly suitable. They extend logic programs by allowing program clauses to be disjunctive and by annotating each atom in the head with a probability. A clause can be causally interpreted in the following way: the truth of the body causes the truth of one of the atoms in the head non-deterministically chosen on the basis of the annotations. The semantics of LPADs is given in terms of the well founded model <ref type="bibr" target="#b12">[13]</ref> of the normal logic programs obtained by selecting one head for each disjunctive clause.</p><p>In order to compute the (conditional) probability of queries, various options are possible. <ref type="bibr" target="#b13">[14]</ref> showed that ground acyclic LPADs can be converted to Bayesian networks. However, the conversion requires the complete grounding of the LPAD, thus making the technique impractical.</p><p>[14] also showed that acyclic LPADs can be converted to Independent Choice Logic (ICL) programs. Thus inference can be performed by using the Cilog2 system <ref type="bibr" target="#b8">[9]</ref>. An algorithm for performing inference directly with LPADs was proposed in <ref type="bibr" target="#b9">[10]</ref>. The algorithm, that will be called SLDNFAD in the following, is an extension of SLDNF derivation and uses Binary Decision Diagrams, similarly to what is presented in <ref type="bibr" target="#b7">[8]</ref> for the ProbLog language. Both Cilog2 and SLDNFAD are complete and correct for programs for which the Clark's completion semantics <ref type="bibr" target="#b6">[7]</ref> and the well founded semantics coincide, as for acyclic <ref type="bibr" target="#b0">[1]</ref> and modularly acyclic programs <ref type="bibr" target="#b11">[12]</ref>.</p><p>In this paper we present the SLGAD top-down procedure for performing inference with possibly (modularly) cyclic LPADs. SLGAD is based on the SLG procedure <ref type="bibr" target="#b3">[4]</ref> for normal logic programs and extends it in a minimal way.</p><p>SLGAD is evaluated on classical benchmarks for well founded semantics inference algorithms, namely the stalemate game and the ancestor relation. In both cases, various extensional databases are considered, encoding linear, cyclic or tree-shaped relations. SLGAD is compared with Cilog2 and SLD-NFAD on the modularly acyclic programs. The results show that SLGAD is able to deal with cycles and, while being more expensive than SLDNFAD on problems where SLDNFAD succeeds, is faster than Cilog2 when the query is true in an exponential number of instances.</p><p>The paper is organized as follows. In Section 2 we present the syntax and semantics of LPADs together with some properties of normal programs and of LPADs. Section 3 provides the definition of the SLGAD procedure, Section 4 presents the experiments and, finally, Section 5 concludes and presents directions for future work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Preliminaries</head><p>A Logic Program with Annotated Disjunctions <ref type="bibr" target="#b14">[15]</ref> T consists of a finite set of formulas of the form</p><formula xml:id="formula_0">(H 1 : α 1 ) ∨ (H 2 : α 2 ) ∨ . . . ∨ (H n : α n ) : −B 1 , B 2 , . . . B m</formula><p>called annotated disjunctive clauses. In such a clause the H i are logical atoms, the B i are logical literals and the α i are real numbers in the interval [0, 1] such that n i=1 α i 1. The head of LPAD clauses implicitly contains an extra atom null that does not appear in the body of any clause and whose annotation is 1 − n i=1 α i . For a clause C of the form above, we define head(C) as {(H i :</p><formula xml:id="formula_1">α i )|1 i n} ∪ {(null : 1 − n i=1 α i )}, body(C) as {B i |1 i m}, H i (C</formula><p>) as H i and α i (C) as α i . For example, the formula C = itching(X, strong) : 0.3 ∨ itching(X, moderate) : 0.5 : −measles(X).</p><p>is an annotated disjunctive clause in which head(C) = {(itching(X, strong) : 0.3), (itching(X, moderate) : 0.5), (null, 0.2)}, body(C) = {measles(X)}</p><p>Moreover, H 1 (C) = itching(X, strong), α 1 (C) = 0.3 and so on. Let H B (T ) be the Herbrand base of T and let I T be the set of all the possible Herbrand interpretations of P (i.e., subsets of H B (T )). If T contains function symbols, then H B (T ) is infinite, otherwise it is finite.</p><p>In order to define the semantics of a non-ground LPAD T , we must generate the grounding T of T . Each ground annotated disjunctive clause represents a probabilistic choice among the ground non-disjunctive clauses obtained by selecting only one head. The intuitive interpretation of a ground clause is that the body represents an event that, when it happens (i.e. it becomes true), causes an atom in the head (an effect) to happen (i.e. to become true). If the atom selected is null, this is equivalent to having no effect.</p><p>The semantics of an LPAD, given in <ref type="bibr" target="#b14">[15]</ref>, requires the grounding to be finite, so the program must not contain function symbols.</p><p>By choosing a head atom for each ground clause of an LPAD we get a normal logic program called an instance of the LPAD. A probability distribution is defined over the space of instances by assuming independence among the choices made for each clause.</p><p>A choice κ is a set of triples (C, θ, i) where C ∈ T , θ is a substitution that grounds C and i ∈ {1, . . . , |head(C)|}. (C, θ, i) means that, for ground clause Cθ, the head H i θ was chosen. A choice κ is consistent if (C, θ, i) ∈ κ, (C, θ, j) ∈ κ ⇒ i = j, i.e. only one head is selected for a ground clause. For different groundings of the same clause, different heads can be chosen: it is possible for a consistent choice κ to be such that (C, θ, i) ∈ κ, (C, θ , j) ∈ κ with θ = θ and i = j¿ A consistent choice is a selection σ if for each clause Cθ in the grounding of T there is a triple (C, θ, i) in σ. We denote the set of all selections of a program T by S T . Note that, since the program T does not contain function symbols, the grounding of T is finite and so is σ.</p><formula xml:id="formula_2">A consistent choice κ identifies a normal logic program T κ = {(H i (C) : −body(C))θ|(C, θ, i) ∈ κ} that is called a sub-instance of T . If σ is a selec- tion, T σ is called an instance.</formula><p>For a consistent choice κ, let U (κ) be the set of instances that are supersets of T κ , i.e., the set of instances T σ with σ a selection such that σ ⊇ κ.</p><p>We now assign a probability to a consistent choice κ. The probability P κ of a consistent choice κ is the product of the probabilities of the individual choices made, i.e. P κ = (C,θ,i)∈κ α i (C). The probability of instance T σ is P σ . Note that if T contains function symbols, σ would be infinite and so P σ would always be 0, being an infinite product of numbers all smaller than one.</p><p>The semantics of the instances of an LPAD is given by the well founded semantics (WFS) <ref type="bibr" target="#b12">[13]</ref>. Given a normal program T , we call W F M (T ) its well founded partial model. For each instance T σ , we require that the W F M (T σ ) is two-valued, since we want to model uncertainty solely by means of disjunctions. An LPAD T is called sound iff, for each selection σ in S T , W F M (T σ ) is two-valued. In the following we consider only sound programs.</p><p>The probability of an interpretation I ∈ I T according to T is given by the sum of the probabilities of the instances that have I as the well founded model, i.e.</p><formula xml:id="formula_3">P T (I) = σ∈S T ,W F M (Tσ)=I P σ .</formula><p>The probability of a formula χ according to T is given by the sum of the probabilities of interpretations in which the formula is true, i.e.</p><formula xml:id="formula_4">P T (χ) = I∈I T ,I|=χ P (I).</formula><p>Equivalently, the probability of a formula χ is given by the sum of the probabilities of the instances in which the formula is true according to the WFS:</p><formula xml:id="formula_5">P T (χ) = Tσ|= W F S χ P σ</formula><p>Note that this semantics is well defined because, since the instances are finite, the probabilities P σ are not all 0. A semantics for LPADs with function symbols must take a different approach and is subject of future work.</p><p>Example 1. Consider the dependency of a person's itching from him having allergy or measles: C 1 = itching(X, strong) : 0.3 ∨ itching(X, moderate) : 0.5 : −measles(X). C 2 = itching(X, strong) : 0.2 ∨ itching(X, moderate) : 0.6 : −allergy(X). C 3 = allergy(david). C 4 = measles(david). This program models the fact that itching can be caused by allergy or measles.</p><p>Measles causes strong itching with probability 0.3, moderate itching with probability 0.5 and no itching with probability 1 − 0.3 − 0.5 = 0.2; allergy causes strong itching with probability 0.2, moderate itching with probability 0.6 and no itching with probability 1 − 0.2 − 0.6 = 0.2. For example, itching(david, strong) is true in 5 of the 9 instances of the program and its probability is</p><formula xml:id="formula_6">0.3 • 0.2 + 0.3 • 0.6 + 0.3 • 0.2 + 0.5 • 0.2 + 0.2 • 0.2 = 0.44</formula><p>Example 2. Consider a probabilistic game in which a position is winning with a certain probability if there is a move to another position that is losing for the opponent. This game can be represented by win(X, white) : 0.8 : − move(X, Y ), ¬win(Y, black). win(X, black) : 0.8 : − move(X, Y ), ¬win(Y, white).</p><p>plus facts for the move predicate.</p><p>If move represents an acyclic relation<ref type="foot" target="#foot_1">1</ref> , then the program is sound. Otherwise, there are instances that do not have a total well founded model, namely those where the win head is selected for all the ground clauses whose instance of the move(X, Y ) atom is in the cycle.</p><p>An LPAD is (modularly) acyclic <ref type="bibr" target="#b11">[12]</ref> if all of its instances are (modularly) acyclic.</p><p>An LPAD is range restricted if all the variables appearing in the head of clauses also appear in the body.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">SLGAD Resolution Algorithm</head><p>In this section we present Linear resolution with Selection function for General logic programs with Annotated Disjunctions (SLGAD) that extends SLG resolution <ref type="bibr" target="#b5">[6,</ref><ref type="bibr" target="#b3">4]</ref> for dealing with LPADs.</p><p>In the following we give a brief sketch of the implementation of SLG resolution as presented in <ref type="bibr" target="#b3">[4]</ref>. SLG builds a search forest for a subgoal (i.e. a (partially instantiated) atom) by performing depth first search. Besides a stack S of subgoals, SLG keeps a table T in which it stores, for each subgoal A considered in the computation, the set of answers (i.e. instantiations of the subgoal) already computed Anss, the set of resolvents that wait for new answers for A, separated into a set P oss that has A selected and a set N egs that has ¬A selected, and a boolean flag Comp that indicates whether A has been completely evaluated. After every resolution step for a subgoal A, SLG tests whether all possible answers for A have been computed: if so, it sets Comp to true. When it encounters a case of a possible loop through negation, it "delays" the selected literal ¬A by inserting it into a dedicated data structure of the resolvent. Delayed literals are then removed if they turn out to be true.</p><p>SLG uses X-clauses to represent resolvents with delayed literals.</p><p>Definition 3.1 (X-Clause). An X-clause X is a clause of the form A: −D|B where A is an atom, D is a sequence of ground negative literals and (possibly unground) atoms and B is a sequence of literals. Literals in D are called delayed literals. If B is empty, an X-clause is called an X-answer clause.</p><p>An ordinary program clause is seen as a X-clause with an empty set of delayed literals.</p><p>SLG is based on the operation of SLG resolution and SLG factoring on X-clauses. In particular, SLG resolution is performed between an X-clause A : −|A and a program clause or between an X-clause and an X-answer.</p><p>In SLGAD, X-clauses are replaced by XD-clauses.</p><formula xml:id="formula_7">Definition 3.2 (XD-Clause). An XD-clause G is a quadruple (X, C, θ, i)</formula><p>where X is an X-clause, C is a clause of T , θ is a substitution for (some of ) the variables of C and i ∈ {1, . . . , |head(C)|}. Let X be A : −D|B: if B is empty, the XD-clause is called an XD-answer clause.</p><p>In SLGAD, SLG resolution between an X-clause A : −|A and a program clause is replaced by SLGAD goal resolution and SLG resolution between an X-clause and an X-answer is replaced by SLGAD answer resolution.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Definition 3.3 (SLGAD Goal Resolution).</head><p>Let A be a subgoal and let C be a clause of T such that A is unifiable with an atom H i in the head of C. Let C be a variant of C with variables renamed so that A and C have no variables in common. We call the XD-clause</p><formula xml:id="formula_8">((A : −|body(C ))θ, C , θ, i)</formula><p>the SLGAD goal resolvent of A with C on head H i , where θ is the most general unifier of A and H i . C is kept in the resolvent because we must be able to recover the ground program clause to which the XD-clause refers.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Definition 3.4 (SLGAD Answer Resolution). Let G be an XD-clause</head><formula xml:id="formula_9">(A : −D|L 1 , . . . , L n , C, θ, i)</formula><p>where n &gt; 0 and L j be the selected atom. Let F be an XD-answer clause with an empty set of delayed literals, and let F , of the form (A : −|, E , θ , i ), be a variant of F with variables renamed so that G and F have no variables in common. If L j and A are unifiable then we call the XD-clause ((A : −D|L 1 , . . . , L j−1 , L j+1 , . . . , L n )δ, C, θδ, i) A as an answer; 8 return κ∈ψ P κ 9 end the SLGAD answer resolvent of G with F , where δ is the most general unifier of A and L j .</p><p>SLG factoring is replaced by SLGAD factoring.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Definition 3.5 (SLGAD Factoring). Let G be an XD-clause</head><formula xml:id="formula_10">(A : −D|L 1 , . . . , L n , C, θ, i)</formula><p>where n &gt; 0 and L j be the selected atom. Let F be an XD-answer clause, and let F , of the form (A : −D |, E , θ , i ), be a variant of F with variables renamed so that G and F have no variable in common. If D is not empty and L j and A are unifiable then the SLGAD factor of G with F is</p><formula xml:id="formula_11">((A : −D, L j |L 1 , . . . , L j−1 , L j+1 , . . . , L n )δ, C, θδ, i)</formula><p>where δ is the most general unifier of A and L j .</p><p>SLGAD goal resolution, SLGAD answer resolution and SLGAD factoring are equivalent to their SLG counterparts on the underlying X-clauses.</p><p>The SLGAD algorithm is defined with a procedural pseudo-code that contains a non-deterministic choice point. The main function of the algorithm is shown in Figure <ref type="figure" target="#fig_0">1</ref>. It takes as input a ground atom A and a program T and it keeps four global variables. The first three are shared with SLG: the table T , the stack of subgoals S and the counter Count. The fourth variable is specific of SLGAD and is used to record all the clauses used in the SLGAD derivation together with the heads selected: it is a choice κ, i.e., a set of triples (C, θ, i) where C is a clause of T , θ is a substitution that grounds C and i is the index of an atom in the head of C. We assume that the global variables are copied in different branches of the search tree generated by the choice points, so that a modification in a branch does not influence the other branches. The search tree is explored depth first.</p><p>The SLGAD algorithm modifies in a minimal way SLG: it is composed of the same procedures as SLG <ref type="bibr" target="#b3">[4]</ref>, plus procedure ADD CLAUSE. We refer to [4] for a detailed description of the individual SLG procedures, here we report only the differences, that are indicated in italics in the figures. Procedure SLG SUBGOAL (see Figure <ref type="figure" target="#fig_1">2</ref>) differs from that of SLG because in line 3 each SLGAD goal resolvent is considered rather than each SLG resolvent. Procedure SLG NEWCLAUSE performs resolution on the selected positive or negative literal in the body of the clause or adds an answer if the body is empty. SLG NEWCLAUSE is the same as in SLG with X-clauses replaced by XD-clauses. The main difference is in procedure SLG ANSWER (see Figure <ref type="figure">3</ref>) where a call to ADD CLAUSE is added in line <ref type="bibr" target="#b3">4</ref>.</p><p>If the answer G is not subsumed by an answer already present in the table, ADD CLAUSE is called (see Figure <ref type="figure">4</ref>) that modifies κ and returns a Boolean value to SLG ANSWER in the variable Derivable. If G = (X, C, θ, i)<ref type="foot" target="#foot_2">2</ref> , ADD CLAUSE may add a new triple (C, θ, j) to the current κ set. If the program is range restricted, Cθ is ground. ADD CLAUSE first checks whether the clause Cθ already appears in the current choice with a head index different from i: if so, it fails the derivation. Otherwise, it non-deterministically selects a head index j from {1, . . . , |head(C)|}: if j = i this means that the subgoal in the head is derivable in the sub-instance represented by κ, so it sets Derivable to true. If j = i, then Derivable is set to false. In backtracking, all elements of {1, . . . , |head(C)|} are selected.</p><p>Since every clause relevant to a subgoal is eventually reduced to an XD--answer, it is sufficient to update κ only in SLG ANSWER by means of ADD CLAUSE. The cases where j = i are necessary because we must consider also the possibility that the subgoal A is derived not using head i of clause Cθ. It may be that A could be derived in a possibility j = i using other clauses and/or that the possibility j is used to derive a subgoal necessary for this second derivation branch: if we do not consider these possibilities we could miss some explanations for A.  SLG ANSWER then behaves differently depending on the value of Derivable: if it is true, a new answer has been found so the rest of the code of the SLG ANSWER procedure of SLG is performed with X-clauses replaced by XD-clauses, otherwise it exits without modifying the global variables.</p><p>Procedure SLG POSITIVE, that performs resolution on a positive literal, modifies the one of SLG by replacing SLG resolution with SLGAD answer resolution and SLG factoring with SLGAD factoring. The other SLG procedure are modified simply by replacing X-clauses with XD-clauses.</p><p>If the conditional probability of a ground atom A given another ground atom E must be computed, rather then computing P T (A ∧ E) and P T (E) separately, an optimization can be done: we first identify the choices for all successful derivations for E and then we look for the choices for the successful derivations of A starting from a choice of E.</p><p>SLGAD is sound and complete with respect to the LPAD semantics and the proof is based on the theorem of partial correctness of SLG <ref type="bibr" target="#b5">[6,</ref><ref type="bibr" target="#b4">5]</ref>: SLG is sound and complete given an arbitrary but fixed computation rule when it does not flounder. The proof of soundness and completeness can be found in <ref type="bibr" target="#b10">[11]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Experiments</head><p>We tested SLGAD on some synthetic problems similar to those that were used as benchmarks for SLG <ref type="bibr" target="#b3">[4,</ref><ref type="bibr" target="#b2">3]</ref>: win, ranc and lanc. win is an implementation of the stalemate game and contains the clause win(X):0.8 :-move(X,Y),\+ win(Y). ranc and lanc model the ancestor relation with right and left recursion respectively:</p><p>rancestor(X,Y):0.8 :-move(X,Y). rancestor(X,Y):0.8 :-move(X,Z),rancestor(Z,Y). lancestor(X,Y):0.8 :-move(X,Y). lancestor(X,Y):0.8 :-lancestor(Z,Y),move(X,Z).</p><p>Various definitions of move are considered: a linear and acyclic relation, containing the tuples (1, 2), . . . , (N − 1, N ), a linear and cyclic relation, containing the tuples (1, 2), . . . , (N − 1, N ), (N, 1), and a tree relation, that represents a complete binary tree of height N , containing 2 N − 2 tuples. For win, all the move relations are used, while for ranc and lanc only the linear ones.</p><p>SLDAG was compared with Cilog2 and SLDNFAD. Cilog2 <ref type="bibr" target="#b8">[9]</ref> computes probabilities by identifying consistent choices on which the query is true then it makes them mutually incompatible with an iterative algorithm. SLDNFAD <ref type="bibr" target="#b9">[10]</ref> extends SLDNF in order to store choices and computes the probability with an algorithm based on Binary Decision Diagrams.</p><p>For SLGAD and SLDNFAD we used the implementations in Yap Prolog<ref type="foot" target="#foot_3">3</ref> available in the cplint suite <ref type="foot" target="#foot_4">4</ref> . SLGAD code is based on the SLG system <ref type="foot" target="#foot_5">5</ref> . For Cilog2 we ported the code available on the web<ref type="foot" target="#foot_6">6</ref> to Yap. All the experiments were performed on Linux machines with an Intel Core 2 Duo E6550 (2,333 MHz) processor and 4 GB of RAM.</p><p>The execution times for the query win(1) to the win program are shown in Figures <ref type="figure" target="#fig_6">5(a</ref> win has an exponential number of instances where the query is true and the graphs show the combinatorial explosion. On win with tree move the graph in Figure <ref type="figure" target="#fig_7">6</ref> shows the execution times only up to N = 4 because for N = 4 SLGAD did not terminate after one day.</p><p>On the ancestor dataset, the proof tree has only one successful branch with a number of nodes proportional to N . However, the execution time      of SLGAD increases more than linearly as a function of N because each derivation step requires a lookup and an insert into the table T that is implemented as a tree-like data structure (2-3 tree in the SLG system). Each insert and lookup take logarithmic time. SLGAD is compared with Cilog2 and SLDNFAD on the problems that are modularly acyclic and right recursive, i.e. win with linear and tree move (Figures 5(a) and 6) and ranc with linear move (Figure <ref type="figure" target="#fig_8">7</ref>(a)). On the other problems a comparison was not possible because Cilog2 and SLD-NFAD would go into a loop. In win all the algorithms show the combinatorial explosion, with SLGAD performing better than Cilog2 and worse than SLDNFAD. On ranc with linear move (Figure <ref type="figure" target="#fig_8">7</ref> </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Conclusions and Future Works</head><p>We have presented the SLGAD top-down procedure for computing the probability of LPADs queries that is based on SLG and we have experimentally compared it with Cilog2 and SLDNFAD.</p><p>In the future, we plan to study the possibility of answering queries in an approximate way by returning an upper and a lower bound of the correct probability. Moreover, we plan to consider extensions of the language such as aggregates in the body and probabilities in the head that depend on literals in the body.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Figure 1 :</head><label>1</label><figDesc>Figure 1: Procedure SLGAD 1 function SLGAD(A,T ) 2 begin 3 Initialize Count, T , S, DFN, PosMin and NegMin as in SLG; 4 κ := ∅; 5 let ψ be the set of all the values for κ after an execution of 6 SLG SUBGOAL(A,PosMin,NegMin) such that T contains 7A as an answer; 8 return κ∈ψ P κ 9 end</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Figure 2 :</head><label>2</label><figDesc>Figure 2: Procedures SLG SUBGOAL 1 procedure SLG SUBGOAL(A,PosMin,NegMin) 2 begin 3 for each SLGAD goal resolvent G of A with some clause C ∈ T 4 on the head H i do begin 5 SLG NEWCLAUSE(A, G,PosMin,NegMin); 6 end; 7 SLG COMPLETE(A,PosMin,NegMin,κ); 8 end;</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Figure</head><label></label><figDesc>Figure 3: Procedure SLG ANSWER 1 procedure SLG ANSWER(A, G,PosMin,NegMin) 2 begin 3 if G is not subsumed by any answer in Anss(A) in T then 3 begin 4 ADD CLAUSE(G,Derivable); 5 if Derivable then begin 6 insert G into Anss(A); 7 if G has no delayed literals then begin; 8 reset N egs(A) to empty; 9 let L be the list of all pairs (B, H ), where 10 (B, H) ∈ P oss(A) and 11 H is the SLGAD answer resolvent of H with G; 12 for each (B, H ) in L do begin 13 SLG NEWCLAUSE(B,H',PosMin,NegMin); 14 end; 15 end else begin /* G has a non empty delay */ 16 if no other answer in Anss(A) has the same head 17 as G does then 18 begin 19 let L be the list of all pairs (B, H ), where 20 (B, H) ∈ P oss(A) 21 and H is the SLGAD factor of H with G; 22 for each (B, H ) in L do begin 23 SLG NEWCLAUSE(B, H ,PosMin,NegMin); 24 end; 25 end; 26 end; 27 end; 28 end; 29 end;</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head></head><label></label><figDesc>), 5(b) and 6 as a function of N for linear, cyclic and tree move respectively.The execution times for the query ancestor(1,N) to the ranc program are shown in Figures7(a) and 7(b) as a function of N for linear and cyclic move respectively. The execution times for the query ancestor(1,N) to the lanc program are shown in Figures 8(a) and 8(b) as a function of N for linear and cyclic move respectively.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_6"><head>Figure 5 :</head><label>5</label><figDesc>Figure 5: Execution times for win with linear and cyclic move.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_7"><head>Figure 6 :</head><label>6</label><figDesc>Figure 6: Execution times for win with tree move</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_8"><head>Figure 7 :</head><label>7</label><figDesc>Figure 7: Execution times for ranc</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_9"><head>Figure 8 :</head><label>8</label><figDesc>Figure 8: Execution times for lanc.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_10"><head></head><label></label><figDesc>(a)), SLGAD takes longer than Cilog2 and SLDNFAD, with Cilog2, SLDNFAD and SLGAD taking 8.3, 1165.4 and 4726.8 seconds for N = 20000 respectively.</figDesc></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0">Proceedings of the 15th International RCRA workshop (RCRA 2008): Experimental Evaluation of Algorithms for Solving Problems with Combinatorial Explosion Udine, Italy, 12-13 December 2008</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_1">A binary relation R is acyclic if the graph containing an edge from node a to node b if R(a, b) holds is acyclic</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_2">C is the clause of the program from which the XD-clause G was obtained by SL-GAD goal resolution, i is the index of the head used in the goal resolution and θ is the composition of the substitutions of all the derivations and factorings performed on G</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_3">http://www.ncc.up.pt/∼vsc/Yap/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="4" xml:id="foot_4">http://www.ing.unife.it/software/cplint/, also included in the CVS version of Yap</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="5" xml:id="foot_5">http://engr.smu.edu/∼wchen/slg.html</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="6" xml:id="foot_6">http://www.cs.ubc.ca/spider/poole/aibook/code/cilog/CILog2.html</note>
		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Acyclic programs</title>
		<author>
			<persName><forename type="first">K</forename><forename type="middle">R</forename><surname>Apt</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Bezem</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">New Generation Comput</title>
		<imprint>
			<biblScope unit="volume">9</biblScope>
			<biblScope unit="issue">3/4</biblScope>
			<biblScope unit="page" from="335" to="364" />
			<date type="published" when="1991">1991</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<monogr>
		<title level="m" type="main">Logical Foundations of Probability</title>
		<author>
			<persName><forename type="first">R</forename><surname>Carnap</surname></persName>
		</author>
		<imprint>
			<date type="published" when="1950">1950</date>
			<publisher>University of Chicago Press</publisher>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">Suspending and resuming computations in engines for SLG evaluation</title>
		<author>
			<persName><forename type="first">L</forename><forename type="middle">F</forename><surname>Castro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Swift</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><forename type="middle">S</forename><surname>Warren</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Practical Aspects of Declarative Languages</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2002">2002</date>
			<biblScope unit="volume">2257</biblScope>
			<biblScope unit="page" from="332" to="350" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Efficient top-down computation of queries under the well-founded semantics</title>
		<author>
			<persName><forename type="first">W</forename><surname>Chen</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Swift</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><forename type="middle">S</forename><surname>Warren</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">J. Log. Program</title>
		<imprint>
			<biblScope unit="volume">24</biblScope>
			<biblScope unit="issue">3</biblScope>
			<biblScope unit="page" from="161" to="199" />
			<date type="published" when="1995">1995</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<monogr>
		<title level="m" type="main">Towards effective evaluation of general logic programs</title>
		<author>
			<persName><forename type="first">W</forename><surname>Chen</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Warren</surname></persName>
		</author>
		<imprint>
			<date type="published" when="1993">1993</date>
		</imprint>
		<respStmt>
			<orgName>State University of New York at Stony Brook</orgName>
		</respStmt>
	</monogr>
	<note type="report_type">Technical report</note>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Query evaluation under the well founded semantics</title>
		<author>
			<persName><forename type="first">W</forename><surname>Chen</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><forename type="middle">S</forename><surname>Warren</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Symposium on Principles of Database Systems</title>
				<imprint>
			<publisher>ACM Press</publisher>
			<date type="published" when="1993">1993</date>
			<biblScope unit="page" from="168" to="179" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Negation as failure</title>
		<author>
			<persName><forename type="first">K</forename><forename type="middle">L</forename><surname>Clark</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Logic and Databases</title>
				<imprint>
			<publisher>Plenum Press</publisher>
			<date type="published" when="1978">1978</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<analytic>
		<title level="a" type="main">ProbLog: A probabilistic prolog and its application in link discovery</title>
		<author>
			<persName><forename type="first">L</forename><surname>De Raedt</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Kimmig</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><surname>Toivonen</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">International Joint Conference on Artificial Intelligence</title>
				<imprint>
			<date type="published" when="2007">2007</date>
			<biblScope unit="page" from="2462" to="2467" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b8">
	<analytic>
		<title level="a" type="main">Abducing through negation as failure: stable models within the independent choice logic</title>
		<author>
			<persName><forename type="first">D</forename><surname>Poole</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">J. Log. Program</title>
		<imprint>
			<biblScope unit="volume">44</biblScope>
			<biblScope unit="issue">1-3</biblScope>
			<biblScope unit="page" from="5" to="35" />
			<date type="published" when="2000">2000</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b9">
	<analytic>
		<title level="a" type="main">A top down interpreter for LPAD and CP-logic</title>
		<author>
			<persName><forename type="first">F</forename><surname>Riguzzi</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Congress of the Italian Association for Artificial Intelligence</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2007">2007</date>
			<biblScope unit="volume">4733</biblScope>
			<biblScope unit="page" from="109" to="120" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b10">
	<monogr>
		<title level="m" type="main">The SLGAD procedure for inference on logic programs with annotated disjunctions</title>
		<author>
			<persName><forename type="first">F</forename><surname>Riguzzi</surname></persName>
		</author>
		<idno>CS-2008-01</idno>
		<ptr target="http://www.unife.it/dipartimento/ingegneria/informazione/informatica/rapporti-tecnici-1/cs-2008-01.pdf/view" />
		<imprint>
			<date type="published" when="2008">2008</date>
		</imprint>
		<respStmt>
			<orgName>University of Ferrara</orgName>
		</respStmt>
	</monogr>
	<note type="report_type">Technical Report</note>
</biblStruct>

<biblStruct xml:id="b11">
	<analytic>
		<title level="a" type="main">Modular acyclicity and tail recursion in logic programs</title>
		<author>
			<persName><forename type="first">K</forename><forename type="middle">A</forename><surname>Ross</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Symposium on Principles of Database Systems</title>
				<imprint>
			<publisher>ACM Press</publisher>
			<date type="published" when="1991">1991</date>
			<biblScope unit="page" from="92" to="101" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b12">
	<analytic>
		<title level="a" type="main">The well-founded semantics for general logic programs</title>
		<author>
			<persName><forename type="first">A</forename><surname>Van Gelder</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><forename type="middle">A</forename><surname>Ross</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">S</forename><surname>Schlipf</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">J. of the ACM</title>
		<imprint>
			<biblScope unit="volume">38</biblScope>
			<biblScope unit="issue">3</biblScope>
			<biblScope unit="page" from="620" to="650" />
			<date type="published" when="1991">1991</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b13">
	<monogr>
		<title level="m" type="main">Logic programs with annotated disjunctions</title>
		<author>
			<persName><forename type="first">J</forename><surname>Vennekens</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Verbaeten</surname></persName>
		</author>
		<ptr target="http://www.cs.kuleuven.ac.be/∼joost/techrep.ps" />
		<imprint>
			<date type="published" when="2003">2003</date>
		</imprint>
		<respStmt>
			<orgName>K. U. Leuven</orgName>
		</respStmt>
	</monogr>
	<note type="report_type">Technical Report CW386</note>
</biblStruct>

<biblStruct xml:id="b14">
	<analytic>
		<title level="a" type="main">Logic programs with annotated disjunctions</title>
		<author>
			<persName><forename type="first">J</forename><surname>Vennekens</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Verbaeten</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Bruynooghe</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">International Conference on Logic Programming</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2004">2004</date>
			<biblScope unit="volume">3131</biblScope>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
