Special Forms of FOL Formulas in Reasoning Systems
6.4 Special Forms of FOL Formulas in Reasoning Systems
Formulas expressed in Conjunctive Normal Form are frequently simplified further in reasoning systems for better efficiency of formula-matching algorithms. Since we know that a CNF formula is a conjunction of clauses, we can eliminate conjunction symbols and divide the formula into simpler axioms. Such simpler axioms are stored
18 After such a replacement the variable y “disappears”, so the quantifier ∃y does not quantify any variable. As a result, we can eliminate it.
19 We make use of a FOL rule of distribution of disjunction over conjunction: [ α ∨ (β ∧ γ)] ⇔ [ (α ∨ β) ∧ (α ∨ γ)].
6.4 Special Forms of FOL Formulas in Reasoning Systems 79 in a knowledge base. In our case formula ( 6.38 ) can be transformed into a set which
consists of two simpler clauses in the following way: student(x) ∨ ¬on _leave(x),
(6.39) The form used in the Prolog language is especially convenient for logic program-
student(x) ∨ ¬attends(x, y) ∨ ¬course(y).
ming. This language was developed by Alain Colmerauer and Phillippe Roussel in 1973 [57] on the basis of the theoretic research of Robert Kowalski, which concerned
a procedural interpretation of Horn clauses. Prolog is considered a standard language used for constructing reasoning systems based on theorem proving with the help of the resolution method. In order to transform the set of clauses ( 6.39 ) into the Prolog- like form we have to transform them into CNF Horn clauses. 20 A Horn clause of the form: ¬ p 1 ∨¬ p 2 ∨···∨¬ p n ∨ h (6.40)
corresponds to the following formula in the form of an implication: p 1 ∧ p 2 ∧···∧ p n ⇒ h. (6.41) We can express it as follows:
(6.42) and in the Prolog language in the following way:
h⇐p 1 ∧ p 2 ∧···∧ p n ,
h: − p 1 , p 2 ,..., p n .
Thus, our clauses from the set ( 6.39 ) can be written as:
student(x) ⇐ on _leave(x), student(x) ⇐ attends(x, y) ∨ course(y),
(6.44) and in the Prolog program they can be written as the axioms-principles:
student(X) :- on_leave(X). /* Axioms-principles in knowledge base */ student(X) :- attends(X,Y),course(Y).
Now, if we add to the Prolog program the following axioms-“facts”: course(Logic).
/* Axioms-facts in knowledge base */ attends(John Smith, Logic).
20 As we have mentioned above, a Horn clause contains at most one positive literal. The clauses in ( 6.39 ) are Horn clauses, because each one contains only one positive literal student(x).
80 6 Logic-Based Reasoning then, after asking the following question to the system:
?- student(John Smith). /* Characters “?-” are written by the system */ the system answers us: Yes In knowledge bases of reasoning systems formulas are often stored in a special
form, which is called a clause form. It is especially convenient when using the resolution method. In such a representation a clause is replaced by the set of its
literals. For example, the clause form for our set of clauses ( 6.39 ) is defined in the following way:
{{ student(x), ¬on _leave(x)},
(6.45) If we use such a representation, then a knowledge base can be constructed as one big
{ student(x), ¬attends(x, y) , ¬course(y)}}.
set consisting of clauses in the form of sets of literals. 21