Z3
 
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Protected Attributes
UserPropagateBase Class Reference

Public Member Functions

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

Data Fields

 solver
 
 fresh_ctx
 
 cb
 
 id
 
 fixed
 
 final
 
 eq
 
 diseq
 
 decide
 
 created
 
 binding
 

Protected Attributes

 _ctx
 

Detailed Description

Definition at line 12455 of file z3py.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  s,
  ctx = None 
)

Definition at line 12464 of file z3py.py.

12464 def __init__(self, s, ctx=None):
12465 assert s is None or ctx is None
12466 ensure_prop_closures()
12467 self.solver = s
12468 self._ctx = None
12469 self.fresh_ctx = None
12470 self.cb = None
12471 self.id = _prop_closures.insert(self)
12472 self.fixed = None
12473 self.final = None
12474 self.eq = None
12475 self.diseq = None
12476 self.decide = None
12477 self.created = None
12478 self.binding = None
12479 if ctx:
12480 self.fresh_ctx = ctx
12481 if s:
12482 Z3_solver_propagate_init(self.ctx_ref(),
12483 s.solver,
12484 ctypes.c_void_p(self.id),
12485 _user_prop_push,
12486 _user_prop_pop,
12487 _user_prop_fresh)
12488
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-propagator with the solver.

◆ __del__()

__del__ (   self)

Definition at line 12489 of file z3py.py.

12489 def __del__(self):
12490 if self._ctx:
12491 self._ctx.ctx = None
12492

Member Function Documentation

◆ add()

add (   self,
  e 
)

Definition at line 12574 of file z3py.py.

12574 def add(self, e):
12575 if self._ctx:
12576 raise Z3Exception("context already initialized")
12577 if self.solver:
12578 Z3_solver_propagate_register(self.ctx_ref(), self.solver.solver, e.ast)
12579 else:
12580 Z3_solver_propagate_register_cb(self.ctx_ref(), ctypes.c_void_p(self.cb), e.ast)
12581
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__().

◆ add_created()

add_created (   self,
  created 
)

Definition at line 12511 of file z3py.py.

12511 def add_created(self, created):
12512 if self.created:
12513 raise Z3Exception("created callback already registered")
12514 if self._ctx:
12515 raise Z3Exception("context already initialized")
12516 if self.solver:
12517 Z3_solver_propagate_created(self.ctx_ref(), self.solver.solver, _user_prop_created)
12518 self.created = created
12519
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()

add_decide (   self,
  decide 
)

Definition at line 12547 of file z3py.py.

12547 def add_decide(self, decide):
12548 if self.decide:
12549 raise Z3Exception("decide callback already registered")
12550 if self._ctx:
12551 raise Z3Exception("context already initialized")
12552 if self.solver:
12553 Z3_solver_propagate_decide(self.ctx_ref(), self.solver.solver, _user_prop_decide)
12554 self.decide = decide
12555
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 cha...

◆ add_diseq()

add_diseq (   self,
  diseq 
)

Definition at line 12538 of file z3py.py.

12538 def add_diseq(self, diseq):
12539 if self.diseq:
12540 raise Z3Exception("diseq callback already registered")
12541 if self._ctx:
12542 raise Z3Exception("context already initialized")
12543 if self.solver:
12544 Z3_solver_propagate_diseq(self.ctx_ref(), self.solver.solver, _user_prop_diseq)
12545 self.diseq = diseq
12546
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()

add_eq (   self,
  eq 
)

Definition at line 12529 of file z3py.py.

12529 def add_eq(self, eq):
12530 if self.eq:
12531 raise Z3Exception("eq callback already registered")
12532 if self._ctx:
12533 raise Z3Exception("context already initialized")
12534 if self.solver:
12535 Z3_solver_propagate_eq(self.ctx_ref(), self.solver.solver, _user_prop_eq)
12536 self.eq = eq
12537
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()

add_final (   self,
  final 
)

Definition at line 12520 of file z3py.py.

12520 def add_final(self, final):
12521 if self.final:
12522 raise Z3Exception("final callback already registered")
12523 if self._ctx:
12524 raise Z3Exception("context already initialized")
12525 if self.solver:
12526 Z3_solver_propagate_final(self.ctx_ref(), self.solver.solver, _user_prop_final)
12527 self.final = final
12528
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()

add_fixed (   self,
  fixed 
)

Definition at line 12502 of file z3py.py.

12502 def add_fixed(self, fixed):
12503 if self.fixed:
12504 raise Z3Exception("fixed callback already registered")
12505 if self._ctx:
12506 raise Z3Exception("context already initialized")
12507 if self.solver:
12508 Z3_solver_propagate_fixed(self.ctx_ref(), self.solver.solver, _user_prop_fixed)
12509 self.fixed = fixed
12510
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 ...

◆ add_on_binding()

add_on_binding (   self,
  binding 
)

Definition at line 12556 of file z3py.py.

12556 def add_on_binding(self, binding):
12557 if self.binding:
12558 raise Z3Exception("binding callback already registered")
12559 if self._ctx:
12560 raise Z3Exception("context already initialized")
12561 if self.solver:
12562 Z3_solver_propagate_on_binding(self.ctx_ref(), self.solver.solver, _user_prop_binding)
12563 self.binding = binding
12564
void Z3_API Z3_solver_propagate_on_binding(Z3_context c, Z3_solver s, Z3_on_binding_eh on_binding_eh)
register a callback when the solver instantiates a quantifier. If the callback returns false,...

◆ conflict()

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

Definition at line 12601 of file z3py.py.

12601 def conflict(self, deps = [], eqs = []):
12602 self.propagate(BoolVal(False, self.ctx()), deps, eqs)

◆ ctx()

ctx (   self)

Definition at line 12493 of file z3py.py.

12493 def ctx(self):
12494 if self.fresh_ctx:
12495 return self.fresh_ctx
12496 else:
12497 return self.solver.ctx
12498

Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), AstMap.__contains__(), AstRef.__copy__(), Goal.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), ModelRef.__copy__(), AstRef.__deepcopy__(), Datatype.__deepcopy__(), ParamsRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), Goal.__deepcopy__(), AstVector.__deepcopy__(), AstMap.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), ModelRef.__deepcopy__(), Statistics.__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__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), AstVector.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), AstMap.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), AstVector.__len__(), AstMap.__len__(), ModelRef.__len__(), Statistics.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BoolRef.__mul__(), ArithRef.__mul__(), BitVecRef.__mul__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), ParamsRef.__repr__(), ParamDescrsRef.__repr__(), AstMap.__repr__(), Statistics.__repr__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), AstVector.__setitem__(), AstMap.__setitem__(), ArithRef.__sub__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), ExprRef.arg(), FuncEntry.arg_value(), FuncInterp.arity(), Goal.as_expr(), Solver.assert_and_track(), Goal.assert_exprs(), Solver.assert_exprs(), QuantifierRef.body(), FiniteSetSortRef.cast(), Solver.check(), Goal.convert_model(), AstRef.ctx_ref(), ExprRef.decl(), ModelRef.decls(), ArrayRef.default(), RatNumRef.denominator(), Goal.depth(), Goal.dimacs(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FuncInterp.else_value(), FuncInterp.entry(), AstMap.erase(), ModelRef.eval(), Goal.get(), ParamDescrsRef.get_documentation(), ModelRef.get_interp(), Statistics.get_key_value(), ParamDescrsRef.get_kind(), ParamDescrsRef.get_name(), ModelRef.get_sort(), ModelRef.get_universe(), Goal.inconsistent(), AstMap.keys(), Statistics.keys(), Solver.model(), SortRef.name(), QuantifierRef.no_pattern(), FuncEntry.num_args(), FuncInterp.num_entries(), Solver.num_scopes(), ModelRef.num_sorts(), FuncDeclRef.params(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), Solver.pop(), Goal.prec(), ModelRef.project(), ModelRef.project_with_witness(), Solver.push(), AstVector.push(), QuantifierRef.qid(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), Context.ref(), AstMap.reset(), Solver.reset(), AstVector.resize(), Solver.set(), ParamsRef.set(), Goal.sexpr(), AstVector.sexpr(), ModelRef.sexpr(), ParamDescrsRef.size(), Goal.size(), QuantifierRef.skolem_id(), AstVector.translate(), AstRef.translate(), Goal.translate(), ModelRef.translate(), ExprRef.update(), DatatypeRef.update_field(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().

◆ ctx_ref()

ctx_ref (   self)

Definition at line 12499 of file z3py.py.

12499 def ctx_ref(self):
12500 return self.ctx().ref()
12501

Referenced by BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), ArithRef.__div__(), BitVecRef.__div__(), SortRef.__eq__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__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(), ExprRef.arg(), FuncDeclRef.arity(), IntNumRef.as_binary_string(), BitVecNumRef.as_binary_string(), RatNumRef.as_decimal(), AlgebraicNumRef.as_decimal(), IntNumRef.as_string(), RatNumRef.as_string(), BitVecNumRef.as_string(), QuantifierRef.body(), ExprRef.decl(), ArrayRef.default(), RatNumRef.denominator(), FuncDeclRef.domain(), ArraySortRef.domain_n(), AstRef.eq(), AstRef.get_id(), SortRef.get_id(), FuncDeclRef.get_id(), ExprRef.get_id(), PatternRef.get_id(), QuantifierRef.get_id(), AstRef.hash(), AlgebraicNumRef.index(), QuantifierRef.is_exists(), QuantifierRef.is_lambda(), FuncDeclRef.kind(), SortRef.name(), QuantifierRef.no_pattern(), ExprRef.num_args(), QuantifierRef.num_no_patterns(), QuantifierRef.num_patterns(), QuantifierRef.num_vars(), FuncDeclRef.params(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), RatNumRef.py_value(), QuantifierRef.qid(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), AstRef.sexpr(), QuantifierRef.skolem_id(), ExprRef.update(), DatatypeRef.update_field(), QuantifierRef.var_name(), QuantifierRef.var_sort(), and QuantifierRef.weight().

◆ fresh()

fresh (   self,
  new_ctx 
)

Definition at line 12571 of file z3py.py.

12571 def fresh(self, new_ctx):
12572 raise Z3Exception("fresh needs to be overwritten")
12573

◆ next_split()

next_split (   self,
  t,
  idx,
  phase 
)

Definition at line 12587 of file z3py.py.

12587 def next_split(self, t, idx, phase):
12588 return Z3_solver_next_split(self.ctx_ref(), ctypes.c_void_p(self.cb), t.ast, idx, phase)
12589
bool Z3_API Z3_solver_next_split(Z3_context c, Z3_solver_callback cb, Z3_ast t, unsigned idx, Z3_lbool phase)

◆ pop()

pop (   self,
  num_scopes 
)

Definition at line 12568 of file z3py.py.

12568 def pop(self, num_scopes):
12569 raise Z3Exception("pop needs to be overwritten")
12570

Referenced by Solver.__exit__().

◆ propagate()

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

Definition at line 12593 of file z3py.py.

12593 def propagate(self, e, ids, eqs=[]):
12594 _ids, num_fixed = _to_ast_array(ids)
12595 num_eqs = len(eqs)
12596 _lhs, _num_lhs = _to_ast_array([x for x, y in eqs])
12597 _rhs, _num_rhs = _to_ast_array([y for x, y in eqs])
12598 return Z3_solver_propagate_consequence(e.ctx.ref(), ctypes.c_void_p(
12599 self.cb), num_fixed, _ids, num_eqs, _lhs, _rhs, e.ast)
12600
bool 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 and equalities. A client may invoke it during the pro...

◆ push()

push (   self)

Definition at line 12565 of file z3py.py.

12565 def push(self):
12566 raise Z3Exception("push needs to be overwritten")
12567

Referenced by Solver.__enter__().

Field Documentation

◆ _ctx

_ctx
protected

Definition at line 12468 of file z3py.py.

◆ binding

binding

Definition at line 12478 of file z3py.py.

◆ cb

cb

Definition at line 12470 of file z3py.py.

◆ created

created

Definition at line 12477 of file z3py.py.

◆ decide

decide

Definition at line 12476 of file z3py.py.

◆ diseq

diseq

Definition at line 12475 of file z3py.py.

◆ eq

eq

Definition at line 12474 of file z3py.py.

Referenced by AstRef.__eq__(), SortRef.cast(), and FiniteSetSortRef.cast().

◆ final

final

Definition at line 12473 of file z3py.py.

◆ fixed

fixed

Definition at line 12472 of file z3py.py.

◆ fresh_ctx

fresh_ctx

Definition at line 12469 of file z3py.py.

◆ id

id

Definition at line 12471 of file z3py.py.

◆ solver

solver