foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
The top-down proof procedure for negation as failure with the variables and functions is much like the top-down procedure for propositional negation as failure. As with the unique names assumption, a problem arises when there are free variables in negated goals.
Consider the clauses
${p}{}{(}{X}{)}{\leftarrow}{\mathrm{\sim}}{}{q}{}{(}{X}{)}{\wedge}{}{r}{}{(}{X}{)}{.}$ | ||
${q}{}{(}{a}{)}{.}$ | ||
${q}{}{(}{b}{)}{.}$ | ||
${r}{}{(}{d}{)}{.}$ |
According to the semantics, there is only one answer to the query ${\text{\U0001d5ba\U0001d5cc\U0001d5c4}}{\mathit{\text{}}}{\mathit{}}{p}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$, which is ${X}{\mathrm{=}}{d}$. As ${r}{\mathit{}}{\mathrm{(}}{d}{\mathrm{)}}$ follows, so does ${\mathrm{\sim}}{q}{\mathit{}}{\mathrm{(}}{d}{\mathrm{)}}$ and so ${p}{\mathit{}}{\mathrm{(}}{d}{\mathrm{)}}$ logically follows from the knowledge base.
When the top-down proof procedure encounters ${\mathrm{\sim}}{q}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$, it should not try to prove ${q}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$, which succeeds (with substitution ${\mathrm{\{}}{X}{\mathrm{/}}{a}{\mathrm{\}}}$). This would make the goal ${p}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$ fail, when it should succeed with ${X}{\mathrm{=}}{d}$. Thus, the proof procedure would be incomplete. Note that, if the knowledge base contained ${s}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}{\mathrm{\leftarrow}}{\mathrm{\sim}}{\mathit{}}{q}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$, the failure of ${q}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$ would mean ${s}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}$ succeeding. Thus, with negation as failure, incompleteness leads to unsoundness.
As with the unique names assumption (Section 13.7.2), a sound proof procedure should delay the negated subgoal until the free variable is bound.
We require a more complicated top-down procedure when there are calls to negation as failure with free variables:
Negation as failure goals that contain free variables must be delayed until the variables become bound.
If the variables never become bound, the goal flounders. In this case, you cannot conclude anything about the goal. The following example shows that you should do something more sophisticated for the case of floundering goals.
Consider the clauses:
${p}{}{(}{X}{)}{\leftarrow}{\mathrm{\sim}}{}{q}{}{(}{X}{)}$ | ||
${q}{}{(}{X}{)}{\leftarrow}{\mathrm{\sim}}{}{r}{}{(}{X}{)}$ | ||
${r}{}{(}{a}{)}$ |
and the query
${\text{\U0001d622\U0001d634\U0001d62c}}{\mathit{\text{}}}{}{p}{}{(}{X}{)}{.}$ |
The completion of the knowledge base is
${p}{}{(}{X}{)}{\leftrightarrow}{\mathrm{\neg}}{}{q}{}{(}{X}{)}{,}$ | ||
${q}{}{(}{X}{)}{\leftrightarrow}{\mathrm{\neg}}{}{r}{}{(}{X}{)}{,}$ | ||
${r}{}{(}{X}{)}{\iff}{X}{=}{a}{.}$ |
Substituting ${X}{\mathrm{=}}{a}$ for ${r}$ gives ${q}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}{\mathrm{\leftrightarrow}}{\mathrm{\neg}}{\mathit{}}{X}{\mathrm{=}}{a}$, and so ${p}{\mathit{}}{\mathrm{(}}{X}{\mathrm{)}}{\mathrm{\leftrightarrow}}{X}{\mathrm{=}}{a}$. Thus, there is one answer, namely ${X}{\mathrm{=}}{a}$, but delaying the goal will not help find it. A proof procedure should analyze the cases for which the goal failed to derive this answer. However, such a procedure is beyond the scope of this book.