Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 6 - Programming Languages - Chapter Review Problems - Page 327: 58

Answer

See the explanation

Work Step by Step

The last two statements of the Prolog program are as follows: 1. `likes(david, X) :- likes(X, sports).` 2. `likes(alice, X) :- likes(david, X).` From this program, Prolog would be able to conclude that Alice likes the following: 1. Sports: This is directly stated in the first statement of the program, `likes(alice, sports)`. 2. Music: This is stated in the second statement of the program, `likes(alice, music)`. 3. Anything that David likes: According to the third statement of the program, if David likes something, then Alice likes that thing too. This can be inferred from the rule `likes(alice, X) :- likes(david, X)`. Therefore, based on the program, Prolog would conclude that Alice likes sports, music, and anything that David likes.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.