Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Data Fields
BitVecSortRef Class Reference

Bit-Vectors. More...

+ Inheritance diagram for BitVecSortRef:

Public Member Functions

def size
 
def subsort
 
def cast
 
- Public Member Functions inherited from SortRef
def as_ast
 
def get_id
 
def kind
 
def subsort
 
def cast
 
def name
 
def __eq__
 
def __ne__
 
- Public Member Functions inherited from AstRef
def __init__
 
def __del__
 
def __str__
 
def __repr__
 
def sexpr
 
def as_ast
 
def get_id
 
def ctx_ref
 
def eq
 
def translate
 
def hash
 
- Public Member Functions inherited from Z3PPObject
def use_pp
 

Data Fields

 ctx
 
- Data Fields inherited from AstRef
 ast
 
 ctx
 

Detailed Description

Bit-Vectors.

Bit-vector sort.

Definition at line 2922 of file z3py.py.

Member Function Documentation

def cast (   self,
  val 
)
Try to cast `val` as a Bit-Vector.

>>> b = BitVecSort(32)
>>> b.cast(10)
10
>>> b.cast(10).sexpr()
'#x0000000a'

Definition at line 2937 of file z3py.py.

2938  def cast(self, val):
2939  """Try to cast `val` as a Bit-Vector.
2940 
2941  >>> b = BitVecSort(32)
2942  >>> b.cast(10)
2943  10
2944  >>> b.cast(10).sexpr()
2945  '#x0000000a'
2946  """
2947  if is_expr(val):
2948  if __debug__:
2949  _z3_assert(self.ctx == val.ctx, "Context mismatch")
2950  # Idea: use sign_extend if sort of val is a bitvector of smaller size
2951  return val
2952  else:
2953  return BitVecVal(val, self)
def BitVecVal
Definition: z3py.py:3474
def is_expr
Definition: z3py.py:961
def size (   self)
Return the size (number of bits) of the bit-vector sort `self`.

>>> b = BitVecSort(32)
>>> b.size()
32

Definition at line 2925 of file z3py.py.

2926  def size(self):
2927  """Return the size (number of bits) of the bit-vector sort `self`.
2928 
2929  >>> b = BitVecSort(32)
2930  >>> b.size()
2931  32
2932  """
2933  return int(Z3_get_bv_sort_size(self.ctx_ref(), self.ast))
unsigned Z3_API Z3_get_bv_sort_size(Z3_context c, Z3_sort t)
Return the size of the given bit-vector sort.
def ctx_ref
Definition: z3py.py:304
def subsort (   self,
  other 
)

Definition at line 2934 of file z3py.py.

2935  def subsort(self, other):
2936  return is_bv_sort(other) and self.size() < other.size()
def is_bv_sort
Definition: z3py.py:2954

Field Documentation

ctx

Definition at line 2948 of file z3py.py.

Referenced by Probe.__eq__(), Probe.__ge__(), ApplyResult.__getitem__(), Probe.__gt__(), Probe.__le__(), Probe.__lt__(), Probe.__ne__(), Fixedpoint.add_rule(), Optimize.add_soft(), Tactic.apply(), ApplyResult.as_expr(), Fixedpoint.assert_exprs(), ApplyResult.convert_model(), Fixedpoint.get_answer(), Fixedpoint.get_assertions(), Fixedpoint.get_cover_delta(), Fixedpoint.get_rules(), Optimize.model(), Fixedpoint.param_descrs(), Optimize.param_descrs(), Tactic.param_descrs(), Fixedpoint.parse_file(), Fixedpoint.parse_string(), Fixedpoint.query(), Fixedpoint.set(), Optimize.set(), Tactic.solver(), Fixedpoint.statistics(), Optimize.statistics(), Solver.to_smt2(), and Fixedpoint.update_rule().