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

10343 def __add__(self, other):
10344 """Create the Z3 expression `self + other`.
10345
10346 >>> x = FP('x', FPSort(8, 24))
10347 >>> y = FP('y', FPSort(8, 24))
10348 >>> x + y
10349 x + y
10350 >>> (x + y).sort()
10351 FPSort(8, 24)
10352 """
10353 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10354 return fpAdd(_dflt_rm(), a, b, self.ctx)
10355

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

10430 def __div__(self, other):
10431 """Create the Z3 expression `self / other`.
10432
10433 >>> x = FP('x', FPSort(8, 24))
10434 >>> y = FP('y', FPSort(8, 24))
10435 >>> x / y
10436 x / y
10437 >>> (x / y).sort()
10438 FPSort(8, 24)
10439 >>> 10 / y
10440 1.25*(2**3) / y
10441 """
10442 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10443 return fpDiv(_dflt_rm(), a, b, self.ctx)
10444

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 10337 of file z3py.py.

10337 def __ge__(self, other):
10338 return fpGEQ(self, other, self.ctx)
10339

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 10340 of file z3py.py.

10340 def __gt__(self, other):
10341 return fpGT(self, other, self.ctx)
10342

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 10331 of file z3py.py.

10331 def __le__(self, other):
10332 return fpLEQ(self, other, self.ctx)
10333

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 10334 of file z3py.py.

10334 def __lt__(self, other):
10335 return fpLT(self, other, self.ctx)
10336

◆ __mod__()

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

Definition at line 10466 of file z3py.py.

10466 def __mod__(self, other):
10467 """Create the Z3 expression mod `self % other`."""
10468 return fpRem(self, other)
10469

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

10389 def __mul__(self, other):
10390 """Create the Z3 expression `self * other`.
10391
10392 >>> x = FP('x', FPSort(8, 24))
10393 >>> y = FP('y', FPSort(8, 24))
10394 >>> x * y
10395 x * y
10396 >>> (x * y).sort()
10397 FPSort(8, 24)
10398 >>> 10 * y
10399 1.25*(2**3) * y
10400 """
10401 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10402 return fpMul(_dflt_rm(), a, b, self.ctx)
10403

◆ __neg__()

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

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

Definition at line 10421 of file z3py.py.

10421 def __neg__(self):
10422 """Create the Z3 expression `-self`.
10423
10424 >>> x = FP('x', Float32())
10425 >>> -x
10426 -x
10427 """
10428 return fpNeg(self)
10429

◆ __pos__()

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

Definition at line 10417 of file z3py.py.

10417 def __pos__(self):
10418 """Create the Z3 expression `+self`."""
10419 return self
10420

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

10356 def __radd__(self, other):
10357 """Create the Z3 expression `other + self`.
10358
10359 >>> x = FP('x', FPSort(8, 24))
10360 >>> 10 + x
10361 1.25*(2**3) + x
10362 """
10363 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10364 return fpAdd(_dflt_rm(), a, b, self.ctx)
10365

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

10445 def __rdiv__(self, other):
10446 """Create the Z3 expression `other / self`.
10447
10448 >>> x = FP('x', FPSort(8, 24))
10449 >>> y = FP('y', FPSort(8, 24))
10450 >>> x / y
10451 x / y
10452 >>> x / 10
10453 x / 1.25*(2**3)
10454 """
10455 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10456 return fpDiv(_dflt_rm(), a, b, self.ctx)
10457

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

◆ __rmod__()

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

Definition at line 10470 of file z3py.py.

10470 def __rmod__(self, other):
10471 """Create the Z3 expression mod `other % self`."""
10472 return fpRem(other, self)
10473
10474

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

10404 def __rmul__(self, other):
10405 """Create the Z3 expression `other * self`.
10406
10407 >>> x = FP('x', FPSort(8, 24))
10408 >>> y = FP('y', FPSort(8, 24))
10409 >>> x * y
10410 x * y
10411 >>> x * 10
10412 x * 1.25*(2**3)
10413 """
10414 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10415 return fpMul(_dflt_rm(), a, b, self.ctx)
10416

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

10379 def __rsub__(self, other):
10380 """Create the Z3 expression `other - self`.
10381
10382 >>> x = FP('x', FPSort(8, 24))
10383 >>> 10 - x
10384 1.25*(2**3) - x
10385 """
10386 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10387 return fpSub(_dflt_rm(), a, b, self.ctx)
10388

◆ __rtruediv__()

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

Definition at line 10462 of file z3py.py.

10462 def __rtruediv__(self, other):
10463 """Create the Z3 expression division `other / self`."""
10464 return self.__rdiv__(other)
10465

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

10366 def __sub__(self, other):
10367 """Create the Z3 expression `self - other`.
10368
10369 >>> x = FP('x', FPSort(8, 24))
10370 >>> y = FP('y', FPSort(8, 24))
10371 >>> x - y
10372 x - y
10373 >>> (x - y).sort()
10374 FPSort(8, 24)
10375 """
10376 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10377 return fpSub(_dflt_rm(), a, b, self.ctx)
10378

◆ __truediv__()

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

Definition at line 10458 of file z3py.py.

10458 def __truediv__(self, other):
10459 """Create the Z3 expression division `self / other`."""
10460 return self.__div__(other)
10461

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 10327 of file z3py.py.

10327 def as_string(self):
10328 """Return a Z3 floating point expression as a Python string."""
10329 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
10330
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 10311 of file z3py.py.

10311 def ebits(self):
10312 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10313 >>> b = FPSort(8, 24)
10314 >>> b.ebits()
10315 8
10316 """
10317 return self.sort().ebits()
10318

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

10319 def sbits(self):
10320 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10321 >>> b = FPSort(8, 24)
10322 >>> b.sbits()
10323 24
10324 """
10325 return self.sort().sbits()
10326

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

10300 def sort(self):
10301 """Return the sort of the floating-point expression `self`.
10302
10303 >>> x = FP('1.0', FPSort(8, 24))
10304 >>> x.sort()
10305 FPSort(8, 24)
10306 >>> x.sort() == FPSort(8, 24)
10307 True
10308 """
10309 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
10310
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 10309 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().