Please complete in Prolog, thank you.
Write the following statement as prolog clauses (one fact and
one rule):
“weather is hot. if weather is hot, everyone like it.”
So, all following queries will return true
likes (me, weather). likes (jane, weather). likes (john, weather).
% etc.
Do these different queries produce the same result in prolog?
Why?
?- N is -(+(5,6),4). ?- N is (5+6)-4.
The prolog code for the 1st part (“weather is hot. if weather is hot, everyone like it”) is as follows -
Code:
% weather is hot
is_hot(weather).
% anyone will like the weather if it is hot
likes(_, W):-
is_hot(W).
Run:

Part 2 -
Do these different queries produce the same result in
prolog? Why?
?- N is -(+(5,6),4). ?- N is (5+6)-4.
Run:

Explanation:
Both the queries produce the same result, because both are mathematical expressions denoting the same thing.
N is -(+(5,6),4). - is prefix notation where the operator comes before the operands.
N is (5+6)-4. - is infix notation which is the common form for a mathematical expression.
Please complete in Prolog, thank you. Write the following statement as prolog clauses (one fact and...