Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Z3 has a new solver (nlsat) for nonlinear arithmetic. It is more efficient than other solvers (<a href="http://research.microsoft.com/en-us/um/people/leonardo/files/IJCAR2012.pdf" rel="nofollow">see this article</a>). The new solver is complete for quantifier-free problems. However, the new solver does not support proof generation. If we disable proof generation, then Z3 will use nlsat and easily solve the problem. Based on your question, it seems you are really looking for solutions, thus disabling proof generation does not seem to be an issue.</p> <p>Moreover, Z3 does not produce approximate solutions (like hand calculators). It uses a precise representation for real algebraic numbers. We can also ask Z3 to display the result in decimal notation (option <code>:pp-decimal</code>). <a href="http://rise4fun.com/Z3/DkLv" rel="nofollow">Here is your example online</a>.</p> <p>In this example, when precise representation is used, Z3 will display the following result for <code>c</code>.</p> <pre><code>(root-obj (+ (^ x 2) (- 2)) 1) </code></pre> <p>It is saying that <code>c</code> is the first root of the polynomial <code>x^2 - 2</code>. When we use <code>(set-option :pp-decimal true)</code>, it will display</p> <pre><code>(- 1.4142135623?) </code></pre> <p>The question mark is used to indicate the result is truncated. Note that, the result is negative. However, it is indeed a solution for the problem you posted. Since, you are looking for triangles, you should assert that the constants are all > 0. </p> <p>BTW, you do not need the existential quantifier. We can simply use a constant <code>c</code>. Here is an example (also available <a href="http://rise4fun.com/Z3/gUO9" rel="nofollow">online at rise4fun</a>):</p> <pre><code>(set-option :pp-decimal true) (declare-const a Real) (declare-const b Real) (declare-const c Real) (assert (= a 1.0)) (assert (= b 1.0)) (assert (&gt; c 0)) (assert (= (+ (* a a) (* b b)) (* c c))) (check-sat) (get-model) </code></pre> <p>Here is another example that does not have a solution (also available <a href="http://rise4fun.com/Z3/9sldh" rel="nofollow">online at rise4fun</a>):</p> <pre><code>(set-option :pp-decimal true) (declare-const a Real) (declare-const b Real) (declare-const c Real) (assert (&gt; c 0)) (assert (&gt; a c)) (assert (= (+ (* a a) (* b b)) (* c c))) (check-sat) </code></pre> <p>BTW, you should consider the <a href="http://rise4fun.com/Z3Py/tutorial/guide" rel="nofollow">Python interface for Z3</a>. It is much more user friendly. The tutorial that I linked has examples in Kinematics. They also use nonlinear arithmetic to encode simple high-school physics problems. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload