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_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)
 
- 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

Array expressions. 

Definition at line 4285 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 4315 of file z3py.py.

4315  def __getitem__(self, arg):
4316  """Return the Z3 expression `self[arg]`.
4317 
4318  >>> a = Array('a', IntSort(), BoolSort())
4319  >>> i = Int('i')
4320  >>> a[i]
4321  a[i]
4322  >>> a[i].sexpr()
4323  '(select a i)'
4324  """
4325  arg = self.domain().cast(arg)
4326  return _to_expr_ref(Z3_mk_select(self.ctx_ref(), self.as_ast(), arg.as_ast()), self.ctx)
4327 

◆ default()

def default (   self)

Definition at line 4328 of file z3py.py.

4328  def default(self):
4329  return _to_expr_ref(Z3_mk_array_default(self.ctx_ref(), self.as_ast()), self.ctx)
4330 

◆ domain()

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

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

Definition at line 4297 of file z3py.py.

4297  def domain(self):
4298  """Shorthand for `self.sort().domain()`.
4299 
4300  >>> a = Array('a', IntSort(), BoolSort())
4301  >>> a.domain()
4302  Int
4303  """
4304  return self.sort().domain()
4305 

Referenced by ArrayRef.__getitem__().

◆ range()

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

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

Definition at line 4306 of file z3py.py.

4306  def range(self):
4307  """Shorthand for `self.sort().range()`.
4308 
4309  >>> a = Array('a', IntSort(), BoolSort())
4310  >>> a.range()
4311  Bool
4312  """
4313  return self.sort().range()
4314 

◆ sort()

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

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

Reimplemented from ExprRef.

Definition at line 4288 of file z3py.py.

4288  def sort(self):
4289  """Return the array sort of the array expression `self`.
4290 
4291  >>> a = Array('a', IntSort(), BoolSort())
4292  >>> a.sort()
4293  Array(Int, Bool)
4294  """
4295  return ArraySortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
4296 
Z3_mk_select
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.
z3::range
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:3515
Z3_mk_array_default
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 ...
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.