Z3
Data Structures | Public Member Functions
user_propagator_base Class Referenceabstract

Public Member Functions

 user_propagator_base (Z3_context c)
 
 user_propagator_base (solver *s)
 
virtual void push ()=0
 
virtual void pop (unsigned num_scopes)=0
 
virtual ~user_propagator_base ()=default
 
virtual user_propagator_basefresh (Z3_context ctx)=0
 user_propagators created using fresh() are created during search and their lifetimes are restricted to search time. They should be garbage collected by the propagator used to invoke fresh(). The life-time of the Z3_context object can only be assumed valid during callbacks, such as fixed(), which contains expressions based on the context. More...
 
void register_fixed (fixed_eh_t &f)
 register callbacks. Callbacks can only be registered with user_propagators that were created using a solver. More...
 
void register_fixed ()
 
void register_eq (eq_eh_t &f)
 
void register_eq ()
 
void register_final (final_eh_t &f)
 register a callback on final-check. During the final check stage, all propagations have been processed. This is an opportunity for the user-propagator to delay some analysis that could be expensive to perform incrementally. It is also an opportunity for the propagator to implement branch and bound optimization. More...
 
void register_final ()
 
virtual void fixed (unsigned, expr const &)
 
virtual void eq (unsigned, unsigned)
 
virtual void final ()
 
unsigned add (expr const &e)
 tracks e by a unique identifier that is returned by the call. More...
 
void conflict (unsigned num_fixed, unsigned const *fixed)
 
void propagate (unsigned num_fixed, unsigned const *fixed, expr const &conseq)
 
void propagate (unsigned num_fixed, unsigned const *fixed, unsigned num_eqs, unsigned const *lhs, unsigned const *rhs, expr const &conseq)
 

Detailed Description

Definition at line 3875 of file z3++.h.

Constructor & Destructor Documentation

user_propagator_base ( Z3_context  c)
inline

Definition at line 3934 of file z3++.h.

3934 : s(nullptr), c(c) {}
user_propagator_base ( solver s)
inline

Definition at line 3936 of file z3++.h.

3936  : s(s), c(nullptr) {
3937  Z3_solver_propagate_init(ctx(), *s, this, push_eh, pop_eh, fresh_eh);
3938  }
void Z3_API Z3_solver_propagate_init(Z3_context c, Z3_solver s, void *user_context, Z3_push_eh push_eh, Z3_pop_eh pop_eh, Z3_fresh_eh fresh_eh)
register a user-properator with the solver.
virtual ~user_propagator_base ( )
virtualdefault

Member Function Documentation

unsigned add ( expr const &  e)
inline

tracks e by a unique identifier that is returned by the call.

If the fixed() callback is registered and if e is a Boolean or Bit-vector, the fixed() callback gets invoked when e is bound to a value. If the eq() callback is registered, then equalities between registered expressions are reported. A consumer can use the propagate or conflict functions to invoke propagations or conflicts as a consequence of these callbacks. These functions take a list of identifiers for registered expressions that have been fixed. The list of identifiers must correspond to already fixed values. Similarly, a list of propagated equalities can be supplied. These must correspond to equalities that have been registered during a callback.

Definition at line 4032 of file z3++.h.

4032  {
4033  assert(s);
4034  return Z3_solver_propagate_register(ctx(), *s, e);
4035  }
unsigned Z3_API Z3_solver_propagate_register(Z3_context c, Z3_solver s, Z3_ast e)
register an expression to propagate on with the solver. Only expressions of type Bool and type Bit-Ve...
void conflict ( unsigned  num_fixed,
unsigned const *  fixed 
)
inline

Definition at line 4037 of file z3++.h.

4037  {
4038  assert(cb);
4039  scoped_context _ctx(ctx());
4040  expr conseq = _ctx().bool_val(false);
4041  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, 0, nullptr, nullptr, conseq);
4042  }
void Z3_API Z3_solver_propagate_consequence(Z3_context c, Z3_solver_callback, unsigned num_fixed, unsigned const *fixed_ids, unsigned num_eqs, unsigned const *eq_lhs, unsigned const *eq_rhs, Z3_ast conseq)
propagate a consequence based on fixed values. This is a callback a client may invoke during the fixe...
virtual void fixed(unsigned, expr const &)
Definition: z3++.h:4012
virtual void eq ( unsigned  ,
unsigned   
)
inlinevirtual

Definition at line 4014 of file z3++.h.

Referenced by user_propagator_base::register_eq().

4014 { }
virtual void final ( )
inlinevirtual

Definition at line 4016 of file z3++.h.

4016 { }
virtual void fixed ( unsigned  ,
expr const &   
)
inlinevirtual

Definition at line 4012 of file z3++.h.

Referenced by user_propagator_base::register_fixed().

4012 { }
virtual user_propagator_base* fresh ( Z3_context  ctx)
pure virtual

user_propagators created using fresh() are created during search and their lifetimes are restricted to search time. They should be garbage collected by the propagator used to invoke fresh(). The life-time of the Z3_context object can only be assumed valid during callbacks, such as fixed(), which contains expressions based on the context.

virtual void pop ( unsigned  num_scopes)
pure virtual
void propagate ( unsigned  num_fixed,
unsigned const *  fixed,
expr const &  conseq 
)
inline

Definition at line 4044 of file z3++.h.

4044  {
4045  assert(cb);
4046  assert(conseq.ctx() == ctx());
4047  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, 0, nullptr, nullptr, conseq);
4048  }
void Z3_API Z3_solver_propagate_consequence(Z3_context c, Z3_solver_callback, unsigned num_fixed, unsigned const *fixed_ids, unsigned num_eqs, unsigned const *eq_lhs, unsigned const *eq_rhs, Z3_ast conseq)
propagate a consequence based on fixed values. This is a callback a client may invoke during the fixe...
virtual void fixed(unsigned, expr const &)
Definition: z3++.h:4012
void propagate ( unsigned  num_fixed,
unsigned const *  fixed,
unsigned  num_eqs,
unsigned const *  lhs,
unsigned const *  rhs,
expr const &  conseq 
)
inline

Definition at line 4050 of file z3++.h.

4052  {
4053  assert(cb);
4054  assert(conseq.ctx() == ctx());
4055  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, num_eqs, lhs, rhs, conseq);
4056  }
void Z3_API Z3_solver_propagate_consequence(Z3_context c, Z3_solver_callback, unsigned num_fixed, unsigned const *fixed_ids, unsigned num_eqs, unsigned const *eq_lhs, unsigned const *eq_rhs, Z3_ast conseq)
propagate a consequence based on fixed values. This is a callback a client may invoke during the fixe...
virtual void fixed(unsigned, expr const &)
Definition: z3++.h:4012
virtual void push ( )
pure virtual
void register_eq ( eq_eh_t &  f)
inline

Definition at line 3975 of file z3++.h.

3975  {
3976  assert(s);
3977  m_eq_eh = f;
3978  Z3_solver_propagate_eq(ctx(), *s, eq_eh);
3979  }
void Z3_API Z3_solver_propagate_eq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression equalities.
void register_eq ( )
inline

Definition at line 3981 of file z3++.h.

3981  {
3982  assert(s);
3983  m_eq_eh = [this](unsigned x, unsigned y) {
3984  eq(x, y);
3985  };
3986  Z3_solver_propagate_eq(ctx(), *s, eq_eh);
3987  }
virtual void eq(unsigned, unsigned)
Definition: z3++.h:4014
void Z3_API Z3_solver_propagate_eq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression equalities.
void register_final ( final_eh_t &  f)
inline

register a callback on final-check. During the final check stage, all propagations have been processed. This is an opportunity for the user-propagator to delay some analysis that could be expensive to perform incrementally. It is also an opportunity for the propagator to implement branch and bound optimization.

Definition at line 3997 of file z3++.h.

3997  {
3998  assert(s);
3999  m_final_eh = f;
4000  Z3_solver_propagate_final(ctx(), *s, final_eh);
4001  }
void Z3_API Z3_solver_propagate_final(Z3_context c, Z3_solver s, Z3_final_eh final_eh)
register a callback on final check. This provides freedom to the propagator to delay actions or imple...
void register_final ( )
inline

Definition at line 4003 of file z3++.h.

4003  {
4004  assert(s);
4005  m_final_eh = [this]() {
4006  final();
4007  };
4008  Z3_solver_propagate_final(ctx(), *s, final_eh);
4009  }
void Z3_API Z3_solver_propagate_final(Z3_context c, Z3_solver s, Z3_final_eh final_eh)
register a callback on final check. This provides freedom to the propagator to delay actions or imple...
void register_fixed ( fixed_eh_t &  f)
inline

register callbacks. Callbacks can only be registered with user_propagators that were created using a solver.

Definition at line 3961 of file z3++.h.

3961  {
3962  assert(s);
3963  m_fixed_eh = f;
3964  Z3_solver_propagate_fixed(ctx(), *s, fixed_eh);
3965  }
void Z3_API Z3_solver_propagate_fixed(Z3_context c, Z3_solver s, Z3_fixed_eh fixed_eh)
register a callback for when an expression is bound to a fixed value. The supported expression types ...
void register_fixed ( )
inline

Definition at line 3967 of file z3++.h.

3967  {
3968  assert(s);
3969  m_fixed_eh = [this](unsigned id, expr const& e) {
3970  fixed(id, e);
3971  };
3972  Z3_solver_propagate_fixed(ctx(), *s, fixed_eh);
3973  }
void Z3_API Z3_solver_propagate_fixed(Z3_context c, Z3_solver s, Z3_fixed_eh fixed_eh)
register a callback for when an expression is bound to a fixed value. The supported expression types ...
virtual void fixed(unsigned, expr const &)
Definition: z3++.h:4012