I want to know how I would get something like this to work. It seems like a simple concept, but I'm very new to Prolog and I can't seem to figure out how I would do this correctly. For example, here are two tables. Each animal, regardless of the category, has two facts. Mammal: tiger - striped, powerful hippo - large, dangerous elephant - large, gentle Insect: fly - black, winged caterpillar - green, slow snail - slimy, slow How would I write all of these statements in Prolog code such that the fly and its characteristics will be categorized under insect and the hippo and its characteristics under mammal? Then, what if I inserted a rule such as this?
guess(mammal, large)
After consulting the code, I would write out this command:
possibleanimal(mammal, X)
and the conclusion to that command would be:
X = hippo X = elephant
since both the hippo and the elephant have the large characteristic. Another example:
guess(insect, slow) guess(insect, green)
Command asked after consulting:
possibleanimal(insect, Y) Y= caterpillar
We can omit the snail because even though it is slow, it is not green. Please help me out in any way you can, thank you!