22.17 Jealousy: Question

Exercise: Jealousy

One of the motives could be that the murderer was jealous of the victim. Now, what is jealousy? Well, mathematicaly speaking, it is a negative feeling which arises in a person X towards a person Y if the person X is involved with a person Z, and Y is also involved with Z.

Assume that you have a predicate 'involved_with(X,Y)' at your disposal. Write a single Prolog rule which tells us whether X is jealous of Y. Call the predicate 'jealous(X,Y)'.

Assume that the 'involved_with(X,Y)' predicate imposes no restrictions on the order of the participants. For example, assume that the following two are equivalent:

  • involved_with(X,Y)
  • involved_with(Y,X)

Answer

Click to see an answer.


Prev: Poverty
Up: 22 A Murder Mystery
Next: Being involved with