Inheritance diagram for ArithRef:Public Member Functions | |
| def | sort |
| def | is_int |
| def | is_real |
| def | __add__ |
| def | __radd__ |
| def | __mul__ |
| def | __rmul__ |
| def | __sub__ |
| def | __rsub__ |
| def | __pow__ |
| def | __rpow__ |
| def | __div__ |
| def | __truediv__ |
| def | __rdiv__ |
| def | __rtruediv__ |
| def | __mod__ |
| def | __rmod__ |
| def | __neg__ |
| def | __pos__ |
| def | __le__ |
| def | __lt__ |
| def | __gt__ |
| def | __ge__ |
| 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 1980 of file z3py.py.
01980 01981 def __add__(self, other): 01982 """Create the Z3 expression `self + other`. 01983 01984 >>> x = Int('x') 01985 >>> y = Int('y') 01986 >>> x + y 01987 x + y 01988 >>> (x + y).sort() 01989 Int 01990 """ 01991 a, b = _coerce_exprs(self, other) 01992 return ArithRef(_mk_bin(Z3_mk_add, a, b), self.ctx)
| 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 2077 of file z3py.py.
02077 02078 def __div__(self, other): 02079 """Create the Z3 expression `other/self`. 02080 02081 >>> x = Int('x') 02082 >>> y = Int('y') 02083 >>> x/y 02084 x/y 02085 >>> (x/y).sort() 02086 Int 02087 >>> (x/y).sexpr() 02088 '(div x y)' 02089 >>> x = Real('x') 02090 >>> y = Real('y') 02091 >>> x/y 02092 x/y 02093 >>> (x/y).sort() 02094 Real 02095 >>> (x/y).sexpr() 02096 '(/ x y)' 02097 """ 02098 a, b = _coerce_exprs(self, other) 02099 return ArithRef(Z3_mk_div(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2211 of file z3py.py.
02211 02212 def __ge__(self, other): 02213 """Create the Z3 expression `other >= self`. 02214 02215 >>> x, y = Ints('x y') 02216 >>> x >= y 02217 x >= y 02218 >>> y = Real('y') 02219 >>> x >= y 02220 ToReal(x) >= y 02221 """ 02222 a, b = _coerce_exprs(self, other) 02223 return BoolRef(Z3_mk_ge(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2198 of file z3py.py.
02198 02199 def __gt__(self, other): 02200 """Create the Z3 expression `other > self`. 02201 02202 >>> x, y = Ints('x y') 02203 >>> x > y 02204 x > y 02205 >>> y = Real('y') 02206 >>> x > y 02207 ToReal(x) > y 02208 """ 02209 a, b = _coerce_exprs(self, other) 02210 return BoolRef(Z3_mk_gt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2172 of file z3py.py.
02172 02173 def __le__(self, other): 02174 """Create the Z3 expression `other <= self`. 02175 02176 >>> x, y = Ints('x y') 02177 >>> x <= y 02178 x <= y 02179 >>> y = Real('y') 02180 >>> x <= y 02181 ToReal(x) <= y 02182 """ 02183 a, b = _coerce_exprs(self, other) 02184 return BoolRef(Z3_mk_le(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2185 of file z3py.py.
02185 02186 def __lt__(self, other): 02187 """Create the Z3 expression `other < self`. 02188 02189 >>> x, y = Ints('x y') 02190 >>> x < y 02191 x < y 02192 >>> y = Real('y') 02193 >>> x < y 02194 ToReal(x) < y 02195 """ 02196 a, b = _coerce_exprs(self, other) 02197 return BoolRef(Z3_mk_lt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2125 of file z3py.py.
02125 02126 def __mod__(self, other): 02127 """Create the Z3 expression `other%self`. 02128 02129 >>> x = Int('x') 02130 >>> y = Int('y') 02131 >>> x % y 02132 x%y 02133 >>> simplify(IntVal(10) % IntVal(3)) 02134 1 02135 """ 02136 a, b = _coerce_exprs(self, other) 02137 if __debug__: 02138 _z3_assert(a.is_int(), "Z3 integer expression expected") 02139 return ArithRef(Z3_mk_mod(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| 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 2003 of file z3py.py.
02003 02004 def __mul__(self, other): 02005 """Create the Z3 expression `self * other`. 02006 02007 >>> x = Real('x') 02008 >>> y = Real('y') 02009 >>> x * y 02010 x*y 02011 >>> (x * y).sort() 02012 Real 02013 """ 02014 a, b = _coerce_exprs(self, other) 02015 return ArithRef(_mk_bin(Z3_mk_mul, a, b), self.ctx)
| def __neg__ | ( | self | ) |
Return an expression representing `-self`.
>>> x = Int('x')
>>> -x
-x
>>> simplify(-(-x))
x
Definition at line 2152 of file z3py.py.
02152 02153 def __neg__(self): 02154 """Return an expression representing `-self`. 02155 02156 >>> x = Int('x') 02157 >>> -x 02158 -x 02159 >>> simplify(-(-x)) 02160 x 02161 """ 02162 return ArithRef(Z3_mk_unary_minus(self.ctx_ref(), self.as_ast()), self.ctx)
| def __pos__ | ( | self | ) |
| 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 2049 of file z3py.py.
02049 02050 def __pow__(self, other): 02051 """Create the Z3 expression `self**other` (** is the power operator). 02052 02053 >>> x = Real('x') 02054 >>> x**3 02055 x**3 02056 >>> (x**3).sort() 02057 Real 02058 >>> simplify(IntVal(2)**8) 02059 256 02060 """ 02061 a, b = _coerce_exprs(self, other) 02062 return ArithRef(Z3_mk_power(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
| def __radd__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other + self`.
>>> x = Int('x')
>>> 10 + x
10 + x
| 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 2104 of file z3py.py.
02104 02105 def __rdiv__(self, other): 02106 """Create the Z3 expression `other/self`. 02107 02108 >>> x = Int('x') 02109 >>> 10/x 02110 10/x 02111 >>> (10/x).sexpr() 02112 '(div 10 x)' 02113 >>> x = Real('x') 02114 >>> 10/x 02115 10/x 02116 >>> (10/x).sexpr() 02117 '(/ 10.0 x)' 02118 """ 02119 a, b = _coerce_exprs(self, other) 02120 return ArithRef(Z3_mk_div(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
| def __rmod__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other%self`.
>>> x = Int('x')
>>> 10 % x
10%x
Definition at line 2140 of file z3py.py.
02140 02141 def __rmod__(self, other): 02142 """Create the Z3 expression `other%self`. 02143 02144 >>> x = Int('x') 02145 >>> 10 % x 02146 10%x 02147 """ 02148 a, b = _coerce_exprs(self, other) 02149 if __debug__: 02150 _z3_assert(a.is_int(), "Z3 integer expression expected") 02151 return ArithRef(Z3_mk_mod(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
| def __rmul__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other * self`.
>>> x = Real('x')
>>> 10 * x
10*x
| 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 2063 of file z3py.py.
02063 02064 def __rpow__(self, other): 02065 """Create the Z3 expression `other**self` (** is the power operator). 02066 02067 >>> x = Real('x') 02068 >>> 2**x 02069 2**x 02070 >>> (2**x).sort() 02071 Real 02072 >>> simplify(2**IntVal(8)) 02073 256 02074 """ 02075 a, b = _coerce_exprs(self, other) 02076 return ArithRef(Z3_mk_power(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
| def __rsub__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other - self`.
>>> x = Int('x')
>>> 10 - x
10 - x
| def __rtruediv__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other/self`.
Definition at line 2121 of file z3py.py.
02121 02122 def __rtruediv__(self, other): 02123 """Create the Z3 expression `other/self`.""" 02124 return self.__rdiv__(other)
| 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 2026 of file z3py.py.
02026 02027 def __sub__(self, other): 02028 """Create the Z3 expression `self - other`. 02029 02030 >>> x = Int('x') 02031 >>> y = Int('y') 02032 >>> x - y 02033 x - y 02034 >>> (x - y).sort() 02035 Int 02036 """ 02037 a, b = _coerce_exprs(self, other) 02038 return ArithRef(_mk_bin(Z3_mk_sub, a, b), self.ctx)
| def __truediv__ | ( | self, | |
| other | |||
| ) |
Create the Z3 expression `other/self`.
Definition at line 2100 of file z3py.py.
02100 02101 def __truediv__(self, other): 02102 """Create the Z3 expression `other/self`.""" 02103 return self.__div__(other)
| def is_int | ( | self | ) |
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
| def is_real | ( | self | ) |
Return `True` if `self` is an real expression.
>>> x = Real('x')
>>> x.is_real()
True
>>> (x + 1).is_real()
True
| def sort | ( | self | ) |
Return the sort (type) of the arithmetical expression `self`.
>>> Int('x').sort()
Int
>>> (Real('x') + 1).sort()
Real
Reimplemented from ExprRef.
Definition at line 1945 of file z3py.py.
Referenced by ArithRef.__add__(), ArithRef.__div__(), ArithRef.__mul__(), ArithRef.__pow__(), ArithRef.__rpow__(), ArithRef.__sub__(), ArrayRef.domain(), ArithRef.is_int(), ArithRef.is_real(), and ArrayRef.range().
01945 01946 def sort(self): 01947 """Return the sort (type) of the arithmetical expression `self`. 01948 01949 >>> Int('x').sort() 01950 Int 01951 >>> (Real('x') + 1).sort() 01952 Real 01953 """ 01954 return ArithSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
1.7.6.1