Defining Relations by Facts, by Rules and Recursive Rules
Defining Relations by Facts, by Rules and Recursive Rules
Practical
Object:
Theory:
This Prolog practical offers you the opportunity to get familiar yourself with facts and
rules for defining relationships, as an example we write a program for a whole
familytree. In this practical you will learn following:
Define relationship by facts.
Define relationship by Rules
Recursive rules.
Ask questions about family tree.
An Example of a Procedure:
Asking Questions
To answer a question, Prolog tries to satisfy all the goals.
To satisfy a goal means to demonstrate that the goal istrue, assuming that the relations in
the program is true.
Example.
sister(X,Y). % who is sister of whom.
mother(X,Y). % X is mother of Y.
Conclusion:
DEPARTMENT OF COMPUTER SCIENCE
QUAID-E-AWAM UNIVERSITY OF ENGG., SCIENCE & TECHNOLOGY, NAWABSHAH
ARTIFICIAL INTELLIGENCE ( 7th TERM, FOURTH YEAR)
________________
________________
________________
3.Make a family tree of own and find relationships for brother, sister, mother,
father, uncle, grandparent.
________________