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)
 
- Public Member Functions inherited from AstRef
def __init__ (self, ast, ctx=None)
 
def __del__ (self)
 
def __str__ (self)
 
def __repr__ (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 hash (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 1209 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 1211 of file z3py.py.

1211  def cast(self, val):
1212  """Try to cast `val` as a Boolean.
1213 
1214  >>> x = BoolSort().cast(True)
1215  >>> x
1216  True
1217  >>> is_expr(x)
1218  True
1219  >>> is_expr(True)
1220  False
1221  >>> x.sort()
1222  Bool
1223  """
1224  if isinstance(val, bool):
1225  return BoolVal(val, self.ctx)
1226  if __debug__:
1227  _z3_assert(is_expr(val), "True, False or Z3 Boolean expression expected")
1228  _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
1229  return val
1230 
def eq(self, other)
Definition: z3py.py:308
def cast(self, val)
Definition: z3py.py:1211
def BoolVal(val, ctx=None)
Definition: z3py.py:1363
def is_expr(a)
Definition: z3py.py:961
def is_bool (   self)

Definition at line 1237 of file z3py.py.

1237  def is_bool(self):
1238  return True
1239 
1240 
def is_bool(self)
Definition: z3py.py:1237
def is_int (   self)

Definition at line 1234 of file z3py.py.

Referenced by ArithSortRef.subsort().

1234  def is_int(self):
1235  return True
1236 
def is_int(self)
Definition: z3py.py:1234
def subsort (   self,
  other 
)

Definition at line 1231 of file z3py.py.

1231  def subsort(self, other):
1232  return isinstance(other, ArithSortRef)
1233 
def subsort(self, other)
Definition: z3py.py:1231