Prolog developer
Budget: $10 – $30 USD
Implement the ``Fred the collie” problem of Chapter 3, Example 3.3.4, in Prolog. Create a Prolog program that encodes the given facts and rules, and run it with the appropriate query to find Fred’s location.
To make the code shown in the book to work, you need to initialize the spaniel and warm predicates with some value. Try putting these two lines at the start of your file:
spaniel(lucy).
warm(friday).
collie(fred).
master(fred, sam).
day(saturday).
¬warm(saturday).
trained(fred)
∀X(spaniel(X) ∨ (collie(X) ∧ trained(X)) → gooddog(X))
∀X∀Y∀Z(gooddog(X) ∧ master(X, Y) ∧ location(Y, Z) → location(X, Z))
day(saturday) ∧ warm(saturday) → location(sam, park)
day(saturday ∧ ¬warm(saturday) → location(sam, museum)
To make the code shown in the book to work, you need to initialize the spaniel and warm predicates with some value. Try putting these two lines at the start of your file:
spaniel(lucy).
warm(friday).
collie(fred).
master(fred, sam).
day(saturday).
¬warm(saturday).
trained(fred)
∀X(spaniel(X) ∨ (collie(X) ∧ trained(X)) → gooddog(X))
∀X∀Y∀Z(gooddog(X) ∧ master(X, Y) ∧ location(Y, Z) → location(X, Z))
day(saturday) ∧ warm(saturday) → location(sam, park)
day(saturday ∧ ¬warm(saturday) → location(sam, museum)