Professional Documents
Culture Documents
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
female(mary).
female(sandra).
female(juliet).
female(lisa).
male(peter).
male(paul).
male(dick).
male(bob).
male(harry).
parent(bob, lisa).
parent(bob, paul).
parent(bob, mary).
parent(juliet, lisa).
parent(juliet, paul).
parent(juliet, mary).
parent(peter, harry).
parent(lisa, harry).
parent(mary, dick).
parent(mary, sandra).
Juliet Bob
Define new predicates (in terms of rules using male/1, female/1 and parent/2) for the
following family relations:
(a) father
- father(F,X) :- parent(F,X), male(F).
(b) sister
- sister(S,X) :- sibling(S,X), female(S).
(c) grandmother
- grandmother(GM,X) :- parent(P,X), parent(GM,P), female(GM).
(d) cousin
- cousin(C,X) :- parent(P,X), sibling(P,OA), parent(OA,C).
Learning Outcome
Understand the basic principles and techniques of logic programming and how these can be
applied in practice.
Learn the idea of recursing down list.
Describe the main concept of Logic Programming.
Learn how make parent tree.