Questions tagged [z3]

Z3 is a high-performance theorem prover being developed at Microsoft Research.

Z3 is a high-performance theorem prover being developed at Microsoft Research. Z3 supports linear real and integer arithmetic, fixed-size bit-vectors, extensional arrays, uninterpreted functions, and quantifiers.

Some key features of Z3 are:

  • High-performance theorem prover
  • Integrating efficient constraint solving technologies
  • Checking satisfiability of logical formulas with quantifiers
  • Highly customizable with an extensive API
  • Including support for custom theories

For more information about Z3, visit the Z3 homepage or try Z3 in your browser.

See also Z3 tutorial guide for more in-depth introduction about Z3.

2824 questions
5
votes
1 answer

Z3: Performing Matrix Operations

My Situation I'm working on a project which needs to: Prove the correctness of 3D matrix transformation formulas involving matrix operations Find a model with the values of the unknown matrix entries. My Question What's the best way to express…
fdj815
  • 569
  • 1
  • 7
  • 15
5
votes
1 answer

z3 number of solutions

How do I use z3 to count the number of solutions? For example, I want to prove that for any n, there are 2 solutions to the set of equations {x^2 == 1, y_1 == 1, ..., y_n == 1}. The following code shows satisfiability for a given n, which isn't…
Alex Reece
  • 1,906
  • 22
  • 31
5
votes
1 answer

How to implement array of bitvectors in z3's Python APIs

I am new to z3py and was going through the Z3 API in Python, but couldn't figure out how to define an array of bitvectors. I want something like: DOT__mem[16] = BitVec('DOT__mem[16]', 8) but this syntax didn't work, even on the practice panel in…
Sharad
  • 445
  • 6
  • 20
5
votes
1 answer

retrieving value of an enumerated type in Z3Py

How do I retrieve the values of an enumerated variable v ? For example, vTyp, (val1,val2,val3) = EnumSort('vTyp',['val1','val2','val3']) v = Const('my variable',vTyp) Now, given just the above variable v, how would I retrieve a list of values …
Vu Nguyen
  • 987
  • 1
  • 9
  • 20
5
votes
1 answer

z3 C++ API & ite

Maybe I missed something, but what is the way of constructing an if-then-else expression using the z3 C++ API ? I could use the C API for that, but I'm wondering why there is no such function in the C++ API. regards, Julien
Julien H.
  • 147
  • 9
5
votes
1 answer

Bit-wise with Z3?

I write the following Z3 python code x, y = Ints('x y') F = (x == y & 16) # x has the value of (y & 16) print F But I get bellow error: TypeError: unsupported operand type(s) for &: 'instance' and 'int' How to do bitwise arithmetic (& in this…
user311703
  • 1,113
  • 2
  • 14
  • 25
5
votes
1 answer

Learning Z3py - Is there support for arrays and loops

I'm going through Z3py and have a question with how to use the API in a couple specific cases. The code below is a simplified version of something I would ultimately like to use Z3 for. Some of my questions are: 1. Is there a way to create an…
daybreak
  • 181
  • 1
  • 8
5
votes
1 answer

Can Z3 be used to preprocess problems?

Doing new research on SMT solvers is many times hindered by the fact that the available problems require lots of tricks and pre-processing techniques not directly related to decision procedures. These are often unpublished or take time to implement…
Dejan Jovanović
  • 2,085
  • 1
  • 16
  • 22
5
votes
1 answer

Z3 with Craig interpolation (iz3)

I'm trying to generate Craig interpolants using the C API but I get incorrect results. However, when I dump the same problem to a file via Z3_write_interpolation_problem and call iZ3 I get the expected interpolant. I attach the code to be able to…
5
votes
2 answers

prevent solution from being simplified

I want to the solution got back from z3 without simplification using let statements. For example if I give the following: (declare-const x Int) (elim-quantifiers (exists ((x.1 Int)) (and (or (and (= (- x.1 2) 0) (<= (- x.1 9) 0)) …
sriraj
  • 93
  • 5
5
votes
1 answer

Empty model in z3

z3py snippet: x = Int('x') s = Solver() s.add(x <= x) print s.check() print s.model() print s.model().sexpr() http://rise4fun.com/Z3Py/mfPU Output: sat [] Any value of x would do but z3 returns empty model. Does a missing free variable x in the…
dips
  • 1,627
  • 14
  • 25
5
votes
1 answer

Z3 Performance with Non-Linear Arithmetic

We are running into performance problems with what I believe is the part of Z3 that treats non-linear arithmetic. Here is a simple concrete Boogie example, that when verified with Z3 (version 4.1) takes a long time (on the order of 3 minutes) to…
stefan
  • 1,135
  • 1
  • 11
  • 22
5
votes
1 answer

z3 const declaration

In Z3 Python, what's the diff between 1) x = Const("x",IntSort()) vs 2) x = Int("x") ? is_const returns true for both and they are both ArithRef. I would thought 1) would be appropriate for defining a const, e.g., x is 3.14 and 2) is to…
Vu Nguyen
  • 987
  • 1
  • 9
  • 20
5
votes
1 answer

TryFor in Z3 does not stop checking after the given timelimit

I am using the .NET API of Z3. When I instantiate a solver by calling: Solver s = ctx.MkSolver(ctx.TryFor(ctx.MkTactic("qflia"), TimeLimit)); and give it a TimeLimit of 60 seconds (60000 milliseconds) for some models the statement s.Check() does…
larsbeck
  • 665
  • 2
  • 7
  • 11
5
votes
1 answer

what's the difference between "simplify" and "ctx-solver-simplify" in z3

since current version, there is some problem in "ctx-solver-simplify"like in the example http://rise4fun.com/Z3/CqRv z3 gives the wrong answer. I replace "ctx-solver-simplify" by "simplify" like http://rise4fun.com/Z3/x9X4 I am wondering, what's…
user1487718