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

Member Function Documentation

◆ __add__()

__add__ ( self,
other )

Definition at line 1598 of file z3py.py.

1598 def __add__(self, other):
1599 if isinstance(other, BoolRef):
1600 other = If(other, 1, 0)
1601 return If(self, 1, 0) + other
1602

◆ __and__()

__and__ ( self,
other )

Definition at line 1620 of file z3py.py.

1620 def __and__(self, other):
1621 return And(self, other)
1622

◆ __invert__()

__invert__ ( self)

Definition at line 1629 of file z3py.py.

1629 def __invert__(self):
1630 return Not(self)
1631

◆ __mul__()

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

Definition at line 1609 of file z3py.py.

1609 def __mul__(self, other):
1610 """Create the Z3 expression `self * other`.
1611 """
1612 if isinstance(other, int) and other == 1:
1613 return If(self, 1, 0)
1614 if isinstance(other, int) and other == 0:
1615 return IntVal(0, self.ctx)
1616 if isinstance(other, BoolRef):
1617 other = If(other, 1, 0)
1618 return If(self, other, 0)
1619

◆ __or__()

__or__ ( self,
other )

Definition at line 1623 of file z3py.py.

1623 def __or__(self, other):
1624 return Or(self, other)
1625

◆ __radd__()

__radd__ ( self,
other )

Definition at line 1603 of file z3py.py.

1603 def __radd__(self, other):
1604 return self + other
1605

◆ __rmul__()

__rmul__ ( self,
other )

Definition at line 1606 of file z3py.py.

1606 def __rmul__(self, other):
1607 return self * other
1608

◆ __xor__()

__xor__ ( self,
other )

Definition at line 1626 of file z3py.py.

1626 def __xor__(self, other):
1627 return Xor(self, other)
1628

◆ py_value()

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

Reimplemented from AstRef.

Definition at line 1632 of file z3py.py.

1632 def py_value(self):
1633 if is_true(self):
1634 return True
1635 if is_false(self):
1636 return False
1637 return None
1638
1639
1640

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

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