ArticleslgStudy

science

Negation as failure

Negation as failure is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Negation as failure rather than just read about it. In short: 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} , dependi…

Key takeaways

  • Negation as failure belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Negation as failure to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Negation as failure from memory before moving on to harder problems.

Reference excerpt

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}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Negation as failure

Start with the simplest possible case. Write down what Negation as failure claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Negation as failure before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Negation as failure ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Negation as failure

In research
Negation as failure appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Negation as failure in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Negation as failure is common in secondary-school and first-year university syllabi. It links to neighbouring topics Logic programming, Rules of inference, so understanding it makes those chapters shorter.
In everyday life
Look for Negation as failure outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Negation as failure” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Negation as failure in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Negation as failure means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Negation as failure out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Negation as failure in simple terms?

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}…

Why does Negation as failure matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Negation as failure?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Negation as failure.

Tags

  • Logic programming
  • Rules of inference

Keep exploring