Z3
Public Member Functions | Data Fields
UserPropagateBase Class Reference

Public Member Functions

def __init__ (self, s, ctx=None)
 
def __del__ (self)
 
def ctx (self)
 
def ctx_ref (self)
 
def add_fixed (self, fixed)
 
def add_created (self, created)
 
def add_final (self, final)
 
def add_eq (self, eq)
 
def add_diseq (self, diseq)
 
def add_decide (self, decide)
 
def push (self)
 
def pop (self, num_scopes)
 
def fresh (self, new_ctx)
 
def add (self, e)
 
def next_split (self, t, idx, phase)
 
def propagate (self, e, ids, eqs=[])
 
def conflict (self, deps=[], eqs=[])
 

Data Fields

 solver
 
 fresh_ctx
 
 cb
 
 id
 
 fixed
 
 final
 
 eq
 
 diseq
 
 created
 
 decide
 

Detailed Description

Definition at line 11524 of file z3py.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  s,
  ctx = None 
)

Definition at line 11533 of file z3py.py.

11533  def __init__(self, s, ctx=None):
11534  assert s is None or ctx is None
11536  self.solver = s
11537  self._ctx = None
11538  self.fresh_ctx = None
11539  self.cb = None
11540  self.id = _prop_closures.insert(self)
11541  self.fixed = None
11542  self.final = None
11543  self.eq = None
11544  self.diseq = None
11545  self.created = None
11546  if ctx:
11547  self.fresh_ctx = ctx
11548  if s:
11549  Z3_solver_propagate_init(self.ctx_ref(),
11550  s.solver,
11551  ctypes.c_void_p(self.id),
11552  _user_prop_push,
11553  _user_prop_pop,
11554  _user_prop_fresh)
11555 
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.
def ensure_prop_closures()
Definition: z3py.py:11408

◆ __del__()

def __del__ (   self)

Definition at line 11556 of file z3py.py.

11556  def __del__(self):
11557  if self._ctx:
11558  self._ctx.ctx = None
11559 

Member Function Documentation

◆ add()

def add (   self,
  e 
)

Definition at line 11620 of file z3py.py.

11620  def add(self, e):
11621  assert not self._ctx
11622  if self.solver:
11623  Z3_solver_propagate_register(self.ctx_ref(), self.solver.solver, e.ast)
11624  else:
11625  Z3_solver_propagate_register_cb(self.ctx_ref(), ctypes.c_void_p(self.cb), e.ast)
11626 
void Z3_API Z3_solver_propagate_register_cb(Z3_context c, Z3_solver_callback cb, Z3_ast e)
register an expression to propagate on with the solver. Only expressions of type Bool and type Bit-Ve...
void 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__().

◆ add_created()

def add_created (   self,
  created 
)

Definition at line 11576 of file z3py.py.

11576  def add_created(self, created):
11577  assert not self.created
11578  assert not self._ctx
11579  if self.solver:
11580  Z3_solver_propagate_created(self.ctx_ref(), self.solver.solver, _user_prop_created)
11581  self.created = created
11582 
void Z3_API Z3_solver_propagate_created(Z3_context c, Z3_solver s, Z3_created_eh created_eh)
register a callback when a new expression with a registered function is used by the solver The regist...

◆ add_decide()

def add_decide (   self,
  decide 
)

Definition at line 11604 of file z3py.py.

11604  def add_decide(self, decide):
11605  assert not self.decide
11606  assert not self._ctx
11607  if self.solver:
11608  Z3_solver_propagate_decide(self.ctx_ref(), self.solver.solver, _user_prop_decide)
11609  self.decide = decide
11610 
void Z3_API Z3_solver_propagate_decide(Z3_context c, Z3_solver s, Z3_decide_eh decide_eh)
register a callback when the solver decides to split on a registered expression. The callback may set...

◆ add_diseq()

def add_diseq (   self,
  diseq 
)

Definition at line 11597 of file z3py.py.

11597  def add_diseq(self, diseq):
11598  assert not self.diseq
11599  assert not self._ctx
11600  if self.solver:
11601  Z3_solver_propagate_diseq(self.ctx_ref(), self.solver.solver, _user_prop_diseq)
11602  self.diseq = diseq
11603 
void Z3_API Z3_solver_propagate_diseq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression dis-equalities.

◆ add_eq()

def add_eq (   self,
  eq 
)

Definition at line 11590 of file z3py.py.

11590  def add_eq(self, eq):
11591  assert not self.eq
11592  assert not self._ctx
11593  if self.solver:
11594  Z3_solver_propagate_eq(self.ctx_ref(), self.solver.solver, _user_prop_eq)
11595  self.eq = eq
11596 
void Z3_API Z3_solver_propagate_eq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression equalities.

◆ add_final()

def add_final (   self,
  final 
)

Definition at line 11583 of file z3py.py.

11583  def add_final(self, final):
11584  assert not self.final
11585  assert not self._ctx
11586  if self.solver:
11587  Z3_solver_propagate_final(self.ctx_ref(), self.solver.solver, _user_prop_final)
11588  self.final = final
11589 
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...

◆ add_fixed()

def add_fixed (   self,
  fixed 
)

Definition at line 11569 of file z3py.py.

11569  def add_fixed(self, fixed):
11570  assert not self.fixed
11571  assert not self._ctx
11572  if self.solver:
11573  Z3_solver_propagate_fixed(self.ctx_ref(), self.solver.solver, _user_prop_fixed)
11574  self.fixed = fixed
11575 
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 ...

◆ conflict()

def conflict (   self,
  deps = [],
  eqs = [] 
)

Definition at line 11646 of file z3py.py.

11646  def conflict(self, deps = [], eqs = []):
11647  self.propagate(BoolVal(False, self.ctx()), deps, eqs)
def BoolVal(val, ctx=None)
Definition: z3py.py:1709

◆ ctx()

def ctx (   self)

Definition at line 11560 of file z3py.py.

11560  def ctx(self):
11561  if self.fresh_ctx:
11562  return self.fresh_ctx
11563  else:
11564  return self.solver.ctx
11565 

Referenced by ArithRef.__add__(), BitVecRef.__add__(), FPRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), Probe.__call__(), AstMap.__contains__(), AstRef.__copy__(), Goal.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), ModelRef.__copy__(), Solver.__copy__(), AstRef.__deepcopy__(), Datatype.__deepcopy__(), ParamsRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), Goal.__deepcopy__(), AstVector.__deepcopy__(), AstMap.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), ModelRef.__deepcopy__(), Statistics.__deepcopy__(), Solver.__deepcopy__(), Fixedpoint.__deepcopy__(), Optimize.__deepcopy__(), ApplyResult.__deepcopy__(), Tactic.__deepcopy__(), Probe.__deepcopy__(), Context.__del__(), AstRef.__del__(), ScopedConstructor.__del__(), ScopedConstructorList.__del__(), ParamsRef.__del__(), ParamDescrsRef.__del__(), Goal.__del__(), AstVector.__del__(), AstMap.__del__(), FuncEntry.__del__(), FuncInterp.__del__(), ModelRef.__del__(), Statistics.__del__(), Solver.__del__(), Fixedpoint.__del__(), Optimize.__del__(), ApplyResult.__del__(), Tactic.__del__(), Probe.__del__(), ParserContext.__del__(), ArithRef.__div__(), BitVecRef.__div__(), FPRef.__div__(), ExprRef.__eq__(), Probe.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), Probe.__ge__(), FPRef.__ge__(), SeqRef.__ge__(), AstVector.__getitem__(), SeqRef.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), ApplyResult.__getitem__(), AstMap.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), Probe.__gt__(), FPRef.__gt__(), SeqRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), Probe.__le__(), FPRef.__le__(), SeqRef.__le__(), CharRef.__le__(), AstVector.__len__(), AstMap.__len__(), ModelRef.__len__(), Statistics.__len__(), ApplyResult.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), Probe.__lt__(), FPRef.__lt__(), SeqRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BoolRef.__mul__(), ArithRef.__mul__(), BitVecRef.__mul__(), FPRef.__mul__(), ExprRef.__ne__(), Probe.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), FPRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), FPRef.__rdiv__(), ParamsRef.__repr__(), ParamDescrsRef.__repr__(), AstMap.__repr__(), Statistics.__repr__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), FPRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), FPRef.__rsub__(), BitVecRef.__rxor__(), AstVector.__setitem__(), AstMap.__setitem__(), ArithRef.__sub__(), BitVecRef.__sub__(), FPRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), Fixedpoint.add_cover(), ParserContext.add_decl(), Fixedpoint.add_rule(), Optimize.add_soft(), ParserContext.add_sort(), Tactic.apply(), AlgebraicNumRef.approx(), ExprRef.arg(), FuncEntry.arg_value(), FuncInterp.arity(), Goal.as_expr(), ApplyResult.as_expr(), FPNumRef.as_string(), Solver.assert_and_track(), Optimize.assert_and_track(), Goal.assert_exprs(), Solver.assert_exprs(), Fixedpoint.assert_exprs(), Optimize.assert_exprs(), Solver.assertions(), Optimize.assertions(), SeqRef.at(), SeqSortRef.basis(), ReSortRef.basis(), QuantifierRef.body(), BoolSortRef.cast(), Solver.check(), Optimize.check(), UserPropagateBase.conflict(), Solver.consequences(), DatatypeSortRef.constructor(), Goal.convert_model(), AstRef.ctx_ref(), UserPropagateBase.ctx_ref(), ExprRef.decl(), ModelRef.decls(), ArrayRef.default(), RatNumRef.denominator(), Goal.depth(), Goal.dimacs(), Solver.dimacs(), ArraySortRef.domain(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FuncInterp.else_value(), FuncInterp.entry(), AstMap.erase(), ModelRef.eval(), FPNumRef.exponent(), FPNumRef.exponent_as_bv(), FPNumRef.exponent_as_long(), Solver.from_file(), Optimize.from_file(), Solver.from_string(), Optimize.from_string(), ParserContext.from_string(), Goal.get(), Fixedpoint.get_answer(), Fixedpoint.get_assertions(), Fixedpoint.get_cover_delta(), ParamDescrsRef.get_documentation(), Fixedpoint.get_ground_sat_answer(), ModelRef.get_interp(), Statistics.get_key_value(), ParamDescrsRef.get_kind(), ParamDescrsRef.get_name(), Fixedpoint.get_num_levels(), Fixedpoint.get_rule_names_along_trace(), Fixedpoint.get_rules(), Fixedpoint.get_rules_along_trace(), ModelRef.get_sort(), ModelRef.get_universe(), Solver.help(), Fixedpoint.help(), Optimize.help(), Tactic.help(), Solver.import_model_converter(), Goal.inconsistent(), CharRef.is_digit(), FPNumRef.isInf(), FPNumRef.isNaN(), FPNumRef.isNegative(), FPNumRef.isNormal(), FPNumRef.isPositive(), FPNumRef.isSubnormal(), FPNumRef.isZero(), AstMap.keys(), Statistics.keys(), SortRef.kind(), Optimize.maximize(), Optimize.minimize(), Solver.model(), Optimize.model(), SortRef.name(), FuncDeclRef.name(), Solver.next(), QuantifierRef.no_pattern(), Solver.non_units(), FuncEntry.num_args(), FuncInterp.num_entries(), Solver.num_scopes(), ModelRef.num_sorts(), RatNumRef.numerator(), Optimize.objectives(), Solver.param_descrs(), Fixedpoint.param_descrs(), Optimize.param_descrs(), Tactic.param_descrs(), FuncDeclRef.params(), Fixedpoint.parse_file(), Fixedpoint.parse_string(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), Optimize.pop(), Solver.pop(), Goal.prec(), Solver.proof(), Solver.push(), Optimize.push(), AstVector.push(), Fixedpoint.query(), Fixedpoint.query_from_lvl(), FuncDeclRef.range(), ArraySortRef.range(), Solver.reason_unknown(), Fixedpoint.reason_unknown(), Optimize.reason_unknown(), DatatypeSortRef.recognizer(), Context.ref(), Fixedpoint.register_relation(), AstMap.reset(), Solver.reset(), AstVector.resize(), Solver.root(), Solver.set(), Fixedpoint.set(), Optimize.set(), ParamsRef.set(), Optimize.set_on_model(), Fixedpoint.set_predicate_representation(), Goal.sexpr(), AstVector.sexpr(), ModelRef.sexpr(), Solver.sexpr(), Fixedpoint.sexpr(), Optimize.sexpr(), ApplyResult.sexpr(), FPNumRef.sign(), FPNumRef.sign_as_bv(), FPNumRef.significand(), FPNumRef.significand_as_bv(), FPNumRef.significand_as_long(), ParamDescrsRef.size(), Goal.size(), Tactic.solver(), ExprRef.sort(), BoolRef.sort(), QuantifierRef.sort(), ArithRef.sort(), BitVecRef.sort(), ArrayRef.sort(), DatatypeRef.sort(), FiniteDomainRef.sort(), FPRef.sort(), SeqRef.sort(), Solver.statistics(), Fixedpoint.statistics(), Optimize.statistics(), CharRef.to_bv(), CharRef.to_int(), Solver.to_smt2(), Fixedpoint.to_string(), Solver.trail(), Solver.trail_levels(), AstVector.translate(), FuncInterp.translate(), AstRef.translate(), Goal.translate(), ModelRef.translate(), Solver.translate(), Solver.units(), Solver.unsat_core(), Optimize.unsat_core(), Fixedpoint.update_rule(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().

◆ ctx_ref()

def ctx_ref (   self)

Definition at line 11566 of file z3py.py.

11566  def ctx_ref(self):
11567  return self.ctx().ref()
11568 

Referenced by BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), ArithRef.__div__(), BitVecRef.__div__(), SortRef.__eq__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), SeqRef.__ge__(), SeqRef.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), SeqRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), SeqRef.__le__(), CharRef.__le__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), SeqRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BitVecRef.__mul__(), SortRef.__ne__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), UserPropagateBase.add(), UserPropagateBase.add_created(), UserPropagateBase.add_decide(), UserPropagateBase.add_diseq(), UserPropagateBase.add_eq(), UserPropagateBase.add_final(), UserPropagateBase.add_fixed(), AlgebraicNumRef.approx(), ExprRef.arg(), FuncDeclRef.arity(), SortRef.as_ast(), FuncDeclRef.as_ast(), PatternRef.as_ast(), IntNumRef.as_binary_string(), BitVecNumRef.as_binary_string(), RatNumRef.as_decimal(), AlgebraicNumRef.as_decimal(), IntNumRef.as_string(), RatNumRef.as_string(), BitVecNumRef.as_string(), FiniteDomainRef.as_string(), FiniteDomainNumRef.as_string(), FPRef.as_string(), FPRMRef.as_string(), SeqRef.as_string(), SeqRef.at(), SeqSortRef.basis(), ReSortRef.basis(), QuantifierRef.body(), DatatypeSortRef.constructor(), ExprRef.decl(), ArrayRef.default(), RatNumRef.denominator(), ArraySortRef.domain(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FPSortRef.ebits(), AstRef.eq(), AstRef.get_id(), SortRef.get_id(), FuncDeclRef.get_id(), ExprRef.get_id(), PatternRef.get_id(), QuantifierRef.get_id(), AstRef.hash(), AlgebraicNumRef.index(), CharRef.is_digit(), QuantifierRef.is_exists(), QuantifierRef.is_forall(), QuantifierRef.is_lambda(), SeqSortRef.is_string(), SeqRef.is_string(), SeqRef.is_string_value(), FuncDeclRef.kind(), SortRef.name(), FuncDeclRef.name(), UserPropagateBase.next_split(), QuantifierRef.no_pattern(), ExprRef.num_args(), DatatypeSortRef.num_constructors(), QuantifierRef.num_no_patterns(), QuantifierRef.num_patterns(), QuantifierRef.num_vars(), RatNumRef.numerator(), FuncDeclRef.params(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), FPSortRef.sbits(), AstRef.sexpr(), BitVecSortRef.size(), FiniteDomainSortRef.size(), BoolRef.sort(), ArithRef.sort(), BitVecRef.sort(), ArrayRef.sort(), DatatypeRef.sort(), FiniteDomainRef.sort(), FPRef.sort(), SeqRef.sort(), CharRef.to_bv(), CharRef.to_int(), QuantifierRef.var_name(), QuantifierRef.var_sort(), and QuantifierRef.weight().

◆ fresh()

def fresh (   self,
  new_ctx 
)

Definition at line 11617 of file z3py.py.

11617  def fresh(self, new_ctx):
11618  raise Z3Exception("fresh needs to be overwritten")
11619 

◆ next_split()

def next_split (   self,
  t,
  idx,
  phase 
)

Definition at line 11632 of file z3py.py.

11632  def next_split(self, t, idx, phase):
11633  Z3_solver_next_split(self.ctx_ref(), ctypes.c_void_p(self.cb), t.ast, idx, phase)
11634 
void Z3_API Z3_solver_next_split(Z3_context c, Z3_solver_callback cb, Z3_ast t, unsigned idx, Z3_lbool phase)

◆ pop()

def pop (   self,
  num_scopes 
)

Definition at line 11614 of file z3py.py.

11614  def pop(self, num_scopes):
11615  raise Z3Exception("pop needs to be overwritten")
11616 

◆ propagate()

def propagate (   self,
  e,
  ids,
  eqs = [] 
)

Definition at line 11638 of file z3py.py.

11638  def propagate(self, e, ids, eqs=[]):
11639  _ids, num_fixed = _to_ast_array(ids)
11640  num_eqs = len(eqs)
11641  _lhs, _num_lhs = _to_ast_array([x for x, y in eqs])
11642  _rhs, _num_rhs = _to_ast_array([y for x, y in eqs])
11643  Z3_solver_propagate_consequence(e.ctx.ref(), ctypes.c_void_p(
11644  self.cb), num_fixed, _ids, num_eqs, _lhs, _rhs, e.ast)
11645 
void Z3_API Z3_solver_propagate_consequence(Z3_context c, Z3_solver_callback cb, unsigned num_fixed, Z3_ast const *fixed, unsigned num_eqs, Z3_ast const *eq_lhs, Z3_ast const *eq_rhs, Z3_ast conseq)
propagate a consequence based on fixed values. This is a callback a client may invoke during the fixe...

Referenced by UserPropagateBase.conflict().

◆ push()

def push (   self)

Definition at line 11611 of file z3py.py.

11611  def push(self):
11612  raise Z3Exception("push needs to be overwritten")
11613 

Field Documentation

◆ cb

cb

◆ created

created

Definition at line 11545 of file z3py.py.

Referenced by UserPropagateBase.add_created().

◆ decide

decide

Definition at line 11609 of file z3py.py.

Referenced by UserPropagateBase.add_decide().

◆ diseq

diseq

Definition at line 11544 of file z3py.py.

Referenced by UserPropagateBase.add_diseq().

◆ eq

eq

Definition at line 11543 of file z3py.py.

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

◆ final

final

Definition at line 11542 of file z3py.py.

Referenced by UserPropagateBase.add_final().

◆ fixed

fixed

Definition at line 11541 of file z3py.py.

Referenced by UserPropagateBase.add_fixed().

◆ fresh_ctx

fresh_ctx

Definition at line 11538 of file z3py.py.

Referenced by UserPropagateBase.ctx().

◆ id

id

Definition at line 11540 of file z3py.py.

◆ solver

solver