Skip to content

Negation as Failure

Treat a ground goal's finite, exhaustive proof failure under a declared logic program and search semantics as defeasible support for weak default negation, while preserving nonmonotonicity, nontermination, floundering, and classical-negation boundaries.

Version
v3 · 2026-09-06 · History
Domain-specific #
2358
Origin domain
computer science
Subdomain
logic programming and nonmonotonic reasoning
Aliases
NAF, Negation by failure, Finite failure negation

Core Idea

Negation as Failure (NAF) is a nonmonotonic inference rule in logic programming that lets not p succeed when a proof attempt for p finitely and exhaustively fails relative to a declared program and operational semantics. Its conclusion is weak or default negation—roughly “p is not derivable here”—not automatically the classical proposition ¬p. The rule turns absence of a successful derivation into a usable, defeasible assumption only when the search has the right scope and termination properties.[1][2]

For a program \(P\) and a suitably ground goal \(A\), the operational core is

\[ \frac{P\not\vdash_{\mathrm{fin}} A}{P\vdash \operatorname{not} A}, \]

where the numerator does not mean an unbounded philosophical absence of proof. It means that the proof procedure's search tree for \(A\) finitely fails under its selection rule and program semantics. If the search diverges, NAF has no licensed failure result. If the procedure is incomplete, failure may reflect the procedure rather than the program. If the goal contains unbound variables, a procedural implementation may test whether some witness exists rather than construct the complement, producing the classic floundering or unsound-use boundary.[2][3]

In Prolog, the operator \+ Goal is conventionally read as “Goal cannot be proven” and is implemented as a control structure. It calls the goal; if the goal succeeds, negation fails, and if the goal finitely fails, negation succeeds. Bindings made during the attempted proof do not escape a successful negation. SWI-Prolog deliberately deprecates the synonym not/1 because it too easily suggests classical logical negation.[4]

The locked identity is:

a declared logic program and operational semantics + a selected, normally ground goal p + an exhaustive finite attempt to derive p + failure with no successful branch + a rule that returns weak/default not-p while discarding attempted bindings + an explicit validity envelope for termination, completeness, variable grounding, recursion through negation, and classical-negation separation -> a defeasible negative conclusion that may be withdrawn when program facts or rules change.

NAF is reusable across Prolog, deductive databases, normal logic programs, closed-world query evaluation, and nonmonotonic knowledge representation. It is not merely one failed query. Its identity is the rule that promotes a qualified derivation failure into default-negative support.

Structural Signature

Sig role-phrases:

  • the declared program — facts and rules relative to which derivability is tested
  • the operational semantics — selection rule, unification behavior, tabling or depth-first search, and treatment of recursion and negation
  • the candidate goal — the atom or subgoal \(p\), normally ground at the time negation is selected
  • the attempted derivation — the search for a successful proof of \(p\)
  • the finite-failure certificate — exhaustion of every admissible branch without success, distinguished from timeout, error, pruning, or divergence
  • the failure-to-negation rule — the operator that lets not p succeed because \(p\) finitely failed
  • the weak-negative conclusion — a default statement about non-derivability, not necessarily an explicit object-language ¬p
  • the binding firewall — attempted bindings inside the negated goal are not returned as constructive negative answers
  • the nonmonotonic dependency — later facts or rules that make \(p\) derivable can retract conclusions depending on not p
  • the semantic envelope — completion, stratification, stable-model, well-founded, or other interpretation under which the operational result is assessed
  • the danger surface — nontermination, nonground floundering, recursion through negation, incomplete search, cuts, side effects, and hidden open-world predicates

Recognition test. Identify the exact program and goal; show that the positive proof attempt finitely exhausts the relevant search; state whether the goal is ground; name the semantics under which not p is interpreted; and keep default negation separate from explicit ¬p. Then perturb the program. If adding a fact for \(p\) can retract the negative conclusion or a conclusion derived from it, the nonmonotonic role is present. A timeout, missing database row under an open-world policy, thrown exception, pruned search, or unattempted proof does not satisfy the finite-failure role.

What It Is Not

  • Not classical negation. not p records non-derivability under a program and procedure; ¬p is an object-language assertion that \(p\) is false.
  • Not proof by contradiction. NAF does not assume \(p\) and derive an inconsistency. It attempts to derive \(p\) and reacts to finite failure.
  • Not contraposition. From failure to establish a consequent, NAF does not infer the negation of an antecedent through a classical implication.
  • Not mere absence from storage. A database may derive a fact through rules even when no row stores it directly. NAF tests derivability, not string membership.
  • Not every failed computation. Exceptions, timeouts, resource exhaustion, cuts that prune alternatives, permission failures, and network errors are not logical finite failure.
  • Not monotonic deduction. Adding information can invalidate a prior default-negative conclusion.
  • Not a constructive complement enumerator. \+ p(X) does not generally enumerate all values for which \(p\) is false; with a free variable it typically asks whether any proof of p(X) exists.
  • Not safe under arbitrary recursion through negation. Cycles can yield undefined, multiple, or no acceptable models depending on semantics.
  • Not identical to the closed-world assumption. CWA is a broader knowledge-base policy; NAF is an operational inference rule that can implement part of such a policy under stated conditions.
  • Not licensed by a search timeout. “No proof found yet” is not “every proof branch finitely failed.”

Scope of Application

NAF is native to logic programming and closely related rule-based systems.

  • Prolog execution. \+ Goal provides a semidet control test that succeeds when the called goal cannot be proven by the current execution.[4]
  • Normal logic programs. Negative literals in rule bodies allow defaults and exceptions, with semantics supplied by completion, stratification, stable models, well-founded models, or related frameworks.[2][5]
  • Deductive databases and Datalog variants. A closed predicate with finite data and terminating rules can use non-derivability to answer negative queries or guard derived relations.
  • Knowledge representation. Defaults such as “normally birds fly unless abnormal” use NAF to represent defeasible absence of an exception.[3]
  • Answer-set and extended logic programming. Default negation coexists with explicit strong negation, but the chosen stable-model or answer-set semantics—not Prolog's depth-first behavior alone—determines accepted models.
  • Rule engines and policy systems. Negative guards can enable a rule when no exception, prohibition, or higher-priority condition is derivable, provided the guarded predicate is closed and evaluation terminates.

The scope is narrowest where information is open-ended. Web knowledge, distributed services, incomplete medical records, and partially synchronized inventories often make “not found” a statement about collection coverage rather than truth. NAF can still be used, but only after the relevant predicate is explicitly closed or given a scoped completeness contract.

Clarity

Four outcomes must be distinguished for a goal \(p\):

  1. Success: at least one derivation of \(p\) succeeds, so not p fails.
  2. Finite failure: every relevant derivation branch closes without success, so not p succeeds.
  3. Divergence: evaluation does not terminate, so neither \(p\) nor not p receives a finite operational answer.
  4. Error or pruned search: the system stops for a reason that does not certify failure, so NAF is not licensed without an explicit semantics that reclassifies the event.

This distinction prevents a timeout from masquerading as negative evidence. It also reveals the role of search order. Pure logical consequences may be selection-rule independent under ideal conditions, while Prolog's depth-first, left-to-right procedure can loop on one clause ordering and terminate on another. NAF inherits that procedural exposure.[3]

Groundness is another clarity boundary. Consider a database containing bird(tweety). The query \+ bird(X) fails because bird(X) has a witness; it does not return all non-birds. To test one individual, bind X first and then call the negative goal. Delaying negation until variables are ground, using constructive negation, or using a semantics designed for nonground queries are different repairs—not cosmetic restatements.

Finally, distinguish the operator from its declarative readings. Clark's program completion relates successful NAF reasoning to a completed definition under conditions.[1] Well-founded semantics can assign true, false, or undefined to atoms in programs with negation and gives one way to represent unresolved negative cycles.[5] These frameworks explain or regularize NAF; they are not identical to the raw operational rule.

Manages Complexity

NAF lets a rule system represent exceptions without enumerating every negative fact. In a finite personnel database, for example, it is often cheaper to store suspended(alex) for exceptional cases and use not suspended(User) as a guard than to maintain an explicit not_suspended fact for every ordinary account. The rule compresses a potentially large negative extension into a proof-failure test.

The gain is accompanied by a coverage obligation. The system must know which predicates are complete enough to close. A useful architecture partitions predicates into open, closed, and derived sets; requires negative calls to be ground; stratifies dependencies where possible; and treats undefined or nonterminating evaluations as separate from false. This turns a vague default into an auditable policy.

Dependency analysis manages updates. If eligible(X) depends on not disqualified(X), every negative support should record its dependency on the absence of a proof for disqualified(X). When a new disqualifying fact arrives, the system can retract or recompute affected conclusions. Stable-model and well-founded approaches make such dependency structure explicit at the semantic level, while tabling can prevent some repeated work and expose negative cycles.

NAF also localizes failures. An unexpected negative conclusion can be diagnosed by asking: Was the positive goal ground? Did every branch actually fail? Was the predicate closed? Did a cut hide alternatives? Did recursion through negation make the value undefined? Was a remote fact source unavailable? These questions are much sharper than “the rule engine said no.”

Abstract Reasoning

NAF changes the logic of information growth. In a monotonic system, if \(P\vdash q\), then \(P\cup P'\vdash q\). With NAF, a conclusion can depend on \(\operatorname{not}p\), and adding a proof of \(p\) defeats that support. If

\[ \mathrm{flies}(x) \leftarrow \mathrm{bird}(x)\land \operatorname{not}\,\mathrm{abnormal}(x), \]

then bird(tweety) may yield flies(tweety) while abnormal(tweety) is not derivable. Adding ostrich(tweety) and abnormal(X) :- ostrich(X) retracts the default conclusion without creating a classical contradiction.[3]

Negative dependency graphs reveal the hard cases. A stratified program assigns levels so a predicate depends negatively only on lower levels; evaluation can settle lower strata before using their failure. By contrast,

p :- not q.
q :- not p.

contains a negative cycle. It has two stable alternatives in the familiar ground reading, while well-founded semantics leaves both atoms undefined. The self-dependent p :- not p. has no stable model. These are not implementation glitches; they show that failure-based negation requires a semantics for circular justification.[5][2]

Counterfactual tests expose the rule. Add a fact proving the positive goal: does the negative conclusion retract? Replace finite failure with divergence: does the evaluator correctly withhold a negative answer? Open the predicate to an incomplete external source: is the conclusion downgraded from false to unknown? Move a negative call before its variables are bound: does behavior change? A correct NAF design makes each dependence explicit.

Knowledge Transfer

Within logic programming, the mechanism transfers literally across Prolog, deductive databases, normal logic programs, rule engines, and nonmonotonic knowledge systems: attempt the positive goal, distinguish finite failure from other outcomes, and use that failure as default-negative support under a declared semantics.

Outside formal rule systems, “absence of evidence is evidence of absence” resembles NAF only when the search or observation process is complete for the target. A warehouse may infer “no pallet in this bay” from a full scan; a clinician cannot infer “no disease” from an incomplete test panel. Those cases instantiate broader Assumption, Completeness, or Model Assumption Failure patterns unless there is a formal program whose derivation failure activates weak negation. The portable skeleton is qualified default inference from exhaustive absence. The named mechanism remains tied to logic-program syntax and semantics.

Examples

Canonical: birds, abnormality, and a retractable default

Use the program:

bird(tweety).
flies(X) :- bird(X), \+ abnormal(X).
abnormal(X) :- ostrich(X).

With no fact deriving abnormal(tweety), the ground call \+ abnormal(tweety) finitely fails on its positive subgoal and therefore succeeds; flies(tweety) is derived. Add ostrich(tweety). The program can now derive abnormal(tweety), so the negative guard fails and the earlier default conclusion is withdrawn. This is nonmonotonic revision, not inconsistency: the system never derived explicit ¬flies(tweety) from the first program. Flach and Sokol use this family of examples to show how new exception information cancels a default supported by NAF.[3]

Mapped back: the clauses are the declared program; abnormal(tweety) is the candidate goal; its initial finite failure is the certificate; \+ is the failure-to-negation rule; flies(tweety) depends on the weak-negative conclusion; and the added ostrich fact demonstrates the nonmonotonic dependency.

Applied / In Practice: a closed suspension guard

Suppose an access rule is may_enter(U) :- employee(U), \+ suspended(U). The employee and suspension tables are local, synchronized, finite, and declared complete for the current decision epoch. Evaluation first binds U through employee(U), then tests the ground goal suspended(U). For an employee absent from the suspension relation, exhaustive indexed lookup finitely fails and the guard succeeds. If a suspension record is later inserted, cached may_enter(U) conclusions must be invalidated. If the suspension service is unreachable, the result is unknown/error—not permission—because loss of the data source is not a finite proof failure in the declared program.

Mapped back: the synchronized tables and rules are the declared program; the bound user is the ground candidate goal; complete lookup supplies the finite-failure certificate; the access conclusion carries a negative dependency; insertion triggers nonmonotonic retraction; and service unavailability lies on the danger surface rather than proving safety.

Worked intervention — a bad nonground negative query. A developer writes eligible(X) :- \+ banned(X), applicant(X). Because X is unbound when the negative call runs, one banned person can make \+ banned(X) fail for every applicant. Reorder the body to bind X first, require a groundness assertion, and document that banned/1 is closed for the decision epoch. Then test a recursive case for termination. If the positive call can loop, use tabling or a semantics that can return undefined; never convert a watchdog timeout into NAF success.

Structural Tensions

T1: Concision versus hidden completeness. NAF avoids storing explicit negative facts, but the savings come from assuming the positive relation is closed enough for failure to matter. Diagnostic: Who guarantees that every relevant positive fact and derivation rule is present at the decision time?

T2: Operational speed versus declarative meaning. Prolog's cut-and-fail control behavior is efficient and concrete, while model-theoretic readings demand conditions that procedural execution may violate. Diagnostic: Is the claim only about what this engine does, or about truth in a completion, stable model, or well-founded model?

T3: Default usefulness versus nonmonotonic retraction. A useful conclusion can be drawn before all future information arrives, but every new fact can defeat negative support. Diagnostic: Are dependencies tracked so conclusions are recomputed when the positive goal becomes derivable?

T4: Finite failure versus nontermination. NAF needs failed exhaustive search, yet logic programs are only semidecidable in general and depth-first search may loop. Diagnostic: Does the evaluator prove finite failure, or merely stop waiting?

T5: Ground tests versus constructive complements. Ground negative guards behave predictably, while nonground users often expect enumeration of all counterexamples. Diagnostic: Are all variables bound before negation, and if not, is constructive negation or a delayed constraint mechanism required?

T6: Two-valued convenience versus undefined cycles. Treating every unproved atom as false simplifies a program, while recursion through negation can support multiple or no coherent two-valued models. Diagnostic: Is the negative dependency graph stratified, or must the semantics preserve an undefined value or multiple stable alternatives?

T7: Weak negation versus explicit falsity. Default not p is flexible under incomplete knowledge, while explicit ¬p can support contradiction detection and stronger inference. Diagnostic: Does the application need “not known/provable” or a positive assertion of falsity, and how are both represented if they coexist?

T8: Autonomy versus reduction. Formal System supplies rules and derivations, and Assumption supplies defeasible accepted propositions, but neither turns qualified proof failure into weak negation with procedural termination and floundering boundaries. Diagnostic: If failure-to-derive, finite search, and the weak/classical distinction are removed, can the parents still recognize or repair NAF? If not, the domain node remains autonomous.

Structural–Framed Character

Negation as Failure is mixed-structural. It is a precisely specified inference operator, but its meaning depends on the conventions and operational semantics of logic programming.

Vocabulary travels (0.75). Failure, proof, rule, default, and negation travel broadly; finite SLDNF failure, ground goal, floundering, completion, and stable or well-founded semantics remain specialist.

Evaluative weight (0.0). NAF is not inherently good or bad. Its conclusions can be warranted or unsafe depending on the search and completeness envelope.

Institutional origin (0.0). Languages standardize syntax, but a result follows from program clauses and evaluation semantics rather than institutional authority.

Human-practice boundedness (0.25). Logic programs are designed artifacts, yet their derivations and failures are mechanically determined once specified.

Import versus recognition (0.75). Prolog, deductive databases, and nonmonotonic rule systems recognize the same operator family. Calling an incomplete real-world search “negation as failure” usually imports the idea without its formal safeguards.

The portable skeleton is a defeasible assumption activated by exhaustive failure inside a formal system. Its character: strongly structural within logic programming, but pinned to specialist proof procedures and semantics.

Structural Core vs. Domain Accent

This section explains why Negation as Failure is domain-specific rather than a prime.

What is skeletal. A system attempts to establish a proposition, treats exhaustive failure as qualified negative support, and allows later evidence to retract conclusions that depended on that support. Assumption carries the defeasible proposition. Formal System carries symbols, rules, and derivation closure. Completeness supplies a related scope question about whether every relevant proof path is represented.

What is domain-bound. NAF requires a logic program, selected goal, unification and variable discipline, finite derivation failure, weak-negation syntax, operational search semantics, and a declarative interpretation for negative recursion. Its characteristic failures—floundering, SLDNF nontermination, cut sensitivity, stratification violations, multiple stable models, and well-founded undefinedness—are not generic absence reasoning. Remove those commitments and the identity becomes a broad default assumption.

Why this does not clear the prime bar. Literal transfer outside formal logic programs fails. A scientist who has not observed a particle may face incomplete measurement rather than a finite failed derivation; a missing database record may reflect synchronization delay. The general lesson belongs to Assumption, Completeness, and Model Assumption Failure. The name Negation as Failure remains justified because its specialist validity conditions are exactly what diagnose and repair logic-program behavior.

Negation as Failure presupposes Formal System. Its program, goal language, derivation rules, and operational semantics must be specified before proof failure has a determinate meaning.

It contains an Assumption role. The successful output not p is a proposition provisionally usable without a positive derivation of explicit ¬p; its warrant is the finite failure of \(p\). The parent does not supply the triggering proof search or nonmonotonic semantics.

Completeness is a close validity neighbor, not a universal parent. Safe negative inference requires enough closure or finite exhaustiveness for the target predicate, but an engine can instantiate NAF even where the result diverges or remains semantically undefined. Deductive Reasoning is also related rather than a genus because classical monotonic truth-preserving deduction does not capture defeasible failure-based support. Model Assumption Failure diagnoses what happens when a supposedly closed predicate or complete search is not; it is a failure mode, not the operator.

Relationships to Other Abstractions

Local relationship map for Negation as FailureParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Negation as FailureDOMAINPrime abstraction: Formal System — presupposesFormal SystemPRIME

Current abstraction Negation as Failure Domain-specific

Parents (1) — more general patterns this builds on

  • Negation as Failure presupposes Formal System Prime

    Negation as Failure presupposes Formal System. Its program, goal language, derivation rules, and operational semantics must be specified before proof failure has a determinate meaning.

Hierarchy paths (2) — routes to 2 parentless roots

Neighborhood in Abstraction Space

Negation as Failure sits in a sparse region of the domain-specific corpus (62nd percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Automata, Model Checking & Formal Semantics (10 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-09-08

Not to Be Confused With

  • Classical negation. ¬p asserts falsity in an object language; not p can mean only lack of derivability. Tell: Would adding a new rule for \(p\) retract the negative conclusion without contradiction?
  • Explicit or strong negation. Extended logic programs may contain a literal explicitly asserting -p as well as default not p. Tell: Is negative information stored/proved, or inferred from absence of a proof?
  • Closed-world assumption. CWA is a policy about treating unentailed facts as false, often at a knowledge-base boundary. Tell: Is the focus a world-closure policy or the operational success/failure of a negative subgoal?
  • Proof by contradiction. That method derives an impossibility from assuming the negation of a target. Tell: Was a contradiction derived, or did positive proof search simply finitely fail?
  • Contraposition. Contraposition reverses a classical implication. Tell: Is the result licensed by an implication's logical equivalence or by search failure?
  • Constructive negation. Constructive methods return constraints describing values that make a goal false. Tell: Does the operation produce negative bindings/constraints, or only semidet success without bindings?
  • Well-founded semantics. WFS assigns a unique partial model and can leave atoms undefined. Tell: Is the object the failure rule itself or one semantic framework for programs containing it?
  • Stable-model semantics. Stable models define globally self-supported sets of defaults and may be multiple or absent. Tell: Is a single procedural proof attempt being evaluated, or are whole candidate models being selected?
  • Model Assumption Failure. That prime marks loss of warrant when a load-bearing assumption is false. Tell: Is failure creating a default negative conclusion, or invalidating a model because its closure/completeness assumption broke?
  • Timeout or missing data. Stopping a search or failing to contact a source does not exhaust derivations. Tell: Is there a finite-failure certificate under the declared semantics?

References

[1] Clark, K. L. "Negation as Failure". In Gallaire, H., and Minker, J. (eds.), Logic and Data Bases, pp. 293–322, Plenum Press (1978). Foundational operational rule and program-completion account. registry ↩a ↩b

[2] Apt, K. R., and Bol, R. N. "Logic Programming and Negation: A Survey". Journal of Logic Programming 19–20, 9–71 (1994). Authoritative survey of proof-theoretic and model-theoretic approaches, termination, floundering, and semantics. registry ↩a ↩b ↩c ↩d

[3] Flach, P. A., and Sokol, K. Simply Logical: Intelligent Reasoning by Example. University of Bristol online edition (2015–2024). Authoritative teaching text for default reasoning, finite failure, nonground and nontermination boundaries. registry ↩a ↩b ↩c ↩d ↩e

[4] SWI-Prolog. "(\\+)/1 — Negation by Failure". Official implementation documentation, accessed 2026-08-26. Operational \\+ behavior and distinction from deprecated not/1 terminology. registry ↩a ↩b

[5] Van Gelder, A., Ross, K. A., and Schlipf, J. S. "The Well-Founded Semantics for General Logic Programs". Journal of the ACM 38(3), 620–650 (1991). Primary partial-model semantics for negative recursion and undefined atoms. registry ↩a ↩b ↩c