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 (self)
 
 sort_kind (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __ne__ (self, other)
 
 params (self)
 
 decl (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)
 
 __eq__ (self, other)
 
 __hash__ (self)
 
 __nonzero__ (self)
 
 __bool__ (self)
 
 sexpr (self)
 
 as_ast (self)
 
 get_id (self)
 
 ctx_ref (self)
 
 eq (self, other)
 
 translate (self, target)
 
 __copy__ (self)
 
 hash (self)
 
- Public Member Functions inherited from Z3PPObject
 use_pp (self)
 

Data Fields

 ctx
 
- Data Fields inherited from ExprRef
 ctx
 
- 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 9596 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 9642 of file z3py.py.

9642 def __add__(self, other):
9643 """Create the Z3 expression `self + other`.
9644
9645 >>> x = FP('x', FPSort(8, 24))
9646 >>> y = FP('y', FPSort(8, 24))
9647 >>> x + y
9648 x + y
9649 >>> (x + y).sort()
9650 FPSort(8, 24)
9651 """
9652 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9653 return fpAdd(_dflt_rm(), a, b, self.ctx)
9654

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

9729 def __div__(self, other):
9730 """Create the Z3 expression `self / other`.
9731
9732 >>> x = FP('x', FPSort(8, 24))
9733 >>> y = FP('y', FPSort(8, 24))
9734 >>> x / y
9735 x / y
9736 >>> (x / y).sort()
9737 FPSort(8, 24)
9738 >>> 10 / y
9739 1.25*(2**3) / y
9740 """
9741 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9742 return fpDiv(_dflt_rm(), a, b, self.ctx)
9743

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 9636 of file z3py.py.

9636 def __ge__(self, other):
9637 return fpGEQ(self, other, self.ctx)
9638

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 9639 of file z3py.py.

9639 def __gt__(self, other):
9640 return fpGT(self, other, self.ctx)
9641

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 9630 of file z3py.py.

9630 def __le__(self, other):
9631 return fpLEQ(self, other, self.ctx)
9632

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 9633 of file z3py.py.

9633 def __lt__(self, other):
9634 return fpLT(self, other, self.ctx)
9635

◆ __mod__()

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

Definition at line 9765 of file z3py.py.

9765 def __mod__(self, other):
9766 """Create the Z3 expression mod `self % other`."""
9767 return fpRem(self, other)
9768

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

9688 def __mul__(self, other):
9689 """Create the Z3 expression `self * other`.
9690
9691 >>> x = FP('x', FPSort(8, 24))
9692 >>> y = FP('y', FPSort(8, 24))
9693 >>> x * y
9694 x * y
9695 >>> (x * y).sort()
9696 FPSort(8, 24)
9697 >>> 10 * y
9698 1.25*(2**3) * y
9699 """
9700 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9701 return fpMul(_dflt_rm(), a, b, self.ctx)
9702

◆ __neg__()

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

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

Definition at line 9720 of file z3py.py.

9720 def __neg__(self):
9721 """Create the Z3 expression `-self`.
9722
9723 >>> x = FP('x', Float32())
9724 >>> -x
9725 -x
9726 """
9727 return fpNeg(self)
9728

◆ __pos__()

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

Definition at line 9716 of file z3py.py.

9716 def __pos__(self):
9717 """Create the Z3 expression `+self`."""
9718 return self
9719

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

9655 def __radd__(self, other):
9656 """Create the Z3 expression `other + self`.
9657
9658 >>> x = FP('x', FPSort(8, 24))
9659 >>> 10 + x
9660 1.25*(2**3) + x
9661 """
9662 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9663 return fpAdd(_dflt_rm(), a, b, self.ctx)
9664

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

9744 def __rdiv__(self, other):
9745 """Create the Z3 expression `other / self`.
9746
9747 >>> x = FP('x', FPSort(8, 24))
9748 >>> y = FP('y', FPSort(8, 24))
9749 >>> x / y
9750 x / y
9751 >>> x / 10
9752 x / 1.25*(2**3)
9753 """
9754 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9755 return fpDiv(_dflt_rm(), a, b, self.ctx)
9756

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

◆ __rmod__()

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

Definition at line 9769 of file z3py.py.

9769 def __rmod__(self, other):
9770 """Create the Z3 expression mod `other % self`."""
9771 return fpRem(other, self)
9772
9773

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

9703 def __rmul__(self, other):
9704 """Create the Z3 expression `other * self`.
9705
9706 >>> x = FP('x', FPSort(8, 24))
9707 >>> y = FP('y', FPSort(8, 24))
9708 >>> x * y
9709 x * y
9710 >>> x * 10
9711 x * 1.25*(2**3)
9712 """
9713 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9714 return fpMul(_dflt_rm(), a, b, self.ctx)
9715

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

9678 def __rsub__(self, other):
9679 """Create the Z3 expression `other - self`.
9680
9681 >>> x = FP('x', FPSort(8, 24))
9682 >>> 10 - x
9683 1.25*(2**3) - x
9684 """
9685 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9686 return fpSub(_dflt_rm(), a, b, self.ctx)
9687

◆ __rtruediv__()

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

Definition at line 9761 of file z3py.py.

9761 def __rtruediv__(self, other):
9762 """Create the Z3 expression division `other / self`."""
9763 return self.__rdiv__(other)
9764

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

9665 def __sub__(self, other):
9666 """Create the Z3 expression `self - other`.
9667
9668 >>> x = FP('x', FPSort(8, 24))
9669 >>> y = FP('y', FPSort(8, 24))
9670 >>> x - y
9671 x - y
9672 >>> (x - y).sort()
9673 FPSort(8, 24)
9674 """
9675 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9676 return fpSub(_dflt_rm(), a, b, self.ctx)
9677

◆ __truediv__()

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

Definition at line 9757 of file z3py.py.

9757 def __truediv__(self, other):
9758 """Create the Z3 expression division `self / other`."""
9759 return self.__div__(other)
9760

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9626 of file z3py.py.

9626 def as_string(self):
9627 """Return a Z3 floating point expression as a Python string."""
9628 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9629
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(), BitVecNumRef.as_long(), and FiniteDomainNumRef.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 9610 of file z3py.py.

9610 def ebits(self):
9611 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9612 >>> b = FPSort(8, 24)
9613 >>> b.ebits()
9614 8
9615 """
9616 return self.sort().ebits()
9617

Referenced by FPRef.ebits().

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

9618 def sbits(self):
9619 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9620 >>> b = FPSort(8, 24)
9621 >>> b.sbits()
9622 24
9623 """
9624 return self.sort().sbits()
9625

Referenced by FPRef.sbits().

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

9599 def sort(self):
9600 """Return the sort of the floating-point expression `self`.
9601
9602 >>> x = FP('1.0', FPSort(8, 24))
9603 >>> x.sort()
9604 FPSort(8, 24)
9605 >>> x.sort() == FPSort(8, 24)
9606 True
9607 """
9608 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9609
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by FPRef.__add__(), FPRef.__div__(), FPRef.__mul__(), FPRef.__sub__(), FPNumRef.as_string(), ArrayRef.domain(), ArrayRef.domain_n(), FPRef.ebits(), ArithRef.is_int(), ArithRef.is_real(), ArrayRef.range(), FPRef.sbits(), BitVecRef.size(), and ExprRef.sort_kind().

Field Documentation

◆ ctx

ctx

Definition at line 9608 of file z3py.py.

Referenced by ArithRef.__add__(), BitVecRef.__add__(), FPRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), Probe.__call__(), AstMap.__contains__(), AstRef.__copy__(), Goal.__copy__(), AstVector.__copy__(), FuncInterp.__copy__(), ModelRef.__copy__(), Solver.__copy__(), AstRef.__deepcopy__(), Datatype.__deepcopy__(), ParamsRef.__deepcopy__(), ParamDescrsRef.__deepcopy__(), Goal.__deepcopy__(), AstVector.__deepcopy__(), AstMap.__deepcopy__(), FuncEntry.__deepcopy__(), FuncInterp.__deepcopy__(), ModelRef.__deepcopy__(), Statistics.__deepcopy__(), Solver.__deepcopy__(), Fixedpoint.__deepcopy__(), Optimize.__deepcopy__(), ApplyResult.__deepcopy__(), Simplifier.__deepcopy__(), Tactic.__deepcopy__(), Probe.__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__(), Fixedpoint.__del__(), Optimize.__del__(), ApplyResult.__del__(), Simplifier.__del__(), Tactic.__del__(), Probe.__del__(), ParserContext.__del__(), ArithRef.__div__(), BitVecRef.__div__(), FPRef.__div__(), ExprRef.__eq__(), Probe.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), Probe.__ge__(), FPRef.__ge__(), SeqRef.__ge__(), AstVector.__getitem__(), SeqRef.__getitem__(), ModelRef.__getitem__(), Statistics.__getitem__(), ApplyResult.__getitem__(), AstMap.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), Probe.__gt__(), FPRef.__gt__(), SeqRef.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), Probe.__le__(), FPRef.__le__(), SeqRef.__le__(), CharRef.__le__(), AstVector.__len__(), AstMap.__len__(), ModelRef.__len__(), Statistics.__len__(), ApplyResult.__len__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), Probe.__lt__(), FPRef.__lt__(), SeqRef.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), BoolRef.__mul__(), ArithRef.__mul__(), BitVecRef.__mul__(), FPRef.__mul__(), ExprRef.__ne__(), Probe.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), FPRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), FPRef.__rdiv__(), ParamsRef.__repr__(), ParamDescrsRef.__repr__(), AstMap.__repr__(), Statistics.__repr__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), FPRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), FPRef.__rsub__(), BitVecRef.__rxor__(), AstVector.__setitem__(), AstMap.__setitem__(), ArithRef.__sub__(), BitVecRef.__sub__(), FPRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), Simplifier.add(), Fixedpoint.add_cover(), ParserContext.add_decl(), Fixedpoint.add_rule(), Optimize.add_soft(), ParserContext.add_sort(), Tactic.apply(), ExprRef.arg(), FuncEntry.arg_value(), FuncInterp.arity(), Goal.as_expr(), ApplyResult.as_expr(), FPNumRef.as_string(), Solver.assert_and_track(), Optimize.assert_and_track(), Goal.assert_exprs(), Solver.assert_exprs(), Fixedpoint.assert_exprs(), Optimize.assert_exprs(), Solver.assertions(), Optimize.assertions(), SeqRef.at(), QuantifierRef.body(), Solver.check(), Optimize.check(), UserPropagateBase.conflict(), Solver.consequences(), Goal.convert_model(), AstRef.ctx_ref(), UserPropagateBase.ctx_ref(), ExprRef.decl(), ModelRef.decls(), ArrayRef.default(), RatNumRef.denominator(), Goal.depth(), Goal.dimacs(), Solver.dimacs(), FuncDeclRef.domain(), ArraySortRef.domain_n(), FuncInterp.else_value(), FuncInterp.entry(), AstMap.erase(), ModelRef.eval(), FPNumRef.exponent(), FPNumRef.exponent_as_bv(), FPNumRef.exponent_as_long(), Solver.from_file(), Optimize.from_file(), Solver.from_string(), Optimize.from_string(), ParserContext.from_string(), Goal.get(), Fixedpoint.get_answer(), Fixedpoint.get_assertions(), Fixedpoint.get_cover_delta(), ParamDescrsRef.get_documentation(), Fixedpoint.get_ground_sat_answer(), ModelRef.get_interp(), Statistics.get_key_value(), ParamDescrsRef.get_kind(), ParamDescrsRef.get_name(), Fixedpoint.get_num_levels(), Fixedpoint.get_rule_names_along_trace(), Fixedpoint.get_rules(), Fixedpoint.get_rules_along_trace(), ModelRef.get_sort(), ModelRef.get_universe(), Solver.help(), Fixedpoint.help(), Optimize.help(), Simplifier.help(), Tactic.help(), Solver.import_model_converter(), Goal.inconsistent(), Solver.interrupt(), CharRef.is_digit(), FPNumRef.isInf(), FPNumRef.isNaN(), FPNumRef.isNegative(), FPNumRef.isNormal(), FPNumRef.isPositive(), FPNumRef.isSubnormal(), FPNumRef.isZero(), AstMap.keys(), Statistics.keys(), Optimize.maximize(), Optimize.minimize(), Solver.model(), Optimize.model(), SortRef.name(), Solver.next(), QuantifierRef.no_pattern(), Solver.non_units(), FuncEntry.num_args(), FuncInterp.num_entries(), Solver.num_scopes(), ModelRef.num_sorts(), Optimize.objectives(), Solver.param_descrs(), Fixedpoint.param_descrs(), Optimize.param_descrs(), Simplifier.param_descrs(), Tactic.param_descrs(), FuncDeclRef.params(), Fixedpoint.parse_file(), Fixedpoint.parse_string(), QuantifierRef.pattern(), AlgebraicNumRef.poly(), Optimize.pop(), Solver.pop(), Goal.prec(), Solver.proof(), Solver.push(), Optimize.push(), AstVector.push(), QuantifierRef.qid(), Fixedpoint.query(), Fixedpoint.query_from_lvl(), FuncDeclRef.range(), ArraySortRef.range(), Solver.reason_unknown(), Fixedpoint.reason_unknown(), Optimize.reason_unknown(), DatatypeSortRef.recognizer(), Context.ref(), Fixedpoint.register_relation(), AstMap.reset(), Solver.reset(), AstVector.resize(), Solver.root(), Solver.set(), Fixedpoint.set(), Optimize.set(), ParamsRef.set(), Optimize.set_on_model(), Fixedpoint.set_predicate_representation(), Goal.sexpr(), AstVector.sexpr(), ModelRef.sexpr(), Solver.sexpr(), Fixedpoint.sexpr(), Optimize.sexpr(), ApplyResult.sexpr(), FPNumRef.sign(), FPNumRef.significand(), FPNumRef.significand_as_bv(), FPNumRef.significand_as_long(), ParamDescrsRef.size(), Goal.size(), QuantifierRef.skolem_id(), Tactic.solver(), Solver.statistics(), Fixedpoint.statistics(), Optimize.statistics(), CharRef.to_bv(), CharRef.to_int(), Solver.to_smt2(), Fixedpoint.to_string(), Solver.trail(), Solver.trail_levels(), AstVector.translate(), AstRef.translate(), Goal.translate(), ModelRef.translate(), Solver.translate(), Solver.units(), Solver.unsat_core(), Optimize.unsat_core(), Fixedpoint.update_rule(), Simplifier.using_params(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().