MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / BoolRef

Class BoolRef

lean_py/z3/core.py:395–430  ·  view source on GitHub ↗

Boolean / Prop expression.

Source from the content-addressed store, hash-verified

393
394
395class BoolRef(ExprRef):
396 """Boolean / Prop expression."""
397
398 __slots__ = ()
399
400 def __init__(
401 self,
402 ast: ASTNode,
403 vars: frozenset[tuple[str, ASTSort]] = frozenset(),
404 ) -> None:
405 super().__init__(ast, BoolSort(), vars)
406
407 def __and__(self, other: BoolRef) -> BoolRef:
408 return And(self, other)
409
410 def __or__(self, other: BoolRef) -> BoolRef:
411 return Or(self, other)
412
413 def __invert__(self) -> BoolRef:
414 return Not(self)
415
416 def __xor__(self, other: BoolRef) -> BoolRef:
417 return Xor(self, other)
418
419 # Bool→Int coercion: z3py converts b + 0 to If(b, 1, 0) + 0
420 def __add__(self, other: object) -> ArithRef:
421 return _bool_to_int(self).__add__(_coerce_arith_any(other))
422
423 def __radd__(self, other: object) -> ArithRef:
424 return _coerce_arith_any(other).__add__(_bool_to_int(self))
425
426 def __mul__(self, other: object) -> ArithRef:
427 return _bool_to_int(self).__mul__(_coerce_arith_any(other))
428
429 def __rmul__(self, other: object) -> ArithRef:
430 return _coerce_arith_any(other).__mul__(_bool_to_int(self))
431
432
433class ArithRef(ExprRef):

Callers 15

__eq__Method · 0.85
__ne__Method · 0.85
__abs__Method · 0.85
__lt__Method · 0.85
__le__Method · 0.85
__gt__Method · 0.85
__ge__Method · 0.85
__lt__Method · 0.85
__le__Method · 0.85
__gt__Method · 0.85
__ge__Method · 0.85
_wrap_exprFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected