Questions tagged [z3py]

Python interface for the Z3 Theorem Prover

z3py - Python interface for the Z3 Theorem Prover. Z3 is a high-performance theorem prover. Z3 supports arithmetic, fixed-size bit-vectors, extensional arrays, datatypes, uninterpreted functions, and quantifiers.

834 questions
0
votes
1 answer

Z3py: parse_smt2_file raises Exception

I'm trying to parse an .smt2 file (which gives an answer without a problem if I just run it over z3) in my python file ctx = Context() s = Solver(ctx=ctx) f = parse_smt2_file("./Encodings/foo.smt2", ctx=ctx) s.add(f) and I get the following…
0
votes
2 answers

Formalization of Reachability in z3py

I am trying to formalize reachability property, such that I can find a satisfiable solution if there exists, a path of length 4 (which means if there are 3 intermediate nodes through which, 2 desired nodes are connected). Note: I am restricting it…
Rauf
  • 27
  • 6
0
votes
1 answer

How to get all the variables that were added to any constraint in a Solver?

I am using Z3py and trying to get the set of all the variables in any constraint in a Solver. I can call Solver.assertions() to get an ASTVector, then loop over this vector and get objects of type BoolRef, for example, but then I'm stuck. How can I…
Stanley Bak
  • 543
  • 3
  • 16
0
votes
1 answer

strange behavior when checking sat Z3

Can somebody see what I am doing wrong.... I am using the for all quantifier to create this two lines : (assert(forall((t Task)) (not (mustPrecede t t)))) (assert(forall((t1 Task)(t2 Task)(t3 Task)) (implies (and (mustPrecede t1 t2)(mustPrecede t2…
user3723800
  • 145
  • 7
0
votes
1 answer

Python - Pass variable handle to evaluate

I am writing some program using python and the z3py module. What I am trying to do is the following: I extract a constraint of an if or a while statement from a function which is located in some other file. Additionally I extract the used variables…
M0rgenstern
  • 411
  • 1
  • 6
  • 18
0
votes
1 answer

declaring algebraic data type of another algebraic data type?

I'm wondering if it's possible to create a algebraic data type that depends on another algebraic data type in Z3Py. Example, say I defined my own Bool data type and I want to define a List of Bool myself: from z3 import * Bool =…
0
votes
1 answer

Possible bug with Z3: Z3 is not able to prove a theorem in Topology

I am trying to prove with Z3 the theorem in general topology given at TPTP-Topology I am translating the code given there using the following Z3-SMT-LIB code ;; File : TOP001-2 : TPTP v6.0.0. Released v1.0.0. ;; Domain : Topology ;; Problem …
Juan Ospina
  • 1,317
  • 1
  • 7
  • 15
0
votes
0 answers

Optimization through Iteration

Hi I am trying to find the minimum value of an objective function which have some constraints, through very basic iterative process. The problem is that due to floating point issue program never terminates. I need accuracy up till 15 decimal digits…
user3196876
  • 187
  • 1
  • 12
0
votes
2 answers

Unsatisfiable formula ? maybe wrong syntax?

Formula which I wanna solve looks like this in C: #define foo(w,x,y) ((((w)*(x)*(y)+31) & ~31) / 8) WORD w,x,y,z; y = 24; if( (foo(w,x,y) * z) == -1 ) printf("yeah!"); I rewrite it to z3py in the following way: from z3 import * w=…
user3305379
  • 35
  • 1
  • 7
0
votes
1 answer

Procedural Attachment in Z3

I am using z3py I have a predicate over two integers that needs to be evaluated using a custom algorithm. I have been trying to get it implemented, without much success. Apparently, what I need is a procedural attachment, which is now deprecated.…
SPMP
  • 1,181
  • 1
  • 9
  • 24
0
votes
1 answer

Does Z3py support Linear Temporal logic LTL?

Does Z3py support Linear Temporal logic LTL? If yes, can you provide an example of simple explain.
0
votes
1 answer

z3py: assumptions from (check-sat ...) statement

Is there a way to pass assumptions from (check-sat ...) statement of SMT2 formula into the solver ? Consider the following example formula stored in ex.smt2: # cat ex.smt2 (declare-fun p () Bool) (assert (not p)) (check-sat p) Running z3 on it…
Anton Belov
  • 534
  • 4
  • 10
0
votes
1 answer

Getting the value in a range which gives the maximum of a bounded function in z3py

I have to get the value (in a range of them) that gives the maximum of a function, using z3py. For example: I have a function (foo(x,y) = 2*x + 1 + y), and I want to find the value of [x,y] (using the constraint lo <= foo(x,y) <= hi) such that…
badnack
  • 737
  • 1
  • 11
  • 20
0
votes
2 answers

Converting to "set-option" SMTLib format

I want to convert this z3py code (online code) to standard SMTLib format. Everything is converted to SMTLib format except the set options properties "(set-option :produce-models true) (set-option :timeout 4000)". Why isn't working? The conversion…
user1770051
  • 131
  • 1
  • 7
0
votes
1 answer

Cannot set pdr_use_farkas option in Z3py

When I try to set the fixedpoint engine to PDR, and I try to set the pdr_use_farkas option, I am getting an unknown_parameter error. In particular, I am using the following options on the fixedpoint…