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

Public Member Functions

def sort (self)
 
def domain (self)
 
def range (self)
 
def __getitem__ (self, arg)
 
def default (self)
 
- Public Member Functions inherited from ExprRef
def as_ast (self)
 
def get_id (self)
 
def sort (self)
 
def sort_kind (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __ne__ (self, other)
 
def decl (self)
 
def num_args (self)
 
def arg (self, idx)
 
def children (self)
 
- Public Member Functions inherited from AstRef
def __init__ (self, ast, ctx=None)
 
def __del__ (self)
 
def __str__ (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __nonzero__ (self)
 
def __bool__ (self)
 
def sexpr (self)
 
def as_ast (self)
 
def get_id (self)
 
def ctx_ref (self)
 
def eq (self, other)
 
def translate (self, target)
 
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

Array expressions. 

Definition at line 3986 of file z3py.py.

Member Function Documentation

§ __getitem__()

def __getitem__ (   self,
  arg 
)
Return the Z3 expression `self[arg]`.

>>> a = Array('a', IntSort(), BoolSort())
>>> i = Int('i')
>>> a[i]
a[i]
>>> a[i].sexpr()
'(select a i)'

Definition at line 4016 of file z3py.py.

4016  def __getitem__(self, arg):
4017  """Return the Z3 expression `self[arg]`.
4018 
4019  >>> a = Array('a', IntSort(), BoolSort())
4020  >>> i = Int('i')
4021  >>> a[i]
4022  a[i]
4023  >>> a[i].sexpr()
4024  '(select a i)'
4025  """
4026  arg = self.domain().cast(arg)
4027  return _to_expr_ref(Z3_mk_select(self.ctx_ref(), self.as_ast(), arg.as_ast()), self.ctx)
4028 
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i)
Array read. The argument a is the array and i is the index of the array that gets read...

§ default()

def default (   self)

Definition at line 4029 of file z3py.py.

4029  def default(self):
4030  return _to_expr_ref(Z3_mk_array_default(self.ctx_ref(), self.as_ast()), self.ctx)
4031 
4032 
Z3_ast Z3_API Z3_mk_array_default(Z3_context c, Z3_ast array)
Access the array default value. Produces the default range value, for arrays that can be represented ...

§ domain()

def domain (   self)
Shorthand for `self.sort().domain()`.

>>> a = Array('a', IntSort(), BoolSort())
>>> a.domain()
Int

Definition at line 3998 of file z3py.py.

3998  def domain(self):
3999  """Shorthand for `self.sort().domain()`.
4000 
4001  >>> a = Array('a', IntSort(), BoolSort())
4002  >>> a.domain()
4003  Int
4004  """
4005  return self.sort().domain()
4006 

§ range()

def range (   self)
Shorthand for `self.sort().range()`.

>>> a = Array('a', IntSort(), BoolSort())
>>> a.range()
Bool

Definition at line 4007 of file z3py.py.

4007  def range(self):
4008  """Shorthand for `self.sort().range()`.
4009 
4010  >>> a = Array('a', IntSort(), BoolSort())
4011  >>> a.range()
4012  Bool
4013  """
4014  return self.sort().range()
4015 

§ sort()

def sort (   self)
Return the array sort of the array expression `self`.

>>> a = Array('a', IntSort(), BoolSort())
>>> a.sort()
Array(Int, Bool)

Definition at line 3989 of file z3py.py.

3989  def sort(self):
3990  """Return the array sort of the array expression `self`.
3991 
3992  >>> a = Array('a', IntSort(), BoolSort())
3993  >>> a.sort()
3994  Array(Int, Bool)
3995  """
3996  return ArraySortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
3997