mirror of
https://github.com/Z3Prover/z3
synced 2025-06-29 01:18:45 +00:00
initial warppers for seq-map/seq-fold
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f9176fb4b7
commit
fc6c4c98e2
5 changed files with 67 additions and 0 deletions
|
@ -11210,6 +11210,19 @@ def Length(s):
|
|||
s = _coerce_seq(s)
|
||||
return ArithRef(Z3_mk_seq_length(s.ctx_ref(), s.as_ast()), s.ctx)
|
||||
|
||||
def SeqMap(f, s):
|
||||
"""Map function 'f' over sequence 's'"""
|
||||
ctx = _get_ctx2(f, s)
|
||||
s = _coerce_seq(s, ctx)
|
||||
return _to_expr_ref(Z3_mk_seq_map(s.ctx_ref(), f.as_ast(), s.as_ast()), ctx)
|
||||
|
||||
def SeqMapI(f, i, s):
|
||||
"""Map function 'f' over sequence 's' at index 'i'"""
|
||||
ctx = _get_ctx(f, s)
|
||||
s = _coerce_seq(s, ctx)
|
||||
if not is_expr(i):
|
||||
i = _py2expr(i)
|
||||
return _to_expr_ref(Z3_mk_seq_mapi(s.ctx_ref(), f.as_ast(), i.as_ast(), s.as_ast()), ctx)
|
||||
|
||||
def StrToInt(s):
|
||||
"""Convert string expression to integer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue