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)
 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 1613 of file z3py.py.

Member Function Documentation

◆ __add__()

__add__ ( self,
other )

Definition at line 1619 of file z3py.py.

1619 def __add__(self, other):
1620 if isinstance(other, BoolRef):
1621 other = If(other, 1, 0)
1622 return If(self, 1, 0) + other
1623

◆ __and__()

__and__ ( self,
other )

Definition at line 1641 of file z3py.py.

1641 def __and__(self, other):
1642 return And(self, other)
1643

◆ __invert__()

__invert__ ( self)

Definition at line 1650 of file z3py.py.

1650 def __invert__(self):
1651 return Not(self)
1652

◆ __mul__()

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

Definition at line 1630 of file z3py.py.

1630 def __mul__(self, other):
1631 """Create the Z3 expression `self * other`.
1632 """
1633 if isinstance(other, int) and other == 1:
1634 return If(self, 1, 0)
1635 if isinstance(other, int) and other == 0:
1636 return IntVal(0, self.ctx)
1637 if isinstance(other, BoolRef):
1638 other = If(other, 1, 0)
1639 return If(self, other, 0)
1640

◆ __or__()

__or__ ( self,
other )

Definition at line 1644 of file z3py.py.

1644 def __or__(self, other):
1645 return Or(self, other)
1646

◆ __radd__()

__radd__ ( self,
other )

Definition at line 1624 of file z3py.py.

1624 def __radd__(self, other):
1625 return self + other
1626

◆ __rmul__()

__rmul__ ( self,
other )

Definition at line 1627 of file z3py.py.

1627 def __rmul__(self, other):
1628 return self * other
1629

◆ __xor__()

__xor__ ( self,
other )

Definition at line 1647 of file z3py.py.

1647 def __xor__(self, other):
1648 return Xor(self, other)
1649

◆ py_value()

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

Reimplemented from AstRef.

Definition at line 1653 of file z3py.py.

1653 def py_value(self):
1654 if is_true(self):
1655 return True
1656 if is_false(self):
1657 return False
1658 return None
1659
1660
1661

◆ 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 1616 of file z3py.py.

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