Z3 Model Incorrect -



Z3 Model Incorrect -

i hacking away @ problem of finding hamiltonian cycle in undirected graph. recent experiment produced should have been impossible model. here input:

;number of vertices = 4 ;5 edges: ;e1 = 0 1 ;e2 = 1 2 ;e3 = 2 3 ;e4 = 3 0 ;e5 = 1 3 (declare-const v0 bool) (declare-const v1 bool) (declare-const v2 bool) (declare-const v3 bool) (declare-const e1 bool) (declare-const e2 bool) (declare-const e3 bool) (declare-const e4 bool) (declare-const e5 bool) (assert (xor (and e2 e3 e4 e5) (and e1 e3 e4 e5) (and e1 e2 e4 e5) (and e1 e2 e3 e5) (and e1 e2 e3 e4))) (assert (and v0 v1 v2 v3)) ;(assert (=> (and e2 e3 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e3 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e4 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e3 e5) (and v0 v1 v2 v3))) ;(assert (=> (and e1 e2 e3 e4) (and v0 v1 v2 v3))) (assert (=> e1 (or e2 e4 e5))) (assert (=> e2 (or e1 e3 e5))) (assert (=> e3 (or e2 e4 e5))) (assert (=> e4 (or e1 e3 e5))) (assert (=> e5 (or e1 e2 e4))) (assert (and (=> e1 e2) (=> e2 e3) (=> e3 e4) (=> e4 e1))) (check-sat) (get-model)

here output showing of e1, e2, e3, e4, , e5 true despite xor statement in input prohibits this:

sat (model (define-fun e2 () bool true) (define-fun e5 () bool true) (define-fun e3 () bool true) (define-fun e4 () bool true) (define-fun e1 () bool true) (define-fun v3 () bool true) (define-fun v2 () bool true) (define-fun v1 () bool true) (define-fun v0 () bool true) )

does have opinions on what's going wrong here?

regards.

i don't know you're trying do, seems misused xor.

since (simplify (xor true true true true true)) returns true, encoding doesn't prohibit current model.

in general, guarantee a1, a2 , a3 has 1 true, follows:

(assert (or a1 a2 a3)) ; @ to the lowest degree 1 true (assert (and (=> a1 (and (not a2) (not a3))) (=> a2 (and (not a1) (not a3))) (=> a3 (and (not a1) (not a2))))); @ 1 true

z3

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -