Microsoft Research Community

how to support the following operations: &, %, |

rated by 0 users
This post has 2 Replies | 2 Followers

Top 500 Contributor
Posts 4
xyz031702 Posted: 09-24-2009 9:40 AM

Hi, all

     I am a beginner using Z3, which already helps me a lot.

    However I met problems when meeting operations : &(bitwise And) , %(mod) ,|(bitwise Or)

Example:

     I try to prove:

 (benchmark tst  :extrafuns ((a Real)) :formula (not (= (% a 2) 1)) :formula (> a 0))

or

 (benchmark tst  :extrafuns ((a Real)) :formula (not (= (& a 2) 1)) :formula (> a 0))

or

 (benchmark tst  :extrafuns ((a Real)) :formula (not (= (| a 2) 1)) :formula (> a 0))

 

The prover will throw exceptions saying "Error: could not find overload for '%' ".

Is there anyone knowing how to solve such problem?

Expecting for the replies and suggestions. Thanks a lot.

Ding Sun

Top 25 Contributor
Posts 41

You need to declare constants as bit-vectors and use bit-vector operation names. The names you use are not used by Z3.

The SMT-LIB syntax is not unique to Z3. More information on SMT-LIB syntax is available from www.smtlib.org

(benchmark tst  :extrafuns ((a BitVec[32]))
:formula (not (= (bvurem a bv2[32]) bv1[32]))
:formula (not (= (bvand a bv2[32]) bv1[32]))
:formula (not (= (bvor a bv2[32]) bv1[32]))
)

 

Top 500 Contributor
Posts 4

many thanks , but how to know the vector size if the variable is from user input,

or is there any mapping rules between data types and vector size? , like the following:

int a <----> BitVec[32]

long b <----> BitVec[?]

 

thanks very much and best regards

ding sun

Page 1 of 1 (3 items) | RSS
©2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Feedback