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

10328 def __add__(self, other):
10329 """Create the Z3 expression `self + other`.
10330
10331 >>> x = FP('x', FPSort(8, 24))
10332 >>> y = FP('y', FPSort(8, 24))
10333 >>> x + y
10334 x + y
10335 >>> (x + y).sort()
10336 FPSort(8, 24)
10337 """
10338 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10339 return fpAdd(_dflt_rm(), a, b, self.ctx)
10340

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

10415 def __div__(self, other):
10416 """Create the Z3 expression `self / other`.
10417
10418 >>> x = FP('x', FPSort(8, 24))
10419 >>> y = FP('y', FPSort(8, 24))
10420 >>> x / y
10421 x / y
10422 >>> (x / y).sort()
10423 FPSort(8, 24)
10424 >>> 10 / y
10425 1.25*(2**3) / y
10426 """
10427 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10428 return fpDiv(_dflt_rm(), a, b, self.ctx)
10429

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

◆ __ge__()

__ge__ (   self,
  other 
)

Definition at line 10322 of file z3py.py.

10322 def __ge__(self, other):
10323 return fpGEQ(self, other, self.ctx)
10324

◆ __gt__()

__gt__ (   self,
  other 
)

Definition at line 10325 of file z3py.py.

10325 def __gt__(self, other):
10326 return fpGT(self, other, self.ctx)
10327

◆ __le__()

__le__ (   self,
  other 
)

Definition at line 10316 of file z3py.py.

10316 def __le__(self, other):
10317 return fpLEQ(self, other, self.ctx)
10318

◆ __lt__()

__lt__ (   self,
  other 
)

Definition at line 10319 of file z3py.py.

10319 def __lt__(self, other):
10320 return fpLT(self, other, self.ctx)
10321

◆ __mod__()

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

Definition at line 10451 of file z3py.py.

10451 def __mod__(self, other):
10452 """Create the Z3 expression mod `self % other`."""
10453 return fpRem(self, other)
10454

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

10374 def __mul__(self, other):
10375 """Create the Z3 expression `self * other`.
10376
10377 >>> x = FP('x', FPSort(8, 24))
10378 >>> y = FP('y', FPSort(8, 24))
10379 >>> x * y
10380 x * y
10381 >>> (x * y).sort()
10382 FPSort(8, 24)
10383 >>> 10 * y
10384 1.25*(2**3) * y
10385 """
10386 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10387 return fpMul(_dflt_rm(), a, b, self.ctx)
10388

◆ __neg__()

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

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

Definition at line 10406 of file z3py.py.

10406 def __neg__(self):
10407 """Create the Z3 expression `-self`.
10408
10409 >>> x = FP('x', Float32())
10410 >>> -x
10411 -x
10412 """
10413 return fpNeg(self)
10414

◆ __pos__()

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

Definition at line 10402 of file z3py.py.

10402 def __pos__(self):
10403 """Create the Z3 expression `+self`."""
10404 return self
10405

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

10341 def __radd__(self, other):
10342 """Create the Z3 expression `other + self`.
10343
10344 >>> x = FP('x', FPSort(8, 24))
10345 >>> 10 + x
10346 1.25*(2**3) + x
10347 """
10348 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10349 return fpAdd(_dflt_rm(), a, b, self.ctx)
10350

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

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

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

◆ __rmod__()

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

Definition at line 10455 of file z3py.py.

10455 def __rmod__(self, other):
10456 """Create the Z3 expression mod `other % self`."""
10457 return fpRem(other, self)
10458
10459

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

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

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

10364 def __rsub__(self, other):
10365 """Create the Z3 expression `other - self`.
10366
10367 >>> x = FP('x', FPSort(8, 24))
10368 >>> 10 - x
10369 1.25*(2**3) - x
10370 """
10371 [a, b] = _coerce_fp_expr_list([other, self], self.ctx)
10372 return fpSub(_dflt_rm(), a, b, self.ctx)
10373

◆ __rtruediv__()

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

Definition at line 10447 of file z3py.py.

10447 def __rtruediv__(self, other):
10448 """Create the Z3 expression division `other / self`."""
10449 return self.__rdiv__(other)
10450

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

10351 def __sub__(self, other):
10352 """Create the Z3 expression `self - other`.
10353
10354 >>> x = FP('x', FPSort(8, 24))
10355 >>> y = FP('y', FPSort(8, 24))
10356 >>> x - y
10357 x - y
10358 >>> (x - y).sort()
10359 FPSort(8, 24)
10360 """
10361 [a, b] = _coerce_fp_expr_list([self, other], self.ctx)
10362 return fpSub(_dflt_rm(), a, b, self.ctx)
10363

◆ __truediv__()

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

Definition at line 10443 of file z3py.py.

10443 def __truediv__(self, other):
10444 """Create the Z3 expression division `self / other`."""
10445 return self.__div__(other)
10446

◆ as_string()

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

Reimplemented in FPNumRef.

Definition at line 10312 of file z3py.py.

10312 def as_string(self):
10313 """Return a Z3 floating point expression as a Python string."""
10314 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
10315
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 10296 of file z3py.py.

10296 def ebits(self):
10297 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10298 >>> b = FPSort(8, 24)
10299 >>> b.ebits()
10300 8
10301 """
10302 return self.sort().ebits()
10303

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

10304 def sbits(self):
10305 """Retrieves the number of bits reserved for the exponent in the FloatingPoint expression `self`.
10306 >>> b = FPSort(8, 24)
10307 >>> b.sbits()
10308 24
10309 """
10310 return self.sort().sbits()
10311

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

10285 def sort(self):
10286 """Return the sort of the floating-point expression `self`.
10287
10288 >>> x = FP('1.0', FPSort(8, 24))
10289 >>> x.sort()
10290 FPSort(8, 24)
10291 >>> x.sort() == FPSort(8, 24)
10292 True
10293 """
10294 return FPSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
10295
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 10294 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().