Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
BoolSortRef Class Reference

Booleans. More...

+ Inheritance diagram for BoolSortRef:

Public Member Functions

def cast

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

Reimplemented from SortRef.

Definition at line 1200 of file z3py.py.

01200 
01201     def cast(self, val):
01202         """Try to cast `val` as a Boolean.
01203         
01204         >>> x = BoolSort().cast(True)
01205         >>> x
01206         True
01207         >>> is_expr(x)
01208         True
01209         >>> is_expr(True)
01210         False
01211         >>> x.sort()
01212         Bool
01213         """
01214         if isinstance(val, bool):
01215             return BoolVal(val, self.ctx)
01216         if __debug__:
01217             _z3_assert(is_expr(val), "True, False or Z3 Boolean expression expected")
01218             _z3_assert(self.eq(val.sort()), "Value cannot be converted into a Z3 Boolean value")
01219         return val

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines