title: SWI-Prolog and constraints, library CLP(FD)
body: <p>I'm playing around with constraints in (swi) prolog using the clpfd library.</p>
  
  <p>I'm trying to identify when one set of constraints encapsulates or subsumes the other, e.g. X&lt;4 encapsulates X&lt;7 as whenever the former is true, the latter is true. This can be easily represented using logical implication. However, I couldn't get the #==> operator to give me the result I wanted, so I resorted to using  not(Co1 #/\ #\Co2) where Co1 and Co2 are constraints. This is fine for individual constraints, but I then wanted to pass a conjunctions of constraints into Co1 and Co2.</p>
  
  <p>Now here is the rub. When I try</p>
  
  <pre><code>X#&lt;7 #/\ #\X#&lt;4.
  </code></pre>
  
  <p>I get back</p>
  
  <pre><code>X in 4..6,
  X+1#=_G822,
  X+1#=_G834,
  _G822 in 5..7,
  _G834 in 5..7.
  </code></pre>
  
  <p>(oddly enough, doing this in Sicstus results in a segmentation fault)</p>
  
  <p>When I pass in </p>
  
  <pre><code>X#&lt;7,X#&lt;4
  </code></pre>
  
  <p>I get the desired</p>
  
  <pre><code>X in inf..3.
  </code></pre>
  
  <p>Obviously, I can't pass the latter into not(Co1 #/\ #\Co2), but the former doesn't give me the result I want. Can anyone explain why the two approaches yield different results, and how I can get the former to act like the latter?</p>