Source

z3 / src / api / ml / test_mlapiV3.regress.out

Full commit
Z3 4.2.0.0

simple_example
CONTEXT:
(solver)END OF CONTEXT

DeMorgan
DeMorgan is valid

find_model_example1
model for: x xor y
sat
y -> false
x -> true


find_model_example2
model for: x < y + 1, x > 2
sat
y -> 3
x -> 3

model for: x < y + 1, x > 2, not(x = y)
sat
y -> 4
x -> 3


prove_example1
prove: x = y implies g(x) = g(y)
valid
disprove: x = y implies g(g(x)) = g(y)
invalid
counterexample:
y -> U!val!0
x -> U!val!0
g -> {
  U!val!0 -> U!val!1
  U!val!1 -> U!val!2
  else -> U!val!1
}


prove_example2
prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0
valid
disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1
invalid
counterexample:
z -> (- 1)
y -> (- 7719)
x -> (- 7719)
g -> {
  (- 7719) -> 0
  0 -> 2
  (- 1) -> 3
  else -> 0
}


push_pop_example1
assert: x >= 'big number'
push
number of scopes: 1
assert: x <= 3
unsat
pop
number of scopes: 0
sat
x = 1000000000000000000000000000000000000000000000000000000:int
function interpretations:
assert: y > x
sat
y = 1000000000000000000000000000000000000000000000000000001:int
x = 1000000000000000000000000000000000000000000000000000000:int
function interpretations:

quantifier_example1
pattern: {(f #0 #1)}

assert axiom:
(forall (k!0 Int) (k!1 Int) (= (inv!0 (f k!1 k!0)) k!0) :pat {(f k!1 k!0)})
prove: f(x, y) = f(w, v) implies y = v
valid
disprove: f(x, y) = f(w, v) implies x = w
that is: not(f(x, y) = f(w, v) implies x = w) is satisfiable
unknown
potential model:
w = 2:int
v = 1:int
y = 1:int
x = 0:int
function interpretations:
f = {(else|->(define f!52 Int Int Int)[(define k!50 Int Int)[#unknown], (define k!51 Int Int)[#unknown]])}
#51 = {(2:int|->2:int), (1:int|->1:int), (15:int|->15:int), (11:int|->11:int), (0:int|->0:int), (19:int|->19:int), (else|->2:int)}
f!52 = {(0:int, 1:int|->3:int), (2:int, 1:int|->3:int), (0:int, 0:int|->4:int), (2:int, 0:int|->5:int), (6:int, 2:int|->7:int), (2:int, 2:int|->8:int), (0:int, 2:int|->9:int), (6:int, 0:int|->10:int), (0:int, 11:int|->12:int), (2:int, 11:int|->13:int), (6:int, 11:int|->14:int), (0:int, 15:int|->16:int), (2:int, 15:int|->17:int), (6:int, 15:int|->18:int), (0:int, 19:int|->20:int), (6:int, 19:int|->21:int), (2:int, 19:int|->22:int), (else|->3:int)}
inv!0 = {(3:int|->1:int), (4:int|->0:int), (5:int|->0:int), (7:int|->2:int), (8:int|->2:int), (9:int|->2:int), (10:int|->0:int), (12:int|->11:int), (13:int|->11:int), (14:int|->11:int), (16:int|->15:int), (17:int|->15:int), (18:int|->15:int), (20:int|->19:int), (21:int|->19:int), (22:int|->19:int), (else|->2:int)}
#50 = {(2:int|->2:int), (6:int|->6:int), (0:int|->0:int), (else|->2:int)}
reason for last failure: 7 (7 = quantifiers)

array_example1
prove: store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))
(=> (= (store a1 i1 v1) (store a2 i2 v2))
    (or (= i1 i3) (= i2 i3) (= (select a1 i3) (select a2 i3))))
valid

array_example2
n = 2
(distinct k!0 k!1)
sat
#0 = (define as-array[k!0] (Array Bool Bool))
#1 = (define as-array[k!1] (Array Bool Bool))
function interpretations:
#0 = {((define false Bool)|->(define true Bool)), (else|->(define true Bool))}
#1 = {((define false Bool)|->(define false Bool)), (else|->(define false Bool))}
n = 3
(distinct k!0 k!1 k!2)
sat
#0 = (define as-array[k!0] (Array Bool Bool))
#1 = (define as-array[k!1] (Array Bool Bool))
#2 = (define as-array[k!2] (Array Bool Bool))
function interpretations:
#0 = {((define true Bool)|->(define true Bool)), ((define false Bool)|->(define false Bool)), (else|->(define true Bool))}
#1 = {((define false Bool)|->(define true Bool)), (else|->(define true Bool))}
#2 = {((define true Bool)|->(define false Bool)), ((define false Bool)|->(define false Bool)), (else|->(define false Bool))}
n = 4
(distinct k!0 k!1 k!2 k!3)
sat
#0 = (define as-array[k!0] (Array Bool Bool))
#1 = (define as-array[k!1] (Array Bool Bool))
#2 = (define as-array[k!2] (Array Bool Bool))
#3 = (define as-array[k!3] (Array Bool Bool))
function interpretations:
#0 = {((define true Bool)|->(define false Bool)), ((define false Bool)|->(define true Bool)), (else|->(define false Bool))}
#1 = {((define true Bool)|->(define true Bool)), ((define false Bool)|->(define false Bool)), (else|->(define true Bool))}
#2 = {((define true Bool)|->(define true Bool)), ((define false Bool)|->(define true Bool)), (else|->(define true Bool))}
#3 = {((define true Bool)|->(define false Bool)), ((define false Bool)|->(define false Bool)), (else|->(define false Bool))}
n = 5
(distinct k!0 k!1 k!2 k!3 k!4)
unsat

array_example3
domain: int
range:  bool

tuple_example1
tuple_sort: (real, real)
prove: get_x(mk_pair(x, y)) = 1 implies x = 1
valid
disprove: get_x(mk_pair(x, y)) = 1 implies y = 1
invalid
counterexample:
y -> 0
x -> 1

prove: get_x(p1) = get_x(p2) and get_y(p1) = get_y(p2) implies p1 = p2
valid
disprove: get_x(p1) = get_x(p2) implies p1 = p2
invalid
counterexample:
p1 -> (mk_pair 1 0)
p2 -> (mk_pair 1 2)

prove: p2 = update(p1, 0, 10) implies get_x(p2) = 10
valid
disprove: p2 = update(p1, 0, 10) implies get_y(p2) = 10
invalid
counterexample:
p2 -> (mk_pair 10 1)
p1 -> (mk_pair 0 1)


bitvector_example1
disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers
invalid
counterexample:
x -> bv2147483656[32]


bitvector_example2
find values of x and y, such that x ^ y - 103 == x * y
sat
y -> bv3905735879[32]
x -> bv3787456528[32]


eval_example1
MODEL:
y -> 4
x -> 3

evaluating x+y
result = 7:int

two_contexts_example1
k!0

error_code_example1
last call succeeded.
last call failed.

error_code_example2
before Z3_mk_iff
Z3 error: type error.

parser_example1
formula 0: (> x y)
formula 1: (> x 0)
sat
y -> 0
x -> 1


parser_example2
formula: (> x y)
sat
y -> (- 1)
x -> 0


parser_example3
assert axiom:
(forall (x Int) (y Int) (= (g x y) (g y x)) :qid {k!1})
formula: (forall (x Int) (y Int) (=> (= x y) (= (g x 0) (g 0 y))) :qid {k!1})
valid

parser_example4
declaration 0: (define y Int)
declaration 1: (define sk_hack Bool Bool)
declaration 2: (define x Int)
assumption 0: (= x 20)
formula 0: (> x y)
formula 1: (> x 0)

parser_example5
Z3 error: parser error.
Error message: 'ERROR: line 1 column 41: could not find sort symbol 'y'.
'.

ite_example
term: (if false 1 0)

enum_example
(define apple[fruit:0] fruit)
(define banana[fruit:1] fruit)
(define orange[fruit:2] fruit)
(define is_apple[fruit:0] fruit Bool)
(define is_banana[fruit:1] fruit Bool)
(define is_orange[fruit:2] fruit Bool)
valid
valid
invalid
counterexample:

valid
valid

unsat_core_and_proof_example
unsat
proof: [unit-resolution
  [def-axiom (or (or (not PredA) PredC (not PredB)) (not PredC))]
  [unit-resolution
    [def-axiom (or (or (not PredA) (not PredB) (not PredC)) PredC)]
    [unit-resolution
      [mp
        [asserted (or (and PredA PredB PredC) P1)]
        [monotonicity
          [rewrite
            (iff (and PredA PredB PredC)
                 (not (or (not PredA) (not PredB) (not PredC))))]
          (iff (or (and PredA PredB PredC) P1)
               (or (not (or (not PredA) (not PredB) (not PredC))) P1))]
        (or (not (or (not PredA) (not PredB) (not PredC))) P1)]
      [asserted (not P1)]
      (not (or (not PredA) (not PredB) (not PredC)))]
    PredC]
  [unit-resolution
    [mp
      [asserted (or (and PredA (not PredC) PredB) P2)]
      [monotonicity
        [rewrite
          (iff (and PredA (not PredC) PredB)
               (not (or (not PredA) PredC (not PredB))))]
        (iff (or (and PredA (not PredC) PredB) P2)
             (or (not (or (not PredA) PredC (not PredB))) P2))]
      (or (not (or (not PredA) PredC (not PredB))) P2)]
    [asserted (not P2)]
    (not (or (not PredA) PredC (not PredB)))]
  false]

core:
(not P2)
(not P1)


abstract_example
formula: (> x y)
abstracted formula: (> #0 y)

get_implied_equalities example
Class a |-> 0
Class b |-> 0
Class c |-> 0
Class d |-> 3
Class (f a) |-> 0
Class (f b) |-> 0
Class (f c) |-> 0
asserting f(a) <= b
Class a |-> 0
Class b |-> 0
Class c |-> 0
Class d |-> 3
Class (f a) |-> 0
Class (f b) |-> 0
Class (f c) |-> 0