3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-30 15:00:08 +00:00

adding validation code to doc/udoc

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-09-23 17:10:00 -07:00
parent 54506408f9
commit 1111c0494f
13 changed files with 328 additions and 104 deletions

View file

@ -20,6 +20,7 @@ Revision History:
#include "tbv.h"
#include "hashtable.h"
#include "ast_util.h"
static bool s_debug_alloc = false;
@ -269,3 +270,26 @@ std::ostream& tbv_manager::display(std::ostream& out, tbv const& b) const {
}
return out;
}
expr_ref tbv_manager::to_formula(ast_manager& m, tbv const& src) {
expr_ref result(m);
expr_ref_vector conj(m);
for (unsigned i = 0; i < num_tbits(); ++i) {
switch (src[i]) {
case BIT_0:
conj.push_back(m.mk_not(m.mk_const(symbol(i), m.mk_bool_sort())));
break;
case BIT_1:
conj.push_back(m.mk_const(symbol(i), m.mk_bool_sort()));
break;
default:
break;
}
}
result = mk_and(m, conj.size(), conj.c_ptr());
return result;
}
expr_ref tbv_manager::mk_var(ast_manager& m, unsigned i) {
return expr_ref(m.mk_const(symbol(i), m.mk_bool_sort()), m);
}