Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 get_id
 
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 get_id
 
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
 ast
 
 ctx
 

Detailed Description

Booleans.

Boolean sort.

Definition at line 1198 of file z3py.py.

Member Function Documentation

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

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

Definition at line 1200 of file z3py.py.

1201  def cast(self, val):
1202  """Try to cast `val` as a Boolean.
1203 
1204  >>> x = BoolSort().cast(True)
1205  >>> x
1206  True
1207  >>> is_expr(x)
1208  True
1209  >>> is_expr(True)
1210  False
1211  >>> x.sort()
1212  Bool
1213  """
1214  if isinstance(val, bool):
1215  return BoolVal(val, self.ctx)
1216  if __debug__:
1217  _z3_assert(is_expr(val), "True, False or Z3 Boolean expression expected")
1218  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1219  return val
def BoolVal
Definition: z3py.py:1342
def eq
Definition: z3py.py:309
def is_expr
Definition: z3py.py:950