Z3
Public Member Functions
BoolSortRef Class Reference

Booleans. More...

+ Inheritance diagram for BoolSortRef:

Public Member Functions

def cast (self, val)
 
def subsort (self, other)
 
def is_int (self)
 
def is_bool (self)
 
- Public Member Functions inherited from SortRef
def as_ast (self)
 
def get_id (self)
 
def kind (self)
 
def subsort (self, other)
 
def cast (self, val)
 
def name (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (self)
 
- Public Member Functions inherited from AstRef
def __init__
 
def __del__ (self)
 
def __deepcopy__
 
def __str__ (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __nonzero__ (self)
 
def __bool__ (self)
 
def sexpr (self)
 
def as_ast (self)
 
def get_id (self)
 
def ctx_ref (self)
 
def eq (self, other)
 
def translate (self, target)
 
def __copy__ (self)
 
def hash (self)
 
def py_value (self)
 
- Public Member Functions inherited from Z3PPObject
def use_pp (self)
 

Additional Inherited Members

- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

Booleans.

Boolean sort.

Definition at line 1556 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 1559 of file z3py.py.

1559  def cast(self, val):
1560  """Try to cast `val` as a Boolean.
1561 
1562  >>> x = BoolSort().cast(True)
1563  >>> x
1564  True
1565  >>> is_expr(x)
1566  True
1567  >>> is_expr(True)
1568  False
1569  >>> x.sort()
1570  Bool
1571  """
1572  if isinstance(val, bool):
1573  return BoolVal(val, self.ctx)
1574  if z3_debug():
1575  if not is_expr(val):
1576  msg = "True, False or Z3 Boolean expression expected. Received %s of type %s"
1577  _z3_assert(is_expr(val), msg % (val, type(val)))
1578  if not self.eq(val.sort()):
1579  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1580  return val
1581 
def BoolVal
Definition: z3py.py:1780
def eq(self, other)
Definition: z3py.py:414
def cast(self, val)
Definition: z3py.py:1559
def z3_debug()
Definition: z3py.py:70
def is_expr(a)
Definition: z3py.py:1285
def is_bool (   self)

Definition at line 1588 of file z3py.py.

1588  def is_bool(self):
1589  return True
1590 
1591 
def is_bool(self)
Definition: z3py.py:1588
def is_int (   self)

Definition at line 1585 of file z3py.py.

Referenced by ArithSortRef.subsort().

1585  def is_int(self):
1586  return True
1587 
def is_int(self)
Definition: z3py.py:1585
def subsort (   self,
  other 
)

Definition at line 1582 of file z3py.py.

1582  def subsort(self, other):
1583  return isinstance(other, ArithSortRef)
1584 
def subsort(self, other)
Definition: z3py.py:1582