mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 16:25:48 +00:00
add core validation option to directly validate cores using the context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
76ca64b93b
commit
db24cb8087
6 changed files with 36 additions and 1 deletions
|
@ -399,5 +399,33 @@ namespace smt {
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief validate unsat core returned by
|
||||
*/
|
||||
void context::validate_unsat_core() {
|
||||
if (!get_fparams().m_core_validate) {
|
||||
return;
|
||||
}
|
||||
context ctx(get_manager(), get_fparams(), get_params());
|
||||
ptr_vector<expr> assertions;
|
||||
get_assertions(assertions);
|
||||
unsigned sz = assertions.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
ctx.assert_expr(assertions[i]);
|
||||
}
|
||||
sz = m_unsat_core.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
ctx.assert_expr(m_unsat_core.get(i));
|
||||
}
|
||||
lbool res = ctx.check();
|
||||
switch (res) {
|
||||
case l_false:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
throw default_exception("Core could not be validated");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue