Consider the following relation lovesjohn ann lovested mary

Consider the following relation:

loves(john, ann).
loves(ted, mary).
loves(marc, liza).
loves(ann, ted).
loves(liza, marc).

Select all possible answers to the following question (finding some of them might require typing a semicolon and backtracking):

?-loves(X, Y), loves (Y,X).

      
1) X = ted
Y = mary
2) X = marc
Y = liza
3) X = liza
Y = marc
4) X = ann
Y = ted

Solution

2) X = marc
Y = liza


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site