Z3

How to use Z3 SMT-LIB to prove theorems for the group D3

十年热恋 提交于 2019-12-11 18:09:27
问题 The table of products for the group D3 is : Using the following Z3 SMT-LIB code is possible to obtain a representation: (set-option :mbqi true) (declare-sort S) (declare-fun f (S S) S) (declare-fun g (S) S) (declare-const E S) (declare-const R1 S) (declare-const R2 S) (declare-const R3 S) (declare-const R4 S) (declare-const R5 S) (assert (forall ((x S)) (= (f x E) x))) (assert (forall ((x S)) (= (f E x) x))) (assert (= (f R1 R1) R2)) (assert (= (f R1 R2) E)) (assert (= (f R1 R3) R4)) (assert

Why is MkSimpleSolver not equivalent to MkSolver(“smt”) with Z3?

荒凉一梦 提交于 2019-12-11 17:47:38
问题 I'm experimenting with Z3 tactics. I noticed that the solver returned by context.MkSimpleSolver() has a different performance profile than the solver context.MkSolver(context.MkTactic("smt")) I understand that the "smt" tactic is supposed to perform the most general algorithm that Z3 has. So both these solvers should have identical output. Given this, why do they have different performance profiles? I am testing this on a formula that is quantified over a bitvector. The quantifier body makes

Get the corresponding python variable name of a Z3 model name

徘徊边缘 提交于 2019-12-11 17:23:15
问题 Is there a way to get the corresponding python variable name of a z3 model name? Suppose I have the following code: from z3 import * s = Solver() a = [Real('a_%s' % k) for k in range(10)] for i in range(10): s.add(a[i] > 10) s.check() m = s.model() for d in m: print(d, m[d]) Here the d in m are a_0, a_1, a_2,..., a_9 , and all of their values are 11 . I'm trying to set up some constraints which make the variables don't equal to the previous checking result, like the following: s.add(a[0] != m

old vs new version of Z3

时光总嘲笑我的痴心妄想 提交于 2019-12-11 14:58:38
问题 I have an instance which could be very efficiently solved by old version of Z3(version 2.18). It return SAT in a few seconds. However, when I try it on the current version of Z3(version 4.3.1). It does not return any result after 10 minutes. Here are some details about the experiment. Could anybody give some advice? there are 4000 Bool variables and 200 Int variables all the constraint are in propositional logic with comparison between integers like a < b platform: open suse linux 12.3

Include Z3 in a C++ project

◇◆丶佛笑我妖孽 提交于 2019-12-11 13:52:28
问题 I want to use Z3 in a llvm project(file directory copied from its sample project). What I did now is just simply include z3++.h without adding any other code in the source file and want to pass the compilation. But I don't know how to deal with modifying makefile to make it work. I tried a few times it reports error like "exception handling disabled, use -fexceptions to enable" and other linking errors. Can someone give me a hint on how to change the makefile to make it work? 回答1: It's not

(Sub)optimal way to get a legit range info when using a SMT constraint with Z3

拈花ヽ惹草 提交于 2019-12-11 13:34:47
问题 This question is related to my previous question Is it possible to get a legit range info when using a SMT constraint with Z3 So it seems that "efficiently" finding the maximum range info is not proper, given typical 32-bit vectors and so on. But on the other hand, I am thinking whether it is feasible to find certain "sub-maximum" range info, which hopefully becomes more efficient. Another thing is that we may want to have certain "safe" guarantee, say for all elements in the sub-maximum

SMT: check uniqueness and totality of function

孤街浪徒 提交于 2019-12-11 12:45:38
问题 Given is a function and a description of its behavior: add: (ℤ ∪ {Error, None})² → (ℤ ∪ {Error, None}) For x ∈ (ℤ ∪ {Error, None}): add(x, None) = add(None, x) = None For x ∈ (ℤ ∪ {Error}): add(x, Error) = add(Error, x) = Error For x, y ∈ ℤ: add(x, y) = x + y How can I transform this description to SMT (I'm using Z3) and check whether the description defines a total function? To give you an idea what I want to achieve: in the end I want to generate Python code implementing this function with

Z3 SMT 2.0 vs Z3 py implementation

旧巷老猫 提交于 2019-12-11 12:08:25
问题 I'm trying to encode an arithmetic for positive reals with a constant infinity in Z3. I successfully obtained the result in SMT2 with the following pair encoding (declare-datatypes (T1 T2) ((Pair (mk-pair (first T1) (second T2))))) (declare-const infty (Pair Bool Real)) (assert (= infty (mk-pair true 0.))) (define-fun inf-sum ((p1 (Pair Bool Real)) (p2 (Pair Bool Real))) (Pair Bool Real) ( ite (first p1) p1 (ite (first p2) p2 (mk-pair false (+ (second p1) (second p2))) ) ) ) where a pair

Z3 API: Is inspection of AST possible

蓝咒 提交于 2019-12-11 11:14:46
问题 There is no direct way in Z3 to traverse an already existing Z3_ast for an expression, that much seems clear to me from the API. Is there however an indirect way how to, e.g., split a conjunction, substitute a term for a term in a Z3_ast obtained for example by Z3_parse_smtlib2_string or as an interpolant obtained with Z3_get_interpolant (these are output from Z3, so it makes sense to be able to examine them). 回答1: Traversal is possible, in the C API the functions for that are Z3_get_app_num

Z3 String/Char xor?

跟風遠走 提交于 2019-12-11 11:12:33
问题 I'm working with Z3 in Python and am trying to figure out how to do String operations. In general, I've played around with z3.String as the object, doing things like str1 + str2 == 'hello world' . However, I have been unable to accomplish the following behavior: solver.add(str1[1] ^ str1[2] == 12) # -- or -- solver.add(str1[1] ^ str1[2] == str2[1]) So basically add the constraint that character 1 xor character 2 equals 12. My understanding is that the string is defined as a sequence of 8-bit