Z3
 
Loading...
Searching...
No Matches
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)
 
 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 = s
 
 fresh_ctx = None
 
 cb = None
 
 id = _prop_closures.insert(self)
 
 fixed = None
 
 final = None
 
 eq = None
 
 diseq = None
 
 decide = None
 
 created = None
 

Protected Attributes

 _ctx = None
 

Detailed Description

Definition at line 11747 of file z3py.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
s,
ctx = None )

Definition at line 11756 of file z3py.py.

11756 def __init__(self, s, ctx=None):
11757 assert s is None or ctx is None
11758 ensure_prop_closures()
11759 self.solver = s
11760 self._ctx = None
11761 self.fresh_ctx = None
11762 self.cb = None
11763 self.id = _prop_closures.insert(self)
11764 self.fixed = None
11765 self.final = None
11766 self.eq = None
11767 self.diseq = None
11768 self.decide = None
11769 self.created = None
11770 if ctx:
11771 self.fresh_ctx = ctx
11772 if s:
11773 Z3_solver_propagate_init(self.ctx_ref(),
11774 s.solver,
11775 ctypes.c_void_p(self.id),
11776 _user_prop_push,
11777 _user_prop_pop,
11778 _user_prop_fresh)
11779
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 11780 of file z3py.py.

11780 def __del__(self):
11781 if self._ctx:
11782 self._ctx.ctx = None
11783

Member Function Documentation

◆ add()

add ( self,
e )

Definition at line 11844 of file z3py.py.

11844 def add(self, e):
11845 assert not self._ctx
11846 if self.solver:
11847 Z3_solver_propagate_register(self.ctx_ref(), self.solver.solver, e.ast)
11848 else:
11849 Z3_solver_propagate_register_cb(self.ctx_ref(), ctypes.c_void_p(self.cb), e.ast)
11850
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 11800 of file z3py.py.

11800 def add_created(self, created):
11801 assert not self.created
11802 assert not self._ctx
11803 if self.solver:
11804 Z3_solver_propagate_created(self.ctx_ref(), self.solver.solver, _user_prop_created)
11805 self.created = created
11806
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 11828 of file z3py.py.

11828 def add_decide(self, decide):
11829 assert not self.decide
11830 assert not self._ctx
11831 if self.solver:
11832 Z3_solver_propagate_decide(self.ctx_ref(), self.solver.solver, _user_prop_decide)
11833 self.decide = decide
11834
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 11821 of file z3py.py.

11821 def add_diseq(self, diseq):
11822 assert not self.diseq
11823 assert not self._ctx
11824 if self.solver:
11825 Z3_solver_propagate_diseq(self.ctx_ref(), self.solver.solver, _user_prop_diseq)
11826 self.diseq = diseq
11827
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 11814 of file z3py.py.

11814 def add_eq(self, eq):
11815 assert not self.eq
11816 assert not self._ctx
11817 if self.solver:
11818 Z3_solver_propagate_eq(self.ctx_ref(), self.solver.solver, _user_prop_eq)
11819 self.eq = eq
11820
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 11807 of file z3py.py.

11807 def add_final(self, final):
11808 assert not self.final
11809 assert not self._ctx
11810 if self.solver:
11811 Z3_solver_propagate_final(self.ctx_ref(), self.solver.solver, _user_prop_final)
11812 self.final = final
11813
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 11793 of file z3py.py.

11793 def add_fixed(self, fixed):
11794 assert not self.fixed
11795 assert not self._ctx
11796 if self.solver:
11797 Z3_solver_propagate_fixed(self.ctx_ref(), self.solver.solver, _user_prop_fixed)
11798 self.fixed = fixed
11799
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()

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

Definition at line 11870 of file z3py.py.

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

◆ ctx()

ctx ( self)

Definition at line 11784 of file z3py.py.

11784 def ctx(self):
11785 if self.fresh_ctx:
11786 return self.fresh_ctx
11787 else:
11788 return self.solver.ctx
11789

Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), AstMap.__contains__(), AstRef.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), Goal.__copy__(), ModelRef.__copy__(), AstMap.__deepcopy__(), AstRef.__deepcopy__(), AstVector.__deepcopy__(), Datatype.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), Goal.__deepcopy__(), ModelRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), ParamsRef.__deepcopy__(), Statistics.__deepcopy__(), AstMap.__del__(), AstRef.__del__(), AstVector.__del__(), Context.__del__(), FuncEntry.__del__(), FuncInterp.__del__(), Goal.__del__(), ModelRef.__del__(), ParamDescrsRef.__del__(), ParamsRef.__del__(), ScopedConstructor.__del__(), ScopedConstructorList.__del__(), Solver.__del__(), Statistics.__del__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), AstMap.__getitem__(), AstVector.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), AstMap.__len__(), AstVector.__len__(), ModelRef.__len__(), Statistics.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), ArithRef.__mul__(), BitVecRef.__mul__(), BoolRef.__mul__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), AstMap.__repr__(), ParamDescrsRef.__repr__(), ParamsRef.__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__(), AstMap.__setitem__(), AstVector.__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(), 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(), AstVector.push(), Solver.push(), QuantifierRef.qid(), ArraySortRef.range(), FuncDeclRef.range(), DatatypeSortRef.recognizer(), Context.ref(), AstMap.reset(), Solver.reset(), AstVector.resize(), ParamsRef.set(), Solver.set(), AstVector.sexpr(), Goal.sexpr(), ModelRef.sexpr(), Goal.size(), ParamDescrsRef.size(), QuantifierRef.skolem_id(), AstRef.translate(), AstVector.translate(), Goal.translate(), ModelRef.translate(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().

◆ ctx_ref()

ctx_ref ( self)

Definition at line 11790 of file z3py.py.

11790 def ctx_ref(self):
11791 return self.ctx().ref()
11792

Referenced by BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), SortRef.__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__(), ExprRef.__ne__(), SortRef.__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(), BitVecNumRef.as_binary_string(), IntNumRef.as_binary_string(), AlgebraicNumRef.as_decimal(), RatNumRef.as_decimal(), BitVecNumRef.as_string(), IntNumRef.as_string(), RatNumRef.as_string(), QuantifierRef.body(), ExprRef.decl(), ArrayRef.default(), RatNumRef.denominator(), FuncDeclRef.domain(), ArraySortRef.domain_n(), AstRef.eq(), AstRef.get_id(), ExprRef.get_id(), FuncDeclRef.get_id(), PatternRef.get_id(), QuantifierRef.get_id(), SortRef.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(), QuantifierRef.qid(), ArraySortRef.range(), FuncDeclRef.range(), DatatypeSortRef.recognizer(), AstRef.sexpr(), QuantifierRef.skolem_id(), QuantifierRef.var_name(), QuantifierRef.var_sort(), and QuantifierRef.weight().

◆ fresh()

fresh ( self,
new_ctx )

Definition at line 11841 of file z3py.py.

11841 def fresh(self, new_ctx):
11842 raise Z3Exception("fresh needs to be overwritten")
11843

◆ next_split()

next_split ( self,
t,
idx,
phase )

Definition at line 11856 of file z3py.py.

11856 def next_split(self, t, idx, phase):
11857 return Z3_solver_next_split(self.ctx_ref(), ctypes.c_void_p(self.cb), t.ast, idx, phase)
11858
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 11838 of file z3py.py.

11838 def pop(self, num_scopes):
11839 raise Z3Exception("pop needs to be overwritten")
11840

Referenced by Solver.__exit__().

◆ propagate()

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

Definition at line 11862 of file z3py.py.

11862 def propagate(self, e, ids, eqs=[]):
11863 _ids, num_fixed = _to_ast_array(ids)
11864 num_eqs = len(eqs)
11865 _lhs, _num_lhs = _to_ast_array([x for x, y in eqs])
11866 _rhs, _num_rhs = _to_ast_array([y for x, y in eqs])
11867 return Z3_solver_propagate_consequence(e.ctx.ref(), ctypes.c_void_p(
11868 self.cb), num_fixed, _ids, num_eqs, _lhs, _rhs, e.ast)
11869
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 11835 of file z3py.py.

11835 def push(self):
11836 raise Z3Exception("push needs to be overwritten")
11837

Referenced by Solver.__enter__().

Field Documentation

◆ _ctx

_ctx = None
protected

Definition at line 11760 of file z3py.py.

◆ cb

cb = None

Definition at line 11762 of file z3py.py.

◆ created

created = None

Definition at line 11769 of file z3py.py.

◆ decide

decide = None

Definition at line 11768 of file z3py.py.

◆ diseq

diseq = None

Definition at line 11767 of file z3py.py.

◆ eq

eq = None

Definition at line 11766 of file z3py.py.

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

◆ final

final = None

Definition at line 11765 of file z3py.py.

◆ fixed

fixed = None

Definition at line 11764 of file z3py.py.

◆ fresh_ctx

fresh_ctx = None

Definition at line 11761 of file z3py.py.

◆ id

id = _prop_closures.insert(self)

Definition at line 11763 of file z3py.py.

◆ solver