|
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 (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 | __eq__ (self, other) |
|
def | __hash__ (self) |
|
def | __nonzero__ (self) |
|
def | __bool__ (self) |
|
def | sexpr (self) |
|
def | as_ast (self) |
|
def | get_id (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 2159 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 2197 of file z3py.py.
2197 def __add__(self, other):
2198 """Create the Z3 expression `self + other`. 2207 a, b = _coerce_exprs(self, other)
2208 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 2296 of file z3py.py.
2296 def __div__(self, other):
2297 """Create the Z3 expression `other/self`. 2316 a, b = _coerce_exprs(self, other)
2317 return ArithRef(
Z3_mk_div(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 div arg2.
◆ __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 2430 of file z3py.py.
2430 def __ge__(self, other):
2431 """Create the Z3 expression `other >= self`. 2433 >>> x, y = Ints('x y') 2440 a, b = _coerce_exprs(self, other)
2441 return BoolRef(
Z3_mk_ge(self.ctx_ref(), a.as_ast(), b.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.
◆ __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 2417 of file z3py.py.
2417 def __gt__(self, other):
2418 """Create the Z3 expression `other > self`. 2420 >>> x, y = Ints('x y') 2427 a, b = _coerce_exprs(self, other)
2428 return BoolRef(
Z3_mk_gt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_gt(Z3_context c, Z3_ast t1, Z3_ast t2)
Create greater than.
◆ __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 2391 of file z3py.py.
2391 def __le__(self, other):
2392 """Create the Z3 expression `other <= self`. 2394 >>> x, y = Ints('x y') 2401 a, b = _coerce_exprs(self, other)
2402 return BoolRef(
Z3_mk_le(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_le(Z3_context c, Z3_ast t1, Z3_ast t2)
Create less than or equal to.
◆ __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 2404 of file z3py.py.
2404 def __lt__(self, other):
2405 """Create the Z3 expression `other < self`. 2407 >>> x, y = Ints('x y') 2414 a, b = _coerce_exprs(self, other)
2415 return BoolRef(
Z3_mk_lt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_lt(Z3_context c, Z3_ast t1, Z3_ast t2)
Create less than.
◆ __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 2344 of file z3py.py.
2344 def __mod__(self, other):
2345 """Create the Z3 expression `other%self`. 2351 >>> simplify(IntVal(10) % IntVal(3)) 2354 a, b = _coerce_exprs(self, other)
2356 _z3_assert(a.is_int(),
"Z3 integer expression expected")
2357 return ArithRef(
Z3_mk_mod(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_mod(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 mod arg2.
◆ __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 2220 of file z3py.py.
2220 def __mul__(self, other):
2221 """Create the Z3 expression `self * other`. 2230 if isinstance(other, BoolRef):
2231 return If(other, self, 0)
2232 a, b = _coerce_exprs(self, other)
2233 return ArithRef(_mk_bin(Z3_mk_mul, a, b), self.ctx)
def If(a, b, c, ctx=None)
◆ __neg__()
Return an expression representing `-self`.
>>> x = Int('x')
>>> -x
-x
>>> simplify(-(-x))
x
Definition at line 2371 of file z3py.py.
2372 """Return an expression representing `-self`. Z3_ast Z3_API Z3_mk_unary_minus(Z3_context c, Z3_ast arg)
Create an AST node representing - arg.
◆ __pos__()
Return `self`.
>>> x = Int('x')
>>> +x
x
Definition at line 2382 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 2268 of file z3py.py.
2268 def __pow__(self, other):
2269 """Create the Z3 expression `self**other` (** is the power operator). 2276 >>> simplify(IntVal(2)**8) 2279 a, b = _coerce_exprs(self, other)
2280 return ArithRef(
Z3_mk_power(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_power(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 ^ arg2.
◆ __radd__()
def __radd__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other + self`.
>>> x = Int('x')
>>> 10 + x
10 + x
Definition at line 2210 of file z3py.py.
2210 def __radd__(self, other):
2211 """Create the Z3 expression `other + self`. 2217 a, b = _coerce_exprs(self, other)
2218 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 2323 of file z3py.py.
2323 def __rdiv__(self, other):
2324 """Create the Z3 expression `other/self`. 2337 a, b = _coerce_exprs(self, other)
2338 return ArithRef(
Z3_mk_div(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 div arg2.
◆ __rmod__()
def __rmod__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> 10 % x
10%x
Definition at line 2359 of file z3py.py.
2359 def __rmod__(self, other):
2360 """Create the Z3 expression `other%self`. 2366 a, b = _coerce_exprs(self, other)
2368 _z3_assert(a.is_int(),
"Z3 integer expression expected")
2369 return ArithRef(
Z3_mk_mod(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_mod(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 mod arg2.
◆ __rmul__()
def __rmul__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other * self`.
>>> x = Real('x')
>>> 10 * x
10*x
Definition at line 2235 of file z3py.py.
2235 def __rmul__(self, other):
2236 """Create the Z3 expression `other * self`. 2242 a, b = _coerce_exprs(self, other)
2243 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 2282 of file z3py.py.
2282 def __rpow__(self, other):
2283 """Create the Z3 expression `other**self` (** is the power operator). 2290 >>> simplify(2**IntVal(8)) 2293 a, b = _coerce_exprs(self, other)
2294 return ArithRef(
Z3_mk_power(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
Z3_ast Z3_API Z3_mk_power(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 ^ arg2.
◆ __rsub__()
def __rsub__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Create the Z3 expression `other - self`.
>>> x = Int('x')
>>> 10 - x
10 - x
Definition at line 2258 of file z3py.py.
2258 def __rsub__(self, other):
2259 """Create the Z3 expression `other - self`. 2265 a, b = _coerce_exprs(self, other)
2266 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 2340 of file z3py.py.
2340 def __rtruediv__(self, other):
2341 """Create the Z3 expression `other/self`.""" 2342 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 2245 of file z3py.py.
2245 def __sub__(self, other):
2246 """Create the Z3 expression `self - other`. 2255 a, b = _coerce_exprs(self, other)
2256 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 2319 of file z3py.py.
2319 def __truediv__(self, other):
2320 """Create the Z3 expression `other/self`.""" 2321 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
Definition at line 2172 of file z3py.py.
2173 """Return `True` if `self` is an integer expression. 2178 >>> (x + 1).is_int() 2181 >>> (x + y).is_int() 2184 return self.sort().
is_int()
◆ is_real()
Return `True` if `self` is an real expression.
>>> x = Real('x')
>>> x.is_real()
True
>>> (x + 1).is_real()
True
Definition at line 2186 of file z3py.py.
2187 """Return `True` if `self` is an real expression. 2192 >>> (x + 1).is_real()
◆ sort()