Background definitions
The stable model semantics [Gelfond & Lifschitz 1988] is a view of logic programs as sets of inference rules (more precisely, default inference rules), where a stable model is a set of atoms closed under the program itself. Alternatively, one can see a program as a set of constraints on the solution of a problem, where each stable model represents a solution compatible with the constraints expressed by the program. Consider the simple program . For instance, the first rule is read as “assuming that both and are false, we can conclude that is true.” This program has two stable models. In the first, is true while and are false; in the second, is true while and are false.
Unlike with other semantics, a program may have no stable model, i.e., be contradictory, like the following: , where no set of atoms is closed under the rules. It is important to make sure that a program admits stable models before attempting to perform deduction. Inconsistency may arise, realistically, when programs are combined: if they share atoms, a subprogram like that above may surface in the resulting program.
In this paper we consider, essentially, the language for deductive databases, which is more restricted than traditional logic programming. As discussed in [Marek & Truszczyński 1999], this restriction is not a limitation at this stage.
A rule (clause) is defined as usual, and can be seen as composed of a conclusion , and a set of conditions , the latter divided into positive conditions and negative conditions .
For syntax and semantics of logic programs with negation (general, or normal logic programs), and for the definition of Dependency Graph (DG), the reader may refer for instance to [Apt & Bol 1994] and to the references therein.
For the sake of clarity however, let us report the definition of stable models. We start from the subclass of positive programs, i.e. those where, for every rule , .
Definition 1
(Stable model of positive programs)
The stable model of a positive program is the smallest subset of such that for any rule in : .
Positive programs are unambiguous, in that they have a unique stable model, which coincides with that obtained applying other semantics.
Definition 2
(Stable models of programs)
Let be a logic program. For any set of atoms, let be a program obtained from by deleting (i) each rule that has a formula ‘’ in its body with , and (ii) all formulae of the form ‘’ in the bodies of the remaining rules.
does not contain “not,” so that its stable model is already defined. If this stable model coincides with , then we say that is a stable model of . In other words, the stable models of are characterized by the equation:
Programs which have a unique stable model are called categorical.
In the literature, the main (sufficient) condition to ensure the existence of stable models is call–consistency, which is summarized as follows: no atom depends
on itself via an odd number of negative conditions.
Proposition 1
[Dung 1992] A [normal] logic program has a stable model if it is call–consistent.
More results along the lines of Proposition 1 are found in [Dung 1992]. However, this condition is quite restrictive, as there are programs with odd cycles (in the sense described above) that have one or more stable models. See Example 1 below.
For the sake of simplicity, in this paper we consider kernel programs, that are general logic programs where: (i) there are no positive conditions, i.e. for every clause , ; (ii) every atom which is the head of a rule must also appear in the body of some rule (possibly the same one).
From any program , a kernel program can be obtained, which is equivalent to as far as characterizing stable models.
The relationship between cycles and stable models
As discussed above, we are interested in programs that are not stratified (unstratified programs), and do not satisfy callconsistency. We will speak of an even (resp. odd) cycle referring to a even (resp. odd) number of rules organized like (resp. ). This Section is devoted to the analysis of the type and number of cycles appearing in a program, and their connections, i.e, roughly, rules involving atoms that appear in different cycles, which we call handles. We argue that the form of cycles and connections is the key factor affecting the existence –and the number– of stable models. In fact, the dependency graph makes neither the cycles, nor the connections explicit.
Example 1
Consider the following programs, , and :
It is easy to see that the dependency graphs of the three programs in Example 1 coincide. However, has the stable model while instead has the stable model and has no stable models at all. Why do they have such a diverse semantics? The reason relies in the different decomposition of the three programs into cycles. The programs above are divided into cycles as follows, where OC and EC denote odd and even cycle, respectively, and literals appearing either in square brackets or in braces correspond to different kinds of handles. Consider the following partitions of and , respectively:
The literals in braces are called OR handles of the cycle. Consider program . Literal in is an OR handle for . Now, consider a putative stable model ; if , we can say that “handle is true.” Then, atom is forced to be in and, consequently, has, w.r.t. , the stable model . Literal , instead, is an AND handle (indicated in square brackets) of the odd cycle : if it is false (i.e., ), it forces to be false, and “has the empty model,” and .
Similar considerations can be made on , even tough it has a different structure: literal in this case is an AND handle to (while in it is an OR handle, instead); if is true then the odd cycle is contradictory, and determines the inconsistency of the whole program. If, on the other hand, is false, then is forced to be false, and consequently has the stable model . This means moreover that the OR handle of is true, and thus is true: therefore the contradiction , which could determine the inconsistency of the whole program, is made harmless. Finally, the reader can easily check that program has the odd cycle unconstrained (no handles); thus, has no stable models. A formal assessment of cycles will be part of the forthcoming extended version of this paper.
At this point, it is however important to notice that one rule may belong to several cycles at once.
Example 2
Let
In , the following cycles are found:
This is an odd cycle ( depends on itself).
This is an odd cycle ( depends on itself).
Moreover, the former two rules together
form also an even cycle, where depends on and vice versa, i.e.:
Now,
is an even cycle, while
is an odd cycle ( depends on itself). Finally,
is an even cycle, depends on and vice versa.
There are clauses, namely ,
, and , which do not belong to any cycle. Notice
however that they can be seen as forming a chain connecting cycles.
In fact, since the fist atom in the chain is ,
which belongs to cycles and ,
in a way this chain forms two bridges: one between and ,
a the other between and .
In Example 2 above, clause is called an auxiliary rule of cycles and , since its conclusion is an atom belonging to these cycles. As mentioned above, auxiliary rules can belong to a bridge connecting different cycles. For the sake of simplicity, we can assume that all bridges have unitary length, i.e. that all bridges reduce to an auxiliary rule. In fact, what is important is which cycle is connected to which, while the intermediate steps of the chain do not affect the existence and number of stable models.
In the rest of the paper, we will say that a cycle is constrained if it has an handle. Then, a cycle with no handle is called unconstrained.
From cycles to stable models
In order to reason about the existence of the stable models of , it is useful to reason about the existence of the stable models of its composing cycles.
Definition 3
An extended cycle is a set of rules composed of one cycle together with all its auxiliary clauses.
Proposition 2
A program has a unique decomposition into extended cycles , .
Definition 4
Let be an extended cycle, and let be the set of all the atoms occurring in some of the handles of . Let . A completed extended cycle is a set of rules composed of one extended cycle , where atoms in are added as unit clauses.
Notice that adding to some of the atoms of (which are atoms occurring in the handles of ) corresponds to making an hypothesis about truth/falsity of the handles of C. For any extended cycle , there are corresponding completed cycles, each one corresponding to a different hypothesis on the handles. Correspondingly, there are several ways of decomposing into completed cycles , . What we intend to show is the direct relation between the stable models of the completed extended cycles and the stable models of the overall program. Indeed, a completed cycle, taken as a program per se, may or may not have stable models.
Theorem 1
A program with decomposition into cycles has stable models only if there exists a set of completed extended cycles of such that every , , has a stable model.
For any decomposition of into completed extended cycles, we are interested only in those sets of stable models of, respectively, which agree on shared atoms. In other words, a consistent set of partial stable models contains one stable model for each of the extended cycles of the decomposition, and there are no assigning opposite truth values to some atom.
Theorem 2
An interpretation of is a stable model if and only if where is a consistent set of stable models for a decomposition of into completed extended cycles.
Then, from the stable models of the composing cycles, we are able to obtain the stable models of the program. Correspondingly, if we study the conditions for the existence of stable models of the (extended) cycles, we can find conditions for the existence of stable models of .
It is easy to see that whenever a cycle is constrained, then there exists a corresponding completed, extended cycle which is a locally stratified program; thus, has a unique stable model, which also coincide with the Wellfounded model.
Assume instead that contains an unconstrained cycle . In this case, the unique completed extended cycle associated to is itself (trivial completed extended cycle). If is even, then it has the two stable models:
Vice versa, if is odd there are no stable models. In conclusion, we can state the following propositions.
Proposition 3
An unconstrained even cycle always has a corresponding (trivial) completed extended cycle with stable models.
Proposition 4
An unconstrained odd cycle has no corresponding completed extended cycles with a stable model.
These considerations allow us to formulate some useful necessary and sufficient conditions for the existence of stable models.
In our framework, for instance, it becomes easy to reformulate the result in [Dung 1992] saying that every callconsistent program has stable models. Moreover, it is also easy to establish the following.
Proposition 5
A program has a stable model only if every odd composing cycle is constrained.
There are situations however, where the odd cycles are constrained, but still no stable model exists. This happens whenever all possible decompositions of lead to sets of partial stable models which are not consistent. I.e., there are cycles which require opposite truth values of some atom, in order to have stable models, e.g.
It is possible to identify sufficient conditions for the existence of stable models, based on ruling out these situations constructively. This is discussed below as well as in our forthcoming work.
A new graph representation
In order to reason more directly and more efficiently about cycles and handles, we introduce a new graph representation of programs, since the usual DG is not adequate to this aim. On this graph, we should be able of: detecting by means of efficient algorithms the syntactic features of programs w.r.t. the classification sketched above; reasoning about the existence and the number of stable models; computing them. This new graph is similar to the DG, except it is more accurate for negative dependencies, and thus has been called EDG (Extended Dependency Graph).
The definition is based upon distinguishing among rules defining the same atom, i.e, having the same head. To establish this distinction, we assign to each head an upper index, starting from , e.g., becomes . However, for the sake of clarity, we write instead of . The main idea underlying the next definition is to create, for any atom , as many vertices in the graph as the rules with head (labeled etc.).
Definition 5
(Extended dependency graph) (EDG)
For a logic program , its associated Extended Dependency Graph is the directed finite labeled graph defined below. The main idea underlying the definition of is that of creating, for any atom , as many vertices in the graph as the rules with head (labeled etc.).
 V:1

For each rule in there is a vertex , where is the name of the head and is the index of the rule in the definition of ,
 V.2:

for each atom never appearing in a head, there is a vertex simply labeled ;
 E.1:

for each , there is a positive edge , if and only if appears as a positive condition in the kth rule defining , and
 E.2:

for each , there is a negative edge , if and only if appears as a negative condition in the kth rule defining .
The definition of extends that of DG in the sense that for programs where atoms are defined by at most one rule the two coincide. Consider in Figure 1 the of the programs in Example 1. As all conditions in , and are negative, for the sake of simplicity, the ‘’ labels are omitted from edges.
The main idea underlying the definition of is that of creating, for any atom , as many vertices in the graph as the rules with head (labeled etc.). For instance, in (center of Figure 1) arc represents rule . On the graph, we clearly see the cycles, and also the handles. In fact, rule must be represented by the two arcs and since truth of may depend on any of its defining rules; the second one is auxiliary to the cycle, and corresponds to an OR handle. Therefore, the cycle has an OR handle if and only if there is an incoming arc originated in a duplication of one of the atoms of the cycle. In this case, the arc represents the handle of . In the same graph, arc represents instead the handle of . Therefore, a cycle has an AND handle if and only if there exists an incoming arc into that cycle in the , originated in (any duplication of) an atom not belonging to the cycle itself. A cycle with no incoming arcs is unconstrained.
It is easy to see that the of a program is isomorphic to the program itself. Consequently, the conveys enough information for reasoning about stable models of the program.
Coloring EDGs
This section describes how the can be used to study the stable models in terms of graph coloring. Let us define a coloring as an assignment of nodes of a graph to colors, e.g. . An interpretation corresponds to a coloring, where all the true atoms are green, and all the others are red.
We now specify which colorings we intend to rule out, since they trivially correspond to inconsistencies.
Definition 6
(nonadmissible coloring)
A coloring is nonadmissible for if and only if

and and , or

and and .
To sum it up, green nodes cannot be adjacent and edges to a red node cannot all come from red nodes.
A coloring for is admissible unless it is not admissible. A partial coloring is admissible if all its completions (intuitively) are.
Example 3
What are the admissible colorings for in Example 1?
In the center coloring above, arc violates admissibility. In fact, it corresponds to rule in . If is true/green, then by the rule cannot be concluded true/green. As a matter of fact, both and are true in the stable model of , but the truth of comes from, intuitively, labeling green in the first coloring. In the right coloring above, admissibility is violated by arcs and which, together, represent the rule of . When all s are red, we conclude false and –by the above rule–, true/green.
Now, we are able to define a notion of admissible coloring for EDG’s of Kernel programs.
Theorem 3
An interpretation is a stable model of if and only if it corresponds to an admissible coloring of .
We are implementing a practical system that computes stable models on the EDG [Brignoli et al. 1999]
. The coloring procedure is, experimentally, very sensitive to the choice of heuristic methods for starting the coloring itself from “relevant” nodes. In fact, presently the choice of the starting nodes is guided by the concept of extended cycle described earlier: we try identify nodes corresponding to crucial handles, and start from them. A main topic for our research now is clearly the study of new heuristic methods, as well as adapting existing solutions from graph theory.
Acknowledgments
Thanks to Chitta Baral and Michael Gelfond for constant encouragement in the pursuit of this research.
References
 [Apt & Bol 1994] Apt, K. R. and Bol, R., 1994. Logic programming and negation: a survey, J. of Logic Programming, 19/20.
 [Baral & Gelfond 1994] Baral, C. and Gelfond. M., 1994. Logic programming and knowledge representation, J. of Logic Programming, 19/20.
 [Brignoli et al. 1999] Brignoli G., Costantini S. and Provetti A., 1999. A Graph Coloring algorithm for stable models generation. Univ. of Milan Technical Report, submitted for publication.
 [Costantini, 1995] Costantini S., 1995. Contributions to the stable model semantics of logic programs with negation, Theoretical Computer Science, 149.
 [Cholewinński et al. 1996] Cholewiński P., Marek W. and Truszczyński M., 1996. Default reasoning system DeReS. Proc. of KR96, MorganKauffman, pp. 518528.
 [Cholewiński & Truszczyński 1996] Cholewiński P. and Truszczyński M., 1996. Extremal problems in logic programming and stable model computation. Proc. of IJCSLP’96, pp. 408–422. Also in J. of Logic Programming, 38(1999), pp. 219–242.

[Dimopoulos 1996]
Dimopoulos Y., 1996.
On Computing Logic Programs,
J. of Automated Reasoning, 17:259–289.
 [Dung 1992] Dung P.M., 1992. On the Relation between Stable and Well–Founded Semantics of Logic Programs, Theoretical Computer Science, 105.
 [Dunng & Kanchanasut 1989] Dung P.M. and Kanchanasut, 1989. Logic programming and stable model computation, Proc. of NACLP’89.
 [Eiter et al. 1997] Eiter, T., Leone, N., Mateis, C., Pfeifer, G., and Scarcello, F., 1997. A deductive system for nonmonotonic reasoning. Proc. Of the 4 th LPNMR Conference, Springer Verlag, LNCS 1265, pp. 363–374.
 [Gelfond & Lifschitz 1988] Gelfond, M. and Lifschitz, V., 1988. The stable model semantics for logic programming, Proc. of 5th ILPS conference, pp. 1070–1080.
 [Marek & Truszczyński 1991] Marek, W., and Truszczyński M., 1991. Autoepistemic Logic. The Journal of the ACM,38:588–619.
 [Marek & Truszczyński 1999] Marek, W., and Truszczyński M., 1999. Stable models and an alternative logic programming paradigm. The Journal of Logic Programming.
 [Niemelä & Simons 1998] Niemelä I. and Simons P., 1998. Logic programs with stable model semantics as a constraint programming paradigm. Proc. of NM’98 workshop. Extended version submitted for publication.
 [Saccà & Zaniolo 1997] Saccà D. and Zaniolo C., 1997. Deterministic and NonDeterministic Stable Models. J. of Logic and Computation.
 [Simons 1997] Simons P., 1997. Towards Constraint Satisfaction through Logic Programs and the Stable Models Semantics, Helsinki Univ. of Technology R.R. A:47.
 [Subrahmanian et al. 1995] Subrahmanian, V.S., Nau D., and Vago C., 1995. WFS + branch and bound = stable models, IEEE Trans. on Knowledge and Data Engineering, 7(3):362–377.
 [Van Gelder et al. 1990] Van Gelder A., Ross K.A. and Schlipf J., 1990. The WellFounded Semantics for General Logic Programs. Journal of the ACM Vol. 38 N. 3.

[Chen & Warren 1996]
Chen W., and Warren D.S., 1996.
Computation of stable models and its integration with logical
query processing,
IEEE Trans. on Data and Knowledge Engineering, 8(5):742–747.
Comments
There are no comments yet.