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.

Suppose that the above set of clauses is properly structured in PROLOG<br />

<strong>and</strong> the program is then compiled <strong>and</strong> executed. If we now submit the<br />

following queries (goals), the system responds correctly as follows.<br />

1. Goal: Father (X, Y)?<br />

Response: Father (dasaratha, ram).<br />

2. Goal: Son (Y, X)?<br />

Response: Son (ram, dasaratha).<br />

But how does the system respond to our queries? We shall discuss it<br />

shortly. Before that let us learn a little bit of syntax of PROLOG programs. We<br />

take up the scene interpretation problem as an example to learn the syntax of<br />

PROLOG programming.<br />

6.3 A Scene Interpretation Program<br />

/* PROLOG PROGRAM FOR SCENE INTERPRETATION */<br />

Domains<br />

Time, X, Y, Z, W, board, classhour, bench = symbol<br />

Predicates<br />

Teacher (X)<br />

Writes-on (X, board, Time )<br />

Equal (Time, classhour)<br />

Person (X) Person (Y) Person (Z) Person (W)<br />

Sits-on (Y, bench, Time) Sits-on (Z, bench, Time)<br />

Student (Y)<br />

Student (Z)<br />

Object (W)<br />

Clauses<br />

Object (board). 1<br />

Writes-on (john, board, classhour). 2

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

Saved successfully!

Ooh no, something went wrong!