title: Age word prob|em in prolog
body: <p>I know that: <br>
  Nick = 2 * Kate <br>
  (Kate + Lea) = 2 * Nick <br>
  (Chris + Nick) = 2 * (Kate + Lea) <br>
  <strong>Ashley = 24</strong> <br>
  Ashley + Kate + Lea = 2 * (Chris + Nick) <br></p>
  
  <p>After some cancellation I found out that: <br>
  Ashley = 12 * Kate => <strong>Kate = 2</strong> <br>
  Lea = 3 * Kate => <strong>Lea = 6</strong> <br>
  Nick = 2 * Kate => <strong>Nick = 4</strong> <br>
  Chris = 6 * Kate => <strong>Chris = 12</strong> <br></p>
  
  <p>I tried this: </p>
  
  <pre><code>:- use_module(library(clpfd)).
  
  ages(As) :-
     As = [Ashley, Lea, Nick, Chris, Kate],
     Ashley #= 24,
     12 * Kate #= Ashley,
     Lea #= 3*Kate,
     Nick #= 2*Kate,
     Chris #= 6*Kate.
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>Ashley = 24,
  Chris = 12,
  Kate = 2,
  Lea = 6,
  Nick = 4
  </code></pre>
  
  <p>Solution above worked fine, but teacher told me that I can't use cancellation. I'm a little bit confused because without cancellation it doesn't work. </p>
  
  <pre><code>:- use_module(library(clpfd)).
  
  ages(As) :-
     As = [Ashley, Lea, Nick, Chris, Kate],
     Ashley #= 24,
     Lea + Kate #= 2 * Nick,
     Chris + Nick #= 2 * (Kate + Lea),
     Nick #= 2 * Kate,
     Ashley + Kate + Lea #= 2*(Nick + Chris).
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>Ashley = 24,
  Lea+Kate+24#=2*Nick+2*Chris,
  Chris+Nick#=2*Lea+2*Kate,
  Lea+Kate#=2*Nick,
  2*Kate#=Nick
  </code></pre>
  
  <p>Any ideas? </p>