

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


This assignment will be due on Friday, July 28 at 11:59pm. It will only be accepted late within 24 hours of the due date at a loss of 30%, after which it will not be accepted. Email to [email protected]. To turn in, put all of your predicates in a file named by a concatenation of your first initial and last name with an extension “.prl”. Example: John Doe would turn in jdoe.prl. Please write all of you own predicates. The only exception to this is that you may use the built in predicate not. If you need “helper” functions, please include them in your file.
All binary predicates of form predicate(A,B) in this exercise can be read as A is p redicate of B, unless otherwise noted. For this exercise you will be given a knowledge base containing info for three predicates: parent/2, female/1, and male/1. You need to define the following predicates that will work for any family knowledge base:
Example knowledge base parent(alice,betty). parent(alice,bob). parent(alice,ricky). parent(rebecca,alice). parent(castro,betty). parent(castro,bob). parent(castro,ricky). parent(dana,castro). parent(dana,vince). parent(vince,erma). male(ricky). male(vince). male(bob). male(castro). female(alice). female(betty). female(dana). female(erma). female(rebecca). Note! If you are going to test with your own KB (which is recommended!), be sure to define the gender of each person. Also, be sure that no one is their own brother or sister.
Define a predicate merge/3 that takes two non-decreasing sorted lists and merges them into a single sorted lists. It should also remove duplicates in the list. Here’s an example: ?- merge([2, 4, 6], [1, 2, 3, 4, 5], list). list = [1, 2, 3, 4, 5, 6]