Z3
Loading...
Searching...
No Matches
BoolRef Class Reference
Inheritance diagram for BoolRef:

Public Member Functions

 sort (self)
 __add__ (self, other)
 __radd__ (self, other)
 __rmul__ (self, other)
 __mul__ (self, other)
 __and__ (self, other)
 __or__ (self, other)
 __xor__ (self, other)
 __invert__ (self)
 py_value (self)
Public Member Functions inherited from ExprRef
 as_ast (self)
 get_id (self)
 sort_kind (self)
 __eq__ (self, other)
 __hash__ (self)
 __ne__ (self, other)
 params (self)
 decl (self)
 kind (self)
 num_args (self)
 arg (self, idx)
 children (self)
 update (self, *args)
 from_string (self, s)
 serialize (self)
Public Member Functions inherited from AstRef
 __init__ (self, ast, ctx=None)
 __del__ (self)
 __deepcopy__ (self, memo={})
 __str__ (self)
 __repr__ (self)
 __eq__ (self, other)
 __hash__ (self)
 __nonzero__ (self)
 __bool__ (self)
 sexpr (self)
 ctx_ref (self)
 eq (self, other)
 translate (self, target)
 __copy__ (self)
 hash (self)
Public Member Functions inherited from Z3PPObject
 use_pp (self)

Additional Inherited Members

Data Fields inherited from AstRef
 ast = ast
 ctx = _get_ctx(ctx)
Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)

Detailed Description

All Boolean expressions are instances of this class.

Definition at line 1660 of file z3py.py.

Member Function Documentation

◆ __add__()

__add__ ( self,
other )

Definition at line 1666 of file z3py.py.

1666 def __add__(self, other):
1667 if isinstance(other, BoolRef):
1668 other = If(other, 1, 0)
1669 return If(self, 1, 0) + other
1670

◆ __and__()

__and__ ( self,
other )

Definition at line 1688 of file z3py.py.

1688 def __and__(self, other):
1689 return And(self, other)
1690

◆ __invert__()

__invert__ ( self)

Definition at line 1697 of file z3py.py.

1697 def __invert__(self):
1698 return Not(self)
1699

◆ __mul__()

__mul__ ( self,
other )
Create the Z3 expression `self * other`.

Definition at line 1677 of file z3py.py.

1677 def __mul__(self, other):
1678 """Create the Z3 expression `self * other`.
1679 """
1680 if isinstance(other, int) and other == 1:
1681 return If(self, 1, 0)
1682 if isinstance(other, int) and other == 0:
1683 return IntVal(0, self.ctx)
1684 if isinstance(other, BoolRef):
1685 other = If(other, 1, 0)
1686 return If(self, other, 0)
1687

◆ __or__()

__or__ ( self,
other )

Definition at line 1691 of file z3py.py.

1691 def __or__(self, other):
1692 return Or(self, other)
1693

◆ __radd__()

__radd__ ( self,
other )

Definition at line 1671 of file z3py.py.

1671 def __radd__(self, other):
1672 return self + other
1673

◆ __rmul__()

__rmul__ ( self,
other )

Definition at line 1674 of file z3py.py.

1674 def __rmul__(self, other):
1675 return self * other
1676

◆ __xor__()

__xor__ ( self,
other )

Definition at line 1694 of file z3py.py.

1694 def __xor__(self, other):
1695 return Xor(self, other)
1696

◆ py_value()

py_value ( self)
Return a Python value that is equivalent to `self`.

Reimplemented from AstRef.

Definition at line 1700 of file z3py.py.

1700 def py_value(self):
1701 if is_true(self):
1702 return True
1703 if is_false(self):
1704 return False
1705 return None
1706
1707
1708

◆ sort()

sort ( self)
Return the sort of expression `self`.

>>> x = Int('x')
>>> (x + 1).sort()
Int
>>> y = Real('y')
>>> (x + y).sort()
Real

Reimplemented from ExprRef.

Reimplemented in QuantifierRef.

Definition at line 1663 of file z3py.py.

1663 def sort(self):
1664 return BoolSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
1665
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.