mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 08:28:44 +00:00
added API to monitor clause inferences
See RELEASE_NOTES for more information examples pending.
This commit is contained in:
parent
77cbd89420
commit
07dd1065db
34 changed files with 505 additions and 122 deletions
|
@ -907,6 +907,33 @@ extern "C" {
|
|||
~api_context_obj() override { dealloc(c); }
|
||||
};
|
||||
|
||||
struct scoped_ast_vector {
|
||||
Z3_ast_vector_ref* v;
|
||||
scoped_ast_vector(Z3_ast_vector_ref* v): v(v) { v->inc_ref(); }
|
||||
~scoped_ast_vector() { v->dec_ref(); }
|
||||
};
|
||||
|
||||
void Z3_API Z3_solver_register_on_clause(
|
||||
Z3_context c,
|
||||
Z3_solver s,
|
||||
void* user_context,
|
||||
Z3_on_clause_eh on_clause_eh) {
|
||||
Z3_TRY;
|
||||
RESET_ERROR_CODE();
|
||||
init_solver(c, s);
|
||||
user_propagator::on_clause_eh_t _on_clause = [=](void* user_ctx, expr* proof, unsigned n, expr* const* _literals) {
|
||||
Z3_ast_vector_ref * literals = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
|
||||
mk_c(c)->save_object(literals);
|
||||
expr_ref pr(proof, mk_c(c)->m());
|
||||
scoped_ast_vector _sc(literals);
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
literals->m_ast_vector.push_back(_literals[i]);
|
||||
on_clause_eh(user_ctx, of_expr(pr.get()), of_ast_vector(literals));
|
||||
};
|
||||
to_solver_ref(s)->register_on_clause(user_context, _on_clause);
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
void Z3_API Z3_solver_propagate_init(
|
||||
Z3_context c,
|
||||
Z3_solver s,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue