smt - Does z3 support rational arithmetic for its input constraints? -


in fact, smt-lib standard have rational (not real) sort? going website, not.
if x rational , have constraint x^2 = 2, should ``unsatisfiable''. closest encoding constraint following:

;;(set-logic qf_nra) ;; intentionally commented out   (declare-const x real)   (assert (= (* x x) 2.0))   (check-sat)   (get-model)   

for z3 returns solution, there solution (irrational) in reals. understand z3 has own rational library, uses, instance, when solving qf_lra constraints using adaptation of simplex algorithm. on related note, there smt solver supports rationals @ input level?

i'm sure it's possible define rational sort using 2 integers suggested nikolaj -- interested see that. might easier use real sort, , time want rational, assert it's equal ratio of 2 ints. example:

(set-option :pp.decimal true) (declare-const x real) (declare-const p int) (declare-const q int) (assert (> q 0)) (assert (= x (/ p q))) (assert (= x 0.5)) (check-sat) (get-value (x p q))  

this comes with

sat ((x 0.5)  (p 1)  (q 2)) 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -