Define your answers to Exercises 1 through 6 in terms of the base relations pare
ID: 3822634 • Letter: D
Question
Define your answers to Exercises 1 through 6 in terms of the base relations parent (X, Y), female (X), and male (X). To test your code, define some parent facts like those in this chapter, along with apporpriates female and male facts. But your solutions should be gerneral enough to work with any set of such facts.
Exercise 2.) Define a father predicate so that father (X,Y) says that X is the father of Y.
Exercise 3.) Define a sister predicate so that sister (X,Y) says that X is a sister of Y. Be careful, a perosn cannot be her own sister.
Your Name Chapter 1 Exercises CSC 3750 Spring 2017 Facts females( brandy, ann mary, Susan jen jane, susie, nda] males (Doseph, brandon, jim, james, tom, john, clark, bob, steven, jason, bill, jude]). males (mark) parent(adam mary) parent(mary Susan) parent parent parent(steven,bill). parent(mary,clark) parent(maryim) parent clark Steven) Predicates male(X) males (L) member (X,L) female(X) females(L), member (X,L) "Exercise 19.1 mother (X,Y) female(X) parent sibling(X,Y) parent(P,X), parent(PY), not (X Y) "Exercise 19.4 grandson(X,Y) male (X) parent(P,X), parent(YP) ancestor (X,Y) parent(X,Y) parent(P,Y), ancestor (X,Y) ancestor (X,P) Exercise 19.12Explanation / Answer
female(abc).
female(cde).
female(efg).
female(fgh).
male(lmn).
male(nop).
male(pqr).
male(rst).
mother(abc,cde).
mother(abc,efg).
mother(cde,nop).
mother(fgh,pqr).
father(lmn,cde).
father(lmn,efg).
father(rst,abc).
father(rst,fgh).
1.parent(X,Y) : mother(X,Y), female(X).
here X is female from that X is mother of Y
4.grandson(X,Y) : grandparent(X,Y), male(X).
here X is male and from that above X is grandson of Y
5.firstCousin(X,Y) : parent(Z,X), parent(W,Y), sibling(Z,W).
in this X is first cousin of Y as per the above syntax
6.descendant(X,Y) : parent(X,Y).
descendant(X,Y) : parent(Z,X), descendant(Z,Y).
from the above formats X is a descendent of Y
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.