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

How get a a value from a Lambda expression?

I'm experimenting with z3 in python. I have the following model: (set-option :produce-models true) (set-logic QF_AUFBV ) (declare-fun a () (Array (_ BitVec 32) (_ BitVec 8) ) ) (declare-fun another () (Array (_ BitVec 32) (_ BitVec 8) ) ) (assert…
Alberto
  • 446
  • 5
  • 14
5
votes
0 answers

Z3 OCaml API Recursive Function

Let's say I want to check if the formula x+y=z (x,y,z integers) is satisfiable. Using Z3 i could input something like: (declare-fun x () Int) (declare-fun y () Int) (declare-fun z () Int) (assert (= z (+ x y))) (check-sat) I could equivalently use…
sh0t
  • 51
  • 3
5
votes
2 answers

How to use z3 BitVec or Int as an array index?

I want to use a Int vector as an array index. python. array = [12,45,66,34] s= Solver() x = Int('x') s.add(array[x] == 66) so the x should be 2.. how can i do it?
pandaos
  • 51
  • 1
  • 3
5
votes
2 answers

Exactly what quantifiers is SMT complete for?

I've been looking at various SMT solvers, mainly Z3, CVC4, and VeriT. They all have vague descriptions of their ability to solve SMT problems with quantifiers. Their documentation is primarily example based (Z3), or consists of academic papers,…
jmite
  • 8,171
  • 6
  • 40
  • 81
5
votes
2 answers

SMT solver with custom theories?

I'm looking at doing some verification work where I've got regular tree grammars as an underlying theory. Z3 lets you define your own stuff with uninterpreted functions, but that doesn't tend to work well any time your decision procedures are…
jmite
  • 8,171
  • 6
  • 40
  • 81
5
votes
2 answers

Looking for practical examples of SMT Z3 usecases (like DbC) and open source alternative to Z3?

I have got interested in and looking for practical examples of SMT Z3 usage (like DbC) with code and open source alternatives to this tool. So, in fact, I am interested in similar Z3 formal solving tools, but: it must be open source provide both…
Yauhen Yakimovich
  • 13,635
  • 8
  • 60
  • 67
5
votes
1 answer

Suggestion of an efficient SAT solver with good C++ interface (or: is Z3 good for me)?

For a project I'm starting I will need to use a SAT solver. I've used some of them before but mainly for experimenting, while here the main constraint for the project is good performance. I'm trying to look for alternatives, and trying to understand…
gigabytes
  • 3,104
  • 19
  • 35
5
votes
1 answer

Why is non-linear real arithmetic decidable while non-linear integer arithmetic is not?

I understand that nonlinear integer arithmetic is basically Hilbert's tenth problem and is proven to be undecidable. However the Z3 solver is able to provide a complete solution for nonlinear real arithmetic. I was just curious what is the…
user4233211
5
votes
1 answer

LiquidHaskell: failing DeMorgan's law

I am having troubles proving the following law with LiquidHaskell: It is known as (one of) DeMorgan's law, and simply states that the negation of oring two values must be the same as anding the negation of each. It's been proven for a long time,…
Nicolas Mattia
  • 1,269
  • 11
  • 20
5
votes
1 answer

Executing a Z3 script in command line prompt

I have a very simple example Z3 program which is as follows: (declare-const a Int) (declare-fun f (Int Bool) Int) (assert (> a 10)) (assert (< (f a true) 100)) (check-sat) This sample program can be executed in the Z3 online compiler and there are…
Amir Ebrahimi
  • 115
  • 1
  • 10
5
votes
2 answers

How can I access the variable mapping used when bit-blasting?

I'm modifying a tool which uses Z3 (specifically the Python API) to solve bitvector constraints. I need to use a particular external SAT solver instead of the internal Z3 one, so I'm first bit-blasting using the tactic Then('simplify', 'bit-blast',…
Daniel
  • 55
  • 2
5
votes
2 answers

Z3 Java API defining a function

I need your help defining a function with the Z3 Java API. I try to solve something like this (which is working fine with the z3.exe process): (declare-fun a () Real) (declare-fun b () Real) (declare-fun c () Bool) (define-fun max2 ((x Real) (y…
ConcolicAndy
  • 115
  • 5
5
votes
1 answer

Using Z3 QFNRA tactic with datatypes: interaction or inlining

In Non-linear arithmetic and uninterpreted functions, Leonardo de Moura states that the qfnra-nlsat tactic hasn't been fully integrated with the rest of Z3 yet. I thought that the situation has changed in two years, but apparently the integration is…
Skiminok
  • 2,801
  • 1
  • 24
  • 29
5
votes
2 answers

Checking syntactic equivalence of two constraints efficiently in Z3

Supposed I have two constraints(c1,c2) and I want to check whether they are syntactic identical: c1: f(x)>1 && g(y)=2 c2: f(x)>1 && g(y)=2 Option 1: We could turn this into a satisfiability problem like this post: Whether two boolexpr are…
Yu Feng
  • 303
  • 2
  • 7
5
votes
7 answers

Why does 0 = 0.5?

I noticed some strange behavior with Z3 4.3.1 when working with .smt2 files. If I do (assert (= 0 0.5)) it will be satisfiable. However, if I switch the order and do (assert (= 0.5 0)) it's not satisfiable. My guess as to what is happening is that…
Stanley Bak
  • 543
  • 3
  • 16