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

(Z3Py) declaring function

I would like to find c and t coefficients in simple "result=x*t+c" formula for some given result/x pairs: from z3 import * x=Int('x') c=Int('c') t=Int('t') s=Solver() f = Function('f', IntSort(), IntSort()) # x*t+c = result # x, result =…
user313885
6
votes
1 answer

Understanding the indexing of bound variables in Z3

I am trying to understand how the bound variables are indexed in z3. Here in a snippet in z3py and the corresponding output. ( http://rise4fun.com/Z3Py/plVw1 ) x, y = Ints('x y') f1 = ForAll(x, And(x == 0, Exists(y, x == y))) f2 = ForAll(x,…
dips
  • 1,627
  • 14
  • 25
6
votes
1 answer

Triggering problems in Z3

I've recently observed several behaviours in Z3 with respect to triggering, which I don't understand. Unfortunately, the examples come from large Boogie files, so I thought I'd describe them abstractly for now, just to see if there are obvious…
Alex Summers
  • 256
  • 1
  • 8
5
votes
1 answer

Quantifier in Z3

Basically, I want to ask Z3 to give me an arbitrary integer whose value is greater than 10. So I write the following statements: (declare-const x (Int)) (assert (forall ((i Int)) (> i 10))) (check-sat) (get-value(x)) How can I apply this quantifier…
user1197891
  • 265
  • 1
  • 12
5
votes
1 answer

Can Z3 work in incremental mode?

I am using Z3 on QFBV formulas . I was wondering if Z3 can work incrementally on such formulas like SAT solvers can on boolean clauses. Basically I need a way to implement the following loop: F = initial QFBV formula while(F is unsat) { F := F…
5
votes
2 answers

Determine upper/lower bound for variables in an arbitrary propositional formula

Given an arbitrary propositional formula PHI (linear constraints on some variables), what is the best way to determine the (approximate) upper and lower bound for each variable? Some variables may be unbounded. In this case, an algorithm should…
liyistc
  • 83
  • 1
  • 5
5
votes
1 answer

Sort Mismatch in Model

I have analyzed a formula in QF_AUFLIA with z3. The result was sat. The model returned by (get-model) contained the following lines: (define-fun PCsc5_ () Int (ite (= 2 false) 23 33) According to my understanding of the SMTLIBv2 language,…
Georg
  • 283
  • 2
  • 12
5
votes
2 answers

Use Z3 and SMT-LIB to get a maximum of two values

How do I get the maximum of a formula using smt-lib2? I want something like this: (declare-fun x () Int) (declare-fun y () Int) (declare-fun z () Int) (assert (= x 2)) (assert (= y 4)) (assert (= z (max x y)) (check-sat) (get-model) (exit) Of…
John Smith
  • 771
  • 8
  • 25
5
votes
1 answer

Does Z3_ast reference counting count references outside Z3?

In Z3 there are 2 modes: automatic reference counting and manual. I understand how manual ref counting works. Thanks to example. But how does Z3 know when to delete AST node in automatic ref-counting case? Since Z3_ast is a struct from C language =>…
Ayrat
  • 1,221
  • 1
  • 18
  • 36
5
votes
2 answers

Can Z3 check the satisfiability of recursive functions on bounded data structures?

I know that Z3 cannot check the satisfiability of formulas that contain recursive functions. But, I wonder if Z3 can handle such formulas over bounded data structures. For example, I've defined a list of length at most two in my Z3 program and a…
reprogrammer
  • 14,298
  • 16
  • 57
  • 93
5
votes
1 answer

Does Z3 Support Craig Interpolation

Can Z3 generate Craig interpolants (at least for propositional logic ?). I have not found it in the documentation of Z3.
5
votes
2 answers

Solving predicate calculus problems with Z3 SMT

I'd like to use Z3 to solve problems that are most naturally expressed in terms of atoms (symbols), sets, predicates, and first order logic. For example (in pseudocode): A = {a1, a2, a3, ...} # A is a set B = {b1, b2, b3...} C = {c1, c2,…
SRobertJames
  • 8,210
  • 14
  • 60
  • 107
5
votes
1 answer

Why is Int32 sort much slower than Integer sort in this SBV/Z3 code?

In an effort to learn Z3 I tried solving one of my favorite Advent of Code problems (a particularly difficult one, 2018 day 23, part 2) using the Haskell bindings sbv. Spoilers in code ahead... module Lib ( solve ) where import…
mjgpy3
  • 8,597
  • 5
  • 30
  • 51
5
votes
2 answers

How to setup a Java development environment for Z3

How to setup a Java development environment for the Z3 SMT solver? Note: Written and answered by the author, see Can I answer my own question?.
David Soroko
  • 8,521
  • 2
  • 39
  • 51
5
votes
1 answer

What is the theory behind Z3 Optimize maximum and minimum functionality?

I am writing to inquire the theory/algorithm behind the Z3 Optimize function, especially for its maximum and minimum function. This seems pretty magic to me. Is it somehow a binary search or so? How can it efficiently figure out the max/min value…
lllllllllllll
  • 8,519
  • 9
  • 45
  • 80