8000 Python API: incorrect sort wrapper for "(seq.nth s i)" · Issue #2537 · Z3Prover/z3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Python API: incorrect sort wrapper for "(seq.nth s i)" #2537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
corwin-of-amber opened this issue Sep 5, 2019 · 0 comments
Closed

Python API: incorrect sort wrapper for "(seq.nth s i)" #2537

corwin-of-amber opened this issue Sep 5, 2019 · 0 comments

Comments

@corwin-of-amber
Copy link

The Python expression Const('s', SeqSort(IntSort()))[0] generates the correct expression AST, but wraps it with a SeqRef, while its actual sort is IntSort() (in general, the sort of the Seq's elements).

The following patch fixes it.

diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py
index 3a1f3d5fe..f8df8f003 100644
--- a/src/api/python/z3/z3.py
+++ b/src/api/python/z3/z3.py
@@ -9988,7 +9988,7 @@ class SeqRef(ExprRef):
     def __getitem__(self, i):
         if _is_int(i):
             i = IntVal(i, self.ctx)
-        return SeqRef(Z3_mk_seq_nth(self.ctx_ref(), self.as_ast(), i.as_ast()), self.ctx)
+        return _to_expr_ref(Z3_mk_seq_nth(self.ctx_ref(), self.as_ast(), i.as_ast()), self.ctx)
 
     def at(self, i):
         if _is_int(i):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0