Z3
Public Member Functions
BitVecRef Class Reference
+ Inheritance diagram for BitVecRef:

Public Member Functions

def sort (self)
 
def size (self)
 
def __add__ (self, other)
 
def __radd__ (self, other)
 
def __mul__ (self, other)
 
def __rmul__ (self, other)
 
def __sub__ (self, other)
 
def __rsub__ (self, other)
 
def __or__ (self, other)
 
def __ror__ (self, other)
 
def __and__ (self, other)
 
def __rand__ (self, other)
 
def __xor__ (self, other)
 
def __rxor__ (self, other)
 
def __pos__ (self)
 
def __neg__ (self)
 
def __invert__ (self)
 
def __div__ (self, other)
 
def __truediv__ (self, other)
 
def __rdiv__ (self, other)
 
def __rtruediv__ (self, other)
 
def __mod__ (self, other)
 
def __rmod__ (self, other)
 
def __le__ (self, other)
 
def __lt__ (self, other)
 
def __gt__ (self, other)
 
def __ge__ (self, other)
 
def __rshift__ (self, other)
 
def __lshift__ (self, other)
 
def __rrshift__ (self, other)
 
def __rlshift__ (self, other)
 
- Public Member Functions inherited from ExprRef
def as_ast (self)
 
def get_id (self)
 
def sort_kind (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __ne__ (self, other)
 
def params (self)
 
def decl (self)
 
def num_args (self)
 
def arg (self, idx)
 
def children (self)
 
def from_string (self, s)
 
def serialize (self)
 
- Public Member Functions inherited from AstRef
def __init__ (self, ast, ctx=None)
 
def __del__ (self)
 
def __deepcopy__ (self, memo={})
 
def __str__ (self)
 
def __repr__ (self)
 
def __nonzero__ (self)
 
def __bool__ (self)
 
def sexpr (self)
 
def ctx_ref (self)
 
def eq (self, other)
 
def translate (self, target)
 
def __copy__ (self)
 
def hash (self)
 
- Public Member Functions inherited from Z3PPObject
def use_pp (self)
 

Additional Inherited Members

- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

Bit-vector expressions.

Definition at line 3472 of file z3py.py.

Member Function Documentation

◆ __add__()

def __add__ (   self,
  other 
)
Create the Z3 expression `self + other`.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x + y
x + y
>>> (x + y).sort()
BitVec(32)

Definition at line 3497 of file z3py.py.

3497  def __add__(self, other):
3498  """Create the Z3 expression `self + other`.
3499 
3500  >>> x = BitVec('x', 32)
3501  >>> y = BitVec('y', 32)
3502  >>> x + y
3503  x + y
3504  >>> (x + y).sort()
3505  BitVec(32)
3506  """
3507  a, b = _coerce_exprs(self, other)
3508  return BitVecRef(Z3_mk_bvadd(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3509 

◆ __and__()

def __and__ (   self,
  other 
)
Create the Z3 expression bitwise-and `self & other`.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x & y
x & y
>>> (x & y).sort()
BitVec(32)

Definition at line 3589 of file z3py.py.

3589  def __and__(self, other):
3590  """Create the Z3 expression bitwise-and `self & other`.
3591 
3592  >>> x = BitVec('x', 32)
3593  >>> y = BitVec('y', 32)
3594  >>> x & y
3595  x & y
3596  >>> (x & y).sort()
3597  BitVec(32)
3598  """
3599  a, b = _coerce_exprs(self, other)
3600  return BitVecRef(Z3_mk_bvand(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3601 

◆ __div__()

def __div__ (   self,
  other 
)
Create the Z3 expression (signed) division `self / other`.

Use the function UDiv() for unsigned division.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x / y
x/y
>>> (x / y).sort()
BitVec(32)
>>> (x / y).sexpr()
'(bvsdiv x y)'
>>> UDiv(x, y).sexpr()
'(bvudiv x y)'

Definition at line 3666 of file z3py.py.

3666  def __div__(self, other):
3667  """Create the Z3 expression (signed) division `self / other`.
3668 
3669  Use the function UDiv() for unsigned division.
3670 
3671  >>> x = BitVec('x', 32)
3672  >>> y = BitVec('y', 32)
3673  >>> x / y
3674  x/y
3675  >>> (x / y).sort()
3676  BitVec(32)
3677  >>> (x / y).sexpr()
3678  '(bvsdiv x y)'
3679  >>> UDiv(x, y).sexpr()
3680  '(bvudiv x y)'
3681  """
3682  a, b = _coerce_exprs(self, other)
3683  return BitVecRef(Z3_mk_bvsdiv(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3684 

Referenced by BitVecRef.__truediv__(), and FPRef.__truediv__().

◆ __ge__()

def __ge__ (   self,
  other 
)
Create the Z3 expression (signed) `other >= self`.

Use the function UGE() for unsigned greater than or equal to.

>>> x, y = BitVecs('x y', 32)
>>> x >= y
x >= y
>>> (x >= y).sexpr()
'(bvsge x y)'
>>> UGE(x, y).sexpr()
'(bvuge x y)'

Definition at line 3796 of file z3py.py.

3796  def __ge__(self, other):
3797  """Create the Z3 expression (signed) `other >= self`.
3798 
3799  Use the function UGE() for unsigned greater than or equal to.
3800 
3801  >>> x, y = BitVecs('x y', 32)
3802  >>> x >= y
3803  x >= y
3804  >>> (x >= y).sexpr()
3805  '(bvsge x y)'
3806  >>> UGE(x, y).sexpr()
3807  '(bvuge x y)'
3808  """
3809  a, b = _coerce_exprs(self, other)
3810  return BoolRef(Z3_mk_bvsge(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3811 

◆ __gt__()

def __gt__ (   self,
  other 
)
Create the Z3 expression (signed) `other > self`.

Use the function UGT() for unsigned greater than.

>>> x, y = BitVecs('x y', 32)
>>> x > y
x > y
>>> (x > y).sexpr()
'(bvsgt x y)'
>>> UGT(x, y).sexpr()
'(bvugt x y)'

Definition at line 3780 of file z3py.py.

3780  def __gt__(self, other):
3781  """Create the Z3 expression (signed) `other > self`.
3782 
3783  Use the function UGT() for unsigned greater than.
3784 
3785  >>> x, y = BitVecs('x y', 32)
3786  >>> x > y
3787  x > y
3788  >>> (x > y).sexpr()
3789  '(bvsgt x y)'
3790  >>> UGT(x, y).sexpr()
3791  '(bvugt x y)'
3792  """
3793  a, b = _coerce_exprs(self, other)
3794  return BoolRef(Z3_mk_bvsgt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3795 

◆ __invert__()

def __invert__ (   self)
Create the Z3 expression bitwise-not `~self`.

>>> x = BitVec('x', 32)
>>> ~x
~x
>>> simplify(~(~x))
x

Definition at line 3655 of file z3py.py.

3655  def __invert__(self):
3656  """Create the Z3 expression bitwise-not `~self`.
3657 
3658  >>> x = BitVec('x', 32)
3659  >>> ~x
3660  ~x
3661  >>> simplify(~(~x))
3662  x
3663  """
3664  return BitVecRef(Z3_mk_bvnot(self.ctx_ref(), self.as_ast()), self.ctx)
3665 

◆ __le__()

def __le__ (   self,
  other 
)
Create the Z3 expression (signed) `other <= self`.

Use the function ULE() for unsigned less than or equal to.

>>> x, y = BitVecs('x y', 32)
>>> x <= y
x <= y
>>> (x <= y).sexpr()
'(bvsle x y)'
>>> ULE(x, y).sexpr()
'(bvule x y)'

Definition at line 3748 of file z3py.py.

3748  def __le__(self, other):
3749  """Create the Z3 expression (signed) `other <= self`.
3750 
3751  Use the function ULE() for unsigned less than or equal to.
3752 
3753  >>> x, y = BitVecs('x y', 32)
3754  >>> x <= y
3755  x <= y
3756  >>> (x <= y).sexpr()
3757  '(bvsle x y)'
3758  >>> ULE(x, y).sexpr()
3759  '(bvule x y)'
3760  """
3761  a, b = _coerce_exprs(self, other)
3762  return BoolRef(Z3_mk_bvsle(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3763 

◆ __lshift__()

def __lshift__ (   self,
  other 
)
Create the Z3 expression left shift `self << other`

>>> x, y = BitVecs('x y', 32)
>>> x << y
x << y
>>> (x << y).sexpr()
'(bvshl x y)'
>>> simplify(BitVecVal(2, 3) << 1)
4

Definition at line 3842 of file z3py.py.

3842  def __lshift__(self, other):
3843  """Create the Z3 expression left shift `self << other`
3844 
3845  >>> x, y = BitVecs('x y', 32)
3846  >>> x << y
3847  x << y
3848  >>> (x << y).sexpr()
3849  '(bvshl x y)'
3850  >>> simplify(BitVecVal(2, 3) << 1)
3851  4
3852  """
3853  a, b = _coerce_exprs(self, other)
3854  return BitVecRef(Z3_mk_bvshl(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3855 

◆ __lt__()

def __lt__ (   self,
  other 
)
Create the Z3 expression (signed) `other < self`.

Use the function ULT() for unsigned less than.

>>> x, y = BitVecs('x y', 32)
>>> x < y
x < y
>>> (x < y).sexpr()
'(bvslt x y)'
>>> ULT(x, y).sexpr()
'(bvult x y)'

Definition at line 3764 of file z3py.py.

3764  def __lt__(self, other):
3765  """Create the Z3 expression (signed) `other < self`.
3766 
3767  Use the function ULT() for unsigned less than.
3768 
3769  >>> x, y = BitVecs('x y', 32)
3770  >>> x < y
3771  x < y
3772  >>> (x < y).sexpr()
3773  '(bvslt x y)'
3774  >>> ULT(x, y).sexpr()
3775  '(bvult x y)'
3776  """
3777  a, b = _coerce_exprs(self, other)
3778  return BoolRef(Z3_mk_bvslt(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3779 

◆ __mod__()

def __mod__ (   self,
  other 
)
Create the Z3 expression (signed) mod `self % other`.

Use the function URem() for unsigned remainder, and SRem() for signed remainder.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x % y
x%y
>>> (x % y).sort()
BitVec(32)
>>> (x % y).sexpr()
'(bvsmod x y)'
>>> URem(x, y).sexpr()
'(bvurem x y)'
>>> SRem(x, y).sexpr()
'(bvsrem x y)'

Definition at line 3709 of file z3py.py.

3709  def __mod__(self, other):
3710  """Create the Z3 expression (signed) mod `self % other`.
3711 
3712  Use the function URem() for unsigned remainder, and SRem() for signed remainder.
3713 
3714  >>> x = BitVec('x', 32)
3715  >>> y = BitVec('y', 32)
3716  >>> x % y
3717  x%y
3718  >>> (x % y).sort()
3719  BitVec(32)
3720  >>> (x % y).sexpr()
3721  '(bvsmod x y)'
3722  >>> URem(x, y).sexpr()
3723  '(bvurem x y)'
3724  >>> SRem(x, y).sexpr()
3725  '(bvsrem x y)'
3726  """
3727  a, b = _coerce_exprs(self, other)
3728  return BitVecRef(Z3_mk_bvsmod(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3729 

◆ __mul__()

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

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x * y
x*y
>>> (x * y).sort()
BitVec(32)

Definition at line 3520 of file z3py.py.

3520  def __mul__(self, other):
3521  """Create the Z3 expression `self * other`.
3522 
3523  >>> x = BitVec('x', 32)
3524  >>> y = BitVec('y', 32)
3525  >>> x * y
3526  x*y
3527  >>> (x * y).sort()
3528  BitVec(32)
3529  """
3530  a, b = _coerce_exprs(self, other)
3531  return BitVecRef(Z3_mk_bvmul(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3532 

◆ __neg__()

def __neg__ (   self)
Return an expression representing `-self`.

>>> x = BitVec('x', 32)
>>> -x
-x
>>> simplify(-(-x))
x

Definition at line 3644 of file z3py.py.

3644  def __neg__(self):
3645  """Return an expression representing `-self`.
3646 
3647  >>> x = BitVec('x', 32)
3648  >>> -x
3649  -x
3650  >>> simplify(-(-x))
3651  x
3652  """
3653  return BitVecRef(Z3_mk_bvneg(self.ctx_ref(), self.as_ast()), self.ctx)
3654 

◆ __or__()

def __or__ (   self,
  other 
)
Create the Z3 expression bitwise-or `self | other`.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x | y
x | y
>>> (x | y).sort()
BitVec(32)

Definition at line 3566 of file z3py.py.

3566  def __or__(self, other):
3567  """Create the Z3 expression bitwise-or `self | other`.
3568 
3569  >>> x = BitVec('x', 32)
3570  >>> y = BitVec('y', 32)
3571  >>> x | y
3572  x | y
3573  >>> (x | y).sort()
3574  BitVec(32)
3575  """
3576  a, b = _coerce_exprs(self, other)
3577  return BitVecRef(Z3_mk_bvor(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3578 

◆ __pos__()

def __pos__ (   self)
Return `self`.

>>> x = BitVec('x', 32)
>>> +x
x

Definition at line 3635 of file z3py.py.

3635  def __pos__(self):
3636  """Return `self`.
3637 
3638  >>> x = BitVec('x', 32)
3639  >>> +x
3640  x
3641  """
3642  return self
3643 

◆ __radd__()

def __radd__ (   self,
  other 
)
Create the Z3 expression `other + self`.

>>> x = BitVec('x', 32)
>>> 10 + x
10 + x

Definition at line 3510 of file z3py.py.

3510  def __radd__(self, other):
3511  """Create the Z3 expression `other + self`.
3512 
3513  >>> x = BitVec('x', 32)
3514  >>> 10 + x
3515  10 + x
3516  """
3517  a, b = _coerce_exprs(self, other)
3518  return BitVecRef(Z3_mk_bvadd(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3519 

◆ __rand__()

def __rand__ (   self,
  other 
)
Create the Z3 expression bitwise-or `other & self`.

>>> x = BitVec('x', 32)
>>> 10 & x
10 & x

Definition at line 3602 of file z3py.py.

3602  def __rand__(self, other):
3603  """Create the Z3 expression bitwise-or `other & self`.
3604 
3605  >>> x = BitVec('x', 32)
3606  >>> 10 & x
3607  10 & x
3608  """
3609  a, b = _coerce_exprs(self, other)
3610  return BitVecRef(Z3_mk_bvand(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3611 

◆ __rdiv__()

def __rdiv__ (   self,
  other 
)
Create the Z3 expression (signed) division `other / self`.

Use the function UDiv() for unsigned division.

>>> x = BitVec('x', 32)
>>> 10 / x
10/x
>>> (10 / x).sexpr()
'(bvsdiv #x0000000a x)'
>>> UDiv(10, x).sexpr()
'(bvudiv #x0000000a x)'

Definition at line 3689 of file z3py.py.

3689  def __rdiv__(self, other):
3690  """Create the Z3 expression (signed) division `other / self`.
3691 
3692  Use the function UDiv() for unsigned division.
3693 
3694  >>> x = BitVec('x', 32)
3695  >>> 10 / x
3696  10/x
3697  >>> (10 / x).sexpr()
3698  '(bvsdiv #x0000000a x)'
3699  >>> UDiv(10, x).sexpr()
3700  '(bvudiv #x0000000a x)'
3701  """
3702  a, b = _coerce_exprs(self, other)
3703  return BitVecRef(Z3_mk_bvsdiv(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3704 

Referenced by BitVecRef.__rtruediv__(), and FPRef.__rtruediv__().

◆ __rlshift__()

def __rlshift__ (   self,
  other 
)
Create the Z3 expression left shift `other << self`.

Use the function LShR() for the right logical shift

>>> x = BitVec('x', 32)
>>> 10 << x
10 << x
>>> (10 << x).sexpr()
'(bvshl #x0000000a x)'

Definition at line 3870 of file z3py.py.

3870  def __rlshift__(self, other):
3871  """Create the Z3 expression left shift `other << self`.
3872 
3873  Use the function LShR() for the right logical shift
3874 
3875  >>> x = BitVec('x', 32)
3876  >>> 10 << x
3877  10 << x
3878  >>> (10 << x).sexpr()
3879  '(bvshl #x0000000a x)'
3880  """
3881  a, b = _coerce_exprs(self, other)
3882  return BitVecRef(Z3_mk_bvshl(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3883 
3884 

◆ __rmod__()

def __rmod__ (   self,
  other 
)
Create the Z3 expression (signed) mod `other % self`.

Use the function URem() for unsigned remainder, and SRem() for signed remainder.

>>> x = BitVec('x', 32)
>>> 10 % x
10%x
>>> (10 % x).sexpr()
'(bvsmod #x0000000a x)'
>>> URem(10, x).sexpr()
'(bvurem #x0000000a x)'
>>> SRem(10, x).sexpr()
'(bvsrem #x0000000a x)'

Definition at line 3730 of file z3py.py.

3730  def __rmod__(self, other):
3731  """Create the Z3 expression (signed) mod `other % self`.
3732 
3733  Use the function URem() for unsigned remainder, and SRem() for signed remainder.
3734 
3735  >>> x = BitVec('x', 32)
3736  >>> 10 % x
3737  10%x
3738  >>> (10 % x).sexpr()
3739  '(bvsmod #x0000000a x)'
3740  >>> URem(10, x).sexpr()
3741  '(bvurem #x0000000a x)'
3742  >>> SRem(10, x).sexpr()
3743  '(bvsrem #x0000000a x)'
3744  """
3745  a, b = _coerce_exprs(self, other)
3746  return BitVecRef(Z3_mk_bvsmod(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3747 

◆ __rmul__()

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

>>> x = BitVec('x', 32)
>>> 10 * x
10*x

Definition at line 3533 of file z3py.py.

3533  def __rmul__(self, other):
3534  """Create the Z3 expression `other * self`.
3535 
3536  >>> x = BitVec('x', 32)
3537  >>> 10 * x
3538  10*x
3539  """
3540  a, b = _coerce_exprs(self, other)
3541  return BitVecRef(Z3_mk_bvmul(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3542 

◆ __ror__()

def __ror__ (   self,
  other 
)
Create the Z3 expression bitwise-or `other | self`.

>>> x = BitVec('x', 32)
>>> 10 | x
10 | x

Definition at line 3579 of file z3py.py.

3579  def __ror__(self, other):
3580  """Create the Z3 expression bitwise-or `other | self`.
3581 
3582  >>> x = BitVec('x', 32)
3583  >>> 10 | x
3584  10 | x
3585  """
3586  a, b = _coerce_exprs(self, other)
3587  return BitVecRef(Z3_mk_bvor(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3588 

◆ __rrshift__()

def __rrshift__ (   self,
  other 
)
Create the Z3 expression (arithmetical) right shift `other` >> `self`.

Use the function LShR() for the right logical shift

>>> x = BitVec('x', 32)
>>> 10 >> x
10 >> x
>>> (10 >> x).sexpr()
'(bvashr #x0000000a x)'

Definition at line 3856 of file z3py.py.

3856  def __rrshift__(self, other):
3857  """Create the Z3 expression (arithmetical) right shift `other` >> `self`.
3858 
3859  Use the function LShR() for the right logical shift
3860 
3861  >>> x = BitVec('x', 32)
3862  >>> 10 >> x
3863  10 >> x
3864  >>> (10 >> x).sexpr()
3865  '(bvashr #x0000000a x)'
3866  """
3867  a, b = _coerce_exprs(self, other)
3868  return BitVecRef(Z3_mk_bvashr(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3869 

◆ __rshift__()

def __rshift__ (   self,
  other 
)
Create the Z3 expression (arithmetical) right shift `self >> other`

Use the function LShR() for the right logical shift

>>> x, y = BitVecs('x y', 32)
>>> x >> y
x >> y
>>> (x >> y).sexpr()
'(bvashr x y)'
>>> LShR(x, y).sexpr()
'(bvlshr x y)'
>>> BitVecVal(4, 3)
4
>>> BitVecVal(4, 3).as_signed_long()
-4
>>> simplify(BitVecVal(4, 3) >> 1).as_signed_long()
-2
>>> simplify(BitVecVal(4, 3) >> 1)
6
>>> simplify(LShR(BitVecVal(4, 3), 1))
2
>>> simplify(BitVecVal(2, 3) >> 1)
1
>>> simplify(LShR(BitVecVal(2, 3), 1))
1

Definition at line 3812 of file z3py.py.

3812  def __rshift__(self, other):
3813  """Create the Z3 expression (arithmetical) right shift `self >> other`
3814 
3815  Use the function LShR() for the right logical shift
3816 
3817  >>> x, y = BitVecs('x y', 32)
3818  >>> x >> y
3819  x >> y
3820  >>> (x >> y).sexpr()
3821  '(bvashr x y)'
3822  >>> LShR(x, y).sexpr()
3823  '(bvlshr x y)'
3824  >>> BitVecVal(4, 3)
3825  4
3826  >>> BitVecVal(4, 3).as_signed_long()
3827  -4
3828  >>> simplify(BitVecVal(4, 3) >> 1).as_signed_long()
3829  -2
3830  >>> simplify(BitVecVal(4, 3) >> 1)
3831  6
3832  >>> simplify(LShR(BitVecVal(4, 3), 1))
3833  2
3834  >>> simplify(BitVecVal(2, 3) >> 1)
3835  1
3836  >>> simplify(LShR(BitVecVal(2, 3), 1))
3837  1
3838  """
3839  a, b = _coerce_exprs(self, other)
3840  return BitVecRef(Z3_mk_bvashr(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3841 

◆ __rsub__()

def __rsub__ (   self,
  other 
)
Create the Z3 expression `other - self`.

>>> x = BitVec('x', 32)
>>> 10 - x
10 - x

Definition at line 3556 of file z3py.py.

3556  def __rsub__(self, other):
3557  """Create the Z3 expression `other - self`.
3558 
3559  >>> x = BitVec('x', 32)
3560  >>> 10 - x
3561  10 - x
3562  """
3563  a, b = _coerce_exprs(self, other)
3564  return BitVecRef(Z3_mk_bvsub(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3565 

◆ __rtruediv__()

def __rtruediv__ (   self,
  other 
)
Create the Z3 expression (signed) division `other / self`.

Definition at line 3705 of file z3py.py.

3705  def __rtruediv__(self, other):
3706  """Create the Z3 expression (signed) division `other / self`."""
3707  return self.__rdiv__(other)
3708 

◆ __rxor__()

def __rxor__ (   self,
  other 
)
Create the Z3 expression bitwise-xor `other ^ self`.

>>> x = BitVec('x', 32)
>>> 10 ^ x
10 ^ x

Definition at line 3625 of file z3py.py.

3625  def __rxor__(self, other):
3626  """Create the Z3 expression bitwise-xor `other ^ self`.
3627 
3628  >>> x = BitVec('x', 32)
3629  >>> 10 ^ x
3630  10 ^ x
3631  """
3632  a, b = _coerce_exprs(self, other)
3633  return BitVecRef(Z3_mk_bvxor(self.ctx_ref(), b.as_ast(), a.as_ast()), self.ctx)
3634 

◆ __sub__()

def __sub__ (   self,
  other 
)
Create the Z3 expression `self - other`.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x - y
x - y
>>> (x - y).sort()
BitVec(32)

Definition at line 3543 of file z3py.py.

3543  def __sub__(self, other):
3544  """Create the Z3 expression `self - other`.
3545 
3546  >>> x = BitVec('x', 32)
3547  >>> y = BitVec('y', 32)
3548  >>> x - y
3549  x - y
3550  >>> (x - y).sort()
3551  BitVec(32)
3552  """
3553  a, b = _coerce_exprs(self, other)
3554  return BitVecRef(Z3_mk_bvsub(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3555 

◆ __truediv__()

def __truediv__ (   self,
  other 
)
Create the Z3 expression (signed) division `self / other`.

Definition at line 3685 of file z3py.py.

3685  def __truediv__(self, other):
3686  """Create the Z3 expression (signed) division `self / other`."""
3687  return self.__div__(other)
3688 

◆ __xor__()

def __xor__ (   self,
  other 
)
Create the Z3 expression bitwise-xor `self ^ other`.

>>> x = BitVec('x', 32)
>>> y = BitVec('y', 32)
>>> x ^ y
x ^ y
>>> (x ^ y).sort()
BitVec(32)

Definition at line 3612 of file z3py.py.

3612  def __xor__(self, other):
3613  """Create the Z3 expression bitwise-xor `self ^ other`.
3614 
3615  >>> x = BitVec('x', 32)
3616  >>> y = BitVec('y', 32)
3617  >>> x ^ y
3618  x ^ y
3619  >>> (x ^ y).sort()
3620  BitVec(32)
3621  """
3622  a, b = _coerce_exprs(self, other)
3623  return BitVecRef(Z3_mk_bvxor(self.ctx_ref(), a.as_ast(), b.as_ast()), self.ctx)
3624 

◆ size()

def size (   self)
Return the number of bits of the bit-vector expression `self`.

>>> x = BitVec('x', 32)
>>> (x + 1).size()
32
>>> Concat(x, x).size()
64

Definition at line 3486 of file z3py.py.

3486  def size(self):
3487  """Return the number of bits of the bit-vector expression `self`.
3488 
3489  >>> x = BitVec('x', 32)
3490  >>> (x + 1).size()
3491  32
3492  >>> Concat(x, x).size()
3493  64
3494  """
3495  return self.sort().size()
3496 

Referenced by ParamDescrsRef.__len__(), Goal.__len__(), and BitVecNumRef.as_signed_long().

◆ sort()

def sort (   self)
Return the sort of the bit-vector expression `self`.

>>> x = BitVec('x', 32)
>>> x.sort()
BitVec(32)
>>> x.sort() == BitVecSort(32)
True

Reimplemented from ExprRef.

Definition at line 3475 of file z3py.py.

3475  def sort(self):
3476  """Return the sort of the bit-vector expression `self`.
3477 
3478  >>> x = BitVec('x', 32)
3479  >>> x.sort()
3480  BitVec(32)
3481  >>> x.sort() == BitVecSort(32)
3482  True
3483  """
3484  return BitVecSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
3485 
Z3_mk_bvmul
Z3_ast Z3_API Z3_mk_bvmul(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement multiplication.
Z3_mk_bvsle
Z3_ast Z3_API Z3_mk_bvsle(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed less than or equal to.
Z3_mk_bvashr
Z3_ast Z3_API Z3_mk_bvashr(Z3_context c, Z3_ast t1, Z3_ast t2)
Arithmetic shift right.
Z3_mk_bvsdiv
Z3_ast Z3_API Z3_mk_bvsdiv(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed division.
Z3_mk_bvsge
Z3_ast Z3_API Z3_mk_bvsge(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed greater than or equal to.
Z3_mk_bvor
Z3_ast Z3_API Z3_mk_bvor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise or.
Z3_mk_bvsgt
Z3_ast Z3_API Z3_mk_bvsgt(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed greater than.
Z3_mk_bvadd
Z3_ast Z3_API Z3_mk_bvadd(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement addition.
Z3_mk_bvnot
Z3_ast Z3_API Z3_mk_bvnot(Z3_context c, Z3_ast t1)
Bitwise negation.
Z3_mk_bvneg
Z3_ast Z3_API Z3_mk_bvneg(Z3_context c, Z3_ast t1)
Standard two's complement unary minus.
Z3_mk_bvshl
Z3_ast Z3_API Z3_mk_bvshl(Z3_context c, Z3_ast t1, Z3_ast t2)
Shift left.
Z3_mk_bvslt
Z3_ast Z3_API Z3_mk_bvslt(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed less than.
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.
Z3_mk_bvsmod
Z3_ast Z3_API Z3_mk_bvsmod(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed remainder (sign follows divisor).
Z3_mk_bvsub
Z3_ast Z3_API Z3_mk_bvsub(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement subtraction.
Z3_mk_bvand
Z3_ast Z3_API Z3_mk_bvand(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise and.
Z3_mk_bvxor
Z3_ast Z3_API Z3_mk_bvxor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise exclusive-or.