title: Prolog operator precedence and rules matching
body: <p>I have the next two facts loaded in my prolog interpreter:</p>
  
  <pre><code>foo(U+V,1).
  foo(U*V,2).
  </code></pre>
  
  <p>Now I try the next queries with that results:</p>
  
  <pre><code>foo(x*x+x,R).  --&gt;  R = 1
  foo(x+x*x,R).  --&gt;  R = 1
  foo(x*x*x,R).  --&gt;  R = 2
  </code></pre>
  
  <p>Now I try with the next query:</p>
  
  <pre><code>foo(x*x-x,R).  --&gt;  no
  </code></pre>
  
  <p>As I understand, this is explained by how the operator precedence build the tree expression:</p>
  
  <pre><code>x+x*x  --&gt;  +           so it matches with  --&gt;  +
             / \                                  / \
            x   *                                U   V
               / \
              x   x
  
  x-x*x  --&gt;  -           DOES NOT matches any fact.
             / \                             
            x   *                                
               / \
              x   x
  </code></pre>
  
  <p>Is this explanation correct?</p>