Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Prolog help Question 1: Try and create facts from the following information: 1.

ID: 3769607 • Letter: P

Question

Prolog help

Question 1: Try and create facts from the following information:

1. Joe is male.

2. Pat is male.

3. Sharon is female.

4. Mary is female.

5. Joe is the father of Mary.

6. Sharon is the mother of Mary.

7. Joe is married to Sharon.

Question 2: Given the following facts information in the database,

car(vw_beatle).
car(ford_escort).
bike(harley_davidson).
red(vw_beatle).
red(ford_escort).
blue(harley_davidson).

Add some rules into the database representing the sentence:

‘An item is fun if the item is red and it is a car or an item is fun if the item is blue and it is a bike’.

Question 3: Given the following facts information in the database,

loves(john,mary).
loves(tom,mary).
loves(mike,judy).
loves(judy,mike).

Add one rule into the database to define a concept of jealousy. It says that a person A will be jealous of a person B if there is some person C that A loves, and B loves that same individual C too.

Question 4: Given the following facts information in the database,

2) Using the same facts information above together with your designed parent_child rules, further design a new rule describing general sibling relationship.

Note: the term inequality comparison operator: ==

(Usage: Arg1 == Arg2 Succeeds if Arg1 and Arg2 are not literally identical.)

You can check your designed database by posing the following query that should be evaluated as true:

?- sibling(sally, erica).

True

Question 5: Assume given a set of facts of the form father(name1,name2) (name1 is the father of name2).

father(c,f).

Define a predicate brother(X,Y) which holds iff X and Y are brothers.

Define a predicate cousin(X,Y) which holds iff X and Y are cousins.

Define a predicate grandson(X,Y) which holds iff X is a grandson of Y.   

Explanation / Answer

1. Joe and Sharon both are husband and wife. Mary is daughter of joe and sharon and pat is son of joe and sharon.

2.