Boolean / Prop expression.
| 393 | |
| 394 | |
| 395 | class 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 | |
| 433 | class ArithRef(ExprRef): |
no outgoing calls
no test coverage detected