| 1 |
; COMMAND-LINE: --no-jh-rlv-order |
| 2 |
; EXPECT: unsat |
| 3 |
(set-logic AUFBVFPDTNIRA) |
| 4 |
(set-info :status unsat) |
| 5 |
(set-info :smt-lib-version 2.6) |
| 6 |
|
| 7 |
(declare-const dividend Int) |
| 8 |
(declare-const divisor Int) |
| 9 |
|
| 10 |
(define-fun pos_div_relation ((res Int) (num Int) |
| 11 |
(den Int)) Bool (let ((exact (div num den))) |
| 12 |
(ite (= num 0) (= res 0) |
| 13 |
(ite (= num (* exact den)) (= res exact) |
| 14 |
(and (<= exact res) (<= res (+ exact 1))))))) |
| 15 |
|
| 16 |
(declare-fun fxp_div_int (Int Int) Int) |
| 17 |
|
| 18 |
(assert |
| 19 |
(forall ((x Int)) |
| 20 |
(forall ((y Int)) |
| 21 |
(! (ite (= x 0) (= (fxp_div_int x y) 0) |
| 22 |
(ite (and (< 0 x) (< 0 y)) (pos_div_relation (fxp_div_int x y) x y) |
| 23 |
(ite (and (< x 0) (< y 0)) (pos_div_relation (fxp_div_int x y) (- x) |
| 24 |
(- y)) |
| 25 |
(ite (and (< x 0) (< 0 y)) (pos_div_relation (- (fxp_div_int x y)) (- x) |
| 26 |
y) |
| 27 |
(=> (and (< 0 x) (< y 0)) (pos_div_relation (- (fxp_div_int x y)) x |
| 28 |
(- y))))))) :pattern ((fxp_div_int x y)) )))) |
| 29 |
|
| 30 |
(declare-fun of_int (Int) Int) |
| 31 |
|
| 32 |
(declare-fun fxp_div (Int Int) Int) |
| 33 |
|
| 34 |
;; VC was unprovable in the past when swapping the following two assertions |
| 35 |
(assert |
| 36 |
(forall ((x Int)) |
| 37 |
(! (ite (= x 0) (= (of_int x) 0) |
| 38 |
(ite (< 0 x) (pos_div_relation (of_int x) (* x 1073741824) 1) |
| 39 |
(pos_div_relation (- (of_int x)) (* (- x) 1073741824) 1))) :pattern ( |
| 40 |
(of_int x)) ))) |
| 41 |
|
| 42 |
(assert |
| 43 |
(forall ((x Int)) |
| 44 |
(forall ((y Int)) |
| 45 |
(! (ite (= x 0) (= (fxp_div x y) 0) |
| 46 |
(ite (and (< 0 x) (< 0 y)) (pos_div_relation (fxp_div x y) |
| 47 |
(* (* (* x 1) 1073741824) 1073741824) (* (* (* y 1073741824) 1) 1)) |
| 48 |
(ite (and (< x 0) (< y 0)) (pos_div_relation (fxp_div x y) |
| 49 |
(* (* (* (- x) 1) 1073741824) 1073741824) |
| 50 |
(* (* (* (- y) 1073741824) 1) 1)) |
| 51 |
(ite (and (< x 0) (< 0 y)) (pos_div_relation (- (fxp_div x y)) |
| 52 |
(* (* (* (- x) 1) 1073741824) 1073741824) (* (* (* y 1073741824) 1) 1)) |
| 53 |
(=> (and (< 0 x) (< y 0)) (pos_div_relation (- (fxp_div x y)) |
| 54 |
(* (* (* x 1) 1073741824) 1073741824) (* (* (* (- y) 1073741824) 1) 1))))))) :pattern ( |
| 55 |
(fxp_div x y)) )))) |
| 56 |
|
| 57 |
(define-fun in_range2 ((x Int)) Bool |
| 58 |
(and (<= (- 9223372036854775808) x) (<= x 9223372036854775807))) |
| 59 |
|
| 60 |
(assert |
| 61 |
(not |
| 62 |
(=> (< 0 divisor) |
| 63 |
(=> (< divisor 2147483648) |
| 64 |
(=> (<= (- 2147483648) dividend) |
| 65 |
(=> (< dividend divisor) |
| 66 |
(in_range2 (fxp_div (of_int dividend) (of_int divisor))))))))) |
| 67 |
|
| 68 |
(check-sat) |