-Bill owns a dog.
-Every dogowner likes animals.
-Every person who likes animals cannot hit an animal.
-Bill or Bull hit a cat whose name is Tom.
-Every cat is an animal.
owns(bill,dog).
likes(X,animals):- owns(X,dog).
cannothit(X,animal):- likes(X,animals).
or hit(X,animal):- \+ likes(X,animal)
With the 4th sentence I have a major problem because I do not know how to state that or.
It would be so awesome if someone could help me.
On 24/11/2017, at 05:08, sasa...@msn.com wrote:Hi guys :) I am totally new to prolog and therefor could use some help with a homework. I already asked the question on stackoverflow, but for what I really needed, the guy stopped responding
and the homework is due to tomorrow :/
So we need to formulate these sentences into Prolog:
1. Bill owns a dog.
2. Every dogowner likes animals.
3. Every person who likes animals cannot hit an animal.
4. Bill or Bull hit a cat whose name is Tom.
5. Every cat is an animal.
owns(bill,dog).
Again, I’d use Pet with dog(Pet) instead of dog.likes(X,animals):- owns(X,dog).
cannothit(X,animal):- likes(X,animals).
orhit(X,animal):- \+ likes(X,animal)
With the 4th sentence I have a major problem because I do not know how to state that or.
It would be so awesome if someone could help me.