Question: THIS IS A PROLOG QUESTION ! PLEASE ANSWER IT WITH PROLOG . For the purposes of the examples in this question, assume that the following

THIS IS A PROLOG QUESTION ! PLEASE ANSWER IT WITH PROLOG .

For the purposes of the examples in this question, assume that the following facts have been loaded into Prolog:

likes(mary, apple). likes(mary, pear). likes(mary, grapes). likes(tim, mango). likes(tim, apple). likes(jane, apple). likes(jane, mango).

Write a predicate all_like_all(Who_List, What_List) that takes a list of people Who_List and a list of items What_List and succeeds if every person in Who_List likes every item in What_List, according to the predicate likes(Who, What). Your predicate should also succeed if eitherWho_List or What_List is empty. Examples:

?- all_like_all([jane,tim],[apple,mango]). true ?- all_like_all([mary,tim],[apple,grapes]). false. ?- all_like_all([],[bananas]). true 

Note that your all_like_all predicate will be tested with different likes(Who, What) facts to those in the examples.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!