We define the difference between two lists A and B as A-B = Elements in A but not B. SWI Prolog has a builtin predicate to do this in the form of subtract/3. It seems that XSB Prolog lacks this predicate. So, here is a simple alternate definition of subtract in XSB prolog-
subtract(A,B,C):- findall(X, (member(X,A), not(member(X,B))), C).
where C = A – B