13 Individuals and Relations

The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).

13.8 Complete Knowledge Assumption

The complete knowledge assumption, as discussed in Section 5.6, is the assumption that any statement that does not follow from a knowledge base is false. It also allows for proof by negation as failure.

To extend the complete knowledge assumption to logic programs with variables and functions symbols, we require axioms for equality, and the domain closure, and a more sophisticated notion of the completion. Again, this defines a form of negation as failure.

Example 13.47.

Suppose a s⁢t⁢u⁢d⁢e⁢n⁢t relation is defined by

s⁢t⁢u⁢d⁢e⁢n⁢t⁢(m⁢a⁢r⁢y).
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(j⁢o⁢h⁢n).
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(y⁢i⁢n⁢g).

The complete knowledge assumption would say that these three are the only students:

s⁢t⁢u⁢d⁢e⁢n⁢t⁢(X)⇔X=m⁢a⁢r⁢y∨X=j⁢o⁢h⁢n∨X=y⁢i⁢n⁢g.

That is, if X is m⁢a⁢r⁢y, j⁢o⁢h⁢n, or y⁢i⁢n⁢g, then X is a student, and if X is a student, X must be one of these three. In particular, k⁢i⁢m is not a student.

Concluding ¬⁢s⁢t⁢u⁢d⁢e⁢n⁢t⁢(k⁢i⁢m) requires proving prove k⁢i⁢m≠m⁢a⁢r⁢y∧⁢k⁢i⁢m≠j⁢o⁢h⁢n∧⁢k⁢i⁢m≠y⁢i⁢n⁢g. To derive the inequalities, the unique names assumption is required.

The complete knowledge assumption includes the unique names assumption. As a result, we assume the axioms for equality and inequality for the rest of this section.

The Clark normal form of the clause

p⁢(t1,…,tk)←⁢B.

is the clause

p⁢(V1,…,Vk)←⁢∃W1⁢…⁢∃Wm⁢V1=t1∧⁢…∧⁢Vk=tk∧⁢B.

where V1,…,Vk are k variables that did not appear in the original clause, and W1,…,Wm are the original variables in the clause. “∃” means “there exists”. When the clause is an atomic clause, B is t⁢r⁢u⁢e.

Suppose all of the clauses for p are put into Clark normal form, with the same set of introduced variables, giving

p⁢(V1,…,Vk)←⁢B1.
    ⋮
p⁢(V1,…,Vk)←⁢Bn.

which is equivalent to

p⁢(V1,…,Vk)←⁢B1∨…∨Bn.

This implication is logically equivalent to the set of original clauses.

Clark’s completion of predicate p is the equivalence

∀V1⁢…⁢∀Vk⁢p⁢(V1,…,Vk)⇔B1∨…∨Bn

where negation as failure (∼) in bodies is replaced by standard logical negation (¬). The completion means that p⁢(V1,…,Vk) is true if and only if at least one body Bi is true.

Clark’s completion of a knowledge base consists of the completion of every predicate symbol along with the axioms for equality and inequality.

Example 13.48.

For the clauses

s⁢t⁢u⁢d⁢e⁢n⁢t⁢(m⁢a⁢r⁢y).
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(j⁢o⁢h⁢n).
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(y⁢i⁢n⁢g).

the Clark normal form is

s⁢t⁢u⁢d⁢e⁢n⁢t⁢(V)←⁢V=m⁢a⁢r⁢y.
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(V)←⁢V=j⁢o⁢h⁢n.
s⁢t⁢u⁢d⁢e⁢n⁢t⁢(V)←⁢V=y⁢i⁢n⁢g.

which is equivalent to

s⁢t⁢u⁢d⁢e⁢n⁢t⁢(V)←⁢V=m⁢a⁢r⁢y∨V=j⁢o⁢h⁢n∨V=y⁢i⁢n⁢g.

The completion of the s⁢t⁢u⁢d⁢e⁢n⁢t predicate is

∀V⁢s⁢t⁢u⁢d⁢e⁢n⁢t⁢(V)⇔V=m⁢a⁢r⁢y∨V=j⁢o⁢h⁢n∨V=y⁢i⁢n⁢g.
Example 13.49.

Consider the following recursive definition:

p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢([],S⁢t,M⁢i⁢n⁢P⁢a⁢s⁢s).
p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢([C∣R],S⁢t,M⁢i⁢n⁢P⁢a⁢s⁢s)←
    p⁢a⁢s⁢s⁢e⁢d⁢(S⁢t,C,M⁢i⁢n⁢P⁢a⁢s⁢s)∧
    p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢(R,S⁢t,M⁢i⁢n⁢P⁢a⁢s⁢s).

In Clark normal form, this can be written as

p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢(L,S,M)←⁢L=[].
p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢(L,S,M)←
    ∃C⁢∃R⁢L=[C∣R]∧
    p⁢a⁢s⁢s⁢e⁢d⁢(S,C,M)∧
    p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢(R,S,M).

Here, we have removed the equalities that specify renaming of variables and have renamed the variables as appropriate. Thus, Clark’s completion of p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h is

∀L⁢∀S⁢∀M⁢p⁢a⁢s⁢s⁢e⁢d⁢_⁢e⁢a⁢c⁢h⁢(L,S,M)⇔L=[]∨
    ∃C∃R(L=[C∣R]∧
    p⁢a⁢s⁢s⁢e⁢d⁢(S,C,M)∧
    passed_each(R,S,M)).

Under the complete knowledge assumption, relations that cannot be defined using only definite clauses can now be defined.

Example 13.50.

Suppose you are given a database of c⁢o⁢u⁢r⁢s⁢e⁢(C) that is true if C is a course, and e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C), which means that student S is enrolled in course C. Without the complete knowledge assumption, you cannot define e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C) which is true if there are no students enrolled in course C. This is because there is always a model of the knowledge base where every course has someone enrolled.

Using negation as failure, e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C) can be defined by

e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)←⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)∧∼⁢h⁢a⁢s⁢_⁢e⁢n⁢r⁢o⁢l⁢l⁢m⁢e⁢n⁢t⁢(C).
h⁢a⁢s⁢_⁢e⁢n⁢r⁢o⁢l⁢l⁢m⁢e⁢n⁢t⁢(C)←⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).

The completion of this is

∀C⁢e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)⇔c⁢o⁢u⁢r⁢s⁢e⁢(C)∧⁢¬⁢h⁢a⁢s⁢_⁢e⁢n⁢r⁢o⁢l⁢l⁢m⁢e⁢n⁢t⁢(C).
∀C⁢h⁢a⁢s⁢_⁢e⁢n⁢r⁢o⁢l⁢l⁢m⁢e⁢n⁢t⁢(C)⇔∃S⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).

Here we offer a word of caution. You should be very careful when you include free variables within negation as failure. They usually do not mean what you think they might. We introduced the predicate h⁢a⁢s⁢_⁢e⁢n⁢r⁢o⁢l⁢l⁢m⁢e⁢n⁢t in the previous example to avoid having a free variable within a negation as failure. Consider what would have happened if you had not done this:

Example 13.51.

One may be tempted to define e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e in the following manner:

e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)←⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)∧∼⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).

which has the completion

∀C⁢e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)⇔∃S⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)∧⁢¬⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).

This is not correct. Given the clauses

c⁢o⁢u⁢r⁢s⁢e⁢(c⁢s⁢422).
c⁢o⁢u⁢r⁢s⁢e⁢(c⁢s⁢486).
e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(m⁢a⁢r⁢y,c⁢s⁢422).
e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(s⁢a⁢l⁢l⁢y,c⁢s⁢486).

the clause

e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(c⁢s⁢422)←⁢c⁢o⁢u⁢r⁢s⁢e⁢(c⁢s⁢422)∧∼⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(s⁢a⁢l⁢l⁢y,c⁢s⁢422)

is an instance of the preceding clause for which the body is true, and the head is false, because c⁢s⁢422 is not an empty course. This is a contradiction to the truth of the preceding clause.

Note that the completion of the definition in Example 13.50 is equivalent to

∀C⁢e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)⇔c⁢o⁢u⁢r⁢s⁢e⁢(C)∧⁢¬⁢∃S⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).

The existence is in the scope of the negation, so this is equivalent to

∀C⁢e⁢m⁢p⁢t⁢y⁢_⁢c⁢o⁢u⁢r⁢s⁢e⁢(C)⇔c⁢o⁢u⁢r⁢s⁢e⁢(C)∧⁢∀S⁢¬⁢e⁢n⁢r⁢o⁢l⁢l⁢e⁢d⁢(S,C).