3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-05 05:00:23 +00:00
This commit is contained in:
Daniel Tang 2026-02-14 01:40:18 -05:00 committed by GitHub
commit 7a819233e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2804,6 +2804,17 @@ class ArithRef(ExprRef):
a, b = _coerce_exprs(self, other)
return BoolRef(Z3_mk_ge(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
def __abs__(self):
"""Return an expression representing `abs(self)`.
>>> x = Int('x')
>>> abs(x)
If(x > 0, x, -x)
>>> eq(abs(x), Abs(x))
True
"""
return Abs(self)
def is_arith(a):
"""Return `True` if `a` is an arithmetical expression.