Z3

How to estimate time spent in SAT solving part in z3 for SMT?

▼魔方 西西 提交于 2019-12-23 15:19:52
问题 I have profiled my problems, which are in (pseudo-nonlinear) integer real fragment using the profiler gprof (stats here including the call graph) and was trying to separate out the time taken into two classes: I)The SAT solving part (including [purely] boolean propagation and [purely] boolean conflict clause detection, backjumping, any other propositional manipulation) II)The theory solving part (including theory consistency checks, generation of theory conflict-clauses and theory propagation

Why does a query result changes if comment an intermediate `(check-sat)` call?

人走茶凉 提交于 2019-12-23 13:35:30
问题 While debugging UNSAT query I noticed an interesting difference in the query status. The query structure is: assert(...) (push) ; commenting any of these two calls (check-sat) ; makes the whole query UNSAT, otherwise it is SAT assert(...) (check-sat) ; SAT or UNSAT depending on existence of previous call (exit) There are no pop calls in the query. The query that triggers this behaviour is here. Ideas why? Note: I don't actually need incrementality, it is for debugging purposes only. Z3

Z3 Java API defining a function

折月煮酒 提交于 2019-12-23 12:38:41
问题 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 Real)) Real (ite (<= x y) y x)) (assert (and (>= a 0.0) (<= a 100.0))) (assert (or (= (max2 (+ 100.0 (* (- 1.0) a)) (/ 1.0 1000.0)) 0.0) c (not (= b 0.0)))) (check-sat-using (then simplify bit-blast qfnra)) (get-model) The result of this smt-file is:

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

最后都变了- 提交于 2019-12-23 12:27:10
问题 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 two semantically identical SMT specifications Spec1 and Spec2, Z3 times out (200 sec) for proving Spec1 but proves Spec2. The only different between Spec1 and Spec2 is that they have different function identifiers (because I use java hash names).

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

懵懂的女人 提交于 2019-12-23 12:17:30
问题 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) (= y x))))))) (check-sat) I expected the result to be sat , with at least a model where PZ is the powerset of Z (integers) and MS is a predicate which tests the membership of an integer into a subset of Z (an element of the sort PZ ). But z3 answered unsat . Could you help me

How to use Z3py and Sympy together

馋奶兔 提交于 2019-12-23 10:53:15
问题 I am trying to perform some symbolic calculation on matrices (with symbols as an entries of matrices), and after that I will have a number of possible solution. My goal is to select solutions/ solution based upon constraints. for example, M is a matrix which have one element as a symbol . This matrix will have 2 eigenvalues one is positive an one is negative. Using z3 I am trying to find out only negative value, but I am unable to do so as a is defined as a symbol and I cannot write it as a

(Z3Py) declaring function

雨燕双飞 提交于 2019-12-23 10:28:12
问题 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 = [(1,55), (12,34), (13,300)] s.add (f(x)==(x*t+c)) s.add (f(1)==55, f(12)==34, f(13)==300) t=s.check() if t==sat: print s.model() else: print t ... but the result is obviously wrong. I probably need to find out how to map function arguments. How should I

How to get a list of all available configuration settings for a Z3 context?

血红的双手。 提交于 2019-12-23 09:36:34
问题 The .net API has the following constructor for a Context: Context (Dictionary< string, string > settings) how to get a list of all the possible settings? Specifically, I am interested in how to ask Z3 to produce an unsat core, ie the equivalent of the SMT lib produce-unsat-cores. 回答1: You make a good point. The parameters that you can send to the .NET API are not described together with the .NET code. However, they are calling the C-based API and the comments for the C-based API (https:/

Why this code returns Unsat (formula using ForAll & Implies)?

☆樱花仙子☆ 提交于 2019-12-23 05:29:19
问题 Given 2 equations c == a + 4 and t == c + b , if a == -4 , then t == b . I am trying to do the opposite, meaning given the above 2 equations, and t == b , I try to find value of a . I have below code to do this with ForAll and Implies : from z3 import * a, b, c, t = BitVecs('a b c t', 32) g = True g = And(g, c == (a + 4)) g = And(g, t == (c + b)) s = Solver() s.add(ForAll([c, t, b], Implies(g, t == b))) if s.check() == sat: print s.model()[a] else: print 'Unsat' However, running the above

Does Z3 take a longer time to give an unsat result compared to a sat result?

泄露秘密 提交于 2019-12-23 05:29:05
问题 From my experiences, in case of larger models, I found that Z3 takes a very longer time to give an unsat result compared to the sat cases. Even sometimes Z3 is running an infinite time without giving no answer. In the following I give an example of such cases. [Though I used .NET API for formalization, I am writing here the equivalent SMT-LIB 2 code.] (declare-fun VCapacity (Int) Int) (declare-fun VChargeInit (Int) Int) (declare-fun VChargeEnd (Int) Int) (declare-fun VStartAt (Int) Int)