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_final (self, final)
 
def add_eq (self, eq)
 
def add_diseq (self, diseq)
 
def push (self)
 
def pop (self, num_scopes)
 
def fresh (self)
 
def add (self, e)
 
def propagate (self, e, ids, eqs=[])
 
def conflict (self, ids)
 

Data Fields

 solver
 
 cb
 
 id
 
 fixed
 
 final
 
 eq
 
 diseq
 

Detailed Description

Definition at line 11168 of file z3py.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  s,
  ctx = None 
)

Definition at line 11177 of file z3py.py.

11177  def __init__(self, s, ctx=None):
11178  assert s is None or ctx is None
11180  self.solver = s
11181  self._ctx = None
11182  self.cb = None
11183  self.id = _prop_closures.insert(self)
11184  self.fixed = None
11185  self.final = None
11186  self.eq = None
11187  self.diseq = None
11188  if ctx:
11189  self._ctx = Context()
11190  Z3_del_context(self._ctx.ctx)
11191  self._ctx.ctx = ctx
11192  self._ctx.eh = Z3_set_error_handler(ctx, z3_error_handler)
11193  Z3_set_ast_print_mode(ctx, Z3_PRINT_SMTLIB2_COMPLIANT)
11194  if s:
11195  Z3_solver_propagate_init(self.ctx_ref(),
11196  s.solver,
11197  ctypes.c_void_p(self.id),
11198  _user_prop_push,
11199  _user_prop_pop,
11200  _user_prop_fresh)
11201 

◆ __del__()

def __del__ (   self)

Definition at line 11202 of file z3py.py.

11202  def __del__(self):
11203  if self._ctx:
11204  self._ctx.ctx = None
11205 

Member Function Documentation

◆ add()

def add (   self,
  e 
)

Definition at line 11248 of file z3py.py.

11248  def add(self, e):
11249  assert self.solver
11250  assert not self._ctx
11251  return Z3_solver_propagate_register(self.ctx_ref(), self.solver.solver, e.ast)
11252 

◆ add_diseq()

def add_diseq (   self,
  diseq 
)

Definition at line 11233 of file z3py.py.

11233  def add_diseq(self, diseq):
11234  assert not self.diseq
11235  assert not self._ctx
11236  Z3_solver_propagate_diseq(self.ctx_ref(), self.solver.solver, _user_prop_diseq)
11237  self.diseq = diseq
11238 

◆ add_eq()

def add_eq (   self,
  eq 
)

Definition at line 11227 of file z3py.py.

11227  def add_eq(self, eq):
11228  assert not self.eq
11229  assert not self._ctx
11230  Z3_solver_propagate_eq(self.ctx_ref(), self.solver.solver, _user_prop_eq)
11231  self.eq = eq
11232 

◆ add_final()

def add_final (   self,
  final 
)

Definition at line 11221 of file z3py.py.

11221  def add_final(self, final):
11222  assert not self.final
11223  assert not self._ctx
11224  Z3_solver_propagate_final(self.ctx_ref(), self.solver.solver, _user_prop_final)
11225  self.final = final
11226 

◆ add_fixed()

def add_fixed (   self,
  fixed 
)

Definition at line 11215 of file z3py.py.

11215  def add_fixed(self, fixed):
11216  assert not self.fixed
11217  assert not self._ctx
11218  Z3_solver_propagate_fixed(self.ctx_ref(), self.solver.solver, _user_prop_fixed)
11219  self.fixed = fixed
11220 

◆ conflict()

def conflict (   self,
  ids 
)

Definition at line 11270 of file z3py.py.

11270  def conflict(self, ids):
11271  self.propagate(BoolVal(False, self.ctx()), ids, eqs=[])

◆ ctx()

def ctx (   self)

Definition at line 11206 of file z3py.py.

11206  def ctx(self):
11207  if self._ctx:
11208  return self._ctx
11209  else:
11210  return self.solver.ctx
11211 

Referenced by UserPropagateBase.conflict(), and UserPropagateBase.ctx_ref().

◆ ctx_ref()

def ctx_ref (   self)

Definition at line 11212 of file z3py.py.

11212  def ctx_ref(self):
11213  return self.ctx().ref()
11214 

Referenced by UserPropagateBase.add(), UserPropagateBase.add_diseq(), UserPropagateBase.add_eq(), UserPropagateBase.add_final(), and UserPropagateBase.add_fixed().

◆ fresh()

def fresh (   self)

Definition at line 11245 of file z3py.py.

11245  def fresh(self):
11246  raise Z3Exception("fresh needs to be overwritten")
11247 

◆ pop()

def pop (   self,
  num_scopes 
)

Definition at line 11242 of file z3py.py.

11242  def pop(self, num_scopes):
11243  raise Z3Exception("pop needs to be overwritten")
11244 

◆ propagate()

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

Definition at line 11256 of file z3py.py.

11256  def propagate(self, e, ids, eqs=[]):
11257  num_fixed = len(ids)
11258  _ids = (ctypes.c_uint * num_fixed)()
11259  for i in range(num_fixed):
11260  _ids[i] = ids[i]
11261  num_eqs = len(eqs)
11262  _lhs = (ctypes.c_uint * num_eqs)()
11263  _rhs = (ctypes.c_uint * num_eqs)()
11264  for i in range(num_eqs):
11265  _lhs[i] = eqs[i][0]
11266  _rhs[i] = eqs[i][1]
11267  Z3_solver_propagate_consequence(e.ctx.ref(), ctypes.c_void_p(
11268  self.cb), num_fixed, _ids, num_eqs, _lhs, _rhs, e.ast)
11269 

Referenced by UserPropagateBase.conflict().

◆ push()

def push (   self)

Definition at line 11239 of file z3py.py.

11239  def push(self):
11240  raise Z3Exception("push needs to be overwritten")
11241 

Field Documentation

◆ cb

cb

Definition at line 11182 of file z3py.py.

Referenced by UserPropagateBase.propagate().

◆ diseq

diseq

Definition at line 11187 of file z3py.py.

Referenced by UserPropagateBase.add_diseq().

◆ eq

eq

Definition at line 11186 of file z3py.py.

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

◆ final

final

Definition at line 11185 of file z3py.py.

Referenced by UserPropagateBase.add_final().

◆ fixed

fixed

Definition at line 11184 of file z3py.py.

Referenced by UserPropagateBase.add_fixed().

◆ id

id

Definition at line 11183 of file z3py.py.

◆ solver

solver
Z3_solver_propagate_diseq
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.
z3py.UserPropagateBase.__init__
def __init__(self, s, ctx=None)
Definition: z3py.py:11177
z3py.UserPropagateBase.add_diseq
def add_diseq(self, diseq)
Definition: z3py.py:11233
Z3_del_context
void Z3_API Z3_del_context(Z3_context c)
Delete the given logical context.
z3::range
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:3725
z3py.ensure_prop_closures
def ensure_prop_closures()
Definition: z3py.py:11110
Z3_solver_propagate_init
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.
z3py.UserPropagateBase.pop
def pop(self, num_scopes)
Definition: z3py.py:11242
Z3_solver_propagate_eq
void Z3_API Z3_solver_propagate_eq(Z3_context c, Z3_solver s, Z3_eq_eh eq_eh)
register a callback on expression equalities.
z3py.UserPropagateBase.add_final
def add_final(self, final)
Definition: z3py.py:11221
z3py.UserPropagateBase.push
def push(self)
Definition: z3py.py:11239
Z3_set_ast_print_mode
void Z3_API Z3_set_ast_print_mode(Z3_context c, Z3_ast_print_mode mode)
Select mode for the format used for pretty-printing AST nodes.
Z3_solver_propagate_consequence
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...
z3py.UserPropagateBase.__del__
def __del__(self)
Definition: z3py.py:11202
z3py.UserPropagateBase.add_eq
def add_eq(self, eq)
Definition: z3py.py:11227
z3py.UserPropagateBase.ctx
def ctx(self)
Definition: z3py.py:11206
z3py.UserPropagateBase.ctx_ref
def ctx_ref(self)
Definition: z3py.py:11212
z3py.UserPropagateBase.conflict
def conflict(self, ids)
Definition: z3py.py:11270
Z3_solver_propagate_final
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...
z3py.BoolVal
def BoolVal(val, ctx=None)
Definition: z3py.py:1673
z3py.UserPropagateBase.add_fixed
def add_fixed(self, fixed)
Definition: z3py.py:11215
Z3_solver_propagate_register
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...
Z3_set_error_handler
void Z3_API Z3_set_error_handler(Z3_context c, Z3_error_handler h)
Register a Z3 error handler.
Z3_solver_propagate_fixed
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 ...
z3py.UserPropagateBase.propagate
def propagate(self, e, ids, eqs=[])
Definition: z3py.py:11256
z3py.UserPropagateBase.add
def add(self, e)
Definition: z3py.py:11248
z3py.UserPropagateBase.fresh
def fresh(self)
Definition: z3py.py:11245