3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-23 06:13:40 +00:00

prepare user propagator declared functions for likely Clemens use case

This commit is contained in:
Nikolaj Bjorner 2021-12-16 19:36:18 -08:00
parent a288f9048a
commit 6cc9aa3562
8 changed files with 120 additions and 15 deletions

View file

@ -23,8 +23,33 @@ namespace user_propagator {
typedef std::function<void*(void*, ast_manager&, context_obj*&)> fresh_eh_t;
typedef std::function<void(void*)> push_eh_t;
typedef std::function<void(void*,unsigned)> pop_eh_t;
typedef std::function<void(void*, callback*, expr*, unsigned)> register_created_eh_t;
class plugin : public decl_plugin {
public:
enum kind_t { OP_USER_PROPAGATE };
virtual ~plugin() {}
virtual decl_plugin* mk_fresh() { return alloc(plugin); }
family_id get_family_id() const { return m_family_id; }
sort* mk_sort(decl_kind k, unsigned num_parameters, parameter const* parameters) override {
UNREACHABLE();
return nullptr;
}
func_decl* mk_func_decl(decl_kind k, unsigned num_parameters, parameter const* parameters,
unsigned arity, sort* const* domain, sort* range) {
UNREACHABLE();
return nullptr;
}
};
class core {
public:
@ -58,8 +83,25 @@ namespace user_propagator {
throw default_exception("user-propagators are only supported on the SMT solver");
}
/**
* Create uninterpreted function for the user propagator.
* When expressions using the function are assigned values, generate a callback
* into a register_declared_eh(user_ctx, solver_ctx, declared_expr, declare_id) with arguments
* 1. context and callback context
* 2. declared_expr: expression using function that was declared at top.
* 3. declared_id: a unique identifier (unique within the current scope) to track the expression.
*/
virtual func_decl* user_propagate_declare(symbol const& name, unsigned n, sort* const* domain, sort* range) {
throw default_exception("user-propagators are only supported on the SMT solver");
}
virtual void user_propagate_register_created(register_created_eh_t& r) {
throw default_exception("user-propagators are only supported on the SMT solver");
}
virtual void user_propagate_clear() {
}
};