Check the prolog manual regarding the different comparators, etc. They mean and do various things. =:=/2
is specifically evaluates arithmetic expressions on either side and checks for equality of results. =/2
is not an equality operator; it performs prolog unification. It's important to know the difference. In your example, limiting all results to maximum of 6
, then permutations of 3,4,5
are the only positive integer solutions to the right triangle.
?- between(1,6,X), between(1,6,Y), between(1,6,Z), Z^2 =:= X^2 + Y^2.
X = 3,
Y = 4,
Z = 5 ;
X = 4,
Y = 3,
Z = 5 ;
false.