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
10
votes
1 answer

Use Z3 managed API on Mono

We have a .NET project using Z3 API v4.0. We would like to be able to compile and run the project on Mono. The project compiled fine with MonoDevelop. However, when we run or debugged the program, the following exception…
pad
  • 41,040
  • 7
  • 92
  • 166
10
votes
1 answer

Traversing Z3_ast tree in C/C++

In short, I need to be able to traverse Z3_ast tree and access the data associated with its nodes. Cannot seem to find any documentation/examples on how to do that. Any pointers would be helpful. At length, I need to parse smt2lib type formulae into…
Garvit Juniwal
  • 195
  • 1
  • 6
10
votes
1 answer

Casting a Z3 integer expression to a C/C++ int

I'm new to Z3 and searched for the answer to my question here and on Google. Unfortunately, I was not successful. I'm using the Z3 4.0 C/C++ API. I declared an undefined function d: (Int Int) Int, added some assertions, and computed a model. So far,…
Dan
  • 1,539
  • 12
  • 23
10
votes
2 answers

Create an array with fixed size and initialize it

I'm going to create an array with fixed size and initialize it with some values. For example, the following C++ code: a[0] = 10; a[1] = 23; a[2] = 27; a[3] = 12; a[4] = 19; a[5] = 31; a[6] = 41; a[7] = 7; Are there some utilities in Z3 to model it?
user1458344
  • 111
  • 1
  • 3
9
votes
1 answer

Can Z3 be used to reason about substrings?

I am trying to use Z3 to reason about substrings, and have come across some non-intuitive behavior. Z3 returns 'sat' when asked to determine if 'xy' appears within 'xy', but it returns 'unknown' when asked if 'x' is in 'x', or 'x' is in 'xy'. I've…
Katie
  • 93
  • 4
9
votes
1 answer

While loop for Z3 or Smt2

How to convert a simple while loop(c- code) to smt2 language or z3? For ex : int x,a; while(x > 10 && x < 100){ a = x + a; x++; }
hodophile
  • 357
  • 1
  • 5
  • 14
9
votes
1 answer

Z3 Int not defined error

I am trying to use Z3 library from python however it does not work. It gives an error Int is not defined. I installed the z3 module using pip and as you can see, there is no error message thrown when I import the lib. I am using Mac OS X and python…
Neon Flash
  • 3,113
  • 12
  • 58
  • 96
9
votes
1 answer

Multi-threaded Z3?

I'm working on a Python project, where I'm currently trying to speed things up in some horrible ways: I set up my Z3 solvers, then I fork the process, and have Z3 perform the solve in the child process and pass a pickle-able representation of the…
Zardus
  • 316
  • 2
  • 7
9
votes
1 answer

declare-fun vs declare-const in SMT2

I get confused about the following two declarations. For me, they describe the same thing: an integer variable x. (declare-const x Int) (declare-fun x () Int) Is there any context that make them different in performance or provide different…
sean
  • 1,632
  • 2
  • 15
  • 34
9
votes
1 answer

Z3: Offering random solutions in solving

I tried the following code in http://rise4fun.com/z3/tutorial (declare-const a Int) (assert (> a 100)) (check-sat) (get-model) the result is always a=101. I need some randomness in the answer that it produce a random number in the range…
mrd abd
  • 828
  • 10
  • 19
9
votes
1 answer

(get-unsat-core) returns empty in Z3

I am using Z3 to extract the unsat-core of an unsatisfiable formula. I am using Z3@Rise interface (web based) to write the following code, (set-logic QF_LIA) (set-option :produce-unsat-cores true) (declare-fun ph1 () Int) (declare-fun ph1p ()…
chinu
  • 239
  • 2
  • 6
9
votes
1 answer

Z3py: how to get the list of variables from a formula?

In Z3Py, I have a formula. How can I retrieve the list of variables using in the formula? Thanks.
user311703
  • 1,113
  • 2
  • 14
  • 25
9
votes
1 answer

Avoiding quantifiers in Z3

I am experimenting with Z3 where I combine the theories of arithmetic, quantifiers and equality. This does not seem to be very efficient, in fact it seems to be more efficient to replace the quantifiers with all instantiated ground instances when…
marczoid
  • 1,365
  • 2
  • 12
  • 20
9
votes
1 answer

z3python: converting string to expression

Given that x,y,z = Ints('x y z') and a string like s='x + y + 2*z = 5', is there a quick way to convert s into a z3 expression ? If it's not possible then it seems I have to do lots of string operations to do the conversion.
Vu Nguyen
  • 987
  • 1
  • 9
  • 20
8
votes
2 answers

a datatype contains a set in Z3

how can I make a datatype that contains a set of another objects. Basically, I am doing the following code: (define-sort Set(T) (Array Int T)) (declare-datatypes () ((A f1 (cons (value Int) (b (Set B)))) (B f2 (cons (id Int) (a (Set A)))) …
user1197891
  • 265
  • 1
  • 12