Skip to content
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

Assertion violation in PbEq with integer parameter #5829

Closed
dan-simon opened this issue Feb 9, 2022 · 0 comments
Closed

Assertion violation in PbEq with integer parameter #5829

dan-simon opened this issue Feb 9, 2022 · 0 comments

Comments

@dan-simon
Copy link

I'm using the Python z3 library and got the following error:

ASSERTION VIOLATION
File: ../src/ast/ast.cpp
Line: 414
UNEXPECTED CODE WAS REACHED.
Z3 4.8.14.0
Please file an issue with this message and more detail about how you encountered it at https://github.com/Z3Prover/z3/issues/new

via code which I managed to simplify to:

from z3 import Int, PbEq

x = Int('x')

PbEq([(x == 0, 1), (x == 1, 1), (x == 0, 1), (x, 1)], 0)

It seems like the issue with this code is x, which is an integer, being used as a boolean, and many small changes to this code (e.g. removing one of the first three terms, or doing PbEq([(x == 0, 1), (x == 0, 1), (x == 1, 1), (x, 1)], 0) instead) will instead give the error "invalid non-Boolean sort applied to 'at-most'". It appears, from a few tests, that "UNEXPECTED CODE WAS REACHED." only occurs when there are at least three items in the list passed to PbEq (in addition to the item (x, 1)), and, if there are exactly three other items, when no two consecutive items are the same.

I tried to look at the source but the issue seemed deep enough to be hard to find.

Z3 version: Z3 version 4.8.14 - 64 bit
Python version: Python 3.8.3
Operating system: macOS Big Sur (11.3)

NikolajBjorner added a commit that referenced this issue Feb 10, 2022
* fix #5829

* na

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* switch to vs 2022

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Adapted the example to the changes in the propagator

Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
NikolajBjorner added a commit that referenced this issue Feb 17, 2022
* user propagator without ids

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* user propagator without ids

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix signature

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* references #5818

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix c++ build

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* switch to vs 2022

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* switch 2022

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Update propagator example (I) (#5835)

* fix #5829

* na

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* switch to vs 2022

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Adapted the example to the changes in the propagator

Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* context goes out of scope in stack allocation, so can't used scoped context when passing objects around

* parameter check

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add rewriter

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Fixed bug in user-propagator "created" (#5843)

Co-authored-by: Clemens Eisenhofer <56730610+CEisenhofer@users.noreply.github.com>
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