The “Animals” knowledge base is set: Live - dog. Rex is a dog. A squirrel is a cat. Fast - horse. Live - black. The squirrel is white. Rex is a redhead. Fast - white. Pets - dog or cat. Animals - or horse, or pets. Tom has one who is a dog and not of a black color. Mary possesses one who is either black or horse. Write a program on Prolog and answer the question: Who is a squirrel? Print all animals in white. Print nicknames of all pets

Here's the code, but I can't understand how to answer the question Who is a squirrel ?:

domains animal=symbol predicates dog(animal) cat(animal) horse(animal) white(animal) black(animal) rufous(animal) animal_house(animal) animal_z(animal) tom_v(animal) meri_v(animal) clauses dog(zhavii). dog(reksh). cat(bilka). white(shidkii). white(bilka). horse(shidkii). black(zhavii). rufous(reksh). animal_house(X):- cat(X). animal_house(X):- dog(X). animal_z(X):- horse(X). animal_z(X):- animal_house(X). tom_v(X) if dog(X) and not(black(X)). meri_v(X):- black(X). meri_v(X):- horse(X). goal white(X) and write( "White animals: ",X) and nl, animal_house(X) and write( "Animals house: ",X) and nl. 
  • What does not suit you in your code? - michael_best 5:46 pm
  • write ("Animals house:", X) and nl, most likely a point is expected here, not a comma - Komdosh February

0