Skip to content

Instantly share code, notes, and snippets.

@daniel-j-h
Created June 24, 2015 15:56
Show Gist options
  • Save daniel-j-h/33d49c7f51dd74ea0cbc to your computer and use it in GitHub Desktop.
Save daniel-j-h/33d49c7f51dd74ea0cbc to your computer and use it in GitHub Desktop.
Z3 issue: toStream gives different result as toInt conversion
#include <iostream>
#include <z3++.h>
int main() {
z3::config config;
z3::context context{config};
z3::optimize optimizer{context};
auto x = context.int_const("x");
optimizer.add((x > 15) && (x < 20));
optimizer.minimize(x);
if (optimizer.check() != z3::sat)
return -1;
auto model = optimizer.get_model();
for (unsigned i = 0; i < model.num_consts(); ++i) {
z3::func_decl decl = model[i];
std::cout << model.get_const_interp(decl) << std::endl;
int x = model.get_const_interp(decl);
std::cout << x << std::endl;
}
}
// output is
//
// 16
// 1
//
// branch qsat @31643a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment