Search
In the first assignment you are going to revise basic syntax of Prolog, its search strategy and recursion. You are asked to save your work in a file called family.pl and to submit it via the upload system.
family.pl
You may find the code from the first prolog tutorial pastebin.com/u/radek useful.
Familiarize yourself with the royal family of the British Monarchy: wikipedia:British_Royal_Family
Consider the following people:
william
harry
charles
diana
camilla
george
elizabeth
philip
edward
sophie
louise
james
and their relationships:
male(X)
X
female(X)
parent(P,C)
P
C
wife(W,H)
W
H
Your task is to encode the genealogy graph about the listed people using the listed relations into Prolog as ground facts.
1 point
husband(Man,Woman)
person(P)
mother(Mother,Child)
father(Father,Child)
Using the course literature or Google, study the “negation as failure \+” technique or “non-unifiability predicate \=”.
\+
\=
sibling(Sibling1,Sibling2,Parent)
Sibling1
Sibling2
sibling(william,william,P)
misbegotten(Child)
2 points
brother(Brother,Person)
?- brother(X,Y)
ancestor(Predecesor,Succesor)
Predecesor
Succesor
ancestor(george,william)
Submit the file to cw.felk.cvut.cz/upload on the 14.4.2011 23:59 CEST the latest. The deadline is strict.