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

Booleans. More...

+ Inheritance diagram for BoolSortRef:

Public Member Functions

def cast
 
def subsort
 
def is_int
 
def is_bool
 
- Public Member Functions inherited from SortRef
def as_ast
 
def get_id
 
def kind
 
def subsort
 
def cast
 
def name
 
def __eq__
 
def __ne__
 
def __hash__
 
- Public Member Functions inherited from AstRef
def __init__
 
def __del__
 
def __deepcopy__
 
def __str__
 
def __repr__
 
def __eq__
 
def __hash__
 
def __nonzero__
 
def __bool__
 
def sexpr
 
def as_ast
 
def get_id
 
def ctx_ref
 
def eq
 
def translate
 
def __copy__
 
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 1360 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 1362 of file z3py.py.

1363  def cast(self, val):
1364  """Try to cast `val` as a Boolean.
1365 
1366  >>> x = BoolSort().cast(True)
1367  >>> x
1368  True
1369  >>> is_expr(x)
1370  True
1371  >>> is_expr(True)
1372  False
1373  >>> x.sort()
1374  Bool
1375  """
1376  if isinstance(val, bool):
1377  return BoolVal(val, self.ctx)
1378  if z3_debug():
1379  if not is_expr(val):
1380  _z3_assert(is_expr(val), "True, False or Z3 Boolean expression expected. Received %s" % val)
1381  if not self.eq(val.sort()):
1382  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1383  return val
def BoolVal
Definition: z3py.py:1540
def eq
Definition: z3py.py:356
def is_expr
Definition: z3py.py:1105
def z3_debug
Definition: z3py.py:58
def is_bool (   self)

Definition at line 1390 of file z3py.py.

1391  def is_bool(self):
1392  return True
1393 
def is_int (   self)

Definition at line 1387 of file z3py.py.

Referenced by ArithSortRef.subsort().

1388  def is_int(self):
1389  return True
def subsort (   self,
  other 
)

Definition at line 1384 of file z3py.py.

1385  def subsort(self, other):
1386  return isinstance(other, ArithSortRef)