Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What has been your desire for leadership in CVS Health?

Answered: 1 week ago

Question

Question 5) Let n = N and Y Answered: 1 week ago

Answered: 1 week ago