Prolog Lab 2 University of Wales, Cardiff
This exercise is not assessed, but it is in your interest to
practise this, because SOON there might be one that is.
1. Consider the following program :
parent_of(mary, peter). parent_of(james, peter). parent_of(mary, eunice). parent_of(james, eunice). parent_of(mary, lois). parent_of(james, lois). parent_of(marion, mary). parent_of(timothy, mary). parent_of(paul, timothy). parent_of(marion, anna). parent_of(jack, jill). parent_of(mick, liam). parent_of(clare, steve). male(peter). male(james). male(timothy). male(paul). male(steve). male(jack). male(mick). male(liam). female(mary). female(eunice). female(lois). female(marion). female(anna). female(clare). female(jill). mother_of(Mother, Person) :- parent_of(Mother, Person), female(Mother). mother_of2(Person) :- parent_of(Mother, Person), female(Mother). grandad_of(Granpa, Person) :- parent_of(Parent, Person), parent_of(Granpa, Parent), male(Granpa).
B<>Note: the facts within the database may have to be expanded for some of the relations to be written.
Omer Rana
February 1997.
Omer F Rana