Operationally: the elements in both lists are constrained such that their domains are consistent with the assumption that the list Sorted is the sorted version of the list List.
One of the two arguments can be uninstantiated or partial lists at call time.
Any input variables which do not already have finite bounds will be given default bounds of -10000000 to 10000000.
?- length(Xs,4), Xs::0..100, sorted(Xs,Ys), Xs = [8,20|_]. Xs = [8, 20, _340{[0..100]}, _353{[0..100]}] Ys = [_431{[0..8]}, _413{[0..20]}, _523{[8..100]}, _621{[20..100]}] ?- length(Ys,4), Ys::0..100, sorted(Xs,Ys), Ys = [8,20|_]. Xs = [_464{[8..100]}, _477{[8..100]}, _490{[8..100]}, _503{[8..100]}] Ys = [8, 20, _340{[20..100]}, _353{[20..100]}]