Solved. It turns out the native abs
function doesn't really work as I expected it to, but defining both conditions for the adj
function does the disjunctive trick and works like a charm.
This:
a(1..3).
adj(X,Y) :- a(X), a(Y), X-Y==1.
adj(X,Y) :- a(X), a(Y), Y-X==1.
#hide a/1.
Outputs:
Answer: 1
adj(3,2) adj(2,1) adj(2,3) adj(1,2)
SATISFIABLE
Models : 1
Time : 0.000
Prepare : 0.000
Prepro. : 0.000
Solving : 0.000