- Source: Negation as failure
Negation as failure (NAF, for short) is a non-monotonic inference rule in logic programming, used to derive
n
o
t
p
{\displaystyle \mathrm {not} ~p}
(i.e. that
p
{\displaystyle p}
is assumed not to hold) from failure to derive
p
{\displaystyle p}
. Note that
n
o
t
p
{\displaystyle \mathrm {not} ~p}
can be different from the statement
¬
p
{\displaystyle \neg p}
of the logical negation of
p
{\displaystyle 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, 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. 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
n
o
t
p
{\displaystyle \mathrm {not} ~p}
can occur in the body of clauses and can be used to derive other NAF literals. For example, given only the four clauses
p
←
q
∧
n
o
t
r
{\displaystyle p\leftarrow q\land \mathrm {not} ~r}
q
←
s
{\displaystyle q\leftarrow s}
q
←
t
{\displaystyle q\leftarrow t}
t
←
{\displaystyle t\leftarrow }
NAF derives
n
o
t
s
{\displaystyle \mathrm {not} ~s}
,
n
o
t
r
{\displaystyle \mathrm {not} ~r}
and
p
{\displaystyle p}
as well as
t
{\displaystyle t}
and
q
{\displaystyle 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
←
{\displaystyle \leftarrow }
are interpreted as "if and only if", written as "iff" or "
≡
{\displaystyle \equiv }
".
For example, the completion of the four clauses above is
p
≡
q
∧
n
o
t
r
{\displaystyle p\equiv q\land \mathrm {not} ~r}
q
≡
s
∨
t
{\displaystyle q\equiv s\lor t}
t
≡
t
r
u
e
{\displaystyle t\equiv \mathrm {true} }
r
≡
f
a
l
s
e
{\displaystyle r\equiv \mathrm {false} }
s
≡
f
a
l
s
e
{\displaystyle s\equiv \mathrm {false} }
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
n
o
t
p
{\displaystyle \mathrm {not} ~p}
, NAF simulates reasoning with the equivalences
n
o
t
p
≡
n
o
t
q
∨
r
{\displaystyle \mathrm {not} ~p\equiv \mathrm {not} ~q\lor r}
n
o
t
q
≡
n
o
t
s
∧
n
o
t
t
{\displaystyle \mathrm {not} ~q\equiv \mathrm {not} ~s\land \mathrm {not} ~t}
n
o
t
t
≡
f
a
l
s
e
{\displaystyle \mathrm {not} ~t\equiv \mathrm {false} }
n
o
t
r
≡
t
r
u
e
{\displaystyle \mathrm {not} ~r\equiv \mathrm {true} }
n
o
t
s
≡
t
r
u
e
{\displaystyle \mathrm {not} ~s\equiv \mathrm {true} }
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
)
←
{\displaystyle p(a)\leftarrow }
p
(
b
)
←
t
{\displaystyle p(b)\leftarrow t}
NAF derives
n
o
t
p
(
c
)
{\displaystyle \mathrm {not} ~p(c)}
.
The completion of the program is
p
(
X
)
≡
X
=
a
∨
X
=
b
{\displaystyle p(X)\equiv X=a\lor X=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
n
o
t
p
{\displaystyle \mathrm {not} ~p}
of a NAF inference as the classical negation
¬
p
{\displaystyle \neg p}
of
p
{\displaystyle p}
. However, in 1987, Michael Gelfond showed that it is also possible to interpret
n
o
t
p
{\displaystyle \mathrm {not} ~p}
literally as "
p
{\displaystyle p}
can not be shown", "
p
{\displaystyle p}
is not known" or "
p
{\displaystyle 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
Δ = {not p | p is not implied by P ∪ Δ}
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,
p
←
n
o
t
p
{\displaystyle p\leftarrow \mathrm {not} ~p}
has no stable expansions.
p
←
n
o
t
q
{\displaystyle p\leftarrow \mathrm {not} ~q}
has exactly one stable expansion Δ = {not q}
p
←
n
o
t
q
{\displaystyle p\leftarrow \mathrm {not} ~q}
q
←
n
o
t
p
{\displaystyle q\leftarrow \mathrm {not} ~p}
has exactly two stable expansions Δ1 = {not p} and Δ2 = {not q}.
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
¬
p
←
n
o
t
p
{\displaystyle \neg p\leftarrow \mathrm {not} ~p}
(the closed world assumption) and
p
←
n
o
t
¬
p
{\displaystyle p\leftarrow \mathrm {not} ~\neg p}
(
p
{\displaystyle p}
holds by default).
Footnotes
References
External links
Report from the W3C Workshop on Rule Languages for Interoperability. Includes notes on NAF and SNAF (scoped negation as failure).
Kata Kunci Pencarian:
- Negation as failure
- Negation
- Logic programming
- Stable model semantics
- Absys
- Planner (programming language)
- NAF
- Closed-world assumption
- Law of excluded middle
- History of artificial intelligence