In the river crossing Alloy model, this predicate:
pred crossRiver [from, from', to, to': set Object] {
one x: from | {
from' = from - x - Farmer - from'.eats
to' = to + x + Farmer
}
}
models the river crossing: One of the objects x
from the from
side moves to the to
side, along with the Farmer.
To test my understanding, I changed: one x: from
to lone x: from - Farmer
--- the former moving "exactly one thing" across the river, and the latter moving "at most one non-Farmer thing".
I thought the latter better models the problem: The Farmer is hardcoded in the equality constraints and always crosses the river, and lone
should better convey that the farmer can take zero or one things with them across the river.
However, when running the model after this change, the results are nonsense:
Here the second state instance shows the chicken and grain on both sides of the river and the farmer not having crossed at all.
What am I missing? (This was run on Alloy 4.2_2015-02-22)