Public Member Functions | |
def | __init__ |
def | __del__ |
def | solver |
def | apply |
def | __call__ |
def | help |
def | param_descrs |
Data Fields | |
ctx | |
tactic |
Tactics transform, solver and/or simplify sets of constraints (Goal). A Tactic can be converted into a Solver using the method solver(). Several combinators are available for creating new tactics using the built-in ones: Then(), OrElse(), FailIf(), Repeat(), When(), Cond().
def __init__ | ( | self, | |
tactic, | |||
ctx = None |
|||
) |
Definition at line 6439 of file z3py.py.
06439 06440 def __init__(self, tactic, ctx=None): 06441 self.ctx = _get_ctx(ctx) 06442 self.tactic = None 06443 if isinstance(tactic, TacticObj): 06444 self.tactic = tactic 06445 else: 06446 if __debug__: 06447 _z3_assert(isinstance(tactic, str), "tactic name expected") 06448 try: 06449 self.tactic = Z3_mk_tactic(self.ctx.ref(), str(tactic)) 06450 except Z3Exception: 06451 raise Z3Exception("unknown tactic '%s'" % tactic) 06452 Z3_tactic_inc_ref(self.ctx.ref(), self.tactic)
def __del__ | ( | self | ) |
def __call__ | ( | self, | |
goal, | |||
arguments, | |||
keywords | |||
) |
Apply tactic `self` to the given goal or Z3 Boolean expression using the given options. >>> x, y = Ints('x y') >>> t = Tactic('solve-eqs') >>> t(And(x == 0, y >= x + 1)) [[y >= 1]]
Definition at line 6491 of file z3py.py.
06491 06492 def __call__(self, goal, *arguments, **keywords): 06493 """Apply tactic `self` to the given goal or Z3 Boolean expression using the given options. 06494 06495 >>> x, y = Ints('x y') 06496 >>> t = Tactic('solve-eqs') 06497 >>> t(And(x == 0, y >= x + 1)) 06498 [[y >= 1]] 06499 """ 06500 return self.apply(goal, *arguments, **keywords)
def apply | ( | self, | |
goal, | |||
arguments, | |||
keywords | |||
) |
Apply tactic `self` to the given goal or Z3 Boolean expression using the given options. >>> x, y = Ints('x y') >>> t = Tactic('solve-eqs') >>> t.apply(And(x == 0, y >= x + 1)) [[y >= 1]]
Definition at line 6474 of file z3py.py.
Referenced by Tactic.__call__().
06474 06475 def apply(self, goal, *arguments, **keywords): 06476 """Apply tactic `self` to the given goal or Z3 Boolean expression using the given options. 06477 06478 >>> x, y = Ints('x y') 06479 >>> t = Tactic('solve-eqs') 06480 >>> t.apply(And(x == 0, y >= x + 1)) 06481 [[y >= 1]] 06482 """ 06483 if __debug__: 06484 _z3_assert(isinstance(goal, Goal) or isinstance(goal, BoolRef), "Z3 Goal or Boolean expressions expected") 06485 goal = _to_goal(goal) 06486 if len(arguments) > 0 or len(keywords) > 0: 06487 p = args2params(arguments, keywords, self.ctx) 06488 return ApplyResult(Z3_tactic_apply_ex(self.ctx.ref(), self.tactic, goal.goal, p.params), self.ctx) 06489 else: 06490 return ApplyResult(Z3_tactic_apply(self.ctx.ref(), self.tactic, goal.goal), self.ctx)
def help | ( | self | ) |
Display a string containing a description of the available options for the `self` tactic.
Definition at line 6501 of file z3py.py.
06501 06502 def help(self): 06503 """Display a string containing a description of the available options for the `self` tactic.""" 06504 print(Z3_tactic_get_help(self.ctx.ref(), self.tactic))
def param_descrs | ( | self | ) |
Return the parameter description set.
Definition at line 6505 of file z3py.py.
06505 06506 def param_descrs(self): 06507 """Return the parameter description set.""" 06508 return ParamDescrsRef(Z3_tactic_get_param_descrs(self.ctx.ref(), self.tactic), self.ctx)
def solver | ( | self | ) |
Create a solver using the tactic `self`. The solver supports the methods `push()` and `pop()`, but it will always solve each `check()` from scratch. >>> t = Then('simplify', 'nlsat') >>> s = t.solver() >>> x = Real('x') >>> s.add(x**2 == 2, x > 0) >>> s.check() sat >>> s.model() [x = 1.4142135623?]
Definition at line 6457 of file z3py.py.
06457 06458 def solver(self): 06459 """Create a solver using the tactic `self`. 06460 06461 The solver supports the methods `push()` and `pop()`, but it 06462 will always solve each `check()` from scratch. 06463 06464 >>> t = Then('simplify', 'nlsat') 06465 >>> s = t.solver() 06466 >>> x = Real('x') 06467 >>> s.add(x**2 == 2, x > 0) 06468 >>> s.check() 06469 sat 06470 >>> s.model() 06471 [x = 1.4142135623?] 06472 """ 06473 return Solver(Z3_mk_solver_from_tactic(self.ctx.ref(), self.tactic), self.ctx)
Definition at line 6439 of file z3py.py.
Referenced by ArithRef::__add__(), BitVecRef::__add__(), BitVecRef::__and__(), FuncDeclRef::__call__(), ArithRef::__div__(), BitVecRef::__div__(), ExprRef::__eq__(), Probe::__eq__(), ArithRef::__ge__(), BitVecRef::__ge__(), Probe::__ge__(), ArrayRef::__getitem__(), ArithRef::__gt__(), BitVecRef::__gt__(), Probe::__gt__(), BitVecRef::__invert__(), ArithRef::__le__(), BitVecRef::__le__(), Probe::__le__(), BitVecRef::__lshift__(), ArithRef::__lt__(), BitVecRef::__lt__(), Probe::__lt__(), ArithRef::__mod__(), BitVecRef::__mod__(), ArithRef::__mul__(), BitVecRef::__mul__(), ExprRef::__ne__(), Probe::__ne__(), ArithRef::__neg__(), BitVecRef::__neg__(), BitVecRef::__or__(), ArithRef::__pow__(), ArithRef::__radd__(), BitVecRef::__radd__(), BitVecRef::__rand__(), ArithRef::__rdiv__(), BitVecRef::__rdiv__(), BitVecRef::__rlshift__(), ArithRef::__rmod__(), BitVecRef::__rmod__(), ArithRef::__rmul__(), BitVecRef::__rmul__(), BitVecRef::__ror__(), ArithRef::__rpow__(), BitVecRef::__rrshift__(), BitVecRef::__rshift__(), ArithRef::__rsub__(), BitVecRef::__rsub__(), BitVecRef::__rxor__(), ArithRef::__sub__(), BitVecRef::__sub__(), BitVecRef::__xor__(), DatatypeSortRef::accessor(), Tactic::apply(), AlgebraicNumRef::approx(), ExprRef::arg(), QuantifierRef::body(), BoolSortRef::cast(), DatatypeSortRef::constructor(), ExprRef::decl(), RatNumRef::denominator(), FuncDeclRef::domain(), ArraySortRef::domain(), SortRef::kind(), SortRef::name(), FuncDeclRef::name(), QuantifierRef::no_pattern(), RatNumRef::numerator(), Tactic::param_descrs(), QuantifierRef::pattern(), FuncDeclRef::range(), ArraySortRef::range(), DatatypeSortRef::recognizer(), Tactic::solver(), ExprRef::sort(), BoolRef::sort(), QuantifierRef::sort(), ArithRef::sort(), BitVecRef::sort(), ArrayRef::sort(), DatatypeRef::sort(), QuantifierRef::var_name(), and QuantifierRef::var_sort().
Definition at line 6439 of file z3py.py.
Referenced by Tactic.__del__(), Tactic.apply(), Tactic.help(), Tactic.param_descrs(), and Tactic.solver().