skip to content

Your containment knowledge base answers 'no' for a part nobody has recorded yet - what assumption did that answer make?

level: seniorimportance: must knowfreq 54%

answer

  1. the engine proved nothing, it failed
  2. absence of evidence read as evidence
  3. the world assumed complete
  4. not classical negation
  5. a new fact can retract an old answer

basics

~10 s

The closed-world assumption: anything not derivable from the recorded facts is treated as false. The engine proved nothing about that part - it merely failed to prove containment, and reported failure as a negative.

solid answer

~40 s

Logic engines implement a negative goal as **negation as failure**: to answer 'not contained', the engine tries to prove 'contained', and if that search finishes without success it reports the negation as true. That is only sound under the **closed-world assumption** - that the knowledge base holds everything true about the relation. A bill of materials that is still being entered violates that assumption, so 'this fastener is not inside the assembly' and 'nobody has entered this fastener's containment record' produce the identical answer, with nothing to tell them apart downstream. The repairs are all about restoring the distinction: record explicit negative facts, model 'unrecorded' as a third outcome rather than folding it into false, and apply the closed-world assumption only to relations whose data you own end to end.

code

pseudocode · 8 lines
pseudocode
rule safeToScrap(Part):
    knownPart(Part)                        # binds Part
    not partOf("mainAssembly", Part)       # both arguments bound here

# knownPart("bolt-9") succeeds; the engine then searches for
# partOf("mainAssembly", "bolt-9"), finds no derivation, and the
# negated goal succeeds - identically for a bolt that truly sits
# outside the assembly and one whose record was never entered

go deeper

for a junior

Remember what a 'no' from this kind of engine really says: not that the fact was disproved, but that nothing in the recorded facts proved it.

for a middle

Explain negation as failure and the closed-world assumption together, and show why an incomplete knowledge base turns that pairing into false negatives.

for a senior

Handle it in a real system: scope the assumption per relation, record negatives or an explicit unknown, and keep negated goals bound and terminating before any irreversible action reads the answer.

for a principal

Own the modelling stance - deciding which relations your platform treats as closed, and what every consumer is entitled to conclude from a 'no', is an interface commitment, not a query detail.

## What question the engine actually answered You asked whether the part is contained in the assembly. What the engine determined is whether containment is **derivable from the clauses currently loaded**. Those are different questions, and the gap between them is where this whole subject lives. The engine searched; the search ended without a proof; and it converted 'not provable' into 'false'. That conversion has a name and a licence. ## The closed-world assumption The **closed-world assumption** says that the knowledge base is complete for the relations it describes: everything true is recorded, so anything absent is false. Under it, converting failure into falsity is sound. The opposite stance - an **open-world** reading - says the knowledge base records what is known, and absence means nothing at all. Under it, the only honest answers are 'yes' and 'I cannot tell'. Neither stance is universally right; each is a modelling decision, and the defect is making it by accident. A closed world is a fine assumption for data you generate and own completely. It is the wrong assumption for a bill of materials being entered by people, imported in batches, or federated from suppliers - exactly the setting where the query looks most useful. ## Negation as failure The mechanism that implements the assumption is **negation as failure**: a negated goal succeeds precisely when the engine exhausts the search for the positive goal without proving it. Three properties follow, and each is a practical trap: - **It is not classical negation.** Classical negation asserts falsity; this asserts only that nothing here proves the positive. - **It is non-monotonic.** In a program without negation, adding a fact can only add answers. With negation as failure, adding a fact can **withdraw** a previously derived answer, because a negated goal that used to succeed now fails. Conclusions are not stable under new information. - **It depends on the search terminating.** If the positive goal loops, the negation never answers at all - so termination is a correctness concern here and not merely a performance one. A fourth trap is binding-related: negating a goal with unbound variables asks something different from what the author usually means. 'There is no whole containing this part' and 'there exists a whole that does not contain it' are different claims, and engines typically require the negated goal's arguments to be bound so the question is unambiguous. ## Where it bites in an incomplete knowledge base | what is true in the world | what is in the knowledge base | what a negated goal reports | |---|---|---| | the part is genuinely outside the assembly | nothing recorded | not contained | | the part is inside, record not yet entered | nothing recorded | not contained | | the part is inside, record entered | the containment fact | contained | Rows one and two are indistinguishable, and that is the whole defect. It is most dangerous where the answer drives an irreversible action - scrapping the part, unblocking a shipment, deleting the record - because the process is most likely to consult the knowledge base precisely while the data is still arriving. ## Restoring the distinction 1. **Scope the assumption.** Decide per relation whether your data is authoritative and complete. Closed-world reasoning over a relation you merely mirror is a bug waiting for a slow import. 2. **Record negatives explicitly.** An asserted 'this part is not inside this assembly' can be proved, which makes the negative answer as auditable as the positive one. 3. **Model the third outcome.** Make 'unrecorded' a value the query can return, so callers must handle it rather than receive it silently disguised as 'no'. 4. **Track completeness as data.** Mark an assembly's bill of materials as fully entered, and let the negative answer depend on that marker, so the engine can say 'no' only where you have claimed the world is closed. 5. **Keep negated goals bound and terminating.** Order the body so the negated goal's arguments are bound by an earlier goal, and make sure the positive goal it negates cannot loop. ## Why this is the paradigm's signature interview question Every system that answers questions from a store of records faces this choice, whether or not it uses a logic engine. The value of meeting it here is that the paradigm makes the assumption explicit and gives it a name, so you can ask of any query interface: when this says no, does it mean *proved absent*, or *nothing recorded*? A candidate who answers 'it means the search failed, and whether that is a no depends on whether the data is complete' has understood the model rather than the syntax.

  • How does negation as failure differ from classical logical negation?
    Classical negation asserts that something is false, and asserting it is a claim about the world. Negation as failure asserts only that the current program contains no proof of the positive goal. The first is monotonic - new facts never retract a conclusion - while the second is not, since a newly added fact can make the negated goal fail where it used to succeed.
  • When is the closed-world assumption actually safe?
    When your store is authoritative and complete for that relation - typically data you generate and own end to end, with no external source able to add truths you have not recorded. Make the scope explicit per relation rather than globally, because a system usually owns some of its relations completely and mirrors others.
  • Why do engines restrict negation to goals whose arguments are bound?
    Because negating a goal with an open variable is ambiguous: 'there is no whole containing this part' and 'there is some whole not containing it' are different claims, and a search over an open position answers the wrong one. Requiring the arguments to be bound makes the negated question definite.

A library catalogue that says a book is 'not held' can only really say it is not in the catalogue. If the cataloguer is a week behind, the book is on the shelf and the answer is still 'no'.

saying these in an interview costs you the question

  • Says a negative answer means the engine proved the fact false
  • Treats absence of a record as equivalent to a recorded absence
  • Claims adding facts can only ever add answers, ignoring negated goals
  • Negates a goal whose arguments no earlier goal has bound
  • Applies closed-world reasoning to data imported from elsewhere
  • Assumes a negated goal answers even when the positive search loops