Z3
Loading...
Searching...
No Matches
SeqRef Class Reference
Inheritance diagram for SeqRef:

Public Member Functions

 sort (self)
 __add__ (self, other)
 __radd__ (self, other)
 __pow__ (self, other)
 __getitem__ (self, i)
 at (self, i)
 is_string (self)
 is_string_value (self)
 as_string (self)
 py_value (self)
 __le__ (self, other)
 __lt__ (self, other)
 __ge__ (self, other)
 __gt__ (self, other)
Public Member Functions inherited from ExprRef
 as_ast (self)
 get_id (self)
 sort_kind (self)
 __eq__ (self, other)
 __hash__ (self)
 __ne__ (self, other)
 params (self)
 decl (self)
 kind (self)
 num_args (self)
 arg (self, idx)
 children (self)
 update (self, *args)
 from_string (self, s)
 serialize (self)
Public Member Functions inherited from AstRef
 __init__ (self, ast, ctx=None)
 __del__ (self)
 __deepcopy__ (self, memo={})
 __str__ (self)
 __repr__ (self)
 __eq__ (self, other)
 __hash__ (self)
 __nonzero__ (self)
 __bool__ (self)
 sexpr (self)
 ctx_ref (self)
 eq (self, other)
 translate (self, target)
 __copy__ (self)
 hash (self)
Public Member Functions inherited from Z3PPObject
 use_pp (self)

Additional Inherited Members

Data Fields inherited from AstRef
 ast = ast
 ctx = _get_ctx(ctx)
Protected Member Functions inherited from Z3PPObject
 _repr_html_ (self)

Detailed Description

Sequence expression.

Definition at line 11639 of file z3py.py.

Member Function Documentation

◆ __add__()

__add__ ( self,
other )

Definition at line 11645 of file z3py.py.

11645 def __add__(self, other):
11646 return Concat(self, other)
11647

◆ __ge__()

__ge__ ( self,
other )

Definition at line 11687 of file z3py.py.

11687 def __ge__(self, other):
11688 return _to_expr_ref(Z3_mk_str_le(self.ctx_ref(), other.as_ast(), self.as_ast()), self.ctx)
11689
Z3_ast Z3_API Z3_mk_str_le(Z3_context c, Z3_ast prefix, Z3_ast s)
Check if s1 is equal or lexicographically strictly less than s2.

◆ __getitem__()

__getitem__ ( self,
i )

Definition at line 11654 of file z3py.py.

11654 def __getitem__(self, i):
11655 if _is_int(i):
11656 i = IntVal(i, self.ctx)
11657 return _to_expr_ref(Z3_mk_seq_nth(self.ctx_ref(), self.as_ast(), i.as_ast()), self.ctx)
11658
Z3_ast Z3_API Z3_mk_seq_nth(Z3_context c, Z3_ast s, Z3_ast index)
Retrieve from s the element positioned at position index. The function is under-specified if the inde...

◆ __gt__()

__gt__ ( self,
other )

Definition at line 11690 of file z3py.py.

11690 def __gt__(self, other):
11691 return _to_expr_ref(Z3_mk_str_lt(self.ctx_ref(), other.as_ast(), self.as_ast()), self.ctx)
11692
11693
Z3_ast Z3_API Z3_mk_str_lt(Z3_context c, Z3_ast prefix, Z3_ast s)
Check if s1 is lexicographically strictly less than s2.

◆ __le__()

__le__ ( self,
other )

Definition at line 11681 of file z3py.py.

11681 def __le__(self, other):
11682 return _to_expr_ref(Z3_mk_str_le(self.ctx_ref(), self.as_ast(), other.as_ast()), self.ctx)
11683

◆ __lt__()

__lt__ ( self,
other )

Definition at line 11684 of file z3py.py.

11684 def __lt__(self, other):
11685 return _to_expr_ref(Z3_mk_str_lt(self.ctx_ref(), self.as_ast(), other.as_ast()), self.ctx)
11686

◆ __pow__()

__pow__ ( self,
other )

Definition at line 11651 of file z3py.py.

11651 def __pow__(self, other):
11652 return SeqPower(self, other)
11653

◆ __radd__()

__radd__ ( self,
other )

Definition at line 11648 of file z3py.py.

11648 def __radd__(self, other):
11649 return Concat(other, self)
11650

◆ as_string()

as_string ( self)
Return a string representation of sequence expression.

Definition at line 11670 of file z3py.py.

11670 def as_string(self):
11671 """Return a string representation of sequence expression."""
11672 if self.is_string_value():
11673 string_length = ctypes.c_uint()
11674 chars = Z3_get_lstring(self.ctx_ref(), self.as_ast(), byref(string_length))
11675 return string_at(chars, size=string_length.value).decode("latin-1")
11676 return Z3_ast_to_string(self.ctx_ref(), self.as_ast())
11677
Z3_string Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a)
Convert the given AST node into a string.
Z3_char_ptr Z3_API Z3_get_lstring(Z3_context c, Z3_ast s, unsigned *length)
Retrieve the string constant stored in s. The string can contain escape sequences....

◆ at()

at ( self,
i )

Definition at line 11659 of file z3py.py.

11659 def at(self, i):
11660 if _is_int(i):
11661 i = IntVal(i, self.ctx)
11662 return SeqRef(Z3_mk_seq_at(self.ctx_ref(), self.as_ast(), i.as_ast()), self.ctx)
11663
Z3_ast Z3_API Z3_mk_seq_at(Z3_context c, Z3_ast s, Z3_ast index)
Retrieve from s the unit sequence positioned at position index. The sequence is empty if the index is...

◆ is_string()

is_string ( self)

Definition at line 11664 of file z3py.py.

11664 def is_string(self):
11665 return Z3_is_string_sort(self.ctx_ref(), Z3_get_sort(self.ctx_ref(), self.as_ast()))
11666
bool Z3_API Z3_is_string_sort(Z3_context c, Z3_sort s)
Check if s is a string sort.
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.

◆ is_string_value()

is_string_value ( self)

Definition at line 11667 of file z3py.py.

11667 def is_string_value(self):
11668 return Z3_is_string(self.ctx_ref(), self.as_ast())
11669
bool Z3_API Z3_is_string(Z3_context c, Z3_ast s)
Determine if s is a string constant.

◆ py_value()

py_value ( self)
Return a Python value that is equivalent to `self`.

Reimplemented from AstRef.

Definition at line 11678 of file z3py.py.

11678 def py_value(self):
11679 return self.as_string()
11680

◆ sort()

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

>>> x = Int('x')
>>> (x + 1).sort()
Int
>>> y = Real('y')
>>> (x + y).sort()
Real

Reimplemented from ExprRef.

Definition at line 11642 of file z3py.py.

11642 def sort(self):
11643 return SeqSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)
11644