1

I'm writing a proofchecker for a novel program logic, dealing with weak memory. Z3 does the heavy lifting: I translate all my checks into ASTs and throw them at Z3 using the ML binding. (But, see below, I've checked that Z3 online, via rise4fun, gives the same answer). Here's the implication I would like to check, pretty-printed so I can understand the operator nesting, with the names slightly simplified so it's easy to see what they are:

         r1=1
       =>      y=1
           /\  x=1
   /\  xnew=x
   /\  ynew=2
=>          xnew=x
       /\  ynew=y
   \/  Exists(r1) 
                   r1=1
               =>      y=1
                   /\  x=1
           /\  xnew=x
           /\  ynew=2

This translates into ASTs nicely (type declarations not shown, but see below for actual Z3 input):

(let ((a1 (and (=> (= r1 1) (and (= y 1) (= x 1)))
               (= xnew x)
               (= ynew 2)))
     (a2 (exists ((r1 Int))
            (and (=> (= r1 1) (and (= y 1) (= x 1)))
                 (= xnew x)
                 (= ynew 2)))))
 (=> a1 (or 

(and (= xnew x) (= ynew y)) a2)))

So that's all fine. But Z3 says 'unknown'. Oddly, this is the only one of many thousands of queries in all my tests which gives this result. So I investigated with the online version of Z3, via the rise4fun tutorial, which accepted this input

(declare-const r1 Int)
(declare-const y Int)
(declare-const x Int)
(declare-const xnew Int)
(declare-const ynew Int)
(define-fun a1 () Bool
  (and (=> (= r1 1) (and (= y 1) (= x 1)))
               (= xnew x)
               (= ynew 2))
)
(define-fun a2 () Bool
  (exists ((r1 Int))
            (and (=> (= r1 1) (and (= y 1) (= x 1)))
                 (= xnew x)
                 (= ynew 2)))
)
(define-fun conjecture () Bool 
  (=> a1 (or (and (= xnew x) (= ynew y)) a2))
)
(assert (not conjecture))
(check-sat)

and said 'unknown'.

Am I making a simple error, or is this a bug, or what?

1 Answers1

0

This seems to be a bug in the master branch and in the executable used online. The behavior does not reproduce in the latest unstable branch.

Nikolaj Bjorner
  • 8,229
  • 14
  • 15
  • Thanks. I'll hold my breath :-) – user3464390 Mar 26 '14 at 15:07
  • @Nikolaj: Here is a relatively small input that produces "unknown" result - [Z3 input](http://stackoverflow.com/questions/22670784/why-does-z3-return-unknown-on-this-simple-input). It does not use any theories like arithmetic. Perhaps this may help you reproduce the behaviour. – Gowtham Kaki Mar 26 '14 at 19:16