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
2 answers

How to hide variable with Z3

Say I have t1
william007
  • 17,375
  • 25
  • 118
  • 194
5
votes
1 answer

How to convert a formula to Disjunctive Normal Form?

Say given a formula (t1>=2 or t2>=3) and (t3>=1) I wish to get its disjunctive normal form (t1>=2 and t3>=1) or (t2>=3 and t3>=1) How to achieve this in Z3?
william007
  • 17,375
  • 25
  • 118
  • 194
5
votes
1 answer

Quantifier Elimination - More questions

Many thanks Josh and Leonardo for answering the previous question. I have few more questions. <1> Consider another example. (exists k) i * k > = 4 and k > 1. This has a simple solution i > 0. (both for Int and Real case) However, when I tried…
Kaustubh Nimkar
  • 159
  • 1
  • 6
4
votes
1 answer

Does parallel version of Z3 work for BV logic?

I could not utilize both cores of the processor with parallel Z3 3.2 (from bin_mt or x64_mt directory) with PAR_NUM_THREADS=2 on Windows7. The same 50% and no time difference with single threaded version. Is parallel version supported for these…
Ayrat
  • 1,221
  • 1
  • 18
  • 36
4
votes
1 answer

Incremental calls to Z3 on UFBV with and without push calls

I am running Z3 on UFBV queries. Currently the query contains 2 calls check-sat. If I put push 1 just after check-sat, Z3 solves the query in 30sec. If I don't put any push 1 at all, thus have two calls check-sat without any push 1 between them,…
Ayrat
  • 1,221
  • 1
  • 18
  • 36
4
votes
1 answer

The "pull-nested-quantifiers" option seems to cause problems in the context for UFBV?

I am currently experimenting with Z3 as bounded engine for specifications written in Alloy (a relational logic/language). I am using the UFBV as target language. I detect a problem using the Z3 option (set-option :pull-nested-quantifiers true). For…
4
votes
1 answer

How are Int sort (of SMT-LIB 2.0 Ints theory) and dynamically declared sorts defined in z3?

Here is an SMT-LIB 2.0 benchmark which I executed with z3 : (set-logic AUFLIA) (declare-sort PZ 0) (declare-fun MS (Int PZ) Bool) (assert (forall ((x Int)) (exists ((X PZ)) (and (MS x X) (forall ((y Int)) (=> (MS y X)…
ygu
  • 345
  • 1
  • 16
4
votes
1 answer

What methods does Z3 use to solve quantifier-free bit-vector formulas (QF_BV)?

Particularly, does it use DPLL(T)? Does it use under/over approximations? Does it handle linear arithmetic on a word level? What about non-linear arithmetic? I found only a superficial mention of "simplifications similar to those in…
Ayrat
  • 1,221
  • 1
  • 18
  • 36
4
votes
1 answer

Z3: Extracting existential model-values

I'm playing around with Z3's QBVF solver, and wondering if it's possible to extract values from an existential assertion. To wit, let's say I have the following: (assert (exists ((x (_ BitVec 16))) (forall ((y (_ BitVec 16))) (bvuge y x)))) This…
4
votes
1 answer

Assign value to a bitvector (SMTLIB2, Z3)?

I am using Z3 version 3.0. I want to assign a value to a bitvector variable, like below. But Z3 reports error "invalid function application, sort mismatch on argument at position 2 in line 3". It seems wrong with my constant #x0a? how can i fix…
user311703
  • 1,113
  • 2
  • 14
  • 25
4
votes
1 answer

Can Z3 check the satisfiability of formulas that contain recursive functions?

I'm trying out some of the examples of a Z3 tutorial that involve recursive functions. I've tried out the following example. Fibonacci (Section 8.3) IsNat (Section 8.3) Inductive (Section 10.5) Z3 times out on all of the above examples. But, the…
reprogrammer
  • 14,298
  • 16
  • 57
  • 93
4
votes
1 answer

How to get median constraint with z3 solver in python

I got different vectors where I want to set constraints for different medians. Where some medians are calculated for different subsets of the vector. Eg, I want a constraint for age = IntVector('age', 10) male = BoolVector('male', 10) …
mojado
  • 370
  • 1
  • 12
4
votes
2 answers

Timeout for Z3 Optimize

How do you set a timeout for the z3 optimizer such that it will give you the best known solution when it runs out of time? from z3 import * s = Optimize() # Hard Problem print(s.check()) print(s.model()) Follow-up question, can you set z3 to…
HiDefender
  • 2,088
  • 2
  • 14
  • 31
4
votes
1 answer

Z3 giving unsat result for equation Solving

Given a set of possible values for each variable and two equations, I wrote the below code to get the exact variable values. But Z3 is giving Unsat results. I have created 7 instances and combined them to make a single one. And passed the instance…
4
votes
1 answer

Scalability of z3

I would like to improve the scalability of SMT solving. I have actually implemented the incremental solving. But I would like to improve more. Any other general methods to improve it without the knowledge of the problem itself?