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

z3py's Solver.check does not accept assumptions #46

Closed
Vlad-Shcherbina opened this issue Apr 20, 2015 · 1 comment
Closed

z3py's Solver.check does not accept assumptions #46

Vlad-Shcherbina opened this issue Apr 20, 2015 · 1 comment

Comments

@Vlad-Shcherbina
Copy link

>>> import z3
>>> solver = z3.Solver()
>>> x = z3.Int('x')
>>> solver.add(x == 0)
>>> solver.check()  # works
sat
>>> solver.check(x == 0)  # fails
WARNING: an assumption must be a propositional variable or the negation of one
unknown

I observed it both in binary release of 4.3.2 on windows with python 2.7 and in recent linux build of unstable branch at 6c1a539 with python 3.4.

@NikolajBjorner
Copy link
Contributor

Assumptions can only be propositional variables. So you have to create a propositional variable that is shorthand for the formula you assume.

from z3 import *
solver = z3.Solver()
x = z3.Int('x')
p = z3.Bool('p')
solver.add((x == 0) == p)
solver.check(p)

NikolajBjorner added a commit to NikolajBjorner/z3 that referenced this issue May 8, 2017
* local changes

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

* add bound extraction for variables

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

* adding fixed equality propagation

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

* adding fixed equality propagation

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

* adding fixed equality propagation

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

* adding bounds propagation

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

* add eager bounds propagation

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

* add configuration parameters for LP solver

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

* remove wrong assert

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

* fix wrong assert

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

* add timeout, signals to interface

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

* add stats

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

* getting rid of typename

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

* outline compound bound propagation functionality

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

* disable repropagation on pop

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

* add compound bound propagation code, remains disabled

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

* stronger ad-hoc bounds propagation

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

* stronger ad-hoc bounds propagation

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

* merge

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

* adding validation

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

* check assignments and conflicts

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

* check assignments and conflicts

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

* relax assertion check to take care of cancellation

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

* add debugging tracing to theory_lra to easier debug bounds propagation bug

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

* add debugging tracing to theory_lra to easier debug bounds propagation bug

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

* adding fixed numeric bounds to fixed value table for better fixed equality propagation

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

* add debugging to lra

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

* initial integration of opt

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

* fix bounds update in lra optimization

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

* simplify handling of objectives

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.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

2 participants