|
def | sort (self) |
|
def | is_int (self) |
|
def | is_real (self) |
|
def | __add__ (self, other) |
|
def | __radd__ (self, other) |
|
def | __mul__ (self, other) |
|
def | __rmul__ (self, other) |
|
def | __sub__ (self, other) |
|
def | __rsub__ (self, other) |
|
def | __pow__ (self, other) |
|
def | __rpow__ (self, other) |
|
def | __div__ (self, other) |
|
def | __truediv__ (self, other) |
|
def | __rdiv__ (self, other) |
|
def | __rtruediv__ (self, other) |
|
def | __mod__ (self, other) |
|
def | __rmod__ (self, other) |
|
def | __neg__ (self) |
|
def | __pos__ (self) |
|
def | __le__ (self, other) |
|
def | __lt__ (self, other) |
|
def | __gt__ (self, other) |
|
def | __ge__ (self, other) |
|
def | as_ast (self) |
|
def | get_id (self) |
|
def | sort_kind (self) |
|
def | __eq__ (self, other) |
|
def | __hash__ (self) |
|
def | __ne__ (self, other) |
|
def | params (self) |
|
def | decl (self) |
|
def | num_args (self) |
|
def | arg (self, idx) |
|
def | children (self) |
|
def | __init__ (self, ast, ctx=None) |
|
def | __del__ (self) |
|
def | __deepcopy__ (self, memo={}) |
|
def | __str__ (self) |
|
def | __repr__ (self) |
|
def | __nonzero__ (self) |
|
def | __bool__ (self) |
|
def | sexpr (self) |
|
def | ctx_ref (self) |
|
def | eq (self, other) |
|
def | translate (self, target) |
|
def | __copy__ (self) |
|
def | hash (self) |
|
def | use_pp (self) |
|
Integer and Real expressions.
Definition at line 2214 of file z3py.py.
◆ __add__()
def __add__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `self + other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x + y
x + y
>>> (x + y).sort()
Int
Definition at line 2252 of file z3py.py.
2252 def __add__(self, other):
2253 """Create the Z3 expression `self + other`.
2262 a, b = _coerce_exprs(self, other)
2263 return ArithRef(_mk_bin(Z3_mk_add, a, b), self.ctx)
◆ __div__()
def __div__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x/y
x/y
>>> (x/y).sort()
Int
>>> (x/y).sexpr()
'(div x y)'
>>> x = Real('x')
>>> y = Real('y')
>>> x/y
x/y
>>> (x/y).sort()
Real
>>> (x/y).sexpr()
'(/ x y)'
Definition at line 2351 of file z3py.py.
2351 def __div__(self, other):
2352 """Create the Z3 expression `other/self`.
2371 a, b = _coerce_exprs(self, other)
2372 return ArithRef(
Z3_mk_div(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Referenced by ArithRef.__truediv__(), BitVecRef.__truediv__(), and FPRef.__truediv__().
◆ __ge__()
def __ge__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other >= self`.
>>> x, y = Ints('x y')
>>> x >= y
x >= y
>>> y = Real('y')
>>> x >= y
ToReal(x) >= y
Definition at line 2485 of file z3py.py.
2485 def __ge__(self, other):
2486 """Create the Z3 expression `other >= self`.
2488 >>> x, y = Ints('x y')
2495 a, b = _coerce_exprs(self, other)
2496 return BoolRef(
Z3_mk_ge(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __gt__()
def __gt__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other > self`.
>>> x, y = Ints('x y')
>>> x > y
x > y
>>> y = Real('y')
>>> x > y
ToReal(x) > y
Definition at line 2472 of file z3py.py.
2472 def __gt__(self, other):
2473 """Create the Z3 expression `other > self`.
2475 >>> x, y = Ints('x y')
2482 a, b = _coerce_exprs(self, other)
2483 return BoolRef(
Z3_mk_gt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __le__()
def __le__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other <= self`.
>>> x, y = Ints('x y')
>>> x <= y
x <= y
>>> y = Real('y')
>>> x <= y
ToReal(x) <= y
Definition at line 2446 of file z3py.py.
2446 def __le__(self, other):
2447 """Create the Z3 expression `other <= self`.
2449 >>> x, y = Ints('x y')
2456 a, b = _coerce_exprs(self, other)
2457 return BoolRef(
Z3_mk_le(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __lt__()
def __lt__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other < self`.
>>> x, y = Ints('x y')
>>> x < y
x < y
>>> y = Real('y')
>>> x < y
ToReal(x) < y
Definition at line 2459 of file z3py.py.
2459 def __lt__(self, other):
2460 """Create the Z3 expression `other < self`.
2462 >>> x, y = Ints('x y')
2469 a, b = _coerce_exprs(self, other)
2470 return BoolRef(
Z3_mk_lt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __mod__()
def __mod__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> y = Int('y')
>>> x % y
x%y
>>> simplify(IntVal(10) % IntVal(3))
1
Definition at line 2399 of file z3py.py.
2399 def __mod__(self, other):
2400 """Create the Z3 expression `other%self`.
2406 >>> simplify(IntVal(10) % IntVal(3))
2409 a, b = _coerce_exprs(self, other)
2411 _z3_assert(a.is_int(),
"Z3 integer expression expected")
2412 return ArithRef(
Z3_mk_mod(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __mul__()
def __mul__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `self * other`.
>>> x = Real('x')
>>> y = Real('y')
>>> x * y
x*y
>>> (x * y).sort()
Real
Definition at line 2275 of file z3py.py.
2275 def __mul__(self, other):
2276 """Create the Z3 expression `self * other`.
2285 if isinstance(other, BoolRef):
2286 return If(other, self, 0)
2287 a, b = _coerce_exprs(self, other)
2288 return ArithRef(_mk_bin(Z3_mk_mul, a, b), self.ctx)
◆ __neg__()
Return an expression representing `-self`.
>>> x = Int('x')
>>> -x
-x
>>> simplify(-(-x))
x
Definition at line 2426 of file z3py.py.
2427 """Return an expression representing `-self`.
◆ __pos__()
Return `self`.
>>> x = Int('x')
>>> +x
x
Definition at line 2437 of file z3py.py.
◆ __pow__()
def __pow__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `self**other` (** is the power operator).
>>> x = Real('x')
>>> x**3
x**3
>>> (x**3).sort()
Real
>>> simplify(IntVal(2)**8)
256
Definition at line 2323 of file z3py.py.
2323 def __pow__(self, other):
2324 """Create the Z3 expression `self**other` (** is the power operator).
2331 >>> simplify(IntVal(2)**8)
2334 a, b = _coerce_exprs(self, other)
2335 return ArithRef(
Z3_mk_power(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
◆ __radd__()
def __radd__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other + self`.
>>> x = Int('x')
>>> 10 + x
10 + x
Definition at line 2265 of file z3py.py.
2265 def __radd__(self, other):
2266 """Create the Z3 expression `other + self`.
2272 a, b = _coerce_exprs(self, other)
2273 return ArithRef(_mk_bin(Z3_mk_add, b, a), self.ctx)
◆ __rdiv__()
def __rdiv__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other/self`.
>>> x = Int('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(div 10 x)'
>>> x = Real('x')
>>> 10/x
10/x
>>> (10/x).sexpr()
'(/ 10.0 x)'
Definition at line 2378 of file z3py.py.
2378 def __rdiv__(self, other):
2379 """Create the Z3 expression `other/self`.
2392 a, b = _coerce_exprs(self, other)
2393 return ArithRef(
Z3_mk_div(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
Referenced by ArithRef.__rtruediv__(), BitVecRef.__rtruediv__(), and FPRef.__rtruediv__().
◆ __rmod__()
def __rmod__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> 10 % x
10%x
Definition at line 2414 of file z3py.py.
2414 def __rmod__(self, other):
2415 """Create the Z3 expression `other%self`.
2421 a, b = _coerce_exprs(self, other)
2423 _z3_assert(a.is_int(),
"Z3 integer expression expected")
2424 return ArithRef(
Z3_mk_mod(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
◆ __rmul__()
def __rmul__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other * self`.
>>> x = Real('x')
>>> 10 * x
10*x
Definition at line 2290 of file z3py.py.
2290 def __rmul__(self, other):
2291 """Create the Z3 expression `other * self`.
2297 a, b = _coerce_exprs(self, other)
2298 return ArithRef(_mk_bin(Z3_mk_mul, b, a), self.ctx)
◆ __rpow__()
def __rpow__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other**self` (** is the power operator).
>>> x = Real('x')
>>> 2**x
2**x
>>> (2**x).sort()
Real
>>> simplify(2**IntVal(8))
256
Definition at line 2337 of file z3py.py.
2337 def __rpow__(self, other):
2338 """Create the Z3 expression `other**self` (** is the power operator).
2345 >>> simplify(2**IntVal(8))
2348 a, b = _coerce_exprs(self, other)
2349 return ArithRef(
Z3_mk_power(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
◆ __rsub__()
def __rsub__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other - self`.
>>> x = Int('x')
>>> 10 - x
10 - x
Definition at line 2313 of file z3py.py.
2313 def __rsub__(self, other):
2314 """Create the Z3 expression `other - self`.
2320 a, b = _coerce_exprs(self, other)
2321 return ArithRef(_mk_bin(Z3_mk_sub, b, a), self.ctx)
◆ __rtruediv__()
def __rtruediv__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other/self`.
Definition at line 2395 of file z3py.py.
2395 def __rtruediv__(self, other):
2396 """Create the Z3 expression `other/self`."""
2397 return self.__rdiv__(other)
◆ __sub__()
def __sub__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `self - other`.
>>> x = Int('x')
>>> y = Int('y')
>>> x - y
x - y
>>> (x - y).sort()
Int
Definition at line 2300 of file z3py.py.
2300 def __sub__(self, other):
2301 """Create the Z3 expression `self - other`.
2310 a, b = _coerce_exprs(self, other)
2311 return ArithRef(_mk_bin(Z3_mk_sub, a, b), self.ctx)
◆ __truediv__()
def __truediv__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other/self`.
Definition at line 2374 of file z3py.py.
2374 def __truediv__(self, other):
2375 """Create the Z3 expression `other/self`."""
2376 return self.__div__(other)
◆ is_int()
Return `True` if `self` is an integer expression.
>>> x = Int('x')
>>> x.is_int()
True
>>> (x + 1).is_int()
True
>>> y = Real('y')
>>> (x + y).is_int()
False
Reimplemented in RatNumRef.
Definition at line 2227 of file z3py.py.
2228 """Return `True` if `self` is an integer expression.
2233 >>> (x + 1).is_int()
2236 >>> (x + y).is_int()
2239 return self.sort().
is_int()
Referenced by IntNumRef.as_long().
◆ is_real()
Return `True` if `self` is an real expression.
>>> x = Real('x')
>>> x.is_real()
True
>>> (x + 1).is_real()
True
Reimplemented in RatNumRef.
Definition at line 2241 of file z3py.py.
2242 """Return `True` if `self` is an real expression.
2247 >>> (x + 1).is_real()
◆ sort()
Return the sort (type) of the arithmetical expression `self`.
>>> Int('x').sort()
Int
>>> (Real('x') + 1).sort()
Real
Reimplemented from ExprRef.
Definition at line 2217 of file z3py.py.
2218 """Return the sort (type) of the arithmetical expression `self`.
2222 >>> (Real('x') + 1).sort()
2225 return ArithSortRef(
Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_ge(Z3_context c, Z3_ast t1, Z3_ast t2)
Create greater than or equal to.
Z3_ast Z3_API Z3_mk_power(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 ^ arg2.
Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 div arg2.
Z3_ast Z3_API Z3_mk_mod(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 mod arg2.
Z3_ast Z3_API Z3_mk_le(Z3_context c, Z3_ast t1, Z3_ast t2)
Create less than or equal to.