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 __gt__ (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 1618 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 1621 of file z3py.py.

1621  def cast(self, val):
1622  """Try to cast `val` as a Boolean.
1623 
1624  >>> x = BoolSort().cast(True)
1625  >>> x
1626  True
1627  >>> is_expr(x)
1628  True
1629  >>> is_expr(True)
1630  False
1631  >>> x.sort()
1632  Bool
1633  """
1634  if isinstance(val, bool):
1635  return BoolVal(val, self.ctx)
1636  if z3_debug():
1637  if not is_expr(val):
1638  msg = "True, False or Z3 Boolean expression expected. Received %s of type %s"
1639  _z3_assert(is_expr(val), msg % (val, type(val)))
1640  if not self.eq(val.sort()):
1641  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1642  return val
1643 
def BoolVal
Definition: z3py.py:1842
def eq(self, other)
Definition: z3py.py:431
def cast(self, val)
Definition: z3py.py:1621
def z3_debug()
Definition: z3py.py:70
def is_expr(a)
Definition: z3py.py:1345
def is_bool (   self)

Definition at line 1650 of file z3py.py.

1650  def is_bool(self):
1651  return True
1652 
1653 
def is_bool(self)
Definition: z3py.py:1650
def is_int (   self)

Definition at line 1647 of file z3py.py.

Referenced by ArithSortRef.subsort().

1647  def is_int(self):
1648  return True
1649 
def is_int(self)
Definition: z3py.py:1647
def subsort (   self,
  other 
)

Definition at line 1644 of file z3py.py.

1644  def subsort(self, other):
1645  return isinstance(other, ArithSortRef)
1646 
def subsort(self, other)
Definition: z3py.py:1644