title: c++ linear formula simplifying library
body: <p>What is the best (in terms of simplicity of use and performance) C++/C++11 library which can simplify formulas like the following?</p>
  
  <pre><code>(a &lt; 0 &amp;&amp; b &gt; 0) || (a &lt; 0 &amp;&amp; c &gt; 0) || (a &lt; 0 &amp;&amp; c &gt; 1) 
  </code></pre>
  
  <p>to (e.g.)</p>
  
  <pre><code>a &lt; 0 &amp;&amp; (b &gt; 0 || c &gt; 0)
  </code></pre>
  
  <p>I think it is very important to explain one thing (because I see this question is misunderstood).</p>
  
  <p><strong>I do not want to simplify C / C++ expressions - I know, the compiler can make it.</strong></p>
  
  <p>I'm making a graph processing tool. On the edges of the graph, there are some conditions about its vertices (lets say the vertices are <code>a</code>, <code>b</code>, <code>c</code> and these conditions are like <code>a&lt;b</code>, <code>b&gt;0</code> etc - Please note, that these conditions are not expressed as "strings", they can be any function or library call). During processing, I'm collecting the expressions together and before further graph processing I want to simplify them.</p>
  
  <p><strong>The conditions and expressions will be created during runtime.</strong></p>
  
  <p>I want to be able to input some expressions to that library, like:</p>
  
  <pre><code>[...]
  a = new Variable();
  b = new Variable();
  expr1 = lib.addExpr(a,0, lib.LESS);
  expr2 = lib.addExpr(b,0, lib.MORE);
  expr3 = lib.addExpr(expr1, expr2, lib.AND);
  [...]
  cout &lt;&lt; lib.solve(exprn).getConditionsOf(a);
  </code></pre>
  
  <p>Of course this library will probably have a lot more beautiful API. I have written it as method calls only to show what I expect to be the underlying mechanism - to emphasize, that I do not need a source to source compiler or that this question is not related to source compilation optimization.</p>