Question: Write the following statement as prolog clauses (one fact and one rule): coffee is hot. if coffee is hot, everyone likes it. So, all following

Write the following statement as prolog clauses (one fact and one rule): coffee is hot. if coffee is hot, everyone likes it. So, all following queries will return true

 likes (me, coffee). likes (tom, coffee). likes (johnny, coffee). % etc. 

Do these different queries produce the same result in prolog? Why? ?- N is -(+(6,7),3).

?- N is (6+7)-3. 

For each of the following English statements write a prolog program.

% Facts & Rules (1) jane is a woman. (2) john is a man. (3) john is healthy. (4) jane is healthy. (5) john is muscular. (6) anyone is a hiker if he is healthy and muscular. (7) anyone can hike if he is a hiker. % Goals (queries). (8) Who can hike? (9) Who is healthy and muscular?

What answers do you get for below queries for this given program?

 % Facts & Rules vegan(jose). vegan (james). milk(cow_milk). milk(soy_milk). likes(jose, X) :- milk(X). loves(Who, soy_milk) :- vegan(Who). 

% This are queries. You do not need to copy the ?- symbol ?- milk(X). ?- milk(potato). ?- likes(jose, What).

?- likes(Who, soy_milk).

?- loves(Who, soy_milk). 

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!