Z3
Data Structures | Public Member Functions
user_propagator_base Class Referenceabstract

Public Member Functions

 user_propagator_base (solver *s)
 
 user_propagator_base (Z3_context c)
 
virtual void push ()=0
 
virtual void pop (unsigned num_scopes)=0
 
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 fixed (fixed_eh_t &f)
 register callbacks. Callbacks can only be registered with user_propagators that were created using a solver. More...
 
void eq (eq_eh_t &f)
 
void 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...
 
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 3596 of file z3++.h.

Constructor & Destructor Documentation

◆ user_propagator_base() [1/2]

user_propagator_base ( solver s)
inline

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

3655 : s(s), c(nullptr) {}

◆ user_propagator_base() [2/2]

user_propagator_base ( Z3_context  c)
inline

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

3656 : s(nullptr), c(c) {}

Member Function Documentation

◆ add()

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 3717 of file z3++.h.

3717  {
3718  assert(s);
3719  return Z3_solver_propagate_register(ctx(), *s, e);
3720  }
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...

Referenced by Solver::__iadd__(), Fixedpoint::__iadd__(), and Optimize::__iadd__().

◆ conflict()

void conflict ( unsigned  num_fixed,
unsigned const *  fixed 
)
inline

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

3722  {
3723  assert(cb);
3724  scoped_context _ctx(ctx());
3725  expr conseq = _ctx().bool_val(false);
3726  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, 0, nullptr, nullptr, conseq);
3727  }
void fixed(fixed_eh_t &f)
register callbacks. Callbacks can only be registered with user_propagators that were created using a ...
Definition: z3++.h:3677
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...

◆ eq()

void eq ( eq_eh_t &  f)
inline

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

3683  {
3684  assert(s);
3685  m_eq_eh = f;
3686  Z3_solver_propagate_eq(ctx(), *s, eq_eh);
3687  }
void Z3_API Z3_solver_propagate_eq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression equalities.

Referenced by AstRef::__eq__(), UserPropagateBase::add_eq(), SortRef::cast(), and BoolSortRef::cast().

◆ final()

void 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 3697 of file z3++.h.

3697  {
3698  assert(s);
3699  m_final_eh = f;
3700  Z3_solver_propagate_final(ctx(), *s, final_eh);
3701  }
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...

Referenced by UserPropagateBase::add_final().

◆ fixed()

void 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 3677 of file z3++.h.

3677  {
3678  assert(s);
3679  m_fixed_eh = f;
3680  Z3_solver_propagate_fixed(ctx(), *s, fixed_eh);
3681  }
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 ...

Referenced by UserPropagateBase::add_fixed(), user_propagator_base::conflict(), and user_propagator_base::propagate().

◆ fresh()

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.

◆ pop()

virtual void pop ( unsigned  num_scopes)
pure virtual

◆ propagate() [1/2]

void propagate ( unsigned  num_fixed,
unsigned const *  fixed,
expr const &  conseq 
)
inline

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

3729  {
3730  assert(cb);
3731  assert(conseq.ctx() == ctx());
3732  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, 0, nullptr, nullptr, conseq);
3733  }

Referenced by UserPropagateBase::conflict().

◆ propagate() [2/2]

void propagate ( unsigned  num_fixed,
unsigned const *  fixed,
unsigned  num_eqs,
unsigned const *  lhs,
unsigned const *  rhs,
expr const &  conseq 
)
inline

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

3737  {
3738  assert(cb);
3739  assert(conseq.ctx() == ctx());
3740  Z3_solver_propagate_consequence(ctx(), cb, num_fixed, fixed, num_eqs, lhs, rhs, conseq);
3741  }

Referenced by UserPropagateBase::conflict().

◆ push()

virtual void push ( )
pure virtual