Suppose I read the SMTLIB formula using the API:
context ctx;
...
expr F = to_expr(ctx, Z3_parse_smtlib2_file(ctx,argv[1],0,0,0,0,0,0));
The expression F
is a conjunction of assertions of the form:
(and (< (+ x y) 3)
(> (- x1 x2) 0)
(< (- x1 x2) 4)
(not (= (- x1 x2) 1))
(not (= (- x1 x2) 2))
(not (= (- x1 x2) 3)))
I'd like to extract each individual assertion from this conjunction using the following code fragment from post: How to use z3 split clauses of unsat cores & try to find out unsat core again
F = F.simplify();
for (unsigned i = 0; i < F.num_args(); i++) {
expr Ai = F.arg(i);
// ... Do something with Ai, just printing in this example.
std::cout << Ai << "\n";
}
After utilizing the F.arg(i)
, the original clause (< (+ x y) 3)
has been changed into (not (<= 3 (+ x y)))
. Here is my
a) question : How can I place the clause (not (<= 3 (+ x y)))
to (< (+ x y) 3)
?
b) question : I consider the symbol <=
mean to imply in this case, not mean to less than. Am I right?
c) question : Because the clause (not (<= 3 (+ x y)))
model is true or false, how can I get arithmetic values such as x = 1, y = -1
?
It's very grateful for any suggestion. Thank you very much.