Existential Query Answering in the Blocks World

Existential Query Answering in the Blocks World

Verified Sources
Sep 11, 2026

The Blocks World is a classic symbolic-AI domain in which named blocks are related by predicates such as on(x, y). A knowledge base (KB) stores facts about the current configuration, and a query asks whether a logical statement follows from those facts.

Given:

  1. on(A,C)on(A,C)
  2. on(D,B)on(D,B)

the query is:

w  above(w,B)\exists w\; above(w,B)

This asks:

Does there exist at least one object ww that is above block BB?

In standard Blocks World terminology, on(x, y) usually means that block xx is directly on block yy. The relation above may either be interpreted as a synonym for direct on, or as a transitive relation meaning “somewhere higher in the same stack.” Under either interpretation, the fact on(D,B)on(D,B) provides a witness: DD.

Therefore, the answer is true, with substitution:

w=Dw = D

and proof:

on(D,B)above(D,B)on(D,B) \models above(D,B)

Hence:

w  above(w,B) is true\boxed{\exists w\; above(w,B)\text{ is true}}

Footnotes

  1. Blocks world - Overview of the classic symbolic-AI planning domain.

Core Insight

For an existential query, one valid witness is sufficient. Since D is directly on B, D satisfies the variable w.

1. Formalizing the Knowledge Base

The constants are:

  • AA: a block
  • BB: a block
  • CC: a block
  • DD: a block

The binary predicate on(x, y) represents a direct spatial relationship:

on(x,y)=“block x is directly on block yon(x,y) = \text{“block }x\text{ is directly on block }y\text{”}

The KB is:

KB={on(A,C),  on(D,B)}KB = \{on(A,C),\; on(D,B)\}

The query uses the predicate above:

Q=w  above(w,B)Q = \exists w\; above(w,B)

In a simple representation, we can define:

above(x,y)on(x,y)above(x,y) \leftarrow on(x,y)

This rule states that anything directly on yy is also above yy.

Thus:

on(D,B)above(D,B)on(D,B) \rightarrow above(D,B)

Since DD is an object for which above(D, B) is true, the existential query succeeds.

Important terms include constant, predicate, knowledge base, and witness.

2. Understanding the Existential Quantifier

The symbol \exists is the existential quantifier.

The expression:

w  above(w,B)\exists w\; above(w,B)

means:

There is at least one object ww such that ww is above BB.

The variable ww can be replaced by each known object:

above(A,B)above(B,B)above(C,B)above(D,B)above(A,B) \lor above(B,B) \lor above(C,B) \lor above(D,B)

The query is true if at least one of these grounded statements is true. From the KB:

  • above(A,B)above(A,B) is not given.
  • above(B,B)above(B,B) is not given.
  • above(C,B)above(C,B) is not given.
  • above(D,B)above(D,B) follows from on(D,B)on(D,B).

Therefore:

w  above(w,B)\exists w\; above(w,B)

is true with witness DD.

The existential query does not require every object to be above BB, nor does it require the witness to be unique. It only requires one satisfying object.

3. Direct on Versus General above

A crucial modeling issue is the intended meaning of above.

Direct interpretation

If above(x, y) means exactly “xx is directly on yy,” then:

on(D,B)above(D,B)on(D,B) \Rightarrow above(D,B)

The query is immediately answered by DD.

Transitive interpretation

If above(x, y) means “xx is anywhere above yy in a stack,” then the relation is transitive:

above(x,y)above(y,z)above(x,z)above(x,y) \land above(y,z) \rightarrow above(x,z)

For example, if the KB contained:

on(A,D)on(A,D)

then we could infer:

above(A,D)above(A,D)

and, because DD is on BB:

above(D,B)above(D,B)

we could also infer:

above(A,B)above(A,B)

However, the supplied KB contains only on(A,C)on(A,C) and on(D,B)on(D,B). There is no connection between the stack containing A,CA,C and the stack containing D,BD,B. The direct witness DD is already sufficient.

4. Visualizing the Two Stacks

The facts describe two independent stacks:

The relevant stack is:

D is above BD \text{ is above } B

The fact involving AA and CC is irrelevant to the query because it does not place any object above BB:

on(A,C)on(A,C)

does not imply:

above(A,B)above(A,B)

No rule connects CC to BB, and no rule connects the two stacks.

Key terms include direct relation, transitivity, stack, and ground atom.

Solving the Existential Query

  1. 1
    Step 1

    The query contains the variable w in ∃w above(w, B). The task is to find at least one object that can replace w.

  2. 2
    Step 2

    The named blocks in the KB are A, B, C, and D. These are the possible substitutions for w.

  3. 3
    Step 3

    The second argument must be B, because the query asks for an object above B.

  4. 4
    Step 4

    The fact on(D, B) has B in its second position. It therefore identifies D as an object directly on B.

  5. 5
    Step 5

    Because a block directly on B is above B, infer above(D, B).

  6. 6
    Step 6

    Set w = D. The resulting statement above(D, B) is true.

  7. 7
    Step 7

    Since at least one witness exists, ∃w above(w, B) is true.

Candidate Substitutions for w

Only D satisfies the query under the supplied knowledge base.

5. Proof by Substitution

Existential queries can be answered by finding a substitution that makes the formula true.

Start with:

w  above(w,B)\exists w\; above(w,B)

Choose the substitution:

θ={w/D}\theta = \{w/D\}

Applying θ\theta gives:

above(w,B)θ=above(D,B)above(w,B)\theta = above(D,B)

From the KB:

on(D,B)on(D,B)

Using the rule:

on(x,y)above(x,y)on(x,y) \rightarrow above(x,y)

we derive:

above(D,B)above(D,B)

Therefore:

KBabove(D,B)KB \models above(D,B)

and consequently:

KBw  above(w,B)KB \models \exists w\; above(w,B)

The notation KBQKB \models Q means that the query QQ is logically entailed by the KB: every interpretation that satisfies the KB also satisfies QQ.

Forward-Chaining Derivation

  1. 1
    Step 1

    Begin with F = {on(A, C), on(D, B)}.

  2. 2
    Step 2

    Use the rule on(x, y) → above(x, y) with x = D and y = B.

  3. 3
    Step 3

    Add above(D, B) to the set of known consequences.

  4. 4
    Step 4

    The derived fact matches the pattern above(w, B), with substitution w = D.

  5. 5
    Step 5

    Return true and the witness D.

6. Why the Other Fact Does Not Answer the Query

The first fact is:

on(A,C)on(A,C)

It supports the conclusion:

above(A,C)above(A,C)

but the query requires an object above BB:

above(w,B)above(w,B)

The second argument does not match:

  • Fact: on(A,C)on(A,C)
  • Required target: BB

Therefore, this fact cannot directly satisfy the query.

The second fact is:

on(D,B)on(D,B)

Its second argument is exactly BB, so it supplies the required witness.

This illustrates unification, argument position, and logical entailment.

Common Questions and Edge Cases

Do Not Confuse Failure with Negation

If no witness were found, that would usually mean the query is not entailed. It would not automatically prove that ∀w ¬above(w, B), unless a closed-world assumption were explicitly adopted.

7. Closed-World and Open-World Readings

The interpretation of missing facts matters in knowledge representation.

Closed-world assumption

Under a closed-world assumption, facts not present in the KB are treated as false. This is common in database-style reasoning.

Under this interpretation:

  • above(D,B)above(D,B) is true.
  • above(A,B)above(A,B), above(B,B)above(B,B), and above(C,B)above(C,B) are false unless derived.
  • The existential query is true because DD is a witness.

Open-world assumption

Under an open-world assumption, missing facts are unknown rather than false. This is common in formal knowledge representation and ontology-based systems.

Even under the open-world assumption, the query is still true because the KB explicitly supports:

above(D,B)above(D,B)

The distinction would matter for a negative query such as:

¬w  above(w,B)\neg\exists w\; above(w,B)

The absence of a known witness would not necessarily establish that negative claim under open-world reasoning.

w  above(w,B)\exists w\; above(w,B) means that at least one object is above B.

8. Relation to Blocks World Planning

In planning systems, a Blocks World state is commonly represented as a set of predicates such as On-Block(x, y), On-Table(x), Clear(x), and HandEmpty(). Operators change the state by adding and deleting predicates; their preconditions determine when an action is legal.

The present problem is not asking for a plan. It is a state-query problem:

  • It does not ask how to move a block.
  • It does not specify a goal configuration.
  • It asks whether a relation is supported by the current KB.

The distinction is important:

TaskExampleRequired reasoning
State queryw  above(w,B)\exists w\; above(w,B)Inspect facts and infer consequences
PlanningMove DD from BB to CCSearch for legal actions
Goal testingIs DD above BB?Check whether a proposition holds
State transitionApply unstack(D,B)Update predicates using action effects

The same predicate vocabulary can support both querying and planning, but the reasoning task is different.

Footnotes

  1. The Blocks World - Course material describing state representations and predicates.

  2. Classical Planning - Lecture notes on Blocks World operators, preconditions, add effects, and delete effects.

Reasoning Pathway

Represent

1

Encode the configuration as facts: on(A, C) and on(D, B)."

Parse

2

Recognize the query as an existential statement asking for a witness above B."

Match

3

Compare the query target B with the second arguments of the known on facts."

Infer

4

Use on(D, B) to derive above(D, B)."

Answer

5

Return true with witness D."

Blocks World Query Reasoning

1 / 6
Question · Term

What does ∃ mean?

Click to reveal
Answer · Definition

There exists at least one object satisfying the formula.

Final Answer

Yes. The query ∃w above(w, B) is entailed by the KB. A valid witness is w = D, because on(D, B) implies above(D, B).

Knowledge Check

Question 1 of 5
Q1Single choice

What does the query ∃w above(w, B) ask?