HOME

TheInfoList



OR:

The concept of a stable model, or answer set, is used to define a declarative
semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy Philosophy (f ...
for logic programs with
negation as failure Negation as failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive \mathrm~p (i.e. that ~p is assumed not to hold) from failure to derive ~p. Note that \mathrm ~p can be different from the statement \neg p ...
. This is one of several standard approaches to the meaning of
negation In logic, negation, also called the logical complement, is an operation that takes a proposition P to another proposition "not P", written \neg P, \mathord P or \overline. It is interpreted intuitively as being true when P is false, and false ...
in logic programming, along with program completion and the
well-founded semantics In logic programming, the well-founded semantics is one definition of how we can make conclusions from a set of logical rules. In logic programming, we give a computer a set of facts, and a set of "inference rules" about how these facts relate. Th ...
. The stable model semantics is the basis of answer set programming.


Motivation

Research on the declarative semantics of negation in logic programming was motivated by the fact that the behavior of SLDNF resolution — the generalization of
SLD resolution SLD resolution (''Selective Linear Definite'' clause resolution) is the basic inference rule used in logic programming. It is a refinement of resolution, which is both sound and refutation complete for Horn clauses. The SLD inference rule Given ...
used by
Prolog Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
in the presence of negation in the bodies of rules — does not fully match the
truth tables A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional argumen ...
familiar from classical
propositional logic Propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. It deals with propositions (which can be true or false) and relations b ...
. Consider, for instance, the program :p\ :r \leftarrow p,\ q :s \leftarrow p,\ \operatorname q. Given this program, the query will succeed, because the program includes as a fact; the query will fail, because it does not occur in the head of any of the rules. The query will fail also, because the only rule with in the head contains the subgoal in its body; as we have seen, that subgoal fails. Finally, the query succeeds, because each of the subgoals , \operatorname q succeeds. (The latter succeeds because the corresponding positive goal fails.) To sum up, the behavior of SLDNF resolution on the given program can be represented by the following truth assignment: : On the other hand, the rules of the given program can be viewed as
propositional formula In propositional logic, a propositional formula is a type of syntactic formula which is well formed and has a truth value. If the values of all variables in a propositional formula are given, it determines a unique truth value. A propositional fo ...
s if we identify the comma with conjunction \land, the symbol \operatorname with negation \neg, and agree to treat F \leftarrow G as the implication G \rightarrow F written backwards. For instance, the last rule of the given program is, from this point of view, alternative notation for the propositional formula :p \land \neg q \rightarrow s. If we calculate the
truth value In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth, which in classical logic has only two possible values (''true'' or '' false''). Computing In some progr ...
s of the rules of the program for the truth assignment shown above then we will see that each rule gets the value T. In other words, that assignment is a
model A model is an informative representation of an object, person or system. The term originally denoted the plans of a building in late 16th-century English, and derived via French and Italian ultimately from Latin ''modulus'', a measure. Models c ...
of the program. But this program has also other models, for instance : Thus one of the models of the given program is special in the sense that it correctly represents the behavior of SLDNF resolution. What are the mathematical properties of that model that make it special? An answer to this question is provided by the definition of a stable model.


Relation to nonmonotonic logic

The meaning of negation in logic programs is closely related to two theories of nonmonotonic reasoning — autoepistemic logic and
default logic Default logic is a non-monotonic logic proposed by Raymond Reiter to formalize reasoning with default assumptions. Default logic can express facts like “by default, something is true”; by contrast, standard logic can only express that somethi ...
. The discovery of these relationships was a key step towards the invention of the stable model semantics. The syntax of autoepistemic logic uses a
modal operator A modal connective (or modal operator) is a logical connective for modal logic. It is an operator which forms propositions from propositions. In general, a modal operator has the "formal" property of being non-truth-functional in the following sen ...
that allows us to distinguish between what is true and what is believed.
Michael Gelfond Michael Gelfond is a Professor in Computer Sciences at Texas Tech University in the United States. He received a degree in mathematics from the Steklov Institute of Mathematics in Russia in 1974 and emigrated to the United States in 1978. Gelfond's ...
987proposed to read \operatorname p in the body of a rule as "p is not believed", and to understand a rule with negation as the corresponding formula of autoepistemic logic. The stable model semantics, in its basic form, can be viewed as a reformulation of this idea that avoids explicit references to autoepistemic logic. In default logic, a default is similar to an
inference rule In the philosophy of logic, a rule of inference, inference rule or transformation rule is a logical form consisting of a function which takes premises, analyzes their syntax, and returns a conclusion (or conclusions). For example, the rule of in ...
, except that it includes, besides its premises and conclusion, a list of formulas called justifications. A default can be used to derive its conclusion under the assumption that its justifications are consistent with what is currently believed. Nicole Bidoit and Christine Froidevaux 987proposed to treat negated atoms in the bodies of rules as justifications. For instance, the rule :s \leftarrow p,\ \operatorname q can be understood as the default that allows us to derive s from p assuming that \neg q is consistent. The stable model semantics uses the same idea, but it does not explicitly refer to default logic.


Stable models

The definition of a stable model below, reproduced from elfond and Lifschitz, 1988 uses two conventions. First, a truth assignment is identified with the set of atoms that get the value T. For instance, the truth assignment : is identified with the set \. This convention allows us to use the set inclusion relation to compare truth assignments with each other. The smallest of all truth assignments \emptyset is the one that makes every atom false; the largest truth assignment makes every atom true. Second, a logic program with variables is viewed as shorthand for the set of all ground instances of its rules, that is, for the result of substituting variable-free terms for variables in the rules of the program in all possible ways. For instance, the logic programming definition of even numbers :\operatorname(0)\ :\operatorname(s(X))\leftarrow \operatorname \operatorname(X) is understood as the result of replacing in this program by the ground terms :0,\ s(0),\ s(s(0)),\dots. in all possible ways. The result is the infinite ground program :\operatorname(0)\ :\operatorname(s(0))\leftarrow \operatorname \operatorname(0) :\operatorname(s(s(0)))\leftarrow \operatorname \operatorname(s(0)) :\dots


Definition

Let be a set of rules of the form :A \leftarrow B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ where A,B_,\dots,B_,C_,\dots,C_ are ground atoms. If does not contain negation (n=0 in every rule of the program) then, by definition, the only stable model of is its model that is minimal relative to set inclusion. (Any program without negation has exactly one minimal model.) To extend this definition to the case of programs with negation, we need the auxiliary concept of the reduct, defined as follows. For any set of ground atoms, the ''reduct'' of relative to is the set of rules without negation obtained from by first dropping every rule such that at least one of the atoms in its body :B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ belongs to , and then dropping the parts \operatorname C_,\dots,\operatorname C_ from the bodies of all remaining rules. We say that is a ''stable model'' of if is the stable model of the reduct of relative to . (Since the reduct does not contain negation, its stable model has been already defined.) As the term "stable model" suggests, every stable model of is a model of .


Example

To illustrate these definitions, let us check that \ is a stable model of the program :p\ :r \leftarrow p,\ q :s \leftarrow p,\ \operatorname q. The reduct of this program relative to \ is :p\ :r \leftarrow p,\ q :s \leftarrow p. (Indeed, since q\not\in\, the reduct is obtained from the program by dropping the part \operatorname q.\ ) The stable model of the reduct is \. (Indeed, this set of atoms satisfies every rule of the reduct, and it has no proper subsets with the same property.) Thus after computing the stable model of the reduct we arrived at the same set \ that we started with. Consequently, that set is a stable model. Checking in the same way the other 15 sets consisting of the atoms p,\ q,\ r,\ s shows that this program has no other stable models. For instance, the reduct of the program relative to \ is :p\ :r \leftarrow p,\ q. The stable model of the reduct is \, which is different from the set \ that we started with.


Programs without a unique stable model

A program with negation may have many stable models or no stable models. For instance, the program :p \leftarrow \operatorname q :q \leftarrow \operatorname p has two stable models \, \. The one-rule program :p \leftarrow \operatorname p has no stable models. If we think of the stable model semantics as a description of the behavior of
Prolog Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
in the presence of negation then programs without a unique stable model can be judged unsatisfactory: they do not provide an unambiguous specification for Prolog-style query answering. For instance, the two programs above are not reasonable as Prolog programs — SLDNF resolution does not terminate on them. But the use of stable models in answer set programming provides a different perspective on such programs. In that programming paradigm, a given search problem is represented by a logic program so that the stable models of the program correspond to solutions. Then programs with many stable models correspond to problems with many solutions, and programs without stable models correspond to unsolvable problems. For instance, the
eight queens puzzle The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. There are 92 solutions. ...
has 92 solutions; to solve it using answer set programming, we encode it by a logic program with 92 stable models. From this point of view, logic programs with exactly one stable model are rather special in answer set programming, like polynomials with exactly one root in algebra.


Properties of the stable model semantics

In this section, as in the definition of a stable model above, by a logic program we mean a set of rules of the form :A \leftarrow B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ where A,B_,\dots,B_,C_,\dots,C_ are ground atoms. ;''Head atoms'': If an atom belongs to a stable model of a logic program then is the head of one of the rules of . ;''Minimality'': Any stable model of a logic program is minimal among the models of relative to set inclusion. ;''The antichain property'': If and are stable models of the same logic program then is not a proper subset of . In other words, the set of stable models of a program is an
antichain In mathematics, in the area of order theory, an antichain is a subset of a partially ordered set such that any two distinct elements in the subset are incomparable. The size of the largest antichain in a partially ordered set is known as its wid ...
. ;''NP-completeness'': Testing whether a finite ground logic program has a stable model is
NP-complete In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryi ...
.


Relation to other theories of negation as failure


Program completion

Any stable model of a finite ground program is not only a model of the program itself, but also a model of its completion arek and Subrahmanian, 1989 The converse, however, is not true. For instance, the completion of the one-rule program :p \leftarrow p is the tautology p \leftrightarrow p. The model \emptyset of this tautology is a stable model of p \leftarrow p, but its other model \\ is not. François Fages
994 Year 994 ( CMXCIV) was a common year starting on Monday (link will display the full calendar) of the Julian calendar. Events By place Byzantine Empire * September 15 – Battle of the Orontes: Fatimid forces, under Turkish gener ...
found a syntactic condition on logic programs that eliminates such counterexamples and guarantees the stability of every model of the program's completion. The programs that satisfy his condition are called ''tight''. Fangzhen Lin and Yuting Zhao 004showed how to make the completion of a nontight program stronger so that all its nonstable models will be eliminated. The additional formulas that they add to the completion are called ''loop formulas''.


Well-founded semantics

The well-founded model of a logic program partitions all ground atoms into three sets: true, false and unknown. If an atom is true in the well-founded model of P then it belongs to every stable model of P. The converse, generally, does not hold. For instance, the program :p \leftarrow \operatorname q :q \leftarrow \operatorname p :r\leftarrow p :r\leftarrow q has two stable models, \ and \. Even though r belongs to both of them, its value in the well-founded model is ''unknown''. Furthermore, if an atom is false in the well-founded model of a program then it does not belong to any of its stable models. Thus the well-founded model of a logic program provides a lower bound on the intersection of its stable models and an upper bound on their union.


Strong negation


Representing incomplete information

From the perspective of
knowledge representation Knowledge representation and reasoning (KRR, KR&R, KR²) is the field of artificial intelligence (AI) dedicated to representing information about the world in a form that a computer system can use to solve complex tasks such as diagnosing a medic ...
, a set of ground atoms can be thought of as a description of a complete state of knowledge: the atoms that belong to the set are known to be true, and the atoms that do not belong to the set are known to be false. A possibly ''incomplete'' state of knowledge can be described using a consistent but possibly incomplete set of literals; if an atom p does not belong to the set and its negation does not belong to the set either then it is not known whether p is true or false. In the context of logic programming, this idea leads to the need to distinguish between two kinds of negation — ''
negation as failure Negation as failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive \mathrm~p (i.e. that ~p is assumed not to hold) from failure to derive ~p. Note that \mathrm ~p can be different from the statement \neg p ...
'', discussed above, and ''strong negation'', which is denoted here by \sim. call the second negation ''classical'' and denote it by \neg. The following example, illustrating the difference between the two kinds of negation, belongs to John McCarthy. A school bus may cross railway tracks under the condition that there is no approaching train. If we do not necessarily know whether a train is approaching then the rule using negation as failure :\hbox \leftarrow \hbox is not an adequate representation of this idea: it says that it's okay to cross ''in the absence of information'' about an approaching train. The weaker rule, that uses strong negation in the body, is preferable: :\hbox \leftarrow \,\sim\hbox. It says that it's okay to cross if we ''know'' that no train is approaching.


Coherent stable models

To incorporate strong negation in the theory of stable models, Gelfond and Lifschitz 991allowed each of the expressions A, B_i, C_i in a rule :A \leftarrow B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ to be either an atom or an atom prefixed with the strong negation symbol. Instead of stable models, this generalization uses ''answer sets'', which may include both atoms and atoms prefixed with strong negation. An alternative approach erraris and Lifschitz, 2005treats strong negation as a part of an atom, and it does not require any changes in the definition of a stable model. In this theory of strong negation, we distinguish between atoms of two kinds, ''positive'' and ''negative'', and assume that each negative atom is an expression of the form \sim A, where A\ is a positive atom. A set of atoms is called ''coherent'' if it does not contain "complementary" pairs of atoms \ A,\sim A. Coherent stable models of a program are identical to its consistent answer sets in the sense of elfond and Lifschitz, 1991 For instance, the program :p \leftarrow \operatorname q :q \leftarrow \operatorname p :r\ :\sim r\leftarrow \operatornamep has two stable models, \\ and \ \. The first model is coherent; the second is not, because it contains both the atom \ r and the atom \ \sim r.


Closed world assumption

According to elfond and Lifschitz, 1991 the
closed world assumption The closed-world assumption (CWA), in a formal system of logic used for knowledge representation, is the presumption that a statement that is true is also known to be true. Therefore, conversely, what is not currently known to be true, is false. Th ...
for a predicate p\ can be expressed by the rule :\sim p(X_1,\dots,X_n)\leftarrow\operatornamep(X_1,\dots,X_n) (the relation p\ does not hold for a tuple X_1,\dots,X_n if there is no evidence that it does). For instance, the stable model of the program :p(a,b)\ :p(c,d)\ :\sim p(X,Y)\leftarrow\operatornamep(X,Y) consists of 2 positive atoms :p(a,b),\ p(c,d)\ and 14 negative atoms :\sim p(a,a),\ \sim p(a,c),\ \dots i.e., the strong negations of all other positive ground atoms formed from p,\ a,\ b,\ c,\ d. A logic program with strong negation can include the closed world assumption rules for some of its predicates and leave the other predicates in the realm of the
open world assumption In a formal system of logic used for knowledge representation, the open-world assumption is the assumption that the truth value of a statement may be true irrespective of whether or not it is ''known'' to be true. It is the opposite of the clos ...
.


Programs with constraints

The stable model semantics has been generalized to many kinds of logic programs other than collections of "traditional" rules discussed above — rules of the form :A \leftarrow B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ where A,B_,\dots,B_,C_,\dots,C_ are atoms. One simple extension allows programs to contain ''constraints'' — rules with the empty head: :\leftarrow B_,\dots,B_,\operatornameC_,\dots,\operatorname C_. Recall that a traditional rule can be viewed as alternative notation for a propositional formula if we identify the comma with conjunction \land, the symbol \operatorname with negation \neg, and agree to treat F \leftarrow G as the implication G \rightarrow F written backwards. To extend this convention to constraints, we identify a constraint with the negation of the formula corresponding to its body: :\neg(B_\land\cdots\land B_\land\neg C_\land\cdots\land\neg C_). We can now extend the definition of a stable model to programs with constraints. As in the case of traditional programs, we begin with programs that do not contain negation. Such a program may be inconsistent; then we say that it has no stable models. If such a program P is consistent then P has a unique minimal model, and that model is considered the only stable model of P. Next, stable models of arbitrary programs with constraints are defined using reducts, formed in the same way as in the case of traditional programs (see the definition of a stable model above). A set I of atoms is a ''stable model'' of a program P with constraints if the reduct of P relative to I has a stable model, and that stable model equals I. The properties of the stable model semantics stated above for traditional programs hold in the presence of constraints as well. Constraints play an important role in answer set programming because adding a constraint to a logic program P affects the collection of stable models of P in a very simple way: it eliminates the stable models that violate the constraint. In other words, for any program P with constraints and any constraint C, the stable models of P\cup\ can be characterized as the stable models of P that satisfy C.


Disjunctive programs

In a ''disjunctive rule'', the head may be the disjunction of several atoms: :A_1;\dots;A_k \leftarrow B_,\dots,B_,\operatorname C_,\dots,\operatorname C_ (the semicolon is viewed as alternative notation for disjunction \lor). Traditional rules correspond to k=1, and constraints to k=0. To extend the stable model semantics to disjunctive programs elfond and Lifschitz, 1991 we first define that in the absence of negation (n=0 in each rule) the stable models of a program are its minimal models. The definition of the reduct for disjunctive programs remains the same as before. A set I of atoms is a ''stable model'' of P if I is a stable model of the reduct of P relative to I. For example, the set \ is a stable model of the disjunctive program :p;q\ :r\leftarrow \operatorname q because it is one of two minimal models of the reduct :p;q\ :r.\ The program above has one more stable model, \. As in the case of traditional programs, each element of any stable model of a disjunctive program P is a head atom of P, in the sense that it occurs in the head of one of the rules of P. As in the traditional case, the stable models of a disjunctive program are minimal and form an antichain. Testing whether a finite disjunctive program has a stable model is \Sigma_2^-complete
and Gottlob, 1993 or AND may refer to: Logic, grammar, and computing * Conjunction (grammar), connecting two words, phrases, or clauses * Logical conjunction in mathematical logic, notated as "∧", "⋅", "&", or simple juxtaposition * Bitwise AND, a boole ...


Stable models of a set of propositional formulas

Rules, and even disjunctive rules, have a rather special syntactic form, in comparison with arbitrary
propositional formula In propositional logic, a propositional formula is a type of syntactic formula which is well formed and has a truth value. If the values of all variables in a propositional formula are given, it determines a unique truth value. A propositional fo ...
s. Each disjunctive rule is essentially an implication such that its antecedent (the body of the rule) is a conjunction of literals, and its
consequent A consequent is the second half of a hypothetical proposition. In the standard form of such a proposition, it is the part that follows "then". In an implication, if ''P'' implies ''Q'', then ''P'' is called the antecedent and ''Q'' is called ...
(head) is a disjunction of atoms. David Pearce
997 Year 997 (Roman numerals, CMXCVII) was a common year starting on Friday (link will display the full calendar) of the Julian calendar. Events By place Japan * 1 February: Empress Teishi gives birth to Princess Shushi - she is the first ...
and Paolo Ferraris 005showed how to extend the definition of a stable model to sets of arbitrary propositional formulas. This generalization has applications to answer set programming. Pearce's formulation looks very different from the original definition of a stable model. Instead of reducts, it refers to ''equilibrium logic'' — a system of
nonmonotonic logic A non-monotonic logic is a formal logic whose conclusion relation is not monotonic. In other words, non-monotonic logics are devised to capture and represent defeasible inferences (cf. defeasible reasoning), i.e., a kind of inference in which ...
based on Kripke models. Ferraris's formulation, on the other hand, is based on reducts, although the process of constructing the reduct that it uses differs from the one described above. The two approaches to defining stable models for sets of propositional formulas are equivalent to each other.


General definition of a stable model

According to erraris, 2005 the ''reduct'' of a propositional formula F relative to a set I of atoms is the formula obtained from F by replacing each maximal subformula that is not satisfied by I with the logical constant \bot (false). The ''reduct'' of a set P of propositional formulas relative to I consists of the reducts of all formulas from P relative to I. As in the case of disjunctive programs, we say that a set I of atoms is a ''stable model'' of P if I is minimal (with respect to set inclusion) among the models of the reduct of P relative to I. For instance, the reduct of the set :\ relative to \ is :\. Since \ is a model of the reduct, and the proper subsets of that set are not models of the reduct, \ is a stable model of the given set of formulas. We have seen that \ is also a stable model of the same formula, written in logic programming notation, in the sense of the original definition. This is an instance of a general fact: in application to a set of (formulas corresponding to) traditional rules, the definition of a stable model according to Ferraris is equivalent to the original definition. The same is true, more generally, for programs with constraints and for disjunctive programs.


Properties of the general stable model semantics

The theorem asserting that all elements of any stable model of a program P are head atoms of P can be extended to sets of propositional formulas, if we define head atoms as follows. An atom A is a ''head atom'' of a set P of propositional formulas if at least one occurrence of A in a formula from P is neither in the scope of a negation nor in the antecedent of an implication. (We assume here that equivalence is treated as an abbreviation, not a primitive connective.) The minimality and the antichain property of stable models of a traditional program do not hold in the general case. For instance, (the singleton set consisting of) the formula :p\lor\neg p has two stable models, \empty and \. The latter is not minimal, and it is a proper superset of the former. Testing whether a finite set of propositional formulas has a stable model is \Sigma_2^-complete, as in the case of disjunctive programs.


See also

* Answer set programming *
Logic programming Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic prog ...
*
Negation as failure Negation as failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive \mathrm~p (i.e. that ~p is assumed not to hold) from failure to derive ~p. Note that \mathrm ~p can be different from the statement \neg p ...


Notes


References

* * * * * * * * * * * * * *{{cite journal , author1-link=Raymond Reiter , first=R. , last=Reiter , title=A logic for default reasoning , journal=Artificial Intelligence , volume=13 , issue= 1–2, pages=81–132 , date=1980 , doi= 10.1016/0004-3702(80)90014-4, url=http://www.umiacs.umd.edu/~horty/courses/readings/reiter-default-1980.pdf Logic programming Model theory