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 9528 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 9574 of file z3py.py.

9574 def __add__(self, other):
9575 """Create the Z3 expression `self + other`.
9576
9577 >>> x = FP('x', FPSort(8, 24))
9578 >>> y = FP('y', FPSort(8, 24))
9579 >>> x + y
9580 x + y
9581 >>> (x + y).sort()
9582 FPSort(8, 24)
9583 """
9584 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9585 return fpAdd(_dflt_rm(), a, b, self.ctx)
9586

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

9661 def __div__(self, other):
9662 """Create the Z3 expression `self / other`.
9663
9664 >>> x = FP('x', FPSort(8, 24))
9665 >>> y = FP('y', FPSort(8, 24))
9666 >>> x / y
9667 x / y
9668 >>> (x / y).sort()
9669 FPSort(8, 24)
9670 >>> 10 / y
9671 1.25*(2**3) / y
9672 """
9673 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9674 return fpDiv(_dflt_rm(), a, b, self.ctx)
9675

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 9568 of file z3py.py.

9568 def __ge__(self, other):
9569 return fpGEQ(self, other, self.ctx)
9570

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 9571 of file z3py.py.

9571 def __gt__(self, other):
9572 return fpGT(self, other, self.ctx)
9573

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 9562 of file z3py.py.

9562 def __le__(self, other):
9563 return fpLEQ(self, other, self.ctx)
9564

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 9565 of file z3py.py.

9565 def __lt__(self, other):
9566 return fpLT(self, other, self.ctx)
9567

◆ __mod__()

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

Definition at line 9697 of file z3py.py.

9697 def __mod__(self, other):
9698 """Create the Z3 expression mod `self % other`."""
9699 return fpRem(self, other)
9700

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

9620 def __mul__(self, other):
9621 """Create the Z3 expression `self * other`.
9622
9623 >>> x = FP('x', FPSort(8, 24))
9624 >>> y = FP('y', FPSort(8, 24))
9625 >>> x * y
9626 x * y
9627 >>> (x * y).sort()
9628 FPSort(8, 24)
9629 >>> 10 * y
9630 1.25*(2**3) * y
9631 """
9632 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9633 return fpMul(_dflt_rm(), a, b, self.ctx)
9634

◆ __neg__()

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

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

Definition at line 9652 of file z3py.py.

9652 def __neg__(self):
9653 """Create the Z3 expression `-self`.
9654
9655 >>> x = FP('x', Float32())
9656 >>> -x
9657 -x
9658 """
9659 return fpNeg(self)
9660

◆ __pos__()

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

Definition at line 9648 of file z3py.py.

9648 def __pos__(self):
9649 """Create the Z3 expression `+self`."""
9650 return self
9651

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

9587 def __radd__(self, other):
9588 """Create the Z3 expression `other + self`.
9589
9590 >>> x = FP('x', FPSort(8, 24))
9591 >>> 10 + x
9592 1.25*(2**3) + x
9593 """
9594 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9595 return fpAdd(_dflt_rm(), a, b, self.ctx)
9596

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

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

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

◆ __rmod__()

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

Definition at line 9701 of file z3py.py.

9701 def __rmod__(self, other):
9702 """Create the Z3 expression mod `other % self`."""
9703 return fpRem(other, self)
9704
9705

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

9635 def __rmul__(self, other):
9636 """Create the Z3 expression `other * self`.
9637
9638 >>> x = FP('x', FPSort(8, 24))
9639 >>> y = FP('y', FPSort(8, 24))
9640 >>> x * y
9641 x * y
9642 >>> x * 10
9643 x * 1.25*(2**3)
9644 """
9645 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9646 return fpMul(_dflt_rm(), a, b, self.ctx)
9647

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

9610 def __rsub__(self, other):
9611 """Create the Z3 expression `other - self`.
9612
9613 >>> x = FP('x', FPSort(8, 24))
9614 >>> 10 - x
9615 1.25*(2**3) - x
9616 """
9617 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
9618 return fpSub(_dflt_rm(), a, b, self.ctx)
9619

◆ __rtruediv__()

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

Definition at line 9693 of file z3py.py.

9693 def __rtruediv__(self, other):
9694 """Create the Z3 expression division `other / self`."""
9695 return self.__rdiv__(other)
9696

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

9597 def __sub__(self, other):
9598 """Create the Z3 expression `self - other`.
9599
9600 >>> x = FP('x', FPSort(8, 24))
9601 >>> y = FP('y', FPSort(8, 24))
9602 >>> x - y
9603 x - y
9604 >>> (x - y).sort()
9605 FPSort(8, 24)
9606 """
9607 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
9608 return fpSub(_dflt_rm(), a, b, self.ctx)
9609

◆ __truediv__()

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

Definition at line 9689 of file z3py.py.

9689 def __truediv__(self, other):
9690 """Create the Z3 expression division `self / other`."""
9691 return self.__div__(other)
9692

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 9558 of file z3py.py.

9558 def as_string(self):
9559 """Return a Z3 floating point expression as a Python string."""
9560 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
9561
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 9542 of file z3py.py.

9542 def ebits(self):
9543 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9544 >>> b = FPSort(8, 24)
9545 >>> b.ebits()
9546 8
9547 """
9548 return self.sort().ebits()
9549

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

9550 def sbits(self):
9551 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
9552 >>> b = FPSort(8, 24)
9553 >>> b.sbits()
9554 24
9555 """
9556 return self.sort().sbits()
9557

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

9531 def sort(self):
9532 """Return the sort of the floating-point expression `self`.
9533
9534 >>> x = FP('1.0', FPSort(8, 24))
9535 >>> x.sort()
9536 FPSort(8, 24)
9537 >>> x.sort() == FPSort(8, 24)
9538 True
9539 """
9540 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
9541
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 9540 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(), 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(), 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(), 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().