A Sort is essentially a type. Every Z3 expression has a sort. A sort is an AST node.
Definition at line 558 of file z3py.py.
Try to cast `val` as an element of sort `self`.
This method is used in Z3Py to convert Python objects such as integers,
floats, longs and strings into Z3 expressions.
>>> x = Int('x')
>>> RealSort().cast(x)
ToReal(x)
Reimplemented in FPSortRef, BitVecSortRef, ArithSortRef, and BoolSortRef.
Definition at line 592 of file z3py.py.
593 """Try to cast `val` as an element of sort `self`.
595 This method is used in Z3Py to convert Python objects such as integers,
596 floats, longs and strings into Z3 expressions.
599 >>> RealSort().cast(x)
603 _z3_assert(
is_expr(val),
"Z3 expression expected")
604 _z3_assert(self.eq(val.sort()),
"Sort mismatch")
Return the Z3 internal kind of a sort.
This method can be used to test if `self` is one of the Z3 builtin sorts.
>>> b = BoolSort()
>>> b.kind() == Z3_BOOL_SORT
True
>>> b.kind() == Z3_INT_SORT
False
>>> A = ArraySort(IntSort(), IntSort())
>>> A.kind() == Z3_ARRAY_SORT
True
>>> A.kind() == Z3_INT_SORT
False
Definition at line 567 of file z3py.py.
568 """Return the Z3 internal kind of a sort.
569 This method can be used to test if `self` is one of the Z3 builtin sorts.
572 >>> b.kind() == Z3_BOOL_SORT
574 >>> b.kind() == Z3_INT_SORT
576 >>> A = ArraySort(IntSort(), IntSort())
577 >>> A.kind() == Z3_ARRAY_SORT
579 >>> A.kind() == Z3_INT_SORT
582 return _sort_kind(self.ctx, self.ast)
Referenced by ArithSortRef.is_int(), and ArithSortRef.is_real().