All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions
BoolSortRef Class Reference

Booleans. More...

+ Inheritance diagram for BoolSortRef:

Public Member Functions

def cast
- Public Member Functions inherited from SortRef
def as_ast
def kind
def subsort
def cast
def name
def __eq__
def __ne__
- Public Member Functions inherited from AstRef
def __init__
def __del__
def __str__
def __repr__
def sexpr
def as_ast
def ctx_ref
def eq
def translate
def hash
- Public Member Functions inherited from Z3PPObject
def use_pp

Additional Inherited Members

- Data Fields inherited from AstRef

Detailed Description


Boolean sort.

Definition at line 1122 of file z3py.py.

Member Function Documentation

def cast (   self,
Try to cast `val` as a Boolean.

>>> x = BoolSort().cast(True)
>>> x
>>> is_expr(x)
>>> is_expr(True)
>>> x.sort()

Definition at line 1124 of file z3py.py.

1125  def cast(self, val):
1126  """Try to cast `val` as a Boolean.
1128  >>> x = BoolSort().cast(True)
1129  >>> x
1130  True
1131  >>> is_expr(x)
1132  True
1133  >>> is_expr(True)
1134  False
1135  >>> x.sort()
1136  Bool
1137  """
1138  if isinstance(val, bool):
1139  return BoolVal(val, self.ctx)
1140  if __debug__:
1141  _z3_assert(is_expr(val), "True, False or Z3 Boolean expression expected")
1142  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1143  return val