Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 2897 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 2912 of file z3py.py.

2913  def cast(self, val):
2914  """Try to cast `val` as a Bit-Vector.
2915 
2916  >>> b = BitVecSort(32)
2917  >>> b.cast(10)
2918  10
2919  >>> b.cast(10).sexpr()
2920  '#x0000000a'
2921  """
2922  if is_expr(val):
2923  if __debug__:
2924  _z3_assert(self.ctx == val.ctx, "Context mismatch")
2925  # Idea: use sign_extend if sort of val is a bitvector of smaller size
2926  return val
2927  else:
2928  return BitVecVal(val, self)
def BitVecVal
Definition: z3py.py:3449
def is_expr
Definition: z3py.py:950
def size (   self)
Return the size (number of bits) of the bit-vector sort `self`.

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

Definition at line 2900 of file z3py.py.

Referenced by BitVecNumRef.as_signed_long().

2901  def size(self):
2902  """Return the size (number of bits) of the bit-vector sort `self`.
2903 
2904  >>> b = BitVecSort(32)
2905  >>> b.size()
2906  32
2907  """
2908  return int(Z3_get_bv_sort_size(self.ctx_ref(), self.ast))
unsigned Z3_API Z3_get_bv_sort_size(__in Z3_context c, __in Z3_sort t)
Return the size of the given bit-vector sort.
def ctx_ref
Definition: z3py.py:305
def subsort (   self,
  other 
)

Definition at line 2909 of file z3py.py.

2910  def subsort(self, other):
2911  return is_bv_sort(other) and self.size() < other.size()
def is_bv_sort
Definition: z3py.py:2929

Field Documentation

ctx

Definition at line 2923 of file z3py.py.

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