Z3
 
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
FPRef Class Reference
+ Inheritance diagram for FPRef:

Public Member Functions

 sort (self)
 
 ebits (self)
 
 sbits (self)
 
 as_string (self)
 
 __le__ (self, other)
 
 __lt__ (self, other)
 
 __ge__ (self, other)
 
 __gt__ (self, other)
 
 __add__ (self, other)
 
 __radd__ (self, other)
 
 __sub__ (self, other)
 
 __rsub__ (self, other)
 
 __mul__ (self, other)
 
 __rmul__ (self, other)
 
 __pos__ (self)
 
 __neg__ (self)
 
 __div__ (self, other)
 
 __rdiv__ (self, other)
 
 __truediv__ (self, other)
 
 __rtruediv__ (self, other)
 
 __mod__ (self, other)
 
 __rmod__ (self, other)
 
- Public Member Functions inherited from ExprRef
 as_ast (self)
 
 get_id (self)
 
 sort_kind (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __ne__ (self, other)
 
 params (self)
 
 decl (self)
 
 kind (self)
 
 num_args (self)
 
 arg (self, idx)
 
 children (self)
 
 update (self, *args)
 
 from_string (self, s)
 
 serialize (self)
 
- Public Member Functions inherited from AstRef
 __init__ (self, ast, ctx=None)
 
 __del__ (self)
 
 __deepcopy__ (self, memo={})
 
 __str__ (self)
 
 __repr__ (self)
 
 __nonzero__ (self)
 
 __bool__ (self)
 
 sexpr (self)
 
 ctx_ref (self)
 
 eq (self, other)
 
 translate (self, target)
 
 __copy__ (self)
 
 hash (self)
 
 py_value (self)
 
- Public Member Functions inherited from Z3PPObject
 use_pp (self)
 

Data Fields

 ctx
 
- Data Fields inherited from ExprRef
 ctx
 
 ast
 
- Data Fields inherited from AstRef
 ast
 
 ctx
 

Additional Inherited Members

- Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)
 

Detailed Description

Floating-point expressions.

Definition at line 9811 of file z3py.py.

Member Function Documentation

◆ __add__()

__add__ (   self,
  other 
)
Create the Z3 expression `self + other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x + y
x + y
>>> (x + y).sort()
FPSort(8, 24)

Definition at line 9857 of file z3py.py.

9857 def __add__(self, other):
9858 """Create the Z3 expression `self + other`.
9859
9860 >>> x = FP('x', FPSort(8, 24))
9861 >>> y = FP('y', FPSort(8, 24))
9862 >>> x + y
9863 x + y
9864 >>> (x + y).sort()
9865 FPSort(8, 24)
9866 """
9867 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9868 return fpAdd(_dflt_rm(), a, b, self.ctx)
9869

◆ __div__()

__div__ (   self,
  other 
)
Create the Z3 expression `self / other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x / y
x / y
>>> (x / y).sort()
FPSort(8, 24)
>>> 10 / y
1.25*(2**3) / y

Definition at line 9944 of file z3py.py.

9944 def __div__(self, other):
9945 """Create the Z3 expression `self / other`.
9946
9947 >>> x = FP('x', FPSort(8, 24))
9948 >>> y = FP('y', FPSort(8, 24))
9949 >>> x / y
9950 x / y
9951 >>> (x / y).sort()
9952 FPSort(8, 24)
9953 >>> 10 / y
9954 1.25*(2**3) / y
9955 """
9956 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9957 return fpDiv(_dflt_rm(), a, b, self.ctx)
9958

Referenced by ArithRef.__truediv__(), and BitVecRef.__truediv__().

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 9851 of file z3py.py.

9851 def __ge__(self, other):
9852 return fpGEQ(self, other, self.ctx)
9853

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 9854 of file z3py.py.

9854 def __gt__(self, other):
9855 return fpGT(self, other, self.ctx)
9856

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 9845 of file z3py.py.

9845 def __le__(self, other):
9846 return fpLEQ(self, other, self.ctx)
9847

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 9848 of file z3py.py.

9848 def __lt__(self, other):
9849 return fpLT(self, other, self.ctx)
9850

◆ __mod__()

__mod__ (   self,
  other 
)
Create the Z3 expression mod `self % other`.

Definition at line 9980 of file z3py.py.

9980 def __mod__(self, other):
9981 """Create the Z3 expression mod `self % other`."""
9982 return fpRem(self, other)
9983

◆ __mul__()

__mul__ (   self,
  other 
)
Create the Z3 expression `self * other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x * y
x * y
>>> (x * y).sort()
FPSort(8, 24)
>>> 10 * y
1.25*(2**3) * y

Definition at line 9903 of file z3py.py.

9903 def __mul__(self, other):
9904 """Create the Z3 expression `self * other`.
9905
9906 >>> x = FP('x', FPSort(8, 24))
9907 >>> y = FP('y', FPSort(8, 24))
9908 >>> x * y
9909 x * y
9910 >>> (x * y).sort()
9911 FPSort(8, 24)
9912 >>> 10 * y
9913 1.25*(2**3) * y
9914 """
9915 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9916 return fpMul(_dflt_rm(), a, b, self.ctx)
9917

◆ __neg__()

__neg__ (   self)
Create the Z3 expression `-self`.

>>> x = FP('x', Float32())
>>> -x
-x

Definition at line 9935 of file z3py.py.

9935 def __neg__(self):
9936 """Create the Z3 expression `-self`.
9937
9938 >>> x = FP('x', Float32())
9939 >>> -x
9940 -x
9941 """
9942 return fpNeg(self)
9943

◆ __pos__()

__pos__ (   self)
Create the Z3 expression `+self`.

Definition at line 9931 of file z3py.py.

9931 def __pos__(self):
9932 """Create the Z3 expression `+self`."""
9933 return self
9934

◆ __radd__()

__radd__ (   self,
  other 
)
Create the Z3 expression `other + self`.

>>> x = FP('x', FPSort(8, 24))
>>> 10 + x
1.25*(2**3) + x

Definition at line 9870 of file z3py.py.

9870 def __radd__(self, other):
9871 """Create the Z3 expression `other + self`.
9872
9873 >>> x = FP('x', FPSort(8, 24))
9874 >>> 10 + x
9875 1.25*(2**3) + x
9876 """
9877 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9878 return fpAdd(_dflt_rm(), a, b, self.ctx)
9879

◆ __rdiv__()

__rdiv__ (   self,
  other 
)
Create the Z3 expression `other / self`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x / y
x / y
>>> x / 10
x / 1.25*(2**3)

Definition at line 9959 of file z3py.py.

9959 def __rdiv__(self, other):
9960 """Create the Z3 expression `other / self`.
9961
9962 >>> x = FP('x', FPSort(8, 24))
9963 >>> y = FP('y', FPSort(8, 24))
9964 >>> x / y
9965 x / y
9966 >>> x / 10
9967 x / 1.25*(2**3)
9968 """
9969 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9970 return fpDiv(_dflt_rm(), a, b, self.ctx)
9971

Referenced by ArithRef.__rtruediv__(), and BitVecRef.__rtruediv__().

◆ __rmod__()

__rmod__ (   self,
  other 
)
Create the Z3 expression mod `other % self`.

Definition at line 9984 of file z3py.py.

9984 def __rmod__(self, other):
9985 """Create the Z3 expression mod `other % self`."""
9986 return fpRem(other, self)
9987
9988

◆ __rmul__()

__rmul__ (   self,
  other 
)
Create the Z3 expression `other * self`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x * y
x * y
>>> x * 10
x * 1.25*(2**3)

Definition at line 9918 of file z3py.py.

9918 def __rmul__(self, other):
9919 """Create the Z3 expression `other * self`.
9920
9921 >>> x = FP('x', FPSort(8, 24))
9922 >>> y = FP('y', FPSort(8, 24))
9923 >>> x * y
9924 x * y
9925 >>> x * 10
9926 x * 1.25*(2**3)
9927 """
9928 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9929 return fpMul(_dflt_rm(), a, b, self.ctx)
9930

◆ __rsub__()

__rsub__ (   self,
  other 
)
Create the Z3 expression `other - self`.

>>> x = FP('x', FPSort(8, 24))
>>> 10 - x
1.25*(2**3) - x

Definition at line 9893 of file z3py.py.

9893 def __rsub__(self, other):
9894 """Create the Z3 expression `other - self`.
9895
9896 >>> x = FP('x', FPSort(8, 24))
9897 >>> 10 - x
9898 1.25*(2**3) - x
9899 """
9900 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9901 return fpSub(_dflt_rm(), a, b, self.ctx)
9902

◆ __rtruediv__()

__rtruediv__ (   self,
  other 
)
Create the Z3 expression division `other / self`.

Definition at line 9976 of file z3py.py.

9976 def __rtruediv__(self, other):
9977 """Create the Z3 expression division `other / self`."""
9978 return self.__rdiv__(other)
9979

◆ __sub__()

__sub__ (   self,
  other 
)
Create the Z3 expression `self - other`.

>>> x = FP('x', FPSort(8, 24))
>>> y = FP('y', FPSort(8, 24))
>>> x - y
x - y
>>> (x - y).sort()
FPSort(8, 24)

Definition at line 9880 of file z3py.py.

9880 def __sub__(self, other):
9881 """Create the Z3 expression `self - other`.
9882
9883 >>> x = FP('x', FPSort(8, 24))
9884 >>> y = FP('y', FPSort(8, 24))
9885 >>> x - y
9886 x - y
9887 >>> (x - y).sort()
9888 FPSort(8, 24)
9889 """
9890 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9891 return fpSub(_dflt_rm(), a, b, self.ctx)
9892

◆ __truediv__()

__truediv__ (   self,
  other 
)
Create the Z3 expression division `self / other`.

Definition at line 9972 of file z3py.py.

9972 def __truediv__(self, other):
9973 """Create the Z3 expression division `self / other`."""
9974 return self.__div__(other)
9975

◆ as_string()

as_string (   self)
Return a Z3 floating point expression as a Python string.

Reimplemented in FPNumRef.

Definition at line 9841 of file z3py.py.

9841 def as_string(self):
9842 """Return a Z3 floating point expression as a Python string."""
9843 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9844
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.

Referenced by IntNumRef.as_long(), and BitVecNumRef.as_long().

◆ ebits()

ebits (   self)
Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
>>> b = FPSort(8, 24)
>>> b.ebits()
8

Definition at line 9825 of file z3py.py.

9825 def ebits(self):
9826 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9827 >>> b = FPSort(8, 24)
9828 >>> b.ebits()
9829 8
9830 """
9831 return self.sort().ebits()
9832

◆ sbits()

sbits (   self)
Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
>>> b = FPSort(8, 24)
>>> b.sbits()
24

Definition at line 9833 of file z3py.py.

9833 def sbits(self):
9834 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9835 >>> b = FPSort(8, 24)
9836 >>> b.sbits()
9837 24
9838 """
9839 return self.sort().sbits()
9840

◆ sort()

sort (   self)
Return the sort of the floating-point expression `self`.

>>> x = FP('1.0', FPSort(8, 24))
>>> x.sort()
FPSort(8, 24)
>>> x.sort() == FPSort(8, 24)
True

Reimplemented from ExprRef.

Definition at line 9814 of file z3py.py.

9814 def sort(self):
9815 """Return the sort of the floating-point expression `self`.
9816
9817 >>> x = FP('1.0', FPSort(8, 24))
9818 >>> x.sort()
9819 FPSort(8, 24)
9820 >>> x.sort() == FPSort(8, 24)
9821 True
9822 """
9823 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9824
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by ArrayRef.domain(), ArrayRef.domain_n(), ArithRef.is_int(), ArithRef.is_real(), ArrayRef.range(), BitVecRef.size(), and ExprRef.sort_kind().

Field Documentation

◆ ctx

ctx

Definition at line 9823 of file z3py.py.

Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), AstMap.__contains__(), AstRef.__copy__(), Goal.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), ModelRef.__copy__(), AstRef.__deepcopy__(), Datatype.__deepcopy__(), ParamsRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), Goal.__deepcopy__(), AstVector.__deepcopy__(), AstMap.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), ModelRef.__deepcopy__(), Statistics.__deepcopy__(), Context.__del__(), AstRef.__del__(), ScopedConstructor.__del__(), ScopedConstructorList.__del__(), ParamsRef.__del__(), ParamDescrsRef.__del__(), Goal.__del__(), AstVector.__del__(), AstMap.__del__(), FuncEntry.__del__(), FuncInterp.__del__(), ModelRef.__del__(), Statistics.__del__(), Solver.__del__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), AstVector.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), AstMap.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), AstVector.__len__(), AstMap.__len__(), ModelRef.__len__(), Statistics.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BoolRef.__mul__(), ArithRef.__mul__(), BitVecRef.__mul__(), ExprRef.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), ParamsRef.__repr__(), ParamDescrsRef.__repr__(), AstMap.__repr__(), Statistics.__repr__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), AstVector.__setitem__(), AstMap.__setitem__(), ArithRef.__sub__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), ExprRef.arg(), FuncEntry.arg_value(), FuncInterp.arity(), Goal.as_expr(), Solver.assert_and_track(), Goal.assert_exprs(), Solver.assert_exprs(), QuantifierRef.body(), Solver.check(), Goal.convert_model(), AstRef.ctx_ref(), ExprRef.decl(), ModelRef.decls(), ArrayRef.default(), RatNumRef.denominator(), Goal.depth(), Goal.dimacs(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FuncInterp.else_value(), FuncInterp.entry(), AstMap.erase(), ModelRef.eval(), Goal.get(), ParamDescrsRef.get_documentation(), ModelRef.get_interp(), Statistics.get_key_value(), ParamDescrsRef.get_kind(), ParamDescrsRef.get_name(), ModelRef.get_sort(), ModelRef.get_universe(), Goal.inconsistent(), AstMap.keys(), Statistics.keys(), Solver.model(), SortRef.name(), QuantifierRef.no_pattern(), FuncEntry.num_args(), FuncInterp.num_entries(), Solver.num_scopes(), ModelRef.num_sorts(), FuncDeclRef.params(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), Solver.pop(), Goal.prec(), ModelRef.project(), ModelRef.project_with_witness(), Solver.push(), AstVector.push(), QuantifierRef.qid(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), Context.ref(), AstMap.reset(), Solver.reset(), AstVector.resize(), Solver.set(), ParamsRef.set(), Goal.sexpr(), AstVector.sexpr(), ModelRef.sexpr(), ParamDescrsRef.size(), Goal.size(), QuantifierRef.skolem_id(), AstVector.translate(), AstRef.translate(), Goal.translate(), ModelRef.translate(), ExprRef.update(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().