I have this implication from the classic farmer wolf goat cabbage problem in Artificial Intelligence
The text book says that this rule operates when the farmer and wolf are on the opposite sides of the river.I'm unable to understand the 'if part of the implication'
What does it mean?
The predicate move/2
takes parameters of the form state/4 in
order to implement the state of problem. In the states the first parameter is used for the farmer, the second for the wolf,third for goat and fourth for cabbage. Every parameter-variable of the state should get either value e (for east) or w (for west).
In order to solve the problem you can define clauses of the form move(state(F1,W1,G1,C1),state(F2,W2,G2,C2)):-...
similar to clause in the picture.
The predicate that is shown in the picture is used when both farmer and wolf are in the same side so in the input state the two first variables are common (state(X,X,G,C))
and want to move in the opposite side so the will go to state(Y,Y,G,C)
where opp(X,Y)
is true which means that if X is e then both farmer and wold will move to w and vice versa. The above move is valid since you have implemented previous moves such that farmer and wolf can't be in the same side and simultaneously goat and cabbage are also in the same side (goat would eat cabbage), so the previous sequence of moves since it is valid farmer and wolf can be on the same side and cabbage and goat will be on opposite sides.