Z3

Z3 Context serialization/deserialization?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 07:37:08
问题 Is it possible to serialize/deserialize a Z3 context (from C#)? If not, is this feature planned ? I think this feature is important for real world applications. 回答1: This is not directly supported in the current API. The next release will support multiple solvers, and we will provide commands for copying the assertions from one solver to another, and retrieving the assertions. With these commands, one can implement serialization by dumping the expressions in a file (in SMT 2.0 format). To

Z3Py: Generating Abstract Formulas From A System Of Equations

喜欢而已 提交于 2019-12-11 07:32:40
问题 My Example: system of equations Pseudo-Code Constraint Base a = b+c ∧ e = a*c ∧ a = +2 ; some replaceable concrete values ∧ c = +18 Solution b = -16 ∧ e = -32 The Information I Want In a system of equations, I want to get the following knowledge: Abstract formulas which I can use to compute the variable values (the solution) from the given values (in the constraint base). (Like in high school where the teacher don't just wanted the see the result, but also such an transformated abstract

Is it possible to find optimal solution for a boolean formula by SMT solvers?

耗尽温柔 提交于 2019-12-11 07:32:20
问题 I have a big boolean formula to solve, due to the reason of the redaction, I have to paste an image here: Also, I have already a function area to measure the dimension of 4 integers: area(c,d,e,f)=|c−d|×|e−f| I would like to do more than just figuring out if the formula is satisfiable: I am looking for an optimal 6-tuple (a,b,c,d,e,f) which makes the big formula TRUE and area(c,d,e,f) is greater or equal to the dimension of any other 6-tuple which also satisfies the formula. In other word,

Z3 BitVec extraction using symbolic high and low

断了今生、忘了曾经 提交于 2019-12-11 07:02:21
问题 I've been playing around with proving certain SIMD vectorizations using Z3 and I'm running into a problem trying to model SIMD operations that conditionally move around bits or lanes (such as Intel _mm_shuffle_epi8 for example) The problem occurs when I try to use symbolic high and low with Extract which does not seem supported: assert a.sort() == BitVecSort(128) assert b.sort() == BitVecSort(128) Extract( Extract(i+3,i,b)*8+7, Extract(i+3,i,b)*8, a) results in z3.z3types.Z3Exception:

Wrapping entities from Z3 C API

时光总嘲笑我的痴心妄想 提交于 2019-12-11 06:33:06
问题 I'm experimenting with enumeration sorts in Z3 as described in How to use enumerated constants after calling of some tactic in Z3? and I noticed that I might have some misunderstanding on how to use C and C++ api properly. Let's consider the following example. context z3_cont; Z3_symbol e_names[2 ]; Z3_func_decl e_consts[2]; Z3_func_decl e_testers[2]; e_names[0] = Z3_mk_string_symbol(z3_cont, "x1"); e_names[1] = Z3_mk_string_symbol(z3_cont, "x2"); Z3_symbol e_name = Z3_mk_string_symbol(z3

Z3: timeout for optimize in C++

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 06:25:30
问题 I'm trying to understand how to set a timeout for the optimize class of Z3 using C++ API. This i my code: context c; optimize opt(c); z3::params par(c); par.set("timeout", 1000); opt.set(par); But I get "unknown parameter 'timeout'" exception on the line opt.set(par). Is it possible to set the timeout for the optimize class (after the timeout, I would like to obtain the best solution found)? Thank you! 回答1: I know this is an old question, but if anyone's still looking for an answer, you need:

Dafny function, invalid logical expression on while loop

孤街浪徒 提交于 2019-12-11 06:05:33
问题 I am new in Dafny and getting some errors that I can not figure it out. in my Dafny program for insertionSort (the code is here), I do not understand why I get an invalid logical expression on While loop over variable i . while (i < |input|) in the same code at the swapping part ( input[j := b]; input[j-1 := a]; ) also I get expected method call, found expression . According to the tutorial input[j:=b] is replacing index j of seq input with the value of b 回答1: The first error is because you

How to declare constants to use as bound variables in Z3_mk_forall_const?

岁酱吖の 提交于 2019-12-11 05:55:36
问题 Suppose I want to universally quantify x and y in the following formula: f(x,y) <=> x=y using Z3_mk_forall_const . I will have to first construct the formula above, which requires constants x and y of type Z3_ast . Using Z3_mk_const to create x and y results in a global declaration. I would ideally like to avoid that. Is there an alternative? 回答1: Yes there is an alternative; you can use Z3_mk_forall which uses de-Brujin variable indexes. Instead of constants, you can create indexed variables

Is there any function readily available for calculating logarithm to the base 2 in Z3/cvc4?

吃可爱长大的小学妹 提交于 2019-12-11 05:48:28
问题 I want to prove a simplification which involves calculating log to the base 2. Is there any function available in z3/cvc4 for calculating it? 回答1: The short answer is that support is unavailable directly for integers in either tool. For unbounded integers, decision procedures for Presburger exponentiation by a fixed constant exist. From this you can construct the logarithm function (or vice versa). I am not an expert but my understanding is that these are quite complicated. For more