I am trying to use the function Z3_benchmark_to_smtlib_string(). Here are the arguments I am using:
Z3_benchmark_to_smtlib_string(
ctx, /* this one is valid */
"test", /* this one is random, I don't understand it */
"QF_UFBV", /* I got this name from the smtlib website, valid ? */
"sat", /* not sure about this one either */
NULL, /* not sure about this one either */
nb_assumptions, /* should be ok */
assumptions, /* should be ok too */
NULL); /* not sure about this one, is this mandatory ? */
Any help would be welcome.
In parallel, I am using displaying my assumptions on the fly, using:
Z3_set_ast_print_mode(ctx,Z3_PRINT_SMTLIB2_COMPLIANT);
en get strange characters like : ?x21, ?x24, ?x37, (see below). Any hint to solve this issue ?
Thanks in advance,
A.G.
(let ((?x21 (bvand (_ bv582 32) (ite (= ((_ sign_extend 24) (_ bv98 8)) ((_ sign_extend 24) |Mem5[8]|)) (_ bv64 32) (_ bv0 32))))) (let ((?x24 (bvand ?x21 (ite (bvsgt ((_ sign_extend 24) (_ bv98 8)) ((_ sign_extend 24) |Mem5[8]|)) (_ bv128 32) (_ bv0 32))))) (let ((?x37 (bvand ?x24 (ite (= ((_ sign_extend 24) (_ bv97 8)) ((_ sign_extend 24) |Mem6[8]|)) (_ bv64 32) (_ bv0 32))))) (bvand ?x37 (ite (bvsgt ((_ sign_extend 24) (_ bv97 8)) ((_ sign_extend 24) |Mem6[8]|)) (_ bv128 32) (_ bv0 32))))))
This function is quite old. It was created when SMT 2.0 didn't exist. A SMT 1.0 benchmark looks like that:
The function you are using was meant for producing a benchmark in this format. That is why we have parameters such as
name
,logic
,status
, etc. They correspond to the annotations in the example above. Moreover, a SMT 1.0 problem consists of 0 or more assumptions and 1 formula.When SMT 2.0 was introduced, this method was extended to print benchmarks in SMT 2.0 format when we have
The strange characters are just auxiliary
let
declarations used to avoid an exponential blowup when printing formulas. Note that, Z3 ASTs are DAGs and not trees. It is very easy to create a DAG using the C API that has a lot of sharing. Example:The AST
a_100
is a very compact object in memory. If we try to print it as a tree without using the auxiliarylet
declarations, the output will be very huge.Note that the output produced by this function was never meant to be consumed by humans. It is mainly used to generate benchmarks for the SMT-LIB repository.