foundations of computational agents
This section presents a very simple vanilla meta-interpreter for the definite clause language written in the definite clause language. Subsequent sections augment this meta-interpreter to provide extra language constructs and knowledge engineering tools. It is important to first understand the simple case before considering the more sophisticated meta-interpreters presented later.
% is true if base-level body is a logical consequence of the base-level clauses that are defined using the predicate symbol “”.
Figure 14.9 defines a meta-interpreter for the definite clause language. This is an axiomatization of the relation , where is true when base-level body is a logical consequence of the base-level clauses.
As with axiomatizing any other relation, we write the clauses that are true in the intended interpretation, ensuring that they cover all of the cases and that there is some simplification through recursion. This meta-interpreter essentially covers each of the cases allowed in the body of a clause or in a query, and it specifies how to solve each case. A body is either empty, a conjunction, or an atom. The empty base-level body is trivially proved. To prove the base-level conjunction , prove and prove . To prove atom , find a base-level clause with as the head, and prove the body of the clause.
Consider Figure 14.10 adapted from Example 13.12. This can be seen from meta-level as a knowledge base of atoms, all with the same predicate symbol . It can also be viewed as base-level knowledge base consisting of multiple rules. The vanilla meta-interpreter sees it as a collection of atoms.
The base-level goal is asked with the following query to the meta-interpreter:
The third clause of is the only clause matching this query. It then looks for a clause of the form and finds
unifies with , and unifies with . It then tries to prove
The second clause for is applicable. It then tries to prove
Using the third clause for , it looks for a clause with a head to unify with
and find , binding to . It then tries to prove , which succeeds using the first clause for .
The second half of the conjunction, with , reduces to which is, again, immediately solved.