Negation as failure

From testwiki
Revision as of 10:49, 2 December 2024 by 2603:6081:100:1aa3:bd70:cff5:df63:e776 (talk) (Autoepistemic Semantics: Typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Negation As Failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive notp (i.e. that p is assumed not to hold) from failure to derive p. Note that notp can be different from the statement ¬p of the logical negation of p, depending on the completeness of the inference algorithm and thus also on the formal logic system.

Negation As Failure has been an important feature of logic programming since the earliest days of both Planner and Prolog. In Prolog, it is usually implemented using Prolog's extralogical constructs.

More generally, this kind of negation is known as Weak Negation,[1][2] in contrast with the strong (i.e. explicit, provable) negation.

Planner Semantics

In Planner, Negation As Failure could be implemented as follows:

if (not (goal p)), then (assert ¬p)

which says that if an exhaustive search to prove p fails, then assert ¬p.[3] This states that proposition p shall be assumed as "not true" in any subsequent processing. However, Planner not being based on a logical model, a logical interpretation of the preceding remains obscure.

Prolog Semantics

In pure Prolog, NAF literals of the form notp can occur in the body of clauses and can be used to derive other NAF literals. For example, given only the four clauses

pqnotr
qs
qt
t

NAF derives nots, notr and p as well as t and q.

Completion Semantics

The semantics of NAF remained an open issue until 1978, when Keith Clark showed that it is correct with respect to the completion of the logic program, where, loosely speaking, "only" and are interpreted as "if and only if", written as "iff" or "".

For example, the completion of the four clauses above is

pqnotr
qst
ttrue
rfalse
sfalse

The NAF inference rule simulates reasoning explicitly with the completion, where both sides of the equivalence are negated and negation on the right-hand side is distributed down to atomic formulae. For example, to show notp, NAF simulates reasoning with the equivalences

notpnotqr
notqnotsnott
nottfalse
notrtrue
notstrue

In the non-propositional case, the completion needs to be augmented with equality axioms, to formalize the assumption that individuals with distinct names are distinct. NAF simulates this by failure of unification. For example, given only the two clauses

p(a)
p(b)t

NAF derives notp(c).

The completion of the program is

p(X)X=aX=b

augmented with unique names axioms and domain closure axioms.

The completion semantics is closely related both to circumscription and to the closed world assumption.

Autoepistemic Semantics

The completion semantics justifies interpreting the result notp of a NAF inference as the classical negation ¬p of p. However, in 1987, Michael Gelfond showed that it is also possible to interpret notp literally as "p can not be shown", "p is not known" or "p is not believed", as in autoepistemic logic. The autoepistemic interpretation was developed further by Gelfond and Lifschitz in 1988, and is the basis of answer set programming.

The autoepistemic semantics of a pure Prolog program P with NAF literals is obtained by "expanding" P with a set of ground (variable-free) NAF literals Δ that is stable in the sense that

Template:Math

In other words, a set of assumptions Δ about what can not be shown is stable if and only if Δ is the set of all sentences that truly can not be shown from the program P expanded by Δ. Here, because of the simple syntax of pure Prolog programs, "implied by" can be understood very simply as derivability using modus ponens and universal instantiation alone.

A program can have zero, one or more stable expansions. For example,

pnotp

has no stable expansions.

pnotq

has exactly one stable expansion Template:Math

pnotq
qnotp

has exactly two stable expansions Template:Math and Template:Math

The autoepistemic interpretation of NAF can be combined with classical negation, as in extended logic programming and answer set programming. Combining the two negations, it is possible to express, for example

¬pnotp (the closed world assumption) and
pnot¬p (p holds by default).

Footnotes

Template:Reflist

References

Template:Refbegin

Template:Refend

  • Report from the W3C Workshop on Rule Languages for Interoperability. Includes notes on NAF and SNAF (scoped negation as failure).