foundations of computational agents
The propositional bottom-up proof procedure can be extended to Datalog by using ground instances of the clauses. A ground instance of a clause is obtained by uniformly substituting constants for the variables in the clause. The constants required are those appearing in the knowledge base or in the query. If there are no constants in the knowledge base or the query, one must be invented.
Suppose the knowledge base is
The set of all ground instances is
The propositional bottom-up proof procedure of Section 5.3.2 can be applied to the grounding to derive , , , , , and as the ground instances that are logical consequences.
Suppose the knowledge base is
The bottom-up proof procedure for query “” must invent a new constant symbol, say . The set of all ground instances is then
The propositional bottom-up proof procedure will derive and .
If the query were “” the set of ground instances would change to reflect the constants and .
The bottom-up proof procedure applied to the grounding of the knowledge base is sound, because each instance of each rule is true in every model. This procedure is essentially the same as the variable-free case, but it uses the set of ground instances of the clauses, all of which are true because the variables in a clause are universally quantified.
This bottom-up procedure will eventually halt for Datalog because there are only finitely many grounded atoms, and one ground atom is added to the consequence set each time through the loop.
This procedure is also complete for ground atoms. That is, if a ground atom is a consequence of the knowledge base, it will be derived. To prove this, as in the propositional case, we construct a particular generic model. Recall that a model specifies the domain, what the constants denote, and what is true. A Herbrand interpretation is an interpretation where the domain is symbolic and consists of all constants of the language. A constant is invented if there are no constants in the knowledge base or the query. In a Herbrand interpretation, each constant denotes itself. Thus, in the definition of an interpretation, and are fixed for a given program, and all that needs to be specified is , which defines the predicate symbols.
Consider the Herbrand interpretation where the true atoms are the ground instances of the relations that are eventually derived by the bottom-up procedure. It is easy to see that this Herbrand interpretation is a model of the rules given. As in the variable-free case, it is a minimal model in that it has the fewest true atoms of any model. If for ground atom , then is true in the minimal model and, thus, is eventually derived.
Consider the clauses of Figure 13.2. The bottom-up proof procedure can immediately derive each instance of given as a fact. The algorithm can then add the atoms to the consequence set:
Next, the relations that follow can be added to the set of consequences, including
The relations can be added to the set of consequences, including
Finally, the relations that follow can be added to the set of consequences.