Public Member Functions | |
| def | __init__ |
| def | __del__ |
| def | __lt__ |
| def | __gt__ |
| def | __le__ |
| def | __ge__ |
| def | __eq__ |
| def | __ne__ |
| def | __call__ |
Data Fields | |
| ctx | |
| probe | |
Probes are used to inspect a goal (aka problem) and collect information that may be used to decide which solver and/or preprocessing step will be used.
| def __init__ | ( | self, | |
| probe, | |||
ctx = None |
|||
| ) |
Definition at line 6924 of file z3py.py.
06924 06925 def __init__(self, probe, ctx=None): 06926 self.ctx = _get_ctx(ctx) 06927 self.probe = None 06928 if isinstance(probe, ProbeObj): 06929 self.probe = probe 06930 elif isinstance(probe, float): 06931 self.probe = Z3_probe_const(self.ctx.ref(), probe) 06932 elif _is_int(probe): 06933 self.probe = Z3_probe_const(self.ctx.ref(), float(probe)) 06934 elif isinstance(probe, bool): 06935 if probe: 06936 self.probe = Z3_probe_const(self.ctx.ref(), 1.0) 06937 else: 06938 self.probe = Z3_probe_const(self.ctx.ref(), 0.0) 06939 else: 06940 if __debug__: 06941 _z3_assert(isinstance(probe, str), "probe name expected") 06942 try: 06943 self.probe = Z3_mk_probe(self.ctx.ref(), probe) 06944 except Z3Exception: 06945 raise Z3Exception("unknown probe '%s'" % probe) 06946 Z3_probe_inc_ref(self.ctx.ref(), self.probe)
| def __del__ | ( | self | ) |
| def __call__ | ( | self, | |
| goal | |||
| ) |
Evaluate the probe `self` in the given goal.
>>> p = Probe('size')
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
2.0
>>> g.add(x < 20)
>>> p(g)
3.0
>>> p = Probe('num-consts')
>>> p(g)
1.0
>>> p = Probe('is-propositional')
>>> p(g)
0.0
>>> p = Probe('is-qflia')
>>> p(g)
1.0
Definition at line 7030 of file z3py.py.
07030 07031 def __call__(self, goal): 07032 """Evaluate the probe `self` in the given goal. 07033 07034 >>> p = Probe('size') 07035 >>> x = Int('x') 07036 >>> g = Goal() 07037 >>> g.add(x > 0) 07038 >>> g.add(x < 10) 07039 >>> p(g) 07040 2.0 07041 >>> g.add(x < 20) 07042 >>> p(g) 07043 3.0 07044 >>> p = Probe('num-consts') 07045 >>> p(g) 07046 1.0 07047 >>> p = Probe('is-propositional') 07048 >>> p(g) 07049 0.0 07050 >>> p = Probe('is-qflia') 07051 >>> p(g) 07052 1.0 07053 """ 07054 if __debug__: 07055 _z3_assert(isinstance(goal, Goal) or isinstance(goal, BoolRef), "Z3 Goal or Boolean expression expected") 07056 goal = _to_goal(goal) 07057 return Z3_probe_apply(self.ctx.ref(), self.probe, goal.goal)
| def __eq__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is equal to the value returned by `other`.
>>> p = Probe('size') == 2
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
1.0
Definition at line 7003 of file z3py.py.
Referenced by Probe.__ne__().
07003 07004 def __eq__(self, other): 07005 """Return a probe that evaluates to "true" when the value returned by `self` is equal to the value returned by `other`. 07006 07007 >>> p = Probe('size') == 2 07008 >>> x = Int('x') 07009 >>> g = Goal() 07010 >>> g.add(x > 0) 07011 >>> g.add(x < 10) 07012 >>> p(g) 07013 1.0 07014 """ 07015 return Probe(Z3_probe_eq(self.ctx.ref(), self.probe, _to_probe(other, self.ctx).probe), self.ctx)
| def __ge__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is greater than or equal to the value returned by `other`.
>>> p = Probe('size') >= 2
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
1.0
Definition at line 6990 of file z3py.py.
06990 06991 def __ge__(self, other): 06992 """Return a probe that evaluates to "true" when the value returned by `self` is greater than or equal to the value returned by `other`. 06993 06994 >>> p = Probe('size') >= 2 06995 >>> x = Int('x') 06996 >>> g = Goal() 06997 >>> g.add(x > 0) 06998 >>> g.add(x < 10) 06999 >>> p(g) 07000 1.0 07001 """ 07002 return Probe(Z3_probe_ge(self.ctx.ref(), self.probe, _to_probe(other, self.ctx).probe), self.ctx)
| def __gt__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is greater than the value returned by `other`.
>>> p = Probe('size') > 10
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
0.0
Definition at line 6964 of file z3py.py.
06964 06965 def __gt__(self, other): 06966 """Return a probe that evaluates to "true" when the value returned by `self` is greater than the value returned by `other`. 06967 06968 >>> p = Probe('size') > 10 06969 >>> x = Int('x') 06970 >>> g = Goal() 06971 >>> g.add(x > 0) 06972 >>> g.add(x < 10) 06973 >>> p(g) 06974 0.0 06975 """ 06976 return Probe(Z3_probe_gt(self.ctx.ref(), self.probe, _to_probe(other, self.ctx).probe), self.ctx)
| def __le__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is less than or equal to the value returned by `other`.
>>> p = Probe('size') <= 2
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
1.0
Definition at line 6977 of file z3py.py.
06977 06978 def __le__(self, other): 06979 """Return a probe that evaluates to "true" when the value returned by `self` is less than or equal to the value returned by `other`. 06980 06981 >>> p = Probe('size') <= 2 06982 >>> x = Int('x') 06983 >>> g = Goal() 06984 >>> g.add(x > 0) 06985 >>> g.add(x < 10) 06986 >>> p(g) 06987 1.0 06988 """ 06989 return Probe(Z3_probe_le(self.ctx.ref(), self.probe, _to_probe(other, self.ctx).probe), self.ctx)
| def __lt__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is less than the value returned by `other`.
>>> p = Probe('size') < 10
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
1.0
Definition at line 6951 of file z3py.py.
06951 06952 def __lt__(self, other): 06953 """Return a probe that evaluates to "true" when the value returned by `self` is less than the value returned by `other`. 06954 06955 >>> p = Probe('size') < 10 06956 >>> x = Int('x') 06957 >>> g = Goal() 06958 >>> g.add(x > 0) 06959 >>> g.add(x < 10) 06960 >>> p(g) 06961 1.0 06962 """ 06963 return Probe(Z3_probe_lt(self.ctx.ref(), self.probe, _to_probe(other, self.ctx).probe), self.ctx)
| def __ne__ | ( | self, | |
| other | |||
| ) |
Return a probe that evaluates to "true" when the value returned by `self` is not equal to the value returned by `other`.
>>> p = Probe('size') != 2
>>> x = Int('x')
>>> g = Goal()
>>> g.add(x > 0)
>>> g.add(x < 10)
>>> p(g)
0.0
Definition at line 7016 of file z3py.py.
07016 07017 def __ne__(self, other): 07018 """Return a probe that evaluates to "true" when the value returned by `self` is not equal to the value returned by `other`. 07019 07020 >>> p = Probe('size') != 2 07021 >>> x = Int('x') 07022 >>> g = Goal() 07023 >>> g.add(x > 0) 07024 >>> g.add(x < 10) 07025 >>> p(g) 07026 0.0 07027 """ 07028 p = self.__eq__(other) 07029 return Probe(Z3_probe_not(self.ctx.ref(), p.probe), self.ctx)
Definition at line 6924 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(), AlgebraicNumRef::approx(), ExprRef::arg(), QuantifierRef::body(), BoolSortRef::cast(), DatatypeSortRef::constructor(), ExprRef::decl(), RatNumRef::denominator(), FuncDeclRef::domain(), ArraySortRef::domain(), SortRef::kind(), ArrayRef::mk_default(), SortRef::name(), FuncDeclRef::name(), QuantifierRef::no_pattern(), RatNumRef::numerator(), QuantifierRef::pattern(), FuncDeclRef::range(), ArraySortRef::range(), DatatypeSortRef::recognizer(), ExprRef::sort(), BoolRef::sort(), QuantifierRef::sort(), ArithRef::sort(), BitVecRef::sort(), ArrayRef::sort(), DatatypeRef::sort(), QuantifierRef::var_name(), and QuantifierRef::var_sort().
Definition at line 6924 of file z3py.py.
Referenced by Probe.__call__(), Probe.__del__(), Probe.__eq__(), Probe.__ge__(), Probe.__gt__(), Probe.__le__(), and Probe.__lt__().
1.7.6.1