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)
 
 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 9767 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 9813 of file z3py.py.

9813 def __add__(self, other):
9814 """Create the Z3 expression `self + other`.
9815
9816 >>> x = FP('x', FPSort(8, 24))
9817 >>> y = FP('y', FPSort(8, 24))
9818 >>> x + y
9819 x + y
9820 >>> (x + y).sort()
9821 FPSort(8, 24)
9822 """
9823 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9824 return fpAdd(_dflt_rm(), a, b, self.ctx)
9825

◆ __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 9900 of file z3py.py.

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

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 9807 of file z3py.py.

9807 def __ge__(self, other):
9808 return fpGEQ(self, other, self.ctx)
9809

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 9810 of file z3py.py.

9810 def __gt__(self, other):
9811 return fpGT(self, other, self.ctx)
9812

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 9801 of file z3py.py.

9801 def __le__(self, other):
9802 return fpLEQ(self, other, self.ctx)
9803

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 9804 of file z3py.py.

9804 def __lt__(self, other):
9805 return fpLT(self, other, self.ctx)
9806

◆ __mod__()

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

Definition at line 9936 of file z3py.py.

9936 def __mod__(self, other):
9937 """Create the Z3 expression mod `self % other`."""
9938 return fpRem(self, other)
9939

◆ __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 9859 of file z3py.py.

9859 def __mul__(self, other):
9860 """Create the Z3 expression `self * other`.
9861
9862 >>> x = FP('x', FPSort(8, 24))
9863 >>> y = FP('y', FPSort(8, 24))
9864 >>> x * y
9865 x * y
9866 >>> (x * y).sort()
9867 FPSort(8, 24)
9868 >>> 10 * y
9869 1.25*(2**3) * y
9870 """
9871 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9872 return fpMul(_dflt_rm(), a, b, self.ctx)
9873

◆ __neg__()

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

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

Definition at line 9891 of file z3py.py.

9891 def __neg__(self):
9892 """Create the Z3 expression `-self`.
9893
9894 >>> x = FP('x', Float32())
9895 >>> -x
9896 -x
9897 """
9898 return fpNeg(self)
9899

◆ __pos__()

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

Definition at line 9887 of file z3py.py.

9887 def __pos__(self):
9888 """Create the Z3 expression `+self`."""
9889 return self
9890

◆ __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 9826 of file z3py.py.

9826 def __radd__(self, other):
9827 """Create the Z3 expression `other + self`.
9828
9829 >>> x = FP('x', FPSort(8, 24))
9830 >>> 10 + x
9831 1.25*(2**3) + x
9832 """
9833 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9834 return fpAdd(_dflt_rm(), a, b, self.ctx)
9835

◆ __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 9915 of file z3py.py.

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

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

◆ __rmod__()

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

Definition at line 9940 of file z3py.py.

9940 def __rmod__(self, other):
9941 """Create the Z3 expression mod `other % self`."""
9942 return fpRem(other, self)
9943
9944

◆ __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 9874 of file z3py.py.

9874 def __rmul__(self, other):
9875 """Create the Z3 expression `other * self`.
9876
9877 >>> x = FP('x', FPSort(8, 24))
9878 >>> y = FP('y', FPSort(8, 24))
9879 >>> x * y
9880 x * y
9881 >>> x * 10
9882 x * 1.25*(2**3)
9883 """
9884 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9885 return fpMul(_dflt_rm(), a, b, self.ctx)
9886

◆ __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 9849 of file z3py.py.

9849 def __rsub__(self, other):
9850 """Create the Z3 expression `other - self`.
9851
9852 >>> x = FP('x', FPSort(8, 24))
9853 >>> 10 - x
9854 1.25*(2**3) - x
9855 """
9856 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9857 return fpSub(_dflt_rm(), a, b, self.ctx)
9858

◆ __rtruediv__()

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

Definition at line 9932 of file z3py.py.

9932 def __rtruediv__(self, other):
9933 """Create the Z3 expression division `other / self`."""
9934 return self.__rdiv__(other)
9935

◆ __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 9836 of file z3py.py.

9836 def __sub__(self, other):
9837 """Create the Z3 expression `self - other`.
9838
9839 >>> x = FP('x', FPSort(8, 24))
9840 >>> y = FP('y', FPSort(8, 24))
9841 >>> x - y
9842 x - y
9843 >>> (x - y).sort()
9844 FPSort(8, 24)
9845 """
9846 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9847 return fpSub(_dflt_rm(), a, b, self.ctx)
9848

◆ __truediv__()

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

Definition at line 9928 of file z3py.py.

9928 def __truediv__(self, other):
9929 """Create the Z3 expression division `self / other`."""
9930 return self.__div__(other)
9931

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9797 of file z3py.py.

9797 def as_string(self):
9798 """Return a Z3 floating point expression as a Python string."""
9799 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9800
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 9781 of file z3py.py.

9781 def ebits(self):
9782 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9783 >>> b = FPSort(8, 24)
9784 >>> b.ebits()
9785 8
9786 """
9787 return self.sort().ebits()
9788

◆ 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 9789 of file z3py.py.

9789 def sbits(self):
9790 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9791 >>> b = FPSort(8, 24)
9792 >>> b.sbits()
9793 24
9794 """
9795 return self.sort().sbits()
9796

◆ 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 9770 of file z3py.py.

9770 def sort(self):
9771 """Return the sort of the floating-point expression `self`.
9772
9773 >>> x = FP('1.0', FPSort(8, 24))
9774 >>> x.sort()
9775 FPSort(8, 24)
9776 >>> x.sort() == FPSort(8, 24)
9777 True
9778 """
9779 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9780
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 9779 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(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().