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 | 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 | __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 | __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 4505 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 4535 of file z3py.py.

4535 def __getitem__(self, arg):
4536 """Return the Z3 expression `self[arg]`.
4537
4538 >>> a = Array('a', IntSort(), BoolSort())
4539 >>> i = Int('i')
4540 >>> a[i]
4541 a[i]
4542 >>> a[i].sexpr()
4543 '(select a i)'
4544 """
4545 arg = self.domain().cast(arg)
4546 return _to_expr_ref(Z3_mk_select(self.ctx_ref(), self.as_ast(), arg.as_ast()), self.ctx)
4547
z3py.IntSort
def IntSort(ctx=None)
Definition: z3py.py:3100
z3py.BoolSort
def BoolSort(ctx=None)
Definition: z3py.py:1655
z3py.Int
def Int(name, ctx=None)
Definition: z3py.py:3210
z3py.Array
def Array(name, dom, rng)
Definition: z3py.py:4678
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.

## ◆ default()

def default | ( |  | self | ) |

Definition at line 4548 of file z3py.py.

4548 def default(self):
4549 return _to_expr_ref(Z3_mk_array_default(self.ctx_ref(), self.as_ast()), self.ctx)
4550
4551
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 ...

## ◆ domain()

def domain | ( |  | self | ) |

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

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

Definition at line 4517 of file z3py.py.

4517 def domain(self):
4518 """Shorthand for `self.sort().domain()`.
4519
4520 >>> a = Array('a', IntSort(), BoolSort())
4521 >>> a.domain()
4522 Int
4523 """
4524 return self.sort().domain()
4525

Referenced by FuncDeclRef.__call__(), ArrayRef.__getitem__(), and ArrayRef.domain().

## ◆ range()

def range | ( |  | self | ) |

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

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

Definition at line 4526 of file z3py.py.

4526 def range(self):
4527 """Shorthand for `self.sort().range()`.
4528
4529 >>> a = Array('a', IntSort(), BoolSort())
4530 >>> a.range()
4531 Bool
4532 """
4533 return self.sort().range()
4534
z3::range
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:3725

Referenced by ArrayRef.range().

## ◆ 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 4508 of file z3py.py.

4508 def sort(self):
4509 """Return the array sort of the array expression `self`.
4510
4511 >>> a = Array('a', IntSort(), BoolSort())
4512 >>> a.sort()
4513 Array(Int, Bool)
4514 """
4515 return ArraySortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
4516
Z3_get_sort
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

Referenced by QuantifierRef.__getitem__(), FPNumRef.as_string(), ArrayRef.domain(), FPRef.ebits(), ArithRef.is_int(), ArithRef.is_real(), ArrayRef.range(), FPRef.sbits(), BitVecRef.size(), and ExprRef.sort_kind().