mirror of
https://github.com/Z3Prover/z3
synced 2026-01-18 16:28:56 +00:00
tune consequence finding. Factor solver pretty-printing as SMT-LIB into top-level
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cb2d8d2107
commit
491b3b34aa
15 changed files with 149 additions and 69 deletions
|
|
@ -20,6 +20,7 @@ Notes:
|
|||
#include"model_evaluator.h"
|
||||
#include"ast_util.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_pp_util.h"
|
||||
|
||||
unsigned solver::get_num_assertions() const {
|
||||
NOT_IMPLEMENTED_YET();
|
||||
|
|
@ -32,7 +33,13 @@ expr * solver::get_assertion(unsigned idx) const {
|
|||
}
|
||||
|
||||
std::ostream& solver::display(std::ostream & out) const {
|
||||
return out << "(solver)";
|
||||
expr_ref_vector fmls(get_manager());
|
||||
get_assertions(fmls);
|
||||
ast_pp_util visitor(get_manager());
|
||||
visitor.collect(fmls);
|
||||
visitor.display_decls(out);
|
||||
visitor.display_asserts(out, fmls, true);
|
||||
return out;
|
||||
}
|
||||
|
||||
void solver::get_assertions(expr_ref_vector& fmls) const {
|
||||
|
|
@ -69,6 +76,7 @@ lbool solver::get_consequences_core(expr_ref_vector const& asms, expr_ref_vector
|
|||
tmp = vars[i];
|
||||
val = eval(tmp);
|
||||
if (!m.is_value(val)) {
|
||||
// vars[i] is unfixed
|
||||
continue;
|
||||
}
|
||||
if (m.is_bool(tmp) && is_uninterp_const(tmp)) {
|
||||
|
|
@ -81,6 +89,7 @@ lbool solver::get_consequences_core(expr_ref_vector const& asms, expr_ref_vector
|
|||
lit = m.mk_not(tmp);
|
||||
}
|
||||
else {
|
||||
// vars[i] is unfixed
|
||||
continue;
|
||||
}
|
||||
scoped_assumption_push _scoped_push(asms1, nlit);
|
||||
|
|
@ -89,6 +98,7 @@ lbool solver::get_consequences_core(expr_ref_vector const& asms, expr_ref_vector
|
|||
case l_undef:
|
||||
return is_sat;
|
||||
case l_true:
|
||||
// vars[i] is unfixed
|
||||
break;
|
||||
case l_false:
|
||||
get_unsat_core(core);
|
||||
|
|
@ -114,6 +124,7 @@ lbool solver::get_consequences_core(expr_ref_vector const& asms, expr_ref_vector
|
|||
case l_undef:
|
||||
return is_sat;
|
||||
case l_true:
|
||||
// vars[i] is unfixed
|
||||
break;
|
||||
case l_false:
|
||||
get_unsat_core(core);
|
||||
|
|
@ -124,3 +135,5 @@ lbool solver::get_consequences_core(expr_ref_vector const& asms, expr_ref_vector
|
|||
}
|
||||
return l_true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue