Racket Programming write a logic program that represents the genealogy of a samp
ID: 3684911 • Letter: R
Question
Racket Programming
write a logic program that represents the genealogy of a sample family(with four generations)shown below using Racklog. Refer http://docs.racket-lang.org/racklog/ if needed.
Question 1. Write predicates %male, %female,%parent,%spouse to represent the facts in the tree.
For example: Phil and Beth are spouses and parents o fEdward.
Note:all male members of the tree are marked in blue and female members in red.
Question 2. write predicates to represent the following rules.%husband, %wife, %sibling, %brother, %sister,%father, %mother, %son, %daughter, %cousin, %grandparent, %greatgrandparent, %inlaw, %niece, %nephew.
For example,a person X is the %motherof Y, if: X is %female and X is the %parent of Y.
Question 3. Write a minimum of 20 queries of different forms to test (search for solutions in)the logic program.Queries can be yes/noquestions (represented as ‘() and #f in Racklog) or more complex questions.
Phil Beth Pete Diana Edward Kate Jim Amv Sarah Ralph Autumn Neil Laura Jordan Maria Nate Aidy Tim Leslie Aaron SashaExplanation / Answer
Question:1
male(x) : x is a male
female(x) : x is a female
parent(x, y) : x is a parent of y
spouse(x, y) : x is married to y
% males and females
male(Phil)
male(Pete)
male(Edward)
male(Ralph)
male(Neil)
male(Jim)
male(Jordan)
male(Nate)
male(Tim)
male(Aaron)
female(Beth)
female(Diana)
female(Kate)
female(Amv)
female(Sarah)
female(Autumn)
female(Laura)
female(Maria)
female(Aidy)
female(Lesile)
female(Sasha)
% parent
parent(Phil, Edward)
parent(Beth, Edward)
parent(Pete, Kate)
parent(Diana, Kate)
parent(Edward, Ralph)
parent(Edward, Autumn)
parent(Edward, Neil)
parent(Kate, Ralph)
parent(Kate, Autumn)
parent(Kate, Neil)
parent(Jim, Laura)
parent(Amv, Laura)
parent(Jim, Jordan)
parent(Amv, Jordan)
parent(Sarah, Nate)
parent(Ralph, Nate)
parent(Jordan, Aaron)
parent(Jordan, Sasha)
parent(Maria, Aaron)
parent(Maria, Sasha)
parent(Neil, Aidy)
parent(Neil, Tim)
parent(Neil, Lesile)
parent(Laura, Aidy)
parent(Laura, Tim)
parent(Laura, Lesile)
%spouse
spouse(Phil, Beth)
spouse(Pete, Diana)
spouse(Edward, Kate)
spouse(Jim, Amv)
spouse(Sarah, Ralph)
spouse(Neil, Laura)
spouse(Jordan, Maria)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.