06.03.2013 Views

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The resolution tree for linear selection is presented in fig. 6.3. It is clear<br />

that two clauses from the set S1 = S ∪ { ¬ Goal} are first used for resolution<br />

<strong>and</strong> the resolvent is next used for resolution with a third clause from the same<br />

set S1. The process is continued until a null clause is generated. In the linear<br />

selection process, one clause, however, can be used more than once for<br />

resolution.<br />

An alternative way to represent the resolution process in a tree with<br />

linear selection is presented below. Such trees are generally referred to as SLD<br />

trees. Let us now consider the following Logic program <strong>and</strong> draw the SLD<br />

tree for the program.<br />

Example 6.4: The Logic program built with definite clauses <strong>and</strong> the goal<br />

are presented below.<br />

1. P (X, Z) ← Q (X, Y) , P (Y, Z)<br />

2. P (X, X) ←<br />

3. Q (a, b) ←<br />

Goal : ← P (X, b)<br />

For the construction of the SLD tree, we would match the head of a<br />

clause with the same consequent clause in another's body, during the process<br />

of resolution of two clauses. This, however, in no way imposes restriction in<br />

the general notion of resolution. Rather, it helps the beginners to mechanically<br />

realize the resolution process. The SLD tree of a Logic Program becomes infinite,<br />

if one uses the same rule many times. For instance using rule 1 many<br />

times, we find an infinite SLD tree like fig. 6.4 for the current example.<br />

6.6 Controlling Backtracking by CUT<br />

Since a PROLOG compiler searches for the solution using a “depth first<br />

search” strategy, the leftmost sub-tree in fig. 6.4 being infinite does not yield<br />

any solution of the system. Such a problem, however, can be taken care of by<br />

appropriately positioning “CUT” statements in the Logic Program. Since<br />

depth first search in PROLOG programs are realized by stack, an infinitely<br />

large SLD tree results in a stack overflow.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!