Question about clpfd and "insufficiently instantiated variables"

I’m trying to declare a constraint variable to be in one of two intervals, say [0…3] or [5…6]. I imagined that I should be able to do this:

?- X in 0..3 #\/ X in 5..6, label([X]).
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR:   [14] throw(error(instantiation_error,_29172))
ERROR:   [11] clpfd:'__aux_maplist/2_must_be_finite_fdvar+0'([_29206]) at /usr/lib/swi-prolog/library/clp/clpfd.pl:1745
ERROR:   [10] clpfd:labeling([],[_29244]) at /usr/lib/swi-prolog/library/clp/clpfd.pl:1748
ERROR:    [7] <user>
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.

Am I misunderstanding something, or is this a limitation in SWI Prolog?

as specified here, you need the (\/)/2 operator, and not the reification oriented (#\/)/2.

?- X in 1..3 \/ 5..6, label([X]).
X = 1 ;
X = 2 ;
X = 3 ;
X = 5 ;
X = 6.
1 Like

Yes, that solved the problem. Thanks!