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

10482 def __add__(self, other):
10483 """Create the Z3 expression `self + other`.
10484
10485 >>> x = FP('x', FPSort(8, 24))
10486 >>> y = FP('y', FPSort(8, 24))
10487 >>> x + y
10488 x + y
10489 >>> (x + y).sort()
10490 FPSort(8, 24)
10491 """
10492 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10493 return fpAdd(_dflt_rm(), a, b, self.ctx)
10494

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

10569 def __div__(self, other):
10570 """Create the Z3 expression `self / other`.
10571
10572 >>> x = FP('x', FPSort(8, 24))
10573 >>> y = FP('y', FPSort(8, 24))
10574 >>> x / y
10575 x / y
10576 >>> (x / y).sort()
10577 FPSort(8, 24)
10578 >>> 10 / y
10579 1.25*(2**3) / y
10580 """
10581 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10582 return fpDiv(_dflt_rm(), a, b, self.ctx)
10583

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 10476 of file z3py.py.

10476 def __ge__(self, other):
10477 return fpGEQ(self, other, self.ctx)
10478

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 10479 of file z3py.py.

10479 def __gt__(self, other):
10480 return fpGT(self, other, self.ctx)
10481

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 10470 of file z3py.py.

10470 def __le__(self, other):
10471 return fpLEQ(self, other, self.ctx)
10472

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 10473 of file z3py.py.

10473 def __lt__(self, other):
10474 return fpLT(self, other, self.ctx)
10475

◆ __mod__()

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

Definition at line 10605 of file z3py.py.

10605 def __mod__(self, other):
10606 """Create the Z3 expression mod `self % other`."""
10607 return fpRem(self, other)
10608

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

10528 def __mul__(self, other):
10529 """Create the Z3 expression `self * other`.
10530
10531 >>> x = FP('x', FPSort(8, 24))
10532 >>> y = FP('y', FPSort(8, 24))
10533 >>> x * y
10534 x * y
10535 >>> (x * y).sort()
10536 FPSort(8, 24)
10537 >>> 10 * y
10538 1.25*(2**3) * y
10539 """
10540 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10541 return fpMul(_dflt_rm(), a, b, self.ctx)
10542

◆ __neg__()

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

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

Definition at line 10560 of file z3py.py.

10560 def __neg__(self):
10561 """Create the Z3 expression `-self`.
10562
10563 >>> x = FP('x', Float32())
10564 >>> -x
10565 -x
10566 """
10567 return fpNeg(self)
10568

◆ __pos__()

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

Definition at line 10556 of file z3py.py.

10556 def __pos__(self):
10557 """Create the Z3 expression `+self`."""
10558 return self
10559

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

10495 def __radd__(self, other):
10496 """Create the Z3 expression `other + self`.
10497
10498 >>> x = FP('x', FPSort(8, 24))
10499 >>> 10 + x
10500 1.25*(2**3) + x
10501 """
10502 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10503 return fpAdd(_dflt_rm(), a, b, self.ctx)
10504

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

10584 def __rdiv__(self, other):
10585 """Create the Z3 expression `other / self`.
10586
10587 >>> x = FP('x', FPSort(8, 24))
10588 >>> y = FP('y', FPSort(8, 24))
10589 >>> x / y
10590 x / y
10591 >>> x / 10
10592 x / 1.25*(2**3)
10593 """
10594 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10595 return fpDiv(_dflt_rm(), a, b, self.ctx)
10596

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

◆ __rmod__()

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

Definition at line 10609 of file z3py.py.

10609 def __rmod__(self, other):
10610 """Create the Z3 expression mod `other % self`."""
10611 return fpRem(other, self)
10612
10613

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

10543 def __rmul__(self, other):
10544 """Create the Z3 expression `other * self`.
10545
10546 >>> x = FP('x', FPSort(8, 24))
10547 >>> y = FP('y', FPSort(8, 24))
10548 >>> x * y
10549 x * y
10550 >>> x * 10
10551 x * 1.25*(2**3)
10552 """
10553 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10554 return fpMul(_dflt_rm(), a, b, self.ctx)
10555

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

10518 def __rsub__(self, other):
10519 """Create the Z3 expression `other - self`.
10520
10521 >>> x = FP('x', FPSort(8, 24))
10522 >>> 10 - x
10523 1.25*(2**3) - x
10524 """
10525 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10526 return fpSub(_dflt_rm(), a, b, self.ctx)
10527

◆ __rtruediv__()

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

Definition at line 10601 of file z3py.py.

10601 def __rtruediv__(self, other):
10602 """Create the Z3 expression division `other / self`."""
10603 return self.__rdiv__(other)
10604

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

10505 def __sub__(self, other):
10506 """Create the Z3 expression `self - other`.
10507
10508 >>> x = FP('x', FPSort(8, 24))
10509 >>> y = FP('y', FPSort(8, 24))
10510 >>> x - y
10511 x - y
10512 >>> (x - y).sort()
10513 FPSort(8, 24)
10514 """
10515 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10516 return fpSub(_dflt_rm(), a, b, self.ctx)
10517

◆ __truediv__()

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

Definition at line 10597 of file z3py.py.

10597 def __truediv__(self, other):
10598 """Create the Z3 expression division `self / other`."""
10599 return self.__div__(other)
10600

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 10466 of file z3py.py.

10466 def as_string(self):
10467 """Return a Z3 floating point expression as a Python string."""
10468 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
10469
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 10450 of file z3py.py.

10450 def ebits(self):
10451 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10452 >>> b = FPSort(8, 24)
10453 >>> b.ebits()
10454 8
10455 """
10456 return self.sort().ebits()
10457

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

10458 def sbits(self):
10459 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10460 >>> b = FPSort(8, 24)
10461 >>> b.sbits()
10462 24
10463 """
10464 return self.sort().sbits()
10465

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

10439 def sort(self):
10440 """Return the sort of the floating-point expression `self`.
10441
10442 >>> x = FP('1.0', FPSort(8, 24))
10443 >>> x.sort()
10444 FPSort(8, 24)
10445 >>> x.sort() == FPSort(8, 24)
10446 True
10447 """
10448 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
10449
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 10448 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(), FiniteSetSortRef.cast(), 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(), DatatypeRef.update_field(), ParamsRef.validate(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().