The `Distinct' function only creates a term, it doesn't add itself to the solver. Here's an example that works for me: x = Int('x') y = Int('y') d = Distinct(x, y) s = Solver() s.add(d) # SAT without this one, UNSAT with s.add(x == y) print s print s.check() ...

Apparently it is an issue with the precedence of the ^ operator. Using lhs = (x ^ y) + (2*(x&y)) makes the example work for me....

arrays,z3,smt,z3py,microsoft-research

Disclaimer: I've hardly ever used Z3py before, but I've used Z3 quite a bit. I have the feeling that you are somewhat new to encoding logical problems as well - could that be? There are several (odd) things going on in your problem. You put constraints on x and y,...

There may be some bug, but the following returns a model of x = 0 and z = 1, even though it gives unknown. Assuming the Python API also shows this model, you could create a simple hack to extract the model and add it to the assertions to check,...

so I couldn't get rid of the multiplications without restructuring the whole approach so what I did instead was moving the block with all the conditions (uc=1 or uc=1 and sum = 1) below the forAll block. This worked in most cases but there were still a few tests where...

Well, it turns out I used brackets where I shouldn't - the reference to the custom data type "Bool" needs no call: BoolList.declare('bCONS', ('hd', Bool), ('tail', BoolList)) works just fine :)...

sorting,z3,z3py,theorem-proving

This example is not well-formed SMT2, functions can not return multiple objects. The Z3 Guide for examples of how to use datatypes as well as quantifiers.

Here's a trick you might enjoy by parsing the SMT2 string via the Python API with parse_smt2_string ( http://research.microsoft.com/en-us/um/redmond/projects/z3/z3.html#-parse_smt2_string ): from z3 import * s = SolverFor("BV") #s.set(':pp.bv_literals', True) # gives error for some reason mask = BitVec('mask', 64) multiplicand = BitVec('multiplicand', 64) x = BitVec('x', 64) y = BitVec('y',...

z3,topology,z3py,theorem-proving

It is possible that both a formula and the negation of the formula is consistent with respect to a background theory T. In particular, when T is not complete, then there are sentences that are neither consequences of T nor inconsistent with T. In your case the theory T is...

Thanks for catching that! There was indeed a bug that caused the random seed not to be passed through to the arithmetic theory. This is now fixed in the unstable branch (fix here). This example: (set-option :smt.arith.random_initial_value true) (declare-const x Int) (declare-const y Int) (assert (> (+ x y) 0))...

Disclaimer: If your problem is solely that you are struggling with encoding the problem using Z3py, then my suggestions won't help you since they are not about Z3py. However, I assume that your problem is actually more fundamental. Answer: Axiomatising the lists in Z3/SMTLIB is not at all straight-forward, in...

It may, but switching solvers or building a specialized tactic will probably have a greater influence.

Z3 is not particularly tuned for proving theorems in universal algebra. Theorem provers with super-position, such as E, Spass, Vampire, are traditionally well suited for such theorems. That said, the version of Z3 in the unstable branch has no problems. Here is what I get: z3.exe ua.smt2 /v:10 (simplifier :num-exprs...