Extend your PROLOG program from Project #6 to include the following facts for your immediate family. married_to(X, Y). You must also create the following predicates: predicate uncle_of(X, Y) aunt_of(X, Y) cousin_of(X, Y) brother_in_law_of(X, Y) sister_in_law_of(X, Y) father_in_law_of(X, Y) mother_in_law_of(X,Y) interpretation X is the uncle of Y X is the aunt of Y X is the cousin of Y X is the brother-in-law of Y X is the sister-in-law of Y X is the father-in-law of Y X is the mother-in-law of Y Your database should be rich enough to test all of these new predicates. For example, if you do not have an aunt, you may have to make up a fictitious one. Be careful with these. If your mother has a brother, then you obviously have an uncle, but if your mother has a sister who is married to a man, then that man is your uncle too.
In PROLOG
Using the following code, refer to image for prompt!
% Facts
parent_of(joe, susie).
parent_of(joe, dan).
parent_of(mary, susie).
parent_of(mary, dan).
male(dan).
male(joe).
female(susie).
female(mary).
% Rules
father_of(X, Y) :- parent_of(X, Y), male(X).
mother_of(X, Y) :- parent_of(X, Y), female(X).
son_of(X, Y) :- parent_of(Y, X), male(X).
daughter_of(X, Y) :- parent_of(Y, X), female(X).
sibling_of(X, Y) :- parent_of(Z, X), parent_of(Z, Y), X \= Y.
brother_of(X, Y) :- sibling_of(X, Y), male(X).
sister_of(X, Y) :- sibling_of(X, Y), female(X).
grandparent_of(X, Y) :- parent_of(X, Z), parent_of(Z, Y).
ancestor_of(X, Y) :- parent_of(X, Y).
ancestor_of(X, Y) :- parent_of(X, Z), ancestor_of(Z, Y).
Unlock instant AI solutions
Tap the button
to generate a solution