DeepAI
Log In Sign Up

Guarded resolution for answer set programming

We describe a variant of resolution rule of proof and show that it is complete for stable semantics of logic programs. We show applications of this result.

READ FULL TEXT VIEW PDF

page 1

page 2

page 3

page 4

07/30/2022

Typed SLD-Resolution: Dynamic Typing for Logic Programming

The semantic foundations for logic programming are usually separated int...
05/02/2009

An Application of Proof-Theory in Answer Set Programming

We apply proof-theoretic techniques in answer Set Programming. The main ...
12/27/2021

A Brief History of Updates of Answer-Set Programs

Over the last couple of decades, there has been a considerable effort de...
12/20/2013

A Functional View of Strong Negation in Answer Set Programming

The distinction between strong negation and default negation has been us...
05/08/2000

A Denotational Semantics for First-Order Logic

In Apt and Bezem [AB99] (see cs.LO/9811017) we provided a computational ...
06/03/2011

Semantics for Possibilistic Disjunctive Programs

In this paper, a possibilistic disjunctive logic programming approach fo...
03/08/2000

Smodels: A System for Answer Set Programming

The Smodels system implements the stable model semantics for normal logi...

1 Introduction

In this note, we introduce a rule of proof, called guarded unit resolution. Guarded unit resolution is a generalization of a special case of the resolution rule of proof, namely, positive unit resolution. In positive unit resolution, one of the inputs is an atom unit clause. Positive unit resolution is complete for Horn clauses, specifically, given a consistent Horn theory and an atom , the atom belongs to the least model of , , if and only if there is a positive unit resolution proof of from [Dowling and Gallier (1984)].

The modification we introduce in this note concerns guarded atoms and guarded Horn clauses. Guarded atoms are strings of the form: where are propositional atoms. Guarded Horn clauses are strings of the form again with propositional atoms.

These guarded atoms and guarded rules will be used to obtain a characterization of stable models of normal logic programs. There are many characterizations of stable models of logic programs. In fact, in [Lifschitz (2008)], Lifschitz lists twelve different characterizations of stable models of logic programs. The characterization of stable models that we present in this paper has a distinctly proof-theoretic flavor and makes easy to prove some basic results on Answer Set Programming such as Fages’ Theorem [Fages (1994)], Erdem-Lifschitz Theorem [Erdem and Lifschitz (2003)], and Dung’s Theorem [Dung and Kanchansut (1989)].

It should be observed that in [Dung and Kanchansut (1989)] Dung and Kanchansut consider so-called quasi-interpretations which, in the formalism of our paper, can be viewed as collections of guarded atoms. The difference between our approach and that of [Dung and Kanchansut (1989)] is that we elucidate the proof theoretic content of the Gelfond-Lifschitz operator and show how this technique allows for uniform proof of various results in the theory of stable models of programs.

The outline of this paper is as follows. First, we introduce the definition of the guarded resolution rule of proof and then derive its connections with the Gelfond-Lifschitz operator [Gelfond and Lifschitz (1988)]. Once we do this, we will obtain the desired lifting of the classical result on the completeness of positive unit resolution for Horn theories [Dowling and Gallier (1984)] to the context of the stable semantics of logic programs. In Section 3, we show how guarded resolution proofs can be used to prove various standard results in the theory of stable models of propositional programs. Finally, in Section 4, we show how the theory developed in this paper can be used to obtain an algorithm for computation of stable models that does not use loop formulas and runs in polynomial space in the size of the program.

2 Guarded resolution and Stable Semantics

By a logic program clause, we mean a string of the form

(1)

A program is a set of logic program clauses.

We will interpret program clause given in (1) as a guarded Horn clause:

We define . Observe that when we interpret a logic program clause as a guarded Horn clause, the polarity of atoms appearing negatively in the body of the programming clause changes in its representation as the guarded Horn clause. That is, they occurred negatively in the body of clause and they now appear positively in the guard. By convention, we think of a propositional atom as a guarded atom with an empty guard.

We now introduce our guarded resolution rule as follows. It has two arguments: the first is a guarded Horn clause and the second is a guarded atom . The guarded atom must occur in the body of the guarded Horn clause. The result of the application of the rule is a guarded Horn clause whose body is the body of the original guarded Horn clause minus the atom . The guard of the resulting guarded Horn clause is the union of the guard of the guarded atom and the guard of the original guarded Horn clause. Formally, our guarded resolution rule has the following form:

Next, we discuss the Gelfond-Lifschitz operator associated with a normal propositional program. Given a set of atoms and a normal logic program , we first define the Gelfond-Lifschitz reduct of . is constructed according to the following two step process. First, if

is a clause in and for some , then we eliminate . Second, if is not eliminated after step 1, then we replace by

Clearly, is a Horn program. Thus has a least model . The Gelfond-Lifschitz operator assigns to the set of atoms .

Our guarded unit resolution rule naturally leads to the notion of a guarded resolution proof of a guarded atom from the program . Here is a, possibly empty, set of atoms. That is, a guarded resolution proof of is a labeled tree such that every node that is not a leaf has two parents, one labeled with a guarded Horn clause and the other labeled with a guarded atom, where the label of the node is the result of executing the guarded unit resolution rule on the labels of the parents. Each leaf is either a guarded Horn clause such that is in or a guarded atom such that is in . In the special case where the tree consist of a single node, we assume that the node is labeled with a guarded atom where is in . Note that in a guarded resolution proof, guards only grow as we proceed down the tree. That is, as we resolve, the guards are summed up. For this reason, the guard of the root of the proof contains the guards of every label in the tree.

We say that a set of atoms admits a guarded atom , if and that admits a guarded resolution proof if it admits the label of the root of . The following statement follows from the containment properties of guards in a guarded resolution proof.

Lemma 2.1

If admits the guarded resolution proof , then admits every guarded atom occurring as a label in and is disjoint from the guard of every guarded clause in .

We then have the following proposition.

Proposition 2.1

Let be a propositional logic program and let be a set of atoms. Then consists exactly of atoms such that there exists a set of atoms where the guarded atom is the conclusion of a guarded resolution proof from admitted by .

Proof: Let and assume that . Then by definition, where is the standard one-step provability operator for . We claim that we can prove by induction on that whenever , then there exists a set of atoms such that possesses a guarded resolution proof from admitted by . If , then it must be the case that the belongs to . But then, for some ,

belongs to and . Therefore the guarded atom is admitted by and it possesses a guarded resolution proof from , namely, the one that consists of the root labeled by . Now, let us assume . Then there is a clause in such that for . Thus by induction, there are sets of atoms , , such that possesses a guarded resolution proof from admitted by . As belongs to , there must exist atoms such that

is a clause in . It is easy to combine the guarded resolution proofs of , and the guarded clause to obtain a guarded resolution proof from of the following guarded atom:

As all the sets occurring in the guard of this guarded atom are disjoint from , the resulting guarded resolution proof is admitted by . This shows the inclusion .

Conversely, suppose has a guarded resolution proof from admitted by . By the lemma, all the guards occurring in are disjoint from . We can then prove by induction on the height of the tree that . If the height of is , then it must be the case that

belongs to where . But since , the clause belongs to . Hence .

Now, for the inductive step, assume that whenever has a guarded resolution proof from that is admitted by of height less than or equal to , then . We now show that the same property holds for all guarded atoms which have a guarded resolution proof from that is admitted by of the height . What does such a guarded resolution proof look like? First the root must be the result of a guarded unit resolution of the form

As , and . Now, has a guarded resolution proof from that is admitted by of height at most and, hence, by our inductive assumption. Since as we progress down the proof tree, the body of guarded clauses only get smaller and the guards of guarded clauses only get bigger, there must exist a path starting at the guarded clause which consists of guarded clauses of the form

where and for each , there is a node in the tree of the form such that the resolution of and results in the clause . Now each is the root of a guarded resolution proof from that is admitted by of height less than or equal to and, hence, is in for .

Since is a leaf, there must be a clause

in where . Since admits the proof tree, it must be the case that and, hence, is in . But then, since are in , it follows that .

Proposition 2.1 tells us that the Gelfond-Lifschitz operator is, essentially, a proof-theoretic construct. Here is one consequence, this time a semantic one.

Corollary 2.1

Let be a propositional logic program and let be a set of atoms. Then is a stable model of if and only if

  1. for every , there is a set of atoms such that there is a guarded resolution proof of from admitted by and

  2. for every , there is no set of atoms such that there is a guarded resolution proof of from admitted by .

When is a Horn program Corollary 2.1 reduces to the classical fact [Dowling and Gallier (1984)] that the elements of the least model of the Horn programs are precisely those that can be proved out of clausal representation of using positive unit resolution.

Given a finite set of atoms , we write for the conjunction . Next, let us call such that has a guarded resolution proof from a support of with respect to . We can then form an equation for with respect to , , as follows:

where is the list of all supports of with respect to . If the only support of is the empty set, then we let and if there are no supports for , then we let . Next, let be the propositional theory consisting of for all . We then have the following theorem resembling Clark’s completion theorem, except we get it for stable models, not supported models.

Proposition 2.2

Let be a propositional program and let be a set of atoms. Then is a stable model of if and only if .

Proof: First, assume that is a stable model of . Then if , it follows from Corollary 2.1 that there is an such that has a guarded resolution proof admitted by . Hence and . Thus satisfies both and one of the disjuncts on the right-hand side of . Hence . Next assume that . Then there is no such that has a guarded resolution proof admitted by . It follows that either equals or satisfies both negation of and of the negation of every disjunct on the right-hand-side of . Thus again . This shows “if” part of the theorem.

For the other direction, suppose that . Then if , either or . In the former case, this means that the tree consisting of a single node is a guarded resolution proof and, hence, is a clause in . Thus must be in . In the latter case, there must be some such that . But by definition, is the root of some guarded resolution proof for and since every guard in such a guarded resolution proof is contained in , it must be the case that admits . But then we have shown that . Thus .

On the other hand, if , then either or . In the former case, there must be be no guarded resolution proofs of and, hence, is not in . In the latter case, it must be that does not satisfy any . This means that there is no guarded resolution proof from whose root is of the form such that admits and, hence, . This implies and, hence, . Thus is a stable model of .

If we look carefully at the structure of any resolution proof tree of a guarded atom , we see that collects a set atoms which guarantee that whenever . Thus in defining , we essentially unfold the atoms in to conjunctions of negated atoms (cf. [Brass and Dix (1999)]).

We observe that, in principle, when the program is infinite, the theory may be infinitary. Specifically, the formulas may be infinitary formulas, since the disjunction on the right-hand-side of the equivalence may be over an infinite set of finite conjunctions. But the semantics for infinite propositional logic is well-known [Karp (1964)] and can be applied here. The authors studied the necessary and sufficient conditions for to be finitary in [Marek and Remmel (2010)].

3 Some applications

In this section we will use the results of Section 2 to derive the result of Erdem and Lifschitz [Erdem and Lifschitz (2003)]. This result generalizes a theorem by Fages [Fages (1994)] which is useful as a preprocessing step for the computation of stable models of programs. We will also prove a result of Dung [Dung and Kanchansut (1989)] on stable models of purely negative programs.

We say that a set of atoms has levels with respect to a program if

  1. is a model of , and

  2. There is a function such that, for every , there is a clause such that

    1. ,

    2. , and

    3. For all , .

Clearly, the least model of a Horn program has levels since the function which assigns to an atom , the least integer such that is the desired rank function for condition (2).

We now prove the following proposition.

Proposition 3.1

Let be a propositional logic program and . Then is a stable model of if and only if has levels with respect to .

Proof: Clearly, when is a stable model of , then has levels with respect to . Namely, the rank function whose existence is postulated in (2) is the rank function inherited from the Horn program .

Converse implication can be proved in a variety of ways. Our proof, in the spirit of the proof-theoretic approach of this paper, uses guarded resolution. That is, assume that has levels with respect to where is the rank function in condition (2). Our goal is to prove that . First, let us observe that since , . Thus, all we need to show is that . By Corollary 2.1, we need only show that for given any , there is a such that possesses a guarded resolution proof from that is admitted by . We construct the desired set and guarded resolution proof by using the rank function . Let , i.e. is the range of rank function. We proceed by transfinite induction on the elements of . Let be an atom in such that is the least element of . By assumption, there must exist a clause in such that , and for all , . Since , there can be no ’s in positive part of the body of because any such must be in and have rank strictly less than . Thus the clause has the following form:

As , . But then is a guarded atom admitted by and so has a guarded resolution proof from which consists of a single node labeled with .

Now, assume that whenever , , and , then there is a guarded resolution proof of from admitted by for some set . Let us assume that and . By our assumption, there is a clause

with and . By inductive assumption, for every , , there is a finite set of atoms such that there is guarded resolution proof from of admitted by . In particular . We can then easily combine the guarded resolution proofs for with applications of guarded unit resolution starting with the leaf

to produce a guarded resolution proof of

from where . Since all s are disjoint from and , it follows that . Thus the resulting resolution proof is admitted by . This completes the inductive argument and thus the proof of the Proposition.

We observe that, in fact, it is sufficient to limit the functions in the definition of having levels respect to to those rank functions that take values in , the set of natural numbers.

We get, as promised, several corollaries. One of these is the result of Erdem and Lifschitz [Erdem and Lifschitz (2003)]. Following [Erdem and Lifschitz (2003)], we say that a program is tight on a set of atoms if there is a rank function defined on such that whenever is a clause in and , then for all , Here is the result of Erdem and Lifschitz.

Corollary 3.1 (Erdem and Lifschitz)

If is tight on and is a supported model of , then is a stable model of .

Proof: Indeed, tightness on requires that for any , there is a support for and that all clauses that provide the support for the presence of in have the property that the atoms in the positive part of the body of have smaller rank. In Proposition 3.1, we showed that it is enough to have just one such clause. Since tightness on implies existence of such a supported clause, the corollary follows.

Since all stable models are supported [Gelfond and Lifschitz (1988)], one can express Erdem-Lifschitz Theorem in a more succinct way.

Corollary 3.2 (Erdem-Lifschitz)

If for every supported model of a program , is tight on , then the classes of supported and stable models of coincide.

Fages Theorem [Fages (1994)] is a weaker version of Corollary 3.1 (but with assumptions that are easier to test). Specifically, we say that a program is tight if there is a rank function such that for every clause of , the ranks of the atoms occurring in the positive part of the body of are smaller than the rank of the head of . Clearly, if is tight, then is tight on any of its models since will also witness that is tight on . Thus one has the following corollary.

Corollary 3.3 (Fages)

If is tight, then the classes of supported and stable models of coincide.

Tightness is a syntactic property that can be checked in polynomial time by inspection of the positive call-graph of . This is not the case for the stronger assumptions of Proposition 3.1 and Corollary 3.2.

Let be the set of all stable models of . We say that programs , are equivalent if . This notion and its strengthenings were studied by ASP community [Lifschitz, Pearce and Valverde (2001)], [Truszczynski (2006)]. We have the following fact.

Lemma 3.1

If prove the same guarded atoms, then and are equivalent.

As a corollary we get the following result due to Dung [Dung and Kanchansut (1989)]

Corollary 3.4 (Dung)

For every program , there is purely negative program such that , are equivalent.

The program is quite easy to construct. That is, for each atom , if

then we add to , all clauses of the form

where . If , then we add to . Finally, if , then we add nothing to . It is then easy to see that and hence and are equivalent.

4 Computing stable models via satisfiability, but without loop formulas or defining equations

Proposition 2.2 characterized the stable models of a propositional program in terms of the collection of all propositional valuations of the underlying set of atoms. In this section, we give an alternative characterization in terms of the models of suitably chosen propositional theories. The proof of this characterization uses Proposition 2.2, but relates stable models of finite propositional programs to models of theories of size . This is in contrast to Proposition 2.2 since the set of defining equations is, in general, of size exponential in .

A subequation for an atom is either a formula or a formula

where is a support of a guarded resolution proof of from . Here if , then by convention we interpret to be simply the atom . The idea is that a subequation either asserts absence of the atom in the putative stable model or provides the reason for the presence of in the putative stable model. A candidate theory for program is the union of and a set of subequations, one for each . By we denote the set of candidate theories for .

Proposition 4.1
  1. Let be a candidate theory for (i.e. ). If is consistent, then every propositional model of is a stable model for .

  2. For every stable model of , there is theory such that is a model for .

Proof: (1) Let be a candidate theory for and suppose that . We need to show that is a stable model for . In other words, we need to show that

The inclusion follows from the fact that is a model of . That is, since is a model of , it immediately follows that is a model of the Gelfond-Lifschitz transform of , . Since is the unique minimal model of , it automatically follows that .

To show that , suppose that . Then the subequation for that is in can not be . Therefore it is of the form

where there is some guarded resolution proof of from . Since and , . But then so that admits . Hence by Corollary 2.1, .
 
(2) Let be a stable model of . We construct a candidate theory so that is a model of . To this end, for each , we select as a subequation for . For each , we select a guarded resolution proof of some from that admitted by . We then add to the formula

Clearly, is a candidate theory, and , as desired.

Next we give an example of our approach to reducing the computation of of stable models to satisfiability of propositional theories. It will be clear from this example that our approach avoids having to compute the completion of the program and thus significantly reduces the size of the input theories.

Example 4.1

Let be a propositional program as follows:

Let us observe that the atom has two inclusion-minimal supports, namely and . The atom has just one support, namely , and the atom also has just one support, namely . The atoms and have no support at all.

Thus there are three subequations for :

Now, has only two subequations: , and . Similarly, has only two subequations, and , but the second one automatically leads to contradiction whenever it is chosen. Finally each of and have just one defining equation, , and , respectively.

First let us choose for , the subequation , and for , the subequation . The remaining subequations are forced to , , and . The resulting theory has nine clauses, when we write our program in propositional form:

It is quite obvious that this theory is inconsistent. However, if we choose for , the subequation and for , the subequation , then the resulting theory written out in propositional form is

In this case, is a model of and hence, is a stable model of .

It should be clear that Proposition 4.1 implies an algorithm for computation of stable models. Namely, we generate candidate theories and find their propositional models.

Let us observe that the algorithm described above can be implemented as a two-tier backtracking search, with the on-line computation of supports of guarded resolution proofs, and the usual backtracking scheme of DPLL. This second backtracking can be implemented using any DPLL-based SAT-solver. Proposition 4.1 implies that the algorithm we outlined is both sound and complete. Indeed, if the SAT solver returns a model of theory , then, by Proposition 4.1(1), is a stable model for . Otherwise we generate another candidate theory and loop through this process until one satisfying assignment is found. Proposition 4.1(2) guarantees the completeness of our algorithm.

Our algorithm is not using loop formulas like the algorithm of Lin and Zhao [Lin and Zhang (2002)] but systematically searches for supports of proof schemes, thus providing supports for atoms in the putative model. It also differs from the modified loop formulas approach of Ferraris, Lee and Lifschitz [Ferraris, Lee and Lifschitz (2006)] in that we do not consider loops of the call-graph of at all. Instead, we compute systematically proof schemes and their supports for atoms. While the time-complexity of our algorithm is significant because there may be exponentially many supports for any given atom , the space complexity is . This is the effect of not looking at loop formulas at all ([Lifschitz and Razborov (2006)]).

5 Conclusions and Further Work

We have shown that guarded unit resolution, a proof system that is a nonmonotonic version of unit resolution, is adequate for description of the Gelfond-Lifschitz operator and its fixpoints. That is, we can characterize stable models of logic programs in terms of guarded resolution.

There are several natural questions concerning extensions of guarded resolution in the context of Answer Set Programming. For example:
 
(1) Is there an analogous proof system for the disjunctive version of logic programming?
or
(2) Are there analogous proof systems for logic programming with constraints?
 
We believe that availability of such proof systems could help with finding a variety of results on the complexity of reasoning in nonmonotonic logics. An interesting case is that of propositional Default Logic. We will show in a subsequent paper that that we can develop a similar guarded resolution proof scheme for propositional Default Logic. The main difference is that we must allow proof trees where the leaves can be tautologies rather than just guarded atoms or guarded clauses that are derived from the given program as in this paper.

References

  • Apt, Blair and Walker (1988) Apt, K., Blair, H.A., and Walker, A. Towards a theory of Declarative Knowledge. In: Foundations of Deductive Databases and Logic Programming, J. Minker, Ed. Morgan Kaufmann, 89–148, 1988.
  • Baral (2003) Baral, C., Knowledge Representation, Reasoning and Declarative Problem Solving, Cambridge University Press, 2003.
  • Brass and Dix (1999) Brass, J. and Dix, J. Semantics of (Disjunctive) Logic Programs Based on Partial Evaluation. Journal of Logic Programming 40:1–46, 1999.
  • Dowling and Gallier (1984) Dowling, W.F. and Gallier, J.H. Linear time algorithms for testing satisfiability of propositional Horn formulae. Journal of Logic Programming 1:267–284, 1984.
  • Dung and Kanchansut (1989) Dung, P.M. and Kanchansut, K. A fixpoint approach to declarative semantics of logic programs. Proceedings of North American Conference on Logic Programming pages 604–625, 1989.
  • Erdem and Lifschitz (2003) Erdem, E. and Lifschitz, V. Tight Logic Programs. Theory and Practice of Logic Programming 3:499–518, 2003.
  • Fages (1994) Fages, F. Consistency of Clark’s completion and existence of stable models. Journal of Methods of Logic in Computer Science, 1:51–60, 1994.
  • Ferraris, Lee and Lifschitz (2006) Ferraris, P., Lee, J. and Lifschitz, V. A generalization of Lin-Zhao theorem.

    Annals of Mathematics and Artificial Intelligence

    47:79–101, 2006.
  • Gelfond and Leone (2002) Gelfond, M. and Leone, N. Logic Programming and Knowledge Representation – A-Prolog perspective. Artificial Intelligence 138:3–38, 2002.
  • Gelfond and Lifschitz (1988) Gelfond, M. and Lifschitz, V. The stable model semantics for logic programming. In: Proceedings of the International Joint Conference and Symposium on Logic Programming. MIT Press, 1070–1080, 1988.
  • Karp (1964) Karp, C. Languages with Expressions of Infinitary length. North-Holland, Amsterdam, 1964.
  • Lifschitz (2008) Lifschitz, V. Twelve definitions of a stable model. In: Proceedings of International Conference on Logic Programming, pages 37–51, 2008.
  • Lifschitz, Pearce and Valverde (2001) Lifschitz, V., Pearce, D. and Valverde, A. Strongly equivalent logic programs. ACM Transactions on computational logic 2:526–541, 2001.
  • Lifschitz and Razborov (2006) Lifschitz, V. and Razborov. A. Why are there so many loop formulas. Annals of Mathematics and Artificial Intelligence 7:261–268, 2006.
  • Lin and Zhang (2002) Lin, F. and Zhao, Y. ASSAT: Computing answer sets of a logic program by SAT solvers. Proceedings of AAAI 2002, pages 112–117. 2002.
  • Marek and Remmel (2010) Marek, V.W. and Remmel, J.B. An Application of Proof-theory in Answer Set Programming. Preliminary version at arXiv:0905.4076, 2010.
  • Marek and Truszczynski (1999) Marek, V.W., and Truszczyński, M. Stable Models and an Alternative Logic Programming Paradigm. The Logic Programming Paradigm, pp. 375–398. Series Artificial Intelligence, Springer-Verlag, 1999.
  • Niemelä (1999) Niemelä, I. Logic programs with stable model semantics as a constraint programming paradigm. Annals of Mathematics and Artificial Intelligence 25, 3,4, 241–273, 1999
  • Truszczynski (2006) Truszczynski, M. Strong and Uniform Equivalence of Nonmonotonic Theories An algebraic Approach. Proceedings of the Conference on Principles of Knowledge Representation and Reasoning, pages 389–399, 2006.