smt

Creating List in z3 using function

不想你离开。 提交于 2019-12-13 02:49:51
问题 I'm trying to convert this piece of pseudocode to SMT-LIB language, but I got stuck. List function my_fun(int x) { list = nil for(i in 1 to x): if(some_condition_on_i) list.concat(i) return list } what I've done so far is this: (declare-const l1 (List Int)) (define-fun my_fun ((x Int)) (List Int) (forall ((t Int)) (ite (and (some_condition_on_t) (< t x)) (insert t l1) l1 ) ) ) ) which I know it is wrong, and does not work. can you help me to understand how can I do this? 回答1: SMT-LIB models

Why does Z3 return unknown for this nonlinear integer arithmetic example?

时光毁灭记忆、已成空白 提交于 2019-12-13 02:37:47
问题 I have a simple example in nonlinear integer arithmetic, namely a search for Pythagorean triples. Based on what I read in related questions (see below), I'd expect Z3 to find a solution to this problem, but it returns 'unknown'. Here is the example in SMT-LIB v2: (declare-fun x () Int) (declare-fun y () Int) (declare-fun z () Int) (declare-fun xSquared () Int) (declare-fun ySquared () Int) (declare-fun zSquared () Int) (declare-fun xSquaredPlusYSquared () Int) (assert (= xSquared (* x x)))

Which techniques are used to handle Non-linear Integer Real problems in z3?

▼魔方 西西 提交于 2019-12-12 16:15:02
问题 Here are z3 statistics for a problem in the Non-Linear Integer Real Fragment (and many of my problems are similar to this): (:add-rows 11062574 :added-eqs 34 :arith-conflicts 37293 :assert-lower 837747 :assert-upper 1909779 :binary-propagations 13807730 :bound-prop 32666 :conflicts 47631 :decisions 157457 :del-clause 32828 :final-checks 39307 :gcd-tests 329820 :gomory-cuts 927 :ineq-splits 19490 :memory 39.52 :minimized-lits 93912 :mk-clause 73468 :pivots 768193 :propagations 15992318 :pseudo

Z3: Check if model is unique

旧巷老猫 提交于 2019-12-12 14:05:05
问题 Is there a way in Z3 to prove/show that a given model is unique and that no other solution exists? A small example to demonstrate (declare-const a1 Int) (declare-const a2 Int) (declare-const a3 Int) (declare-const b1 Int) (declare-const b2 Int) (declare-const b3 Int) (declare-const c1 Int) (declare-const c2 Int) (declare-const c3 Int) (declare-const ra Int) (declare-const rb Int) (declare-const rc Int) (declare-const r1 Int) (declare-const r2 Int) (declare-const r3 Int) (assert (>= a1 0))

How can I solve minimizing constraint in Z3?

不想你离开。 提交于 2019-12-12 12:38:01
问题 Could any one can tell me how I can implement minimizing integer problem like the below one by Z3py? How can I define for all statement? Here all variables are int sort. Is there any dedicated solver within Z3 is available to solve such kind of problem? If there any, then how can I set configuration for that solver? Thanks 回答1: Here are some relevant/similar questions and answers: Minimum and maximum value of variable Determine upper/lower bound for variables in an arbitrary propositional

Keep getting “unknown” result with :pattern usage in SMTLIB v2 input

蹲街弑〆低调 提交于 2019-12-12 12:09:44
问题 I'm encountering a problem when using the SMTLIBv2 input format and patterns with Z3: I keep getting the result "unknown" with the following input: (declare-datatypes () ((L L0 L1))) (declare-fun path () (List L)) (declare-fun checkTransition ((List L)) Bool) (define-fun isCons ((p (List L))) Bool (not (= p nil)) ) ; configuration options for :pattern, taken from the Z3 tutorial (set-option :auto-config false) ; disable automatic self configuration (set-option :smt.mbqi false) ; disable model

(check-sat) then (check-sat-using qfnra-nlsat)

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:37:01
问题 What I want to do: I would like to call (check-sat) , and then if the result is unknown , call (check-sat-using qfnra-nlsat) . Why do I want to do this?: For my application the Z3 default tactics applied with (check-sat) are superior to anything I have devised using (check-sat-using) . However, there are a few situations where (check-sat) returns unknown , but (check-sat-using ...) with judiciously chosen tactics finds a result. Here is an example: (declare-fun x () Real) (declare-fun y ()

Z3py SMT coding following variables and the formulas

Deadly 提交于 2019-12-12 03:35:36
问题 I am really new to Z3 and SMT solvers. I have the following problem which I don't know how to code in Z3py. In the above diagram N is set of nodes, thus N = {Node1, Node2, Node3, Node4, Node5, Node6, Node7} I is set of Inputs, I = {I 1 , I 2 , I 3 , I 4 } O is set of Outputs, O = {O 1 , O 2 , O 3 } G is a group where for any consecutive 2 outputs (O i , O j ), if O i is first output generated and O j is second output generated then, G k is set of nodes that were scheduled after the generation

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