domains, constraints and labeling in Sicstus Prolog solver, finite domain

by Forrest Sheng Bao http://fsbao.net

It's really tricky to program in Sicstus Prolog solver.

Bellow is an example

:- use_module(library(clpfd)).
a(X,Y):-domain([X], 1,4), domain([Y], 4, 6), X+2#>Y, labeling([],[X,Y]).

Results on Sicstus:

| ?- [d].
% consulting /home/grad2/fsbao/d.pl...
% consulted /home/grad2/fsbao/d.pl in module user, 10 msec 72 bytes
yes
| ?- a(X,Y).
X = 3,
Y = 4 ? ;
X = 4,
Y = 4 ? ;
X = 4,
Y = 5 ? ;
no

Ref: Constraint Logic Programming over Finite Domains, Sicstus Manual, http://www.sics.se/sicstus/docs/3.7.1/html/sicstus_33.html