-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Algebraic numbers, index problem #5807
Labels
Comments
You are the only user of this feature. I am afraid you would have to fix this on your own. |
janvrany
added a commit
to janvrany/z3
that referenced
this issue
Mar 8, 2022
In some cases, Z3_algebraic_get_i() returned 0. For example, in the following Python snippet, the last assert would fail: import z3 x = z3.Real('x') s = z3.Solver() s.add( (x * x) - 2 == 0, x <= 0) s.check() val_x = s.model().get_interp(x) assert val_x.index() == 1 The problem was that `algebraic_numbers::manager::imp::get_i()` did not check whether the root index was properly initialized. This commit fixes this issue by checking whether root index is initialized the same way various other routines do. Fixes issue Z3Prover#5807. Signed-off-by: Jan Vrany <jan.vrany@labware.com>
janvrany
added a commit
to janvrany/z3
that referenced
this issue
Mar 8, 2022
In some cases, Z3_algebraic_get_i() returned 0. For example, in the following Python snippet, the last assert would fail: import z3 x = z3.Real('x') s = z3.Solver() s.add( (x * x) - 2 == 0, x <= 0) s.check() val_x = s.model().get_interp(x) assert val_x.index() == 1 The problem was that `algebraic_numbers::manager::imp::get_i()` did not check whether the root index was properly initialized. This commit fixes this issue by checking whether root index is initialized the same way various other routines do. Fixes issue Z3Prover#5807. Signed-off-by: Jan Vrany <jan.vrany@labware.com>
Fix in PR #5888 should fix the problem. |
NikolajBjorner
pushed a commit
that referenced
this issue
Mar 17, 2022
…#5888) In some cases, Z3_algebraic_get_i() returned 0. For example, in the following Python snippet, the last assert would fail: import z3 x = z3.Real('x') s = z3.Solver() s.add( (x * x) - 2 == 0, x <= 0) s.check() val_x = s.model().get_interp(x) assert val_x.index() == 1 The problem was that `algebraic_numbers::manager::imp::get_i()` did not check whether the root index was properly initialized. This commit fixes this issue by checking whether root index is initialized the same way various other routines do. Fixes issue #5807. Signed-off-by: Jan Vrany <jan.vrany@labware.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I am experimenting with z3 in Python.
I am not sure, but it looks like the index() method of the AlgebraicNumRef class is not working properly:
the output is:
The polynomial defining the solutions is correct: polynomial$1x^2 + 0x -2 = 0$
But the two roots are both getting index 0.
The text was updated successfully, but these errors were encountered: